@rjsf/mui 6.6.1 → 6.6.2
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.cjs +90 -71
- package/dist/index.cjs.map +3 -3
- package/dist/mui.esm.js +103 -145
- package/dist/mui.esm.js.map +3 -3
- package/dist/mui.umd.js +85 -67
- package/lib/AddButton/AddButton.d.ts +1 -1
- package/lib/AddButton/AddButton.js +1 -1
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +4 -4
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +4 -4
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +3 -3
- package/lib/BaseInputTemplate/BaseInputTemplate.js +7 -7
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +3 -3
- package/lib/CheckboxWidget/CheckboxWidget.js +5 -5
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +4 -4
- package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.d.ts +2 -2
- package/lib/DescriptionField/DescriptionField.js +1 -1
- package/lib/DescriptionField/DescriptionField.js.map +1 -1
- package/lib/ErrorList/ErrorList.d.ts +8 -8
- package/lib/ErrorList/ErrorList.js +2 -4
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +4 -4
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +2 -4
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +2 -2
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +3 -3
- package/lib/FieldTemplate/FieldTemplate.js +2 -2
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +1 -1
- package/lib/IconButton/IconButton.d.ts +14 -7
- package/lib/IconButton/IconButton.js +15 -7
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MuiForm/MuiForm.d.ts +3 -3
- package/lib/MuiForm/MuiForm.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +3 -3
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +3 -3
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +4 -4
- package/lib/RadioWidget/RadioWidget.js +6 -6
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +2 -2
- package/lib/RangeWidget/RangeWidget.js +6 -6
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +3 -3
- package/lib/SelectWidget/SelectWidget.js +7 -7
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +3 -3
- package/lib/SubmitButton/SubmitButton.js +1 -1
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/Theme/Theme.d.ts +2 -2
- package/lib/TitleField/TitleField.d.ts +5 -5
- package/lib/TitleField/TitleField.js +1 -1
- package/lib/TitleField/TitleField.js.map +1 -1
- package/lib/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +2 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util.d.ts +2 -2
- package/lib/util.js +3 -3
- package/package.json +6 -6
- package/src/AddButton/AddButton.tsx +4 -9
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +9 -7
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +8 -7
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +17 -18
- package/src/CheckboxWidget/CheckboxWidget.tsx +12 -20
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +16 -17
- package/src/DescriptionField/DescriptionField.tsx +4 -3
- package/src/ErrorList/ErrorList.tsx +26 -27
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +17 -22
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +4 -10
- package/src/FieldTemplate/FieldTemplate.tsx +8 -13
- package/src/GridTemplate/GridTemplate.tsx +1 -1
- package/src/IconButton/IconButton.tsx +20 -19
- package/src/MuiForm/MuiForm.tsx +4 -3
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +6 -4
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +6 -10
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
- package/src/RadioWidget/RadioWidget.tsx +17 -18
- package/src/RangeWidget/RangeWidget.tsx +12 -19
- package/src/SelectWidget/SelectWidget.tsx +21 -20
- package/src/SubmitButton/SubmitButton.tsx +6 -11
- package/src/Templates/Templates.ts +1 -1
- package/src/TextareaWidget/TextareaWidget.tsx +2 -1
- package/src/Theme/Theme.tsx +2 -2
- package/src/TitleField/TitleField.tsx +11 -13
- package/src/Widgets/Widgets.ts +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +6 -8
- package/src/util.ts +5 -5
package/dist/index.cjs
CHANGED
|
@@ -58,9 +58,9 @@ function getMuiProps(options, propsToFilter, rjsfSlotPropsOnly) {
|
|
|
58
58
|
return { rjsfSlotProps };
|
|
59
59
|
}
|
|
60
60
|
if (propsToFilter) {
|
|
61
|
-
return Object.keys(muiProps).filter((key) => propsToFilter.includes(key)).reduce((
|
|
62
|
-
|
|
63
|
-
return
|
|
61
|
+
return Object.keys(muiProps).filter((key) => propsToFilter.includes(key)).reduce((acc, key) => {
|
|
62
|
+
acc[key] = muiProps[key];
|
|
63
|
+
return acc;
|
|
64
64
|
}, {});
|
|
65
65
|
}
|
|
66
66
|
return muiProps;
|
|
@@ -299,11 +299,11 @@ function BaseInputTemplate(props) {
|
|
|
299
299
|
accept,
|
|
300
300
|
...schema.examples ? { list: (0, import_utils4.examplesId)(id) } : void 0
|
|
301
301
|
};
|
|
302
|
-
const
|
|
303
|
-
const
|
|
304
|
-
const
|
|
302
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
303
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
304
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
305
305
|
const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps, shrink: true } : { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps };
|
|
306
|
-
const
|
|
306
|
+
const handleClear = (0, import_react.useCallback)(
|
|
307
307
|
(e) => {
|
|
308
308
|
e.preventDefault();
|
|
309
309
|
e.stopPropagation();
|
|
@@ -313,7 +313,7 @@ function BaseInputTemplate(props) {
|
|
|
313
313
|
);
|
|
314
314
|
const inputProps = { ...InputProps, ...slotProps?.input, ...muiSlotProps?.input };
|
|
315
315
|
if (options.allowClearTextInputs && value && !readonly && !disabled) {
|
|
316
|
-
const clearAdornment = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_InputAdornment.default, { position: "end", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClearButton2, { registry, onClick:
|
|
316
|
+
const clearAdornment = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_InputAdornment.default, { position: "end", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClearButton2, { registry, onClick: handleClear }) });
|
|
317
317
|
inputProps.endAdornment = !inputProps.endAdornment ? clearAdornment : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
318
318
|
inputProps.endAdornment,
|
|
319
319
|
clearAdornment
|
|
@@ -340,9 +340,9 @@ function BaseInputTemplate(props) {
|
|
|
340
340
|
...rest,
|
|
341
341
|
value: value || value === 0 ? value : "",
|
|
342
342
|
error: rawErrors.length > 0,
|
|
343
|
-
onChange: onChangeOverride ||
|
|
344
|
-
onBlur:
|
|
345
|
-
onFocus:
|
|
343
|
+
onChange: onChangeOverride || handleChange,
|
|
344
|
+
onBlur: handleBlur,
|
|
345
|
+
onFocus: handleFocus,
|
|
346
346
|
...{ ...otherMuiProps, ...textFieldProps },
|
|
347
347
|
"aria-describedby": (0, import_utils4.ariaDescribedByIds)(id, !!schema.examples)
|
|
348
348
|
}
|
|
@@ -406,12 +406,13 @@ function ErrorList({
|
|
|
406
406
|
} = getMuiProps(uiOptions);
|
|
407
407
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Paper3.default, { elevation: 2, ...errorPaper, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_Box3.default, { ...errorBox, sx: computeSxProps({ mb: 2, p: 2 }, errorBox), children: [
|
|
408
408
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Typography2.default, { variant: "h6", ...errorTypography, children: translateString(import_utils6.TranslatableString.ErrorsLabel) }),
|
|
409
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_List.default, { dense: true, ...errorList, children: errors.map((error, i) =>
|
|
410
|
-
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_List.default, { dense: true, ...errorList, children: errors.map((error, i) => (
|
|
410
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
411
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_ListItem.default, { ...errorListItem, children: [
|
|
411
412
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListItemIcon.default, { ...errorListItemIcon, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Error.default, { color: "error" }) }),
|
|
412
413
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListItemText.default, { primary: error.stack, ...errorListItemText })
|
|
413
|
-
] }, i)
|
|
414
|
-
|
|
414
|
+
] }, i)
|
|
415
|
+
)) })
|
|
415
416
|
] }) });
|
|
416
417
|
}
|
|
417
418
|
|
|
@@ -430,9 +431,10 @@ function FieldErrorTemplate(props) {
|
|
|
430
431
|
const uiOptions = (0, import_utils7.getUiOptions)(uiSchema);
|
|
431
432
|
const muiProps = getMuiProps(uiOptions);
|
|
432
433
|
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
433
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_List2.default, { id, dense: true, disablePadding: true, ...muiSlotProps?.fieldErrorList, children: errors.map((error, i) =>
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_List2.default, { id, dense: true, disablePadding: true, ...muiSlotProps?.fieldErrorList, children: errors.map((error, i) => (
|
|
435
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
436
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ListItem2.default, { disableGutters: true, ...muiSlotProps?.fieldErrorListItem, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_FormHelperText.default, { component: "div", id: `${id}-${i}`, ...muiSlotProps?.fieldErrorFormHelperText, children: error }) }, i)
|
|
437
|
+
)) });
|
|
436
438
|
}
|
|
437
439
|
|
|
438
440
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
@@ -521,7 +523,7 @@ function FieldTemplate(props) {
|
|
|
521
523
|
import_FormControl.default,
|
|
522
524
|
{
|
|
523
525
|
fullWidth: true,
|
|
524
|
-
error: rawErrors.length
|
|
526
|
+
error: !!rawErrors.length,
|
|
525
527
|
required,
|
|
526
528
|
...muiSlotProps?.fieldFormControl,
|
|
527
529
|
sx: otherMuiProps.sx,
|
|
@@ -547,6 +549,7 @@ function GridTemplate(props) {
|
|
|
547
549
|
}
|
|
548
550
|
|
|
549
551
|
// src/IconButton/IconButton.tsx
|
|
552
|
+
var import_react2 = require("react");
|
|
550
553
|
var import_ArrowDownward = __toESM(require("@mui/icons-material/ArrowDownward"), 1);
|
|
551
554
|
var import_ArrowUpward = __toESM(require("@mui/icons-material/ArrowUpward"), 1);
|
|
552
555
|
var import_Clear = __toESM(require("@mui/icons-material/Clear"), 1);
|
|
@@ -555,7 +558,7 @@ var import_Remove = __toESM(require("@mui/icons-material/Remove"), 1);
|
|
|
555
558
|
var import_IconButton2 = __toESM(require("@mui/material/IconButton"), 1);
|
|
556
559
|
var import_utils10 = require("@rjsf/utils");
|
|
557
560
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
558
|
-
function
|
|
561
|
+
function MuiIconButtonFn(props) {
|
|
559
562
|
const { icon, color, uiSchema, registry, ...otherProps } = props;
|
|
560
563
|
const uiOptions = (0, import_utils10.getUiOptions)(uiSchema);
|
|
561
564
|
const muiProps = getMuiProps(uiOptions, [
|
|
@@ -568,7 +571,9 @@ function MuiIconButton(props) {
|
|
|
568
571
|
]);
|
|
569
572
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_IconButton2.default, { ...muiProps, ...otherProps, size: "small", color, children: icon });
|
|
570
573
|
}
|
|
571
|
-
|
|
574
|
+
var MuiIconButton = (0, import_react2.memo)(MuiIconButtonFn);
|
|
575
|
+
var IconButton_default = MuiIconButton;
|
|
576
|
+
function CopyButtonFn(props) {
|
|
572
577
|
const {
|
|
573
578
|
registry: { translateString }
|
|
574
579
|
} = props;
|
|
@@ -581,7 +586,8 @@ function CopyButton(props) {
|
|
|
581
586
|
}
|
|
582
587
|
);
|
|
583
588
|
}
|
|
584
|
-
|
|
589
|
+
var CopyButton = (0, import_react2.memo)(CopyButtonFn);
|
|
590
|
+
function MoveDownButtonFn(props) {
|
|
585
591
|
const {
|
|
586
592
|
registry: { translateString }
|
|
587
593
|
} = props;
|
|
@@ -594,7 +600,8 @@ function MoveDownButton(props) {
|
|
|
594
600
|
}
|
|
595
601
|
);
|
|
596
602
|
}
|
|
597
|
-
|
|
603
|
+
var MoveDownButton = (0, import_react2.memo)(MoveDownButtonFn);
|
|
604
|
+
function MoveUpButtonFn(props) {
|
|
598
605
|
const {
|
|
599
606
|
registry: { translateString }
|
|
600
607
|
} = props;
|
|
@@ -607,7 +614,8 @@ function MoveUpButton(props) {
|
|
|
607
614
|
}
|
|
608
615
|
);
|
|
609
616
|
}
|
|
610
|
-
|
|
617
|
+
var MoveUpButton = (0, import_react2.memo)(MoveUpButtonFn);
|
|
618
|
+
function RemoveButtonFn(props) {
|
|
611
619
|
const { iconType, ...otherProps } = props;
|
|
612
620
|
const {
|
|
613
621
|
registry: { translateString }
|
|
@@ -622,7 +630,8 @@ function RemoveButton(props) {
|
|
|
622
630
|
}
|
|
623
631
|
);
|
|
624
632
|
}
|
|
625
|
-
|
|
633
|
+
var RemoveButton = (0, import_react2.memo)(RemoveButtonFn);
|
|
634
|
+
function ClearButtonFn(props) {
|
|
626
635
|
const { iconType, ...otherProps } = props;
|
|
627
636
|
const {
|
|
628
637
|
registry: { translateString }
|
|
@@ -636,6 +645,7 @@ function ClearButton(props) {
|
|
|
636
645
|
}
|
|
637
646
|
);
|
|
638
647
|
}
|
|
648
|
+
var ClearButton = (0, import_react2.memo)(ClearButtonFn);
|
|
639
649
|
|
|
640
650
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
641
651
|
var import_Box4 = __toESM(require("@mui/material/Box"), 1);
|
|
@@ -719,7 +729,7 @@ function ObjectFieldTemplate(props) {
|
|
|
719
729
|
children: [
|
|
720
730
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
721
731
|
properties.map(
|
|
722
|
-
(element
|
|
732
|
+
(element) => (
|
|
723
733
|
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
724
734
|
// itself would otherwise still take up space.
|
|
725
735
|
element.hidden ? element.content : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -730,7 +740,7 @@ function ObjectFieldTemplate(props) {
|
|
|
730
740
|
sx: computeSxProps({ mb: 1.25 }, objectGridItem),
|
|
731
741
|
children: element.content
|
|
732
742
|
},
|
|
733
|
-
|
|
743
|
+
element.name
|
|
734
744
|
)
|
|
735
745
|
)
|
|
736
746
|
)
|
|
@@ -766,7 +776,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
766
776
|
const { id, registry, label, onAddClick, onRemoveClick, uiSchema } = props;
|
|
767
777
|
if (onAddClick) {
|
|
768
778
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
769
|
-
|
|
779
|
+
IconButton_default,
|
|
770
780
|
{
|
|
771
781
|
id,
|
|
772
782
|
registry,
|
|
@@ -777,7 +787,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
777
787
|
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Add2.default, { fontSize: "small" })
|
|
778
788
|
}
|
|
779
789
|
);
|
|
780
|
-
}
|
|
790
|
+
}
|
|
791
|
+
if (onRemoveClick) {
|
|
781
792
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
782
793
|
RemoveButton,
|
|
783
794
|
{
|
|
@@ -978,7 +989,7 @@ var import_FormGroup = __toESM(require("@mui/material/FormGroup"), 1);
|
|
|
978
989
|
var import_FormLabel = __toESM(require("@mui/material/FormLabel"), 1);
|
|
979
990
|
var import_utils16 = require("@rjsf/utils");
|
|
980
991
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
981
|
-
var
|
|
992
|
+
var import_react3 = require("react");
|
|
982
993
|
function CheckboxesWidget(props) {
|
|
983
994
|
const {
|
|
984
995
|
label,
|
|
@@ -998,15 +1009,15 @@ function CheckboxesWidget(props) {
|
|
|
998
1009
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
999
1010
|
const optionValueFormat = (0, import_utils16.getOptionValueFormat)(options);
|
|
1000
1011
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
1001
|
-
const
|
|
1012
|
+
const handleChange = (index) => ({ target: { checked } }) => {
|
|
1002
1013
|
if (checked) {
|
|
1003
1014
|
onChange((0, import_utils16.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
1004
1015
|
} else {
|
|
1005
1016
|
onChange((0, import_utils16.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
1006
1017
|
}
|
|
1007
1018
|
};
|
|
1008
|
-
const
|
|
1009
|
-
const
|
|
1019
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils16.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1020
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils16.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1010
1021
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
1011
1022
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1012
1023
|
(0, import_utils16.labelValue)(
|
|
@@ -1015,7 +1026,7 @@ function CheckboxesWidget(props) {
|
|
|
1015
1026
|
),
|
|
1016
1027
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_FormGroup.default, { ...otherMuiProps, ...muiSlotProps?.formGroup, id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1017
1028
|
const checked = (0, import_utils16.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
1018
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
1029
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
1019
1030
|
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1020
1031
|
import_Checkbox.default,
|
|
1021
1032
|
{
|
|
@@ -1025,18 +1036,18 @@ function CheckboxesWidget(props) {
|
|
|
1025
1036
|
checked,
|
|
1026
1037
|
disabled: disabled || itemDisabled || readonly,
|
|
1027
1038
|
autoFocus: autofocus && index === 0,
|
|
1028
|
-
onChange:
|
|
1029
|
-
onBlur:
|
|
1030
|
-
onFocus:
|
|
1039
|
+
onChange: handleChange(index),
|
|
1040
|
+
onBlur: handleBlur,
|
|
1041
|
+
onFocus: handleFocus,
|
|
1031
1042
|
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id)
|
|
1032
1043
|
}
|
|
1033
1044
|
);
|
|
1034
|
-
return /* @__PURE__ */ (0,
|
|
1045
|
+
return /* @__PURE__ */ (0, import_react3.createElement)(
|
|
1035
1046
|
import_FormControlLabel.default,
|
|
1036
1047
|
{
|
|
1037
1048
|
...muiSlotProps?.formControlLabel,
|
|
1038
1049
|
control: checkbox,
|
|
1039
|
-
key:
|
|
1050
|
+
key: String(option.value),
|
|
1040
1051
|
label: option.label
|
|
1041
1052
|
}
|
|
1042
1053
|
);
|
|
@@ -1073,9 +1084,9 @@ function CheckboxWidget(props) {
|
|
|
1073
1084
|
options
|
|
1074
1085
|
);
|
|
1075
1086
|
const required = (0, import_utils17.schemaRequiresTrueValue)(schema);
|
|
1076
|
-
const
|
|
1077
|
-
const
|
|
1078
|
-
const
|
|
1087
|
+
const handleChange = (_, checked) => onChange(checked);
|
|
1088
|
+
const handleBlur = () => onBlur(id, value);
|
|
1089
|
+
const handleFocus = () => onFocus(id, value);
|
|
1079
1090
|
const description = options.description ?? schema.description;
|
|
1080
1091
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
1081
1092
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
@@ -1103,9 +1114,9 @@ function CheckboxWidget(props) {
|
|
|
1103
1114
|
required,
|
|
1104
1115
|
disabled: disabled || readonly,
|
|
1105
1116
|
autoFocus: autofocus,
|
|
1106
|
-
onChange:
|
|
1107
|
-
onBlur:
|
|
1108
|
-
onFocus:
|
|
1117
|
+
onChange: handleChange,
|
|
1118
|
+
onBlur: handleBlur,
|
|
1119
|
+
onFocus: handleFocus,
|
|
1109
1120
|
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id),
|
|
1110
1121
|
...muiSlotProps?.checkbox
|
|
1111
1122
|
}
|
|
@@ -1123,14 +1134,14 @@ var import_Radio = __toESM(require("@mui/material/Radio"), 1);
|
|
|
1123
1134
|
var import_RadioGroup = __toESM(require("@mui/material/RadioGroup"), 1);
|
|
1124
1135
|
var import_utils18 = require("@rjsf/utils");
|
|
1125
1136
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1126
|
-
var
|
|
1137
|
+
var import_react4 = require("react");
|
|
1127
1138
|
function RadioWidget(props) {
|
|
1128
1139
|
const { id, htmlName, options, value, required, disabled, readonly, label, hideLabel, onChange, onBlur, onFocus } = props;
|
|
1129
1140
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1130
1141
|
const optionValueFormat = (0, import_utils18.getOptionValueFormat)(options);
|
|
1131
|
-
const
|
|
1132
|
-
const
|
|
1133
|
-
const
|
|
1142
|
+
const handleChange = (_, enumValue) => onChange((0, import_utils18.enumOptionValueDecoder)(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
1143
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils18.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1144
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils18.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1134
1145
|
const row = options ? options.inline : false;
|
|
1135
1146
|
const selectValue = (0, import_utils18.enumOptionSelectedValue)(value, enumOptions, false, optionValueFormat, "");
|
|
1136
1147
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
@@ -1148,20 +1159,20 @@ function RadioWidget(props) {
|
|
|
1148
1159
|
name: htmlName || id,
|
|
1149
1160
|
value: selectValue,
|
|
1150
1161
|
row,
|
|
1151
|
-
onChange:
|
|
1152
|
-
onBlur:
|
|
1153
|
-
onFocus:
|
|
1162
|
+
onChange: handleChange,
|
|
1163
|
+
onBlur: handleBlur,
|
|
1164
|
+
onFocus: handleFocus,
|
|
1154
1165
|
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id),
|
|
1155
1166
|
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1156
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
1157
|
-
const radio = /* @__PURE__ */ (0,
|
|
1167
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
1168
|
+
const radio = /* @__PURE__ */ (0, import_react4.createElement)(
|
|
1158
1169
|
import_FormControlLabel3.default,
|
|
1159
1170
|
{
|
|
1160
1171
|
...muiSlotProps?.formControlLabel,
|
|
1161
1172
|
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Radio.default, { ...muiSlotProps?.radio, name: htmlName || id, id: (0, import_utils18.optionId)(id, index), color: "primary" }),
|
|
1162
1173
|
label: option.label,
|
|
1163
1174
|
value: (0, import_utils18.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
1164
|
-
key:
|
|
1175
|
+
key: String(option.value),
|
|
1165
1176
|
disabled: disabled || itemDisabled || readonly
|
|
1166
1177
|
}
|
|
1167
1178
|
);
|
|
@@ -1180,11 +1191,11 @@ var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
|
1180
1191
|
function RangeWidget(props) {
|
|
1181
1192
|
const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } = props;
|
|
1182
1193
|
const sliderProps = { value, label, id, name: id, ...(0, import_utils19.rangeSpec)(schema) };
|
|
1183
|
-
const
|
|
1184
|
-
onChange(
|
|
1194
|
+
const handleChange = (_, newValue) => {
|
|
1195
|
+
onChange(newValue ?? options.emptyValue);
|
|
1185
1196
|
};
|
|
1186
|
-
const
|
|
1187
|
-
const
|
|
1197
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1198
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1188
1199
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
1189
1200
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1190
1201
|
(0, import_utils19.labelValue)(
|
|
@@ -1195,9 +1206,9 @@ function RangeWidget(props) {
|
|
|
1195
1206
|
import_Slider.default,
|
|
1196
1207
|
{
|
|
1197
1208
|
disabled: disabled || readonly,
|
|
1198
|
-
onChange:
|
|
1199
|
-
onBlur:
|
|
1200
|
-
onFocus:
|
|
1209
|
+
onChange: handleChange,
|
|
1210
|
+
onBlur: handleBlur,
|
|
1211
|
+
onFocus: handleFocus,
|
|
1201
1212
|
valueLabelDisplay: "auto",
|
|
1202
1213
|
...otherMuiProps,
|
|
1203
1214
|
...muiSlotProps?.slider,
|
|
@@ -1245,9 +1256,9 @@ function SelectWidget(props) {
|
|
|
1245
1256
|
const isMultiple = typeof multiple === "undefined" ? false : !!multiple;
|
|
1246
1257
|
const emptyValue = isMultiple ? [] : "";
|
|
1247
1258
|
const isEmpty = typeof value === "undefined" || isMultiple && value.length < 1 || !isMultiple && value === emptyValue;
|
|
1248
|
-
const
|
|
1249
|
-
const
|
|
1250
|
-
const
|
|
1259
|
+
const handleChange = ({ target: { value: newValue } }) => onChange((0, import_utils20.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
1260
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils20.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1261
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils20.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1251
1262
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
1252
1263
|
const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
|
|
1253
1264
|
const showPlaceholderOption = !isMultiple && schema.default === void 0;
|
|
@@ -1264,9 +1275,9 @@ function SelectWidget(props) {
|
|
|
1264
1275
|
autoComplete: autocomplete,
|
|
1265
1276
|
placeholder,
|
|
1266
1277
|
error: rawErrors.length > 0,
|
|
1267
|
-
onChange:
|
|
1268
|
-
onBlur:
|
|
1269
|
-
onFocus:
|
|
1278
|
+
onChange: handleChange,
|
|
1279
|
+
onBlur: handleBlur,
|
|
1280
|
+
onFocus: handleFocus,
|
|
1270
1281
|
...{ ...otherMuiProps, ...textFieldRemainingProps },
|
|
1271
1282
|
select: true,
|
|
1272
1283
|
slotProps: {
|
|
@@ -1283,9 +1294,17 @@ function SelectWidget(props) {
|
|
|
1283
1294
|
"aria-describedby": (0, import_utils20.ariaDescribedByIds)(id),
|
|
1284
1295
|
children: [
|
|
1285
1296
|
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_MenuItem.default, { value: "", children: placeholder }),
|
|
1286
|
-
Array.isArray(enumOptions) && enumOptions.map(({ value:
|
|
1287
|
-
const
|
|
1288
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1297
|
+
Array.isArray(enumOptions) && enumOptions.map(({ value: enumValue, label: enumLabel }, i) => {
|
|
1298
|
+
const isDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(enumValue);
|
|
1299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1300
|
+
import_MenuItem.default,
|
|
1301
|
+
{
|
|
1302
|
+
value: (0, import_utils20.enumOptionValueEncoder)(enumValue, i, optionValueFormat),
|
|
1303
|
+
disabled: isDisabled,
|
|
1304
|
+
children: enumLabel
|
|
1305
|
+
},
|
|
1306
|
+
String(enumValue)
|
|
1307
|
+
);
|
|
1289
1308
|
})
|
|
1290
1309
|
]
|
|
1291
1310
|
}
|