@rjsf/mui 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +183 -183
- package/README.md +1 -0
- package/dist/mui.cjs.development.js +436 -397
- package/dist/mui.cjs.development.js.map +1 -1
- package/dist/mui.cjs.production.min.js +1 -1
- package/dist/mui.cjs.production.min.js.map +1 -1
- package/dist/mui.esm.js +436 -397
- package/dist/mui.esm.js.map +1 -1
- package/dist/mui.umd.development.js +438 -400
- package/dist/mui.umd.development.js.map +1 -1
- package/dist/mui.umd.production.min.js +1 -1
- package/dist/mui.umd.production.min.js.map +1 -1
- package/package.json +14 -14
|
@@ -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/ContentCopy'), 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/ContentCopy', '@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.CopyIcon, 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, CopyIcon, 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);
|
|
@@ -21,6 +20,7 @@
|
|
|
21
20
|
var ListItemText__default = /*#__PURE__*/_interopDefaultLegacy(ListItemText);
|
|
22
21
|
var ArrowDownwardIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDownwardIcon);
|
|
23
22
|
var ArrowUpwardIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowUpwardIcon);
|
|
23
|
+
var CopyIcon__default = /*#__PURE__*/_interopDefaultLegacy(CopyIcon);
|
|
24
24
|
var RemoveIcon__default = /*#__PURE__*/_interopDefaultLegacy(RemoveIcon);
|
|
25
25
|
var FormHelperText__default = /*#__PURE__*/_interopDefaultLegacy(FormHelperText);
|
|
26
26
|
var FormControl__default = /*#__PURE__*/_interopDefaultLegacy(FormControl);
|
|
@@ -71,11 +71,12 @@
|
|
|
71
71
|
var registry = _ref.registry,
|
|
72
72
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
73
73
|
var translateString = registry.translateString;
|
|
74
|
-
return
|
|
74
|
+
return jsxRuntime.jsx(IconButton__default["default"], _extends({
|
|
75
75
|
title: translateString(utils.TranslatableString.AddItemButton)
|
|
76
76
|
}, props, {
|
|
77
|
-
color:
|
|
78
|
-
|
|
77
|
+
color: 'primary',
|
|
78
|
+
children: jsxRuntime.jsx(AddIcon__default["default"], {})
|
|
79
|
+
}));
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
@@ -86,16 +87,19 @@
|
|
|
86
87
|
var children = props.children,
|
|
87
88
|
disabled = props.disabled,
|
|
88
89
|
hasToolbar = props.hasToolbar,
|
|
90
|
+
hasCopy = props.hasCopy,
|
|
89
91
|
hasMoveDown = props.hasMoveDown,
|
|
90
92
|
hasMoveUp = props.hasMoveUp,
|
|
91
93
|
hasRemove = props.hasRemove,
|
|
92
94
|
index = props.index,
|
|
95
|
+
onCopyIndexClick = props.onCopyIndexClick,
|
|
93
96
|
onDropIndexClick = props.onDropIndexClick,
|
|
94
97
|
onReorderClick = props.onReorderClick,
|
|
95
98
|
readonly = props.readonly,
|
|
96
99
|
uiSchema = props.uiSchema,
|
|
97
100
|
registry = props.registry;
|
|
98
101
|
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
102
|
+
CopyButton = _registry$templates$B.CopyButton,
|
|
99
103
|
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
100
104
|
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
101
105
|
RemoveButton = _registry$templates$B.RemoveButton;
|
|
@@ -103,45 +107,57 @@
|
|
|
103
107
|
flex: 1,
|
|
104
108
|
paddingLeft: 6,
|
|
105
109
|
paddingRight: 6,
|
|
106
|
-
fontWeight:
|
|
110
|
+
fontWeight: 'bold',
|
|
107
111
|
minWidth: 0
|
|
108
112
|
};
|
|
109
|
-
return
|
|
113
|
+
return jsxRuntime.jsxs(Grid__default["default"], {
|
|
110
114
|
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
|
-
|
|
115
|
+
alignItems: 'center',
|
|
116
|
+
children: [jsxRuntime.jsx(Grid__default["default"], {
|
|
117
|
+
item: true,
|
|
118
|
+
xs: true,
|
|
119
|
+
style: {
|
|
120
|
+
overflow: 'auto'
|
|
121
|
+
},
|
|
122
|
+
children: jsxRuntime.jsx(Box__default["default"], {
|
|
123
|
+
mb: 2,
|
|
124
|
+
children: jsxRuntime.jsx(Paper__default["default"], {
|
|
125
|
+
elevation: 2,
|
|
126
|
+
children: jsxRuntime.jsx(Box__default["default"], {
|
|
127
|
+
p: 2,
|
|
128
|
+
children: children
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
}), hasToolbar && jsxRuntime.jsxs(Grid__default["default"], {
|
|
133
|
+
item: true,
|
|
134
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
135
|
+
style: btnStyle,
|
|
136
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
137
|
+
onClick: onReorderClick(index, index - 1),
|
|
138
|
+
uiSchema: uiSchema,
|
|
139
|
+
registry: registry
|
|
140
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
141
|
+
style: btnStyle,
|
|
142
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
143
|
+
onClick: onReorderClick(index, index + 1),
|
|
144
|
+
uiSchema: uiSchema,
|
|
145
|
+
registry: registry
|
|
146
|
+
}), hasCopy && jsxRuntime.jsx(CopyButton, {
|
|
147
|
+
style: btnStyle,
|
|
148
|
+
disabled: disabled || readonly,
|
|
149
|
+
onClick: onCopyIndexClick(index),
|
|
150
|
+
uiSchema: uiSchema,
|
|
151
|
+
registry: registry
|
|
152
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
153
|
+
style: btnStyle,
|
|
154
|
+
disabled: disabled || readonly,
|
|
155
|
+
onClick: onDropIndexClick(index),
|
|
156
|
+
uiSchema: uiSchema,
|
|
157
|
+
registry: registry
|
|
158
|
+
})]
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
145
161
|
}
|
|
146
162
|
|
|
147
163
|
var _excluded$3 = ["key"];
|
|
@@ -162,55 +178,59 @@
|
|
|
162
178
|
schema = props.schema,
|
|
163
179
|
title = props.title;
|
|
164
180
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
165
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
166
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
167
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
181
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
182
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
183
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
168
184
|
// Button templates are not overridden in the uiSchema
|
|
169
185
|
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
|
-
|
|
186
|
+
return jsxRuntime.jsx(Paper__default["default"], {
|
|
187
|
+
elevation: 2,
|
|
188
|
+
children: jsxRuntime.jsxs(Box__default["default"], {
|
|
189
|
+
p: 2,
|
|
190
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
191
|
+
idSchema: idSchema,
|
|
192
|
+
title: uiOptions.title || title,
|
|
193
|
+
schema: schema,
|
|
194
|
+
uiSchema: uiSchema,
|
|
195
|
+
required: required,
|
|
196
|
+
registry: registry
|
|
197
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
198
|
+
idSchema: idSchema,
|
|
199
|
+
description: uiOptions.description || schema.description,
|
|
200
|
+
schema: schema,
|
|
201
|
+
uiSchema: uiSchema,
|
|
202
|
+
registry: registry
|
|
203
|
+
}), jsxRuntime.jsxs(Grid__default["default"], {
|
|
204
|
+
container: true,
|
|
205
|
+
children: [items && items.map(function (_ref) {
|
|
206
|
+
var key = _ref.key,
|
|
207
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
208
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
209
|
+
}), canAdd && jsxRuntime.jsx(Grid__default["default"], {
|
|
210
|
+
container: true,
|
|
211
|
+
justifyContent: 'flex-end',
|
|
212
|
+
children: jsxRuntime.jsx(Grid__default["default"], {
|
|
213
|
+
item: true,
|
|
214
|
+
children: jsxRuntime.jsx(Box__default["default"], {
|
|
215
|
+
mt: 2,
|
|
216
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
217
|
+
className: 'array-item-add',
|
|
218
|
+
onClick: onAddClick,
|
|
219
|
+
disabled: disabled || readonly,
|
|
220
|
+
uiSchema: uiSchema,
|
|
221
|
+
registry: registry
|
|
222
|
+
})
|
|
223
|
+
})
|
|
224
|
+
})
|
|
225
|
+
})]
|
|
226
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
227
|
+
})
|
|
228
|
+
});
|
|
210
229
|
}
|
|
211
230
|
|
|
212
|
-
var _excluded$2 = ["id", "placeholder", "required", "readonly", "disabled", "type", "label", "value", "onChange", "onBlur", "onFocus", "autofocus", "options", "schema", "uiSchema", "rawErrors", "formContext", "registry"],
|
|
231
|
+
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
232
|
_excluded2$1 = ["step", "min", "max"];
|
|
233
|
+
var TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];
|
|
214
234
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
215
235
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
216
236
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -227,6 +247,7 @@
|
|
|
227
247
|
label = props.label,
|
|
228
248
|
value = props.value,
|
|
229
249
|
onChange = props.onChange,
|
|
250
|
+
onChangeOverride = props.onChangeOverride,
|
|
230
251
|
onBlur = props.onBlur,
|
|
231
252
|
onFocus = props.onFocus,
|
|
232
253
|
autofocus = props.autofocus,
|
|
@@ -236,6 +257,7 @@
|
|
|
236
257
|
_props$rawErrors = props.rawErrors,
|
|
237
258
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
238
259
|
registry = props.registry,
|
|
260
|
+
InputLabelProps = props.InputLabelProps,
|
|
239
261
|
textFieldProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
240
262
|
var inputProps = utils.getInputProps(schema, type, options);
|
|
241
263
|
// Now we need to pull out the step, min, max into an inner `inputProps` for material-ui
|
|
@@ -254,7 +276,7 @@
|
|
|
254
276
|
}, rest);
|
|
255
277
|
var _onChange = function _onChange(_ref) {
|
|
256
278
|
var value = _ref.target.value;
|
|
257
|
-
return onChange(value ===
|
|
279
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
258
280
|
};
|
|
259
281
|
var _onBlur = function _onBlur(_ref2) {
|
|
260
282
|
var value = _ref2.target.value;
|
|
@@ -266,30 +288,36 @@
|
|
|
266
288
|
};
|
|
267
289
|
var schemaUtils = registry.schemaUtils;
|
|
268
290
|
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
|
-
|
|
291
|
+
var DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? _extends({}, InputLabelProps, {
|
|
292
|
+
shrink: true
|
|
293
|
+
}) : InputLabelProps;
|
|
294
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
295
|
+
children: [jsxRuntime.jsx(TextField__default["default"], _extends({
|
|
296
|
+
id: id,
|
|
297
|
+
name: id,
|
|
298
|
+
placeholder: placeholder,
|
|
299
|
+
label: displayLabel ? label || schema.title : false,
|
|
300
|
+
autoFocus: autofocus,
|
|
301
|
+
required: required,
|
|
302
|
+
disabled: disabled || readonly
|
|
303
|
+
}, otherProps, {
|
|
304
|
+
value: value || value === 0 ? value : '',
|
|
305
|
+
error: rawErrors.length > 0,
|
|
306
|
+
onChange: onChangeOverride || _onChange,
|
|
307
|
+
onBlur: _onBlur,
|
|
308
|
+
onFocus: _onFocus,
|
|
309
|
+
InputLabelProps: DisplayInputLabelProps
|
|
310
|
+
}, textFieldProps, {
|
|
311
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
312
|
+
})), Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
313
|
+
id: utils.examplesId(id),
|
|
314
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
315
|
+
return jsxRuntime.jsx("option", {
|
|
316
|
+
value: example
|
|
317
|
+
}, example);
|
|
318
|
+
})
|
|
319
|
+
})]
|
|
320
|
+
});
|
|
293
321
|
}
|
|
294
322
|
|
|
295
323
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -300,13 +328,14 @@
|
|
|
300
328
|
var id = props.id,
|
|
301
329
|
description = props.description;
|
|
302
330
|
if (description) {
|
|
303
|
-
return
|
|
331
|
+
return jsxRuntime.jsx(Typography__default["default"], {
|
|
304
332
|
id: id,
|
|
305
|
-
variant:
|
|
333
|
+
variant: 'subtitle2',
|
|
306
334
|
style: {
|
|
307
|
-
marginTop:
|
|
308
|
-
}
|
|
309
|
-
|
|
335
|
+
marginTop: '5px'
|
|
336
|
+
},
|
|
337
|
+
children: description
|
|
338
|
+
});
|
|
310
339
|
}
|
|
311
340
|
return null;
|
|
312
341
|
}
|
|
@@ -319,24 +348,30 @@
|
|
|
319
348
|
var errors = _ref.errors,
|
|
320
349
|
registry = _ref.registry;
|
|
321
350
|
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
|
-
|
|
351
|
+
return jsxRuntime.jsx(Paper__default["default"], {
|
|
352
|
+
elevation: 2,
|
|
353
|
+
children: jsxRuntime.jsxs(Box__default["default"], {
|
|
354
|
+
mb: 2,
|
|
355
|
+
p: 2,
|
|
356
|
+
children: [jsxRuntime.jsx(Typography__default["default"], {
|
|
357
|
+
variant: 'h6',
|
|
358
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
359
|
+
}), jsxRuntime.jsx(List__default["default"], {
|
|
360
|
+
dense: true,
|
|
361
|
+
children: errors.map(function (error, i) {
|
|
362
|
+
return jsxRuntime.jsxs(ListItem__default["default"], {
|
|
363
|
+
children: [jsxRuntime.jsx(ListItemIcon__default["default"], {
|
|
364
|
+
children: jsxRuntime.jsx(ErrorIcon__default["default"], {
|
|
365
|
+
color: 'error'
|
|
366
|
+
})
|
|
367
|
+
}), jsxRuntime.jsx(ListItemText__default["default"], {
|
|
368
|
+
primary: error.stack
|
|
369
|
+
})]
|
|
370
|
+
}, i);
|
|
371
|
+
})
|
|
372
|
+
})]
|
|
373
|
+
})
|
|
374
|
+
});
|
|
340
375
|
}
|
|
341
376
|
|
|
342
377
|
var _excluded$1 = ["icon", "color", "uiSchema", "registry"],
|
|
@@ -345,28 +380,39 @@
|
|
|
345
380
|
var icon = props.icon,
|
|
346
381
|
color = props.color,
|
|
347
382
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
348
|
-
return
|
|
349
|
-
size:
|
|
350
|
-
color: color
|
|
351
|
-
|
|
383
|
+
return jsxRuntime.jsx(IconButton__default["default"], _extends({}, otherProps, {
|
|
384
|
+
size: 'small',
|
|
385
|
+
color: color,
|
|
386
|
+
children: icon
|
|
387
|
+
}));
|
|
388
|
+
}
|
|
389
|
+
function CopyButton(props) {
|
|
390
|
+
var translateString = props.registry.translateString;
|
|
391
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
392
|
+
title: translateString(utils.TranslatableString.CopyButton)
|
|
393
|
+
}, props, {
|
|
394
|
+
icon: jsxRuntime.jsx(CopyIcon__default["default"], {
|
|
395
|
+
fontSize: 'small'
|
|
396
|
+
})
|
|
397
|
+
}));
|
|
352
398
|
}
|
|
353
399
|
function MoveDownButton(props) {
|
|
354
400
|
var translateString = props.registry.translateString;
|
|
355
|
-
return
|
|
401
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
356
402
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
357
403
|
}, props, {
|
|
358
|
-
icon:
|
|
359
|
-
fontSize:
|
|
404
|
+
icon: jsxRuntime.jsx(ArrowDownwardIcon__default["default"], {
|
|
405
|
+
fontSize: 'small'
|
|
360
406
|
})
|
|
361
407
|
}));
|
|
362
408
|
}
|
|
363
409
|
function MoveUpButton(props) {
|
|
364
410
|
var translateString = props.registry.translateString;
|
|
365
|
-
return
|
|
411
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
366
412
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
367
413
|
}, props, {
|
|
368
|
-
icon:
|
|
369
|
-
fontSize:
|
|
414
|
+
icon: jsxRuntime.jsx(ArrowUpwardIcon__default["default"], {
|
|
415
|
+
fontSize: 'small'
|
|
370
416
|
})
|
|
371
417
|
}));
|
|
372
418
|
}
|
|
@@ -374,12 +420,12 @@
|
|
|
374
420
|
var iconType = props.iconType,
|
|
375
421
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
376
422
|
var translateString = otherProps.registry.translateString;
|
|
377
|
-
return
|
|
423
|
+
return jsxRuntime.jsx(MuiIconButton, _extends({
|
|
378
424
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
379
425
|
}, otherProps, {
|
|
380
|
-
color:
|
|
381
|
-
icon:
|
|
382
|
-
fontSize: iconType ===
|
|
426
|
+
color: 'error',
|
|
427
|
+
icon: jsxRuntime.jsx(RemoveIcon__default["default"], {
|
|
428
|
+
fontSize: iconType === 'default' ? undefined : 'small'
|
|
383
429
|
})
|
|
384
430
|
}));
|
|
385
431
|
}
|
|
@@ -396,17 +442,19 @@
|
|
|
396
442
|
return null;
|
|
397
443
|
}
|
|
398
444
|
var id = utils.errorId(idSchema);
|
|
399
|
-
return
|
|
445
|
+
return jsxRuntime.jsx(List__default["default"], {
|
|
400
446
|
dense: true,
|
|
401
|
-
disablePadding: true
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
447
|
+
disablePadding: true,
|
|
448
|
+
children: errors.map(function (error, i) {
|
|
449
|
+
return jsxRuntime.jsx(ListItem__default["default"], {
|
|
450
|
+
disableGutters: true,
|
|
451
|
+
children: jsxRuntime.jsx(FormHelperText__default["default"], {
|
|
452
|
+
id: id,
|
|
453
|
+
children: error
|
|
454
|
+
})
|
|
455
|
+
}, i);
|
|
456
|
+
})
|
|
457
|
+
});
|
|
410
458
|
}
|
|
411
459
|
|
|
412
460
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -420,9 +468,10 @@
|
|
|
420
468
|
return null;
|
|
421
469
|
}
|
|
422
470
|
var id = utils.helpId(idSchema);
|
|
423
|
-
return
|
|
424
|
-
id: id
|
|
425
|
-
|
|
471
|
+
return jsxRuntime.jsx(FormHelperText__default["default"], {
|
|
472
|
+
id: id,
|
|
473
|
+
children: help
|
|
474
|
+
});
|
|
426
475
|
}
|
|
427
476
|
|
|
428
477
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
@@ -452,15 +501,16 @@
|
|
|
452
501
|
uiSchema = props.uiSchema,
|
|
453
502
|
registry = props.registry;
|
|
454
503
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
455
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
504
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
456
505
|
if (hidden) {
|
|
457
|
-
return
|
|
506
|
+
return jsxRuntime.jsx("div", {
|
|
458
507
|
style: {
|
|
459
|
-
display:
|
|
460
|
-
}
|
|
461
|
-
|
|
508
|
+
display: 'none'
|
|
509
|
+
},
|
|
510
|
+
children: children
|
|
511
|
+
});
|
|
462
512
|
}
|
|
463
|
-
return
|
|
513
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
464
514
|
classNames: classNames,
|
|
465
515
|
style: style,
|
|
466
516
|
disabled: disabled,
|
|
@@ -472,15 +522,18 @@
|
|
|
472
522
|
required: required,
|
|
473
523
|
schema: schema,
|
|
474
524
|
uiSchema: uiSchema,
|
|
475
|
-
registry: registry
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
525
|
+
registry: registry,
|
|
526
|
+
children: jsxRuntime.jsxs(FormControl__default["default"], {
|
|
527
|
+
fullWidth: true,
|
|
528
|
+
error: rawErrors.length ? true : false,
|
|
529
|
+
required: required,
|
|
530
|
+
children: [children, displayLabel && rawDescription ? jsxRuntime.jsx(Typography__default["default"], {
|
|
531
|
+
variant: 'caption',
|
|
532
|
+
color: 'textSecondary',
|
|
533
|
+
children: rawDescription
|
|
534
|
+
}) : null, errors, help]
|
|
535
|
+
})
|
|
536
|
+
});
|
|
484
537
|
}
|
|
485
538
|
|
|
486
539
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -503,54 +556,59 @@
|
|
|
503
556
|
onAddClick = props.onAddClick,
|
|
504
557
|
registry = props.registry;
|
|
505
558
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
506
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
507
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
559
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
560
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
508
561
|
// Button templates are not overridden in the uiSchema
|
|
509
562
|
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
|
-
|
|
563
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
564
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
565
|
+
id: utils.titleId(idSchema),
|
|
566
|
+
title: title,
|
|
567
|
+
required: required,
|
|
568
|
+
schema: schema,
|
|
569
|
+
uiSchema: uiSchema,
|
|
570
|
+
registry: registry
|
|
571
|
+
}), (uiOptions.description || description) && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
572
|
+
id: utils.descriptionId(idSchema),
|
|
573
|
+
description: uiOptions.description || description,
|
|
574
|
+
schema: schema,
|
|
575
|
+
uiSchema: uiSchema,
|
|
576
|
+
registry: registry
|
|
577
|
+
}), jsxRuntime.jsxs(Grid__default["default"], {
|
|
578
|
+
container: true,
|
|
579
|
+
spacing: 2,
|
|
580
|
+
style: {
|
|
581
|
+
marginTop: '10px'
|
|
582
|
+
},
|
|
583
|
+
children: [properties.map(function (element, index) {
|
|
584
|
+
return (
|
|
585
|
+
// Remove the <Grid> if the inner element is hidden as the <Grid>
|
|
586
|
+
// itself would otherwise still take up space.
|
|
587
|
+
element.hidden ? element.content : jsxRuntime.jsx(Grid__default["default"], {
|
|
588
|
+
item: true,
|
|
589
|
+
xs: 12,
|
|
590
|
+
style: {
|
|
591
|
+
marginBottom: '10px'
|
|
592
|
+
},
|
|
593
|
+
children: element.content
|
|
594
|
+
}, index)
|
|
595
|
+
);
|
|
596
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(Grid__default["default"], {
|
|
597
|
+
container: true,
|
|
598
|
+
justifyContent: 'flex-end',
|
|
599
|
+
children: jsxRuntime.jsx(Grid__default["default"], {
|
|
600
|
+
item: true,
|
|
601
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
602
|
+
className: 'object-property-expand',
|
|
603
|
+
onClick: onAddClick(schema),
|
|
604
|
+
disabled: disabled || readonly,
|
|
605
|
+
uiSchema: uiSchema,
|
|
606
|
+
registry: registry
|
|
607
|
+
})
|
|
608
|
+
})
|
|
609
|
+
})]
|
|
610
|
+
})]
|
|
611
|
+
});
|
|
554
612
|
}
|
|
555
613
|
|
|
556
614
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -565,13 +623,16 @@
|
|
|
565
623
|
if (norender) {
|
|
566
624
|
return null;
|
|
567
625
|
}
|
|
568
|
-
return
|
|
569
|
-
marginTop: 3
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
626
|
+
return jsxRuntime.jsx(Box__default["default"], {
|
|
627
|
+
marginTop: 3,
|
|
628
|
+
children: jsxRuntime.jsx(Button__default["default"], _extends({
|
|
629
|
+
type: 'submit',
|
|
630
|
+
variant: 'contained',
|
|
631
|
+
color: 'primary'
|
|
632
|
+
}, submitButtonProps, {
|
|
633
|
+
children: submitText
|
|
634
|
+
}))
|
|
635
|
+
});
|
|
575
636
|
}
|
|
576
637
|
|
|
577
638
|
/** The `TitleField` is the template to use to render the title of a field
|
|
@@ -581,13 +642,15 @@
|
|
|
581
642
|
function TitleField(_ref) {
|
|
582
643
|
var id = _ref.id,
|
|
583
644
|
title = _ref.title;
|
|
584
|
-
return
|
|
645
|
+
return jsxRuntime.jsxs(Box__default["default"], {
|
|
585
646
|
id: id,
|
|
586
647
|
mb: 1,
|
|
587
|
-
mt: 1
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
648
|
+
mt: 1,
|
|
649
|
+
children: [jsxRuntime.jsx(Typography__default["default"], {
|
|
650
|
+
variant: 'h5',
|
|
651
|
+
children: title
|
|
652
|
+
}), jsxRuntime.jsx(Divider__default["default"], {})]
|
|
653
|
+
});
|
|
591
654
|
}
|
|
592
655
|
|
|
593
656
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -619,51 +682,58 @@
|
|
|
619
682
|
flex: 1,
|
|
620
683
|
paddingLeft: 6,
|
|
621
684
|
paddingRight: 6,
|
|
622
|
-
fontWeight:
|
|
685
|
+
fontWeight: 'bold'
|
|
623
686
|
};
|
|
624
687
|
if (!additional) {
|
|
625
|
-
return
|
|
688
|
+
return jsxRuntime.jsx("div", {
|
|
626
689
|
className: classNames,
|
|
627
|
-
style: style
|
|
628
|
-
|
|
690
|
+
style: style,
|
|
691
|
+
children: children
|
|
692
|
+
});
|
|
629
693
|
}
|
|
630
694
|
var handleBlur = function handleBlur(_ref) {
|
|
631
695
|
var target = _ref.target;
|
|
632
696
|
return onKeyChange(target.value);
|
|
633
697
|
};
|
|
634
|
-
return
|
|
698
|
+
return jsxRuntime.jsxs(Grid__default["default"], {
|
|
635
699
|
container: true,
|
|
636
|
-
|
|
637
|
-
alignItems: "center",
|
|
700
|
+
alignItems: 'center',
|
|
638
701
|
spacing: 2,
|
|
639
702
|
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
|
-
|
|
703
|
+
style: style,
|
|
704
|
+
children: [jsxRuntime.jsx(Grid__default["default"], {
|
|
705
|
+
item: true,
|
|
706
|
+
xs: true,
|
|
707
|
+
children: jsxRuntime.jsxs(FormControl__default["default"], {
|
|
708
|
+
fullWidth: true,
|
|
709
|
+
required: required,
|
|
710
|
+
children: [jsxRuntime.jsx(InputLabel__default["default"], {
|
|
711
|
+
children: keyLabel
|
|
712
|
+
}), jsxRuntime.jsx(Input__default["default"], {
|
|
713
|
+
defaultValue: label,
|
|
714
|
+
disabled: disabled || readonly,
|
|
715
|
+
id: id + "-key",
|
|
716
|
+
name: id + "-key",
|
|
717
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
718
|
+
type: 'text'
|
|
719
|
+
})]
|
|
720
|
+
})
|
|
721
|
+
}), jsxRuntime.jsx(Grid__default["default"], {
|
|
722
|
+
item: true,
|
|
723
|
+
xs: true,
|
|
724
|
+
children: children
|
|
725
|
+
}), jsxRuntime.jsx(Grid__default["default"], {
|
|
726
|
+
item: true,
|
|
727
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
728
|
+
iconType: 'default',
|
|
729
|
+
style: btnStyle,
|
|
730
|
+
disabled: disabled || readonly,
|
|
731
|
+
onClick: onDropPropertyClick(label),
|
|
732
|
+
uiSchema: uiSchema,
|
|
733
|
+
registry: registry
|
|
734
|
+
})
|
|
735
|
+
})]
|
|
736
|
+
}, id + "-key");
|
|
667
737
|
}
|
|
668
738
|
|
|
669
739
|
function generateTemplates() {
|
|
@@ -673,6 +743,7 @@
|
|
|
673
743
|
BaseInputTemplate: BaseInputTemplate,
|
|
674
744
|
ButtonTemplates: {
|
|
675
745
|
AddButton: AddButton,
|
|
746
|
+
CopyButton: CopyButton,
|
|
676
747
|
MoveDownButton: MoveDownButton,
|
|
677
748
|
MoveUpButton: MoveUpButton,
|
|
678
749
|
RemoveButton: RemoveButton,
|
|
@@ -721,11 +792,11 @@
|
|
|
721
792
|
var value = _ref2.target.value;
|
|
722
793
|
return onFocus(id, value);
|
|
723
794
|
};
|
|
724
|
-
return
|
|
725
|
-
control:
|
|
795
|
+
return jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
796
|
+
control: jsxRuntime.jsx(Checkbox__default["default"], {
|
|
726
797
|
id: id,
|
|
727
798
|
name: id,
|
|
728
|
-
checked: typeof value ===
|
|
799
|
+
checked: typeof value === 'undefined' ? false : Boolean(value),
|
|
729
800
|
required: required,
|
|
730
801
|
disabled: disabled || readonly,
|
|
731
802
|
autoFocus: autofocus,
|
|
@@ -734,7 +805,7 @@
|
|
|
734
805
|
onFocus: _onFocus,
|
|
735
806
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
736
807
|
}),
|
|
737
|
-
label: label ||
|
|
808
|
+
label: label || ''
|
|
738
809
|
});
|
|
739
810
|
}
|
|
740
811
|
|
|
@@ -779,73 +850,35 @@
|
|
|
779
850
|
var value = _ref4.target.value;
|
|
780
851
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
781
852
|
};
|
|
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
|
-
}));
|
|
853
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
854
|
+
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
855
|
+
required: required,
|
|
856
|
+
htmlFor: id,
|
|
857
|
+
children: label || schema.title
|
|
858
|
+
}), jsxRuntime.jsx(FormGroup__default["default"], {
|
|
859
|
+
id: id,
|
|
860
|
+
row: !!inline,
|
|
861
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
862
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
863
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
864
|
+
var checkbox = jsxRuntime.jsx(Checkbox__default["default"], {
|
|
865
|
+
id: utils.optionId(id, index),
|
|
866
|
+
name: id,
|
|
867
|
+
checked: checked,
|
|
868
|
+
disabled: disabled || itemDisabled || readonly,
|
|
869
|
+
autoFocus: autofocus && index === 0,
|
|
870
|
+
onChange: _onChange(index),
|
|
871
|
+
onBlur: _onBlur,
|
|
872
|
+
onFocus: _onFocus,
|
|
873
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
874
|
+
});
|
|
875
|
+
return jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
876
|
+
control: checkbox,
|
|
877
|
+
label: option.label
|
|
878
|
+
}, index);
|
|
879
|
+
})
|
|
880
|
+
})]
|
|
881
|
+
});
|
|
849
882
|
}
|
|
850
883
|
|
|
851
884
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
@@ -881,33 +914,36 @@
|
|
|
881
914
|
};
|
|
882
915
|
var row = options ? options.inline : false;
|
|
883
916
|
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
|
-
|
|
917
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
918
|
+
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
919
|
+
required: required,
|
|
920
|
+
htmlFor: id,
|
|
921
|
+
children: label || schema.title
|
|
922
|
+
}), jsxRuntime.jsx(RadioGroup__default["default"], {
|
|
923
|
+
id: id,
|
|
924
|
+
name: id,
|
|
925
|
+
value: selectedIndex,
|
|
926
|
+
row: row,
|
|
927
|
+
onChange: _onChange,
|
|
928
|
+
onBlur: _onBlur,
|
|
929
|
+
onFocus: _onFocus,
|
|
930
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
931
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
932
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
933
|
+
var radio = jsxRuntime.jsx(FormControlLabel__default["default"], {
|
|
934
|
+
control: jsxRuntime.jsx(Radio__default["default"], {
|
|
935
|
+
name: id,
|
|
936
|
+
id: utils.optionId(id, index),
|
|
937
|
+
color: 'primary'
|
|
938
|
+
}),
|
|
939
|
+
label: option.label,
|
|
940
|
+
value: String(index),
|
|
941
|
+
disabled: disabled || itemDisabled || readonly
|
|
942
|
+
}, index);
|
|
943
|
+
return radio;
|
|
944
|
+
})
|
|
945
|
+
})]
|
|
946
|
+
});
|
|
911
947
|
}
|
|
912
948
|
|
|
913
949
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -944,21 +980,24 @@
|
|
|
944
980
|
var value = _ref2.target.value;
|
|
945
981
|
return onFocus(id, value);
|
|
946
982
|
};
|
|
947
|
-
return
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
983
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
984
|
+
children: [jsxRuntime.jsx(FormLabel__default["default"], {
|
|
985
|
+
required: required,
|
|
986
|
+
htmlFor: id,
|
|
987
|
+
children: label || schema.title
|
|
988
|
+
}), jsxRuntime.jsx(Slider__default["default"], _extends({
|
|
989
|
+
disabled: disabled || readonly,
|
|
990
|
+
onChange: _onChange,
|
|
991
|
+
onBlur: _onBlur,
|
|
992
|
+
onFocus: _onFocus,
|
|
993
|
+
valueLabelDisplay: 'auto'
|
|
994
|
+
}, sliderProps, {
|
|
995
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
996
|
+
}))]
|
|
997
|
+
});
|
|
959
998
|
}
|
|
960
999
|
|
|
961
|
-
var _excluded = ["schema", "id", "options", "label", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
1000
|
+
var _excluded = ["schema", "id", "name", "options", "label", "required", "disabled", "placeholder", "readonly", "value", "multiple", "autofocus", "onChange", "onBlur", "onFocus", "rawErrors", "registry", "uiSchema", "hideError", "formContext"];
|
|
962
1001
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
963
1002
|
* It is typically used with string properties constrained with enum options.
|
|
964
1003
|
*
|
|
@@ -985,9 +1024,9 @@
|
|
|
985
1024
|
var enumOptions = options.enumOptions,
|
|
986
1025
|
enumDisabled = options.enumDisabled,
|
|
987
1026
|
optEmptyVal = options.emptyValue;
|
|
988
|
-
multiple = typeof multiple ===
|
|
989
|
-
var emptyValue = multiple ? [] :
|
|
990
|
-
var isEmpty = typeof value ===
|
|
1027
|
+
multiple = typeof multiple === 'undefined' ? false : !!multiple;
|
|
1028
|
+
var emptyValue = multiple ? [] : '';
|
|
1029
|
+
var isEmpty = typeof value === 'undefined' || multiple && value.length < 1 || !multiple && value === emptyValue;
|
|
991
1030
|
var _onChange = function _onChange(_ref2) {
|
|
992
1031
|
var value = _ref2.target.value;
|
|
993
1032
|
return onChange(utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
@@ -1001,7 +1040,7 @@
|
|
|
1001
1040
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1002
1041
|
};
|
|
1003
1042
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1004
|
-
return
|
|
1043
|
+
return jsxRuntime.jsx(TextField__default["default"], _extends({
|
|
1005
1044
|
id: id,
|
|
1006
1045
|
name: id,
|
|
1007
1046
|
label: label || schema.title,
|
|
@@ -1023,16 +1062,17 @@
|
|
|
1023
1062
|
SelectProps: _extends({}, textFieldProps.SelectProps, {
|
|
1024
1063
|
multiple: multiple
|
|
1025
1064
|
}),
|
|
1026
|
-
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1065
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1066
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (_ref5, i) {
|
|
1067
|
+
var value = _ref5.value,
|
|
1068
|
+
label = _ref5.label;
|
|
1069
|
+
var disabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1;
|
|
1070
|
+
return jsxRuntime.jsx(MenuItem__default["default"], {
|
|
1071
|
+
value: String(i),
|
|
1072
|
+
disabled: disabled,
|
|
1073
|
+
children: label
|
|
1074
|
+
}, i);
|
|
1075
|
+
})
|
|
1036
1076
|
}));
|
|
1037
1077
|
}
|
|
1038
1078
|
|
|
@@ -1043,12 +1083,12 @@
|
|
|
1043
1083
|
function TextareaWidget(props) {
|
|
1044
1084
|
var options = props.options,
|
|
1045
1085
|
registry = props.registry;
|
|
1046
|
-
var BaseInputTemplate = utils.getTemplate(
|
|
1086
|
+
var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
|
|
1047
1087
|
var rows = 5;
|
|
1048
|
-
if (typeof options.rows ===
|
|
1088
|
+
if (typeof options.rows === 'string' || typeof options.rows === 'number') {
|
|
1049
1089
|
rows = options.rows;
|
|
1050
1090
|
}
|
|
1051
|
-
return
|
|
1091
|
+
return jsxRuntime.jsx(BaseInputTemplate, _extends({}, props, {
|
|
1052
1092
|
multiline: true,
|
|
1053
1093
|
rows: rows
|
|
1054
1094
|
}));
|
|
@@ -1058,8 +1098,6 @@
|
|
|
1058
1098
|
return {
|
|
1059
1099
|
CheckboxWidget: CheckboxWidget,
|
|
1060
1100
|
CheckboxesWidget: CheckboxesWidget,
|
|
1061
|
-
DateWidget: DateWidget,
|
|
1062
|
-
DateTimeWidget: DateTimeWidget,
|
|
1063
1101
|
RadioWidget: RadioWidget,
|
|
1064
1102
|
RangeWidget: RangeWidget,
|
|
1065
1103
|
SelectWidget: SelectWidget,
|