@pdg/react-form 1.0.13 → 1.0.14
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/@types/types.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface FormValueMap {
|
|
|
19
19
|
[key: string]: FormValue;
|
|
20
20
|
}
|
|
21
21
|
export interface FormValueItemBaseCommands<ValueType = FormItemValue> {
|
|
22
|
-
getType(): 'default' | 'FormCheckbox' | 'FormToggleButtonGroup' | 'FormRadioGroup' | 'FormRating' | 'FormTextEditor' | 'FormAutocomplete' | 'FormDatePicker' | 'FormDateTimePicker' | 'FormTimePicker' | 'FormDateRangePicker' | 'FormFile';
|
|
22
|
+
getType(): 'default' | 'FormCheckbox' | 'FormCheckboxGroup' | 'FormToggleButtonGroup' | 'FormRadioGroup' | 'FormRating' | 'FormTextEditor' | 'FormAutocomplete' | 'FormDatePicker' | 'FormDateTimePicker' | 'FormTimePicker' | 'FormDateRangePicker' | 'FormFile';
|
|
23
23
|
getName(): string;
|
|
24
24
|
getReset(): ValueType;
|
|
25
25
|
reset(): void;
|
|
@@ -11,6 +11,7 @@ export interface FormToggleButtonGroupItem {
|
|
|
11
11
|
}
|
|
12
12
|
export declare type FormToggleButtonGroupValue = FormToggleButtonGroupItemValue | FormToggleButtonGroupItemValue[] | undefined;
|
|
13
13
|
export interface FormToggleButtonGroupProps extends CommonSxProps, Omit<FormValueItemProps, 'value'>, PartialPick<FormItemBaseProps, 'required' | 'focused'> {
|
|
14
|
+
type?: 'button' | 'checkbox';
|
|
14
15
|
value?: FormToggleButtonGroupValue;
|
|
15
16
|
items?: FormToggleButtonGroupItem[];
|
|
16
17
|
multiple?: boolean;
|
|
@@ -21,7 +22,7 @@ export interface FormToggleButtonGroupProps extends CommonSxProps, Omit<FormValu
|
|
|
21
22
|
onLoadItems?: () => Promise<FormToggleButtonGroupItem[]>;
|
|
22
23
|
onValue?: (value: FormToggleButtonGroupValue) => FormToggleButtonGroupValue;
|
|
23
24
|
}
|
|
24
|
-
export declare const FormToggleButtonGroupDefaultProps: Pick<FormToggleButtonGroupProps, 'formValueSeparator'>;
|
|
25
|
+
export declare const FormToggleButtonGroupDefaultProps: Pick<FormToggleButtonGroupProps, 'type' | 'formValueSeparator'>;
|
|
25
26
|
export interface FormToggleButtonGroupExtraCommands extends FormArrayValueItemCommands, FormItemsValueItemCommands<FormToggleButtonGroupItem>, FormMultipleValueItemCommands, FormLoadingValueItemCommands {
|
|
26
27
|
}
|
|
27
28
|
export interface FormToggleButtonGroupCommands extends FormValueItemBaseCommands<FormToggleButtonGroupValue>, FormToggleButtonGroupExtraCommands {
|
package/dist/index.esm.js
CHANGED
|
@@ -4913,13 +4913,14 @@ var FormRadioGroup = React__default.forwardRef(function (_a, ref) {
|
|
|
4913
4913
|
});
|
|
4914
4914
|
FormRadioGroup.displayName = 'FormRadioGroup';
|
|
4915
4915
|
FormRadioGroup.defaultProps = FormRadioGroupDefaultProps;var FormToggleButtonGroupDefaultProps = {
|
|
4916
|
+
type: 'button',
|
|
4916
4917
|
formValueSeparator: ',',
|
|
4917
|
-
};var css_248z$b = ".FormToggleButtonGroup .ToggleButton {\n display: inline-block;\n padding: 0 10px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.FormToggleButtonGroup:not(.with-label).variant-outlined .ToggleButton {\n height: 52px;\n}\n.FormToggleButtonGroup:not(.with-label).variant-filled .ToggleButton {\n height: 52px;\n}\n.FormToggleButtonGroup:not(.with-label).variant-standard .ToggleButton {\n height: 28px;\n}\n.FormToggleButtonGroup:not(.with-label).size-small.variant-outlined .ToggleButton {\n height: 37px;\n}\n.FormToggleButtonGroup:not(.with-label).size-small.variant-filled .ToggleButton {\n height: 44px;\n}\n.FormToggleButtonGroup:not(.with-label).size-small.variant-standard .ToggleButton {\n height: 26px;\n}\n.FormToggleButtonGroup.with-label.variant-outlined .ToggleButton {\n height: 37px;\n}\n.FormToggleButtonGroup.with-label.variant-filled .ToggleButton {\n height: 37px;\n}\n.FormToggleButtonGroup.with-label.variant-standard .ToggleButton {\n height: 28px;\n}\n.FormToggleButtonGroup.with-label.size-small.variant-outlined .ToggleButton {\n height: 24px;\n}\n.FormToggleButtonGroup.with-label.size-small.variant-filled .ToggleButton {\n height: 31px;\n}\n.FormToggleButtonGroup.with-label.size-small.variant-standard .ToggleButton {\n height: 26px;\n}\n\n.Form .FormCol.with-label .FormToggleButtonGroup.variant-outlined .ToggleButton {\n height: 37px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.variant-filled .ToggleButton {\n height: 37px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.variant-standard .ToggleButton {\n height: 28px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.size-small.variant-outlined .ToggleButton {\n height: 24px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.size-small.variant-filled .ToggleButton {\n height: 31px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.size-small.variant-standard .ToggleButton {\n height: 26px;\n}";
|
|
4918
|
+
};var css_248z$b = ".FormToggleButtonGroup .ToggleButton {\n display: inline-block;\n padding: 0 10px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.FormToggleButtonGroup.type-checkbox .ToggleButton {\n padding-left: 3px;\n padding-right: 5px;\n display: flex;\n background-color: transparent !important;\n border: 0;\n}\n.FormToggleButtonGroup.type-checkbox .ToggleButton:not(:last-child) {\n margin-right: 5px;\n}\n.FormToggleButtonGroup.type-checkbox .ToggleButton .__checkbox-checked__,\n.FormToggleButtonGroup.type-checkbox .ToggleButton .__checkbox-unchecked__ {\n margin-right: 3px;\n}\n.FormToggleButtonGroup.type-checkbox .ToggleButton .__checkbox-checked__ {\n display: none;\n}\n.FormToggleButtonGroup.type-checkbox .ToggleButton.Mui-selected .__checkbox-checked__ {\n display: block;\n}\n.FormToggleButtonGroup.type-checkbox .ToggleButton.Mui-selected .__checkbox-unchecked__ {\n display: none;\n}\n.FormToggleButtonGroup:not(.with-label).variant-outlined .ToggleButton {\n height: 52px;\n}\n.FormToggleButtonGroup:not(.with-label).variant-filled .ToggleButton {\n height: 52px;\n}\n.FormToggleButtonGroup:not(.with-label).variant-standard .ToggleButton {\n height: 28px;\n}\n.FormToggleButtonGroup:not(.with-label).size-small.variant-outlined .ToggleButton {\n height: 37px;\n}\n.FormToggleButtonGroup:not(.with-label).size-small.variant-filled .ToggleButton {\n height: 44px;\n}\n.FormToggleButtonGroup:not(.with-label).size-small.variant-standard .ToggleButton {\n height: 26px;\n}\n.FormToggleButtonGroup.with-label.variant-outlined .ToggleButton {\n height: 37px;\n}\n.FormToggleButtonGroup.with-label.variant-filled .ToggleButton {\n height: 37px;\n}\n.FormToggleButtonGroup.with-label.variant-standard .ToggleButton {\n height: 28px;\n}\n.FormToggleButtonGroup.with-label.size-small.variant-outlined .ToggleButton {\n height: 24px;\n}\n.FormToggleButtonGroup.with-label.size-small.variant-filled .ToggleButton {\n height: 31px;\n}\n.FormToggleButtonGroup.with-label.size-small.variant-standard .ToggleButton {\n height: 26px;\n}\n\n.Form .FormCol.with-label .FormToggleButtonGroup.variant-outlined .ToggleButton {\n height: 37px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.variant-filled .ToggleButton {\n height: 37px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.variant-standard .ToggleButton {\n height: 28px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.size-small.variant-outlined .ToggleButton {\n height: 24px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.size-small.variant-filled .ToggleButton {\n height: 31px;\n}\n.Form .FormCol.with-label .FormToggleButtonGroup.size-small.variant-standard .ToggleButton {\n height: 26px;\n}";
|
|
4918
4919
|
styleInject(css_248z$b);var FormToggleButtonGroup = React__default.forwardRef(function (_a, ref) {
|
|
4919
4920
|
// ID --------------------------------------------------------------------------------------------------------------
|
|
4920
4921
|
var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initFullWidth = _a.fullWidth,
|
|
4921
4922
|
//----------------------------------------------------------------------------------------------------------------
|
|
4922
|
-
name = _a.name, labelIcon = _a.labelIcon, label = _a.label, initLoading = _a.loading, initItems = _a.items, initValue = _a.value, initError = _a.error, initHelperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, notAllowEmptyValue = _a.notAllowEmptyValue, exceptValue = _a.exceptValue, initWidth = _a.width, multiple = _a.multiple, formValueSeparator = _a.formValueSeparator, formValueSort = _a.formValueSort, onLoadItems = _a.onLoadItems,
|
|
4923
|
+
name = _a.name, labelIcon = _a.labelIcon, label = _a.label, type = _a.type, initLoading = _a.loading, initItems = _a.items, initValue = _a.value, initError = _a.error, initHelperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, notAllowEmptyValue = _a.notAllowEmptyValue, exceptValue = _a.exceptValue, initWidth = _a.width, multiple = _a.multiple, formValueSeparator = _a.formValueSeparator, formValueSort = _a.formValueSort, onLoadItems = _a.onLoadItems,
|
|
4923
4924
|
//----------------------------------------------------------------------------------------------------------------
|
|
4924
4925
|
onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate,
|
|
4925
4926
|
//----------------------------------------------------------------------------------------------------------------
|
|
@@ -5246,7 +5247,7 @@ styleInject(css_248z$b);var FormToggleButtonGroup = React__default.forwardRef(fu
|
|
|
5246
5247
|
if (focused) {
|
|
5247
5248
|
formControlBaseProps.focused = true;
|
|
5248
5249
|
}
|
|
5249
|
-
return (React__default.createElement(FormItemBase, __assign$4({}, formControlBaseProps, { className: classNames$1(className, 'FormValueItem', 'FormToggleButtonGroup', "variant-".concat(variant), "size-".concat(size), !!label && 'with-label', !!fullWidth && 'full-width'), variant: variant, size: size, color: color, labelIcon: labelIcon, label: label, required: required, fullWidth: fullWidth, error: error, helperText: helperText, helperTextProps: { style: { marginLeft: 2 } }, style: style, sx: sx, controlHeight: height || 0, controlVerticalCenter: isOnGetItemLoading || loading, control: isOnGetItemLoading || loading ? (React__default.createElement("div", { style: { opacity: 0.54 }, ref: resizeHeightDetectorRef },
|
|
5250
|
+
return (React__default.createElement(FormItemBase, __assign$4({}, formControlBaseProps, { className: classNames$1(className, 'FormValueItem', 'FormToggleButtonGroup', "variant-".concat(variant), "size-".concat(size), !!label && 'with-label', !!fullWidth && 'full-width', "type-".concat(type)), variant: variant, size: size, color: color, labelIcon: labelIcon, label: label, required: required, fullWidth: fullWidth, error: error, helperText: helperText, helperTextProps: { style: { marginLeft: 2 } }, style: style, sx: sx, controlHeight: height || 0, controlVerticalCenter: isOnGetItemLoading || loading, control: isOnGetItemLoading || loading ? (React__default.createElement("div", { style: { opacity: 0.54 }, ref: resizeHeightDetectorRef },
|
|
5250
5251
|
React__default.createElement(CircularProgress, { size: 16, color: 'inherit' }))) : (React__default.createElement(React__default.Fragment, null,
|
|
5251
5252
|
!fullWidth && !isOnGetItemLoading && !loading && items && (React__default.createElement("div", { ref: resizeWidthDetectorRef, style: {
|
|
5252
5253
|
display: 'grid',
|
|
@@ -5266,12 +5267,18 @@ styleInject(css_248z$b);var FormToggleButtonGroup = React__default.forwardRef(fu
|
|
|
5266
5267
|
width: !fullWidth && formColWidth && typeof width === 'number' && width > formColWidth
|
|
5267
5268
|
? formColWidth
|
|
5268
5269
|
: undefined,
|
|
5270
|
+
flexWrap: type === 'checkbox' ? 'wrap' : 'nowrap',
|
|
5269
5271
|
}, "aria-labelledby": notEmpty(label) ? labelId : undefined }, isOnGetItemLoading || loading || !items || empty$1(items) ? (React__default.createElement(ToggleButton, { ref: resizeHeightDetectorRef, size: size, className: 'ToggleButton', disabled: disabled || readOnly, value: '', style: { visibility: 'hidden' } })) : (items.map(function (_a, idx) {
|
|
5270
5272
|
var value = _a.value, label = _a.label, itemDisabled = _a.disabled, itemColor = _a.color;
|
|
5271
5273
|
return (React__default.createElement(ToggleButton, { ref: idx === 0 ? resizeHeightDetectorRef : undefined, key: idx, size: size, className: 'ToggleButton', value: value, color: itemColor || color, disabled: disabled || readOnly || itemDisabled, style: {
|
|
5272
5274
|
borderColor: error ? theme.palette.error.main : '',
|
|
5273
5275
|
color: error ? theme.palette.error.main : '',
|
|
5274
|
-
|
|
5276
|
+
width: type === 'checkbox' ? 'auto' : undefined,
|
|
5277
|
+
}, onFocus: function () { return setFocused(initFocused || true); }, onBlur: function () { return setFocused(initFocused || false); } },
|
|
5278
|
+
type === 'checkbox' && (React__default.createElement(React__default.Fragment, null,
|
|
5279
|
+
React__default.createElement(Icon$1, { className: '__checkbox-unchecked__' }, "check_box_outline_blank"),
|
|
5280
|
+
React__default.createElement(Icon$1, { className: '__checkbox-checked__' }, "check_box"))),
|
|
5281
|
+
label));
|
|
5275
5282
|
}))))) })));
|
|
5276
5283
|
});
|
|
5277
5284
|
FormToggleButtonGroup.displayName = 'FormToggleButtonGroup';
|