@kdcloudjs/kdesign 1.7.19 → 1.7.21

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 (90) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/kdesign-complete.less +337 -240
  3. package/dist/kdesign.css +270 -240
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +766 -850
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +3 -3
  8. package/dist/kdesign.min.js +9 -9
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/button/style/token.less +1 -0
  11. package/es/checkbox/checkbox.js +5 -5
  12. package/es/checkbox/style/index.css +2 -0
  13. package/es/checkbox/style/index.less +2 -0
  14. package/es/checkbox/style/token.less +1 -1
  15. package/es/city-picker/city-picker.d.ts +3 -23
  16. package/es/city-picker/city-picker.js +351 -124
  17. package/es/city-picker/interface.d.ts +57 -0
  18. package/es/city-picker/interface.js +3 -0
  19. package/es/city-picker/option.d.ts +4 -0
  20. package/es/city-picker/option.js +42 -0
  21. package/es/city-picker/style/index.css +264 -239
  22. package/es/city-picker/style/index.less +262 -218
  23. package/es/city-picker/style/mixin.less +26 -3
  24. package/es/city-picker/style/token.less +42 -14
  25. package/es/config-provider/compDefaultProps.d.ts +15 -0
  26. package/es/config-provider/compDefaultProps.js +16 -1
  27. package/es/input/style/token.less +2 -8
  28. package/es/select/select.js +25 -15
  29. package/es/tree/tree.js +61 -57
  30. package/es/tree/treeNode.js +1 -6
  31. package/es/tree-select/interface.d.ts +1 -0
  32. package/es/tree-select/style/index.css +4 -1
  33. package/es/tree-select/style/index.less +5 -1
  34. package/es/tree-select/style/token.less +1 -0
  35. package/es/tree-select/tree-select.js +18 -4
  36. package/lib/button/style/token.less +1 -0
  37. package/lib/checkbox/checkbox.js +4 -4
  38. package/lib/checkbox/style/index.css +2 -0
  39. package/lib/checkbox/style/index.less +2 -0
  40. package/lib/checkbox/style/token.less +1 -1
  41. package/lib/city-picker/city-picker.d.ts +3 -23
  42. package/lib/city-picker/city-picker.js +350 -123
  43. package/lib/city-picker/interface.d.ts +57 -0
  44. package/lib/city-picker/interface.js +11 -0
  45. package/lib/city-picker/option.d.ts +4 -0
  46. package/lib/city-picker/option.js +55 -0
  47. package/lib/city-picker/style/index.css +264 -239
  48. package/lib/city-picker/style/index.less +262 -218
  49. package/lib/city-picker/style/mixin.less +26 -3
  50. package/lib/city-picker/style/token.less +42 -14
  51. package/lib/config-provider/compDefaultProps.d.ts +15 -0
  52. package/lib/config-provider/compDefaultProps.js +16 -1
  53. package/lib/input/style/token.less +2 -8
  54. package/lib/select/select.js +25 -15
  55. package/lib/tree/tree.js +60 -56
  56. package/lib/tree/treeNode.js +1 -6
  57. package/lib/tree-select/interface.d.ts +1 -0
  58. package/lib/tree-select/style/index.css +4 -1
  59. package/lib/tree-select/style/index.less +5 -1
  60. package/lib/tree-select/style/token.less +1 -0
  61. package/lib/tree-select/tree-select.js +20 -6
  62. package/package.json +1 -1
  63. package/es/city-picker/city-group.d.ts +0 -8
  64. package/es/city-picker/city-group.js +0 -38
  65. package/es/city-picker/city-list.d.ts +0 -12
  66. package/es/city-picker/city-list.js +0 -55
  67. package/es/city-picker/city-panel-item.d.ts +0 -13
  68. package/es/city-picker/city-panel-item.js +0 -22
  69. package/es/city-picker/city-panel.d.ts +0 -17
  70. package/es/city-picker/city-panel.js +0 -153
  71. package/es/city-picker/city-search-panel.d.ts +0 -9
  72. package/es/city-picker/city-search-panel.js +0 -44
  73. package/es/city-picker/no-data.d.ts +0 -3
  74. package/es/city-picker/no-data.js +0 -18
  75. package/es/city-picker/utils/grouping.d.ts +0 -7
  76. package/es/city-picker/utils/grouping.js +0 -24
  77. package/lib/city-picker/city-group.d.ts +0 -8
  78. package/lib/city-picker/city-group.js +0 -51
  79. package/lib/city-picker/city-list.d.ts +0 -12
  80. package/lib/city-picker/city-list.js +0 -68
  81. package/lib/city-picker/city-panel-item.d.ts +0 -13
  82. package/lib/city-picker/city-panel-item.js +0 -35
  83. package/lib/city-picker/city-panel.d.ts +0 -17
  84. package/lib/city-picker/city-panel.js +0 -166
  85. package/lib/city-picker/city-search-panel.d.ts +0 -9
  86. package/lib/city-picker/city-search-panel.js +0 -57
  87. package/lib/city-picker/no-data.d.ts +0 -3
  88. package/lib/city-picker/no-data.js +0 -31
  89. package/lib/city-picker/utils/grouping.d.ts +0 -7
  90. package/lib/city-picker/utils/grouping.js +0 -30
