{"name":"@rc-component/tree-select","version":"1.4.0","keywords":["react","react-component","react-tree-select","tree-select"],"author":{"name":"smith3816@gmail.com"},"license":"MIT","_id":"@rc-component/tree-select@1.4.0","maintainers":[{"name":"zombiej","email":"smith3816@gmail.com"},{"name":"afc163","email":"afc163@gmail.com"},{"name":"madccc","email":"1075746765@qq.com"},{"name":"peachscript","email":"scdzwyxst@gmail.com"},{"name":"chenshuai2144","email":"wasd2144@hotmail.com"}],"homepage":"https://github.com/react-component/tree-select","bugs":{"url":"https://github.com/react-component/tree-select/issues"},"dist":{"shasum":"b26af50f71aef1fb15add63aad39220bdbb20295","tarball":"http://registry-npm.ywwl.com/@rc-component/tree-select/download/@rc-component/tree-select-1.4.0.tgz","fileCount":81,"integrity":"sha512-I3UAlO2hNqy9CSKc8EBaESgnmKk2QaRzuZ2XHZGFCgsSMkGl06mdF97sVfROM02YIb64ocgLKefsjE0Ch4ocwQ==","signatures":[{"sig":"MEUCIBs1adgY099Oeb08iGpeKjaP4jyVaPsersViDZ7nd0qMAiEA6MbjUt1cIa4N2u21KvnoTT9g2JQIqvBRn9p6/Wixv/I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":171744,"size":37128,"noattachment":false,"key":"/@rc-component/tree-select/-/@rc-component/tree-select-1.4.0.tgz"},"main":"./lib/index","types":"./lib/index.d.ts","module":"./es/index","gitHead":"cbdacf35af184bd760720240de777bd64a15074d","scripts":{"lint":"eslint src/ examples/ --ext .tsx,.ts,.jsx,.js","test":"rc-test","build":"dumi build","start":"dumi dev","compile":"father build","prepare":"husky && dumi setup","prettier":"prettier '{src,tests}/**/*.{ts,tsx}' 'tests/**/*.js' --write","now-build":"npm run build","prepublishOnly":"npm run compile && rc-np"},"_npmUser":{"name":"afc163","email":"afc163@gmail.com"},"repository":{"url":"git+https://github.com/react-component/tree-select.git","type":"git"},"_npmVersion":"11.6.0","description":"tree-select ui component for react","directories":{},"lint-staged":{"*":"prettier --write --ignore-unknown"},"_nodeVersion":"22.8.0","dependencies":{"clsx":"^2.1.1","@rc-component/tree":"~1.1.0","@rc-component/util":"^1.4.0","@rc-component/select":"~1.3.0"},"_hasShrinkwrap":false,"devDependencies":{"dumi":"^2.4.12","glob":"^11.0.0","husky":"^9.1.6","react":"^16.0.0","enzyme":"^3.11.0","eslint":"^8.57.1","father":"^4.5.0","cheerio":"1.0.0-rc.12","rc-test":"^7.1.1","prettier":"^3.3.3","cross-env":"^7.0.3","react-dom":"^16.0.0","typescript":"^5.6.3","@types/jest":"^29.5.13","@types/node":"^22.7.5","lint-staged":"^15.2.10","@types/react":"^18.3.11","@umijs/fabric":"^4.0.1","@types/warning":"^3.0.3","enzyme-to-json":"^3.6.2","@rc-component/np":"^1.0.3","@types/react-dom":"^19.0.1","@rc-component/form":"^1.4.0","eslint-plugin-jest":"^28.10.0","@rc-component/dialog":"^1.2.0","@rc-component/trigger":"^3.0.0","eslint-plugin-unicorn":"^56.0.0","@testing-library/react":"^12.1.5","enzyme-adapter-react-16":"^1.15.8","@rc-component/virtual-list":"^1.0.1","@rc-component/father-plugin":"^2.0.2"},"peerDependencies":{"react":"*","react-dom":"*"},"_npmOperationalInternal":{"tmp":"tmp/tree-select_1.4.0_1764670587085_0.04514103107635381","host":"s3://npm-registry-packages-npm-production"},"readme":"<div align=\"center\">\n  <h1>@rc-component/tree-select</h1>\n  <p><sub><a href=\"https://ant.design\"><img alt=\"Ant Design\" height=\"14\" src=\"https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg\" style=\"vertical-align: -0.125em;\" /></a> Ant Design 生态的一部分。</sub></p>\n  <p>🌳 React 树选择组件，结合树形数据、多选、搜索和下拉交互。</p>\n\n  <p>\n    <a href=\"https://npmjs.org/package/@rc-component/tree-select\"><img alt=\"NPM version\" src=\"https://img.shields.io/npm/v/@rc-component/tree-select.svg?style=flat-square\"></a>\n    <a href=\"https://npmjs.org/package/@rc-component/tree-select\"><img alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/@rc-component/tree-select.svg?style=flat-square\"></a>\n    <a href=\"https://github.com/react-component/tree-select/actions/workflows/react-component-ci.yml\"><img alt=\"build status\" src=\"https://github.com/react-component/tree-select/actions/workflows/react-component-ci.yml/badge.svg\"></a>\n    <a href=\"https://app.codecov.io/gh/react-component/tree-select\"><img alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/react-component/tree-select/master.svg?style=flat-square\"></a>\n    <a href=\"https://bundlephobia.com/package/@rc-component/tree-select\"><img alt=\"bundle size\" src=\"https://img.shields.io/bundlephobia/minzip/@rc-component/tree-select?style=flat-square\"></a>\n    <a href=\"https://github.com/umijs/dumi\"><img alt=\"dumi\" src=\"https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square\"></a>\n  </p>\n</div>\n\n<p align=\"center\"><a href=\"./README.md\">English</a> | 简体中文</p>\n\n## 特性\n\n| 范围 | 支持                               |\n| ---- | ---------------------------------- |\n| 数据 | 树数据、简单模式和自定义字段名     |\n| 选择 | 单选、多选、勾选、严格勾选和标注值 |\n| 搜索 | 受控搜索、自定义过滤和自动清除     |\n| 加载 | 异步树加载和受控 loaded keys       |\n| 规模 | 支持可配置列表指标的虚拟滚动       |\n\n## 安装\n\n```bash\nnpm install @rc-component/tree-select\n```\n\n## 使用\n\n```tsx | pure\nimport TreeSelect from '@rc-component/tree-select';\n\nconst treeData = [\n  {\n    title: 'Parent',\n    value: 'parent',\n    children: [\n      {\n        title: 'Child',\n        value: 'child',\n      },\n    ],\n  },\n];\n\nexport default () => <TreeSelect treeData={treeData} placeholder=\"Select a node\" />;\n```\n\n## 示例\n\n运行本地 dumi 站点：\n\n```bash\nnpm install\nnpm start\n```\n\n然后打开 `http://localhost:8000`。\n\n## API\n\n### TreeSelect\n\nTreeSelect 还接受来自 `@rc-component/select` `BaseSelect` 的公共属性，但内部使用的 `mode`、`classNames`、`styles` 和由 TreeSelect 重新定义的 `showSearch` 除外。\n\n| 名称                    | 说明                                               | 类型                                                                                                       | 默认值                                                      |\n| ----------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |\n| autoClearSearchValue    | 已弃用。请改用 `showSearch.autoClearSearchValue`。 | boolean                                                                                                    | true                                                        |\n| classNames              | 语义 className。                                   | `Partial<Record<SemanticName, string>> & { popup?: Partial<Record<PopupSemantic, string>> }`               | -                                                           |\n| defaultValue            | 初始选中值。                                       | `ValueType`                                                                                                | -                                                           |\n| fieldNames              | 自定义树数据的字段名称。                           | `FieldNames`                                                                                               | -                                                           |\n| filterTreeNode          | 已弃用。请改用 `showSearch.filterTreeNode`。       | boolean \\| `(inputValue: string, treeNode: DataNode) => boolean`                                           | -                                                           |\n| inputValue              | 已弃用。请改用 `showSearch.searchValue`。          | string                                                                                                     | -                                                           |\n| labelInValue            | 是否返回标记值对象而不是原始值。                   | boolean                                                                                                    | false                                                       |\n| listHeight              | 弹层列表高度。                                     | number                                                                                                     | 200                                                         |\n| listItemHeight          | 弹层列表项的高度。                                 | number                                                                                                     | 20                                                          |\n| listItemScrollOffset    | 弹层列表项滚动偏移。                               | number                                                                                                     | 0                                                           |\n| loadData                | 异步加载树数据。                                   | `(dataNode: LegacyDataNode) => Promise<unknown>`                                                           | -                                                           |\n| maxCount                | 多重或可检查模式下的最大选定项目数。               | number                                                                                                     | -                                                           |\n| multiple                | 启用多项选择。                                     | boolean                                                                                                    | false                                                       |\n| onChange                | 当选定值更改时调用。                               | `(value: ValueType, labelList: ReactNode[], extra: ChangeEventExtra) => void`                              | -                                                           |\n| onDeselect              | 当取消选择某个值时调用。                           | `(value: ValueType, option: OptionType) => void`                                                           | -                                                           |\n| onPopupVisibleChange    | 当弹层窗口可见性发生变化时调用。                   | `(open: boolean) => void`                                                                                  | -                                                           |\n| onSearch                | 已弃用。请改用 `showSearch.onSearch`。             | `(value: string) => void`                                                                                  | -                                                           |\n| onSelect                | 选择值时调用。                                     | `(value: ValueType, option: OptionType) => void`                                                           | -                                                           |\n| onTreeExpand            | 当扩展树键更改时调用。                             | `(expandedKeys: SafeKey[]) => void`                                                                        | -                                                           |\n| onTreeLoad              | 当异步加载的键发生变化时调用。                     | `(loadedKeys: SafeKey[]) => void`                                                                          | -                                                           |\n| searchValue             | 已弃用。请改用 `showSearch.searchValue`。          | string                                                                                                     | -                                                           |\n| showCheckedStrategy     | 配置检查值的显示方式。                             | `SHOW_ALL` \\| `SHOW_PARENT` \\| `SHOW_CHILD`                                                                | 当 `treeCheckable` 使能时为 `SHOW_CHILD`，否则为 `SHOW_ALL` |\n| showSearch              | 启用搜索或配置搜索行为。                           | boolean \\| `SearchConfig`                                                                                  | -                                                           |\n| showTreeIcon            | 是否显示树形图标。                                 | boolean                                                                                                    | false                                                       |\n| styles                  | 语义化样式。                                       | `Partial<Record<SemanticName, CSSProperties>> & { popup?: Partial<Record<PopupSemantic, CSSProperties>> }` | -                                                           |\n| switcherIcon            | 自定义树切换器图标。                               | `IconType`                                                                                                 | -                                                           |\n| treeCheckable           | 是否在树中显示复选框。                             | boolean \\| ReactNode                                                                                       | false                                                       |\n| treeCheckStrictly       | 精确检查树节点，无需父子关联。                     | boolean                                                                                                    | false                                                       |\n| treeData                | 树节点数据。                                       | `OptionType[]`                                                                                             | -                                                           |\n| treeDataSimpleMode      | 启用简单树数据模式。                               | boolean \\| `SimpleModeConfig`                                                                              | false                                                       |\n| treeDefaultExpandAll    | 默认展开所有树节点。                               | boolean                                                                                                    | false                                                       |\n| treeDefaultExpandedKeys | 初始扩展树键。                                     | `SafeKey[]`                                                                                                | -                                                           |\n| treeExpandAction        | 树节点展开触发行为。                               | false \\| `click` \\| `doubleClick`                                                                          | `click`                                                     |\n| treeExpandedKeys        | 受控的扩展树键。                                   | `SafeKey[]`                                                                                                | -                                                           |\n| treeIcon                | 自定义树图标。                                     | `IconType`                                                                                                 | -                                                           |\n| treeLine                | 是否显示树线。                                     | boolean                                                                                                    | false                                                       |\n| treeLoadedKeys          | 受控加载的树键。                                   | `SafeKey[]`                                                                                                | -                                                           |\n| treeMotion              | 树运动配置。                                       | any                                                                                                        | -                                                           |\n| treeNodeFilterProp      | 已弃用。请改用 `showSearch.treeNodeFilterProp`。   | string                                                                                                     | `value`                                                     |\n| treeNodeLabelProp       | 作为选中标签渲染的树节点属性。                     | string                                                                                                     | `title`                                                     |\n| treeTitleRender         | 自定义树节点标题渲染器。                           | `(node: OptionType) => ReactNode`                                                                          | -                                                           |\n| value                   | 受控选中值。                                       | `ValueType`                                                                                                | -                                                           |\n| virtual                 | 设置为 `false` 时禁用虚拟滚动。                    | boolean                                                                                                    | -                                                           |\n\n### SearchConfig\n\n| 名称                 | 说明                                           | 类型                                                             | 默认值  |\n| -------------------- | ---------------------------------------------- | ---------------------------------------------------------------- | ------- |\n| autoClearSearchValue | 在多种模式下选择或取消选择后清除搜索输入。     | boolean                                                          | true    |\n| filterTreeNode       | 根据搜索输入过滤树节点。                       | boolean \\| `(inputValue: string, treeNode: DataNode) => boolean` | -       |\n| onSearch             | 当搜索输入更改时调用。                         | `(value: string) => void`                                        | -       |\n| searchValue          | 受控搜索输入值。                               | string                                                           | -       |\n| treeNodeFilterProp   | 启用 `filterTreeNode` 时用于过滤的树节点属性。 | string                                                           | `value` |\n\n### DataNode\n\n| 名称     | 说明             | 类型         | 默认值 |\n| -------- | ---------------- | ------------ | ------ |\n| children | 子树节点。       | `DataNode[]` | -      |\n| disabled | 禁用树节点。     | boolean      | false  |\n| key      | 唯一树节点 key。 | `React.Key`  | -      |\n| title    | 树节点标题。     | ReactNode    | -      |\n| value    | 树节点值。       | `SafeKey`    | -      |\n\n### TreeNode\n\n推荐使用 `treeData`。`TreeNode` 仅为兼容旧用法保留。\n\n| 名称     | 说明                 | 类型      | 默认值 |\n| -------- | -------------------- | --------- | ------ |\n| disabled | 禁用树节点。         | boolean   | false  |\n| isLeaf   | 标记节点为叶子节点。 | boolean   | false  |\n| key      | 唯一树节点 key。     | React.Key | -      |\n| title    | 树节点标题。         | ReactNode | -      |\n| value    | 树节点值。           | SafeKey   | -      |\n\n## 说明\n\n对于大型树，避免默认展开所有节点。优先使用虚拟滚动，减少同时存在的 TreeSelect 实例数量，并在可勾选节点较多时使用 `treeCheckStrictly`。\n\n在 `treeCheckable` 模式下，从选择器中移除选中项和取消勾选对应树节点会得到相同的选中值，但它们是不同的交互。二者都会触发 `onChange`，`extra` 参数可能\ntherefore differ.\n\n## 本地开发\n\n```bash\nnpm install\nnpm start\nnpm test\nnpm run lint\nnpm run compile\n```\n\ndumi 站点默认运行在 `http://localhost:8000`。\n\n## 发布\n\n```bash\nnpm run prepublishOnly\n```\n\n包构建完成后，发布流程由 `@rc-component/np` 通过 `rc-np` 命令处理。\n\n## 许可证\n\n@rc-component/tree-select 基于 [MIT](./LICENSE) 许可证发布。\n","publish_time":1764670587273,"_cnpm_publish_time":1764670587273,"dist-tags":{"latest":"1.19.0"}}