@rjsf/mui 5.2.0 → 5.2.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/LICENSE.md +183 -183
- package/README.md +1 -0
- package/dist/mui.cjs.development.js +414 -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 +415 -397
- package/dist/mui.esm.js.map +1 -1
- package/dist/mui.umd.development.js +417 -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 +5 -5
|
@@ -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');
|
|
@@ -37,7 +37,6 @@ var MenuItem = require('@mui/material/MenuItem');
|
|
|
37
37
|
|
|
38
38
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
39
39
|
|
|
40
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
41
40
|
var AddIcon__default = /*#__PURE__*/_interopDefaultLegacy(AddIcon);
|
|
42
41
|
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
|
43
42
|
var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
|
|
@@ -102,11 +101,12 @@ function AddButton(_ref) {
|
|
|
102
101
|
var registry = _ref.registry,
|
|
103
102
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
104
103
|
var translateString = registry.translateString;
|
|
105
|
-
return
|
|
104
|
+
return jsxRuntime.jsx(IconButton__default["default"], _extends({
|
|
106
105
|
title: translateString(utils.TranslatableString.AddItemButton)
|
|
107
106
|
}, props, {
|
|
108
|
-
color:
|
|
109
|
-
|
|
107
|
+
color: 'primary',
|
|
108
|
+
children: jsxRuntime.jsx(AddIcon__default["default"], {})
|
|
109
|
+
}));
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
@@ -134,45 +134,51 @@ function ArrayFieldItemTemplate(props) {
|
|
|
134
134
|
flex: 1,
|
|
135
135
|
paddingLeft: 6,
|
|
136
136
|
paddingRight: 6,
|
|
137
|
-
fontWeight:
|
|
137
|
+
fontWeight: 'bold',
|
|
138
138
|
minWidth: 0
|
|
139
139
|
};
|
|
140
|
-
return
|
|
140
|
+
return jsxRuntime.jsxs(Grid__default["default"], {
|
|
141
141
|
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
|
-
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
children: [jsxRuntime.jsx(Grid__default["default"], {
|
|
144
|
+
item: true,
|
|
145
|
+
xs: true,
|
|
146
|
+
style: {
|
|
147
|
+
overflow: 'auto'
|
|
148
|
+
},
|
|
149
|
+
children: jsxRuntime.jsx(Box__default["default"], {
|
|
150
|
+
mb: 2,
|
|
151
|
+
children: jsxRuntime.jsx(Paper__default["default"], {
|
|
152
|
+
elevation: 2,
|
|
153
|
+
children: jsxRuntime.jsx(Box__default["default"], {
|
|
154
|
+
p: 2,
|
|
155
|
+
children: children
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
}), hasToolbar && jsxRuntime.jsxs(Grid__default["default"], {
|
|
160
|
+
item: true,
|
|
161
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
162
|
+
style: btnStyle,
|
|
163
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
164
|
+
onClick: onReorderClick(index, index - 1),
|
|
165
|
+
uiSchema: uiSchema,
|
|
166
|
+
registry: registry
|
|
167
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
168
|
+
style: btnStyle,
|
|
169
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
170
|
+
onClick: onReorderClick(index, index + 1),
|
|
171
|
+
uiSchema: uiSchema,
|
|
172
|
+
registry: registry
|
|
173
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
174
|
+
style: btnStyle,
|
|
175
|
+
disabled: disabled || readonly,
|
|
176
|
+
onClick: onDropIndexClick(index),
|
|
177
|
+
uiSchema: uiSchema,
|
|
178
|
+
registry: registry
|
|
179
|
+
})]
|
|
180
|
+
})]
|
|
181
|
+
});
|
|
176
182
|
}
|
|
177
183
|
|
|
178
184
|
var _excluded$3 = ["key"];
|
|
@@ -193,55 +199,59 @@ function ArrayFieldTemplate(props) {
|
|
|
193
199
|
schema = props.schema,
|
|
194
200
|
title = props.title;
|
|
195
201
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
196
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
197
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
198
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
202
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
203
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
204
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
199
205
|
// Button templates are not overridden in the uiSchema
|
|
200
206
|
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
|
-
|
|
207
|
+
return jsxRuntime.jsx(Paper__default["default"], {
|
|
208
|
+
elevation: 2,
|
|
209
|
+
children: jsxRuntime.jsxs(Box__default["default"], {
|
|
210
|
+
p: 2,
|
|
211
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
212
|
+
idSchema: idSchema,
|
|
213
|
+
title: uiOptions.title || title,
|
|
214
|
+
schema: schema,
|
|
215
|
+
uiSchema: uiSchema,
|
|
216
|
+
required: required,
|
|
217
|
+
registry: registry
|
|
218
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
219
|
+
idSchema: idSchema,
|
|
220
|
+
description: uiOptions.description || schema.description,
|
|
221
|
+
schema: schema,
|
|
222
|
+
uiSchema: uiSchema,
|
|
223
|
+
registry: registry
|
|
224
|
+
}), jsxRuntime.jsxs(Grid__default["default"], {
|
|
225
|
+
container: true,
|
|
226
|
+
children: [items && items.map(function (_ref) {
|
|
227
|
+
var key = _ref.key,
|
|
228
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
229
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
230
|
+
}), canAdd && jsxRuntime.jsx(Grid__default["default"], {
|
|
231
|
+
container: true,
|
|
232
|
+
justifyContent: 'flex-end',
|
|
233
|
+
children: jsxRuntime.jsx(Grid__default["default"], {
|
|
234
|
+
item: true,
|
|
235
|
+
children: jsxRuntime.jsx(Box__default["default"], {
|
|
236
|
+
mt: 2,
|
|
237
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
238
|
+
className: 'array-item-add',
|
|
239
|
+
onClick: onAddClick,
|
|
240
|
+
disabled: disabled || readonly,
|
|
241
|
+
uiSchema: uiSchema,
|
|
242
|
+
registry: registry
|
|
243
|
+
})
|
|
244
|
+
})
|
|
245
|
+
})
|
|
246
|
+
})]
|
|
247
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
248
|
+
})
|
|
249
|
+
});
|
|
241
250
|
}
|
|
242
251
|
|
|
243
|
-
var _excluded$2 = ["id", "placeholder", "required", "readonly", "disabled", "type", "label", "value", "onChange", "onBlur", "onFocus", "autofocus", "options", "schema", "uiSchema", "rawErrors", "formContext", "registry"],
|
|
252
|
+
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
253
|
_excluded2$1 = ["step", "min", "max"];
|
|
254
|
+
var TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file'];
|
|
245
255
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
246
256
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
247
257
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -258,6 +268,7 @@ function BaseInputTemplate(props) {
|
|
|
258
268
|
label = props.label,
|
|
259
269
|
value = props.value,
|
|
260
270
|
onChange = props.onChange,
|
|
271
|
+
onChangeOverride = props.onChangeOverride,
|
|
261
272
|
onBlur = props.onBlur,
|
|
262
273
|
onFocus = props.onFocus,
|
|
263
274
|
autofocus = props.autofocus,
|
|
@@ -267,6 +278,7 @@ function BaseInputTemplate(props) {
|
|
|
267
278
|
_props$rawErrors = props.rawErrors,
|
|
268
279
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
269
280
|
registry = props.registry,
|
|
281
|
+
InputLabelProps = props.InputLabelProps,
|
|
270
282
|
textFieldProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
271
283
|
var inputProps = utils.getInputProps(schema, type, options);
|
|
272
284
|
// Now we need to pull out the step, min, max into an inner `inputProps` for material-ui
|
|
@@ -285,7 +297,7 @@ function BaseInputTemplate(props) {
|
|
|
285
297
|
}, rest);
|
|
286
298
|
var _onChange = function _onChange(_ref) {
|
|
287
299
|
var value = _ref.target.value;
|
|
288
|
-
return onChange(value ===
|
|
300
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
289
301
|
};
|
|
290
302
|
var _onBlur = function _onBlur(_ref2) {
|
|
291
303
|
var value = _ref2.target.value;
|
|
@@ -297,30 +309,36 @@ function BaseInputTemplate(props) {
|
|
|
297
309
|
};
|
|
298
310
|
var schemaUtils = registry.schemaUtils;
|
|
299
311
|
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
|
-
|
|
312
|
+
var DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? _extends({}, InputLabelProps, {
|
|
313
|
+
shrink: true
|
|
314
|
+
}) : InputLabelProps;
|
|
315
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
316
|
+
children: [jsxRuntime.jsx(TextField__default["default"], _extends({
|
|
317
|
+
id: id,
|
|
318
|
+
name: id,
|
|
319
|
+
placeholder: placeholder,
|
|
320
|
+
label: displayLabel ? label || schema.title : false,
|
|
321
|
+
autoFocus: autofocus,
|
|
322
|
+
required: required,
|
|
323
|
+
disabled: disabled || readonly
|
|
324
|
+
}, otherProps, {
|
|
325
|
+
value: value || value === 0 ? value : '',
|
|
326
|
+
error: rawErrors.length > 0,
|
|
327
|
+
onChange: onChangeOverride || _onChange,
|
|
328
|
+
onBlur: _onBlur,
|
|
329
|
+
onFocus: _onFocus,
|
|
330
|
+
InputLabelProps: DisplayInputLabelProps
|
|
331
|
+
}, textFieldProps, {
|
|
332
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
333
|
+
})), Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
334
|
+
id: utils.examplesId(id),
|
|
335
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
336
|
+
return jsxRuntime.jsx("option", {
|
|
337
|
+
value: example
|
|
338
|
+
}, example);
|
|
339
|
+
})
|
|
340
|
+
})]
|
|
341
|
+
});
|
|
324
342
|
}
|
|
325
343
|
|
|
326
344
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -331,13 +349,14 @@ function DescriptionField(props) {
|
|
|
331
349
|
var id = props.id,
|
|
332
350
|
description = props.description;
|
|
333
351
|
if (description) {
|
|
334
|
-
return
|
|
352
|
+
return jsxRuntime.jsx(Typography__default["default"], {
|
|
335
353
|
id: id,
|
|
336
|
-
variant:
|
|
354
|
+
variant: 'subtitle2',
|
|
337
355
|
style: {
|
|
338
|
-
marginTop:
|
|
339
|
-
}
|
|
340
|
-
|
|
356
|
+
marginTop: '5px'
|
|
357
|
+
},
|
|
358
|
+
children: description
|
|
359
|
+
});
|
|
341
360
|
}
|
|
342
361
|
return null;
|
|
343
362
|
}
|
|
@@ -350,24 +369,30 @@ function ErrorList(_ref) {
|
|
|
350
369
|
var errors = _ref.errors,
|
|
351
370
|
registry = _ref.registry;
|
|
352
371
|
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
|
-
|
|
372
|
+
return jsxRuntime.jsx(Paper__default["default"], {
|
|
373
|
+
elevation: 2,
|
|
374
|
+
children: jsxRuntime.jsxs(Box__default["default"], {
|
|
375
|
+
mb: 2,
|
|
376
|
+
p: 2,
|
|
377
|
+
children: [jsxRuntime.jsx(Typography__default["default"], {
|
|
378
|
+
variant: 'h6',
|
|
379
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
380
|
+
}), jsxRuntime.jsx(List__default["default"], {
|
|
381
|
+
dense: true,
|
|
382
|
+
children: errors.map(function (error, i) {
|
|
383
|
+
return jsxRuntime.jsxs(ListItem__default["default"], {
|
|
384
|
+
children: [jsxRuntime.jsx(ListItemIcon__default["default"], {
|
|
385
|
+
children: jsxRuntime.jsx(ErrorIcon__default["default"], {
|
|
386
|
+
color: 'error'
|
|
387
|
+
})
|
|
388
|
+
}), jsxRuntime.jsx(ListItemText__default["default"], {
|
|
389
|
+
primary: error.stack
|
|
390
|
+
})]
|
|
391
|
+
}, i);
|
|
392
|
+
})
|
|
393
|
+
})]
|
|
394
|
+
})
|
|
395
|
+
});
|
|
371
396
|
}
|
|
372
397
|
|
|
373
398
|
var _excluded$1 = ["icon", "color", "uiSchema", "registry"],
|
|
@@ -376,28 +401,29 @@ function MuiIconButton(props) {
|
|
|
376
401
|
var icon = props.icon,
|
|
377
402
|
color = props.color,
|
|
378
403
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
379
|
-
return
|
|
380
|
-
size:
|
|
381
|
-
color: color
|
|
382
|
-
|
|
404
|
+
return jsxRuntime.jsx(IconButton__default["default"], _extends({}, otherProps, {
|
|
405
|
+
size: 'small',
|
|
406
|
+
color: color,
|
|
407
|
+
children: icon
|
|
408
|
+
}));
|
|
383
409
|
}
|
|
384
410
|
function MoveDownButton(props) {
|
|
385
411
|
var translateString = props.registry.translateString;
|
|
386
|
-
return
|
|
412
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
387
413
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
388
414
|
}, props, {
|
|
389
|
-
icon:
|
|
390
|
-
fontSize:
|
|
415
|
+
icon: jsxRuntime.jsx(ArrowDownwardIcon__default["default"], {
|
|
416
|
+
fontSize: 'small'
|
|
391
417
|
})
|
|
392
418
|
}));
|
|
393
419
|
}
|
|
394
420
|
function MoveUpButton(props) {
|
|
395
421
|
var translateString = props.registry.translateString;
|
|
396
|
-
return
|
|
422
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
397
423
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
398
424
|
}, props, {
|
|
399
|
-
icon:
|
|
400
|
-
fontSize:
|
|
425
|
+
icon: jsxRuntime.jsx(ArrowUpwardIcon__default["default"], {
|
|
426
|
+
fontSize: 'small'
|
|
401
427
|
})
|
|
402
428
|
}));
|
|
403
429
|
}
|
|
@@ -405,12 +431,12 @@ function RemoveButton(props) {
|
|
|
405
431
|
var iconType = props.iconType,
|
|
406
432
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
407
433
|
var translateString = otherProps.registry.translateString;
|
|
408
|
-
return
|
|
434
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
409
435
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
410
436
|
}, otherProps, {
|
|
411
|
-
color:
|
|
412
|
-
icon:
|
|
413
|
-
fontSize: iconType ===
|
|
437
|
+
color: 'error',
|
|
438
|
+
icon: jsxRuntime.jsx(RemoveIcon__default["default"], {
|
|
439
|
+
fontSize: iconType === 'default' ? undefined : 'small'
|
|
414
440
|
})
|
|
415
441
|
}));
|
|
416
442
|
}
|
|
@@ -427,17 +453,19 @@ function FieldErrorTemplate(props) {
|
|
|
427
453
|
return null;
|
|
428
454
|
}
|
|
429
455
|
var id = utils.errorId(idSchema);
|
|
430
|
-
return
|
|
456
|
+
return jsxRuntime.jsx(List__default["default"], {
|
|
431
457
|
dense: true,
|
|
432
|
-
disablePadding: true
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
458
|
+
disablePadding: true,
|
|
459
|
+
children: errors.map(function (error, i) {
|
|
460
|
+
return jsxRuntime.jsx(ListItem__default["default"], {
|
|
461
|
+
disableGutters: true,
|
|
462
|
+
children: jsxRuntime.jsx(FormHelperText__default["default"], {
|
|
463
|
+
id: id,
|
|
464
|
+
children: error
|
|
465
|
+
})
|
|
466
|
+
}, i);
|
|
467
|
+
})
|
|
468
|
+
});
|
|
441
469
|
}
|
|
442
470
|
|
|
443
471
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -451,9 +479,10 @@ function FieldHelpTemplate(props) {
|
|
|
451
479
|
return null;
|
|
452
480
|
}
|
|
453
481
|
var id = utils.helpId(idSchema);
|
|
454
|
-
return
|
|
455
|
-
id: id
|
|
456
|
-
|
|
482
|
+
return jsxRuntime.jsx(FormHelperText__default["default"], {
|
|
483
|
+
id: id,
|
|
484
|
+
children: help
|
|
485
|
+
});
|
|
457
486
|
}
|
|
458
487
|
|
|
459
488
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -483,15 +512,16 @@ function FieldTemplate(props) {
|
|
|
483
512
|
uiSchema = props.uiSchema,
|
|
484
513
|
registry = props.registry;
|
|
485
514
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
486
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
515
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
487
516
|
if (hidden) {
|
|
488
|
-
return
|
|
517
|
+
return jsxRuntime.jsx("div", {
|
|
489
518
|
style: {
|
|
490
|
-
display:
|
|
491
|
-
}
|
|
492
|
-
|
|
519
|
+
display: 'none'
|
|
520
|
+
},
|
|
521
|
+
children: children
|
|
522
|
+
});
|
|
493
523
|
}
|
|
494
|
-
return
|
|
524
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
495
525
|
classNames: classNames,
|
|
496
526
|
style: style,
|
|
497
527
|
disabled: disabled,
|
|
@@ -503,15 +533,18 @@ function FieldTemplate(props) {
|
|
|
503
533
|
required: required,
|
|
504
534
|
schema: schema,
|
|
505
535
|
uiSchema: uiSchema,
|
|
506
|
-
registry: registry
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
536
|
+
registry: registry,
|
|
537
|
+
children: jsxRuntime.jsxs(FormControl__default["default"], {
|
|
538
|
+
fullWidth: true,
|
|
539
|
+
error: rawErrors.length ? true : false,
|
|
540
|
+
required: required,
|
|
541
|
+
children: [children, displayLabel && rawDescription ? jsxRuntime.jsx(Typography__default["default"], {
|
|
542
|
+
variant: 'caption',
|
|
543
|
+
color: 'textSecondary',
|
|
544
|
+
children: rawDescription
|
|
545
|
+
}) : null, errors, help]
|
|
546
|
+
})
|
|
547
|
+
});
|
|
515
548
|
}
|
|
516
549
|
|
|
517
550
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -534,54 +567,59 @@ function ObjectFieldTemplate(props) {
|
|
|
534
567
|
onAddClick = props.onAddClick,
|
|
535
568
|
registry = props.registry;
|
|
536
569
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
537
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
538
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
570
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
571
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
539
572
|
// Button templates are not overridden in the uiSchema
|
|
540
573
|
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
|
-
|
|
574
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
575
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
576
|
+
id: utils.titleId(idSchema),
|
|
577
|
+
title: title,
|
|
578
|
+
required: required,
|
|
579
|
+
schema: schema,
|
|
580
|
+
uiSchema: uiSchema,
|
|
581
|
+
registry: registry
|
|
582
|
+
}), (uiOptions.description || description) && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
583
|
+
id: utils.descriptionId(idSchema),
|
|
584
|
+
description: uiOptions.description || description,
|
|
585
|
+
schema: schema,
|
|
586
|
+
uiSchema: uiSchema,
|
|
587
|
+
registry: registry
|
|
588
|
+
}), jsxRuntime.jsxs(Grid__default["default"], {
|
|
589
|
+
container: true,
|
|
590
|
+
spacing: 2,
|
|
591
|
+
style: {
|
|
592
|
+
marginTop: '10px'
|
|
593
|
+
},
|
|
594
|
+
children: [properties.map(function (element, index) {
|
|
595
|
+
return (
|
|
596
|
+
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
597
|
+
// itself would otherwise still take up space.
|
|
598
|
+
element.hidden ? element.content : jsxRuntime.jsx(Grid__default["default"], {
|
|
599
|
+
item: true,
|
|
600
|
+
xs: 12,
|
|
601
|
+
style: {
|
|
602
|
+
marginBottom: '10px'
|
|
603
|
+
},
|
|
604
|
+
children: element.content
|
|
605
|
+
}, index)
|
|
606
|
+
);
|
|
607
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(Grid__default["default"], {
|
|
608
|
+
container: true,
|
|
609
|
+
justifyContent: 'flex-end',
|
|
610
|
+
children: jsxRuntime.jsx(Grid__default["default"], {
|
|
611
|
+
item: true,
|
|
612
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
613
|
+
className: 'object-property-expand',
|
|
614
|
+
onClick: onAddClick(schema),
|
|
615
|
+
disabled: disabled || readonly,
|
|
616
|
+
uiSchema: uiSchema,
|
|
617
|
+
registry: registry
|
|
618
|
+
})
|
|
619
|
+
})
|
|
620
|
+
})]
|
|
621
|
+
})]
|
|
622
|
+
});
|
|
585
623
|
}
|
|
586
624
|
|
|
587
625
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -596,13 +634,16 @@ function SubmitButton(_ref) {
|
|
|
596
634
|
if (norender) {
|
|
597
635
|
return null;
|
|
598
636
|
}
|
|
599
|
-
return
|
|
600
|
-
marginTop: 3
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
637
|
+
return jsxRuntime.jsx(Box__default["default"], {
|
|
638
|
+
marginTop: 3,
|
|
639
|
+
children: jsxRuntime.jsx(Button__default["default"], _extends({
|
|
640
|
+
type: 'submit',
|
|
641
|
+
variant: 'contained',
|
|
642
|
+
color: 'primary'
|
|
643
|
+
}, submitButtonProps, {
|
|
644
|
+
children: submitText
|
|
645
|
+
}))
|
|
646
|
+
});
|
|
606
647
|
}
|
|
607
648
|
|
|
608
649
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -612,13 +653,15 @@ function SubmitButton(_ref) {
|
|
|
612
653
|
function TitleField(_ref) {
|
|
613
654
|
var id = _ref.id,
|
|
614
655
|
title = _ref.title;
|
|
615
|
-
return
|
|
656
|
+
return jsxRuntime.jsxs(Box__default["default"], {
|
|
616
657
|
id: id,
|
|
617
658
|
mb: 1,
|
|
618
|
-
mt: 1
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
659
|
+
mt: 1,
|
|
660
|
+
children: [jsxRuntime.jsx(Typography__default["default"], {
|
|
661
|
+
variant: 'h5',
|
|
662
|
+
children: title
|
|
663
|
+
}), jsxRuntime.jsx(Divider__default["default"], {})]
|
|
664
|
+
});
|
|
622
665
|
}
|
|
623
666
|
|
|
624
667
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -650,51 +693,58 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
650
693
|
flex: 1,
|
|
651
694
|
paddingLeft: 6,
|
|
652
695
|
paddingRight: 6,
|
|
653
|
-
fontWeight:
|
|
696
|
+
fontWeight: 'bold'
|
|
654
697
|
};
|
|
655
698
|
if (!additional) {
|
|
656
|
-
return
|
|
699
|
+
return jsxRuntime.jsx("div", {
|
|
657
700
|
className: classNames,
|
|
658
|
-
style: style
|
|
659
|
-
|
|
701
|
+
style: style,
|
|
702
|
+
children: children
|
|
703
|
+
});
|
|
660
704
|
}
|
|
661
705
|
var handleBlur = function handleBlur(_ref) {
|
|
662
706
|
var target = _ref.target;
|
|
663
707
|
return onKeyChange(target.value);
|
|
664
708
|
};
|
|
665
|
-
return
|
|
709
|
+
return jsxRuntime.jsxs(Grid__default["default"], {
|
|
666
710
|
container: true,
|
|
667
|
-
|
|
668
|
-
alignItems: "center",
|
|
711
|
+
alignItems: 'center',
|
|
669
712
|
spacing: 2,
|
|
670
713
|
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
|
-
|
|
714
|
+
style: style,
|
|
715
|
+
children: [jsxRuntime.jsx(Grid__default["default"], {
|
|
716
|
+
item: true,
|
|
717
|
+
xs: true,
|
|
718
|
+
children: jsxRuntime.jsxs(FormControl__default["default"], {
|
|
719
|
+
fullWidth: true,
|
|
720
|
+
required: required,
|
|
721
|
+
children: [jsxRuntime.jsx(InputLabel__default["default"], {
|
|
722
|
+
children: keyLabel
|
|
723
|
+
}), jsxRuntime.jsx(Input__default["default"], {
|
|
724
|
+
defaultValue: label,
|
|
725
|
+
disabled: disabled || readonly,
|
|
726
|
+
id: id + "-key",
|
|
727
|
+
name: id + "-key",
|
|
728
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
729
|
+
type: 'text'
|
|
730
|
+
})]
|
|
731
|
+
})
|
|
732
|
+
}), jsxRuntime.jsx(Grid__default["default"], {
|
|
733
|
+
item: true,
|
|
734
|
+
xs: true,
|
|
735
|
+
children: children
|
|
736
|
+
}), jsxRuntime.jsx(Grid__default["default"], {
|
|
737
|
+
item: true,
|
|
738
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
739
|
+
iconType: 'default',
|
|
740
|
+
style: btnStyle,
|
|
741
|
+
disabled: disabled || readonly,
|
|
742
|
+
onClick: onDropPropertyClick(label),
|
|
743
|
+
uiSchema: uiSchema,
|
|
744
|
+
registry: registry
|
|
745
|
+
})
|
|
746
|
+
})]
|
|
747
|
+
}, id + "-key");
|
|
698
748
|
}
|
|
699
749
|
|
|
700
750
|
function generateTemplates() {
|
|
@@ -752,11 +802,11 @@ function CheckboxWidget(props) {
|
|
|
752
802
|
var value = _ref2.target.value;
|
|
753
803
|
return onFocus(id, value);
|
|
754
804
|
};
|
|
755
|
-
return
|
|
756
|
-
control:
|
|
805
|
+
return jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
806
|
+
control: jsxRuntime.jsx(Checkbox__default["default"], {
|
|
757
807
|
id: id,
|
|
758
808
|
name: id,
|
|
759
|
-
checked: typeof value ===
|
|
809
|
+
checked: typeof value === 'undefined' ? false : Boolean(value),
|
|
760
810
|
required: required,
|
|
761
811
|
disabled: disabled || readonly,
|
|
762
812
|
autoFocus: autofocus,
|
|
@@ -765,7 +815,7 @@ function CheckboxWidget(props) {
|
|
|
765
815
|
onFocus: _onFocus,
|
|
766
816
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
767
817
|
}),
|
|
768
|
-
label: label ||
|
|
818
|
+
label: label || ''
|
|
769
819
|
});
|
|
770
820
|
}
|
|
771
821
|
|
|
@@ -810,73 +860,35 @@ function CheckboxesWidget(_ref) {
|
|
|
810
860
|
var value = _ref4.target.value;
|
|
811
861
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
812
862
|
};
|
|
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
|
-
}));
|
|
863
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
864
|
+
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
865
|
+
required: required,
|
|
866
|
+
htmlFor: id,
|
|
867
|
+
children: label || schema.title
|
|
868
|
+
}), jsxRuntime.jsx(FormGroup__default["default"], {
|
|
869
|
+
id: id,
|
|
870
|
+
row: !!inline,
|
|
871
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
872
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
873
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
874
|
+
var checkbox = jsxRuntime.jsx(Checkbox__default["default"], {
|
|
875
|
+
id: utils.optionId(id, index),
|
|
876
|
+
name: id,
|
|
877
|
+
checked: checked,
|
|
878
|
+
disabled: disabled || itemDisabled || readonly,
|
|
879
|
+
autoFocus: autofocus && index === 0,
|
|
880
|
+
onChange: _onChange(index),
|
|
881
|
+
onBlur: _onBlur,
|
|
882
|
+
onFocus: _onFocus,
|
|
883
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
884
|
+
});
|
|
885
|
+
return jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
886
|
+
control: checkbox,
|
|
887
|
+
label: option.label
|
|
888
|
+
}, index);
|
|
889
|
+
})
|
|
890
|
+
})]
|
|
891
|
+
});
|
|
880
892
|
}
|
|
881
893
|
|
|
882
894
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
@@ -912,33 +924,36 @@ function RadioWidget(_ref) {
|
|
|
912
924
|
};
|
|
913
925
|
var row = options ? options.inline : false;
|
|
914
926
|
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
|
-
|
|
927
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
928
|
+
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
929
|
+
required: required,
|
|
930
|
+
htmlFor: id,
|
|
931
|
+
children: label || schema.title
|
|
932
|
+
}), jsxRuntime.jsx(RadioGroup__default["default"], {
|
|
933
|
+
id: id,
|
|
934
|
+
name: id,
|
|
935
|
+
value: selectedIndex,
|
|
936
|
+
row: row,
|
|
937
|
+
onChange: _onChange,
|
|
938
|
+
onBlur: _onBlur,
|
|
939
|
+
onFocus: _onFocus,
|
|
940
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
941
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
942
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
943
|
+
var radio = jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
944
|
+
control: jsxRuntime.jsx(Radio__default["default"], {
|
|
945
|
+
name: id,
|
|
946
|
+
id: utils.optionId(id, index),
|
|
947
|
+
color: 'primary'
|
|
948
|
+
}),
|
|
949
|
+
label: option.label,
|
|
950
|
+
value: String(index),
|
|
951
|
+
disabled: disabled || itemDisabled || readonly
|
|
952
|
+
}, index);
|
|
953
|
+
return radio;
|
|
954
|
+
})
|
|
955
|
+
})]
|
|
956
|
+
});
|
|
942
957
|
}
|
|
943
958
|
|
|
944
959
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -975,21 +990,24 @@ function RangeWidget(props) {
|
|
|
975
990
|
var value = _ref2.target.value;
|
|
976
991
|
return onFocus(id, value);
|
|
977
992
|
};
|
|
978
|
-
return
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
993
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
994
|
+
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
995
|
+
required: required,
|
|
996
|
+
htmlFor: id,
|
|
997
|
+
children: label || schema.title
|
|
998
|
+
}), jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
999
|
+
disabled: disabled || readonly,
|
|
1000
|
+
onChange: _onChange,
|
|
1001
|
+
onBlur: _onBlur,
|
|
1002
|
+
onFocus: _onFocus,
|
|
1003
|
+
valueLabelDisplay: 'auto'
|
|
1004
|
+
}, sliderProps, {
|
|
1005
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1006
|
+
}))]
|
|
1007
|
+
});
|
|
990
1008
|
}
|
|
991
1009
|
|
|
992
|
-
var _excluded = ["schema", "id", "options", "label", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
1010
|
+
var _excluded = ["schema", "id", "name", "options", "label", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
993
1011
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
994
1012
|
* It is typically used with string properties constrained with enum options.
|
|
995
1013
|
*
|
|
@@ -1016,9 +1034,9 @@ function SelectWidget(_ref) {
|
|
|
1016
1034
|
var enumOptions = options.enumOptions,
|
|
1017
1035
|
enumDisabled = options.enumDisabled,
|
|
1018
1036
|
optEmptyVal = options.emptyValue;
|
|
1019
|
-
multiple = typeof multiple ===
|
|
1020
|
-
var emptyValue = multiple ? [] :
|
|
1021
|
-
var isEmpty = typeof value ===
|
|
1037
|
+
multiple = typeof multiple === 'undefined' ? false : !!multiple;
|
|
1038
|
+
var emptyValue = multiple ? [] : '';
|
|
1039
|
+
var isEmpty = typeof value === 'undefined' || multiple && value.length < 1 || !multiple && value === emptyValue;
|
|
1022
1040
|
var _onChange = function _onChange(_ref2) {
|
|
1023
1041
|
var value = _ref2.target.value;
|
|
1024
1042
|
return onChange(utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
@@ -1032,7 +1050,7 @@ function SelectWidget(_ref) {
|
|
|
1032
1050
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1033
1051
|
};
|
|
1034
1052
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1035
|
-
return
|
|
1053
|
+
return jsxRuntime.jsx(TextField__default["default"], _extends({
|
|
1036
1054
|
id: id,
|
|
1037
1055
|
name: id,
|
|
1038
1056
|
label: label || schema.title,
|
|
@@ -1054,16 +1072,17 @@ function SelectWidget(_ref) {
|
|
|
1054
1072
|
SelectProps: _extends({}, textFieldProps.SelectProps, {
|
|
1055
1073
|
multiple: multiple
|
|
1056
1074
|
}),
|
|
1057
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1075
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1076
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (_ref5, i) {
|
|
1077
|
+
var value = _ref5.value,
|
|
1078
|
+
label = _ref5.label;
|
|
1079
|
+
var disabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1;
|
|
1080
|
+
return jsxRuntime.jsx(MenuItem__default["default"], {
|
|
1081
|
+
value: String(i),
|
|
1082
|
+
disabled: disabled,
|
|
1083
|
+
children: label
|
|
1084
|
+
}, i);
|
|
1085
|
+
})
|
|
1067
1086
|
}));
|
|
1068
1087
|
}
|
|
1069
1088
|
|
|
@@ -1074,12 +1093,12 @@ function SelectWidget(_ref) {
|
|
|
1074
1093
|
function TextareaWidget(props) {
|
|
1075
1094
|
var options = props.options,
|
|
1076
1095
|
registry = props.registry;
|
|
1077
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
1096
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
1078
1097
|
var rows = 5;
|
|
1079
|
-
if (typeof options.rows ===
|
|
1098
|
+
if (typeof options.rows === 'string' || typeof options.rows === 'number') {
|
|
1080
1099
|
rows = options.rows;
|
|
1081
1100
|
}
|
|
1082
|
-
return
|
|
1101
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({}, props, {
|
|
1083
1102
|
multiline: true,
|
|
1084
1103
|
rows: rows
|
|
1085
1104
|
}));
|
|
@@ -1089,8 +1108,6 @@ function generateWidgets() {
|
|
|
1089
1108
|
return {
|
|
1090
1109
|
CheckboxWidget: CheckboxWidget,
|
|
1091
1110
|
CheckboxesWidget: CheckboxesWidget,
|
|
1092
|
-
DateWidget: DateWidget,
|
|
1093
|
-
DateTimeWidget: DateTimeWidget,
|
|
1094
1111
|
RadioWidget: RadioWidget,
|
|
1095
1112
|
RangeWidget: RangeWidget,
|
|
1096
1113
|
SelectWidget: SelectWidget,
|