@rjsf/mui 5.24.10 → 6.0.0-beta.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 +4 -4
- package/dist/index.js +201 -238
- package/dist/index.js.map +4 -4
- package/dist/mui.esm.js +99 -130
- package/dist/mui.esm.js.map +4 -4
- package/dist/mui.umd.js +36 -78
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -3
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +7 -5
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +4 -4
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +7 -0
- package/lib/GridTemplate/GridTemplate.js +12 -0
- package/lib/GridTemplate/GridTemplate.js.map +1 -0
- package/lib/GridTemplate/index.d.ts +2 -0
- package/lib/GridTemplate/index.js +3 -0
- package/lib/GridTemplate/index.js.map +1 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +5 -5
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.js +2 -0
- package/lib/Templates/Templates.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +3 -3
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -38
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +25 -63
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +15 -13
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +1 -1
- package/src/CheckboxWidget/CheckboxWidget.tsx +2 -2
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +2 -2
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +1 -1
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +1 -1
- package/src/FieldTemplate/FieldTemplate.tsx +2 -2
- package/src/GridTemplate/GridTemplate.tsx +16 -0
- package/src/GridTemplate/index.ts +2 -0
- package/src/IconButton/IconButton.tsx +5 -5
- package/src/MuiForm/MuiForm.tsx +1 -1
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +16 -14
- package/src/RadioWidget/RadioWidget.tsx +1 -1
- package/src/RangeWidget/RangeWidget.tsx +2 -2
- package/src/SelectWidget/SelectWidget.tsx +1 -1
- package/src/SubmitButton/SubmitButton.tsx +1 -1
- package/src/Templates/Templates.ts +3 -1
- package/src/TextareaWidget/TextareaWidget.tsx +1 -1
- package/src/Theme/Theme.tsx +1 -1
- package/src/Widgets/Widgets.ts +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +12 -11
- package/LICENSE.md +0 -201
package/dist/index.js
CHANGED
|
@@ -28,26 +28,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
Form: () => MuiForm_default,
|
|
34
34
|
Templates: () => Templates_default,
|
|
35
35
|
Theme: () => Theme_default,
|
|
36
36
|
Widgets: () => Widgets_default,
|
|
37
|
-
default: () =>
|
|
37
|
+
default: () => index_default,
|
|
38
38
|
generateForm: () => generateForm,
|
|
39
39
|
generateTemplates: () => generateTemplates,
|
|
40
40
|
generateTheme: () => generateTheme,
|
|
41
41
|
generateWidgets: () => generateWidgets
|
|
42
42
|
});
|
|
43
|
-
module.exports = __toCommonJS(
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
44
|
|
|
45
45
|
// src/MuiForm/MuiForm.tsx
|
|
46
46
|
var import_core = require("@rjsf/core");
|
|
47
47
|
|
|
48
48
|
// src/AddButton/AddButton.tsx
|
|
49
|
-
var import_Add = __toESM(require("@mui/icons-material/Add"));
|
|
50
|
-
var import_IconButton = __toESM(require("@mui/material/IconButton"));
|
|
49
|
+
var import_Add = __toESM(require("@mui/icons-material/Add"), 1);
|
|
50
|
+
var import_IconButton = __toESM(require("@mui/material/IconButton"), 1);
|
|
51
51
|
var import_utils = require("@rjsf/utils");
|
|
52
52
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
53
53
|
function AddButton({
|
|
@@ -60,28 +60,19 @@ function AddButton({
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
63
|
-
var import_Box = __toESM(require("@mui/material/Box"));
|
|
64
|
-
var
|
|
65
|
-
var import_Paper = __toESM(require("@mui/material/Paper"));
|
|
63
|
+
var import_Box = __toESM(require("@mui/material/Box"), 1);
|
|
64
|
+
var import_Grid2 = __toESM(require("@mui/material/Grid2"), 1);
|
|
65
|
+
var import_Paper = __toESM(require("@mui/material/Paper"), 1);
|
|
66
|
+
var import_utils2 = require("@rjsf/utils");
|
|
66
67
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
67
68
|
function ArrayFieldItemTemplate(props) {
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
hasRemove,
|
|
76
|
-
index,
|
|
77
|
-
onCopyIndexClick,
|
|
78
|
-
onDropIndexClick,
|
|
79
|
-
onReorderClick,
|
|
80
|
-
readonly,
|
|
81
|
-
uiSchema,
|
|
82
|
-
registry
|
|
83
|
-
} = props;
|
|
84
|
-
const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
|
|
69
|
+
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
70
|
+
const uiOptions = (0, import_utils2.getUiOptions)(uiSchema);
|
|
71
|
+
const ArrayFieldItemButtonsTemplate = (0, import_utils2.getTemplate)(
|
|
72
|
+
"ArrayFieldItemButtonsTemplate",
|
|
73
|
+
registry,
|
|
74
|
+
uiOptions
|
|
75
|
+
);
|
|
85
76
|
const btnStyle = {
|
|
86
77
|
flex: 1,
|
|
87
78
|
paddingLeft: 6,
|
|
@@ -89,73 +80,32 @@ function ArrayFieldItemTemplate(props) {
|
|
|
89
80
|
fontWeight: "bold",
|
|
90
81
|
minWidth: 0
|
|
91
82
|
};
|
|
92
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
93
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
94
|
-
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime2.
|
|
95
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
96
|
-
MoveUpButton2,
|
|
97
|
-
{
|
|
98
|
-
style: btnStyle,
|
|
99
|
-
disabled: disabled || readonly || !hasMoveUp,
|
|
100
|
-
onClick: onReorderClick(index, index - 1),
|
|
101
|
-
uiSchema,
|
|
102
|
-
registry
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
106
|
-
MoveDownButton2,
|
|
107
|
-
{
|
|
108
|
-
style: btnStyle,
|
|
109
|
-
disabled: disabled || readonly || !hasMoveDown,
|
|
110
|
-
onClick: onReorderClick(index, index + 1),
|
|
111
|
-
uiSchema,
|
|
112
|
-
registry
|
|
113
|
-
}
|
|
114
|
-
),
|
|
115
|
-
hasCopy && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
116
|
-
CopyButton2,
|
|
117
|
-
{
|
|
118
|
-
style: btnStyle,
|
|
119
|
-
disabled: disabled || readonly,
|
|
120
|
-
onClick: onCopyIndexClick(index),
|
|
121
|
-
uiSchema,
|
|
122
|
-
registry
|
|
123
|
-
}
|
|
124
|
-
),
|
|
125
|
-
hasRemove && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
126
|
-
RemoveButton2,
|
|
127
|
-
{
|
|
128
|
-
style: btnStyle,
|
|
129
|
-
disabled: disabled || readonly,
|
|
130
|
-
onClick: onDropIndexClick(index),
|
|
131
|
-
uiSchema,
|
|
132
|
-
registry
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
] })
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_Grid2.default, { container: true, alignItems: "center", children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Grid2.default, { size: "auto", style: { overflow: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Box.default, { mb: 2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Paper.default, { elevation: 2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Box.default, { p: 2, children }) }) }) }),
|
|
85
|
+
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Grid2.default, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) })
|
|
136
86
|
] });
|
|
137
87
|
}
|
|
138
88
|
|
|
139
89
|
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
140
|
-
var import_Box2 = __toESM(require("@mui/material/Box"));
|
|
141
|
-
var
|
|
142
|
-
var import_Paper2 = __toESM(require("@mui/material/Paper"));
|
|
143
|
-
var
|
|
90
|
+
var import_Box2 = __toESM(require("@mui/material/Box"), 1);
|
|
91
|
+
var import_Grid22 = __toESM(require("@mui/material/Grid2"), 1);
|
|
92
|
+
var import_Paper2 = __toESM(require("@mui/material/Paper"), 1);
|
|
93
|
+
var import_utils3 = require("@rjsf/utils");
|
|
144
94
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
145
95
|
function ArrayFieldTemplate(props) {
|
|
146
96
|
const { canAdd, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, schema, title } = props;
|
|
147
|
-
const uiOptions = (0,
|
|
148
|
-
const ArrayFieldDescriptionTemplate = (0,
|
|
97
|
+
const uiOptions = (0, import_utils3.getUiOptions)(uiSchema);
|
|
98
|
+
const ArrayFieldDescriptionTemplate = (0, import_utils3.getTemplate)(
|
|
149
99
|
"ArrayFieldDescriptionTemplate",
|
|
150
100
|
registry,
|
|
151
101
|
uiOptions
|
|
152
102
|
);
|
|
153
|
-
const ArrayFieldItemTemplate2 = (0,
|
|
103
|
+
const ArrayFieldItemTemplate2 = (0, import_utils3.getTemplate)(
|
|
154
104
|
"ArrayFieldItemTemplate",
|
|
155
105
|
registry,
|
|
156
106
|
uiOptions
|
|
157
107
|
);
|
|
158
|
-
const ArrayFieldTitleTemplate = (0,
|
|
108
|
+
const ArrayFieldTitleTemplate = (0, import_utils3.getTemplate)(
|
|
159
109
|
"ArrayFieldTitleTemplate",
|
|
160
110
|
registry,
|
|
161
111
|
uiOptions
|
|
@@ -186,10 +136,11 @@ function ArrayFieldTemplate(props) {
|
|
|
186
136
|
}
|
|
187
137
|
),
|
|
188
138
|
items && items.map(({ key, ...itemProps }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrayFieldItemTemplate2, { ...itemProps }, key)),
|
|
189
|
-
canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
139
|
+
canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Grid22.default, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Grid22.default, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_Box2.default, { mt: 2, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
190
140
|
AddButton2,
|
|
191
141
|
{
|
|
192
|
-
|
|
142
|
+
id: (0, import_utils3.buttonId)(idSchema, "add"),
|
|
143
|
+
className: "rjsf-array-item-add",
|
|
193
144
|
onClick: onAddClick,
|
|
194
145
|
disabled: disabled || readonly,
|
|
195
146
|
uiSchema,
|
|
@@ -200,8 +151,8 @@ function ArrayFieldTemplate(props) {
|
|
|
200
151
|
}
|
|
201
152
|
|
|
202
153
|
// src/BaseInputTemplate/BaseInputTemplate.tsx
|
|
203
|
-
var import_TextField = __toESM(require("@mui/material/TextField"));
|
|
204
|
-
var
|
|
154
|
+
var import_TextField = __toESM(require("@mui/material/TextField"), 1);
|
|
155
|
+
var import_utils4 = require("@rjsf/utils");
|
|
205
156
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
206
157
|
var TYPES_THAT_SHRINK_LABEL = ["date", "datetime-local", "file", "time"];
|
|
207
158
|
function BaseInputTemplate(props) {
|
|
@@ -233,9 +184,9 @@ function BaseInputTemplate(props) {
|
|
|
233
184
|
InputLabelProps,
|
|
234
185
|
...textFieldProps
|
|
235
186
|
} = props;
|
|
236
|
-
const inputProps = (0,
|
|
187
|
+
const inputProps = (0, import_utils4.getInputProps)(schema, type, options);
|
|
237
188
|
const { step, min, max, accept, ...rest } = inputProps;
|
|
238
|
-
const htmlInputProps = { step, min, max, accept, ...schema.examples ? { list: (0,
|
|
189
|
+
const htmlInputProps = { step, min, max, accept, ...schema.examples ? { list: (0, import_utils4.examplesId)(id) } : void 0 };
|
|
239
190
|
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
240
191
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
241
192
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
@@ -250,7 +201,7 @@ function BaseInputTemplate(props) {
|
|
|
250
201
|
id,
|
|
251
202
|
name: id,
|
|
252
203
|
placeholder,
|
|
253
|
-
label: (0,
|
|
204
|
+
label: (0, import_utils4.labelValue)(label || void 0, hideLabel, void 0),
|
|
254
205
|
autoFocus: autofocus,
|
|
255
206
|
required,
|
|
256
207
|
disabled: disabled || readonly,
|
|
@@ -263,17 +214,17 @@ function BaseInputTemplate(props) {
|
|
|
263
214
|
onFocus: _onFocus,
|
|
264
215
|
InputLabelProps: DisplayInputLabelProps,
|
|
265
216
|
...textFieldProps,
|
|
266
|
-
"aria-describedby": (0,
|
|
217
|
+
"aria-describedby": (0, import_utils4.ariaDescribedByIds)(id, !!schema.examples)
|
|
267
218
|
}
|
|
268
219
|
),
|
|
269
|
-
Array.isArray(schema.examples) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("datalist", { id: (0,
|
|
220
|
+
Array.isArray(schema.examples) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("datalist", { id: (0, import_utils4.examplesId)(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
|
|
270
221
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: example }, example);
|
|
271
222
|
}) })
|
|
272
223
|
] });
|
|
273
224
|
}
|
|
274
225
|
|
|
275
226
|
// src/DescriptionField/DescriptionField.tsx
|
|
276
|
-
var import_Typography = __toESM(require("@mui/material/Typography"));
|
|
227
|
+
var import_Typography = __toESM(require("@mui/material/Typography"), 1);
|
|
277
228
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
278
229
|
function DescriptionField(props) {
|
|
279
230
|
const { id, description } = props;
|
|
@@ -284,15 +235,15 @@ function DescriptionField(props) {
|
|
|
284
235
|
}
|
|
285
236
|
|
|
286
237
|
// src/ErrorList/ErrorList.tsx
|
|
287
|
-
var import_Error = __toESM(require("@mui/icons-material/Error"));
|
|
288
|
-
var import_Box3 = __toESM(require("@mui/material/Box"));
|
|
289
|
-
var import_List = __toESM(require("@mui/material/List"));
|
|
290
|
-
var import_ListItem = __toESM(require("@mui/material/ListItem"));
|
|
291
|
-
var import_ListItemIcon = __toESM(require("@mui/material/ListItemIcon"));
|
|
292
|
-
var import_ListItemText = __toESM(require("@mui/material/ListItemText"));
|
|
293
|
-
var import_Paper3 = __toESM(require("@mui/material/Paper"));
|
|
294
|
-
var import_Typography2 = __toESM(require("@mui/material/Typography"));
|
|
295
|
-
var
|
|
238
|
+
var import_Error = __toESM(require("@mui/icons-material/Error"), 1);
|
|
239
|
+
var import_Box3 = __toESM(require("@mui/material/Box"), 1);
|
|
240
|
+
var import_List = __toESM(require("@mui/material/List"), 1);
|
|
241
|
+
var import_ListItem = __toESM(require("@mui/material/ListItem"), 1);
|
|
242
|
+
var import_ListItemIcon = __toESM(require("@mui/material/ListItemIcon"), 1);
|
|
243
|
+
var import_ListItemText = __toESM(require("@mui/material/ListItemText"), 1);
|
|
244
|
+
var import_Paper3 = __toESM(require("@mui/material/Paper"), 1);
|
|
245
|
+
var import_Typography2 = __toESM(require("@mui/material/Typography"), 1);
|
|
246
|
+
var import_utils5 = require("@rjsf/utils");
|
|
296
247
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
297
248
|
function ErrorList({
|
|
298
249
|
errors,
|
|
@@ -300,7 +251,7 @@ function ErrorList({
|
|
|
300
251
|
}) {
|
|
301
252
|
const { translateString } = registry;
|
|
302
253
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Paper3.default, { elevation: 2, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_Box3.default, { mb: 2, p: 2, children: [
|
|
303
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Typography2.default, { variant: "h6", children: translateString(
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Typography2.default, { variant: "h6", children: translateString(import_utils5.TranslatableString.ErrorsLabel) }),
|
|
304
255
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_List.default, { dense: true, children: errors.map((error, i) => {
|
|
305
256
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_ListItem.default, { children: [
|
|
306
257
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ListItemIcon.default, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Error.default, { color: "error" }) }),
|
|
@@ -311,12 +262,12 @@ function ErrorList({
|
|
|
311
262
|
}
|
|
312
263
|
|
|
313
264
|
// src/IconButton/IconButton.tsx
|
|
314
|
-
var import_IconButton2 = __toESM(require("@mui/material/IconButton"));
|
|
315
|
-
var import_ArrowDownward = __toESM(require("@mui/icons-material/ArrowDownward"));
|
|
316
|
-
var import_ArrowUpward = __toESM(require("@mui/icons-material/ArrowUpward"));
|
|
317
|
-
var import_ContentCopy = __toESM(require("@mui/icons-material/ContentCopy"));
|
|
318
|
-
var import_Remove = __toESM(require("@mui/icons-material/Remove"));
|
|
319
|
-
var
|
|
265
|
+
var import_IconButton2 = __toESM(require("@mui/material/IconButton"), 1);
|
|
266
|
+
var import_ArrowDownward = __toESM(require("@mui/icons-material/ArrowDownward"), 1);
|
|
267
|
+
var import_ArrowUpward = __toESM(require("@mui/icons-material/ArrowUpward"), 1);
|
|
268
|
+
var import_ContentCopy = __toESM(require("@mui/icons-material/ContentCopy"), 1);
|
|
269
|
+
var import_Remove = __toESM(require("@mui/icons-material/Remove"), 1);
|
|
270
|
+
var import_utils6 = require("@rjsf/utils");
|
|
320
271
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
321
272
|
function MuiIconButton(props) {
|
|
322
273
|
const { icon, color, uiSchema, registry, ...otherProps } = props;
|
|
@@ -329,7 +280,7 @@ function CopyButton(props) {
|
|
|
329
280
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
330
281
|
MuiIconButton,
|
|
331
282
|
{
|
|
332
|
-
title: translateString(
|
|
283
|
+
title: translateString(import_utils6.TranslatableString.CopyButton),
|
|
333
284
|
...props,
|
|
334
285
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ContentCopy.default, { fontSize: "small" })
|
|
335
286
|
}
|
|
@@ -342,7 +293,7 @@ function MoveDownButton(props) {
|
|
|
342
293
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
343
294
|
MuiIconButton,
|
|
344
295
|
{
|
|
345
|
-
title: translateString(
|
|
296
|
+
title: translateString(import_utils6.TranslatableString.MoveDownButton),
|
|
346
297
|
...props,
|
|
347
298
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ArrowDownward.default, { fontSize: "small" })
|
|
348
299
|
}
|
|
@@ -355,7 +306,7 @@ function MoveUpButton(props) {
|
|
|
355
306
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
356
307
|
MuiIconButton,
|
|
357
308
|
{
|
|
358
|
-
title: translateString(
|
|
309
|
+
title: translateString(import_utils6.TranslatableString.MoveUpButton),
|
|
359
310
|
...props,
|
|
360
311
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ArrowUpward.default, { fontSize: "small" })
|
|
361
312
|
}
|
|
@@ -369,7 +320,7 @@ function RemoveButton(props) {
|
|
|
369
320
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
370
321
|
MuiIconButton,
|
|
371
322
|
{
|
|
372
|
-
title: translateString(
|
|
323
|
+
title: translateString(import_utils6.TranslatableString.RemoveButton),
|
|
373
324
|
...otherProps,
|
|
374
325
|
color: "error",
|
|
375
326
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Remove.default, { fontSize: iconType === "default" ? void 0 : "small" })
|
|
@@ -378,39 +329,39 @@ function RemoveButton(props) {
|
|
|
378
329
|
}
|
|
379
330
|
|
|
380
331
|
// src/FieldErrorTemplate/FieldErrorTemplate.tsx
|
|
381
|
-
var import_ListItem2 = __toESM(require("@mui/material/ListItem"));
|
|
382
|
-
var import_FormHelperText = __toESM(require("@mui/material/FormHelperText"));
|
|
383
|
-
var import_List2 = __toESM(require("@mui/material/List"));
|
|
384
|
-
var
|
|
332
|
+
var import_ListItem2 = __toESM(require("@mui/material/ListItem"), 1);
|
|
333
|
+
var import_FormHelperText = __toESM(require("@mui/material/FormHelperText"), 1);
|
|
334
|
+
var import_List2 = __toESM(require("@mui/material/List"), 1);
|
|
335
|
+
var import_utils7 = require("@rjsf/utils");
|
|
385
336
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
386
337
|
function FieldErrorTemplate(props) {
|
|
387
338
|
const { errors = [], idSchema } = props;
|
|
388
339
|
if (errors.length === 0) {
|
|
389
340
|
return null;
|
|
390
341
|
}
|
|
391
|
-
const id = (0,
|
|
342
|
+
const id = (0, import_utils7.errorId)(idSchema);
|
|
392
343
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_List2.default, { id, dense: true, disablePadding: true, children: errors.map((error, i) => {
|
|
393
344
|
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);
|
|
394
345
|
}) });
|
|
395
346
|
}
|
|
396
347
|
|
|
397
348
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
398
|
-
var import_FormHelperText2 = __toESM(require("@mui/material/FormHelperText"));
|
|
399
|
-
var
|
|
349
|
+
var import_FormHelperText2 = __toESM(require("@mui/material/FormHelperText"), 1);
|
|
350
|
+
var import_utils8 = require("@rjsf/utils");
|
|
400
351
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
401
352
|
function FieldHelpTemplate(props) {
|
|
402
353
|
const { idSchema, help } = props;
|
|
403
354
|
if (!help) {
|
|
404
355
|
return null;
|
|
405
356
|
}
|
|
406
|
-
const id = (0,
|
|
357
|
+
const id = (0, import_utils8.helpId)(idSchema);
|
|
407
358
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_FormHelperText2.default, { component: "div", id, children: help });
|
|
408
359
|
}
|
|
409
360
|
|
|
410
361
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
411
|
-
var import_FormControl = __toESM(require("@mui/material/FormControl"));
|
|
412
|
-
var import_Typography3 = __toESM(require("@mui/material/Typography"));
|
|
413
|
-
var
|
|
362
|
+
var import_FormControl = __toESM(require("@mui/material/FormControl"), 1);
|
|
363
|
+
var import_Typography3 = __toESM(require("@mui/material/Typography"), 1);
|
|
364
|
+
var import_utils9 = require("@rjsf/utils");
|
|
414
365
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
415
366
|
function FieldTemplate(props) {
|
|
416
367
|
const {
|
|
@@ -435,8 +386,8 @@ function FieldTemplate(props) {
|
|
|
435
386
|
uiSchema,
|
|
436
387
|
registry
|
|
437
388
|
} = props;
|
|
438
|
-
const uiOptions = (0,
|
|
439
|
-
const WrapIfAdditionalTemplate2 = (0,
|
|
389
|
+
const uiOptions = (0, import_utils9.getUiOptions)(uiSchema);
|
|
390
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils9.getTemplate)(
|
|
440
391
|
"WrapIfAdditionalTemplate",
|
|
441
392
|
registry,
|
|
442
393
|
uiOptions
|
|
@@ -469,10 +420,18 @@ function FieldTemplate(props) {
|
|
|
469
420
|
);
|
|
470
421
|
}
|
|
471
422
|
|
|
472
|
-
// src/
|
|
473
|
-
var
|
|
474
|
-
var import_utils9 = require("@rjsf/utils");
|
|
423
|
+
// src/GridTemplate/GridTemplate.tsx
|
|
424
|
+
var import_Grid23 = __toESM(require("@mui/material/Grid2"), 1);
|
|
475
425
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
426
|
+
function GridTemplate(props) {
|
|
427
|
+
const { children, column, ...rest } = props;
|
|
428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Grid23.default, { container: !column, ...rest, children });
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
432
|
+
var import_Grid24 = __toESM(require("@mui/material/Grid2"), 1);
|
|
433
|
+
var import_utils10 = require("@rjsf/utils");
|
|
434
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
476
435
|
function ObjectFieldTemplate(props) {
|
|
477
436
|
const {
|
|
478
437
|
description,
|
|
@@ -488,9 +447,9 @@ function ObjectFieldTemplate(props) {
|
|
|
488
447
|
onAddClick,
|
|
489
448
|
registry
|
|
490
449
|
} = props;
|
|
491
|
-
const uiOptions = (0,
|
|
492
|
-
const TitleFieldTemplate = (0,
|
|
493
|
-
const DescriptionFieldTemplate = (0,
|
|
450
|
+
const uiOptions = (0, import_utils10.getUiOptions)(uiSchema);
|
|
451
|
+
const TitleFieldTemplate = (0, import_utils10.getTemplate)("TitleFieldTemplate", registry, uiOptions);
|
|
452
|
+
const DescriptionFieldTemplate = (0, import_utils10.getTemplate)(
|
|
494
453
|
"DescriptionFieldTemplate",
|
|
495
454
|
registry,
|
|
496
455
|
uiOptions
|
|
@@ -498,11 +457,11 @@ function ObjectFieldTemplate(props) {
|
|
|
498
457
|
const {
|
|
499
458
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
500
459
|
} = registry.templates;
|
|
501
|
-
return /* @__PURE__ */ (0,
|
|
502
|
-
title && /* @__PURE__ */ (0,
|
|
460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
461
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
503
462
|
TitleFieldTemplate,
|
|
504
463
|
{
|
|
505
|
-
id: (0,
|
|
464
|
+
id: (0, import_utils10.titleId)(idSchema),
|
|
506
465
|
title,
|
|
507
466
|
required,
|
|
508
467
|
schema,
|
|
@@ -510,28 +469,29 @@ function ObjectFieldTemplate(props) {
|
|
|
510
469
|
registry
|
|
511
470
|
}
|
|
512
471
|
),
|
|
513
|
-
description && /* @__PURE__ */ (0,
|
|
472
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
514
473
|
DescriptionFieldTemplate,
|
|
515
474
|
{
|
|
516
|
-
id: (0,
|
|
475
|
+
id: (0, import_utils10.descriptionId)(idSchema),
|
|
517
476
|
description,
|
|
518
477
|
schema,
|
|
519
478
|
uiSchema,
|
|
520
479
|
registry
|
|
521
480
|
}
|
|
522
481
|
),
|
|
523
|
-
/* @__PURE__ */ (0,
|
|
482
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_Grid24.default, { container: true, spacing: 2, style: { marginTop: "10px" }, children: [
|
|
524
483
|
properties.map(
|
|
525
484
|
(element, index) => (
|
|
526
|
-
// Remove the <
|
|
485
|
+
// Remove the <Grid2> if the inner element is hidden as the <Grid2>
|
|
527
486
|
// itself would otherwise still take up space.
|
|
528
|
-
element.hidden ? element.content : /* @__PURE__ */ (0,
|
|
487
|
+
element.hidden ? element.content : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Grid24.default, { size: { xs: 12 }, style: { marginBottom: "10px" }, children: element.content }, index)
|
|
529
488
|
)
|
|
530
489
|
),
|
|
531
|
-
(0,
|
|
490
|
+
(0, import_utils10.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Grid24.default, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_Grid24.default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
532
491
|
AddButton2,
|
|
533
492
|
{
|
|
534
|
-
|
|
493
|
+
id: (0, import_utils10.buttonId)(idSchema, "add"),
|
|
494
|
+
className: "rjsf-object-property-expand",
|
|
535
495
|
onClick: onAddClick(schema),
|
|
536
496
|
disabled: disabled || readonly,
|
|
537
497
|
uiSchema,
|
|
@@ -543,38 +503,38 @@ function ObjectFieldTemplate(props) {
|
|
|
543
503
|
}
|
|
544
504
|
|
|
545
505
|
// src/SubmitButton/SubmitButton.tsx
|
|
546
|
-
var import_Box4 = __toESM(require("@mui/material/Box"));
|
|
547
|
-
var import_Button = __toESM(require("@mui/material/Button"));
|
|
548
|
-
var
|
|
549
|
-
var
|
|
506
|
+
var import_Box4 = __toESM(require("@mui/material/Box"), 1);
|
|
507
|
+
var import_Button = __toESM(require("@mui/material/Button"), 1);
|
|
508
|
+
var import_utils11 = require("@rjsf/utils");
|
|
509
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
550
510
|
function SubmitButton({ uiSchema }) {
|
|
551
|
-
const { submitText, norender, props: submitButtonProps = {} } = (0,
|
|
511
|
+
const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils11.getSubmitButtonOptions)(uiSchema);
|
|
552
512
|
if (norender) {
|
|
553
513
|
return null;
|
|
554
514
|
}
|
|
555
|
-
return /* @__PURE__ */ (0,
|
|
515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Box4.default, { marginTop: 3, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Button.default, { type: "submit", variant: "contained", color: "primary", ...submitButtonProps, children: submitText }) });
|
|
556
516
|
}
|
|
557
517
|
|
|
558
518
|
// src/TitleField/TitleField.tsx
|
|
559
|
-
var import_Box5 = __toESM(require("@mui/material/Box"));
|
|
560
|
-
var import_Divider = __toESM(require("@mui/material/Divider"));
|
|
561
|
-
var import_Typography4 = __toESM(require("@mui/material/Typography"));
|
|
562
|
-
var
|
|
519
|
+
var import_Box5 = __toESM(require("@mui/material/Box"), 1);
|
|
520
|
+
var import_Divider = __toESM(require("@mui/material/Divider"), 1);
|
|
521
|
+
var import_Typography4 = __toESM(require("@mui/material/Typography"), 1);
|
|
522
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
563
523
|
function TitleField({
|
|
564
524
|
id,
|
|
565
525
|
title
|
|
566
526
|
}) {
|
|
567
|
-
return /* @__PURE__ */ (0,
|
|
568
|
-
/* @__PURE__ */ (0,
|
|
569
|
-
/* @__PURE__ */ (0,
|
|
527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_Box5.default, { id, mb: 1, mt: 1, children: [
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Typography4.default, { variant: "h5", children: title }),
|
|
529
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Divider.default, {})
|
|
570
530
|
] });
|
|
571
531
|
}
|
|
572
532
|
|
|
573
533
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
574
|
-
var
|
|
575
|
-
var import_TextField2 = __toESM(require("@mui/material/TextField"));
|
|
576
|
-
var
|
|
577
|
-
var
|
|
534
|
+
var import_Grid25 = __toESM(require("@mui/material/Grid2"), 1);
|
|
535
|
+
var import_TextField2 = __toESM(require("@mui/material/TextField"), 1);
|
|
536
|
+
var import_utils12 = require("@rjsf/utils");
|
|
537
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
578
538
|
function WrapIfAdditionalTemplate(props) {
|
|
579
539
|
const {
|
|
580
540
|
children,
|
|
@@ -593,8 +553,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
593
553
|
} = props;
|
|
594
554
|
const { templates, translateString } = registry;
|
|
595
555
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
596
|
-
const keyLabel = translateString(
|
|
597
|
-
const additional =
|
|
556
|
+
const keyLabel = translateString(import_utils12.TranslatableString.KeyLabel, [label]);
|
|
557
|
+
const additional = import_utils12.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
598
558
|
const btnStyle = {
|
|
599
559
|
flex: 1,
|
|
600
560
|
paddingLeft: 6,
|
|
@@ -602,11 +562,11 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
602
562
|
fontWeight: "bold"
|
|
603
563
|
};
|
|
604
564
|
if (!additional) {
|
|
605
|
-
return /* @__PURE__ */ (0,
|
|
565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: classNames, style, children });
|
|
606
566
|
}
|
|
607
567
|
const handleBlur = ({ target }) => onKeyChange(target && target.value);
|
|
608
|
-
return /* @__PURE__ */ (0,
|
|
609
|
-
/* @__PURE__ */ (0,
|
|
568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_Grid25.default, { container: true, alignItems: "center", spacing: 2, className: classNames, style, children: [
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Grid25.default, { size: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
610
570
|
import_TextField2.default,
|
|
611
571
|
{
|
|
612
572
|
fullWidth: true,
|
|
@@ -620,10 +580,12 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
620
580
|
type: "text"
|
|
621
581
|
}
|
|
622
582
|
) }),
|
|
623
|
-
/* @__PURE__ */ (0,
|
|
624
|
-
/* @__PURE__ */ (0,
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Grid25.default, { size: "auto", children }),
|
|
584
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_Grid25.default, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
625
585
|
RemoveButton2,
|
|
626
586
|
{
|
|
587
|
+
id: (0, import_utils12.buttonId)(id, "remove"),
|
|
588
|
+
className: "rjsf-object-property-remove",
|
|
627
589
|
iconType: "default",
|
|
628
590
|
style: btnStyle,
|
|
629
591
|
disabled: disabled || readonly,
|
|
@@ -654,6 +616,7 @@ function generateTemplates() {
|
|
|
654
616
|
FieldErrorTemplate,
|
|
655
617
|
FieldHelpTemplate,
|
|
656
618
|
FieldTemplate,
|
|
619
|
+
GridTemplate,
|
|
657
620
|
ObjectFieldTemplate,
|
|
658
621
|
TitleFieldTemplate: TitleField,
|
|
659
622
|
WrapIfAdditionalTemplate
|
|
@@ -662,10 +625,10 @@ function generateTemplates() {
|
|
|
662
625
|
var Templates_default = generateTemplates();
|
|
663
626
|
|
|
664
627
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
665
|
-
var import_Checkbox = __toESM(require("@mui/material/Checkbox"));
|
|
666
|
-
var import_FormControlLabel = __toESM(require("@mui/material/FormControlLabel"));
|
|
667
|
-
var
|
|
668
|
-
var
|
|
628
|
+
var import_Checkbox = __toESM(require("@mui/material/Checkbox"), 1);
|
|
629
|
+
var import_FormControlLabel = __toESM(require("@mui/material/FormControlLabel"), 1);
|
|
630
|
+
var import_utils13 = require("@rjsf/utils");
|
|
631
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
669
632
|
function CheckboxWidget(props) {
|
|
670
633
|
const {
|
|
671
634
|
schema,
|
|
@@ -683,31 +646,31 @@ function CheckboxWidget(props) {
|
|
|
683
646
|
options,
|
|
684
647
|
uiSchema
|
|
685
648
|
} = props;
|
|
686
|
-
const DescriptionFieldTemplate = (0,
|
|
649
|
+
const DescriptionFieldTemplate = (0, import_utils13.getTemplate)(
|
|
687
650
|
"DescriptionFieldTemplate",
|
|
688
651
|
registry,
|
|
689
652
|
options
|
|
690
653
|
);
|
|
691
|
-
const required = (0,
|
|
654
|
+
const required = (0, import_utils13.schemaRequiresTrueValue)(schema);
|
|
692
655
|
const _onChange = (_, checked) => onChange(checked);
|
|
693
656
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
694
657
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
695
658
|
const description = options.description ?? schema.description;
|
|
696
|
-
return /* @__PURE__ */ (0,
|
|
697
|
-
!hideLabel && !!description && /* @__PURE__ */ (0,
|
|
659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
660
|
+
!hideLabel && !!description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
698
661
|
DescriptionFieldTemplate,
|
|
699
662
|
{
|
|
700
|
-
id: (0,
|
|
663
|
+
id: (0, import_utils13.descriptionId)(id),
|
|
701
664
|
description,
|
|
702
665
|
schema,
|
|
703
666
|
uiSchema,
|
|
704
667
|
registry
|
|
705
668
|
}
|
|
706
669
|
),
|
|
707
|
-
/* @__PURE__ */ (0,
|
|
670
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
708
671
|
import_FormControlLabel.default,
|
|
709
672
|
{
|
|
710
|
-
control: /* @__PURE__ */ (0,
|
|
673
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
711
674
|
import_Checkbox.default,
|
|
712
675
|
{
|
|
713
676
|
id,
|
|
@@ -719,22 +682,22 @@ function CheckboxWidget(props) {
|
|
|
719
682
|
onChange: _onChange,
|
|
720
683
|
onBlur: _onBlur,
|
|
721
684
|
onFocus: _onFocus,
|
|
722
|
-
"aria-describedby": (0,
|
|
685
|
+
"aria-describedby": (0, import_utils13.ariaDescribedByIds)(id)
|
|
723
686
|
}
|
|
724
687
|
),
|
|
725
|
-
label: (0,
|
|
688
|
+
label: (0, import_utils13.labelValue)(label, hideLabel, false)
|
|
726
689
|
}
|
|
727
690
|
)
|
|
728
691
|
] });
|
|
729
692
|
}
|
|
730
693
|
|
|
731
694
|
// src/CheckboxesWidget/CheckboxesWidget.tsx
|
|
732
|
-
var import_Checkbox2 = __toESM(require("@mui/material/Checkbox"));
|
|
733
|
-
var import_FormControlLabel2 = __toESM(require("@mui/material/FormControlLabel"));
|
|
734
|
-
var import_FormGroup = __toESM(require("@mui/material/FormGroup"));
|
|
735
|
-
var import_FormLabel = __toESM(require("@mui/material/FormLabel"));
|
|
736
|
-
var
|
|
737
|
-
var
|
|
695
|
+
var import_Checkbox2 = __toESM(require("@mui/material/Checkbox"), 1);
|
|
696
|
+
var import_FormControlLabel2 = __toESM(require("@mui/material/FormControlLabel"), 1);
|
|
697
|
+
var import_FormGroup = __toESM(require("@mui/material/FormGroup"), 1);
|
|
698
|
+
var import_FormLabel = __toESM(require("@mui/material/FormLabel"), 1);
|
|
699
|
+
var import_utils14 = require("@rjsf/utils");
|
|
700
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
738
701
|
function CheckboxesWidget({
|
|
739
702
|
label,
|
|
740
703
|
hideLabel,
|
|
@@ -753,25 +716,25 @@ function CheckboxesWidget({
|
|
|
753
716
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
754
717
|
const _onChange = (index) => ({ target: { checked } }) => {
|
|
755
718
|
if (checked) {
|
|
756
|
-
onChange((0,
|
|
719
|
+
onChange((0, import_utils14.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
757
720
|
} else {
|
|
758
|
-
onChange((0,
|
|
721
|
+
onChange((0, import_utils14.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
759
722
|
}
|
|
760
723
|
};
|
|
761
|
-
const _onBlur = ({ target }) => onBlur(id, (0,
|
|
762
|
-
const _onFocus = ({ target }) => onFocus(id, (0,
|
|
763
|
-
return /* @__PURE__ */ (0,
|
|
764
|
-
(0,
|
|
765
|
-
/* @__PURE__ */ (0,
|
|
724
|
+
const _onBlur = ({ target }) => onBlur(id, (0, import_utils14.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
725
|
+
const _onFocus = ({ target }) => onFocus(id, (0, import_utils14.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
727
|
+
(0, import_utils14.labelValue)(
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_FormLabel.default, { required, htmlFor: id, children: label || void 0 }),
|
|
766
729
|
hideLabel
|
|
767
730
|
),
|
|
768
|
-
/* @__PURE__ */ (0,
|
|
769
|
-
const checked = (0,
|
|
731
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_FormGroup.default, { id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
732
|
+
const checked = (0, import_utils14.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
770
733
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
771
|
-
const checkbox = /* @__PURE__ */ (0,
|
|
734
|
+
const checkbox = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
772
735
|
import_Checkbox2.default,
|
|
773
736
|
{
|
|
774
|
-
id: (0,
|
|
737
|
+
id: (0, import_utils14.optionId)(id, index),
|
|
775
738
|
name: id,
|
|
776
739
|
checked,
|
|
777
740
|
disabled: disabled || itemDisabled || readonly,
|
|
@@ -779,21 +742,21 @@ function CheckboxesWidget({
|
|
|
779
742
|
onChange: _onChange(index),
|
|
780
743
|
onBlur: _onBlur,
|
|
781
744
|
onFocus: _onFocus,
|
|
782
|
-
"aria-describedby": (0,
|
|
745
|
+
"aria-describedby": (0, import_utils14.ariaDescribedByIds)(id)
|
|
783
746
|
}
|
|
784
747
|
);
|
|
785
|
-
return /* @__PURE__ */ (0,
|
|
748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_FormControlLabel2.default, { control: checkbox, label: option.label }, index);
|
|
786
749
|
}) })
|
|
787
750
|
] });
|
|
788
751
|
}
|
|
789
752
|
|
|
790
753
|
// src/RadioWidget/RadioWidget.tsx
|
|
791
|
-
var import_FormControlLabel3 = __toESM(require("@mui/material/FormControlLabel"));
|
|
792
|
-
var import_FormLabel2 = __toESM(require("@mui/material/FormLabel"));
|
|
793
|
-
var import_Radio = __toESM(require("@mui/material/Radio"));
|
|
794
|
-
var import_RadioGroup = __toESM(require("@mui/material/RadioGroup"));
|
|
795
|
-
var
|
|
796
|
-
var
|
|
754
|
+
var import_FormControlLabel3 = __toESM(require("@mui/material/FormControlLabel"), 1);
|
|
755
|
+
var import_FormLabel2 = __toESM(require("@mui/material/FormLabel"), 1);
|
|
756
|
+
var import_Radio = __toESM(require("@mui/material/Radio"), 1);
|
|
757
|
+
var import_RadioGroup = __toESM(require("@mui/material/RadioGroup"), 1);
|
|
758
|
+
var import_utils15 = require("@rjsf/utils");
|
|
759
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
797
760
|
function RadioWidget({
|
|
798
761
|
id,
|
|
799
762
|
options,
|
|
@@ -808,17 +771,17 @@ function RadioWidget({
|
|
|
808
771
|
onFocus
|
|
809
772
|
}) {
|
|
810
773
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
811
|
-
const _onChange = (_, value2) => onChange((0,
|
|
812
|
-
const _onBlur = ({ target }) => onBlur(id, (0,
|
|
813
|
-
const _onFocus = ({ target }) => onFocus(id, (0,
|
|
774
|
+
const _onChange = (_, value2) => onChange((0, import_utils15.enumOptionsValueForIndex)(value2, enumOptions, emptyValue));
|
|
775
|
+
const _onBlur = ({ target }) => onBlur(id, (0, import_utils15.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
776
|
+
const _onFocus = ({ target }) => onFocus(id, (0, import_utils15.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
814
777
|
const row = options ? options.inline : false;
|
|
815
|
-
const selectedIndex = (0,
|
|
816
|
-
return /* @__PURE__ */ (0,
|
|
817
|
-
(0,
|
|
818
|
-
/* @__PURE__ */ (0,
|
|
778
|
+
const selectedIndex = (0, import_utils15.enumOptionsIndexForValue)(value, enumOptions) ?? null;
|
|
779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
780
|
+
(0, import_utils15.labelValue)(
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_FormLabel2.default, { required, htmlFor: id, children: label || void 0 }),
|
|
819
782
|
hideLabel
|
|
820
783
|
),
|
|
821
|
-
/* @__PURE__ */ (0,
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
822
785
|
import_RadioGroup.default,
|
|
823
786
|
{
|
|
824
787
|
id,
|
|
@@ -828,13 +791,13 @@ function RadioWidget({
|
|
|
828
791
|
onChange: _onChange,
|
|
829
792
|
onBlur: _onBlur,
|
|
830
793
|
onFocus: _onFocus,
|
|
831
|
-
"aria-describedby": (0,
|
|
794
|
+
"aria-describedby": (0, import_utils15.ariaDescribedByIds)(id),
|
|
832
795
|
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
833
796
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
834
|
-
const radio = /* @__PURE__ */ (0,
|
|
797
|
+
const radio = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
835
798
|
import_FormControlLabel3.default,
|
|
836
799
|
{
|
|
837
|
-
control: /* @__PURE__ */ (0,
|
|
800
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_Radio.default, { name: id, id: (0, import_utils15.optionId)(id, index), color: "primary" }),
|
|
838
801
|
label: option.label,
|
|
839
802
|
value: String(index),
|
|
840
803
|
disabled: disabled || itemDisabled || readonly
|
|
@@ -849,24 +812,24 @@ function RadioWidget({
|
|
|
849
812
|
}
|
|
850
813
|
|
|
851
814
|
// src/RangeWidget/RangeWidget.tsx
|
|
852
|
-
var import_FormLabel3 = __toESM(require("@mui/material/FormLabel"));
|
|
853
|
-
var import_Slider = __toESM(require("@mui/material/Slider"));
|
|
854
|
-
var
|
|
855
|
-
var
|
|
815
|
+
var import_FormLabel3 = __toESM(require("@mui/material/FormLabel"), 1);
|
|
816
|
+
var import_Slider = __toESM(require("@mui/material/Slider"), 1);
|
|
817
|
+
var import_utils16 = require("@rjsf/utils");
|
|
818
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
856
819
|
function RangeWidget(props) {
|
|
857
820
|
const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } = props;
|
|
858
|
-
const sliderProps = { value, label, id, name: id, ...(0,
|
|
821
|
+
const sliderProps = { value, label, id, name: id, ...(0, import_utils16.rangeSpec)(schema) };
|
|
859
822
|
const _onChange = (_, value2) => {
|
|
860
823
|
onChange(value2 ?? options.emptyValue);
|
|
861
824
|
};
|
|
862
825
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
863
826
|
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
864
|
-
return /* @__PURE__ */ (0,
|
|
865
|
-
(0,
|
|
866
|
-
/* @__PURE__ */ (0,
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
828
|
+
(0, import_utils16.labelValue)(
|
|
829
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FormLabel3.default, { required, htmlFor: id, children: label || void 0 }),
|
|
867
830
|
hideLabel
|
|
868
831
|
),
|
|
869
|
-
/* @__PURE__ */ (0,
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
870
833
|
import_Slider.default,
|
|
871
834
|
{
|
|
872
835
|
disabled: disabled || readonly,
|
|
@@ -875,17 +838,17 @@ function RangeWidget(props) {
|
|
|
875
838
|
onFocus: _onFocus,
|
|
876
839
|
valueLabelDisplay: "auto",
|
|
877
840
|
...sliderProps,
|
|
878
|
-
"aria-describedby": (0,
|
|
841
|
+
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id)
|
|
879
842
|
}
|
|
880
843
|
)
|
|
881
844
|
] });
|
|
882
845
|
}
|
|
883
846
|
|
|
884
847
|
// src/SelectWidget/SelectWidget.tsx
|
|
885
|
-
var import_MenuItem = __toESM(require("@mui/material/MenuItem"));
|
|
886
|
-
var import_TextField3 = __toESM(require("@mui/material/TextField"));
|
|
887
|
-
var
|
|
888
|
-
var
|
|
848
|
+
var import_MenuItem = __toESM(require("@mui/material/MenuItem"), 1);
|
|
849
|
+
var import_TextField3 = __toESM(require("@mui/material/TextField"), 1);
|
|
850
|
+
var import_utils17 = require("@rjsf/utils");
|
|
851
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
889
852
|
function SelectWidget({
|
|
890
853
|
schema,
|
|
891
854
|
id,
|
|
@@ -916,18 +879,18 @@ function SelectWidget({
|
|
|
916
879
|
multiple = typeof multiple === "undefined" ? false : !!multiple;
|
|
917
880
|
const emptyValue = multiple ? [] : "";
|
|
918
881
|
const isEmpty = typeof value === "undefined" || multiple && value.length < 1 || !multiple && value === emptyValue;
|
|
919
|
-
const _onChange = ({ target: { value: value2 } }) => onChange((0,
|
|
920
|
-
const _onBlur = ({ target }) => onBlur(id, (0,
|
|
921
|
-
const _onFocus = ({ target }) => onFocus(id, (0,
|
|
922
|
-
const selectedIndexes = (0,
|
|
882
|
+
const _onChange = ({ target: { value: value2 } }) => onChange((0, import_utils17.enumOptionsValueForIndex)(value2, enumOptions, optEmptyVal));
|
|
883
|
+
const _onBlur = ({ target }) => onBlur(id, (0, import_utils17.enumOptionsValueForIndex)(target && target.value, enumOptions, optEmptyVal));
|
|
884
|
+
const _onFocus = ({ target }) => onFocus(id, (0, import_utils17.enumOptionsValueForIndex)(target && target.value, enumOptions, optEmptyVal));
|
|
885
|
+
const selectedIndexes = (0, import_utils17.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
923
886
|
const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
|
|
924
887
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
925
|
-
return /* @__PURE__ */ (0,
|
|
888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
926
889
|
import_TextField3.default,
|
|
927
890
|
{
|
|
928
891
|
id,
|
|
929
892
|
name: id,
|
|
930
|
-
label: (0,
|
|
893
|
+
label: (0, import_utils17.labelValue)(label || void 0, hideLabel, void 0),
|
|
931
894
|
value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
|
|
932
895
|
required,
|
|
933
896
|
disabled: disabled || readonly,
|
|
@@ -948,12 +911,12 @@ function SelectWidget({
|
|
|
948
911
|
...SelectProps,
|
|
949
912
|
multiple
|
|
950
913
|
},
|
|
951
|
-
"aria-describedby": (0,
|
|
914
|
+
"aria-describedby": (0, import_utils17.ariaDescribedByIds)(id),
|
|
952
915
|
children: [
|
|
953
|
-
showPlaceholderOption && /* @__PURE__ */ (0,
|
|
916
|
+
showPlaceholderOption && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_MenuItem.default, { value: "", children: placeholder }),
|
|
954
917
|
Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label: label2 }, i) => {
|
|
955
918
|
const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1;
|
|
956
|
-
return /* @__PURE__ */ (0,
|
|
919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_MenuItem.default, { value: String(i), disabled: disabled2, children: label2 }, i);
|
|
957
920
|
})
|
|
958
921
|
]
|
|
959
922
|
}
|
|
@@ -961,16 +924,16 @@ function SelectWidget({
|
|
|
961
924
|
}
|
|
962
925
|
|
|
963
926
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
964
|
-
var
|
|
965
|
-
var
|
|
927
|
+
var import_utils18 = require("@rjsf/utils");
|
|
928
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
966
929
|
function TextareaWidget(props) {
|
|
967
930
|
const { options, registry } = props;
|
|
968
|
-
const BaseInputTemplate2 = (0,
|
|
931
|
+
const BaseInputTemplate2 = (0, import_utils18.getTemplate)("BaseInputTemplate", registry, options);
|
|
969
932
|
let rows = 5;
|
|
970
933
|
if (typeof options.rows === "string" || typeof options.rows === "number") {
|
|
971
934
|
rows = options.rows;
|
|
972
935
|
}
|
|
973
|
-
return /* @__PURE__ */ (0,
|
|
936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(BaseInputTemplate2, { ...props, multiline: true, rows });
|
|
974
937
|
}
|
|
975
938
|
|
|
976
939
|
// src/Widgets/Widgets.ts
|
|
@@ -1002,5 +965,5 @@ function generateForm() {
|
|
|
1002
965
|
var MuiForm_default = generateForm();
|
|
1003
966
|
|
|
1004
967
|
// src/index.ts
|
|
1005
|
-
var
|
|
968
|
+
var index_default = MuiForm_default;
|
|
1006
969
|
//# sourceMappingURL=index.js.map
|