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