@rjsf/mui 5.2.0 → 5.3.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/LICENSE.md +183 -183
- package/README.md +1 -0
- package/dist/mui.cjs.development.js +436 -397
- package/dist/mui.cjs.development.js.map +1 -1
- package/dist/mui.cjs.production.min.js +1 -1
- package/dist/mui.cjs.production.min.js.map +1 -1
- package/dist/mui.esm.js +436 -397
- package/dist/mui.esm.js.map +1 -1
- package/dist/mui.umd.development.js +438 -400
- package/dist/mui.umd.development.js.map +1 -1
- package/dist/mui.umd.production.min.js +1 -1
- package/dist/mui.umd.production.min.js.map +1 -1
- package/package.json +14 -14
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@rjsf/core');
|
|
6
|
-
var
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var AddIcon = require('@mui/icons-material/Add');
|
|
8
8
|
var IconButton = require('@mui/material/IconButton');
|
|
9
9
|
var utils = require('@rjsf/utils');
|
|
@@ -19,6 +19,7 @@ var ListItemIcon = require('@mui/material/ListItemIcon');
|
|
|
19
19
|
var ListItemText = require('@mui/material/ListItemText');
|
|
20
20
|
var ArrowDownwardIcon = require('@mui/icons-material/ArrowDownward');
|
|
21
21
|
var ArrowUpwardIcon = require('@mui/icons-material/ArrowUpward');
|
|
22
|
+
var CopyIcon = require('@mui/icons-material/ContentCopy');
|
|
22
23
|
var RemoveIcon = require('@mui/icons-material/Remove');
|
|
23
24
|
var FormHelperText = require('@mui/material/FormHelperText');
|
|
24
25
|
var FormControl = require('@mui/material/FormControl');
|
|
@@ -37,7 +38,6 @@ var MenuItem = require('@mui/material/MenuItem');
|
|
|
37
38
|
|
|
38
39
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
39
40
|
|
|
40
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
41
41
|
var AddIcon__default = /*#__PURE__*/_interopDefaultLegacy(AddIcon);
|
|
42
42
|
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
|
43
43
|
var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
|
|
@@ -52,6 +52,7 @@ var ListItemIcon__default = /*#__PURE__*/_interopDefaultLegacy(ListItemIcon);
|
|
|
52
52
|
var ListItemText__default = /*#__PURE__*/_interopDefaultLegacy(ListItemText);
|
|
53
53
|
var ArrowDownwardIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDownwardIcon);
|
|
54
54
|
var ArrowUpwardIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowUpwardIcon);
|
|
55
|
+
var CopyIcon__default = /*#__PURE__*/_interopDefaultLegacy(CopyIcon);
|
|
55
56
|
var RemoveIcon__default = /*#__PURE__*/_interopDefaultLegacy(RemoveIcon);
|
|
56
57
|
var FormHelperText__default = /*#__PURE__*/_interopDefaultLegacy(FormHelperText);
|
|
57
58
|
var FormControl__default = /*#__PURE__*/_interopDefaultLegacy(FormControl);
|
|
@@ -102,11 +103,12 @@ function AddButton(_ref) {
|
|
|
102
103
|
var registry = _ref.registry,
|
|
103
104
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
104
105
|
var translateString = registry.translateString;
|
|
105
|
-
return
|
|
106
|
+
return jsxRuntime.jsx(IconButton__default["default"], _extends({
|
|
106
107
|
title: translateString(utils.TranslatableString.AddItemButton)
|
|
107
108
|
}, props, {
|
|
108
|
-
color:
|
|
109
|
-
|
|
109
|
+
color: 'primary',
|
|
110
|
+
children: jsxRuntime.jsx(AddIcon__default["default"], {})
|
|
111
|
+
}));
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
@@ -117,16 +119,19 @@ function ArrayFieldItemTemplate(props) {
|
|
|
117
119
|
var children = props.children,
|
|
118
120
|
disabled = props.disabled,
|
|
119
121
|
hasToolbar = props.hasToolbar,
|
|
122
|
+
hasCopy = props.hasCopy,
|
|
120
123
|
hasMoveDown = props.hasMoveDown,
|
|
121
124
|
hasMoveUp = props.hasMoveUp,
|
|
122
125
|
hasRemove = props.hasRemove,
|
|
123
126
|
index = props.index,
|
|
127
|
+
onCopyIndexClick = props.onCopyIndexClick,
|
|
124
128
|
onDropIndexClick = props.onDropIndexClick,
|
|
125
129
|
onReorderClick = props.onReorderClick,
|
|
126
130
|
readonly = props.readonly,
|
|
127
131
|
uiSchema = props.uiSchema,
|
|
128
132
|
registry = props.registry;
|
|
129
133
|
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
134
|
+
CopyButton = _registry$templates$B.CopyButton,
|
|
130
135
|
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
131
136
|
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
132
137
|
RemoveButton = _registry$templates$B.RemoveButton;
|
|
@@ -134,45 +139,57 @@ function ArrayFieldItemTemplate(props) {
|
|
|
134
139
|
flex: 1,
|
|
135
140
|
paddingLeft: 6,
|
|
136
141
|
paddingRight: 6,
|
|
137
|
-
fontWeight:
|
|
142
|
+
fontWeight: 'bold',
|
|
138
143
|
minWidth: 0
|
|
139
144
|
};
|
|
140
|
-
return
|
|
145
|
+
return jsxRuntime.jsxs(Grid__default["default"], {
|
|
141
146
|
container: true,
|
|
142
|
-
alignItems:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
children: [jsxRuntime.jsx(Grid__default["default"], {
|
|
149
|
+
item: true,
|
|
150
|
+
xs: true,
|
|
151
|
+
style: {
|
|
152
|
+
overflow: 'auto'
|
|
153
|
+
},
|
|
154
|
+
children: jsxRuntime.jsx(Box__default["default"], {
|
|
155
|
+
mb: 2,
|
|
156
|
+
children: jsxRuntime.jsx(Paper__default["default"], {
|
|
157
|
+
elevation: 2,
|
|
158
|
+
children: jsxRuntime.jsx(Box__default["default"], {
|
|
159
|
+
p: 2,
|
|
160
|
+
children: children
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
}), hasToolbar && jsxRuntime.jsxs(Grid__default["default"], {
|
|
165
|
+
item: true,
|
|
166
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
167
|
+
style: btnStyle,
|
|
168
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
169
|
+
onClick: onReorderClick(index, index - 1),
|
|
170
|
+
uiSchema: uiSchema,
|
|
171
|
+
registry: registry
|
|
172
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
173
|
+
style: btnStyle,
|
|
174
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
175
|
+
onClick: onReorderClick(index, index + 1),
|
|
176
|
+
uiSchema: uiSchema,
|
|
177
|
+
registry: registry
|
|
178
|
+
}), hasCopy && jsxRuntime.jsx(CopyButton, {
|
|
179
|
+
style: btnStyle,
|
|
180
|
+
disabled: disabled || readonly,
|
|
181
|
+
onClick: onCopyIndexClick(index),
|
|
182
|
+
uiSchema: uiSchema,
|
|
183
|
+
registry: registry
|
|
184
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
185
|
+
style: btnStyle,
|
|
186
|
+
disabled: disabled || readonly,
|
|
187
|
+
onClick: onDropIndexClick(index),
|
|
188
|
+
uiSchema: uiSchema,
|
|
189
|
+
registry: registry
|
|
190
|
+
})]
|
|
191
|
+
})]
|
|
192
|
+
});
|
|
176
193
|
}
|
|
177
194
|
|
|
178
195
|
var _excluded$3 = ["key"];
|
|
@@ -193,55 +210,59 @@ function ArrayFieldTemplate(props) {
|
|
|
193
210
|
schema = props.schema,
|
|
194
211
|
title = props.title;
|
|
195
212
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
196
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
197
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
198
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
213
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
214
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
215
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
199
216
|
// Button templates are not overridden in the uiSchema
|
|
200
217
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
201
|
-
return
|
|
202
|
-
elevation: 2
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
218
|
+
return jsxRuntime.jsx(Paper__default["default"], {
|
|
219
|
+
elevation: 2,
|
|
220
|
+
children: jsxRuntime.jsxs(Box__default["default"], {
|
|
221
|
+
p: 2,
|
|
222
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
223
|
+
idSchema: idSchema,
|
|
224
|
+
title: uiOptions.title || title,
|
|
225
|
+
schema: schema,
|
|
226
|
+
uiSchema: uiSchema,
|
|
227
|
+
required: required,
|
|
228
|
+
registry: registry
|
|
229
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
230
|
+
idSchema: idSchema,
|
|
231
|
+
description: uiOptions.description || schema.description,
|
|
232
|
+
schema: schema,
|
|
233
|
+
uiSchema: uiSchema,
|
|
234
|
+
registry: registry
|
|
235
|
+
}), jsxRuntime.jsxs(Grid__default["default"], {
|
|
236
|
+
container: true,
|
|
237
|
+
children: [items && items.map(function (_ref) {
|
|
238
|
+
var key = _ref.key,
|
|
239
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
240
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
241
|
+
}), canAdd && jsxRuntime.jsx(Grid__default["default"], {
|
|
242
|
+
container: true,
|
|
243
|
+
justifyContent: 'flex-end',
|
|
244
|
+
children: jsxRuntime.jsx(Grid__default["default"], {
|
|
245
|
+
item: true,
|
|
246
|
+
children: jsxRuntime.jsx(Box__default["default"], {
|
|
247
|
+
mt: 2,
|
|
248
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
249
|
+
className: 'array-item-add',
|
|
250
|
+
onClick: onAddClick,
|
|
251
|
+
disabled: disabled || readonly,
|
|
252
|
+
uiSchema: uiSchema,
|
|
253
|
+
registry: registry
|
|
254
|
+
})
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
})]
|
|
258
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
259
|
+
})
|
|
260
|
+
});
|
|
241
261
|
}
|
|
242
262
|
|
|
243
|
-
var _excluded$2 = ["id", "placeholder", "required", "readonly", "disabled", "type", "label", "value", "onChange", "onBlur", "onFocus", "autofocus", "options", "schema", "uiSchema", "rawErrors", "formContext", "registry"],
|
|
263
|
+
var _excluded$2 = ["id", "name", "placeholder", "required", "readonly", "disabled", "type", "label", "value", "onChange", "onChangeOverride", "onBlur", "onFocus", "autofocus", "options", "schema", "uiSchema", "rawErrors", "formContext", "registry", "InputLabelProps"],
|
|
244
264
|
_excluded2$1 = ["step", "min", "max"];
|
|
265
|
+
var TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];
|
|
245
266
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
246
267
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
247
268
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -258,6 +279,7 @@ function BaseInputTemplate(props) {
|
|
|
258
279
|
label = props.label,
|
|
259
280
|
value = props.value,
|
|
260
281
|
onChange = props.onChange,
|
|
282
|
+
onChangeOverride = props.onChangeOverride,
|
|
261
283
|
onBlur = props.onBlur,
|
|
262
284
|
onFocus = props.onFocus,
|
|
263
285
|
autofocus = props.autofocus,
|
|
@@ -267,6 +289,7 @@ function BaseInputTemplate(props) {
|
|
|
267
289
|
_props$rawErrors = props.rawErrors,
|
|
268
290
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
269
291
|
registry = props.registry,
|
|
292
|
+
InputLabelProps = props.InputLabelProps,
|
|
270
293
|
textFieldProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
271
294
|
var inputProps = utils.getInputProps(schema, type, options);
|
|
272
295
|
// Now we need to pull out the step, min, max into an inner `inputProps` for material-ui
|
|
@@ -285,7 +308,7 @@ function BaseInputTemplate(props) {
|
|
|
285
308
|
}, rest);
|
|
286
309
|
var _onChange = function _onChange(_ref) {
|
|
287
310
|
var value = _ref.target.value;
|
|
288
|
-
return onChange(value ===
|
|
311
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
289
312
|
};
|
|
290
313
|
var _onBlur = function _onBlur(_ref2) {
|
|
291
314
|
var value = _ref2.target.value;
|
|
@@ -297,30 +320,36 @@ function BaseInputTemplate(props) {
|
|
|
297
320
|
};
|
|
298
321
|
var schemaUtils = registry.schemaUtils;
|
|
299
322
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
323
|
+
var DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? _extends({}, InputLabelProps, {
|
|
324
|
+
shrink: true
|
|
325
|
+
}) : InputLabelProps;
|
|
326
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
327
|
+
children: [jsxRuntime.jsx(TextField__default["default"], _extends({
|
|
328
|
+
id: id,
|
|
329
|
+
name: id,
|
|
330
|
+
placeholder: placeholder,
|
|
331
|
+
label: displayLabel ? label || schema.title : false,
|
|
332
|
+
autoFocus: autofocus,
|
|
333
|
+
required: required,
|
|
334
|
+
disabled: disabled || readonly
|
|
335
|
+
}, otherProps, {
|
|
336
|
+
value: value || value === 0 ? value : '',
|
|
337
|
+
error: rawErrors.length > 0,
|
|
338
|
+
onChange: onChangeOverride || _onChange,
|
|
339
|
+
onBlur: _onBlur,
|
|
340
|
+
onFocus: _onFocus,
|
|
341
|
+
InputLabelProps: DisplayInputLabelProps
|
|
342
|
+
}, textFieldProps, {
|
|
343
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
344
|
+
})), Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
345
|
+
id: utils.examplesId(id),
|
|
346
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
347
|
+
return jsxRuntime.jsx("option", {
|
|
348
|
+
value: example
|
|
349
|
+
}, example);
|
|
350
|
+
})
|
|
351
|
+
})]
|
|
352
|
+
});
|
|
324
353
|
}
|
|
325
354
|
|
|
326
355
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -331,13 +360,14 @@ function DescriptionField(props) {
|
|
|
331
360
|
var id = props.id,
|
|
332
361
|
description = props.description;
|
|
333
362
|
if (description) {
|
|
334
|
-
return
|
|
363
|
+
return jsxRuntime.jsx(Typography__default["default"], {
|
|
335
364
|
id: id,
|
|
336
|
-
variant:
|
|
365
|
+
variant: 'subtitle2',
|
|
337
366
|
style: {
|
|
338
|
-
marginTop:
|
|
339
|
-
}
|
|
340
|
-
|
|
367
|
+
marginTop: '5px'
|
|
368
|
+
},
|
|
369
|
+
children: description
|
|
370
|
+
});
|
|
341
371
|
}
|
|
342
372
|
return null;
|
|
343
373
|
}
|
|
@@ -350,24 +380,30 @@ function ErrorList(_ref) {
|
|
|
350
380
|
var errors = _ref.errors,
|
|
351
381
|
registry = _ref.registry;
|
|
352
382
|
var translateString = registry.translateString;
|
|
353
|
-
return
|
|
354
|
-
elevation: 2
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
383
|
+
return jsxRuntime.jsx(Paper__default["default"], {
|
|
384
|
+
elevation: 2,
|
|
385
|
+
children: jsxRuntime.jsxs(Box__default["default"], {
|
|
386
|
+
mb: 2,
|
|
387
|
+
p: 2,
|
|
388
|
+
children: [jsxRuntime.jsx(Typography__default["default"], {
|
|
389
|
+
variant: 'h6',
|
|
390
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
391
|
+
}), jsxRuntime.jsx(List__default["default"], {
|
|
392
|
+
dense: true,
|
|
393
|
+
children: errors.map(function (error, i) {
|
|
394
|
+
return jsxRuntime.jsxs(ListItem__default["default"], {
|
|
395
|
+
children: [jsxRuntime.jsx(ListItemIcon__default["default"], {
|
|
396
|
+
children: jsxRuntime.jsx(ErrorIcon__default["default"], {
|
|
397
|
+
color: 'error'
|
|
398
|
+
})
|
|
399
|
+
}), jsxRuntime.jsx(ListItemText__default["default"], {
|
|
400
|
+
primary: error.stack
|
|
401
|
+
})]
|
|
402
|
+
}, i);
|
|
403
|
+
})
|
|
404
|
+
})]
|
|
405
|
+
})
|
|
406
|
+
});
|
|
371
407
|
}
|
|
372
408
|
|
|
373
409
|
var _excluded$1 = ["icon", "color", "uiSchema", "registry"],
|
|
@@ -376,28 +412,39 @@ function MuiIconButton(props) {
|
|
|
376
412
|
var icon = props.icon,
|
|
377
413
|
color = props.color,
|
|
378
414
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
379
|
-
return
|
|
380
|
-
size:
|
|
381
|
-
color: color
|
|
382
|
-
|
|
415
|
+
return jsxRuntime.jsx(IconButton__default["default"], _extends({}, otherProps, {
|
|
416
|
+
size: 'small',
|
|
417
|
+
color: color,
|
|
418
|
+
children: icon
|
|
419
|
+
}));
|
|
420
|
+
}
|
|
421
|
+
function CopyButton(props) {
|
|
422
|
+
var translateString = props.registry.translateString;
|
|
423
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
424
|
+
title: translateString(utils.TranslatableString.CopyButton)
|
|
425
|
+
}, props, {
|
|
426
|
+
icon: jsxRuntime.jsx(CopyIcon__default["default"], {
|
|
427
|
+
fontSize: 'small'
|
|
428
|
+
})
|
|
429
|
+
}));
|
|
383
430
|
}
|
|
384
431
|
function MoveDownButton(props) {
|
|
385
432
|
var translateString = props.registry.translateString;
|
|
386
|
-
return
|
|
433
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
387
434
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
388
435
|
}, props, {
|
|
389
|
-
icon:
|
|
390
|
-
fontSize:
|
|
436
|
+
icon: jsxRuntime.jsx(ArrowDownwardIcon__default["default"], {
|
|
437
|
+
fontSize: 'small'
|
|
391
438
|
})
|
|
392
439
|
}));
|
|
393
440
|
}
|
|
394
441
|
function MoveUpButton(props) {
|
|
395
442
|
var translateString = props.registry.translateString;
|
|
396
|
-
return
|
|
443
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
397
444
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
398
445
|
}, props, {
|
|
399
|
-
icon:
|
|
400
|
-
fontSize:
|
|
446
|
+
icon: jsxRuntime.jsx(ArrowUpwardIcon__default["default"], {
|
|
447
|
+
fontSize: 'small'
|
|
401
448
|
})
|
|
402
449
|
}));
|
|
403
450
|
}
|
|
@@ -405,12 +452,12 @@ function RemoveButton(props) {
|
|
|
405
452
|
var iconType = props.iconType,
|
|
406
453
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
407
454
|
var translateString = otherProps.registry.translateString;
|
|
408
|
-
return
|
|
455
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
409
456
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
410
457
|
}, otherProps, {
|
|
411
|
-
color:
|
|
412
|
-
icon:
|
|
413
|
-
fontSize: iconType ===
|
|
458
|
+
color: 'error',
|
|
459
|
+
icon: jsxRuntime.jsx(RemoveIcon__default["default"], {
|
|
460
|
+
fontSize: iconType === 'default' ? undefined : 'small'
|
|
414
461
|
})
|
|
415
462
|
}));
|
|
416
463
|
}
|
|
@@ -427,17 +474,19 @@ function FieldErrorTemplate(props) {
|
|
|
427
474
|
return null;
|
|
428
475
|
}
|
|
429
476
|
var id = utils.errorId(idSchema);
|
|
430
|
-
return
|
|
477
|
+
return jsxRuntime.jsx(List__default["default"], {
|
|
431
478
|
dense: true,
|
|
432
|
-
disablePadding: true
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
479
|
+
disablePadding: true,
|
|
480
|
+
children: errors.map(function (error, i) {
|
|
481
|
+
return jsxRuntime.jsx(ListItem__default["default"], {
|
|
482
|
+
disableGutters: true,
|
|
483
|
+
children: jsxRuntime.jsx(FormHelperText__default["default"], {
|
|
484
|
+
id: id,
|
|
485
|
+
children: error
|
|
486
|
+
})
|
|
487
|
+
}, i);
|
|
488
|
+
})
|
|
489
|
+
});
|
|
441
490
|
}
|
|
442
491
|
|
|
443
492
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -451,9 +500,10 @@ function FieldHelpTemplate(props) {
|
|
|
451
500
|
return null;
|
|
452
501
|
}
|
|
453
502
|
var id = utils.helpId(idSchema);
|
|
454
|
-
return
|
|
455
|
-
id: id
|
|
456
|
-
|
|
503
|
+
return jsxRuntime.jsx(FormHelperText__default["default"], {
|
|
504
|
+
id: id,
|
|
505
|
+
children: help
|
|
506
|
+
});
|
|
457
507
|
}
|
|
458
508
|
|
|
459
509
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -483,15 +533,16 @@ function FieldTemplate(props) {
|
|
|
483
533
|
uiSchema = props.uiSchema,
|
|
484
534
|
registry = props.registry;
|
|
485
535
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
486
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
536
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
487
537
|
if (hidden) {
|
|
488
|
-
return
|
|
538
|
+
return jsxRuntime.jsx("div", {
|
|
489
539
|
style: {
|
|
490
|
-
display:
|
|
491
|
-
}
|
|
492
|
-
|
|
540
|
+
display: 'none'
|
|
541
|
+
},
|
|
542
|
+
children: children
|
|
543
|
+
});
|
|
493
544
|
}
|
|
494
|
-
return
|
|
545
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
495
546
|
classNames: classNames,
|
|
496
547
|
style: style,
|
|
497
548
|
disabled: disabled,
|
|
@@ -503,15 +554,18 @@ function FieldTemplate(props) {
|
|
|
503
554
|
required: required,
|
|
504
555
|
schema: schema,
|
|
505
556
|
uiSchema: uiSchema,
|
|
506
|
-
registry: registry
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
557
|
+
registry: registry,
|
|
558
|
+
children: jsxRuntime.jsxs(FormControl__default["default"], {
|
|
559
|
+
fullWidth: true,
|
|
560
|
+
error: rawErrors.length ? true : false,
|
|
561
|
+
required: required,
|
|
562
|
+
children: [children, displayLabel && rawDescription ? jsxRuntime.jsx(Typography__default["default"], {
|
|
563
|
+
variant: 'caption',
|
|
564
|
+
color: 'textSecondary',
|
|
565
|
+
children: rawDescription
|
|
566
|
+
}) : null, errors, help]
|
|
567
|
+
})
|
|
568
|
+
});
|
|
515
569
|
}
|
|
516
570
|
|
|
517
571
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -534,54 +588,59 @@ function ObjectFieldTemplate(props) {
|
|
|
534
588
|
onAddClick = props.onAddClick,
|
|
535
589
|
registry = props.registry;
|
|
536
590
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
537
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
538
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
591
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
592
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
539
593
|
// Button templates are not overridden in the uiSchema
|
|
540
594
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
541
|
-
return
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
595
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
596
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
597
|
+
id: utils.titleId(idSchema),
|
|
598
|
+
title: title,
|
|
599
|
+
required: required,
|
|
600
|
+
schema: schema,
|
|
601
|
+
uiSchema: uiSchema,
|
|
602
|
+
registry: registry
|
|
603
|
+
}), (uiOptions.description || description) && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
604
|
+
id: utils.descriptionId(idSchema),
|
|
605
|
+
description: uiOptions.description || description,
|
|
606
|
+
schema: schema,
|
|
607
|
+
uiSchema: uiSchema,
|
|
608
|
+
registry: registry
|
|
609
|
+
}), jsxRuntime.jsxs(Grid__default["default"], {
|
|
610
|
+
container: true,
|
|
611
|
+
spacing: 2,
|
|
612
|
+
style: {
|
|
613
|
+
marginTop: '10px'
|
|
614
|
+
},
|
|
615
|
+
children: [properties.map(function (element, index) {
|
|
616
|
+
return (
|
|
617
|
+
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
618
|
+
// itself would otherwise still take up space.
|
|
619
|
+
element.hidden ? element.content : jsxRuntime.jsx(Grid__default["default"], {
|
|
620
|
+
item: true,
|
|
621
|
+
xs: 12,
|
|
622
|
+
style: {
|
|
623
|
+
marginBottom: '10px'
|
|
624
|
+
},
|
|
625
|
+
children: element.content
|
|
626
|
+
}, index)
|
|
627
|
+
);
|
|
628
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(Grid__default["default"], {
|
|
629
|
+
container: true,
|
|
630
|
+
justifyContent: 'flex-end',
|
|
631
|
+
children: jsxRuntime.jsx(Grid__default["default"], {
|
|
632
|
+
item: true,
|
|
633
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
634
|
+
className: 'object-property-expand',
|
|
635
|
+
onClick: onAddClick(schema),
|
|
636
|
+
disabled: disabled || readonly,
|
|
637
|
+
uiSchema: uiSchema,
|
|
638
|
+
registry: registry
|
|
639
|
+
})
|
|
640
|
+
})
|
|
641
|
+
})]
|
|
642
|
+
})]
|
|
643
|
+
});
|
|
585
644
|
}
|
|
586
645
|
|
|
587
646
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -596,13 +655,16 @@ function SubmitButton(_ref) {
|
|
|
596
655
|
if (norender) {
|
|
597
656
|
return null;
|
|
598
657
|
}
|
|
599
|
-
return
|
|
600
|
-
marginTop: 3
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
658
|
+
return jsxRuntime.jsx(Box__default["default"], {
|
|
659
|
+
marginTop: 3,
|
|
660
|
+
children: jsxRuntime.jsx(Button__default["default"], _extends({
|
|
661
|
+
type: 'submit',
|
|
662
|
+
variant: 'contained',
|
|
663
|
+
color: 'primary'
|
|
664
|
+
}, submitButtonProps, {
|
|
665
|
+
children: submitText
|
|
666
|
+
}))
|
|
667
|
+
});
|
|
606
668
|
}
|
|
607
669
|
|
|
608
670
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -612,13 +674,15 @@ function SubmitButton(_ref) {
|
|
|
612
674
|
function TitleField(_ref) {
|
|
613
675
|
var id = _ref.id,
|
|
614
676
|
title = _ref.title;
|
|
615
|
-
return
|
|
677
|
+
return jsxRuntime.jsxs(Box__default["default"], {
|
|
616
678
|
id: id,
|
|
617
679
|
mb: 1,
|
|
618
|
-
mt: 1
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
680
|
+
mt: 1,
|
|
681
|
+
children: [jsxRuntime.jsx(Typography__default["default"], {
|
|
682
|
+
variant: 'h5',
|
|
683
|
+
children: title
|
|
684
|
+
}), jsxRuntime.jsx(Divider__default["default"], {})]
|
|
685
|
+
});
|
|
622
686
|
}
|
|
623
687
|
|
|
624
688
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -650,51 +714,58 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
650
714
|
flex: 1,
|
|
651
715
|
paddingLeft: 6,
|
|
652
716
|
paddingRight: 6,
|
|
653
|
-
fontWeight:
|
|
717
|
+
fontWeight: 'bold'
|
|
654
718
|
};
|
|
655
719
|
if (!additional) {
|
|
656
|
-
return
|
|
720
|
+
return jsxRuntime.jsx("div", {
|
|
657
721
|
className: classNames,
|
|
658
|
-
style: style
|
|
659
|
-
|
|
722
|
+
style: style,
|
|
723
|
+
children: children
|
|
724
|
+
});
|
|
660
725
|
}
|
|
661
726
|
var handleBlur = function handleBlur(_ref) {
|
|
662
727
|
var target = _ref.target;
|
|
663
728
|
return onKeyChange(target.value);
|
|
664
729
|
};
|
|
665
|
-
return
|
|
730
|
+
return jsxRuntime.jsxs(Grid__default["default"], {
|
|
666
731
|
container: true,
|
|
667
|
-
|
|
668
|
-
alignItems: "center",
|
|
732
|
+
alignItems: 'center',
|
|
669
733
|
spacing: 2,
|
|
670
734
|
className: classNames,
|
|
671
|
-
style: style
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
735
|
+
style: style,
|
|
736
|
+
children: [jsxRuntime.jsx(Grid__default["default"], {
|
|
737
|
+
item: true,
|
|
738
|
+
xs: true,
|
|
739
|
+
children: jsxRuntime.jsxs(FormControl__default["default"], {
|
|
740
|
+
fullWidth: true,
|
|
741
|
+
required: required,
|
|
742
|
+
children: [jsxRuntime.jsx(InputLabel__default["default"], {
|
|
743
|
+
children: keyLabel
|
|
744
|
+
}), jsxRuntime.jsx(Input__default["default"], {
|
|
745
|
+
defaultValue: label,
|
|
746
|
+
disabled: disabled || readonly,
|
|
747
|
+
id: id + "-key",
|
|
748
|
+
name: id + "-key",
|
|
749
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
750
|
+
type: 'text'
|
|
751
|
+
})]
|
|
752
|
+
})
|
|
753
|
+
}), jsxRuntime.jsx(Grid__default["default"], {
|
|
754
|
+
item: true,
|
|
755
|
+
xs: true,
|
|
756
|
+
children: children
|
|
757
|
+
}), jsxRuntime.jsx(Grid__default["default"], {
|
|
758
|
+
item: true,
|
|
759
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
760
|
+
iconType: 'default',
|
|
761
|
+
style: btnStyle,
|
|
762
|
+
disabled: disabled || readonly,
|
|
763
|
+
onClick: onDropPropertyClick(label),
|
|
764
|
+
uiSchema: uiSchema,
|
|
765
|
+
registry: registry
|
|
766
|
+
})
|
|
767
|
+
})]
|
|
768
|
+
}, id + "-key");
|
|
698
769
|
}
|
|
699
770
|
|
|
700
771
|
function generateTemplates() {
|
|
@@ -704,6 +775,7 @@ function generateTemplates() {
|
|
|
704
775
|
BaseInputTemplate: BaseInputTemplate,
|
|
705
776
|
ButtonTemplates: {
|
|
706
777
|
AddButton: AddButton,
|
|
778
|
+
CopyButton: CopyButton,
|
|
707
779
|
MoveDownButton: MoveDownButton,
|
|
708
780
|
MoveUpButton: MoveUpButton,
|
|
709
781
|
RemoveButton: RemoveButton,
|
|
@@ -752,11 +824,11 @@ function CheckboxWidget(props) {
|
|
|
752
824
|
var value = _ref2.target.value;
|
|
753
825
|
return onFocus(id, value);
|
|
754
826
|
};
|
|
755
|
-
return
|
|
756
|
-
control:
|
|
827
|
+
return jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
828
|
+
control: jsxRuntime.jsx(Checkbox__default["default"], {
|
|
757
829
|
id: id,
|
|
758
830
|
name: id,
|
|
759
|
-
checked: typeof value ===
|
|
831
|
+
checked: typeof value === 'undefined' ? false : Boolean(value),
|
|
760
832
|
required: required,
|
|
761
833
|
disabled: disabled || readonly,
|
|
762
834
|
autoFocus: autofocus,
|
|
@@ -765,7 +837,7 @@ function CheckboxWidget(props) {
|
|
|
765
837
|
onFocus: _onFocus,
|
|
766
838
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
767
839
|
}),
|
|
768
|
-
label: label ||
|
|
840
|
+
label: label || ''
|
|
769
841
|
});
|
|
770
842
|
}
|
|
771
843
|
|
|
@@ -810,73 +882,35 @@ function CheckboxesWidget(_ref) {
|
|
|
810
882
|
var value = _ref4.target.value;
|
|
811
883
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
812
884
|
};
|
|
813
|
-
return
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
* the value to undefined when it is falsy during the `onChange` handling.
|
|
843
|
-
*
|
|
844
|
-
* @param props - The `WidgetProps` for this component
|
|
845
|
-
*/
|
|
846
|
-
function DateWidget(props) {
|
|
847
|
-
var options = props.options,
|
|
848
|
-
registry = props.registry;
|
|
849
|
-
var BaseInputTemplate = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
850
|
-
return /*#__PURE__*/React__default["default"].createElement(BaseInputTemplate, _extends({
|
|
851
|
-
type: "date",
|
|
852
|
-
InputLabelProps: {
|
|
853
|
-
shrink: true
|
|
854
|
-
}
|
|
855
|
-
}, props));
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
859
|
-
* the value to/from utc using the appropriate utility functions.
|
|
860
|
-
*
|
|
861
|
-
* @param props - The `WidgetProps` for this component
|
|
862
|
-
*/
|
|
863
|
-
function DateTimeWidget(props) {
|
|
864
|
-
var options = props.options,
|
|
865
|
-
registry = props.registry;
|
|
866
|
-
var BaseInputTemplate = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
867
|
-
var value = utils.utcToLocal(props.value);
|
|
868
|
-
var onChange = function onChange(value) {
|
|
869
|
-
props.onChange(utils.localToUTC(value));
|
|
870
|
-
};
|
|
871
|
-
return /*#__PURE__*/React__default["default"].createElement(BaseInputTemplate, _extends({
|
|
872
|
-
type: "datetime-local",
|
|
873
|
-
InputLabelProps: {
|
|
874
|
-
shrink: true
|
|
875
|
-
}
|
|
876
|
-
}, props, {
|
|
877
|
-
value: value,
|
|
878
|
-
onChange: onChange
|
|
879
|
-
}));
|
|
885
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
886
|
+
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
887
|
+
required: required,
|
|
888
|
+
htmlFor: id,
|
|
889
|
+
children: label || schema.title
|
|
890
|
+
}), jsxRuntime.jsx(FormGroup__default["default"], {
|
|
891
|
+
id: id,
|
|
892
|
+
row: !!inline,
|
|
893
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
894
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
895
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
896
|
+
var checkbox = jsxRuntime.jsx(Checkbox__default["default"], {
|
|
897
|
+
id: utils.optionId(id, index),
|
|
898
|
+
name: id,
|
|
899
|
+
checked: checked,
|
|
900
|
+
disabled: disabled || itemDisabled || readonly,
|
|
901
|
+
autoFocus: autofocus && index === 0,
|
|
902
|
+
onChange: _onChange(index),
|
|
903
|
+
onBlur: _onBlur,
|
|
904
|
+
onFocus: _onFocus,
|
|
905
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
906
|
+
});
|
|
907
|
+
return jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
908
|
+
control: checkbox,
|
|
909
|
+
label: option.label
|
|
910
|
+
}, index);
|
|
911
|
+
})
|
|
912
|
+
})]
|
|
913
|
+
});
|
|
880
914
|
}
|
|
881
915
|
|
|
882
916
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
@@ -912,33 +946,36 @@ function RadioWidget(_ref) {
|
|
|
912
946
|
};
|
|
913
947
|
var row = options ? options.inline : false;
|
|
914
948
|
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
915
|
-
return
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
949
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
950
|
+
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
951
|
+
required: required,
|
|
952
|
+
htmlFor: id,
|
|
953
|
+
children: label || schema.title
|
|
954
|
+
}), jsxRuntime.jsx(RadioGroup__default["default"], {
|
|
955
|
+
id: id,
|
|
956
|
+
name: id,
|
|
957
|
+
value: selectedIndex,
|
|
958
|
+
row: row,
|
|
959
|
+
onChange: _onChange,
|
|
960
|
+
onBlur: _onBlur,
|
|
961
|
+
onFocus: _onFocus,
|
|
962
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
963
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
964
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
965
|
+
var radio = jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
966
|
+
control: jsxRuntime.jsx(Radio__default["default"], {
|
|
967
|
+
name: id,
|
|
968
|
+
id: utils.optionId(id, index),
|
|
969
|
+
color: 'primary'
|
|
970
|
+
}),
|
|
971
|
+
label: option.label,
|
|
972
|
+
value: String(index),
|
|
973
|
+
disabled: disabled || itemDisabled || readonly
|
|
974
|
+
}, index);
|
|
975
|
+
return radio;
|
|
976
|
+
})
|
|
977
|
+
})]
|
|
978
|
+
});
|
|
942
979
|
}
|
|
943
980
|
|
|
944
981
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -975,21 +1012,24 @@ function RangeWidget(props) {
|
|
|
975
1012
|
var value = _ref2.target.value;
|
|
976
1013
|
return onFocus(id, value);
|
|
977
1014
|
};
|
|
978
|
-
return
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1015
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1016
|
+
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
1017
|
+
required: required,
|
|
1018
|
+
htmlFor: id,
|
|
1019
|
+
children: label || schema.title
|
|
1020
|
+
}), jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
1021
|
+
disabled: disabled || readonly,
|
|
1022
|
+
onChange: _onChange,
|
|
1023
|
+
onBlur: _onBlur,
|
|
1024
|
+
onFocus: _onFocus,
|
|
1025
|
+
valueLabelDisplay: 'auto'
|
|
1026
|
+
}, sliderProps, {
|
|
1027
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1028
|
+
}))]
|
|
1029
|
+
});
|
|
990
1030
|
}
|
|
991
1031
|
|
|
992
|
-
var _excluded = ["schema", "id", "options", "label", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
1032
|
+
var _excluded = ["schema", "id", "name", "options", "label", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
993
1033
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
994
1034
|
* It is typically used with string properties constrained with enum options.
|
|
995
1035
|
*
|
|
@@ -1016,9 +1056,9 @@ function SelectWidget(_ref) {
|
|
|
1016
1056
|
var enumOptions = options.enumOptions,
|
|
1017
1057
|
enumDisabled = options.enumDisabled,
|
|
1018
1058
|
optEmptyVal = options.emptyValue;
|
|
1019
|
-
multiple = typeof multiple ===
|
|
1020
|
-
var emptyValue = multiple ? [] :
|
|
1021
|
-
var isEmpty = typeof value ===
|
|
1059
|
+
multiple = typeof multiple === 'undefined' ? false : !!multiple;
|
|
1060
|
+
var emptyValue = multiple ? [] : '';
|
|
1061
|
+
var isEmpty = typeof value === 'undefined' || multiple && value.length < 1 || !multiple && value === emptyValue;
|
|
1022
1062
|
var _onChange = function _onChange(_ref2) {
|
|
1023
1063
|
var value = _ref2.target.value;
|
|
1024
1064
|
return onChange(utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
@@ -1032,7 +1072,7 @@ function SelectWidget(_ref) {
|
|
|
1032
1072
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1033
1073
|
};
|
|
1034
1074
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1035
|
-
return
|
|
1075
|
+
return jsxRuntime.jsx(TextField__default["default"], _extends({
|
|
1036
1076
|
id: id,
|
|
1037
1077
|
name: id,
|
|
1038
1078
|
label: label || schema.title,
|
|
@@ -1054,16 +1094,17 @@ function SelectWidget(_ref) {
|
|
|
1054
1094
|
SelectProps: _extends({}, textFieldProps.SelectProps, {
|
|
1055
1095
|
multiple: multiple
|
|
1056
1096
|
}),
|
|
1057
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1097
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1098
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (_ref5, i) {
|
|
1099
|
+
var value = _ref5.value,
|
|
1100
|
+
label = _ref5.label;
|
|
1101
|
+
var disabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1;
|
|
1102
|
+
return jsxRuntime.jsx(MenuItem__default["default"], {
|
|
1103
|
+
value: String(i),
|
|
1104
|
+
disabled: disabled,
|
|
1105
|
+
children: label
|
|
1106
|
+
}, i);
|
|
1107
|
+
})
|
|
1067
1108
|
}));
|
|
1068
1109
|
}
|
|
1069
1110
|
|
|
@@ -1074,12 +1115,12 @@ function SelectWidget(_ref) {
|
|
|
1074
1115
|
function TextareaWidget(props) {
|
|
1075
1116
|
var options = props.options,
|
|
1076
1117
|
registry = props.registry;
|
|
1077
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
1118
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
1078
1119
|
var rows = 5;
|
|
1079
|
-
if (typeof options.rows ===
|
|
1120
|
+
if (typeof options.rows === 'string' || typeof options.rows === 'number') {
|
|
1080
1121
|
rows = options.rows;
|
|
1081
1122
|
}
|
|
1082
|
-
return
|
|
1123
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({}, props, {
|
|
1083
1124
|
multiline: true,
|
|
1084
1125
|
rows: rows
|
|
1085
1126
|
}));
|
|
@@ -1089,8 +1130,6 @@ function generateWidgets() {
|
|
|
1089
1130
|
return {
|
|
1090
1131
|
CheckboxWidget: CheckboxWidget,
|
|
1091
1132
|
CheckboxesWidget: CheckboxesWidget,
|
|
1092
|
-
DateWidget: DateWidget,
|
|
1093
|
-
DateTimeWidget: DateTimeWidget,
|
|
1094
1133
|
RadioWidget: RadioWidget,
|
|
1095
1134
|
RangeWidget: RangeWidget,
|
|
1096
1135
|
SelectWidget: SelectWidget,
|