@rc-component/tree-select 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/LICENSE.md +22 -0
  2. package/README.md +140 -0
  3. package/assets/icons.png +0 -0
  4. package/assets/index.less +2 -0
  5. package/assets/loading.gif +0 -0
  6. package/assets/minus.gif +0 -0
  7. package/assets/select.less +3 -0
  8. package/assets/tree.less +3 -0
  9. package/dist/223.90c7e648.async.js +3 -0
  10. package/dist/338.a2a48f3b.async.js +15 -0
  11. package/dist/338.e8c51481.chunk.css +5 -0
  12. package/dist/404.html +20 -0
  13. package/dist/439.67bede3f.async.js +137 -0
  14. package/dist/929.df8dd03f.async.js +32 -0
  15. package/dist/demo/basic/index.html +20 -0
  16. package/dist/demo/big-data/index.html +20 -0
  17. package/dist/demo/controlled/index.html +20 -0
  18. package/dist/demo/custom-icons/index.html +20 -0
  19. package/dist/demo/debug/index.html +20 -0
  20. package/dist/demo/disable/index.html +20 -0
  21. package/dist/demo/dynamic/index.html +20 -0
  22. package/dist/demo/field-names/index.html +20 -0
  23. package/dist/demo/filter/index.html +20 -0
  24. package/dist/demo/form/index.html +20 -0
  25. package/dist/demo/mutiple-with-max-count/index.html +20 -0
  26. package/dist/demo/tree-node-label-prop/index.html +20 -0
  27. package/dist/demo/width/index.html +20 -0
  28. package/dist/demos.f221b577.async.js +1 -0
  29. package/dist/docs__demo__basic.md.bcb0edb7.async.js +1 -0
  30. package/dist/docs__demo__big-data.md.8783cd6b.async.js +1 -0
  31. package/dist/docs__demo__controlled.md.e65ef7d7.async.js +1 -0
  32. package/dist/docs__demo__custom-icons.md.d53bf2f9.async.js +1 -0
  33. package/dist/docs__demo__debug.md.099ad226.async.js +1 -0
  34. package/dist/docs__demo__disable.md.6ba57652.async.js +1 -0
  35. package/dist/docs__demo__dynamic.md.f7559890.async.js +1 -0
  36. package/dist/docs__demo__fieldNames.md.16131d9f.async.js +1 -0
  37. package/dist/docs__demo__filter.md.02527db4.async.js +1 -0
  38. package/dist/docs__demo__form.md.6b77dffe.async.js +1 -0
  39. package/dist/docs__demo__mutiple-with-maxCount.md.7268d4ad.async.js +1 -0
  40. package/dist/docs__demo__treeNodeLabelProp.md.24709916.async.js +1 -0
  41. package/dist/docs__demo__width.md.24bfecd6.async.js +1 -0
  42. package/dist/docs__index.md.a6e45331.async.js +1 -0
  43. package/dist/dumi__tmp-production__dumi__theme__ContextWrapper.f56a0670.async.js +1 -0
  44. package/dist/index.html +20 -0
  45. package/dist/meta__docs.255fc42b.chunk.css +1 -0
  46. package/dist/meta__docs.dbf04b66.async.js +3359 -0
  47. package/dist/nm__dumi__dist__client__pages__404.8b85f2d9.chunk.css +1 -0
  48. package/dist/nm__dumi__dist__client__pages__404.ca2add38.async.js +1 -0
  49. package/dist/nm__dumi__dist__client__pages__Demo__index.29e9ef8f.async.js +1 -0
  50. package/dist/nm__dumi__dist__client__pages__Demo__index.578aa5c0.chunk.css +1 -0
  51. package/dist/nm__dumi__theme-default__layouts__DocLayout__index.8ed833d7.async.js +1 -0
  52. package/dist/preload_helper.d41c4da0.js +1 -0
  53. package/dist/umi.4f47b921.js +124 -0
  54. package/dist/umi.8faca2de.css +1 -0
  55. package/dist/~demos/:id/index.html +20 -0
  56. package/dist/~demos/docs-demo-basic-demo-basic/index.html +20 -0
  57. package/dist/~demos/docs-demo-big-data-demo-big-data/index.html +20 -0
  58. package/dist/~demos/docs-demo-controlled-demo-controlled/index.html +20 -0
  59. package/dist/~demos/docs-demo-custom-icons-demo-custom-icons/index.html +20 -0
  60. package/dist/~demos/docs-demo-debug-demo-debug/index.html +20 -0
  61. package/dist/~demos/docs-demo-disable-demo-disable/index.html +20 -0
  62. package/dist/~demos/docs-demo-dynamic-demo-dynamic/index.html +20 -0
  63. package/dist/~demos/docs-demo-field-names-demo-fieldnames/index.html +20 -0
  64. package/dist/~demos/docs-demo-filter-demo-filter/index.html +20 -0
  65. package/dist/~demos/docs-demo-form-demo-form/index.html +20 -0
  66. package/dist/~demos/docs-demo-mutiple-with-max-count-demo-mutiple-with-maxcount/index.html +20 -0
  67. package/dist/~demos/docs-demo-tree-node-label-prop-demo-treenodelabelprop/index.html +20 -0
  68. package/dist/~demos/docs-demo-width-demo-width/index.html +20 -0
  69. package/es/LegacyContext.d.ts +24 -0
  70. package/es/LegacyContext.js +3 -0
  71. package/es/OptionList.d.ts +8 -0
  72. package/es/OptionList.js +351 -0
  73. package/es/TreeNode.d.ts +9 -0
  74. package/es/TreeNode.js +5 -0
  75. package/es/TreeSelect.d.ts +65 -0
  76. package/es/TreeSelect.js +507 -0
  77. package/es/TreeSelectContext.d.ts +25 -0
  78. package/es/TreeSelectContext.js +3 -0
  79. package/es/hooks/useCache.d.ts +7 -0
  80. package/es/hooks/useCache.js +32 -0
  81. package/es/hooks/useCheckedKeys.d.ts +5 -0
  82. package/es/hooks/useCheckedKeys.js +21 -0
  83. package/es/hooks/useDataEntities.d.ts +7 -0
  84. package/es/hooks/useDataEntities.js +26 -0
  85. package/es/hooks/useFilterTreeData.d.ts +8 -0
  86. package/es/hooks/useFilterTreeData.js +33 -0
  87. package/es/hooks/useRefFunc.d.ts +5 -0
  88. package/es/hooks/useRefFunc.js +14 -0
  89. package/es/hooks/useTreeData.d.ts +7 -0
  90. package/es/hooks/useTreeData.js +52 -0
  91. package/es/index.d.ts +7 -0
  92. package/es/index.js +5 -0
  93. package/es/interface.d.ts +57 -0
  94. package/es/interface.js +1 -0
  95. package/es/utils/legacyUtil.d.ts +5 -0
  96. package/es/utils/legacyUtil.js +120 -0
  97. package/es/utils/strategyUtil.d.ts +7 -0
  98. package/es/utils/strategyUtil.js +25 -0
  99. package/es/utils/valueUtil.d.ts +11 -0
  100. package/es/utils/valueUtil.js +30 -0
  101. package/es/utils/warningPropsUtil.d.ts +5 -0
  102. package/es/utils/warningPropsUtil.js +30 -0
  103. package/lib/LegacyContext.d.ts +24 -0
  104. package/lib/LegacyContext.js +11 -0
  105. package/lib/OptionList.d.ts +8 -0
  106. package/lib/OptionList.js +359 -0
  107. package/lib/TreeNode.d.ts +9 -0
  108. package/lib/TreeNode.js +11 -0
  109. package/lib/TreeSelect.d.ts +65 -0
  110. package/lib/TreeSelect.js +516 -0
  111. package/lib/TreeSelectContext.d.ts +25 -0
  112. package/lib/TreeSelectContext.js +11 -0
  113. package/lib/hooks/useCache.d.ts +7 -0
  114. package/lib/hooks/useCache.js +41 -0
  115. package/lib/hooks/useCheckedKeys.d.ts +5 -0
  116. package/lib/hooks/useCheckedKeys.js +29 -0
  117. package/lib/hooks/useDataEntities.d.ts +7 -0
  118. package/lib/hooks/useDataEntities.js +36 -0
  119. package/lib/hooks/useFilterTreeData.d.ts +8 -0
  120. package/lib/hooks/useFilterTreeData.js +41 -0
  121. package/lib/hooks/useRefFunc.d.ts +5 -0
  122. package/lib/hooks/useRefFunc.js +21 -0
  123. package/lib/hooks/useTreeData.d.ts +7 -0
  124. package/lib/hooks/useTreeData.js +60 -0
  125. package/lib/index.d.ts +7 -0
  126. package/lib/index.js +35 -0
  127. package/lib/interface.d.ts +57 -0
  128. package/lib/interface.js +5 -0
  129. package/lib/utils/legacyUtil.d.ts +5 -0
  130. package/lib/utils/legacyUtil.js +131 -0
  131. package/lib/utils/strategyUtil.d.ts +7 -0
  132. package/lib/utils/strategyUtil.js +32 -0
  133. package/lib/utils/valueUtil.d.ts +11 -0
  134. package/lib/utils/valueUtil.js +41 -0
  135. package/lib/utils/warningPropsUtil.d.ts +5 -0
  136. package/lib/utils/warningPropsUtil.js +37 -0
  137. package/package.json +89 -0
