@kdcloudjs/kdesign 1.7.37 → 1.7.39

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.
@@ -70,6 +70,7 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
70
70
  var prefixCls = getPrefixCls(pkgPrefixCls, 'cascader', customPrefixcls);
71
71
  var mergeRef = useRef();
72
72
  var inputRef = useRef();
73
+ var suffixRef = useRef(null);
73
74
  var wrapperRef = useRef();
74
75
  var _useState = useState(!!props.popperVisible || !!props.popupVisible || defaultPopupVisible),
75
76
  _useState2 = _slicedToArray(_useState, 2),
@@ -199,10 +200,12 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
199
200
  };
200
201
  React.useEffect(function () {
201
202
  var _a;
202
- (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseup', handleMouseUp);
203
+ ;
204
+ (_a = (isMultiple ? suffixRef : wrapperRef).current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseup', handleMouseUp);
203
205
  return function () {
204
206
  var _a;
205
- (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', handleMouseUp);
207
+ ;
208
+ (_a = (isMultiple ? suffixRef : wrapperRef).current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', handleMouseUp);
206
209
  };
207
210
  }, []);
208
211
  var labels = useMemo(function () {
@@ -304,9 +307,10 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
304
307
  className: "".concat(prefixCls, "-tag-describe-content")
305
308
  }, "\u5171", currentOptions.length, "\u9879")) : null), /*#__PURE__*/React.createElement("span", {
306
309
  className: "".concat(prefixCls, "-placeholder")
307
- }, !currentOptions.length && placeholder), /*#__PURE__*/React.createElement("span", {
310
+ }, !currentOptions.length && placeholder)), /*#__PURE__*/React.createElement("span", {
311
+ ref: suffixRef,
308
312
  className: "".concat(prefixCls, "-suffix")
309
- }, renderSuffix())));
313
+ }, renderSuffix()));
310
314
  };
311
315
  var renderSingle = function renderSingle() {
312
316
  var _classNames5;
@@ -276,9 +276,11 @@
276
276
  }
277
277
  .kd-cascader-bordered.kd-cascader-multiple .kd-cascader-suffix {
278
278
  right: 9px;
279
+ top: 50%;
280
+ -webkit-transform: translateY(-50%);
281
+ transform: translateY(-50%);
279
282
  }
280
283
  .kd-cascader-multiple {
281
- padding: 1px 28px 1px 0;
282
284
  -webkit-transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
283
285
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
284
286
  width: 100%;
@@ -291,7 +293,6 @@
291
293
  cursor: pointer;
292
294
  -webkit-box-sizing: border-box;
293
295
  box-sizing: border-box;
294
- overflow-y: auto;
295
296
  overflow-x: hidden;
296
297
  position: relative;
297
298
  border-bottom: 1px solid #d9d9d9;
@@ -311,6 +312,8 @@
311
312
  -ms-flex-wrap: wrap;
312
313
  flex-wrap: wrap;
313
314
  width: 100%;
315
+ padding: 1px 28px 1px 0;
316
+ overflow-y: auto;
314
317
  }
315
318
  .kd-cascader-placeholder {
316
319
  position: absolute;
@@ -180,11 +180,12 @@
180
180
 
181
181
  .@{kd-prefix}-cascader-suffix {
182
182
  right: 9px;
183
+ top: 50%;
184
+ transform: translateY(-50%);
183
185
  }
184
186
  }
185
187
 
186
188
  &-multiple {
187
- padding: 1px 28px 1px 0;
188
189
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
189
190
  width: 100%;
190
191
  min-height: 30px;
@@ -193,7 +194,6 @@
193
194
  display: flex;
194
195
  cursor: pointer;
195
196
  box-sizing: border-box;
196
- overflow-y: auto;
197
197
  overflow-x: hidden;
198
198
  position: relative;
199
199
  border-bottom: 1px solid #d9d9d9;
@@ -210,6 +210,8 @@
210
210
  align-items: center;
211
211
  flex-wrap: wrap;
212
212
  width: 100%;
213
+ padding: 1px 28px 1px 0;
214
+ overflow-y: auto;
213
215
  }
