@ostack.tech/ui 0.14.1 → 0.14.2
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.
- package/dist/ostack-ui.js +22 -24
- package/dist/ostack-ui.js.map +1 -1
- package/package.json +1 -1
package/dist/ostack-ui.js
CHANGED
|
@@ -13421,7 +13421,6 @@ const NumericInput = forwardRef(function NumericInput2({
|
|
|
13421
13421
|
() => valueToRNFString(value, valueIsInteger, formatProps),
|
|
13422
13422
|
[formatProps, value, valueIsInteger]
|
|
13423
13423
|
);
|
|
13424
|
-
const prevStringValueRef = useRef(stringValue);
|
|
13425
13424
|
const isAllowed = useCallback(
|
|
13426
13425
|
(values) => {
|
|
13427
13426
|
const valueRepresentations = transformNumberFormatValues(
|
|
@@ -13429,48 +13428,46 @@ const NumericInput = forwardRef(function NumericInput2({
|
|
|
13429
13428
|
valueIsInteger,
|
|
13430
13429
|
scale
|
|
13431
13430
|
);
|
|
13432
|
-
const { stringValue:
|
|
13433
|
-
|
|
13434
|
-
if (stringValue2) {
|
|
13431
|
+
const { stringValue: newStringValue } = valueRepresentations;
|
|
13432
|
+
if (newStringValue) {
|
|
13435
13433
|
if (precision != null) {
|
|
13436
|
-
const
|
|
13437
|
-
const
|
|
13434
|
+
const newIsNegative = isNumericStringNegative(newStringValue);
|
|
13435
|
+
const oldIsNegative = isNumericStringNegative(stringValue);
|
|
13438
13436
|
if (valueIsInteger) {
|
|
13439
|
-
const
|
|
13440
|
-
if (
|
|
13441
|
-
const
|
|
13442
|
-
if (
|
|
13437
|
+
const newPrecision = newStringValue.length - (newIsNegative ? 1 : 0);
|
|
13438
|
+
if (newPrecision > precision) {
|
|
13439
|
+
const oldPrecision = stringValue.length - (oldIsNegative ? 1 : 0);
|
|
13440
|
+
if (newPrecision > oldPrecision) {
|
|
13443
13441
|
return false;
|
|
13444
13442
|
}
|
|
13445
13443
|
}
|
|
13446
13444
|
} else {
|
|
13447
|
-
const
|
|
13448
|
-
const
|
|
13449
|
-
const
|
|
13450
|
-
if (
|
|
13451
|
-
const
|
|
13452
|
-
const
|
|
13453
|
-
const
|
|
13454
|
-
if (
|
|
13445
|
+
const newDecimalSeparatorIndex = newStringValue.indexOf(".");
|
|
13446
|
+
const newDecimal = newDecimalSeparatorIndex === -1 ? newStringValue : newStringValue.slice(0, newDecimalSeparatorIndex);
|
|
13447
|
+
const newDecimalPrecision = newDecimal.length - (newIsNegative ? 1 : 0);
|
|
13448
|
+
if (newDecimalPrecision > precision - scale) {
|
|
13449
|
+
const oldDecimalSeparatorIndex = stringValue.indexOf(".");
|
|
13450
|
+
const oldDecimal = oldDecimalSeparatorIndex === -1 ? stringValue : stringValue.slice(0, oldDecimalSeparatorIndex);
|
|
13451
|
+
const oldDecimalPrecision = oldDecimal.length - (oldIsNegative ? 1 : 0);
|
|
13452
|
+
if (newDecimalPrecision > oldDecimalPrecision) {
|
|
13455
13453
|
return false;
|
|
13456
13454
|
}
|
|
13457
13455
|
}
|
|
13458
13456
|
}
|
|
13459
13457
|
}
|
|
13460
|
-
if (minString && (compareNumericStrings(minString, "0") < 0 && compareNumericStrings(
|
|
13458
|
+
if (minString && (compareNumericStrings(minString, "0") < 0 && compareNumericStrings(newStringValue, minString) < 0 || compareNumericStrings(minString, "0") >= 0 && compareNumericStrings(newStringValue, "0") < 0) && compareNumericStrings(newStringValue, stringValue) < 0) {
|
|
13461
13459
|
return false;
|
|
13462
13460
|
}
|
|
13463
|
-
if (maxString && (compareNumericStrings(maxString, "0") > 0 && compareNumericStrings(
|
|
13461
|
+
if (maxString && (compareNumericStrings(maxString, "0") > 0 && compareNumericStrings(newStringValue, maxString) > 0 || compareNumericStrings(maxString, "0") <= 0 && compareNumericStrings(newStringValue, "0") > 0) && compareNumericStrings(newStringValue, stringValue) > 0) {
|
|
13464
13462
|
return false;
|
|
13465
13463
|
}
|
|
13466
|
-
if (exclusiveMinString && (compareNumericStrings(exclusiveMinString, "0") < 0 && compareNumericStrings(
|
|
13464
|
+
if (exclusiveMinString && (compareNumericStrings(exclusiveMinString, "0") < 0 && compareNumericStrings(newStringValue, exclusiveMinString) <= 0 || compareNumericStrings(exclusiveMinString, "0") >= 0 && compareNumericStrings(newStringValue, "0") < 0) && compareNumericStrings(newStringValue, stringValue) < 0) {
|
|
13467
13465
|
return false;
|
|
13468
13466
|
}
|
|
13469
|
-
if (exclusiveMaxString && (compareNumericStrings(exclusiveMaxString, "0") > 0 && compareNumericStrings(
|
|
13467
|
+
if (exclusiveMaxString && (compareNumericStrings(exclusiveMaxString, "0") > 0 && compareNumericStrings(newStringValue, exclusiveMaxString) >= 0 || compareNumericStrings(exclusiveMaxString, "0") <= 0 && compareNumericStrings(newStringValue, "0") > 0) && compareNumericStrings(newStringValue, stringValue) > 0) {
|
|
13470
13468
|
return false;
|
|
13471
13469
|
}
|
|
13472
13470
|
}
|
|
13473
|
-
prevStringValueRef.current = stringValue2;
|
|
13474
13471
|
return true;
|
|
13475
13472
|
},
|
|
13476
13473
|
[
|
|
@@ -13480,7 +13477,8 @@ const NumericInput = forwardRef(function NumericInput2({
|
|
|
13480
13477
|
minString,
|
|
13481
13478
|
maxString,
|
|
13482
13479
|
exclusiveMinString,
|
|
13483
|
-
exclusiveMaxString
|
|
13480
|
+
exclusiveMaxString,
|
|
13481
|
+
stringValue
|
|
13484
13482
|
]
|
|
13485
13483
|
);
|
|
13486
13484
|
const {
|