@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.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('@mui/icons-material/Add'), require('@mui/material/IconButton'), require('@rjsf/utils'), require('react/jsx-runtime'), require('@mui/material/Box'), require('@mui/material/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', '@mui/icons-material/Add', '@mui/material/IconButton', '@rjsf/utils', 'react/jsx-runtime', '@mui/material/Box', '@mui/material/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/mui"] = {}, global.core, global.AddIcon, global.IconButton, global.utils, global.jsxRuntime, global.Box, global.
|
|
5
|
-
})(this, (function (exports, core, AddIcon, IconButton, utils, jsxRuntime, Box,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('@mui/icons-material/Add'), require('@mui/material/IconButton'), require('@rjsf/utils'), require('react/jsx-runtime'), require('@mui/material/Box'), require('@mui/material/Grid'), require('@mui/material/Paper'), require('@mui/material/TextField'), require('@mui/material/Typography'), require('@mui/icons-material/Error'), require('@mui/material/List'), require('@mui/material/ListItem'), require('@mui/material/ListItemIcon'), require('@mui/material/ListItemText'), require('@mui/icons-material/ArrowDownward'), require('@mui/icons-material/ArrowUpward'), require('@mui/icons-material/ContentCopy'), require('@mui/icons-material/Remove'), require('@mui/material/FormHelperText'), require('@mui/material/FormControl'), require('@mui/material/Button'), require('@mui/material/Divider'), require('@mui/material/Checkbox'), require('@mui/material/FormControlLabel'), require('@mui/material/FormGroup'), require('@mui/material/FormLabel'), require('@mui/material/Radio'), require('@mui/material/RadioGroup'), require('@mui/material/Slider'), require('@mui/material/MenuItem')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', '@mui/icons-material/Add', '@mui/material/IconButton', '@rjsf/utils', 'react/jsx-runtime', '@mui/material/Box', '@mui/material/Grid', '@mui/material/Paper', '@mui/material/TextField', '@mui/material/Typography', '@mui/icons-material/Error', '@mui/material/List', '@mui/material/ListItem', '@mui/material/ListItemIcon', '@mui/material/ListItemText', '@mui/icons-material/ArrowDownward', '@mui/icons-material/ArrowUpward', '@mui/icons-material/ContentCopy', '@mui/icons-material/Remove', '@mui/material/FormHelperText', '@mui/material/FormControl', '@mui/material/Button', '@mui/material/Divider', '@mui/material/Checkbox', '@mui/material/FormControlLabel', '@mui/material/FormGroup', '@mui/material/FormLabel', '@mui/material/Radio', '@mui/material/RadioGroup', '@mui/material/Slider', '@mui/material/MenuItem'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/mui"] = {}, global.core, global.AddIcon, global.IconButton, global.utils, global.jsxRuntime, global.Box, global.Grid4, global.Paper, global.TextField, global.Typography, global.ErrorIcon, global.List, global.ListItem, global.ListItemIcon, global.ListItemText, global.ArrowDownwardIcon, global.ArrowUpwardIcon, global.CopyIcon, global.RemoveIcon, global.FormHelperText, global.FormControl, global.Button, global.Divider, global.Checkbox, global.FormControlLabel, global.FormGroup, global.FormLabel, global.Radio, global.RadioGroup, global.Slider, global.MenuItem));
|
|
5
|
+
})(this, (function (exports, core, AddIcon, IconButton, utils, jsxRuntime, Box, Grid4, Paper, TextField, Typography, ErrorIcon, List, ListItem, ListItemIcon, ListItemText, ArrowDownwardIcon, ArrowUpwardIcon, CopyIcon, RemoveIcon, FormHelperText, FormControl, Button, Divider, Checkbox, FormControlLabel, FormGroup, FormLabel, Radio, RadioGroup, Slider, MenuItem) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// src/MuiForm/MuiForm.tsx
|
|
8
8
|
function AddButton({
|
|
@@ -28,29 +28,38 @@
|
|
|
28
28
|
fontWeight: "bold",
|
|
29
29
|
minWidth: 0
|
|
30
30
|
};
|
|
31
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
32
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
-
hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, alignItems: "center", children: [
|
|
32
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: "auto", style: { overflow: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { p: 2, children }) }) }) }),
|
|
33
|
+
hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(Grid4, { children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) })
|
|
34
34
|
] });
|
|
35
35
|
}
|
|
36
36
|
function ArrayFieldTemplate(props) {
|
|
37
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
canAdd,
|
|
39
|
+
disabled,
|
|
40
|
+
fieldPathId,
|
|
41
|
+
uiSchema,
|
|
42
|
+
items,
|
|
43
|
+
optionalDataControl,
|
|
44
|
+
onAddClick,
|
|
45
|
+
readonly,
|
|
46
|
+
registry,
|
|
47
|
+
required,
|
|
48
|
+
schema,
|
|
49
|
+
title
|
|
50
|
+
} = props;
|
|
38
51
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
39
52
|
const ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
40
53
|
"ArrayFieldDescriptionTemplate",
|
|
41
54
|
registry,
|
|
42
55
|
uiOptions
|
|
43
56
|
);
|
|
44
|
-
const ArrayFieldItemTemplate2 = utils.getTemplate(
|
|
45
|
-
"ArrayFieldItemTemplate",
|
|
46
|
-
registry,
|
|
47
|
-
uiOptions
|
|
48
|
-
);
|
|
49
57
|
const ArrayFieldTitleTemplate = utils.getTemplate(
|
|
50
58
|
"ArrayFieldTitleTemplate",
|
|
51
59
|
registry,
|
|
52
60
|
uiOptions
|
|
53
61
|
);
|
|
62
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
54
63
|
const {
|
|
55
64
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
56
65
|
} = registry.templates;
|
|
@@ -58,29 +67,31 @@
|
|
|
58
67
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
59
68
|
ArrayFieldTitleTemplate,
|
|
60
69
|
{
|
|
61
|
-
|
|
70
|
+
fieldPathId,
|
|
62
71
|
title: uiOptions.title || title,
|
|
63
72
|
schema,
|
|
64
73
|
uiSchema,
|
|
65
74
|
required,
|
|
66
|
-
registry
|
|
75
|
+
registry,
|
|
76
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
67
77
|
}
|
|
68
78
|
),
|
|
69
79
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
70
80
|
ArrayFieldDescriptionTemplate,
|
|
71
81
|
{
|
|
72
|
-
|
|
82
|
+
fieldPathId,
|
|
73
83
|
description: uiOptions.description || schema.description,
|
|
74
84
|
schema,
|
|
75
85
|
uiSchema,
|
|
76
86
|
registry
|
|
77
87
|
}
|
|
78
88
|
),
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
90
|
+
items,
|
|
91
|
+
canAdd && /* @__PURE__ */ jsxRuntime.jsx(Grid4, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(Grid4, { children: /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
81
92
|
AddButton2,
|
|
82
93
|
{
|
|
83
|
-
id: utils.buttonId(
|
|
94
|
+
id: utils.buttonId(fieldPathId, "add"),
|
|
84
95
|
className: "rjsf-array-item-add",
|
|
85
96
|
onClick: onAddClick,
|
|
86
97
|
disabled: disabled || readonly,
|
|
@@ -96,6 +107,7 @@
|
|
|
96
107
|
id,
|
|
97
108
|
name,
|
|
98
109
|
// remove this from textFieldProps
|
|
110
|
+
htmlName,
|
|
99
111
|
placeholder,
|
|
100
112
|
required,
|
|
101
113
|
readonly,
|
|
@@ -115,7 +127,6 @@
|
|
|
115
127
|
uiSchema,
|
|
116
128
|
rawErrors = [],
|
|
117
129
|
errorSchema,
|
|
118
|
-
formContext,
|
|
119
130
|
registry,
|
|
120
131
|
InputLabelProps,
|
|
121
132
|
...textFieldProps
|
|
@@ -135,20 +146,19 @@
|
|
|
135
146
|
TextField,
|
|
136
147
|
{
|
|
137
148
|
id,
|
|
138
|
-
name: id,
|
|
149
|
+
name: htmlName || id,
|
|
139
150
|
placeholder,
|
|
140
151
|
label: utils.labelValue(label || void 0, hideLabel, void 0),
|
|
141
152
|
autoFocus: autofocus,
|
|
142
153
|
required,
|
|
143
154
|
disabled: disabled || readonly,
|
|
144
|
-
|
|
155
|
+
slotProps: { htmlInput: htmlInputProps, inputLabel: DisplayInputLabelProps },
|
|
145
156
|
...rest,
|
|
146
157
|
value: value || value === 0 ? value : "",
|
|
147
158
|
error: rawErrors.length > 0,
|
|
148
159
|
onChange: onChangeOverride || _onChange,
|
|
149
160
|
onBlur: _onBlur,
|
|
150
161
|
onFocus: _onFocus,
|
|
151
|
-
InputLabelProps: DisplayInputLabelProps,
|
|
152
162
|
...textFieldProps,
|
|
153
163
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
154
164
|
}
|
|
@@ -239,21 +249,21 @@
|
|
|
239
249
|
);
|
|
240
250
|
}
|
|
241
251
|
function FieldErrorTemplate(props) {
|
|
242
|
-
const { errors = [],
|
|
252
|
+
const { errors = [], fieldPathId } = props;
|
|
243
253
|
if (errors.length === 0) {
|
|
244
254
|
return null;
|
|
245
255
|
}
|
|
246
|
-
const id = utils.errorId(
|
|
256
|
+
const id = utils.errorId(fieldPathId);
|
|
247
257
|
return /* @__PURE__ */ jsxRuntime.jsx(List, { id, dense: true, disablePadding: true, children: errors.map((error, i) => {
|
|
248
258
|
return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { disableGutters: true, children: /* @__PURE__ */ jsxRuntime.jsx(FormHelperText, { component: "div", id: `${id}-${i}`, children: error }) }, i);
|
|
249
259
|
}) });
|
|
250
260
|
}
|
|
251
261
|
function FieldHelpTemplate(props) {
|
|
252
|
-
const {
|
|
262
|
+
const { fieldPathId, help } = props;
|
|
253
263
|
if (!help) {
|
|
254
264
|
return null;
|
|
255
265
|
}
|
|
256
|
-
const id = utils.helpId(
|
|
266
|
+
const id = utils.helpId(fieldPathId);
|
|
257
267
|
return /* @__PURE__ */ jsxRuntime.jsx(FormHelperText, { component: "div", id, children: help });
|
|
258
268
|
}
|
|
259
269
|
function FieldTemplate(props) {
|
|
@@ -266,8 +276,9 @@
|
|
|
266
276
|
displayLabel,
|
|
267
277
|
hidden,
|
|
268
278
|
label,
|
|
269
|
-
|
|
270
|
-
|
|
279
|
+
onKeyRename,
|
|
280
|
+
onKeyRenameBlur,
|
|
281
|
+
onRemoveProperty,
|
|
271
282
|
readonly,
|
|
272
283
|
required,
|
|
273
284
|
rawErrors = [],
|
|
@@ -296,8 +307,9 @@
|
|
|
296
307
|
disabled,
|
|
297
308
|
id,
|
|
298
309
|
label,
|
|
299
|
-
|
|
300
|
-
|
|
310
|
+
onKeyRename,
|
|
311
|
+
onKeyRenameBlur,
|
|
312
|
+
onRemoveProperty,
|
|
301
313
|
readonly,
|
|
302
314
|
required,
|
|
303
315
|
schema,
|
|
@@ -314,7 +326,14 @@
|
|
|
314
326
|
}
|
|
315
327
|
function GridTemplate(props) {
|
|
316
328
|
const { children, column, ...rest } = props;
|
|
317
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
329
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Grid4, { container: !column, ...rest, children });
|
|
330
|
+
}
|
|
331
|
+
function MultiSchemaFieldTemplate(props) {
|
|
332
|
+
const { optionSchemaField, selector } = props;
|
|
333
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { mb: 2 }, children: [
|
|
334
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { fullWidth: true, sx: { mb: 2 }, children: selector }),
|
|
335
|
+
optionSchemaField
|
|
336
|
+
] });
|
|
318
337
|
}
|
|
319
338
|
function ObjectFieldTemplate(props) {
|
|
320
339
|
const {
|
|
@@ -325,10 +344,11 @@
|
|
|
325
344
|
disabled,
|
|
326
345
|
readonly,
|
|
327
346
|
uiSchema,
|
|
328
|
-
|
|
347
|
+
fieldPathId,
|
|
329
348
|
schema,
|
|
330
349
|
formData,
|
|
331
|
-
|
|
350
|
+
optionalDataControl,
|
|
351
|
+
onAddProperty,
|
|
332
352
|
registry
|
|
333
353
|
} = props;
|
|
334
354
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
@@ -338,6 +358,7 @@
|
|
|
338
358
|
registry,
|
|
339
359
|
uiOptions
|
|
340
360
|
);
|
|
361
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
341
362
|
const {
|
|
342
363
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
343
364
|
} = registry.templates;
|
|
@@ -345,38 +366,40 @@
|
|
|
345
366
|
title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
346
367
|
TitleFieldTemplate,
|
|
347
368
|
{
|
|
348
|
-
id: utils.titleId(
|
|
369
|
+
id: utils.titleId(fieldPathId),
|
|
349
370
|
title,
|
|
350
371
|
required,
|
|
351
372
|
schema,
|
|
352
373
|
uiSchema,
|
|
353
|
-
registry
|
|
374
|
+
registry,
|
|
375
|
+
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
354
376
|
}
|
|
355
377
|
),
|
|
356
378
|
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
357
379
|
DescriptionFieldTemplate,
|
|
358
380
|
{
|
|
359
|
-
id: utils.descriptionId(
|
|
381
|
+
id: utils.descriptionId(fieldPathId),
|
|
360
382
|
description,
|
|
361
383
|
schema,
|
|
362
384
|
uiSchema,
|
|
363
385
|
registry
|
|
364
386
|
}
|
|
365
387
|
),
|
|
366
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
388
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, spacing: 2, style: { marginTop: "10px" }, children: [
|
|
389
|
+
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
367
390
|
properties.map(
|
|
368
391
|
(element, index) => (
|
|
369
|
-
// Remove the <
|
|
392
|
+
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
370
393
|
// itself would otherwise still take up space.
|
|
371
|
-
element.hidden ? element.content : /* @__PURE__ */ jsxRuntime.jsx(
|
|
394
|
+
element.hidden ? element.content : /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: { xs: 12 }, style: { marginBottom: "10px" }, children: element.content }, index)
|
|
372
395
|
)
|
|
373
396
|
),
|
|
374
|
-
utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
397
|
+
utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(Grid4, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(Grid4, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
375
398
|
AddButton2,
|
|
376
399
|
{
|
|
377
|
-
id: utils.buttonId(
|
|
400
|
+
id: utils.buttonId(fieldPathId, "add"),
|
|
378
401
|
className: "rjsf-object-property-expand",
|
|
379
|
-
onClick:
|
|
402
|
+
onClick: onAddProperty,
|
|
380
403
|
disabled: disabled || readonly,
|
|
381
404
|
uiSchema,
|
|
382
405
|
registry
|
|
@@ -385,6 +408,34 @@
|
|
|
385
408
|
] })
|
|
386
409
|
] });
|
|
387
410
|
}
|
|
411
|
+
function OptionalDataControlsTemplate(props) {
|
|
412
|
+
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
413
|
+
if (onAddClick) {
|
|
414
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
415
|
+
MuiIconButton,
|
|
416
|
+
{
|
|
417
|
+
id,
|
|
418
|
+
registry,
|
|
419
|
+
className: "rjsf-add-optional-data",
|
|
420
|
+
onClick: onAddClick,
|
|
421
|
+
title: label,
|
|
422
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(AddIcon, { fontSize: "small" })
|
|
423
|
+
}
|
|
424
|
+
);
|
|
425
|
+
} else if (onRemoveClick) {
|
|
426
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
427
|
+
RemoveButton,
|
|
428
|
+
{
|
|
429
|
+
id,
|
|
430
|
+
registry,
|
|
431
|
+
className: "rjsf-remove-optional-data",
|
|
432
|
+
onClick: onRemoveClick,
|
|
433
|
+
title: label
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
return /* @__PURE__ */ jsxRuntime.jsx("em", { id, children: label });
|
|
438
|
+
}
|
|
388
439
|
function SubmitButton({ uiSchema }) {
|
|
389
440
|
const { submitText, norender, props: submitButtonProps = {} } = utils.getSubmitButtonOptions(uiSchema);
|
|
390
441
|
if (norender) {
|
|
@@ -394,10 +445,18 @@
|
|
|
394
445
|
}
|
|
395
446
|
function TitleField({
|
|
396
447
|
id,
|
|
397
|
-
title
|
|
448
|
+
title,
|
|
449
|
+
optionalDataControl
|
|
398
450
|
}) {
|
|
451
|
+
let heading = /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h5", children: title });
|
|
452
|
+
if (optionalDataControl) {
|
|
453
|
+
heading = /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, spacing: 0, children: [
|
|
454
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: "grow", children: heading }),
|
|
455
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid4, { justifyContent: "flex-end", children: optionalDataControl })
|
|
456
|
+
] });
|
|
457
|
+
}
|
|
399
458
|
return /* @__PURE__ */ jsxRuntime.jsxs(Box, { id, mb: 1, mt: 1, children: [
|
|
400
|
-
|
|
459
|
+
heading,
|
|
401
460
|
/* @__PURE__ */ jsxRuntime.jsx(Divider, {})
|
|
402
461
|
] });
|
|
403
462
|
}
|
|
@@ -409,8 +468,8 @@
|
|
|
409
468
|
disabled,
|
|
410
469
|
id,
|
|
411
470
|
label,
|
|
412
|
-
|
|
413
|
-
|
|
471
|
+
onKeyRenameBlur,
|
|
472
|
+
onRemoveProperty,
|
|
414
473
|
readonly,
|
|
415
474
|
required,
|
|
416
475
|
schema,
|
|
@@ -430,9 +489,8 @@
|
|
|
430
489
|
if (!additional) {
|
|
431
490
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children });
|
|
432
491
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
/* @__PURE__ */ jsxRuntime.jsx(Grid24, { size: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, alignItems: "center", spacing: 2, className: classNames, style, children: [
|
|
493
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
436
494
|
TextField,
|
|
437
495
|
{
|
|
438
496
|
fullWidth: true,
|
|
@@ -442,12 +500,12 @@
|
|
|
442
500
|
disabled: disabled || readonly,
|
|
443
501
|
id: `${id}-key`,
|
|
444
502
|
name: `${id}-key`,
|
|
445
|
-
onBlur: !readonly ?
|
|
503
|
+
onBlur: !readonly ? onKeyRenameBlur : void 0,
|
|
446
504
|
type: "text"
|
|
447
505
|
}
|
|
448
506
|
) }),
|
|
449
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
450
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
507
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: "auto", children }),
|
|
508
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid4, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
451
509
|
RemoveButton2,
|
|
452
510
|
{
|
|
453
511
|
id: utils.buttonId(id, "remove"),
|
|
@@ -455,7 +513,7 @@
|
|
|
455
513
|
iconType: "default",
|
|
456
514
|
style: btnStyle,
|
|
457
515
|
disabled: disabled || readonly,
|
|
458
|
-
onClick:
|
|
516
|
+
onClick: onRemoveProperty,
|
|
459
517
|
uiSchema,
|
|
460
518
|
registry
|
|
461
519
|
}
|
|
@@ -483,7 +541,9 @@
|
|
|
483
541
|
FieldHelpTemplate,
|
|
484
542
|
FieldTemplate,
|
|
485
543
|
GridTemplate,
|
|
544
|
+
MultiSchemaFieldTemplate,
|
|
486
545
|
ObjectFieldTemplate,
|
|
546
|
+
OptionalDataControlsTemplate,
|
|
487
547
|
TitleFieldTemplate: TitleField,
|
|
488
548
|
WrapIfAdditionalTemplate
|
|
489
549
|
};
|
|
@@ -493,6 +553,7 @@
|
|
|
493
553
|
const {
|
|
494
554
|
schema,
|
|
495
555
|
id,
|
|
556
|
+
htmlName,
|
|
496
557
|
value,
|
|
497
558
|
disabled,
|
|
498
559
|
readonly,
|
|
@@ -513,8 +574,8 @@
|
|
|
513
574
|
);
|
|
514
575
|
const required = utils.schemaRequiresTrueValue(schema);
|
|
515
576
|
const _onChange = (_, checked) => onChange(checked);
|
|
516
|
-
const _onBlur = (
|
|
517
|
-
const _onFocus = (
|
|
577
|
+
const _onBlur = () => onBlur(id, value);
|
|
578
|
+
const _onFocus = () => onFocus(id, value);
|
|
518
579
|
const description = options.description ?? schema.description;
|
|
519
580
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
520
581
|
!hideLabel && description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -534,7 +595,7 @@
|
|
|
534
595
|
Checkbox,
|
|
535
596
|
{
|
|
536
597
|
id,
|
|
537
|
-
name: id,
|
|
598
|
+
name: htmlName || id,
|
|
538
599
|
checked: typeof value === "undefined" ? false : Boolean(value),
|
|
539
600
|
required,
|
|
540
601
|
disabled: disabled || readonly,
|
|
@@ -554,6 +615,7 @@
|
|
|
554
615
|
label,
|
|
555
616
|
hideLabel,
|
|
556
617
|
id,
|
|
618
|
+
htmlName,
|
|
557
619
|
disabled,
|
|
558
620
|
options,
|
|
559
621
|
value,
|
|
@@ -587,7 +649,7 @@
|
|
|
587
649
|
Checkbox,
|
|
588
650
|
{
|
|
589
651
|
id: utils.optionId(id, index),
|
|
590
|
-
name: id,
|
|
652
|
+
name: htmlName || id,
|
|
591
653
|
checked,
|
|
592
654
|
disabled: disabled || itemDisabled || readonly,
|
|
593
655
|
autoFocus: autofocus && index === 0,
|
|
@@ -603,6 +665,7 @@
|
|
|
603
665
|
}
|
|
604
666
|
function RadioWidget({
|
|
605
667
|
id,
|
|
668
|
+
htmlName,
|
|
606
669
|
options,
|
|
607
670
|
value,
|
|
608
671
|
required,
|
|
@@ -629,7 +692,7 @@
|
|
|
629
692
|
RadioGroup,
|
|
630
693
|
{
|
|
631
694
|
id,
|
|
632
|
-
name: id,
|
|
695
|
+
name: htmlName || id,
|
|
633
696
|
value: selectedIndex,
|
|
634
697
|
row,
|
|
635
698
|
onChange: _onChange,
|
|
@@ -641,7 +704,7 @@
|
|
|
641
704
|
const radio = /* @__PURE__ */ jsxRuntime.jsx(
|
|
642
705
|
FormControlLabel,
|
|
643
706
|
{
|
|
644
|
-
control: /* @__PURE__ */ jsxRuntime.jsx(Radio, { name: id, id: utils.optionId(id, index), color: "primary" }),
|
|
707
|
+
control: /* @__PURE__ */ jsxRuntime.jsx(Radio, { name: htmlName || id, id: utils.optionId(id, index), color: "primary" }),
|
|
645
708
|
label: option.label,
|
|
646
709
|
value: String(index),
|
|
647
710
|
disabled: disabled || itemDisabled || readonly
|
|
@@ -686,6 +749,7 @@
|
|
|
686
749
|
id,
|
|
687
750
|
name,
|
|
688
751
|
// remove this from textFieldProps
|
|
752
|
+
htmlName,
|
|
689
753
|
options,
|
|
690
754
|
label,
|
|
691
755
|
hideLabel,
|
|
@@ -704,7 +768,6 @@
|
|
|
704
768
|
registry,
|
|
705
769
|
uiSchema,
|
|
706
770
|
hideError,
|
|
707
|
-
formContext,
|
|
708
771
|
...textFieldProps
|
|
709
772
|
}) {
|
|
710
773
|
const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
|
|
@@ -721,7 +784,7 @@
|
|
|
721
784
|
TextField,
|
|
722
785
|
{
|
|
723
786
|
id,
|
|
724
|
-
name: id,
|
|
787
|
+
name: htmlName || id,
|
|
725
788
|
label: utils.labelValue(label || void 0, hideLabel, void 0),
|
|
726
789
|
value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
|
|
727
790
|
required,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import AddIcon from '@mui/icons-material/Add';
|
|
3
|
-
import IconButton from '@mui/material/IconButton
|
|
3
|
+
import IconButton from '@mui/material/IconButton';
|
|
4
4
|
import { TranslatableString } from '@rjsf/utils';
|
|
5
5
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
3
3
|
*
|
|
4
|
-
* @param props - The `
|
|
4
|
+
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
5
5
|
*/
|
|
6
|
-
export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props:
|
|
6
|
+
export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Box from '@mui/material/Box
|
|
3
|
-
import
|
|
4
|
-
import Paper from '@mui/material/Paper
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
4
|
+
import Paper from '@mui/material/Paper';
|
|
5
5
|
import { getUiOptions, getTemplate, } from '@rjsf/utils';
|
|
6
6
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
7
7
|
*
|
|
8
|
-
* @param props - The `
|
|
8
|
+
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
9
9
|
*/
|
|
10
10
|
export default function ArrayFieldItemTemplate(props) {
|
|
11
11
|
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
@@ -18,6 +18,6 @@ export default function ArrayFieldItemTemplate(props) {
|
|
|
18
18
|
fontWeight: 'bold',
|
|
19
19
|
minWidth: 0,
|
|
20
20
|
};
|
|
21
|
-
return (_jsxs(
|
|
21
|
+
return (_jsxs(Grid, { container: true, alignItems: 'center', children: [_jsx(Grid, { size: 'auto', style: { overflow: 'auto' }, children: _jsx(Box, { mb: 2, children: _jsx(Paper, { elevation: 2, children: _jsx(Box, { p: 2, children: children }) }) }) }), hasToolbar && (_jsx(Grid, { children: _jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) }))] }));
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=ArrayFieldItemTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAGL,YAAY,EACZ,WAAW,GAGZ,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAI5C,KAA2C;IAC3C,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACzE,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,QAAQ,GAAkB;QAC9B,IAAI,EAAE,CAAC;QACP,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE,CAAC;KACZ,CAAC;IACF,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAC,QAAQ,aACxC,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,YAC3C,KAAC,GAAG,IAAC,EAAE,EAAE,CAAC,YACR,KAAC,KAAK,IAAC,SAAS,EAAE,CAAC,YACjB,KAAC,GAAG,IAAC,CAAC,EAAE,CAAC,YAAG,QAAQ,GAAO,GACrB,GACJ,GACD,EACN,UAAU,IAAI,CACb,KAAC,IAAI,cACH,KAAC,6BAA6B,OAAK,YAAY,EAAE,KAAK,EAAE,QAAQ,GAAI,GAC/D,CACR,IACI,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
3
3
|
*
|
|
4
|
-
* @param props - The `
|
|
4
|
+
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
5
5
|
*/
|
|
6
6
|
export default function ArrayFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Box from '@mui/material/Box
|
|
3
|
-
import
|
|
4
|
-
import Paper from '@mui/material/Paper
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
4
|
+
import Paper from '@mui/material/Paper';
|
|
5
5
|
import { getTemplate, getUiOptions, buttonId, } from '@rjsf/utils';
|
|
6
6
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
7
7
|
*
|
|
8
|
-
* @param props - The `
|
|
8
|
+
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
9
9
|
*/
|
|
10
10
|
export default function ArrayFieldTemplate(props) {
|
|
11
|
-
const { canAdd, disabled,
|
|
11
|
+
const { canAdd, disabled, fieldPathId, uiSchema, items, optionalDataControl, onAddClick, readonly, registry, required, schema, title, } = props;
|
|
12
12
|
const uiOptions = getUiOptions(uiSchema);
|
|
13
13
|
const ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
14
|
-
const ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
15
14
|
const ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
15
|
+
const showOptionalDataControlInTitle = !readonly && !disabled;
|
|
16
16
|
// Button templates are not overridden in the uiSchema
|
|
17
17
|
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
18
|
-
return (_jsx(Paper, { elevation: 2, children: _jsxs(Box, { p: 2, children: [_jsx(ArrayFieldTitleTemplate, {
|
|
19
|
-
items.map(({ key, ...itemProps }) => (_jsx(ArrayFieldItemTemplate, { ...itemProps }, key))), canAdd && (_jsx(Grid2, { container: true, justifyContent: 'flex-end', children: _jsx(Grid2, { children: _jsx(Box, { mt: 2, children: _jsx(AddButton, { id: buttonId(idSchema, 'add'), className: 'rjsf-array-item-add', onClick: onAddClick, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }) }))] }) }));
|
|
18
|
+
return (_jsx(Paper, { elevation: 2, children: _jsxs(Box, { p: 2, children: [_jsx(ArrayFieldTitleTemplate, { fieldPathId: fieldPathId, title: uiOptions.title || title, schema: schema, uiSchema: uiSchema, required: required, registry: registry, optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : undefined }), _jsx(ArrayFieldDescriptionTemplate, { fieldPathId: fieldPathId, description: uiOptions.description || schema.description, schema: schema, uiSchema: uiSchema, registry: registry }), !showOptionalDataControlInTitle ? optionalDataControl : undefined, items, canAdd && (_jsx(Grid, { container: true, justifyContent: 'flex-end', children: _jsx(Grid, { children: _jsx(Box, { mt: 2, children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-array-item-add', onClick: onAddClick, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }) }))] }) }));
|
|
20
19
|
}
|
|
21
20
|
//# sourceMappingURL=ArrayFieldTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EACL,WAAW,EACX,YAAY,EAKZ,QAAQ,GACT,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAIxC,KAAuC;IACvC,MAAM,EACJ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,KAAK,GACN,GAAG,KAAK,CAAC;IACV,MAAM,SAAS,GAAG,Y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AC/B,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,GACE,GACD,GACF,CACR,IACG,GACA,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import TextField from '@mui/material/TextField
|
|
2
|
+
import TextField from '@mui/material/TextField';
|
|
3
3
|
import { ariaDescribedByIds, examplesId, getInputProps, labelValue, } from '@rjsf/utils';
|
|
4
4
|
const TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];
|
|
5
5
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
@@ -10,7 +10,7 @@ const TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];
|
|
|
10
10
|
*/
|
|
11
11
|
export default function BaseInputTemplate(props) {
|
|
12
12
|
const { id, name, // remove this from textFieldProps
|
|
13
|
-
placeholder, required, readonly, disabled, type, label, hideLabel, hideError, value, onChange, onChangeOverride, onBlur, onFocus, autofocus, options, schema, uiSchema, rawErrors = [], errorSchema,
|
|
13
|
+
htmlName, placeholder, required, readonly, disabled, type, label, hideLabel, hideError, value, onChange, onChangeOverride, onBlur, onFocus, autofocus, options, schema, uiSchema, rawErrors = [], errorSchema, registry, InputLabelProps, ...textFieldProps } = props;
|
|
14
14
|
const inputProps = getInputProps(schema, type, options);
|
|
15
15
|
// Now we need to pull out the step, min, max into an inner `inputProps` for material-ui
|
|
16
16
|
const { step, min, max, accept, ...rest } = inputProps;
|
|
@@ -24,7 +24,7 @@ export default function BaseInputTemplate(props) {
|
|
|
24
24
|
shrink: true,
|
|
25
25
|
}
|
|
26
26
|
: InputLabelProps;
|
|
27
|
-
return (_jsxs(_Fragment, { children: [_jsx(TextField, { id: id, name: id, placeholder: placeholder, label: labelValue(label || undefined, hideLabel, undefined), autoFocus: autofocus, required: required, disabled: disabled || readonly,
|
|
27
|
+
return (_jsxs(_Fragment, { children: [_jsx(TextField, { id: id, name: htmlName || id, placeholder: placeholder, label: labelValue(label || undefined, hideLabel, undefined), autoFocus: autofocus, required: required, disabled: disabled || readonly, slotProps: { htmlInput: htmlInputProps, inputLabel: DisplayInputLabelProps }, ...rest, value: value || value === 0 ? value : '', error: rawErrors.length > 0, onChange: onChangeOverride || _onChange, onBlur: _onBlur, onFocus: _onFocus, ...textFieldProps, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }), Array.isArray(schema.examples) && (_jsx("datalist", { id: examplesId(id), children: schema.examples
|
|
28
28
|
.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : [])
|
|
29
29
|
.map((example) => {
|
|
30
30
|
return _jsx("option", { value: example }, example);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputTemplate.js","sourceRoot":"","sources":["../../src/BaseInputTemplate/BaseInputTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,SAA6B,MAAM,yBAAyB,CAAC;AACpE,OAAO,EACL,kBAAkB,EAElB,UAAU,EACV,aAAa,EACb,UAAU,GAIX,MAAM,aAAa,CAAC;AAErB,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAIvC,KAAsC;IACtC,MAAM,EACJ,EAAE,EACF,IAAI,EAAE,kCAAkC;IACxC,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,SAAS,EACT,SAAS,EACT,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,WAAW,EACX,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