214
216
 
215
217
  &-placeholder {
@@ -58,6 +58,10 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
58
58
  _useState2 = _slicedToArray(_useState, 2),
59
59
  inputValue = _useState2[0],
60
60
  setInputValue = _useState2[1];
61
+ var _useState3 = useState(1),
62
+ _useState4 = _slicedToArray(_useState3, 2),
63
+ forceUpdate = _useState4[0],
64
+ setForceUpdate = _useState4[1];
61
65
  var inputStatus = useRef({
62
66
  isHandleChange: false,
63
67
  inputFocused: false
@@ -109,10 +113,11 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
109
113
  var handleChange = function handleChange(event) {
110
114
  inputStatus.current.isHandleChange = true;
111
115
  var legalNumber = verifiValue(event.target.value);
116
+ updateSelectionRangePosition(event);
112
117
  if (legalNumber === false) {
118
+ setForceUpdate(forceUpdate + 1);
113
119
  return false;
114
120
  }
115
- updateSelectionRangePosition(event);
116
121
  value === undefined && setInputValue(legalNumber);
117
122
  onChange && onChange(handleEventAttachValue(event, numberMode ? Number(legalNumber) : legalNumber));
118
123
  };
@@ -151,23 +156,23 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
151
156
  if (decimalValueLength <= decimalLength && integerValueLength <= digitLength - decimalLength) {
152
157
  resultNumerical = numerical;
153
158
  } else if (integerValueLength > digitLength - decimalLength) {
154
- var _context;
155
- resultNumerical = _concatInstanceProperty(_context = "".concat(sign)).call(_context, integerValue.substr(0, digitLength - decimalLength));
159
+ var _context, _context2;
160
+ resultNumerical = mustInPrecisionScope ? inputValue : _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "".concat(sign)).call(_context2, integerValue.substr(0, digitLength - decimalLength))).call(_context, decimalValue ? '.' + decimalValue : '');
156
161
  } else if (decimalValueLength > decimalLength) {
157
- var _context2, _context3;
158
- resultNumerical = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "".concat(sign)).call(_context3, integerValue, ".")).call(_context2, decimalValue.substr(0, decimalLength));
162
+ var _context3, _context4;
163
+ resultNumerical = mustInPrecisionScope ? inputValue : _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "".concat(sign)).call(_context4, integerValue, ".")).call(_context3, decimalValue.substr(0, decimalLength));
159
164
  }
160
165
  } else if (typeof decimalLength !== 'number' && typeof digitLength === 'number') {
161
166
  if (integerValueLength >= digitLength) {
162
- var _context4;
163
- resultNumerical = _concatInstanceProperty(_context4 = "".concat(sign)).call(_context4, integerValue.substr(0, digitLength));
167
+ var _context5;
168
+ resultNumerical = _concatInstanceProperty(_context5 = "".concat(sign)).call(_context5, integerValue.substr(0, digitLength));
164
169
  } else {
165
- var _context5, _context6, _context7;
166
- resultNumerical = decimalValueLength ? _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = "".concat(sign)).call(_context6, integerValue, ".")).call(_context5, decimalValue.substr(0, digitLength - integerValueLength)) : _concatInstanceProperty(_context7 = "".concat(sign)).call(_context7, integerValue);
170
+ var _context6, _context7, _context8;
171
+ resultNumerical = decimalValueLength ? _concatInstanceProperty(_context6 = _concatInstanceProperty(_context7 = "".concat(sign)).call(_context7, integerValue, ".")).call(_context6, decimalValue.substr(0, digitLength - integerValueLength)) : _concatInstanceProperty(_context8 = "".concat(sign)).call(_context8, integerValue);
167
172
  }