@@ -0,0 +1,351 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import { useBaseProps } from '@rc-component/select';
3
+ import Tree from 'rc-tree';
4
+ import { UnstableContext } from 'rc-tree';
5
+ import KeyCode from "@rc-component/util/es/KeyCode";
6
+ import useMemo from "@rc-component/util/es/hooks/useMemo";
7
+ import * as React from 'react';
8
+ import LegacyContext from "./LegacyContext";
9
+ import TreeSelectContext from "./TreeSelectContext";
10
+ import { getAllKeys, isCheckDisabled } from "./utils/valueUtil";
11
+ import { useEvent } from '@rc-component/util';
12
+ const HIDDEN_STYLE = {
13
+ width: 0,
14
+ height: 0,
15
+ display: 'flex',
16
+ overflow: 'hidden',
17
+ opacity: 0,
18
+ border: 0,
19
+ padding: 0,
20
+ margin: 0
21
+ };
22
+ const OptionList = (_, ref) => {
23
+ const {
24
+ prefixCls,
25
+ multiple,
26
+ searchValue,
27
+ toggleOpen,
28
+ open,
29
+ notFoundContent
30
+ } = useBaseProps();
31
+ const {
32
+ virtual,
33
+ listHeight,
34
+ listItemHeight,
35
+ listItemScrollOffset,
36
+ treeData,
37
+ fieldNames,
38
+ onSelect,
39
+ popupMatchSelectWidth,
40
+ treeExpandAction,
41
+ treeTitleRender,
42
+ onPopupScroll,
43
+ leftMaxCount,
44
+ leafCountOnly,
45
+ valueEntities
46
+ } = React.useContext(TreeSelectContext);
47
+ const {
48
+ checkable,
49
+ checkedKeys,
50
+ halfCheckedKeys,
51
+ treeExpandedKeys,
52
+ treeDefaultExpandAll,
53
+ treeDefaultExpandedKeys,
54
+ onTreeExpand,
55
+ treeIcon,
56
+ showTreeIcon,
57
+ switcherIcon,
58
+ treeLine,
59
+ treeNodeFilterProp,
60
+ loadData,
61
+ treeLoadedKeys,
62
+ treeMotion,
63
+ onTreeLoad,
64
+ keyEntities
65
+ } = React.useContext(LegacyContext);
66
+ const treeRef = React.useRef();
67
+ const memoTreeData = useMemo(() => treeData,
68
+ // eslint-disable-next-line react-hooks/exhaustive-deps
69
+ [open, treeData], (prev, next) => next[0] && prev[1] !== next[1]);
70
+
71
+ // ========================== Values ==========================
72
+ const mergedCheckedKeys = React.useMemo(() => {
73
+ if (!checkable) {
74
+ return null;
75
+ }
76
+ return {
77
+ checked: checkedKeys,
78
+ halfChecked: halfCheckedKeys
79
+ };
80
+ }, [checkable, checkedKeys, halfCheckedKeys]);
81
+
82
+ // ========================== Scroll ==========================
83
+ React.useEffect(() => {
84
+ // Single mode should scroll to current key
85
+ if (open && !multiple && checkedKeys.length) {
86
+ treeRef.current?.scrollTo({
87
+ key: checkedKeys[0]
88
+ });
89
+ }
90
+ // eslint-disable-next-line react-hooks/exhaustive-deps
91
+ }, [open]);
92
+
93
+ // ========================== Events ==========================
94
+ const onListMouseDown = event => {
95
+ event.preventDefault();
96
+ };
97
+ const onInternalSelect = (__, info) => {
98
+ const {
99
+ node
100
+ } = info;
101
+ if (checkable && isCheckDisabled(node)) {
102
+ return;
103
+ }
104
+ onSelect(node.key, {
105
+ selected: !checkedKeys.includes(node.key)
106
+ });
107
+ if (!multiple) {
108
+ toggleOpen(false);
109
+ }
110
+ };
111
+
112
+ // =========================== Keys ===========================
113
+ const [expandedKeys, setExpandedKeys] = React.useState(treeDefaultExpandedKeys);
114
+ const [searchExpandedKeys, setSearchExpandedKeys] = React.useState(null);
115
+ const mergedExpandedKeys = React.useMemo(() => {
116
+ if (treeExpandedKeys) {
117
+ return [...treeExpandedKeys];
118
+ }
119
+ return searchValue ? searchExpandedKeys : expandedKeys;
120
+ }, [expandedKeys, searchExpandedKeys, treeExpandedKeys, searchValue]);
121
+ const onInternalExpand = keys => {
122
+ setExpandedKeys(keys);
123
+ setSearchExpandedKeys(keys);
124
+ if (onTreeExpand) {
125
+ onTreeExpand(keys);
126
+ }
127
+ };
128
+
129
+ // ========================== Search ==========================
130
+ const lowerSearchValue = String(searchValue).toLowerCase();
131
+ const filterTreeNode = treeNode => {
132
+ if (!lowerSearchValue) {
133
+ return false;
134
+ }
135
+ return String(treeNode[treeNodeFilterProp]).toLowerCase().includes(lowerSearchValue);
136
+ };
137
+ React.useEffect(() => {
138
+ if (searchValue) {
139
+ setSearchExpandedKeys(getAllKeys(treeData, fieldNames));
140
+ }
141
+ // eslint-disable-next-line react-hooks/exhaustive-deps
142
+ }, [searchValue]);
143
+
144
+ // ========================= Disabled =========================
145
+ // Cache disabled states in React state to ensure re-render when cache updates
146
+ const [disabledCache, setDisabledCache] = React.useState(() => new Map());
147
+ React.useEffect(() => {
148
+ if (leftMaxCount) {
149
+ setDisabledCache(new Map());
150
+ }
151
+ }, [leftMaxCount]);
152
+ function getDisabledWithCache(node) {
153
+ const value = node[fieldNames.value];
154
+ if (!disabledCache.has(value)) {
155
+ const entity = valueEntities.get(value);
156
+ const isLeaf = (entity.children || []).length === 0;
157
+ if (!isLeaf) {
158
+ const checkableChildren = entity.children.filter(childTreeNode => !childTreeNode.node.disabled && !childTreeNode.node.disableCheckbox && !checkedKeys.includes(childTreeNode.node[fieldNames.value]));
159
+ const checkableChildrenCount = checkableChildren.length;
160
+ disabledCache.set(value, checkableChildrenCount > leftMaxCount);
161
+ } else {
162
+ disabledCache.set(value, false);
163
+ }
164
+ }
165
+ return disabledCache.get(value);
166
+ }
167
+ const nodeDisabled = useEvent(node => {
168
+ const nodeValue = node[fieldNames.value];
169
+ if (checkedKeys.includes(nodeValue)) {
170
+ return false;
171
+ }
172
+ if (leftMaxCount === null) {
173
+ return false;
174
+ }
175
+ if (leftMaxCount <= 0) {
176
+ return true;
177
+ }
178
+
179
+ // This is a low performance calculation
180
+ if (leafCountOnly && leftMaxCount) {
181
+ return getDisabledWithCache(node);
182
+ }
183
+ return false;
184
+ });
185
+
186
+ // ========================== Get First Selectable Node ==========================
187
+ const getFirstMatchingNode = nodes => {
188
+ for (const node of nodes) {
189
+ if (node.disabled || node.selectable === false) {
190
+ continue;
191
+ }
192
+ if (searchValue) {
193
+ if (filterTreeNode(node)) {
194
+ return node;
195
+ }
196
+ } else {
197
+ return node;
198
+ }
199
+ if (node[fieldNames.children]) {
200
+ const matchInChildren = getFirstMatchingNode(node[fieldNames.children]);
201
+ if (matchInChildren) {
202
+ return matchInChildren;
203
+ }
204
+ }
205
+ }
206
+ return null;
207
+ };
208
+
209
+ // ========================== Active ==========================
210
+ const [activeKey, setActiveKey] = React.useState(null);
211
+ const activeEntity = keyEntities[activeKey];
212
+ React.useEffect(() => {
213
+ if (!open) {
214
+ return;
215
+ }
216
+ let nextActiveKey = null;
217
+ const getFirstNode = () => {
218
+ const firstNode = getFirstMatchingNode(memoTreeData);
219
+ return firstNode ? firstNode[fieldNames.value] : null;
220
+ };
221
+
222
+ // single mode active first checked node
223
+ if (!multiple && checkedKeys.length && !searchValue) {
224
+ nextActiveKey = checkedKeys[0];
225
+ } else {
226
+ nextActiveKey = getFirstNode();
227
+ }
228
+ setActiveKey(nextActiveKey);
229
+ // eslint-disable-next-line react-hooks/exhaustive-deps
230
+ }, [open, searchValue]);
231
+
232
+ // ========================= Keyboard =========================
233
+ React.useImperativeHandle(ref, () => ({
234
+ scrollTo: treeRef.current?.scrollTo,
235
+ onKeyDown: event => {
236
+ const {
237
+ which
238
+ } = event;
239
+ switch (which) {
240
+ // >>> Arrow keys
241
+ case KeyCode.UP:
242
+ case KeyCode.DOWN:
243
+ case KeyCode.LEFT:
244
+ case KeyCode.RIGHT:
245
+ treeRef.current?.onKeyDown(event);
246
+ break;
247
+
248
+ // >>> Select item
249
+ case KeyCode.ENTER:
250
+ {
251
+ if (activeEntity) {
252
+ const isNodeDisabled = nodeDisabled(activeEntity.node);
253
+ const {
254
+ selectable,
255
+ value,
256
+ disabled
257
+ } = activeEntity?.node || {};
258
+ if (selectable !== false && !disabled && !isNodeDisabled) {
259
+ onInternalSelect(null, {
260
+ node: {
261
+ key: activeKey
262
+ },
263
+ selected: !checkedKeys.includes(value)
264
+ });
265
+ }
266
+ }
267
+ break;
268
+ }
269
+
270
+ // >>> Close
271
+ case KeyCode.ESC:
272
+ {
273
+ toggleOpen(false);
274
+ }
275
+ }
276
+ },
277
+ onKeyUp: () => {}
278
+ }));
279
+ const hasLoadDataFn = useMemo(() => searchValue ? false : true,
280
+ // eslint-disable-next-line react-hooks/exhaustive-deps
281
+ [searchValue, treeExpandedKeys || expandedKeys], ([preSearchValue], [nextSearchValue, nextExcludeSearchExpandedKeys]) => preSearchValue !== nextSearchValue && !!(nextSearchValue || nextExcludeSearchExpandedKeys));
282
+ const syncLoadData = hasLoadDataFn ? loadData : null;
283
+
284
+ // ========================== Render ==========================
285
+ if (memoTreeData.length === 0) {
286
+ return /*#__PURE__*/React.createElement("div", {
287
+ role: "listbox",
288
+ className: `${prefixCls}-empty`,
289
+ onMouseDown: onListMouseDown
290
+ }, notFoundContent);
291
+ }
292
+ const treeProps = {
293
+ fieldNames
294
+ };
295
+ if (treeLoadedKeys) {
296
+ treeProps.loadedKeys = treeLoadedKeys;
297
+ }
298
+ if (mergedExpandedKeys) {
299
+ treeProps.expandedKeys = mergedExpandedKeys;
300
+ }
301
+ return /*#__PURE__*/React.createElement("div", {
302
+ onMouseDown: onListMouseDown
303
+ }, activeEntity && open && /*#__PURE__*/React.createElement("span", {
304
+ style: HIDDEN_STYLE,
305
+ "aria-live": "assertive"
306
+ }, activeEntity.node.value), /*#__PURE__*/React.createElement(UnstableContext.Provider, {
307
+ value: {
308
+ nodeDisabled
309
+ }
310
+ }, /*#__PURE__*/React.createElement(Tree, _extends({
311
+ ref: treeRef,
312
+ focusable: false,
313
+ prefixCls: `${prefixCls}-tree`,
314
+ treeData: memoTreeData,
315
+ height: listHeight,
316
+ itemHeight: listItemHeight,
317
+ itemScrollOffset: listItemScrollOffset,
318
+ virtual: virtual !== false && popupMatchSelectWidth !== false,
319
+ multiple: multiple,
320
+ icon: treeIcon,
321
+ showIcon: showTreeIcon,
322
+ switcherIcon: switcherIcon,
323
+ showLine: treeLine,
324
+ loadData: syncLoadData,
325
+ motion: treeMotion,
326
+ activeKey: activeKey
327
+ // We handle keys by out instead tree self
328
+ ,
329
+ checkable: checkable,
330
+ checkStrictly: true,
331
+ checkedKeys: mergedCheckedKeys,
332
+ selectedKeys: !checkable ? checkedKeys : [],
333
+ defaultExpandAll: treeDefaultExpandAll,
334
+ titleRender: treeTitleRender
335
+ }, treeProps, {
336
+ // Proxy event out
337
+ onActiveChange: setActiveKey,
338
+ onSelect: onInternalSelect,
339
+ onCheck: onInternalSelect,
340
+ onExpand: onInternalExpand,
341
+ onLoad: onTreeLoad,
342
+ filterTreeNode: filterTreeNode,
343
+ expandAction: treeExpandAction,
344
+ onScroll: onPopupScroll
345
+ }))));
346
+ };
347
+ const RefOptionList = /*#__PURE__*/React.forwardRef(OptionList);
348
+ if (process.env.NODE_ENV !== 'production') {
349
+ RefOptionList.displayName = 'OptionList';
350
+ }
351
+ export default RefOptionList;
@@ -0,0 +1,9 @@
1
+ import type * as React from 'react';
2
+ import type { DataNode, Key } from './interface';
3
+ export interface TreeNodeProps extends Omit<DataNode, 'children'> {
4
+ value: Key;
5
+ children?: React.ReactNode;
6
+ }
7
+ /** This is a placeholder, not real render in dom */
8
+ declare const TreeNode: React.FC<TreeNodeProps>;
9
+ export default TreeNode;
package/es/TreeNode.js ADDED
@@ -0,0 +1,5 @@
1
+ /* istanbul ignore file */
2
+
3
+ /** This is a placeholder, not real render in dom */
4
+ const TreeNode = () => null;
5
+ export default TreeNode;
@@ -0,0 +1,65 @@
1
+ import type { BaseSelectPropsWithoutPrivate, BaseSelectRef } from '@rc-component/select';
2
+ import type { IconType } from 'rc-tree/lib/interface';
3
+ import type { ExpandAction } from 'rc-tree/lib/Tree';
4
+ import * as React from 'react';
5
+ import TreeNode from './TreeNode';
6
+ import type { CheckedStrategy } from './utils/strategyUtil';
7
+ import { SHOW_ALL, SHOW_CHILD, SHOW_PARENT } from './utils/strategyUtil';
8
+ import type { SafeKey, DataNode, SimpleModeConfig, ChangeEventExtra, FieldNames, LegacyDataNode } from './interface';
9
+ export interface TreeSelectProps<ValueType = any, OptionType extends DataNode = DataNode> extends Omit<BaseSelectPropsWithoutPrivate, 'mode'> {
10
+ prefixCls?: string;
11
+ id?: string;
12
+ children?: React.ReactNode;
13
+ value?: ValueType;
14
+ defaultValue?: ValueType;
15
+ onChange?: (value: ValueType, labelList: React.ReactNode[], extra: ChangeEventExtra) => void;
16
+ searchValue?: string;
17
+ /** @deprecated Use `searchValue` instead */
18
+ inputValue?: string;
19
+ onSearch?: (value: string) => void;
20
+ autoClearSearchValue?: boolean;
21
+ filterTreeNode?: boolean | ((inputValue: string, treeNode: DataNode) => boolean);
22
+ treeNodeFilterProp?: string;
23
+ onSelect?: (value: ValueType, option: OptionType) => void;
24
+ onDeselect?: (value: ValueType, option: OptionType) => void;
25
+ showCheckedStrategy?: CheckedStrategy;
26
+ treeNodeLabelProp?: string;
27
+ fieldNames?: FieldNames;
28
+ multiple?: boolean;
29
+ treeCheckable?: boolean | React.ReactNode;
30
+ treeCheckStrictly?: boolean;
31
+ labelInValue?: boolean;
32
+ maxCount?: number;
33
+ treeData?: OptionType[];
34
+ treeDataSimpleMode?: boolean | SimpleModeConfig;
35
+ loadData?: (dataNode: LegacyDataNode) => Promise<unknown>;
36
+ treeLoadedKeys?: SafeKey[];
37
+ onTreeLoad?: (loadedKeys: SafeKey[]) => void;
38
+ treeDefaultExpandAll?: boolean;
39
+ treeExpandedKeys?: SafeKey[];
40
+ treeDefaultExpandedKeys?: SafeKey[];
41
+ onTreeExpand?: (expandedKeys: SafeKey[]) => void;
42
+ treeExpandAction?: ExpandAction;
43
+ virtual?: boolean;
44
+ listHeight?: number;
45
+ listItemHeight?: number;
46
+ listItemScrollOffset?: number;
47
+ onPopupVisibleChange?: (open: boolean) => void;
48
+ treeTitleRender?: (node: OptionType) => React.ReactNode;
49
+ treeLine?: boolean;
50
+ treeIcon?: IconType;
51
+ showTreeIcon?: boolean;
52
+ switcherIcon?: IconType;
53
+ treeMotion?: any;
54
+ }
55
+ declare const GenericTreeSelect: (<ValueType = any, OptionType extends DataNode = DataNode>(props: TreeSelectProps<ValueType, OptionType> & {
56
+ children?: React.ReactNode;
57
+ } & {
58
+ ref?: React.Ref<BaseSelectRef>;
59
+ }) => React.ReactElement) & {
60
+ TreeNode: typeof TreeNode;
61
+ SHOW_ALL: typeof SHOW_ALL;
62
+ SHOW_PARENT: typeof SHOW_PARENT;
63
+ SHOW_CHILD: typeof SHOW_CHILD;
64
+ };
65
+ export default GenericTreeSelect;