@rjsf/semantic-ui 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 +15 -12
- package/dist/semantic-ui.cjs.development.js +407 -341
- package/dist/semantic-ui.cjs.development.js.map +1 -1
- package/dist/semantic-ui.cjs.production.min.js +1 -1
- package/dist/semantic-ui.cjs.production.min.js.map +1 -1
- package/dist/semantic-ui.esm.js +407 -340
- package/dist/semantic-ui.esm.js.map +1 -1
- package/dist/semantic-ui.umd.development.js +409 -344
- package/dist/semantic-ui.umd.development.js.map +1 -1
- package/dist/semantic-ui.umd.production.min.js +1 -1
- package/dist/semantic-ui.umd.production.min.js.map +1 -1
- package/package.json +11 -11
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var core = require('@rjsf/core');
|
|
6
6
|
var semanticUiReact = require('semantic-ui-react');
|
|
7
|
-
var
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var utils = require('@rjsf/utils');
|
|
9
9
|
var nanoid = require('nanoid');
|
|
10
|
+
var react = require('react');
|
|
10
11
|
var map = require('lodash/map');
|
|
11
12
|
|
|
12
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
14
|
|
|
14
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
15
|
var map__default = /*#__PURE__*/_interopDefaultLegacy(map);
|
|
16
16
|
|
|
17
17
|
function _extends() {
|
|
@@ -49,14 +49,15 @@ function AddButton(_ref) {
|
|
|
49
49
|
color = _ref.color,
|
|
50
50
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
51
51
|
var translateString = registry.translateString;
|
|
52
|
-
return
|
|
52
|
+
return jsxRuntime.jsx(semanticUiReact.Button, _extends({
|
|
53
53
|
title: translateString(utils.TranslatableString.AddItemButton),
|
|
54
54
|
color: color
|
|
55
55
|
}, props, {
|
|
56
56
|
icon: true,
|
|
57
|
-
size:
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
size: 'tiny',
|
|
58
|
+
children: jsxRuntime.jsx(semanticUiReact.Icon, {
|
|
59
|
+
name: 'plus'
|
|
60
|
+
})
|
|
60
61
|
}));
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -110,8 +111,8 @@ function getSemanticErrorProps(_ref2) {
|
|
|
110
111
|
options = _ref2$options === void 0 ? {} : _ref2$options,
|
|
111
112
|
_ref2$defaultProps = _ref2.defaultProps,
|
|
112
113
|
defaultProps = _ref2$defaultProps === void 0 ? {
|
|
113
|
-
size:
|
|
114
|
-
pointing:
|
|
114
|
+
size: 'small',
|
|
115
|
+
pointing: 'above'
|
|
115
116
|
} : _ref2$defaultProps;
|
|
116
117
|
var formContextProps = formContext.semantic && formContext.semantic.errorOptions;
|
|
117
118
|
var semanticOptions = utils.getUiOptions(uiSchema).semantic;
|
|
@@ -141,7 +142,7 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
141
142
|
// returning them as a string
|
|
142
143
|
return [].concat(new Set(classList.filter(function (cn) {
|
|
143
144
|
return !omit.includes(cn);
|
|
144
|
-
}))).join(
|
|
145
|
+
}))).join(' ');
|
|
145
146
|
}
|
|
146
147
|
/**
|
|
147
148
|
*
|
|
@@ -154,15 +155,15 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
154
155
|
function MaybeWrap(_ref3) {
|
|
155
156
|
var wrap = _ref3.wrap,
|
|
156
157
|
_ref3$component = _ref3.component,
|
|
157
|
-
Component = _ref3$component === void 0 ?
|
|
158
|
+
Component = _ref3$component === void 0 ? 'div' : _ref3$component,
|
|
158
159
|
props = _objectWithoutPropertiesLoose(_ref3, _excluded$3);
|
|
159
|
-
return wrap ?
|
|
160
|
+
return wrap ? jsxRuntime.jsx(Component, _extends({}, props)) : props.children;
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
var gridStyle = function gridStyle(vertical) {
|
|
163
164
|
return {
|
|
164
|
-
display:
|
|
165
|
-
gridTemplateColumns: "1fr " + (vertical ? 65 :
|
|
165
|
+
display: 'grid',
|
|
166
|
+
gridTemplateColumns: "1fr " + (vertical ? 65 : 150) + "px"
|
|
166
167
|
};
|
|
167
168
|
};
|
|
168
169
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
@@ -173,16 +174,19 @@ function ArrayFieldItemTemplate(props) {
|
|
|
173
174
|
var children = props.children,
|
|
174
175
|
disabled = props.disabled,
|
|
175
176
|
hasToolbar = props.hasToolbar,
|
|
177
|
+
hasCopy = props.hasCopy,
|
|
176
178
|
hasMoveDown = props.hasMoveDown,
|
|
177
179
|
hasMoveUp = props.hasMoveUp,
|
|
178
180
|
hasRemove = props.hasRemove,
|
|
179
181
|
index = props.index,
|
|
182
|
+
onCopyIndexClick = props.onCopyIndexClick,
|
|
180
183
|
onDropIndexClick = props.onDropIndexClick,
|
|
181
184
|
onReorderClick = props.onReorderClick,
|
|
182
185
|
readonly = props.readonly,
|
|
183
186
|
uiSchema = props.uiSchema,
|
|
184
187
|
registry = props.registry;
|
|
185
188
|
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
189
|
+
CopyButton = _registry$templates$B.CopyButton,
|
|
186
190
|
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
187
191
|
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
188
192
|
RemoveButton = _registry$templates$B.RemoveButton;
|
|
@@ -190,43 +194,56 @@ function ArrayFieldItemTemplate(props) {
|
|
|
190
194
|
// Pull the semantic props out of the uiOptions that were put in via the ArrayFieldTemplate
|
|
191
195
|
var _uiOptions$semantic = uiOptions.semantic,
|
|
192
196
|
_uiOptions$semantic$h = _uiOptions$semantic.horizontalButtons,
|
|
193
|
-
horizontalButtons = _uiOptions$semantic$h === void 0 ?
|
|
197
|
+
horizontalButtons = _uiOptions$semantic$h === void 0 ? true : _uiOptions$semantic$h,
|
|
194
198
|
_uiOptions$semantic$w = _uiOptions$semantic.wrapItem,
|
|
195
199
|
wrapItem = _uiOptions$semantic$w === void 0 ? false : _uiOptions$semantic$w;
|
|
196
|
-
return
|
|
197
|
-
className:
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
200
|
+
return jsxRuntime.jsx("div", {
|
|
201
|
+
className: 'array-item',
|
|
202
|
+
children: jsxRuntime.jsx(MaybeWrap, {
|
|
203
|
+
wrap: wrapItem,
|
|
204
|
+
component: semanticUiReact.Segment,
|
|
205
|
+
children: jsxRuntime.jsxs(semanticUiReact.Grid, {
|
|
206
|
+
style: _extends({}, gridStyle(!horizontalButtons), {
|
|
207
|
+
alignItems: 'center'
|
|
208
|
+
}),
|
|
209
|
+
children: [jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
210
|
+
width: 16,
|
|
211
|
+
verticalAlign: 'middle',
|
|
212
|
+
children: children
|
|
213
|
+
}), hasToolbar && jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
214
|
+
children: (hasMoveUp || hasMoveDown || hasRemove) && jsxRuntime.jsxs(semanticUiReact.Button.Group, {
|
|
215
|
+
size: 'mini',
|
|
216
|
+
vertical: !horizontalButtons,
|
|
217
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
218
|
+
className: 'array-item-move-up',
|
|
219
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
220
|
+
onClick: onReorderClick(index, index - 1),
|
|
221
|
+
uiSchema: uiSchema,
|
|
222
|
+
registry: registry
|
|
223
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
224
|
+
className: 'array-item-move-down',
|
|
225
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
226
|
+
onClick: onReorderClick(index, index + 1),
|
|
227
|
+
uiSchema: uiSchema,
|
|
228
|
+
registry: registry
|
|
229
|
+
}), hasCopy && jsxRuntime.jsx(CopyButton, {
|
|
230
|
+
className: 'array-item-copy',
|
|
231
|
+
disabled: disabled || readonly,
|
|
232
|
+
onClick: onCopyIndexClick(index),
|
|
233
|
+
uiSchema: uiSchema,
|
|
234
|
+
registry: registry
|
|
235
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
236
|
+
className: 'array-item-remove',
|
|
237
|
+
disabled: disabled || readonly,
|
|
238
|
+
onClick: onDropIndexClick(index),
|
|
239
|
+
uiSchema: uiSchema,
|
|
240
|
+
registry: registry
|
|
241
|
+
})]
|
|
242
|
+
})
|
|
243
|
+
})]
|
|
244
|
+
})
|
|
245
|
+
})
|
|
246
|
+
});
|
|
230
247
|
}
|
|
231
248
|
|
|
232
249
|
var _excluded$2 = ["key", "uiSchema"];
|
|
@@ -252,7 +269,7 @@ function ArrayFieldTemplate(props) {
|
|
|
252
269
|
uiSchema: uiSchema,
|
|
253
270
|
formContext: formContext,
|
|
254
271
|
defaultSchemaProps: {
|
|
255
|
-
horizontalButtons:
|
|
272
|
+
horizontalButtons: true,
|
|
256
273
|
wrapItem: false
|
|
257
274
|
}
|
|
258
275
|
});
|
|
@@ -263,57 +280,58 @@ function ArrayFieldTemplate(props) {
|
|
|
263
280
|
wrapItem: wrapItem
|
|
264
281
|
};
|
|
265
282
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
266
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
267
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
268
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
283
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
284
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
285
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
269
286
|
// Button templates are not overridden in the uiSchema
|
|
270
287
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
271
|
-
return
|
|
272
|
-
className: cleanClassNames([className, utils.isFixedItems(schema) ?
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
288
|
+
return jsxRuntime.jsxs("div", {
|
|
289
|
+
className: cleanClassNames([className, utils.isFixedItems(schema) ? '' : 'sortable-form-fields']),
|
|
290
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
291
|
+
idSchema: idSchema,
|
|
292
|
+
title: uiOptions.title || title,
|
|
293
|
+
schema: schema,
|
|
294
|
+
uiSchema: uiSchema,
|
|
295
|
+
required: required,
|
|
296
|
+
registry: registry
|
|
297
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
298
|
+
idSchema: idSchema,
|
|
299
|
+
description: uiOptions.description || schema.description,
|
|
300
|
+
schema: schema,
|
|
301
|
+
uiSchema: uiSchema,
|
|
302
|
+
registry: registry
|
|
303
|
+
}), jsxRuntime.jsxs("div", {
|
|
304
|
+
children: [jsxRuntime.jsx("div", {
|
|
305
|
+
className: 'row array-item-list',
|
|
306
|
+
children: items && items.map(function (_ref) {
|
|
307
|
+
var _extends2;
|
|
308
|
+
var key = _ref.key,
|
|
309
|
+
_ref$uiSchema = _ref.uiSchema,
|
|
310
|
+
itemUiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema,
|
|
311
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
312
|
+
// Merge in the semantic props from the ArrayFieldTemplate into each of the items
|
|
313
|
+
var mergedUiSchema = _extends({}, itemUiSchema, (_extends2 = {}, _extends2[utils.UI_OPTIONS_KEY] = _extends({}, itemUiSchema[utils.UI_OPTIONS_KEY], {
|
|
314
|
+
semantic: semantic
|
|
315
|
+
}), _extends2));
|
|
316
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, props, {
|
|
317
|
+
uiSchema: mergedUiSchema
|
|
318
|
+
}), key);
|
|
319
|
+
})
|
|
320
|
+
}), canAdd && jsxRuntime.jsx("div", {
|
|
321
|
+
style: {
|
|
322
|
+
marginTop: '1rem',
|
|
323
|
+
position: 'relative',
|
|
324
|
+
textAlign: 'right'
|
|
325
|
+
},
|
|
326
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
327
|
+
onClick: onAddClick,
|
|
328
|
+
disabled: disabled || readonly,
|
|
329
|
+
uiSchema: uiSchema,
|
|
330
|
+
registry: registry
|
|
331
|
+
})
|
|
332
|
+
})]
|
|
333
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
334
|
+
});
|
|
317
335
|
}
|
|
318
336
|
|
|
319
337
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
@@ -331,6 +349,7 @@ function BaseInputTemplate(props) {
|
|
|
331
349
|
readonly = props.readonly,
|
|
332
350
|
disabled = props.disabled,
|
|
333
351
|
onChange = props.onChange,
|
|
352
|
+
onChangeOverride = props.onChangeOverride,
|
|
334
353
|
onBlur = props.onBlur,
|
|
335
354
|
onFocus = props.onFocus,
|
|
336
355
|
autofocus = props.autofocus,
|
|
@@ -351,7 +370,7 @@ function BaseInputTemplate(props) {
|
|
|
351
370
|
var schemaUtils = registry.schemaUtils;
|
|
352
371
|
var _onChange = function _onChange(_ref) {
|
|
353
372
|
var value = _ref.target.value;
|
|
354
|
-
return onChange(value ===
|
|
373
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
355
374
|
};
|
|
356
375
|
var _onBlur = function _onBlur() {
|
|
357
376
|
return onBlur && onBlur(id, value);
|
|
@@ -360,32 +379,33 @@ function BaseInputTemplate(props) {
|
|
|
360
379
|
return onFocus && onFocus(id, value);
|
|
361
380
|
};
|
|
362
381
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
363
|
-
return
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
382
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
383
|
+
children: [jsxRuntime.jsx(semanticUiReact.Form.Input, _extends({
|
|
384
|
+
id: id,
|
|
385
|
+
name: id,
|
|
386
|
+
placeholder: placeholder
|
|
387
|
+
}, inputProps, {
|
|
388
|
+
label: displayLabel ? label || schema.title : false,
|
|
389
|
+
required: required,
|
|
390
|
+
autoFocus: autofocus,
|
|
391
|
+
disabled: disabled || readonly,
|
|
392
|
+
list: schema.examples ? utils.examplesId(id) : undefined
|
|
393
|
+
}, semanticProps, {
|
|
394
|
+
value: value || value === 0 ? value : '',
|
|
395
|
+
error: rawErrors.length > 0,
|
|
396
|
+
onChange: onChangeOverride || _onChange,
|
|
397
|
+
onBlur: _onBlur,
|
|
398
|
+
onFocus: _onFocus,
|
|
399
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
400
|
+
}), id), Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
401
|
+
id: utils.examplesId(id),
|
|
402
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
403
|
+
return jsxRuntime.jsx("option", {
|
|
404
|
+
value: example
|
|
405
|
+
}, example);
|
|
406
|
+
})
|
|
407
|
+
})]
|
|
408
|
+
});
|
|
389
409
|
}
|
|
390
410
|
|
|
391
411
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -398,10 +418,11 @@ function DescriptionField(props) {
|
|
|
398
418
|
if (!description) {
|
|
399
419
|
return null;
|
|
400
420
|
}
|
|
401
|
-
return
|
|
421
|
+
return jsxRuntime.jsx("p", {
|
|
402
422
|
id: id,
|
|
403
|
-
className:
|
|
404
|
-
|
|
423
|
+
className: 'sui-description',
|
|
424
|
+
children: description
|
|
425
|
+
});
|
|
405
426
|
}
|
|
406
427
|
|
|
407
428
|
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
@@ -412,13 +433,18 @@ function ErrorList(_ref) {
|
|
|
412
433
|
var errors = _ref.errors,
|
|
413
434
|
registry = _ref.registry;
|
|
414
435
|
var translateString = registry.translateString;
|
|
415
|
-
return
|
|
416
|
-
negative: true
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
436
|
+
return jsxRuntime.jsxs(semanticUiReact.Message, {
|
|
437
|
+
negative: true,
|
|
438
|
+
children: [jsxRuntime.jsx(semanticUiReact.Message.Header, {
|
|
439
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
440
|
+
}), jsxRuntime.jsx(semanticUiReact.Message.List, {
|
|
441
|
+
children: errors.map(function (error, index) {
|
|
442
|
+
return jsxRuntime.jsx(semanticUiReact.Message.Item, {
|
|
443
|
+
children: error.stack
|
|
444
|
+
}, "error-" + index);
|
|
445
|
+
})
|
|
446
|
+
})]
|
|
447
|
+
});
|
|
422
448
|
}
|
|
423
449
|
|
|
424
450
|
var _excluded$1 = ["icon", "iconType", "color", "className", "uiSchema", "registry"];
|
|
@@ -428,42 +454,50 @@ function IconButton(props) {
|
|
|
428
454
|
color = props.color,
|
|
429
455
|
className = props.className,
|
|
430
456
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
431
|
-
return
|
|
457
|
+
return jsxRuntime.jsx(semanticUiReact.Button, _extends({
|
|
432
458
|
icon: icon,
|
|
433
459
|
size: iconType,
|
|
434
460
|
color: color,
|
|
435
461
|
className: className
|
|
436
462
|
}, otherProps));
|
|
437
463
|
}
|
|
464
|
+
function CopyButton(props) {
|
|
465
|
+
var translateString = props.registry.translateString;
|
|
466
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
467
|
+
title: translateString(utils.TranslatableString.CopyButton)
|
|
468
|
+
}, props, {
|
|
469
|
+
icon: 'copy'
|
|
470
|
+
}));
|
|
471
|
+
}
|
|
438
472
|
function MoveDownButton(props) {
|
|
439
473
|
var translateString = props.registry.translateString;
|
|
440
|
-
return
|
|
474
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
441
475
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
442
476
|
}, props, {
|
|
443
|
-
icon:
|
|
477
|
+
icon: 'angle down'
|
|
444
478
|
}));
|
|
445
479
|
}
|
|
446
480
|
function MoveUpButton(props) {
|
|
447
481
|
var translateString = props.registry.translateString;
|
|
448
|
-
return
|
|
482
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
449
483
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
450
484
|
}, props, {
|
|
451
|
-
icon:
|
|
485
|
+
icon: 'angle up'
|
|
452
486
|
}));
|
|
453
487
|
}
|
|
454
488
|
function RemoveButton(props) {
|
|
455
489
|
var translateString = props.registry.translateString;
|
|
456
|
-
return
|
|
490
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
457
491
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
458
492
|
}, props, {
|
|
459
|
-
icon:
|
|
493
|
+
icon: 'trash'
|
|
460
494
|
}));
|
|
461
495
|
}
|
|
462
496
|
|
|
463
497
|
var DEFAULT_OPTIONS$1 = {
|
|
464
498
|
options: {
|
|
465
|
-
pointing:
|
|
466
|
-
size:
|
|
499
|
+
pointing: 'above',
|
|
500
|
+
size: 'small'
|
|
467
501
|
}
|
|
468
502
|
};
|
|
469
503
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -485,19 +519,21 @@ function FieldErrorTemplate(_ref) {
|
|
|
485
519
|
size = options.size;
|
|
486
520
|
if (errors && errors.length > 0) {
|
|
487
521
|
var id = utils.errorId(idSchema);
|
|
488
|
-
return
|
|
522
|
+
return jsxRuntime.jsx(semanticUiReact.Label, {
|
|
489
523
|
id: id,
|
|
490
|
-
color:
|
|
491
|
-
pointing: pointing ||
|
|
492
|
-
size: size ||
|
|
493
|
-
basic: true
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
524
|
+
color: 'red',
|
|
525
|
+
pointing: pointing || 'above',
|
|
526
|
+
size: size || 'small',
|
|
527
|
+
basic: true,
|
|
528
|
+
children: jsxRuntime.jsx(semanticUiReact.List, {
|
|
529
|
+
bulleted: true,
|
|
530
|
+
children: errors.map(function (error) {
|
|
531
|
+
return jsxRuntime.jsx(semanticUiReact.List.Item, {
|
|
532
|
+
children: error
|
|
533
|
+
}, nanoid.nanoid());
|
|
534
|
+
})
|
|
535
|
+
})
|
|
536
|
+
});
|
|
501
537
|
}
|
|
502
538
|
return null;
|
|
503
539
|
}
|
|
@@ -511,8 +547,8 @@ function FieldHelpTemplate(props) {
|
|
|
511
547
|
help = props.help;
|
|
512
548
|
if (help) {
|
|
513
549
|
var id = utils.helpId(idSchema);
|
|
514
|
-
return
|
|
515
|
-
size:
|
|
550
|
+
return jsxRuntime.jsx(semanticUiReact.Message, {
|
|
551
|
+
size: 'mini',
|
|
516
552
|
info: true,
|
|
517
553
|
id: id,
|
|
518
554
|
content: help
|
|
@@ -546,16 +582,17 @@ function FieldTemplate(props) {
|
|
|
546
582
|
var wrapLabel = semanticProps.wrapLabel,
|
|
547
583
|
wrapContent = semanticProps.wrapContent;
|
|
548
584
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
549
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
550
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
585
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
586
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
551
587
|
if (hidden) {
|
|
552
|
-
return
|
|
588
|
+
return jsxRuntime.jsx("div", {
|
|
553
589
|
style: {
|
|
554
|
-
display:
|
|
555
|
-
}
|
|
556
|
-
|
|
590
|
+
display: 'none'
|
|
591
|
+
},
|
|
592
|
+
children: children
|
|
593
|
+
});
|
|
557
594
|
}
|
|
558
|
-
return
|
|
595
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, _extends({
|
|
559
596
|
classNames: classNames,
|
|
560
597
|
style: style,
|
|
561
598
|
id: id,
|
|
@@ -563,23 +600,27 @@ function FieldTemplate(props) {
|
|
|
563
600
|
registry: registry,
|
|
564
601
|
schema: schema,
|
|
565
602
|
uiSchema: uiSchema
|
|
566
|
-
}, otherProps
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
603
|
+
}, otherProps, {
|
|
604
|
+
children: jsxRuntime.jsx(semanticUiReact.Form.Group, {
|
|
605
|
+
widths: 'equal',
|
|
606
|
+
grouped: true,
|
|
607
|
+
children: jsxRuntime.jsxs(MaybeWrap, {
|
|
608
|
+
wrap: wrapContent,
|
|
609
|
+
className: 'sui-field-content',
|
|
610
|
+
children: [children, displayLabel && rawDescription && jsxRuntime.jsx(MaybeWrap, {
|
|
611
|
+
wrap: wrapLabel,
|
|
612
|
+
className: 'sui-field-label',
|
|
613
|
+
children: rawDescription && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
614
|
+
id: utils.descriptionId(id),
|
|
615
|
+
description: rawDescription,
|
|
616
|
+
schema: schema,
|
|
617
|
+
uiSchema: uiSchema,
|
|
618
|
+
registry: registry
|
|
619
|
+
})
|
|
620
|
+
}), help, errors]
|
|
621
|
+
})
|
|
622
|
+
}, id)
|
|
623
|
+
}));
|
|
583
624
|
}
|
|
584
625
|
|
|
585
626
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -602,42 +643,48 @@ function ObjectFieldTemplate(props) {
|
|
|
602
643
|
idSchema = props.idSchema,
|
|
603
644
|
registry = props.registry;
|
|
604
645
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
605
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
606
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
646
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
647
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
607
648
|
// Button templates are not overridden in the uiSchema
|
|
608
649
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
609
650
|
var fieldTitle = uiOptions.title || title;
|
|
610
651
|
var fieldDescription = uiOptions.description || description;
|
|
611
|
-
return
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
652
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
653
|
+
children: [fieldTitle && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
654
|
+
id: utils.titleId(idSchema),
|
|
655
|
+
title: fieldTitle,
|
|
656
|
+
required: required,
|
|
657
|
+
schema: schema,
|
|
658
|
+
uiSchema: uiSchema,
|
|
659
|
+
registry: registry
|
|
660
|
+
}), fieldDescription && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
661
|
+
id: utils.descriptionId(idSchema),
|
|
662
|
+
description: fieldDescription,
|
|
663
|
+
schema: schema,
|
|
664
|
+
uiSchema: uiSchema,
|
|
665
|
+
registry: registry
|
|
666
|
+
}), properties.map(function (prop) {
|
|
667
|
+
return prop.content;
|
|
668
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
669
|
+
width: 16,
|
|
670
|
+
verticalAlign: 'middle',
|
|
671
|
+
children: jsxRuntime.jsx(semanticUiReact.Grid.Row, {
|
|
672
|
+
children: jsxRuntime.jsx("div", {
|
|
673
|
+
style: {
|
|
674
|
+
marginTop: '1rem',
|
|
675
|
+
position: 'relative',
|
|
676
|
+
textAlign: 'right'
|
|
677
|
+
},
|
|
678
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
679
|
+
onClick: onAddClick(schema),
|
|
680
|
+
disabled: disabled || readonly,
|
|
681
|
+
uiSchema: uiSchema,
|
|
682
|
+
registry: registry
|
|
683
|
+
})
|
|
684
|
+
})
|
|
685
|
+
})
|
|
686
|
+
})]
|
|
687
|
+
});
|
|
641
688
|
}
|
|
642
689
|
|
|
643
690
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -652,10 +699,12 @@ function SubmitButton(_ref) {
|
|
|
652
699
|
if (norender) {
|
|
653
700
|
return null;
|
|
654
701
|
}
|
|
655
|
-
return
|
|
656
|
-
type:
|
|
702
|
+
return jsxRuntime.jsx(semanticUiReact.Button, _extends({
|
|
703
|
+
type: 'submit',
|
|
657
704
|
primary: true
|
|
658
|
-
}, submitButtonProps
|
|
705
|
+
}, submitButtonProps, {
|
|
706
|
+
children: submitText
|
|
707
|
+
}));
|
|
659
708
|
}
|
|
660
709
|
|
|
661
710
|
var DEFAULT_OPTIONS = {
|
|
@@ -677,11 +726,12 @@ function TitleField(_ref) {
|
|
|
677
726
|
if (!title) {
|
|
678
727
|
return null;
|
|
679
728
|
}
|
|
680
|
-
return
|
|
729
|
+
return jsxRuntime.jsx(semanticUiReact.Header, _extends({
|
|
681
730
|
id: id
|
|
682
731
|
}, semanticProps, {
|
|
683
|
-
as:
|
|
684
|
-
|
|
732
|
+
as: 'h5',
|
|
733
|
+
children: title
|
|
734
|
+
}));
|
|
685
735
|
}
|
|
686
736
|
|
|
687
737
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -714,51 +764,60 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
714
764
|
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
715
765
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
716
766
|
if (!additional) {
|
|
717
|
-
return
|
|
767
|
+
return jsxRuntime.jsx("div", {
|
|
718
768
|
className: classNames,
|
|
719
|
-
style: style
|
|
720
|
-
|
|
769
|
+
style: style,
|
|
770
|
+
children: children
|
|
771
|
+
});
|
|
721
772
|
}
|
|
722
773
|
var handleBlur = function handleBlur(_ref) {
|
|
723
774
|
var target = _ref.target;
|
|
724
775
|
return onKeyChange(target.value);
|
|
725
776
|
};
|
|
726
|
-
return
|
|
777
|
+
return jsxRuntime.jsx("div", {
|
|
727
778
|
className: classNames,
|
|
728
779
|
style: style,
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
780
|
+
children: jsxRuntime.jsx(semanticUiReact.Grid, {
|
|
781
|
+
columns: 'equal',
|
|
782
|
+
children: jsxRuntime.jsxs(semanticUiReact.Grid.Row, {
|
|
783
|
+
children: [jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
784
|
+
className: 'form-additional',
|
|
785
|
+
children: jsxRuntime.jsx(semanticUiReact.Form.Group, {
|
|
786
|
+
widths: 'equal',
|
|
787
|
+
grouped: true,
|
|
788
|
+
children: jsxRuntime.jsx(semanticUiReact.Form.Input, {
|
|
789
|
+
className: 'form-group',
|
|
790
|
+
hasFeedback: true,
|
|
791
|
+
fluid: true,
|
|
792
|
+
htmlFor: "" + id,
|
|
793
|
+
label: keyLabel,
|
|
794
|
+
required: required,
|
|
795
|
+
defaultValue: label,
|
|
796
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
797
|
+
id: "" + id,
|
|
798
|
+
name: "" + id,
|
|
799
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
800
|
+
style: wrapperStyle,
|
|
801
|
+
type: 'text'
|
|
802
|
+
})
|
|
803
|
+
})
|
|
804
|
+
}), jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
805
|
+
className: 'form-additional',
|
|
806
|
+
verticalAlign: 'middle',
|
|
807
|
+
children: children
|
|
808
|
+
}), jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
809
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
810
|
+
iconType: 'mini',
|
|
811
|
+
className: 'array-item-remove',
|
|
812
|
+
disabled: disabled || readonly,
|
|
813
|
+
onClick: onDropPropertyClick(label),
|
|
814
|
+
uiSchema: uiSchema,
|
|
815
|
+
registry: registry
|
|
816
|
+
})
|
|
817
|
+
})]
|
|
818
|
+
})
|
|
819
|
+
})
|
|
820
|
+
}, id + "-key");
|
|
762
821
|
}
|
|
763
822
|
|
|
764
823
|
function generateTemplates() {
|
|
@@ -768,6 +827,7 @@ function generateTemplates() {
|
|
|
768
827
|
BaseInputTemplate: BaseInputTemplate,
|
|
769
828
|
ButtonTemplates: {
|
|
770
829
|
AddButton: AddButton,
|
|
830
|
+
CopyButton: CopyButton,
|
|
771
831
|
MoveDownButton: MoveDownButton,
|
|
772
832
|
MoveUpButton: MoveUpButton,
|
|
773
833
|
RemoveButton: RemoveButton,
|
|
@@ -811,7 +871,7 @@ function CheckboxWidget(props) {
|
|
|
811
871
|
formContext: formContext,
|
|
812
872
|
uiSchema: uiSchema,
|
|
813
873
|
defaultSchemaProps: {
|
|
814
|
-
inverted: false
|
|
874
|
+
inverted: 'false'
|
|
815
875
|
}
|
|
816
876
|
});
|
|
817
877
|
// Because an unchecked checkbox will cause html5 validation to fail, only add
|
|
@@ -827,20 +887,20 @@ function CheckboxWidget(props) {
|
|
|
827
887
|
var _onFocus = function _onFocus() {
|
|
828
888
|
return onFocus && onFocus(id, value);
|
|
829
889
|
};
|
|
830
|
-
var checked = value ==
|
|
831
|
-
return
|
|
890
|
+
var checked = value == 'true' || value == true;
|
|
891
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Checkbox, _extends({
|
|
832
892
|
id: id,
|
|
833
893
|
name: id,
|
|
834
894
|
disabled: disabled || readonly,
|
|
835
895
|
autoFocus: autofocus
|
|
836
896
|
}, semanticProps, {
|
|
837
|
-
checked: typeof value ===
|
|
897
|
+
checked: typeof value === 'undefined' ? false : checked,
|
|
838
898
|
error: rawErrors.length > 0,
|
|
839
899
|
onChange: _onChange,
|
|
840
900
|
onBlur: _onBlur,
|
|
841
901
|
onFocus: _onFocus,
|
|
842
902
|
required: required,
|
|
843
|
-
label: label ||
|
|
903
|
+
label: label || '',
|
|
844
904
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
845
905
|
}));
|
|
846
906
|
}
|
|
@@ -866,7 +926,7 @@ function CheckboxesWidget(props) {
|
|
|
866
926
|
_props$rawErrors = props.rawErrors,
|
|
867
927
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
868
928
|
registry = props.registry;
|
|
869
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
929
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
870
930
|
var enumOptions = options.enumOptions,
|
|
871
931
|
enumDisabled = options.enumDisabled,
|
|
872
932
|
inline = options.inline;
|
|
@@ -877,7 +937,7 @@ function CheckboxesWidget(props) {
|
|
|
877
937
|
formContext: formContext,
|
|
878
938
|
uiSchema: uiSchema,
|
|
879
939
|
defaultSchemaProps: {
|
|
880
|
-
inverted: false
|
|
940
|
+
inverted: 'false'
|
|
881
941
|
}
|
|
882
942
|
});
|
|
883
943
|
var _onChange = function _onChange(index) {
|
|
@@ -902,34 +962,37 @@ function CheckboxesWidget(props) {
|
|
|
902
962
|
} : {
|
|
903
963
|
grouped: true
|
|
904
964
|
};
|
|
905
|
-
return
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
965
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
966
|
+
children: [title && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
967
|
+
id: utils.titleId(id),
|
|
968
|
+
title: title,
|
|
969
|
+
schema: schema,
|
|
970
|
+
uiSchema: uiSchema,
|
|
971
|
+
registry: registry
|
|
972
|
+
}), jsxRuntime.jsx(semanticUiReact.Form.Group, _extends({
|
|
973
|
+
id: id,
|
|
974
|
+
name: id
|
|
975
|
+
}, inlineOption, {
|
|
976
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
977
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
978
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
979
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Checkbox, _extends({
|
|
980
|
+
id: utils.optionId(id, index),
|
|
981
|
+
name: id,
|
|
982
|
+
label: option.label
|
|
983
|
+
}, semanticProps, {
|
|
984
|
+
checked: checked,
|
|
985
|
+
error: rawErrors.length > 0,
|
|
986
|
+
disabled: disabled || itemDisabled || readonly,
|
|
987
|
+
autoFocus: autofocus && index === 0,
|
|
988
|
+
onChange: _onChange(index),
|
|
989
|
+
onBlur: _onBlur,
|
|
990
|
+
onFocus: _onFocus,
|
|
991
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
992
|
+
}), index);
|
|
993
|
+
})
|
|
994
|
+
}))]
|
|
995
|
+
});
|
|
933
996
|
}
|
|
934
997
|
|
|
935
998
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
@@ -974,26 +1037,28 @@ function RadioWidget(props) {
|
|
|
974
1037
|
} : {
|
|
975
1038
|
grouped: true
|
|
976
1039
|
};
|
|
977
|
-
return
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1040
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Group, _extends({}, inlineOption, {
|
|
1041
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
1042
|
+
var checked = utils.enumOptionsIsSelected(option.value, value);
|
|
1043
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
1044
|
+
return /*#__PURE__*/react.createElement(semanticUiReact.Form.Field, _extends({
|
|
1045
|
+
required: required,
|
|
1046
|
+
control: semanticUiReact.Radio,
|
|
1047
|
+
id: utils.optionId(id, index),
|
|
1048
|
+
name: id
|
|
1049
|
+
}, semanticProps, {
|
|
1050
|
+
onFocus: _onFocus,
|
|
1051
|
+
onBlur: _onBlur,
|
|
1052
|
+
onChange: _onChange,
|
|
1053
|
+
label: option.label,
|
|
1054
|
+
value: String(index),
|
|
1055
|
+
error: rawErrors.length > 0,
|
|
1056
|
+
key: index,
|
|
1057
|
+
checked: checked,
|
|
1058
|
+
disabled: disabled || itemDisabled || readonly,
|
|
1059
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1060
|
+
}));
|
|
1061
|
+
})
|
|
997
1062
|
}));
|
|
998
1063
|
}
|
|
999
1064
|
|
|
@@ -1028,7 +1093,7 @@ function RangeWidget(props) {
|
|
|
1028
1093
|
// eslint-disable-next-line no-shadow
|
|
1029
1094
|
var _onChange = function _onChange(_ref) {
|
|
1030
1095
|
var value = _ref.target.value;
|
|
1031
|
-
return onChange && onChange(value ===
|
|
1096
|
+
return onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1032
1097
|
};
|
|
1033
1098
|
var _onBlur = function _onBlur() {
|
|
1034
1099
|
return onBlur && onBlur(id, value);
|
|
@@ -1036,21 +1101,24 @@ function RangeWidget(props) {
|
|
|
1036
1101
|
var _onFocus = function _onFocus() {
|
|
1037
1102
|
return onFocus && onFocus(id, value);
|
|
1038
1103
|
};
|
|
1039
|
-
return
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1104
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1105
|
+
children: [jsxRuntime.jsx(semanticUiReact.Input, _extends({
|
|
1106
|
+
id: id,
|
|
1107
|
+
name: id,
|
|
1108
|
+
type: 'range',
|
|
1109
|
+
required: required,
|
|
1110
|
+
disabled: disabled || readonly
|
|
1111
|
+
}, utils.rangeSpec(schema), semanticProps, {
|
|
1112
|
+
value: value || '',
|
|
1113
|
+
error: rawErrors.length > 0,
|
|
1114
|
+
onChange: _onChange,
|
|
1115
|
+
onBlur: _onBlur,
|
|
1116
|
+
onFocus: _onFocus,
|
|
1117
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1118
|
+
}), id), jsxRuntime.jsx("span", {
|
|
1119
|
+
children: value
|
|
1120
|
+
})]
|
|
1121
|
+
});
|
|
1054
1122
|
}
|
|
1055
1123
|
|
|
1056
1124
|
/**
|
|
@@ -1102,7 +1170,7 @@ function SelectWidget(props) {
|
|
|
1102
1170
|
formContext: formContext,
|
|
1103
1171
|
options: options,
|
|
1104
1172
|
defaultSchemaProps: {
|
|
1105
|
-
inverted:
|
|
1173
|
+
inverted: 'false',
|
|
1106
1174
|
selection: true,
|
|
1107
1175
|
fluid: true,
|
|
1108
1176
|
scrolling: true,
|
|
@@ -1112,7 +1180,7 @@ function SelectWidget(props) {
|
|
|
1112
1180
|
var enumDisabled = options.enumDisabled,
|
|
1113
1181
|
enumOptions = options.enumOptions,
|
|
1114
1182
|
optEmptyVal = options.emptyValue;
|
|
1115
|
-
var emptyValue = multiple ? [] :
|
|
1183
|
+
var emptyValue = multiple ? [] : '';
|
|
1116
1184
|
var dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
|
|
1117
1185
|
var _onChange = function _onChange(_, _ref2) {
|
|
1118
1186
|
var value = _ref2.value;
|
|
@@ -1128,13 +1196,12 @@ function SelectWidget(props) {
|
|
|
1128
1196
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1129
1197
|
};
|
|
1130
1198
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1131
|
-
return
|
|
1132
|
-
key: id,
|
|
1199
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Dropdown, _extends({
|
|
1133
1200
|
id: id,
|
|
1134
1201
|
name: id,
|
|
1135
1202
|
label: label || schema.title,
|
|
1136
|
-
multiple: typeof multiple ===
|
|
1137
|
-
value: typeof value ===
|
|
1203
|
+
multiple: typeof multiple === 'undefined' ? false : multiple,
|
|
1204
|
+
value: typeof value === 'undefined' ? emptyValue : selectedIndexes,
|
|
1138
1205
|
error: rawErrors.length > 0,
|
|
1139
1206
|
disabled: disabled,
|
|
1140
1207
|
placeholder: placeholder
|
|
@@ -1147,7 +1214,7 @@ function SelectWidget(props) {
|
|
|
1147
1214
|
onBlur: _onBlur,
|
|
1148
1215
|
onFocus: _onFocus,
|
|
1149
1216
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1150
|
-
}));
|
|
1217
|
+
}), id);
|
|
1151
1218
|
}
|
|
1152
1219
|
|
|
1153
1220
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
@@ -1177,14 +1244,14 @@ function TextareaWidget(props) {
|
|
|
1177
1244
|
formContext: formContext,
|
|
1178
1245
|
options: options,
|
|
1179
1246
|
defaultSchemaProps: {
|
|
1180
|
-
inverted: false
|
|
1247
|
+
inverted: 'false'
|
|
1181
1248
|
}
|
|
1182
1249
|
});
|
|
1183
1250
|
var schemaUtils = registry.schemaUtils;
|
|
1184
1251
|
// eslint-disable-next-line no-shadow
|
|
1185
1252
|
var _onChange = function _onChange(_ref) {
|
|
1186
1253
|
var value = _ref.target.value;
|
|
1187
|
-
return onChange && onChange(value ===
|
|
1254
|
+
return onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1188
1255
|
};
|
|
1189
1256
|
var _onBlur = function _onBlur() {
|
|
1190
1257
|
return onBlur && onBlur(id, value);
|
|
@@ -1193,9 +1260,8 @@ function TextareaWidget(props) {
|
|
|
1193
1260
|
return onFocus && onFocus(id, value);
|
|
1194
1261
|
};
|
|
1195
1262
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
1196
|
-
return
|
|
1263
|
+
return jsxRuntime.jsx(semanticUiReact.Form.TextArea, _extends({
|
|
1197
1264
|
id: id,
|
|
1198
|
-
key: id,
|
|
1199
1265
|
name: id,
|
|
1200
1266
|
label: displayLabel ? label || schema.title : false,
|
|
1201
1267
|
placeholder: placeholder,
|
|
@@ -1203,14 +1269,14 @@ function TextareaWidget(props) {
|
|
|
1203
1269
|
required: required,
|
|
1204
1270
|
disabled: disabled || readonly
|
|
1205
1271
|
}, semanticProps, {
|
|
1206
|
-
value: value ||
|
|
1272
|
+
value: value || '',
|
|
1207
1273
|
error: rawErrors.length > 0,
|
|
1208
1274
|
rows: options.rows || 5,
|
|
1209
1275
|
onChange: _onChange,
|
|
1210
1276
|
onBlur: _onBlur,
|
|
1211
1277
|
onFocus: _onFocus,
|
|
1212
1278
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1213
|
-
}));
|
|
1279
|
+
}), id);
|
|
1214
1280
|
}
|
|
1215
1281
|
|
|
1216
1282
|
function generateWidgets() {
|