@rjsf/mui 6.0.0-beta.9 → 6.0.1
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 +2 -2
- package/dist/{index.js → index.cjs} +165 -91
- package/dist/index.cjs.map +7 -0
- package/dist/mui.esm.js +164 -90
- package/dist/mui.esm.js.map +4 -4
- package/dist/mui.umd.js +107 -43
- package/lib/AddButton/AddButton.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -3
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +4 -4
- 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.js +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 +5 -4
- 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 +22 -23
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -3
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +22 -16
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +5 -5
- 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/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +20 -0
- package/src/MultiSchemaFieldTemplate/index.ts +2 -0
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +10 -6
- 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 +6 -8
- package/dist/index.js.map +0 -7
package/README.md
CHANGED
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
|
|
48
48
|
## About The Project
|
|
49
49
|
|
|
50
|
-
[![@rjsf/mui Screen Shot][product-screenshot]](https://rjsf-team.github.io/@rjsf/mui)
|
|
51
|
-
|
|
52
50
|
Exports `MUI` version 5 theme, fields, and widgets for `react-jsonschema-form`.
|
|
53
51
|
|
|
52
|
+
[<img src="./screenshot.png" alt="product-screenshot" width="800" />](https://rjsf-team.github.io/@rjsf/mui)
|
|
53
|
+
|
|
54
54
|
### Built With
|
|
55
55
|
|
|
56
56
|
- [react-jsonschema-form](https://github.com/rjsf-team/react-jsonschema-form/)
|
|
@@ -93,23 +93,32 @@ var import_Paper2 = __toESM(require("@mui/material/Paper"), 1);
|
|
|
93
93
|
var import_utils3 = require("@rjsf/utils");
|
|
94
94
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
95
95
|
function ArrayFieldTemplate(props) {
|
|
96
|
-
const {
|
|
96
|
+
const {
|
|
97
|
+
canAdd,
|
|
98
|
+
disabled,
|
|
99
|
+
fieldPathId,
|
|
100
|
+
uiSchema,
|
|
101
|
+
items,
|
|
102
|
+
optionalDataControl,
|
|
103
|
+
onAddClick,
|
|
104
|
+
readonly,
|
|
105
|
+
registry,
|
|
106
|
+
required,
|
|
107
|
+
schema,
|
|
108
|
+
title
|
|
109
|
+
} = props;
|
|
97
110
|
const uiOptions = (0, import_utils3.getUiOptions)(uiSchema);
|
|
98
111
|
const ArrayFieldDescriptionTemplate = (0, import_utils3.getTemplate)(
|
|
99
112
|
"ArrayFieldDescriptionTemplate",
|
|
100
113
|
registry,
|
|
101
114
|
uiOptions
|
|
102
115
|
);
|
|
103
|
-
const ArrayFieldItemTemplate2 = (0, import_utils3.getTemplate)(
|
|
104
|
-
"ArrayFieldItemTemplate",
|
|
105
|
-
registry,
|
|
106
|
-
uiOptions
|
|
107
|
-
);
|
|
108
116
|
const ArrayFieldTitleTemplate = (0, import_utils3.getTemplate)(
|
|
109
117
|
"ArrayFieldTitleTemplate",
|
|
110
118
|
registry,
|
|
111
119
|
uiOptions
|
|
112
120
|
);
|
|
121
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
113
122
|
const {
|
|
114
123
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
115
124
|
} = registry.templates;
|
|
@@ -117,29 +126,31 @@ function ArrayFieldTemplate(props) {
|
|
|
117
126
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
118
127
|
ArrayFieldTitleTemplate,
|
|
119
128
|
{
|
|
120
|
-
|
|
129
|
+
fieldPathId,
|
|
121
130
|
title: uiOptions.title || title,
|
|
122
131
|
schema,
|
|
123
132
|
uiSchema,
|
|
124
133
|
required,
|
|
125
|
-
registry
|
|
134
|
+
registry,
|
|
135
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
126
136
|
}
|
|
127
137
|
),
|
|
128
138
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
129
139
|
ArrayFieldDescriptionTemplate,
|
|
130
140
|
{
|
|
131
|
-
|
|
141
|
+
fieldPathId,
|
|
132
142
|
description: uiOptions.description || schema.description,
|
|
133
143
|
schema,
|
|
134
144
|
uiSchema,
|
|
135
145
|
registry
|
|
136
146
|
}
|
|
137
147
|
),
|
|
138
|
-
|
|
148
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
149
|
+
items,
|
|
139
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)(
|
|
140
151
|
AddButton2,
|
|
141
152
|
{
|
|
142
|
-
id: (0, import_utils3.buttonId)(
|
|
153
|
+
id: (0, import_utils3.buttonId)(fieldPathId, "add"),
|
|
143
154
|
className: "rjsf-array-item-add",
|
|
144
155
|
onClick: onAddClick,
|
|
145
156
|
disabled: disabled || readonly,
|
|
@@ -160,6 +171,7 @@ function BaseInputTemplate(props) {
|
|
|
160
171
|
id,
|
|
161
172
|
name,
|
|
162
173
|
// remove this from textFieldProps
|
|
174
|
+
htmlName,
|
|
163
175
|
placeholder,
|
|
164
176
|
required,
|
|
165
177
|
readonly,
|
|
@@ -179,7 +191,6 @@ function BaseInputTemplate(props) {
|
|
|
179
191
|
uiSchema,
|
|
180
192
|
rawErrors = [],
|
|
181
193
|
errorSchema,
|
|
182
|
-
formContext,
|
|
183
194
|
registry,
|
|
184
195
|
InputLabelProps,
|
|
185
196
|
...textFieldProps
|
|
@@ -199,7 +210,7 @@ function BaseInputTemplate(props) {
|
|
|
199
210
|
import_TextField.default,
|
|
200
211
|
{
|
|
201
212
|
id,
|
|
202
|
-
name: id,
|
|
213
|
+
name: htmlName || id,
|
|
203
214
|
placeholder,
|
|
204
215
|
label: (0, import_utils4.labelValue)(label || void 0, hideLabel, void 0),
|
|
205
216
|
autoFocus: autofocus,
|
|
@@ -335,11 +346,11 @@ var import_List2 = __toESM(require("@mui/material/List"), 1);
|
|
|
335
346
|
var import_utils7 = require("@rjsf/utils");
|
|
336
347
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
337
348
|
function FieldErrorTemplate(props) {
|
|
338
|
-
const { errors = [],
|
|
349
|
+
const { errors = [], fieldPathId } = props;
|
|
339
350
|
if (errors.length === 0) {
|
|
340
351
|
return null;
|
|
341
352
|
}
|
|
342
|
-
const id = (0, import_utils7.errorId)(
|
|
353
|
+
const id = (0, import_utils7.errorId)(fieldPathId);
|
|
343
354
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_List2.default, { id, dense: true, disablePadding: true, children: errors.map((error, i) => {
|
|
344
355
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ListItem2.default, { disableGutters: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_FormHelperText.default, { component: "div", id: `${id}-${i}`, children: error }) }, i);
|
|
345
356
|
}) });
|
|
@@ -350,11 +361,11 @@ var import_FormHelperText2 = __toESM(require("@mui/material/FormHelperText"), 1)
|
|
|
350
361
|
var import_utils8 = require("@rjsf/utils");
|
|
351
362
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
352
363
|
function FieldHelpTemplate(props) {
|
|
353
|
-
const {
|
|
364
|
+
const { fieldPathId, help } = props;
|
|
354
365
|
if (!help) {
|
|
355
366
|
return null;
|
|
356
367
|
}
|
|
357
|
-
const id = (0, import_utils8.helpId)(
|
|
368
|
+
const id = (0, import_utils8.helpId)(fieldPathId);
|
|
358
369
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_FormHelperText2.default, { component: "div", id, children: help });
|
|
359
370
|
}
|
|
360
371
|
|
|
@@ -373,8 +384,9 @@ function FieldTemplate(props) {
|
|
|
373
384
|
displayLabel,
|
|
374
385
|
hidden,
|
|
375
386
|
label,
|
|
376
|
-
|
|
377
|
-
|
|
387
|
+
onKeyRename,
|
|
388
|
+
onKeyRenameBlur,
|
|
389
|
+
onRemoveProperty,
|
|
378
390
|
readonly,
|
|
379
391
|
required,
|
|
380
392
|
rawErrors = [],
|
|
@@ -403,8 +415,9 @@ function FieldTemplate(props) {
|
|
|
403
415
|
disabled,
|
|
404
416
|
id,
|
|
405
417
|
label,
|
|
406
|
-
|
|
407
|
-
|
|
418
|
+
onKeyRename,
|
|
419
|
+
onKeyRenameBlur,
|
|
420
|
+
onRemoveProperty,
|
|
408
421
|
readonly,
|
|
409
422
|
required,
|
|
410
423
|
schema,
|
|
@@ -428,10 +441,22 @@ function GridTemplate(props) {
|
|
|
428
441
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Grid3.default, { container: !column, ...rest, children });
|
|
429
442
|
}
|
|
430
443
|
|
|
444
|
+
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
445
|
+
var import_Box4 = __toESM(require("@mui/material/Box"), 1);
|
|
446
|
+
var import_FormControl2 = __toESM(require("@mui/material/FormControl"), 1);
|
|
447
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
448
|
+
function MultiSchemaFieldTemplate(props) {
|
|
449
|
+
const { optionSchemaField, selector } = props;
|
|
450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_Box4.default, { sx: { mb: 2 }, children: [
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_FormControl2.default, { fullWidth: true, sx: { mb: 2 }, children: selector }),
|
|
452
|
+
optionSchemaField
|
|
453
|
+
] });
|
|
454
|
+
}
|
|
455
|
+
|
|
431
456
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
432
457
|
var import_Grid4 = __toESM(require("@mui/material/Grid"), 1);
|
|
433
458
|
var import_utils10 = require("@rjsf/utils");
|
|
434
|
-
var
|
|
459
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
435
460
|
function ObjectFieldTemplate(props) {
|
|
436
461
|
const {
|
|
437
462
|
description,
|
|
@@ -441,10 +466,11 @@ function ObjectFieldTemplate(props) {
|
|
|
441
466
|
disabled,
|
|
442
467
|
readonly,
|
|
443
468
|
uiSchema,
|
|
444
|
-
|
|
469
|
+
fieldPathId,
|
|
445
470
|
schema,
|
|
446
471
|
formData,
|
|
447
|
-
|
|
472
|
+
optionalDataControl,
|
|
473
|
+
onAddProperty,
|
|
448
474
|
registry
|
|
449
475
|
} = props;
|
|
450
476
|
const uiOptions = (0, import_utils10.getUiOptions)(uiSchema);
|
|
@@ -454,45 +480,48 @@ function ObjectFieldTemplate(props) {
|
|
|
454
480
|
registry,
|
|
455
481
|
uiOptions
|
|
456
482
|
);
|
|
483
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
457
484
|
const {
|
|
458
485
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
459
486
|
} = registry.templates;
|
|
460
|
-
return /* @__PURE__ */ (0,
|
|
461
|
-
title && /* @__PURE__ */ (0,
|
|
487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
488
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
462
489
|
TitleFieldTemplate,
|
|
463
490
|
{
|
|
464
|
-
id: (0, import_utils10.titleId)(
|
|
491
|
+
id: (0, import_utils10.titleId)(fieldPathId),
|
|
465
492
|
title,
|
|
466
493
|
required,
|
|
467
494
|
schema,
|
|
468
495
|
uiSchema,
|
|
469
|
-
registry
|
|
496
|
+
registry,
|
|
497
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
470
498
|
}
|
|
471
499
|
),
|
|
472
|
-
description && /* @__PURE__ */ (0,
|
|
500
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
473
501
|
DescriptionFieldTemplate,
|
|
474
502
|
{
|
|
475
|
-
id: (0, import_utils10.descriptionId)(
|
|
503
|
+
id: (0, import_utils10.descriptionId)(fieldPathId),
|
|
476
504
|
description,
|
|
477
505
|
schema,
|
|
478
506
|
uiSchema,
|
|
479
507
|
registry
|
|
480
508
|
}
|
|
481
509
|
),
|
|
482
|
-
/* @__PURE__ */ (0,
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_Grid4.default, { container: true, spacing: 2, style: { marginTop: "10px" }, children: [
|
|
511
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
483
512
|
properties.map(
|
|
484
513
|
(element, index) => (
|
|
485
514
|
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
486
515
|
// itself would otherwise still take up space.
|
|
487
|
-
element.hidden ? element.content : /* @__PURE__ */ (0,
|
|
516
|
+
element.hidden ? element.content : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Grid4.default, { size: { xs: 12 }, style: { marginBottom: "10px" }, children: element.content }, index)
|
|
488
517
|
)
|
|
489
518
|
),
|
|
490
|
-
(0, import_utils10.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0,
|
|
519
|
+
(0, import_utils10.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Grid4.default, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Grid4.default, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
491
520
|
AddButton2,
|
|
492
521
|
{
|
|
493
|
-
id: (0, import_utils10.buttonId)(
|
|
522
|
+
id: (0, import_utils10.buttonId)(fieldPathId, "add"),
|
|
494
523
|
className: "rjsf-object-property-expand",
|
|
495
|
-
onClick:
|
|
524
|
+
onClick: onAddProperty,
|
|
496
525
|
disabled: disabled || readonly,
|
|
497
526
|
uiSchema,
|
|
498
527
|
registry
|
|
@@ -502,39 +531,80 @@ function ObjectFieldTemplate(props) {
|
|
|
502
531
|
] });
|
|
503
532
|
}
|
|
504
533
|
|
|
534
|
+
// src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx
|
|
535
|
+
var import_Add2 = __toESM(require("@mui/icons-material/Add"), 1);
|
|
536
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
537
|
+
function OptionalDataControlsTemplate(props) {
|
|
538
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
539
|
+
if (onAddClick) {
|
|
540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
541
|
+
MuiIconButton,
|
|
542
|
+
{
|
|
543
|
+
id,
|
|
544
|
+
registry,
|
|
545
|
+
className: "rjsf-add-optional-data",
|
|
546
|
+
onClick: onAddClick,
|
|
547
|
+
title: label,
|
|
548
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Add2.default, { fontSize: "small" })
|
|
549
|
+
}
|
|
550
|
+
);
|
|
551
|
+
} else if (onRemoveClick) {
|
|
552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
553
|
+
RemoveButton,
|
|
554
|
+
{
|
|
555
|
+
id,
|
|
556
|
+
registry,
|
|
557
|
+
className: "rjsf-remove-optional-data",
|
|
558
|
+
onClick: onRemoveClick,
|
|
559
|
+
title: label
|
|
560
|
+
}
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("em", { id, children: label });
|
|
564
|
+
}
|
|
565
|
+
|
|
505
566
|
// src/SubmitButton/SubmitButton.tsx
|
|
506
|
-
var
|
|
567
|
+
var import_Box5 = __toESM(require("@mui/material/Box"), 1);
|
|
507
568
|
var import_Button = __toESM(require("@mui/material/Button"), 1);
|
|
508
569
|
var import_utils11 = require("@rjsf/utils");
|
|
509
|
-
var
|
|
570
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
510
571
|
function SubmitButton({ uiSchema }) {
|
|
511
572
|
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils11.getSubmitButtonOptions)(uiSchema);
|
|
512
573
|
if (norender) {
|
|
513
574
|
return null;
|
|
514
575
|
}
|
|
515
|
-
return /* @__PURE__ */ (0,
|
|
576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Box5.default, { marginTop: 3, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Button.default, { type: "submit", variant: "contained", color: "primary", ...submitButtonProps, children: submitText }) });
|
|
516
577
|
}
|
|
517
578
|
|
|
518
579
|
// src/TitleField/TitleField.tsx
|
|
519
|
-
var
|
|
580
|
+
var import_Box6 = __toESM(require("@mui/material/Box"), 1);
|
|
520
581
|
var import_Divider = __toESM(require("@mui/material/Divider"), 1);
|
|
582
|
+
var import_Grid5 = __toESM(require("@mui/material/Grid"), 1);
|
|
521
583
|
var import_Typography4 = __toESM(require("@mui/material/Typography"), 1);
|
|
522
|
-
var
|
|
584
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
523
585
|
function TitleField({
|
|
524
586
|
id,
|
|
525
|
-
title
|
|
587
|
+
title,
|
|
588
|
+
optionalDataControl
|
|
526
589
|
}) {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
/* @__PURE__ */ (0,
|
|
590
|
+
let heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Typography4.default, { variant: "h5", children: title });
|
|
591
|
+
if (optionalDataControl) {
|
|
592
|
+
heading = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_Grid5.default, { container: true, spacing: 0, children: [
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Grid5.default, { size: "grow", children: heading }),
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Grid5.default, { justifyContent: "flex-end", children: optionalDataControl })
|
|
595
|
+
] });
|
|
596
|
+
}
|
|
597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_Box6.default, { id, mb: 1, mt: 1, children: [
|
|
598
|
+
heading,
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Divider.default, {})
|
|
530
600
|
] });
|
|
531
601
|
}
|
|
532
602
|
|
|
533
603
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
534
|
-
var
|
|
604
|
+
var import_Grid6 = __toESM(require("@mui/material/Grid"), 1);
|
|
535
605
|
var import_TextField2 = __toESM(require("@mui/material/TextField"), 1);
|
|
536
606
|
var import_utils12 = require("@rjsf/utils");
|
|
537
|
-
var
|
|
607
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
538
608
|
function WrapIfAdditionalTemplate(props) {
|
|
539
609
|
const {
|
|
540
610
|
children,
|
|
@@ -543,8 +613,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
543
613
|
disabled,
|
|
544
614
|
id,
|
|
545
615
|
label,
|
|
546
|
-
|
|
547
|
-
|
|
616
|
+
onKeyRenameBlur,
|
|
617
|
+
onRemoveProperty,
|
|
548
618
|
readonly,
|
|
549
619
|
required,
|
|
550
620
|
schema,
|
|
@@ -562,11 +632,10 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
562
632
|
fontWeight: "bold"
|
|
563
633
|
};
|
|
564
634
|
if (!additional) {
|
|
565
|
-
return /* @__PURE__ */ (0,
|
|
635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classNames, style, children });
|
|
566
636
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Grid5.default, { size: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_Grid6.default, { container: true, alignItems: "center", spacing: 2, className: classNames, style, children: [
|
|
638
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Grid6.default, { size: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
570
639
|
import_TextField2.default,
|
|
571
640
|
{
|
|
572
641
|
fullWidth: true,
|
|
@@ -576,12 +645,12 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
576
645
|
disabled: disabled || readonly,
|
|
577
646
|
id: `${id}-key`,
|
|
578
647
|
name: `${id}-key`,
|
|
579
|
-
onBlur: !readonly ?
|
|
648
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
580
649
|
type: "text"
|
|
581
650
|
}
|
|
582
651
|
) }),
|
|
583
|
-
/* @__PURE__ */ (0,
|
|
584
|
-
/* @__PURE__ */ (0,
|
|
652
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Grid6.default, { size: "auto", children }),
|
|
653
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Grid6.default, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
585
654
|
RemoveButton2,
|
|
586
655
|
{
|
|
587
656
|
id: (0, import_utils12.buttonId)(id, "remove"),
|
|
@@ -589,7 +658,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
589
658
|
iconType: "default",
|
|
590
659
|
style: btnStyle,
|
|
591
660
|
disabled: disabled || readonly,
|
|
592
|
-
onClick:
|
|
661
|
+
onClick: onRemoveProperty,
|
|
593
662
|
uiSchema,
|
|
594
663
|
registry
|
|
595
664
|
}
|
|
@@ -617,7 +686,9 @@ function generateTemplates() {
|
|
|
617
686
|
FieldHelpTemplate,
|
|
618
687
|
FieldTemplate,
|
|
619
688
|
GridTemplate,
|
|
689
|
+
MultiSchemaFieldTemplate,
|
|
620
690
|
ObjectFieldTemplate,
|
|
691
|
+
OptionalDataControlsTemplate,
|
|
621
692
|
TitleFieldTemplate: TitleField,
|
|
622
693
|
WrapIfAdditionalTemplate
|
|
623
694
|
};
|
|
@@ -628,11 +699,12 @@ var Templates_default = generateTemplates();
|
|
|
628
699
|
var import_Checkbox = __toESM(require("@mui/material/Checkbox"), 1);
|
|
629
700
|
var import_FormControlLabel = __toESM(require("@mui/material/FormControlLabel"), 1);
|
|
630
701
|
var import_utils13 = require("@rjsf/utils");
|
|
631
|
-
var
|
|
702
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
632
703
|
function CheckboxWidget(props) {
|
|
633
704
|
const {
|
|
634
705
|
schema,
|
|
635
706
|
id,
|
|
707
|
+
htmlName,
|
|
636
708
|
value,
|
|
637
709
|
disabled,
|
|
638
710
|
readonly,
|
|
@@ -653,11 +725,11 @@ function CheckboxWidget(props) {
|
|
|
653
725
|
);
|
|
654
726
|
const required = (0, import_utils13.schemaRequiresTrueValue)(schema);
|
|
655
727
|
const _onChange = (_, checked) => onChange(checked);
|
|
656
|
-
const _onBlur = (
|
|
657
|
-
const _onFocus = (
|
|
728
|
+
const _onBlur = () => onBlur(id, value);
|
|
729
|
+
const _onFocus = () => onFocus(id, value);
|
|
658
730
|
const description = options.description ?? schema.description;
|
|
659
|
-
return /* @__PURE__ */ (0,
|
|
660
|
-
!hideLabel && description && /* @__PURE__ */ (0,
|
|
731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
732
|
+
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
661
733
|
DescriptionFieldTemplate,
|
|
662
734
|
{
|
|
663
735
|
id: (0, import_utils13.descriptionId)(id),
|
|
@@ -667,14 +739,14 @@ function CheckboxWidget(props) {
|
|
|
667
739
|
registry
|
|
668
740
|
}
|
|
669
741
|
),
|
|
670
|
-
/* @__PURE__ */ (0,
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
671
743
|
import_FormControlLabel.default,
|
|
672
744
|
{
|
|
673
|
-
control: /* @__PURE__ */ (0,
|
|
745
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
674
746
|
import_Checkbox.default,
|
|
675
747
|
{
|
|
676
748
|
id,
|
|
677
|
-
name: id,
|
|
749
|
+
name: htmlName || id,
|
|
678
750
|
checked: typeof value === "undefined" ? false : Boolean(value),
|
|
679
751
|
required,
|
|
680
752
|
disabled: disabled || readonly,
|
|
@@ -697,11 +769,12 @@ var import_FormControlLabel2 = __toESM(require("@mui/material/FormControlLabel")
|
|
|
697
769
|
var import_FormGroup = __toESM(require("@mui/material/FormGroup"), 1);
|
|
698
770
|
var import_FormLabel = __toESM(require("@mui/material/FormLabel"), 1);
|
|
699
771
|
var import_utils14 = require("@rjsf/utils");
|
|
700
|
-
var
|
|
772
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
701
773
|
function CheckboxesWidget({
|
|
702
774
|
label,
|
|
703
775
|
hideLabel,
|
|
704
776
|
id,
|
|
777
|
+
htmlName,
|
|
705
778
|
disabled,
|
|
706
779
|
options,
|
|
707
780
|
value,
|
|
@@ -723,19 +796,19 @@ function CheckboxesWidget({
|
|
|
723
796
|
};
|
|
724
797
|
const _onBlur = ({ target }) => onBlur(id, (0, import_utils14.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
725
798
|
const _onFocus = ({ target }) => onFocus(id, (0, import_utils14.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
726
|
-
return /* @__PURE__ */ (0,
|
|
799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
727
800
|
(0, import_utils14.labelValue)(
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FormLabel.default, { required, htmlFor: id, children: label || void 0 }),
|
|
729
802
|
hideLabel
|
|
730
803
|
),
|
|
731
|
-
/* @__PURE__ */ (0,
|
|
804
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FormGroup.default, { id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
732
805
|
const checked = (0, import_utils14.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
733
806
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
734
|
-
const checkbox = /* @__PURE__ */ (0,
|
|
807
|
+
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
735
808
|
import_Checkbox2.default,
|
|
736
809
|
{
|
|
737
810
|
id: (0, import_utils14.optionId)(id, index),
|
|
738
|
-
name: id,
|
|
811
|
+
name: htmlName || id,
|
|
739
812
|
checked,
|
|
740
813
|
disabled: disabled || itemDisabled || readonly,
|
|
741
814
|
autoFocus: autofocus && index === 0,
|
|
@@ -745,7 +818,7 @@ function CheckboxesWidget({
|
|
|
745
818
|
"aria-describedby": (0, import_utils14.ariaDescribedByIds)(id)
|
|
746
819
|
}
|
|
747
820
|
);
|
|
748
|
-
return /* @__PURE__ */ (0,
|
|
821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FormControlLabel2.default, { control: checkbox, label: option.label }, index);
|
|
749
822
|
}) })
|
|
750
823
|
] });
|
|
751
824
|
}
|
|
@@ -756,9 +829,10 @@ var import_FormLabel2 = __toESM(require("@mui/material/FormLabel"), 1);
|
|
|
756
829
|
var import_Radio = __toESM(require("@mui/material/Radio"), 1);
|
|
757
830
|
var import_RadioGroup = __toESM(require("@mui/material/RadioGroup"), 1);
|
|
758
831
|
var import_utils15 = require("@rjsf/utils");
|
|
759
|
-
var
|
|
832
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
760
833
|
function RadioWidget({
|
|
761
834
|
id,
|
|
835
|
+
htmlName,
|
|
762
836
|
options,
|
|
763
837
|
value,
|
|
764
838
|
required,
|
|
@@ -776,16 +850,16 @@ function RadioWidget({
|
|
|
776
850
|
const _onFocus = ({ target }) => onFocus(id, (0, import_utils15.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
777
851
|
const row = options ? options.inline : false;
|
|
778
852
|
const selectedIndex = (0, import_utils15.enumOptionsIndexForValue)(value, enumOptions) ?? null;
|
|
779
|
-
return /* @__PURE__ */ (0,
|
|
853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
780
854
|
(0, import_utils15.labelValue)(
|
|
781
|
-
/* @__PURE__ */ (0,
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_FormLabel2.default, { required, htmlFor: id, children: label || void 0 }),
|
|
782
856
|
hideLabel
|
|
783
857
|
),
|
|
784
|
-
/* @__PURE__ */ (0,
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
785
859
|
import_RadioGroup.default,
|
|
786
860
|
{
|
|
787
861
|
id,
|
|
788
|
-
name: id,
|
|
862
|
+
name: htmlName || id,
|
|
789
863
|
value: selectedIndex,
|
|
790
864
|
row,
|
|
791
865
|
onChange: _onChange,
|
|
@@ -794,10 +868,10 @@ function RadioWidget({
|
|
|
794
868
|
"aria-describedby": (0, import_utils15.ariaDescribedByIds)(id),
|
|
795
869
|
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
796
870
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
797
|
-
const radio = /* @__PURE__ */ (0,
|
|
871
|
+
const radio = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
798
872
|
import_FormControlLabel3.default,
|
|
799
873
|
{
|
|
800
|
-
control: /* @__PURE__ */ (0,
|
|
874
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Radio.default, { name: htmlName || id, id: (0, import_utils15.optionId)(id, index), color: "primary" }),
|
|
801
875
|
label: option.label,
|
|
802
876
|
value: String(index),
|
|
803
877
|
disabled: disabled || itemDisabled || readonly
|
|
@@ -815,7 +889,7 @@ function RadioWidget({
|
|
|
815
889
|
var import_FormLabel3 = __toESM(require("@mui/material/FormLabel"), 1);
|
|
816
890
|
var import_Slider = __toESM(require("@mui/material/Slider"), 1);
|
|
817
891
|
var import_utils16 = require("@rjsf/utils");
|
|
818
|
-
var
|
|
892
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
819
893
|
function RangeWidget(props) {
|
|
820
894
|
const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } = props;
|
|
821
895
|
const sliderProps = { value, label, id, name: id, ...(0, import_utils16.rangeSpec)(schema) };
|
|
@@ -824,12 +898,12 @@ function RangeWidget(props) {
|
|
|
824
898
|
};
|
|
825
899
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
826
900
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
827
|
-
return /* @__PURE__ */ (0,
|
|
901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
828
902
|
(0, import_utils16.labelValue)(
|
|
829
|
-
/* @__PURE__ */ (0,
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_FormLabel3.default, { required, htmlFor: id, children: label || void 0 }),
|
|
830
904
|
hideLabel
|
|
831
905
|
),
|
|
832
|
-
/* @__PURE__ */ (0,
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
833
907
|
import_Slider.default,
|
|
834
908
|
{
|
|
835
909
|
disabled: disabled || readonly,
|
|
@@ -848,12 +922,13 @@ function RangeWidget(props) {
|
|
|
848
922
|
var import_MenuItem = __toESM(require("@mui/material/MenuItem"), 1);
|
|
849
923
|
var import_TextField3 = __toESM(require("@mui/material/TextField"), 1);
|
|
850
924
|
var import_utils17 = require("@rjsf/utils");
|
|
851
|
-
var
|
|
925
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
852
926
|
function SelectWidget({
|
|
853
927
|
schema,
|
|
854
928
|
id,
|
|
855
929
|
name,
|
|
856
930
|
// remove this from textFieldProps
|
|
931
|
+
htmlName,
|
|
857
932
|
options,
|
|
858
933
|
label,
|
|
859
934
|
hideLabel,
|
|
@@ -872,7 +947,6 @@ function SelectWidget({
|
|
|
872
947
|
registry,
|
|
873
948
|
uiSchema,
|
|
874
949
|
hideError,
|
|
875
|
-
formContext,
|
|
876
950
|
...textFieldProps
|
|
877
951
|
}) {
|
|
878
952
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
@@ -885,11 +959,11 @@ function SelectWidget({
|
|
|
885
959
|
const selectedIndexes = (0, import_utils17.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
886
960
|
const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
|
|
887
961
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
888
|
-
return /* @__PURE__ */ (0,
|
|
962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
889
963
|
import_TextField3.default,
|
|
890
964
|
{
|
|
891
965
|
id,
|
|
892
|
-
name: id,
|
|
966
|
+
name: htmlName || id,
|
|
893
967
|
label: (0, import_utils17.labelValue)(label || void 0, hideLabel, void 0),
|
|
894
968
|
value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
|
|
895
969
|
required,
|
|
@@ -913,10 +987,10 @@ function SelectWidget({
|
|
|
913
987
|
},
|
|
914
988
|
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id),
|
|
915
989
|
children: [
|
|
916
|
-
showPlaceholderOption && /* @__PURE__ */ (0,
|
|
990
|
+
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_MenuItem.default, { value: "", children: placeholder }),
|
|
917
991
|
Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label: label2 }, i) => {
|
|
918
992
|
const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1;
|
|
919
|
-
return /* @__PURE__ */ (0,
|
|
993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_MenuItem.default, { value: String(i), disabled: disabled2, children: label2 }, i);
|
|
920
994
|
})
|
|
921
995
|
]
|
|
922
996
|
}
|
|
@@ -925,7 +999,7 @@ function SelectWidget({
|
|
|
925
999
|
|
|
926
1000
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
927
1001
|
var import_utils18 = require("@rjsf/utils");
|
|
928
|
-
var
|
|
1002
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
929
1003
|
function TextareaWidget(props) {
|
|
930
1004
|
const { options, registry } = props;
|
|
931
1005
|
const BaseInputTemplate2 = (0, import_utils18.getTemplate)("BaseInputTemplate", registry, options);
|
|
@@ -933,7 +1007,7 @@ function TextareaWidget(props) {
|
|
|
933
1007
|
if (typeof options.rows === "string" || typeof options.rows === "number") {
|
|
934
1008
|
rows = options.rows;
|
|
935
1009
|
}
|
|
936
|
-
return /* @__PURE__ */ (0,
|
|
1010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BaseInputTemplate2, { ...props, multiline: true, rows });
|
|
937
1011
|
}
|
|
938
1012
|
|
|
939
1013
|
// src/Widgets/Widgets.ts
|
|
@@ -966,4 +1040,4 @@ var MuiForm_default = generateForm();
|
|
|
966
1040
|
|
|
967
1041
|
// src/index.ts
|
|
968
1042
|
var index_default = MuiForm_default;
|
|
969
|
-
//# sourceMappingURL=index.
|
|
1043
|
+
//# sourceMappingURL=index.cjs.map
|