@rjsf/mui 6.0.0-beta.8 → 6.0.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 +14 -14
- package/dist/{index.js → index.cjs} +176 -103
- package/dist/index.cjs.map +7 -0
- package/dist/mui.esm.js +175 -102
- package/dist/mui.esm.js.map +4 -4
- package/dist/mui.umd.js +125 -62
- package/lib/AddButton/AddButton.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -3
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +5 -5
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +7 -8
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +3 -3
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +6 -6
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.js +1 -1
- package/lib/ErrorList/ErrorList.js +7 -7
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +5 -5
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +3 -3
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.js +4 -4
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +1 -1
- package/lib/GridTemplate/GridTemplate.js +3 -3
- package/lib/GridTemplate/GridTemplate.js.map +1 -1
- package/lib/IconButton/IconButton.js +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +2 -0
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +8 -0
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -0
- package/lib/MultiSchemaFieldTemplate/index.d.ts +2 -0
- package/lib/MultiSchemaFieldTemplate/index.js +3 -0
- package/lib/MultiSchemaFieldTemplate/index.js.map +1 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +6 -5
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +10 -0
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +22 -0
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -0
- package/lib/OptionalDataControlsTemplate/index.d.ts +2 -0
- package/lib/OptionalDataControlsTemplate/index.js +3 -0
- package/lib/OptionalDataControlsTemplate/index.js.map +1 -0
- package/lib/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.js +7 -7
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.js +2 -2
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +4 -4
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.js +2 -2
- package/lib/Templates/Templates.js +4 -0
- package/lib/Templates/Templates.js.map +1 -1
- package/lib/TitleField/TitleField.d.ts +1 -1
- package/lib/TitleField/TitleField.js +10 -5
- package/lib/TitleField/TitleField.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +4 -5
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -26
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +10 -10
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +27 -21
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +6 -7
- package/src/CheckboxWidget/CheckboxWidget.tsx +6 -6
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +3 -2
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +2 -2
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -2
- package/src/FieldTemplate/FieldTemplate.tsx +6 -4
- package/src/GridTemplate/GridTemplate.tsx +4 -4
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +20 -0
- package/src/MultiSchemaFieldTemplate/index.ts +2 -0
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +20 -16
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +43 -0
- package/src/OptionalDataControlsTemplate/index.ts +2 -0
- package/src/RadioWidget/RadioWidget.tsx +4 -3
- package/src/RangeWidget/RangeWidget.tsx +1 -1
- package/src/SelectWidget/SelectWidget.tsx +3 -3
- package/src/Templates/Templates.ts +4 -0
- package/src/TitleField/TitleField.tsx +12 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +14 -16
- package/dist/index.js.map +0 -7
package/dist/mui.esm.js
CHANGED
|
@@ -17,7 +17,7 @@ function AddButton({
|
|
|
17
17
|
|
|
18
18
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
19
19
|
import Box from "@mui/material/Box";
|
|
20
|
-
import
|
|
20
|
+
import Grid from "@mui/material/Grid";
|
|
21
21
|
import Paper from "@mui/material/Paper";
|
|
22
22
|
import {
|
|
23
23
|
getUiOptions,
|
|
@@ -39,15 +39,15 @@ function ArrayFieldItemTemplate(props) {
|
|
|
39
39
|
fontWeight: "bold",
|
|
40
40
|
minWidth: 0
|
|
41
41
|
};
|
|
42
|
-
return /* @__PURE__ */ jsxs(
|
|
43
|
-
/* @__PURE__ */ jsx2(
|
|
44
|
-
hasToolbar && /* @__PURE__ */ jsx2(
|
|
42
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", children: [
|
|
43
|
+
/* @__PURE__ */ jsx2(Grid, { size: "auto", style: { overflow: "auto" }, children: /* @__PURE__ */ jsx2(Box, { mb: 2, children: /* @__PURE__ */ jsx2(Paper, { elevation: 2, children: /* @__PURE__ */ jsx2(Box, { p: 2, children }) }) }) }),
|
|
44
|
+
hasToolbar && /* @__PURE__ */ jsx2(Grid, { children: /* @__PURE__ */ jsx2(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) })
|
|
45
45
|
] });
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
49
49
|
import Box2 from "@mui/material/Box";
|
|
50
|
-
import
|
|
50
|
+
import Grid2 from "@mui/material/Grid";
|
|
51
51
|
import Paper2 from "@mui/material/Paper";
|
|
52
52
|
import {
|
|
53
53
|
getTemplate as getTemplate2,
|
|
@@ -56,23 +56,32 @@ import {
|
|
|
56
56
|
} from "@rjsf/utils";
|
|
57
57
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
58
58
|
function ArrayFieldTemplate(props) {
|
|
59
|
-
const {
|
|
59
|
+
const {
|
|
60
|
+
canAdd,
|
|
61
|
+
disabled,
|
|
62
|
+
fieldPathId,
|
|
63
|
+
uiSchema,
|
|
64
|
+
items,
|
|
65
|
+
optionalDataControl,
|
|
66
|
+
onAddClick,
|
|
67
|
+
readonly,
|
|
68
|
+
registry,
|
|
69
|
+
required,
|
|
70
|
+
schema,
|
|
71
|
+
title
|
|
72
|
+
} = props;
|
|
60
73
|
const uiOptions = getUiOptions2(uiSchema);
|
|
61
74
|
const ArrayFieldDescriptionTemplate = getTemplate2(
|
|
62
75
|
"ArrayFieldDescriptionTemplate",
|
|
63
76
|
registry,
|
|
64
77
|
uiOptions
|
|
65
78
|
);
|
|
66
|
-
const ArrayFieldItemTemplate2 = getTemplate2(
|
|
67
|
-
"ArrayFieldItemTemplate",
|
|
68
|
-
registry,
|
|
69
|
-
uiOptions
|
|
70
|
-
);
|
|
71
79
|
const ArrayFieldTitleTemplate = getTemplate2(
|
|
72
80
|
"ArrayFieldTitleTemplate",
|
|
73
81
|
registry,
|
|
74
82
|
uiOptions
|
|
75
83
|
);
|
|
84
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
76
85
|
const {
|
|
77
86
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
78
87
|
} = registry.templates;
|
|
@@ -80,29 +89,31 @@ function ArrayFieldTemplate(props) {
|
|
|
80
89
|
/* @__PURE__ */ jsx3(
|
|
81
90
|
ArrayFieldTitleTemplate,
|
|
82
91
|
{
|
|
83
|
-
|
|
92
|
+
fieldPathId,
|
|
84
93
|
title: uiOptions.title || title,
|
|
85
94
|
schema,
|
|
86
95
|
uiSchema,
|
|
87
96
|
required,
|
|
88
|
-
registry
|
|
97
|
+
registry,
|
|
98
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
89
99
|
}
|
|
90
100
|
),
|
|
91
101
|
/* @__PURE__ */ jsx3(
|
|
92
102
|
ArrayFieldDescriptionTemplate,
|
|
93
103
|
{
|
|
94
|
-
|
|
104
|
+
fieldPathId,
|
|
95
105
|
description: uiOptions.description || schema.description,
|
|
96
106
|
schema,
|
|
97
107
|
uiSchema,
|
|
98
108
|
registry
|
|
99
109
|
}
|
|
100
110
|
),
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
112
|
+
items,
|
|
113
|
+
canAdd && /* @__PURE__ */ jsx3(Grid2, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsx3(Grid2, { children: /* @__PURE__ */ jsx3(Box2, { mt: 2, children: /* @__PURE__ */ jsx3(
|
|
103
114
|
AddButton2,
|
|
104
115
|
{
|
|
105
|
-
id: buttonId(
|
|
116
|
+
id: buttonId(fieldPathId, "add"),
|
|
106
117
|
className: "rjsf-array-item-add",
|
|
107
118
|
onClick: onAddClick,
|
|
108
119
|
disabled: disabled || readonly,
|
|
@@ -128,6 +139,7 @@ function BaseInputTemplate(props) {
|
|
|
128
139
|
id,
|
|
129
140
|
name,
|
|
130
141
|
// remove this from textFieldProps
|
|
142
|
+
htmlName,
|
|
131
143
|
placeholder,
|
|
132
144
|
required,
|
|
133
145
|
readonly,
|
|
@@ -147,7 +159,6 @@ function BaseInputTemplate(props) {
|
|
|
147
159
|
uiSchema,
|
|
148
160
|
rawErrors = [],
|
|
149
161
|
errorSchema,
|
|
150
|
-
formContext,
|
|
151
162
|
registry,
|
|
152
163
|
InputLabelProps,
|
|
153
164
|
...textFieldProps
|
|
@@ -167,20 +178,19 @@ function BaseInputTemplate(props) {
|
|
|
167
178
|
TextField,
|
|
168
179
|
{
|
|
169
180
|
id,
|
|
170
|
-
name: id,
|
|
181
|
+
name: htmlName || id,
|
|
171
182
|
placeholder,
|
|
172
183
|
label: labelValue(label || void 0, hideLabel, void 0),
|
|
173
184
|
autoFocus: autofocus,
|
|
174
185
|
required,
|
|
175
186
|
disabled: disabled || readonly,
|
|
176
|
-
|
|
187
|
+
slotProps: { htmlInput: htmlInputProps, inputLabel: DisplayInputLabelProps },
|
|
177
188
|
...rest,
|
|
178
189
|
value: value || value === 0 ? value : "",
|
|
179
190
|
error: rawErrors.length > 0,
|
|
180
191
|
onChange: onChangeOverride || _onChange,
|
|
181
192
|
onBlur: _onBlur,
|
|
182
193
|
onFocus: _onFocus,
|
|
183
|
-
InputLabelProps: DisplayInputLabelProps,
|
|
184
194
|
...textFieldProps,
|
|
185
195
|
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
186
196
|
}
|
|
@@ -304,11 +314,11 @@ import List2 from "@mui/material/List";
|
|
|
304
314
|
import { errorId } from "@rjsf/utils";
|
|
305
315
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
306
316
|
function FieldErrorTemplate(props) {
|
|
307
|
-
const { errors = [],
|
|
317
|
+
const { errors = [], fieldPathId } = props;
|
|
308
318
|
if (errors.length === 0) {
|
|
309
319
|
return null;
|
|
310
320
|
}
|
|
311
|
-
const id = errorId(
|
|
321
|
+
const id = errorId(fieldPathId);
|
|
312
322
|
return /* @__PURE__ */ jsx8(List2, { id, dense: true, disablePadding: true, children: errors.map((error, i) => {
|
|
313
323
|
return /* @__PURE__ */ jsx8(ListItem2, { disableGutters: true, children: /* @__PURE__ */ jsx8(FormHelperText, { component: "div", id: `${id}-${i}`, children: error }) }, i);
|
|
314
324
|
}) });
|
|
@@ -319,11 +329,11 @@ import FormHelperText2 from "@mui/material/FormHelperText";
|
|
|
319
329
|
import { helpId } from "@rjsf/utils";
|
|
320
330
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
321
331
|
function FieldHelpTemplate(props) {
|
|
322
|
-
const {
|
|
332
|
+
const { fieldPathId, help } = props;
|
|
323
333
|
if (!help) {
|
|
324
334
|
return null;
|
|
325
335
|
}
|
|
326
|
-
const id = helpId(
|
|
336
|
+
const id = helpId(fieldPathId);
|
|
327
337
|
return /* @__PURE__ */ jsx9(FormHelperText2, { component: "div", id, children: help });
|
|
328
338
|
}
|
|
329
339
|
|
|
@@ -345,8 +355,9 @@ function FieldTemplate(props) {
|
|
|
345
355
|
displayLabel,
|
|
346
356
|
hidden,
|
|
347
357
|
label,
|
|
348
|
-
|
|
349
|
-
|
|
358
|
+
onKeyRename,
|
|
359
|
+
onKeyRenameBlur,
|
|
360
|
+
onRemoveProperty,
|
|
350
361
|
readonly,
|
|
351
362
|
required,
|
|
352
363
|
rawErrors = [],
|
|
@@ -375,8 +386,9 @@ function FieldTemplate(props) {
|
|
|
375
386
|
disabled,
|
|
376
387
|
id,
|
|
377
388
|
label,
|
|
378
|
-
|
|
379
|
-
|
|
389
|
+
onKeyRename,
|
|
390
|
+
onKeyRenameBlur,
|
|
391
|
+
onRemoveProperty,
|
|
380
392
|
readonly,
|
|
381
393
|
required,
|
|
382
394
|
schema,
|
|
@@ -393,15 +405,27 @@ function FieldTemplate(props) {
|
|
|
393
405
|
}
|
|
394
406
|
|
|
395
407
|
// src/GridTemplate/GridTemplate.tsx
|
|
396
|
-
import
|
|
408
|
+
import Grid3 from "@mui/material/Grid";
|
|
397
409
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
398
410
|
function GridTemplate(props) {
|
|
399
411
|
const { children, column, ...rest } = props;
|
|
400
|
-
return /* @__PURE__ */ jsx11(
|
|
412
|
+
return /* @__PURE__ */ jsx11(Grid3, { container: !column, ...rest, children });
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
416
|
+
import Box4 from "@mui/material/Box";
|
|
417
|
+
import FormControl2 from "@mui/material/FormControl";
|
|
418
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
419
|
+
function MultiSchemaFieldTemplate(props) {
|
|
420
|
+
const { optionSchemaField, selector } = props;
|
|
421
|
+
return /* @__PURE__ */ jsxs6(Box4, { sx: { mb: 2 }, children: [
|
|
422
|
+
/* @__PURE__ */ jsx12(FormControl2, { fullWidth: true, sx: { mb: 2 }, children: selector }),
|
|
423
|
+
optionSchemaField
|
|
424
|
+
] });
|
|
401
425
|
}
|
|
402
426
|
|
|
403
427
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
404
|
-
import
|
|
428
|
+
import Grid4 from "@mui/material/Grid";
|
|
405
429
|
import {
|
|
406
430
|
canExpand,
|
|
407
431
|
descriptionId,
|
|
@@ -410,7 +434,7 @@ import {
|
|
|
410
434
|
titleId,
|
|
411
435
|
buttonId as buttonId2
|
|
412
436
|
} from "@rjsf/utils";
|
|
413
|
-
import { Fragment as Fragment2, jsx as
|
|
437
|
+
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
414
438
|
function ObjectFieldTemplate(props) {
|
|
415
439
|
const {
|
|
416
440
|
description,
|
|
@@ -420,10 +444,11 @@ function ObjectFieldTemplate(props) {
|
|
|
420
444
|
disabled,
|
|
421
445
|
readonly,
|
|
422
446
|
uiSchema,
|
|
423
|
-
|
|
447
|
+
fieldPathId,
|
|
424
448
|
schema,
|
|
425
449
|
formData,
|
|
426
|
-
|
|
450
|
+
optionalDataControl,
|
|
451
|
+
onAddProperty,
|
|
427
452
|
registry
|
|
428
453
|
} = props;
|
|
429
454
|
const uiOptions = getUiOptions4(uiSchema);
|
|
@@ -433,45 +458,48 @@ function ObjectFieldTemplate(props) {
|
|
|
433
458
|
registry,
|
|
434
459
|
uiOptions
|
|
435
460
|
);
|
|
461
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
436
462
|
const {
|
|
437
463
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
438
464
|
} = registry.templates;
|
|
439
|
-
return /* @__PURE__ */
|
|
440
|
-
title && /* @__PURE__ */
|
|
465
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
466
|
+
title && /* @__PURE__ */ jsx13(
|
|
441
467
|
TitleFieldTemplate,
|
|
442
468
|
{
|
|
443
|
-
id: titleId(
|
|
469
|
+
id: titleId(fieldPathId),
|
|
444
470
|
title,
|
|
445
471
|
required,
|
|
446
472
|
schema,
|
|
447
473
|
uiSchema,
|
|
448
|
-
registry
|
|
474
|
+
registry,
|
|
475
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
449
476
|
}
|
|
450
477
|
),
|
|
451
|
-
description && /* @__PURE__ */
|
|
478
|
+
description && /* @__PURE__ */ jsx13(
|
|
452
479
|
DescriptionFieldTemplate,
|
|
453
480
|
{
|
|
454
|
-
id: descriptionId(
|
|
481
|
+
id: descriptionId(fieldPathId),
|
|
455
482
|
description,
|
|
456
483
|
schema,
|
|
457
484
|
uiSchema,
|
|
458
485
|
registry
|
|
459
486
|
}
|
|
460
487
|
),
|
|
461
|
-
/* @__PURE__ */
|
|
488
|
+
/* @__PURE__ */ jsxs7(Grid4, { container: true, spacing: 2, style: { marginTop: "10px" }, children: [
|
|
489
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
462
490
|
properties.map(
|
|
463
491
|
(element, index) => (
|
|
464
|
-
// Remove the <
|
|
492
|
+
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
465
493
|
// itself would otherwise still take up space.
|
|
466
|
-
element.hidden ? element.content : /* @__PURE__ */
|
|
494
|
+
element.hidden ? element.content : /* @__PURE__ */ jsx13(Grid4, { size: { xs: 12 }, style: { marginBottom: "10px" }, children: element.content }, index)
|
|
467
495
|
)
|
|
468
496
|
),
|
|
469
|
-
canExpand(schema, uiSchema, formData) && /* @__PURE__ */
|
|
497
|
+
canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx13(Grid4, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsx13(Grid4, { children: /* @__PURE__ */ jsx13(
|
|
470
498
|
AddButton2,
|
|
471
499
|
{
|
|
472
|
-
id: buttonId2(
|
|
500
|
+
id: buttonId2(fieldPathId, "add"),
|
|
473
501
|
className: "rjsf-object-property-expand",
|
|
474
|
-
onClick:
|
|
502
|
+
onClick: onAddProperty,
|
|
475
503
|
disabled: disabled || readonly,
|
|
476
504
|
uiSchema,
|
|
477
505
|
registry
|
|
@@ -481,43 +509,84 @@ function ObjectFieldTemplate(props) {
|
|
|
481
509
|
] });
|
|
482
510
|
}
|
|
483
511
|
|
|
512
|
+
// src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx
|
|
513
|
+
import AddIcon2 from "@mui/icons-material/Add";
|
|
514
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
515
|
+
function OptionalDataControlsTemplate(props) {
|
|
516
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
517
|
+
if (onAddClick) {
|
|
518
|
+
return /* @__PURE__ */ jsx14(
|
|
519
|
+
MuiIconButton,
|
|
520
|
+
{
|
|
521
|
+
id,
|
|
522
|
+
registry,
|
|
523
|
+
className: "rjsf-add-optional-data",
|
|
524
|
+
onClick: onAddClick,
|
|
525
|
+
title: label,
|
|
526
|
+
icon: /* @__PURE__ */ jsx14(AddIcon2, { fontSize: "small" })
|
|
527
|
+
}
|
|
528
|
+
);
|
|
529
|
+
} else if (onRemoveClick) {
|
|
530
|
+
return /* @__PURE__ */ jsx14(
|
|
531
|
+
RemoveButton,
|
|
532
|
+
{
|
|
533
|
+
id,
|
|
534
|
+
registry,
|
|
535
|
+
className: "rjsf-remove-optional-data",
|
|
536
|
+
onClick: onRemoveClick,
|
|
537
|
+
title: label
|
|
538
|
+
}
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
return /* @__PURE__ */ jsx14("em", { id, children: label });
|
|
542
|
+
}
|
|
543
|
+
|
|
484
544
|
// src/SubmitButton/SubmitButton.tsx
|
|
485
|
-
import
|
|
545
|
+
import Box5 from "@mui/material/Box";
|
|
486
546
|
import Button from "@mui/material/Button";
|
|
487
547
|
import { getSubmitButtonOptions } from "@rjsf/utils";
|
|
488
|
-
import { jsx as
|
|
548
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
489
549
|
function SubmitButton({ uiSchema }) {
|
|
490
550
|
const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
|
|
491
551
|
if (norender) {
|
|
492
552
|
return null;
|
|
493
553
|
}
|
|
494
|
-
return /* @__PURE__ */
|
|
554
|
+
return /* @__PURE__ */ jsx15(Box5, { marginTop: 3, children: /* @__PURE__ */ jsx15(Button, { type: "submit", variant: "contained", color: "primary", ...submitButtonProps, children: submitText }) });
|
|
495
555
|
}
|
|
496
556
|
|
|
497
557
|
// src/TitleField/TitleField.tsx
|
|
498
|
-
import
|
|
558
|
+
import Box6 from "@mui/material/Box";
|
|
499
559
|
import Divider from "@mui/material/Divider";
|
|
560
|
+
import Grid5 from "@mui/material/Grid";
|
|
500
561
|
import Typography4 from "@mui/material/Typography";
|
|
501
|
-
import { jsx as
|
|
562
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
502
563
|
function TitleField({
|
|
503
564
|
id,
|
|
504
|
-
title
|
|
565
|
+
title,
|
|
566
|
+
optionalDataControl
|
|
505
567
|
}) {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
/* @__PURE__ */
|
|
568
|
+
let heading = /* @__PURE__ */ jsx16(Typography4, { variant: "h5", children: title });
|
|
569
|
+
if (optionalDataControl) {
|
|
570
|
+
heading = /* @__PURE__ */ jsxs8(Grid5, { container: true, spacing: 0, children: [
|
|
571
|
+
/* @__PURE__ */ jsx16(Grid5, { size: "grow", children: heading }),
|
|
572
|
+
/* @__PURE__ */ jsx16(Grid5, { justifyContent: "flex-end", children: optionalDataControl })
|
|
573
|
+
] });
|
|
574
|
+
}
|
|
575
|
+
return /* @__PURE__ */ jsxs8(Box6, { id, mb: 1, mt: 1, children: [
|
|
576
|
+
heading,
|
|
577
|
+
/* @__PURE__ */ jsx16(Divider, {})
|
|
509
578
|
] });
|
|
510
579
|
}
|
|
511
580
|
|
|
512
581
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
513
|
-
import
|
|
582
|
+
import Grid6 from "@mui/material/Grid";
|
|
514
583
|
import TextField2 from "@mui/material/TextField";
|
|
515
584
|
import {
|
|
516
585
|
ADDITIONAL_PROPERTY_FLAG,
|
|
517
586
|
buttonId as buttonId3,
|
|
518
587
|
TranslatableString as TranslatableString4
|
|
519
588
|
} from "@rjsf/utils";
|
|
520
|
-
import { jsx as
|
|
589
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
521
590
|
function WrapIfAdditionalTemplate(props) {
|
|
522
591
|
const {
|
|
523
592
|
children,
|
|
@@ -526,8 +595,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
526
595
|
disabled,
|
|
527
596
|
id,
|
|
528
597
|
label,
|
|
529
|
-
|
|
530
|
-
|
|
598
|
+
onKeyRenameBlur,
|
|
599
|
+
onRemoveProperty,
|
|
531
600
|
readonly,
|
|
532
601
|
required,
|
|
533
602
|
schema,
|
|
@@ -545,11 +614,10 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
545
614
|
fontWeight: "bold"
|
|
546
615
|
};
|
|
547
616
|
if (!additional) {
|
|
548
|
-
return /* @__PURE__ */
|
|
617
|
+
return /* @__PURE__ */ jsx17("div", { className: classNames, style, children });
|
|
549
618
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
/* @__PURE__ */ jsx15(Grid25, { size: "auto", children: /* @__PURE__ */ jsx15(
|
|
619
|
+
return /* @__PURE__ */ jsxs9(Grid6, { container: true, alignItems: "center", spacing: 2, className: classNames, style, children: [
|
|
620
|
+
/* @__PURE__ */ jsx17(Grid6, { size: "auto", children: /* @__PURE__ */ jsx17(
|
|
553
621
|
TextField2,
|
|
554
622
|
{
|
|
555
623
|
fullWidth: true,
|
|
@@ -559,12 +627,12 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
559
627
|
disabled: disabled || readonly,
|
|
560
628
|
id: `${id}-key`,
|
|
561
629
|
name: `${id}-key`,
|
|
562
|
-
onBlur: !readonly ?
|
|
630
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
563
631
|
type: "text"
|
|
564
632
|
}
|
|
565
633
|
) }),
|
|
566
|
-
/* @__PURE__ */
|
|
567
|
-
/* @__PURE__ */
|
|
634
|
+
/* @__PURE__ */ jsx17(Grid6, { size: "auto", children }),
|
|
635
|
+
/* @__PURE__ */ jsx17(Grid6, { children: /* @__PURE__ */ jsx17(
|
|
568
636
|
RemoveButton2,
|
|
569
637
|
{
|
|
570
638
|
id: buttonId3(id, "remove"),
|
|
@@ -572,7 +640,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
572
640
|
iconType: "default",
|
|
573
641
|
style: btnStyle,
|
|
574
642
|
disabled: disabled || readonly,
|
|
575
|
-
onClick:
|
|
643
|
+
onClick: onRemoveProperty,
|
|
576
644
|
uiSchema,
|
|
577
645
|
registry
|
|
578
646
|
}
|
|
@@ -600,7 +668,9 @@ function generateTemplates() {
|
|
|
600
668
|
FieldHelpTemplate,
|
|
601
669
|
FieldTemplate,
|
|
602
670
|
GridTemplate,
|
|
671
|
+
MultiSchemaFieldTemplate,
|
|
603
672
|
ObjectFieldTemplate,
|
|
673
|
+
OptionalDataControlsTemplate,
|
|
604
674
|
TitleFieldTemplate: TitleField,
|
|
605
675
|
WrapIfAdditionalTemplate
|
|
606
676
|
};
|
|
@@ -617,11 +687,12 @@ import {
|
|
|
617
687
|
labelValue as labelValue2,
|
|
618
688
|
schemaRequiresTrueValue
|
|
619
689
|
} from "@rjsf/utils";
|
|
620
|
-
import { Fragment as Fragment3, jsx as
|
|
690
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
621
691
|
function CheckboxWidget(props) {
|
|
622
692
|
const {
|
|
623
693
|
schema,
|
|
624
694
|
id,
|
|
695
|
+
htmlName,
|
|
625
696
|
value,
|
|
626
697
|
disabled,
|
|
627
698
|
readonly,
|
|
@@ -642,11 +713,11 @@ function CheckboxWidget(props) {
|
|
|
642
713
|
);
|
|
643
714
|
const required = schemaRequiresTrueValue(schema);
|
|
644
715
|
const _onChange = (_, checked) => onChange(checked);
|
|
645
|
-
const _onBlur = (
|
|
646
|
-
const _onFocus = (
|
|
716
|
+
const _onBlur = () => onBlur(id, value);
|
|
717
|
+
const _onFocus = () => onFocus(id, value);
|
|
647
718
|
const description = options.description ?? schema.description;
|
|
648
|
-
return /* @__PURE__ */
|
|
649
|
-
!hideLabel && description && /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
720
|
+
!hideLabel && description && /* @__PURE__ */ jsx18(
|
|
650
721
|
DescriptionFieldTemplate,
|
|
651
722
|
{
|
|
652
723
|
id: descriptionId2(id),
|
|
@@ -656,14 +727,14 @@ function CheckboxWidget(props) {
|
|
|
656
727
|
registry
|
|
657
728
|
}
|
|
658
729
|
),
|
|
659
|
-
/* @__PURE__ */
|
|
730
|
+
/* @__PURE__ */ jsx18(
|
|
660
731
|
FormControlLabel,
|
|
661
732
|
{
|
|
662
|
-
control: /* @__PURE__ */
|
|
733
|
+
control: /* @__PURE__ */ jsx18(
|
|
663
734
|
Checkbox,
|
|
664
735
|
{
|
|
665
736
|
id,
|
|
666
|
-
name: id,
|
|
737
|
+
name: htmlName || id,
|
|
667
738
|
checked: typeof value === "undefined" ? false : Boolean(value),
|
|
668
739
|
required,
|
|
669
740
|
disabled: disabled || readonly,
|
|
@@ -694,11 +765,12 @@ import {
|
|
|
694
765
|
labelValue as labelValue3,
|
|
695
766
|
optionId
|
|
696
767
|
} from "@rjsf/utils";
|
|
697
|
-
import { Fragment as Fragment4, jsx as
|
|
768
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
698
769
|
function CheckboxesWidget({
|
|
699
770
|
label,
|
|
700
771
|
hideLabel,
|
|
701
772
|
id,
|
|
773
|
+
htmlName,
|
|
702
774
|
disabled,
|
|
703
775
|
options,
|
|
704
776
|
value,
|
|
@@ -720,19 +792,19 @@ function CheckboxesWidget({
|
|
|
720
792
|
};
|
|
721
793
|
const _onBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
722
794
|
const _onFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
723
|
-
return /* @__PURE__ */
|
|
795
|
+
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
724
796
|
labelValue3(
|
|
725
|
-
/* @__PURE__ */
|
|
797
|
+
/* @__PURE__ */ jsx19(FormLabel, { required, htmlFor: id, children: label || void 0 }),
|
|
726
798
|
hideLabel
|
|
727
799
|
),
|
|
728
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ jsx19(FormGroup, { id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
729
801
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
730
802
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
731
|
-
const checkbox = /* @__PURE__ */
|
|
803
|
+
const checkbox = /* @__PURE__ */ jsx19(
|
|
732
804
|
Checkbox2,
|
|
733
805
|
{
|
|
734
806
|
id: optionId(id, index),
|
|
735
|
-
name: id,
|
|
807
|
+
name: htmlName || id,
|
|
736
808
|
checked,
|
|
737
809
|
disabled: disabled || itemDisabled || readonly,
|
|
738
810
|
autoFocus: autofocus && index === 0,
|
|
@@ -742,7 +814,7 @@ function CheckboxesWidget({
|
|
|
742
814
|
"aria-describedby": ariaDescribedByIds3(id)
|
|
743
815
|
}
|
|
744
816
|
);
|
|
745
|
-
return /* @__PURE__ */
|
|
817
|
+
return /* @__PURE__ */ jsx19(FormControlLabel2, { control: checkbox, label: option.label }, index);
|
|
746
818
|
}) })
|
|
747
819
|
] });
|
|
748
820
|
}
|
|
@@ -759,9 +831,10 @@ import {
|
|
|
759
831
|
labelValue as labelValue4,
|
|
760
832
|
optionId as optionId2
|
|
761
833
|
} from "@rjsf/utils";
|
|
762
|
-
import { Fragment as Fragment5, jsx as
|
|
834
|
+
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
763
835
|
function RadioWidget({
|
|
764
836
|
id,
|
|
837
|
+
htmlName,
|
|
765
838
|
options,
|
|
766
839
|
value,
|
|
767
840
|
required,
|
|
@@ -779,16 +852,16 @@ function RadioWidget({
|
|
|
779
852
|
const _onFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue));
|
|
780
853
|
const row = options ? options.inline : false;
|
|
781
854
|
const selectedIndex = enumOptionsIndexForValue(value, enumOptions) ?? null;
|
|
782
|
-
return /* @__PURE__ */
|
|
855
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
783
856
|
labelValue4(
|
|
784
|
-
/* @__PURE__ */
|
|
857
|
+
/* @__PURE__ */ jsx20(FormLabel2, { required, htmlFor: id, children: label || void 0 }),
|
|
785
858
|
hideLabel
|
|
786
859
|
),
|
|
787
|
-
/* @__PURE__ */
|
|
860
|
+
/* @__PURE__ */ jsx20(
|
|
788
861
|
RadioGroup,
|
|
789
862
|
{
|
|
790
863
|
id,
|
|
791
|
-
name: id,
|
|
864
|
+
name: htmlName || id,
|
|
792
865
|
value: selectedIndex,
|
|
793
866
|
row,
|
|
794
867
|
onChange: _onChange,
|
|
@@ -797,10 +870,10 @@ function RadioWidget({
|
|
|
797
870
|
"aria-describedby": ariaDescribedByIds4(id),
|
|
798
871
|
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
799
872
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
800
|
-
const radio = /* @__PURE__ */
|
|
873
|
+
const radio = /* @__PURE__ */ jsx20(
|
|
801
874
|
FormControlLabel3,
|
|
802
875
|
{
|
|
803
|
-
control: /* @__PURE__ */
|
|
876
|
+
control: /* @__PURE__ */ jsx20(Radio, { name: htmlName || id, id: optionId2(id, index), color: "primary" }),
|
|
804
877
|
label: option.label,
|
|
805
878
|
value: String(index),
|
|
806
879
|
disabled: disabled || itemDisabled || readonly
|
|
@@ -822,7 +895,7 @@ import {
|
|
|
822
895
|
labelValue as labelValue5,
|
|
823
896
|
rangeSpec
|
|
824
897
|
} from "@rjsf/utils";
|
|
825
|
-
import { Fragment as Fragment6, jsx as
|
|
898
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
826
899
|
function RangeWidget(props) {
|
|
827
900
|
const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } = props;
|
|
828
901
|
const sliderProps = { value, label, id, name: id, ...rangeSpec(schema) };
|
|
@@ -831,12 +904,12 @@ function RangeWidget(props) {
|
|
|
831
904
|
};
|
|
832
905
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
833
906
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
834
|
-
return /* @__PURE__ */
|
|
907
|
+
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
835
908
|
labelValue5(
|
|
836
|
-
/* @__PURE__ */
|
|
909
|
+
/* @__PURE__ */ jsx21(FormLabel3, { required, htmlFor: id, children: label || void 0 }),
|
|
837
910
|
hideLabel
|
|
838
911
|
),
|
|
839
|
-
/* @__PURE__ */
|
|
912
|
+
/* @__PURE__ */ jsx21(
|
|
840
913
|
Slider,
|
|
841
914
|
{
|
|
842
915
|
disabled: disabled || readonly,
|
|
@@ -860,12 +933,13 @@ import {
|
|
|
860
933
|
enumOptionsValueForIndex as enumOptionsValueForIndex3,
|
|
861
934
|
labelValue as labelValue6
|
|
862
935
|
} from "@rjsf/utils";
|
|
863
|
-
import { jsx as
|
|
936
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
864
937
|
function SelectWidget({
|
|
865
938
|
schema,
|
|
866
939
|
id,
|
|
867
940
|
name,
|
|
868
941
|
// remove this from textFieldProps
|
|
942
|
+
htmlName,
|
|
869
943
|
options,
|
|
870
944
|
label,
|
|
871
945
|
hideLabel,
|
|
@@ -884,7 +958,6 @@ function SelectWidget({
|
|
|
884
958
|
registry,
|
|
885
959
|
uiSchema,
|
|
886
960
|
hideError,
|
|
887
|
-
formContext,
|
|
888
961
|
...textFieldProps
|
|
889
962
|
}) {
|
|
890
963
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
@@ -897,11 +970,11 @@ function SelectWidget({
|
|
|
897
970
|
const selectedIndexes = enumOptionsIndexForValue2(value, enumOptions, multiple);
|
|
898
971
|
const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
|
|
899
972
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
900
|
-
return /* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ jsxs14(
|
|
901
974
|
TextField3,
|
|
902
975
|
{
|
|
903
976
|
id,
|
|
904
|
-
name: id,
|
|
977
|
+
name: htmlName || id,
|
|
905
978
|
label: labelValue6(label || void 0, hideLabel, void 0),
|
|
906
979
|
value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
|
|
907
980
|
required,
|
|
@@ -925,10 +998,10 @@ function SelectWidget({
|
|
|
925
998
|
},
|
|
926
999
|
"aria-describedby": ariaDescribedByIds6(id),
|
|
927
1000
|
children: [
|
|
928
|
-
showPlaceholderOption && /* @__PURE__ */
|
|
1001
|
+
showPlaceholderOption && /* @__PURE__ */ jsx22(MenuItem, { value: "", children: placeholder }),
|
|
929
1002
|
Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label: label2 }, i) => {
|
|
930
1003
|
const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1;
|
|
931
|
-
return /* @__PURE__ */
|
|
1004
|
+
return /* @__PURE__ */ jsx22(MenuItem, { value: String(i), disabled: disabled2, children: label2 }, i);
|
|
932
1005
|
})
|
|
933
1006
|
]
|
|
934
1007
|
}
|
|
@@ -937,7 +1010,7 @@ function SelectWidget({
|
|
|
937
1010
|
|
|
938
1011
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
939
1012
|
import { getTemplate as getTemplate6 } from "@rjsf/utils";
|
|
940
|
-
import { jsx as
|
|
1013
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
941
1014
|
function TextareaWidget(props) {
|
|
942
1015
|
const { options, registry } = props;
|
|
943
1016
|
const BaseInputTemplate2 = getTemplate6("BaseInputTemplate", registry, options);
|
|
@@ -945,7 +1018,7 @@ function TextareaWidget(props) {
|
|
|
945
1018
|
if (typeof options.rows === "string" || typeof options.rows === "number") {
|
|
946
1019
|
rows = options.rows;
|
|
947
1020
|
}
|
|
948
|
-
return /* @__PURE__ */
|
|
1021
|
+
return /* @__PURE__ */ jsx23(BaseInputTemplate2, { ...props, multiline: true, rows });
|
|
949
1022
|
}
|
|
950
1023
|
|
|
951
1024
|
// src/Widgets/Widgets.ts
|