@@ -463,7 +463,22 @@ var compDefaultProps = {
463
463
  type: "arrow-right-solid"
464
464
  });
465
465
  },
466
- expandOnClickNode: false
466
+ expandOnClickNode: false,
467
+ listHeight: 184,
468
+ virtual: true
469
+ },
470
+ CityPicker: {
471
+ type: 'domestic',
472
+ loading: false,
473
+ size: 'small',
474
+ borderType: 'underline',
475
+ defaultOpen: false,
476
+ showArrow: true,
477
+ placeholder: '',
478
+ description: '城市',
479
+ showDescription: true,
480
+ optionHighlightProps: 'highlightText',
481
+ allowClear: true
467
482
  }
468
483
  };
469
484
  export default compDefaultProps;
@@ -9,16 +9,10 @@
9
9
  @input-clear-color: var(~'@{input-prefix}-clear-color', #d9d9d9);
10
10
  @input-clear-color-hover: var(~'@{input-prefix}-clear-color-hover', #999);
11
11
  @input-background-color-inner: var(~'@{input-prefix}-color-background', @color-white);
12
- @input-background-color-disabled-inner: var(
13
- ~'@{input-prefix}-color-background-disabled',
14
- @color-background-contain-disabled
15
- );
12
+ @input-background-color-disabled-inner: var(~'@{input-prefix}-color-background-disabled', @color-background-contain-disabled);
16
13
  @input-border-color-focused: var(~'@{input-prefix}-color-border-focused', @color-theme);
17
14
  @input-border-color-disabled-inner: var(~'@{input-prefix}-color-border-disabled', @color-border-strong);
18
- @input-underline-border-color-disabled-inner: var(
19
- ~'@{input-prefix}-underline-color-border-disabled',
20
- @color-border-weak
21
- );
15
+ @input-underline-border-color-disabled-inner: var(~'@{input-prefix}-underline-color-border-disabled', @color-border-weak);
22
16
  @input-color-disabled-inner: var(~'@{input-prefix}-color-disabled', @color-disabled);
23
17
  @input-affix-color: var(~'@{input-prefix}-affix-color-text', #666);
24
18
  @input-error-color: var(~'@{input-prefix}-color-error', @color-error);
@@ -140,22 +140,29 @@ var InternalSelect = function InternalSelect(props, ref) {
140
140
  var arr = [];
141
141
  _mapInstanceProperty(initValue).call(initValue, function (item) {
142
142
  var _a, _b;
143
- var obj = (realChildren === null || realChildren === void 0 ? void 0 : _findInstanceProperty(realChildren).call(realChildren, function (child) {
143
+ var obj = realChildren === null || realChildren === void 0 ? void 0 : _findInstanceProperty(realChildren).call(realChildren, function (child) {
144
144
  if (child && child.props) {
145
145
  return child.props.value === item;
146
146
  } else {
147
147
  return child.value === item;
148
148
  }
149
- })) || {};
150
- if (options && options.length) {
151
- arr.push({
152
- value: obj === null || obj === void 0 ? void 0 : obj.value,
153
- label: (obj === null || obj === void 0 ? void 0 : obj.label) || (obj === null || obj === void 0 ? void 0 : obj.value)
154
- });
149
+ });
150
+ if (obj) {
151
+ if (options && options.length) {
152
+ arr.push({
153
+ value: obj === null || obj === void 0 ? void 0 : obj.value,
154
+ label: (obj === null || obj === void 0 ? void 0 : obj.label) || (obj === null || obj === void 0 ? void 0 : obj.value)
155
+ });
156
+ } else {
157
+ arr.push({
158
+ value: (_a = obj.props) === null || _a === void 0 ? void 0 : _a.value,
159
+ label: (_b = obj.props) === null || _b === void 0 ? void 0 : _b.children
160
+ });
161
+ }
155
162
  } else {
156
163
  arr.push({
157
- value: (_a = obj.props) === null || _a === void 0 ? void 0 : _a.value,
158
- label: (_b = obj.props) === null || _b === void 0 ? void 0 : _b.children
164
+ value: item,
165
+ label: item
159
166
  });
160
167
  }
161
168
  });
@@ -172,19 +179,22 @@ var InternalSelect = function InternalSelect(props, ref) {
172
179
  if (!isMultiple) {
173
180
  multipleRef.current.selectedVal = initValue; // 默认选中值
174
181
  if (initValue !== undefined) {
175
- var obj = (realChildren === null || realChildren === void 0 ? void 0 : _findInstanceProperty(realChildren).call(realChildren, function (child) {
182
+ var obj = realChildren === null || realChildren === void 0 ? void 0 : _findInstanceProperty(realChildren).call(realChildren, function (child) {
176
183
  var _a;
177
184
  if (child && child.props) {
178
185
  return ((_a = child.props) === null || _a === void 0 ? void 0 : _a.value) === initValue;
179
186
  } else {
180
187
  return (child === null || child === void 0 ? void 0 : child.value) === initValue;
181
188
  }
182
- })) || {};
183
- if (options && options.length) {
184
- setSingleVal(getOptionLabel(obj) || (obj === null || obj === void 0 ? void 0 : obj.value));
189
+ });
190
+ if (obj) {
191
+ if (options && options.length) {
192
+ setSingleVal(getOptionLabel(obj) || (obj === null || obj === void 0 ? void 0 : obj.value));
193
+ } else {
194
+ setSingleVal(getOptionLabel(obj));
195
+ }
185
196
  } else {
186
- // setSingleVal(obj.props?.children)
187
- setSingleVal(getOptionLabel(obj));
197
+ setSingleVal(initValue);
188
198
  }
189
199
  } else {
190
200
  setSingleVal(undefined);
package/es/tree/tree.js CHANGED
@@ -21,8 +21,9 @@ import cloneDeep from 'lodash/cloneDeep';
21
21
  import ConfigContext from '../config-provider/ConfigContext';
22
22
  import { getCompProps } from '../_utils';
23
23
  import TreeNode from './treeNode';
24
+ import VirtualList from '../virtual-list';
24
25
  import { getChecked, getHalfChecked, addKeys, flattenAll, delKey, getFilterData, getSpreadAttrData, getAllCheckedKeys, getDataCheckededStateStrictly, getAllChildKeys, getPos, calcDropPosition } from './utils/treeUtils';
25
- import { useChecked, useExpand, usePlantomHeightEffect, useViewportHeight, useVisibleDataMemo, useScrollToKey, useSelect } from './treeHooks';
26
+ import { useChecked, useExpand, useSelect } from './treeHooks';
26
27
  import isBoolean from 'lodash/isBoolean';
27
28
  var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
28
29
  var _useContext = useContext(ConfigContext),
@@ -80,7 +81,6 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
80
81
  notFoundContent = TreeProps.notFoundContent,
81
82
  others = __rest(TreeProps, ["prefixCls", "treeData", "virtual", "showIcon", "switcherIcon", "icon", "checkable", "checkStrictly", "disabled", "draggable", "scrollToKey", "expandedKeys", "checkedKeys", "defaultExpandRoot", "defaultExpandAll", "defaultExpandParent", "defaultExpandedKeys", "defaultCheckedKeys", "defaultSelectedKeys", "height", "onCheck", "onExpand", "onDragStart", "onDragOver", "onDragLeave", "onDragEnter", "onDragEnd", "onDrop", "onSelect", "selectedKeys", "setTreeNodeStyle", "setTreeNodeClassName", "estimatedItemSize", "style", "className", "filterTreeNode", "filterValue", "expandOnClickNode", "onlyExpandOnClickIcon", "loadData", "notFoundContent"]);
82
83
  var treePrefixCls = getPrefixCls(prefixCls, 'tree', customPrefixcls); // 树样式前缀
83
- var treeNodePrefixCls = getPrefixCls(prefixCls, 'tree-node', customPrefixcls); // 树节点样式前缀
84
84
  var treeNodeClassName = classNames(className, _defineProperty({}, "".concat(treePrefixCls), true));
85
85
  var treeRootClassName = "".concat(treePrefixCls, "-root");
86
86
  var estimatedItemSize = innerEstimatedItemSize; // 节点高度
@@ -94,45 +94,41 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
94
94
  _React$useState2 = _slicedToArray(_React$useState, 2),
95
95
  scrollKey = _React$useState2[0],
96
96
  setScrollKey = _React$useState2[1];
97
- var _React$useState3 = React.useState(0),
98
- _React$useState4 = _slicedToArray(_React$useState3, 2),
99
- start = _React$useState4[0],
100
- setStart = _React$useState4[1];
101
97
  var _useSelect = useSelect(selectedKeysProps, defaultSelectedKeys),
102
98
  _useSelect2 = _slicedToArray(_useSelect, 2),
103
99
  selectedKeys = _useSelect2[0],
104
100
  setSelectedKeys = _useSelect2[1];
105
101
  var listRef = React.useRef(null);
106
- var plantomRef = React.useRef(null);
107
102
  var rootRef = React.useRef(null);
108
103
  var scrollRef = ref || rootRef;
109
104
  var treeNodeRef = React.useRef(null);
110
105
  var dragNodeRef = React.useRef(null);
111
106
  var delayedDragEnterRef = React.useRef(null);
112
- var _React$useState5 = React.useState(true),
107
+ var virtualListRef = React.useRef(null);
108
+ var _React$useState3 = React.useState(true),
109
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
110
+ isInit = _React$useState4[0],
111
+ setIsInit = _React$useState4[1];
112
+ var _React$useState5 = React.useState(null),
113
113
  _React$useState6 = _slicedToArray(_React$useState5, 2),
114
- isInit = _React$useState6[0],
115
- setIsInit = _React$useState6[1];
114
+ dropPosition = _React$useState6[0],
115
+ setDropPosition = _React$useState6[1];
116
116
  var _React$useState7 = React.useState(null),
117
117
  _React$useState8 = _slicedToArray(_React$useState7, 2),
118
- dropPosition = _React$useState8[0],
119
- setDropPosition = _React$useState8[1];
120
- var _React$useState9 = React.useState(null),
118
+ dragOverNodeKey = _React$useState8[0],
119
+ setDragOverNodeKey = _React$useState8[1];
120
+ var _React$useState9 = React.useState(new _Set()),
121
121
  _React$useState10 = _slicedToArray(_React$useState9, 2),
122
- dragOverNodeKey = _React$useState10[0],
123
- setDragOverNodeKey = _React$useState10[1];
122
+ loadedKeys = _React$useState10[0],
123
+ setLoadedKeys = _React$useState10[1];
124
124
  var _React$useState11 = React.useState(new _Set()),
125
125
  _React$useState12 = _slicedToArray(_React$useState11, 2),
126
- loadedKeys = _React$useState12[0],
127
- setLoadedKeys = _React$useState12[1];
128
- var _React$useState13 = React.useState(new _Set()),
126
+ loadingKeys = _React$useState12[0],
127
+ setLoadingKeys = _React$useState12[1];
128
+ var _React$useState13 = React.useState([]),
129
129
  _React$useState14 = _slicedToArray(_React$useState13, 2),
130
- loadingKeys = _React$useState14[0],
131
- setLoadingKeys = _React$useState14[1];
132
- var _React$useState15 = React.useState([]),
133
- _React$useState16 = _slicedToArray(_React$useState15, 2),
134
- searchExpandedKeys = _React$useState16[0],
135
- setSearchExpandedKeys = _React$useState16[1];
130
+ searchExpandedKeys = _React$useState14[0],
131
+ setSearchExpandedKeys = _React$useState14[1];
136
132
  var isSearching = React.useMemo(function () {
137
133
  return typeof filterTreeNode === 'function' && !!filterValue;
138
134
  }, [filterValue]);
@@ -157,13 +153,11 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
157
153
  var filterData = React.useMemo(function () {
158
154
  return getFilterData(spreadAttrData, filterTreeNode, isSearching, posData, keysData);
159
155
  }, [spreadAttrData, isSearching, posData, keysData]);
160
- var _useViewportHeight = useViewportHeight(height, listRef),
161
- _useViewportHeight2 = _slicedToArray(_useViewportHeight, 1),
162
- viewportHeight = _useViewportHeight2[0];
163
- var _useVisibleDataMemo = useVisibleDataMemo(virtual, filterData, viewportHeight, estimatedItemSize, start),
164
- _useVisibleDataMemo2 = _slicedToArray(_useVisibleDataMemo, 1),
165
- visibleData = _useVisibleDataMemo2[0];
166
- var index = React.useMemo(function () {
156
+ useEffect(function () {
157
+ var _a, _b;
158
+ if (typeof scrollKey === 'undefined') {
159
+ return;
160
+ }
167
161
  var scrollIndex = 0;
168
162
  for (var i = 0; i < filterData.length; i++) {
169
163
  if (filterData[i].key === scrollKey) {
@@ -171,19 +165,21 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
171
165
  break;
172
166
  }
173
167
  }
174
- return scrollIndex;
175
- }, [filterData, scrollKey]);
176
- useScrollToKey(scrollKey, index, estimatedItemSize, scrollRef, viewportHeight, treeNodePrefixCls);
177
- usePlantomHeightEffect(plantomRef, filterData, estimatedItemSize);
178
- var handleScroll = useCallback(function () {
179
- if (!virtual) return;
180
- var scrollTop = scrollRef.current.scrollTop;
181
- setStart(Math.floor(scrollTop / estimatedItemSize));
182
- var tempStartOffset = scrollTop - scrollTop % estimatedItemSize;
183
- if (listRef.current && virtual) {
184
- listRef.current.style.transform = "translate3d(0,".concat(tempStartOffset, "px,0)");
168
+ if (virtual) {
169
+ (_a = virtualListRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
170
+ index: scrollIndex
171
+ });
172
+ } else {
173
+ var wrapperDom = scrollRef.current;
174
+ var node = wrapperDom ? (_b = wrapperDom === null || wrapperDom === void 0 ? void 0 : wrapperDom.children[0]) === null || _b === void 0 ? void 0 : _b.children[scrollIndex] : null;
175
+ if (node && wrapperDom) {
176
+ var containerHeight = wrapperDom.clientHeight;
177
+ var targetHeight = node.clientHeight;
178
+ var scrollPosition = node.offsetTop + targetHeight - containerHeight;
179
+ wrapperDom.scrollTop = scrollPosition;
180
+ }
185
181
  }
186
- }, [listRef, scrollRef, virtual, estimatedItemSize]);
182
+ }, [filterData, scrollKey, virtual]);
187
183
  var handleNodeLoad = useCallback(function (loadedKeys, loadingKeys, data) {
188
184
  var key = data.key;
189
185
  if (!loadData || loadedKeys.has(key) || loadingKeys.has(key)) {
@@ -228,7 +224,7 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
228
224
  var newSearchExpandedKeys = expanded ? addKeys(searchExpandedKeys, [key]) : delKey(searchExpandedKeys, [key]);
229
225
  setSearchExpandedKeys(newSearchExpandedKeys);
230
226
  }
231
- setScrollKey('');
227
+ setScrollKey(undefined);
232
228
  setIsInit(false);
233
229
  if (expanded && loadData) {
234
230
  handleNodeLoad(loadedKeys, loadingKeys, node);
@@ -374,18 +370,7 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
374
370
  useEffect(function () {
375
371
  setCheckedKeys(checkedKeys);
376
372
  }, [checkedKeys, setCheckedKeys]);
377
- return /*#__PURE__*/React.createElement("div", _extends({
378
- className: treeNodeClassName,
379
- style: style,
380
- ref: scrollRef,
381
- onScroll: handleScroll
382
- }, others), /*#__PURE__*/React.createElement("div", {
383
- ref: plantomRef,
384
- className: "".concat(treePrefixCls, "-plantom")
385
- }), /*#__PURE__*/React.createElement("div", {
386
- className: treeRootClassName,
387
- ref: listRef
388
- }, !(visibleData === null || visibleData === void 0 ? void 0 : visibleData.length) && notFoundContent, visibleData && _mapInstanceProperty(visibleData).call(visibleData, function (item) {
373
+ var renderTreeNode = function renderTreeNode(item) {
389
374
  var checked = getChecked(checkedKeys, item.key);
390
375
  var indeterminate = getHalfChecked(halfCheckedKeys, item.key);
391
376
  item.nodeKey = item.key;
@@ -423,7 +408,26 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
423
408
  key: item.key,
424
409
  ref: treeNodeRef
425
410
  }));
426
- })));
411
+ };
412
+ return /*#__PURE__*/React.createElement("div", _extends({
413
+ className: treeNodeClassName,
414
+ style: style,
415
+ ref: scrollRef
416
+ }, others), /*#__PURE__*/React.createElement("div", {
417
+ className: treeRootClassName,
418
+ ref: listRef
419
+ }, !(filterData === null || filterData === void 0 ? void 0 : filterData.length) && notFoundContent, virtual ? /*#__PURE__*/React.createElement(VirtualList, {
420
+ className: className,
421
+ style: style,
422
+ ref: virtualListRef,
423
+ data: filterData,
424
+ isStaticItemHeight: true,
425
+ itemKey: function itemKey(item) {
426
+ return item === null || item === void 0 ? void 0 : item.key;
427
+ },
428
+ height: height,
429
+ itemHeight: estimatedItemSize
430
+ }, renderTreeNode) : _mapInstanceProperty(filterData).call(filterData, renderTreeNode)));
427
431
  });
428
432
  var Tree = InternalTree;
429
433
  Tree.displayName = 'Tree';
@@ -18,7 +18,7 @@ import { getCompProps } from '../_utils';
18
18
  import Checkbox from './../checkbox';
19
19
  import Icon from '../icon';
20
20
  import Spin from '../spin';
21
- var TreeNode = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
+ var TreeNode = /*#__PURE__*/React.forwardRef(function (props) {
22
22
  var _context;
23
23
  var _useContext = useContext(ConfigContext),
24
24
  getPrefixCls = _useContext.getPrefixCls,
@@ -230,11 +230,6 @@ var TreeNode = /*#__PURE__*/React.forwardRef(function (props, ref) {
230
230
  var handleSelect = React.useCallback(function (e) {
231
231
  selectable && !disabled && onSelect && onSelect(e, nodeData, nodeKey);
232
232
  }, [onSelect, selectable, disabled, nodeData, nodeKey]);
233
- React.useImperativeHandle(ref, function () {
234
- return {
235
- selectNode: handleSelect
236
- };
237
- });
238
233
  var handleExpandIconClick = useCallback(function (e) {
239
234
  e === null || e === void 0 ? void 0 : e.stopPropagation();
240
235
  setExpandState(!expandState);
@@ -48,6 +48,7 @@ export declare type ITreeProps = {
48
48
  treeExpandOnClickNode?: boolean;
49
49
  showTreeIcon?: boolean;
50
50
  treeLoadData?: () => void;
51
+ listHeight?: number;
51
52
  };
52
53
  export declare type TreeSelectValue = string | string[] | number | number[] | undefined;
53
54
  export interface ITreeSelectProps<T extends TreeSelectValue> extends AbstractSelectProps, ITreeProps {
@@ -228,7 +228,7 @@
228
228
  z-index: var(--kd-c-tree-select-z-index, var(--kd-g-z-index-popper, 1050));
229
229
  -webkit-box-sizing: border-box;
230
230
  box-sizing: border-box;
231
- padding: 4px 0;
231
+ padding: var(--kd-c-tree-select-dropdown-spacing-padding-vertical, 8px) 0;
232
232
  margin: 0;
233
233
  overflow: auto;
234
234
  font-size: var(--kd-c-tree-select-dropdown-font-size, 12px);
@@ -240,6 +240,9 @@
240
240
  box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2);
241
241
  max-height: 200px;
242
242
  }
243
+ .kd-tree-select-dropdown .kd-tree {
244
+ padding: 0;
245
+ }
243
246
  .kd-tree-select-dropdown .kd-tree-node-item {
244
247
  padding: 0 var(--kd-c-tree-select-dropdown-node-spacing-padding-horizontal, 16px);
245
248
  }
@@ -126,7 +126,7 @@
126
126
  left: 0;
127
127
  z-index: @tree-select-z-index;
128
128
  box-sizing: border-box;
129
- padding: 4px 0;
129
+ padding: @tree-select-padding-vertical 0;
130
130
  margin: 0;
131
131
  overflow: auto;
132
132
  font-size: @tree-select-list-font-size;
@@ -137,6 +137,10 @@
137
137
  box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2);
138
138
  max-height: 200px;
139
139
 
140
+ .@{tree-prefix-cls} {
141
+ padding: 0;
142
+ }
143
+
140
144
  .@{tree-prefix-cls}-node-item {
141
145
  padding: 0 @tree-select-dropdown-node-horizontal;
142
146
  }
@@ -45,6 +45,7 @@
45
45
  @tree-select-bordered: var(~'@{tree-select-custom-prefix}-bordered-spacing-padding-left', 8px);
46
46
  @tree-select-wrapper-padding: var(~'@{tree-select-custom-prefix}-wrapper-spacing-padding', 1px 28px 1px 0);
47
47
  @tree-select-dropdown-node-horizontal: var(~'@{tree-select-custom-prefix}-dropdown-node-spacing-padding-horizontal', 16px);
48
+ @tree-select-padding-vertical: var(~'@{tree-select-custom-prefix}-dropdown-spacing-padding-vertical', 8px);
48
49
 
49
50
  // radius
50
51
  @tree-select-g-radius-border: var(~'@{tree-select-custom-prefix}-radius-border', @radius-border);
@@ -1,3 +1,4 @@
1
+ import _typeof from "@babel/runtime-corejs3/helpers/typeof";
1
2
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
2
3
  import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
3
4
  import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
@@ -96,7 +97,8 @@ var InternalTreeSelect = function InternalTreeSelect(props, ref) {
96
97
  onSelect = treeSelectProps.onSelect,
97
98
  onCheck = treeSelectProps.onCheck,
98
99
  dropdownRender = treeSelectProps.dropdownRender,
99
- onlyExpandOnClickIcon = treeSelectProps.onlyExpandOnClickIcon;
100
+ onlyExpandOnClickIcon = treeSelectProps.onlyExpandOnClickIcon,
101
+ listHeight = treeSelectProps.listHeight;
100
102
  var isMultiple = mode === 'multiple'; // 是否多选
101
103
  var _useMergedState = useMergedState(isMultiple ? [] : undefined, {
102
104
  value: value,
@@ -155,16 +157,26 @@ var InternalTreeSelect = function InternalTreeSelect(props, ref) {
155
157
  var commCls = classNames((_classNames4 = {}, _defineProperty(_classNames4, "".concat(selectPrefixCls, "-bordered"), borderType === 'bordered'), _defineProperty(_classNames4, "".concat(selectPrefixCls, "-underline"), borderType === 'underline'), _defineProperty(_classNames4, "".concat(selectPrefixCls, "-borderless"), borderType === 'none'), _defineProperty(_classNames4, _concatInstanceProperty(_context3 = "".concat(selectPrefixCls, "-size-")).call(_context3, size), size), _defineProperty(_classNames4, "".concat(selectPrefixCls, "-wrapper"), true), _classNames4));
156
158
  useEffect(function () {
157
159
  var arr = [];
158
- if (isMultiple && (initValue === null || initValue === void 0 ? void 0 : initValue.length)) {
160
+ if (isMultiple) {
159
161
  for (var index = 0; index < initValue.length; index++) {
160
162
  var key = initValue[index];
161
163
  if (TreeMap.has(key)) {
162
164
  arr.push(TreeMap.get(key));
165
+ } else {
166
+ arr.push({
167
+ key: key,
168
+ title: key
169
+ });
163
170
  }
164
171
  }
165
172
  } else {
166
173
  if (TreeMap.has(initValue)) {
167
174
  arr.push(TreeMap.get(initValue));
175
+ } else {
176
+ _typeof(initValue) !== undefined && arr.push({
177
+ key: initValue,
178
+ title: initValue
179
+ });
168
180
  }
169
181
  }
170
182
  setSelectTreeNodes(arr);
@@ -315,7 +327,8 @@ var InternalTreeSelect = function InternalTreeSelect(props, ref) {
315
327
  notFoundContent: renderNotContent(),
316
328
  filterTreeNode: defFilterTreeNode,
317
329
  onSelect: handleSelect,
318
- onExpand: handleExpand
330
+ onExpand: handleExpand,
331
+ height: listHeight
319
332
  };
320
333
  if (isMultiple) {
321
334
  treeProps.checkable = true;
@@ -343,7 +356,8 @@ var InternalTreeSelect = function InternalTreeSelect(props, ref) {
343
356
  // 渲染下拉列表框
344
357
  var renderContent = function renderContent() {
345
358
  var dropDownStyle = _extends({
346
- width: style === null || style === void 0 ? void 0 : style.width
359
+ width: style === null || style === void 0 ? void 0 : style.width,
360
+ maxHeight: virtual ? 'unset' : ''
347
361
  }, dropdownStyle);
348
362
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
349
363
  className: dropDownCls,
@@ -91,6 +91,7 @@
91
91
  @btn-middle-height: var(~'@{button-custom-prefix}-sizing-height-middle', 28px); // 中号 高度 高度配置
92
92
  @btn-middle-min-width: var(~'@{button-custom-prefix}-sizing-min-width-middle', 60px); // 中号 最小宽度
93
93
  @btn-large-height: var(~'@{button-custom-prefix}-sizing-height-large', 32px); // 大号 高度
94
+ @btn-middle-max-width: var(~'@{button-custom-prefix}-sizing-max-width-middle'); // 中号 最大宽度
94
95
  @btn-large-min-width: var(~'@{button-custom-prefix}-sizing-min-width-large', 80px); // 大号 最小宽度
95
96
  @btn-group-dropdown-item-height: var(~'@{button-custom-prefix}--group-dropdown-item-height', 30px);
96
97
  @btn-group-dropdown-min-width: var(~'@{button-custom-prefix}-group-dropdown-min-width', 80px);
@@ -75,20 +75,20 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
75
75
  var getIndeterminate = function getIndeterminate() {
76
76
  return selected ? false : indeterminate;
77
77
  };
78
- var getDefaultClassName = (0, _classnames.default)(className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(checkboxPrefixCls), true), (0, _defineProperty2.default)(_classNames, "".concat(checkboxPrefixCls, "-no-child"), !children), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context = "".concat(checkboxPrefixCls, "-")).call(_context, mergedSize), true && !!children), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context2 = "".concat(checkboxPrefixCls, "-")).call(_context2, mergedCheckboxType), true), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context3 = "".concat(checkboxPrefixCls, "-")).call(_context3, mergedCheckboxType, "-disabled"), mergedDisabled), (0, _defineProperty2.default)(_classNames, "checked", selected), _classNames));
79
- var getSquareClassName = (0, _classnames.default)(className, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(checkboxPrefixCls), true), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context4 = "".concat(checkboxPrefixCls, "-")).call(_context4, mergedCheckboxType), true), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context5 = "".concat(checkboxPrefixCls, "-")).call(_context5, mergedSize), true && !!children), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context6 = "".concat(checkboxPrefixCls, "-")).call(_context6, mergedCheckboxType, "-disabled"), mergedDisabled), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context7 = "".concat(checkboxPrefixCls, "-")).call(_context7, mergedCheckboxType, "-checked"), selected && !mergedDisabled), (0, _defineProperty2.default)(_classNames2, "checked", selected), _classNames2));
78
+ var getDefaultClassName = (0, _classnames.default)(className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(checkboxPrefixCls), true), (0, _defineProperty2.default)(_classNames, "".concat(checkboxPrefixCls, "-no-child"), !children), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context = "".concat(checkboxPrefixCls, "-")).call(_context, mergedSize), !!children), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context2 = "".concat(checkboxPrefixCls, "-")).call(_context2, mergedCheckboxType), true), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context3 = "".concat(checkboxPrefixCls, "-")).call(_context3, mergedCheckboxType, "-disabled"), mergedDisabled), (0, _defineProperty2.default)(_classNames, "checked", selected), _classNames));
79
+ var getSquareClassName = (0, _classnames.default)(className, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(checkboxPrefixCls), true), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context4 = "".concat(checkboxPrefixCls, "-")).call(_context4, mergedCheckboxType), true), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context5 = "".concat(checkboxPrefixCls, "-")).call(_context5, mergedSize), !!children), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context6 = "".concat(checkboxPrefixCls, "-")).call(_context6, mergedCheckboxType, "-disabled"), mergedDisabled), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context7 = "".concat(checkboxPrefixCls, "-")).call(_context7, mergedCheckboxType, "-checked"), selected && !mergedDisabled), (0, _defineProperty2.default)(_classNames2, "checked", selected), _classNames2));
80
80
  var getRootClassName = isDefaultType() ? getDefaultClassName : getSquareClassName;
