@pdg/react-form 1.0.63 → 1.0.65
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/FormItemTextFieldBase/FormNumber/FormNumber.d.ts +2 -3
- package/dist/FormItemTextFieldBase/FormNumber/FormNumber.types.d.ts +3 -5
- package/dist/index.esm.js +23 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +23 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4010,13 +4010,18 @@ function NumericFormat(props) {
|
|
|
4010
4010
|
onChange({ target: { value: values.value } });
|
|
4011
4011
|
} })));
|
|
4012
4012
|
});
|
|
4013
|
-
NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps = __assign$7(__assign$7({}, FormTextFieldDefaultProps), { clear: true
|
|
4013
|
+
NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps = __assign$7(__assign$7({}, FormTextFieldDefaultProps), { clear: true });var FormNumber = React.forwardRef(function (_a, ref) {
|
|
4014
|
+
// State -------------------------------------------------------------------------------------------------------------
|
|
4015
|
+
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"]);
|
|
4016
|
+
var _b = React.useState(function () { return (empty(initValue) ? '' : "".concat(initValue)); }), strValue = _b[0], setStrValue = _b[1];
|
|
4017
|
+
// Effect ------------------------------------------------------------------------------------------------------------
|
|
4018
|
+
React.useEffect(function () {
|
|
4019
|
+
setStrValue(empty(initValue) ? '' : "".concat(initValue));
|
|
4020
|
+
}, [initValue]);
|
|
4014
4021
|
// Memo --------------------------------------------------------------------------------------------------------------
|
|
4015
|
-
var className = _a.className, allowLeadingZeros = _a.allowLeadingZeros, 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, props = __rest$4(_a, ["className", "allowLeadingZeros", "allowNegative", "thousandSeparator", "allowDecimal", "decimalScale", "prefix", "suffix", "readOnly", "tabIndex", "InputProps"]);
|
|
4016
4022
|
var muiInputProps = React.useMemo(function () {
|
|
4017
4023
|
var inputProps = {
|
|
4018
4024
|
className: readOnly ? 'Mui-disabled' : undefined,
|
|
4019
|
-
allowLeadingZeros: !!allowLeadingZeros,
|
|
4020
4025
|
allowNegative: !!allowNegative,
|
|
4021
4026
|
thousandSeparator: thousandSeparator,
|
|
4022
4027
|
prefix: prefix,
|
|
@@ -4032,21 +4037,27 @@ NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps
|
|
|
4032
4037
|
else {
|
|
4033
4038
|
inputProps.decimalScale = 0;
|
|
4034
4039
|
}
|
|
4035
|
-
return __assign$7(__assign$7({}, initMuiInputProps), { inputComponent: NumberFormatCustom, inputProps: inputProps });
|
|
4040
|
+
return __assign$7(__assign$7({}, initMuiInputProps), { inputComponent: NumberFormatCustom, inputProps: __assign$7(__assign$7({}, initInputProps), inputProps) });
|
|
4036
4041
|
}, [
|
|
4037
|
-
|
|
4038
|
-
allowLeadingZeros,
|
|
4042
|
+
readOnly,
|
|
4039
4043
|
allowNegative,
|
|
4040
|
-
|
|
4041
|
-
initMuiInputProps,
|
|
4044
|
+
thousandSeparator,
|
|
4042
4045
|
prefix,
|
|
4043
|
-
readOnly,
|
|
4044
|
-
tabIndex,
|
|
4045
4046
|
suffix,
|
|
4046
|
-
|
|
4047
|
+
tabIndex,
|
|
4048
|
+
allowDecimal,
|
|
4049
|
+
initMuiInputProps,
|
|
4050
|
+
initInputProps,
|
|
4051
|
+
decimalScale,
|
|
4047
4052
|
]);
|
|
4053
|
+
// Event Handler -----------------------------------------------------------------------------------------------------
|
|
4054
|
+
var handleChange = React.useCallback(function (value) {
|
|
4055
|
+
var newValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
|
|
4056
|
+
onChange && onChange(newValue);
|
|
4057
|
+
setStrValue(value);
|
|
4058
|
+
}, [onChange]);
|
|
4048
4059
|
// Render ----------------------------------------------------------------------------------------------------------
|
|
4049
|
-
return (React.createElement(FormTextField, __assign$7({ ref: ref, className: classNames$1(className, 'FormNumber'), disableReturnKey: true, InputProps: muiInputProps, readOnly: readOnly }, props)));
|
|
4060
|
+
return (React.createElement(FormTextField, __assign$7({ ref: ref, className: classNames$1(className, 'FormNumber'), disableReturnKey: true, InputProps: muiInputProps, readOnly: readOnly, value: strValue, onChange: handleChange }, props)));
|
|
4050
4061
|
});
|
|
4051
4062
|
FormNumber.displayName = 'FormNumber';
|
|
4052
4063
|
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}";
|