@pdg/react-form 1.0.60 → 1.0.62
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/FormAutocomplete/FormAutocomplete.types.d.ts +2 -2
- package/dist/FormItemCustom/FormRadioGroup/FormRadioGroup.types.d.ts +1 -1
- package/dist/FormItemCustom/FormToggleButtonGroup/FormToggleButtonGroup.types.d.ts +1 -1
- package/dist/FormItemTextFieldBase/FormSelect/FormSelect.types.d.ts +1 -1
- package/dist/index.esm.js +10 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { CommonSxProps, FormMultipleValueItemCommands } from '../../@types';
|
|
3
3
|
import { FormArrayValueItemCommands, FormItemsValueItemCommands, FormLoadingValueItemCommands, FormValueItemBaseCommands, FormValueItemProps } from '../../@types';
|
|
4
4
|
import { FormTextFieldProps } from '../../FormItemTextFieldBase';
|
|
5
|
-
export type FormAutocompleteSingleValue = string | number;
|
|
5
|
+
export type FormAutocompleteSingleValue = string | number | boolean;
|
|
6
6
|
export interface FormAutocompleteItem<T extends FormAutocompleteSingleValue> {
|
|
7
|
-
label:
|
|
7
|
+
label: ReactNode;
|
|
8
8
|
value: T;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
[key: string]: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { CommonSxProps, FormItemsValueItemCommands, FormLoadingValueItemCommands, FormValueItemBaseCommands, FormValueItemProps } from '../../@types';
|
|
3
|
-
export type FormRadioGroupSingleValue = string | number;
|
|
3
|
+
export type FormRadioGroupSingleValue = string | number | boolean;
|
|
4
4
|
export interface FormRadioGroupItem<T extends FormRadioGroupSingleValue> {
|
|
5
5
|
label: ReactNode;
|
|
6
6
|
value: T;
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { ToggleButtonProps } from '@mui/material';
|
|
3
3
|
import { PartialPick, CommonSxProps, FormMultipleValueItemCommands, FormArrayValueItemCommands, FormItemsValueItemCommands, FormLoadingValueItemCommands, FormValueItemBaseCommands, FormValueItemProps } from '../../@types';
|
|
4
4
|
import { FormItemBaseProps } from '../FormItemBase';
|
|
5
|
-
export type FormToggleButtonGroupSingleValue = string | number;
|
|
5
|
+
export type FormToggleButtonGroupSingleValue = string | number | boolean;
|
|
6
6
|
export interface FormToggleButtonGroupItem<T extends FormToggleButtonGroupSingleValue> {
|
|
7
7
|
label: ReactNode;
|
|
8
8
|
value: T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { FormArrayValueItemCommands, FormItemsValueItemCommands, FormLoadingValueItemCommands, FormValueItemBaseCommands, FormMultipleValueItemCommands } from '../../@types';
|
|
3
3
|
import { FormTextFieldProps } from '../FormTextField';
|
|
4
|
-
export type FormSelectSingleValue = string | number;
|
|
4
|
+
export type FormSelectSingleValue = string | number | boolean;
|
|
5
5
|
export type FormSelectValue<T extends FormSelectSingleValue, Multiple extends boolean | undefined> = [
|
|
6
6
|
Multiple
|
|
7
7
|
] extends [true] ? T[] : '' | T;
|
package/dist/index.esm.js
CHANGED
|
@@ -4102,7 +4102,7 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
4102
4102
|
useEffect(function () {
|
|
4103
4103
|
if (items) {
|
|
4104
4104
|
setItemValueLabels(items.reduce(function (res, item) {
|
|
4105
|
-
res[item.value] = item.label;
|
|
4105
|
+
res["".concat(item.value)] = item.label;
|
|
4106
4106
|
return res;
|
|
4107
4107
|
}, {}));
|
|
4108
4108
|
setHasEmptyValue(!!items.find(function (_a) {
|
|
@@ -4120,7 +4120,7 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
4120
4120
|
if (items) {
|
|
4121
4121
|
return items.reduce(function (res, _a) {
|
|
4122
4122
|
var value = _a.value;
|
|
4123
|
-
res[
|
|
4123
|
+
res["".concat(value)] = value;
|
|
4124
4124
|
return res;
|
|
4125
4125
|
}, {});
|
|
4126
4126
|
}
|
|
@@ -4170,13 +4170,13 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
4170
4170
|
if (multiple) {
|
|
4171
4171
|
if (Array.isArray(finalValue)) {
|
|
4172
4172
|
finalValue = finalValue.map(function (v) {
|
|
4173
|
-
var realValue = itemsValues[
|
|
4173
|
+
var realValue = itemsValues["".concat(v)];
|
|
4174
4174
|
return realValue != null ? realValue : v;
|
|
4175
4175
|
});
|
|
4176
4176
|
}
|
|
4177
4177
|
}
|
|
4178
4178
|
else {
|
|
4179
|
-
var realValue = itemsValues[
|
|
4179
|
+
var realValue = itemsValues["".concat(finalValue)];
|
|
4180
4180
|
if (realValue != null && finalValue !== realValue) {
|
|
4181
4181
|
finalValue = realValue;
|
|
4182
4182
|
}
|
|
@@ -4228,7 +4228,7 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
4228
4228
|
return React__default.createElement(Chip, { key: value || '$$$EmptyValuePlaceholder$$$', label: 'hahaha', size: 'small' });
|
|
4229
4229
|
}
|
|
4230
4230
|
else {
|
|
4231
|
-
return React__default.createElement(Chip, { key: value, label: itemValueLabels[value], size: 'small' });
|
|
4231
|
+
return React__default.createElement(Chip, { key: value, label: itemValueLabels["".concat(value)], size: 'small' });
|
|
4232
4232
|
}
|
|
4233
4233
|
})));
|
|
4234
4234
|
}
|
|
@@ -4312,7 +4312,7 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
4312
4312
|
isSelectedPlaceholder && (React__default.createElement(MenuItem, { key: '$$$EmptyValuePlaceholder$$$', value: '', disabled: true, sx: { display: 'none' } }, placeholder)),
|
|
4313
4313
|
items && notEmpty(items) ? (items.map(function (_a) {
|
|
4314
4314
|
var itemLabel = _a.label, itemValue = _a.value, disabled = _a.disabled;
|
|
4315
|
-
return (React__default.createElement(MenuItem, { key: empty(itemValue) ? '$$$EmptyValue$$$' : itemValue, value: itemValue, disabled: disabled },
|
|
4315
|
+
return (React__default.createElement(MenuItem, { key: empty(itemValue) ? '$$$EmptyValue$$$' : "".concat(itemValue), value: typeof itemValue === 'boolean' ? "".concat(itemValue) : itemValue, disabled: disabled },
|
|
4316
4316
|
multiple && checkbox && Array.isArray(value) && React__default.createElement(Checkbox, { checked: value.includes(itemValue) }),
|
|
4317
4317
|
itemLabel));
|
|
4318
4318
|
})) : (React__default.createElement(MenuItem, { value: '' })))));
|
|
@@ -5085,7 +5085,7 @@ styleInject(css_248z$d);var FormToggleButtonGroup = ToForwardRefExoticComponent(
|
|
|
5085
5085
|
if (items) {
|
|
5086
5086
|
return items.reduce(function (res, _a) {
|
|
5087
5087
|
var value = _a.value;
|
|
5088
|
-
res[
|
|
5088
|
+
res["".concat(value)] = value;
|
|
5089
5089
|
return res;
|
|
5090
5090
|
}, {});
|
|
5091
5091
|
}
|
|
@@ -5149,13 +5149,13 @@ styleInject(css_248z$d);var FormToggleButtonGroup = ToForwardRefExoticComponent(
|
|
|
5149
5149
|
if (multiple) {
|
|
5150
5150
|
if (Array.isArray(finalValue)) {
|
|
5151
5151
|
finalValue = finalValue.map(function (v) {
|
|
5152
|
-
var realValue = itemsValues[
|
|
5152
|
+
var realValue = itemsValues["".concat(v)];
|
|
5153
5153
|
return realValue != null ? realValue : v;
|
|
5154
5154
|
});
|
|
5155
5155
|
}
|
|
5156
5156
|
}
|
|
5157
5157
|
else {
|
|
5158
|
-
var realValue = itemsValues[
|
|
5158
|
+
var realValue = itemsValues["".concat(finalValue)];
|
|
5159
5159
|
if (realValue != null && finalValue !== realValue) {
|
|
5160
5160
|
finalValue = realValue;
|
|
5161
5161
|
}
|
|
@@ -8112,7 +8112,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
8112
8112
|
}
|
|
8113
8113
|
}, [getOptionDisabled]);
|
|
8114
8114
|
// Render ----------------------------------------------------------------------------------------------------------
|
|
8115
|
-
return (React__default.createElement(Autocomplete, { options: items || [], className: classNames$1(className, 'FormValueItem', 'FormAutocomplete'), sx: sx, multiple: multiple, fullWidth: !width && fullWidth, openOnFocus: openOnFocus, disableClearable: disableClearable, disablePortal: disablePortal, noOptionsText: noOptionsText, value: componentValue, style: style, isOptionEqualToValue: function (option, value) { return option.value === value.value; }, getOptionDisabled: handleGetOptionDisabled, disabled: disabled, readOnly: readOnly, loading: loading || isOnGetItemLoading, loadingText: loadingText, limitTags: limitTags, onChange: function (e, value, reason, details) { return handleChange(value, reason, details); }, renderOption: function (props, option) { return (React__default.createElement("li", __assign$7({}, props, { key: option.value }), onRenderItem ? onRenderItem(option) : option.label)); }, onInputChange: function (event, newInputValue, reason) {
|
|
8115
|
+
return (React__default.createElement(Autocomplete, { options: items || [], className: classNames$1(className, 'FormValueItem', 'FormAutocomplete'), sx: sx, multiple: multiple, fullWidth: !width && fullWidth, openOnFocus: openOnFocus, disableClearable: disableClearable, disablePortal: disablePortal, noOptionsText: noOptionsText, value: componentValue, style: style, isOptionEqualToValue: function (option, value) { return option.value === value.value; }, getOptionDisabled: handleGetOptionDisabled, disabled: disabled, readOnly: readOnly, loading: loading || isOnGetItemLoading, loadingText: loadingText, limitTags: limitTags, onChange: function (e, value, reason, details) { return handleChange(value, reason, details); }, renderOption: function (props, option) { return (React__default.createElement("li", __assign$7({}, props, { key: "".concat(option.value) }), onRenderItem ? onRenderItem(option) : option.label)); }, onInputChange: function (event, newInputValue, reason) {
|
|
8116
8116
|
if (reason === 'input') {
|
|
8117
8117
|
setInputValue(newInputValue);
|
|
8118
8118
|
}
|