@kdcloudjs/kdesign 1.6.6 → 1.6.7

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 (94) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/kdesign-complete.less +105 -105
  3. package/dist/kdesign.css +100 -83
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +726 -488
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +3 -3
  8. package/dist/kdesign.min.js +8 -8
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/carousel/style/index.css +3 -0
  11. package/es/carousel/style/index.less +4 -0
  12. package/es/cascader/style/index.css +7 -7
  13. package/es/cascader/style/token.less +2 -2
  14. package/es/config-provider/compDefaultProps.d.ts +4 -0
  15. package/es/config-provider/compDefaultProps.js +5 -1
  16. package/es/date-picker/date-picker.js +11 -14
  17. package/es/date-picker/panel/month/month.d.ts +0 -1
  18. package/es/date-picker/panel/month/month.js +6 -4
  19. package/es/date-picker/range/input-range.js +41 -11
  20. package/es/date-picker/range-picker.js +8 -11
  21. package/es/date-picker/single/input-date.js +40 -10
  22. package/es/date-picker/style/index.css +27 -23
  23. package/es/date-picker/style/index.less +16 -33
  24. package/es/date-picker/style/mixin.less +7 -0
  25. package/es/date-picker/style/token.less +2 -1
  26. package/es/form/Field.d.ts +1 -0
  27. package/es/form/Field.js +9 -5
  28. package/es/form/FieldLabel.d.ts +1 -0
  29. package/es/form/FieldLabel.js +4 -2
  30. package/es/input/ClearableLabeledInput.js +23 -5
  31. package/es/input/style/index.css +5 -8
  32. package/es/input/style/index.less +2 -5
  33. package/es/input/style/mixin.less +3 -3
  34. package/es/input/style/token.less +2 -0
  35. package/es/search/style/index.css +3 -1
  36. package/es/search/style/index.less +3 -1
  37. package/es/search/style/token.less +2 -1
  38. package/es/select/interface.d.ts +2 -0
  39. package/es/select/option.js +1 -1
  40. package/es/select/select.js +180 -128
  41. package/es/select/style/index.css +54 -24
  42. package/es/select/style/index.less +60 -43
  43. package/es/select/style/mixin.less +0 -2
  44. package/es/select/style/token.less +2 -0
  45. package/es/split-panel/style/index.css +0 -6
  46. package/es/split-panel/style/index.less +0 -3
  47. package/es/steps/style/index.css +0 -13
  48. package/es/steps/style/index.less +0 -11
  49. package/es/table/feature/mergeCellHover.d.ts +3 -0
  50. package/es/table/feature/mergeCellHover.js +7 -0
  51. package/es/table/table.js +2 -0
  52. package/lib/carousel/style/index.css +3 -0
  53. package/lib/carousel/style/index.less +4 -0
  54. package/lib/cascader/style/index.css +7 -7
  55. package/lib/cascader/style/token.less +2 -2
  56. package/lib/config-provider/compDefaultProps.d.ts +4 -0
  57. package/lib/config-provider/compDefaultProps.js +5 -1
  58. package/lib/date-picker/date-picker.js +10 -16
  59. package/lib/date-picker/panel/month/month.d.ts +0 -1
  60. package/lib/date-picker/panel/month/month.js +10 -8
  61. package/lib/date-picker/range/input-range.js +40 -11
  62. package/lib/date-picker/range-picker.js +7 -13
  63. package/lib/date-picker/single/input-date.js +37 -9
  64. package/lib/date-picker/style/index.css +27 -23
  65. package/lib/date-picker/style/index.less +16 -33
  66. package/lib/date-picker/style/mixin.less +7 -0
  67. package/lib/date-picker/style/token.less +2 -1
  68. package/lib/form/Field.d.ts +1 -0
  69. package/lib/form/Field.js +10 -6
  70. package/lib/form/FieldLabel.d.ts +1 -0
  71. package/lib/form/FieldLabel.js +4 -2
  72. package/lib/input/ClearableLabeledInput.js +34 -5
  73. package/lib/input/style/index.css +5 -8
  74. package/lib/input/style/index.less +2 -5
  75. package/lib/input/style/mixin.less +3 -3
  76. package/lib/input/style/token.less +2 -0
  77. package/lib/search/style/index.css +3 -1
  78. package/lib/search/style/index.less +3 -1
  79. package/lib/search/style/token.less +2 -1
  80. package/lib/select/interface.d.ts +2 -0
  81. package/lib/select/option.js +1 -1
  82. package/lib/select/select.js +179 -126
  83. package/lib/select/style/index.css +54 -24
  84. package/lib/select/style/index.less +60 -43
  85. package/lib/select/style/mixin.less +0 -2
  86. package/lib/select/style/token.less +2 -0
  87. package/lib/split-panel/style/index.css +0 -6
  88. package/lib/split-panel/style/index.less +0 -3
  89. package/lib/steps/style/index.css +0 -13
  90. package/lib/steps/style/index.less +0 -11
  91. package/lib/table/feature/mergeCellHover.d.ts +3 -0
  92. package/lib/table/feature/mergeCellHover.js +15 -0
  93. package/lib/table/table.js +3 -0
  94. package/package.json +1 -1
