11<div align =" center " >
22 <h1 >@rc-component/cascader</h1 >
3- <p ><sub >Ant Design 生态的一部分。</sub ></p >
4- <img alt =" Ant Design " height =" 32 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " />
3+ <p ><sub ><img alt =" Ant Design " height =" 14 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " style =" vertical-align : -0.125em ;" /> Ant Design 生态的一部分。</sub ></p >
54 <p >🧭 React 级联选择组件,支持层级选项、搜索、多选、异步加载和自定义渲染。</p >
65
76 <p >
2120
2221| 范围 | 支持 |
2322| --------- | ---------------------------------------------------------------- |
24- | Data | Nested options, field name mapping, disabled nodes |
25- | Selection | Single, multiple, checkable, and change-on-select flows |
26- | Search | Controlled search, custom filter, custom sort, custom render |
27- | Loading | Async option loading with ` loadData ` |
28- | Rendering | Custom option label, dropdown content, icons, and expand trigger |
23+ | 数据 | 嵌套选项、字段名映射和禁用节点 |
24+ | Selection | 单选、多选、勾选和逐级选择流程 |
25+ | 搜索 | 受控搜索、自定义过滤、自定义排序和自定义渲染 |
26+ | Loading | 通过 ` loadData ` 异步加载选项 |
27+ | Rendering | 自定义选项标签、下拉内容、图标和展开触发方式 |
2928
3029## 安装
3130
@@ -66,67 +65,67 @@ export default () => (
6665
6766## 示例
6867
69- 查看[ 在线示例] ( https://cascader-react-component.vercel.app/ ) ,了解 search, multiple selection, custom field names, lazy loading, panel mode, and popup customization 。
68+ 查看[ 在线示例] ( https://cascader-react-component.vercel.app/ ) ,了解搜索、多选、自定义字段名称、延迟加载、面板模式和弹层窗口自定义 。
7069
7170## API
7271
7372### Cascader
7473
7574| 参数 | 类型 | 默认值 | 说明 |
7675| -------------------- | ------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
77- | autoClearSearchValue | boolean | true | Deprecated. Use ` showSearch.autoClearSearchValue ` instead. |
78- | builtinPlacements | BuildInPlacements | - | Custom popup placements. |
79- | changeOnSelect | boolean | false | Trigger ` onChange ` when selecting each level. |
80- | checkable | boolean \| ReactNode | false | Enable multiple selection with checkbox UI. |
81- | children | ReactElement | - | Trigger element. |
82- | classNames | Semantic class name map | - | Semantic class names for selector and popup elements. |
83- | defaultValue | string [ ] \| number [ ] \| Array<string [ ] \| number [ ] > | - | Initial selected value. |
84- | displayRender | ` (label, selectedOptions) => ReactNode ` | - | Render selected labels. |
85- | expandIcon | ReactNode | ` > ` | Custom expand icon. |
86- | expandTrigger | ` click ` \| ` hover ` | ` click ` | Trigger action for expanding the next option level. |
87- | fieldNames | ` { label?: string; value?: string; children?: string } ` | ` { label: 'label', value: 'value', children: 'children' } ` | Custom option field names. |
88- | loadData | ` (selectedOptions) => void ` | - | Load child options asynchronously. |
89- | loadingIcon | ReactNode | - | Custom loading icon. |
90- | onChange | ` (value, selectedOptions) => void ` | - | Called when selection changes. |
91- | onPopupVisibleChange | ` (open: boolean) => void ` | - | Called when popup visibility changes. |
92- | onSearch | ` (value: string) => void ` | - | Deprecated. Use ` showSearch.onSearch ` instead. |
93- | open | boolean | - | Controlled popup visibility. |
94- | optionRender | ` (option) => ReactNode ` | - | Custom option renderer. |
95- | options | Option [ ] | - | Hierarchical option data. |
96- | placement | Select placement | - | Popup placement. |
97- | popupClassName | string | - | Popup class name. |
98- | popupMenuColumnStyle | CSSProperties | - | Style for each popup menu column. |
99- | prefixCls | string | ` rc-cascader ` | Class name prefix. |
100- | searchValue | string | - | Deprecated. Use ` showSearch.searchValue ` instead. |
101- | showCheckedStrategy | ` SHOW_PARENT ` \| ` SHOW_CHILD ` | ` SHOW_PARENT ` | Strategy for rendering checked values in multiple mode. |
102- | showSearch | boolean \| SearchConfig | false | Enable and configure search. |
103- | styles | Semantic style map | - | Semantic styles for selector and popup elements. |
104- | value | string [ ] \| number [ ] \| Array<string [ ] \| number [ ] > | - | Controlled selected value. |
105-
106- ` Cascader ` also accepts public props from ` @rc-component/select ` ` BaseSelect ` , except private select-only props such as ` mode ` , ` labelInValue ` , ` showSearch ` , and ` tokenSeparators ` .
76+ | autoClearSearchValue | boolean | true | 已弃用。请改用 ` showSearch.autoClearSearchValue ` 。 |
77+ | builtinPlacements | BuildInPlacements | - | 自定义弹层位置。 |
78+ | changeOnSelect | boolean | false | 选择每个级别时触发 ` onChange ` 。 |
79+ | checkable | boolean \| ReactNode | false | 启用带复选框 UI 的多选。 |
80+ | 孩子们 | ReactElement | - | 触发元素。 |
81+ | classNames | 语义className映射 | - | 选择器和弹层元素的语义className称。 |
82+ | defaultValue | 字符串 [ ] \| 数字 [ ] \| 数组<字符串 [ ] \| 数字 [ ] > | - | 初始选中值。 |
83+ | displayRender | ` (label, selectedOptions) => ReactNode ` | - | 渲染选定的标签。 |
84+ | expandIcon | ReactNode | ` > ` | 自定义展开图标。 |
85+ | expandTrigger | ` click ` \| ` hover ` | ` click ` | 触发扩展下一个选项级别的操作。 |
86+ | fieldNames | ` { label?: string; value?: string; children?: string } ` | ` { label: 'label', value: 'value', children: 'children' } ` | 自定义选项字段名称。 |
87+ | loadData | ` (selectedOptions) => void ` | - | 异步加载子选项。 |
88+ | loadingIcon | ReactNode | - | 自定义加载图标。 |
89+ | onChange | ` (value, selectedOptions) => void ` | - | 选择更改时调用。 |
90+ | onPopupVisibleChange | ` (open: boolean) => void ` | - | 当弹层窗口可见性发生变化时调用。 |
91+ | onSearch | ` (value: string) => void ` | - | 已弃用。请改用 ` showSearch.onSearch ` 。 |
92+ | 打开 | boolean | - | 受控的弹层窗口可见性。 |
93+ | optionRender | ` (option) => ReactNode ` | - | 自定义选项渲染器。 |
94+ | 选项 | 选项 [ ] | - | 分层选项数据。 |
95+ | placement | 选择展示位置 | - | 弹层窗口放置。 |
96+ | popupClassName | string | - | 弹层className。 |
97+ | popupMenuColumnStyle | CSSProperties | - | 每个弹出菜单列的样式。 |
98+ | prefixCls | string | ` rc-cascader ` | className前缀。 |
99+ | searchValue | string | - | 已弃用。请改用 ` showSearch.searchValue ` 。 |
100+ | showCheckedStrategy | ` SHOW_PARENT ` \| ` SHOW_CHILD ` | ` SHOW_PARENT ` | 在多种模式下渲染检查值的策略。 |
101+ | showSearch | boolean \| SearchConfig | false | 启用并配置搜索。 |
102+ | styles | 语义风格图 | - | 选择器和弹层元素的语义样式。 |
103+ | 价值 | 字符串 [ ] \| 数字 [ ] \| 数组<字符串 [ ] \| 数字 [ ] > | - | 受控选中值。 |
104+
105+ ` Cascader ` 还接受来自 ` @rc-component/select ` ` BaseSelect ` 的公共属性,但私有仅选择属性除外,例如 ` mode ` 、 ` labelInValue ` 、 ` showSearch ` 和 ` tokenSeparators ` 。
107106
108107### SearchConfig
109108
110109| 参数 | 类型 | 默认值 | 说明 |
111110| -------------------- | -------------------------------------------------------- | ------- | ---------------------------------------------------------- |
112- | autoClearSearchValue | boolean | true | Clear search text after selecting an item. |
113- | filter | ` (inputValue, options, fieldNames) => boolean ` | - | Return ` true ` to include an option path in search results. |
114- | limit | number \| false | 50 | Limit the number of filtered items. |
115- | matchInputWidth | boolean | true | Whether the search result width matches the input width. |
116- | onSearch | ` (value: string) => void ` | - | Called when search text changes. |
117- | render | ` (inputValue, path, prefixCls, fieldNames) => ReactNode ` | - | Render a filtered option path. |
118- | searchValue | string | - | Controlled search text. |
119- | sort | ` (a, b, inputValue, fieldNames) => number ` | - | Sort filtered option paths. |
111+ | autoClearSearchValue | boolean | true | 选择项目后清除搜索文本。 |
112+ | 筛选 | ` (inputValue, options, fieldNames) => boolean ` | - | 返回 ` true ` 以在搜索结果中包含选项路径。 |
113+ | limit | number \| false | 50 | 限制过滤项目的数量。 |
114+ | matchInputWidth | boolean | true | 搜索结果宽度是否与输入宽度匹配。 |
115+ | onSearch | ` (value: string) => void ` | - | 当搜索文本更改时调用。 |
116+ | 使成为 | ` (inputValue, path, prefixCls, fieldNames) => ReactNode ` | - | 渲染过滤后的选项路径。 |
117+ | searchValue | string | - | 受控搜索文本。 |
118+ | 种类 | ` (a, b, inputValue, fieldNames) => number ` | - | 对过滤后的选项路径进行排序。 |
120119
121- ### Option
120+ ### 选项
122121
123122| 参数 | 类型 | 默认值 | 说明 |
124123| --------------- | ------------------------ | ------- | ------------------------------------------------ |
125- | children | Option [ ] | - | Child options. |
126- | disabled | boolean | false | Disable this option. |
127- | disableCheckbox | boolean | false | Disable this option's checkbox in multiple mode. |
124+ | 孩子们 | 选项 [ ] | - | 儿童选项。 |
125+ | disabled | boolean | false | 禁用此选项。 |
126+ | disableCheckbox | boolean | false | 在多种模式下禁用此选项的复选框。 |
128127| label | ReactNode | - | Display label. |
129- | value | string \| number \| null | - | Option value. |
128+ | 价值 | 字符串 \| 数字 \| 无效的 | - | 选项值。 |
130129
131130## 本地开发
132131
@@ -151,8 +150,8 @@ npm run compile
151150npm run prepublishOnly
152151```
153152
154- The release flow is handled by ` @rc-component/np ` through the ` rc-np ` command after the package build.
153+ 包构建完成后,发布流程由 ` @rc-component/np ` 通过 ` rc-np ` 命令处理。
155154
156155## 许可证
157156
158- @rc-component/cascader is released under the [ MIT] ( ./LICENSE.md ) license.
157+ @rc-component/cascader 基于 [ MIT] ( ./LICENSE.md ) 许可证发布。
0 commit comments