168
173
  } else if (typeof decimalLength === 'number' && typeof digitLength !== 'number') {
169
- var _context8, _context9, _context10;
170
- resultNumerical = decimalValueLength ? _concatInstanceProperty(_context8 = _concatInstanceProperty(_context9 = "".concat(sign)).call(_context9, integerValue, ".")).call(_context8, decimalValue.substr(0, decimalLength)) : _concatInstanceProperty(_context10 = "".concat(sign)).call(_context10, integerValue);
174
+ var _context9, _context10, _context11;
175
+ resultNumerical = decimalValueLength ? _concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "".concat(sign)).call(_context10, integerValue, ".")).call(_context9, decimalValue.substr(0, decimalLength)) : _concatInstanceProperty(_context11 = "".concat(sign)).call(_context11, integerValue);
171
176
  } else {
172
177
  resultNumerical = numerical;
173
178
  }
@@ -197,13 +202,13 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
197
202
  });
198
203
  };
199
204
  var handleKeyDown = function handleKeyDown(event) {
200
- var _context11;
205
+ var _context12;
201
206
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
202
207
  if (!stepOption || props.disabled || props.readOnly) {
203
208
  return;
204
209
  }
205
210
  var keyCode = event.keyCode;
206
- if (_includesInstanceProperty(_context11 = [38, 40]).call(_context11, keyCode)) {
211
+ if (_includesInstanceProperty(_context12 = [38, 40]).call(_context12, keyCode)) {
207
212
  event.preventDefault();
208
213
  handleStepChang(keyCode === 38 ? 'plus' : 'minus');
209
214
  }
@@ -310,7 +315,8 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
310
315
  }, [inputValue, formatter]);
