@rjsf/mui 5.1.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 +433 -407
- 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 +433 -406
- package/dist/mui.esm.js.map +1 -1
- package/dist/mui.umd.development.js +435 -409
- 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
package/dist/mui.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { withTheme } from '@rjsf/core';
|
|
2
|
-
import
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import AddIcon from '@mui/icons-material/Add';
|
|
4
4
|
import IconButton from '@mui/material/IconButton';
|
|
5
|
+
import { TranslatableString, getUiOptions, getTemplate, getInputProps, examplesId, ariaDescribedByIds, errorId, helpId, titleId, descriptionId, canExpand, getSubmitButtonOptions, ADDITIONAL_PROPERTY_FLAG, schemaRequiresTrueValue, enumOptionsIsSelected, optionId, enumOptionsSelectValue, enumOptionsDeselectValue, enumOptionsValueForIndex, enumOptionsIndexForValue, rangeSpec } from '@rjsf/utils';
|
|
5
6
|
import Box from '@mui/material/Box';
|
|
6
7
|
import Grid from '@mui/material/Grid';
|
|
7
8
|
import Paper from '@mui/material/Paper';
|
|
8
|
-
import { getUiOptions, getTemplate, getInputProps, examplesId, ariaDescribedByIds, errorId, helpId, titleId, descriptionId, canExpand, getSubmitButtonOptions, ADDITIONAL_PROPERTY_FLAG, schemaRequiresTrueValue, enumOptionsIsSelected, optionId, enumOptionsSelectValue, enumOptionsDeselectValue, enumOptionsValueForIndex, utcToLocal, localToUTC, enumOptionsIndexForValue, rangeSpec } from '@rjsf/utils';
|
|
9
9
|
import TextField from '@mui/material/TextField';
|
|
10
10
|
import Typography from '@mui/material/Typography';
|
|
11
11
|
import ErrorIcon from '@mui/icons-material/Error';
|
|
@@ -62,12 +62,15 @@ var _excluded$4 = ["uiSchema", "registry"];
|
|
|
62
62
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
63
63
|
*/
|
|
64
64
|
function AddButton(_ref) {
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
var registry = _ref.registry,
|
|
66
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
67
|
+
var translateString = registry.translateString;
|
|
68
|
+
return jsx(IconButton, _extends({
|
|
69
|
+
title: translateString(TranslatableString.AddItemButton)
|
|
68
70
|
}, props, {
|
|
69
|
-
color:
|
|
70
|
-
|
|
71
|
+
color: 'primary',
|
|
72
|
+
children: jsx(AddIcon, {})
|
|
73
|
+
}));
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
@@ -95,45 +98,51 @@ function ArrayFieldItemTemplate(props) {
|
|
|
95
98
|
flex: 1,
|
|
96
99
|
paddingLeft: 6,
|
|
97
100
|
paddingRight: 6,
|
|
98
|
-
fontWeight:
|
|
101
|
+
fontWeight: 'bold',
|
|
99
102
|
minWidth: 0
|
|
100
103
|
};
|
|
101
|
-
return
|
|
104
|
+
return jsxs(Grid, {
|
|
102
105
|
container: true,
|
|
103
|
-
alignItems:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
children: [jsx(Grid, {
|
|
108
|
+
item: true,
|
|
109
|
+
xs: true,
|
|
110
|
+
style: {
|
|
111
|
+
overflow: 'auto'
|
|
112
|
+
},
|
|
113
|
+
children: jsx(Box, {
|
|
114
|
+
mb: 2,
|
|
115
|
+
children: jsx(Paper, {
|
|
116
|
+
elevation: 2,
|
|
117
|
+
children: jsx(Box, {
|
|
118
|
+
p: 2,
|
|
119
|
+
children: children
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
}), hasToolbar && jsxs(Grid, {
|
|
124
|
+
item: true,
|
|
125
|
+
children: [(hasMoveUp || hasMoveDown) && jsx(MoveUpButton, {
|
|
126
|
+
style: btnStyle,
|
|
127
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
128
|
+
onClick: onReorderClick(index, index - 1),
|
|
129
|
+
uiSchema: uiSchema,
|
|
130
|
+
registry: registry
|
|
131
|
+
}), (hasMoveUp || hasMoveDown) && jsx(MoveDownButton, {
|
|
132
|
+
style: btnStyle,
|
|
133
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
134
|
+
onClick: onReorderClick(index, index + 1),
|
|
135
|
+
uiSchema: uiSchema,
|
|
136
|
+
registry: registry
|
|
137
|
+
}), hasRemove && jsx(RemoveButton, {
|
|
138
|
+
style: btnStyle,
|
|
139
|
+
disabled: disabled || readonly,
|
|
140
|
+
onClick: onDropIndexClick(index),
|
|
141
|
+
uiSchema: uiSchema,
|
|
142
|
+
registry: registry
|
|
143
|
+
})]
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
var _excluded$3 = ["key"];
|
|
@@ -154,55 +163,59 @@ function ArrayFieldTemplate(props) {
|
|
|
154
163
|
schema = props.schema,
|
|
155
164
|
title = props.title;
|
|
156
165
|
var uiOptions = getUiOptions(uiSchema);
|
|
157
|
-
var ArrayFieldDescriptionTemplate = getTemplate(
|
|
158
|
-
var ArrayFieldItemTemplate = getTemplate(
|
|
159
|
-
var ArrayFieldTitleTemplate = getTemplate(
|
|
166
|
+
var ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
167
|
+
var ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
168
|
+
var ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
160
169
|
// Button templates are not overridden in the uiSchema
|
|
161
170
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
162
|
-
return
|
|
163
|
-
elevation: 2
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
171
|
+
return jsx(Paper, {
|
|
172
|
+
elevation: 2,
|
|
173
|
+
children: jsxs(Box, {
|
|
174
|
+
p: 2,
|
|
175
|
+
children: [jsx(ArrayFieldTitleTemplate, {
|
|
176
|
+
idSchema: idSchema,
|
|
177
|
+
title: uiOptions.title || title,
|
|
178
|
+
schema: schema,
|
|
179
|
+
uiSchema: uiSchema,
|
|
180
|
+
required: required,
|
|
181
|
+
registry: registry
|
|
182
|
+
}), jsx(ArrayFieldDescriptionTemplate, {
|
|
183
|
+
idSchema: idSchema,
|
|
184
|
+
description: uiOptions.description || schema.description,
|
|
185
|
+
schema: schema,
|
|
186
|
+
uiSchema: uiSchema,
|
|
187
|
+
registry: registry
|
|
188
|
+
}), jsxs(Grid, {
|
|
189
|
+
container: true,
|
|
190
|
+
children: [items && items.map(function (_ref) {
|
|
191
|
+
var key = _ref.key,
|
|
192
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
193
|
+
return jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
194
|
+
}), canAdd && jsx(Grid, {
|
|
195
|
+
container: true,
|
|
196
|
+
justifyContent: 'flex-end',
|
|
197
|
+
children: jsx(Grid, {
|
|
198
|
+
item: true,
|
|
199
|
+
children: jsx(Box, {
|
|
200
|
+
mt: 2,
|
|
201
|
+
children: jsx(AddButton, {
|
|
202
|
+
className: 'array-item-add',
|
|
203
|
+
onClick: onAddClick,
|
|
204
|
+
disabled: disabled || readonly,
|
|
205
|
+
uiSchema: uiSchema,
|
|
206
|
+
registry: registry
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
})]
|
|
211
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
212
|
+
})
|
|
213
|
+
});
|
|
202
214
|
}
|
|
203
215
|
|
|
204
|
-
var _excluded$2 = ["id", "placeholder", "required", "readonly", "disabled", "type", "label", "value", "onChange", "onBlur", "onFocus", "autofocus", "options", "schema", "uiSchema", "rawErrors", "formContext", "registry"],
|
|
216
|
+
var _excluded$2 = ["id", "name", "placeholder", "required", "readonly", "disabled", "type", "label", "value", "onChange", "onChangeOverride", "onBlur", "onFocus", "autofocus", "options", "schema", "uiSchema", "rawErrors", "formContext", "registry", "InputLabelProps"],
|
|
205
217
|
_excluded2$1 = ["step", "min", "max"];
|
|
218
|
+
var TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file'];
|
|
206
219
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
207
220
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
208
221
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -219,6 +232,7 @@ function BaseInputTemplate(props) {
|
|
|
219
232
|
label = props.label,
|
|
220
233
|
value = props.value,
|
|
221
234
|
onChange = props.onChange,
|
|
235
|
+
onChangeOverride = props.onChangeOverride,
|
|
222
236
|
onBlur = props.onBlur,
|
|
223
237
|
onFocus = props.onFocus,
|
|
224
238
|
autofocus = props.autofocus,
|
|
@@ -228,6 +242,7 @@ function BaseInputTemplate(props) {
|
|
|
228
242
|
_props$rawErrors = props.rawErrors,
|
|
229
243
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
230
244
|
registry = props.registry,
|
|
245
|
+
InputLabelProps = props.InputLabelProps,
|
|
231
246
|
textFieldProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
232
247
|
var inputProps = getInputProps(schema, type, options);
|
|
233
248
|
// Now we need to pull out the step, min, max into an inner `inputProps` for material-ui
|
|
@@ -246,7 +261,7 @@ function BaseInputTemplate(props) {
|
|
|
246
261
|
}, rest);
|
|
247
262
|
var _onChange = function _onChange(_ref) {
|
|
248
263
|
var value = _ref.target.value;
|
|
249
|
-
return onChange(value ===
|
|
264
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
250
265
|
};
|
|
251
266
|
var _onBlur = function _onBlur(_ref2) {
|
|
252
267
|
var value = _ref2.target.value;
|
|
@@ -258,30 +273,36 @@ function BaseInputTemplate(props) {
|
|
|
258
273
|
};
|
|
259
274
|
var schemaUtils = registry.schemaUtils;
|
|
260
275
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
276
|
+
var DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? _extends({}, InputLabelProps, {
|
|
277
|
+
shrink: true
|
|
278
|
+
}) : InputLabelProps;
|
|
279
|
+
return jsxs(Fragment, {
|
|
280
|
+
children: [jsx(TextField, _extends({
|
|
281
|
+
id: id,
|
|
282
|
+
name: id,
|
|
283
|
+
placeholder: placeholder,
|
|
284
|
+
label: displayLabel ? label || schema.title : false,
|
|
285
|
+
autoFocus: autofocus,
|
|
286
|
+
required: required,
|
|
287
|
+
disabled: disabled || readonly
|
|
288
|
+
}, otherProps, {
|
|
289
|
+
value: value || value === 0 ? value : '',
|
|
290
|
+
error: rawErrors.length > 0,
|
|
291
|
+
onChange: onChangeOverride || _onChange,
|
|
292
|
+
onBlur: _onBlur,
|
|
293
|
+
onFocus: _onFocus,
|
|
294
|
+
InputLabelProps: DisplayInputLabelProps
|
|
295
|
+
}, textFieldProps, {
|
|
296
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
297
|
+
})), Array.isArray(schema.examples) && jsx("datalist", {
|
|
298
|
+
id: examplesId(id),
|
|
299
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
300
|
+
return jsx("option", {
|
|
301
|
+
value: example
|
|
302
|
+
}, example);
|
|
303
|
+
})
|
|
304
|
+
})]
|
|
305
|
+
});
|
|
285
306
|
}
|
|
286
307
|
|
|
287
308
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -292,13 +313,14 @@ function DescriptionField(props) {
|
|
|
292
313
|
var id = props.id,
|
|
293
314
|
description = props.description;
|
|
294
315
|
if (description) {
|
|
295
|
-
return
|
|
316
|
+
return jsx(Typography, {
|
|
296
317
|
id: id,
|
|
297
|
-
variant:
|
|
318
|
+
variant: 'subtitle2',
|
|
298
319
|
style: {
|
|
299
|
-
marginTop:
|
|
300
|
-
}
|
|
301
|
-
|
|
320
|
+
marginTop: '5px'
|
|
321
|
+
},
|
|
322
|
+
children: description
|
|
323
|
+
});
|
|
302
324
|
}
|
|
303
325
|
return null;
|
|
304
326
|
}
|
|
@@ -308,25 +330,33 @@ function DescriptionField(props) {
|
|
|
308
330
|
* @param props - The `ErrorListProps` for this component
|
|
309
331
|
*/
|
|
310
332
|
function ErrorList(_ref) {
|
|
311
|
-
var errors = _ref.errors
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
333
|
+
var errors = _ref.errors,
|
|
334
|
+
registry = _ref.registry;
|
|
335
|
+
var translateString = registry.translateString;
|
|
336
|
+
return jsx(Paper, {
|
|
337
|
+
elevation: 2,
|
|
338
|
+
children: jsxs(Box, {
|
|
339
|
+
mb: 2,
|
|
340
|
+
p: 2,
|
|
341
|
+
children: [jsx(Typography, {
|
|
342
|
+
variant: 'h6',
|
|
343
|
+
children: translateString(TranslatableString.ErrorsLabel)
|
|
344
|
+
}), jsx(List, {
|
|
345
|
+
dense: true,
|
|
346
|
+
children: errors.map(function (error, i) {
|
|
347
|
+
return jsxs(ListItem, {
|
|
348
|
+
children: [jsx(ListItemIcon, {
|
|
349
|
+
children: jsx(ErrorIcon, {
|
|
350
|
+
color: 'error'
|
|
351
|
+
})
|
|
352
|
+
}), jsx(ListItemText, {
|
|
353
|
+
primary: error.stack
|
|
354
|
+
})]
|
|
355
|
+
}, i);
|
|
356
|
+
})
|
|
357
|
+
})]
|
|
358
|
+
})
|
|
359
|
+
});
|
|
330
360
|
}
|
|
331
361
|
|
|
332
362
|
var _excluded$1 = ["icon", "color", "uiSchema", "registry"],
|
|
@@ -335,38 +365,42 @@ function MuiIconButton(props) {
|
|
|
335
365
|
var icon = props.icon,
|
|
336
366
|
color = props.color,
|
|
337
367
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
338
|
-
return
|
|
339
|
-
size:
|
|
340
|
-
color: color
|
|
341
|
-
|
|
368
|
+
return jsx(IconButton, _extends({}, otherProps, {
|
|
369
|
+
size: 'small',
|
|
370
|
+
color: color,
|
|
371
|
+
children: icon
|
|
372
|
+
}));
|
|
342
373
|
}
|
|
343
374
|
function MoveDownButton(props) {
|
|
344
|
-
|
|
345
|
-
|
|
375
|
+
var translateString = props.registry.translateString;
|
|
376
|
+
return jsx(MuiIconButton, _extends({
|
|
377
|
+
title: translateString(TranslatableString.MoveDownButton)
|
|
346
378
|
}, props, {
|
|
347
|
-
icon:
|
|
348
|
-
fontSize:
|
|
379
|
+
icon: jsx(ArrowDownwardIcon, {
|
|
380
|
+
fontSize: 'small'
|
|
349
381
|
})
|
|
350
382
|
}));
|
|
351
383
|
}
|
|
352
384
|
function MoveUpButton(props) {
|
|
353
|
-
|
|
354
|
-
|
|
385
|
+
var translateString = props.registry.translateString;
|
|
386
|
+
return jsx(MuiIconButton, _extends({
|
|
387
|
+
title: translateString(TranslatableString.MoveUpButton)
|
|
355
388
|
}, props, {
|
|
356
|
-
icon:
|
|
357
|
-
fontSize:
|
|
389
|
+
icon: jsx(ArrowUpwardIcon, {
|
|
390
|
+
fontSize: 'small'
|
|
358
391
|
})
|
|
359
392
|
}));
|
|
360
393
|
}
|
|
361
394
|
function RemoveButton(props) {
|
|
362
395
|
var iconType = props.iconType,
|
|
363
396
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
364
|
-
|
|
365
|
-
|
|
397
|
+
var translateString = otherProps.registry.translateString;
|
|
398
|
+
return jsx(MuiIconButton, _extends({
|
|
399
|
+
title: translateString(TranslatableString.RemoveButton)
|
|
366
400
|
}, otherProps, {
|
|
367
|
-
color:
|
|
368
|
-
icon:
|
|
369
|
-
fontSize: iconType ===
|
|
401
|
+
color: 'error',
|
|
402
|
+
icon: jsx(RemoveIcon, {
|
|
403
|
+
fontSize: iconType === 'default' ? undefined : 'small'
|
|
370
404
|
})
|
|
371
405
|
}));
|
|
372
406
|
}
|
|
@@ -383,17 +417,19 @@ function FieldErrorTemplate(props) {
|
|
|
383
417
|
return null;
|
|
384
418
|
}
|
|
385
419
|
var id = errorId(idSchema);
|
|
386
|
-
return
|
|
420
|
+
return jsx(List, {
|
|
387
421
|
dense: true,
|
|
388
|
-
disablePadding: true
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
422
|
+
disablePadding: true,
|
|
423
|
+
children: errors.map(function (error, i) {
|
|
424
|
+
return jsx(ListItem, {
|
|
425
|
+
disableGutters: true,
|
|
426
|
+
children: jsx(FormHelperText, {
|
|
427
|
+
id: id,
|
|
428
|
+
children: error
|
|
429
|
+
})
|
|
430
|
+
}, i);
|
|
431
|
+
})
|
|
432
|
+
});
|
|
397
433
|
}
|
|
398
434
|
|
|
399
435
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -407,9 +443,10 @@ function FieldHelpTemplate(props) {
|
|
|
407
443
|
return null;
|
|
408
444
|
}
|
|
409
445
|
var id = helpId(idSchema);
|
|
410
|
-
return
|
|
411
|
-
id: id
|
|
412
|
-
|
|
446
|
+
return jsx(FormHelperText, {
|
|
447
|
+
id: id,
|
|
448
|
+
children: help
|
|
449
|
+
});
|
|
413
450
|
}
|
|
414
451
|
|
|
415
452
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -439,15 +476,16 @@ function FieldTemplate(props) {
|
|
|
439
476
|
uiSchema = props.uiSchema,
|
|
440
477
|
registry = props.registry;
|
|
441
478
|
var uiOptions = getUiOptions(uiSchema);
|
|
442
|
-
var WrapIfAdditionalTemplate = getTemplate(
|
|
479
|
+
var WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
443
480
|
if (hidden) {
|
|
444
|
-
return
|
|
481
|
+
return jsx("div", {
|
|
445
482
|
style: {
|
|
446
|
-
display:
|
|
447
|
-
}
|
|
448
|
-
|
|
483
|
+
display: 'none'
|
|
484
|
+
},
|
|
485
|
+
children: children
|
|
486
|
+
});
|
|
449
487
|
}
|
|
450
|
-
return
|
|
488
|
+
return jsx(WrapIfAdditionalTemplate, {
|
|
451
489
|
classNames: classNames,
|
|
452
490
|
style: style,
|
|
453
491
|
disabled: disabled,
|
|
@@ -459,15 +497,18 @@ function FieldTemplate(props) {
|
|
|
459
497
|
required: required,
|
|
460
498
|
schema: schema,
|
|
461
499
|
uiSchema: uiSchema,
|
|
462
|
-
registry: registry
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
500
|
+
registry: registry,
|
|
501
|
+
children: jsxs(FormControl, {
|
|
502
|
+
fullWidth: true,
|
|
503
|
+
error: rawErrors.length ? true : false,
|
|
504
|
+
required: required,
|
|
505
|
+
children: [children, displayLabel && rawDescription ? jsx(Typography, {
|
|
506
|
+
variant: 'caption',
|
|
507
|
+
color: 'textSecondary',
|
|
508
|
+
children: rawDescription
|
|
509
|
+
}) : null, errors, help]
|
|
510
|
+
})
|
|
511
|
+
});
|
|
471
512
|
}
|
|
472
513
|
|
|
473
514
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -490,54 +531,59 @@ function ObjectFieldTemplate(props) {
|
|
|
490
531
|
onAddClick = props.onAddClick,
|
|
491
532
|
registry = props.registry;
|
|
492
533
|
var uiOptions = getUiOptions(uiSchema);
|
|
493
|
-
var TitleFieldTemplate = getTemplate(
|
|
494
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
534
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
535
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
495
536
|
// Button templates are not overridden in the uiSchema
|
|
496
537
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
497
|
-
return
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
538
|
+
return jsxs(Fragment, {
|
|
539
|
+
children: [(uiOptions.title || title) && jsx(TitleFieldTemplate, {
|
|
540
|
+
id: titleId(idSchema),
|
|
541
|
+
title: title,
|
|
542
|
+
required: required,
|
|
543
|
+
schema: schema,
|
|
544
|
+
uiSchema: uiSchema,
|
|
545
|
+
registry: registry
|
|
546
|
+
}), (uiOptions.description || description) && jsx(DescriptionFieldTemplate, {
|
|
547
|
+
id: descriptionId(idSchema),
|
|
548
|
+
description: uiOptions.description || description,
|
|
549
|
+
schema: schema,
|
|
550
|
+
uiSchema: uiSchema,
|
|
551
|
+
registry: registry
|
|
552
|
+
}), jsxs(Grid, {
|
|
553
|
+
container: true,
|
|
554
|
+
spacing: 2,
|
|
555
|
+
style: {
|
|
556
|
+
marginTop: '10px'
|
|
557
|
+
},
|
|
558
|
+
children: [properties.map(function (element, index) {
|
|
559
|
+
return (
|
|
560
|
+
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
561
|
+
// itself would otherwise still take up space.
|
|
562
|
+
element.hidden ? element.content : jsx(Grid, {
|
|
563
|
+
item: true,
|
|
564
|
+
xs: 12,
|
|
565
|
+
style: {
|
|
566
|
+
marginBottom: '10px'
|
|
567
|
+
},
|
|
568
|
+
children: element.content
|
|
569
|
+
}, index)
|
|
570
|
+
);
|
|
571
|
+
}), canExpand(schema, uiSchema, formData) && jsx(Grid, {
|
|
572
|
+
container: true,
|
|
573
|
+
justifyContent: 'flex-end',
|
|
574
|
+
children: jsx(Grid, {
|
|
575
|
+
item: true,
|
|
576
|
+
children: jsx(AddButton, {
|
|
577
|
+
className: 'object-property-expand',
|
|
578
|
+
onClick: onAddClick(schema),
|
|
579
|
+
disabled: disabled || readonly,
|
|
580
|
+
uiSchema: uiSchema,
|
|
581
|
+
registry: registry
|
|
582
|
+
})
|
|
583
|
+
})
|
|
584
|
+
})]
|
|
585
|
+
})]
|
|
586
|
+
});
|
|
541
587
|
}
|
|
542
588
|
|
|
543
589
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -552,13 +598,16 @@ function SubmitButton(_ref) {
|
|
|
552
598
|
if (norender) {
|
|
553
599
|
return null;
|
|
554
600
|
}
|
|
555
|
-
return
|
|
556
|
-
marginTop: 3
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
601
|
+
return jsx(Box, {
|
|
602
|
+
marginTop: 3,
|
|
603
|
+
children: jsx(Button, _extends({
|
|
604
|
+
type: 'submit',
|
|
605
|
+
variant: 'contained',
|
|
606
|
+
color: 'primary'
|
|
607
|
+
}, submitButtonProps, {
|
|
608
|
+
children: submitText
|
|
609
|
+
}))
|
|
610
|
+
});
|
|
562
611
|
}
|
|
563
612
|
|
|
564
613
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -568,13 +617,15 @@ function SubmitButton(_ref) {
|
|
|
568
617
|
function TitleField(_ref) {
|
|
569
618
|
var id = _ref.id,
|
|
570
619
|
title = _ref.title;
|
|
571
|
-
return
|
|
620
|
+
return jsxs(Box, {
|
|
572
621
|
id: id,
|
|
573
622
|
mb: 1,
|
|
574
|
-
mt: 1
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
623
|
+
mt: 1,
|
|
624
|
+
children: [jsx(Typography, {
|
|
625
|
+
variant: 'h5',
|
|
626
|
+
children: title
|
|
627
|
+
}), jsx(Divider, {})]
|
|
628
|
+
});
|
|
578
629
|
}
|
|
579
630
|
|
|
580
631
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -596,59 +647,68 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
596
647
|
schema = props.schema,
|
|
597
648
|
uiSchema = props.uiSchema,
|
|
598
649
|
registry = props.registry;
|
|
650
|
+
var templates = registry.templates,
|
|
651
|
+
translateString = registry.translateString;
|
|
599
652
|
// Button templates are not overridden in the uiSchema
|
|
600
|
-
var RemoveButton =
|
|
601
|
-
var keyLabel = label
|
|
653
|
+
var RemoveButton = templates.ButtonTemplates.RemoveButton;
|
|
654
|
+
var keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
602
655
|
var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
603
656
|
var btnStyle = {
|
|
604
657
|
flex: 1,
|
|
605
658
|
paddingLeft: 6,
|
|
606
659
|
paddingRight: 6,
|
|
607
|
-
fontWeight:
|
|
660
|
+
fontWeight: 'bold'
|
|
608
661
|
};
|
|
609
662
|
if (!additional) {
|
|
610
|
-
return
|
|
663
|
+
return jsx("div", {
|
|
611
664
|
className: classNames,
|
|
612
|
-
style: style
|
|
613
|
-
|
|
665
|
+
style: style,
|
|
666
|
+
children: children
|
|
667
|
+
});
|
|
614
668
|
}
|
|
615
669
|
var handleBlur = function handleBlur(_ref) {
|
|
616
670
|
var target = _ref.target;
|
|
617
671
|
return onKeyChange(target.value);
|
|
618
672
|
};
|
|
619
|
-
return
|
|
673
|
+
return jsxs(Grid, {
|
|
620
674
|
container: true,
|
|
621
|
-
|
|
622
|
-
alignItems: "center",
|
|
675
|
+
alignItems: 'center',
|
|
623
676
|
spacing: 2,
|
|
624
677
|
className: classNames,
|
|
625
|
-
style: style
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
678
|
+
style: style,
|
|
679
|
+
children: [jsx(Grid, {
|
|
680
|
+
item: true,
|
|
681
|
+
xs: true,
|
|
682
|
+
children: jsxs(FormControl, {
|
|
683
|
+
fullWidth: true,
|
|
684
|
+
required: required,
|
|
685
|
+
children: [jsx(InputLabel, {
|
|
686
|
+
children: keyLabel
|
|
687
|
+
}), jsx(Input, {
|
|
688
|
+
defaultValue: label,
|
|
689
|
+
disabled: disabled || readonly,
|
|
690
|
+
id: id + "-key",
|
|
691
|
+
name: id + "-key",
|
|
692
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
693
|
+
type: 'text'
|
|
694
|
+
})]
|
|
695
|
+
})
|
|
696
|
+
}), jsx(Grid, {
|
|
697
|
+
item: true,
|
|
698
|
+
xs: true,
|
|
699
|
+
children: children
|
|
700
|
+
}), jsx(Grid, {
|
|
701
|
+
item: true,
|
|
702
|
+
children: jsx(RemoveButton, {
|
|
703
|
+
iconType: 'default',
|
|
704
|
+
style: btnStyle,
|
|
705
|
+
disabled: disabled || readonly,
|
|
706
|
+
onClick: onDropPropertyClick(label),
|
|
707
|
+
uiSchema: uiSchema,
|
|
708
|
+
registry: registry
|
|
709
|
+
})
|
|
710
|
+
})]
|
|
711
|
+
}, id + "-key");
|
|
652
712
|
}
|
|
653
713
|
|
|
654
714
|
function generateTemplates() {
|
|
@@ -706,11 +766,11 @@ function CheckboxWidget(props) {
|
|
|
706
766
|
var value = _ref2.target.value;
|
|
707
767
|
return onFocus(id, value);
|
|
708
768
|
};
|
|
709
|
-
return
|
|
710
|
-
control:
|
|
769
|
+
return jsx(FormControlLabel, {
|
|
770
|
+
control: jsx(Checkbox, {
|
|
711
771
|
id: id,
|
|
712
772
|
name: id,
|
|
713
|
-
checked: typeof value ===
|
|
773
|
+
checked: typeof value === 'undefined' ? false : Boolean(value),
|
|
714
774
|
required: required,
|
|
715
775
|
disabled: disabled || readonly,
|
|
716
776
|
autoFocus: autofocus,
|
|
@@ -719,7 +779,7 @@ function CheckboxWidget(props) {
|
|
|
719
779
|
onFocus: _onFocus,
|
|
720
780
|
"aria-describedby": ariaDescribedByIds(id)
|
|
721
781
|
}),
|
|
722
|
-
label: label ||
|
|
782
|
+
label: label || ''
|
|
723
783
|
});
|
|
724
784
|
}
|
|
725
785
|
|
|
@@ -764,73 +824,35 @@ function CheckboxesWidget(_ref) {
|
|
|
764
824
|
var value = _ref4.target.value;
|
|
765
825
|
return onFocus(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
766
826
|
};
|
|
767
|
-
return
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
* the value to undefined when it is falsy during the `onChange` handling.
|
|
797
|
-
*
|
|
798
|
-
* @param props - The `WidgetProps` for this component
|
|
799
|
-
*/
|
|
800
|
-
function DateWidget(props) {
|
|
801
|
-
var options = props.options,
|
|
802
|
-
registry = props.registry;
|
|
803
|
-
var BaseInputTemplate = getTemplate("BaseInputTemplate", registry, options);
|
|
804
|
-
return /*#__PURE__*/React.createElement(BaseInputTemplate, _extends({
|
|
805
|
-
type: "date",
|
|
806
|
-
InputLabelProps: {
|
|
807
|
-
shrink: true
|
|
808
|
-
}
|
|
809
|
-
}, props));
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
813
|
-
* the value to/from utc using the appropriate utility functions.
|
|
814
|
-
*
|
|
815
|
-
* @param props - The `WidgetProps` for this component
|
|
816
|
-
*/
|
|
817
|
-
function DateTimeWidget(props) {
|
|
818
|
-
var options = props.options,
|
|
819
|
-
registry = props.registry;
|
|
820
|
-
var BaseInputTemplate = getTemplate("BaseInputTemplate", registry, options);
|
|
821
|
-
var value = utcToLocal(props.value);
|
|
822
|
-
var onChange = function onChange(value) {
|
|
823
|
-
props.onChange(localToUTC(value));
|
|
824
|
-
};
|
|
825
|
-
return /*#__PURE__*/React.createElement(BaseInputTemplate, _extends({
|
|
826
|
-
type: "datetime-local",
|
|
827
|
-
InputLabelProps: {
|
|
828
|
-
shrink: true
|
|
829
|
-
}
|
|
830
|
-
}, props, {
|
|
831
|
-
value: value,
|
|
832
|
-
onChange: onChange
|
|
833
|
-
}));
|
|
827
|
+
return jsxs(Fragment, {
|
|
828
|
+
children: [jsx(FormLabel, {
|
|
829
|
+
required: required,
|
|
830
|
+
htmlFor: id,
|
|
831
|
+
children: label || schema.title
|
|
832
|
+
}), jsx(FormGroup, {
|
|
833
|
+
id: id,
|
|
834
|
+
row: !!inline,
|
|
835
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
836
|
+
var checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
837
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
838
|
+
var checkbox = jsx(Checkbox, {
|
|
839
|
+
id: optionId(id, index),
|
|
840
|
+
name: id,
|
|
841
|
+
checked: checked,
|
|
842
|
+
disabled: disabled || itemDisabled || readonly,
|
|
843
|
+
autoFocus: autofocus && index === 0,
|
|
844
|
+
onChange: _onChange(index),
|
|
845
|
+
onBlur: _onBlur,
|
|
846
|
+
onFocus: _onFocus,
|
|
847
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
848
|
+
});
|
|
849
|
+
return jsx(FormControlLabel, {
|
|
850
|
+
control: checkbox,
|
|
851
|
+
label: option.label
|
|
852
|
+
}, index);
|
|
853
|
+
})
|
|
854
|
+
})]
|
|
855
|
+
});
|
|
834
856
|
}
|
|
835
857
|
|
|
836
858
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
@@ -866,33 +888,36 @@ function RadioWidget(_ref) {
|
|
|
866
888
|
};
|
|
867
889
|
var row = options ? options.inline : false;
|
|
868
890
|
var selectedIndex = enumOptionsIndexForValue(value, enumOptions);
|
|
869
|
-
return
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
891
|
+
return jsxs(Fragment, {
|
|
892
|
+
children: [jsx(FormLabel, {
|
|
893
|
+
required: required,
|
|
894
|
+
htmlFor: id,
|
|
895
|
+
children: label || schema.title
|
|
896
|
+
}), jsx(RadioGroup, {
|
|
897
|
+
id: id,
|
|
898
|
+
name: id,
|
|
899
|
+
value: selectedIndex,
|
|
900
|
+
row: row,
|
|
901
|
+
onChange: _onChange,
|
|
902
|
+
onBlur: _onBlur,
|
|
903
|
+
onFocus: _onFocus,
|
|
904
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
905
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
906
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
907
|
+
var radio = jsx(FormControlLabel, {
|
|
908
|
+
control: jsx(Radio, {
|
|
909
|
+
name: id,
|
|
910
|
+
id: optionId(id, index),
|
|
911
|
+
color: 'primary'
|
|
912
|
+
}),
|
|
913
|
+
label: option.label,
|
|
914
|
+
value: String(index),
|
|
915
|
+
disabled: disabled || itemDisabled || readonly
|
|
916
|
+
}, index);
|
|
917
|
+
return radio;
|
|
918
|
+
})
|
|
919
|
+
})]
|
|
920
|
+
});
|
|
896
921
|
}
|
|
897
922
|
|
|
898
923
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -919,7 +944,7 @@ function RangeWidget(props) {
|
|
|
919
944
|
name: id
|
|
920
945
|
}, rangeSpec(schema));
|
|
921
946
|
var _onChange = function _onChange(_, value) {
|
|
922
|
-
onChange(value ? value : options.emptyValue);
|
|
947
|
+
onChange(value != null ? value : options.emptyValue);
|
|
923
948
|
};
|
|
924
949
|
var _onBlur = function _onBlur(_ref) {
|
|
925
950
|
var value = _ref.target.value;
|
|
@@ -929,21 +954,24 @@ function RangeWidget(props) {
|
|
|
929
954
|
var value = _ref2.target.value;
|
|
930
955
|
return onFocus(id, value);
|
|
931
956
|
};
|
|
932
|
-
return
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
957
|
+
return jsxs(Fragment, {
|
|
958
|
+
children: [jsx(FormLabel, {
|
|
959
|
+
required: required,
|
|
960
|
+
htmlFor: id,
|
|
961
|
+
children: label || schema.title
|
|
962
|
+
}), jsx(Slider, _extends({
|
|
963
|
+
disabled: disabled || readonly,
|
|
964
|
+
onChange: _onChange,
|
|
965
|
+
onBlur: _onBlur,
|
|
966
|
+
onFocus: _onFocus,
|
|
967
|
+
valueLabelDisplay: 'auto'
|
|
968
|
+
}, sliderProps, {
|
|
969
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
970
|
+
}))]
|
|
971
|
+
});
|
|
944
972
|
}
|
|
945
973
|
|
|
946
|
-
var _excluded = ["schema", "id", "options", "label", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
974
|
+
var _excluded = ["schema", "id", "name", "options", "label", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
947
975
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
948
976
|
* It is typically used with string properties constrained with enum options.
|
|
949
977
|
*
|
|
@@ -970,9 +998,9 @@ function SelectWidget(_ref) {
|
|
|
970
998
|
var enumOptions = options.enumOptions,
|
|
971
999
|
enumDisabled = options.enumDisabled,
|
|
972
1000
|
optEmptyVal = options.emptyValue;
|
|
973
|
-
multiple = typeof multiple ===
|
|
974
|
-
var emptyValue = multiple ? [] :
|
|
975
|
-
var isEmpty = typeof value ===
|
|
1001
|
+
multiple = typeof multiple === 'undefined' ? false : !!multiple;
|
|
1002
|
+
var emptyValue = multiple ? [] : '';
|
|
1003
|
+
var isEmpty = typeof value === 'undefined' || multiple && value.length < 1 || !multiple && value === emptyValue;
|
|
976
1004
|
var _onChange = function _onChange(_ref2) {
|
|
977
1005
|
var value = _ref2.target.value;
|
|
978
1006
|
return onChange(enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
@@ -986,7 +1014,7 @@ function SelectWidget(_ref) {
|
|
|
986
1014
|
return onFocus(id, enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
987
1015
|
};
|
|
988
1016
|
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
989
|
-
return
|
|
1017
|
+
return jsx(TextField, _extends({
|
|
990
1018
|
id: id,
|
|
991
1019
|
name: id,
|
|
992
1020
|
label: label || schema.title,
|
|
@@ -1008,16 +1036,17 @@ function SelectWidget(_ref) {
|
|
|
1008
1036
|
SelectProps: _extends({}, textFieldProps.SelectProps, {
|
|
1009
1037
|
multiple: multiple
|
|
1010
1038
|
}),
|
|
1011
|
-
"aria-describedby": ariaDescribedByIds(id)
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1039
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
1040
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (_ref5, i) {
|
|
1041
|
+
var value = _ref5.value,
|
|
1042
|
+
label = _ref5.label;
|
|
1043
|
+
var disabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1;
|
|
1044
|
+
return jsx(MenuItem, {
|
|
1045
|
+
value: String(i),
|
|
1046
|
+
disabled: disabled,
|
|
1047
|
+
children: label
|
|
1048
|
+
}, i);
|
|
1049
|
+
})
|
|
1021
1050
|
}));
|
|
1022
1051
|
}
|
|
1023
1052
|
|
|
@@ -1028,12 +1057,12 @@ function SelectWidget(_ref) {
|
|
|
1028
1057
|
function TextareaWidget(props) {
|
|
1029
1058
|
var options = props.options,
|
|
1030
1059
|
registry = props.registry;
|
|
1031
|
-
var BaseInputTemplate = getTemplate(
|
|
1060
|
+
var BaseInputTemplate = getTemplate('BaseInputTemplate', registry, options);
|
|
1032
1061
|
var rows = 5;
|
|
1033
|
-
if (typeof options.rows ===
|
|
1062
|
+
if (typeof options.rows === 'string' || typeof options.rows === 'number') {
|
|
1034
1063
|
rows = options.rows;
|
|
1035
1064
|
}
|
|
1036
|
-
return
|
|
1065
|
+
return jsx(BaseInputTemplate, _extends({}, props, {
|
|
1037
1066
|
multiline: true,
|
|
1038
1067
|
rows: rows
|
|
1039
1068
|
}));
|
|
@@ -1043,8 +1072,6 @@ function generateWidgets() {
|
|
|
1043
1072
|
return {
|
|
1044
1073
|
CheckboxWidget: CheckboxWidget,
|
|
1045
1074
|
CheckboxesWidget: CheckboxesWidget,
|
|
1046
|
-
DateWidget: DateWidget,
|
|
1047
|
-
DateTimeWidget: DateTimeWidget,
|
|
1048
1075
|
RadioWidget: RadioWidget,
|
|
1049
1076
|
RangeWidget: RangeWidget,
|
|
1050
1077
|
SelectWidget: SelectWidget,
|