@pdg/react-form 1.0.66 → 1.0.67
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/index.esm.js +18 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4011,7 +4011,7 @@ function NumericFormat(props) {
|
|
|
4011
4011
|
});
|
|
4012
4012
|
NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps = __assign$7(__assign$7({}, FormTextFieldDefaultProps), { clear: true });var FormNumber = React.forwardRef(function (_a, ref) {
|
|
4013
4013
|
// State -------------------------------------------------------------------------------------------------------------
|
|
4014
|
-
var className = _a.className, allowNegative = _a.allowNegative, thousandSeparator = _a.thousandSeparator, allowDecimal = _a.allowDecimal, decimalScale = _a.decimalScale, prefix = _a.prefix, suffix = _a.suffix, readOnly = _a.readOnly, tabIndex = _a.tabIndex, initMuiInputProps = _a.InputProps, initInputProps = _a.inputProps, initValue = _a.value, onChange = _a.onChange, props = __rest$4(_a, ["className", "allowNegative", "thousandSeparator", "allowDecimal", "decimalScale", "prefix", "suffix", "readOnly", "tabIndex", "InputProps", "inputProps", "value", "onChange"]);
|
|
4014
|
+
var className = _a.className, allowNegative = _a.allowNegative, thousandSeparator = _a.thousandSeparator, allowDecimal = _a.allowDecimal, decimalScale = _a.decimalScale, prefix = _a.prefix, suffix = _a.suffix, readOnly = _a.readOnly, tabIndex = _a.tabIndex, initMuiInputProps = _a.InputProps, initInputProps = _a.inputProps, initValue = _a.value, onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate, props = __rest$4(_a, ["className", "allowNegative", "thousandSeparator", "allowDecimal", "decimalScale", "prefix", "suffix", "readOnly", "tabIndex", "InputProps", "inputProps", "value", "onChange", "onValue", "onValidate"]);
|
|
4015
4015
|
var _b = React.useState(function () { return (empty(initValue) ? '' : "".concat(initValue)); }), strValue = _b[0], setStrValue = _b[1];
|
|
4016
4016
|
// Effect ------------------------------------------------------------------------------------------------------------
|
|
4017
4017
|
React.useEffect(function () {
|
|
@@ -4055,8 +4055,24 @@ NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps
|
|
|
4055
4055
|
onChange && onChange(newValue);
|
|
4056
4056
|
setStrValue(value);
|
|
4057
4057
|
}, [onChange]);
|
|
4058
|
+
var handleValue = React.useCallback(function (value) {
|
|
4059
|
+
var finalValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
|
|
4060
|
+
if (onValue) {
|
|
4061
|
+
finalValue = onValue(finalValue);
|
|
4062
|
+
}
|
|
4063
|
+
return finalValue !== undefined ? finalValue.toString() : undefined;
|
|
4064
|
+
}, [onValue]);
|
|
4065
|
+
var handleValidate = React.useCallback(function (value) {
|
|
4066
|
+
if (onValidate) {
|
|
4067
|
+
var finalValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
|
|
4068
|
+
return onValidate(finalValue);
|
|
4069
|
+
}
|
|
4070
|
+
else {
|
|
4071
|
+
return true;
|
|
4072
|
+
}
|
|
4073
|
+
}, [onValidate]);
|
|
4058
4074
|
// Render ----------------------------------------------------------------------------------------------------------
|
|
4059
|
-
return (React.createElement(FormTextField, __assign$7({ ref: ref, className: classNames$1(className, 'FormNumber'), disableReturnKey: true, InputProps: muiInputProps, readOnly: readOnly, value: strValue, onChange: handleChange }, props)));
|
|
4075
|
+
return (React.createElement(FormTextField, __assign$7({ ref: ref, className: classNames$1(className, 'FormNumber'), disableReturnKey: true, InputProps: muiInputProps, readOnly: readOnly, value: strValue, onChange: handleChange, onValue: handleValue, onValidate: handleValidate }, props)));
|
|
4060
4076
|
});
|
|
4061
4077
|
FormNumber.displayName = 'FormNumber';
|
|
4062
4078
|
FormNumber.defaultProps = FormNumberDefaultProps;var FormSearchDefaultProps = __assign$7({}, FormTextDefaultProps);var css_248z$h = ".FormSearch input[type=search]::-webkit-search-decoration,\n.FormSearch input[type=search]::-webkit-search-cancel-button,\n.FormSearch input[type=search]::-webkit-search-results-button,\n.FormSearch input[type=search]::-webkit-search-results-decoration {\n -webkit-appearance: none;\n}";
|