311
316
  var updateSelectionRangePosition = useSelectionRange({
312
317
  inputElement: (_a = inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.input,
313
- inputValue: displayedInputValue
318
+ inputValue: displayedInputValue,
319
+ forceUpdate: forceUpdate
314
320
  });
315
321
  return /*#__PURE__*/React.createElement(Input, _extends({}, others, {
316
322
  ref: inputNumberRef,
@@ -1,4 +1,5 @@
1
- export default function useSelectionRange({ inputElement, inputValue, }: {
1
+ export default function useSelectionRange({ inputElement, inputValue, forceUpdate, }: {
2
2
  inputElement: HTMLInputElement;
3
3
  inputValue: string;
4
+ forceUpdate: number;
4
5
  }): (event: any) => void;
@@ -2,7 +2,8 @@ import { useRef, useLayoutEffect } from 'react';
2
2
  import isNumber from 'lodash/isNumber';
3
3
  export default function useSelectionRange(_ref) {
4
4
  var inputElement = _ref.inputElement,
5
- inputValue = _ref.inputValue;
5
+ inputValue = _ref.inputValue,
6
+ forceUpdate = _ref.forceUpdate;
6
7
  var refSelectionPosition = useRef();
7
8
  useLayoutEffect(function () {
8
9
  var position = refSelectionPosition.current;
@@ -10,7 +11,7 @@ export default function useSelectionRange(_ref) {
10
11
  var start = Math.max(0, inputValue.length - position);
11
12
  inputElement.setSelectionRange(start, start);
12
13
  }
13
- }, [inputValue]);
14
+ }, [inputValue, forceUpdate]);
14
15
  return function (event) {
15
16
  var _event$target = event.target,
16
17
  end = _event$target.selectionEnd,
@@ -1,4 +1,3 @@
1
- import _typeof from "@babel/runtime-corejs3/helpers/typeof";
2
1
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
3
2
  import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
4
3
  import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
@@ -174,7 +173,8 @@ var InternalTreeSelect = function InternalTreeSelect(props, ref) {
174
173
  if (TreeMap.has(initValue)) {
175
174
  arr.push(TreeMap.get(initValue));
176
175
  } else {
177
- _typeof(initValue) !== undefined && arr.push({
176
+ ;
177
+ (initValue !== null && initValue !== void 0 ? initValue : '') !== '' && arr.push({
178
178
  key: initValue,
179
179
  title: initValue
180
180
  });
@@ -83,6 +83,7 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
83
83
  var prefixCls = getPrefixCls(pkgPrefixCls, 'cascader', customPrefixcls);
84
84
  var mergeRef = (0, _react.useRef)();
85
85
  var inputRef = (0, _react.useRef)();
86
+ var suffixRef = (0, _react.useRef)(null);
86
87
  var wrapperRef = (0, _react.useRef)();
87
88
  var _useState = (0, _react.useState)(!!props.popperVisible || !!props.popupVisible || defaultPopupVisible),
88
89
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -212,10 +213,12 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
212
213
  };
213
214
  _react.default.useEffect(function () {
214
215
  var _a;
215
- (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseup', handleMouseUp);
216
+ ;
217
+ (_a = (isMultiple ? suffixRef : wrapperRef).current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseup', handleMouseUp);
216
218
  return function () {
217
219
  var _a;
218
- (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', handleMouseUp);
220
+ ;
221
+ (_a = (isMultiple ? suffixRef : wrapperRef).current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', handleMouseUp);
219
222
  };
220
223
  }, []);
221
224
  var labels = (0, _react.useMemo)(function () {
@@ -317,9 +320,10 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
317
320
  className: "".concat(prefixCls, "-tag-describe-content")
318
321
  }, "\u5171", currentOptions.length, "\u9879")) : null), /*#__PURE__*/_react.default.createElement("span", {
319
322
  className: "".concat(prefixCls, "-placeholder")
320
- }, !currentOptions.length && placeholder), /*#__PURE__*/_react.default.createElement("span", {
323
+ }, !currentOptions.length && placeholder)), /*#__PURE__*/_react.default.createElement("span", {
324
+ ref: suffixRef,
321
325
  className: "".concat(prefixCls, "-suffix")
322
- }, renderSuffix())));
326
+ }, renderSuffix()));
323
327
  };
324
328
  var renderSingle = function renderSingle() {
325
329
  var _classNames5;
@@ -276,9 +276,11 @@
276
276
  }
277
277
  .kd-cascader-bordered.kd-cascader-multiple .kd-cascader-suffix {
278
278
  right: 9px;
279
+ top: 50%;
280
+ -webkit-transform: translateY(-50%);
281
+ transform: translateY(-50%);
279
282
  }
280
283
  .kd-cascader-multiple {
281
- padding: 1px 28px 1px 0;
282
284
  -webkit-transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
283
285
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
284
286
  width: 100%;
@@ -291,7 +293,6 @@
291
293
  cursor: pointer;
292
294
  -webkit-box-sizing: border-box;
293
295
  box-sizing: border-box;
294
- overflow-y: auto;
295
296
  overflow-x: hidden;
296
297
  position: relative;
297
298
  border-bottom: 1px solid #d9d9d9;
@@ -311,6 +312,8 @@
311
312
  -ms-flex-wrap: wrap;
312
313
  flex-wrap: wrap;
313
314
  width: 100%;
315
+ padding: 1px 28px 1px 0;
316
+ overflow-y: auto;
314
317
  }
315
318
  .kd-cascader-placeholder {
316
319
  position: absolute;
@@ -180,11 +180,12 @@
180
180
 
181
181
  .@{kd-prefix}-cascader-suffix {
182
182
  right: 9px;
183
+ top: 50%;
184
+ transform: translateY(-50%);
183
185
  }
184
186
  }
185
187
 
186
188
  &-multiple {
187
- padding: 1px 28px 1px 0;
188
189
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
189
190
  width: 100%;
190
191
  min-height: 30px;
@@ -193,7 +194,6 @@
193
194
  display: flex;
194
195
  cursor: pointer;
195
196
  box-sizing: border-box;
196
- overflow-y: auto;
197
197
  overflow-x: hidden;
198
198
  position: relative;
199
199
  border-bottom: 1px solid #d9d9d9;
@@ -210,6 +210,8 @@
210
210
  align-items: center;
211
211
  flex-wrap: wrap;
212
212
  width: 100%;
213
+ padding: 1px 28px 1px 0;
214
+ overflow-y: auto;
213
215
  }
214
216
 
215
217
  &-placeholder {
@@ -70,6 +70,10 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
70
70
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
71
71
  inputValue = _useState2[0],
72
72
  setInputValue = _useState2[1];
73
+ var _useState3 = (0, _react.useState)(1),
74
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
75
+ forceUpdate = _useState4[0],
76
+ setForceUpdate = _useState4[1];
73
77
  var inputStatus = (0, _react.useRef)({
74
78
  isHandleChange: false,
75
79
  inputFocused: false
@@ -121,10 +125,11 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
121
125
  var handleChange = function handleChange(event) {
122
126
  inputStatus.current.isHandleChange = true;
123
127
  var legalNumber = verifiValue(event.target.value);
128
+ updateSelectionRangePosition(event);
124
129
  if (legalNumber === false) {
130
+ setForceUpdate(forceUpdate + 1);
125
131
  return false;
126
132
  }
127
- updateSelectionRangePosition(event);
128
133
  value === undefined && setInputValue(legalNumber);
129
134
  onChange && onChange(handleEventAttachValue(event, numberMode ? Number(legalNumber) : legalNumber));
130
135
  };
@@ -163,23 +168,23 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
163
168
  if (decimalValueLength <= decimalLength && integerValueLength <= digitLength - decimalLength) {
164
169
  resultNumerical = numerical;
165
170
  } else if (integerValueLength > digitLength - decimalLength) {
166
- var _context;
167
- resultNumerical = (0, _concat.default)(_context = "".concat(sign)).call(_context, integerValue.substr(0, digitLength - decimalLength));
171
+ var _context, _context2;
172
+ resultNumerical = mustInPrecisionScope ? inputValue : (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(sign)).call(_context2, integerValue.substr(0, digitLength - decimalLength))).call(_context, decimalValue ? '.' + decimalValue : '');
168
173
  } else if (decimalValueLength > decimalLength) {
169
- var _context2, _context3;
170
- resultNumerical = (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = "".concat(sign)).call(_context3, integerValue, ".")).call(_context2, decimalValue.substr(0, decimalLength));
174
+ var _context3, _context4;
175
+ resultNumerical = mustInPrecisionScope ? inputValue : (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(sign)).call(_context4, integerValue, ".")).call(_context3, decimalValue.substr(0, decimalLength));
171
176
  }
172
177
  } else if (typeof decimalLength !== 'number' && typeof digitLength === 'number') {
173
178
  if (integerValueLength >= digitLength) {
174
- var _context4;
175
- resultNumerical = (0, _concat.default)(_context4 = "".concat(sign)).call(_context4, integerValue.substr(0, digitLength));
179
+ var _context5;
180
+ resultNumerical = (0, _concat.default)(_context5 = "".concat(sign)).call(_context5, integerValue.substr(0, digitLength));
176
181
  } else {
177
- var _context5, _context6, _context7;
178
- resultNumerical = decimalValueLength ? (0, _concat.default)(_context5 = (0, _concat.default)(_context6 = "".concat(sign)).call(_context6, integerValue, ".")).call(_context5, decimalValue.substr(0, digitLength - integerValueLength)) : (0, _concat.default)(_context7 = "".concat(sign)).call(_context7, integerValue);
182
+ var _context6, _context7, _context8;
183
+ resultNumerical = decimalValueLength ? (0, _concat.default)(_context6 = (0, _concat.default)(_context7 = "".concat(sign)).call(_context7, integerValue, ".")).call(_context6, decimalValue.substr(0, digitLength - integerValueLength)) : (0, _concat.default)(_context8 = "".concat(sign)).call(_context8, integerValue);
179
184
  }
180
185
  } else if (typeof decimalLength === 'number' && typeof digitLength !== 'number') {
181
- var _context8, _context9, _context10;
182
- resultNumerical = decimalValueLength ? (0, _concat.default)(_context8 = (0, _concat.default)(_context9 = "".concat(sign)).call(_context9, integerValue, ".")).call(_context8, decimalValue.substr(0, decimalLength)) : (0, _concat.default)(_context10 = "".concat(sign)).call(_context10, integerValue);
186
+ var _context9, _context10, _context11;
187
+ resultNumerical = decimalValueLength ? (0, _concat.default)(_context9 = (0, _concat.default)(_context10 = "".concat(sign)).call(_context10, integerValue, ".")).call(_context9, decimalValue.substr(0, decimalLength)) : (0, _concat.default)(_context11 = "".concat(sign)).call(_context11, integerValue);
183
188
  } else {
184
189
  resultNumerical = numerical;
185
190
  }
@@ -209,13 +214,13 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
209
214
  });
210
215
  };