@@ -7,20 +7,20 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
7
7
  import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
8
8
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
9
9
  import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
10
- import React, { useContext, useRef, useEffect, useState, useCallback } from 'react';
10
+ import React, { useContext, useRef, useEffect, useState, useCallback, useLayoutEffect, useMemo } from 'react';
11
11
  import { useMergedState } from '../_utils/hooks';
12
+ import isBoolean from 'lodash/isBoolean';
12
13
  import classNames from 'classnames';
13
14
  import ConfigContext from '../config-provider/ConfigContext';
14
15
  import { getCompProps } from '../_utils';
15
16
  import { toArray } from '../_utils/react-children';
16
- import { Input, Icon, Checkbox, Tag } from '../index';
17
+ import { Icon, Checkbox, Tag } from '../index';
17
18
  import Option from './option';
18
19
  import usePopper from '../_utils/usePopper';
20
+ var INPUT_MIN_WIDTH = 4; // 输入框最小宽度
19
21
 
20
22
  var InternalSelect = function InternalSelect(props, ref) {
21
- var _context, _classNames7, _classNames13, _classNames14;
22
-
23
- var _a;
23
+ var _context, _classNames6, _classNames12;
24
24
 
25
25
  var _useContext = useContext(ConfigContext),
26
26
  getPrefixCls = _useContext.getPrefixCls,
@@ -56,6 +56,9 @@ var InternalSelect = function InternalSelect(props, ref) {
56
56
  dropdownStyle = selectProps.dropdownStyle,
57
57
  style = selectProps.style,
58
58
  clearIcon = selectProps.clearIcon,
59
+ filterOption = selectProps.filterOption,
60
+ optionFilterProp = selectProps.optionFilterProp,
61
+ optionLabelProp = selectProps.optionLabelProp,
59
62
  _selectProps$popperSt = selectProps.popperStyle,
60
63
  popperStyle = _selectProps$popperSt === void 0 ? {} : _selectProps$popperSt;
61
64
  var isMultiple = mode === 'multiple'; // 是否多选
@@ -81,6 +84,8 @@ var InternalSelect = function InternalSelect(props, ref) {
81
84
  selectMulOpts: []
82
85
  }); // 多选ref已选中项
83
86
 
87
+ var measureRef = React.useRef(null);
88
+
84
89
  var _useState = useState([]),
85
90
  _useState2 = _slicedToArray(_useState, 2),
86
91
  mulOptions = _useState2[0],
@@ -95,18 +100,19 @@ var InternalSelect = function InternalSelect(props, ref) {
95
100
  _useState6 = _slicedToArray(_useState5, 2),
96
101
  optionShow = _useState6[0],
97
102
  setOptionShow = _useState6[1]; // 下拉列表是否展示
103
+ // const [searchInput, setSearchInput] = useState<string>('') // 搜索框值
98
104
 
99
105
 
100
106
  var _useState7 = useState(''),
101
107
  _useState8 = _slicedToArray(_useState7, 2),
102
- searchInput = _useState8[0],
103
- setSearchInput = _useState8[1]; // 搜索框值
108
+ searchValue = _useState8[0],
109
+ setSearchValue = _useState8[1]; // 搜索框定时器
104
110
 
105
111
 
106
- var _useState9 = useState(null),
112
+ var _useState9 = useState(INPUT_MIN_WIDTH),
107
113
  _useState10 = _slicedToArray(_useState9, 2),
108
- timer = _useState10[0],
109
- setTimer = _useState10[1]; // 搜索框定时器
114
+ inputWidth = _useState10[0],
115
+ setInputWidth = _useState10[1]; // 输入框宽度
110
116
 
111
117
 
112
118
  var selectPrefixCls = getPrefixCls(prefixCls, 'select', customPrefixcls); // 选择器样式
@@ -114,15 +120,13 @@ var InternalSelect = function InternalSelect(props, ref) {
114
120
  var selectCls = classNames(selectPrefixCls, className, _defineProperty({}, "".concat(selectPrefixCls, "-visible"), optionShow));
115
121
  var selectionCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-selector"), true)); // 下拉列表框样式
116
122
 
117
- var dropDownCls = classNames(dropdownClassName, _defineProperty({}, "".concat(selectPrefixCls, "-dropdown"), true)); // 下拉搜索框样式
118
-
119
- var searchCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-dropdown-search"), true)); // 下拉子项列表样式
123
+ var dropDownCls = classNames(dropdownClassName, _defineProperty({}, "".concat(selectPrefixCls, "-dropdown"), true)); // 下拉子项列表样式
120
124
 
121
125
  var dropContentCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-dropdown-scroll"), (isMultiple ? (realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) > 8 : (realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) > 10) || selectProps.dropdownRender)); // 多选底部样式
122
126
 
123
127
  var multipleFooterCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-multiple-footer"), true)); // 多选,单选公共样式
124
128
 
125
- var commCls = classNames((_classNames7 = {}, _defineProperty(_classNames7, "".concat(selectPrefixCls, "-bordered"), borderType === 'bordered'), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-underline"), borderType === 'underline'), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-borderless"), borderType === 'none'), _defineProperty(_classNames7, _concatInstanceProperty(_context = "".concat(selectPrefixCls, "-size-")).call(_context, size), size), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-wrapper"), true), _classNames7));
129
+ var commCls = classNames((_classNames6 = {}, _defineProperty(_classNames6, "".concat(selectPrefixCls, "-bordered"), borderType === 'bordered'), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-underline"), borderType === 'underline'), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-borderless"), borderType === 'none'), _defineProperty(_classNames6, _concatInstanceProperty(_context = "".concat(selectPrefixCls, "-size-")).call(_context, size), size), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-wrapper"), true), _classNames6));
126
130
  React.useEffect(function () {
127
131
  setOptionShow(!!props.visible);
128
132
  }, [props.visible]); // realchildren更新时数据处理---待解决
@@ -172,8 +176,6 @@ var InternalSelect = function InternalSelect(props, ref) {
172
176
  }
173
177
  }, [isMultiple, initValue, children, options]);
174
178
  useEffect(function () {
175
- var _a;
176
-
177
179
  if (!isMultiple) {
178
180
  multipleRef.current.selectedVal = initValue; // 默认选中值
179
181
 
@@ -189,28 +191,27 @@ var InternalSelect = function InternalSelect(props, ref) {
189
191
  })) || {};
190
192
 
191
193
  if (options && options.length) {
192
- setSingleVal((obj === null || obj === void 0 ? void 0 : obj.label) || (obj === null || obj === void 0 ? void 0 : obj.value));
194
+ setSingleVal(getOptionLabel(obj) || (obj === null || obj === void 0 ? void 0 : obj.value));
193
195
  } else {
194
- setSingleVal((_a = obj.props) === null || _a === void 0 ? void 0 : _a.children);
196
+ // setSingleVal(obj.props?.children)
197
+ setSingleVal(getOptionLabel(obj));
195
198
  }
196
199
  } else {
197
200
  setSingleVal(undefined);
198
201
  }
199
202
  }
