diginet-core-ui 1.4.55-beta.7 → 1.4.55-beta.8
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,8 +172,8 @@ 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
|
+
if ((min || min === 0) && eval(valueT) < min) valueT = min;
|
|
176
|
+
if ((max || max === 0) && eval(valueT) > max) valueT = max;
|
|
177
177
|
valueT = parseNumberToMoney(valueT);
|
|
178
178
|
const returnValue = convertMoneyToNumber(valueT);
|
|
179
179
|
e.value = globalRef.current.value = !isNaN(parseFloat(returnValue)) ? parseFloat(returnValue) : null;
|
|
@@ -496,10 +496,10 @@ NumberInput.propTypes = {
|
|
|
496
496
|
style: PropTypes.object,
|
|
497
497
|
/** Thousand separator character. */
|
|
498
498
|
thousandSeparator: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['.', ','])]),
|
|
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
|
|
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
|
|
503
503
|
*/
|
|
504
504
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
505
505
|
/** The value of the input element, required for a controlled component. */
|