81
81
  var inputClassName = (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(checkboxPrefixCls, "-input"), true));
82
82
  var checkedWrapperClassName = (0, _classnames.default)((_classNames4 = {}, (0, _defineProperty2.default)(_classNames4, (0, _concat.default)(_context8 = "".concat(checkboxPrefixCls, "-")).call(_context8, mergedCheckboxType, "-no-child"), !children), (0, _defineProperty2.default)(_classNames4, (0, _concat.default)(_context9 = "".concat(checkboxPrefixCls, "-")).call(_context9, mergedCheckboxType, "-wrapper"), true), (0, _defineProperty2.default)(_classNames4, (0, _concat.default)(_context10 = "".concat(checkboxPrefixCls, "-")).call(_context10, mergedCheckboxType, "-wrapper-size"), !!children), (0, _defineProperty2.default)(_classNames4, (0, _concat.default)(_context11 = "".concat(checkboxPrefixCls, "-")).call(_context11, mergedCheckboxType, "-margin"), !!children), (0, _defineProperty2.default)(_classNames4, (0, _concat.default)(_context12 = "".concat(checkboxPrefixCls, "-")).call(_context12, mergedCheckboxType, "-checked"), selected), (0, _defineProperty2.default)(_classNames4, (0, _concat.default)(_context13 = "".concat(checkboxPrefixCls, "-")).call(_context13, mergedCheckboxType, "-indeterminate"), getIndeterminate()), (0, _defineProperty2.default)(_classNames4, (0, _concat.default)(_context14 = "".concat(checkboxPrefixCls, "-")).call(_context14, mergedCheckboxType, "-disabled"), mergedDisabled && !selected), (0, _defineProperty2.default)(_classNames4, (0, _concat.default)(_context15 = "".concat(checkboxPrefixCls, "-")).call(_context15, mergedCheckboxType, "-checked-disabled"), mergedDisabled && selected), _classNames4));
