intelicoreact 0.3.42 → 0.3.43
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.
|
@@ -214,7 +214,7 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
(0, _react.useLayoutEffect)(function () {
|
|
217
|
-
if (isUseBitDepthPoints) setFormatedValue((0, _fieldValueFormatters.formatToAddBitDepthPoints)(value === undefined || value === null ? '' : value));
|
|
217
|
+
if (isUseBitDepthPoints) setFormatedValue((0, _fieldValueFormatters.formatToAddBitDepthPoints)(value === undefined || value === null ? '' : value, onlyNumbers));
|
|
218
218
|
}, [value]);
|
|
219
219
|
(0, _react.useEffect)(function () {
|
|
220
220
|
var _inputRef$current, _inputRef$current$foc;
|
|
@@ -134,7 +134,7 @@ var NumericInput = function NumericInput(_ref) {
|
|
|
134
134
|
var inputValue = e.target ? (0, _fieldValueFormatters.filterNumeric)(e.target.value, {
|
|
135
135
|
type: 'int'
|
|
136
136
|
}) : e;
|
|
137
|
-
if (inputValue
|
|
137
|
+
if (Number.isNaN(+inputValue) || +inputValue < 0) inputValue = min || '0'; // ToDo - не совсем понятно что проверяется, т.к. при нажатии инкремента/декримента все равно в change приходит число, а не эвент
|
|
138
138
|
// ToDo - боюсь сломать, временно оставляю, выпилить через какое-то время
|
|
139
139
|
// if (inputValue && (decRef.current?.contains?.(e.target) || incRef.current?.contains?.(e.target))) {
|
|
140
140
|
|
|
@@ -52,7 +52,7 @@ var SwitcherRadio = function SwitcherRadio(_ref) {
|
|
|
52
52
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
53
53
|
className: (0, _classnames.default)("".concat(RC, "__wrap"), (0, _defineProperty2.default)({}, "switcher-radio_".concat(direction), direction), {
|
|
54
54
|
disabled: disabled
|
|
55
|
-
})
|
|
55
|
+
}, className)
|
|
56
56
|
}, options === null || options === void 0 ? void 0 : options.map(function (option, index) {
|
|
57
57
|
return /*#__PURE__*/_react.default.createElement(_RadioInput.default, (0, _extends2.default)({}, option, {
|
|
58
58
|
key: option.id || option.value || index,
|
|
@@ -16,8 +16,11 @@ var getSafelyValue = function getSafelyValue(value) {
|
|
|
16
16
|
}; // базовая реализация
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var intlNumbersFormatter = function intlNumbersFormatter(
|
|
19
|
+
var intlNumbersFormatter = function intlNumbersFormatter(inputValue) {
|
|
20
20
|
var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
21
|
+
var previousValue = '' + inputValue.slice(0, -1);
|
|
22
|
+
var lastSym = '' + inputValue.slice(-1);
|
|
23
|
+
var value = lastSym === '.' ? previousValue : inputValue;
|
|
21
24
|
if (Number.isNaN(+value)) return '';
|
|
22
25
|
var _settings$locale = settings.locale,
|
|
23
26
|
locale = _settings$locale === void 0 ? "en-US" : _settings$locale,
|
|
@@ -83,7 +86,8 @@ var intlNumbersFormatter = function intlNumbersFormatter(value) {
|
|
|
83
86
|
maximumFractionDigits: quantity //максимально отображать 2 цифры после запятой, если центы всё же есть
|
|
84
87
|
|
|
85
88
|
};
|
|
86
|
-
|
|
89
|
+
var output = new Intl.NumberFormat(locale, priceSettings).format(value);
|
|
90
|
+
return lastSym === '.' ? output + lastSym : output;
|
|
87
91
|
}; // *** format ***
|
|
88
92
|
|
|
89
93
|
|
|
@@ -101,8 +105,12 @@ var formatToRemoveComa = function formatToRemoveComa(value) {
|
|
|
101
105
|
|
|
102
106
|
exports.formatToRemoveComa = formatToRemoveComa;
|
|
103
107
|
|
|
104
|
-
var formatToAddBitDepthPoints = function formatToAddBitDepthPoints(value) {
|
|
105
|
-
return intlNumbersFormatter(getSafelyValue(value)
|
|
108
|
+
var formatToAddBitDepthPoints = function formatToAddBitDepthPoints(value, settings) {
|
|
109
|
+
return intlNumbersFormatter(getSafelyValue(value), {
|
|
110
|
+
fractionDigits: {
|
|
111
|
+
quantity: (settings === null || settings === void 0 ? void 0 : settings.type) === 'int' ? 0 : settings === null || settings === void 0 ? void 0 : settings.decimalPlaces
|
|
112
|
+
}
|
|
113
|
+
});
|
|
106
114
|
};
|
|
107
115
|
|
|
108
116
|
exports.formatToAddBitDepthPoints = formatToAddBitDepthPoints;
|
|
@@ -131,7 +139,7 @@ var formatToTwoDigitAfterDot = function formatToTwoDigitAfterDot(value) {
|
|
|
131
139
|
exports.formatToTwoDigitAfterDot = formatToTwoDigitAfterDot;
|
|
132
140
|
|
|
133
141
|
var formatToPriceWithUSD = function formatToPriceWithUSD(value) {
|
|
134
|
-
return intlNumbersFormatter(getSafelyValue(value)
|
|
142
|
+
return intlNumbersFormatter(getSafelyValue(value), {
|
|
135
143
|
withSymbol: 'currency',
|
|
136
144
|
currency: {
|
|
137
145
|
currencyType: 'USD'
|
|
@@ -226,7 +234,6 @@ var filterFloat = function filterFloat(inputValue) {
|
|
|
226
234
|
var previousValue = '' + output.slice(0, -1);
|
|
227
235
|
var lastSym = '' + output.slice(-1);
|
|
228
236
|
if (decimalPlaces && typeof decimalPlaces === 'number' && previousValue.includes('.') && previousValue.indexOf('.') + 1 + decimalPlaces === previousValue.length) return replaser(previousValue);
|
|
229
|
-
console.log(lastSym === '.' && previousValue.includes('.'), 'replacer');
|
|
230
237
|
return replaser(lastSym === '.' && previousValue.includes('.') ? previousValue : output);
|
|
231
238
|
};
|
|
232
239
|
|