@rjsf/mui 6.4.2 → 6.5.0
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/README.md +25 -0
- package/dist/index.cjs +353 -214
- package/dist/index.cjs.map +4 -4
- package/dist/mui.esm.js +354 -185
- package/dist/mui.esm.js.map +4 -4
- package/dist/mui.umd.js +293 -165
- package/lib/AddButton/AddButton.js +12 -2
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +22 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +3 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +20 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +3 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +17 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +9 -4
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +13 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +3 -1
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +17 -2
- package/lib/CheckboxesWidget/CheckboxesWidget.js +12 -7
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.d.ts +10 -1
- package/lib/DescriptionField/DescriptionField.js +6 -1
- package/lib/DescriptionField/DescriptionField.js.map +1 -1
- package/lib/ErrorList/ErrorList.d.ts +29 -2
- package/lib/ErrorList/ErrorList.js +7 -4
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +16 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +8 -4
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +10 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +6 -2
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +13 -1
- package/lib/FieldTemplate/FieldTemplate.js +3 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/IconButton/IconButton.js +12 -2
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +13 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +6 -2
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +16 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +4 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +3 -3
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +17 -2
- package/lib/RadioWidget/RadioWidget.js +13 -9
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +10 -1
- package/lib/RangeWidget/RangeWidget.js +3 -1
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +14 -3
- package/lib/SelectWidget/SelectWidget.js +26 -19
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +13 -1
- package/lib/SubmitButton/SubmitButton.js +5 -2
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/TitleField/TitleField.d.ts +24 -2
- package/lib/TitleField/TitleField.js +9 -4
- package/lib/TitleField/TitleField.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +16 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +7 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util.d.ts +9 -0
- package/lib/util.js +24 -0
- package/lib/util.js.map +1 -0
- package/package.json +7 -7
- package/src/AddButton/AddButton.tsx +21 -3
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +39 -9
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +30 -8
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +29 -5
- package/src/CheckboxWidget/CheckboxWidget.tsx +20 -2
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +51 -23
- package/src/DescriptionField/DescriptionField.tsx +25 -3
- package/src/ErrorList/ErrorList.tsx +52 -15
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +34 -8
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +30 -3
- package/src/FieldTemplate/FieldTemplate.tsx +26 -4
- package/src/IconButton/IconButton.tsx +21 -2
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +28 -6
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +25 -5
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -1
- package/src/RadioWidget/RadioWidget.tsx +43 -26
- package/src/RangeWidget/RangeWidget.tsx +16 -1
- package/src/SelectWidget/SelectWidget.tsx +71 -49
- package/src/SubmitButton/SubmitButton.tsx +36 -5
- package/src/TitleField/TitleField.tsx +54 -16
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +39 -5
- package/src/util.ts +30 -0
package/dist/index.cjs
CHANGED
|
@@ -49,6 +49,24 @@ var import_core4 = require("@rjsf/core");
|
|
|
49
49
|
var import_Add = __toESM(require("@mui/icons-material/Add"), 1);
|
|
50
50
|
var import_IconButton = __toESM(require("@mui/material/IconButton"), 1);
|
|
51
51
|
var import_utils = require("@rjsf/utils");
|
|
52
|
+
|
|
53
|
+
// src/util.ts
|
|
54
|
+
function getMuiProps(options, propsToFilter, rjsfSlotPropsOnly) {
|
|
55
|
+
const muiProps = options?.mui || {};
|
|
56
|
+
if (rjsfSlotPropsOnly) {
|
|
57
|
+
const { rjsfSlotProps } = muiProps;
|
|
58
|
+
return { rjsfSlotProps };
|
|
59
|
+
}
|
|
60
|
+
if (propsToFilter) {
|
|
61
|
+
return Object.keys(muiProps).filter((key) => propsToFilter.includes(key)).reduce((obj, key) => {
|
|
62
|
+
obj[key] = muiProps[key];
|
|
63
|
+
return obj;
|
|
64
|
+
}, {});
|
|
65
|
+
}
|
|
66
|
+
return muiProps;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/AddButton/AddButton.tsx
|
|
52
70
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
53
71
|
function AddButton({
|
|
54
72
|
uiSchema,
|
|
@@ -56,7 +74,16 @@ function AddButton({
|
|
|
56
74
|
...props
|
|
57
75
|
}) {
|
|
58
76
|
const { translateString } = registry;
|
|
59
|
-
|
|
77
|
+
const uiOptions = (0, import_utils.getUiOptions)(uiSchema);
|
|
78
|
+
const muiProps = getMuiProps(uiOptions, [
|
|
79
|
+
"color",
|
|
80
|
+
"disableFocusRipple",
|
|
81
|
+
"disableRipple",
|
|
82
|
+
"edge",
|
|
83
|
+
"size",
|
|
84
|
+
"sx"
|
|
85
|
+
]);
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_IconButton.default, { title: translateString(import_utils.TranslatableString.AddItemButton), ...props, color: "primary", ...muiProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Add.default, {}) });
|
|
60
87
|
}
|
|
61
88
|
|
|
62
89
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
@@ -80,9 +107,18 @@ function ArrayFieldItemTemplate(props) {
|
|
|
80
107
|
fontWeight: "bold",
|
|
81
108
|
minWidth: 0
|
|
82
109
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
110
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_Grid.default, { container: true, alignItems: "center", ...muiSlotProps?.arrayItemGridContainer, children: [
|
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
113
|
+
import_Grid.default,
|
|
114
|
+
{
|
|
115
|
+
size: { xs: 8, sm: 9, md: 10, lg: 11, xl: 11.25 },
|
|
116
|
+
style: { overflow: "auto" },
|
|
117
|
+
...muiSlotProps?.arrayItemGridItem,
|
|
118
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Box.default, { mb: 2, ...muiSlotProps?.arrayItemOuterBox, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Paper.default, { elevation: 2, ...muiSlotProps?.arrayItemPaper, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Box.default, { p: 2, ...muiSlotProps?.arrayItemInnerBox, children }) }) })
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Grid.default, { sx: { mt: hasDescription ? -5 : -1.5 }, ...muiSlotProps?.arrayItemToolbarGrid, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) })
|
|
86
122
|
] });
|
|
87
123
|
}
|
|
88
124
|
|
|
@@ -122,7 +158,8 @@ function ArrayFieldTemplate(props) {
|
|
|
122
158
|
const {
|
|
123
159
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
124
160
|
} = registry.templates;
|
|
125
|
-
|
|
161
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Paper2.default, { elevation: 2, ...muiSlotProps?.arrayPaper, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_Box2.default, { p: 2, ...muiSlotProps?.arrayBox, children: [
|
|
126
163
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
127
164
|
ArrayFieldTitleTemplate,
|
|
128
165
|
{
|
|
@@ -147,7 +184,7 @@ function ArrayFieldTemplate(props) {
|
|
|
147
184
|
),
|
|
148
185
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
149
186
|
items,
|
|
150
|
-
canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Grid2.default, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Grid2.default, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Box2.default, { mt: 2, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
187
|
+
canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Grid2.default, { container: true, justifyContent: "flex-end", ...muiSlotProps?.arrayAddButtonGridContainer, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Grid2.default, { ...muiSlotProps?.arrayAddButtonGridItem, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Box2.default, { mt: 2, ...muiSlotProps?.arrayAddButtonBox, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
151
188
|
AddButton2,
|
|
152
189
|
{
|
|
153
190
|
id: (0, import_utils3.buttonId)(fieldPathId, "add"),
|
|
@@ -202,8 +239,11 @@ function BaseInputTemplate(props) {
|
|
|
202
239
|
} = props;
|
|
203
240
|
const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
|
|
204
241
|
const { step, min, max, accept, ...rest } = (0, import_utils4.getInputProps)(schema, type, options);
|
|
242
|
+
const muiProps = getMuiProps(options);
|
|
243
|
+
const { slotProps: muiSlotProps, ...otherMuiProps } = muiProps;
|
|
205
244
|
const htmlInputProps = {
|
|
206
245
|
...slotProps?.htmlInput,
|
|
246
|
+
...muiSlotProps?.htmlInput,
|
|
207
247
|
step,
|
|
208
248
|
min,
|
|
209
249
|
max,
|
|
@@ -213,7 +253,7 @@ function BaseInputTemplate(props) {
|
|
|
213
253
|
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
214
254
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
215
255
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
216
|
-
const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? { ...slotProps?.inputLabel, ...InputLabelProps, shrink: true } : { ...slotProps?.inputLabel, ...InputLabelProps };
|
|
256
|
+
const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps, shrink: true } : { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps };
|
|
217
257
|
const _onClear = (0, import_react.useCallback)(
|
|
218
258
|
(e) => {
|
|
219
259
|
e.preventDefault();
|
|
@@ -222,7 +262,7 @@ function BaseInputTemplate(props) {
|
|
|
222
262
|
},
|
|
223
263
|
[onChange, options.emptyValue]
|
|
224
264
|
);
|
|
225
|
-
const inputProps = { ...InputProps, ...slotProps?.input };
|
|
265
|
+
const inputProps = { ...InputProps, ...slotProps?.input, ...muiSlotProps?.input };
|
|
226
266
|
if (options.allowClearTextInputs && value && !readonly && !disabled) {
|
|
227
267
|
const clearAdornment = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_InputAdornment.default, { position: "end", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClearButton2, { registry, onClick: _onClear }) });
|
|
228
268
|
inputProps.endAdornment = !inputProps.endAdornment ? clearAdornment : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
@@ -243,6 +283,7 @@ function BaseInputTemplate(props) {
|
|
|
243
283
|
disabled: disabled || readonly,
|
|
244
284
|
slotProps: {
|
|
245
285
|
...slotProps,
|
|
286
|
+
...muiSlotProps,
|
|
246
287
|
input: inputProps,
|
|
247
288
|
htmlInput: htmlInputProps,
|
|
248
289
|
inputLabel: DisplayInputLabelProps
|
|
@@ -253,7 +294,7 @@ function BaseInputTemplate(props) {
|
|
|
253
294
|
onChange: onChangeOverride || _onChange,
|
|
254
295
|
onBlur: _onBlur,
|
|
255
296
|
onFocus: _onFocus,
|
|
256
|
-
...textFieldProps,
|
|
297
|
+
...{ ...otherMuiProps, ...textFieldProps },
|
|
257
298
|
"aria-describedby": (0, import_utils4.ariaDescribedByIds)(id, !!schema.examples)
|
|
258
299
|
}
|
|
259
300
|
),
|
|
@@ -263,12 +304,16 @@ function BaseInputTemplate(props) {
|
|
|
263
304
|
|
|
264
305
|
// src/DescriptionField/DescriptionField.tsx
|
|
265
306
|
var import_Typography = __toESM(require("@mui/material/Typography"), 1);
|
|
307
|
+
var import_utils5 = require("@rjsf/utils");
|
|
266
308
|
var import_core2 = require("@rjsf/core");
|
|
267
309
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
268
310
|
function DescriptionField(props) {
|
|
269
311
|
const { id, description, registry, uiSchema } = props;
|
|
312
|
+
const uiOptions = (0, import_utils5.getUiOptions)(uiSchema);
|
|
313
|
+
const muiProps = getMuiProps(uiOptions);
|
|
314
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
270
315
|
if (description) {
|
|
271
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Typography.default, { id, variant: "subtitle2", style: { marginTop: "5px" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core2.RichDescription, { description, registry, uiSchema }) });
|
|
316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Typography.default, { id, variant: "subtitle2", style: { marginTop: "5px" }, ...muiSlotProps?.descTypography, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core2.RichDescription, { description, registry, uiSchema }) });
|
|
272
317
|
}
|
|
273
318
|
return null;
|
|
274
319
|
}
|
|
@@ -282,19 +327,22 @@ var import_ListItemIcon = __toESM(require("@mui/material/ListItemIcon"), 1);
|
|
|
282
327
|
var import_ListItemText = __toESM(require("@mui/material/ListItemText"), 1);
|
|
283
328
|
var import_Paper3 = __toESM(require("@mui/material/Paper"), 1);
|
|
284
329
|
var import_Typography2 = __toESM(require("@mui/material/Typography"), 1);
|
|
285
|
-
var
|
|
330
|
+
var import_utils6 = require("@rjsf/utils");
|
|
286
331
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
287
332
|
function ErrorList({
|
|
288
333
|
errors,
|
|
289
|
-
registry
|
|
334
|
+
registry,
|
|
335
|
+
uiSchema
|
|
290
336
|
}) {
|
|
291
337
|
const { translateString } = registry;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
338
|
+
const uiOptions = (0, import_utils6.getUiOptions)(uiSchema);
|
|
339
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Paper3.default, { elevation: 2, ...muiSlotProps?.errorPaper, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_Box3.default, { mb: 2, p: 2, ...muiSlotProps?.errorBox, children: [
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Typography2.default, { variant: "h6", ...muiSlotProps?.errorTypography, children: translateString(import_utils6.TranslatableString.ErrorsLabel) }),
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_List.default, { dense: true, ...muiSlotProps?.errorList, children: errors.map((error, i) => {
|
|
343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_ListItem.default, { ...muiSlotProps?.errorListItem, children: [
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListItemIcon.default, { ...muiSlotProps?.errorListItemIcon, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Error.default, { color: "error" }) }),
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListItemText.default, { primary: error.stack, ...muiSlotProps?.errorListItemText })
|
|
298
346
|
] }, i);
|
|
299
347
|
}) })
|
|
300
348
|
] }) });
|
|
@@ -307,11 +355,20 @@ var import_ArrowUpward = __toESM(require("@mui/icons-material/ArrowUpward"), 1);
|
|
|
307
355
|
var import_ContentCopy = __toESM(require("@mui/icons-material/ContentCopy"), 1);
|
|
308
356
|
var import_Remove = __toESM(require("@mui/icons-material/Remove"), 1);
|
|
309
357
|
var import_Clear = __toESM(require("@mui/icons-material/Clear"), 1);
|
|
310
|
-
var
|
|
358
|
+
var import_utils7 = require("@rjsf/utils");
|
|
311
359
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
312
360
|
function MuiIconButton(props) {
|
|
313
361
|
const { icon, color, uiSchema, registry, ...otherProps } = props;
|
|
314
|
-
|
|
362
|
+
const uiOptions = (0, import_utils7.getUiOptions)(uiSchema);
|
|
363
|
+
const muiProps = getMuiProps(uiOptions, [
|
|
364
|
+
"color",
|
|
365
|
+
"disableFocusRipple",
|
|
366
|
+
"disableRipple",
|
|
367
|
+
"edge",
|
|
368
|
+
"size",
|
|
369
|
+
"sx"
|
|
370
|
+
]);
|
|
371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_IconButton2.default, { ...muiProps, ...otherProps, size: "small", color, children: icon });
|
|
315
372
|
}
|
|
316
373
|
function CopyButton(props) {
|
|
317
374
|
const {
|
|
@@ -320,7 +377,7 @@ function CopyButton(props) {
|
|
|
320
377
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
321
378
|
MuiIconButton,
|
|
322
379
|
{
|
|
323
|
-
title: translateString(
|
|
380
|
+
title: translateString(import_utils7.TranslatableString.CopyButton),
|
|
324
381
|
...props,
|
|
325
382
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ContentCopy.default, { fontSize: "small" })
|
|
326
383
|
}
|
|
@@ -333,7 +390,7 @@ function MoveDownButton(props) {
|
|
|
333
390
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
334
391
|
MuiIconButton,
|
|
335
392
|
{
|
|
336
|
-
title: translateString(
|
|
393
|
+
title: translateString(import_utils7.TranslatableString.MoveDownButton),
|
|
337
394
|
...props,
|
|
338
395
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ArrowDownward.default, { fontSize: "small" })
|
|
339
396
|
}
|
|
@@ -346,7 +403,7 @@ function MoveUpButton(props) {
|
|
|
346
403
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
347
404
|
MuiIconButton,
|
|
348
405
|
{
|
|
349
|
-
title: translateString(
|
|
406
|
+
title: translateString(import_utils7.TranslatableString.MoveUpButton),
|
|
350
407
|
...props,
|
|
351
408
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ArrowUpward.default, { fontSize: "small" })
|
|
352
409
|
}
|
|
@@ -360,7 +417,7 @@ function RemoveButton(props) {
|
|
|
360
417
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
361
418
|
MuiIconButton,
|
|
362
419
|
{
|
|
363
|
-
title: translateString(
|
|
420
|
+
title: translateString(import_utils7.TranslatableString.RemoveButton),
|
|
364
421
|
...otherProps,
|
|
365
422
|
color: "error",
|
|
366
423
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Remove.default, { fontSize: iconType === "default" ? void 0 : "small" })
|
|
@@ -375,7 +432,7 @@ function ClearButton(props) {
|
|
|
375
432
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
376
433
|
MuiIconButton,
|
|
377
434
|
{
|
|
378
|
-
title: translateString(
|
|
435
|
+
title: translateString(import_utils7.TranslatableString.ClearButton),
|
|
379
436
|
...otherProps,
|
|
380
437
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Clear.default, { fontSize: iconType === "default" ? void 0 : "small" })
|
|
381
438
|
}
|
|
@@ -386,22 +443,25 @@ function ClearButton(props) {
|
|
|
386
443
|
var import_ListItem2 = __toESM(require("@mui/material/ListItem"), 1);
|
|
387
444
|
var import_FormHelperText = __toESM(require("@mui/material/FormHelperText"), 1);
|
|
388
445
|
var import_List2 = __toESM(require("@mui/material/List"), 1);
|
|
389
|
-
var
|
|
446
|
+
var import_utils8 = require("@rjsf/utils");
|
|
390
447
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
391
448
|
function FieldErrorTemplate(props) {
|
|
392
|
-
const { errors = [], fieldPathId } = props;
|
|
449
|
+
const { errors = [], fieldPathId, uiSchema } = props;
|
|
393
450
|
if (errors.length === 0) {
|
|
394
451
|
return null;
|
|
395
452
|
}
|
|
396
|
-
const id = (0,
|
|
397
|
-
|
|
398
|
-
|
|
453
|
+
const id = (0, import_utils8.errorId)(fieldPathId);
|
|
454
|
+
const uiOptions = (0, import_utils8.getUiOptions)(uiSchema);
|
|
455
|
+
const muiProps = getMuiProps(uiOptions);
|
|
456
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_List2.default, { id, dense: true, disablePadding: true, ...muiSlotProps?.fieldErrorList, children: errors.map((error, i) => {
|
|
458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ListItem2.default, { disableGutters: true, ...muiSlotProps?.fieldErrorListItem, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_FormHelperText.default, { component: "div", id: `${id}-${i}`, ...muiSlotProps?.fieldErrorFormHelperText, children: error }) }, i);
|
|
399
459
|
}) });
|
|
400
460
|
}
|
|
401
461
|
|
|
402
462
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
403
463
|
var import_core3 = require("@rjsf/core");
|
|
404
|
-
var
|
|
464
|
+
var import_utils9 = require("@rjsf/utils");
|
|
405
465
|
var import_FormHelperText2 = __toESM(require("@mui/material/FormHelperText"), 1);
|
|
406
466
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
407
467
|
function FieldHelpTemplate(props) {
|
|
@@ -409,13 +469,25 @@ function FieldHelpTemplate(props) {
|
|
|
409
469
|
if (!help) {
|
|
410
470
|
return null;
|
|
411
471
|
}
|
|
412
|
-
|
|
472
|
+
const uiOptions = (0, import_utils9.getUiOptions)(uiSchema);
|
|
473
|
+
const muiProps = getMuiProps(uiOptions);
|
|
474
|
+
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
476
|
+
import_FormHelperText2.default,
|
|
477
|
+
{
|
|
478
|
+
component: "div",
|
|
479
|
+
id: (0, import_utils9.helpId)(fieldPathId),
|
|
480
|
+
style: { marginTop: "5px" },
|
|
481
|
+
...muiSlotProps?.helpFormHelperText,
|
|
482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core3.RichHelp, { help, registry, uiSchema })
|
|
483
|
+
}
|
|
484
|
+
);
|
|
413
485
|
}
|
|
414
486
|
|
|
415
487
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
416
488
|
var import_FormControl = __toESM(require("@mui/material/FormControl"), 1);
|
|
417
489
|
var import_Typography3 = __toESM(require("@mui/material/Typography"), 1);
|
|
418
|
-
var
|
|
490
|
+
var import_utils10 = require("@rjsf/utils");
|
|
419
491
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
420
492
|
function FieldTemplate(props) {
|
|
421
493
|
const {
|
|
@@ -441,8 +513,8 @@ function FieldTemplate(props) {
|
|
|
441
513
|
uiSchema,
|
|
442
514
|
registry
|
|
443
515
|
} = props;
|
|
444
|
-
const uiOptions = (0,
|
|
445
|
-
const WrapIfAdditionalTemplate2 = (0,
|
|
516
|
+
const uiOptions = (0, import_utils10.getUiOptions)(uiSchema);
|
|
517
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils10.getTemplate)(
|
|
446
518
|
"WrapIfAdditionalTemplate",
|
|
447
519
|
registry,
|
|
448
520
|
uiOptions
|
|
@@ -451,6 +523,7 @@ function FieldTemplate(props) {
|
|
|
451
523
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "none" }, children });
|
|
452
524
|
}
|
|
453
525
|
const isCheckbox = uiOptions.widget === "checkbox";
|
|
526
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
|
|
454
527
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
455
528
|
WrapIfAdditionalTemplate2,
|
|
456
529
|
{
|
|
@@ -469,12 +542,23 @@ function FieldTemplate(props) {
|
|
|
469
542
|
schema,
|
|
470
543
|
uiSchema,
|
|
471
544
|
registry,
|
|
472
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
545
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
546
|
+
import_FormControl.default,
|
|
547
|
+
{
|
|
548
|
+
fullWidth: true,
|
|
549
|
+
error: rawErrors.length ? true : false,
|
|
550
|
+
required,
|
|
551
|
+
...muiSlotProps?.fieldFormControl,
|
|
552
|
+
sx: otherMuiProps.sx,
|
|
553
|
+
className: otherMuiProps.className,
|
|
554
|
+
children: [
|
|
555
|
+
children,
|
|
556
|
+
displayLabel && !isCheckbox && rawDescription ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_Typography3.default, { variant: "caption", color: "textSecondary", ...muiSlotProps?.fieldTypography, children: description }) : null,
|
|
557
|
+
errors,
|
|
558
|
+
help
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
)
|
|
478
562
|
}
|
|
479
563
|
);
|
|
480
564
|
}
|
|
@@ -490,18 +574,21 @@ function GridTemplate(props) {
|
|
|
490
574
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
491
575
|
var import_Box4 = __toESM(require("@mui/material/Box"), 1);
|
|
492
576
|
var import_FormControl2 = __toESM(require("@mui/material/FormControl"), 1);
|
|
577
|
+
var import_utils11 = require("@rjsf/utils");
|
|
493
578
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
494
579
|
function MultiSchemaFieldTemplate(props) {
|
|
495
|
-
const { optionSchemaField, selector } = props;
|
|
496
|
-
|
|
497
|
-
|
|
580
|
+
const { optionSchemaField, selector, uiSchema } = props;
|
|
581
|
+
const uiOptions = (0, import_utils11.getUiOptions)(uiSchema);
|
|
582
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_Box4.default, { sx: { mb: 2 }, ...muiSlotProps?.multiBox, children: [
|
|
584
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_FormControl2.default, { fullWidth: true, sx: { mb: 2 }, ...muiSlotProps?.multiFormControl, children: selector }),
|
|
498
585
|
optionSchemaField
|
|
499
586
|
] });
|
|
500
587
|
}
|
|
501
588
|
|
|
502
589
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
503
590
|
var import_Grid4 = __toESM(require("@mui/material/Grid"), 1);
|
|
504
|
-
var
|
|
591
|
+
var import_utils12 = require("@rjsf/utils");
|
|
505
592
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
506
593
|
function ObjectFieldTemplate(props) {
|
|
507
594
|
const {
|
|
@@ -519,9 +606,9 @@ function ObjectFieldTemplate(props) {
|
|
|
519
606
|
onAddProperty,
|
|
520
607
|
registry
|
|
521
608
|
} = props;
|
|
522
|
-
const uiOptions = (0,
|
|
523
|
-
const TitleFieldTemplate = (0,
|
|
524
|
-
const DescriptionFieldTemplate = (0,
|
|
609
|
+
const uiOptions = (0, import_utils12.getUiOptions)(uiSchema);
|
|
610
|
+
const TitleFieldTemplate = (0, import_utils12.getTemplate)("TitleFieldTemplate", registry, uiOptions);
|
|
611
|
+
const DescriptionFieldTemplate = (0, import_utils12.getTemplate)(
|
|
525
612
|
"DescriptionFieldTemplate",
|
|
526
613
|
registry,
|
|
527
614
|
uiOptions
|
|
@@ -530,11 +617,12 @@ function ObjectFieldTemplate(props) {
|
|
|
530
617
|
const {
|
|
531
618
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
532
619
|
} = registry.templates;
|
|
620
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
533
621
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
534
622
|
title && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
535
623
|
TitleFieldTemplate,
|
|
536
624
|
{
|
|
537
|
-
id: (0,
|
|
625
|
+
id: (0, import_utils12.titleId)(fieldPathId),
|
|
538
626
|
title,
|
|
539
627
|
required,
|
|
540
628
|
schema,
|
|
@@ -546,27 +634,27 @@ function ObjectFieldTemplate(props) {
|
|
|
546
634
|
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
547
635
|
DescriptionFieldTemplate,
|
|
548
636
|
{
|
|
549
|
-
id: (0,
|
|
637
|
+
id: (0, import_utils12.descriptionId)(fieldPathId),
|
|
550
638
|
description,
|
|
551
639
|
schema,
|
|
552
640
|
uiSchema,
|
|
553
641
|
registry
|
|
554
642
|
}
|
|
555
643
|
),
|
|
556
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_Grid4.default, { container: true, spacing: 2, style: { marginTop: "10px" }, children: [
|
|
644
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_Grid4.default, { container: true, spacing: 2, style: { marginTop: "10px" }, ...muiSlotProps?.objectGridContainer, children: [
|
|
557
645
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
558
646
|
properties.map(
|
|
559
647
|
(element, index) => (
|
|
560
648
|
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
561
649
|
// itself would otherwise still take up space.
|
|
562
|
-
element.hidden ? element.content : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Grid4.default, { size: { xs: 12 }, style: { marginBottom: "10px" }, children: element.content }, index)
|
|
650
|
+
element.hidden ? element.content : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Grid4.default, { size: { xs: 12 }, style: { marginBottom: "10px" }, ...muiSlotProps?.objectGridItem, children: element.content }, index)
|
|
563
651
|
)
|
|
564
652
|
)
|
|
565
653
|
] }),
|
|
566
|
-
(0,
|
|
654
|
+
(0, import_utils12.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Grid4.default, { container: true, justifyContent: "flex-end", ...muiSlotProps?.objectAddButtonGridContainer, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Grid4.default, { ...muiSlotProps?.objectAddButtonGridItem, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
567
655
|
AddButton2,
|
|
568
656
|
{
|
|
569
|
-
id: (0,
|
|
657
|
+
id: (0, import_utils12.buttonId)(fieldPathId, "add"),
|
|
570
658
|
className: "rjsf-object-property-expand",
|
|
571
659
|
onClick: onAddProperty,
|
|
572
660
|
disabled: disabled || readonly,
|
|
@@ -581,13 +669,14 @@ function ObjectFieldTemplate(props) {
|
|
|
581
669
|
var import_Add2 = __toESM(require("@mui/icons-material/Add"), 1);
|
|
582
670
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
583
671
|
function OptionalDataControlsTemplate(props) {
|
|
584
|
-
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
672
|
+
const { id, registry, label, onAddClick, onRemoveClick, uiSchema } = props;
|
|
585
673
|
if (onAddClick) {
|
|
586
674
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
587
675
|
MuiIconButton,
|
|
588
676
|
{
|
|
589
677
|
id,
|
|
590
678
|
registry,
|
|
679
|
+
uiSchema,
|
|
591
680
|
className: "rjsf-add-optional-data",
|
|
592
681
|
onClick: onAddClick,
|
|
593
682
|
title: label,
|
|
@@ -600,6 +689,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
600
689
|
{
|
|
601
690
|
id,
|
|
602
691
|
registry,
|
|
692
|
+
uiSchema,
|
|
603
693
|
className: "rjsf-remove-optional-data",
|
|
604
694
|
onClick: onRemoveClick,
|
|
605
695
|
title: label
|
|
@@ -612,14 +702,27 @@ function OptionalDataControlsTemplate(props) {
|
|
|
612
702
|
// src/SubmitButton/SubmitButton.tsx
|
|
613
703
|
var import_Box5 = __toESM(require("@mui/material/Box"), 1);
|
|
614
704
|
var import_Button = __toESM(require("@mui/material/Button"), 1);
|
|
615
|
-
var
|
|
705
|
+
var import_utils13 = require("@rjsf/utils");
|
|
616
706
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
617
707
|
function SubmitButton({ uiSchema }) {
|
|
618
|
-
const { submitText, norender, props: submitButtonProps = {} } = (0,
|
|
708
|
+
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils13.getSubmitButtonOptions)(uiSchema);
|
|
619
709
|
if (norender) {
|
|
620
710
|
return null;
|
|
621
711
|
}
|
|
622
|
-
|
|
712
|
+
const uiOptions = (0, import_utils13.getUiOptions)(uiSchema);
|
|
713
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
|
|
714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Box5.default, { marginTop: 3, ...muiSlotProps?.submitBox, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
715
|
+
import_Button.default,
|
|
716
|
+
{
|
|
717
|
+
type: "submit",
|
|
718
|
+
variant: "contained",
|
|
719
|
+
color: "primary",
|
|
720
|
+
...submitButtonProps,
|
|
721
|
+
...otherMuiProps,
|
|
722
|
+
...muiSlotProps?.submitButton,
|
|
723
|
+
children: submitText
|
|
724
|
+
}
|
|
725
|
+
) });
|
|
623
726
|
}
|
|
624
727
|
|
|
625
728
|
// src/TitleField/TitleField.tsx
|
|
@@ -627,29 +730,29 @@ var import_Box6 = __toESM(require("@mui/material/Box"), 1);
|
|
|
627
730
|
var import_Divider = __toESM(require("@mui/material/Divider"), 1);
|
|
628
731
|
var import_Grid5 = __toESM(require("@mui/material/Grid"), 1);
|
|
629
732
|
var import_Typography4 = __toESM(require("@mui/material/Typography"), 1);
|
|
733
|
+
var import_utils14 = require("@rjsf/utils");
|
|
630
734
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
631
|
-
function TitleField({
|
|
632
|
-
id,
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
let heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Typography4.default, { variant: "h5", children: title });
|
|
735
|
+
function TitleField(props) {
|
|
736
|
+
const { id, title, optionalDataControl, uiSchema } = props;
|
|
737
|
+
const uiOptions = (0, import_utils14.getUiOptions)(uiSchema);
|
|
738
|
+
const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
|
|
739
|
+
let heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Typography4.default, { variant: "h5", ...muiSlotProps?.titleTypography, children: title });
|
|
637
740
|
if (optionalDataControl) {
|
|
638
|
-
heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_Grid5.default, { container: true, spacing: 0, children: [
|
|
639
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Grid5.default, { size: "grow", children: heading }),
|
|
640
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Grid5.default, { justifyContent: "flex-end", children: optionalDataControl })
|
|
741
|
+
heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_Grid5.default, { container: true, spacing: 0, ...muiSlotProps?.titleGridContainer, children: [
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Grid5.default, { size: "grow", ...muiSlotProps?.titleGridItem, children: heading }),
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Grid5.default, { justifyContent: "flex-end", ...muiSlotProps?.titleOptionalDataGridItem, children: optionalDataControl })
|
|
641
744
|
] });
|
|
642
745
|
}
|
|
643
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_Box6.default, { id, mb: 1, mt: 1, children: [
|
|
746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_Box6.default, { id, mb: 1, mt: 1, ...muiSlotProps?.titleBox, children: [
|
|
644
747
|
heading,
|
|
645
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Divider.default, {})
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Divider.default, { ...muiSlotProps?.titleDivider })
|
|
646
749
|
] });
|
|
647
750
|
}
|
|
648
751
|
|
|
649
752
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
650
753
|
var import_Grid6 = __toESM(require("@mui/material/Grid"), 1);
|
|
651
754
|
var import_TextField2 = __toESM(require("@mui/material/TextField"), 1);
|
|
652
|
-
var
|
|
755
|
+
var import_utils15 = require("@rjsf/utils");
|
|
653
756
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
654
757
|
function WrapIfAdditionalTemplate(props) {
|
|
655
758
|
const {
|
|
@@ -670,47 +773,64 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
670
773
|
} = props;
|
|
671
774
|
const { templates, translateString } = registry;
|
|
672
775
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
673
|
-
const keyLabel = translateString(
|
|
674
|
-
const additional =
|
|
776
|
+
const keyLabel = translateString(import_utils15.TranslatableString.KeyLabel, [label]);
|
|
777
|
+
const additional = import_utils15.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
675
778
|
const btnStyle = {
|
|
676
779
|
flex: 1,
|
|
677
780
|
paddingLeft: 6,
|
|
678
781
|
paddingRight: 6,
|
|
679
782
|
fontWeight: "bold"
|
|
680
783
|
};
|
|
784
|
+
const uiOptions = (0, import_utils15.getUiOptions)(uiSchema);
|
|
785
|
+
const { rjsfSlotProps } = getMuiProps(uiOptions);
|
|
786
|
+
const muiSlotProps = rjsfSlotProps;
|
|
681
787
|
if (!additional) {
|
|
682
788
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classNames, style, children });
|
|
683
789
|
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
790
|
+
const { wrapGridContainer, wrapKeyGridItem, wrapChildrenGridItem, wrapRemoveButtonGridItem } = muiSlotProps || {};
|
|
791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
792
|
+
import_Grid6.default,
|
|
793
|
+
{
|
|
794
|
+
container: true,
|
|
795
|
+
alignItems: "flex-start",
|
|
796
|
+
spacing: 2,
|
|
797
|
+
className: classNames,
|
|
798
|
+
style,
|
|
799
|
+
...wrapGridContainer,
|
|
800
|
+
children: [
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Grid6.default, { size: 5.5, ...wrapKeyGridItem, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
802
|
+
import_TextField2.default,
|
|
803
|
+
{
|
|
804
|
+
fullWidth: true,
|
|
805
|
+
required,
|
|
806
|
+
label: displayLabel ? keyLabel : void 0,
|
|
807
|
+
defaultValue: label,
|
|
808
|
+
disabled: disabled || readonly,
|
|
809
|
+
id: `${id}-key`,
|
|
810
|
+
name: `${id}-key`,
|
|
811
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
812
|
+
type: "text"
|
|
813
|
+
},
|
|
814
|
+
label
|
|
815
|
+
) }),
|
|
816
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Grid6.default, { size: 5.5, ...wrapChildrenGridItem, children }),
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Grid6.default, { sx: { mt: 1.5 }, ...wrapRemoveButtonGridItem, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
818
|
+
RemoveButton2,
|
|
819
|
+
{
|
|
820
|
+
id: (0, import_utils15.buttonId)(id, "remove"),
|
|
821
|
+
className: "rjsf-object-property-remove",
|
|
822
|
+
iconType: "default",
|
|
823
|
+
style: btnStyle,
|
|
824
|
+
disabled: disabled || readonly,
|
|
825
|
+
onClick: onRemoveProperty,
|
|
826
|
+
uiSchema,
|
|
827
|
+
registry
|
|
828
|
+
}
|
|
829
|
+
) })
|
|
830
|
+
]
|
|
831
|
+
},
|
|
832
|
+
`${id}-key`
|
|
833
|
+
);
|
|
714
834
|
}
|
|
715
835
|
|
|
716
836
|
// src/Templates/Templates.ts
|
|
@@ -746,7 +866,7 @@ var Templates_default = generateTemplates();
|
|
|
746
866
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
747
867
|
var import_Checkbox = __toESM(require("@mui/material/Checkbox"), 1);
|
|
748
868
|
var import_FormControlLabel = __toESM(require("@mui/material/FormControlLabel"), 1);
|
|
749
|
-
var
|
|
869
|
+
var import_utils16 = require("@rjsf/utils");
|
|
750
870
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
751
871
|
function CheckboxWidget(props) {
|
|
752
872
|
const {
|
|
@@ -766,21 +886,22 @@ function CheckboxWidget(props) {
|
|
|
766
886
|
options,
|
|
767
887
|
uiSchema
|
|
768
888
|
} = props;
|
|
769
|
-
const DescriptionFieldTemplate = (0,
|
|
889
|
+
const DescriptionFieldTemplate = (0, import_utils16.getTemplate)(
|
|
770
890
|
"DescriptionFieldTemplate",
|
|
771
891
|
registry,
|
|
772
892
|
options
|
|
773
893
|
);
|
|
774
|
-
const required = (0,
|
|
894
|
+
const required = (0, import_utils16.schemaRequiresTrueValue)(schema);
|
|
775
895
|
const _onChange = (_, checked) => onChange(checked);
|
|
776
896
|
const _onBlur = () => onBlur(id, value);
|
|
777
897
|
const _onFocus = () => onFocus(id, value);
|
|
778
898
|
const description = options.description ?? schema.description;
|
|
899
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
779
900
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
780
901
|
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
781
902
|
DescriptionFieldTemplate,
|
|
782
903
|
{
|
|
783
|
-
id: (0,
|
|
904
|
+
id: (0, import_utils16.descriptionId)(id),
|
|
784
905
|
description,
|
|
785
906
|
schema,
|
|
786
907
|
uiSchema,
|
|
@@ -790,6 +911,8 @@ function CheckboxWidget(props) {
|
|
|
790
911
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
791
912
|
import_FormControlLabel.default,
|
|
792
913
|
{
|
|
914
|
+
...otherMuiProps,
|
|
915
|
+
...muiSlotProps?.formControlLabel,
|
|
793
916
|
control: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
794
917
|
import_Checkbox.default,
|
|
795
918
|
{
|
|
@@ -802,10 +925,11 @@ function CheckboxWidget(props) {
|
|
|
802
925
|
onChange: _onChange,
|
|
803
926
|
onBlur: _onBlur,
|
|
804
927
|
onFocus: _onFocus,
|
|
805
|
-
"aria-describedby": (0,
|
|
928
|
+
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id),
|
|
929
|
+
...muiSlotProps?.checkbox
|
|
806
930
|
}
|
|
807
931
|
),
|
|
808
|
-
label: (0,
|
|
932
|
+
label: (0, import_utils16.labelValue)(label, hideLabel, false)
|
|
809
933
|
}
|
|
810
934
|
)
|
|
811
935
|
] });
|
|
@@ -816,46 +940,51 @@ var import_Checkbox2 = __toESM(require("@mui/material/Checkbox"), 1);
|
|
|
816
940
|
var import_FormControlLabel2 = __toESM(require("@mui/material/FormControlLabel"), 1);
|
|
817
941
|
var import_FormGroup = __toESM(require("@mui/material/FormGroup"), 1);
|
|
818
942
|
var import_FormLabel = __toESM(require("@mui/material/FormLabel"), 1);
|
|
819
|
-
var
|
|
943
|
+
var import_utils17 = require("@rjsf/utils");
|
|
820
944
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
945
|
+
var import_react2 = require("react");
|
|
946
|
+
function CheckboxesWidget(props) {
|
|
947
|
+
const {
|
|
948
|
+
label,
|
|
949
|
+
hideLabel,
|
|
950
|
+
id,
|
|
951
|
+
htmlName,
|
|
952
|
+
disabled,
|
|
953
|
+
options,
|
|
954
|
+
value,
|
|
955
|
+
autofocus,
|
|
956
|
+
readonly,
|
|
957
|
+
required,
|
|
958
|
+
onChange,
|
|
959
|
+
onBlur,
|
|
960
|
+
onFocus
|
|
961
|
+
} = props;
|
|
836
962
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
963
|
+
const optionValueFormat = (0, import_utils17.getOptionValueFormat)(options);
|
|
837
964
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
838
965
|
const _onChange = (index) => ({ target: { checked } }) => {
|
|
839
966
|
if (checked) {
|
|
840
|
-
onChange((0,
|
|
967
|
+
onChange((0, import_utils17.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
841
968
|
} else {
|
|
842
|
-
onChange((0,
|
|
969
|
+
onChange((0, import_utils17.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
843
970
|
}
|
|
844
971
|
};
|
|
845
|
-
const _onBlur = ({ target }) => onBlur(id, (0,
|
|
846
|
-
const _onFocus = ({ target }) => onFocus(id, (0,
|
|
972
|
+
const _onBlur = ({ target }) => onBlur(id, (0, import_utils17.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
973
|
+
const _onFocus = ({ target }) => onFocus(id, (0, import_utils17.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
974
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
847
975
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
848
|
-
(0,
|
|
976
|
+
(0, import_utils17.labelValue)(
|
|
849
977
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FormLabel.default, { required, htmlFor: id, children: label || void 0 }),
|
|
850
978
|
hideLabel
|
|
851
979
|
),
|
|
852
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FormGroup.default, { id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
853
|
-
const checked = (0,
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FormGroup.default, { ...otherMuiProps, ...muiSlotProps?.formGroup, id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
981
|
+
const checked = (0, import_utils17.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
854
982
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
855
983
|
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
856
984
|
import_Checkbox2.default,
|
|
857
985
|
{
|
|
858
|
-
|
|
986
|
+
...muiSlotProps?.checkbox,
|
|
987
|
+
id: (0, import_utils17.optionId)(id, index),
|
|
859
988
|
name: htmlName || id,
|
|
860
989
|
checked,
|
|
861
990
|
disabled: disabled || itemDisabled || readonly,
|
|
@@ -863,10 +992,18 @@ function CheckboxesWidget({
|
|
|
863
992
|
onChange: _onChange(index),
|
|
864
993
|
onBlur: _onBlur,
|
|
865
994
|
onFocus: _onFocus,
|
|
866
|
-
"aria-describedby": (0,
|
|
995
|
+
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id)
|
|
996
|
+
}
|
|
997
|
+
);
|
|
998
|
+
return /* @__PURE__ */ (0, import_react2.createElement)(
|
|
999
|
+
import_FormControlLabel2.default,
|
|
1000
|
+
{
|
|
1001
|
+
...muiSlotProps?.formControlLabel,
|
|
1002
|
+
control: checkbox,
|
|
1003
|
+
key: index,
|
|
1004
|
+
label: option.label
|
|
867
1005
|
}
|
|
868
1006
|
);
|
|
869
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FormControlLabel2.default, { control: checkbox, label: option.label }, index);
|
|
870
1007
|
}) })
|
|
871
1008
|
] });
|
|
872
1009
|
}
|
|
@@ -876,55 +1013,49 @@ var import_FormControlLabel3 = __toESM(require("@mui/material/FormControlLabel")
|
|
|
876
1013
|
var import_FormLabel2 = __toESM(require("@mui/material/FormLabel"), 1);
|
|
877
1014
|
var import_Radio = __toESM(require("@mui/material/Radio"), 1);
|
|
878
1015
|
var import_RadioGroup = __toESM(require("@mui/material/RadioGroup"), 1);
|
|
879
|
-
var
|
|
1016
|
+
var import_utils18 = require("@rjsf/utils");
|
|
880
1017
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
htmlName,
|
|
884
|
-
options,
|
|
885
|
-
value,
|
|
886
|
-
required,
|
|
887
|
-
disabled,
|
|
888
|
-
readonly,
|
|
889
|
-
label,
|
|
890
|
-
hideLabel,
|
|
891
|
-
onChange,
|
|
892
|
-
onBlur,
|
|
893
|
-
onFocus
|
|
894
|
-
}) {
|
|
1018
|
+
var import_react3 = require("react");
|
|
1019
|
+
function RadioWidget(props) {
|
|
1020
|
+
const { id, htmlName, options, value, required, disabled, readonly, label, hideLabel, onChange, onBlur, onFocus } = props;
|
|
895
1021
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
896
|
-
const
|
|
897
|
-
const
|
|
898
|
-
const
|
|
1022
|
+
const optionValueFormat = (0, import_utils18.getOptionValueFormat)(options);
|
|
1023
|
+
const _onChange = (_, value2) => onChange((0, import_utils18.enumOptionValueDecoder)(value2, enumOptions, optionValueFormat, emptyValue));
|
|
1024
|
+
const _onBlur = ({ target }) => onBlur(id, (0, import_utils18.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1025
|
+
const _onFocus = ({ target }) => onFocus(id, (0, import_utils18.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
899
1026
|
const row = options ? options.inline : false;
|
|
900
|
-
const
|
|
1027
|
+
const selectValue = (0, import_utils18.enumOptionSelectedValue)(value, enumOptions, false, optionValueFormat, "");
|
|
1028
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
901
1029
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
902
|
-
(0,
|
|
1030
|
+
(0, import_utils18.labelValue)(
|
|
903
1031
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_FormLabel2.default, { required, htmlFor: id, children: label || void 0 }),
|
|
904
1032
|
hideLabel
|
|
905
1033
|
),
|
|
906
1034
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
907
1035
|
import_RadioGroup.default,
|
|
908
1036
|
{
|
|
1037
|
+
...otherMuiProps,
|
|
1038
|
+
...muiSlotProps?.radioGroup,
|
|
909
1039
|
id,
|
|
910
1040
|
name: htmlName || id,
|
|
911
|
-
value:
|
|
1041
|
+
value: selectValue,
|
|
912
1042
|
row,
|
|
913
1043
|
onChange: _onChange,
|
|
914
1044
|
onBlur: _onBlur,
|
|
915
1045
|
onFocus: _onFocus,
|
|
916
|
-
"aria-describedby": (0,
|
|
1046
|
+
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id),
|
|
917
1047
|
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
918
1048
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
919
|
-
const radio = /* @__PURE__ */ (0,
|
|
1049
|
+
const radio = /* @__PURE__ */ (0, import_react3.createElement)(
|
|
920
1050
|
import_FormControlLabel3.default,
|
|
921
1051
|
{
|
|
922
|
-
|
|
1052
|
+
...muiSlotProps?.formControlLabel,
|
|
1053
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Radio.default, { ...muiSlotProps?.radio, name: htmlName || id, id: (0, import_utils18.optionId)(id, index), color: "primary" }),
|
|
923
1054
|
label: option.label,
|
|
924
|
-
value:
|
|
1055
|
+
value: (0, import_utils18.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
1056
|
+
key: index,
|
|
925
1057
|
disabled: disabled || itemDisabled || readonly
|
|
926
|
-
}
|
|
927
|
-
index
|
|
1058
|
+
}
|
|
928
1059
|
);
|
|
929
1060
|
return radio;
|
|
930
1061
|
})
|
|
@@ -936,18 +1067,19 @@ function RadioWidget({
|
|
|
936
1067
|
// src/RangeWidget/RangeWidget.tsx
|
|
937
1068
|
var import_FormLabel3 = __toESM(require("@mui/material/FormLabel"), 1);
|
|
938
1069
|
var import_Slider = __toESM(require("@mui/material/Slider"), 1);
|
|
939
|
-
var
|
|
1070
|
+
var import_utils19 = require("@rjsf/utils");
|
|
940
1071
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
941
1072
|
function RangeWidget(props) {
|
|
942
1073
|
const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } = props;
|
|
943
|
-
const sliderProps = { value, label, id, name: id, ...(0,
|
|
1074
|
+
const sliderProps = { value, label, id, name: id, ...(0, import_utils19.rangeSpec)(schema) };
|
|
944
1075
|
const _onChange = (_, value2) => {
|
|
945
1076
|
onChange(value2 ?? options.emptyValue);
|
|
946
1077
|
};
|
|
947
1078
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
948
1079
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1080
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
949
1081
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
950
|
-
(0,
|
|
1082
|
+
(0, import_utils19.labelValue)(
|
|
951
1083
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_FormLabel3.default, { required, htmlFor: id, children: label || void 0 }),
|
|
952
1084
|
hideLabel
|
|
953
1085
|
),
|
|
@@ -959,8 +1091,10 @@ function RangeWidget(props) {
|
|
|
959
1091
|
onBlur: _onBlur,
|
|
960
1092
|
onFocus: _onFocus,
|
|
961
1093
|
valueLabelDisplay: "auto",
|
|
1094
|
+
...otherMuiProps,
|
|
1095
|
+
...muiSlotProps?.slider,
|
|
962
1096
|
...sliderProps,
|
|
963
|
-
"aria-describedby": (0,
|
|
1097
|
+
"aria-describedby": (0, import_utils19.ariaDescribedByIds)(id)
|
|
964
1098
|
}
|
|
965
1099
|
)
|
|
966
1100
|
] });
|
|
@@ -969,51 +1103,53 @@ function RangeWidget(props) {
|
|
|
969
1103
|
// src/SelectWidget/SelectWidget.tsx
|
|
970
1104
|
var import_MenuItem = __toESM(require("@mui/material/MenuItem"), 1);
|
|
971
1105
|
var import_TextField3 = __toESM(require("@mui/material/TextField"), 1);
|
|
972
|
-
var
|
|
1106
|
+
var import_utils20 = require("@rjsf/utils");
|
|
973
1107
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
974
|
-
function SelectWidget({
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1108
|
+
function SelectWidget(props) {
|
|
1109
|
+
const {
|
|
1110
|
+
schema,
|
|
1111
|
+
id,
|
|
1112
|
+
name,
|
|
1113
|
+
// remove this from textFieldProps
|
|
1114
|
+
htmlName,
|
|
1115
|
+
options,
|
|
1116
|
+
label,
|
|
1117
|
+
hideLabel,
|
|
1118
|
+
required,
|
|
1119
|
+
disabled,
|
|
1120
|
+
placeholder,
|
|
1121
|
+
readonly,
|
|
1122
|
+
value,
|
|
1123
|
+
multiple,
|
|
1124
|
+
autofocus,
|
|
1125
|
+
onChange,
|
|
1126
|
+
onBlur,
|
|
1127
|
+
onFocus,
|
|
1128
|
+
errorSchema,
|
|
1129
|
+
rawErrors = [],
|
|
1130
|
+
registry,
|
|
1131
|
+
uiSchema,
|
|
1132
|
+
hideError,
|
|
1133
|
+
...textFieldProps
|
|
1134
|
+
} = props;
|
|
1000
1135
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
1001
|
-
|
|
1002
|
-
const
|
|
1003
|
-
const
|
|
1004
|
-
const
|
|
1005
|
-
const
|
|
1006
|
-
const
|
|
1007
|
-
const
|
|
1136
|
+
const optionValueFormat = (0, import_utils20.getOptionValueFormat)(options);
|
|
1137
|
+
const isMultiple = typeof multiple === "undefined" ? false : !!multiple;
|
|
1138
|
+
const emptyValue = isMultiple ? [] : "";
|
|
1139
|
+
const isEmpty = typeof value === "undefined" || isMultiple && value.length < 1 || !isMultiple && value === emptyValue;
|
|
1140
|
+
const _onChange = ({ target: { value: value2 } }) => onChange((0, import_utils20.enumOptionValueDecoder)(value2, enumOptions, optionValueFormat, optEmptyVal));
|
|
1141
|
+
const _onBlur = ({ target }) => onBlur(id, (0, import_utils20.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1142
|
+
const _onFocus = ({ target }) => onFocus(id, (0, import_utils20.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1143
|
+
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
1008
1144
|
const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
|
|
1009
|
-
const showPlaceholderOption = !
|
|
1145
|
+
const showPlaceholderOption = !isMultiple && schema.default === void 0;
|
|
1010
1146
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1011
1147
|
import_TextField3.default,
|
|
1012
1148
|
{
|
|
1013
1149
|
id,
|
|
1014
1150
|
name: htmlName || id,
|
|
1015
|
-
label: (0,
|
|
1016
|
-
value:
|
|
1151
|
+
label: (0, import_utils20.labelValue)(label || void 0, hideLabel, void 0),
|
|
1152
|
+
value: (0, import_utils20.enumOptionSelectedValue)(value, enumOptions, isMultiple, optionValueFormat, emptyValue),
|
|
1017
1153
|
required,
|
|
1018
1154
|
disabled: disabled || readonly,
|
|
1019
1155
|
autoFocus: autofocus,
|
|
@@ -1023,22 +1159,25 @@ function SelectWidget({
|
|
|
1023
1159
|
onChange: _onChange,
|
|
1024
1160
|
onBlur: _onBlur,
|
|
1025
1161
|
onFocus: _onFocus,
|
|
1026
|
-
...textFieldRemainingProps,
|
|
1162
|
+
...{ ...otherMuiProps, ...textFieldRemainingProps },
|
|
1027
1163
|
select: true,
|
|
1028
|
-
|
|
1029
|
-
...
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1164
|
+
slotProps: {
|
|
1165
|
+
...muiSlotProps,
|
|
1166
|
+
inputLabel: {
|
|
1167
|
+
...muiSlotProps?.inputLabel,
|
|
1168
|
+
shrink: !isEmpty
|
|
1169
|
+
},
|
|
1170
|
+
select: {
|
|
1171
|
+
...muiSlotProps?.select,
|
|
1172
|
+
multiple
|
|
1173
|
+
}
|
|
1035
1174
|
},
|
|
1036
|
-
"aria-describedby": (0,
|
|
1175
|
+
"aria-describedby": (0, import_utils20.ariaDescribedByIds)(id),
|
|
1037
1176
|
children: [
|
|
1038
1177
|
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_MenuItem.default, { value: "", children: placeholder }),
|
|
1039
1178
|
Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label: label2 }, i) => {
|
|
1040
1179
|
const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1;
|
|
1041
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_MenuItem.default, { value:
|
|
1180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_MenuItem.default, { value: (0, import_utils20.enumOptionValueEncoder)(value2, i, optionValueFormat), disabled: disabled2, children: label2 }, i);
|
|
1042
1181
|
})
|
|
1043
1182
|
]
|
|
1044
1183
|
}
|
|
@@ -1046,11 +1185,11 @@ function SelectWidget({
|
|
|
1046
1185
|
}
|
|
1047
1186
|
|
|
1048
1187
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
1049
|
-
var
|
|
1188
|
+
var import_utils21 = require("@rjsf/utils");
|
|
1050
1189
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1051
1190
|
function TextareaWidget(props) {
|
|
1052
1191
|
const { options, registry } = props;
|
|
1053
|
-
const BaseInputTemplate2 = (0,
|
|
1192
|
+
const BaseInputTemplate2 = (0, import_utils21.getTemplate)("BaseInputTemplate", registry, options);
|
|
1054
1193
|
let rows = 5;
|
|
1055
1194
|
if (typeof options.rows === "string" || typeof options.rows === "number") {
|
|
1056
1195
|
rows = options.rows;
|