83
83
  var triangleClassName = (0, _classnames.default)((_classNames5 = {}, (0, _defineProperty2.default)(_classNames5, (0, _concat.default)(_context16 = "".concat(checkboxPrefixCls, "-")).call(_context16, mergedCheckboxType, "-triangle"), !selected), (0, _defineProperty2.default)(_classNames5, (0, _concat.default)(_context17 = "".concat(checkboxPrefixCls, "-")).call(_context17, mergedCheckboxType, "-triangle-checked"), selected), (0, _defineProperty2.default)(_classNames5, (0, _concat.default)(_context18 = "".concat(checkboxPrefixCls, "-")).call(_context18, mergedCheckboxType, "-triangle-disabled"), mergedDisabled), _classNames5));
84
84
  var innerIconClassName = (0, _classnames.default)((0, _defineProperty2.default)({}, (0, _concat.default)(_context19 = "".concat(checkboxPrefixCls, "-")).call(_context19, mergedCheckboxType, "-inner"), true));
85
- var handleChange = (0, _react.useCallback)(function (e) {
85
+ var handleChange = function handleChange(e) {
86
86
  onChange && onChange(e);
87
87
  (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.onCheckboxGroupChange) && (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.onCheckboxGroupChange(value, e.target.checked, e));
88
88
  if (!(checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.isControlled)) {
89
89
  setSelected(e.target.checked);
90
90
  }
91
- }, [onChange]);
91
+ };
92
92
  (0, _react.useEffect)(function () {
93
93
  (0, _isBoolean.default)(checked) && checked !== selected && setSelected(checked);
94
94
  }, [checked, selected]);
