@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/mui.esm.js
CHANGED
|
@@ -4,10 +4,7 @@ import { withTheme } from "@rjsf/core";
|
|
|
4
4
|
// src/AddButton/AddButton.tsx
|
|
5
5
|
import AddIcon from "@mui/icons-material/Add";
|
|
6
6
|
import IconButton from "@mui/material/IconButton";
|
|
7
|
-
import {
|
|
8
|
-
getUiOptions,
|
|
9
|
-
TranslatableString
|
|
10
|
-
} from "@rjsf/utils";
|
|
7
|
+
import { getUiOptions, TranslatableString } from "@rjsf/utils";
|
|
11
8
|
|
|
12
9
|
// src/util.ts
|
|
13
10
|
function getMuiProps(options, propsToFilter, rjsfSlotPropsOnly) {
|
|
@@ -17,9 +14,9 @@ function getMuiProps(options, propsToFilter, rjsfSlotPropsOnly) {
|
|
|
17
14
|
return { rjsfSlotProps };
|
|
18
15
|
}
|
|
19
16
|
if (propsToFilter) {
|
|
20
|
-
return Object.keys(muiProps).filter((key) => propsToFilter.includes(key)).reduce((
|
|
21
|
-
|
|
22
|
-
return
|
|
17
|
+
return Object.keys(muiProps).filter((key) => propsToFilter.includes(key)).reduce((acc, key) => {
|
|
18
|
+
acc[key] = muiProps[key];
|
|
19
|
+
return acc;
|
|
23
20
|
}, {});
|
|
24
21
|
}
|
|
25
22
|
return muiProps;
|
|
@@ -58,10 +55,7 @@ function AddButton({
|
|
|
58
55
|
import Box from "@mui/material/Box";
|
|
59
56
|
import Grid from "@mui/material/Grid";
|
|
60
57
|
import Paper from "@mui/material/Paper";
|
|
61
|
-
import {
|
|
62
|
-
getUiOptions as getUiOptions2,
|
|
63
|
-
getTemplate
|
|
64
|
-
} from "@rjsf/utils";
|
|
58
|
+
import { getUiOptions as getUiOptions2, getTemplate } from "@rjsf/utils";
|
|
65
59
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
66
60
|
function ArrayFieldItemTemplate(props) {
|
|
67
61
|
const { children, buttonsProps, hasDescription, hasToolbar, uiSchema, registry } = props;
|
|
@@ -121,11 +115,7 @@ function ArrayFieldItemTemplate(props) {
|
|
|
121
115
|
import Box2 from "@mui/material/Box";
|
|
122
116
|
import Grid2 from "@mui/material/Grid";
|
|
123
117
|
import Paper2 from "@mui/material/Paper";
|
|
124
|
-
import {
|
|
125
|
-
getTemplate as getTemplate2,
|
|
126
|
-
getUiOptions as getUiOptions3,
|
|
127
|
-
buttonId
|
|
128
|
-
} from "@rjsf/utils";
|
|
118
|
+
import { getTemplate as getTemplate2, getUiOptions as getUiOptions3, buttonId } from "@rjsf/utils";
|
|
129
119
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
130
120
|
function ArrayFieldTemplate(props) {
|
|
131
121
|
const {
|
|
@@ -218,12 +208,7 @@ import { useCallback } from "react";
|
|
|
218
208
|
import InputAdornment from "@mui/material/InputAdornment";
|
|
219
209
|
import TextField from "@mui/material/TextField";
|
|
220
210
|
import { SchemaExamples } from "@rjsf/core";
|
|
221
|
-
import {
|
|
222
|
-
ariaDescribedByIds,
|
|
223
|
-
examplesId,
|
|
224
|
-
getInputProps,
|
|
225
|
-
labelValue
|
|
226
|
-
} from "@rjsf/utils";
|
|
211
|
+
import { ariaDescribedByIds, examplesId, getInputProps, labelValue } from "@rjsf/utils";
|
|
227
212
|
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
228
213
|
var TYPES_THAT_SHRINK_LABEL = ["date", "datetime-local", "file", "time"];
|
|
229
214
|
function BaseInputTemplate(props) {
|
|
@@ -270,11 +255,11 @@ function BaseInputTemplate(props) {
|
|
|
270
255
|
accept,
|
|
271
256
|
...schema.examples ? { list: examplesId(id) } : void 0
|
|
272
257
|
};
|
|
273
|
-
const
|
|
274
|
-
const
|
|
275
|
-
const
|
|
258
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
259
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
260
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
276
261
|
const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps, shrink: true } : { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps };
|
|
277
|
-
const
|
|
262
|
+
const handleClear = useCallback(
|
|
278
263
|
(e) => {
|
|
279
264
|
e.preventDefault();
|
|
280
265
|
e.stopPropagation();
|
|
@@ -284,7 +269,7 @@ function BaseInputTemplate(props) {
|
|
|
284
269
|
);
|
|
285
270
|
const inputProps = { ...InputProps, ...slotProps?.input, ...muiSlotProps?.input };
|
|
286
271
|
if (options.allowClearTextInputs && value && !readonly && !disabled) {
|
|
287
|
-
const clearAdornment = /* @__PURE__ */ jsx4(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx4(ClearButton2, { registry, onClick:
|
|
272
|
+
const clearAdornment = /* @__PURE__ */ jsx4(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx4(ClearButton2, { registry, onClick: handleClear }) });
|
|
288
273
|
inputProps.endAdornment = !inputProps.endAdornment ? clearAdornment : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
289
274
|
inputProps.endAdornment,
|
|
290
275
|
clearAdornment
|
|
@@ -311,9 +296,9 @@ function BaseInputTemplate(props) {
|
|
|
311
296
|
...rest,
|
|
312
297
|
value: value || value === 0 ? value : "",
|
|
313
298
|
error: rawErrors.length > 0,
|
|
314
|
-
onChange: onChangeOverride ||
|
|
315
|
-
onBlur:
|
|
316
|
-
onFocus:
|
|
299
|
+
onChange: onChangeOverride || handleChange,
|
|
300
|
+
onBlur: handleBlur,
|
|
301
|
+
onFocus: handleFocus,
|
|
317
302
|
...{ ...otherMuiProps, ...textFieldProps },
|
|
318
303
|
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
319
304
|
}
|
|
@@ -325,9 +310,7 @@ function BaseInputTemplate(props) {
|
|
|
325
310
|
// src/DescriptionField/DescriptionField.tsx
|
|
326
311
|
import Typography from "@mui/material/Typography";
|
|
327
312
|
import { RichDescription } from "@rjsf/core";
|
|
328
|
-
import {
|
|
329
|
-
getUiOptions as getUiOptions4
|
|
330
|
-
} from "@rjsf/utils";
|
|
313
|
+
import { getUiOptions as getUiOptions4 } from "@rjsf/utils";
|
|
331
314
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
332
315
|
function DescriptionField(props) {
|
|
333
316
|
const { id, description, registry, uiSchema } = props;
|
|
@@ -357,10 +340,7 @@ import ListItemIcon from "@mui/material/ListItemIcon";
|
|
|
357
340
|
import ListItemText from "@mui/material/ListItemText";
|
|
358
341
|
import Paper3 from "@mui/material/Paper";
|
|
359
342
|
import Typography2 from "@mui/material/Typography";
|
|
360
|
-
import {
|
|
361
|
-
TranslatableString as TranslatableString2,
|
|
362
|
-
getUiOptions as getUiOptions5
|
|
363
|
-
} from "@rjsf/utils";
|
|
343
|
+
import { TranslatableString as TranslatableString2, getUiOptions as getUiOptions5 } from "@rjsf/utils";
|
|
364
344
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
365
345
|
function ErrorList({
|
|
366
346
|
errors,
|
|
@@ -382,12 +362,13 @@ function ErrorList({
|
|
|
382
362
|
} = getMuiProps(uiOptions);
|
|
383
363
|
return /* @__PURE__ */ jsx6(Paper3, { elevation: 2, ...errorPaper, children: /* @__PURE__ */ jsxs4(Box3, { ...errorBox, sx: computeSxProps({ mb: 2, p: 2 }, errorBox), children: [
|
|
384
364
|
/* @__PURE__ */ jsx6(Typography2, { variant: "h6", ...errorTypography, children: translateString(TranslatableString2.ErrorsLabel) }),
|
|
385
|
-
/* @__PURE__ */ jsx6(List, { dense: true, ...errorList, children: errors.map((error, i) =>
|
|
386
|
-
|
|
365
|
+
/* @__PURE__ */ jsx6(List, { dense: true, ...errorList, children: errors.map((error, i) => (
|
|
366
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
367
|
+
/* @__PURE__ */ jsxs4(ListItem, { ...errorListItem, children: [
|
|
387
368
|
/* @__PURE__ */ jsx6(ListItemIcon, { ...errorListItemIcon, children: /* @__PURE__ */ jsx6(ErrorIcon, { color: "error" }) }),
|
|
388
369
|
/* @__PURE__ */ jsx6(ListItemText, { primary: error.stack, ...errorListItemText })
|
|
389
|
-
] }, i)
|
|
390
|
-
|
|
370
|
+
] }, i)
|
|
371
|
+
)) })
|
|
391
372
|
] }) });
|
|
392
373
|
}
|
|
393
374
|
|
|
@@ -395,10 +376,7 @@ function ErrorList({
|
|
|
395
376
|
import FormHelperText from "@mui/material/FormHelperText";
|
|
396
377
|
import List2 from "@mui/material/List";
|
|
397
378
|
import ListItem2 from "@mui/material/ListItem";
|
|
398
|
-
import {
|
|
399
|
-
errorId,
|
|
400
|
-
getUiOptions as getUiOptions6
|
|
401
|
-
} from "@rjsf/utils";
|
|
379
|
+
import { errorId, getUiOptions as getUiOptions6 } from "@rjsf/utils";
|
|
402
380
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
403
381
|
function FieldErrorTemplate(props) {
|
|
404
382
|
const { errors = [], fieldPathId, uiSchema } = props;
|
|
@@ -409,18 +387,16 @@ function FieldErrorTemplate(props) {
|
|
|
409
387
|
const uiOptions = getUiOptions6(uiSchema);
|
|
410
388
|
const muiProps = getMuiProps(uiOptions);
|
|
411
389
|
const { rjsfSlotProps: muiSlotProps } = muiProps;
|
|
412
|
-
return /* @__PURE__ */ jsx7(List2, { id, dense: true, disablePadding: true, ...muiSlotProps?.fieldErrorList, children: errors.map((error, i) =>
|
|
413
|
-
|
|
414
|
-
|
|
390
|
+
return /* @__PURE__ */ jsx7(List2, { id, dense: true, disablePadding: true, ...muiSlotProps?.fieldErrorList, children: errors.map((error, i) => (
|
|
391
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
392
|
+
/* @__PURE__ */ jsx7(ListItem2, { disableGutters: true, ...muiSlotProps?.fieldErrorListItem, children: /* @__PURE__ */ jsx7(FormHelperText, { component: "div", id: `${id}-${i}`, ...muiSlotProps?.fieldErrorFormHelperText, children: error }) }, i)
|
|
393
|
+
)) });
|
|
415
394
|
}
|
|
416
395
|
|
|
417
396
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
418
397
|
import FormHelperText2 from "@mui/material/FormHelperText";
|
|
419
398
|
import { RichHelp } from "@rjsf/core";
|
|
420
|
-
import {
|
|
421
|
-
helpId,
|
|
422
|
-
getUiOptions as getUiOptions7
|
|
423
|
-
} from "@rjsf/utils";
|
|
399
|
+
import { helpId, getUiOptions as getUiOptions7 } from "@rjsf/utils";
|
|
424
400
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
425
401
|
function FieldHelpTemplate(props) {
|
|
426
402
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
@@ -444,10 +420,7 @@ function FieldHelpTemplate(props) {
|
|
|
444
420
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
445
421
|
import FormControl from "@mui/material/FormControl";
|
|
446
422
|
import Typography3 from "@mui/material/Typography";
|
|
447
|
-
import {
|
|
448
|
-
getTemplate as getTemplate3,
|
|
449
|
-
getUiOptions as getUiOptions8
|
|
450
|
-
} from "@rjsf/utils";
|
|
423
|
+
import { getTemplate as getTemplate3, getUiOptions as getUiOptions8 } from "@rjsf/utils";
|
|
451
424
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
452
425
|
function FieldTemplate(props) {
|
|
453
426
|
const {
|
|
@@ -506,7 +479,7 @@ function FieldTemplate(props) {
|
|
|
506
479
|
FormControl,
|
|
507
480
|
{
|
|
508
481
|
fullWidth: true,
|
|
509
|
-
error: rawErrors.length
|
|
482
|
+
error: !!rawErrors.length,
|
|
510
483
|
required,
|
|
511
484
|
...muiSlotProps?.fieldFormControl,
|
|
512
485
|
sx: otherMuiProps.sx,
|
|
@@ -532,18 +505,16 @@ function GridTemplate(props) {
|
|
|
532
505
|
}
|
|
533
506
|
|
|
534
507
|
// src/IconButton/IconButton.tsx
|
|
508
|
+
import { memo } from "react";
|
|
535
509
|
import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
|
|
536
510
|
import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
|
|
537
511
|
import ClearIcon from "@mui/icons-material/Clear";
|
|
538
512
|
import CopyIcon from "@mui/icons-material/ContentCopy";
|
|
539
513
|
import RemoveIcon from "@mui/icons-material/Remove";
|
|
540
514
|
import IconButton2 from "@mui/material/IconButton";
|
|
541
|
-
import {
|
|
542
|
-
TranslatableString as TranslatableString3,
|
|
543
|
-
getUiOptions as getUiOptions9
|
|
544
|
-
} from "@rjsf/utils";
|
|
515
|
+
import { TranslatableString as TranslatableString3, getUiOptions as getUiOptions9 } from "@rjsf/utils";
|
|
545
516
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
546
|
-
function
|
|
517
|
+
function MuiIconButtonFn(props) {
|
|
547
518
|
const { icon, color, uiSchema, registry, ...otherProps } = props;
|
|
548
519
|
const uiOptions = getUiOptions9(uiSchema);
|
|
549
520
|
const muiProps = getMuiProps(uiOptions, [
|
|
@@ -556,7 +527,9 @@ function MuiIconButton(props) {
|
|
|
556
527
|
]);
|
|
557
528
|
return /* @__PURE__ */ jsx11(IconButton2, { ...muiProps, ...otherProps, size: "small", color, children: icon });
|
|
558
529
|
}
|
|
559
|
-
|
|
530
|
+
var MuiIconButton = memo(MuiIconButtonFn);
|
|
531
|
+
var IconButton_default = MuiIconButton;
|
|
532
|
+
function CopyButtonFn(props) {
|
|
560
533
|
const {
|
|
561
534
|
registry: { translateString }
|
|
562
535
|
} = props;
|
|
@@ -569,7 +542,8 @@ function CopyButton(props) {
|
|
|
569
542
|
}
|
|
570
543
|
);
|
|
571
544
|
}
|
|
572
|
-
|
|
545
|
+
var CopyButton = memo(CopyButtonFn);
|
|
546
|
+
function MoveDownButtonFn(props) {
|
|
573
547
|
const {
|
|
574
548
|
registry: { translateString }
|
|
575
549
|
} = props;
|
|
@@ -582,7 +556,8 @@ function MoveDownButton(props) {
|
|
|
582
556
|
}
|
|
583
557
|
);
|
|
584
558
|
}
|
|
585
|
-
|
|
559
|
+
var MoveDownButton = memo(MoveDownButtonFn);
|
|
560
|
+
function MoveUpButtonFn(props) {
|
|
586
561
|
const {
|
|
587
562
|
registry: { translateString }
|
|
588
563
|
} = props;
|
|
@@ -595,7 +570,8 @@ function MoveUpButton(props) {
|
|
|
595
570
|
}
|
|
596
571
|
);
|
|
597
572
|
}
|
|
598
|
-
|
|
573
|
+
var MoveUpButton = memo(MoveUpButtonFn);
|
|
574
|
+
function RemoveButtonFn(props) {
|
|
599
575
|
const { iconType, ...otherProps } = props;
|
|
600
576
|
const {
|
|
601
577
|
registry: { translateString }
|
|
@@ -610,7 +586,8 @@ function RemoveButton(props) {
|
|
|
610
586
|
}
|
|
611
587
|
);
|
|
612
588
|
}
|
|
613
|
-
|
|
589
|
+
var RemoveButton = memo(RemoveButtonFn);
|
|
590
|
+
function ClearButtonFn(props) {
|
|
614
591
|
const { iconType, ...otherProps } = props;
|
|
615
592
|
const {
|
|
616
593
|
registry: { translateString }
|
|
@@ -624,13 +601,12 @@ function ClearButton(props) {
|
|
|
624
601
|
}
|
|
625
602
|
);
|
|
626
603
|
}
|
|
604
|
+
var ClearButton = memo(ClearButtonFn);
|
|
627
605
|
|
|
628
606
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
629
607
|
import Box4 from "@mui/material/Box";
|
|
630
608
|
import FormControl2 from "@mui/material/FormControl";
|
|
631
|
-
import {
|
|
632
|
-
getUiOptions as getUiOptions10
|
|
633
|
-
} from "@rjsf/utils";
|
|
609
|
+
import { getUiOptions as getUiOptions10 } from "@rjsf/utils";
|
|
634
610
|
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
635
611
|
function MultiSchemaFieldTemplate(props) {
|
|
636
612
|
const { optionSchemaField, selector, uiSchema } = props;
|
|
@@ -644,14 +620,7 @@ function MultiSchemaFieldTemplate(props) {
|
|
|
644
620
|
|
|
645
621
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
646
622
|
import Grid4 from "@mui/material/Grid";
|
|
647
|
-
import {
|
|
648
|
-
canExpand,
|
|
649
|
-
descriptionId,
|
|
650
|
-
getTemplate as getTemplate4,
|
|
651
|
-
getUiOptions as getUiOptions11,
|
|
652
|
-
titleId,
|
|
653
|
-
buttonId as buttonId2
|
|
654
|
-
} from "@rjsf/utils";
|
|
623
|
+
import { canExpand, descriptionId, getTemplate as getTemplate4, getUiOptions as getUiOptions11, titleId, buttonId as buttonId2 } from "@rjsf/utils";
|
|
655
624
|
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
656
625
|
function ObjectFieldTemplate(props) {
|
|
657
626
|
const {
|
|
@@ -716,7 +685,7 @@ function ObjectFieldTemplate(props) {
|
|
|
716
685
|
children: [
|
|
717
686
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
718
687
|
properties.map(
|
|
719
|
-
(element
|
|
688
|
+
(element) => (
|
|
720
689
|
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
721
690
|
// itself would otherwise still take up space.
|
|
722
691
|
element.hidden ? element.content : /* @__PURE__ */ jsx13(
|
|
@@ -727,7 +696,7 @@ function ObjectFieldTemplate(props) {
|
|
|
727
696
|
sx: computeSxProps({ mb: 1.25 }, objectGridItem),
|
|
728
697
|
children: element.content
|
|
729
698
|
},
|
|
730
|
-
|
|
699
|
+
element.name
|
|
731
700
|
)
|
|
732
701
|
)
|
|
733
702
|
)
|
|
@@ -763,7 +732,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
763
732
|
const { id, registry, label, onAddClick, onRemoveClick, uiSchema } = props;
|
|
764
733
|
if (onAddClick) {
|
|
765
734
|
return /* @__PURE__ */ jsx14(
|
|
766
|
-
|
|
735
|
+
IconButton_default,
|
|
767
736
|
{
|
|
768
737
|
id,
|
|
769
738
|
registry,
|
|
@@ -774,7 +743,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
774
743
|
icon: /* @__PURE__ */ jsx14(AddIcon2, { fontSize: "small" })
|
|
775
744
|
}
|
|
776
745
|
);
|
|
777
|
-
}
|
|
746
|
+
}
|
|
747
|
+
if (onRemoveClick) {
|
|
778
748
|
return /* @__PURE__ */ jsx14(
|
|
779
749
|
RemoveButton,
|
|
780
750
|
{
|
|
@@ -793,10 +763,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
793
763
|
// src/SubmitButton/SubmitButton.tsx
|
|
794
764
|
import Box5 from "@mui/material/Box";
|
|
795
765
|
import Button from "@mui/material/Button";
|
|
796
|
-
import {
|
|
797
|
-
getSubmitButtonOptions,
|
|
798
|
-
getUiOptions as getUiOptions12
|
|
799
|
-
} from "@rjsf/utils";
|
|
766
|
+
import { getSubmitButtonOptions, getUiOptions as getUiOptions12 } from "@rjsf/utils";
|
|
800
767
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
801
768
|
function SubmitButton({ uiSchema }) {
|
|
802
769
|
const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
|
|
@@ -824,9 +791,7 @@ import Box6 from "@mui/material/Box";
|
|
|
824
791
|
import Divider from "@mui/material/Divider";
|
|
825
792
|
import Grid5 from "@mui/material/Grid";
|
|
826
793
|
import Typography4 from "@mui/material/Typography";
|
|
827
|
-
import {
|
|
828
|
-
getUiOptions as getUiOptions13
|
|
829
|
-
} from "@rjsf/utils";
|
|
794
|
+
import { getUiOptions as getUiOptions13 } from "@rjsf/utils";
|
|
830
795
|
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
831
796
|
function TitleField(props) {
|
|
832
797
|
const { id, title, optionalDataControl, uiSchema } = props;
|
|
@@ -864,12 +829,7 @@ function TitleField(props) {
|
|
|
864
829
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
865
830
|
import Grid6 from "@mui/material/Grid";
|
|
866
831
|
import TextField2 from "@mui/material/TextField";
|
|
867
|
-
import {
|
|
868
|
-
ADDITIONAL_PROPERTY_FLAG,
|
|
869
|
-
buttonId as buttonId3,
|
|
870
|
-
TranslatableString as TranslatableString4,
|
|
871
|
-
getUiOptions as getUiOptions14
|
|
872
|
-
} from "@rjsf/utils";
|
|
832
|
+
import { ADDITIONAL_PROPERTY_FLAG, buttonId as buttonId3, TranslatableString as TranslatableString4, getUiOptions as getUiOptions14 } from "@rjsf/utils";
|
|
873
833
|
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
874
834
|
function WrapIfAdditionalTemplate(props) {
|
|
875
835
|
const {
|
|
@@ -1014,15 +974,15 @@ function CheckboxesWidget(props) {
|
|
|
1014
974
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1015
975
|
const optionValueFormat = getOptionValueFormat(options);
|
|
1016
976
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
1017
|
-
const
|
|
977
|
+
const handleChange = (index) => ({ target: { checked } }) => {
|
|
1018
978
|
if (checked) {
|
|
1019
979
|
onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
1020
980
|
} else {
|
|
1021
981
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
1022
982
|
}
|
|
1023
983
|
};
|
|
1024
|
-
const
|
|
1025
|
-
const
|
|
984
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
985
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1026
986
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
1027
987
|
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1028
988
|
labelValue2(
|
|
@@ -1031,7 +991,7 @@ function CheckboxesWidget(props) {
|
|
|
1031
991
|
),
|
|
1032
992
|
/* @__PURE__ */ jsx18(FormGroup, { ...otherMuiProps, ...muiSlotProps?.formGroup, id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1033
993
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
1034
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
994
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
1035
995
|
const checkbox = /* @__PURE__ */ jsx18(
|
|
1036
996
|
Checkbox,
|
|
1037
997
|
{
|
|
@@ -1041,9 +1001,9 @@ function CheckboxesWidget(props) {
|
|
|
1041
1001
|
checked,
|
|
1042
1002
|
disabled: disabled || itemDisabled || readonly,
|
|
1043
1003
|
autoFocus: autofocus && index === 0,
|
|
1044
|
-
onChange:
|
|
1045
|
-
onBlur:
|
|
1046
|
-
onFocus:
|
|
1004
|
+
onChange: handleChange(index),
|
|
1005
|
+
onBlur: handleBlur,
|
|
1006
|
+
onFocus: handleFocus,
|
|
1047
1007
|
"aria-describedby": ariaDescribedByIds2(id)
|
|
1048
1008
|
}
|
|
1049
1009
|
);
|
|
@@ -1052,7 +1012,7 @@ function CheckboxesWidget(props) {
|
|
|
1052
1012
|
{
|
|
1053
1013
|
...muiSlotProps?.formControlLabel,
|
|
1054
1014
|
control: checkbox,
|
|
1055
|
-
key:
|
|
1015
|
+
key: String(option.value),
|
|
1056
1016
|
label: option.label
|
|
1057
1017
|
}
|
|
1058
1018
|
);
|
|
@@ -1063,13 +1023,7 @@ function CheckboxesWidget(props) {
|
|
|
1063
1023
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
1064
1024
|
import Checkbox2 from "@mui/material/Checkbox";
|
|
1065
1025
|
import FormControlLabel2 from "@mui/material/FormControlLabel";
|
|
1066
|
-
import {
|
|
1067
|
-
ariaDescribedByIds as ariaDescribedByIds3,
|
|
1068
|
-
descriptionId as descriptionId2,
|
|
1069
|
-
getTemplate as getTemplate5,
|
|
1070
|
-
labelValue as labelValue3,
|
|
1071
|
-
schemaRequiresTrueValue
|
|
1072
|
-
} from "@rjsf/utils";
|
|
1026
|
+
import { ariaDescribedByIds as ariaDescribedByIds3, descriptionId as descriptionId2, getTemplate as getTemplate5, labelValue as labelValue3, schemaRequiresTrueValue } from "@rjsf/utils";
|
|
1073
1027
|
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1074
1028
|
function CheckboxWidget(props) {
|
|
1075
1029
|
const {
|
|
@@ -1095,9 +1049,9 @@ function CheckboxWidget(props) {
|
|
|
1095
1049
|
options
|
|
1096
1050
|
);
|
|
1097
1051
|
const required = schemaRequiresTrueValue(schema);
|
|
1098
|
-
const
|
|
1099
|
-
const
|
|
1100
|
-
const
|
|
1052
|
+
const handleChange = (_, checked) => onChange(checked);
|
|
1053
|
+
const handleBlur = () => onBlur(id, value);
|
|
1054
|
+
const handleFocus = () => onFocus(id, value);
|
|
1101
1055
|
const description = options.description ?? schema.description;
|
|
1102
1056
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
1103
1057
|
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
@@ -1125,9 +1079,9 @@ function CheckboxWidget(props) {
|
|
|
1125
1079
|
required,
|
|
1126
1080
|
disabled: disabled || readonly,
|
|
1127
1081
|
autoFocus: autofocus,
|
|
1128
|
-
onChange:
|
|
1129
|
-
onBlur:
|
|
1130
|
-
onFocus:
|
|
1082
|
+
onChange: handleChange,
|
|
1083
|
+
onBlur: handleBlur,
|
|
1084
|
+
onFocus: handleFocus,
|
|
1131
1085
|
"aria-describedby": ariaDescribedByIds3(id),
|
|
1132
1086
|
...muiSlotProps?.checkbox
|
|
1133
1087
|
}
|
|
@@ -1158,9 +1112,9 @@ function RadioWidget(props) {
|
|
|
1158
1112
|
const { id, htmlName, options, value, required, disabled, readonly, label, hideLabel, onChange, onBlur, onFocus } = props;
|
|
1159
1113
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1160
1114
|
const optionValueFormat = getOptionValueFormat2(options);
|
|
1161
|
-
const
|
|
1162
|
-
const
|
|
1163
|
-
const
|
|
1115
|
+
const handleChange = (_, enumValue) => onChange(enumOptionValueDecoder2(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
1116
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1117
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1164
1118
|
const row = options ? options.inline : false;
|
|
1165
1119
|
const selectValue = enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, "");
|
|
1166
1120
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
@@ -1178,12 +1132,12 @@ function RadioWidget(props) {
|
|
|
1178
1132
|
name: htmlName || id,
|
|
1179
1133
|
value: selectValue,
|
|
1180
1134
|
row,
|
|
1181
|
-
onChange:
|
|
1182
|
-
onBlur:
|
|
1183
|
-
onFocus:
|
|
1135
|
+
onChange: handleChange,
|
|
1136
|
+
onBlur: handleBlur,
|
|
1137
|
+
onFocus: handleFocus,
|
|
1184
1138
|
"aria-describedby": ariaDescribedByIds4(id),
|
|
1185
1139
|
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1186
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
1140
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
1187
1141
|
const radio = /* @__PURE__ */ createElement2(
|
|
1188
1142
|
FormControlLabel3,
|
|
1189
1143
|
{
|
|
@@ -1191,7 +1145,7 @@ function RadioWidget(props) {
|
|
|
1191
1145
|
control: /* @__PURE__ */ jsx20(Radio, { ...muiSlotProps?.radio, name: htmlName || id, id: optionId2(id, index), color: "primary" }),
|
|
1192
1146
|
label: option.label,
|
|
1193
1147
|
value: enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
1194
|
-
key:
|
|
1148
|
+
key: String(option.value),
|
|
1195
1149
|
disabled: disabled || itemDisabled || readonly
|
|
1196
1150
|
}
|
|
1197
1151
|
);
|
|
@@ -1205,20 +1159,16 @@ function RadioWidget(props) {
|
|
|
1205
1159
|
// src/RangeWidget/RangeWidget.tsx
|
|
1206
1160
|
import FormLabel3 from "@mui/material/FormLabel";
|
|
1207
1161
|
import Slider from "@mui/material/Slider";
|
|
1208
|
-
import {
|
|
1209
|
-
ariaDescribedByIds as ariaDescribedByIds5,
|
|
1210
|
-
labelValue as labelValue5,
|
|
1211
|
-
rangeSpec
|
|
1212
|
-
} from "@rjsf/utils";
|
|
1162
|
+
import { ariaDescribedByIds as ariaDescribedByIds5, labelValue as labelValue5, rangeSpec } from "@rjsf/utils";
|
|
1213
1163
|
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1214
1164
|
function RangeWidget(props) {
|
|
1215
1165
|
const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } = props;
|
|
1216
1166
|
const sliderProps = { value, label, id, name: id, ...rangeSpec(schema) };
|
|
1217
|
-
const
|
|
1218
|
-
onChange(
|
|
1167
|
+
const handleChange = (_, newValue) => {
|
|
1168
|
+
onChange(newValue ?? options.emptyValue);
|
|
1219
1169
|
};
|
|
1220
|
-
const
|
|
1221
|
-
const
|
|
1170
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1171
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1222
1172
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
1223
1173
|
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
1224
1174
|
labelValue5(
|
|
@@ -1229,9 +1179,9 @@ function RangeWidget(props) {
|
|
|
1229
1179
|
Slider,
|
|
1230
1180
|
{
|
|
1231
1181
|
disabled: disabled || readonly,
|
|
1232
|
-
onChange:
|
|
1233
|
-
onBlur:
|
|
1234
|
-
onFocus:
|
|
1182
|
+
onChange: handleChange,
|
|
1183
|
+
onBlur: handleBlur,
|
|
1184
|
+
onFocus: handleFocus,
|
|
1235
1185
|
valueLabelDisplay: "auto",
|
|
1236
1186
|
...otherMuiProps,
|
|
1237
1187
|
...muiSlotProps?.slider,
|
|
@@ -1286,9 +1236,9 @@ function SelectWidget(props) {
|
|
|
1286
1236
|
const isMultiple = typeof multiple === "undefined" ? false : !!multiple;
|
|
1287
1237
|
const emptyValue = isMultiple ? [] : "";
|
|
1288
1238
|
const isEmpty = typeof value === "undefined" || isMultiple && value.length < 1 || !isMultiple && value === emptyValue;
|
|
1289
|
-
const
|
|
1290
|
-
const
|
|
1291
|
-
const
|
|
1239
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(enumOptionValueDecoder3(newValue, enumOptions, optionValueFormat, optEmptyVal));
|
|
1240
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder3(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1241
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder3(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
1292
1242
|
const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
|
|
1293
1243
|
const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
|
|
1294
1244
|
const showPlaceholderOption = !isMultiple && schema.default === void 0;
|
|
@@ -1305,9 +1255,9 @@ function SelectWidget(props) {
|
|
|
1305
1255
|
autoComplete: autocomplete,
|
|
1306
1256
|
placeholder,
|
|
1307
1257
|
error: rawErrors.length > 0,
|
|
1308
|
-
onChange:
|
|
1309
|
-
onBlur:
|
|
1310
|
-
onFocus:
|
|
1258
|
+
onChange: handleChange,
|
|
1259
|
+
onBlur: handleBlur,
|
|
1260
|
+
onFocus: handleFocus,
|
|
1311
1261
|
...{ ...otherMuiProps, ...textFieldRemainingProps },
|
|
1312
1262
|
select: true,
|
|
1313
1263
|
slotProps: {
|
|
@@ -1324,9 +1274,17 @@ function SelectWidget(props) {
|
|
|
1324
1274
|
"aria-describedby": ariaDescribedByIds6(id),
|
|
1325
1275
|
children: [
|
|
1326
1276
|
showPlaceholderOption && /* @__PURE__ */ jsx22(MenuItem, { value: "", children: placeholder }),
|
|
1327
|
-
Array.isArray(enumOptions) && enumOptions.map(({ value:
|
|
1328
|
-
const
|
|
1329
|
-
return /* @__PURE__ */ jsx22(
|
|
1277
|
+
Array.isArray(enumOptions) && enumOptions.map(({ value: enumValue, label: enumLabel }, i) => {
|
|
1278
|
+
const isDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(enumValue);
|
|
1279
|
+
return /* @__PURE__ */ jsx22(
|
|
1280
|
+
MenuItem,
|
|
1281
|
+
{
|
|
1282
|
+
value: enumOptionValueEncoder2(enumValue, i, optionValueFormat),
|
|
1283
|
+
disabled: isDisabled,
|
|
1284
|
+
children: enumLabel
|
|
1285
|
+
},
|
|
1286
|
+
String(enumValue)
|
|
1287
|
+
);
|
|
1330
1288
|
})
|
|
1331
1289
|
]
|
|
1332
1290
|
}
|