200
- }, [initValue, realChildren]); // 更新搜索框的值,判断清除按钮显隐
201
-
203
+ }, [initValue, realChildren]);
202
204
  useEffect(function () {
203
- var _a;
204
-
205
- setSearchInput((_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.value);
206
- }, [(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.value]);
207
- useEffect(function () {
208
- handleClear();
209
- }, [optionShow === false]);
205
+ if (optionShow === false) {
206
+ handleClear();
207
+ }
208
+ }, [optionShow]);
210
209
  var handleFocus = useCallback(function (e) {
210
+ e.stopPropagation();
211
211
  onFocus && onFocus(e);
212
212
  }, [onFocus]);
213
213
  var handleBlur = useCallback(function (e) {
214
+ e.stopPropagation();
214
215
  onBlur && onBlur(e);
215
216
  }, [onBlur]); // 点击组件
216
217
 
@@ -220,8 +221,7 @@ var InternalSelect = function InternalSelect(props, ref) {
220
221
  if (!optionShow) {
221
222
  var onDropdownVisibleChange = selectProps.onDropdownVisibleChange;
222
223
  onDropdownVisibleChange && onDropdownVisibleChange(!optionShow);
223
- } // handleClear()
224
-
224
+ }
225
225
  };
226
226
 
227
227
  useEffect(function () {
@@ -234,11 +234,63 @@ var InternalSelect = function InternalSelect(props, ref) {
234
234
  e.stopPropagation();
235
235
  }
236
236
  });