@@ -141,6 +141,8 @@
141
141
  width: 100%;
142
142
  cursor: inherit;
143
143
  opacity: 0;
144
+ inset: 0;
145
+ z-index: 1;
144
146
  }
145
147
  .kd-checkbox-children {
146
148
  display: -webkit-inline-box;
@@ -32,6 +32,8 @@
32
32
  width: 100%;
33
33
  cursor: inherit;
34
34
  opacity: 0;
35
+ inset: 0;
36
+ z-index: 1;
35
37
  }
36
38
  &-children {
37
39
  display: inline-flex;
@@ -2,7 +2,7 @@
2
2
 
3
3
  @checkbox-prefix: '--@{kd-prefix}-c-checkbox';
4
4
 
5
- // colors
5
+ // color
6
6
  @checkbox-color-theme: var(~'@{checkbox-prefix}-color-theme', @color-theme);
7
7
  @checkbox-font-color: var(~'@{checkbox-prefix}-color-text-primary', #212121);
8
8
  @checkbox-border-color: var(~'@{checkbox-prefix}-color-border', #d9d9d9);
@@ -1,24 +1,4 @@
1
1
  import React from 'react';
2
- import CityPanelItem from './city-panel-item';
3
- import CityPanel, { Common, Group, List as CityList } from './city-panel';
4
- import SearchPanel from './city-search-panel';
5
- export interface CityPickerProps {
6
- cityList?: CityList;
7
- className?: string;
8
- commons?: Common;
9
- disabled?: boolean;
10
- groups?: Group;
11
- inputClassName?: string;
12
- inputStyle?: React.CSSProperties;
13
- placeholder?: string;
14
- showTitle?: boolean;
15
- style?: React.CSSProperties;
16
- title?: string;
17
- }
18
- export interface MenuType extends React.FC<CityPickerProps> {
19
- PanelItem: typeof CityPanelItem;
20
- Panel: typeof CityPanel;
21
- SearchPanel: typeof SearchPanel;
22
- }
23
- declare const CityPicker: MenuType;
24
- export default CityPicker;
2
+ import { CityPickerProps } from './interface';
3
+ declare const Select: React.ForwardRefExoticComponent<CityPickerProps & React.RefAttributes<unknown>>;
4
+ export default Select;