diginet-core-ui 1.4.55-beta.6 → 1.4.55-beta.7
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.
|
@@ -98,13 +98,13 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
98
98
|
|
|
99
99
|
// if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
|
|
100
100
|
|
|
101
|
-
/**
|
|
102
|
-
* Convert number to format money
|
|
103
|
-
* @param vl {number} - value
|
|
104
|
-
* @type {function}
|
|
105
|
-
* @return {string}
|
|
106
|
-
* @example 1200300.123 => 1,200,300.123
|
|
107
|
-
* @example 1200300,123 => 1.200.300,123
|
|
101
|
+
/**
|
|
102
|
+
* Convert number to format money
|
|
103
|
+
* @param vl {number} - value
|
|
104
|
+
* @type {function}
|
|
105
|
+
* @return {string}
|
|
106
|
+
* @example 1200300.123 => 1,200,300.123
|
|
107
|
+
* @example 1200300,123 => 1.200.300,123
|
|
108
108
|
*/
|
|
109
109
|
const parseNumberToMoney = useCallback((vl, isNumber) => {
|
|
110
110
|
var _number, _number2, _number$, _number3;
|
|
@@ -152,13 +152,13 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
152
152
|
return number;
|
|
153
153
|
}, [decimalSymbol, max, value, decimalDigit, fixedDecimalDigit]);
|
|
154
154
|
|
|
155
|
-
/**
|
|
156
|
-
* Convert money to format number
|
|
157
|
-
* @param vl {string} - value
|
|
158
|
-
* @type {function}
|
|
159
|
-
* @return {number}
|
|
160
|
-
* @example 1,200,300.123 => 1200300.123
|
|
161
|
-
* @example 1.200.300,123 => 1200300.123
|
|
155
|
+
/**
|
|
156
|
+
* Convert money to format number
|
|
157
|
+
* @param vl {string} - value
|
|
158
|
+
* @type {function}
|
|
159
|
+
* @return {number}
|
|
160
|
+
* @example 1,200,300.123 => 1200300.123
|
|
161
|
+
* @example 1.200.300,123 => 1200300.123
|
|
162
162
|
*/
|
|
163
163
|
const convertMoneyToNumber = useCallback((vl, isNumber) => {
|
|
164
164
|
var _number4, _number4$toString, _number4$toString$rep, _number4$toString$rep2, _number4$toString$rep3;
|
|
@@ -172,13 +172,15 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
172
172
|
var _e$target$value;
|
|
173
173
|
let valueT = (_e$target$value = e.target.value) !== null && _e$target$value !== void 0 ? _e$target$value : e.value;
|
|
174
174
|
if (disabledNegative && Number(valueT || 0) < 0) valueT = 0;
|
|
175
|
+
if (min && eval(valueT) < min) valueT = min;
|
|
176
|
+
if (max && eval(valueT) > max) valueT = max;
|
|
175
177
|
valueT = parseNumberToMoney(valueT);
|
|
176
178
|
const returnValue = convertMoneyToNumber(valueT);
|
|
177
179
|
e.value = globalRef.current.value = !isNaN(parseFloat(returnValue)) ? parseFloat(returnValue) : null;
|
|
178
180
|
// e.target.value = globalRef.current.valueString = valueT || '';
|
|
179
181
|
// globalRef.current.returnValue = returnValue || '';
|
|
180
182
|
e.target.value = globalRef.current.valueString = valueT || '';
|
|
181
|
-
e.value =
|
|
183
|
+
e.value = valueT;
|
|
182
184
|
globalRef.current.returnValue = returnValue || '';
|
|
183
185
|
onInput === null || onInput === void 0 ? void 0 : onInput(e);
|
|
184
186
|
setValue(eval(valueT));
|
|
@@ -494,10 +496,10 @@ NumberInput.propTypes = {
|
|
|
494
496
|
style: PropTypes.object,
|
|
495
497
|
/** Thousand separator character. */
|
|
496
498
|
thousandSeparator: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['.', ','])]),
|
|
497
|
-
/** Validation value, argument can:<br/>
|
|
498
|
-
* * string: the validation rule. Example required.<br/>
|
|
499
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
500
|
-
* * array: the validation rule list, insist object/string
|
|
499
|
+
/** Validation value, argument can:<br/>
|
|
500
|
+
* * string: the validation rule. Example required.<br/>
|
|
501
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
502
|
+
* * array: the validation rule list, insist object/string
|
|
501
503
|
*/
|
|
502
504
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
503
505
|
/** The value of the input element, required for a controlled component. */
|