211
216
  var handleKeyDown = function handleKeyDown(event) {
212
- var _context11;
217
+ var _context12;
213
218
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
214
219
  if (!stepOption || props.disabled || props.readOnly) {
215
220
  return;
216
221
  }
217
222
  var keyCode = event.keyCode;
218
- if ((0, _includes.default)(_context11 = [38, 40]).call(_context11, keyCode)) {
223
+ if ((0, _includes.default)(_context12 = [38, 40]).call(_context12, keyCode)) {
219
224
  event.preventDefault();
220
225
  handleStepChang(keyCode === 38 ? 'plus' : 'minus');
221
226
  }
@@ -322,7 +327,8 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
322
327
  }, [inputValue, formatter]);
323
328
  var updateSelectionRangePosition = (0, _useSelectionRange.default)({
324
329
  inputElement: (_a = inputNumberRef.current) === null || _a === void 0 ? void 0 : _a.input,
325
- inputValue: displayedInputValue
330
+ inputValue: displayedInputValue,
331
+ forceUpdate: forceUpdate
326
332
  });
327
333
  return /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({}, others, {
328
334
  ref: inputNumberRef,
@@ -1,4 +1,5 @@
1
- export default function useSelectionRange({ inputElement, inputValue, }: {
1
+ export default function useSelectionRange({ inputElement, inputValue, forceUpdate, }: {
2
2
  inputElement: HTMLInputElement;
3
3
  inputValue: string;
4
+ forceUpdate: number;
4
5
  }): (event: any) => void;
@@ -9,7 +9,8 @@ var _react = require("react");
9
9
  var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
10
10
  function useSelectionRange(_ref) {
11
11
  var inputElement = _ref.inputElement,
12
- inputValue = _ref.inputValue;
12
+ inputValue = _ref.inputValue,
13
+ forceUpdate = _ref.forceUpdate;
13
14
  var refSelectionPosition = (0, _react.useRef)();
14
15
  (0, _react.useLayoutEffect)(function () {
15
16
  var position = refSelectionPosition.current;
@@ -17,7 +18,7 @@ function useSelectionRange(_ref) {
17
18
  var start = Math.max(0, inputValue.length - position);
18
19
  inputElement.setSelectionRange(start, start);
19
20
  }
20
- }, [inputValue]);
21
+ }, [inputValue, forceUpdate]);
21
22
  return function (event) {
22
23
  var _event$target = event.target,
23
24
  end = _event$target.selectionEnd,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _typeof3 = require("@babel/runtime-corejs3/helpers/typeof");
3
+ var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
4
  var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
5
5
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
6
6
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
  exports.default = void 0;
11
- var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
12
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
13
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
14
13
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
@@ -26,7 +25,7 @@ var _utils = require("../_utils");
26
25
  var _index = require("../index");
27
26
  var _usePopper = _interopRequireDefault(require("../_utils/usePopper"));
28
27
  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); }
29
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
28
+ 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; }
30
29
  var INPUT_MIN_WIDTH = 4; // 输入框最小宽度
31
30
  function flattenTreeData(treeData) {
32
31
  var map = new _map.default();
@@ -186,7 +185,8 @@ var InternalTreeSelect = function InternalTreeSelect(props, ref) {
186
185
  if (TreeMap.has(initValue)) {
187
186
  arr.push(TreeMap.get(initValue));
188
187
  } else {
189
- (0, _typeof2.default)(initValue) !== undefined && arr.push({
188
+ ;
189
+ (initValue !== null && initValue !== void 0 ? initValue : '') !== '' && arr.push({
190
190
  key: initValue,
191
191
  title: initValue
192
192
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.7.37",
3
+ "version": "1.7.39",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [