From b389ea0014f9b7e5e0668556fa6e9534f366286f Mon Sep 17 00:00:00 2001 From: FairyYang <269291280@qq.com> Date: Fri, 6 Dec 2024 10:29:51 +0800 Subject: [PATCH] fix(Select): Fix select doc --- components/select/__docs__/index.en-us.md | 107 +++++++++++----------- components/select/__docs__/index.md | 107 +++++++++++----------- 2 files changed, 110 insertions(+), 104 deletions(-) diff --git a/components/select/__docs__/index.en-us.md b/components/select/__docs__/index.en-us.md index e85ed11d89..4c36d6f009 100644 --- a/components/select/__docs__/index.en-us.md +++ b/components/select/__docs__/index.en-us.md @@ -64,7 +64,7 @@ This is because the layer's animation of the overlay is implemented by `classNam | Param | Description | Type | Default Value | Required | Supported Version | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | -------- | ----------------- | | size | Size | 'small' \| 'medium' \| 'large' | 'medium' | | - | -| children | Child elements, reference the demo for details | ReactElementWithTypeMark \| ReactElementWithTypeMark[] | - | | - | +| children | Child elements, reference the demo for details | React.ReactNode | - | | - | | name | Name | string | - | | - | | value | Current value, for controlled mode | DataSourceItem \| DataSourceItem[] | - | | - | | defaultValue | Initial default value | DataSourceItem \| DataSourceItem[] | - | | - | @@ -81,13 +81,13 @@ This is because the layer's animation of the overlay is implemented by `classNam | popupContainer | Popup mounting container | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | - | | popupClassName | Popup class name | string | - | | - | | popupStyle | Popup inline style | React.CSSProperties | - | | - | -| popupProps | Props added to the popup | PopupProps | - | | - | +| popupProps | Props added to the popup | React.ComponentPropsWithRef\ | - | | - | | followTrigger | Whether to follow the trigger scroll | boolean | - | | - | | popupContent | Custom popup content | React.ReactNode | - | | - | | menuProps | Menu property | MenuProps | - | | 1.18 | | filterLocal | Use local filtering, when the data source is remote, you need to close this item | boolean | true | | - | | filter | Local filtering method, return a Boolean value to determine whether to retain

**signature**:
**params**:
_key_: Search keyword
_item_: Render node item | (key: string \| number, item: ObjectItem) => boolean | - | | - | -| onToggleHighlightItem | Callback when pressing keyboard up and down keys to switch the menu highlight option | (highlightKey?: unknown, type?: HighlightChangeType) => void | - | | - | +| onToggleHighlightItem | Callback when pressing keyboard up and down keys to switch the menu highlight option | (
highlightKey?: string \| boolean \| NormalizedObjectItem \| null,
type?: HighlightChangeType
) => void | - | | - | | useVirtual | Whether to enable virtual scrolling mode | boolean | - | | - | | dataSource | Data source, can dynamically render child items | Array\ | - | | - | | itemRender | Render MenuItem content method

**signature**:
**params**:
_item_: item
_searchValue_: searchValue | (item: ObjectItem, searchValue: string \| undefined) => React.ReactNode | - | | - | @@ -97,6 +97,7 @@ This is because the layer's animation of the overlay is implemented by `classNam | hasBorder | Whether there is a border | boolean | - | | - | | hasArrow | Whether there is a drop | boolean | true | | - | | showSearch | Whether it can be searched after expansion (fixed in tag mode) | boolean | false | | - | +| autoClearSearchValue | Whether to clear the search box after selecting the selected item, only in mode multiple or tags is valid | boolean | true | | - | | onSearch | Callback when the search box value changes | (value: string, e: React.ChangeEvent\) => void | - | | - | | onSearchClear | Callback when the search box value is cleared | (actionType?: string) => void | - | | - | | hasSelectAll | Whether there is a full selection function in multi | boolean \| string | - | | - | @@ -126,42 +127,42 @@ This is because the layer's animation of the overlay is implemented by `classNam ### Select.AutoComplete -| Param | Description | Type | Default Value | Required | -| ---------------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------- | ------------- | -------- | -| size | Size | 'small' \| 'medium' \| 'large' | 'medium' | | -| value | Current value, for controlled mode | string \| number \| null | - | | -| defaultValue | Initial default value | string \| number | - | | -| placeholder | Placeholder when no value | string | - | | -| autoWidth | Whether the width of the drop | boolean | true | | -| label | Custom inline label | React.ReactNode | - | | -| hasClear | Whether to have a clear button (valid in single mode) | boolean | - | | -| state | Validation status | 'error' \| 'loading' \| 'success' \| 'warning' | - | | -| readOnly | Read | boolean | - | | -| disabled | Whether to disable the selector | boolean | - | | -| visible | Whether the pop | boolean | - | | -| defaultVisible | Whether the pop | boolean | - | | -| onVisibleChange | Callback when the pop | (visible: boolean, type?: VisibleChangeType) => void | - | | -| popupContainer | Popup mounting container | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | -| popupClassName | Popup class name | string | - | | -| popupStyle | Popup inline style | React.CSSProperties | - | | -| popupProps | Props added to the popup | PopupProps | - | | -| popupContent | Custom popup content | React.ReactNode | - | | -| followTrigger | Whether to follow the trigger scroll | boolean | - | | -| filterLocal | Use local filtering, when the data source is remote, you need to close this item | boolean | true | | -| filter | Local filtering method, return a Boolean value to determine whether to retain | (key: string \| number, item: ObjectItem) => boolean | - | | -| onToggleHighlightItem | Callback when pressing keyboard up and down keys to switch the menu highlight option | (highlightKey: unknown, ...args: unknown[]) => void | - | | -| useVirtual | Whether to enable virtual scrolling mode | boolean | - | | -| dataSource | Data source, can dynamically render child items | Array\ | - | | -| itemRender | Render MenuItem content | (item: ObjectItem) => React.ReactNode | - | | -| onChange | Callback when AutoComplete changes | (value: string, actionType: string, item?: ObjectItem) => void | - | | -| onKeyDown | - | (e: React.KeyboardEvent\) => void | - | | -| fillProps | The key to fill in the value of the selection box | string | 'value' | | -| autoHighlightFirstItem | Automatically highlight the first option | boolean | true | | -| highlightKey | Highlight key | string | - | | -| defaultHighlightKey | Default highlight key | string | - | | -| onFocus | Callback when AutoComplete gets focus | InputProps['onFocus'] | - | | -| children | Child elements, reference the demo for details | ReactElementWithTypeMark \| ReactElementWithTypeMark[] | - | | -| highlightHolder | Whether to display the current highlighted option as a placeholder | boolean | - | | +| Param | Description | Type | Default Value | Required | +| ---------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- | ------------- | -------- | +| size | Size | 'small' \| 'medium' \| 'large' | 'medium' | | +| value | Current value, for controlled mode | string \| number \| null | - | | +| defaultValue | Initial default value | string \| number | - | | +| placeholder | Placeholder when no value | string | - | | +| autoWidth | Whether the width of the drop | boolean | true | | +| label | Custom inline label | React.ReactNode | - | | +| hasClear | Whether to have a clear button (valid in single mode) | boolean | - | | +| state | Validation status | 'error' \| 'loading' \| 'success' \| 'warning' | - | | +| readOnly | Read | boolean | - | | +| disabled | Whether to disable the selector | boolean | - | | +| visible | Whether the pop | boolean | - | | +| defaultVisible | Whether the pop | boolean | - | | +| onVisibleChange | Callback when the pop | (visible: boolean, type?: VisibleChangeType) => void | - | | +| popupContainer | Popup mounting container | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | +| popupClassName | Popup class name | string | - | | +| popupStyle | Popup inline style | React.CSSProperties | - | | +| popupProps | Props added to the popup | React.ComponentPropsWithRef\ | - | | +| popupContent | Custom popup content | React.ReactNode | - | | +| followTrigger | Whether to follow the trigger scroll | boolean | - | | +| filterLocal | Use local filtering, when the data source is remote, you need to close this item | boolean | true | | +| filter | Local filtering method, return a Boolean value to determine whether to retain | (key: string \| number, item: ObjectItem) => boolean | - | | +| onToggleHighlightItem | Callback when pressing keyboard up and down keys to switch the menu highlight option | (
highlightKey?: string \| boolean \| NormalizedObjectItem \| null,
type?: HighlightChangeType
) => void | - | | +| useVirtual | Whether to enable virtual scrolling mode | boolean | - | | +| dataSource | Data source, can dynamically render child items | Array\ | - | | +| itemRender | Render MenuItem content | (item: ObjectItem) => React.ReactNode | - | | +| onChange | Callback when AutoComplete changes | (value: string, actionType: string, item?: ObjectItem) => void | - | | +| onKeyDown | - | (e: React.KeyboardEvent\) => void | - | | +| fillProps | The key to fill in the value of the selection box | string | 'value' | | +| autoHighlightFirstItem | Automatically highlight the first option | boolean | true | | +| highlightKey | Highlight key | string | - | | +| defaultHighlightKey | Default highlight key | string | - | | +| onFocus | Callback when AutoComplete gets focus | InputProps['onFocus'] | - | | +| children | Child elements, reference the demo for details | React.ReactNode | - | | +| highlightHolder | Whether to display the current highlighted option as a placeholder | boolean | - | | ### Select.OptionGroup @@ -171,22 +172,24 @@ This is because the layer's animation of the overlay is implemented by `classNam ### Select.Option -| Param | Description | Type | Default Value | Required | -| -------- | ------------------ | ------------------------------------------------ | ------------- | -------- | -| value | Option value | string \| number \| boolean \| null \| undefined | - | yes | -| disabled | Whether to disable | boolean | - | | +| Param | Description | Type | Default Value | Required | +| -------- | ---------------------------------------------- | ------------------------------------------------ | ------------- | -------- | +| value | Option value | string \| number \| boolean \| null \| undefined | - | | +| key | Option value, priority is lower than value | React.Key | - | | +| disabled | Whether to disable | boolean | - | | +| label | Option label, priority is higher than children | React.ReactNode | - | | +| children | Option label | React.ReactNode | - | | ### ObjectItem -| Param | Description | Type | Default Value | Required | -| ----------- | ----------- | ------------------------------------------------ | ------------- | -------- | -| value | - | string \| number \| boolean \| null \| undefined | - | | -| label | - | string \| number \| boolean | - | | -| color | - | string | - | | -| disabled | - | boolean | - | | -| children | - | DataSourceItem[] | - | | -| title | - | string | - | | -| \_\_isAddon | - | boolean | - | | +| Param | Description | Type | Default Value | Required | +| -------- | ------------------------------------------------------------ | ------------------------------------------------ | ------------- | -------- | +| value | Option value | string \| number \| boolean \| null \| undefined | - | | +| label | Option label | React.ReactNode | - | | +| color | Option background color, optional values are the same as Tag | TagProps['color'] | - | | +| disabled | Option is disabled | boolean | - | | +| children | Sub | DataSourceItem[] | - | | +| title | Option title | string \| null | - | | ### DataSourceItem diff --git a/components/select/__docs__/index.md b/components/select/__docs__/index.md index 360cd1413b..386cdb4348 100644 --- a/components/select/__docs__/index.md +++ b/components/select/__docs__/index.md @@ -28,7 +28,7 @@ | 参数 | 说明 | 类型 | 默认值 | 是否必填 | 支持版本 | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | -------- | -------- | | size | 选择器尺寸 | 'small' \| 'medium' \| 'large' | 'medium' | | - | -| children | 子元素,详细使用方法参考 demo | ReactElementWithTypeMark \| ReactElementWithTypeMark[] | - | | - | +| children | 子元素,详细使用方法参考 demo | React.ReactNode | - | | - | | name | name | string | - | | - | | value | 当前值,用于受控模式 | DataSourceItem \| DataSourceItem[] | - | | - | | defaultValue | 初始的默认值 | DataSourceItem \| DataSourceItem[] | - | | - | @@ -45,13 +45,13 @@ | popupContainer | 弹层挂载的容器节点 | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | - | | popupClassName | 弹层的 className | string | - | | - | | popupStyle | 弹层的内联样式 | React.CSSProperties | - | | - | -| popupProps | 添加到弹层上的属性 | PopupProps | - | | - | +| popupProps | 添加到弹层上的属性 | React.ComponentPropsWithRef\ | - | | - | | followTrigger | 是否跟随 trigger 滚动 | boolean | - | | - | | popupContent | 自定义弹层的内容 | React.ReactNode | - | | - | | menuProps | 弹层菜单属性 | MenuProps | - | | 1.18 | | filterLocal | 是否使用本地过滤,在数据源为远程的时候需要关闭此项 | boolean | true | | - | | filter | 本地过滤方法,返回一个 Boolean 值确定是否保留

