@pdg/react-form 1.0.62 → 1.0.64
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/FormItemCustom/FormToggleButtonGroup/FormToggleButtonGroup.types.d.ts +1 -1
- package/dist/FormItemTextFieldBase/FormNumber/FormNumber.d.ts +2 -3
- package/dist/FormItemTextFieldBase/FormNumber/FormNumber.types.d.ts +3 -5
- package/dist/index.esm.js +15 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ export interface FormToggleButtonGroupProps<T extends FormToggleButtonGroupSingl
|
|
|
15
15
|
type?: 'button' | 'checkbox' | 'radio';
|
|
16
16
|
value?: FormToggleButtonGroupValue<T, Multiple>;
|
|
17
17
|
items?: FormToggleButtonGroupItem<T>[];
|
|
18
|
-
multiple?:
|
|
18
|
+
multiple?: Multiple;
|
|
19
19
|
notAllowEmptyValue?: boolean;
|
|
20
20
|
formValueSeparator?: string;
|
|
21
21
|
formValueSort?: boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FormNumberCommands
|
|
3
|
-
declare const FormNumber: React.ForwardRefExoticComponent<Omit<import("../FormTextField").FormTextFieldProps<
|
|
4
|
-
allowLeadingZeros?: boolean | undefined;
|
|
2
|
+
import { FormNumberCommands } from './FormNumber.types';
|
|
3
|
+
declare const FormNumber: React.ForwardRefExoticComponent<Omit<import("../FormTextField").FormTextFieldProps<number, true, number | undefined>, "type"> & {
|
|
5
4
|
allowNegative?: boolean | undefined;
|
|
6
5
|
thousandSeparator?: boolean | undefined;
|
|
7
6
|
allowDecimal?: boolean | undefined;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { FormTextFieldCommands, FormTextFieldProps } from '../FormTextField';
|
|
2
|
-
export type
|
|
3
|
-
export type
|
|
4
|
-
export type FormNumberProps = Omit<FormTextFieldProps<FormNumberValue, false>, 'type'> & {
|
|
5
|
-
allowLeadingZeros?: boolean;
|
|
2
|
+
export type FormNumberCommands = FormTextFieldCommands<number>;
|
|
3
|
+
export type FormNumberProps = Omit<FormTextFieldProps<number>, 'type'> & {
|
|
6
4
|
allowNegative?: boolean;
|
|
7
5
|
thousandSeparator?: boolean;
|
|
8
6
|
allowDecimal?: boolean;
|
|
@@ -10,4 +8,4 @@ export type FormNumberProps = Omit<FormTextFieldProps<FormNumberValue, false>, '
|
|
|
10
8
|
prefix?: string;
|
|
11
9
|
suffix?: string;
|
|
12
10
|
};
|
|
13
|
-
export declare const FormNumberDefaultProps: Pick<FormNumberProps, '
|
|
11
|
+
export declare const FormNumberDefaultProps: Pick<FormNumberProps, 'clear'>;
|
package/dist/index.esm.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__default.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, initValue = _a.value, onChange = _a.onChange, props = __rest$4(_a, ["className", "allowNegative", "thousandSeparator", "allowDecimal", "decimalScale", "prefix", "suffix", "readOnly", "tabIndex", "InputProps", "value", "onChange"]);
|
|
4016
|
+
var _b = useState(function () { return (empty(initValue) ? '' : "".concat(initValue)); }), strValue = _b[0], setStrValue = _b[1];
|
|
4017
|
+
// Effect ------------------------------------------------------------------------------------------------------------
|
|
4018
|
+
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 = 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,
|
|
@@ -4035,7 +4040,6 @@ NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps
|
|
|
4035
4040
|
return __assign$7(__assign$7({}, initMuiInputProps), { inputComponent: NumberFormatCustom, inputProps: inputProps });
|
|
4036
4041
|
}, [
|
|
4037
4042
|
allowDecimal,
|
|
4038
|
-
allowLeadingZeros,
|
|
4039
4043
|
allowNegative,
|
|
4040
4044
|
decimalScale,
|
|
4041
4045
|
initMuiInputProps,
|
|
@@ -4045,8 +4049,14 @@ NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps
|
|
|
4045
4049
|
suffix,
|
|
4046
4050
|
thousandSeparator,
|
|
4047
4051
|
]);
|
|
4052
|
+
// Event Handler -----------------------------------------------------------------------------------------------------
|
|
4053
|
+
var handleChange = useCallback(function (value) {
|
|
4054
|
+
var newValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
|
|
4055
|
+
onChange && onChange(newValue);
|
|
4056
|
+
setStrValue(value);
|
|
4057
|
+
}, [onChange]);
|
|
4048
4058
|
// Render ----------------------------------------------------------------------------------------------------------
|
|
4049
|
-
return (React__default.createElement(FormTextField, __assign$7({ ref: ref, className: classNames$1(className, 'FormNumber'), disableReturnKey: true, InputProps: muiInputProps, readOnly: readOnly }, props)));
|
|
4059
|
+
return (React__default.createElement(FormTextField, __assign$7({ ref: ref, className: classNames$1(className, 'FormNumber'), disableReturnKey: true, InputProps: muiInputProps, readOnly: readOnly, value: strValue, onChange: handleChange }, props)));
|
|
4050
4060
|
});
|
|
4051
4061
|
FormNumber.displayName = 'FormNumber';
|
|
4052
4062
|
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}";
|