@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
@@ -439,6 +439,23 @@ var compDefaultProps = {
439
439
  Link: {
440
440
  size: 'middle',
441
441
  underscore: false
442
+ },
443
+ TreeSelect: {
444
+ size: 'middle',
445
+ borderType: 'underline',
446
+ mode: 'single',
447
+ defaultOpen: false,
448
+ showArrow: true,
449
+ placeholder: '请输入需要搜索的内容',
450
+ optionLabelProp: 'title',
451
+ treeNodeFilterProp: 'title',
452
+ showSearch: true,
453
+ switcherIcon: function switcherIcon() {
454
+ return /*#__PURE__*/React.createElement(_index.Icon, {
455
+ type: "arrow-right-solid"
456
+ });
457
+ },
458
+ expandOnClickNode: false
442
459
  }
443
460
  };
444
461
  var _default = compDefaultProps;
package/lib/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/lib/index.js CHANGED
@@ -349,6 +349,12 @@ Object.defineProperty(exports, "TreeNode", {
349
349
  return _treeNode.default;
350
350
  }
351
351
  });
352
+ Object.defineProperty(exports, "TreeSelect", {
353
+ enumerable: true,
354
+ get: function get() {
355
+ return _treeSelect.default;
356
+ }
357
+ });
352
358
  Object.defineProperty(exports, "Typography", {
353
359
  enumerable: true,
354
360
  get: function get() {
@@ -416,6 +422,7 @@ var _table = _interopRequireDefault(require("./table"));
416
422
  var _stepper = _interopRequireDefault(require("./stepper"));
417
423
  var _baseData = _interopRequireDefault(require("./base-data"));
418
424
  var _link = _interopRequireDefault(require("./link"));
425
+ var _treeSelect = _interopRequireDefault(require("./tree-select"));
419
426
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
420
427
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
421
428
  /* @remove-on-es-build-begin */
@@ -52,6 +52,10 @@ var ClearableInput = function ClearableInput(props) {
52
52
  var mouseLeaveHandle = function mouseLeaveHandle() {
53
53
  setIsMouseEnter(false);
54
54
  };
55
+ var mouseDownHandle = function mouseDownHandle(e) {
56
+ e.stopPropagation();
57
+ e.preventDefault();
58
+ };
55
59
  var renderClearIcon = function renderClearIcon() {
56
60
  var _classNames;
57
61
  if (!allowClear) {
@@ -69,12 +73,13 @@ var ClearableInput = function ClearableInput(props) {
69
73
  var renderSuffix = function renderSuffix() {
70
74
  if (suffix || !disabled && !!allowClear || inputCount) {
71
75
  return /*#__PURE__*/_react.default.createElement("span", {
72
- className: "".concat(prefixCls, "-suffix")
76
+ className: "".concat(prefixCls, "-suffix"),
77
+ onMouseDown: mouseDownHandle
73
78
  }, renderClearIcon(), inputCount && /*#__PURE__*/_react.default.createElement("span", {
74
79
  style: {
75
80
  marginRight: suffix ? 9 : 0
76
81
  }
77
- }, inputCount), /*#__PURE__*/_react.default.createElement("span", null, suffix));
82
+ }, inputCount), suffix);
78
83
  }
79
84
  return null;
80
85
  };
@@ -85,7 +90,8 @@ var ClearableInput = function ClearableInput(props) {
85
90
  }
86
91
  var suffixNode = renderSuffix();
87
92
  var prefixNode = prefix ? /*#__PURE__*/_react.default.createElement("span", {
88
- className: "".concat(prefixCls, "-prefix")
93
+ className: "".concat(prefixCls, "-prefix"),
94
+ onMouseDown: mouseDownHandle
89
95
  }, prefix) : null;
90
96
  var inputWrapperClasses = (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper"), true), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-focused"), focused && !disabled), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-disabled"), disabled), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context = "".concat(prefixCls, "-wrapper-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-underline"), borderType === 'underline'), _classNames2), (0, _defineProperty2.default)({}, className, className && !addonBefore && !addonAfter));
91
97
  return /*#__PURE__*/_react.default.createElement("span", {
@@ -134,11 +134,7 @@ var InternalInput = function InternalInput(props, ref) {
134
134
  }
135
135
  if (count && showNumberMark && !disabled) {
136
136
  return /*#__PURE__*/_react.default.createElement("div", {
137
- className: (0, _classnames.default)("".concat(inputPrefixCls, "-input-mark-inner")),
138
- onMouseDown: function onMouseDown(e) {
139
- e.stopPropagation();
140
- e.preventDefault();
141
- }
137
+ className: (0, _classnames.default)("".concat(inputPrefixCls, "-input-mark-inner"))
142
138
  }, enteredLength, maxLength !== undefined ? "/".concat(maxLength) : null);
143
139
  }
144
140
  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;
@@ -113,6 +113,10 @@ var InternalSelect = function InternalSelect(props, ref) {
113
113
  _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
114
114
  inputWidth = _useState10[0],
115
115
  setInputWidth = _useState10[1]; // 输入框宽度
116
+ var _useState11 = (0, _react.useState)(autoFocus),
117
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
118
+ focusd = _useState12[0],
119
+ setFocusd = _useState12[1];
116
120
  var selectPrefixCls = getPrefixCls(prefixCls, 'select', customPrefixcls);
117
121
  // 选择器样式
118
122
  var selectCls = (0, _classnames.default)(selectPrefixCls, className, (0, _defineProperty2.default)({}, "".concat(selectPrefixCls, "-visible"), optionShow));
@@ -196,10 +200,12 @@ var InternalSelect = function InternalSelect(props, ref) {
196
200
  }, [optionShow]);
197
201
  var handleFocus = (0, _react.useCallback)(function (e) {
198
202
  e.stopPropagation();
203
+ setFocusd(true);
199
204
  onFocus && onFocus(e);
200
205
  }, [onFocus]);
201
206
  var handleBlur = (0, _react.useCallback)(function (e) {
202
207
  e.stopPropagation();
208
+ setFocusd(false);
203
209
  onBlur && onBlur(e);
204
210
  }, [onBlur]);
205
211
  // 点击组件
@@ -251,7 +257,7 @@ var InternalSelect = function InternalSelect(props, ref) {
251
257
  }, [searchValue, realChildren, filterOption, optionFilterProp]);
252
258
  var getOptionLabel = (0, _react.useCallback)(function (obj) {
253
259
  var _a;
254
- var text = 'options' in selectProps ? 'label' : optionLabelProp;
260
+ var text = Object.prototype.hasOwnProperty.call(selectProps, 'options') && !Object.prototype.hasOwnProperty.call(props, 'optionLabelProp') ? 'label' : optionLabelProp;
255
261
  if (obj.props) {
256
262
  if (text) {
257
263
  return obj === null || obj === void 0 ? void 0 : obj.props[text];
@@ -395,6 +401,7 @@ var InternalSelect = function InternalSelect(props, ref) {
395
401
  // 输入框变化搜索内容
396
402
  var handleSearchChange = (0, _react.useCallback)(function (event) {
397
403
  var val = event.currentTarget.value;
404
+ setOptionShow(true);
398
405
  setSearchValue(val);
399
406
  onSearch === null || onSearch === void 0 ? void 0 : onSearch(val);
400
407
  }, [onSearch]);
@@ -447,9 +454,9 @@ var InternalSelect = function InternalSelect(props, ref) {
447
454
  return e.preventDefault();
448
455
  },
449
456
  className: clearIconCls
450
- }, /*#__PURE__*/_react.default.createElement(_index.Icon, {
457
+ }, clearIcon || /*#__PURE__*/_react.default.createElement(_index.Icon, {
451
458
  type: "close-solid"
452
- }) || clearIcon), showArrow && /*#__PURE__*/_react.default.createElement("span", {
459
+ })), showArrow && /*#__PURE__*/_react.default.createElement("span", {
453
460
  className: arrowIconCls
454
461
  }, suffixIcon || /*#__PURE__*/_react.default.createElement(_index.Icon, {
455
462
  type: "arrow-down"
@@ -495,6 +502,12 @@ var InternalSelect = function InternalSelect(props, ref) {
495
502
  var isShowSearch = (0, _react.useMemo)(function () {
496
503
  return (0, _isBoolean.default)(showSearch) ? showSearch : isMultiple;
497
504
  }, [isMultiple, showSearch]);
505
+ (0, _react.useEffect)(function () {
506
+ var _a;
507
+ if (isShowSearch && autoFocus && !disabled) {
508
+ (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
509
+ }
510
+ }, [isShowSearch, autoFocus, disabled]);
498
511
  // 渲染下拉列表框
499
512
  var renderContent = function renderContent() {
500
513
  var dropdownRender = selectProps.dropdownRender,
@@ -617,7 +630,7 @@ var InternalSelect = function InternalSelect(props, ref) {
617
630
  var _context3, _classNames10, _context4, _classNames11;
618
631
  var maxTagCount = selectProps.maxTagCount,
619
632
  maxTagPlaceholder = selectProps.maxTagPlaceholder;
620
- var multipleCls = (0, _classnames.default)(commCls, (_classNames10 = {}, (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-multiple-disabled"), disabled), (0, _defineProperty2.default)(_classNames10, (0, _concat.default)(_context3 = "".concat(selectPrefixCls, "-")).call(_context3, mode), mode), (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-focused"), autoFocus || optionShow), (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-placeholder"), placeholder && !mulOptions.length), _classNames10));
633
+ var multipleCls = (0, _classnames.default)(commCls, (_classNames10 = {}, (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-multiple-disabled"), disabled), (0, _defineProperty2.default)(_classNames10, (0, _concat.default)(_context3 = "".concat(selectPrefixCls, "-")).call(_context3, mode), mode), (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-focused"), focusd || optionShow), (0, _defineProperty2.default)(_classNames10, "".concat(selectPrefixCls, "-placeholder"), placeholder && !mulOptions.length), _classNames10));
621
634
  var itemCls = (0, _classnames.default)((_classNames11 = {}, (0, _defineProperty2.default)(_classNames11, "".concat(selectPrefixCls, "-selection-item"), true), (0, _defineProperty2.default)(_classNames11, (0, _concat.default)(_context4 = "".concat(selectPrefixCls, "-selection-item-")).call(_context4, size), size), _classNames11));
622
635
  var TagStyle = {
623
636
  margin: '2px 8px 2px 0',
@@ -678,7 +691,7 @@ var InternalSelect = function InternalSelect(props, ref) {
678
691
  className: "".concat(selectPrefixCls, "-suffix")
679
692
  }, renderSuffix()));
680
693
  };
681
- var singleCls = (0, _classnames.default)(commCls, (_classNames12 = {}, (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single"), true), (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single-disabled"), disabled), (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single-focused"), autoFocus && !disabled || optionShow), _classNames12));
694
+ var singleCls = (0, _classnames.default)(commCls, (_classNames12 = {}, (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single"), true), (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single-disabled"), disabled), (0, _defineProperty2.default)(_classNames12, "".concat(selectPrefixCls, "-single-focused"), focusd && !disabled || optionShow), _classNames12));
682
695
  var renderSelect = function renderSelect() {
683
696
  return /*#__PURE__*/_react.default.createElement("div", {
684
697
  className: selectCls,
@@ -49,5 +49,6 @@
49
49
  @import "../tooltip/style/index.less";
50
50
  @import "../transfer/style/index.less";
51
51
  @import "../tree/style/index.less";
52
+ @import "../tree-select/style/index.less";
52
53
  @import "../typography/style/index.less";
53
54
  @import "../upload/style/index.less";
@@ -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/lib/tree/tree.js CHANGED
@@ -76,7 +76,8 @@ var InternalTree = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
76
76
  filterTreeNode = TreeProps.filterTreeNode,
77
77
  filterValue = TreeProps.filterValue,
78
78
  expandOnClickNode = TreeProps.expandOnClickNode,
79
- loadData = TreeProps.loadData;
79
+ loadData = TreeProps.loadData,
80
+ notFoundContent = TreeProps.notFoundContent;
80
81
  var treePrefixCls = getPrefixCls(prefixCls, 'tree', customPrefixcls); // 树样式前缀
81
82
  var treeNodePrefixCls = getPrefixCls(prefixCls, 'tree-node', customPrefixcls); // 树节点样式前缀
82
83
  var treeNodeClassName = (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(treePrefixCls), true));
@@ -132,7 +133,7 @@ var InternalTree = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
132
133
  searchExpandedKeys = _React$useState16[0],
133
134
  setSearchExpandedKeys = _React$useState16[1];
134
135
  var isSearching = _react.default.useMemo(function () {
135
- return typeof filterTreeNode === 'function' && filterValue;
136
+ return typeof filterTreeNode === 'function' && !!filterValue;
136
137
  }, [filterValue]);
137
138
  (0, _react.useEffect)(function () {
138
139
  setSearchExpandedKeys([]);
@@ -383,7 +384,7 @@ var InternalTree = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
383
384
  }), /*#__PURE__*/_react.default.createElement("div", {
384
385
  className: treeRootClassName,
385
386
  ref: listRef
386
- }, visibleData && (0, _map.default)(visibleData).call(visibleData, function (item) {
387
+ }, !(visibleData === null || visibleData === void 0 ? void 0 : visibleData.length) && notFoundContent, visibleData && (0, _map.default)(visibleData).call(visibleData, function (item) {
387
388
  var checked = (0, _treeUtils.getChecked)(checkedKeys, item.key);
388
389
  var indeterminate = (0, _treeUtils.getHalfChecked)(halfCheckedKeys, item.key);
389
390
  item.nodeKey = item.key;
@@ -53,6 +53,7 @@ var flattenAll = function flattenAll(treeData) {
53
53
  var parent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
54
54
  treeData && treeData.forEach(function (item, index) {
55
55
  var _context, _context2;
56
+ var _a;
56
57
  var children = item.children,
57
58
  title = item.title,
58
59
  key = item.key,
@@ -66,7 +67,7 @@ var flattenAll = function flattenAll(treeData) {
66
67
  hasChildNode: hasChildNode,
67
68
  children: children,
68
69
  level: level,
69
- parentKey: (parent === null || parent === void 0 ? void 0 : parent.key) || null,
70
+ 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,
70
71
  pathParentKeys: parent ? (0, _concat.default)(_context2 = []).call(_context2, (0, _toConsumableArray2.default)((parent === null || parent === void 0 ? void 0 : parent.pathParentKeys) || []), [parent === null || parent === void 0 ? void 0 : parent.key]) : []
71
72
  }, others);
72
73
  keysData[key] = flattenNode;
@@ -147,11 +148,8 @@ var getAllFilterKeys = function getAllFilterKeys(data, filterTreeNode, keysData)
147
148
  filterKeys.forEach(function (item) {
148
149
  var node = (0, _extends2.default)({}, item);
149
150
  while (node) {
150
- var _context3;
151
151
  allFilterKeys.add(node.key);
152
- !(0, _includes.default)(_context3 = (0, _map.default)(filterKeys).call(filterKeys, function (i) {
153
- return i.key;
154
- })).call(_context3, node.key) && filterExpandKeys.add(node.key);
152
+ filterExpandKeys.add(node.key);
155
153
  node = (keysData === null || keysData === void 0 ? void 0 : keysData[node === null || node === void 0 ? void 0 : node.parentKey]) || null;
156
154
  }
157
155
  });
@@ -298,10 +296,10 @@ var getSpreadAttrData = function getSpreadAttrData(treeData, expandedKeys) {
298
296
  };
299
297
  exports.getSpreadAttrData = getSpreadAttrData;
300
298
  var addKeys = function addKeys() {
301
- var _context4;
299
+ var _context3;
302
300
  var prevKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
303
301
  var newKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
304
- return (0, _from.default)(new _set.default((0, _concat.default)(_context4 = []).call(_context4, (0, _toConsumableArray2.default)(prevKeys), (0, _toConsumableArray2.default)(newKeys))));
302
+ return (0, _from.default)(new _set.default((0, _concat.default)(_context3 = []).call(_context3, (0, _toConsumableArray2.default)(prevKeys), (0, _toConsumableArray2.default)(newKeys))));
305
303
  };
306
304
  exports.addKeys = addKeys;
307
305
  var getAllParentKeys = function getAllParentKeys(data) {
@@ -352,13 +350,13 @@ var getPos = function getPos(data, key) {
352
350
  };
353
351
  exports.getPos = getPos;
354
352
  var getInitCheckedKeys = function getInitCheckedKeys(data, keys) {
355
- var _context5;
353
+ var _context4;
356
354
  var checkedKeys = [];
357
355
  keys.forEach(function (item) {
358
356
  var pos = getPos(data, item);
359
357
  checkedKeys.push.apply(checkedKeys, (0, _toConsumableArray2.default)(getAllChildKeys(data, pos)));
360
358
  });
361
- return (0, _from.default)(new _set.default((0, _concat.default)(_context5 = []).call(_context5, checkedKeys, (0, _toConsumableArray2.default)(keys))));
359
+ return (0, _from.default)(new _set.default((0, _concat.default)(_context4 = []).call(_context4, checkedKeys, (0, _toConsumableArray2.default)(keys))));
362
360
  };
363
361
  exports.getInitCheckedKeys = getInitCheckedKeys;
364
362
  var getInitCheckededState = function getInitCheckededState(data) {
@@ -454,7 +452,7 @@ var updateParent = function updateParent(key, keysNodeProps, allKeys, halfChecke
454
452
  });
455
453
  };
456
454
  var getInitCheckededKeys = function getInitCheckededKeys() {
457
- var _context6;
455
+ var _context5;
458
456
  var checkedKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
459
457
  var keysNodeProps = arguments.length > 1 ? arguments[1] : undefined;
460
458
  var checkedKeysSet = new _set.default(checkedKeys || []);
@@ -474,7 +472,7 @@ var getInitCheckededKeys = function getInitCheckededKeys() {
474
472
  }
475
473
  });
476
474
  return {
477
- checkedKeys: (0, _toConsumableArray2.default)(new _set.default((0, _concat.default)(_context6 = []).call(_context6, (0, _toConsumableArray2.default)(checkedKeysSet), (0, _toConsumableArray2.default)(childCheckedKeysSet)))),
475
+ checkedKeys: (0, _toConsumableArray2.default)(new _set.default((0, _concat.default)(_context5 = []).call(_context5, (0, _toConsumableArray2.default)(checkedKeysSet), (0, _toConsumableArray2.default)(childCheckedKeysSet)))),
478
476
  halfCheckedKeys: (0, _toConsumableArray2.default)(halfCheckedKeysSet)
479
477
  };
480
478
  };
@@ -642,8 +640,8 @@ var getInitExpandedKeys = function getInitExpandedKeys(data, expandedKeys, defau
642
640
  }
643
641
  }
644
642
  if (isSearching) {
645
- var _context7;
646
- keys = (0, _concat.default)(_context7 = []).call(_context7, (0, _toConsumableArray2.default)(searchExpandedKeys), (0, _toConsumableArray2.default)(getAllFilterKeys(data, filterTreeNode, keysData).filterExpandKeys));
643
+ var _context6;
644
+ keys = (0, _concat.default)(_context6 = []).call(_context6, (0, _toConsumableArray2.default)(searchExpandedKeys), (0, _toConsumableArray2.default)(getAllFilterKeys(data, filterTreeNode, keysData).filterExpandKeys));
647
645
  }
648
646
  return (0, _from.default)(new _set.default((0, _toConsumableArray2.default)(keys)));
649
647
  };
@@ -0,0 +1,3 @@
1
+ import TreeSelect from './tree-select';
2
+ export * from './tree-select';
3
+ export default TreeSelect;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
+ var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
5
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
6
+ var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ var _exportNames = {};
11
+ exports.default = void 0;
12
+ var _treeSelect = _interopRequireWildcard(require("./tree-select"));
13
+ _Object$keys(_treeSelect).forEach(function (key) {
14
+ if (key === "default" || key === "__esModule") return;
15
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
16
+ if (key in exports && exports[key] === _treeSelect[key]) return;
17
+ Object.defineProperty(exports, key, {
18
+ enumerable: true,
19
+ get: function get() {
20
+ return _treeSelect[key];
21
+ }
22
+ });
23
+ });
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
+ var _default = _treeSelect.default;
27
+ exports.default = _default;
@@ -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,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SelectSizes = exports.Modes = exports.BorderTypes = void 0;
7
+ var _type = require("../_utils/type");
8
+ var SelectSizes = (0, _type.tuple)('large', 'middle', 'small'); // 选择框大小
9
+ exports.SelectSizes = SelectSizes;
10
+ var BorderTypes = (0, _type.tuple)('none', 'underline', 'bordered');
11
+ exports.BorderTypes = BorderTypes;
12
+ var Modes = (0, _type.tuple)('multiple', 'single');
13
+ exports.Modes = Modes;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ require("../../style/index.css");
4
+ require("./index.css");