@kdcloudjs/kdesign 1.7.64 → 1.7.66

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.
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
3
3
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
4
4
  import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
5
- import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
6
5
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
7
6
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
7
+ import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
8
8
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
9
9
  import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
10
10
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
@@ -17,6 +17,7 @@ import { getCompProps } from '../_utils';
17
17
  import { Input, Icon, Tabs, Empty, Spin, Checkbox } from '../index';
18
18
  import usePopper from '../_utils/usePopper';
19
19
  var InternalBaseData = function InternalBaseData(props, ref) {
20
+ var _context2;
20
21
  var _useContext = useContext(ConfigContext),
21
22
  getPrefixCls = _useContext.getPrefixCls,
22
23
  prefixCls = _useContext.prefixCls,
@@ -102,8 +103,12 @@ var InternalBaseData = function InternalBaseData(props, ref) {
102
103
  }, [seletedOptions]);
103
104
  // 记录每个选项的开始与结束下标
104
105
  var setValIndxPosition = useCallback(function () {
106
+ var _context;
107
+ var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
105
108
  var arr = [];
106
- inputValue.split(delimiter).reduce(function (pre, next) {
109
+ _filterInstanceProperty(_context = (str || inputValue).split(delimiter)).call(_context, function (item) {
110
+ return !!item;
111
+ }).reduce(function (pre, next) {
107
112
  arr.push({
108
113
  start: pre,
109
114
  end: pre + next.length
@@ -112,6 +117,13 @@ var InternalBaseData = function InternalBaseData(props, ref) {
112
117
  }, 0);
113
118
  return arr;
114
119
  }, [delimiter, inputValue]);
120
+ var initInputValue = _filterInstanceProperty(_context2 = searchInfo.current.editOptions || []).call(_context2, function (item) {
121
+ return !!item;
122
+ }).reduce(function (pre, next, index, arr) {
123
+ var _context3, _context4;
124
+ return _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "".concat(pre)).call(_context4, next[optionLabelProp])).call(_context3, index !== arr.length - 1 ? delimiter : '');
125
+ }, '');
126
+ var initIndexPos = setValIndxPosition(initInputValue);
115
127
  useEffect(function () {
116
128
  var list = setValIndxPosition();
117
129
  setIndxPosList(list);
@@ -141,7 +153,6 @@ var InternalBaseData = function InternalBaseData(props, ref) {
141
153
  // 新增一个
142
154
  var list = _toConsumableArray(searchInfo.current.editOptions || []);
143
155
  if (valueArr.length - preValueArr.length === 1) {
144
- searchInfo.current.deleteEndIndx = index;
145
156
  _spliceInstanceProperty(list).call(list, index, 0, null);
146
157
  }
147
158
  if (valueArr.length < preValueArr.length) {
@@ -158,15 +169,26 @@ var InternalBaseData = function InternalBaseData(props, ref) {
158
169
  end = _findDeleteInterval.end;
159
170
  list === null || list === void 0 ? void 0 : _spliceInstanceProperty(list).call(list, start, end - start + 1);
160
171
  }
172
+ // 判断每次单个按del键时删除了分隔符后下一次触发
173
+ if (searchInfo.current.deleteEndIndx > 0 && selectionStart !== searchInfo.current.deleteEndIndx) {
174
+ var _findDeleteInterval2 = findDeleteInterval(selectionStart, searchInfo.current.deleteEndIndx, initIndexPos),
175
+ _start = _findDeleteInterval2.start,
176
+ _end = _findDeleteInterval2.end;
177
+ // 单个删除时找到合理的下标触发
178
+ if (_start !== null && _end !== null && _start <= _end) {
179
+ list === null || list === void 0 ? void 0 : _spliceInstanceProperty(list).call(list, _start, _end - _start + 1);
180
+ searchInfo.current.deleteEndIndx = 0;
181
+ }
182
+ }
161
183
  searchInfo.current.editOptions = list;
162
184
  searchInfo.current.previousEditValue = inputValue;
163
185
  // eslint-disable-next-line react-hooks/exhaustive-deps
164
186
  }, [delimiter, inputValue, isMultiple, setValIndxPosition]);
165
187
  var getStrToArr = function getStrToArr() {
166
- var _context;
188
+ var _context5;
167
189
  var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
168
190
  var delimiter = arguments.length > 1 ? arguments[1] : undefined;
169
- return _filterInstanceProperty(_context = str.split(delimiter)).call(_context, function (item) {
191
+ return _filterInstanceProperty(_context5 = str.split(delimiter)).call(_context5, function (item) {
170
192
  return item;
171
193
  });
172
194
  };
@@ -183,26 +205,37 @@ var InternalBaseData = function InternalBaseData(props, ref) {
183
205
  }, [inputRef, inputValue]);
184
206
  // 通过选中项显示input文字, optionLabelProp为回填到选择框的属性
185
207
  var setValueBySeleted = useCallback(function () {
186
- var _context4;
208
+ var _context8;
187
209
  var defaultInputValue = seletedOptions.reduce(function (pre, next, index, arr) {
188
- var _context2, _context3;
189
- return _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "".concat(pre)).call(_context3, next[optionLabelProp])).call(_context2, index !== arr.length - 1 ? delimiter : '');
210
+ var _context6, _context7;
211
+ return _concatInstanceProperty(_context6 = _concatInstanceProperty(_context7 = "".concat(pre)).call(_context7, next[optionLabelProp])).call(_context6, index !== arr.length - 1 ? delimiter : '');
190
212
  }, '');
191
213
  searchInfo.current.previousInputValue = defaultInputValue;
192
214
  setInputValue(defaultInputValue);
193
- searchInfo.current.previousEditValue = _concatInstanceProperty(_context4 = "".concat(defaultInputValue)).call(_context4, delimiter);
215
+ searchInfo.current.previousEditValue = _concatInstanceProperty(_context8 = "".concat(defaultInputValue)).call(_context8, delimiter);
194
216
  }, [delimiter, optionLabelProp, seletedOptions]);
195
217
  useEffect(function () {
196
218
  setValueBySeleted();
197
219
  }, [setValueBySeleted]);
220
+ var findDeletedChar = function findDeletedChar(prev, current) {
221
+ if (prev.length > current.length) {
222
+ for (var i = 0; i < prev.length; i++) {
223
+ if (prev[i] !== current[i]) {
224
+ return prev[i];
225
+ }
226
+ }
227
+ return prev[prev.length - 1];
228
+ }
229
+ return null;
230
+ };
198
231
  var changeInputText = function changeInputText(e) {
199
232
  var _a;
200
233
  setOptionShow(true);
201
234
  var textValue = e.target.value;
202
235
  var val = textValue;
203
236
  var inputDom = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input;
237
+ var selectionStart = inputDom.selectionStart || 0; // selectionStart: 光标前面有几个字符
204
238
  if (isMultiple && inputDom && textValue && textValue.length > inputValue.length) {
205
- var selectionStart = inputDom.selectionStart || 0; // selectionStart: 光标前面有几个字符
206
239
  searchInfo.current.selectionStart = selectionStart;
207
240
  var isInHead = selectionStart === 1 && textValue[1] !== delimiter && textValue.length !== 1; // 在首部添加
208
241
  var isInMid = selectionStart !== textValue.length && textValue[selectionStart - 2] === delimiter && textValue[selectionStart] !== delimiter;
@@ -211,6 +244,10 @@ var InternalBaseData = function InternalBaseData(props, ref) {
211
244
  setCursorPosition(inputDom, selectionStart);
212
245
  }
213
246
  }
247
+ // 单个删除时 当删除的字符为分隔符delimiter 记录位置
248
+ if (findDeletedChar(searchInfo.current.previousEditValue || '', textValue) === delimiter) {
249
+ searchInfo.current.deleteEndIndx = selectionStart;
250
+ }
214
251
  setInputValue(val);
215
252
  handleChange(val);
216
253
  };
@@ -239,26 +276,26 @@ var InternalBaseData = function InternalBaseData(props, ref) {
239
276
  return queryStr;
240
277
  };
241
278
  var handleFocus = function handleFocus() {
242
- var _context5;
279
+ var _context9;
243
280
  if (disabled) return;
244
281
  setFocused(true);
245
- isMultiple && seletedOptions.length && setInputValue(_concatInstanceProperty(_context5 = "".concat(inputValue)).call(_context5, delimiter));
282
+ isMultiple && seletedOptions.length && setInputValue(_concatInstanceProperty(_context9 = "".concat(inputValue)).call(_context9, delimiter));
246
283
  };
247
284
  var handleBlur = function handleBlur() {
248
- var _context6, _context7;
285
+ var _context10, _context11;
249
286
  if (disabled) return;
250
287
  setFocused(false);
251
288
  setInputValue(searchInfo.current.previousInputValue);
252
- searchInfo.current.previousEditValue = _concatInstanceProperty(_context6 = "".concat(searchInfo.current.previousInputValue)).call(_context6, delimiter);
289
+ searchInfo.current.previousEditValue = _concatInstanceProperty(_context10 = "".concat(searchInfo.current.previousInputValue)).call(_context10, delimiter);
253
290
  // 多选失去焦点时,通过editOptions去改写选中项
254
- var list = _filterInstanceProperty(_context7 = searchInfo.current.editOptions || []).call(_context7, function (item) {
291
+ var list = _filterInstanceProperty(_context11 = searchInfo.current.editOptions || []).call(_context11, function (item) {
255
292
  return item;
256
293
  }) || [];
257
294
  if (_JSON$stringify(list) !== _JSON$stringify(seletedOptions)) {
258
- var _context8;
259
- onChange === null || onChange === void 0 ? void 0 : onChange(_mapInstanceProperty(_context8 = _filterInstanceProperty(list).call(list, function (item) {
295
+ var _context12;
296
+ onChange === null || onChange === void 0 ? void 0 : onChange(_mapInstanceProperty(_context12 = _filterInstanceProperty(list).call(list, function (item) {
260
297
  return item;
261
- })).call(_context8, function (v) {
298
+ })).call(_context12, function (v) {
262
299
  return v.value;
263
300
  }), _filterInstanceProperty(list).call(list, function (item) {
264
301
  return item;
@@ -356,20 +393,20 @@ var InternalBaseData = function InternalBaseData(props, ref) {
356
393
  element.setSelectionRange(start, end);
357
394
  };
358
395
  var handleSelect = function handleSelect(item) {
359
- var _context13;
396
+ var _context17;
360
397
  searchInfo.current.searchValue = undefined;
361
398
  if (_findIndexInstanceProperty(seletedOptions).call(seletedOptions, function (v) {
362
399
  return v.value === item.value;
363
400
  }) !== -1) {
364
- var _context9;
401
+ var _context13;
365
402
  var _list = _filterInstanceProperty(seletedOptions).call(seletedOptions, function (v) {
366
403
  return v.value !== item.value;
367
404
  });
368
405
  // 取消选中(非受控状态下)
369
406
  isMultiple && value === undefined && setSeletedOptions(_list);
370
- onChange === null || onChange === void 0 ? void 0 : onChange(_mapInstanceProperty(_context9 = _filterInstanceProperty(_list).call(_list, function (item) {
407
+ onChange === null || onChange === void 0 ? void 0 : onChange(_mapInstanceProperty(_context13 = _filterInstanceProperty(_list).call(_list, function (item) {
371
408
  return item;
372
- })).call(_context9, function (v) {
409
+ })).call(_context13, function (v) {
373
410
  return v.value;
374
411
  }), _filterInstanceProperty(_list).call(_list, function (item) {
375
412
  return item;
@@ -379,12 +416,12 @@ var InternalBaseData = function InternalBaseData(props, ref) {
379
416
  var list = _toConsumableArray(searchInfo.current.editOptions || []);
380
417
  list === null || list === void 0 ? void 0 : _spliceInstanceProperty(list).call(list, searchInfo.current.searchIndex || 0, 1, item);
381
418
  if (isMultiple) {
382
- var _context10, _context11, _context12;
383
- onChange === null || onChange === void 0 ? void 0 : onChange(_mapInstanceProperty(_context10 = _filterInstanceProperty(_context11 = list || []).call(_context11, function (item) {
419
+ var _context14, _context15, _context16;
420
+ onChange === null || onChange === void 0 ? void 0 : onChange(_mapInstanceProperty(_context14 = _filterInstanceProperty(_context15 = list || []).call(_context15, function (item) {
384
421
  return item;
385
- })).call(_context10, function (v) {
422
+ })).call(_context14, function (v) {
386
423
  return v.value;
387
- }), _filterInstanceProperty(_context12 = list || []).call(_context12, function (item) {
424
+ }), _filterInstanceProperty(_context16 = list || []).call(_context16, function (item) {
388
425
  return item;
389
426
  }));
390
427
  } else {
@@ -395,7 +432,7 @@ var InternalBaseData = function InternalBaseData(props, ref) {
395
432
  return;
396
433
  }
397
434
  searchInfo.current.editOptions = list;
398
- setSeletedOptions(_filterInstanceProperty(_context13 = list || []).call(_context13, function (item) {
435
+ setSeletedOptions(_filterInstanceProperty(_context17 = list || []).call(_context17, function (item) {
399
436
  return item;
400
437
  }));
401
438
  };
@@ -471,10 +508,10 @@ var InternalBaseData = function InternalBaseData(props, ref) {
471
508
  * @returns {React.ReactNode}
472
509
  */
473
510
  var renderDropdownContent = function renderDropdownContent(data, myColumns) {
474
- var _context14;
511
+ var _context18;
475
512
  var showFooter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
476
513
  var showCheckbox = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
477
- var dropDownColumns = myColumns && Array.isArray(myColumns) ? myColumns : data && Array.isArray(data) && data.length ? _mapInstanceProperty(_context14 = _Object$keys(data[0])).call(_context14, function (v) {
514
+ var dropDownColumns = myColumns && Array.isArray(myColumns) ? myColumns : data && Array.isArray(data) && data.length ? _mapInstanceProperty(_context18 = _Object$keys(data[0])).call(_context18, function (v) {
478
515
  return {
479
516
  key: v
480
517
  };
@@ -52,6 +52,6 @@ export interface ISearchInfoProps {
52
52
  previousEditValue?: string;
53
53
  searchIndex?: number;
54
54
  selectionStart?: number;
55
- deleteEndIndx?: number;
55
+ deleteEndIndx: number;
56
56
  editOptions?: any[];
57
57
  }
@@ -16,8 +16,8 @@
16
16
  @modal-theme-color-active: var(~'@{modal-prefix}-color-theme-active', @color-theme-7);
17
17
  @modal-mask-color-background: var(~'@{modal-prefix}-mask-color-background', rgba(55, 55, 55, 0.5));
18
18
  @modal-close-icon-color-text: var(~'@{modal-prefix}-close-icon-color-text', #666666);
19
- @confirm-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-ongoing', @color-ongoing); // 提示弹窗的背景色
20
- @warning-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-warning', @color-warning); // 警告弹窗的背景色
19
+ @confirm-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-ongoing', @color-ongoing); // 弹出框的背景色
20
+ @warning-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-warning', @color-warning); // 警告弹出框的背景色
21
21
  @error-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-warning', @color-warning); // 反馈浮层错误提示的背景色
22
22
 
23
23
  // z-index
@@ -46,4 +46,4 @@
46
46
  @modal-title-icon-sizing-margin-right: var(~'@{modal-prefix}-title-icon-sizing-margin-right', 8px);
47
47
  @modal-header-sizing-padding-horizontal: var(~'@{modal-prefix}-header-sizing-padding-horizontal', 20px);
48
48
  @modal-header-sizing-padding-vertical: var(~'@{modal-prefix}-header-sizing-padding-vertical', 0px);
49
- @modal-body-sizing-padding: var(~'@{modal-prefix}-body-sizing-padding', 20px);
49
+ @modal-body-sizing-padding: var(~'@{modal-prefix}-body-sizing-padding', 20px);
@@ -523,8 +523,8 @@
523
523
  /* ----------- Split-Panel ——————---- end */
524
524
 
525
525
  /* ----------- Modal ——————---- start */
526
- @confirm-modal-title-icon-bg: @ongoing-bg-color; // 提示弹窗的背景色
527
- @warning-modal-title-icon-bg: @warning-bg-color; // 警告弹窗的背景色
526
+ @confirm-modal-title-icon-bg: @ongoing-bg-color; // 弹出框的背景色
527
+ @warning-modal-title-icon-bg: @warning-bg-color; // 警告弹出框的背景色
528
528
  @error-modal-title-icon-bg: @error-bg-color; // 反馈浮层错误提示的背景色
529
529
  @modal-border-color: @strong-border-color-1;
530
530
  /* ----------- Modal ——————---- end */
@@ -706,4 +706,4 @@
706
706
  @advancedSelector-dropdown-options-height: 32px;
707
707
  @advancedSelector-hover-bg: @hover-color;
708
708
 
709
- /* ----------- AdvancedSelector ——————---- end */
709
+ /* ----------- AdvancedSelector ——————---- end */
package/es/tree/tree.js CHANGED
@@ -162,7 +162,7 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
162
162
  return getFilterData(spreadAttrData, filterTreeNode, isSearching, posData, keysData, expandOnFilterNode);
163
163
  }, [spreadAttrData, isSearching, posData, keysData, filterValue, expandOnFilterNode]);
164
164
  useEffect(function () {
165
- var _a, _b;
165
+ var _a;
166
166
  if (typeof scrollKey === 'undefined') {
167
167
  return;
168
168
  }
@@ -174,12 +174,15 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
174
174
  }
175
175
  }
176
176
  if (virtual) {
177
- (_a = virtualListRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
178
- index: scrollIndex
177
+ requestAnimationFrame(function () {
178
+ var _a;
179
+ return (_a = virtualListRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
180
+ index: scrollIndex
181
+ });
179
182
  });
180
183
  } else {
181
184
  var wrapperDom = scrollRef.current;
182
- var node = wrapperDom ? (_b = wrapperDom === null || wrapperDom === void 0 ? void 0 : wrapperDom.children[0]) === null || _b === void 0 ? void 0 : _b.children[scrollIndex] : null;
185
+ var node = wrapperDom ? (_a = wrapperDom === null || wrapperDom === void 0 ? void 0 : wrapperDom.children[0]) === null || _a === void 0 ? void 0 : _a.children[scrollIndex] : null;
183
186
  if (node && wrapperDom) {
184
187
  var containerHeight = wrapperDom.clientHeight;
185
188
  var targetHeight = node.clientHeight;
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
  exports.default = void 0;
11
- var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
12
11
  var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
13
12
  var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
13
+ var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
14
14
  var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
15
15
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
16
16
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
@@ -29,6 +29,7 @@ var _usePopper = _interopRequireDefault(require("../_utils/usePopper"));
29
29
  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); }
30
30
  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; }
31
31
  var InternalBaseData = function InternalBaseData(props, ref) {
32
+ var _context2;
32
33
  var _useContext = (0, _react.useContext)(_ConfigContext.default),
33
34
  getPrefixCls = _useContext.getPrefixCls,
34
35
  prefixCls = _useContext.prefixCls,
@@ -114,8 +115,12 @@ var InternalBaseData = function InternalBaseData(props, ref) {
114
115
  }, [seletedOptions]);
115
116
  // 记录每个选项的开始与结束下标
116
117
  var setValIndxPosition = (0, _react.useCallback)(function () {
118
+ var _context;
119
+ var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
117
120
  var arr = [];
118
- inputValue.split(delimiter).reduce(function (pre, next) {
121
+ (0, _filter.default)(_context = (str || inputValue).split(delimiter)).call(_context, function (item) {
122
+ return !!item;
123
+ }).reduce(function (pre, next) {
119
124
  arr.push({
120
125
  start: pre,
121
126
  end: pre + next.length
@@ -124,6 +129,13 @@ var InternalBaseData = function InternalBaseData(props, ref) {
124
129
  }, 0);
125
130
  return arr;
126
131
  }, [delimiter, inputValue]);
132
+ var initInputValue = (0, _filter.default)(_context2 = searchInfo.current.editOptions || []).call(_context2, function (item) {
133
+ return !!item;
134
+ }).reduce(function (pre, next, index, arr) {
135
+ var _context3, _context4;
136
+ return (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(pre)).call(_context4, next[optionLabelProp])).call(_context3, index !== arr.length - 1 ? delimiter : '');
137
+ }, '');
138
+ var initIndexPos = setValIndxPosition(initInputValue);
127
139
  (0, _react.useEffect)(function () {
128
140
  var list = setValIndxPosition();
129
141
  setIndxPosList(list);
@@ -153,7 +165,6 @@ var InternalBaseData = function InternalBaseData(props, ref) {
153
165
  // 新增一个
154
166
  var list = (0, _toConsumableArray2.default)(searchInfo.current.editOptions || []);
155
167
  if (valueArr.length - preValueArr.length === 1) {
156
- searchInfo.current.deleteEndIndx = index;
157
168
  (0, _splice.default)(list).call(list, index, 0, null);
158
169
  }
159
170
  if (valueArr.length < preValueArr.length) {
@@ -170,15 +181,26 @@ var InternalBaseData = function InternalBaseData(props, ref) {
170
181
  end = _findDeleteInterval.end;
171
182
  list === null || list === void 0 ? void 0 : (0, _splice.default)(list).call(list, start, end - start + 1);
172
183
  }
184
+ // 判断每次单个按del键时删除了分隔符后下一次触发
185
+ if (searchInfo.current.deleteEndIndx > 0 && selectionStart !== searchInfo.current.deleteEndIndx) {
186
+ var _findDeleteInterval2 = findDeleteInterval(selectionStart, searchInfo.current.deleteEndIndx, initIndexPos),
187
+ _start = _findDeleteInterval2.start,
188
+ _end = _findDeleteInterval2.end;
189
+ // 单个删除时找到合理的下标触发
190
+ if (_start !== null && _end !== null && _start <= _end) {
191
+ list === null || list === void 0 ? void 0 : (0, _splice.default)(list).call(list, _start, _end - _start + 1);
192
+ searchInfo.current.deleteEndIndx = 0;
193
+ }
194
+ }
173
195
  searchInfo.current.editOptions = list;
174
196
  searchInfo.current.previousEditValue = inputValue;
175
197
  // eslint-disable-next-line react-hooks/exhaustive-deps
176
198
  }, [delimiter, inputValue, isMultiple, setValIndxPosition]);
177
199
  var getStrToArr = function getStrToArr() {
178
- var _context;
200
+ var _context5;
179
201
  var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
180
202
  var delimiter = arguments.length > 1 ? arguments[1] : undefined;
181
- return (0, _filter.default)(_context = str.split(delimiter)).call(_context, function (item) {
203
+ return (0, _filter.default)(_context5 = str.split(delimiter)).call(_context5, function (item) {
182
204
  return item;
183
205
  });
184
206
  };
@@ -195,26 +217,37 @@ var InternalBaseData = function InternalBaseData(props, ref) {
195
217
  }, [inputRef, inputValue]);
196
218
  // 通过选中项显示input文字, optionLabelProp为回填到选择框的属性
197
219
  var setValueBySeleted = (0, _react.useCallback)(function () {
198
- var _context4;
220
+ var _context8;
199
221
  var defaultInputValue = seletedOptions.reduce(function (pre, next, index, arr) {
200
- var _context2, _context3;
201
- return (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = "".concat(pre)).call(_context3, next[optionLabelProp])).call(_context2, index !== arr.length - 1 ? delimiter : '');
222
+ var _context6, _context7;
223
+ return (0, _concat.default)(_context6 = (0, _concat.default)(_context7 = "".concat(pre)).call(_context7, next[optionLabelProp])).call(_context6, index !== arr.length - 1 ? delimiter : '');
202
224
  }, '');
203
225
  searchInfo.current.previousInputValue = defaultInputValue;
204
226
  setInputValue(defaultInputValue);
205
- searchInfo.current.previousEditValue = (0, _concat.default)(_context4 = "".concat(defaultInputValue)).call(_context4, delimiter);
227
+ searchInfo.current.previousEditValue = (0, _concat.default)(_context8 = "".concat(defaultInputValue)).call(_context8, delimiter);
206
228
  }, [delimiter, optionLabelProp, seletedOptions]);
207
229
  (0, _react.useEffect)(function () {
208
230
  setValueBySeleted();
209
231
  }, [setValueBySeleted]);
232
+ var findDeletedChar = function findDeletedChar(prev, current) {
233
+ if (prev.length > current.length) {
234
+ for (var i = 0; i < prev.length; i++) {
235
+ if (prev[i] !== current[i]) {
236
+ return prev[i];
237
+ }
238
+ }
239
+ return prev[prev.length - 1];
240
+ }
241
+ return null;
242
+ };
210
243
  var changeInputText = function changeInputText(e) {
211
244
  var _a;
212
245
  setOptionShow(true);
213
246
  var textValue = e.target.value;
214
247
  var val = textValue;
215
248
  var inputDom = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input;
249
+ var selectionStart = inputDom.selectionStart || 0; // selectionStart: 光标前面有几个字符
216
250
  if (isMultiple && inputDom && textValue && textValue.length > inputValue.length) {
217
- var selectionStart = inputDom.selectionStart || 0; // selectionStart: 光标前面有几个字符
218
251
  searchInfo.current.selectionStart = selectionStart;
219
252
  var isInHead = selectionStart === 1 && textValue[1] !== delimiter && textValue.length !== 1; // 在首部添加
220
253
  var isInMid = selectionStart !== textValue.length && textValue[selectionStart - 2] === delimiter && textValue[selectionStart] !== delimiter;
@@ -223,6 +256,10 @@ var InternalBaseData = function InternalBaseData(props, ref) {
223
256
  setCursorPosition(inputDom, selectionStart);
224
257
  }
225
258
  }
259
+ // 单个删除时 当删除的字符为分隔符delimiter 记录位置
260
+ if (findDeletedChar(searchInfo.current.previousEditValue || '', textValue) === delimiter) {
261
+ searchInfo.current.deleteEndIndx = selectionStart;
262
+ }
226
263
  setInputValue(val);
227
264
  handleChange(val);
228
265
  };
@@ -251,26 +288,26 @@ var InternalBaseData = function InternalBaseData(props, ref) {
251
288
  return queryStr;
252
289
  };
253
290
  var handleFocus = function handleFocus() {
254
- var _context5;
291
+ var _context9;
255
292
  if (disabled) return;
256
293
  setFocused(true);
257
- isMultiple && seletedOptions.length && setInputValue((0, _concat.default)(_context5 = "".concat(inputValue)).call(_context5, delimiter));
294
+ isMultiple && seletedOptions.length && setInputValue((0, _concat.default)(_context9 = "".concat(inputValue)).call(_context9, delimiter));
258
295
  };
259
296
  var handleBlur = function handleBlur() {
260
- var _context6, _context7;
297
+ var _context10, _context11;
261
298
  if (disabled) return;
262
299
  setFocused(false);
263
300
  setInputValue(searchInfo.current.previousInputValue);
264
- searchInfo.current.previousEditValue = (0, _concat.default)(_context6 = "".concat(searchInfo.current.previousInputValue)).call(_context6, delimiter);
301
+ searchInfo.current.previousEditValue = (0, _concat.default)(_context10 = "".concat(searchInfo.current.previousInputValue)).call(_context10, delimiter);
265
302
  // 多选失去焦点时,通过editOptions去改写选中项
266
- var list = (0, _filter.default)(_context7 = searchInfo.current.editOptions || []).call(_context7, function (item) {
303
+ var list = (0, _filter.default)(_context11 = searchInfo.current.editOptions || []).call(_context11, function (item) {
267
304
  return item;
268
305
  }) || [];
269
306
  if ((0, _stringify.default)(list) !== (0, _stringify.default)(seletedOptions)) {
270
- var _context8;
271
- onChange === null || onChange === void 0 ? void 0 : onChange((0, _map.default)(_context8 = (0, _filter.default)(list).call(list, function (item) {
307
+ var _context12;
308
+ onChange === null || onChange === void 0 ? void 0 : onChange((0, _map.default)(_context12 = (0, _filter.default)(list).call(list, function (item) {
272
309
  return item;
273
- })).call(_context8, function (v) {
310
+ })).call(_context12, function (v) {
274
311
  return v.value;
275
312
  }), (0, _filter.default)(list).call(list, function (item) {
276
313
  return item;
@@ -368,20 +405,20 @@ var InternalBaseData = function InternalBaseData(props, ref) {
368
405
  element.setSelectionRange(start, end);
369
406
  };
370
407
  var handleSelect = function handleSelect(item) {
371
- var _context13;
408
+ var _context17;
372
409
  searchInfo.current.searchValue = undefined;
373
410
  if ((0, _findIndex.default)(seletedOptions).call(seletedOptions, function (v) {
374
411
  return v.value === item.value;
375
412
  }) !== -1) {
376
- var _context9;
413
+ var _context13;
377
414
  var _list = (0, _filter.default)(seletedOptions).call(seletedOptions, function (v) {
378
415
  return v.value !== item.value;
379
416
  });
380
417
  // 取消选中(非受控状态下)
381
418
  isMultiple && value === undefined && setSeletedOptions(_list);
382
- onChange === null || onChange === void 0 ? void 0 : onChange((0, _map.default)(_context9 = (0, _filter.default)(_list).call(_list, function (item) {
419
+ onChange === null || onChange === void 0 ? void 0 : onChange((0, _map.default)(_context13 = (0, _filter.default)(_list).call(_list, function (item) {
383
420
  return item;
384
- })).call(_context9, function (v) {
421
+ })).call(_context13, function (v) {
385
422
  return v.value;
386
423
  }), (0, _filter.default)(_list).call(_list, function (item) {
387
424
  return item;
@@ -391,12 +428,12 @@ var InternalBaseData = function InternalBaseData(props, ref) {
391
428
  var list = (0, _toConsumableArray2.default)(searchInfo.current.editOptions || []);
392
429
  list === null || list === void 0 ? void 0 : (0, _splice.default)(list).call(list, searchInfo.current.searchIndex || 0, 1, item);
393
430
  if (isMultiple) {
394
- var _context10, _context11, _context12;
395
- onChange === null || onChange === void 0 ? void 0 : onChange((0, _map.default)(_context10 = (0, _filter.default)(_context11 = list || []).call(_context11, function (item) {
431
+ var _context14, _context15, _context16;
432
+ onChange === null || onChange === void 0 ? void 0 : onChange((0, _map.default)(_context14 = (0, _filter.default)(_context15 = list || []).call(_context15, function (item) {
396
433
  return item;
397
- })).call(_context10, function (v) {
434
+ })).call(_context14, function (v) {
398
435
  return v.value;
399
- }), (0, _filter.default)(_context12 = list || []).call(_context12, function (item) {
436
+ }), (0, _filter.default)(_context16 = list || []).call(_context16, function (item) {
400
437
  return item;
401
438
  }));
402
439
  } else {
@@ -407,7 +444,7 @@ var InternalBaseData = function InternalBaseData(props, ref) {
407
444
  return;
408
445
  }
409
446
  searchInfo.current.editOptions = list;
410
- setSeletedOptions((0, _filter.default)(_context13 = list || []).call(_context13, function (item) {
447
+ setSeletedOptions((0, _filter.default)(_context17 = list || []).call(_context17, function (item) {
411
448
  return item;
412
449
  }));
413
450
  };
@@ -483,10 +520,10 @@ var InternalBaseData = function InternalBaseData(props, ref) {
483
520
  * @returns {React.ReactNode}
484
521
  */
485
522
  var renderDropdownContent = function renderDropdownContent(data, myColumns) {
486
- var _context14;
523
+ var _context18;
487
524
  var showFooter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
488
525
  var showCheckbox = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
489
- var dropDownColumns = myColumns && Array.isArray(myColumns) ? myColumns : data && Array.isArray(data) && data.length ? (0, _map.default)(_context14 = (0, _keys.default)(data[0])).call(_context14, function (v) {
526
+ var dropDownColumns = myColumns && Array.isArray(myColumns) ? myColumns : data && Array.isArray(data) && data.length ? (0, _map.default)(_context18 = (0, _keys.default)(data[0])).call(_context18, function (v) {
490
527
  return {
491
528
  key: v
492
529
  };
@@ -52,6 +52,6 @@ export interface ISearchInfoProps {
52
52
  previousEditValue?: string;
53
53
  searchIndex?: number;
54
54
  selectionStart?: number;
55
- deleteEndIndx?: number;
55
+ deleteEndIndx: number;
56
56
  editOptions?: any[];
57
57
  }
@@ -16,8 +16,8 @@
16
16
  @modal-theme-color-active: var(~'@{modal-prefix}-color-theme-active', @color-theme-7);
17
17
  @modal-mask-color-background: var(~'@{modal-prefix}-mask-color-background', rgba(55, 55, 55, 0.5));
18
18
  @modal-close-icon-color-text: var(~'@{modal-prefix}-close-icon-color-text', #666666);
19
- @confirm-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-ongoing', @color-ongoing); // 提示弹窗的背景色
20
- @warning-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-warning', @color-warning); // 警告弹窗的背景色
19
+ @confirm-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-ongoing', @color-ongoing); // 弹出框的背景色
20
+ @warning-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-warning', @color-warning); // 警告弹出框的背景色
21
21
  @error-modal-title-icon-bg: var(~'@{modal-prefix}-title-icon-color-backround-warning', @color-warning); // 反馈浮层错误提示的背景色
22
22
 
23
23
  // z-index
@@ -46,4 +46,4 @@
46
46
  @modal-title-icon-sizing-margin-right: var(~'@{modal-prefix}-title-icon-sizing-margin-right', 8px);
47
47
  @modal-header-sizing-padding-horizontal: var(~'@{modal-prefix}-header-sizing-padding-horizontal', 20px);
48
48
  @modal-header-sizing-padding-vertical: var(~'@{modal-prefix}-header-sizing-padding-vertical', 0px);
49
- @modal-body-sizing-padding: var(~'@{modal-prefix}-body-sizing-padding', 20px);
49
+ @modal-body-sizing-padding: var(~'@{modal-prefix}-body-sizing-padding', 20px);
@@ -523,8 +523,8 @@
523
523
  /* ----------- Split-Panel ——————---- end */
524
524
 
525
525
  /* ----------- Modal ——————---- start */
526
- @confirm-modal-title-icon-bg: @ongoing-bg-color; // 提示弹窗的背景色
527
- @warning-modal-title-icon-bg: @warning-bg-color; // 警告弹窗的背景色
526
+ @confirm-modal-title-icon-bg: @ongoing-bg-color; // 弹出框的背景色
527
+ @warning-modal-title-icon-bg: @warning-bg-color; // 警告弹出框的背景色
528
528
  @error-modal-title-icon-bg: @error-bg-color; // 反馈浮层错误提示的背景色
529
529
  @modal-border-color: @strong-border-color-1;
530
530
  /* ----------- Modal ——————---- end */
@@ -706,4 +706,4 @@
706
706
  @advancedSelector-dropdown-options-height: 32px;
707
707
  @advancedSelector-hover-bg: @hover-color;
708
708
 
709
- /* ----------- AdvancedSelector ——————---- end */
709
+ /* ----------- AdvancedSelector ——————---- end */
package/lib/tree/tree.js CHANGED
@@ -174,7 +174,7 @@ var InternalTree = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
174
174
  return (0, _treeUtils.getFilterData)(spreadAttrData, filterTreeNode, isSearching, posData, keysData, expandOnFilterNode);
175
175
  }, [spreadAttrData, isSearching, posData, keysData, filterValue, expandOnFilterNode]);
176
176
  (0, _react.useEffect)(function () {
177
- var _a, _b;
177
+ var _a;
178
178
  if (typeof scrollKey === 'undefined') {
179
179
  return;
180
180
  }
@@ -186,12 +186,15 @@ var InternalTree = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
186
186
  }
187
187
  }
188
188
  if (virtual) {
189
- (_a = virtualListRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
190
- index: scrollIndex
189
+ requestAnimationFrame(function () {
190
+ var _a;
191
+ return (_a = virtualListRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
192
+ index: scrollIndex
193
+ });
191
194
  });
192
195
  } else {
193
196
  var wrapperDom = scrollRef.current;
194
- var node = wrapperDom ? (_b = wrapperDom === null || wrapperDom === void 0 ? void 0 : wrapperDom.children[0]) === null || _b === void 0 ? void 0 : _b.children[scrollIndex] : null;
197
+ var node = wrapperDom ? (_a = wrapperDom === null || wrapperDom === void 0 ? void 0 : wrapperDom.children[0]) === null || _a === void 0 ? void 0 : _a.children[scrollIndex] : null;
195
198
  if (node && wrapperDom) {
196
199
  var containerHeight = wrapperDom.clientHeight;
197
200
  var targetHeight = node.clientHeight;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.7.64",
3
+ "version": "1.7.66",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [