Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(progress): ts type rename #337

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on v
color | String / Object / Array | '' | Typescript:`string \| Array<string> \| Record<string, string>` | N
label | String / Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
percentage | Number | 0 | \- | N
status | String | - | options: success/error/warning/active。Typescript:`StatusEnum` `type StatusEnum = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
status | String | - | options: success/error/warning/active。Typescript:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
stroke-width | String / Number | - | \- | N
theme | String | line | options: line/plump/circle。Typescript:`ThemeEnum` `type ThemeEnum = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
theme | String | line | options: line/plump/circle。Typescript:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
track-color | String | '' | \- | N
### Progress External Classes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场
color | String / Object / Array | '' | 进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']` 或 `{ '0%': '#f00', '100%': '#0ff' }` 或 `{ from: '#000', to: '#000' }` 等。TS 类型:`string \| Array<string> \| Record<string, string>` | N
label | String / Boolean / Slot | true | 进度百分比,可自定义。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
percentage | Number | 0 | 进度条百分比 | N
status | String | - | 进度条状态。可选项:success/error/warning/active。TS 类型:`StatusEnum` `type StatusEnum = 'success' \| 'error' \| 'warning' \| 'active'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
status | String | - | 进度条状态。可选项:success/error/warning/active。TS 类型:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
stroke-width | String / Number | - | 进度条线宽,默认单位 `px` | N
theme | String | line | 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间。可选项:line/plump/circle。TS 类型:`ThemeEnum` `type ThemeEnum = 'line' \| 'plump' \| 'circle'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
theme | String | line | 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间。可选项:line/plump/circle。TS 类型:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
track-color | String | '' | 进度条未完成部分颜色 | N
### Progress External Classes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const props: TdProgressProps = {
status: {
type: String,
},
/** 进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度 */
/** 进度条线宽,默认单位 `px` */
strokeWidth: {
type: null,
},
Expand Down
10 changes: 5 additions & 5 deletions packages/products/tdesign-miniprogram/src/progress/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export interface TdProgressProps {
*/
status?: {
type: StringConstructor;
value?: StatusEnum;
value?: ProgressStatus;
};
/**
* 进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度
* 进度条线宽,默认单位 `px`
*/
strokeWidth?: {
type: null;
Expand All @@ -57,7 +57,7 @@ export interface TdProgressProps {
*/
theme?: {
type: StringConstructor;
value?: ThemeEnum;
value?: ProgressTheme;
};
/**
* 进度条未完成部分颜色
Expand All @@ -69,6 +69,6 @@ export interface TdProgressProps {
};
}

export type StatusEnum = 'success' | 'error' | 'warning' | 'active';
export type ProgressStatus = 'success' | 'error' | 'warning' | 'active';

export type ThemeEnum = 'line' | 'plump' | 'circle';
export type ProgressTheme = 'line' | 'plump' | 'circle';
8 changes: 5 additions & 3 deletions packages/products/tdesign-mobile-react/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ReactElement, ReactNode, CSSProperties, FormEvent, DragEvent, Synthetic
// TElement 表示 API 只接受传入组件
export type TElement<T = undefined> = T extends undefined ? ReactElement : (props: T) => ReactElement;
// 1. TNode = ReactNode; 2. TNode<T> = (props: T) => ReactNode
export type TNode<T = undefined> = T extends undefined ? ReactNode : ReactNode | ((props: T) => ReactNode);
export type TNode<T = undefined> = T extends undefined ? ReactNode | (() => ReactNode) : ReactNode | ((props: T) => ReactNode);

export type AttachNodeReturnValue = HTMLElement | Element | Document;
export type AttachNode = CSSSelector | ((triggerNode?: HTMLElement) => AttachNodeReturnValue);
Expand Down Expand Up @@ -64,6 +64,8 @@ export type HorizontalAlignEnum = 'left' | 'center' | 'right';

export type VerticalAlignEnum = 'top' | 'middle' | 'bottom';

export type LayoutEnum = 'vertical' | 'horizontal';

export type ClassName = { [className: string]: any } | ClassName[] | string;

export type CSSSelector = string;
Expand Down Expand Up @@ -115,7 +117,7 @@ export type InfinityScroll = TScroll;

export interface ScrollToElementParams {
/** 跳转元素下标 */
index: number;
index?: number;
/** 跳转元素距离顶部的距离 */
top?: number;
/** 单个元素高度非固定场景下,即 isFixedRowHeight = false。延迟设置元素位置,一般用于依赖不同高度异步渲染等场景,单位:毫秒 */
Expand All @@ -124,5 +126,5 @@ export interface ScrollToElementParams {
}

export interface ComponentScrollToElementParams extends ScrollToElementParams {
key: string | number;
key?: string | number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdProgressProps } from './type';

export const progressDefaultProps: TdProgressProps = {
color: '',
label: true,
percentage: 0,
theme: 'line',
trackColor: '',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:: BASE_DOC ::

## API

### Progress Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
color | String / Object / Array | '' | Typescript:`string \| Array<string> \| Record<string, string>` | N
label | TNode | true | Typescript:`string \| boolean \| TNode`。[see more ts definition](https://github.com/TDesignOteam/tdesign-mobile-react/blob/develop/src/common.ts) | N
percentage | Number | 0 | \- | N
status | String | - | options: success/error/warning/active。Typescript:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/TDesignOteam/tdesign-mobile-react/tree/develop/src/progress/type.ts) | N
strokeWidth | String / Number | - | \- | N
theme | String | line | options: line/plump/circle。Typescript:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/TDesignOteam/tdesign-mobile-react/tree/develop/src/progress/type.ts) | N
trackColor | String | '' | \- | N
17 changes: 17 additions & 0 deletions packages/products/tdesign-mobile-react/src/progress/progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:: BASE_DOC ::

## API

### Progress Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
color | String / Object / Array | '' | 进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']` 或 `{ '0%': '#f00', '100%': '#0ff' }` 或 `{ from: '#000', to: '#000' }` 等。TS 类型:`string \| Array<string> \| Record<string, string>` | N
label | TNode | true | 进度百分比,可自定义。TS 类型:`string \| boolean \| TNode`。[通用类型定义](https://github.com/TDesignOteam/tdesign-mobile-react/blob/develop/src/common.ts) | N
percentage | Number | 0 | 进度条百分比 | N
status | String | - | 进度条状态。可选项:success/error/warning/active。TS 类型:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[详细类型定义](https://github.com/TDesignOteam/tdesign-mobile-react/tree/develop/src/progress/type.ts) | N
strokeWidth | String / Number | - | 进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度 | N
theme | String | line | 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间。可选项:line/plump/circle。TS 类型:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[详细类型定义](https://github.com/TDesignOteam/tdesign-mobile-react/tree/develop/src/progress/type.ts) | N
trackColor | String | '' | 进度条未完成部分颜色 | N
47 changes: 47 additions & 0 deletions packages/products/tdesign-mobile-react/src/progress/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TNode } from '../common';

export interface TdProgressProps {
/**
* 进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']` 或 `{ '0%': '#f00', '100%': '#0ff' }` 或 `{ from: '#000', to: '#000' }` 等
* @default ''
*/
color?: string | Array<string> | Record<string, string>;
/**
* 进度百分比,可自定义
* @default true
*/
label?: TNode;
/**
* 进度条百分比
* @default 0
*/
percentage?: number;
/**
* 进度条状态
*/
status?: ProgressStatus;
/**
* 进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度
*/
strokeWidth?: string | number;
/**
* 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间
* @default line
*/
theme?: ProgressTheme;
/**
* 进度条未完成部分颜色
* @default ''
*/
trackColor?: string;
}

export type ProgressStatus = 'success' | 'error' | 'warning' | 'active';

export type ProgressTheme = 'line' | 'plump' | 'circle';
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name | type | default | description | required
color | String / Object / Array | '' | Typescript:`string \| Array<string> \| Record<string, string>` | N
label | String / Boolean / Slot / Function | true | Typescript:`string \| boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
percentage | Number | 0 | \- | N
status | String | - | options: success/error/warning/active。Typescript:`StatusEnum` `type StatusEnum = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/progress/type.ts) | N
status | String | - | options: success/error/warning/active。Typescript:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/progress/type.ts) | N
strokeWidth | String / Number | - | \- | N
theme | String | line | options: line/plump/circle。Typescript:`ThemeEnum` `type ThemeEnum = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/progress/type.ts) | N
theme | String | line | options: line/plump/circle。Typescript:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/progress/type.ts) | N
trackColor | String | '' | \- | N
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
color | String / Object / Array | '' | 进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']` 或 `{ '0%': '#f00', '100%': '#0ff' }` 或 `{ from: '#000', to: '#000' }` 等。TS 类型:`string \| Array<string> \| Record<string, string>` | N
label | String / Boolean / Slot / Function | true | 进度百分比,可自定义。TS 类型:`string \| boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
percentage | Number | 0 | 进度条百分比 | N
status | String | - | 进度条状态。可选项:success/error/warning/active。TS 类型:`StatusEnum` `type StatusEnum = 'success' \| 'error' \| 'warning' \| 'active'`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/progress/type.ts) | N
status | String | - | 进度条状态。可选项:success/error/warning/active。TS 类型:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/progress/type.ts) | N
strokeWidth | String / Number | - | 进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度 | N
theme | String | line | 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间。可选项:line/plump/circle。TS 类型:`ThemeEnum` `type ThemeEnum = 'line' \| 'plump' \| 'circle'`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/progress/type.ts) | N
theme | String | line | 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间。可选项:line/plump/circle。TS 类型:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/progress/type.ts) | N
trackColor | String | '' | 进度条未完成部分颜色 | N
52 changes: 52 additions & 0 deletions packages/products/tdesign-mobile-vue/src/progress/props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdProgressProps } from './type';
import { PropType } from 'vue';

export default {
/** 进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']` 或 `{ '0%': '#f00', '100%': '#0ff' }` 或 `{ from: '#000', to: '#000' }` 等 */
color: {
type: [String, Object, Array] as PropType<TdProgressProps['color']>,
default: '',
},
/** 进度百分比,可自定义 */
label: {
type: [String, Boolean, Function] as PropType<TdProgressProps['label']>,
default: true,
},
/** 进度条百分比 */
percentage: {
type: Number,
default: 0,
},
/** 进度条状态 */
status: {
type: String as PropType<TdProgressProps['status']>,
validator(val: TdProgressProps['status']): boolean {
if (!val) return true;
return ['success', 'error', 'warning', 'active'].includes(val);
},
},
/** 进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度 */
strokeWidth: {
type: [String, Number] as PropType<TdProgressProps['strokeWidth']>,
},
/** 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间 */
theme: {
type: String as PropType<TdProgressProps['theme']>,
default: 'line' as TdProgressProps['theme'],
validator(val: TdProgressProps['theme']): boolean {
if (!val) return true;
return ['line', 'plump', 'circle'].includes(val);
},
},
/** 进度条未完成部分颜色 */
trackColor: {
type: String,
default: '',
},
};
47 changes: 47 additions & 0 deletions packages/products/tdesign-mobile-vue/src/progress/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TNode } from '../common';

export interface TdProgressProps {
/**
* 进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']` 或 `{ '0%': '#f00', '100%': '#0ff' }` 或 `{ from: '#000', to: '#000' }` 等
* @default ''
*/
color?: string | Array<string> | Record<string, string>;
/**
* 进度百分比,可自定义
* @default true
*/
label?: string | boolean | TNode;
/**
* 进度条百分比
* @default 0
*/
percentage?: number;
/**
* 进度条状态
*/
status?: ProgressStatus;
/**
* 进度条线宽。宽度数值不能超过 size 的一半,否则不能输出环形进度
*/
strokeWidth?: string | number;
/**
* 进度条风格。值为 line,标签(label)显示在进度条右侧;值为 plump,标签(label)显示在进度条里面;值为 circle,标签(label)显示在进度条正中间
* @default line
*/
theme?: ProgressTheme;
/**
* 进度条未完成部分颜色
* @default ''
*/
trackColor?: string;
}

export type ProgressStatus = 'success' | 'error' | 'warning' | 'active';

export type ProgressTheme = 'line' | 'plump' | 'circle';
14 changes: 14 additions & 0 deletions packages/products/tdesign-react/src/progress/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdProgressProps } from './type';

export const progressDefaultProps: TdProgressProps = {
color: '',
label: true,
percentage: 0,
size: 'medium',
theme: 'line',
trackColor: '',
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
color | String / Object / Array | '' | Typescript:`string \| Array<string> \| Record<string, string>` | N
label | TNode | true | Typescript:`string \| boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
percentage | Number | 0 | \- | N
size | String / Number | 'medium' | \- | N
status | String | - | optionssuccess/error/warning/active。Typescript:`StatusEnum` `type StatusEnum = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/progress/type.ts) | N
status | String | - | options: success/error/warning/active。Typescript:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/progress/type.ts) | N
strokeWidth | String / Number | - | \- | N
theme | String | line | optionsline/plump/circle。Typescript:`ThemeEnum` `type ThemeEnum = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/progress/type.ts) | N
theme | String | line | options: line/plump/circle。Typescript:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/progress/type.ts) | N
trackColor | String | '' | \- | N
Loading
Loading