{"name":"@rc-component/tree-select","version":"1.15.0","keywords":["react","react-component","react-tree-select","tree-select"],"author":{"name":"smith3816@gmail.com"},"license":"MIT","_id":"@rc-component/tree-select@1.15.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://react-component.github.io/tree-select","bugs":{"url":"https://github.com/react-component/tree-select/issues"},"dist":{"shasum":"3765d27f3039e6b0c160264a3a3a6d1486f9504d","tarball":"http://registry-npm.ywwl.com/@rc-component/tree-select/download/@rc-component/tree-select-1.15.0.tgz","fileCount":83,"integrity":"sha512-4ochj6dldT4tv8sOeuhrSJfgYe63gANU+q9b+9VbM/a9wjAFsA4sp9/0SFT7RIj1WGWhlQO+pLT5aQN3rPaw3Q==","signatures":[{"sig":"MEYCIQCYg1GIqBo2zEots/YYLMSyVYQDhWVvx4+nCFu4U5CvQgIhAPQXJkmDs7563vjQCBjLVVgpVWhPO+1XrPJz4PHAqrBj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":178476,"size":39403,"noattachment":false,"key":"/@rc-component/tree-select/-/@rc-component/tree-select-1.15.0.tgz"},"main":"./lib/index","types":"./es/index.d.ts","module":"./es/index","gitHead":"5a718680d0430861cdb86b1960a9abeb1fbdd272","scripts":{"tsc":"tsc --noEmit","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 --write --ignore-unknown .","prepublishOnly":"npm run compile && rc-np"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"repository":{"url":"git+https://github.com/react-component/tree-select.git","type":"git"},"_npmVersion":"11.7.0","description":"tree-select ui component for react","directories":{},"lint-staged":{"*":"prettier --write --ignore-unknown"},"_nodeVersion":"22.15.1","dependencies":{"clsx":"^2.1.1","@rc-component/tree":"~1.3.2","@rc-component/util":"^1.11.1","@rc-component/select":"~1.10.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"dumi":"^2.4.38","glob":"^13.0.6","husky":"^9.1.7","react":"^19.2.7","eslint":"^10.6.0","father":"^4.6.24","globals":"^17.7.0","rc-test":"^7.1.3","prettier":"^3.9.4","cross-env":"^10.1.0","react-dom":"^19.2.7","@eslint/js":"^10.0.1","typescript":"^6.0.3","@types/jest":"^30.0.0","@types/node":"^26.0.1","lint-staged":"^17.0.8","@types/react":"^19.2.17","@eslint/compat":"^2.1.0","@types/warning":"^3.0.4","@rc-component/np":"^1.0.4","@types/react-dom":"^19.2.3","typescript-eslint":"^8.62.1","@rc-component/form":"^1.4.0","eslint-plugin-jest":"^29.15.4","eslint-plugin-react":"^7.37.5","@rc-component/dialog":"^1.2.0","@testing-library/dom":"^10.4.1","@rc-component/trigger":"^3.0.0","@testing-library/react":"^16.3.2","eslint-config-prettier":"^10.1.8","@testing-library/jest-dom":"^6.9.1","eslint-plugin-react-hooks":"^7.1.1","@rc-component/virtual-list":"^1.0.1","@rc-component/father-plugin":"^2.2.0"},"peerDependencies":{"react":"*","react-dom":"*"},"_npmOperationalInternal":{"tmp":"tmp/tree-select_1.15.0_1783675322059_0.8193872587354738","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":1783675322208,"_cnpm_publish_time":1783675322208,"dist-tags":{"latest":"1.19.0"}}