@kdcloudjs/kdesign 1.6.39 → 1.7.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 (69) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/kdesign-complete.less +478 -0
  3. package/dist/kdesign.css +504 -1
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +775 -85
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +2 -2
  8. package/dist/kdesign.min.js +6 -6
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/button/button.js +2 -2
  11. package/es/cascader/cascader.js +14 -3
  12. package/es/cascader/util.js +13 -4
  13. package/es/config-provider/compDefaultProps.d.ts +13 -0
  14. package/es/config-provider/compDefaultProps.js +17 -0
  15. package/es/index.d.ts +1 -0
  16. package/es/index.js +2 -1
  17. package/es/input/ClearableLabeledInput.js +9 -3
  18. package/es/input/input.js +1 -5
  19. package/es/select/interface.d.ts +1 -1
  20. package/es/select/select.js +18 -5
  21. package/es/tree/tree.d.ts +2 -1
  22. package/es/tree/tree.js +4 -3
  23. package/es/tree/utils/treeUtils.js +11 -13
  24. package/es/tree-select/index.d.ts +3 -0
  25. package/es/tree-select/index.js +3 -0
  26. package/es/tree-select/interface.d.ts +68 -0
  27. package/es/tree-select/interface.js +4 -0
  28. package/es/tree-select/style/css.js +2 -0
  29. package/es/tree-select/style/index.css +502 -0
  30. package/es/tree-select/style/index.d.ts +2 -0
  31. package/es/tree-select/style/index.js +2 -0
  32. package/es/tree-select/style/index.less +392 -0
  33. package/es/tree-select/style/mixin.less +29 -0
  34. package/es/tree-select/style/token.less +54 -0
  35. package/es/tree-select/tree-select.d.ts +4 -0
  36. package/es/tree-select/tree-select.js +506 -0
  37. package/es/upload/upload.d.ts +1 -1
  38. package/es/upload/upload.js +4 -3
  39. package/lib/button/button.js +2 -2
  40. package/lib/cascader/cascader.js +14 -3
  41. package/lib/cascader/util.js +13 -4
  42. package/lib/config-provider/compDefaultProps.d.ts +13 -0
  43. package/lib/config-provider/compDefaultProps.js +17 -0
  44. package/lib/index.d.ts +1 -0
  45. package/lib/index.js +7 -0
  46. package/lib/input/ClearableLabeledInput.js +9 -3
  47. package/lib/input/input.js +1 -5
  48. package/lib/select/interface.d.ts +1 -1
  49. package/lib/select/select.js +18 -5
  50. package/lib/style/components.less +1 -0
  51. package/lib/tree/tree.d.ts +2 -1
  52. package/lib/tree/tree.js +4 -3
  53. package/lib/tree/utils/treeUtils.js +11 -13
  54. package/lib/tree-select/index.d.ts +3 -0
  55. package/lib/tree-select/index.js +27 -0
  56. package/lib/tree-select/interface.d.ts +68 -0
  57. package/lib/tree-select/interface.js +13 -0
  58. package/lib/tree-select/style/css.js +4 -0
  59. package/lib/tree-select/style/index.css +502 -0
  60. package/lib/tree-select/style/index.d.ts +2 -0
  61. package/lib/tree-select/style/index.js +4 -0
  62. package/lib/tree-select/style/index.less +392 -0
  63. package/lib/tree-select/style/mixin.less +29 -0
  64. package/lib/tree-select/style/token.less +54 -0
  65. package/lib/tree-select/tree-select.d.ts +4 -0
  66. package/lib/tree-select/tree-select.js +519 -0
  67. package/lib/upload/upload.d.ts +1 -1
  68. package/lib/upload/upload.js +41 -40
  69. package/package.json +3 -4
@@ -53,8 +53,8 @@ var InternalButton = function InternalButton(props, ref) {
53
53
  * @param {React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>} e 事件对象
54
54
  */
55
55
  var handleClick = function handleClick(e) {
56
- if (loading) {
57
- // 加载中不触发点击事件
56
+ if (loading || disabled) {
57
+ // 加载中和禁用状态不触发点击事件
58
58
  return;
59
59
  }
60
60
  var waveStatus = buttonRef.current.getAttribute('click-animating-wave');
@@ -169,6 +169,17 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
169
169
  });
170
170
  });
