diff --git a/src/affix/affix.en-US.md b/src/affix/affix.en-US.md
index 030007a0e8..eecfa9bd79 100644
--- a/src/affix/affix.en-US.md
+++ b/src/affix/affix.en-US.md
@@ -10,7 +10,7 @@ style | Object | - | 样式,Typescript:`React.CSSProperties` | N
children | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
container | String / Function | () => (() => window) | Typescript:`ScrollContainer`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
content | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-offsetBottom | Number | 0 | When the distance from the bottom of the container reaches the specified distance, the trigger is fixed | N
-offsetTop | Number | 0 | When the distance from the top of the container reaches the specified distance, the trigger is fixed | N
+offsetBottom | Number | 0 | \- | N
+offsetTop | Number | 0 | \- | N
zIndex | Number | - | \- | N
onFixedChange | Function | | Typescript:`(affixed: boolean, context: { top: number }) => void`
| N
diff --git a/src/affix/defaultProps.ts b/src/affix/defaultProps.ts
index 254e262a4b..20c86fd884 100644
--- a/src/affix/defaultProps.ts
+++ b/src/affix/defaultProps.ts
@@ -4,4 +4,4 @@
import { TdAffixProps } from './type';
-export const affixDefaultProps: TdAffixProps = { container: () => window, offsetBottom: 0, offsetTop: 0 };
+export const affixDefaultProps: TdAffixProps = { container: '() => (() => window)', offsetBottom: 0, offsetTop: 0 };
diff --git a/src/affix/type.ts b/src/affix/type.ts
index 54e8546986..4815a199be 100644
--- a/src/affix/type.ts
+++ b/src/affix/type.ts
@@ -13,7 +13,7 @@ export interface TdAffixProps {
children?: TNode;
/**
* 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body
- * @default () => window
+ * @default () => (() => window)
*/
container?: ScrollContainer;
/**
@@ -21,12 +21,12 @@ export interface TdAffixProps {
*/
content?: TNode;
/**
- * 距离容器底部达到指定距离后触发固定
+ * 距离容器顶部达到指定距离后触发固定
* @default 0
*/
offsetBottom?: number;
/**
- * 距离容器顶部达到指定距离后触发固定
+ * 距离容器底部达到指定距离后触发固定
* @default 0
*/
offsetTop?: number;
diff --git a/src/alert/alert.md b/src/alert/alert.md
index 7a110b422c..7406f83517 100644
--- a/src/alert/alert.md
+++ b/src/alert/alert.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Alert Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/anchor/anchor.en-US.md b/src/anchor/anchor.en-US.md
index 64f0b9c8b8..b6110351eb 100644
--- a/src/anchor/anchor.en-US.md
+++ b/src/anchor/anchor.en-US.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Anchor Props
name | type | default | description | required
@@ -9,10 +10,9 @@ className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
affixProps | Object | - | Typescript:`Omit`,[Affix API Documents](./affix?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/anchor/type.ts) | N
bounds | Number | 5 | \- | N
-container | String / Function | () => window | Typescript:`ScrollContainer`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+container | String / Function | () => (() => window) | Typescript:`ScrollContainer`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
cursor | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-getCurrentAnchor | Function | - | Custom Highlighted Anchor Points。Typescript:`(activeLink: string) => string` | N
-size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+size | String | medium | options:small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
targetOffset | Number | 0 | \- | N
onChange | Function | | Typescript:`(currentLink: string, prevLink: string) => void`
| N
onClick | Function | | Typescript:`(link: { href: string; title: string; e: MouseEvent }) => void`
| N
@@ -24,7 +24,7 @@ name | type | default | description | required
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
href | String | - | required | Y
-target | String | _self | options: _self/_blank/_parent/_top | N
+target | String | _self | options:_self/_blank/_parent/_top | N
title | TNode | '' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
### AnchorTarget Props
diff --git a/src/anchor/anchor.md b/src/anchor/anchor.md
index c613d357ca..208c8c5fb8 100644
--- a/src/anchor/anchor.md
+++ b/src/anchor/anchor.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Anchor Props
名称 | 类型 | 默认值 | 说明 | 必传
@@ -9,9 +10,8 @@ className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
affixProps | Object | - | 透传 Affix 组件属性,即让 Anchor 组件支持所有 Affix 组件特性。TS 类型:`Omit`,[Affix API Documents](./affix?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/anchor/type.ts) | N
bounds | Number | 5 | 锚点区域边界 | N
-container | String / Function | () => window | 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`ScrollContainer`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+container | String / Function | () => (() => window) | 指定滚动的容器。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`ScrollContainer`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
cursor | TElement | - | 用于自定义选中项左侧游标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-getCurrentAnchor | Function | - | 自定义高亮的锚点 。TS 类型:`(activeLink: string) => string` | N
size | String | medium | 组件尺寸,small(120px),medium(200px),large(320px)。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
targetOffset | Number | 0 | 锚点滚动偏移量 | N
onChange | Function | | TS 类型:`(currentLink: string, prevLink: string) => void`
锚点改变时触发 | N
diff --git a/src/auto-complete/auto-complete.en-US.md b/src/auto-complete/auto-complete.en-US.md
index e2d32bb536..5af736b84c 100644
--- a/src/auto-complete/auto-complete.en-US.md
+++ b/src/auto-complete/auto-complete.en-US.md
@@ -29,7 +29,7 @@ triggerElement | TNode | - | Typescript:`string \| TNode`。[see more ts defin
value | String | - | \- | N
defaultValue | String | - | uncontrolled property | N
onBlur | Function | | Typescript:`(context: { e: FocusEvent; value: string }) => void`
| N
-onChange | Function | | Typescript:`(value: string, context?: { e?: InputEvent \| MouseEvent \| CompositionEvent \| KeyboardEvent }) => void`
| N
+onChange | Function | | Typescript:`(value: string, context?: { e?: InputEvent \| MouseEvent \| KeyboardEvent }) => void`
| N
onClear | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
onCompositionend | Function | | Typescript:`(context: { e: CompositionEvent; value: string }) => void`
trigger on compositionend | N
onCompositionstart | Function | | Typescript:`(context: { e: CompositionEvent; value: string }) => void`
trigger on compositionstart | N
diff --git a/src/auto-complete/auto-complete.md b/src/auto-complete/auto-complete.md
index a6e6ca744b..5fc1ece72c 100644
--- a/src/auto-complete/auto-complete.md
+++ b/src/auto-complete/auto-complete.md
@@ -29,7 +29,7 @@ triggerElement | TNode | - | 触发显示联想词下拉框的元素,默认为
value | String | - | 输入框的值,即当前指定的联想词 | N
defaultValue | String | - | 输入框的值,即当前指定的联想词。非受控属性 | N
onBlur | Function | | TS 类型:`(context: { e: FocusEvent; value: string }) => void`
失去焦点时触发 | N
-onChange | Function | | TS 类型:`(value: string, context?: { e?: InputEvent \| MouseEvent \| CompositionEvent \| KeyboardEvent }) => void`
输入框值发生变化时触发 | N
+onChange | Function | | TS 类型:`(value: string, context?: { e?: InputEvent \| MouseEvent \| KeyboardEvent }) => void`
输入框值发生变化时触发 | N
onClear | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
清空按钮点击时触发 | N
onCompositionend | Function | | TS 类型:`(context: { e: CompositionEvent; value: string }) => void`
中文输入结束时触发 | N
onCompositionstart | Function | | TS 类型:`(context: { e: CompositionEvent; value: string }) => void`
中文输入开始时触发 | N
diff --git a/src/auto-complete/type.ts b/src/auto-complete/type.ts
index 6fea8b877a..8bfc889e4e 100644
--- a/src/auto-complete/type.ts
+++ b/src/auto-complete/type.ts
@@ -110,9 +110,7 @@ export interface TdAutoCompleteProps | MouseEvent | CompositionEvent | KeyboardEvent;
- },
+ context?: { e?: FormEvent | MouseEvent | KeyboardEvent },
) => void;
/**
* 清空按钮点击时触发
@@ -121,11 +119,11 @@ export interface TdAutoCompleteProps; value: string }) => void;
+ onCompositionend?: (context: { e: CompositionEvent; value: string }) => void;
/**
* 中文输入开始时触发
*/
- onCompositionstart?: (context: { e: CompositionEvent; value: string }) => void;
+ onCompositionstart?: (context: { e: CompositionEvent; value: string }) => void;
/**
* 回车键按下时触发
*/
@@ -137,7 +135,7 @@ export interface TdAutoCompleteProps | KeyboardEvent }) => void;
+ onSelect?: (value: string, context: { e: MouseEvent | KeyboardEvent }) => void;
}
export type AutoCompleteOption = string | AutoCompleteOptionObj;
diff --git a/src/avatar/avatar.en-US.md b/src/avatar/avatar.en-US.md
index a2ddd048d0..8a5ea6132b 100644
--- a/src/avatar/avatar.en-US.md
+++ b/src/avatar/avatar.en-US.md
@@ -16,7 +16,7 @@ image | String | - | images url | N
imageProps | Object | - | Typescript:`ImageProps`,[Image API Documents](./image?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
shape | String | circle | shape。options:circle/round。Typescript:`ShapeEnum ` `type ShapeEnum = 'circle' \| 'round'`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
size | String | - | size | N
-onError | Function | | Typescript:`(context: { e: ImageEvent }) => void`
trigger on image load failed | N
+onError | Function | | Typescript:`(context: { e: Event }) => void`
trigger on image load failed | N
### AvatarGroup Props
@@ -27,5 +27,6 @@ style | Object | - | 样式,Typescript:`React.CSSProperties` | N
cascading | String | 'right-up' | multiple images cascading。options:left-up/right-up。Typescript:`CascadingValue` `type CascadingValue = 'left-up' \| 'right-up'`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
collapseAvatar | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
max | Number | - | \- | N
+placement | String | - | popup placement。options:left/top/bottom/right。Typescript:`MaxOverPlacement` `type MaxOverPlacement = 'left' \| 'top' \| 'bottom' \| 'right'`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
popupProps | Object | - | Typescript:`PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
-size | String | - | size | N
+size | String | medium | size | N
diff --git a/src/avatar/avatar.md b/src/avatar/avatar.md
index 07ad27d6e9..73996a8031 100644
--- a/src/avatar/avatar.md
+++ b/src/avatar/avatar.md
@@ -16,7 +16,7 @@ image | String | - | 图片地址 | N
imageProps | Object | - | 透传至 Image 组件。TS 类型:`ImageProps`,[Image API Documents](./image?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
shape | String | circle | 形状。可选项:circle/round。TS 类型:`ShapeEnum ` `type ShapeEnum = 'circle' \| 'round'`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
size | String | - | 尺寸,示例值:small/medium/large/24px/38px 等。优先级高于 AvatarGroup.size 。Avatar 单独存在时,默认值为 medium。如果父组件存在 AvatarGroup,默认值便由 AvatarGroup.size 决定 | N
-onError | Function | | TS 类型:`(context: { e: ImageEvent }) => void`
图片加载失败时触发 | N
+onError | Function | | TS 类型:`(context: { e: Event }) => void`
图片加载失败时触发 | N
### AvatarGroup Props
@@ -27,5 +27,6 @@ style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
cascading | String | 'right-up' | 图片之间的层叠关系,可选值:左侧图片在上和右侧图片在上。可选项:left-up/right-up。TS 类型:`CascadingValue` `type CascadingValue = 'left-up' \| 'right-up'`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
collapseAvatar | TNode | - | 头像数量超出时,会出现一个头像折叠元素。该元素内容可自定义。默认为 `+N`。示例:`+5`,`...`, `更多`。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
max | Number | - | 能够同时显示的最多头像数量 | N
+placement | String | - | 超出的头像呈现位置。可选项:left/top/bottom/right。TS 类型:`MaxOverPlacement` `type MaxOverPlacement = 'left' \| 'top' \| 'bottom' \| 'right'`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
popupProps | Object | - | 头像右上角提示信息。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/avatar/type.ts) | N
-size | String | - | 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size | N
+size | String | medium | 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size | N
diff --git a/src/avatar/defaultProps.ts b/src/avatar/defaultProps.ts
index 17f25745ab..07cdbddd6b 100644
--- a/src/avatar/defaultProps.ts
+++ b/src/avatar/defaultProps.ts
@@ -6,4 +6,4 @@ import { TdAvatarProps, TdAvatarGroupProps } from './type';
export const avatarDefaultProps: TdAvatarProps = { hideOnLoadFailed: false, shape: 'circle' };
-export const avatarGroupDefaultProps: TdAvatarGroupProps = { cascading: 'right-up' };
+export const avatarGroupDefaultProps: TdAvatarGroupProps = { cascading: 'right-up', size: 'medium' };
diff --git a/src/avatar/type.ts b/src/avatar/type.ts
index ee200cb4a3..094293dff1 100644
--- a/src/avatar/type.ts
+++ b/src/avatar/type.ts
@@ -6,7 +6,7 @@
import { ImageProps } from '../image';
import { PopupProps } from '../popup';
-import { TNode, TElement, ImageEvent } from '../common';
+import { TNode, TElement } from '../common';
export interface TdAvatarProps {
/**
@@ -53,7 +53,7 @@ export interface TdAvatarProps {
/**
* 图片加载失败时触发
*/
- onError?: (context: { e: ImageEvent }) => void;
+ onError?: (context: { e: Event }) => void;
}
export interface TdAvatarGroupProps {
@@ -70,13 +70,17 @@ export interface TdAvatarGroupProps {
* 能够同时显示的最多头像数量
*/
max?: number;
+ /**
+ * 超出的头像呈现位置
+ */
+ placement?: MaxOverPlacement;
/**
* 头像右上角提示信息
*/
popupProps?: PopupProps;
/**
* 尺寸,示例值:small/medium/large/24px/38px 等。优先级低于 Avatar.size
- * @default ''
+ * @default medium
*/
size?: string;
}
@@ -84,3 +88,5 @@ export interface TdAvatarGroupProps {
export type ShapeEnum = 'circle' | 'round';
export type CascadingValue = 'left-up' | 'right-up';
+
+export type MaxOverPlacement = 'left' | 'top' | 'bottom' | 'right';
diff --git a/src/back-top/back-top.en-US.md b/src/back-top/back-top.en-US.md
index 3b3ae29d8a..b020f2662f 100644
--- a/src/back-top/back-top.en-US.md
+++ b/src/back-top/back-top.en-US.md
@@ -1,7 +1,6 @@
:: BASE_DOC ::
## API
-
### BackTop Props
name | type | default | description | required
diff --git a/src/back-top/back-top.md b/src/back-top/back-top.md
index 54989a0119..a4cf2dfaca 100644
--- a/src/back-top/back-top.md
+++ b/src/back-top/back-top.md
@@ -1,7 +1,6 @@
:: BASE_DOC ::
## API
-
### BackTop Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/back-top/type.ts b/src/back-top/type.ts
index 2760706eae..395679a662 100644
--- a/src/back-top/type.ts
+++ b/src/back-top/type.ts
@@ -8,14 +8,6 @@ import { TNode, AttachNode } from '../common';
import { MouseEvent } from 'react';
export interface TdBackTopProps {
- /**
- * 类名
- */
- className?: string;
- /**
- * 样式
- */
- style?: React.CSSProperties;
/**
* 回到顶部内容,同 `content`
*/
diff --git a/src/badge/badge.md b/src/badge/badge.md
index 211752f705..87e4f5f44f 100644
--- a/src/badge/badge.md
+++ b/src/badge/badge.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Badge Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/breadcrumb-item/breadcrumb-item.en-US.md b/src/breadcrumb-item/breadcrumb-item.en-US.md
new file mode 100644
index 0000000000..1805ef1423
--- /dev/null
+++ b/src/breadcrumb-item/breadcrumb-item.en-US.md
@@ -0,0 +1,20 @@
+:: BASE_DOC ::
+
+## API
+
+### BreadcrumbItem Props
+
+name | type | default | description | required
+-- | -- | -- | -- | --
+className | String | - | 类名 | N
+style | Object | - | 样式,Typescript:`React.CSSProperties` | N
+children | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+content | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+disabled | Boolean | - | \- | N
+href | String | - | \- | N
+icon | TElement | - | prefix icon in breadcrumb item。Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+maxWidth | String | undefined | \- | N
+replace | Boolean | false | \- | N
+router | Object | - | Typescript:`any` | N
+target | String | _self | options:_blank/_self/_parent/_top | N
+to | String / Object | - | Typescript:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
diff --git a/src/breadcrumb-item/breadcrumb-item.md b/src/breadcrumb-item/breadcrumb-item.md
new file mode 100644
index 0000000000..1360f87faf
--- /dev/null
+++ b/src/breadcrumb-item/breadcrumb-item.md
@@ -0,0 +1,20 @@
+:: BASE_DOC ::
+
+## API
+
+### BreadcrumbItem Props
+
+名称 | 类型 | 默认值 | 说明 | 必传
+-- | -- | -- | -- | --
+className | String | - | 类名 | N
+style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
+children | TNode | - | 子元素,同 content。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+content | TNode | - | 子元素。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+disabled | Boolean | - | 是否禁用当前项点击 | N
+href | String | - | 跳转链接 | N
+icon | TElement | - | 面板屑项内的前置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+maxWidth | String | undefined | 最大宽度,超出后会以省略号形式呈现。优先级高于 Breadcrumb 中的 maxItemWidth | N
+replace | Boolean | false | 路由跳转是否采用覆盖的方式(覆盖后将没有浏览器历史记录) | N
+router | Object | - | 路由对象。如果项目存在 Router,则默认使用 Router。TS 类型:`any` | N
+target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
+to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
diff --git a/src/breadcrumb/breadcrumb.en-US.md b/src/breadcrumb/breadcrumb.en-US.md
index a7c881b5d8..5b3d927987 100644
--- a/src/breadcrumb/breadcrumb.en-US.md
+++ b/src/breadcrumb/breadcrumb.en-US.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Breadcrumb Props
name | type | default | description | required
@@ -26,4 +27,4 @@ maxWidth | String | undefined | \- | N
replace | Boolean | false | \- | N
router | Object | - | Typescript:`any` | N
target | String | _self | options:_blank/_self/_parent/_top | N
-to | String / Object | - | Typescript:`Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
+to | String / Object | - | Typescript:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
diff --git a/src/breadcrumb/breadcrumb.md b/src/breadcrumb/breadcrumb.md
index ce63ef9bc2..c6f85ad4c4 100644
--- a/src/breadcrumb/breadcrumb.md
+++ b/src/breadcrumb/breadcrumb.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Breadcrumb Props
名称 | 类型 | 默认值 | 说明 | 必传
@@ -26,4 +27,4 @@ maxWidth | String | undefined | 最大宽度,超出后会以省略号形式呈
replace | Boolean | false | 路由跳转是否采用覆盖的方式(覆盖后将没有浏览器历史记录) | N
router | Object | - | 路由对象。如果项目存在 Router,则默认使用 Router。TS 类型:`any` | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
-to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
+to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
diff --git a/src/breadcrumb/defaultProps.ts b/src/breadcrumb/defaultProps.ts
index 7e1fd07e12..faa7968a50 100644
--- a/src/breadcrumb/defaultProps.ts
+++ b/src/breadcrumb/defaultProps.ts
@@ -2,9 +2,7 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
-import { TdBreadcrumbProps, TdBreadcrumbItemProps } from './type';
-
-export const breadcrumbDefaultProps: TdBreadcrumbProps = { maxItemWidth: undefined };
+import { TdBreadcrumbItemProps } from './type';
export const breadcrumbItemDefaultProps: TdBreadcrumbItemProps = {
maxWidth: undefined,
diff --git a/src/breadcrumb/type.ts b/src/breadcrumb/type.ts
index 93697472d1..b652cc6a95 100644
--- a/src/breadcrumb/type.ts
+++ b/src/breadcrumb/type.ts
@@ -6,21 +6,6 @@
import { TNode, TElement } from '../common';
-export interface TdBreadcrumbProps {
- /**
- * 单项最大宽度,超出后会以省略号形式呈现
- */
- maxItemWidth?: string;
- /**
- * 面包屑项,功能同 BreadcrumbItem
- */
- options?: Array;
- /**
- * 自定义分隔符
- */
- separator?: TNode;
-}
-
export interface TdBreadcrumbItemProps {
/**
* 子元素,同 content
@@ -64,7 +49,7 @@ export interface TdBreadcrumbItemProps {
/**
* 路由跳转目标,当且仅当 Router 存在时,该 API 有效
*/
- to?: Route | string;
+ to?: string | Route;
}
export interface Route {
diff --git a/src/button/__tests__/vitest-button.test.jsx b/src/button/__tests__/vitest-button.test.jsx
index d4e7bba212..dd9d4f855e 100644
--- a/src/button/__tests__/vitest-button.test.jsx
+++ b/src/button/__tests__/vitest-button.test.jsx
@@ -143,15 +143,6 @@ describe('Button Component', () => {
expect(container.querySelector('.custom-node')).toBeTruthy();
});
- const tagExpectedDom = ['button', 'a', 'div'];
- ['button', 'a', 'div'].forEach((item, index) => {
- it(`props.tag is equal to ${item}`, () => {
- const { container } = render();
- expect(container.querySelector(tagExpectedDom[index])).toBeTruthy();
- expect(container).toMatchSnapshot();
- });
- });
-
['default', 'primary', 'danger', 'warning', 'success'].forEach((item) => {
it(`props.theme is equal to ${item}`, () => {
const { container } = render();
diff --git a/src/calendar/calendar.en-US.md b/src/calendar/calendar.en-US.md
index 48390f0b21..04ae380414 100644
--- a/src/calendar/calendar.en-US.md
+++ b/src/calendar/calendar.en-US.md
@@ -1,7 +1,6 @@
:: BASE_DOC ::
## API
-
### Calendar Props
name | type | default | description | required
@@ -10,7 +9,7 @@ className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
cell | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
cellAppend | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-controllerConfig | Boolean / Object | - | Typescript:`boolean \| CalendarController` | N
+controllerConfig | Boolean / Object | undefined | Typescript:`boolean \| CalendarController` | N
fillWithZero | Boolean | true | \- | N
firstDayOfWeek | Number | 1 | options:1/2/3/4/5/6/7 | N
format | String | 'YYYY-MM-DD' | \- | N
@@ -18,10 +17,11 @@ head | TNode | - | Typescript:`string \| TNode`。[see more
isShowWeekendDefault | Boolean | true | \- | N
mode | String | month | options:month/year | N
month | String / Number | - | \- | N
+multiple | Boolean | - | \- | N
preventCellContextmenu | Boolean | false | \- | N
range | Array | - | Typescript:`Array` | N
theme | String | full | options:full/card | N
-value | String / Date | - | Typescript:`CalendarValue` `type CalendarValue = string \| Date`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
+value | String / Array / Date | - | Typescript:`CalendarValue \| CalendarValue[]` `type CalendarValue = string \| Date`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
week | TNode | - | Typescript:`Array \| TNode` `interface CalendarWeek { day: WeekDay }` `type WeekDay = 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
year | String / Number | - | \- | N
onCellClick | Function | | Typescript:`(options: { cell: CalendarCell; e: MouseEvent }) => void`
| N
@@ -34,7 +34,7 @@ onMonthChange | Function | | Typescript:`(options: { month: string; year: str
name | type | default | description | required
-- | -- | -- | -- | --
-current | Object | - | Typescript:`{ visible?: boolean; currentDayButtonProps?: ButtonProps; currentMonthButtonProps?: ButtonProps }` | N
+current | Object | - | Typescript:`{ visible?: boolean; currentDayButtonProps?: ButtonProps; currentMonthButtonProps?: ButtonProps }`,[Button API Documents](./button?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
disabled | Boolean | false | \- | N
mode | Object | - | Typescript:`{ visible?: boolean; radioGroupProps?: RadioGroupProps }`,[Radio API Documents](./radio?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
month | Object | - | Typescript:`{ visible?: boolean; selectProps?: SelectProps }` | N
diff --git a/src/calendar/calendar.md b/src/calendar/calendar.md
index 44a696a388..eadaec046f 100644
--- a/src/calendar/calendar.md
+++ b/src/calendar/calendar.md
@@ -9,18 +9,19 @@ className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
cell | TNode | - | 单元格插槽。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
cellAppend | TNode | - | 单元格插槽,在原来的内容之后追加。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-controllerConfig | Boolean / Object | - | 右上角控制器配置。值为 false 则表示不显示控制器,值为 true 则显示控制器默认配置,值类型为 CalendarController 则显示为自定义控制器配置。TS 类型:`boolean \| CalendarController` | N
-fillWithZero | Boolean | true | 小于 10 的日期,是否使用 '0' 填充。默认表现为 `01` `02`,值为 false 表现为 `1` `2` `9` | N
+controllerConfig | Boolean / Object | undefined | 右上角控制器配置。支持全局配置。值为 false 则表示不显示控制器,值为 true 则显示控制器默认配置,值类型为 CalendarController 则显示为自定义控制器配置。TS 类型:`boolean \| CalendarController` | N
+fillWithZero | Boolean | true | 小于 10 的日期,是否使用 '0' 填充。支持全局配置。默认表现为 `01` `02`,值为 false 表现为 `1` `2` `9` | N
firstDayOfWeek | Number | 1 | 第一天从星期几开始,仅在日历展示维度为月份时(mode = month)有效。默认为 1。可选项:1/2/3/4/5/6/7 | N
format | String | 'YYYY-MM-DD' | 用于格式化日期,决定事件参数 formattedFilterDate 的输出值。[详细文档](https://day.js.org/docs/en/display/format) | N
head | TNode | - | 头部插槽(左上角处,默认不显示任何内容)。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
isShowWeekendDefault | Boolean | true | 默认是否显示周末 | N
mode | String | month | 日历展示维度。可选项:month/year | N
month | String / Number | - | 控制当前面板展示月份,优先级高于 `controllerConfig.month` | N
+multiple | Boolean | - | 是否高亮多个日期单元格 | N
preventCellContextmenu | Boolean | false | 是否禁用单元格右键默认系统菜单 | N
range | Array | - | 用于设置日历的年月份显示范围,[范围开始,范围结束]。TS 类型:`Array` | N
theme | String | full | 日历风格。可选项:full/card | N
-value | String / Date | - | 当前高亮的日期。TS 类型:`CalendarValue` `type CalendarValue = string \| Date`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
+value | String / Array / Date | - | 当前高亮的日期。TS 类型:`CalendarValue \| CalendarValue[]` `type CalendarValue = string \| Date`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
week | TNode | - | 用于自定义日历星期呈现方式。CalendarWeek.day 表示当前是星期几。示例一:['周一', '周二', '周三', '周四', '周五', '星期六', '星期天']。示例二:`({ day }) => '周' + day`。TS 类型:`Array \| TNode` `interface CalendarWeek { day: WeekDay }` `type WeekDay = 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
year | String / Number | - | 控制当前面板展示年份,优先级高于 `controllerConfig.year` | N
onCellClick | Function | | TS 类型:`(options: { cell: CalendarCell; e: MouseEvent }) => void`
日历单元格点击时触发 | N
@@ -33,7 +34,7 @@ onMonthChange | Function | | TS 类型:`(options: { month: string; year: stri
名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
-current | Object | - | “今天(本月)”按钮控制器。TS 类型:`{ visible?: boolean; currentDayButtonProps?: ButtonProps; currentMonthButtonProps?: ButtonProps }` | N
+current | Object | - | “今天(本月)”按钮控制器。TS 类型:`{ visible?: boolean; currentDayButtonProps?: ButtonProps; currentMonthButtonProps?: ButtonProps }`,[Button API Documents](./button?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
disabled | Boolean | false | 是否禁用右上角控制器 | N
mode | Object | - | 日历展示维度控制器。TS 类型:`{ visible?: boolean; radioGroupProps?: RadioGroupProps }`,[Radio API Documents](./radio?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/calendar/type.ts) | N
month | Object | - | 日历月份控制器。TS 类型:`{ visible?: boolean; selectProps?: SelectProps }` | N
diff --git a/src/calendar/defaultProps.ts b/src/calendar/defaultProps.ts
index 261dcd2f18..bff73fc2de 100644
--- a/src/calendar/defaultProps.ts
+++ b/src/calendar/defaultProps.ts
@@ -5,6 +5,8 @@
import { TdCalendarProps } from './type';
export const calendarDefaultProps: TdCalendarProps = {
+ controllerConfig: undefined,
+ fillWithZero: undefined,
format: 'YYYY-MM-DD',
isShowWeekendDefault: true,
mode: 'month',
diff --git a/src/calendar/type.ts b/src/calendar/type.ts
index 52e4c416f2..37ca0c7b25 100644
--- a/src/calendar/type.ts
+++ b/src/calendar/type.ts
@@ -4,10 +4,10 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
-import { RadioGroupProps } from '../radio';
import { ButtonProps } from '../button';
-import { SelectProps } from '../select';
+import { RadioGroupProps } from '../radio';
import { CheckTagProps } from '../tag';
+import { SelectProps } from '../select';
import { TNode } from '../common';
import { MouseEvent } from 'react';
@@ -21,11 +21,11 @@ export interface TdCalendarProps {
*/
cellAppend?: string | TNode;
/**
- * 右上角控制器配置。值为 false 则表示不显示控制器,值为 true 则显示控制器默认配置,值类型为 CalendarController 则显示为自定义控制器配置
+ * 右上角控制器配置。支持全局配置。值为 false 则表示不显示控制器,值为 true 则显示控制器默认配置,值类型为 CalendarController 则显示为自定义控制器配置
*/
controllerConfig?: boolean | CalendarController;
/**
- * 小于 10 的日期,是否使用 '0' 填充。默认表现为 `01` `02`,值为 false 表现为 `1` `2` `9`
+ * 小于 10 的日期,是否使用 '0' 填充。支持全局配置。默认表现为 `01` `02`,值为 false 表现为 `1` `2` `9`
*/
fillWithZero?: boolean;
/**
@@ -55,6 +55,10 @@ export interface TdCalendarProps {
* 控制当前面板展示月份,优先级高于 `controllerConfig.month`
*/
month?: string | number;
+ /**
+ * 是否高亮多个日期单元格
+ */
+ multiple?: boolean;
/**
* 是否禁用单元格右键默认系统菜单
* @default false
@@ -72,7 +76,7 @@ export interface TdCalendarProps {
/**
* 当前高亮的日期
*/
- value?: CalendarValue;
+ value?: CalendarValue | CalendarValue[];
/**
* 用于自定义日历星期呈现方式。CalendarWeek.day 表示当前是星期几。示例一:['周一', '周二', '周三', '周四', '周五', '星期六', '星期天']。示例二:`({ day }) => '周' + day`
*/
diff --git a/src/card/card.md b/src/card/card.md
index cb41dc4442..a784273e72 100644
--- a/src/card/card.md
+++ b/src/card/card.md
@@ -18,7 +18,7 @@ footer | TNode | - | 卡片底部内容,可完全自定义。TS 类型:`stri
header | TNode | - | 卡片顶部内容,优先级高于其他所有元素。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
headerBordered | Boolean | false | 头部是否带分割线,仅在有header时有效 | N
hoverShadow | Boolean | false | hover时是否有阴影 | N
-loading | TNode | false | 加载状态,值为 true 会根据不同的布局显示不同的加载状态,值为 false 则表示非加载状态。也可以使用 Skeleton 组件完全自定义加载态呈现内容。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+loading | TNode | false | 加载状态,值为 true 会根据不同的布局显示不同的加载状态,值为 false 则表示非加载状态。也可以使用 Sketon 组件完全自定义加载态呈现内容。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
loadingProps | Object | - | 透传加载组件(Loading)全部属性。TS 类型:`LoadingProps`,[Loading API Documents](./loading?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/card/type.ts) | N
shadow | Boolean | false | 是否显示卡片阴影,默认不显示 | N
size | String | medium | 尺寸。可选项:medium/small | N
diff --git a/src/card/type.ts b/src/card/type.ts
index 4b69ea2d72..f4ae54a324 100644
--- a/src/card/type.ts
+++ b/src/card/type.ts
@@ -56,7 +56,7 @@ export interface TdCardProps {
*/
hoverShadow?: boolean;
/**
- * 加载状态,值为 true 会根据不同的布局显示不同的加载状态,值为 false 则表示非加载状态。也可以使用 Skeleton 组件完全自定义加载态呈现内容
+ * 加载状态,值为 true 会根据不同的布局显示不同的加载状态,值为 false 则表示非加载状态。也可以使用 Sketon 组件完全自定义加载态呈现内容
* @default false
*/
loading?: TNode;
diff --git a/src/cascader/cascader.en-US.md b/src/cascader/cascader.en-US.md
index 8b3fe8b378..3b617fde50 100644
--- a/src/cascader/cascader.en-US.md
+++ b/src/cascader/cascader.en-US.md
@@ -8,6 +8,7 @@ name | type | default | description | required
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
autofocus | Boolean | - | \- | N
+borderless | Boolean | false | \- | N
checkProps | Object | - | Typescript:`CheckboxProps`,[Checkbox API Documents](./checkbox?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
checkStrictly | Boolean | false | \- | N
clearable | Boolean | false | \- | N
@@ -17,7 +18,7 @@ empty | TNode | - | Typescript:`string \| TNode`。[see more ts definition](ht
filter | Function | - | Typescript:`(filterWords: string, node: TreeNodeModel) => boolean \| Promise` | N
filterable | Boolean | false | \- | N
inputProps | Object | - | Typescript:`InputProps`,[Input API Documents](./input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
-keys | Object | - | Typescript:`CascaderKeysType` `interface CascaderKeysType { value?: string; label?: string; children?: string \| boolean }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
+keys | Object | - | Typescript:`TreeKeysType`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
label | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
lazy | Boolean | true | \- | N
load | Function | - | Typescript:`(node: TreeNodeModel) => Promise>` | N
@@ -31,23 +32,25 @@ options | Array | [] | Typescript:`Array` | N
placeholder | String | undefined | \- | N
popupProps | Object | - | Typescript:`PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
popupVisible | Boolean | - | \- | N
+defaultPopupVisible | Boolean | - | uncontrolled property | N
+prefixIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
readonly | Boolean | false | \- | N
reserveKeyword | Boolean | false | \- | N
selectInputProps | Object | - | Typescript:`SelectInputProps`,[SelectInput API Documents](./select-input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
showAllLevels | Boolean | true | \- | N
-size | String | medium | options:large/medium/small。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-status | String | default | options:default/success/warning/error | N
+size | String | medium | options: large/medium/small。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+status | String | default | options: default/success/warning/error | N
suffix | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
suffixIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
tagInputProps | Object | - | Typescript:`TagInputProps`,[TagInput API Documents](./tag-input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
tagProps | Object | - | Typescript:`TagProps`,[Tag API Documents](./tag?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
tips | TNode | - | tips at the bottom of cascader。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-trigger | String | click | options:click/hover | N
+trigger | String | click | options: click/hover | N
value | String / Number / Array | [] | Typescript:`CascaderValue` `type CascaderValue = string \| number \| T \| Array>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
defaultValue | String / Number / Array | [] | uncontrolled property。Typescript:`CascaderValue` `type CascaderValue = string \| number \| T \| Array>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
-valueDisplay | TNode | - | `MouseEvent`。Typescript:`string \| TNode<{ value: CascaderValue; onClose: (index: number) => void; displayValue?: CascaderValue }>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-valueMode | String | onlyLeaf | options:onlyLeaf/parentFirst/all | N
-valueType | String | single | options:single/full | N
+valueDisplay | TNode | - | `MouseEvent`。Typescript:`string \| TNode<{ value: CascaderValue; onClose: (index: number) => void; displayValue?: CascaderValue; selectedOptions: CascaderOption[] }>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+valueMode | String | onlyLeaf | options: onlyLeaf/parentFirst/all | N
+valueType | String | single | options: single/full | N
onBlur | Function | | Typescript:`(context: { value: CascaderValue } & SelectInputBlurContext ) => void`
| N
onChange | Function | | Typescript:`(value: CascaderValue, context: CascaderChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts)。
`interface CascaderChangeContext { node?: TreeNodeModel; source: CascaderChangeSource }`
`import { TreeNodeModel } from '@Tree'`
`type CascaderChangeSource = 'invalid-value' \| 'check' \| 'clear' \| 'uncheck'`
| N
onFocus | Function | | Typescript:`(context: { value: CascaderValue; e: FocusEvent }) => void`
| N
diff --git a/src/cascader/cascader.md b/src/cascader/cascader.md
index e9d7cb5b2c..529a96d5b3 100644
--- a/src/cascader/cascader.md
+++ b/src/cascader/cascader.md
@@ -8,6 +8,7 @@
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
autofocus | Boolean | - | 自动聚焦 | N
+borderless | Boolean | false | 无边框模式 | N
checkProps | Object | - | 参考 checkbox 组件 API。TS 类型:`CheckboxProps`,[Checkbox API Documents](./checkbox?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
checkStrictly | Boolean | false | 父子节点选中状态不再关联,可各自选中或取消 | N
clearable | Boolean | false | 是否支持清空选项 | N
@@ -17,7 +18,7 @@ empty | TNode | - | 无匹配选项时的内容,默认全局配置为 '暂无
filter | Function | - | 自定义过滤方法,用于对现有数据进行搜索过滤,判断是否过滤某一项数据。TS 类型:`(filterWords: string, node: TreeNodeModel) => boolean \| Promise` | N
filterable | Boolean | false | 是否可搜索 | N
inputProps | Object | - | 透传 Input 输入框组件的全部属性。TS 类型:`InputProps`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
-keys | Object | - | 用来定义 value / label / children 在 `options` 中对应的字段别名。TS 类型:`CascaderKeysType` `interface CascaderKeysType { value?: string; label?: string; children?: string \| boolean }`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
+keys | Object | - | 用来定义 value / label / children / disabled 在 `options` 中对应的字段别名。TS 类型:`TreeKeysType`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
label | TNode | - | 左侧文本。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
lazy | Boolean | true | 延迟加载 children 为 true 的子节点,即使 expandAll 被设置为 true,也同样延迟加载 | N
load | Function | - | 加载子树数据的方法(仅当节点 children 为 true 时生效)。TS 类型:`(node: TreeNodeModel) => Promise>` | N
@@ -31,6 +32,8 @@ options | Array | [] | 可选项数据源。TS 类型:`Array`
placeholder | String | undefined | 占位符 | N
popupProps | Object | - | 参考 popup 组件 API。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
popupVisible | Boolean | - | 是否显示下拉框 | N
+defaultPopupVisible | Boolean | - | 是否显示下拉框。非受控属性 | N
+prefixIcon | TElement | - | 组件前置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
readonly | Boolean | false | 只读状态,值为真会隐藏输入框,且无法打开下拉框 | N
reserveKeyword | Boolean | false | 多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词 | N
selectInputProps | Object | - | 透传 SelectInput 筛选器输入框组件的全部属性。TS 类型:`SelectInputProps`,[SelectInput API Documents](./select-input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
@@ -45,7 +48,7 @@ tips | TNode | - | 输入框下方提示文本,会根据不同的 `status` 呈
trigger | String | click | 展开下一层级的方式。可选项:click/hover | N
value | String / Number / Array | [] | 选中项的值。TS 类型:`CascaderValue` `type CascaderValue = string \| number \| T \| Array>`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
defaultValue | String / Number / Array | [] | 选中项的值。非受控属性。TS 类型:`CascaderValue` `type CascaderValue = string \| number \| T \| Array>`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/cascader/type.ts) | N
-valueDisplay | TNode | - | 【开发中】自定义选中项呈现的内容。TS 类型:`string \| TNode<{ value: CascaderValue; onClose: (index: number) => void; displayValue?: CascaderValue }>`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+valueDisplay | TNode | - | 自定义选中项呈现的内容。TS 类型:`string \| TNode<{ value: CascaderValue; onClose: (index: number) => void; displayValue?: CascaderValue; selectedOptions: CascaderOption[] }>`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
valueMode | String | onlyLeaf | 选中值模式。all 表示父节点和子节点全部会出现在选中值里面;parentFirst 表示当子节点全部选中时,仅父节点在选中值里面;onlyLeaf 表示无论什么情况,选中值仅呈现叶子节点。可选项:onlyLeaf/parentFirst/all | N
valueType | String | single | 用于控制选中值的类型。single 表示输入输出值为 叶子结点值, full 表示输入输出值为全路径。可选项:single/full | N
onBlur | Function | | TS 类型:`(context: { value: CascaderValue } & SelectInputBlurContext ) => void`
当输入框失去焦点时触发 | N
diff --git a/src/cascader/defaultProps.ts b/src/cascader/defaultProps.ts
index 03a78cc259..748b6f8a1d 100644
--- a/src/cascader/defaultProps.ts
+++ b/src/cascader/defaultProps.ts
@@ -5,6 +5,7 @@
import { TdCascaderProps } from './type';
export const cascaderDefaultProps: TdCascaderProps = {
+ borderless: false,
checkStrictly: false,
clearable: false,
filterable: false,
diff --git a/src/cascader/type.ts b/src/cascader/type.ts
index 406a14369f..6dd4b66d33 100644
--- a/src/cascader/type.ts
+++ b/src/cascader/type.ts
@@ -12,7 +12,7 @@ import { TagInputProps } from '../tag-input';
import { TagProps } from '../tag';
import { TreeNodeModel } from '../tree';
import { PopupVisibleChangeContext } from '../popup';
-import { TNode, TElement, TreeOptionData, SizeEnum } from '../common';
+import { TNode, TElement, TreeOptionData, SizeEnum, TreeKeysType } from '../common';
import { FocusEvent } from 'react';
export interface TdCascaderProps {
@@ -20,6 +20,11 @@ export interface TdCascaderProps;
/**
- * 【开发中】自定义选中项呈现的内容
+ * 自定义选中项呈现的内容
*/
valueDisplay?:
| string
@@ -194,6 +203,7 @@ export interface TdCascaderProps;
onClose: (index: number) => void;
displayValue?: CascaderValue;
+ selectedOptions: CascaderOption[];
}>;
/**
* 选中值模式。all 表示父节点和子节点全部会出现在选中值里面;parentFirst 表示当子节点全部选中时,仅父节点在选中值里面;onlyLeaf 表示无论什么情况,选中值仅呈现叶子节点
@@ -227,12 +237,6 @@ export interface TdCascaderProps) => void;
}
-export interface CascaderKeysType {
- value?: string;
- label?: string;
- children?: string | boolean;
-}
-
export type CascaderValue = string | number | T | Array>;
export interface CascaderChangeContext {
diff --git a/src/checkbox/checkbox.en-US.md b/src/checkbox/checkbox.en-US.md
index 116ca2a5a7..29d65e32a8 100644
--- a/src/checkbox/checkbox.en-US.md
+++ b/src/checkbox/checkbox.en-US.md
@@ -14,6 +14,7 @@ children | TNode | - | Typescript:`string \| TNode`。[see more ts definition]
disabled | Boolean | undefined | \- | N
indeterminate | Boolean | false | \- | N
label | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+lazyLoad | Boolean | false | load checkbox content when it entering the visible area | N
name | String | - | \- | N
readonly | Boolean | false | \- | N
value | String / Number / Boolean | - | value of checkbox。Typescript:`string \| number \| boolean` | N
@@ -26,10 +27,11 @@ name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
-disabled | Boolean | - | \- | N
+disabled | Boolean | undefined | \- | N
+lazyLoad | Boolean | false | load checkbox content when it entering the visible area | N
max | Number | undefined | \- | N
name | String | - | \- | N
-options | Array | - | Typescript:`Array` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj { label?: string \| TNode; value?: string \| number; disabled?: boolean; name?: string; checkAll?: true }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts) | N
+options | Array | - | Typescript:`Array` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj extends TdCheckboxProps { text?: string; }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts) | N
value | Array | [] | Typescript:`T` `type CheckboxGroupValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts) | N
defaultValue | Array | [] | uncontrolled property。Typescript:`T` `type CheckboxGroupValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts) | N
-onChange | Function | | Typescript:`(value: T, context: CheckboxGroupChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts)。
`interface CheckboxGroupChangeContext { e: ChangeEvent; current: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`
| N
+onChange | Function | | Typescript:`(value: T, context: CheckboxGroupChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts)。
`interface CheckboxGroupChangeContext { e: ChangeEvent; current: CheckboxOption \| TdCheckboxProps; option: current: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`
| N
diff --git a/src/checkbox/checkbox.md b/src/checkbox/checkbox.md
index 1b106f3964..3847b45fb3 100644
--- a/src/checkbox/checkbox.md
+++ b/src/checkbox/checkbox.md
@@ -1,10 +1,5 @@
:: BASE_DOC ::
-
-### 最多选中的数量
-
-{{ max }}
-
## API
### Checkbox Props
@@ -16,9 +11,10 @@ checkAll | Boolean | false | 用于标识是否为「全选选项」。单独使
checked | Boolean | false | 是否选中 | N
defaultChecked | Boolean | false | 是否选中。非受控属性 | N
children | TNode | - | 多选框内容,同 label。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-disabled | Boolean | undefined | 是否禁用组件。如果父组件存在 CheckboxGroup,默认值由 CheckboxGroup.disabled 控制。Checkbox.disabled 优先级高于 CheckboxGroup.disabled | N
+disabled | Boolean | undefined | 是否禁用组件。如果父组件存在 CheckboxGroup,默认值由 CheckboxGroup.disabled 控制。优先级:Checkbox.disabled > CheckboxGroup.disabled > Form.disabled | N
indeterminate | Boolean | false | 是否为半选 | N
label | TNode | - | 主文案。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+lazyLoad | Boolean | false | 是否启用懒加载。数据量大时建议开启;加载复杂内容或大量图片时建议开启 | N
name | String | - | HTML 元素原生属性 | N
readonly | Boolean | false | 只读状态 | N
value | String / Number / Boolean | - | 多选框的值。TS 类型:`string \| number \| boolean` | N
@@ -31,10 +27,11 @@ onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
-disabled | Boolean | - | 是否禁用组件,默认为 false。CheckboxGroup.disabled 优先级低于 Checkbox.disabled | N
+disabled | Boolean | undefined | 是否禁用组件,默认为 false。优先级:Form.disabled < CheckboxGroup.disabled < Checkbox.disabled | N
+lazyLoad | Boolean | false | 是否启用懒加载。子组件 Checkbox 数据量大时建议开启;加载复杂内容或大量图片时建议开启 | N
max | Number | undefined | 支持最多选中的数量 | N
name | String | - | 统一设置内部复选框 HTML 属性 | N
-options | Array | - | 以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」。TS 类型:`Array` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj { label?: string \| TNode; value?: string \| number; disabled?: boolean; name?: string; checkAll?: true }`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts) | N
+options | Array | - | 以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」。TS 类型:`Array` `type CheckboxOption = string \| number \| CheckboxOptionObj` `interface CheckboxOptionObj extends TdCheckboxProps { text?: string; }`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts) | N
value | Array | [] | 选中值。TS 类型:`T` `type CheckboxGroupValue = Array`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts) | N
defaultValue | Array | [] | 选中值。非受控属性。TS 类型:`T` `type CheckboxGroupValue = Array`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts) | N
-onChange | Function | | TS 类型:`(value: T, context: CheckboxGroupChangeContext) => void`
值变化时触发,`context.current` 表示当前变化的数据值,如果是全选则为空;`context.type` 表示引起选中数据变化的是选中或是取消选中;`context.option` 表示当前变化的数据项。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts)。
`interface CheckboxGroupChangeContext { e: ChangeEvent; current: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`
| N
+onChange | Function | | TS 类型:`(value: T, context: CheckboxGroupChangeContext) => void`
值变化时触发,`context.current` 表示当前变化的数据值,如果是全选则为空;`context.type` 表示引起选中数据变化的是选中或是取消选中;`context.option` 表示当前变化的数据项;`context.current` 即将废弃,请勿使用。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/checkbox/type.ts)。
`interface CheckboxGroupChangeContext { e: ChangeEvent; current: CheckboxOption \| TdCheckboxProps; option: current: CheckboxOption \| TdCheckboxProps; type: 'check' \| 'uncheck' }`
| N
diff --git a/src/checkbox/defaultProps.ts b/src/checkbox/defaultProps.ts
index 3d98f0cfb6..be631ad199 100644
--- a/src/checkbox/defaultProps.ts
+++ b/src/checkbox/defaultProps.ts
@@ -9,7 +9,13 @@ export const checkboxDefaultProps: TdCheckboxProps = {
defaultChecked: false,
disabled: undefined,
indeterminate: false,
+ lazyLoad: false,
readonly: false,
};
-export const checkboxGroupDefaultProps: TdCheckboxGroupProps = { max: undefined, defaultValue: [] };
+export const checkboxGroupDefaultProps: TdCheckboxGroupProps = {
+ disabled: undefined,
+ lazyLoad: false,
+ max: undefined,
+ defaultValue: [],
+};
diff --git a/src/checkbox/type.ts b/src/checkbox/type.ts
index 649b98762a..9e2b017cc2 100644
--- a/src/checkbox/type.ts
+++ b/src/checkbox/type.ts
@@ -4,114 +4,4 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
-import { TNode } from '../common';
-import { MouseEvent, ChangeEvent } from 'react';
-
-export interface TdCheckboxProps {
- /**
- * 用于标识是否为「全选选项」。单独使用无效,需在 CheckboxGroup 中使用
- * @default false
- */
- checkAll?: boolean;
- /**
- * 是否选中
- * @default false
- */
- checked?: boolean;
- /**
- * 是否选中,非受控属性
- * @default false
- */
- defaultChecked?: boolean;
- /**
- * 多选框内容,同 label
- */
- children?: TNode;
- /**
- * 是否禁用组件。如果父组件存在 CheckboxGroup,默认值由 CheckboxGroup.disabled 控制。Checkbox.disabled 优先级高于 CheckboxGroup.disabled
- */
- disabled?: boolean;
- /**
- * 是否为半选
- * @default false
- */
- indeterminate?: boolean;
- /**
- * 主文案
- */
- label?: TNode;
- /**
- * HTML 元素原生属性
- * @default ''
- */
- name?: string;
- /**
- * 只读状态
- * @default false
- */
- readonly?: boolean;
- /**
- * 多选框的值
- */
- value?: string | number | boolean;
- /**
- * 值变化时触发
- */
- onChange?: (checked: boolean, context: { e: ChangeEvent }) => void;
- /**
- * 点击时出发,一般用于外层阻止冒泡场景
- */
- onClick?: (context: { e: MouseEvent }) => void;
-}
-
-export interface TdCheckboxGroupProps {
- /**
- * 是否禁用组件,默认为 false。CheckboxGroup.disabled 优先级低于 Checkbox.disabled
- */
- disabled?: boolean;
- /**
- * 支持最多选中的数量
- */
- max?: number;
- /**
- * 统一设置内部复选框 HTML 属性
- * @default ''
- */
- name?: string;
- /**
- * 以配置形式设置子元素。示例1:`['北京', '上海']` ,示例2: `[{ label: '全选', checkAll: true }, { label: '上海', value: 'shanghai' }]`。checkAll 值为 true 表示当前选项为「全选选项」
- */
- options?: Array;
- /**
- * 选中值
- * @default []
- */
- value?: T;
- /**
- * 选中值,非受控属性
- * @default []
- */
- defaultValue?: T;
- /**
- * 值变化时触发,`context.current` 表示当前变化的数据值,如果是全选则为空;`context.type` 表示引起选中数据变化的是选中或是取消选中;`context.option` 表示当前变化的数据项
- */
- onChange?: (value: T, context: CheckboxGroupChangeContext) => void;
-}
-
-export type CheckboxOption = string | number | CheckboxOptionObj;
-
-export interface CheckboxOptionObj {
- label?: string | TNode;
- value?: string | number;
- disabled?: boolean;
- name?: string;
- checkAll?: true;
-}
-
-export type CheckboxGroupValue = Array;
-
-export interface CheckboxGroupChangeContext {
- e: ChangeEvent;
- current: CheckboxOption | TdCheckboxProps;
- type: 'check' | 'uncheck';
-}
+[object Object]
\ No newline at end of file
diff --git a/src/collapse/defaultProps.ts b/src/collapse/defaultProps.ts
index 3d42c2645d..151f172e9b 100644
--- a/src/collapse/defaultProps.ts
+++ b/src/collapse/defaultProps.ts
@@ -11,6 +11,7 @@ export const collapseDefaultProps: TdCollapseProps = {
expandIconPlacement: 'left',
expandMutex: false,
expandOnRowClick: true,
+ defaultValue: [],
};
export const collapsePanelDefaultProps: TdCollapsePanelProps = {
diff --git a/src/collapse/type.ts b/src/collapse/type.ts
index 7b0b69a328..72942b9510 100644
--- a/src/collapse/type.ts
+++ b/src/collapse/type.ts
@@ -44,16 +44,18 @@ export interface TdCollapseProps {
expandOnRowClick?: boolean;
/**
* 展开的面板集合
+ * @default []
*/
value?: CollapseValue;
/**
* 展开的面板集合,非受控属性
+ * @default []
*/
defaultValue?: CollapseValue;
/**
* 切换面板时触发,返回变化的值
*/
- onChange?: (value: CollapseValue, context: { e: MouseEvent }) => void;
+ onChange?: (value: CollapseValue, context: { e: MouseEvent }) => void;
}
export interface TdCollapsePanelProps {
@@ -93,5 +95,3 @@ export interface TdCollapsePanelProps {
}
export type CollapseValue = Array;
-
-export type CollapsePanelValue = string | number;
diff --git a/src/color-picker/color-picker.en-US.md b/src/color-picker/color-picker.en-US.md
index 6d985fbc9c..7720f51070 100644
--- a/src/color-picker/color-picker.en-US.md
+++ b/src/color-picker/color-picker.en-US.md
@@ -7,10 +7,12 @@ name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
+clearable | Boolean | false | \- | N
closeBtn | TNode | true | Typescript:`string \| boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
colorModes | Array | ()=> ['monochrome', 'linear-gradient'] | Typescript:`Array<'monochrome' \| 'linear-gradient'>` | N
disabled | Boolean | - | \- | N
enableAlpha | Boolean | false | \- | N
+enableMultipleGradient | Boolean | true | \- | N
format | String | RGB | options:RGB/RGBA/HSL/HSLA/HSB/HSV/HSVA/HEX/CMYK/CSS | N
inputProps | Object | - | Typescript:`InputProps`,[Input API Documents](./input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/color-picker/type.ts) | N
multiple | Boolean | false | \- | N
@@ -19,6 +21,7 @@ recentColors | Array | [] | used color recently。Typescript:`boolean \| Array
defaultRecentColors | Array | [] | used color recently。uncontrolled property。Typescript:`boolean \| Array` | N
selectInputProps | Object | - | Typescript:`SelectInputProps`,[SelectInput API Documents](./select-input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/color-picker/type.ts) | N
showPrimaryColorPreview | Boolean | true | \- | N
+size | String | medium | options:small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
swatchColors | Array | - | swatch colors。Typescript:`Array` | N
value | String | - | color value | N
defaultValue | String | - | color value。uncontrolled property | N
diff --git a/src/color-picker/color-picker.md b/src/color-picker/color-picker.md
index 813c21ce6b..1d07e2db9f 100644
--- a/src/color-picker/color-picker.md
+++ b/src/color-picker/color-picker.md
@@ -7,10 +7,12 @@
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
+clearable | Boolean | false | 是否可清空 | N
closeBtn | TNode | true | 关闭按钮,值为 `true` 显示默认关闭按钮;值为 `false` 或 `undefined` 则不显示关闭按钮;值类型为函数,则表示自定义关闭按钮。TS 类型:`string \| boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
colorModes | Array | ()=> ['monochrome', 'linear-gradient'] | 颜色模式选择。同时支持单色和渐变两种模式,可仅使用单色或者渐变其中一种模式,也可以同时使用。`monochrome` 表示单色,`linear-gradient` 表示渐变色。TS 类型:`Array<'monochrome' \| 'linear-gradient'>` | N
disabled | Boolean | - | 是否禁用组件 | N
enableAlpha | Boolean | false | 是否开启透明通道 | N
+enableMultipleGradient | Boolean | true | 是否允许开启通过点击渐变轴增加渐变梯度,默认开启,关闭时只会存在起始和结束两个颜色 | N
format | String | RGB | 格式化色值。`enableAlpha` 为真时,`RGBA/HSLA/HSVA` 等值有效。可选项:RGB/RGBA/HSL/HSLA/HSB/HSV/HSVA/HEX/CMYK/CSS | N
inputProps | Object | - | 透传 Input 输入框组件全部属性。TS 类型:`InputProps`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/color-picker/type.ts) | N
multiple | Boolean | false | 【开发中】是否允许选中多个颜色 | N
@@ -19,6 +21,7 @@ recentColors | Array | [] | 最近使用的颜色。值为 [] 表示以组件内
defaultRecentColors | Array | [] | 最近使用的颜色。值为 [] 表示以组件内部的“最近使用颜色”为准,值长度大于 0 则以该值为准显示“最近使用颜色”。值为 null 则完全不显示“最近使用颜色”。非受控属性。TS 类型:`boolean \| Array` | N
selectInputProps | Object | - | 透传 SelectInputProps 筛选器输入框组件全部属性。TS 类型:`SelectInputProps`,[SelectInput API Documents](./select-input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/color-picker/type.ts) | N
showPrimaryColorPreview | Boolean | true | 是否展示颜色选择条右侧的颜色预览区域 | N
+size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
swatchColors | Array | - | 系统预设的颜色样例,值为 `null` 或 `[]` 则不显示系统色,值为 `undefined` 会显示组件内置的系统默认色。TS 类型:`Array` | N
value | String | - | 色值 | N
defaultValue | String | - | 色值。非受控属性 | N
diff --git a/src/color-picker/defaultProps.ts b/src/color-picker/defaultProps.ts
index 4af991af6e..5592856ef4 100644
--- a/src/color-picker/defaultProps.ts
+++ b/src/color-picker/defaultProps.ts
@@ -4,12 +4,4 @@
import { TdColorPickerProps } from './type';
-export const colorPickerDefaultProps: TdColorPickerProps = {
- closeBtn: true,
- colorModes: ['monochrome', 'linear-gradient'],
- enableAlpha: false,
- format: 'RGB',
- multiple: false,
- defaultRecentColors: [],
- showPrimaryColorPreview: true,
-};
+export const colorPickerDefaultProps: TdColorPickerProps = {clearable: false,closeBtn: true,colorModes: '()=> ['monochrome', 'linear-gradient']',enableAlpha: false,enableMultipleGradient: true,format: 'RGB',multiple: false,defaultRecentColors: [],showPrimaryColorPreview: true,size: 'medium',};
\ No newline at end of file
diff --git a/src/color-picker/type.ts b/src/color-picker/type.ts
index 850699aa77..d048a9f397 100644
--- a/src/color-picker/type.ts
+++ b/src/color-picker/type.ts
@@ -7,9 +7,14 @@
import { InputProps } from '../input';
import { PopupProps } from '../popup';
import { SelectInputProps } from '../select-input';
-import { TNode } from '../common';
+import { TNode, SizeEnum } from '../common';
export interface TdColorPickerProps {
+ /**
+ * 是否可清空
+ * @default false
+ */
+ clearable?: boolean;
/**
* 关闭按钮,值为 `true` 显示默认关闭按钮;值为 `false` 或 `undefined` 则不显示关闭按钮;值类型为函数,则表示自定义关闭按钮
* @default true
@@ -29,6 +34,11 @@ export interface TdColorPickerProps {
* @default false
*/
enableAlpha?: boolean;
+ /**
+ * 是否允许开启通过点击渐变轴增加渐变梯度,默认开启,关闭时只会存在起始和结束两个颜色
+ * @default true
+ */
+ enableMultipleGradient?: boolean;
/**
* 格式化色值。`enableAlpha` 为真时,`RGBA/HSLA/HSVA` 等值有效
* @default RGB
@@ -51,12 +61,12 @@ export interface TdColorPickerProps {
* 最近使用的颜色。值为 [] 表示以组件内部的“最近使用颜色”为准,值长度大于 0 则以该值为准显示“最近使用颜色”。值为 null 则完全不显示“最近使用颜色”
* @default []
*/
- recentColors?: boolean | Array | null;
+ recentColors?: boolean | Array;
/**
* 最近使用的颜色。值为 [] 表示以组件内部的“最近使用颜色”为准,值长度大于 0 则以该值为准显示“最近使用颜色”。值为 null 则完全不显示“最近使用颜色”,非受控属性
* @default []
*/
- defaultRecentColors?: boolean | Array | null;
+ defaultRecentColors?: boolean | Array;
/**
* 透传 SelectInputProps 筛选器输入框组件全部属性
*/
@@ -66,10 +76,15 @@ export interface TdColorPickerProps {
* @default true
*/
showPrimaryColorPreview?: boolean;
+ /**
+ * 组件尺寸
+ * @default medium
+ */
+ size?: SizeEnum;
/**
* 系统预设的颜色样例,值为 `null` 或 `[]` 则不显示系统色,值为 `undefined` 会显示组件内置的系统默认色
*/
- swatchColors?: Array | null;
+ swatchColors?: Array;
/**
* 色值
* @default ''
diff --git a/src/comment/comment.md b/src/comment/comment.md
index f9bbf6f31e..f55fa3571f 100644
--- a/src/comment/comment.md
+++ b/src/comment/comment.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Comment Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/common.ts b/src/common.ts
index e5df47f926..cf41a5950b 100644
--- a/src/common.ts
+++ b/src/common.ts
@@ -5,7 +5,7 @@ import { ReactElement, ReactNode, CSSProperties, FormEvent, DragEvent, Synthetic
// TElement 表示 API 只接受传入组件
export type TElement = T extends undefined ? ReactElement : (props: T) => ReactElement;
// 1. TNode = ReactNode; 2. TNode = (props: T) => ReactNode
-export type TNode = T extends undefined ? ReactNode : ReactNode | ((props: T) => ReactNode);
+export type TNode = T extends undefined ? ReactNode | (() => ReactNode) : ReactNode | ((props: T) => ReactNode);
export type AttachNodeReturnValue = HTMLElement | Element | Document;
export type AttachNode = CSSSelector | ((triggerNode?: HTMLElement) => AttachNodeReturnValue);
@@ -64,10 +64,7 @@ export type HorizontalAlignEnum = 'left' | 'center' | 'right';
export type VerticalAlignEnum = 'top' | 'middle' | 'bottom';
-export enum LayoutEnum {
- VERTICAL = 'vertical',
- HORIZONTAL = 'horizontal',
-}
+export type LayoutEnum = 'vertical' | 'horizontal';
export type ClassName = { [className: string]: any } | ClassName[] | string;
diff --git a/src/config-provider/config-provider.en-US.md b/src/config-provider/config-provider.en-US.md
index 4504d00c2d..e2aaf3d94d 100644
--- a/src/config-provider/config-provider.en-US.md
+++ b/src/config-provider/config-provider.en-US.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### GlobalConfigProvider
name | type | default | description | required
@@ -272,7 +273,6 @@ closeIcon | Function | - | Typescript:`TNode`。[see more ts definition](https
name | type | default | description | required
-- | -- | -- | -- | --
-checkIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
errorIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
### AlertConfig
diff --git a/src/config-provider/config-provider.md b/src/config-provider/config-provider.md
index bd97571d74..f32992c4c0 100644
--- a/src/config-provider/config-provider.md
+++ b/src/config-provider/config-provider.md
@@ -1,36 +1,7 @@
:: BASE_DOC ::
-### 全局组件前缀
-
-TDesign 的组件前缀统一为`t`,在一些业务场景中,有需要改变组件前缀来满足业务的使用场景。
-可以使用`esm`版本(保证您可以修改less vars),通过全局配置修改`classPrefix`,并配合 less-loader 修改`@prefix`这个 less vars 来保证组件样式的正常。
-
-```js
-import { ConfigProvider, Button } from 'tdesign-react/esm'
-import 'tdesign-react/esm/style/index.js'
-
-...
-
-
-
-```
-
-```js
-{
- loaderOptions: {
- less: {
- lessOptions: {
- modifyVars: {
- '@prefix': 'any', // 请注意需要与classPrefix保持一致
- },
- javascriptEnabled: true,
- },
- },
- }
-}
-```
-
## API
+
### GlobalConfigProvider
名称 | 类型 | 默认值 | 说明 | 必传
@@ -302,7 +273,6 @@ closeIcon | Function | - | 关闭图标,【注意】使用渲染函数输出
名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
-checkIcon | TElement | - | 已完成步骤图标,【注意】使用渲染函数输出图标组件。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
errorIcon | TElement | - | 错误步骤图标,【注意】使用渲染函数输出图标组件。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
### AlertConfig
diff --git a/src/date-range-picker/date-range-picker.en-US.md b/src/date-range-picker/date-range-picker.en-US.md
new file mode 100644
index 0000000000..82ab34dd33
--- /dev/null
+++ b/src/date-range-picker/date-range-picker.en-US.md
@@ -0,0 +1,42 @@
+:: BASE_DOC ::
+
+## API
+### DateRangePicker Props
+
+name | type | default | description | required
+-- | -- | -- | -- | --
+className | String | - | 类名 | N
+style | Object | - | 样式,Typescript:`React.CSSProperties` | N
+allowInput | Boolean | false | \- | N
+cancelRangeSelectLimit | Boolean | false | The default date selection interaction is determined based on the order of dates clicked and will be restricted. For example, if a user first clicks on the start date input box and chooses a date, for instance, 2020-05-15, the interaction will automatically shift focus to the end date input box, waiting for the user to select the end time. At this point, the user can only select a date later than 2020-05-15 (previous dates will be grayed out and disabled, restricting the user's selection). When this value is set to `true`, this restriction is lifted. | N
+clearable | Boolean | false | \- | N
+defaultTime | Array | ["00:00:00", "23:59:59"] | Time selector default value。Typescript:`string[]` | N
+disableDate | Object / Array / Function | - | Typescript:`DisableRangeDate` `type DisableRangeDate = Array \| DisableDateObj \| ((context: { date: DateRangeValue; partial: DateRangePickerPartial }) => boolean)` `interface DisableDateObj { from?: string; to?: string; before?: string; after?: string }` `type DateRangePickerPartial = 'start' \| 'end'`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+disabled | Boolean | - | \- | N
+enableTimePicker | Boolean | false | \- | N
+firstDayOfWeek | Number | - | options: 1/2/3/4/5/6/7 | N
+format | String | - | \- | N
+mode | String | date | options: year/quarter/month/week/date | N
+panelPreselection | Boolean | true | \- | N
+placeholder | String / Array | - | Typescript:`string \| Array` | N
+popupProps | Object | - | Typescript:`PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+prefixIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+presets | Object | - | Typescript:`PresetRange` `interface PresetRange { [range: string]: DateRange \| (() => DateRange)}` `type DateRange = [DateValue, DateValue]`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+presetsPlacement | String | bottom | options: left/top/right/bottom | N
+rangeInputProps | Object | - | Typescript:`RangeInputProps`,[RangeInput API Documents](./range-input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+separator | String | - | \- | N
+size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+status | String | default | options: default/success/warning/error | N
+suffixIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+timePickerProps | Object | - | Typescript:`TimePickerProps`,[TimePicker API Documents](./time-picker?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+tips | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+value | Array | [] | Typescript:`DateRangeValue` `type DateRangeValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+defaultValue | Array | [] | uncontrolled property。Typescript:`DateRangeValue` `type DateRangeValue = Array`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+valueType | String | - | options: time-stamp/Date/YYYY/YYYY-MM/YYYY-MM-DD/YYYY-MM-DD HH/YYYY-MM-DD HH:mm/YYYY-MM-DD HH:mm:ss/YYYY-MM-DD HH:mm:ss:SSS | N
+onBlur | Function | | Typescript:`(context: { value: DateRangeValue; partial: DateRangePickerPartial; e: FocusEvent }) => void`
| N
+onChange | Function | | Typescript:`(value: DateRangeValue, context: { dayjsValue?: Dayjs[], trigger?: DatePickerTriggerSource }) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts)。
`import { Dayjs } from 'dayjs'`
| N
+onConfirm | Function | | Typescript:`(context: { date: Date[], e: MouseEvent, partial: DateRangePickerPartial }) => void`
| N
+onFocus | Function | | Typescript:`(context: { value: DateRangeValue; partial: DateRangePickerPartial; e: FocusEvent }) => void`
| N
+onInput | Function | | Typescript:`(context: { input: string; value: DateRangeValue; partial: DateRangePickerPartial; e: InputEvent }) => void`
| N
+onPick | Function | | Typescript:`(value: DateValue, context: PickContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts)。
`interface PickContext { e: MouseEvent; partial: DateRangePickerPartial }`
| N
+onPresetClick | Function | | Typescript:`(context: { preset: PresetDate, e: MouseEvent }) => void`
| N
diff --git a/src/date-range-picker/date-range-picker.md b/src/date-range-picker/date-range-picker.md
new file mode 100644
index 0000000000..38b61034c3
--- /dev/null
+++ b/src/date-range-picker/date-range-picker.md
@@ -0,0 +1,42 @@
+:: BASE_DOC ::
+
+## API
+### DateRangePicker Props
+
+名称 | 类型 | 默认值 | 说明 | 必传
+-- | -- | -- | -- | --
+className | String | - | 类名 | N
+style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
+allowInput | Boolean | false | 是否允许输入日期 | N
+cancelRangeSelectLimit | Boolean | false | 默认的日期选择交互是根据点击前后日期的顺序来决定并且会加以限制。比如:用户先点击开始时间输入框,选择了一个日期例如2020-05-15,紧接着交互会自动将焦点跳到结束日期输入框,等待用户选择结束时间。此时用户只能选择大于2020-05-15的日期(之前的日期会被灰态禁止点击,限制用户的点击)。当该值传递`true`时,则取消该限制。 | N
+clearable | Boolean | false | 是否显示清除按钮 | N
+defaultTime | Array | ["00:00:00", "23:59:59"] | 时间选择器默认值,当 value/defaultValue 未设置值时有效。TS 类型:`string[]` | N
+disableDate | Object / Array / Function | - | 禁用日期,示例:['A', 'B'] 表示日期 A 和日期 B 会被禁用。{ from: 'A', to: 'B' } 表示在 A 到 B 之间的日期会被禁用。{ before: 'A', after: 'B' } 表示在 A 之前和在 B 之后的日期都会被禁用。其中 A = '2021-01-01',B = '2021-02-01'。值类型为 Function 则表示返回值为 true 的日期会被禁用。TS 类型:`DisableRangeDate` `type DisableRangeDate = Array \| DisableDateObj \| ((context: { date: DateRangeValue; partial: DateRangePickerPartial }) => boolean)` `interface DisableDateObj { from?: string; to?: string; before?: string; after?: string }` `type DateRangePickerPartial = 'start' \| 'end'`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+disabled | Boolean | - | 是否禁用组件 | N
+enableTimePicker | Boolean | false | 是否显示时间选择 | N
+firstDayOfWeek | Number | - | 第一天从星期几开始。可选项:1/2/3/4/5/6/7 | N
+format | String | - | 用于格式化日期,[详细文档](https://day.js.org/docs/en/display/format) | N
+mode | String | date | 选择器模式。可选项:year/quarter/month/week/date | N
+panelPreselection | Boolean | true | 在开始日期选中之前,面板是否显示预选状态,即是否高亮预选日期 | N
+placeholder | String / Array | - | 占位符,值为数组表示可分别为开始日期和结束日期设置占位符。TS 类型:`string \| Array` | N
+popupProps | Object | - | 透传给 popup 组件的参数。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+prefixIcon | TElement | - | 组件前置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+presets | Object | - | 预设快捷日期选择,示例:{ '特定日期范围': ['2021-01-01', '2022-01-01'], '本月': [dayjs().startOf('month'), dayjs().endOf('month')] }。TS 类型:`PresetRange` `interface PresetRange { [range: string]: DateRange \| (() => DateRange)}` `type DateRange = [DateValue, DateValue]`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+presetsPlacement | String | bottom | 预设面板展示区域(包含确定按钮)。可选项:left/top/right/bottom | N
+rangeInputProps | Object | - | 透传给范围输入框 RangeInput 组件的参数。TS 类型:`RangeInputProps`,[RangeInput API Documents](./range-input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+separator | String | - | 日期分隔符,支持全局配置,默认为 '-' | N
+size | String | medium | 输入框尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+status | String | default | 输入框状态。可选项:default/success/warning/error | N
+suffixIcon | TElement | - | 组件后置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+timePickerProps | Object | - | 透传 TimePicker 组件属性。TS 类型:`TimePickerProps`,[TimePicker API Documents](./time-picker?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+tips | TNode | - | 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+value | Array | [] | 选中值。TS 类型:`DateRangeValue` `type DateRangeValue = Array`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+defaultValue | Array | [] | 选中值。非受控属性。TS 类型:`DateRangeValue` `type DateRangeValue = Array`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts) | N
+valueType | String | - | 用于格式化日期的值,仅支持部分格式,时间戳、日期等。⚠️ `YYYYMMDD` 这种格式不支持,请勿使用,如果希望支持可以给 `dayjs` 提个 PR。注意和 `format` 的区别,`format` 仅用于处理日期在页面中呈现的格式。可选项:time-stamp/Date/YYYY/YYYY-MM/YYYY-MM-DD/YYYY-MM-DD HH/YYYY-MM-DD HH:mm/YYYY-MM-DD HH:mm:ss/YYYY-MM-DD HH:mm:ss:SSS | N
+onBlur | Function | | TS 类型:`(context: { value: DateRangeValue; partial: DateRangePickerPartial; e: FocusEvent }) => void`
当输入框失去焦点时触发 | N
+onChange | Function | | TS 类型:`(value: DateRangeValue, context: { dayjsValue?: Dayjs[], trigger?: DatePickerTriggerSource }) => void`
选中值发生变化时触发。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts)。
`import { Dayjs } from 'dayjs'`
| N
+onConfirm | Function | | TS 类型:`(context: { date: Date[], e: MouseEvent, partial: DateRangePickerPartial }) => void`
如果存在“确定”按钮,则点击“确定”按钮时触发 | N
+onFocus | Function | | TS 类型:`(context: { value: DateRangeValue; partial: DateRangePickerPartial; e: FocusEvent }) => void`
输入框获得焦点时触发 | N
+onInput | Function | | TS 类型:`(context: { input: string; value: DateRangeValue; partial: DateRangePickerPartial; e: InputEvent }) => void`
输入框数据发生变化时触发,参数 input 表示输入内容,value 表示组件当前有效值 | N
+onPick | Function | | TS 类型:`(value: DateValue, context: PickContext) => void`
选中日期时触发,可能是开始日期,也可能是结束日期,第二个参数可以区分是开始日期或是结束日期。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/date-picker/type.ts)。
`interface PickContext { e: MouseEvent; partial: DateRangePickerPartial }`
| N
+onPresetClick | Function | | TS 类型:`(context: { preset: PresetDate, e: MouseEvent }) => void`
点击预设按钮后触发 | N
diff --git a/src/descriptions/defaultProps.ts b/src/descriptions/defaultProps.ts
index 9a293eb1e4..585ce325a3 100644
--- a/src/descriptions/defaultProps.ts
+++ b/src/descriptions/defaultProps.ts
@@ -6,7 +6,7 @@ import { TdDescriptionsProps, TdDescriptionItemProps } from './type';
export const descriptionsDefaultProps: TdDescriptionsProps = {
bordered: false,
- column: 2,
+ columns: 2,
itemLayout: 'horizontal',
layout: 'horizontal',
size: 'medium',
diff --git a/src/descriptions/descriptions.en-US.md b/src/descriptions/descriptions.en-US.md
index a52229952e..9351fd50bf 100644
--- a/src/descriptions/descriptions.en-US.md
+++ b/src/descriptions/descriptions.en-US.md
@@ -9,10 +9,10 @@ className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
bordered | Boolean | false | set description list with grey border | N
colon | Boolean | - | set label with ":" on the right | N
-column | Number | 2 | count of DescriptionItem in one row | N
+columns | Number | 2 | count of DescriptionItem in one row | N
contentStyle | Object | - | style of description cotent。Typescript:`Styles`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
itemLayout | String | horizontal | layout direction of description item。options: horizontal/vertical | N
-items | Array | - | list of descriptions items。Typescript:`Array` | N
+items | Array | - | list of descriptions items。Typescript:`Array` | N
labelStyle | Object | - | style of description item。Typescript:`Styles`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
layout | String | horizontal | layout direction。options: horizontal/vertical | N
size | String | medium | a descriptions has three size。options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
diff --git a/src/descriptions/descriptions.md b/src/descriptions/descriptions.md
index 923b538be4..09600879db 100644
--- a/src/descriptions/descriptions.md
+++ b/src/descriptions/descriptions.md
@@ -9,10 +9,10 @@ className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
bordered | Boolean | false | 是否带边框 | N
colon | Boolean | - | 字段名右侧是否携带冒号“:” | N
-column | Number | 2 | 一行 `DescriptionItem` 的数量 | N
+columns | Number | 2 | 一行 `DescriptionItem` 的数量 | N
contentStyle | Object | - | 自定义描述项内容的样式。TS 类型:`Styles`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
itemLayout | String | horizontal | 描述项的排列方向。可选项:horizontal/vertical | N
-items | Array | - | 描述项的列表。TS 类型:`Array` | N
+items | Array | - | 描述项的列表。TS 类型:`Array` | N
labelStyle | Object | - | 自定义描述项标签的样式。TS 类型:`Styles`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
layout | String | horizontal | 排列方向。可选项:horizontal/vertical | N
size | String | medium | 组件尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
diff --git a/src/descriptions/type.ts b/src/descriptions/type.ts
index df2888b121..7e5c2e2391 100644
--- a/src/descriptions/type.ts
+++ b/src/descriptions/type.ts
@@ -20,7 +20,7 @@ export interface TdDescriptionsProps {
* 一行 `DescriptionItem` 的数量
* @default 2
*/
- column?: number;
+ columns?: number;
/**
* 自定义描述项内容的样式
*/
@@ -33,7 +33,7 @@ export interface TdDescriptionsProps {
/**
* 描述项的列表
*/
- items?: Array;
+ items?: Array;
/**
* 自定义描述项标签的样式
*/
diff --git a/src/dialog/defaultProps.ts b/src/dialog/defaultProps.ts
index b93b47f711..f849cf277e 100644
--- a/src/dialog/defaultProps.ts
+++ b/src/dialog/defaultProps.ts
@@ -2,23 +2,21 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
-import { TdDialogCardProps, TdDialogProps } from './type';
-
-export const dialogCardDefaultProps: TdDialogCardProps = {
- closeBtn: true,
- footer: true,
- header: true,
- theme: 'default',
-};
+import { TdDialogProps } from './type';
export const dialogDefaultProps: TdDialogProps = {
+ closeBtn: true,
closeOnEscKeydown: undefined,
closeOnOverlayClick: undefined,
+ confirmLoading: undefined,
destroyOnClose: false,
draggable: false,
+ footer: true,
+ header: true,
mode: 'modal',
placement: 'top',
preventScrollThrough: true,
showInAttachedElement: false,
showOverlay: true,
+ theme: 'default',
};
diff --git a/src/dialog/dialog.en-US.md b/src/dialog/dialog.en-US.md
index 50292732d7..b4c0a81e79 100644
--- a/src/dialog/dialog.en-US.md
+++ b/src/dialog/dialog.en-US.md
@@ -7,16 +7,7 @@ name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
-body | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-cancelBtn | TNode | - | Typescript:`string \| ButtonProps \| TNode \| null`,[Button API Documents](./button?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/dialog/type.ts) | N
-closeBtn | TNode | true | Typescript:`string \| boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-confirmBtn | TNode | - | Typescript:`string \| ButtonProps \| TNode \| null`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-footer | TNode | true | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-header | TNode | true | Typescript:`string \| boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-theme | String | default | options:default/info/warning/danger/success | N
-onCancel | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
-onCloseBtnClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
-onConfirm | Function | | Typescript:`(context: { e: MouseEvent \| KeyboardEvent }) => void`
| N
+`Pick` | TNode | - | extends `Pick`。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
### Dialog Props
@@ -25,24 +16,35 @@ name | type | default | description | required
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
attach | String / Function | - | Typescript:`AttachNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+body | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+cancelBtn | TNode | - | Typescript:`string \| ButtonProps \| TNode \| null`,[Button API Documents](./button?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/dialog/type.ts) | N
children | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-closeOnEscKeydown | Boolean | true | \- | N
+closeBtn | TNode | true | Typescript:`string \| boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+closeOnEscKeydown | Boolean | true | trigger dialog close event on `ESC` keydown | N
closeOnOverlayClick | Boolean | true | \- | N
+confirmBtn | TNode | - | Typescript:`string \| ButtonProps \| TNode \| null`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+confirmLoading | Boolean | undefined | confirm button loading status | N
confirmOnEnter | Boolean | - | confirm on enter | N
destroyOnClose | Boolean | false | \- | N
+dialogClassName | String | - | \- | N
draggable | Boolean | false | \- | N
-mode | String | modal | options:modal/modeless/full-screen | N
-placement | String | top | options:top/center | N
+footer | TNode | true | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+header | TNode | true | Typescript:`string \| boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+mode | String | modal | options: modal/modeless/full-screen | N
+placement | String | top | options: top/center | N
preventScrollThrough | Boolean | true | \- | N
showInAttachedElement | Boolean | false | \- | N
showOverlay | Boolean | true | \- | N
+theme | String | default | options: default/info/warning/danger/success | N
top | String / Number | - | \- | N
visible | Boolean | - | \- | N
width | String / Number | - | \- | N
zIndex | Number | - | \- | N
-`DialogCardProps` | \- | - | \- | N
+onCancel | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
onClose | Function | | Typescript:`(context: DialogCloseContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/dialog/type.ts)。
`type DialogEventSource = 'esc' \| 'close-btn' \| 'cancel' \| 'overlay'`
`interface DialogCloseContext { trigger: DialogEventSource; e: MouseEvent \| KeyboardEvent }`
| N
+onCloseBtnClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
onClosed | Function | | Typescript:`() => void`
| N
+onConfirm | Function | | Typescript:`(context: { e: MouseEvent \| KeyboardEvent }) => void`
| N
onEscKeydown | Function | | Typescript:`(context: { e: KeyboardEvent }) => void`
| N
onOpened | Function | | Typescript:`() => void`
| N
onOverlayClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
@@ -54,7 +56,7 @@ name | type | default | description | required
attach | String / Function | 'body' | Typescript:`AttachNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
className | String | - | \- | N
style | Object | - | Typescript:`Styles`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-`Omit` | \- | - | \- | N
+`Omit` | \- | - | extends `Omit` | N
### DialogInstance
@@ -62,6 +64,7 @@ name | params | return | description
-- | -- | -- | --
destroy | \- | \- | required
hide | \- | \- | required
+setConfirmLoading | `(loading: boolean)` | \- | required。set confirm button loading status
show | \- | \- | required
update | `(props: DialogOptions)` | \- | required
diff --git a/src/dialog/dialog.md b/src/dialog/dialog.md
index 6b79e473f0..da9ff49516 100644
--- a/src/dialog/dialog.md
+++ b/src/dialog/dialog.md
@@ -1,26 +1,5 @@
:: BASE_DOC ::
-### 函数式调用
-
-函数调用方式一:`DialogPlugin(options)`
-
-函数调用方式二:`DialogPlugin.confirm(options)`
-
-函数调用方式三:`DialogPlugin.alert(options)`
-
-
-
-组件实例:`DialogInstance = DialogPlugin(options)`
-
-组件实例方法-销毁弹框:`DialogInstance.destroy()`
-
-组件实例方法-隐藏弹框:`DialogInstance.hide()`
-
-组件实例方法-显示弹窗:`DialogInstance.show()`
-
-组件实例方法-更新弹框:`DialogInstance.update()`
-
-{{ plugin }}
## API
### DialogCard Props
@@ -28,16 +7,7 @@
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
-body | TNode | - | 对话框内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-cancelBtn | TNode | - | 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件。TS 类型:`string \| ButtonProps \| TNode \| null`,[Button API Documents](./button?tab=api)。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/dialog/type.ts) | N
-closeBtn | TNode | true | 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。值类型为 TNode,则表示呈现自定义按钮示例。TS 类型:`string \| boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-confirmBtn | TNode | - | 确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件。TS 类型:`string \| ButtonProps \| TNode \| null`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-footer | TNode | true | 底部操作栏,默认会有“确认”和“取消”两个按钮。值为 true 显示默认操作按钮,值为 false 不显示任何内容,值类型为 Function 表示自定义底部内容。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-header | TNode | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 string 则直接显示值,值类型为 Function 表示自定义头部内容。TS 类型:`string \| boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-theme | String | default | 对话框风格。可选项:default/info/warning/danger/success | N
-onCancel | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
如果“取消”按钮存在,则点击“取消”按钮时触发,同时触发关闭事件 | N
-onCloseBtnClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击右上角关闭按钮时触发 | N
-onConfirm | Function | | TS 类型:`(context: { e: MouseEvent \| KeyboardEvent }) => void`
如果“确认”按钮存在,则点击“确认”按钮时触发,或者键盘按下回车键时触发 | N
+`Pick` | TNode | - | 继承 `Pick` 中的全部属性。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
### Dialog Props
@@ -46,24 +16,35 @@ onConfirm | Function | | TS 类型:`(context: { e: MouseEvent \| KeyboardEven
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
attach | String / Function | - | 对话框挂载的节点。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`AttachNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+body | TNode | - | 对话框内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+cancelBtn | TNode | - | 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件。TS 类型:`string \| ButtonProps \| TNode \| null`,[Button API Documents](./button?tab=api)。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/dialog/type.ts) | N
children | TNode | - | 对话框内容,同 body。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+closeBtn | TNode | true | 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。值类型为 TNode,则表示呈现自定义按钮示例。TS 类型:`string \| boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
closeOnEscKeydown | Boolean | true | 按下 ESC 时是否触发对话框关闭事件 | N
closeOnOverlayClick | Boolean | true | 点击蒙层时是否触发关闭事件 | N
+confirmBtn | TNode | - | 确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件。TS 类型:`string \| ButtonProps \| TNode \| null`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+confirmLoading | Boolean | undefined | 确认按钮加载状态 | N
confirmOnEnter | Boolean | - | 是否在按下回车键时,触发确认事件 | N
destroyOnClose | Boolean | false | 是否在关闭弹框的时候销毁子元素 | N
+dialogClassName | String | - | 弹框元素类名,示例:'t-class-dialog-first t-class-dialog-second' | N
draggable | Boolean | false | 对话框是否可以拖拽(仅在非模态对话框时有效) | N
+footer | TNode | true | 底部操作栏,默认会有“确认”和“取消”两个按钮。值为 true 显示默认操作按钮,值为 false 不显示任何内容,值类型为 Function 表示自定义底部内容。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+header | TNode | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 string 则直接显示值,值类型为 Function 表示自定义头部内容。TS 类型:`string \| boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
mode | String | modal | 对话框类型,有 3 种:模态对话框、非模态对话框、全屏对话框。弹出「模态对话框」时,只能操作对话框里面的内容,不能操作其他内容。弹出「非模态对话框」时,则可以操作页面内所有内容。「普通对话框」是指没有脱离文档流的对话框,可以在这个基础上开发更多的插件。可选项:modal/modeless/full-screen | N
placement | String | top | 对话框位置,内置两种:垂直水平居中显示 和 靠近顶部(top:20%)显示。默认情况,为避免贴顶或贴底,顶部和底部距离最小为 `48px`,可通过调整 `top` 覆盖默认大小。可选项:top/center | N
preventScrollThrough | Boolean | true | 防止滚动穿透 | N
showInAttachedElement | Boolean | false | 仅在挂载元素中显示抽屉,默认在浏览器可视区域显示。父元素需要有定位属性,如:position: relative | N
showOverlay | Boolean | true | 是否显示遮罩层 | N
+theme | String | default | 对话框风格。可选项:default/info/warning/danger/success | N
top | String / Number | - | 用于弹框具体窗口顶部的距离,优先级大于 placement | N
visible | Boolean | - | 控制对话框是否显示 | N
width | String / Number | - | 对话框宽度,示例:320, '500px', '80%' | N
zIndex | Number | - | 对话框层级,Web 侧样式默认为 2500,移动端和小程序样式默认为 1500 | N
-`DialogCardProps` | \- | - | 继承 `DialogCardProps` 中的全部 API | N
+onCancel | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
如果“取消”按钮存在,则点击“取消”按钮时触发,同时触发关闭事件 | N
onClose | Function | | TS 类型:`(context: DialogCloseContext) => void`
关闭事件,点击取消按钮、点击关闭按钮、点击蒙层、按下 ESC 等场景下触发。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/dialog/type.ts)。
`type DialogEventSource = 'esc' \| 'close-btn' \| 'cancel' \| 'overlay'`
`interface DialogCloseContext { trigger: DialogEventSource; e: MouseEvent \| KeyboardEvent }`
| N
+onCloseBtnClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击右上角关闭按钮时触发 | N
onClosed | Function | | TS 类型:`() => void`
对话框消失动画效果结束后触发 | N
+onConfirm | Function | | TS 类型:`(context: { e: MouseEvent \| KeyboardEvent }) => void`
如果“确认”按钮存在,则点击“确认”按钮时触发,或者键盘按下回车键时触发 | N
onEscKeydown | Function | | TS 类型:`(context: { e: KeyboardEvent }) => void`
按下 ESC 时触发事件 | N
onOpened | Function | | TS 类型:`() => void`
对话框弹出动画效果结束后触发 | N
onOverlayClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
如果蒙层存在,点击蒙层时触发 | N
@@ -75,7 +56,7 @@ onOverlayClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void
attach | String / Function | 'body' | 对话框挂载的节点。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`AttachNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
className | String | - | 弹框类名,示例:'t-class-dialog-first t-class-dialog-second' | N
style | Object | - | 弹框 style 属性,输入 [CSSStyleDeclaration.cssText](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/cssText)。TS 类型:`Styles`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-`Omit` | \- | - | 继承 `Omit` 中的全部 API | N
+`Omit` | \- | - | 继承 `Omit` 中的全部属性 | N
### DialogInstance
@@ -83,6 +64,7 @@ style | Object | - | 弹框 style 属性,输入 [CSSStyleDeclaration.cssText](
-- | -- | -- | --
destroy | \- | \- | 必需。销毁弹框
hide | \- | \- | 必需。隐藏弹框
+setConfirmLoading | `(loading: boolean)` | \- | 必需。设置确认按钮加载状态
show | \- | \- | 必需。显示弹框
update | `(props: DialogOptions)` | \- | 必需。更新弹框内容
diff --git a/src/dialog/type.ts b/src/dialog/type.ts
index 7081092e04..7adb712006 100644
--- a/src/dialog/type.ts
+++ b/src/dialog/type.ts
@@ -8,20 +8,28 @@ import { ButtonProps } from '../button';
import { TNode, Styles, AttachNode } from '../common';
import { MouseEvent, KeyboardEvent } from 'react';
-export interface TdDialogProps extends TdDialogCardProps {
- /**
- * 弹框元素类名,示例:'t-class-dialog-first t-class-dialog-second'
- * @default ''
- */
- dialogClassName?: string;
+export interface TdDialogProps {
/**
* 对话框挂载的节点。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body
*/
attach?: AttachNode;
+ /**
+ * 对话框内容
+ */
+ body?: TNode;
+ /**
+ * 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件
+ */
+ cancelBtn?: ButtonProps | TNode | null;
/**
* 对话框内容,同 body
*/
children?: TNode;
+ /**
+ * 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。值类型为 TNode,则表示呈现自定义按钮示例
+ * @default true
+ */
+ closeBtn?: TNode;
/**
* 按下 ESC 时是否触发对话框关闭事件
*/
@@ -30,6 +38,14 @@ export interface TdDialogProps extends TdDialogCardProps {
* 点击蒙层时是否触发关闭事件
*/
closeOnOverlayClick?: boolean;
+ /**
+ * 确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件
+ */
+ confirmBtn?: ButtonProps | TNode | null;
+ /**
+ * 确认按钮加载状态
+ */
+ confirmLoading?: boolean;
/**
* 是否在按下回车键时,触发确认事件
*/
@@ -39,11 +55,26 @@ export interface TdDialogProps extends TdDialogCardProps {
* @default false
*/
destroyOnClose?: boolean;
+ /**
+ * 弹框元素类名,示例:'t-class-dialog-first t-class-dialog-second'
+ * @default ''
+ */
+ dialogClassName?: string;
/**
* 对话框是否可以拖拽(仅在非模态对话框时有效)
* @default false
*/
draggable?: boolean;
+ /**
+ * 底部操作栏,默认会有“确认”和“取消”两个按钮。值为 true 显示默认操作按钮,值为 false 不显示任何内容,值类型为 Function 表示自定义底部内容
+ * @default true
+ */
+ footer?: TNode;
+ /**
+ * 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 string 则直接显示值,值类型为 Function 表示自定义头部内容
+ * @default true
+ */
+ header?: TNode;
/**
* 对话框类型,有 3 种:模态对话框、非模态对话框、全屏对话框。弹出「模态对话框」时,只能操作对话框里面的内容,不能操作其他内容。弹出「非模态对话框」时,则可以操作页面内所有内容。「普通对话框」是指没有脱离文档流的对话框,可以在这个基础上开发更多的插件
* @default modal
@@ -69,6 +100,11 @@ export interface TdDialogProps extends TdDialogCardProps {
* @default true
*/
showOverlay?: boolean;
+ /**
+ * 对话框风格
+ * @default default
+ */
+ theme?: 'default' | 'info' | 'warning' | 'danger' | 'success';
/**
* 用于弹框具体窗口顶部的距离,优先级大于 placement
*/
@@ -85,14 +121,26 @@ export interface TdDialogProps extends TdDialogCardProps {
* 对话框层级,Web 侧样式默认为 2500,移动端和小程序样式默认为 1500
*/
zIndex?: number;
+ /**
+ * 如果“取消”按钮存在,则点击“取消”按钮时触发,同时触发关闭事件
+ */
+ onCancel?: (context: { e: MouseEvent }) => void;
/**
* 关闭事件,点击取消按钮、点击关闭按钮、点击蒙层、按下 ESC 等场景下触发
*/
onClose?: (context: DialogCloseContext) => void;
+ /**
+ * 点击右上角关闭按钮时触发
+ */
+ onCloseBtnClick?: (context: { e: MouseEvent }) => void;
/**
* 对话框消失动画效果结束后触发
*/
onClosed?: () => void;
+ /**
+ * 如果“确认”按钮存在,则点击“确认”按钮时触发,或者键盘按下回车键时触发
+ */
+ onConfirm?: (context: { e: MouseEvent | KeyboardEvent }) => void;
/**
* 按下 ESC 时触发事件
*/
@@ -107,52 +155,20 @@ export interface TdDialogProps extends TdDialogCardProps {
onOverlayClick?: (context: { e: MouseEvent }) => void;
}
-export interface TdDialogCardProps {
- /**
- * 对话框内容
- */
- body?: TNode;
- /**
- * 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件
- */
- cancelBtn?: ButtonProps | TNode | null;
- /**
- * 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。值类型为 TNode,则表示呈现自定义按钮示例
- * @default true
- */
- closeBtn?: TNode;
- /**
- * 确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件
- */
- confirmBtn?: ButtonProps | TNode | null;
- /**
- * 底部操作栏,默认会有“确认”和“取消”两个按钮。值为 true 显示默认操作按钮,值为 false 不显示任何内容,值类型为 Function 表示自定义底部内容
- * @default true
- */
- footer?: TNode;
- /**
- * 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 string 则直接显示值,值类型为 Function 表示自定义头部内容
- * @default true
- */
- header?: TNode;
- /**
- * 对话框风格
- * @default default
- */
- theme?: 'default' | 'info' | 'warning' | 'danger' | 'success';
- /**
- * 如果“取消”按钮存在,则点击“取消”按钮时触发,同时触发关闭事件
- */
- onCancel?: (context: { e: MouseEvent }) => void;
- /**
- * 点击右上角关闭按钮时触发
- */
- onCloseBtnClick?: (context: { e: MouseEvent }) => void;
- /**
- * 如果“确认”按钮存在,则点击“确认”按钮时触发,或者键盘按下回车键时触发
- */
- onConfirm?: (context: { e: MouseEvent | KeyboardEvent }) => void;
-}
+export interface TdDialogCardProps
+ extends Pick<
+ TdDialogProps,
+ | 'body'
+ | 'cancelBtn'
+ | 'closeBtn'
+ | 'confirmBtn'
+ | 'footer'
+ | 'header'
+ | 'theme'
+ | 'onCancel'
+ | 'onCloseBtnClick'
+ | 'onConfirm'
+ > {}
export interface DialogOptions extends Omit {
/**
@@ -161,12 +177,12 @@ export interface DialogOptions extends Omit {
*/
attach?: AttachNode;
/**
- * ctx 弹框顶层元素类名,示例:'t-class-dialog-ctx-first t-class-dialog-ctx-second'
+ * 弹框类名,示例:'t-class-dialog-first t-class-dialog-second'
* @default ''
*/
className?: string;
/**
- * 弹框顶层元素 style 属性,输入 [CSSStyleDeclaration.cssText](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/cssText)
+ * 弹框 style 属性,输入 [CSSStyleDeclaration.cssText](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/cssText)
*/
style?: Styles;
}
@@ -180,6 +196,10 @@ export interface DialogInstance {
* 隐藏弹框
*/
hide: () => void;
+ /**
+ * 设置确认按钮加载状态
+ */
+ setConfirmLoading: (loading: boolean) => void;
/**
* 显示弹框
*/
diff --git a/src/drawer/defaultProps.ts b/src/drawer/defaultProps.ts
index 17cdbe8a41..cc28c017a9 100644
--- a/src/drawer/defaultProps.ts
+++ b/src/drawer/defaultProps.ts
@@ -8,7 +8,6 @@ export const drawerDefaultProps: TdDrawerProps = {
closeOnEscKeydown: undefined,
closeOnOverlayClick: undefined,
destroyOnClose: false,
- closeBtn: true,
footer: true,
header: true,
mode: 'overlay',
diff --git a/src/dropdown/defaultProps.ts b/src/dropdown/defaultProps.ts
index 5faa771c3d..a9c9197ea3 100644
--- a/src/dropdown/defaultProps.ts
+++ b/src/dropdown/defaultProps.ts
@@ -6,10 +6,12 @@ import { TdDropdownProps, TdDropdownItemProps } from './type';
export const dropdownDefaultProps: TdDropdownProps = {
direction: 'right',
+ disabled: false,
hideAfterItemClick: true,
maxColumnWidth: 100,
maxHeight: 300,
minColumnWidth: 10,
+ options: [],
placement: 'bottom-left',
trigger: 'hover',
};
diff --git a/src/dropdown/dropdown.md b/src/dropdown/dropdown.md
index 6d44f63f7e..d6fb0e88b1 100644
--- a/src/dropdown/dropdown.md
+++ b/src/dropdown/dropdown.md
@@ -1,11 +1,5 @@
:: BASE_DOC ::
-### 通过传入Children方式使用下拉菜单
-
-下拉菜单操作项支持通过传入Children的方式传递操作项。
-
-{{ child }}
-
## API
### Dropdown Props
diff --git a/src/dropdown/type.ts b/src/dropdown/type.ts
index 370dbb2db5..bf10b66f71 100644
--- a/src/dropdown/type.ts
+++ b/src/dropdown/type.ts
@@ -44,14 +44,6 @@ export interface TdDropdownProps {
* @default []
*/
options?: Array;
- /**
- * 面板内的底部内容
- */
- panelBottomContent?: TNode;
- /**
- * 面板内的顶部内容
- */
- panelTopContent?: TNode;
/**
* 弹窗定位方式,可选值同 Popup 组件
* @default bottom-left
diff --git a/src/empty/defaultProps.ts b/src/empty/defaultProps.ts
new file mode 100644
index 0000000000..ce79e1e01a
--- /dev/null
+++ b/src/empty/defaultProps.ts
@@ -0,0 +1,7 @@
+/**
+ * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
+ * */
+
+import { TdEmptyProps } from './type';
+
+export const emptyDefaultProps: TdEmptyProps = { type: 'empty' };
diff --git a/src/empty/empty.en-US.md b/src/empty/empty.en-US.md
new file mode 100644
index 0000000000..9f5e9849ac
--- /dev/null
+++ b/src/empty/empty.en-US.md
@@ -0,0 +1,15 @@
+:: BASE_DOC ::
+
+## API
+### Empty Props
+
+name | type | default | description | required
+-- | -- | -- | -- | --
+className | String | - | 类名 | N
+style | Object | - | 样式,Typescript:`React.CSSProperties` | N
+action | TElement | - | action block。Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+description | TNode | - | empty component description。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+image | TNode | - | image url, or Image component props, or custom any node you need.。Typescript:`string \| ImageProps \| TNode `,[Image API Documents](./image?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/empty/type.ts) | N
+imageStyle | Object | - | pass `Cascading Style Sheets` to image element。Typescript:`Styles`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+title | TNode | - | empty component title。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+type | String | empty | Empty component type。options: empty/success/fail/network-error/maintenance | N
diff --git a/src/empty/empty.md b/src/empty/empty.md
new file mode 100644
index 0000000000..23c337ca86
--- /dev/null
+++ b/src/empty/empty.md
@@ -0,0 +1,15 @@
+:: BASE_DOC ::
+
+## API
+### Empty Props
+
+名称 | 类型 | 默认值 | 说明 | 必传
+-- | -- | -- | -- | --
+className | String | - | 类名 | N
+style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
+action | TElement | - | 操作区域。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+description | TNode | - | 描述文字。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+image | TNode | - | 组件图片,可以完全自定义内容。值类型为字符串时,表示图片地址;值类型为对象时,则表示透传全部属性到图片组件,示例:``。TS 类型:`string \| ImageProps \| TNode `,[Image API Documents](./image?tab=api)。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/empty/type.ts) | N
+imageStyle | Object | - | 透传图片样式表。TS 类型:`Styles`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+title | TNode | - | 错误标题。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+type | String | empty | 组件类型,如:空数据/成功/失败/网络错误/建设中。可选项:empty/success/fail/network-error/maintenance | N
diff --git a/src/empty/type.ts b/src/empty/type.ts
new file mode 100644
index 0000000000..c2bf77c7dc
--- /dev/null
+++ b/src/empty/type.ts
@@ -0,0 +1,36 @@
+/* eslint-disable */
+
+/**
+ * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
+ * */
+
+import { ImageProps } from '../image';
+import { TNode, TElement, Styles } from '../common';
+
+export interface TdEmptyProps {
+ /**
+ * 操作区域
+ */
+ action?: TElement;
+ /**
+ * 描述文字
+ */
+ description?: TNode;
+ /**
+ * 组件图片,可以完全自定义内容。值类型为字符串时,表示图片地址;值类型为对象时,则表示透传全部属性到图片组件,示例:``
+ */
+ image?: ImageProps | TNode;
+ /**
+ * 透传图片样式表
+ */
+ imageStyle?: Styles;
+ /**
+ * 错误标题
+ */
+ title?: TNode;
+ /**
+ * 组件类型,如:空数据/成功/失败/网络错误/建设中
+ * @default empty
+ */
+ type?: 'empty' | 'success' | 'fail' | 'network-error' | 'maintenance';
+}
diff --git a/src/form/form.en-US.md b/src/form/form.en-US.md
index df0aacadb4..cc3590fc68 100644
--- a/src/form/form.en-US.md
+++ b/src/form/form.en-US.md
@@ -67,7 +67,6 @@ status | String | - | Typescript:`'error' \| 'warning' \| 'success' \| 'valida
statusIcon | TNode | undefined | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
successBorder | Boolean | false | \- | N
tips | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-valueFormat | Function | - | Triggered when user interaction results in data changes, used to format data。Typescript:`FormItemFormatType` `type FormItemFormatType = (value: any) => any`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/form/type.ts) | N
### FormList Props
@@ -97,7 +96,7 @@ number | Boolean | - | \- | N
pattern | Object | - | Typescript:`RegExp` | N
required | Boolean | - | \- | N
telnumber | Boolean | - | \- | N
-trigger | String | change | options: change/blur/submit | N
+trigger | String | change | options: change/blur | N
type | String | error | options: error/warning | N
url | Boolean / Object | - | Typescript:`boolean \| IsURLOptions` `import { IsURLOptions } from 'validator/es/lib/isURL'`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/form/type.ts) | N
validator | Function | - | Typescript:`CustomValidator` `type CustomValidator = (val: ValueType) => CustomValidateResolveType \| Promise` `type CustomValidateResolveType = boolean \| CustomValidateObj` `interface CustomValidateObj { result: boolean; message: string; type?: 'error' \| 'warning' \| 'success' }` `type ValueType = any`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/form/type.ts) | N
diff --git a/src/form/form.md b/src/form/form.md
index c29eefa879..4eec629b41 100644
--- a/src/form/form.md
+++ b/src/form/form.md
@@ -1,95 +1,5 @@
:: BASE_DOC ::
-### 复杂嵌套数据结构表单
-
-可给 `name` 传入数组整理成对象嵌套数据结构
-
-{{ nested-data }}
-
-### 动态增减嵌套表单
-
-可使用 `Form.FormList` 组件创建动态表单
-
-{{ form-list }}
-
-## Hooks
-
-### Form.useForm
-
-创建 Form 实例,用于管理所有数据状态。
-
-
-### Form.useWatch
-
-用于直接获取 form 中字段对应的值。
-
-```js
-const Demo = () => {
- const [form] = Form.useForm();
- const userName = Form.useWatch('username', form);
-
- return (
-
-
-
-
- );
-};
-```
-
-## FAQ
-
-### 为什么被 FormItem 包裹的组件 value、defaultValue 没有效果?
-
-Form 组件设计的初衷是为了解放开发者配置大量的 `value`、`onChange` 受控属性,所以 Form.FormItem 被设计成需要拦截嵌套组件的受控属性,如需定义初始值请使用 `initialData` 属性。
-
-由于 Form.FormItem 只会拦截第一层子节点的受控属性,所以如不希望 Form.FormItem 拦截受控属性希望自行管理 state 的话,可以在 Form.FormItem 下包裹一层 `div` 节点脱离 Form.FormItem 的代理,但同时也会失去 Form 组件的校验能力。
-
-### 我只想要 Form 组件的布局效果,校验能力我自己业务来实现可以吗?
-
-可以的,Form 的校验能力只跟 `name` 属性关联,不指定 Form.FormItem 的 `name` 属性是可以当成布局组件来使用的,甚至可以实现各种嵌套自定义内容的布局效果。
-
-```js
-// 可以单独使用 FormItem 组件
-
- 可以任意定制内容
-
- 可以任意定制内容
-
-```
-
-### getFieldsValue 返回的数据如何支持嵌套数据结构?
-
-将 `name` 设置成数组形式可以支持嵌套数据结构。
-
-```js
-// ['user', 'name'] => { user: { name: '' } }
-
-
-
-```
-
-### 如何根据某个字段变化动态展示数据
-
-而在某些特定场景,例如修改某个字段值后出现新的字段选项、或者纯粹希望表单任意变化都对某一个区域进行渲染。你可以通过 `shouldUpdate` 修改 `FormItem` 的更新逻辑。
-
-```js
- prev.additional !== next.additional}>
- {({ getFieldValue }) => {
- if (getFieldValue('additional') === 'test') {
- return (
-
-
-
- );
- }
- return null;
- }}
-
-
-```
-
## API
### Form Props
@@ -157,7 +67,6 @@ status | String | - | 校验状态,可在需要完全自主控制校验状态
statusIcon | TNode | undefined | 校验状态图标,值为 `true` 显示默认图标,默认图标有 成功、失败、警告 等,不同的状态图标不同。`statusIcon` 值为 `false`,不显示图标。`statusIcon` 值类型为渲染函数,则可以自定义右侧状态图标。优先级高级 Form 的 statusIcon。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
successBorder | Boolean | false | 是否显示校验成功的边框,默认不显示 | N
tips | TNode | - | 自定义提示内容,样式跟随 `status` 变动,可在需要完全自主控制校验规则时使用。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-valueFormat | Function | - | 当用户交互产生数据变化时触发,用于格式化数据。TS 类型:`FormItemFormatType` `type FormItemFormatType = (value: any) => any`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/form/type.ts) | N
### FormList Props
@@ -187,7 +96,7 @@ number | Boolean | - | 内置校验方法,校验值是否为数字(1.2 、 1
pattern | Object | - | 内置校验方法,校验值是否符合正则表达式匹配结果,示例:`{ pattern: /@qq.com/, message: '请输入 QQ 邮箱' }`。TS 类型:`RegExp` | N
required | Boolean | - | 内置校验方法,校验值是否已经填写。该值为 true,默认显示必填标记,可通过设置 `requiredMark: false` 隐藏必填标记 | N
telnumber | Boolean | - | 内置校验方法,校验值是否为手机号码,校验正则为 `/^1[3-9]\d{9}$/`,示例:`{ telnumber: true, message: '请输入正确的手机号码' }` | N
-trigger | String | change | 校验触发方式。可选项:change/blur/submit | N
+trigger | String | change | 校验触发方式。可选项:change/blur | N
type | String | error | 校验未通过时呈现的错误信息类型,有 告警信息提示 和 错误信息提示 等两种。可选项:error/warning | N
url | Boolean / Object | - | 内置校验方法,校验值是否为网络链接地址,[参数文档](https://github.com/validatorjs/validator.js),示例:`{ url: { protocols: ['http','https','ftp'] }, message: '请输入正确的 Url 地址' }`。TS 类型:`boolean \| IsURLOptions` `import { IsURLOptions } from 'validator/es/lib/isURL'`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/form/type.ts) | N
validator | Function | - | 自定义校验规则,示例:`{ validator: (val) => val.length > 0, message: '请输入内容'}`。TS 类型:`CustomValidator` `type CustomValidator = (val: ValueType) => CustomValidateResolveType \| Promise` `type CustomValidateResolveType = boolean \| CustomValidateObj` `interface CustomValidateObj { result: boolean; message: string; type?: 'error' \| 'warning' \| 'success' }` `type ValueType = any`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/form/type.ts) | N
diff --git a/src/form/type.ts b/src/form/type.ts
index 178119685b..09985c87de 100644
--- a/src/form/type.ts
+++ b/src/form/type.ts
@@ -108,11 +108,7 @@ export interface FormInstanceFunctions {
/**
* 获取 form dom 元素
*/
- currentElement?: HTMLFormElement;
- /**
- * 获取 form dom 元素
- */
- getCurrentElement?: () => HTMLFormElement;
+ currentElement: () => HTMLFormElement;
/**
* 获取单个字段值
*/
@@ -120,7 +116,7 @@ export interface FormInstanceFunctions {
/**
* 获取一组字段名对应的值,当调用 getFieldsValue(true) 时返回所有表单数据
*/
- getFieldsValue: getFieldsValue;
+ getFieldsValue: () => getFieldsValue;
/**
* 重置表单,表单里面没有重置按钮``时可以使用该方法,默认重置全部字段为空,该方法会触发 `reset` 事件。
如果表单属性 `resetType='empty'` 或者 `reset.type='empty'` 会重置为空;
如果表单属性 `resetType='initial'` 或者 `reset.type='initial'` 会重置为表单初始值。
`reset.fields` 用于设置具体重置哪些字段,示例:`reset({ type: 'initial', fields: ['name', 'age'] })`
*/
@@ -180,8 +176,9 @@ export interface TdFormItemProps {
labelWidth?: string | number;
/**
* 表单字段名称
+ * @default ''
*/
- name?: NamePath;
+ name?: string;
/**
* 是否显示必填符号(*),优先级高于 Form.requiredMark
*/
@@ -217,10 +214,6 @@ export interface TdFormItemProps {
* 自定义提示内容,样式跟随 `status` 变动,可在需要完全自主控制校验规则时使用
*/
tips?: TNode;
- /**
- * 当用户交互产生数据变化时触发,用于格式化数据
- */
- valueFormat?: FormItemFormatType;
}
export interface TdFormListProps {
@@ -300,7 +293,7 @@ export interface FormRule {
* 校验触发方式
* @default change
*/
- trigger?: 'change' | 'blur' | 'submit';
+ trigger?: 'change' | 'blur';
/**
* 校验未通过时呈现的错误信息类型,有 告警信息提示 和 错误信息提示 等两种
* @default error
@@ -388,7 +381,7 @@ export interface FormErrorMessage {
validator?: string;
}
-export type FormRules = { [field in keyof T]?: Array };
+export type FormRules = { [field in keyof T]?: Array };
export interface SubmitContext {
e?: FormSubmitEvent;
@@ -447,12 +440,8 @@ export type ValidateTriggerType = 'blur' | 'change' | 'all';
export type Data = { [key: string]: any };
-export type FormItemFormatType = (value: any) => any;
-
export type InitialData = any;
-export type NamePath = string | number | Array;
-
export type FormListField = { key: number; name: number; isListField: boolean };
export type FormListFieldOperation = {
diff --git a/src/guide/__tests__/vitest-guide.test.jsx b/src/guide/__tests__/vitest-guide.test.jsx
index 7db3285870..07149c6556 100644
--- a/src/guide/__tests__/vitest-guide.test.jsx
+++ b/src/guide/__tests__/vitest-guide.test.jsx
@@ -17,25 +17,25 @@ import {
describe('Guide Component', () => {
it('props.counter works fine', async () => {
getGuideDefaultMount(Guide, { counter: TNode });
- await mockDelay(60);
- const customNodeDom = document.querySelector('.custom-node');
- expect(customNodeDom).toBeTruthy();
+ await mockDelay(10);
const tGuideCounterDom = document.querySelector('.t-guide__counter');
expect(tGuideCounterDom).toBeTruthy();
+ const customNodeDom = document.querySelector('.custom-node');
+ expect(customNodeDom).toBeTruthy();
});
it('props.counter is a function with params', async () => {
const fn = vi.fn();
getGuideDefaultMount(Guide, { counter: fn });
- await mockDelay(60);
+ await mockDelay(10);
expect(fn).toHaveBeenCalled();
expect(fn.mock.calls[0][0].total).toBe(1);
expect(fn.mock.calls[0][0].current).toBe(0);
});
- it('props.current works fine.', async () => {
+ it('props.current is equal 0', async () => {
getGuideMultipleStepsMount(Guide, { current: 0 });
- await mockDelay(60);
+ await mockDelay(10);
const tGuideCounterDom = document.querySelector('.t-guide__counter');
expect(tGuideCounterDom.textContent).toBe('1/3');
const tGuideTitleDom = document.querySelectorAll('.t-guide__title');
@@ -52,9 +52,9 @@ describe('Guide Component', () => {
expect(tGuideActionTGuideFinishDom).toBeFalsy();
});
- it('props.current works fine.', async () => {
+ it('props.current is equal 1', async () => {
getGuideMultipleStepsMount(Guide, { current: 1 });
- await mockDelay(60);
+ await mockDelay(10);
const tGuideCounterDom = document.querySelector('.t-guide__counter');
expect(tGuideCounterDom.textContent).toBe('2/3');
const tGuideTitleDom = document.querySelectorAll('.t-guide__title');
@@ -71,9 +71,9 @@ describe('Guide Component', () => {
expect(tGuideActionTGuideFinishDom).toBeFalsy();
});
- it('props.current works fine.', async () => {
+ it('props.current is equal 2', async () => {
getGuideMultipleStepsMount(Guide, { current: 2 });
- await mockDelay(60);
+ await mockDelay(10);
const tGuideCounterDom = document.querySelector('.t-guide__counter');
expect(tGuideCounterDom.textContent).toBe('3/3');
const tGuideTitleDom = document.querySelectorAll('.t-guide__title');
@@ -90,44 +90,23 @@ describe('Guide Component', () => {
expect(tGuideActionTGuideFinishDom.length).toBe(1);
});
- it('props.current works fine. `{"document.t-guide__counter":false}` should exist', async () => {
+ it('props.current is equal -1', async () => {
getGuideMultipleStepsMount(Guide, { current: -1 });
- await mockDelay(60);
+ await mockDelay(10);
const tGuideCounterDom = document.querySelector('.t-guide__counter');
expect(tGuideCounterDom).toBeFalsy();
});
it(`props.finishButtonProps is equal to {theme: 'warning'}`, async () => {
getGuideMultipleStepsMount(Guide, { current: 2, finishButtonProps: { theme: 'warning' } });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__finish');
expect(domWrapper).toHaveClass('t-button--theme-warning');
});
- it('props.hideCounter works fine. `{"document.t-guide__counter":false}` should exist', async () => {
- getGuideDefaultMount(Guide, { hideCounter: true });
- await mockDelay(60);
- const tGuideCounterDom = document.querySelector('.t-guide__counter');
- expect(tGuideCounterDom).toBeFalsy();
- });
-
- it('props.hidePrev works fine. `{"document.t-guide__action .t-guide__prev":false}` should exist', async () => {
- getGuideMultipleStepsMount(Guide, { current: 1, hidePrev: true });
- await mockDelay(60);
- const tGuideActionTGuidePrevDom = document.querySelector('.t-guide__action .t-guide__prev');
- expect(tGuideActionTGuidePrevDom).toBeFalsy();
- });
-
- it('props.hideSkip works fine. `{"document.t-guide__action .t-guide__skip":false}` should exist', async () => {
- getGuideMultipleStepsMount(Guide, { current: 1, hideSkip: true });
- await mockDelay(60);
- const tGuideActionTGuideSkipDom = document.querySelector('.t-guide__action .t-guide__skip');
- expect(tGuideActionTGuideSkipDom).toBeFalsy();
- });
-
it(`props.highlightPadding is equal to 32`, async () => {
getGuideDefaultMount(Guide, { highlightPadding: 32 });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__highlight--mask');
expect(domWrapper.style.width).toBe('64px');
expect(domWrapper.style.height).toBe('64px');
@@ -142,61 +121,42 @@ describe('Guide Component', () => {
it(`props.nextButtonProps is equal to {theme: 'warning'}`, async () => {
getGuideMultipleStepsMount(Guide, { current: 1, nextButtonProps: { theme: 'warning' } });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__next');
expect(domWrapper).toHaveClass('t-button--theme-warning');
});
it(`props.prevButtonProps is equal to {theme: 'warning'}`, async () => {
getGuideMultipleStepsMount(Guide, { current: 2, prevButtonProps: { theme: 'warning' } });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__prev');
expect(domWrapper).toHaveClass('t-button--theme-warning');
});
- it('props.showOverlay works fine. `{"document.t-guide__highlight--mask":1}` should exist', async () => {
+ it('props.showOverlay is equal true', async () => {
getGuideDefaultMount(Guide, { showOverlay: true });
- await mockDelay(60);
+ await mockDelay(10);
const tGuideHighlightMaskDom = document.querySelectorAll('.t-guide__highlight--mask');
expect(tGuideHighlightMaskDom.length).toBe(1);
});
- it('props.showOverlay works fine. `{"document.t-guide__highlight--mask":false}` should exist', async () => {
+ it('props.showOverlay is equal false', async () => {
getGuideDefaultMount(Guide, { showOverlay: false });
- await mockDelay(60);
+ await mockDelay(10);
const tGuideHighlightMaskDom = document.querySelector('.t-guide__highlight--mask');
expect(tGuideHighlightMaskDom).toBeFalsy();
});
it(`props.skipButtonProps is equal to {theme: 'warning'}`, async () => {
getGuideMultipleStepsMount(Guide, { current: 0, skipButtonProps: { theme: 'warning' } });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__skip');
expect(domWrapper).toHaveClass('t-button--theme-warning');
});
- it('props.steps works fine.', async () => {
- getGuideDefaultMount(Guide);
- await mockDelay(60);
- const tGuideCounterDom = document.querySelector('.t-guide__counter');
- expect(tGuideCounterDom.textContent).toBe('1/1');
- const tGuideTitleDom = document.querySelectorAll('.t-guide__title');
- expect(tGuideTitleDom.length).toBe(1);
- const tGuideDescDom = document.querySelectorAll('.t-guide__desc');
- expect(tGuideDescDom.length).toBe(1);
- const tGuideActionTGuideSkipDom = document.querySelector('.t-guide__action .t-guide__skip');
- expect(tGuideActionTGuideSkipDom).toBeFalsy();
- const tGuideActionTGuidePrevDom = document.querySelector('.t-guide__action .t-guide__prev');
- expect(tGuideActionTGuidePrevDom).toBeFalsy();
- const tGuideActionTGuideNextDom = document.querySelector('.t-guide__action .t-guide__next');
- expect(tGuideActionTGuideNextDom).toBeFalsy();
- const tGuideActionTGuideFinishDom = document.querySelectorAll('.t-guide__action .t-guide__finish');
- expect(tGuideActionTGuideFinishDom.length).toBe(1);
- });
-
it(`props.zIndex is equal to 5000`, async () => {
- getGuideDefaultMount(Guide, { zIndex: '5000' });
- await mockDelay(60);
+ getGuideDefaultMount(Guide, { zIndex: 5000 });
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__overlay');
expect(domWrapper.style.zIndex).toBe('4998');
const domWrapper1 = document.querySelector('.t-guide__highlight--mask');
@@ -206,7 +166,7 @@ describe('Guide Component', () => {
it('events.change works fine', async () => {
const onChangeFn = vi.fn();
getGuideMultipleStepsMount(Guide, { current: 0 }, { onChange: onChangeFn });
- await mockDelay(60);
+ await mockDelay(10);
fireEvent.click(document.querySelector('.t-guide__next'));
expect(onChangeFn).toHaveBeenCalled();
expect(onChangeFn.mock.calls[0][0]).toBe(1);
@@ -217,7 +177,7 @@ describe('Guide Component', () => {
it('events.change works fine', async () => {
const onChangeFn = vi.fn();
getGuideMultipleStepsMount(Guide, { current: 1 }, { onChange: onChangeFn });
- await mockDelay(60);
+ await mockDelay(10);
fireEvent.click(document.querySelector('.t-guide__prev'));
expect(onChangeFn).toHaveBeenCalled();
expect(onChangeFn.mock.calls[0][0]).toBe(0);
@@ -228,7 +188,7 @@ describe('Guide Component', () => {
it('events.finish works fine', async () => {
const onFinishFn = vi.fn();
getGuideMultipleStepsMount(Guide, { current: 2 }, { onFinish: onFinishFn });
- await mockDelay(60);
+ await mockDelay(10);
fireEvent.click(document.querySelector('.t-guide__finish'));
expect(onFinishFn).toHaveBeenCalled();
expect(onFinishFn.mock.calls[0][0].current).toBe(2);
@@ -239,7 +199,7 @@ describe('Guide Component', () => {
it('events.nextStepClick works fine', async () => {
const onNextStepClickFn = vi.fn();
getGuideMultipleStepsMount(Guide, { current: 1 }, { onNextStepClick: onNextStepClickFn });
- await mockDelay(60);
+ await mockDelay(10);
fireEvent.click(document.querySelector('.t-guide__next'));
expect(onNextStepClickFn).toHaveBeenCalled();
expect(onNextStepClickFn.mock.calls[0][0].current).toBe(1);
@@ -251,7 +211,7 @@ describe('Guide Component', () => {
it('events.prevStepClick works fine', async () => {
const onPrevStepClickFn = vi.fn();
getGuideMultipleStepsMount(Guide, { current: 1 }, { onPrevStepClick: onPrevStepClickFn });
- await mockDelay(60);
+ await mockDelay(10);
fireEvent.click(document.querySelector('.t-guide__prev'));
expect(onPrevStepClickFn).toHaveBeenCalled();
expect(onPrevStepClickFn.mock.calls[0][0].current).toBe(1);
@@ -263,7 +223,7 @@ describe('Guide Component', () => {
it('events.skip works fine', async () => {
const onSkipFn = vi.fn();
getGuideMultipleStepsMount(Guide, { current: 0 }, { onSkip: onSkipFn });
- await mockDelay(60);
+ await mockDelay(10);
fireEvent.click(document.querySelector('.t-guide__skip'));
expect(onSkipFn).toHaveBeenCalled();
expect(onSkipFn.mock.calls[0][0].current).toBe(0);
@@ -275,7 +235,7 @@ describe('Guide Component', () => {
describe('Guide Component', () => {
it('GuideStep.body works fine', async () => {
getCustomGuideStepMount(Guide, { body: TNode });
- await mockDelay(60);
+ await mockDelay(10);
const customNodeDom = document.querySelector('.custom-node');
expect(customNodeDom).toBeTruthy();
expect(document.body).toMatchSnapshot();
@@ -283,7 +243,7 @@ describe('Guide Component', () => {
it('GuideStep.children works fine', async () => {
getCustomGuideStepMount(Guide, { children: TNode });
- await mockDelay(60);
+ await mockDelay(10);
const customNodeDom = document.querySelector('.custom-node');
expect(customNodeDom).toBeTruthy();
expect(document.body).toMatchSnapshot();
@@ -291,7 +251,7 @@ describe('Guide Component', () => {
it('GuideStep.content works fine', async () => {
getCustomGuideStepMount(Guide, { content: TNode });
- await mockDelay(60);
+ await mockDelay(10);
const customNodeDom = document.querySelector('.custom-node');
expect(customNodeDom).toBeTruthy();
expect(document.body).toMatchSnapshot();
@@ -299,7 +259,7 @@ describe('Guide Component', () => {
it('GuideStep.highlightContent works fine', async () => {
getCustomGuideStepMount(Guide, { highlightContent: TNode });
- await mockDelay(60);
+ await mockDelay(10);
const customNodeDom = document.querySelector('.custom-node');
expect(customNodeDom).toBeTruthy();
expect(document.body).toMatchSnapshot();
@@ -307,7 +267,7 @@ describe('Guide Component', () => {
it(`GuideStep.highlightPadding is equal to 32`, async () => {
getCustomGuideStepMount(Guide, { highlightPadding: 32 });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__highlight--mask');
expect(domWrapper.style.width).toBe('64px');
expect(domWrapper.style.height).toBe('64px');
@@ -320,27 +280,16 @@ describe('Guide Component', () => {
expect(domWrapper1.style.left).toBe('-32px');
});
- const modeExpectedDom = ['.t-popup', '.t-guide__dialog'];
- ['popup', 'dialog'].forEach((item, index) => {
- it(`GuideStep.mode is equal to ${item}`, async () => {
- const { container } = getCustomGuideStepMount(Guide, { mode: item });
- await mockDelay(60);
- const modeExpectedDomIndexDom = document.querySelector(modeExpectedDom[index]);
- expect(modeExpectedDomIndexDom).toBeTruthy();
- expect(container).toMatchSnapshot();
- });
- });
-
it(`GuideStep.nextButtonProps is equal to {theme: 'warning'}`, async () => {
getCustomMultipleGuideStepMount(Guide, { current: 1, nextButtonProps: { theme: 'warning' } });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__next');
expect(domWrapper).toHaveClass('t-button--theme-warning');
});
it(`GuideStep.placement is equal to bottom-left`, async () => {
getCustomGuideStepMount(Guide, { placement: 'bottom-left' });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-popup');
expect(domWrapper.getAttribute('data-popper-placement')).toBe('bottom-start');
expect(document.body).toMatchSnapshot();
@@ -348,42 +297,42 @@ describe('Guide Component', () => {
it(`GuideStep.popupProps is equal to {placement: 'top-left'}`, async () => {
getCustomGuideStepMount(Guide, { popupProps: { placement: 'top-left' } });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-popup');
expect(domWrapper.getAttribute('data-popper-placement')).toBe('top-start');
});
it(`GuideStep.prevButtonProps is equal to {theme: 'warning'}`, async () => {
getCustomMultipleGuideStepMount(Guide, { current: 2, prevButtonProps: { theme: 'warning' } });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__prev');
expect(domWrapper).toHaveClass('t-button--theme-warning');
});
- it('props.showOverlay: .t-guide__highlight--mask should exit if showOverlay=true', async () => {
+ it('GuideStep.showOverlay is equal true', async () => {
getCustomMultipleGuideStepMount(Guide, { showOverlay: true });
- await mockDelay(60);
+ await mockDelay(10);
const tGuideHighlightMaskDom = document.querySelectorAll('.t-guide__highlight--mask');
expect(tGuideHighlightMaskDom.length).toBe(1);
});
- it('props.showOverlay: .t-guide__highlight--mask should not exit if showOverlay=false', async () => {
+ it('GuideStep.showOverlay is equal false', async () => {
getCustomMultipleGuideStepMount(Guide, { showOverlay: false });
- await mockDelay(60);
+ await mockDelay(10);
const tGuideHighlightMaskDom = document.querySelector('.t-guide__highlight--mask');
expect(tGuideHighlightMaskDom).toBeFalsy();
});
it(`GuideStep.skipButtonProps is equal to {theme: 'warning'}`, async () => {
getCustomMultipleGuideStepMount(Guide, { current: 1, skipButtonProps: { theme: 'warning' } });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-guide__skip');
expect(domWrapper).toHaveClass('t-button--theme-warning');
});
it(`GuideStep.stepOverlayClass is equal to t-test-guide-step-overlay`, async () => {
getCustomGuideStepMount(Guide, { stepOverlayClass: 't-test-guide-step-overlay' });
- await mockDelay(60);
+ await mockDelay(10);
const domWrapper = document.querySelector('.t-popup');
expect(domWrapper).toHaveClass('t-test-guide-step-overlay');
expect(document.body).toMatchSnapshot();
@@ -391,7 +340,7 @@ describe('Guide Component', () => {
it('GuideStep.title works fine', async () => {
getCustomGuideStepMount(Guide, { title: TNode });
- await mockDelay(60);
+ await mockDelay(10);
const customNodeDom = document.querySelector('.custom-node');
expect(customNodeDom).toBeTruthy();
expect(document.body).toMatchSnapshot();
diff --git a/src/guide/guide.en-US.md b/src/guide/guide.en-US.md
index fdacf92c7e..2778e76929 100644
--- a/src/guide/guide.en-US.md
+++ b/src/guide/guide.en-US.md
@@ -15,7 +15,7 @@ hideCounter | Boolean | false | \- | N
hidePrev | Boolean | false | \- | N
hideSkip | Boolean | false | \- | N
highlightPadding | Number | 8 | \- | N
-mode | String | popup | options:popup/dialog | N
+mode | String | popup | options: popup/dialog | N
nextButtonProps | Object | - | Typescript:`ButtonProps`,[Button API Documents](./button?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/guide/type.ts) | N
prevButtonProps | Object | - | Typescript:`ButtonProps` | N
showOverlay | Boolean | true | \- | N
@@ -38,7 +38,7 @@ content | TElement | - | Typescript:`TNode`。[see more ts definition](https:/
element | String / Function | - | required。Typescript:`AttachNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | Y
highlightContent | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
highlightPadding | Number | - | \- | N
-mode | String | - | options:popup/dialog | N
+mode | String | - | options: popup/dialog | N
nextButtonProps | Object | - | Typescript:`ButtonProps` | N
offset | Array | - | this api is in discussing. do not use it.。Typescript:`Array` | N
placement | String | 'top' | Typescript:`StepPopupPlacement \| StepDialogPlacement` `type StepPopupPlacement = 'top'\|'left'\|'right'\|'bottom'\|'top-left'\|'top-right'\|'bottom-left'\|'bottom-right'\|'left-top'\|'left-bottom'\|'right-top'\|'right-bottom'` `type StepDialogPlacement = 'top'\|'center' `。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/guide/type.ts) | N
@@ -47,4 +47,4 @@ prevButtonProps | Object | - | Typescript:`ButtonProps` | N
showOverlay | Boolean | true | \- | N
skipButtonProps | Object | - | Typescript:`ButtonProps` | N
stepOverlayClass | String | - | \- | N
-title | String | - | \- | N
+title | TNode | - | title of current step。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
diff --git a/src/guide/guide.md b/src/guide/guide.md
index 24f28c8b44..afef908721 100644
--- a/src/guide/guide.md
+++ b/src/guide/guide.md
@@ -47,4 +47,4 @@ prevButtonProps | Object | - | 用于自定义当前引导框的上一步按钮
showOverlay | Boolean | true | 是否出现遮罩层 | N
skipButtonProps | Object | - | 用于自定义当前步骤引导框的跳过按钮的内容。TS 类型:`ButtonProps` | N
stepOverlayClass | String | - | 覆盖引导框的类名 | N
-title | String | - | 当前步骤的标题内容 | N
+title | TNode | - | 当前步骤的标题内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
diff --git a/src/guide/type.ts b/src/guide/type.ts
index 4eb79f16af..3b47865304 100644
--- a/src/guide/type.ts
+++ b/src/guide/type.ts
@@ -165,9 +165,8 @@ export interface GuideStep {
stepOverlayClass?: string;
/**
* 当前步骤的标题内容
- * @default ''
*/
- title?: string;
+ title?: TNode;
}
export type StepPopupPlacement =
diff --git a/src/icon/icon.en-US.md b/src/icon/icon.en-US.md
index 2c8c294296..cfe2eb96f3 100644
--- a/src/icon/icon.en-US.md
+++ b/src/icon/icon.en-US.md
@@ -1,65 +1,5 @@
:: BASE_DOC ::
-### Install tdesign-icons-react
-
-Icons are published and managed as a separate npm package. If you want to use it directly in your project, please install `tdesign-icons-react`.
-### Import on-demand
-
-SVG icons can be imported on demand. When using the Icon component in component development, SVG icons are imported on demand.
-
-`import { CloseIcon } from 'tdesign-icons-react';`
-
-{{ IconExample }}
-
-### Full import
-
-The icon size supports multiple units, such as 'small', 'medium', 'large', '35px', '3em', etc.
-The icon color is controlled by CSS, for example, using style="color: red" or style="fill: red".
-Click on the 「All Icons」 navigation on the right to view all icons in the component library.
-
-{{ SvgSpriteExample }}
-
-### Iconfont
-
-{{ IconFontExample }}
-
-### Advanced usage of SVG
-
-
-New svg icons can be added by passing in the URL.
-
-The component will import default svg icons. If you want to disable the loading of default svg icons, set `loadDefaultIcons` to `false`.
-
-{{ Enhanced }}
-
-### Advanced usage of iconfont
-
-New iconfont icons can be added by passing in the URL.
-
-The component will import default iconfont icons. If you want to disable the loading of default iconfont icons, set `loadDefaultIcons` to `false`.
-
-{{ IconFontEnhanced }}
-
-### Icon Selector
-
-If you need to select icons in your project, please use `Select` to implement an icon selector.
-
-{{ IconSelect }}
-
-### FAQ
-
-#### How to get all the names of icons?
-
-You can get all the name of icon by import manifest from the bundle `import { manifest } from 'tdesign-icons-react'`
-
-#### the usage of full import needs network. What if my project is in a no-network scenario?
-
-if your project is in a no-network scenario, please use on-demand loading of icons. For example,`` should be changed to ``
-### All Icons
-
-
-
-
## API
### IconSVG Props
diff --git a/src/icon/icon.md b/src/icon/icon.md
index 4751de814c..cc69d750cf 100644
--- a/src/icon/icon.md
+++ b/src/icon/icon.md
@@ -1,78 +1,7 @@
:: BASE_DOC ::
-### 安装独立 Icon 包
-
-图标相对其他基础组件较为独立,所以作为一个独立的 `npm` 包做发布管理。如果项目中直接使用,请安装 `tdesign-icons-react`。
-图标库中共包含超过 **25** 类,**1200+** 个图标,推荐您按需引用图标,减少产物的体积。
-
-### 按需引入图标
-
-推荐使用按需引入的方式使用图标,通过如下方式按需引入。
-
-`import { CloseIcon } from 'tdesign-icons-react';`
-
-{{ IconExample }}
-
-### 全量引入使用图标
-
-图标尺寸单位支持多种, 'small', 'medium', 'large', '35px', '3em' 等。
-图标颜色使用 CSS 控制,如:style="color: red",或者 style="fill: red"。
-点击右侧导航「全部图标」即可查看组件库全部图标。
-
-{{ SvgSpriteExample }}
-
-### IconFont 图标
-
-您也可以以 IconFont 的形式使用图标,通过如下来使用图标。
-
-`import { IconFont } from 'tdesign-icons-react';`
-
-{{ IconFontExample }}
-
-### SVG 高级用法
-
-可以传入 url 加入新的 SVG 图标。
-
-引入新的图标 Url 之后,图标名称必须写全称,以作区分,如:`"name='home'"` 需要写成 `"name='t-icon-home'"`。
-
-组件会引入默认的 SVG 图标,如果希望禁止组件加载默认的 SVG 图标,将 `loadDefaultIcons` 置为 false 即可。
-
-{{ Enhanced }}
-
-
-### IconFont 高级用法
-
-可以传入 url 加入新的 iconfont 图标。
-
-引入新的图标 Url 之后,图标名称必须写全称,以作区分,如:`"name='home'"` 需要写成 `"name='t-icon-home'"`。
-
-组件会引入默认的 iconfont 图标,如果希望禁止组件加载默认的 iconfont 图标,将 `loadDefaultIcons` 置为 false 即可。
-
-{{ IconFontEnhanced }}
-
-### 图标选择器
-
-在一些业务场景中,存在需要选择图标的情况,可以配合`Select`组件来实现`图标选择器`。
-
-{{ IconSelect }}
-
-### FAQ
-
-#### 如何获取全部图标的名称列表?
-
-可以通过`import { manifest } from 'tdesign-icons-react'` 获取全部图标的名称列表。
-
-### iconfont和icon使用时都会发起网络请求,我的项目是无网络场景,如何使用?
-
-`iconfont`需要加载图标的字体资源,而`icon`需要加载图标的 svgsprite 资源,这些资源都是相对来说比较大的,所以没有直接放在包里(当然不排除未来会做改动),所以会发起网络请求。
-
-所以如果你的项目是无网络场景,请使用按需加载的图标,如``。
-
-### 全部图标
-
-
-
## API
+
### IconSVG Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/image-viewer/defaultProps.ts b/src/image-viewer/defaultProps.ts
index d6d4a553c7..e0b99ebe3b 100644
--- a/src/image-viewer/defaultProps.ts
+++ b/src/image-viewer/defaultProps.ts
@@ -6,7 +6,6 @@ import { TdImageViewerProps } from './type';
export const imageViewerDefaultProps: TdImageViewerProps = {
closeBtn: true,
- closeOnEscKeydown: true,
draggable: undefined,
images: [],
defaultIndex: 0,
diff --git a/src/image-viewer/type.ts b/src/image-viewer/type.ts
index b1fa3d2f40..72b76dc4a7 100644
--- a/src/image-viewer/type.ts
+++ b/src/image-viewer/type.ts
@@ -15,7 +15,6 @@ export interface TdImageViewerProps {
closeBtn?: TNode;
/**
* 按下 ESC 时是否触发图片预览器关闭事件
- * @default true
*/
closeOnEscKeydown?: boolean;
/**
@@ -27,7 +26,7 @@ export interface TdImageViewerProps {
*/
draggable?: boolean;
/**
- * 图片缩放相关配置。`imageScale.max` 缩放的最大比例;`imageScale.min` 缩放的最小比例;`imageScale.step` 缩放的步长速度; `imageScale.defaultScale` 默认的缩放比例
+ * 图片缩放相关配置。`imageScale.max` 缩放的最大比例;`imageScale.min` 缩放的最小比例;`imageScale.step` 缩放的步长速度
*/
imageScale?: ImageScale;
/**
@@ -99,7 +98,6 @@ export interface ImageScale {
max: number;
min: number;
step: number;
- defaultScale?: number;
}
export interface ImageInfo {
diff --git a/src/image/image.en-US.md b/src/image/image.en-US.md
index 0639351646..f72c440d51 100644
--- a/src/image/image.en-US.md
+++ b/src/image/image.en-US.md
@@ -9,18 +9,15 @@ className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
alt | String | - | \- | N
error | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-fallback | String | - | display `fallback` image on `src` loading failed. you can also use `error` to define more complex error content | N
-fit | String | fill | options: contain/cover/fill/none/scale-down | N
+fit | String | fill | options:contain/cover/fill/none/scale-down | N
gallery | Boolean | false | \- | N
lazy | Boolean | false | \- | N
loading | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
overlayContent | TNode | - | overlay on the top of image。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-overlayTrigger | String | always | options: always/hover | N
+overlayTrigger | String | always | options:always/hover | N
placeholder | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
position | String | center | \- | N
-referrerpolicy | String | - | attribute of ``, [MDN Definition](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy)。options: no-referrer/no-referrer-when-downgrade/origin/origin-when-cross-origin/same-origin/strict-origin/strict-origin-when-cross-origin/unsafe-url | N
-shape | String | square | options: circle/round/square | N
-src | String / Object | - | src attribute of ``. image File can also be loaded。Typescript:`string \| File` | N
-srcset | Object | - | for `.avif` and `.webp` image url, load `srcset` before `src`。Typescript:`ImageSrcset` `interface ImageSrcset { 'image/avif': string; 'image/webp': string; }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/image/type.ts) | N
+shape | String | square | options:circle/round/square | N
+src | String | - | \- | N
onError | Function | | Typescript:`(context: { e: ImageEvent }) => void`
trigger on image load failed | N
onLoad | Function | | Typescript:`(context: { e: ImageEvent }) => void`
trigger on image loaded | N
diff --git a/src/image/image.md b/src/image/image.md
index 25c004e456..812f83b7aa 100644
--- a/src/image/image.md
+++ b/src/image/image.md
@@ -9,7 +9,6 @@ className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
alt | String | - | 图片描述 | N
error | TNode | - | 自定义图片加载失败状态下的显示内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-fallback | String | - | 图片加载失败时,显示当前链接设置的图片地址。如果要使用组件图标或完全自定义加载失败时显示的内容,请更为使用 `error` | N
fit | String | fill | 图片填充模式。可选项:contain/cover/fill/none/scale-down | N
gallery | Boolean | false | 是否展示为图集样式 | N
lazy | Boolean | false | 是否开启图片懒加载 | N
@@ -18,9 +17,7 @@ overlayContent | TNode | - | 图片上方的浮层内容。TS 类型:`string \
overlayTrigger | String | always | 浮层 `overlayContent` 出现的时机。可选项:always/hover | N
placeholder | TNode | - | 占位元素,展示层级低于 `loading` `error` 和图片本身,值类型为字符串时表示占位图片地址。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
position | String | center | 等同于原生的 object-position 属性,可选值为 top right bottom left 或 string,可以自定义任何单位,px 或者 百分比 | N
-referrerpolicy | String | - | `` 标签的原生属性,[MDN 定义](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy)。可选项:no-referrer/no-referrer-when-downgrade/origin/origin-when-cross-origin/same-origin/strict-origin/strict-origin-when-cross-origin/unsafe-url | N
shape | String | square | 图片圆角类型。可选项:circle/round/square | N
-src | String / Object | - | 用于显示图片的链接或原始图片文件对象。TS 类型:`string \| File` | N
-srcset | Object | - | 图片链接集合,用于支持特殊格式的图片,如 `.avif` 和 `.webp`。会优先加载 `srcset` 中的图片格式,浏览器不支持的情况下,加载 `src` 设置的图片地址。TS 类型:`ImageSrcset` `interface ImageSrcset { 'image/avif': string; 'image/webp': string; }`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/image/type.ts) | N
+src | String | - | 图片链接 | N
onError | Function | | TS 类型:`(context: { e: ImageEvent }) => void`
图片加载失败时触发 | N
onLoad | Function | | TS 类型:`(context: { e: ImageEvent }) => void`
图片加载完成时触发 | N
diff --git a/src/image/type.ts b/src/image/type.ts
index 0ba1f34a85..f79b930f08 100644
--- a/src/image/type.ts
+++ b/src/image/type.ts
@@ -16,11 +16,6 @@ export interface TdImageProps {
* 自定义图片加载失败状态下的显示内容
*/
error?: TNode;
- /**
- * 图片加载失败时,显示当前链接设置的图片地址。如果要使用组件图标或完全自定义加载失败时显示的内容,请更为使用 `error`
- * @default ''
- */
- fallback?: string;
/**
* 图片填充模式
* @default fill
@@ -58,31 +53,16 @@ export interface TdImageProps {
* @default center
*/
position?: string;
- /**
- * `` 标签的原生属性,[MDN 定义](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy)
- */
- referrerpolicy?:
- | 'no-referrer'
- | 'no-referrer-when-downgrade'
- | 'origin'
- | 'origin-when-cross-origin'
- | 'same-origin'
- | 'strict-origin'
- | 'strict-origin-when-cross-origin'
- | 'unsafe-url';
/**
* 图片圆角类型
* @default square
*/
shape?: 'circle' | 'round' | 'square';
/**
- * 用于显示图片的链接或原始图片文件对象
- */
- src?: string | File;
- /**
- * 图片链接集合,用于支持特殊格式的图片,如 `.avif` 和 `.webp`。会优先加载 `srcset` 中的图片格式,浏览器不支持的情况下,加载 `src` 设置的图片地址
+ * 图片链接
+ * @default ''
*/
- srcset?: ImageSrcset;
+ src?: string;
/**
* 图片加载失败时触发
*/
@@ -92,8 +72,3 @@ export interface TdImageProps {
*/
onLoad?: (context: { e: ImageEvent }) => void;
}
-
-export interface ImageSrcset {
- 'image/avif': string;
- 'image/webp': string;
-}
diff --git a/src/infinity-scroll/type.ts b/src/infinity-scroll/type.ts
new file mode 100644
index 0000000000..cb71924043
--- /dev/null
+++ b/src/infinity-scroll/type.ts
@@ -0,0 +1,33 @@
+/* eslint-disable */
+
+/**
+ * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
+ * */
+
+import { InfinityScroll } from '../common';
+
+export interface InfinityScroll {
+ /**
+ * 表示除可视区域外,额外渲染的行数,避免快速滚动过程中,新出现的内容来不及渲染从而出现空白
+ * @default 20
+ */
+ bufferSize?: number;
+ /**
+ * 表示每行内容是否同一个固定高度,仅在 `scroll.type` 为 `virtual` 时有效,该属性设置为 `true` 时,可用于简化虚拟滚动内部计算逻辑,提升性能,此时则需要明确指定 `scroll.rowHeight` 属性的值
+ * @default false
+ */
+ isFixedRowHeight?: boolean;
+ /**
+ * 行高,不会给``元素添加样式高度,仅作为滚动时的行高参考。一般情况不需要设置该属性。如果设置,可尽量将该属性设置为每行平均高度,从而使得滚动过程更加平滑
+ */
+ rowHeight?: number;
+ /**
+ * 启动虚拟滚动的阈值。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动
+ * @default 100
+ */
+ threshold?: number;
+ /**
+ * 滚动加载类型,有两种:懒加载和虚拟滚动。
值为 `lazy` ,表示滚动时会进行懒加载,非可视区域内的内容将不会默认渲染,直到该内容可见时,才会进行渲染,并且已渲染的内容滚动到不可见时,不会被销毁;
值为`virtual`时,表示会进行虚拟滚动,无论滚动条滚动到哪个位置,同一时刻,仅渲染该可视区域内的内容,当需要展示的数据量较大时,建议开启该特性
+ */
+ type: 'lazy' | 'virtual';
+}
diff --git a/src/input-adornment/input-adornment.md b/src/input-adornment/input-adornment.md
index 68b5f232a8..5ce0718bfa 100644
--- a/src/input-adornment/input-adornment.md
+++ b/src/input-adornment/input-adornment.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### InputAdornment Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/input-number/input-number.en-US.md b/src/input-number/input-number.en-US.md
index 601c41539f..843cffdb1c 100644
--- a/src/input-number/input-number.en-US.md
+++ b/src/input-number/input-number.en-US.md
@@ -29,7 +29,7 @@ tips | TNode | - | Typescript:`string \| TNode`。[see more ts definition](htt
value | String / Number | - | Typescript:`T` `type InputNumberValue = number \| string`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input-number/type.ts) | N
defaultValue | String / Number | - | uncontrolled property。Typescript:`T` `type InputNumberValue = number \| string`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input-number/type.ts) | N
onBlur | Function | | Typescript:`(value: InputNumberValue, context: { e: FocusEvent }) => void`
| N
-onChange | Function | | Typescript:`(value: T, context: ChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input-number/type.ts)。
`interface ChangeContext { type: ChangeSource; e: InputEvent \| MouseEvent \| FocusEvent \| KeyboardEvent \| CompositionEvent }`
`type ChangeSource = 'add' \| 'reduce' \| 'input' \| 'blur' \| 'enter' \| 'clear' \| 'props'`
| N
+onChange | Function | | Typescript:`(value: T, context: ChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input-number/type.ts)。
`interface ChangeContext { type: ChangeSource; e: InputEvent \| MouseEvent \| FocusEvent \| KeyboardEvent }`
`type ChangeSource = 'add' \| 'reduce' \| 'input' \| 'blur' \| 'enter' \| 'clear' \| 'props'`
| N
onEnter | Function | | Typescript:`(value: InputNumberValue, context: { e: KeyboardEvent }) => void`
| N
onFocus | Function | | Typescript:`(value: InputNumberValue, context: { e: FocusEvent }) => void`
| N
onKeydown | Function | | Typescript:`(value: InputNumberValue, context: { e: KeyboardEvent }) => void`
| N
diff --git a/src/input-number/input-number.md b/src/input-number/input-number.md
index 31786f502b..221443e657 100644
--- a/src/input-number/input-number.md
+++ b/src/input-number/input-number.md
@@ -29,7 +29,7 @@ tips | TNode | - | 输入框下方提示文本,会根据不同的 `status` 呈
value | String / Number | - | 数字输入框的值。当值为 '' 时,输入框显示为空。TS 类型:`T` `type InputNumberValue = number \| string`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input-number/type.ts) | N
defaultValue | String / Number | - | 数字输入框的值。当值为 '' 时,输入框显示为空。非受控属性。TS 类型:`T` `type InputNumberValue = number \| string`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input-number/type.ts) | N
onBlur | Function | | TS 类型:`(value: InputNumberValue, context: { e: FocusEvent }) => void`
失去焦点时触发 | N
-onChange | Function | | TS 类型:`(value: T, context: ChangeContext) => void`
值变化时触发,`type` 表示触发本次变化的来源。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input-number/type.ts)。
`interface ChangeContext { type: ChangeSource; e: InputEvent \| MouseEvent \| FocusEvent \| KeyboardEvent \| CompositionEvent }`
`type ChangeSource = 'add' \| 'reduce' \| 'input' \| 'blur' \| 'enter' \| 'clear' \| 'props'`
| N
+onChange | Function | | TS 类型:`(value: T, context: ChangeContext) => void`
值变化时触发,`type` 表示触发本次变化的来源。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input-number/type.ts)。
`interface ChangeContext { type: ChangeSource; e: InputEvent \| MouseEvent \| FocusEvent \| KeyboardEvent }`
`type ChangeSource = 'add' \| 'reduce' \| 'input' \| 'blur' \| 'enter' \| 'clear' \| 'props'`
| N
onEnter | Function | | TS 类型:`(value: InputNumberValue, context: { e: KeyboardEvent }) => void`
回车键按下时触发 | N
onFocus | Function | | TS 类型:`(value: InputNumberValue, context: { e: FocusEvent }) => void`
获取焦点时触发 | N
onKeydown | Function | | TS 类型:`(value: InputNumberValue, context: { e: KeyboardEvent }) => void`
键盘按下时触发 | N
diff --git a/src/input-number/type.ts b/src/input-number/type.ts
index 932a1b0946..fd23dfe39c 100644
--- a/src/input-number/type.ts
+++ b/src/input-number/type.ts
@@ -6,7 +6,7 @@
import { InputProps } from '../input';
import { TNode } from '../common';
-import { MouseEvent, KeyboardEvent, FocusEvent, FormEvent, CompositionEvent } from 'react';
+import { MouseEvent, KeyboardEvent, FocusEvent, FormEvent } from 'react';
export interface TdInputNumberProps {
/**
@@ -145,8 +145,7 @@ export interface ChangeContext {
| FormEvent
| MouseEvent
| FocusEvent
- | KeyboardEvent
- | CompositionEvent;
+ | KeyboardEvent;
}
export type ChangeSource = 'add' | 'reduce' | 'input' | 'blur' | 'enter' | 'clear' | 'props';
diff --git a/src/input/defaultProps.ts b/src/input/defaultProps.ts
index 98bbbbe035..4c55e17147 100644
--- a/src/input/defaultProps.ts
+++ b/src/input/defaultProps.ts
@@ -10,6 +10,7 @@ export const inputDefaultProps: TdInputProps = {
autoWidth: false,
autocomplete: undefined,
autofocus: false,
+ borderless: false,
clearable: false,
placeholder: undefined,
readonly: false,
@@ -18,5 +19,4 @@ export const inputDefaultProps: TdInputProps = {
size: 'medium',
status: undefined,
type: 'text',
- defaultValue: '',
};
diff --git a/src/input/input.en-US.md b/src/input/input.en-US.md
index 89e29ccfb9..71fc993c30 100644
--- a/src/input/input.en-US.md
+++ b/src/input/input.en-US.md
@@ -7,43 +7,44 @@ name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
-align | String | left | options: left/center/right | N
-allowInputOverMax | Boolean | false | \- | N
-autoWidth | Boolean | false | \- | N
-autocomplete | String | undefined | \- | N
-autofocus | Boolean | false | \- | N
-clearable | Boolean | false | \- | N
-disabled | Boolean | - | \- | N
-format | Function | - | Typescript:`InputFormatType` `type InputFormatType = (value: InputValue) => string`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
-inputClass | String / Object / Array | - | Typescript:`ClassName`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-label | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+align | String | left | text align type。options: left/center/right | N
+allowInputOverMax | Boolean | false | allow to continue input on value length is over `maxlength` or `maxcharacter` | N
+autoWidth | Boolean | false | input width is fit to input content | N
+autocomplete | String | undefined | attribute of input element, [see here](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | N
+autofocus | Boolean | false | autofocus on first rendered | N
+borderless | Boolean | false | input without border | N
+clearable | Boolean | false | show clear icon, clicked to clear input value | N
+disabled | Boolean | - | make input to be disabled | N
+format | Function | - | input value formatter, `type=number` does not work. if you need to format number, `InputNumber` Component might be better。Typescript:`InputFormatType` `type InputFormatType = (value: string) => string`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
+inputClass | String / Object / Array | - | add className to the element with `t-input` class。Typescript:`ClassName`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+label | TNode | - | text on the left of input。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
maxcharacter | Number | - | \- | N
-maxlength | Number | - | \- | N
+maxlength | String / Number | - | \- | N
name | String | - | \- | N
placeholder | String | undefined | \- | N
prefixIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
readonly | Boolean | false | \- | N
-showClearIconOnEmpty | Boolean | false | \- | N
+showClearIconOnEmpty | Boolean | false | show clear icon on empty input value | N
showLimitNumber | Boolean | false | show limit number text on the right | N
-size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+size | String | medium | make input to be different size。options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
status | String | undefined | options: default/success/warning/error | N
-suffix | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-suffixIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-tips | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-type | String | text | options: text/number/url/tel/password/search/submit/hidden | N
-value | String | '' | Typescript:`InputValue` `type InputValue = string`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
-defaultValue | String | '' | uncontrolled property。Typescript:`InputValue` `type InputValue = string`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
-onBlur | Function | | Typescript:`(value: InputValue, context: { e: FocusEvent }) => void`
| N
-onChange | Function | | Typescript:`(value: InputValue, context?: { e?: InputEvent \| MouseEvent \| CompositionEvent; trigger: 'input' \| 'initial' \| 'clear' }) => void`
| N
+suffix | TNode | - | suffix content before suffixIcon。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+suffixIcon | TElement | - | suffix icon of input。Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+tips | TNode | - | tips on the bottom of input, different `status` can make tips to be different color。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+type | String | text | type attribute of input element. if you are using `type=number`, `InputNumber` Component might be better。options: text/number/url/tel/password/search/submit/hidden | N
+value | String | - | input value。Typescript:`T` `type InputValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
+defaultValue | String | - | input value。uncontrolled property。Typescript:`T` `type InputValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
+onBlur | Function | | Typescript:`(value: T, context: { e: FocusEvent }) => void`
| N
+onChange | Function | | Typescript:`(value: T, context?: { e?: InputEvent \| MouseEvent \| CompositionEvent; trigger: 'input' \| 'initial' \| 'clear' }) => void`
trigger on input value changed | N
onClear | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
-onCompositionend | Function | | Typescript:`(value: InputValue, context: { e: CompositionEvent }) => void`
trigger on compositionend | N
-onCompositionstart | Function | | Typescript:`(value: InputValue, context: { e: CompositionEvent }) => void`
trigger on compositionstart | N
-onEnter | Function | | Typescript:`(value: InputValue, context: { e: KeyboardEvent }) => void`
| N
-onFocus | Function | | Typescript:`(value: InputValue, context: { e: FocusEvent }) => void`
| N
-onKeydown | Function | | Typescript:`(value: InputValue, context: { e: KeyboardEvent }) => void`
| N
-onKeypress | Function | | Typescript:`(value: InputValue, context: { e: KeyboardEvent }) => void`
| N
-onKeyup | Function | | Typescript:`(value: InputValue, context: { e: KeyboardEvent }) => void`
| N
+onCompositionend | Function | | Typescript:`(value: string, context: { e: CompositionEvent }) => void`
trigger on compositionend | N
+onCompositionstart | Function | | Typescript:`(value: string, context: { e: CompositionEvent }) => void`
trigger on compositionstart | N
+onEnter | Function | | Typescript:`(value: T, context: { e: KeyboardEvent }) => void`
| N
+onFocus | Function | | Typescript:`(value: T, context: { e: FocusEvent }) => void`
| N
+onKeydown | Function | | Typescript:`(value: T, context: { e: KeyboardEvent }) => void`
| N
+onKeypress | Function | | Typescript:`(value: T, context: { e: KeyboardEvent }) => void`
| N
+onKeyup | Function | | Typescript:`(value: T, context: { e: KeyboardEvent }) => void`
| N
onMouseenter | Function | | Typescript:`(context: { e: MouseEvent }) => void`
trigger on mouseenter | N
onMouseleave | Function | | Typescript:`(context: { e: MouseEvent }) => void`
trigger on mouseleave | N
onPaste | Function | | Typescript:`(context: { e: ClipboardEvent; pasteValue: string }) => void`
| N
diff --git a/src/input/input.md b/src/input/input.md
index 6f1cb9fd23..604f29f066 100644
--- a/src/input/input.md
+++ b/src/input/input.md
@@ -12,13 +12,14 @@ allowInputOverMax | Boolean | false | 超出 `maxlength` 或 `maxcharacter` 之
autoWidth | Boolean | false | 宽度随内容自适应 | N
autocomplete | String | undefined | 是否开启自动填充功能,HTML5 原生属性,[点击查看详情](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | N
autofocus | Boolean | false | 自动聚焦 | N
+borderless | Boolean | false | 【开发中】无边框模式 | N
clearable | Boolean | false | 是否可清空 | N
disabled | Boolean | - | 是否禁用输入框 | N
-format | Function | - | 指定输入框展示值的格式。TS 类型:`InputFormatType` `type InputFormatType = (value: InputValue) => string`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
+format | Function | - | 指定输入框展示值的格式。注意 `type=number` 时请勿使用,此功能建议更为使用 `InputNumber` 组件。TS 类型:`InputFormatType` `type InputFormatType = (value: string) => string`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
inputClass | String / Object / Array | - | t-input 同级类名,示例:'name1 name2 name3' 或 `['name1', 'name2']` 或 `[{ 'name1': true }]`。TS 类型:`ClassName`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
label | TNode | - | 左侧文本。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用 | N
-maxlength | Number | - | 用户最多可以输入的文本长度,一个中文等于一个计数长度。值为空,则表示不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用 | N
+maxlength | String / Number | - | 用户最多可以输入的文本长度,一个中文等于一个计数长度。值为空,则表示不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用 | N
name | String | - | 名称 | N
placeholder | String | undefined | 占位符 | N
prefixIcon | TElement | - | 组件前置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
@@ -30,20 +31,20 @@ status | String | undefined | 输入框状态。默认情况会由组件内部
suffix | TNode | - | 后置图标前的后置内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
suffixIcon | TElement | - | 组件后置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
tips | TNode | - | 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-type | String | text | 输入框类型。可选项:text/number/url/tel/password/search/submit/hidden | N
-value | String | '' | 输入框的值。TS 类型:`InputValue` `type InputValue = string`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
-defaultValue | String | '' | 输入框的值。非受控属性。TS 类型:`InputValue` `type InputValue = string`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
-onBlur | Function | | TS 类型:`(value: InputValue, context: { e: FocusEvent }) => void`
失去焦点时触发 | N
-onChange | Function | | TS 类型:`(value: InputValue, context?: { e?: InputEvent \| MouseEvent \| CompositionEvent; trigger: 'input' \| 'initial' \| 'clear' }) => void`
输入框值发生变化时触发。`trigger=initial` 表示传入的数据不符合预期,组件自动处理后触发 change 告知父组件。如:初始值长度超过 `maxlength` 限制 | N
+type | String | text | 输入框类型。`type=number` 仅支持最基础的数字输入功能,更多功能建议使用 `InputNumber` 组件。可选项:text/number/url/tel/password/search/submit/hidden | N
+value | String | - | 输入框的值。TS 类型:`T` `type InputValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
+defaultValue | String | - | 输入框的值。非受控属性。TS 类型:`T` `type InputValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/input/type.ts) | N
+onBlur | Function | | TS 类型:`(value: T, context: { e: FocusEvent }) => void`
失去焦点时触发 | N
+onChange | Function | | TS 类型:`(value: T, context?: { e?: InputEvent \| MouseEvent \| CompositionEvent; trigger: 'input' \| 'initial' \| 'clear' }) => void`
输入框值发生变化时触发。参数 `trigger=initial` 表示传入的数据不符合预期,组件自动处理后触发 change 告知父组件。如:初始值长度超过 `maxlength` 限制 | N
onClear | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
清空按钮点击时触发 | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击组件时触发 | N
-onCompositionend | Function | | TS 类型:`(value: InputValue, context: { e: CompositionEvent }) => void`
中文输入结束时触发 | N
-onCompositionstart | Function | | TS 类型:`(value: InputValue, context: { e: CompositionEvent }) => void`
中文输入开始时触发 | N
-onEnter | Function | | TS 类型:`(value: InputValue, context: { e: KeyboardEvent }) => void`
回车键按下时触发 | N
-onFocus | Function | | TS 类型:`(value: InputValue, context: { e: FocusEvent }) => void`
获得焦点时触发 | N
-onKeydown | Function | | TS 类型:`(value: InputValue, context: { e: KeyboardEvent }) => void`
键盘按下时触发 | N
-onKeypress | Function | | TS 类型:`(value: InputValue, context: { e: KeyboardEvent }) => void`
按下字符键时触发(keydown -> keypress -> keyup) | N
-onKeyup | Function | | TS 类型:`(value: InputValue, context: { e: KeyboardEvent }) => void`
释放键盘时触发 | N
+onCompositionend | Function | | TS 类型:`(value: string, context: { e: CompositionEvent }) => void`
中文输入结束时触发 | N
+onCompositionstart | Function | | TS 类型:`(value: string, context: { e: CompositionEvent }) => void`
中文输入开始时触发 | N
+onEnter | Function | | TS 类型:`(value: T, context: { e: KeyboardEvent }) => void`
回车键按下时触发 | N
+onFocus | Function | | TS 类型:`(value: T, context: { e: FocusEvent }) => void`
获得焦点时触发 | N
+onKeydown | Function | | TS 类型:`(value: T, context: { e: KeyboardEvent }) => void`
键盘按下时触发 | N
+onKeypress | Function | | TS 类型:`(value: T, context: { e: KeyboardEvent }) => void`
按下字符键时触发(keydown -> keypress -> keyup) | N
+onKeyup | Function | | TS 类型:`(value: T, context: { e: KeyboardEvent }) => void`
释放键盘时触发 | N
onMouseenter | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
进入输入框时触发 | N
onMouseleave | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
离开输入框时触发 | N
onPaste | Function | | TS 类型:`(context: { e: ClipboardEvent; pasteValue: string }) => void`
粘贴事件,`pasteValue` 表示粘贴板的内容 | N
diff --git a/src/input/type.ts b/src/input/type.ts
index a7f698fc0d..7ab712e597 100644
--- a/src/input/type.ts
+++ b/src/input/type.ts
@@ -7,7 +7,7 @@
import { TNode, TElement, SizeEnum, ClassName } from '../common';
import { MouseEvent, KeyboardEvent, ClipboardEvent, FocusEvent, WheelEvent, FormEvent, CompositionEvent } from 'react';
-export interface TdInputProps {
+export interface TdInputProps {
/**
* 文本内容位置,居左/居中/居右
* @default left
@@ -32,6 +32,11 @@ export interface TdInputProps {
* @default false
*/
autofocus?: boolean;
+ /**
+ * 【开发中】无边框模式
+ * @default false
+ */
+ borderless?: boolean;
/**
* 是否可清空
* @default false
@@ -42,7 +47,7 @@ export interface TdInputProps {
*/
disabled?: boolean;
/**
- * 指定输入框展示值的格式
+ * 指定输入框展示值的格式。注意 `type=number` 时请勿使用,此功能建议更为使用 `InputNumber` 组件
*/
format?: InputFormatType;
/**
@@ -60,7 +65,7 @@ export interface TdInputProps {
/**
* 用户最多可以输入的文本长度,一个中文等于一个计数长度。值为空,则表示不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用
*/
- maxlength?: number;
+ maxlength?: string | number;
/**
* 名称
* @default ''
@@ -111,7 +116,7 @@ export interface TdInputProps {
*/
tips?: TNode;
/**
- * 输入框类型
+ * 输入框类型。`type=number` 仅支持最基础的数字输入功能,更多功能建议使用 `InputNumber` 组件
* @default text
*/
type?: 'text' | 'number' | 'url' | 'tel' | 'password' | 'search' | 'submit' | 'hidden';
@@ -119,21 +124,21 @@ export interface TdInputProps {
* 输入框的值
* @default ''
*/
- value?: InputValue;
+ value?: T;
/**
* 输入框的值,非受控属性
* @default ''
*/
- defaultValue?: InputValue;
+ defaultValue?: T;
/**
* 失去焦点时触发
*/
- onBlur?: (value: InputValue, context: { e: FocusEvent }) => void;
+ onBlur?: (value: T, context: { e: FocusEvent }) => void;
/**
- * 输入框值发生变化时触发。`trigger=initial` 表示传入的数据不符合预期,组件自动处理后触发 change 告知父组件。如:初始值长度超过 `maxlength` 限制
+ * 输入框值发生变化时触发。参数 `trigger=initial` 表示传入的数据不符合预期,组件自动处理后触发 change 告知父组件。如:初始值长度超过 `maxlength` 限制
*/
onChange?: (
- value: InputValue,
+ value: T,
context?: {
e?: FormEvent | MouseEvent | CompositionEvent;
trigger: 'input' | 'initial' | 'clear';
@@ -150,31 +155,31 @@ export interface TdInputProps {
/**
* 中文输入结束时触发
*/
- onCompositionend?: (value: InputValue, context: { e: CompositionEvent }) => void;
+ onCompositionend?: (value: string, context: { e: CompositionEvent }) => void;
/**
* 中文输入开始时触发
*/
- onCompositionstart?: (value: InputValue, context: { e: CompositionEvent }) => void;
+ onCompositionstart?: (value: string, context: { e: CompositionEvent }) => void;
/**
* 回车键按下时触发
*/
- onEnter?: (value: InputValue, context: { e: KeyboardEvent }) => void;
+ onEnter?: (value: T, context: { e: KeyboardEvent }) => void;
/**
* 获得焦点时触发
*/
- onFocus?: (value: InputValue, context: { e: FocusEvent }) => void;
+ onFocus?: (value: T, context: { e: FocusEvent }) => void;
/**
* 键盘按下时触发
*/
- onKeydown?: (value: InputValue, context: { e: KeyboardEvent }) => void;
+ onKeydown?: (value: T, context: { e: KeyboardEvent }) => void;
/**
* 按下字符键时触发(keydown -> keypress -> keyup)
*/
- onKeypress?: (value: InputValue, context: { e: KeyboardEvent }) => void;
+ onKeypress?: (value: T, context: { e: KeyboardEvent }) => void;
/**
* 释放键盘时触发
*/
- onKeyup?: (value: InputValue, context: { e: KeyboardEvent }) => void;
+ onKeyup?: (value: T, context: { e: KeyboardEvent }) => void;
/**
* 进入输入框时触发
*/
@@ -204,6 +209,6 @@ export interface TdInputGroupProps {
separate?: boolean;
}
-export type InputFormatType = (value: InputValue) => string;
+export type InputFormatType = (value: string) => string;
-export type InputValue = string;
+export type InputValue = string | number;
diff --git a/src/layout/layout.md b/src/layout/layout.md
index fdce75f8f2..aa01dbeaaf 100644
--- a/src/layout/layout.md
+++ b/src/layout/layout.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Layout Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/list/defaultProps.ts b/src/list/defaultProps.ts
index 995488fc3a..518f1b1737 100644
--- a/src/list/defaultProps.ts
+++ b/src/list/defaultProps.ts
@@ -2,10 +2,6 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
-import { TdListProps, TdListItemProps, TdListItemMetaProps } from './type';
+import { TdListProps } from './type';
export const listDefaultProps: TdListProps = { layout: 'horizontal', size: 'medium', split: false, stripe: false };
-
-export const listItemDefaultProps: TdListItemProps = {};
-
-export const listItemMetaDefaultProps: TdListItemMetaProps = {};
diff --git a/src/list/list.en-US.md b/src/list/list.en-US.md
index bf28fdfda0..b807d74ea3 100644
--- a/src/list/list.en-US.md
+++ b/src/list/list.en-US.md
@@ -1,7 +1,6 @@
:: BASE_DOC ::
## API
-
### List Props
name | type | default | description | required
@@ -11,8 +10,10 @@ style | Object | - | 样式,Typescript:`React.CSSProperties` | N
asyncLoading | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
footer | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
header | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-layout | String | horizontal | options:horizontal/vertical | N
-size | String | medium | options:small/medium/large | N
+layout | String | horizontal | options: horizontal/vertical | N
+scroll | Object | - | lazy load and virtual scroll。Typescript:`InfinityScroll`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+scroll | Object | - | lazy load and virtual scroll。Typescript:`TScroll`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+size | String | medium | options: small/medium/large | N
split | Boolean | false | \- | N
stripe | Boolean | false | \- | N
onLoadMore | Function | | Typescript:`(options: { e: MouseEvent }) => void`
| N
diff --git a/src/list/list.md b/src/list/list.md
index 28ad640407..ae8410bd7e 100644
--- a/src/list/list.md
+++ b/src/list/list.md
@@ -1,21 +1,5 @@
:: BASE_DOC ::
-### 斑马纹区分列表
-
-{{ stripe }}
-
-### 异步加载的列表
-
-{{ asyncLoading }}
-
-### 带头部及尾部的列表
-
-{{ header-footer }}
-
-### 带滚动事件的列表
-
-{{ scroll }}
-
## API
### List Props
@@ -27,6 +11,8 @@ asyncLoading | TNode | - | 自定义加载中。值为空不显示加载中,
footer | TNode | - | 底部。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
header | TNode | - | 头部。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
layout | String | horizontal | 排列方式(待设计稿输出)。可选项:horizontal/vertical | N
+scroll | Object | - | 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`。TS 类型:`InfinityScroll`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+scroll | Object | - | 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`。TS 类型:`TScroll`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
size | String | medium | 尺寸。可选项:small/medium/large | N
split | Boolean | false | 是否展示分割线 | N
stripe | Boolean | false | 是否展示斑马纹 | N
diff --git a/src/list/type.ts b/src/list/type.ts
index ac9a9d6fae..f39d2db262 100644
--- a/src/list/type.ts
+++ b/src/list/type.ts
@@ -4,7 +4,7 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
-import { TNode } from '../common';
+import { TNode, TScroll, InfinityScroll } from '../common';
import { MouseEvent, WheelEvent } from 'react';
export interface TdListProps {
@@ -25,6 +25,14 @@ export interface TdListProps {
* @default horizontal
*/
layout?: 'horizontal' | 'vertical';
+ /**
+ * 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`
+ */
+ scroll?: InfinityScroll;
+ /**
+ * 懒加载和虚拟滚动。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动,`scroll.threshold` 默认为 `100`
+ */
+ scroll?: TScroll;
/**
* 尺寸
* @default medium
diff --git a/src/loading/defaultProps.ts b/src/loading/defaultProps.ts
index 99b8deb2e2..5093afd1a7 100644
--- a/src/loading/defaultProps.ts
+++ b/src/loading/defaultProps.ts
@@ -5,6 +5,7 @@
import { TdLoadingProps } from './type';
export const loadingDefaultProps: TdLoadingProps = {
+ attach: '',
delay: 0,
fullscreen: false,
indicator: true,
diff --git a/src/loading/loading.en-US.md b/src/loading/loading.en-US.md
index ea98c2ff4c..d4d0563b92 100644
--- a/src/loading/loading.en-US.md
+++ b/src/loading/loading.en-US.md
@@ -1,7 +1,6 @@
:: BASE_DOC ::
## API
-
### Loading Props
name | type | default | description | required
@@ -24,8 +23,6 @@ zIndex | Number | - | \- | N
### loading 或 LoadingPlugin
-这是一个插件函数,参数形式为顺序参数(形如:(a, b, c)),而非对象参数(形如:({ a, b, c }))。顺序参数如下,
-
name | params | default | description
-- | -- | -- | --
options | Function | - | required。Typescript:`boolean \| TdLoadingProps`
diff --git a/src/loading/loading.md b/src/loading/loading.md
index adfb07fd66..615372f35f 100644
--- a/src/loading/loading.md
+++ b/src/loading/loading.md
@@ -23,8 +23,6 @@ zIndex | Number | - | 消息通知层级,样式默认为 3500 | N
### loading 或 LoadingPlugin
-这是一个插件函数,参数形式为顺序参数(形如:(a, b, c)),而非对象参数(形如:({ a, b, c }))。顺序参数如下,
-
参数名称 | 参数类型 | 参数默认值 | 参数说明
-- | -- | -- | --
options | Function | - | 必需。TS 类型:`boolean \| TdLoadingProps`
diff --git a/src/menu/defaultProps.ts b/src/menu/defaultProps.ts
index 52cdd6f790..653a8ed625 100644
--- a/src/menu/defaultProps.ts
+++ b/src/menu/defaultProps.ts
@@ -2,20 +2,17 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
-import { TdHeadMenuProps, TdMenuProps, TdMenuGroupProps, TdMenuItemProps, TdSubmenuProps } from './type';
-
-export const headMenuDefaultProps: TdHeadMenuProps = { expandType: 'normal', theme: 'light' };
+import { TdMenuProps, TdHeadMenuProps, TdMenuItemProps } from './type';
export const menuDefaultProps: TdMenuProps = {
collapsed: false,
expandMutex: false,
expandType: 'normal',
+ defaultExpanded: [],
theme: 'light',
width: '232px',
};
-export const menuGroupDefaultProps: TdMenuGroupProps = {};
-
-export const menuItemDefaultProps: TdMenuItemProps = {};
+export const headMenuDefaultProps: TdHeadMenuProps = { expandType: 'normal', expanded: [], theme: 'light' };
-export const submenuDefaultProps: TdSubmenuProps = {};
+export const menuItemDefaultProps: TdMenuItemProps = { target: '_self' };
diff --git a/src/menu/menu.en-US.md b/src/menu/menu.en-US.md
index cd6566a62c..a99bd69a03 100644
--- a/src/menu/menu.en-US.md
+++ b/src/menu/menu.en-US.md
@@ -1,7 +1,6 @@
:: BASE_DOC ::
## API
-
### Menu Props
name | type | default | description | required
@@ -10,12 +9,12 @@ className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
collapsed | Boolean | false | \- | N
expandMutex | Boolean | false | \- | N
-expandType | String | normal | options:normal/popup | N
+expandType | String | normal | options: normal/popup | N
expanded | Array | [] | Typescript:`Array` | N
defaultExpanded | Array | [] | uncontrolled property。Typescript:`Array` | N
logo | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
operations | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-theme | String | light | Menu can be light mode or dark mode.。options:light/dark/global/system | N
+theme | String | light | Menu can be light mode or dark mode.。options: light/dark/global/system | N
value | String / Number | - | Typescript:`MenuValue` `type MenuValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/menu/type.ts) | N
defaultValue | String / Number | - | uncontrolled property。Typescript:`MenuValue` `type MenuValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/menu/type.ts) | N
width | String / Number / Array | '232px' | Typescript:`string \| number \| Array` | N
@@ -28,12 +27,11 @@ name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
-expandType | String | normal | options:normal/popup | N
+expandType | String | normal | options: normal/popup | N
expanded | Array | [] | Typescript:`Array` | N
-defaultExpanded | Array | [] | uncontrolled property。Typescript:`Array` | N
logo | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
operations | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-theme | String | light | options:light/dark | N
+theme | String | light | options: light/dark | N
value | String / Number | - | Typescript:`MenuValue` `type MenuValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/menu/type.ts) | N
defaultValue | String / Number | - | uncontrolled property。Typescript:`MenuValue` `type MenuValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/menu/type.ts) | N
onChange | Function | | Typescript:`(value: MenuValue) => void`
| N
@@ -64,7 +62,7 @@ content | TNode | - | Typescript:`string \| TNode`。[see more ts definition](
disabled | Boolean | - | \- | N
href | String | - | \- | N
icon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-target | String | - | options:_blank/_self/_parent/_top | N
+target | String | _self | options: _blank/_self/_parent/_top | N
value | String / Number | - | Typescript:`MenuValue` | N
onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`
trigger on click | N
diff --git a/src/menu/menu.md b/src/menu/menu.md
index aa53e16781..ee9f8e191d 100644
--- a/src/menu/menu.md
+++ b/src/menu/menu.md
@@ -29,7 +29,6 @@ className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
expandType | String | normal | 二级菜单展开方式,平铺展开和浮层展开。可选项:normal/popup | N
expanded | Array | [] | 展开的子菜单集合。TS 类型:`Array` | N
-defaultExpanded | Array | [] | 展开的子菜单集合。非受控属性。TS 类型:`Array` | N
logo | TElement | - | 站点 LOGO。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
operations | TElement | - | 导航操作区域。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
theme | String | light | 可选项:light/dark | N
@@ -63,9 +62,9 @@ content | TNode | - | 菜单项内容。TS 类型:`string \| TNode`。[通用
disabled | Boolean | - | 是否禁用菜单项展开/收起/跳转等功能 | N
href | String | - | 跳转链接 | N
icon | TElement | - | 图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-target | String | - | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
+target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
value | String / Number | - | 菜单项唯一标识。TS 类型:`MenuValue` | N
-onClick | Function | | TS 类型:`(context: { e: MouseEvent, value: MenuValue }) => void`
点击时触发 | N
+onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击时触发 | N
### MenuGroup Props
diff --git a/src/menu/type.ts b/src/menu/type.ts
index 65e03037b8..dc163b3d88 100644
--- a/src/menu/type.ts
+++ b/src/menu/type.ts
@@ -4,9 +4,9 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */
+import { PopupProps } from '../popup';
import { TNode, TElement } from '../common';
import { MouseEvent } from 'react';
-import { PopupProps } from '../popup';
export interface TdMenuProps {
/**
@@ -14,14 +14,6 @@ export interface TdMenuProps {
* @default false
*/
collapsed?: boolean;
- /**
- * 子菜单展开的导航集合
- */
- expanded?: Array;
- /**
- * 子菜单展开的导航集合,非受控属性
- */
- defaultExpanded?: Array;
/**
* 同级别互斥展开
* @default false
@@ -32,19 +24,29 @@ export interface TdMenuProps {
* @default normal
*/
expandType?: 'normal' | 'popup';
+ /**
+ * 子菜单展开的导航集合
+ * @default []
+ */
+ expanded?: Array;
+ /**
+ * 子菜单展开的导航集合,非受控属性
+ * @default []
+ */
+ defaultExpanded?: Array;
/**
* 站点 LOGO
*/
- logo?: TNode;
+ logo?: TElement;
/**
* 导航操作区域
*/
- operations?: TNode;
+ operations?: TElement;
/**
- * 菜单风格
+ * 菜单风格,有亮色模式和暗色模式两种。当 `theme = global` 时,模式随整个组件库;当 `theme = system` 时,模式跟随系统。⚠️ `global/system` 正在开发中,暂勿使用
* @default light
*/
- theme?: 'light' | 'dark';
+ theme?: 'light' | 'dark' | 'global' | 'system';
/**
* 激活菜单项
*/
@@ -69,27 +71,29 @@ export interface TdMenuProps {
}
export interface TdHeadMenuProps {
+ /**
+ * 二级菜单展开方式,平铺展开和浮层展开
+ * @default normal
+ */
+ expandType?: 'normal' | 'popup';
/**
* 展开的子菜单集合
+ * @default []
*/
expanded?: Array;
/**
* 展开的子菜单集合,非受控属性
+ * @default []
*/
defaultExpanded?: Array;
- /**
- * 二级菜单展开方式,平铺展开和浮层展开
- * @default normal
- */
- expandType?: 'normal' | 'popup';
/**
* 站点 LOGO
*/
- logo?: TNode;
+ logo?: TElement;
/**
* 导航操作区域
*/
- operations?: TNode;
+ operations?: TElement;
/**
* null
* @default light
@@ -129,7 +133,7 @@ export interface TdSubmenuProps {
/**
* 菜单项图标
*/
- icon?: TNode;
+ icon?: TElement;
/**
* 透传 Popup 组件全部特性
*/
@@ -168,6 +172,7 @@ export interface TdMenuItemProps {
icon?: TElement;
/**
* 链接或路由跳转方式
+ * @default _self
*/
target?: '_blank' | '_self' | '_parent' | '_top';
/**
@@ -177,7 +182,7 @@ export interface TdMenuItemProps {
/**
* 点击时触发
*/
- onClick?: (context: { e: MouseEvent; value: MenuValue }) => void;
+ onClick?: (context: { e: MouseEvent }) => void;
}
export interface TdMenuGroupProps {
diff --git a/src/message/message.md b/src/message/message.md
index ed5a669b87..8d9d907453 100644
--- a/src/message/message.md
+++ b/src/message/message.md
@@ -1,25 +1,5 @@
:: BASE_DOC ::
-### 带关闭按钮的全局提示
-
-{{ close }}
-
-### 使用关闭函数控制全局提示
-
-{{ close-function }}
-
-### 关闭多条全局提示
-
-{{ close-all }}
-
-### 控制全局提示显示位置
-
-{{ offset }}
-
-### 函数式调用
-
-{{ duration }}
-
## API
### Message Props
diff --git a/src/popconfirm/popconfirm.md b/src/popconfirm/popconfirm.md
index ea1fb19e08..06235c31a5 100644
--- a/src/popconfirm/popconfirm.md
+++ b/src/popconfirm/popconfirm.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Popconfirm Props
名称 | 类型 | 默认值 | 说明 | 必传
@@ -16,7 +17,7 @@ icon | TElement | - | 确认框图标。TS 类型:`TNode`。[通用类型定
placement | String | top | 浮层出现位置。可选项:top/left/right/bottom/top-left/top-right/bottom-left/bottom-right/left-top/left-bottom/right-top/right-bottom | N
popupProps | Object | - | 透传 Popup 组件属性。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/popconfirm/type.ts) | N
showArrow | Boolean | true | 是否显示浮层箭头 | N
-theme | String | default | 文字提示风格。可选项:default/warning/danger | N
+theme | String | default | 文字提示风格。如果期望不显示文本前方的主题图标,请更为设置 `icon` 为 `null`。可选项:default/warning/danger | N
triggerElement | TNode | - | 触发元素。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
visible | Boolean | - | 是否显示气泡确认框 | N
defaultVisible | Boolean | - | 是否显示气泡确认框。非受控属性 | N
diff --git a/src/popup/popup.en-US.md b/src/popup/popup.en-US.md
index 1b64cb946e..2c0293ab26 100644
--- a/src/popup/popup.en-US.md
+++ b/src/popup/popup.en-US.md
@@ -1,14 +1,5 @@
:: BASE_DOC ::
-### Called Popup via plugin
-
-Calling Popup through the plug-in method is used to render Popup in a scene with existing nodes. At the same time, no matter how it is called, it will only be mounted on one node, which is used to reduce the number of Popup rendering nodes on the page.
-
-Support functional calls `PopupPlugin` 。
-- `PopupPlugin(triggerElement, content, popupProps)`
-
-{{ plugin }}
-
## API
### Popup Props
@@ -16,6 +7,7 @@ name | type | default | description | required
-- | -- | -- | -- | --
attach | String / Function | 'body' | Typescript:`AttachNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
children | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+closeBtn | TNode | - | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
content | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
delay | Number / Array | - | delay to show or hide popover。Typescript:`number \| Array` | N
destroyOnClose | Boolean | false | \- | N
@@ -31,8 +23,7 @@ showArrow | Boolean | false | \- | N
trigger | String | hover | options:hover/click/focus/mousedown/context-menu | N
triggerElement | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
visible | Boolean | - | Typescript:`boolean` | N
-defaultVisible | Boolean | - | uncontrolled property。Typescript:`boolean` | N
zIndex | Number | - | \- | N
onScroll | Function | | Typescript:`(context: { e: WheelEvent }) => void`
| N
onScrollToBottom | Function | | Typescript:`(context: { e: WheelEvent }) => void`
| N
-onVisibleChange | Function | | Typescript:`(visible: boolean, context: PopupVisibleChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/popup/type.ts)。
`interface PopupVisibleChangeContext { e?: PopupTriggerEvent; trigger?: PopupTriggerSource }`
`type PopupTriggerEvent = MouseEvent \| FocusEvent \| KeyboardEvent`
`type PopupTriggerSource = 'document' \| 'trigger-element-click' \| 'trigger-element-hover' \| 'trigger-element-blur' \| 'trigger-element-focus' \| 'trigger-element-mousedown' \| 'context-menu' \| 'keydown-esc'`
| N
+onVisibleChange | Function | | Typescript:`(visible: boolean, context: PopupVisibleChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/popup/type.ts)。
`interface PopupVisibleChangeContext { e?: PopupTriggerEvent; trigger?: PopupTriggerSource }`
`type PopupTriggerEvent = MouseEvent \| FocusEvent \| KeyboardEvent`
`type PopupTriggerSource = 'document' \| 'trigger-element-click' \| 'trigger-element-hover' \| 'trigger-element-blur' \| 'trigger-element-focus' \| 'trigger-element-mousedown' \| 'trigger-element-close' \| 'context-menu' \| 'keydown-esc'`
| N
diff --git a/src/popup/popup.md b/src/popup/popup.md
index cc4e3d0497..3ca8415de0 100644
--- a/src/popup/popup.md
+++ b/src/popup/popup.md
@@ -1,20 +1,5 @@
:: BASE_DOC ::
-### 通过插件方式调用Popup
-
-通过插件方式调用Popup,用于将Popup渲染在已有节点的场景,同时该方式不论如何调用都只会挂载在一个节点上,用于减少页面上的Popup的渲染节点。
-
-支持函数式调用 `PopupPlugin` 。
-- `PopupPlugin(triggerElement, content, popupProps)`
-
-{{ plugin }}
-
-### 动态自适应
-
-当trigger或popup显示内容动态变化时,自适应调整位置
-
-{{ dynamic }}
-
## API
### Popup Props
@@ -22,6 +7,7 @@
-- | -- | -- | -- | --
attach | String / Function | 'body' | 制定挂载节点。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'body' 或 () => document.body。TS 类型:`AttachNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
children | TNode | - | 触发元素,同 triggerElement。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+closeBtn | TNode | - | 是否展示关闭按钮,值为 `true` 显示默认关闭按钮;值为 `false` 则不显示关闭按钮;也可以自定义关闭按钮。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
content | TNode | - | 浮层里面的内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
delay | Number / Array | - | 延时显示或隐藏浮层,[延迟显示的时间,延迟隐藏的时间],单位:毫秒。如果只有一个时间,则表示显示和隐藏的延迟时间相同。示例 `'300'` 或者 `[200, 200]`。默认为:[250, 150]。TS 类型:`number \| Array` | N
destroyOnClose | Boolean | false | 是否在关闭浮层时销毁浮层 | N
@@ -37,8 +23,7 @@ showArrow | Boolean | false | 是否显示浮层箭头 | N
trigger | String | hover | 触发浮层出现的方式。可选项:hover/click/focus/mousedown/context-menu | N
triggerElement | TNode | - | 触发元素。值类型为字符串表示元素选择器。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
visible | Boolean | - | 是否显示浮层。TS 类型:`boolean` | N
-defaultVisible | Boolean | - | 是否显示浮层。非受控属性。TS 类型:`boolean` | N
zIndex | Number | - | 组件层级,Web 侧样式默认为 5500,移动端和小程序样式默认为 1500 | N
onScroll | Function | | TS 类型:`(context: { e: WheelEvent }) => void`
下拉选项滚动事件 | N
onScrollToBottom | Function | | TS 类型:`(context: { e: WheelEvent }) => void`
下拉滚动触底事件,常用于滚动到底执行具体业务逻辑 | N
-onVisibleChange | Function | | TS 类型:`(visible: boolean, context: PopupVisibleChangeContext) => void`
当浮层隐藏或显示时触发,`trigger=document` 表示点击非浮层元素触发;`trigger=context-menu` 表示右击触发。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/popup/type.ts)。
`interface PopupVisibleChangeContext { e?: PopupTriggerEvent; trigger?: PopupTriggerSource }`
`type PopupTriggerEvent = MouseEvent \| FocusEvent \| KeyboardEvent`
`type PopupTriggerSource = 'document' \| 'trigger-element-click' \| 'trigger-element-hover' \| 'trigger-element-blur' \| 'trigger-element-focus' \| 'trigger-element-mousedown' \| 'context-menu' \| 'keydown-esc'`
| N
+onVisibleChange | Function | | TS 类型:`(visible: boolean, context: PopupVisibleChangeContext) => void`
当浮层隐藏或显示时触发,`trigger=document` 表示点击非浮层元素触发;`trigger=context-menu` 表示右击触发。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/popup/type.ts)。
`interface PopupVisibleChangeContext { e?: PopupTriggerEvent; trigger?: PopupTriggerSource }`
`type PopupTriggerEvent = MouseEvent \| FocusEvent \| KeyboardEvent`
`type PopupTriggerSource = 'document' \| 'trigger-element-click' \| 'trigger-element-hover' \| 'trigger-element-blur' \| 'trigger-element-focus' \| 'trigger-element-mousedown' \| 'trigger-element-close' \| 'context-menu' \| 'keydown-esc'`
| N
diff --git a/src/popup/type.ts b/src/popup/type.ts
index bb98bce7ee..0d6af50b1a 100644
--- a/src/popup/type.ts
+++ b/src/popup/type.ts
@@ -17,6 +17,10 @@ export interface TdPopupProps {
* 触发元素,同 triggerElement
*/
children?: TNode;
+ /**
+ * 是否展示关闭按钮,值为 `true` 显示默认关闭按钮;值为 `false` 则不显示关闭按钮;也可以自定义关闭按钮
+ */
+ closeBtn?: TNode;
/**
* 浮层里面的内容
*/
@@ -132,5 +136,6 @@ export type PopupTriggerSource =
| 'trigger-element-blur'
| 'trigger-element-focus'
| 'trigger-element-mousedown'
+ | 'trigger-element-close'
| 'context-menu'
| 'keydown-esc';
diff --git a/src/progress/progress.md b/src/progress/progress.md
index d24048deac..3f929de72d 100644
--- a/src/progress/progress.md
+++ b/src/progress/progress.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Progress Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/radio/__tests__/vitest-radio.test.jsx b/src/radio/__tests__/vitest-radio.test.jsx
index 6fe2edf469..2baab14234 100644
--- a/src/radio/__tests__/vitest-radio.test.jsx
+++ b/src/radio/__tests__/vitest-radio.test.jsx
@@ -170,21 +170,6 @@ describe('RadioGroup Component', () => {
expect(container).toMatchSnapshot();
});
- it('props.options works fine. `{".t-radio":4}` should exist', () => {
- const { container } = getRadioGroupDefaultMount(RadioGroup);
- expect(container.querySelectorAll('.t-radio').length).toBe(4);
- });
-
- it('props.options works fine. `".custom-node"` should exist', () => {
- const { container } = getRadioGroupDefaultMount(RadioGroup);
- expect(container.querySelector('.custom-node')).toBeTruthy();
- });
-
- it('props.options works fine. `{".t-radio.t-is-disabled":1}` should exist', () => {
- const { container } = getRadioGroupDefaultMount(RadioGroup);
- expect(container.querySelectorAll('.t-radio.t-is-disabled').length).toBe(1);
- });
-
it(`props.value is equal to '2'`, () => {
const { container } = getRadioGroupDefaultMount(RadioGroup, { value: '2' });
const domWrapper = container.querySelector('.t-radio.t-is-checked input');
diff --git a/src/radio/defaultProps.ts b/src/radio/defaultProps.ts
index 899a8eb75a..e2ad255c22 100644
--- a/src/radio/defaultProps.ts
+++ b/src/radio/defaultProps.ts
@@ -8,12 +8,8 @@ export const radioDefaultProps: TdRadioProps = {
allowUncheck: false,
defaultChecked: false,
disabled: undefined,
+ readonly: false,
value: undefined,
};
-export const radioGroupDefaultProps: TdRadioGroupProps = {
- allowUncheck: false,
- disabled: undefined,
- size: 'medium',
- variant: 'outline',
-};
+export const radioGroupDefaultProps: TdRadioGroupProps = { allowUncheck: false, size: 'medium', variant: 'outline' };
diff --git a/src/radio/radio.en-US.md b/src/radio/radio.en-US.md
index 49642379ac..a68f996597 100644
--- a/src/radio/radio.en-US.md
+++ b/src/radio/radio.en-US.md
@@ -14,7 +14,8 @@ children | TNode | - | Typescript:`string \| TNode`。[see more ts definition]
disabled | Boolean | undefined | \- | N
label | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
name | String | - | \- | N
-value | String / Number / Boolean | undefined | Typescript:`T` | N
+readonly | Boolean | false | \- | N
+value | String / Number / Boolean | undefined | Typescript:`string \| number \| boolean` | N
onChange | Function | | Typescript:`(checked: boolean, context: { e: ChangeEvent }) => void`
| N
onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`
trigger on click | N
@@ -25,11 +26,11 @@ name | type | default | description | required
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
allowUncheck | Boolean | false | \- | N
-disabled | Boolean | false | \- | N
+disabled | Boolean | - | \- | N
name | String | - | \- | N
-options | Array | - | Typescript:`Array` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number; disabled?: boolean }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
-size | String | medium | options:small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-value | String / Number / Boolean | - | Typescript:`T` | N
-defaultValue | String / Number / Boolean | - | uncontrolled property。Typescript:`T` | N
-variant | String | outline | options:outline/primary-filled/default-filled | N
+options | Array | - | Typescript:`Array` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number \| boolean; disabled?: boolean }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
+size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+value | String / Number / Boolean | - | Typescript:`T` `type RadioValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
+defaultValue | String / Number / Boolean | - | uncontrolled property。Typescript:`T` `type RadioValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
+variant | String | outline | options: outline/primary-filled/default-filled | N
onChange | Function | | Typescript:`(value: T, context: { e: ChangeEvent }) => void`
| N
diff --git a/src/radio/radio.md b/src/radio/radio.md
index afafd20ee8..786071f5b1 100644
--- a/src/radio/radio.md
+++ b/src/radio/radio.md
@@ -14,7 +14,8 @@ children | TNode | - | 单选内容,同 label。TS 类型:`string \| TNode`
disabled | Boolean | undefined | 是否为禁用态。如果存在父组件 RadioGroup,默认值由 RadioGroup.disabled 控制。Radio.disabled 优先级高于 RadioGroup.disabled | N
label | TNode | - | 主文案。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
name | String | - | HTML 元素原生属性 | N
-value | String / Number / Boolean | undefined | 单选按钮的值。TS 类型:`T` | N
+readonly | Boolean | false | 只读状态 | N
+value | String / Number / Boolean | undefined | 单选按钮的值。TS 类型:`string \| number \| boolean` | N
onChange | Function | | TS 类型:`(checked: boolean, context: { e: ChangeEvent }) => void`
选中状态变化时触发 | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击时出发,一般用于外层阻止冒泡场景 | N
@@ -25,11 +26,11 @@ onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
allowUncheck | Boolean | false | 是否允许取消选中 | N
-disabled | Boolean | false | 是否禁用全部子单选框。默认为 false。RadioGroup.disabled 优先级低于 Radio.disabled | N
+disabled | Boolean | - | 是否禁用全部子单选框。默认为 false。RadioGroup.disabled 优先级低于 Radio.disabled | N
name | String | - | HTML 元素原生属性 | N
-options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number; disabled?: boolean }`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
+options | Array | - | 单选组件按钮形式。RadioOption 数据类型为 string 或 number 时,表示 label 和 value 值相同。TS 类型:`Array` `type RadioOption = string \| number \| RadioOptionObj` `interface RadioOptionObj { label?: string \| TNode; value?: string \| number \| boolean; disabled?: boolean }`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
size | String | medium | 组件尺寸【讨论中】。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-value | String / Number / Boolean | - | 选中的值。TS 类型:`T` | N
-defaultValue | String / Number / Boolean | - | 选中的值。非受控属性。TS 类型:`T` | N
+value | String / Number / Boolean | - | 选中的值。TS 类型:`T` `type RadioValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
+defaultValue | String / Number / Boolean | - | 选中的值。非受控属性。TS 类型:`T` `type RadioValue = string \| number \| boolean`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/radio/type.ts) | N
variant | String | outline | 单选组件按钮形式。可选项:outline/primary-filled/default-filled | N
onChange | Function | | TS 类型:`(value: T, context: { e: ChangeEvent }) => void`
选中值发生变化时触发 | N
diff --git a/src/radio/type.ts b/src/radio/type.ts
index 01de0bad1d..7364474a93 100644
--- a/src/radio/type.ts
+++ b/src/radio/type.ts
@@ -7,7 +7,7 @@
import { TNode, SizeEnum } from '../common';
import { MouseEvent, ChangeEvent } from 'react';
-export interface TdRadioProps {
+export interface TdRadioProps {
/**
* 是否允许取消选中
* @default false
@@ -40,10 +40,15 @@ export interface TdRadioProps {
* @default ''
*/
name?: string;
+ /**
+ * 只读状态
+ * @default false
+ */
+ readonly?: boolean;
/**
* 单选按钮的值
*/
- value?: T;
+ value?: string | number | boolean;
/**
* 选中状态变化时触发
*/
@@ -62,7 +67,6 @@ export interface TdRadioGroupProps {
allowUncheck?: boolean;
/**
* 是否禁用全部子单选框。默认为 false。RadioGroup.disabled 优先级低于 Radio.disabled
- * @default false
*/
disabled?: boolean;
/**
@@ -95,15 +99,15 @@ export interface TdRadioGroupProps {
/**
* 选中值发生变化时触发
*/
- onChange?: (value: T, context: { e: ChangeEvent }) => void;
+ onChange?: (value: T, context: { e: ChangeEvent }) => void;
}
-export type RadioValue = string | number | boolean;
-
export type RadioOption = string | number | RadioOptionObj;
export interface RadioOptionObj {
label?: string | TNode;
- value?: string | number;
+ value?: string | number | boolean;
disabled?: boolean;
}
+
+export type RadioValue = string | number | boolean;
diff --git a/src/range-input/range-input.en-US.md b/src/range-input/range-input.en-US.md
index 3751a0daaf..d83d6eff29 100644
--- a/src/range-input/range-input.en-US.md
+++ b/src/range-input/range-input.en-US.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### RangeInput Props
name | type | default | description | required
diff --git a/src/range-input/range-input.md b/src/range-input/range-input.md
index 4a468b7e89..a66c6cf942 100644
--- a/src/range-input/range-input.md
+++ b/src/range-input/range-input.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### RangeInput Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/rate/defaultProps.ts b/src/rate/defaultProps.ts
index 20c06610bb..b1964c0103 100644
--- a/src/rate/defaultProps.ts
+++ b/src/rate/defaultProps.ts
@@ -5,12 +5,13 @@
import { TdRateProps } from './type';
export const rateDefaultProps: TdRateProps = {
- defaultValue: 0,
allowHalf: false,
color: '#ED7B2F',
- size: '24px',
count: 5,
+ disabled: false,
gap: 4,
showText: false,
- texts: ['极差', '失望', '一般', '满意', '惊喜'],
+ size: '24px',
+ texts: [],
+ defaultValue: 0,
};
diff --git a/src/rate/rate.en-US.md b/src/rate/rate.en-US.md
index c6bfa72f21..3db8e1bbfd 100644
--- a/src/rate/rate.en-US.md
+++ b/src/rate/rate.en-US.md
@@ -6,11 +6,11 @@
name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
-style | Object | - | 样式,Typescript:`React.CSSProperties` | N
+style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
allowHalf | Boolean | false | \- | N
-color | String / Array | '#ED7B2F' | Typescript:`string \| Array` | N
+color | String / Array | '#ED7B2F' | Typescript:`string | Array` | N
count | Number | 5 | \- | N
-disabled | Boolean | - | \- | N
+disabled | Boolean | false | \- | N
gap | Number | 4 | \- | N
icon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
showText | Boolean | false | \- | N
@@ -18,4 +18,4 @@ size | String | 24px | \- | N
texts | Array | [] | Typescript:`Array` | N
value | Number | 0 | \- | N
defaultValue | Number | 0 | uncontrolled property | N
-onChange | Function | | Typescript:`(value: number) => void`
| N
+onChange | Function | | TS 类型:`(value: number) => void`
| N
diff --git a/src/rate/rate.md b/src/rate/rate.md
index 3611558d15..0f93b58d6e 100644
--- a/src/rate/rate.md
+++ b/src/rate/rate.md
@@ -8,9 +8,9 @@
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
allowHalf | Boolean | false | 是否允许半选 | N
-color | String / Array | '#ED7B2F' | 评分图标的颜色,样式中默认为 #ED7B2F。一个值表示设置选中高亮的五角星颜色,示例:[选中颜色]。数组则表示分别设置 选中高亮的五角星颜色 和 未选中暗灰的五角星颜色,[选中颜色,未选中颜色]。示例:['#ED7B2F', '#E3E6EB']。TS 类型:`string \| Array` | N
+color | String / Array | '#ED7B2F' | 评分图标的颜色,样式中默认为 #ED7B2F。一个值表示设置选中高亮的五角星颜色,示例:[选中颜色]。数组则表示分别设置 选中高亮的五角星颜色 和 未选中暗灰的五角星颜色,[选中颜色,未选中颜色]。示例:['#ED7B2F', '#E3E6EB']。TS 类型:`string | Array` | N
count | Number | 5 | 评分的数量 | N
-disabled | Boolean | - | 是否禁用评分 | N
+disabled | Boolean | false | 是否禁用评分 | N
gap | Number | 4 | 评分图标的间距 | N
icon | TElement | - | 自定义评分图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
showText | Boolean | false | 是否显示对应的辅助文字 | N
diff --git a/src/rate/type.ts b/src/rate/type.ts
index 92d8a70e14..208949e127 100644
--- a/src/rate/type.ts
+++ b/src/rate/type.ts
@@ -42,8 +42,8 @@ export interface TdRateProps {
*/
showText?: boolean;
/**
- * 评分图标的大小,示例:`20`
- * @default ''
+ * 评分图标的大小,示例:`20px`
+ * @default 24px
*/
size?: string;
/**
diff --git a/src/search/search.md b/src/search/search.md
index 08defa2982..a2ace4b4e5 100644
--- a/src/search/search.md
+++ b/src/search/search.md
@@ -1,6 +1,7 @@
:: BASE_DOC ::
## API
+
### Search Props
名称 | 类型 | 默认值 | 说明 | 必传
diff --git a/src/select-input/defaultProps.ts b/src/select-input/defaultProps.ts
index 3c003dc979..4c733bbc24 100644
--- a/src/select-input/defaultProps.ts
+++ b/src/select-input/defaultProps.ts
@@ -14,5 +14,7 @@ export const selectInputDefaultProps: TdSelectInputProps = {
minCollapsedNum: 0,
multiple: false,
readonly: false,
+ reserveKeyword: false,
status: 'default',
+ value: undefined,
};
diff --git a/src/select-input/select-input.en-US.md b/src/select-input/select-input.en-US.md
index 3bd6d9cf78..34c427b821 100644
--- a/src/select-input/select-input.en-US.md
+++ b/src/select-input/select-input.en-US.md
@@ -15,8 +15,8 @@ clearable | Boolean | false | \- | N
collapsedItems | TElement | - | Typescript:`TNode<{ value: SelectInputValue; collapsedTags: SelectInputValue; count: number }>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
disabled | Boolean | - | \- | N
inputProps | Object | - | Typescript:`InputProps`,[Input API Documents](./input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts) | N
-inputValue | String / Number | - | input value。Typescript:`InputValue`,[Input API Documents](./input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts) | N
-defaultInputValue | String / Number | - | input value。uncontrolled property。Typescript:`InputValue`,[Input API Documents](./input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts) | N
+inputValue | String / Number | - | input value。Typescript:`string` | N
+defaultInputValue | String / Number | - | input value。uncontrolled property。Typescript:`string` | N
keys | Object | - | Typescript:`SelectInputKeys` `interface SelectInputKeys { label?: string; value?: string; children?: string }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts) | N
label | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
loading | Boolean | false | \- | N
@@ -28,7 +28,8 @@ popupProps | Object | - | Typescript:`PopupProps`,[Popup API Documents](./po
popupVisible | Boolean | - | \- | N
defaultPopupVisible | Boolean | - | uncontrolled property | N
readonly | Boolean | false | \- | N
-status | String | default | options:default/success/warning/error | N
+reserveKeyword | Boolean | false | \- | N
+status | String | default | options: default/success/warning/error | N
suffix | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
suffixIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
tag | TNode | - | Typescript:`string \| TNode<{ value: string \| number }>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
@@ -39,9 +40,9 @@ value | String / Number / Boolean / Object / Array / Date | undefined | Typescri
valueDisplay | TNode | - | Typescript:`string \| TNode<{ value: TagInputValue; onClose: (index: number, item?: any) => void }>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
onBlur | Function | | Typescript:`(value: SelectInputValue, context: SelectInputBlurContext) => void`
trigger on blur。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`type SelectInputBlurContext = PopupVisibleChangeContext & { inputValue: string; tagInputValue?: TagInputValue; }`
| N
onClear | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
-onEnter | Function | | Typescript:`(value: SelectInputValue, context: { e: KeyboardEvent; inputValue: InputValue; tagInputValue?: TagInputValue }) => void`
| N
-onFocus | Function | | Typescript:`(value: SelectInputValue, context: SelectInputFocusContext) => void`
trigger on focus。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`interface SelectInputFocusContext { inputValue: InputValue; tagInputValue?: TagInputValue; e: FocusEvent }`
| N
-onInputChange | Function | | Typescript:`(value: InputValue, context?: SelectInputValueChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`interface SelectInputValueChangeContext { e?: Event \| InputEvent \| MouseEvent \| FocusEvent \| KeyboardEvent \| CompositionEvent; trigger: 'input' \| 'clear' \| 'blur' \| 'focus' \| 'initial' \| 'change' }`
| N
+onEnter | Function | | Typescript:`(value: SelectInputValue, context: { e: KeyboardEvent; inputValue: string; tagInputValue?: TagInputValue }) => void`
| N
+onFocus | Function | | Typescript:`(value: SelectInputValue, context: SelectInputFocusContext) => void`
trigger on focus。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`interface SelectInputFocusContext { inputValue: string; tagInputValue?: TagInputValue; e: FocusEvent }`
| N
+onInputChange | Function | | Typescript:`(value: string, context?: SelectInputValueChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`interface SelectInputValueChangeContext { e?: Event \| InputEvent \| MouseEvent \| FocusEvent \| KeyboardEvent \| CompositionEvent; trigger: 'input' \| 'clear' \| 'blur' \| 'focus' \| 'initial' \| 'change' }`
| N
onMouseenter | Function | | Typescript:`(context: { e: MouseEvent }) => void`
trigger on mouseenter | N
onMouseleave | Function | | Typescript:`(context: { e: MouseEvent }) => void`
trigger on mouseleave | N
onPaste | Function | | Typescript:`(context: { e: ClipboardEvent; pasteValue: string }) => void`
| N
diff --git a/src/select-input/select-input.md b/src/select-input/select-input.md
index 398f9fdbd2..2264a7ae59 100644
--- a/src/select-input/select-input.md
+++ b/src/select-input/select-input.md
@@ -15,8 +15,8 @@ clearable | Boolean | false | 是否可清空 | N
collapsedItems | TElement | - | 标签过多的情况下,折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 `collapsedItems` 自定义。`value` 表示所有标签值,`collapsedTags` 表示折叠标签值,`count` 表示折叠的数量。TS 类型:`TNode<{ value: SelectInputValue; collapsedTags: SelectInputValue; count: number }>`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
disabled | Boolean | - | 是否禁用 | N
inputProps | Object | - | 透传 Input 输入框组件全部属性。TS 类型:`InputProps`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts) | N
-inputValue | String / Number | - | 输入框的值。TS 类型:`InputValue`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts) | N
-defaultInputValue | String / Number | - | 输入框的值。非受控属性。TS 类型:`InputValue`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts) | N
+inputValue | String / Number | - | 输入框的值。TS 类型:`string` | N
+defaultInputValue | String / Number | - | 输入框的值。非受控属性。TS 类型:`string` | N
keys | Object | - | 定义字段别名,示例:`{ label: 'text', value: 'id', children: 'list' }`。TS 类型:`SelectInputKeys` `interface SelectInputKeys { label?: string; value?: string; children?: string }`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts) | N
label | TNode | - | 左侧文本。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
loading | Boolean | false | 是否处于加载状态 | N
@@ -28,6 +28,7 @@ popupProps | Object | - | 透传 Popup 浮层组件全部属性。TS 类型:`P
popupVisible | Boolean | - | 是否显示下拉框 | N
defaultPopupVisible | Boolean | - | 是否显示下拉框。非受控属性 | N
readonly | Boolean | false | 只读状态,值为真会隐藏输入框,且无法打开下拉框 | N
+reserveKeyword | Boolean | false | 多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词 | N
status | String | default | 输入框状态。可选项:default/success/warning/error | N
suffix | TNode | - | 后置图标前的后置内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
suffixIcon | TElement | - | 组件后置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
@@ -39,9 +40,9 @@ value | String / Number / Boolean / Object / Array / Date | undefined | 全部
valueDisplay | TNode | - | 自定义值呈现的全部内容,参数为所有标签的值。TS 类型:`string \| TNode<{ value: TagInputValue; onClose: (index: number, item?: any) => void }>`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
onBlur | Function | | TS 类型:`(value: SelectInputValue, context: SelectInputBlurContext) => void`
失去焦点时触发,`context.inputValue` 表示输入框的值;`context.tagInputValue` 表示标签输入框的值。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`type SelectInputBlurContext = PopupVisibleChangeContext & { inputValue: string; tagInputValue?: TagInputValue; }`
| N
onClear | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
清空按钮点击时触发 | N
-onEnter | Function | | TS 类型:`(value: SelectInputValue, context: { e: KeyboardEvent; inputValue: InputValue; tagInputValue?: TagInputValue }) => void`
按键按下 Enter 时触发 | N
-onFocus | Function | | TS 类型:`(value: SelectInputValue, context: SelectInputFocusContext) => void`
聚焦时触发。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`interface SelectInputFocusContext { inputValue: InputValue; tagInputValue?: TagInputValue; e: FocusEvent }`
| N
-onInputChange | Function | | TS 类型:`(value: InputValue, context?: SelectInputValueChangeContext) => void`
输入框值发生变化时触发,`context.trigger` 表示触发输入框值变化的来源:文本输入触发、清除按钮触发等。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`interface SelectInputValueChangeContext { e?: Event \| InputEvent \| MouseEvent \| FocusEvent \| KeyboardEvent \| CompositionEvent; trigger: 'input' \| 'clear' \| 'blur' \| 'focus' \| 'initial' \| 'change' }`
| N
+onEnter | Function | | TS 类型:`(value: SelectInputValue, context: { e: KeyboardEvent; inputValue: string; tagInputValue?: TagInputValue }) => void`
按键按下 Enter 时触发 | N
+onFocus | Function | | TS 类型:`(value: SelectInputValue, context: SelectInputFocusContext) => void`
聚焦时触发。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`interface SelectInputFocusContext { inputValue: string; tagInputValue?: TagInputValue; e: FocusEvent }`
| N
+onInputChange | Function | | TS 类型:`(value: string, context?: SelectInputValueChangeContext) => void`
输入框值发生变化时触发,`context.trigger` 表示触发输入框值变化的来源:文本输入触发、清除按钮触发等。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select-input/type.ts)。
`interface SelectInputValueChangeContext { e?: Event \| InputEvent \| MouseEvent \| FocusEvent \| KeyboardEvent \| CompositionEvent; trigger: 'input' \| 'clear' \| 'blur' \| 'focus' \| 'initial' \| 'change' }`
| N
onMouseenter | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
进入输入框时触发 | N
onMouseleave | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
离开输入框时触发 | N
onPaste | Function | | TS 类型:`(context: { e: ClipboardEvent; pasteValue: string }) => void`
粘贴事件,`pasteValue` 表示粘贴板的内容 | N
diff --git a/src/select-input/type.ts b/src/select-input/type.ts
index 539950dea1..9d63f7edff 100644
--- a/src/select-input/type.ts
+++ b/src/select-input/type.ts
@@ -5,7 +5,6 @@
* */
import { InputProps } from '../input';
-import { InputValue } from '../input';
import { PopupProps } from '../popup';
import { TagInputProps, TagInputValue, TagInputChangeContext } from '../tag-input';
import { TagProps } from '../tag';
@@ -54,11 +53,11 @@ export interface TdSelectInputProps {
/**
* 输入框的值
*/
- inputValue?: InputValue;
+ inputValue?: string;
/**
* 输入框的值,非受控属性
*/
- defaultInputValue?: InputValue;
+ defaultInputValue?: string;
/**
* 定义字段别名,示例:`{ label: 'text', value: 'id', children: 'list' }`
*/
@@ -108,6 +107,11 @@ export interface TdSelectInputProps {
* @default false
*/
readonly?: boolean;
+ /**
+ * 多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词
+ * @default false
+ */
+ reserveKeyword?: boolean;
/**
* 输入框状态
* @default default
@@ -158,7 +162,7 @@ export interface TdSelectInputProps {
*/
onEnter?: (
value: SelectInputValue,
- context: { e: KeyboardEvent; inputValue: InputValue; tagInputValue?: TagInputValue },
+ context: { e: KeyboardEvent; inputValue: string; tagInputValue?: TagInputValue },
) => void;
/**
* 聚焦时触发
@@ -167,7 +171,7 @@ export interface TdSelectInputProps {
/**
* 输入框值发生变化时触发,`context.trigger` 表示触发输入框值变化的来源:文本输入触发、清除按钮触发等
*/
- onInputChange?: (value: InputValue, context?: SelectInputValueChangeContext) => void;
+ onInputChange?: (value: string, context?: SelectInputValueChangeContext) => void;
/**
* 进入输入框时触发
*/
@@ -201,7 +205,7 @@ export type SelectInputValue = string | number | boolean | Date | Object | Array
export type SelectInputBlurContext = PopupVisibleChangeContext & { inputValue: string; tagInputValue?: TagInputValue };
export interface SelectInputFocusContext {
- inputValue: InputValue;
+ inputValue: string;
tagInputValue?: TagInputValue;
e: FocusEvent;
}
diff --git a/src/select/defaultProps.ts b/src/select/defaultProps.ts
index fe977873e1..7b0c8f413d 100644
--- a/src/select/defaultProps.ts
+++ b/src/select/defaultProps.ts
@@ -14,6 +14,7 @@ export const selectDefaultProps: TdSelectProps = {
max: 0,
minCollapsedNum: 0,
multiple: false,
+ optionsLayout: 'vertical',
placeholder: undefined,
readonly: false,
reserveKeyword: false,
diff --git a/src/select/select.en-US.md b/src/select/select.en-US.md
index 09952ca1d6..dba7db5641 100644
--- a/src/select/select.en-US.md
+++ b/src/select/select.en-US.md
@@ -11,16 +11,16 @@ autoWidth | Boolean | false | \- | N
autofocus | Boolean | false | \- | N
borderless | Boolean | false | \- | N
clearable | Boolean | false | \- | N
-collapsedItems | TElement | - | Typescript:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+collapsedItems | TElement | - | Typescript:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number, onClose: (index: number) => void }>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
creatable | Boolean | false | \- | N
disabled | Boolean | - | \- | N
empty | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
filter | Function | - | Typescript:`(filterWords: string, option: T) => boolean \| Promise` | N
filterable | Boolean | false | \- | N
inputProps | Object | - | Typescript:`InputProps`,[Input API Documents](./input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
-inputValue | String / Number | - | input value。Typescript:`InputValue`,[Input API Documents](./input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
-defaultInputValue | String / Number | - | input value。uncontrolled property。Typescript:`InputValue`,[Input API Documents](./input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
-keys | Object | - | Typescript:`SelectKeysType` `interface SelectKeysType { value?: string; label?: string }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
+inputValue | String / Number | - | input value。Typescript:`string` | N
+defaultInputValue | String / Number | - | input value。uncontrolled property。Typescript:`string` | N
+keys | Object | - | alias option field。Typescript:`SelectKeysType` `interface SelectKeysType { value?: string \| ((option: SelectOption) => string); label?: string \| ((option: SelectOption) => string); disabled?: string }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
label | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
loading | Boolean | false | \- | N
loadingText | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
@@ -28,6 +28,7 @@ max | Number | 0 | \- | N
minCollapsedNum | Number | 0 | \- | N
multiple | Boolean | false | \- | N
options | Array | - | Typescript:`Array` | N
+optionsLayout | String | vertical | layout of options in popup。Typescript:`vertical \| horizontal` | N
panelBottomContent | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
panelTopContent | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
placeholder | String | undefined | \- | N
@@ -40,24 +41,24 @@ reserveKeyword | Boolean | false | \- | N
scroll | Object | - | lazy load and virtual scroll。Typescript:`InfinityScroll`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
selectInputProps | Object | - | Typescript:`SelectInputProps`,[SelectInput API Documents](./select-input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
showArrow | Boolean | true | \- | N
-size | String | medium | options:small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-status | String | default | options:default/success/warning/error | N
+size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+status | String | default | options: default/success/warning/error | N
suffix | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
suffixIcon | TElement | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
tagInputProps | Object | - | Typescript:`TagInputProps`,[TagInput API Documents](./tag-input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
tagProps | Object | - | Typescript:`TagProps`,[Tag API Documents](./tag?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
tips | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-value | String / Number / Object / Array | - | Typescript:`SelectValue` `type SelectValue = string \| number \| T \| Array>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
-defaultValue | String / Number / Object / Array | - | uncontrolled property。Typescript:`SelectValue` `type SelectValue = string \| number \| T \| Array>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
+value | String / Number / Boolean / Object / Array | - | Typescript:`SelectValue` `type SelectValue = string \| number \| boolean \| T \| Array>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
+defaultValue | String / Number / Boolean / Object / Array | - | uncontrolled property。Typescript:`SelectValue` `type SelectValue = string \| number \| boolean \| T \| Array>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
valueDisplay | TNode | - | `MouseEvent`。Typescript:`string \| TNode<{ value: SelectValue; onClose: (index: number) => void; displayValue?: SelectValue }>`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-valueType | String | value | options:value/object | N
+valueType | String | value | options: value/object | N
onBlur | Function | | Typescript:`(context: { value: SelectValue; e: FocusEvent \| KeyboardEvent }) => void`
| N
-onChange | Function | | Typescript:`(value: SelectValue, context: { option?: T, selectedOptions: T[], trigger: SelectValueChangeTrigger; e?: MouseEvent \| KeyboardEvent }) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`type SelectValueChangeTrigger = 'clear' \| 'tag-remove' \| 'backspace' \| 'check' \| 'uncheck'`
| N
+onChange | Function | | Typescript:`(value: SelectValue, context: { option?: T, selectedOptions: T[], trigger: SelectValueChangeTrigger; e?: MouseEvent \| KeyboardEvent }) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`type SelectValueChangeTrigger = 'clear' \| 'tag-remove' \| 'backspace' \| 'check' \| 'uncheck' \| 'default'`
| N
onClear | Function | | Typescript:`(context: { e: MouseEvent }) => void`
| N
onCreate | Function | | Typescript:`(value: string \| number) => void`
| N
onEnter | Function | | Typescript:`(context: { inputValue: string; e: KeyboardEvent; value: SelectValue }) => void`
| N
onFocus | Function | | Typescript:`(context: { value: SelectValue; e: FocusEvent \| KeyboardEvent }) => void`
| N
-onInputChange | Function | | Typescript:`(value: InputValue, context?: SelectInputValueChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`import { SelectInputValueChangeContext } from '@SelectInput'`
| N
+onInputChange | Function | | Typescript:`(value: string, context?: SelectInputValueChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`import { SelectInputValueChangeContext } from '@SelectInput'`
| N
onPopupVisibleChange | Function | | Typescript:`(visible: boolean, context: PopupVisibleChangeContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`import { PopupVisibleChangeContext } from '@Popup'`
| N
onRemove | Function | | Typescript:`(options: SelectRemoveContext) => void`
[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`interface SelectRemoveContext { value: string \| number; data: T; e: MouseEvent \| KeyboardEvent }`
| N
onSearch | Function | | Typescript:`(filterWords: string, context: { e: KeyboardEvent }) => void`
| N
@@ -85,7 +86,7 @@ style | Object | - | 样式,Typescript:`React.CSSProperties` | N
divider | Boolean | true | \- | N
label | String | - | \- | N
-### InfinityScroll
+### TScroll
name | type | default | description | required
-- | -- | -- | -- | --
@@ -93,4 +94,4 @@ bufferSize | Number | 20 | \- | N
isFixedRowHeight | Boolean | false | \- | N
rowHeight | Number | - | \- | N
threshold | Number | 100 | \- | N
-type | String | - | required。options:lazy/virtual | Y
\ No newline at end of file
+type | String | - | required。options: lazy/virtual | Y
diff --git a/src/select/select.md b/src/select/select.md
index c066d31b18..44ecdb4bf5 100644
--- a/src/select/select.md
+++ b/src/select/select.md
@@ -11,16 +11,16 @@ autoWidth | Boolean | false | 宽度随内容自适应 | N
autofocus | Boolean | false | 自动聚焦 | N
borderless | Boolean | false | 无边框模式 | N
clearable | Boolean | false | 是否可以清空选项 | N
-collapsedItems | TElement | - | 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量。TS 类型:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+collapsedItems | TElement | - | 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签。TS 类型:`TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number, onClose: (index: number) => void }>`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
creatable | Boolean | false | 是否允许用户创建新条目,需配合 filterable 使用 | N
disabled | Boolean | - | 是否禁用组件 | N
empty | TNode | - | 当下拉列表为空时显示的内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
filter | Function | - | 自定义搜索规则,用于对现有数据进行搜索,判断是否过滤某一项数据。参数 `filterWords` 表示搜索词,`option`表示单个选项内容,返回值为 `true` 保留该选项,返回值为 `false` 则隐藏该选项。使用该方法时无需设置 `filterable`。TS 类型:`(filterWords: string, option: T) => boolean \| Promise` | N
filterable | Boolean | false | 是否可搜索,默认搜索规则不区分大小写,全文本任意位置匹配。如果默认搜索规则不符合业务需求,可以更为使用 `filter` 自定义过滤规则 | N
inputProps | Object | - | 透传 Input 输入框组件的全部属性。TS 类型:`InputProps`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
-inputValue | String / Number | - | 输入框的值。TS 类型:`InputValue`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
-defaultInputValue | String / Number | - | 输入框的值。非受控属性。TS 类型:`InputValue`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
-keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`SelectKeysType` `interface SelectKeysType { value?: string; label?: string }`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
+inputValue | String / Number | - | 输入框的值。TS 类型:`string` | N
+defaultInputValue | String / Number | - | 输入框的值。非受控属性。TS 类型:`string` | N
+keys | Object | - | 用来定义 value / label / disabled 在 `options` 中对应的字段别名。TS 类型:`SelectKeysType` `interface SelectKeysType { value?: string \| ((option: SelectOption) => string); label?: string \| ((option: SelectOption) => string); disabled?: string }`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
label | TNode | - | 左侧文本。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
loading | Boolean | false | 是否为加载状态 | N
loadingText | TNode | - | 远程加载时显示的文字,支持自定义。如加上超链接。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
@@ -28,6 +28,7 @@ max | Number | 0 | 用于控制多选数量,值为 0 则不限制 | N
minCollapsedNum | Number | 0 | 最小折叠数量,用于多选情况下折叠选中项,超出该数值的选中项折叠。值为 0 则表示不折叠 | N
multiple | Boolean | false | 是否允许多选 | N
options | Array | - | 数据化配置选项内容。TS 类型:`Array` | N
+optionsLayout | String | vertical | 下拉选项布局方式,有纵向排列和横向排列两种,默认纵向排列。TS 类型:`vertical \| horizontal` | N
panelBottomContent | TNode | - | 面板内的底部内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
panelTopContent | TNode | - | 面板内的顶部内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
placeholder | String | undefined | 占位符 | N
@@ -47,17 +48,17 @@ suffixIcon | TElement | - | 组件后置图标。TS 类型:`TNode`。[通用
tagInputProps | Object | - | 透传 TagInput 标签输入框组件的全部属性。TS 类型:`TagInputProps`,[TagInput API Documents](./tag-input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
tagProps | Object | - | 透传 Tag 标签组件全部属性。TS 类型:`TagProps`,[Tag API Documents](./tag?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
tips | TNode | - | 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-value | String / Number / Object / Array | - | 选中值。TS 类型:`SelectValue` `type SelectValue = string \| number \| T \| Array>`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
-defaultValue | String / Number / Object / Array | - | 选中值。非受控属性。TS 类型:`SelectValue` `type SelectValue = string \| number \| T \| Array>`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
+value | String / Number / Boolean / Object / Array | - | 选中值。TS 类型:`SelectValue` `type SelectValue = string \| number \| boolean \| T \| Array>`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
+defaultValue | String / Number / Boolean / Object / Array | - | 选中值。非受控属性。TS 类型:`SelectValue` `type SelectValue = string \| number \| boolean \| T \| Array>`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts) | N
valueDisplay | TNode | - | 自定义选中项呈现的内容。TS 类型:`string \| TNode<{ value: SelectValue; onClose: (index: number) => void; displayValue?: SelectValue }>`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
-valueType | String | value | 用于控制选中值的类型。假设数据选项为:`[{ label: '姓名', value: 'name' }]`,value 表示值仅返回数据选项中的 value, object 表示值返回全部数据。可选项:value/object | N
+valueType | String | value | 用于控制选中值的类型。假设数据选项为:`[{ label: '姓名', value: 'name' }]`,value 表示值仅返回数据选项中的 value, object 表示值返回全部数据。。可选项:value/object | N
onBlur | Function | | TS 类型:`(context: { value: SelectValue; e: FocusEvent \| KeyboardEvent }) => void`
输入框失去焦点时触发 | N
-onChange | Function | | TS 类型:`(value: SelectValue, context: { option?: T, selectedOptions: T[], trigger: SelectValueChangeTrigger; e?: MouseEvent \| KeyboardEvent }) => void`
选中值变化时触发。`context.trigger` 表示触发变化的来源;`context.selectedOptions` 表示选中值的完整对象,数组长度一定和 `value` 相同;`context.option` 表示当前操作的选项,不一定存在。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`type SelectValueChangeTrigger = 'clear' \| 'tag-remove' \| 'backspace' \| 'check' \| 'uncheck'`
| N
+onChange | Function | | TS 类型:`(value: SelectValue, context: { option?: T, selectedOptions: T[], trigger: SelectValueChangeTrigger; e?: MouseEvent \| KeyboardEvent }) => void`
选中值变化时触发。`context.trigger` 表示触发变化的来源;`context.selectedOptions` 表示选中值的完整对象,数组长度一定和 `value` 相同;`context.option` 表示当前操作的选项,不一定存在。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`type SelectValueChangeTrigger = 'clear' \| 'tag-remove' \| 'backspace' \| 'check' \| 'uncheck' \| 'default'`
| N
onClear | Function | | TS 类型:`(context: { e: MouseEvent }) => void`
点击清除按钮时触发 | N
onCreate | Function | | TS 类型:`(value: string \| number) => void`
当选择新创建的条目时触发 | N
onEnter | Function | | TS 类型:`(context: { inputValue: string; e: KeyboardEvent; value: SelectValue }) => void`
回车键按下时触发。`inputValue` 表示输入框的值,`value` 表示选中值 | N
onFocus | Function | | TS 类型:`(context: { value: SelectValue; e: FocusEvent \| KeyboardEvent }) => void`
输入框获得焦点时触发 | N
-onInputChange | Function | | TS 类型:`(value: InputValue, context?: SelectInputValueChangeContext) => void`
输入框值发生变化时触发,`context.trigger` 表示触发输入框值变化的来源:文本输入触发、清除按钮触发、失去焦点等。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`import { SelectInputValueChangeContext } from '@SelectInput'`
| N
+onInputChange | Function | | TS 类型:`(value: string, context?: SelectInputValueChangeContext) => void`
输入框值发生变化时触发,`context.trigger` 表示触发输入框值变化的来源:文本输入触发、清除按钮触发、失去焦点等。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`import { SelectInputValueChangeContext } from '@SelectInput'`
| N
onPopupVisibleChange | Function | | TS 类型:`(visible: boolean, context: PopupVisibleChangeContext) => void`
下拉框显示或隐藏时触发。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`import { PopupVisibleChangeContext } from '@Popup'`
| N
onRemove | Function | | TS 类型:`(options: SelectRemoveContext) => void`
多选模式下,选中数据被移除时触发。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/select/type.ts)。
`interface SelectRemoveContext { value: string \| number; data: T; e: MouseEvent \| KeyboardEvent }`
| N
onSearch | Function | | TS 类型:`(filterWords: string, context: { e: KeyboardEvent }) => void`
输入值变化时,触发搜索事件。主要用于远程搜索新数据 | N
@@ -85,7 +86,7 @@ style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
divider | Boolean | true | 是否显示分隔线 | N
label | String | - | 分组别名 | N
-### InfinityScroll
+### TScroll
名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
@@ -93,4 +94,4 @@ bufferSize | Number | 20 | 表示除可视区域外,额外渲染的行数,
isFixedRowHeight | Boolean | false | 表示每行内容是否同一个固定高度,仅在 `scroll.type` 为 `virtual` 时有效,该属性设置为 `true` 时,可用于简化虚拟滚动内部计算逻辑,提升性能,此时则需要明确指定 `scroll.rowHeight` 属性的值 | N
rowHeight | Number | - | 行高,不会给``元素添加样式高度,仅作为滚动时的行高参考。一般情况不需要设置该属性。如果设置,可尽量将该属性设置为每行平均高度,从而使得滚动过程更加平滑 | N
threshold | Number | 100 | 启动虚拟滚动的阈值。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动 | N
-type | String | - | 必需。滚动加载类型,有两种:懒加载和虚拟滚动。
值为 `lazy` ,表示滚动时会进行懒加载,非可视区域内的内容将不会默认渲染,直到该内容可见时,才会进行渲染,并且已渲染的内容滚动到不可见时,不会被销毁;
值为`virtual`时,表示会进行虚拟滚动,无论滚动条滚动到哪个位置,同一时刻,仅渲染该可视区域内的内容,当需要展示的数据量较大时,建议开启该特性。可选项:lazy/virtual | Y
\ No newline at end of file
+type | String | - | 必需。滚动加载类型,有两种:懒加载和虚拟滚动。
值为 `lazy` ,表示滚动时会进行懒加载,非可视区域内的内容将不会默认渲染,直到该内容可见时,才会进行渲染,并且已渲染的内容滚动到不可见时,不会被销毁;
值为`virtual`时,表示会进行虚拟滚动,无论滚动条滚动到哪个位置,同一时刻,仅渲染该可视区域内的内容,当需要展示的数据量较大时,建议开启该特性。可选项:lazy/virtual | Y
diff --git a/src/select/type.ts b/src/select/type.ts
index 1f32030582..25fabaad82 100644
--- a/src/select/type.ts
+++ b/src/select/type.ts
@@ -5,7 +5,6 @@
* */
import { InputProps } from '../input';
-import { InputValue } from '../input';
import { PopupProps } from '../popup';
import { SelectInputProps } from '../select-input';
import { TagInputProps } from '../tag-input';
@@ -37,9 +36,9 @@ export interface TdSelectProps {
*/
clearable?: boolean;
/**
- * 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量
+ * 多选情况下,用于设置折叠项内容,默认为 `+N`。如果需要悬浮就显示其他内容,可以使用 collapsedItems 自定义。`value` 表示当前存在的所有标签,`collapsedTags` 表示折叠的标签,泛型 `T` 继承 `SelectOption`,表示选项数据;`count` 表示折叠的数量, `onClose` 表示移除标签
*/
- collapsedItems?: TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number }>;
+ collapsedItems?: TNode<{ value: T[]; collapsedSelectedItems: T[]; count: number; onClose: (index: number) => void }>;
/**
* 是否允许用户创建新条目,需配合 filterable 使用
* @default false
@@ -68,13 +67,13 @@ export interface TdSelectProps {
/**
* 输入框的值
*/
- inputValue?: InputValue;
+ inputValue?: string;
/**
* 输入框的值,非受控属性
*/
- defaultInputValue?: InputValue;
+ defaultInputValue?: string;
/**
- * 用来定义 value / label 在 `options` 中对应的字段别名
+ * 用来定义 value / label / disabled 在 `options` 中对应的字段别名
*/
keys?: SelectKeysType;
/**
@@ -109,6 +108,11 @@ export interface TdSelectProps {
* 数据化配置选项内容
*/
options?: Array;
+ /**
+ * 下拉选项布局方式,有纵向排列和横向排列两种,默认纵向排列
+ * @default vertical
+ */
+ optionsLayout?: vertical | horizontal;
/**
* 面板内的底部内容
*/
@@ -242,7 +246,7 @@ export interface TdSelectProps {
/**
* 输入框值发生变化时触发,`context.trigger` 表示触发输入框值变化的来源:文本输入触发、清除按钮触发、失去焦点等
*/
- onInputChange?: (value: InputValue, context?: SelectInputValueChangeContext) => void;
+ onInputChange?: (value: string, context?: SelectInputValueChangeContext) => void;
/**
* 下拉框显示或隐藏时触发
*/
@@ -306,13 +310,14 @@ export interface TdOptionGroupProps {
}
export interface SelectKeysType {
- value?: string;
- label?: string;
+ value?: string | ((option: SelectOption) => string);
+ label?: string | ((option: SelectOption) => string);
+ disabled?: string;
}
-export type SelectValue = string | number | T | Array>;
+export type SelectValue = string | number | boolean | T | Array>;
-export type SelectValueChangeTrigger = 'clear' | 'tag-remove' | 'backspace' | 'check' | 'uncheck';
+export type SelectValueChangeTrigger = 'clear' | 'tag-remove' | 'backspace' | 'check' | 'uncheck' | 'default';
export interface SelectRemoveContext {
value: string | number;
diff --git a/src/skeleton/skeleton.en-US.md b/src/skeleton/skeleton.en-US.md
index 15354c585f..c627c6ca91 100644
--- a/src/skeleton/skeleton.en-US.md
+++ b/src/skeleton/skeleton.en-US.md
@@ -9,6 +9,8 @@ name | type | default | description | required
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
animation | String | none | options:gradient/flashed/none | N
+children | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
+content | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
delay | Number | 0 | \- | N
loading | Boolean | true | \- | N
rowCol | Array | - | Typescript:`SkeletonRowCol` `type SkeletonRowCol = Array