237
- }, []); // 点击下拉列表中某项回调
237
+ }, []);
238
+ useLayoutEffect(function () {
239
+ measureRef.current && setInputWidth(measureRef.current.scrollWidth);
240
+ }, [searchValue]);
241
+ var filledOptions = useMemo(function () {
242
+ if (filterOption === false || !searchValue) {
243
+ return realChildren;
244
+ }
238
245
 
239
- var handleOption = function handleOption(key, label, isSelected) {
240
- var _a, _b, _c;
246
+ var childrenList = [];
247
+
248
+ var handleFilledOption = function handleFilledOption(option) {
249
+ if (filterOption === true) {
250
+ return String(option[optionFilterProp]).toLowerCase().indexOf(searchValue.toLowerCase()) !== -1;
251
+ } else if (typeof filterOption === 'function') {
252
+ return filterOption(searchValue, option);
253
+ }
254
+
255
+ return true;
256
+ };
257
+
258
+ _mapInstanceProperty(realChildren).call(realChildren, function (item) {
259
+ if (item === null || item === undefined) return;
260
+ var isValidOption = true;
261
+
262
+ if ((item === null || item === void 0 ? void 0 : item.props) && (item.type.displayName === 'Option' || item.type.name === 'Option')) {
263
+ isValidOption = handleFilledOption(item.props);
264
+ } else {
265
+ isValidOption = handleFilledOption(item);
266
+ }
267
+
268
+ if (isValidOption) {
269
+ childrenList.push(item);
270
+ }
271
+ });
272
+
273
+ return childrenList;
274
+ }, [searchValue, realChildren, filterOption, optionFilterProp]);
275
+ var getOptionLabel = useCallback(function (obj) {
276
+ var _a;
241
277
 
278
+ if (obj.props) {
279
+ if (optionLabelProp) {
280
+ return obj === null || obj === void 0 ? void 0 : obj.props[optionLabelProp];
281
+ }
282
+
283
+ return (_a = obj.props) === null || _a === void 0 ? void 0 : _a.children;
284
+ } else {
285
+ if (optionLabelProp) {
286
+ return obj[optionLabelProp];
287
+ }
288
+ }
289
+
290
+ return obj === null || obj === void 0 ? void 0 : obj.label;
291
+ }, [optionLabelProp]); // 点击下拉列表中某项回调
292
+
293
+ var handleOption = function handleOption(key, label, isSelected) {
242
294
  var onSelect = selectProps.onSelect,
243
295
  onDeselect = selectProps.onDeselect,
244
296
  labelInValue = selectProps.labelInValue,
@@ -255,7 +307,6 @@ var InternalSelect = function InternalSelect(props, ref) {
255
307
  var optionsObj = obj.props ? obj.props : obj || {};
256
308
 
257
309
  if (value !== undefined) {
258
- // onChange && onChange(labelInValue ? { value: key, label } : key)
259
310
  if (isMultiple) {
260
311
  var _multipleRef$current = multipleRef.current,
261
312
  selectedVal = _multipleRef$current.selectedVal,
@@ -275,7 +326,8 @@ var InternalSelect = function InternalSelect(props, ref) {
275
326
  valArr.push(key);
276
327
  optsArr.push(_extends(_extends({}, optionsObj), {
277
328
  value: key,
278
- label: obj.props ? (_a = obj.props) === null || _a === void 0 ? void 0 : _a.children : obj.label || key
329
+ // label: obj.props ? obj.props?.children : obj.label || key,
330
+ label: getOptionLabel(obj) || key
279
331
  }));
280
332
  }
281
333
 
@@ -300,11 +352,10 @@ var InternalSelect = function InternalSelect(props, ref) {
300
352
  }
301
353
 
302
354
  if (!isMultiple) {
303
- setSingleVal(obj.props ? (_b = obj.props) === null || _b === void 0 ? void 0 : _b.children : obj.label || key);
355
+ setSingleVal(getOptionLabel(obj) || key);
304
356
  multipleRef.current.selectedVal = key;
305
357
  setInitValue(key);
306
- props.visible === undefined && setOptionShow(false); // handleClear()
307
-
358
+ props.visible === undefined && setOptionShow(false);
308
359
  onChange && onChange(labelInValue ? {
309
360
  value: key,
310
361
  label: label
@@ -328,10 +379,9 @@ var InternalSelect = function InternalSelect(props, ref) {
328
379
 
329
380
  _selectMulOpts.push(_extends(_extends({}, optionsObj), {
330
381
  value: key,
331
- label: obj.props ? (_c = obj.props) === null || _c === void 0 ? void 0 : _c.children : obj.label || key
382
+ label: getOptionLabel(obj) || key
332
383
  }));
333
- } // setInitValue([...selectedVal])
334
-
384
+ }
335
385
 
336
386
  setMulOptions(_toConsumableArray(_selectMulOpts));
337
387
  onChange && onChange(labelInValue ? _selectMulOpts : _selectedVal, _selectMulOpts);
@@ -339,11 +389,9 @@ var InternalSelect = function InternalSelect(props, ref) {
339
389
  if (!isSelected) {
340
390
  onDeselect && onDeselect(key); // 下拉项取消选中时调用,参数为选中项的value,多选模式下生效
341
391
  }
342
- } // if (isSelected) {
343
- // onSelect && onSelect(key) // 下拉项被选中时调用,参数为选中项value或key
344
- // }
345
-
392
+ }
346
393
 
394
+ setSearchValue('');
347
395
  onSelect && onSelect(key); // 下拉项被选中时调用,参数为选中项value或key
348
396
  }; // 多选模式下选中所有 与清除所有 (可以优化)
349
397
 
@@ -356,14 +404,13 @@ var InternalSelect = function InternalSelect(props, ref) {
356
404
  if ((realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) !== selectedVal.length) {
357
405
  _mapInstanceProperty(realChildren).call(realChildren, function (child) {
358
406
  var _ref = child.props || child,
359
- value = _ref.value,
360
- children = _ref.children;
407
+ value = _ref.value;
361
408
 
362
409
  if (!_includesInstanceProperty(selectedVal).call(selectedVal, value)) {
363
410
  selectedVal.push(value);
364
411
  selectMulOpts.push({
365
412
  value: value,
366
- label: children
413
+ label: getOptionLabel(child)
367
414
  });
368
415
  }
369
416
  });
@@ -376,45 +423,31 @@ var InternalSelect = function InternalSelect(props, ref) {
376
423
  }
377
424
 
378
425
  onChange && onChange(labelInValue ? selectMulOpts : selectedVal, selectMulOpts);
379
- }; // 筛选内容 ---可以优化,抽成hook
380
-
426
+ }; // 输入框变化搜索内容
381
427
 
382
- var handleSearch = useCallback(function (event) {
383
- var _a;
384
-
385
- if (event.currentTarget.matches('i')) {
386
- onSearch && onSearch((_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.value);
387
- }
388
- }, [onSearch]); // 输入框变化搜索内容
389
428
 
390
429
  var handleSearchChange = useCallback(function (event) {
391
430
  var val = event.currentTarget.value;
392
- clearTimeout(timer);
393
- setTimer(setTimeout(function () {
394
- onSearch && onSearch(val);
395
- }, 500));
396
- }, [onSearch, timer]); // 清除搜索内容
431
+ setSearchValue(val);
432
+ onSearch === null || onSearch === void 0 ? void 0 : onSearch(val);
433
+ }, [onSearch]); // 清除搜索内容
397
434
 
398
435
  var handleClear = useCallback(function () {
399
436
  if (searchRef.current) {
400
437
  searchRef.current.value = '';
401
- onSearch && onSearch('');
402
- setSearchInput('');
438
+ setSearchValue('');
403
439
  }
404
- }, [onSearch, searchRef]); // 清空选择器内容
440
+ }, [searchRef]); // 清空选择器内容
405
441
 
406
442
  var handleReset = function handleReset(e) {
407
- e.stopPropagation(); // setOptionShow(false)
408
- // e.nativeEvent.stopImmediatePropagation()
443
+ e.stopPropagation();
409
444
 
410
445
  if (isMultiple) {
411
446
  multipleRef.current.selectedVal = [];
412
447
  multipleRef.current.selectMulOpts = [];
413
448
  setMulOptions([]);
414
449
  } else {
415
- // setSingleVal('')
416
- setInitValue(''); // selectionRef.current.value = ''
417
- // multipleRef.current.selectedVal = ''
450
+ setInitValue('');
418
451
  }
419
452
 
420
453
  onClear && onClear('');
@@ -424,8 +457,7 @@ var InternalSelect = function InternalSelect(props, ref) {
424
457
 
425
458
  var handleRemove = function handleRemove(e) {
426
459
  if (disabled) return;
427
- var tag = e.currentTarget.parentNode.getAttribute('data-tag'); // const { tag } = e.currentTarget.dataset
428
-
460
+ var tag = e.currentTarget.parentNode.getAttribute('data-tag');
429
461
  var _multipleRef$current4 = multipleRef.current,
430
462
  selectedVal = _multipleRef$current4.selectedVal,
431
463
  selectMulOpts = _multipleRef$current4.selectMulOpts;
@@ -442,19 +474,19 @@ var InternalSelect = function InternalSelect(props, ref) {
442
474
 
443
475
 
444
476
  var renderSuffix = function renderSuffix() {
445
- var _classNames8;
477
+ var _classNames7;
446
478
 
447
479
  var suffixIcon = selectProps.suffixIcon;
448
480
  var selectedVal = multipleRef.current.selectedVal; // 选择器下拉icon样式
449
481
 
450
- var arrowIconCls = classNames((_classNames8 = {}, _defineProperty(_classNames8, "".concat(selectPrefixCls, "-icon-arrow"), true), _defineProperty(_classNames8, "".concat(selectPrefixCls, "-icon-arrow-up"), optionShow), _defineProperty(_classNames8, "".concat(selectPrefixCls, "-icon-arrow-down"), !optionShow), _defineProperty(_classNames8, "".concat(selectPrefixCls, "-icon-arrow-focus"), optionShow), _classNames8));
482
+ var arrowIconCls = classNames((_classNames7 = {}, _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow"), true), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-up"), optionShow), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-down"), !optionShow), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-focus"), optionShow), _classNames7));
451
483
  var iconShow = allowClear && !disabled && (isMultiple ? mulOptions.length > 0 : (selectedVal !== null && selectedVal !== void 0 ? selectedVal : '') !== '');
452
484
  var clearIconCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-icon-clear"), true));
453
485
  return /*#__PURE__*/React.createElement(React.Fragment, null, iconShow && /*#__PURE__*/React.createElement("span", {
454
486
  onClick: handleReset,
455
487
  className: clearIconCls
456
488
  }, /*#__PURE__*/React.createElement(Icon, {
457
- type: "close"
489
+ type: "close-solid"
458
490
  }) || clearIcon), showArrow && /*#__PURE__*/React.createElement("span", {
459
491
  className: arrowIconCls
460
492
  }, suffixIcon || /*#__PURE__*/React.createElement(Icon, {
@@ -497,30 +529,26 @@ var InternalSelect = function InternalSelect(props, ref) {
497
529
  var emptyListCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-dropdown-empty"), true));
498
530
  var notFoundContent = selectProps.notFoundContent;
499
531
  var emptyContent = notFoundContent || '暂无数据';
500
- return (realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) === 0 && /*#__PURE__*/React.createElement("div", {
532
+ return (filledOptions === null || filledOptions === void 0 ? void 0 : filledOptions.length) === 0 && /*#__PURE__*/React.createElement("div", {
501
533
  className: emptyListCls
502
534
  }, emptyContent);
503
- };
535
+ }; // const isShowSearch = useCallback(() => {
536
+ // return !showSearch ? false : !!searchValue
537
+ // }, [showSearch, searchValue])
504
538
 
505
- var isShowSearch = useCallback(function () {
506
- if (isMultiple) {
507
- return showSearch !== null && showSearch !== void 0 ? showSearch : true;
508
- }
509
539
 
510
- return showSearch !== null && showSearch !== void 0 ? showSearch : false;
511
- }, [showSearch, isMultiple]); // 渲染下拉列表框
540
+ var isShowSearch = useMemo(function () {
541
+ return isBoolean(showSearch) ? showSearch : isMultiple;
542
+ }, [isMultiple, showSearch]); // 渲染下拉列表框
512
543
 
513
544
  var renderContent = function renderContent() {
514
- var _a;
515
-
516
- var searchIcon = selectProps.searchIcon,
517
- dropdownRender = selectProps.dropdownRender,
545
+ var dropdownRender = selectProps.dropdownRender,
518
546
  listHeight = selectProps.listHeight;
519
547
  var selectedVal = multipleRef.current.selectedVal;
520
- var childrenToRender = realChildren;
548
+ var childrenToRender = filledOptions;
521
549
 
522
- if (Array.isArray(realChildren) && realChildren.length > 0) {
523
- childrenToRender = _mapInstanceProperty(realChildren).call(realChildren, function (item, index) {
550
+ if (Array.isArray(childrenToRender) && childrenToRender.length > 0) {
551
+ childrenToRender = _mapInstanceProperty(childrenToRender).call(childrenToRender, function (item, index) {
524
552
  if (item === null || item === undefined) return;
525
553
  var temp = renderOption(item, index);
526
554
  return temp;
@@ -545,26 +573,7 @@ var InternalSelect = function InternalSelect(props, ref) {
545
573
  className: dropDownCls,
546
574
  style: dropDownStyle,
547
575
  ref: dropDownRef
548
- }, isShowSearch() && /*#__PURE__*/React.createElement("div", {
549
- className: searchCls
550
- }, /*#__PURE__*/React.createElement(Input, {
551
- ref: searchRef,
552
- value: ((_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.value) || '',
553
- borderType: "bordered",
554
- placeholder: "\u8BF7\u8F93\u5165\u9700\u8981\u641C\u7D22\u7684\u5185\u5BB9",
555
- // 搜索图标
556
- prefix: /*#__PURE__*/React.createElement("span", {
557
- onClick: handleSearch
558
- }, /*#__PURE__*/React.createElement(Icon, {
559
- type: "search"
560
- }) || searchIcon),
561
- suffix: searchInput && /*#__PURE__*/React.createElement("span", {
562
- onClick: handleClear
563
- }, /*#__PURE__*/React.createElement(Icon, {
564
- type: "close"
565
- })),
566
- onChange: handleSearchChange
567
- })), !dropdownRender && realChildren.length > 0 && dropRender(childrenToRender, heightStyle), renderNotContent(), /*#__PURE__*/React.createElement("div", null, dropdownRender && dropdownRender(dropRender(childrenToRender, heightStyle))), isMultiple && /*#__PURE__*/React.createElement("div", {
576
+ }, !dropdownRender && childrenToRender.length > 0 && dropRender(childrenToRender, heightStyle), renderNotContent(), /*#__PURE__*/React.createElement("div", null, dropdownRender && dropdownRender(dropRender(childrenToRender, heightStyle))), isMultiple && /*#__PURE__*/React.createElement("div", {
568
577
  className: multipleFooterCls
569
578
  }, /*#__PURE__*/React.createElement(Checkbox, {
570
579
  style: checkboxStyle,
@@ -598,15 +607,43 @@ var InternalSelect = function InternalSelect(props, ref) {
598
607
  disabled: disabled
599
608
  }, maxTagPlaceholder);
600
609
  }
601
- }, [mulOptions]); // 渲染多选选择器 (待优化:多选框下拉按钮样式调整,限制tag数代码优化)
610
+ }, [mulOptions]);
611
+
612
+ var renderSingle = function renderSingle() {
613
+ var hiddenStyle = isShowSearch && !!searchValue || singleVal ? {
614
+ visibility: 'hidden'
615
+ } : undefined;
616
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
617
+ className: singleCls,
618
+ ref: selectionRef
619
+ }, /*#__PURE__*/React.createElement("span", {
620
+ className: "".concat(selectPrefixCls, "-selection-search")
621
+ }, /*#__PURE__*/React.createElement("input", {
622
+ ref: searchRef,
623
+ value: searchValue,
624
+ className: "".concat(selectPrefixCls, "-selection-search-input"),
625
+ onChange: handleSearchChange,
626
+ onFocus: handleFocus,
627
+ onBlur: handleBlur,
628
+ readOnly: !isShowSearch || !!disabled
629
+ })), singleVal && !searchValue && /*#__PURE__*/React.createElement("span", {
630
+ className: "".concat(selectPrefixCls, "-selection-item")
631
+ }, singleVal), /*#__PURE__*/React.createElement("span", {
632
+ className: "".concat(selectPrefixCls, "-placeholder"),
633
+ style: hiddenStyle
634
+ }, placeholder), /*#__PURE__*/React.createElement("span", {
635
+ className: "".concat(selectPrefixCls, "-suffix")
636
+ }, renderSuffix())));
637
+ }; // 渲染多选选择器 (待优化:多选框下拉按钮样式调整,限制tag数代码优化)
638
+
602
639
 
603
640
  var renderMultiple = function renderMultiple() {
604
- var _context3, _classNames11, _context4, _classNames12;
641
+ var _context3, _classNames10, _context4, _classNames11;
605
642
 
606
643
  var maxTagCount = selectProps.maxTagCount,
607
644
  maxTagPlaceholder = selectProps.maxTagPlaceholder;
608
- var multipleCls = classNames(commCls, (_classNames11 = {}, _defineProperty(_classNames11, "".concat(selectPrefixCls, "-multiple-disabled"), disabled), _defineProperty(_classNames11, _concatInstanceProperty(_context3 = "".concat(selectPrefixCls, "-")).call(_context3, mode), mode), _defineProperty(_classNames11, "".concat(selectPrefixCls, "-focused"), autoFocus || optionShow), _defineProperty(_classNames11, "".concat(selectPrefixCls, "-placeholder"), placeholder && !mulOptions.length), _classNames11));
609
- var itemCls = classNames((_classNames12 = {}, _defineProperty(_classNames12, "".concat(selectPrefixCls, "-selection-item"), true), _defineProperty(_classNames12, _concatInstanceProperty(_context4 = "".concat(selectPrefixCls, "-selection-item-")).call(_context4, size), size), _classNames12));
645
+ 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));
646
+ 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
647
  var TagStyle = {
611
648
  margin: '2px 8px 2px 0'
612
649
  };
@@ -632,14 +669,29 @@ var InternalSelect = function InternalSelect(props, ref) {
632
669
  }, /*#__PURE__*/React.createElement("span", {
633
670
  className: "".concat(selectPrefixCls, "-selection-item-content")
634
671
  }, "\u5171", mulOptions.length, "\u9879")) : null), /*#__PURE__*/React.createElement("span", {
672
+ className: "".concat(selectPrefixCls, "-selection-search"),
673
+ style: {
674
+ width: inputWidth
675
+ }
676
+ }, /*#__PURE__*/React.createElement("input", {
677
+ ref: searchRef,
678
+ value: searchValue,
679
+ className: "".concat(selectPrefixCls, "-selection-search-input"),
680
+ onChange: handleSearchChange,
681
+ onFocus: handleFocus,
682
+ onBlur: handleBlur,
683
+ readOnly: !isShowSearch || !!disabled
684
+ }), /*#__PURE__*/React.createElement("span", {
685
+ ref: measureRef,
686
+ className: "".concat(selectPrefixCls, "-selection-search-mirror")
687
+ }, searchValue, "\xA0")), /*#__PURE__*/React.createElement("span", {
635
688
  className: "".concat(selectPrefixCls, "-placeholder")
636
- }, !mulOptions.length && placeholder), /*#__PURE__*/React.createElement("span", {
689
+ }, !mulOptions.length && !searchValue && placeholder), /*#__PURE__*/React.createElement("span", {
637
690
  className: "".concat(selectPrefixCls, "-suffix")
638
691
  }, renderSuffix()));
639
692
  };
640
693
 
641
- var singleCls = classNames(commCls, (_classNames13 = {}, _defineProperty(_classNames13, "".concat(selectPrefixCls, "-single"), true), _defineProperty(_classNames13, "".concat(selectPrefixCls, "-single-disabled"), disabled), _defineProperty(_classNames13, "".concat(selectPrefixCls, "-single-focused"), autoFocus && !disabled || optionShow), _classNames13));
642
- var singleTextCls = classNames((_classNames14 = {}, _defineProperty(_classNames14, "".concat(selectPrefixCls, "-single-text"), true), _defineProperty(_classNames14, "".concat(selectPrefixCls, "-single-disabled-text"), disabled), _classNames14));
694
+ 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));
643
695
 
644
696
  var renderSelect = function renderSelect() {
645
697
  return /*#__PURE__*/React.createElement("div", {
@@ -649,18 +701,18 @@ var InternalSelect = function InternalSelect(props, ref) {
649
701
  }, /*#__PURE__*/React.createElement("span", {
650
702
  className: selectionCls,
651
703
  onClick: handleClick,
652
- onFocus: handleFocus,
653
- onBlur: handleBlur
654
- }, !isMultiple ? /*#__PURE__*/React.createElement("div", {
655
- className: singleCls,
656
- ref: selectionRef
657
- }, /*#__PURE__*/React.createElement("span", {
658
- className: singleTextCls
659
- }, singleVal || null), /*#__PURE__*/React.createElement("span", {
660
- className: "".concat(selectPrefixCls, "-placeholder")
661
- }, !singleVal && placeholder), /*#__PURE__*/React.createElement("span", {
662
- className: "".concat(selectPrefixCls, "-suffix")
663
- }, renderSuffix())) : renderMultiple()));
704
+ tabIndex: disabled ? -1 : 0,
705
+ onFocus: function onFocus() {
706
+ var _a;
707
+
708
+ return (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
709
+ },
710
+ onBlur: function onBlur() {
711
+ var _a;
712
+
713
+ return (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.blur();
714
+ }
715
+ }, !isMultiple ? renderSingle() : renderMultiple()));
664
716
  };
665
717
 
666
718
  var catchStyle = function catchStyle() {