171
171
  }, [currentOptions, fieldNames.label, isMultiple]);
172
+ var values = useMemo(function () {
173
+ return !isMultiple ? _mapInstanceProperty(currentOptions).call(currentOptions, function (_ref3) {
174
+ var value = _ref3.value;
175
+ return value;
176
+ }) : _mapInstanceProperty(currentOptions).call(currentOptions, function (option) {
177
+ return _mapInstanceProperty(option).call(option, function (_ref4) {
178
+ var value = _ref4.value;
179
+ return value;
180
+ });
181
+ });
182
+ }, [currentOptions, isMultiple]);
172
183
  var allowClear = allProps.allowClear && value.length > 0;
173
184
  var locatorProps = {
174
185
  style: style,
@@ -256,7 +267,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
256
267
  ref: wrapperRef
257
268
  }, Array.isArray(currentOptions) && /*#__PURE__*/React.createElement(React.Fragment, null, _mapInstanceProperty(currentOptions).call(currentOptions, function (option, index) {
258
269
  return /*#__PURE__*/React.createElement("span", {
259
- key: _JSON$stringify(labels[index]),
270
+ key: _JSON$stringify(values[index]),
260
271
  className: classNames("".concat(prefixCls, "-selection-tag"))
261
272
  }, (!maxTagCount || index <= maxTagCount - 1) && /*#__PURE__*/React.createElement(Tag, {
262
273
  type: "edit",
@@ -331,8 +342,8 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
331
342
  (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, newValue, newMultipleOptions);
332
343
  };
333
344
  var onChange = function onChange(selectedOptions) {
334
- var selectedValue = _mapInstanceProperty(selectedOptions).call(selectedOptions, function (_ref3) {
335
- var value = _ref3[fieldNames.value];
345
+ var selectedValue = _mapInstanceProperty(selectedOptions).call(selectedOptions, function (_ref5) {
346
+ var value = _ref5[fieldNames.value];
336
347
  return value;
337
348
  });
338
349
  setCurrentOptions(selectedOptions);
@@ -7,9 +7,9 @@ import _Set from "@babel/runtime-corejs3/core-js-stable/set";
7
7
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
8
8
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
9
9
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
10
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
11
10
  import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
12
11
  import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
12
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
13
13
  var __rest = this && this.__rest || function (s, e) {
14
14
  var t = {};
15
15
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -193,9 +193,18 @@ export var getChecked = function getChecked(checkedKeys, key) {
193
193
  return checkedKeys === null || checkedKeys === void 0 ? void 0 : _includesInstanceProperty(checkedKeys).call(checkedKeys, key);
194
194
  };
195
195
  var getCheckedNodes = function getCheckedNodes(flatNodes, checkedKeys) {
196
- return _filterInstanceProperty(flatNodes).call(flatNodes, function (node) {
197
- return checkedKeys === null || checkedKeys === void 0 ? void 0 : _includesInstanceProperty(checkedKeys).call(checkedKeys, node.value);
198
- });
196
+ var result = [];
197
+ for (var i = 0; i < checkedKeys.length; i++) {
198
+ var key = checkedKeys[i];
199
+ for (var j = 0; j < flatNodes.length; j++) {
200
+ var obj = flatNodes[j];
201
+ if (obj.value === key) {
202
+ result.push(obj);
203
+ break;
204
+ }
205
+ }
206
+ }
207
+ return result;
199
208
  };
200
209
  export var addKeys = function addKeys() {
201
210
  var _context6;
@@ -415,5 +415,18 @@ declare const compDefaultProps: {
415
415
  size: string;
416
416
  underscore: boolean;
417
417
  };
418
+ TreeSelect: {
419
+ size: string;
420
+ borderType: string;
421
+ mode: string;
422
+ defaultOpen: boolean;
423
+ showArrow: boolean;
424
+ placeholder: string;
425
+ optionLabelProp: string;
426
+ treeNodeFilterProp: string;
427
+ showSearch: boolean;
428
+ switcherIcon: () => JSX.Element;
429
+ expandOnClickNode: boolean;
430
+ };
418
431
  };
419
432
  export default compDefaultProps;
@@ -428,6 +428,23 @@ var compDefaultProps = {
428
428
  Link: {
429
429
  size: 'middle',
430
430
  underscore: false
431
+ },
432
+ TreeSelect: {
433
+ size: 'middle',
434
+ borderType: 'underline',
435
+ mode: 'single',
436
+ defaultOpen: false,
437
+ showArrow: true,
438
+ placeholder: '请输入需要搜索的内容',
439
+ optionLabelProp: 'title',
440
+ treeNodeFilterProp: 'title',
441
+ showSearch: true,
442
+ switcherIcon: function switcherIcon() {
443
+ return /*#__PURE__*/React.createElement(Icon, {
444
+ type: "arrow-right-solid"
445
+ });
446
+ },
447
+ expandOnClickNode: false
431
448
  }
432
449
  };
433
450
  export default compDefaultProps;
package/es/index.d.ts CHANGED
@@ -53,3 +53,4 @@ export { default as Table } from './table';
53
53
  export { default as Stepper } from './stepper';
54
54
  export { default as BaseData } from './base-data';
55
55
  export { default as Link } from './link';
56
+ export { default as TreeSelect } from './tree-select';
package/es/index.js CHANGED
@@ -52,4 +52,5 @@ export { default as Slider } from './slider';
52
52
  export { default as Table } from './table';
53
53
  export { default as Stepper } from './stepper';
54
54
  export { default as BaseData } from './base-data';
55
- export { default as Link } from './link';
55
+ export { default as Link } from './link';
56
+ export { default as TreeSelect } from './tree-select';
@@ -39,6 +39,10 @@ var ClearableInput = function ClearableInput(props) {
39
39
  var mouseLeaveHandle = function mouseLeaveHandle() {
40
40
  setIsMouseEnter(false);
41
41
  };
42
+ var mouseDownHandle = function mouseDownHandle(e) {
43
+ e.stopPropagation();
44
+ e.preventDefault();
45
+ };
42
46
  var renderClearIcon = function renderClearIcon() {
43
47
  var _classNames;
44
48
  if (!allowClear) {
@@ -56,12 +60,13 @@ var ClearableInput = function ClearableInput(props) {
56
60
  var renderSuffix = function renderSuffix() {
57
61
  if (suffix || !disabled && !!allowClear || inputCount) {
58
62
  return /*#__PURE__*/React.createElement("span", {
59
- className: "".concat(prefixCls, "-suffix")
63
+ className: "".concat(prefixCls, "-suffix"),
64
+ onMouseDown: mouseDownHandle
60
65
  }, renderClearIcon(), inputCount && /*#__PURE__*/React.createElement("span", {
61
66
  style: {
62
67
  marginRight: suffix ? 9 : 0
63
68
  }
64
- }, inputCount), /*#__PURE__*/React.createElement("span", null, suffix));
69
+ }, inputCount), suffix);
65
70
  }
66
71
  return null;
67
72
  };
@@ -72,7 +77,8 @@ var ClearableInput = function ClearableInput(props) {
72
77
  }
73
78
  var suffixNode = renderSuffix();
74
79
  var prefixNode = prefix ? /*#__PURE__*/React.createElement("span", {
75
- className: "".concat(prefixCls, "-prefix")
80
+ className: "".concat(prefixCls, "-prefix"),
81
+ onMouseDown: mouseDownHandle
76
82
  }, prefix) : null;
77
83
  var inputWrapperClasses = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper"), true), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-focused"), focused && !disabled), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-disabled"), disabled), _defineProperty(_classNames2, _concatInstanceProperty(_context = "".concat(prefixCls, "-wrapper-size-")).call(_context, size), size), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-borderless"), borderType === 'none'), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-underline"), borderType === 'underline'), _classNames2), _defineProperty({}, className, className && !addonBefore && !addonAfter));
78
84
  return /*#__PURE__*/React.createElement("span", {
package/es/input/input.js CHANGED
@@ -119,11 +119,7 @@ var InternalInput = function InternalInput(props, ref) {
119
119
  }
120
120
  if (count && showNumberMark && !disabled) {
121
121
  return /*#__PURE__*/React.createElement("div", {
122
- className: classNames("".concat(inputPrefixCls, "-input-mark-inner")),
123
- onMouseDown: function onMouseDown(e) {
124
- e.stopPropagation();
125
- e.preventDefault();
126
- }
122
+ className: classNames("".concat(inputPrefixCls, "-input-mark-inner"))
127
123
  }, enteredLength, maxLength !== undefined ? "/".concat(maxLength) : null);
128
124
  }
129
125
  return null;
@@ -27,7 +27,6 @@ export interface AbstractSelectProps extends PopperProps {
27
27
  id?: string;
28
28
  children?: React.ReactNode;
29
29
  options?: OptionsType[];
30
- loading?: boolean;
31
30
  clearIcon?: React.ReactNode;
32
31
  searchIcon?: React.ReactNode;
33
32
  suffixIcon?: React.ReactNode;
@@ -56,6 +55,7 @@ export interface ISelectProps<T extends SelectValue> extends AbstractSelectProps
56
55
  autoFocus?: boolean;
57
56
  onChange?: (value?: T, option?: React.ReactElement<any> | React.ReactElement<any>[]) => void;
58
57
  onSelect?: (value?: T extends (infer I)[] ? I : T, option?: React.ReactElement<any>) => void;
58
+ onDeselect?: (value?: T extends (infer I)[] ? I : T, option?: React.ReactElement<any>) => void;
59
59
  onBlur?: (value?: T) => void;
60
60
  onFocus?: () => void;
61
61
  onSearch?: (value?: string) => void;
@@ -101,6 +101,10 @@ var InternalSelect = function InternalSelect(props, ref) {
101
101
  _useState10 = _slicedToArray(_useState9, 2),
102
102
  inputWidth = _useState10[0],
103
103
  setInputWidth = _useState10[1]; // 输入框宽度
104
+ var _useState11 = useState(autoFocus),
105
+ _useState12 = _slicedToArray(_useState11, 2),
106
+ focusd = _useState12[0],
107
+ setFocusd = _useState12[1];
104
108
  var selectPrefixCls = getPrefixCls(prefixCls, 'select', customPrefixcls);
105
109
  // 选择器样式
106
110
  var selectCls = classNames(selectPrefixCls, className, _defineProperty({}, "".concat(selectPrefixCls, "-visible"), optionShow));
@@ -184,10 +188,12 @@ var InternalSelect = function InternalSelect(props, ref) {
184
188
  }, [optionShow]);
185
189
  var handleFocus = useCallback(function (e) {
186
190
  e.stopPropagation();
191
+ setFocusd(true);
187
192
  onFocus && onFocus(e);
188
193
  }, [onFocus]);
189
194
  var handleBlur = useCallback(function (e) {
190
195
  e.stopPropagation();
196
+ setFocusd(false);
191
197
  onBlur && onBlur(e);
192
198
  }, [onBlur]);
193
199
  // 点击组件
@@ -239,7 +245,7 @@ var InternalSelect = function InternalSelect(props, ref) {
239
245
  }, [searchValue, realChildren, filterOption, optionFilterProp]);
240
246
  var getOptionLabel = useCallback(function (obj) {
241
247
  var _a;
242
- var text = 'options' in selectProps ? 'label' : optionLabelProp;
248
+ var text = Object.prototype.hasOwnProperty.call(selectProps, 'options') && !Object.prototype.hasOwnProperty.call(props, 'optionLabelProp') ? 'label' : optionLabelProp;
243
249
  if (obj.props) {
244
250
  if (text) {
245
251
  return obj === null || obj === void 0 ? void 0 : obj.props[text];
@@ -383,6 +389,7 @@ var InternalSelect = function InternalSelect(props, ref) {
383
389
  // 输入框变化搜索内容
384
390
  var handleSearchChange = useCallback(function (event) {
385
391
  var val = event.currentTarget.value;
392
+ setOptionShow(true);
386
393
  setSearchValue(val);
387
394
  onSearch === null || onSearch === void 0 ? void 0 : onSearch(val);
388
395
  }, [onSearch]);
@@ -435,9 +442,9 @@ var InternalSelect = function InternalSelect(props, ref) {
435
442
  return e.preventDefault();
436
443
  },
437
444
  className: clearIconCls
438
- }, /*#__PURE__*/React.createElement(Icon, {
445
+ }, clearIcon || /*#__PURE__*/React.createElement(Icon, {
439
446
  type: "close-solid"
440
- }) || clearIcon), showArrow && /*#__PURE__*/React.createElement("span", {
447
+ })), showArrow && /*#__PURE__*/React.createElement("span", {
441
448
  className: arrowIconCls
442
449
  }, suffixIcon || /*#__PURE__*/React.createElement(Icon, {
443
450
  type: "arrow-down"
@@ -483,6 +490,12 @@ var InternalSelect = function InternalSelect(props, ref) {
483
490
  var isShowSearch = useMemo(function () {
484
491
  return isBoolean(showSearch) ? showSearch : isMultiple;
485
492
  }, [isMultiple, showSearch]);
493
+ useEffect(function () {
494
+ var _a;
495
+ if (isShowSearch && autoFocus && !disabled) {
496
+ (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
497
+ }
498
+ }, [isShowSearch, autoFocus, disabled]);
486
499
  // 渲染下拉列表框
487
500
  var renderContent = function renderContent() {
488
501
  var dropdownRender = selectProps.dropdownRender,
@@ -605,7 +618,7 @@ var InternalSelect = function InternalSelect(props, ref) {
605
618
  var _context3, _classNames10, _context4, _classNames11;
606
619
  var maxTagCount = selectProps.maxTagCount,
607
620
  maxTagPlaceholder = selectProps.maxTagPlaceholder;
608
- var multipleCls = classNames(commCls, (_classNames10 = {}, _defineProperty(_classNames10, "".concat(selectPrefixCls, "-multiple-disabled"), disabled), _defineProperty(_classNames10, _concatInstanceProperty(_context3 = "".concat(selectPrefixCls, "-")).call(_context3, mode), mode), _defineProperty(_classNames10, "".concat(selectPrefixCls, "-focused"), autoFocus || optionShow), _defineProperty(_classNames10, "".concat(selectPrefixCls, "-placeholder"), placeholder && !mulOptions.length), _classNames10));
621
+ var multipleCls = classNames(commCls, (_classNames10 = {}, _defineProperty(_classNames10, "".concat(selectPrefixCls, "-multiple-disabled"), disabled), _defineProperty(_classNames10, _concatInstanceProperty(_context3 = "".concat(selectPrefixCls, "-")).call(_context3, mode), mode), _defineProperty(_classNames10, "".concat(selectPrefixCls, "-focused"), focusd || optionShow), _defineProperty(_classNames10, "".concat(selectPrefixCls, "-placeholder"), placeholder && !mulOptions.length), _classNames10));
609
622
  var itemCls = classNames((_classNames11 = {}, _defineProperty(_classNames11, "".concat(selectPrefixCls, "-selection-item"), true), _defineProperty(_classNames11, _concatInstanceProperty(_context4 = "".concat(selectPrefixCls, "-selection-item-")).call(_context4, size), size), _classNames11));
610
623
  var TagStyle = {
611
624
  margin: '2px 8px 2px 0',
@@ -666,7 +679,7 @@ var InternalSelect = function InternalSelect(props, ref) {
666
679
  className: "".concat(selectPrefixCls, "-suffix")
667
680
  }, renderSuffix()));
668
681
  };
669
- var singleCls = classNames(commCls, (_classNames12 = {}, _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single"), true), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-disabled"), disabled), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-focused"), autoFocus && !disabled || optionShow), _classNames12));
682
+ var singleCls = classNames(commCls, (_classNames12 = {}, _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single"), true), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-disabled"), disabled), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-focused"), focusd && !disabled || optionShow), _classNames12));
670
683
  var renderSelect = function renderSelect() {
671
684
  return /*#__PURE__*/React.createElement("div", {
672
685
  className: selectCls,
package/es/tree/tree.d.ts CHANGED
@@ -24,10 +24,11 @@ export interface TreeProps {
24
24
  virtual?: boolean;
25
25
  scrollToKey?: string;
26
26
  selectedKeys?: string[];
27
+ notFoundContent?: ReactNode;
27
28
  loadData?: () => void;
28
29
  onCheck?: (checkedKeys: string[], { checked, node, event, halfCheckedKeys }: any) => void;
29
30
  onExpand?: (expandedKeys: string[], { expanded, node }: any) => void;
30
- onSelect?: ({ checked, node, event }: any) => void;
31
+ onSelect?: (keys: string[], { checked, node, event }: any) => void;
31
32
  onDragStart?: ({ event, node }: any) => void;
32
33
  onDragOver?: ({ event, node }: any) => void;
33
34
  onDragLeave?: ({ event, node }: any) => void;
package/es/tree/tree.js CHANGED
@@ -64,7 +64,8 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
64
64
  filterTreeNode = TreeProps.filterTreeNode,
65
65
  filterValue = TreeProps.filterValue,
66
66
  expandOnClickNode = TreeProps.expandOnClickNode,
67
- loadData = TreeProps.loadData;
67
+ loadData = TreeProps.loadData,
68
+ notFoundContent = TreeProps.notFoundContent;
68
69
  var treePrefixCls = getPrefixCls(prefixCls, 'tree', customPrefixcls); // 树样式前缀
69
70
  var treeNodePrefixCls = getPrefixCls(prefixCls, 'tree-node', customPrefixcls); // 树节点样式前缀
70
71
  var treeNodeClassName = classNames(_defineProperty({}, "".concat(treePrefixCls), true));
@@ -120,7 +121,7 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
120
121
  searchExpandedKeys = _React$useState16[0],
121
122
  setSearchExpandedKeys = _React$useState16[1];
122
123
  var isSearching = React.useMemo(function () {
123
- return typeof filterTreeNode === 'function' && filterValue;
124
+ return typeof filterTreeNode === 'function' && !!filterValue;
124
125
  }, [filterValue]);
125
126
  useEffect(function () {
126
127
  setSearchExpandedKeys([]);
@@ -371,7 +372,7 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
371
372
  }), /*#__PURE__*/React.createElement("div", {
372
373
  className: treeRootClassName,
373
374
  ref: listRef
374
- }, visibleData && _mapInstanceProperty(visibleData).call(visibleData, function (item) {
375
+ }, !(visibleData === null || visibleData === void 0 ? void 0 : visibleData.length) && notFoundContent, visibleData && _mapInstanceProperty(visibleData).call(visibleData, function (item) {
375
376
  var checked = getChecked(checkedKeys, item.key);
376
377
  var indeterminate = getHalfChecked(halfCheckedKeys, item.key);
377
378
  item.nodeKey = item.key;
@@ -40,6 +40,7 @@ export var flattenAll = function flattenAll(treeData) {
40
40
  var parent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
41
41
  treeData && treeData.forEach(function (item, index) {
42
42
  var _context, _context2;
43
+ var _a;
43
44
  var children = item.children,
44
45
  title = item.title,
45
46
  key = item.key,
@@ -53,7 +54,7 @@ export var flattenAll = function flattenAll(treeData) {
53
54
  hasChildNode: hasChildNode,
54
55
  children: children,
55
56
  level: level,
56
- parentKey: (parent === null || parent === void 0 ? void 0 : parent.key) || null,
57
+ parentKey: ((_a = parent === null || parent === void 0 ? void 0 : parent.key) !== null && _a !== void 0 ? _a : '') !== '' ? parent === null || parent === void 0 ? void 0 : parent.key : null,
57
58
  pathParentKeys: parent ? _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray((parent === null || parent === void 0 ? void 0 : parent.pathParentKeys) || []), [parent === null || parent === void 0 ? void 0 : parent.key]) : []
58
59
  }, others);
59
60
  keysData[key] = flattenNode;
@@ -129,11 +130,8 @@ export var getAllFilterKeys = function getAllFilterKeys(data, filterTreeNode, ke
129
130
  filterKeys.forEach(function (item) {
130
131
  var node = _extends({}, item);
131
132
  while (node) {
132
- var _context3;
133
133
  allFilterKeys.add(node.key);
134
- !_includesInstanceProperty(_context3 = _mapInstanceProperty(filterKeys).call(filterKeys, function (i) {
135
- return i.key;
136
- })).call(_context3, node.key) && filterExpandKeys.add(node.key);
134
+ filterExpandKeys.add(node.key);
137
135
  node = (keysData === null || keysData === void 0 ? void 0 : keysData[node === null || node === void 0 ? void 0 : node.parentKey]) || null;
138
136
  }
139
137
  });
@@ -276,10 +274,10 @@ export var getSpreadAttrData = function getSpreadAttrData(treeData, expandedKeys
276
274
  };
277
275
  };
278
276
  export var addKeys = function addKeys() {
279
- var _context4;
277
+ var _context3;
280
278
  var prevKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
281
279
  var newKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
282
- return _Array$from(new _Set(_concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(prevKeys), _toConsumableArray(newKeys))));
280
+ return _Array$from(new _Set(_concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(prevKeys), _toConsumableArray(newKeys))));
283
281
  };
284
282
  export var getAllParentKeys = function getAllParentKeys(data) {
285
283
  var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
@@ -325,13 +323,13 @@ export var getPos = function getPos(data, key) {
325
323
  return node === null || node === void 0 ? void 0 : node.pos;
326
324
  };
327
325
  export var getInitCheckedKeys = function getInitCheckedKeys(data, keys) {
328
- var _context5;
326
+ var _context4;
329
327
  var checkedKeys = [];
330
328
  keys.forEach(function (item) {
331
329
  var pos = getPos(data, item);
332
330
  checkedKeys.push.apply(checkedKeys, _toConsumableArray(getAllChildKeys(data, pos)));
333
331
  });
334
- return _Array$from(new _Set(_concatInstanceProperty(_context5 = []).call(_context5, checkedKeys, _toConsumableArray(keys))));
332
+ return _Array$from(new _Set(_concatInstanceProperty(_context4 = []).call(_context4, checkedKeys, _toConsumableArray(keys))));
335
333
  };
336
334
  export var getInitCheckededState = function getInitCheckededState(data) {
337
335
  var checkedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -425,7 +423,7 @@ var updateParent = function updateParent(key, keysNodeProps, allKeys, halfChecke
425
423
  });
426
424
  };
427
425
  export var getInitCheckededKeys = function getInitCheckededKeys() {
428
- var _context6;
426
+ var _context5;
429
427
  var checkedKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
430
428
  var keysNodeProps = arguments.length > 1 ? arguments[1] : undefined;
431
429
  var checkedKeysSet = new _Set(checkedKeys || []);
@@ -445,7 +443,7 @@ export var getInitCheckededKeys = function getInitCheckededKeys() {
445
443
  }
446
444
  });
447
445
  return {
448
- checkedKeys: _toConsumableArray(new _Set(_concatInstanceProperty(_context6 = []).call(_context6, _toConsumableArray(checkedKeysSet), _toConsumableArray(childCheckedKeysSet)))),
446
+ checkedKeys: _toConsumableArray(new _Set(_concatInstanceProperty(_context5 = []).call(_context5, _toConsumableArray(checkedKeysSet), _toConsumableArray(childCheckedKeysSet)))),
449
447
  halfCheckedKeys: _toConsumableArray(halfCheckedKeysSet)
450
448
  };
451
449
  };
@@ -608,8 +606,8 @@ export var getInitExpandedKeys = function getInitExpandedKeys(data, expandedKeys
608
606
  }
609
607
  }
610
608
  if (isSearching) {
611
- var _context7;
612
- keys = _concatInstanceProperty(_context7 = []).call(_context7, _toConsumableArray(searchExpandedKeys), _toConsumableArray(getAllFilterKeys(data, filterTreeNode, keysData).filterExpandKeys));
609
+ var _context6;
610
+ keys = _concatInstanceProperty(_context6 = []).call(_context6, _toConsumableArray(searchExpandedKeys), _toConsumableArray(getAllFilterKeys(data, filterTreeNode, keysData).filterExpandKeys));
613
611
  }
614
612
  return _Array$from(new _Set(_toConsumableArray(keys)));
615
613
  };
@@ -0,0 +1,3 @@
1
+ import TreeSelect from './tree-select';
2
+ export * from './tree-select';
3
+ export default TreeSelect;
@@ -0,0 +1,3 @@
1
+ import TreeSelect from './tree-select';
2
+ export * from './tree-select';
3
+ export default TreeSelect;
@@ -0,0 +1,68 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { PopperProps } from '../_utils/usePopper';
3
+ import { TreeNodeData } from '../tree';
4
+ export declare const SelectSizes: ["large", "middle", "small"];
5
+ export declare type SelectSize = typeof SelectSizes[number];
6
+ export declare const BorderTypes: ["none", "underline", "bordered"];
7
+ export declare type BorderType = typeof BorderTypes[number];
8
+ export declare const Modes: ["multiple", "single"];
9
+ export declare type Mode = typeof Modes[number];
10
+ export interface AbstractSelectProps extends PopperProps {
11
+ prefixCls?: string;
12
+ className?: string;
13
+ size?: SelectSize;
14
+ borderType?: BorderType;
15
+ notFoundContent?: React.ReactNode | null;
16
+ showSearch?: boolean;
17
+ showArrow?: boolean;
18
+ defaultOpen?: boolean;
19
+ allowClear?: boolean;
20
+ disabled?: boolean;
21
+ style?: React.CSSProperties;
22
+ placeholder?: string | React.ReactNode;
23
+ dropdownClassName?: string;
24
+ dropdownStyle?: React.CSSProperties;
25
+ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
26
+ dropdownRender?: (menu: React.ReactElement) => React.ReactElement;
27
+ id?: string;
28
+ clearIcon?: React.ReactNode;
29
+ searchIcon?: React.ReactNode;
30
+ suffixIcon?: React.ReactNode;
31
+ maxTagCount?: number;
32
+ labelInValue?: boolean;
33
+ maxTagPlaceholder?: React.ReactNode | ((omittedValues: TreeNodeData[]) => React.ReactNode);
34
+ }
35
+ export declare type ITreeProps = {
36
+ treeData?: TreeNodeData;
37
+ treeDefaultExpandAll?: boolean;
38
+ treeDefaultExpandedKeys?: string[];
39
+ treeExpandedKeys?: string[];
40
+ treeIcon?: ReactNode | ((props: any) => ReactNode);
41
+ virtual?: boolean;
42
+ checkStrictly?: boolean;
43
+ filterTreeNode?: (treeNode: TreeNodeData, searchValue: string) => boolean;
44
+ treeNodeFilterProp?: string;
45
+ treeNodeLabelProp?: string;
46
+ expandOnClickNode?: boolean;
47
+ };
48
+ export declare type TreeSelectValue = string | string[] | number | number[] | undefined;
49
+ export interface ITreeSelectProps<T extends TreeSelectValue> extends AbstractSelectProps, ITreeProps {
50
+ value?: T;
51
+ defaultValue?: T;
52
+ mode?: Mode;
53
+ autoFocus?: boolean;
54
+ onChange?: (value: T, treeNode: TreeNodeData) => void;
55
+ onSelect?: (value: T extends (infer I)[] ? I : T, { checked, node, event }: any) => void;
56
+ onBlur?: (value?: T) => void;
57
+ onFocus?: () => void;
58
+ onSearch?: (value?: string) => void;
59
+ onClear?: () => void;
60
+ tagRender?: (props: TagProps) => void;
61
+ }
62
+ export interface TagProps {
63
+ value?: string;
64
+ label?: React.ReactNode;
65
+ disabled: boolean;
66
+ size: SelectSize;
67
+ onClose: () => void;
68
+ }
@@ -0,0 +1,4 @@
1
+ import { tuple } from '../_utils/type';
2
+ export var SelectSizes = tuple('large', 'middle', 'small'); // 选择框大小
3
+ export var BorderTypes = tuple('none', 'underline', 'bordered');
4
+ export var Modes = tuple('multiple', 'single');
@@ -0,0 +1,2 @@
1
+ import '../../style/index.css';
2
+ import './index.css';