intelicoreact 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -117,15 +117,10 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
117
117
|
onInputHover = _useState10[0],
|
|
118
118
|
setOnInputHover = _useState10[1];
|
|
119
119
|
|
|
120
|
-
var _useState11 = (0, _react.useState)(
|
|
120
|
+
var _useState11 = (0, _react.useState)(value),
|
|
121
121
|
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
var _useState13 = (0, _react.useState)(value),
|
|
126
|
-
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
127
|
-
prevValue = _useState14[0],
|
|
128
|
-
setPreviousValue = _useState14[1];
|
|
122
|
+
prevValue = _useState12[0],
|
|
123
|
+
setPreviousValue = _useState12[1];
|
|
129
124
|
|
|
130
125
|
var isUseBitDepthPoints = !!onlyNumbers && isPriceInput;
|
|
131
126
|
var isUseErrorsBlink = !isNotBlinkErrors && !mask; // HANDLES
|
|
@@ -206,7 +201,7 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
206
201
|
|
|
207
202
|
if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
|
|
208
203
|
if (symbolsLimit && inputValue.length > +symbolsLimit) inputValue = inputValue.substring(0, +symbolsLimit);
|
|
209
|
-
if (isCropFirstNool && inputValue[0]
|
|
204
|
+
if (isCropFirstNool && +inputValue[0] === 0) return '';
|
|
210
205
|
if (onlyNumbers && isOnlyString || isOnlyString) inputValue = (0, _fieldValueFormatters.formatToLetters)(inputValue, softStringMode);else if (onlyNumbers) inputValue = handle.correctMinMax(inputValue, 'max');
|
|
211
206
|
onChange((((_minusSymbol3 = minusSymbol) !== null && _minusSymbol3 !== void 0 ? _minusSymbol3 : '') + inputValue).toString());
|
|
212
207
|
},
|
|
@@ -261,12 +256,6 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
261
256
|
onKeyUp(e.keyCode, e);
|
|
262
257
|
}
|
|
263
258
|
};
|
|
264
|
-
(0, _react.useLayoutEffect)(function () {
|
|
265
|
-
var inputValue = (0, _fieldValueFormatters.getSafelyValue)(value);
|
|
266
|
-
if (onlyNumbers !== null && onlyNumbers !== void 0 && onlyNumbers.isNoEmptyValues) inputValue = handle.correctMinMax(inputValue, 'min');
|
|
267
|
-
if (isUseBitDepthPoints) inputValue = (0, _fieldValueFormatters.formatToAddBitDepthPoints)(inputValue, onlyNumbers);
|
|
268
|
-
setFormatedValue(inputValue);
|
|
269
|
-
}, [value]);
|
|
270
259
|
(0, _react.useEffect)(function () {
|
|
271
260
|
var _inputRef$current, _inputRef$current$foc;
|
|
272
261
|
|
|
@@ -288,43 +277,28 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
288
277
|
if (inputRef !== null && inputRef !== void 0 && inputRef.current && typeof isFocusDefault === 'boolean') setIsFocused(isFocusDefault);
|
|
289
278
|
setEditing(isFocusDefault);
|
|
290
279
|
}, [inputRef, isFocusDefault]);
|
|
280
|
+
var formatedValue = (0, _fieldValueFormatters.getSafelyValue)(value);
|
|
281
|
+
if (onlyNumbers !== null && onlyNumbers !== void 0 && onlyNumbers.isNoEmptyValues) formatedValue = handle.correctMinMax(inputValue, 'min');
|
|
282
|
+
if (isUseBitDepthPoints) formatedValue = (0, _fieldValueFormatters.formatToAddBitDepthPoints)(inputValue, onlyNumbers);
|
|
291
283
|
|
|
292
|
-
var
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
} : {});
|
|
311
|
-
|
|
312
|
-
if (mask) return /*#__PURE__*/_react.default.createElement(_reactInputMask.default, (0, _extends2.default)({}, uniProps, {
|
|
313
|
-
inputRef: inputRef,
|
|
314
|
-
mask: mask
|
|
315
|
-
}));
|
|
316
|
-
return /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
317
|
-
"data-testid": "input--key-".concat(testId, "--type-").concat(type)
|
|
318
|
-
}, uniProps, {
|
|
319
|
-
ref: inputRef,
|
|
320
|
-
type: isPriceInput ? 'text' : type,
|
|
321
|
-
autoComplete: autocomplete,
|
|
322
|
-
onFocus: function onFocus() {
|
|
323
|
-
if (isUseAutoSelect) inputRef.current.select();
|
|
324
|
-
if (uniProps.onFocus) uniProps.onFocus.apply(uniProps, arguments);
|
|
325
|
-
}
|
|
326
|
-
}));
|
|
327
|
-
};
|
|
284
|
+
var uniProps = _objectSpread(_objectSpread({
|
|
285
|
+
className: (0, _classnames.default)('input', className, {
|
|
286
|
+
'input--with-icon': icon
|
|
287
|
+
}),
|
|
288
|
+
placeholder: placeholder,
|
|
289
|
+
value: formatedValue,
|
|
290
|
+
inputMode: isNumericMobileKeyboard ? 'numeric' : 'text',
|
|
291
|
+
disabled: disabled,
|
|
292
|
+
onChange: handle.change,
|
|
293
|
+
onFocus: handle.focus,
|
|
294
|
+
onBlur: handle.blur,
|
|
295
|
+
onKeyUp: handle.keyUp,
|
|
296
|
+
onKeyDown: handle.keyDown
|
|
297
|
+
}, maskChar ? {
|
|
298
|
+
maskChar: maskChar
|
|
299
|
+
} : {}), formatChars ? {
|
|
300
|
+
formatChars: formatChars
|
|
301
|
+
} : {});
|
|
328
302
|
|
|
329
303
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
330
304
|
className: (0, _classnames.default)("input__wrap", (0, _defineProperty2.default)({}, "input__wrap_focus", isFocused), (0, _defineProperty2.default)({}, "input__wrap_error", error || isToHighlightError), (0, _defineProperty2.default)({}, "input__wrap--disabled", disabled)),
|
|
@@ -334,7 +308,17 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
334
308
|
onMouseLeave: function onMouseLeave() {
|
|
335
309
|
return setOnInputHover(false);
|
|
336
310
|
}
|
|
337
|
-
},
|
|
311
|
+
}, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
312
|
+
"data-testid": "input--key-".concat(testId, "--type-").concat(type)
|
|
313
|
+
}, uniProps, {
|
|
314
|
+
ref: inputRef,
|
|
315
|
+
type: isPriceInput ? 'text' : type,
|
|
316
|
+
autoComplete: autocomplete,
|
|
317
|
+
onFocus: function onFocus() {
|
|
318
|
+
if (isUseAutoSelect) inputRef.current.select();
|
|
319
|
+
if (uniProps.onFocus) uniProps.onFocus.apply(uniProps, arguments);
|
|
320
|
+
}
|
|
321
|
+
})), icon, action, withDelete && onInputHover && /*#__PURE__*/_react.default.createElement("span", {
|
|
338
322
|
"data-testid": "icon-close",
|
|
339
323
|
className: (0, _classnames.default)("input__close", {
|
|
340
324
|
hidden: !(0, _fieldValueFormatters.getSafelyValue)(value)
|