**签名**:
**参数**:
_key_: 搜索关键字
_item_: 渲染节点的 item | (key: string \| number, item: ObjectItem) => boolean | - | | - | -| onToggleHighlightItem | 键盘上下键切换菜单高亮选项的回调 | (highlightKey?: unknown, type?: HighlightChangeType) => void | - | | - | +| onToggleHighlightItem | 键盘上下键切换菜单高亮选项的回调 | (
highlightKey?: string \| boolean \| NormalizedObjectItem \| null,
type?: HighlightChangeType
) => void | - | | - | | useVirtual | 是否开启虚拟滚动模式 | boolean | - | | - | | dataSource | 传入的数据源,可以动态渲染子项 | Array\ | - | | - | | itemRender | 渲染 MenuItem 内容的方法

**签名**:
**参数**:
_item_: 渲染节点的 item
_searchValue_: 搜索关键字(如果开启搜索) | (item: ObjectItem, searchValue: string \| undefined) => React.ReactNode | - | | - | @@ -61,6 +61,7 @@ | hasBorder | 是否有边框 | boolean | - | | - | | hasArrow | 是否有下拉箭头 | boolean | true | | - | | showSearch | 展开后是否能搜索(tag 模式下固定为 true) | boolean | false | | - | +| autoClearSearchValue | 是否在选中项后清空搜索框,只在 mode 为 multiple 或 tags 时有效 | boolean | true | | - | | onSearch | 当搜索框值变化时回调 | (value: string, e: React.ChangeEvent\) => void | - | | - | | onSearchClear | 当搜索框值被清空时候的回调 | (actionType?: string) => void | - | | - | | hasSelectAll | 多选模式下是否有全选功能 | boolean \| string | - | | - | @@ -90,42 +91,42 @@ ### Select.AutoComplete -| 参数 | 说明 | 类型 | 默认值 | 是否必填 | -| ---------------------- | -------------------------------------------------- | --------------------------------------------------------------- | -------- | -------- | -| size | 选择器尺寸 | 'small' \| 'medium' \| 'large' | 'medium' | | -| value | 当前值,用于受控模式 | string \| number \| null | - | | -| defaultValue | 初始化的默认值 | string \| number | - | | -| placeholder | 没有值的时候的占位符 | string | - | | -| autoWidth | 下拉菜单的宽度是否与选择器保持统一 | boolean | true | | -| label | 自定义内联 label | React.ReactNode | - | | -| hasClear | 是否有清除按钮(单选模式有效) | boolean | - | | -| state | 校验状态 | 'error' \| 'loading' \| 'success' \| 'warning' | - | | -| readOnly | 是否只读,只读模式下可以展开弹层但不能选 | boolean | - | | -| disabled | 是否禁用选择器 | boolean | - | | -| visible | 当前弹层是否显示 | boolean | - | | -| defaultVisible | 弹层初始化是否显示 | boolean | - | | -| onVisibleChange | 弹层显示或隐藏时触发的回调 | (visible: boolean, type?: VisibleChangeType) => void | - | | -| popupContainer | 弹层挂载的容器节点 | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | -| popupClassName | 弹层的 className | string | - | | -| popupStyle | 弹层的内联样式 | React.CSSProperties | - | | -| popupProps | 添加到弹层上的属性 | PopupProps | - | | -| popupContent | 自定义弹层的内容 | React.ReactNode | - | | -| followTrigger | 是否跟随 trigger 滚动 | boolean | - | | -| filterLocal | 是否使用本地过滤,在数据源为远程的时候需要关闭此项 | boolean | true | | -| filter | 本地过滤方法,返回一个 Boolean 值确定是否保留 | (key: string \| number, item: ObjectItem) => boolean | - | | -| onToggleHighlightItem | 键盘上下键切换菜单高亮选项的回调 | (highlightKey: unknown, ...args: unknown[]) => void | - | | -| useVirtual | 是否开启虚拟滚动模式 | boolean | - | | -| dataSource | 传入的数据源,可以动态渲染子项 | Array\ | - | | -| itemRender | 渲染 MenuItem 内容的方法 | (item: ObjectItem) => React.ReactNode | - | | -| onChange | AutoComplete 发生改变时触发的回调 | (value: string, actionType: string, item?: ObjectItem) => void | - | | -| onKeyDown | - | (e: React.KeyboardEvent\) => void | - | | -| fillProps | 填充到选择框里的值的 key | string | 'value' | | -| autoHighlightFirstItem | 自动高亮第一个选项 | boolean | true | | -| highlightKey | 高亮 key | string | - | | -| defaultHighlightKey | 默认高亮 key | string | - | | -| onFocus | AutoComplete 获得焦点时的回调 | InputProps['onFocus'] | - | | -| children | 子元素,详细使用方法参考 demo | ReactElementWithTypeMark \| ReactElementWithTypeMark[] | - | | -| highlightHolder | 是否将当前高亮的选项作为 placeholder | boolean | - | | +| 参数 | 说明 | 类型 | 默认值 | 是否必填 | +| ---------------------- | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -------- | -------- | +| size | 选择器尺寸 | 'small' \| 'medium' \| 'large' | 'medium' | | +| value | 当前值,用于受控模式 | string \| number \| null | - | | +| defaultValue | 初始化的默认值 | string \| number | - | | +| placeholder | 没有值的时候的占位符 | string | - | | +| autoWidth | 下拉菜单的宽度是否与选择器保持统一 | boolean | true | | +| label | 自定义内联 label | React.ReactNode | - | | +| hasClear | 是否有清除按钮(单选模式有效) | boolean | - | | +| state | 校验状态 | 'error' \| 'loading' \| 'success' \| 'warning' | - | | +| readOnly | 是否只读,只读模式下可以展开弹层但不能选 | boolean | - | | +| disabled | 是否禁用选择器 | boolean | - | | +| visible | 当前弹层是否显示 | boolean | - | | +| defaultVisible | 弹层初始化是否显示 | boolean | - | | +| onVisibleChange | 弹层显示或隐藏时触发的回调 | (visible: boolean, type?: VisibleChangeType) => void | - | | +| popupContainer | 弹层挂载的容器节点 | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | +| popupClassName | 弹层的 className | string | - | | +| popupStyle | 弹层的内联样式 | React.CSSProperties | - | | +| popupProps | 添加到弹层上的属性 | React.ComponentPropsWithRef\ | - | | +| popupContent | 自定义弹层的内容 | React.ReactNode | - | | +| followTrigger | 是否跟随 trigger 滚动 | boolean | - | | +| filterLocal | 是否使用本地过滤,在数据源为远程的时候需要关闭此项 | boolean | true | | +| filter | 本地过滤方法,返回一个 Boolean 值确定是否保留 | (key: string \| number, item: ObjectItem) => boolean | - | | +| onToggleHighlightItem | 键盘上下键切换菜单高亮选项的回调 | (
highlightKey?: string \| boolean \| NormalizedObjectItem \| null,
type?: HighlightChangeType
) => void | - | | +| useVirtual | 是否开启虚拟滚动模式 | boolean | - | | +| dataSource | 传入的数据源,可以动态渲染子项 | Array\ | - | | +| itemRender | 渲染 MenuItem 内容的方法 | (item: ObjectItem) => React.ReactNode | - | | +| onChange | AutoComplete 发生改变时触发的回调 | (value: string, actionType: string, item?: ObjectItem) => void | - | | +| onKeyDown | - | (e: React.KeyboardEvent\) => void | - | | +| fillProps | 填充到选择框里的值的 key | string | 'value' | | +| autoHighlightFirstItem | 自动高亮第一个选项 | boolean | true | | +| highlightKey | 高亮 key | string | - | | +| defaultHighlightKey | 默认高亮 key | string | - | | +| onFocus | AutoComplete 获得焦点时的回调 | InputProps['onFocus'] | - | | +| children | 子元素,详细使用方法参考 demo | React.ReactNode | - | | +| highlightHolder | 是否将当前高亮的选项作为 placeholder | boolean | - | | ### Select.OptionGroup @@ -135,22 +136,24 @@ ### Select.Option -| 参数 | 说明 | 类型 | 默认值 | 是否必填 | -| -------- | -------- | ------------------------------------------------ | ------ | -------- | -| value | 选项值 | string \| number \| boolean \| null \| undefined | - | 是 | -| disabled | 是否禁用 | boolean | - | | +| 参数 | 说明 | 类型 | 默认值 | 是否必填 | +| -------- | ----------------------------- | ------------------------------------------------ | ------ | -------- | +| value | 选项值 | string \| number \| boolean \| null \| undefined | - | | +| key | 选项值,优先级低于 value | React.Key | - | | +| disabled | 是否禁用 | boolean | - | | +| label | 选项标签,优先级高于 children | React.ReactNode | - | | +| children | 选项标签 | React.ReactNode | - | | ### ObjectItem -| 参数 | 说明 | 类型 | 默认值 | 是否必填 | -| ----------- | ---- | ------------------------------------------------ | ------ | -------- | -| value | - | string \| number \| boolean \| null \| undefined | - | | -| label | - | string \| number \| boolean | - | | -| color | - | string | - | | -| disabled | - | boolean | - | | -| children | - | DataSourceItem[] | - | | -| title | - | string | - | | -| \_\_isAddon | - | boolean | - | | +| 参数 | 说明 | 类型 | 默认值 | 是否必填 | +| -------- | ------------------------ | ------------------------------------------------ | ------ | -------- | +| value | 选项值 | string \| number \| boolean \| null \| undefined | - | | +| label | 选项标签 | React.ReactNode | - | | +| color | 选项背景色,可选值同 Tag | TagProps['color'] | - | | +| disabled | 选项是否禁用 | boolean | - | | +| children | 子选项 | DataSourceItem[] | - | | +| title | 选项标题 | string \| null | - | | ### DataSourceItem