intelicoreact 0.3.45 → 0.3.47
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.
|
@@ -136,9 +136,9 @@ var NumericInput = function NumericInput(_ref) {
|
|
|
136
136
|
}) : e; // ToDo - не совсем понятно что проверяется, т.к. при нажатии инкремента/декримента все равно в change приходит число, а не эвент
|
|
137
137
|
// ToDo - боюсь сломать, временно оставляю, выпилить через какое-то время
|
|
138
138
|
// if (inputValue && (decRef.current?.contains?.(e.target) || incRef.current?.contains?.(e.target))) {
|
|
139
|
+
// if (symbolsLimit) inputValue = inputValue.toString().substring(0, +symbolsLimit);
|
|
140
|
+
// if (isPriceInput && inputValue?.length > 0) inputValue = addCommas(inputValue);
|
|
139
141
|
|
|
140
|
-
if (symbolsLimit) inputValue = inputValue.toString().substring(0, +symbolsLimit);
|
|
141
|
-
if (isPriceInput) inputValue = (0, _fieldValueFormatters.formatToAddBitDepthPoints)(inputValue);
|
|
142
142
|
setInputValue(inputValue.toString());
|
|
143
143
|
},
|
|
144
144
|
clear: function clear() {
|
|
@@ -152,8 +152,9 @@ var NumericInput = function NumericInput(_ref) {
|
|
|
152
152
|
blur: function blur(e) {
|
|
153
153
|
setIsFocused(false);
|
|
154
154
|
setEditing(false);
|
|
155
|
-
|
|
156
|
-
if (
|
|
155
|
+
var transformedInputValue = parseFloat(inputValue);
|
|
156
|
+
if (Number.isNaN(inputValue) || inputValue < min) setInputValue(min);
|
|
157
|
+
if (max && +max < inputValue) setInputValue(max);
|
|
157
158
|
if (onBlur) onBlur(e);
|
|
158
159
|
},
|
|
159
160
|
keyDown: function keyDown(e) {
|
|
@@ -220,7 +221,7 @@ var NumericInput = function NumericInput(_ref) {
|
|
|
220
221
|
|
|
221
222
|
(0, _react.useEffect)(function () {
|
|
222
223
|
if (inputValue !== value) setIsFocused(true);
|
|
223
|
-
setInputValueFormated(isPriceInput ? isFocused ? (0, _fieldValueFormatters.formatToRemoveComa)(inputValue) : (0, _fieldValueFormatters.formatToAddBitDepthPoints)(inputValue) : inputValue);
|
|
224
|
+
setInputValueFormated(isPriceInput && (inputValue === null || inputValue === void 0 ? void 0 : inputValue.length) > 0 ? isFocused ? (0, _fieldValueFormatters.formatToRemoveComa)(inputValue) : (0, _fieldValueFormatters.formatToAddBitDepthPoints)(inputValue) : inputValue);
|
|
224
225
|
setIntMemoVal((0, _fieldValueFormatters.formatToRemoveComa)(inputValue));
|
|
225
226
|
if (typeof onChange === 'function') onChange(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toString());
|
|
226
227
|
}, [inputValue]); //On Integer Value Change
|
|
@@ -276,7 +277,7 @@ var NumericInput = function NumericInput(_ref) {
|
|
|
276
277
|
|
|
277
278
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, uniProps, {
|
|
278
279
|
"data-testid": "input--".concat(testId),
|
|
279
|
-
value: (0, _fieldValueFormatters.formatToAddBitDepthPoints)((0, _fieldValueFormatters.formatToRemoveComa)(value)),
|
|
280
|
+
value: (value === null || value === void 0 ? void 0 : value.length) > 0 ? (0, _fieldValueFormatters.formatToAddBitDepthPoints)((0, _fieldValueFormatters.formatToRemoveComa)(value)) : value,
|
|
280
281
|
ref: inputRef,
|
|
281
282
|
type: "text",
|
|
282
283
|
onFocus: function onFocus() {
|