@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
|
@@ -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('@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', '@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.
|
|
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);
|
|
@@ -71,11 +70,12 @@
|
|
|
71
70
|
var registry = _ref.registry,
|
|
72
71
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
73
72
|
var translateString = registry.translateString;
|
|
74
|
-
return
|
|
73
|
+
return jsxRuntime.jsx(IconButton__default["default"], _extends({
|
|
75
74
|
title: translateString(utils.TranslatableString.AddItemButton)
|
|
76
75
|
}, props, {
|
|
77
|
-
color:
|
|
78
|
-
|
|
76
|
+
color: 'primary',
|
|
77
|
+
children: jsxRuntime.jsx(AddIcon__default["default"], {})
|
|
78
|
+
}));
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
@@ -103,45 +103,51 @@
|
|
|
103
103
|
flex: 1,
|
|
104
104
|
paddingLeft: 6,
|
|
105
105
|
paddingRight: 6,
|
|
106
|
-
fontWeight:
|
|
106
|
+
fontWeight: 'bold',
|
|
107
107
|
minWidth: 0
|
|
108
108
|
};
|
|
109
|
-
return
|
|
109
|
+
return jsxRuntime.jsxs(Grid__default["default"], {
|
|
110
110
|
container: true,
|
|
111
|
-
alignItems:
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
+
});
|
|
145
151
|
}
|
|
146
152
|
|
|
147
153
|
var _excluded$3 = ["key"];
|
|
@@ -162,55 +168,59 @@
|
|
|
162
168
|
schema = props.schema,
|
|
163
169
|
title = props.title;
|
|
164
170
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
165
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
166
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
167
|
-
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);
|
|
168
174
|
// Button templates are not overridden in the uiSchema
|
|
169
175
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
170
|
-
return
|
|
171
|
-
elevation: 2
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
+
});
|
|
210
219
|
}
|
|
211
220
|
|
|
212
|
-
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"],
|
|
213
222
|
_excluded2$1 = ["step", "min", "max"];
|
|
223
|
+
var TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file'];
|
|
214
224
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
215
225
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
216
226
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -227,6 +237,7 @@
|
|
|
227
237
|
label = props.label,
|
|
228
238
|
value = props.value,
|
|
229
239
|
onChange = props.onChange,
|
|
240
|
+
onChangeOverride = props.onChangeOverride,
|
|
230
241
|
onBlur = props.onBlur,
|
|
231
242
|
onFocus = props.onFocus,
|
|
232
243
|
autofocus = props.autofocus,
|
|
@@ -236,6 +247,7 @@
|
|
|
236
247
|
_props$rawErrors = props.rawErrors,
|
|
237
248
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
238
249
|
registry = props.registry,
|
|
250
|
+
InputLabelProps = props.InputLabelProps,
|
|
239
251
|
textFieldProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
240
252
|
var inputProps = utils.getInputProps(schema, type, options);
|
|
241
253
|
// Now we need to pull out the step, min, max into an inner `inputProps` for material-ui
|
|
@@ -254,7 +266,7 @@
|
|
|
254
266
|
}, rest);
|
|
255
267
|
var _onChange = function _onChange(_ref) {
|
|
256
268
|
var value = _ref.target.value;
|
|
257
|
-
return onChange(value ===
|
|
269
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
258
270
|
};
|
|
259
271
|
var _onBlur = function _onBlur(_ref2) {
|
|
260
272
|
var value = _ref2.target.value;
|
|
@@ -266,30 +278,36 @@
|
|
|
266
278
|
};
|
|
267
279
|
var schemaUtils = registry.schemaUtils;
|
|
268
280
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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
|
+
});
|
|
293
311
|
}
|
|
294
312
|
|
|
295
313
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -300,13 +318,14 @@
|
|
|
300
318
|
var id = props.id,
|
|
301
319
|
description = props.description;
|
|
302
320
|
if (description) {
|
|
303
|
-
return
|
|
321
|
+
return jsxRuntime.jsx(Typography__default["default"], {
|
|
304
322
|
id: id,
|
|
305
|
-
variant:
|
|
323
|
+
variant: 'subtitle2',
|
|
306
324
|
style: {
|
|
307
|
-
marginTop:
|
|
308
|
-
}
|
|
309
|
-
|
|
325
|
+
marginTop: '5px'
|
|
326
|
+
},
|
|
327
|
+
children: description
|
|
328
|
+
});
|
|
310
329
|
}
|
|
311
330
|
return null;
|
|
312
331
|
}
|
|
@@ -319,24 +338,30 @@
|
|
|
319
338
|
var errors = _ref.errors,
|
|
320
339
|
registry = _ref.registry;
|
|
321
340
|
var translateString = registry.translateString;
|
|
322
|
-
return
|
|
323
|
-
elevation: 2
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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
|
+
});
|
|
340
365
|
}
|
|
341
366
|
|
|
342
367
|
var _excluded$1 = ["icon", "color", "uiSchema", "registry"],
|
|
@@ -345,28 +370,29 @@
|
|
|
345
370
|
var icon = props.icon,
|
|
346
371
|
color = props.color,
|
|
347
372
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
348
|
-
return
|
|
349
|
-
size:
|
|
350
|
-
color: color
|
|
351
|
-
|
|
373
|
+
return jsxRuntime.jsx(IconButton__default["default"], _extends({}, otherProps, {
|
|
374
|
+
size: 'small',
|
|
375
|
+
color: color,
|
|
376
|
+
children: icon
|
|
377
|
+
}));
|
|
352
378
|
}
|
|
353
379
|
function MoveDownButton(props) {
|
|
354
380
|
var translateString = props.registry.translateString;
|
|
355
|
-
return
|
|
381
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
356
382
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
357
383
|
}, props, {
|
|
358
|
-
icon:
|
|
359
|
-
fontSize:
|
|
384
|
+
icon: jsxRuntime.jsx(ArrowDownwardIcon__default["default"], {
|
|
385
|
+
fontSize: 'small'
|
|
360
386
|
})
|
|
361
387
|
}));
|
|
362
388
|
}
|
|
363
389
|
function MoveUpButton(props) {
|
|
364
390
|
var translateString = props.registry.translateString;
|
|
365
|
-
return
|
|
391
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
366
392
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
367
393
|
}, props, {
|
|
368
|
-
icon:
|
|
369
|
-
fontSize:
|
|
394
|
+
icon: jsxRuntime.jsx(ArrowUpwardIcon__default["default"], {
|
|
395
|
+
fontSize: 'small'
|
|
370
396
|
})
|
|
371
397
|
}));
|
|
372
398
|
}
|
|
@@ -374,12 +400,12 @@
|
|
|
374
400
|
var iconType = props.iconType,
|
|
375
401
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
376
402
|
var translateString = otherProps.registry.translateString;
|
|
377
|
-
return
|
|
403
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
378
404
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
379
405
|
}, otherProps, {
|
|
380
|
-
color:
|
|
381
|
-
icon:
|
|
382
|
-
fontSize: iconType ===
|
|
406
|
+
color: 'error',
|
|
407
|
+
icon: jsxRuntime.jsx(RemoveIcon__default["default"], {
|
|
408
|
+
fontSize: iconType === 'default' ? undefined : 'small'
|
|
383
409
|
})
|
|
384
410
|
}));
|
|
385
411
|
}
|
|
@@ -396,17 +422,19 @@
|
|
|
396
422
|
return null;
|
|
397
423
|
}
|
|
398
424
|
var id = utils.errorId(idSchema);
|
|
399
|
-
return
|
|
425
|
+
return jsxRuntime.jsx(List__default["default"], {
|
|
400
426
|
dense: true,
|
|
401
|
-
disablePadding: true
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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
|
+
});
|
|
410
438
|
}
|
|
411
439
|
|
|
412
440
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -420,9 +448,10 @@
|
|
|
420
448
|
return null;
|
|
421
449
|
}
|
|
422
450
|
var id = utils.helpId(idSchema);
|
|
423
|
-
return
|
|
424
|
-
id: id
|
|
425
|
-
|
|
451
|
+
return jsxRuntime.jsx(FormHelperText__default["default"], {
|
|
452
|
+
id: id,
|
|
453
|
+
children: help
|
|
454
|
+
});
|
|
426
455
|
}
|
|
427
456
|
|
|
428
457
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -452,15 +481,16 @@
|
|
|
452
481
|
uiSchema = props.uiSchema,
|
|
453
482
|
registry = props.registry;
|
|
454
483
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
455
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
484
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
456
485
|
if (hidden) {
|
|
457
|
-
return
|
|
486
|
+
return jsxRuntime.jsx("div", {
|
|
458
487
|
style: {
|
|
459
|
-
display:
|
|
460
|
-
}
|
|
461
|
-
|
|
488
|
+
display: 'none'
|
|
489
|
+
},
|
|
490
|
+
children: children
|
|
491
|
+
});
|
|
462
492
|
}
|
|
463
|
-
return
|
|
493
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
464
494
|
classNames: classNames,
|
|
465
495
|
style: style,
|
|
466
496
|
disabled: disabled,
|
|
@@ -472,15 +502,18 @@
|
|
|
472
502
|
required: required,
|
|
473
503
|
schema: schema,
|
|
474
504
|
uiSchema: uiSchema,
|
|
475
|
-
registry: registry
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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
|
+
});
|
|
484
517
|
}
|
|
485
518
|
|
|
486
519
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -503,54 +536,59 @@
|
|
|
503
536
|
onAddClick = props.onAddClick,
|
|
504
537
|
registry = props.registry;
|
|
505
538
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
506
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
507
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
539
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
540
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
508
541
|
// Button templates are not overridden in the uiSchema
|
|
509
542
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
510
|
-
return
|
|
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
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
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
|
+
});
|
|
554
592
|
}
|
|
555
593
|
|
|
556
594
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -565,13 +603,16 @@
|
|
|
565
603
|
if (norender) {
|
|
566
604
|
return null;
|
|
567
605
|
}
|
|
568
|
-
return
|
|
569
|
-
marginTop: 3
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
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
|
+
});
|
|
575
616
|
}
|
|
576
617
|
|
|
577
618
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -581,13 +622,15 @@
|
|
|
581
622
|
function TitleField(_ref) {
|
|
582
623
|
var id = _ref.id,
|
|
583
624
|
title = _ref.title;
|
|
584
|
-
return
|
|
625
|
+
return jsxRuntime.jsxs(Box__default["default"], {
|
|
585
626
|
id: id,
|
|
586
627
|
mb: 1,
|
|
587
|
-
mt: 1
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
628
|
+
mt: 1,
|
|
629
|
+
children: [jsxRuntime.jsx(Typography__default["default"], {
|
|
630
|
+
variant: 'h5',
|
|
631
|
+
children: title
|
|
632
|
+
}), jsxRuntime.jsx(Divider__default["default"], {})]
|
|
633
|
+
});
|
|
591
634
|
}
|
|
592
635
|
|
|
593
636
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -619,51 +662,58 @@
|
|
|
619
662
|
flex: 1,
|
|
620
663
|
paddingLeft: 6,
|
|
621
664
|
paddingRight: 6,
|
|
622
|
-
fontWeight:
|
|
665
|
+
fontWeight: 'bold'
|
|
623
666
|
};
|
|
624
667
|
if (!additional) {
|
|
625
|
-
return
|
|
668
|
+
return jsxRuntime.jsx("div", {
|
|
626
669
|
className: classNames,
|
|
627
|
-
style: style
|
|
628
|
-
|
|
670
|
+
style: style,
|
|
671
|
+
children: children
|
|
672
|
+
});
|
|
629
673
|
}
|
|
630
674
|
var handleBlur = function handleBlur(_ref) {
|
|
631
675
|
var target = _ref.target;
|
|
632
676
|
return onKeyChange(target.value);
|
|
633
677
|
};
|
|
634
|
-
return
|
|
678
|
+
return jsxRuntime.jsxs(Grid__default["default"], {
|
|
635
679
|
container: true,
|
|
636
|
-
|
|
637
|
-
alignItems: "center",
|
|
680
|
+
alignItems: 'center',
|
|
638
681
|
spacing: 2,
|
|
639
682
|
className: classNames,
|
|
640
|
-
style: style
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
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");
|
|
667
717
|
}
|
|
668
718
|
|
|
669
719
|
function generateTemplates() {
|
|
@@ -721,11 +771,11 @@
|
|
|
721
771
|
var value = _ref2.target.value;
|
|
722
772
|
return onFocus(id, value);
|
|
723
773
|
};
|
|
724
|
-
return
|
|
725
|
-
control:
|
|
774
|
+
return jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
775
|
+
control: jsxRuntime.jsx(Checkbox__default["default"], {
|
|
726
776
|
id: id,
|
|
727
777
|
name: id,
|
|
728
|
-
checked: typeof value ===
|
|
778
|
+
checked: typeof value === 'undefined' ? false : Boolean(value),
|
|
729
779
|
required: required,
|
|
730
780
|
disabled: disabled || readonly,
|
|
731
781
|
autoFocus: autofocus,
|
|
@@ -734,7 +784,7 @@
|
|
|
734
784
|
onFocus: _onFocus,
|
|
735
785
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
736
786
|
}),
|
|
737
|
-
label: label ||
|
|
787
|
+
label: label || ''
|
|
738
788
|
});
|
|
739
789
|
}
|
|
740
790
|
|
|
@@ -779,73 +829,35 @@
|
|
|
779
829
|
var value = _ref4.target.value;
|
|
780
830
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
781
831
|
};
|
|
782
|
-
return
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
* the value to undefined when it is falsy during the `onChange` handling.
|
|
812
|
-
*
|
|
813
|
-
* @param props - The `WidgetProps` for this component
|
|
814
|
-
*/
|
|
815
|
-
function DateWidget(props) {
|
|
816
|
-
var options = props.options,
|
|
817
|
-
registry = props.registry;
|
|
818
|
-
var BaseInputTemplate = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
819
|
-
return /*#__PURE__*/React__default["default"].createElement(BaseInputTemplate, _extends({
|
|
820
|
-
type: "date",
|
|
821
|
-
InputLabelProps: {
|
|
822
|
-
shrink: true
|
|
823
|
-
}
|
|
824
|
-
}, props));
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
828
|
-
* the value to/from utc using the appropriate utility functions.
|
|
829
|
-
*
|
|
830
|
-
* @param props - The `WidgetProps` for this component
|
|
831
|
-
*/
|
|
832
|
-
function DateTimeWidget(props) {
|
|
833
|
-
var options = props.options,
|
|
834
|
-
registry = props.registry;
|
|
835
|
-
var BaseInputTemplate = utils.getTemplate("BaseInputTemplate", registry, options);
|
|
836
|
-
var value = utils.utcToLocal(props.value);
|
|
837
|
-
var onChange = function onChange(value) {
|
|
838
|
-
props.onChange(utils.localToUTC(value));
|
|
839
|
-
};
|
|
840
|
-
return /*#__PURE__*/React__default["default"].createElement(BaseInputTemplate, _extends({
|
|
841
|
-
type: "datetime-local",
|
|
842
|
-
InputLabelProps: {
|
|
843
|
-
shrink: true
|
|
844
|
-
}
|
|
845
|
-
}, props, {
|
|
846
|
-
value: value,
|
|
847
|
-
onChange: onChange
|
|
848
|
-
}));
|
|
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
|
+
});
|
|
849
861
|
}
|
|
850
862
|
|
|
851
863
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
@@ -881,33 +893,36 @@
|
|
|
881
893
|
};
|
|
882
894
|
var row = options ? options.inline : false;
|
|
883
895
|
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
884
|
-
return
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
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
|
+
});
|
|
911
926
|
}
|
|
912
927
|
|
|
913
928
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -944,21 +959,24 @@
|
|
|
944
959
|
var value = _ref2.target.value;
|
|
945
960
|
return onFocus(id, value);
|
|
946
961
|
};
|
|
947
|
-
return
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
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
|
+
});
|
|
959
977
|
}
|
|
960
978
|
|
|
961
|
-
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"];
|
|
962
980
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
963
981
|
* It is typically used with string properties constrained with enum options.
|
|
964
982
|
*
|
|
@@ -985,9 +1003,9 @@
|
|
|
985
1003
|
var enumOptions = options.enumOptions,
|
|
986
1004
|
enumDisabled = options.enumDisabled,
|
|
987
1005
|
optEmptyVal = options.emptyValue;
|
|
988
|
-
multiple = typeof multiple ===
|
|
989
|
-
var emptyValue = multiple ? [] :
|
|
990
|
-
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;
|
|
991
1009
|
var _onChange = function _onChange(_ref2) {
|
|
992
1010
|
var value = _ref2.target.value;
|
|
993
1011
|
return onChange(utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
@@ -1001,7 +1019,7 @@
|
|
|
1001
1019
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1002
1020
|
};
|
|
1003
1021
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1004
|
-
return
|
|
1022
|
+
return jsxRuntime.jsx(TextField__default["default"], _extends({
|
|
1005
1023
|
id: id,
|
|
1006
1024
|
name: id,
|
|
1007
1025
|
label: label || schema.title,
|
|
@@ -1023,16 +1041,17 @@
|
|
|
1023
1041
|
SelectProps: _extends({}, textFieldProps.SelectProps, {
|
|
1024
1042
|
multiple: multiple
|
|
1025
1043
|
}),
|
|
1026
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
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
|
+
})
|
|
1036
1055
|
}));
|
|
1037
1056
|
}
|
|
1038
1057
|
|
|
@@ -1043,12 +1062,12 @@
|
|
|
1043
1062
|
function TextareaWidget(props) {
|
|
1044
1063
|
var options = props.options,
|
|
1045
1064
|
registry = props.registry;
|
|
1046
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
1065
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
1047
1066
|
var rows = 5;
|
|
1048
|
-
if (typeof options.rows ===
|
|
1067
|
+
if (typeof options.rows === 'string' || typeof options.rows === 'number') {
|
|
1049
1068
|
rows = options.rows;
|
|
1050
1069
|
}
|
|
1051
|
-
return
|
|
1070
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({}, props, {
|
|
1052
1071
|
multiline: true,
|
|
1053
1072
|
rows: rows
|
|
1054
1073
|
}));
|
|
@@ -1058,8 +1077,6 @@
|
|
|
1058
1077
|
return {
|
|
1059
1078
|
CheckboxWidget: CheckboxWidget,
|
|
1060
1079
|
CheckboxesWidget: CheckboxesWidget,
|
|
1061
|
-
DateWidget: DateWidget,
|
|
1062
|
-
DateTimeWidget: DateTimeWidget,
|
|
1063
1080
|
RadioWidget: RadioWidget,
|
|
1064
1081
|
RangeWidget: RangeWidget,
|
|
1065
1082
|
SelectWidget: SelectWidget,
|