@rjsf/semantic-ui 5.1.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +183 -183
- package/README.md +15 -12
- package/dist/semantic-ui.cjs.development.js +402 -345
- 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 +403 -345
- package/dist/semantic-ui.esm.js.map +1 -1
- package/dist/semantic-ui.umd.development.js +404 -348
- 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 +5 -5
|
@@ -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() {
|
|
@@ -45,16 +45,19 @@ var _excluded$4 = ["uiSchema", "registry", "color"];
|
|
|
45
45
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
46
46
|
*/
|
|
47
47
|
function AddButton(_ref) {
|
|
48
|
-
var
|
|
48
|
+
var registry = _ref.registry,
|
|
49
|
+
color = _ref.color,
|
|
49
50
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
var translateString = registry.translateString;
|
|
52
|
+
return jsxRuntime.jsx(semanticUiReact.Button, _extends({
|
|
53
|
+
title: translateString(utils.TranslatableString.AddItemButton),
|
|
52
54
|
color: color
|
|
53
55
|
}, props, {
|
|
54
56
|
icon: true,
|
|
55
|
-
size:
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
size: 'tiny',
|
|
58
|
+
children: jsxRuntime.jsx(semanticUiReact.Icon, {
|
|
59
|
+
name: 'plus'
|
|
60
|
+
})
|
|
58
61
|
}));
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -108,8 +111,8 @@ function getSemanticErrorProps(_ref2) {
|
|
|
108
111
|
options = _ref2$options === void 0 ? {} : _ref2$options,
|
|
109
112
|
_ref2$defaultProps = _ref2.defaultProps,
|
|
110
113
|
defaultProps = _ref2$defaultProps === void 0 ? {
|
|
111
|
-
size:
|
|
112
|
-
pointing:
|
|
114
|
+
size: 'small',
|
|
115
|
+
pointing: 'above'
|
|
113
116
|
} : _ref2$defaultProps;
|
|
114
117
|
var formContextProps = formContext.semantic && formContext.semantic.errorOptions;
|
|
115
118
|
var semanticOptions = utils.getUiOptions(uiSchema).semantic;
|
|
@@ -139,7 +142,7 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
139
142
|
// returning them as a string
|
|
140
143
|
return [].concat(new Set(classList.filter(function (cn) {
|
|
141
144
|
return !omit.includes(cn);
|
|
142
|
-
}))).join(
|
|
145
|
+
}))).join(' ');
|
|
143
146
|
}
|
|
144
147
|
/**
|
|
145
148
|
*
|
|
@@ -152,14 +155,14 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
152
155
|
function MaybeWrap(_ref3) {
|
|
153
156
|
var wrap = _ref3.wrap,
|
|
154
157
|
_ref3$component = _ref3.component,
|
|
155
|
-
Component = _ref3$component === void 0 ?
|
|
158
|
+
Component = _ref3$component === void 0 ? 'div' : _ref3$component,
|
|
156
159
|
props = _objectWithoutPropertiesLoose(_ref3, _excluded$3);
|
|
157
|
-
return wrap ?
|
|
160
|
+
return wrap ? jsxRuntime.jsx(Component, _extends({}, props)) : props.children;
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
var gridStyle = function gridStyle(vertical) {
|
|
161
164
|
return {
|
|
162
|
-
display:
|
|
165
|
+
display: 'grid',
|
|
163
166
|
gridTemplateColumns: "1fr " + (vertical ? 65 : 110) + "px"
|
|
164
167
|
};
|
|
165
168
|
};
|
|
@@ -191,40 +194,47 @@ function ArrayFieldItemTemplate(props) {
|
|
|
191
194
|
horizontalButtons = _uiOptions$semantic$h === void 0 ? false : _uiOptions$semantic$h,
|
|
192
195
|
_uiOptions$semantic$w = _uiOptions$semantic.wrapItem,
|
|
193
196
|
wrapItem = _uiOptions$semantic$w === void 0 ? false : _uiOptions$semantic$w;
|
|
194
|
-
return
|
|
195
|
-
className:
|
|
196
|
-
|
|
197
|
-
|
|
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
|
-
|
|
197
|
+
return jsxRuntime.jsx("div", {
|
|
198
|
+
className: 'array-item',
|
|
199
|
+
children: jsxRuntime.jsx(MaybeWrap, {
|
|
200
|
+
wrap: wrapItem,
|
|
201
|
+
component: semanticUiReact.Segment,
|
|
202
|
+
children: jsxRuntime.jsxs(semanticUiReact.Grid, {
|
|
203
|
+
style: index !== 0 ? _extends({}, gridStyle(!horizontalButtons), {
|
|
204
|
+
alignItems: 'center'
|
|
205
|
+
}) : gridStyle(!horizontalButtons),
|
|
206
|
+
children: [jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
207
|
+
width: 16,
|
|
208
|
+
verticalAlign: 'middle',
|
|
209
|
+
children: children
|
|
210
|
+
}), hasToolbar && jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
211
|
+
children: (hasMoveUp || hasMoveDown || hasRemove) && jsxRuntime.jsxs(semanticUiReact.Button.Group, {
|
|
212
|
+
size: 'mini',
|
|
213
|
+
vertical: !horizontalButtons,
|
|
214
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
215
|
+
className: 'array-item-move-up',
|
|
216
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
217
|
+
onClick: onReorderClick(index, index - 1),
|
|
218
|
+
uiSchema: uiSchema,
|
|
219
|
+
registry: registry
|
|
220
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
221
|
+
className: 'array-item-move-down',
|
|
222
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
223
|
+
onClick: onReorderClick(index, index + 1),
|
|
224
|
+
uiSchema: uiSchema,
|
|
225
|
+
registry: registry
|
|
226
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
227
|
+
className: 'array-item-remove',
|
|
228
|
+
disabled: disabled || readonly,
|
|
229
|
+
onClick: onDropIndexClick(index),
|
|
230
|
+
uiSchema: uiSchema,
|
|
231
|
+
registry: registry
|
|
232
|
+
})]
|
|
233
|
+
})
|
|
234
|
+
})]
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
});
|
|
228
238
|
}
|
|
229
239
|
|
|
230
240
|
var _excluded$2 = ["key", "uiSchema"];
|
|
@@ -261,57 +271,58 @@ function ArrayFieldTemplate(props) {
|
|
|
261
271
|
wrapItem: wrapItem
|
|
262
272
|
};
|
|
263
273
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
264
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
265
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
266
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
274
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
275
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
276
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
267
277
|
// Button templates are not overridden in the uiSchema
|
|
268
278
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
269
|
-
return
|
|
270
|
-
className: cleanClassNames([className, utils.isFixedItems(schema) ?
|
|
271
|
-
|
|
272
|
-
|
|
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
|
-
|
|
279
|
+
return jsxRuntime.jsxs("div", {
|
|
280
|
+
className: cleanClassNames([className, utils.isFixedItems(schema) ? '' : 'sortable-form-fields']),
|
|
281
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
282
|
+
idSchema: idSchema,
|
|
283
|
+
title: uiOptions.title || title,
|
|
284
|
+
schema: schema,
|
|
285
|
+
uiSchema: uiSchema,
|
|
286
|
+
required: required,
|
|
287
|
+
registry: registry
|
|
288
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
289
|
+
idSchema: idSchema,
|
|
290
|
+
description: uiOptions.description || schema.description,
|
|
291
|
+
schema: schema,
|
|
292
|
+
uiSchema: uiSchema,
|
|
293
|
+
registry: registry
|
|
294
|
+
}), jsxRuntime.jsxs("div", {
|
|
295
|
+
children: [jsxRuntime.jsx("div", {
|
|
296
|
+
className: 'row array-item-list',
|
|
297
|
+
children: items && items.map(function (_ref) {
|
|
298
|
+
var _extends2;
|
|
299
|
+
var key = _ref.key,
|
|
300
|
+
_ref$uiSchema = _ref.uiSchema,
|
|
301
|
+
itemUiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema,
|
|
302
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
303
|
+
// Merge in the semantic props from the ArrayFieldTemplate into each of the items
|
|
304
|
+
var mergedUiSchema = _extends({}, itemUiSchema, (_extends2 = {}, _extends2[utils.UI_OPTIONS_KEY] = _extends({}, itemUiSchema[utils.UI_OPTIONS_KEY], {
|
|
305
|
+
semantic: semantic
|
|
306
|
+
}), _extends2));
|
|
307
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, props, {
|
|
308
|
+
uiSchema: mergedUiSchema
|
|
309
|
+
}), key);
|
|
310
|
+
})
|
|
311
|
+
}), canAdd && jsxRuntime.jsx("div", {
|
|
312
|
+
style: {
|
|
313
|
+
marginTop: '1rem',
|
|
314
|
+
position: 'relative',
|
|
315
|
+
textAlign: 'right'
|
|
316
|
+
},
|
|
317
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
318
|
+
onClick: onAddClick,
|
|
319
|
+
disabled: disabled || readonly,
|
|
320
|
+
uiSchema: uiSchema,
|
|
321
|
+
registry: registry
|
|
322
|
+
})
|
|
323
|
+
})]
|
|
324
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
325
|
+
});
|
|
315
326
|
}
|
|
316
327
|
|
|
317
328
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
@@ -329,6 +340,7 @@ function BaseInputTemplate(props) {
|
|
|
329
340
|
readonly = props.readonly,
|
|
330
341
|
disabled = props.disabled,
|
|
331
342
|
onChange = props.onChange,
|
|
343
|
+
onChangeOverride = props.onChangeOverride,
|
|
332
344
|
onBlur = props.onBlur,
|
|
333
345
|
onFocus = props.onFocus,
|
|
334
346
|
autofocus = props.autofocus,
|
|
@@ -349,7 +361,7 @@ function BaseInputTemplate(props) {
|
|
|
349
361
|
var schemaUtils = registry.schemaUtils;
|
|
350
362
|
var _onChange = function _onChange(_ref) {
|
|
351
363
|
var value = _ref.target.value;
|
|
352
|
-
return onChange(value ===
|
|
364
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
353
365
|
};
|
|
354
366
|
var _onBlur = function _onBlur() {
|
|
355
367
|
return onBlur && onBlur(id, value);
|
|
@@ -358,32 +370,33 @@ function BaseInputTemplate(props) {
|
|
|
358
370
|
return onFocus && onFocus(id, value);
|
|
359
371
|
};
|
|
360
372
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
361
|
-
return
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
373
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
374
|
+
children: [jsxRuntime.jsx(semanticUiReact.Form.Input, _extends({
|
|
375
|
+
id: id,
|
|
376
|
+
name: id,
|
|
377
|
+
placeholder: placeholder
|
|
378
|
+
}, inputProps, {
|
|
379
|
+
label: displayLabel ? label || schema.title : false,
|
|
380
|
+
required: required,
|
|
381
|
+
autoFocus: autofocus,
|
|
382
|
+
disabled: disabled || readonly,
|
|
383
|
+
list: schema.examples ? utils.examplesId(id) : undefined
|
|
384
|
+
}, semanticProps, {
|
|
385
|
+
value: value || value === 0 ? value : '',
|
|
386
|
+
error: rawErrors.length > 0,
|
|
387
|
+
onChange: onChangeOverride || _onChange,
|
|
388
|
+
onBlur: _onBlur,
|
|
389
|
+
onFocus: _onFocus,
|
|
390
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
391
|
+
}), id), Array.isArray(schema.examples) && jsxRuntime.jsx("datalist", {
|
|
392
|
+
id: utils.examplesId(id),
|
|
393
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
394
|
+
return jsxRuntime.jsx("option", {
|
|
395
|
+
value: example
|
|
396
|
+
}, example);
|
|
397
|
+
})
|
|
398
|
+
})]
|
|
399
|
+
});
|
|
387
400
|
}
|
|
388
401
|
|
|
389
402
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -396,10 +409,11 @@ function DescriptionField(props) {
|
|
|
396
409
|
if (!description) {
|
|
397
410
|
return null;
|
|
398
411
|
}
|
|
399
|
-
return
|
|
412
|
+
return jsxRuntime.jsx("p", {
|
|
400
413
|
id: id,
|
|
401
|
-
className:
|
|
402
|
-
|
|
414
|
+
className: 'sui-description',
|
|
415
|
+
children: description
|
|
416
|
+
});
|
|
403
417
|
}
|
|
404
418
|
|
|
405
419
|
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
@@ -407,14 +421,21 @@ function DescriptionField(props) {
|
|
|
407
421
|
* @param props - The `ErrorListProps` for this component
|
|
408
422
|
*/
|
|
409
423
|
function ErrorList(_ref) {
|
|
410
|
-
var errors = _ref.errors
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
424
|
+
var errors = _ref.errors,
|
|
425
|
+
registry = _ref.registry;
|
|
426
|
+
var translateString = registry.translateString;
|
|
427
|
+
return jsxRuntime.jsxs(semanticUiReact.Message, {
|
|
428
|
+
negative: true,
|
|
429
|
+
children: [jsxRuntime.jsx(semanticUiReact.Message.Header, {
|
|
430
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
431
|
+
}), jsxRuntime.jsx(semanticUiReact.Message.List, {
|
|
432
|
+
children: errors.map(function (error, index) {
|
|
433
|
+
return jsxRuntime.jsx(semanticUiReact.Message.Item, {
|
|
434
|
+
children: error.stack
|
|
435
|
+
}, "error-" + index);
|
|
436
|
+
})
|
|
437
|
+
})]
|
|
438
|
+
});
|
|
418
439
|
}
|
|
419
440
|
|
|
420
441
|
var _excluded$1 = ["icon", "iconType", "color", "className", "uiSchema", "registry"];
|
|
@@ -424,7 +445,7 @@ function IconButton(props) {
|
|
|
424
445
|
color = props.color,
|
|
425
446
|
className = props.className,
|
|
426
447
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
427
|
-
return
|
|
448
|
+
return jsxRuntime.jsx(semanticUiReact.Button, _extends({
|
|
428
449
|
icon: icon,
|
|
429
450
|
size: iconType,
|
|
430
451
|
color: color,
|
|
@@ -432,31 +453,34 @@ function IconButton(props) {
|
|
|
432
453
|
}, otherProps));
|
|
433
454
|
}
|
|
434
455
|
function MoveDownButton(props) {
|
|
435
|
-
|
|
436
|
-
|
|
456
|
+
var translateString = props.registry.translateString;
|
|
457
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
458
|
+
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
437
459
|
}, props, {
|
|
438
|
-
icon:
|
|
460
|
+
icon: 'angle down'
|
|
439
461
|
}));
|
|
440
462
|
}
|
|
441
463
|
function MoveUpButton(props) {
|
|
442
|
-
|
|
443
|
-
|
|
464
|
+
var translateString = props.registry.translateString;
|
|
465
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
466
|
+
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
444
467
|
}, props, {
|
|
445
|
-
icon:
|
|
468
|
+
icon: 'angle up'
|
|
446
469
|
}));
|
|
447
470
|
}
|
|
448
471
|
function RemoveButton(props) {
|
|
449
|
-
|
|
450
|
-
|
|
472
|
+
var translateString = props.registry.translateString;
|
|
473
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
474
|
+
title: translateString(utils.TranslatableString.RemoveButton)
|
|
451
475
|
}, props, {
|
|
452
|
-
icon:
|
|
476
|
+
icon: 'trash'
|
|
453
477
|
}));
|
|
454
478
|
}
|
|
455
479
|
|
|
456
480
|
var DEFAULT_OPTIONS$1 = {
|
|
457
481
|
options: {
|
|
458
|
-
pointing:
|
|
459
|
-
size:
|
|
482
|
+
pointing: 'above',
|
|
483
|
+
size: 'small'
|
|
460
484
|
}
|
|
461
485
|
};
|
|
462
486
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -477,20 +501,22 @@ function FieldErrorTemplate(_ref) {
|
|
|
477
501
|
var pointing = options.pointing,
|
|
478
502
|
size = options.size;
|
|
479
503
|
if (errors && errors.length > 0) {
|
|
480
|
-
var id = idSchema
|
|
481
|
-
return
|
|
504
|
+
var id = utils.errorId(idSchema);
|
|
505
|
+
return jsxRuntime.jsx(semanticUiReact.Label, {
|
|
482
506
|
id: id,
|
|
483
|
-
color:
|
|
484
|
-
pointing: pointing ||
|
|
485
|
-
size: size ||
|
|
486
|
-
basic: true
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
507
|
+
color: 'red',
|
|
508
|
+
pointing: pointing || 'above',
|
|
509
|
+
size: size || 'small',
|
|
510
|
+
basic: true,
|
|
511
|
+
children: jsxRuntime.jsx(semanticUiReact.List, {
|
|
512
|
+
bulleted: true,
|
|
513
|
+
children: errors.map(function (error) {
|
|
514
|
+
return jsxRuntime.jsx(semanticUiReact.List.Item, {
|
|
515
|
+
children: error
|
|
516
|
+
}, nanoid.nanoid());
|
|
517
|
+
})
|
|
518
|
+
})
|
|
519
|
+
});
|
|
494
520
|
}
|
|
495
521
|
return null;
|
|
496
522
|
}
|
|
@@ -503,9 +529,9 @@ function FieldHelpTemplate(props) {
|
|
|
503
529
|
var idSchema = props.idSchema,
|
|
504
530
|
help = props.help;
|
|
505
531
|
if (help) {
|
|
506
|
-
var id = idSchema
|
|
507
|
-
return
|
|
508
|
-
size:
|
|
532
|
+
var id = utils.helpId(idSchema);
|
|
533
|
+
return jsxRuntime.jsx(semanticUiReact.Message, {
|
|
534
|
+
size: 'mini',
|
|
509
535
|
info: true,
|
|
510
536
|
id: id,
|
|
511
537
|
content: help
|
|
@@ -539,16 +565,17 @@ function FieldTemplate(props) {
|
|
|
539
565
|
var wrapLabel = semanticProps.wrapLabel,
|
|
540
566
|
wrapContent = semanticProps.wrapContent;
|
|
541
567
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
542
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
543
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
568
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
569
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
544
570
|
if (hidden) {
|
|
545
|
-
return
|
|
571
|
+
return jsxRuntime.jsx("div", {
|
|
546
572
|
style: {
|
|
547
|
-
display:
|
|
548
|
-
}
|
|
549
|
-
|
|
573
|
+
display: 'none'
|
|
574
|
+
},
|
|
575
|
+
children: children
|
|
576
|
+
});
|
|
550
577
|
}
|
|
551
|
-
return
|
|
578
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, _extends({
|
|
552
579
|
classNames: classNames,
|
|
553
580
|
style: style,
|
|
554
581
|
id: id,
|
|
@@ -556,23 +583,27 @@ function FieldTemplate(props) {
|
|
|
556
583
|
registry: registry,
|
|
557
584
|
schema: schema,
|
|
558
585
|
uiSchema: uiSchema
|
|
559
|
-
}, otherProps
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
586
|
+
}, otherProps, {
|
|
587
|
+
children: jsxRuntime.jsx(semanticUiReact.Form.Group, {
|
|
588
|
+
widths: 'equal',
|
|
589
|
+
grouped: true,
|
|
590
|
+
children: jsxRuntime.jsxs(MaybeWrap, {
|
|
591
|
+
wrap: wrapContent,
|
|
592
|
+
className: 'sui-field-content',
|
|
593
|
+
children: [children, displayLabel && rawDescription && jsxRuntime.jsx(MaybeWrap, {
|
|
594
|
+
wrap: wrapLabel,
|
|
595
|
+
className: 'sui-field-label',
|
|
596
|
+
children: rawDescription && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
597
|
+
id: utils.descriptionId(id),
|
|
598
|
+
description: rawDescription,
|
|
599
|
+
schema: schema,
|
|
600
|
+
uiSchema: uiSchema,
|
|
601
|
+
registry: registry
|
|
602
|
+
})
|
|
603
|
+
}), help, errors]
|
|
604
|
+
})
|
|
605
|
+
}, id)
|
|
606
|
+
}));
|
|
576
607
|
}
|
|
577
608
|
|
|
578
609
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -595,42 +626,48 @@ function ObjectFieldTemplate(props) {
|
|
|
595
626
|
idSchema = props.idSchema,
|
|
596
627
|
registry = props.registry;
|
|
597
628
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
598
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
599
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
629
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
630
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
600
631
|
// Button templates are not overridden in the uiSchema
|
|
601
632
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
602
633
|
var fieldTitle = uiOptions.title || title;
|
|
603
634
|
var fieldDescription = uiOptions.description || description;
|
|
604
|
-
return
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
635
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
636
|
+
children: [fieldTitle && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
637
|
+
id: utils.titleId(idSchema),
|
|
638
|
+
title: fieldTitle,
|
|
639
|
+
required: required,
|
|
640
|
+
schema: schema,
|
|
641
|
+
uiSchema: uiSchema,
|
|
642
|
+
registry: registry
|
|
643
|
+
}), fieldDescription && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
644
|
+
id: utils.descriptionId(idSchema),
|
|
645
|
+
description: fieldDescription,
|
|
646
|
+
schema: schema,
|
|
647
|
+
uiSchema: uiSchema,
|
|
648
|
+
registry: registry
|
|
649
|
+
}), properties.map(function (prop) {
|
|
650
|
+
return prop.content;
|
|
651
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
652
|
+
width: 16,
|
|
653
|
+
verticalAlign: 'middle',
|
|
654
|
+
children: jsxRuntime.jsx(semanticUiReact.Grid.Row, {
|
|
655
|
+
children: jsxRuntime.jsx("div", {
|
|
656
|
+
style: {
|
|
657
|
+
marginTop: '1rem',
|
|
658
|
+
position: 'relative',
|
|
659
|
+
textAlign: 'right'
|
|
660
|
+
},
|
|
661
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
662
|
+
onClick: onAddClick(schema),
|
|
663
|
+
disabled: disabled || readonly,
|
|
664
|
+
uiSchema: uiSchema,
|
|
665
|
+
registry: registry
|
|
666
|
+
})
|
|
667
|
+
})
|
|
668
|
+
})
|
|
669
|
+
})]
|
|
670
|
+
});
|
|
634
671
|
}
|
|
635
672
|
|
|
636
673
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -645,10 +682,12 @@ function SubmitButton(_ref) {
|
|
|
645
682
|
if (norender) {
|
|
646
683
|
return null;
|
|
647
684
|
}
|
|
648
|
-
return
|
|
649
|
-
type:
|
|
685
|
+
return jsxRuntime.jsx(semanticUiReact.Button, _extends({
|
|
686
|
+
type: 'submit',
|
|
650
687
|
primary: true
|
|
651
|
-
}, submitButtonProps
|
|
688
|
+
}, submitButtonProps, {
|
|
689
|
+
children: submitText
|
|
690
|
+
}));
|
|
652
691
|
}
|
|
653
692
|
|
|
654
693
|
var DEFAULT_OPTIONS = {
|
|
@@ -670,11 +709,12 @@ function TitleField(_ref) {
|
|
|
670
709
|
if (!title) {
|
|
671
710
|
return null;
|
|
672
711
|
}
|
|
673
|
-
return
|
|
712
|
+
return jsxRuntime.jsx(semanticUiReact.Header, _extends({
|
|
674
713
|
id: id
|
|
675
714
|
}, semanticProps, {
|
|
676
|
-
as:
|
|
677
|
-
|
|
715
|
+
as: 'h5',
|
|
716
|
+
children: title
|
|
717
|
+
}));
|
|
678
718
|
}
|
|
679
719
|
|
|
680
720
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -696,60 +736,71 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
696
736
|
schema = props.schema,
|
|
697
737
|
uiSchema = props.uiSchema,
|
|
698
738
|
registry = props.registry;
|
|
739
|
+
var templates = registry.templates,
|
|
740
|
+
translateString = registry.translateString;
|
|
699
741
|
// Button templates are not overridden in the uiSchema
|
|
700
|
-
var RemoveButton =
|
|
742
|
+
var RemoveButton = templates.ButtonTemplates.RemoveButton;
|
|
743
|
+
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
701
744
|
var _registry$formContext = registry.formContext,
|
|
702
745
|
_registry$formContext2 = _registry$formContext.readonlyAsDisabled,
|
|
703
746
|
readonlyAsDisabled = _registry$formContext2 === void 0 ? true : _registry$formContext2,
|
|
704
747
|
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
705
|
-
var keyLabel = label + " Key"; // i18n ?
|
|
706
748
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
707
749
|
if (!additional) {
|
|
708
|
-
return
|
|
750
|
+
return jsxRuntime.jsx("div", {
|
|
709
751
|
className: classNames,
|
|
710
|
-
style: style
|
|
711
|
-
|
|
752
|
+
style: style,
|
|
753
|
+
children: children
|
|
754
|
+
});
|
|
712
755
|
}
|
|
713
756
|
var handleBlur = function handleBlur(_ref) {
|
|
714
757
|
var target = _ref.target;
|
|
715
758
|
return onKeyChange(target.value);
|
|
716
759
|
};
|
|
717
|
-
return
|
|
760
|
+
return jsxRuntime.jsx("div", {
|
|
718
761
|
className: classNames,
|
|
719
762
|
style: style,
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
763
|
+
children: jsxRuntime.jsx(semanticUiReact.Grid, {
|
|
764
|
+
columns: 'equal',
|
|
765
|
+
children: jsxRuntime.jsxs(semanticUiReact.Grid.Row, {
|
|
766
|
+
children: [jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
767
|
+
className: 'form-additional',
|
|
768
|
+
children: jsxRuntime.jsx(semanticUiReact.Form.Group, {
|
|
769
|
+
widths: 'equal',
|
|
770
|
+
grouped: true,
|
|
771
|
+
children: jsxRuntime.jsx(semanticUiReact.Form.Input, {
|
|
772
|
+
className: 'form-group',
|
|
773
|
+
hasFeedback: true,
|
|
774
|
+
fluid: true,
|
|
775
|
+
htmlFor: "" + id,
|
|
776
|
+
label: keyLabel,
|
|
777
|
+
required: required,
|
|
778
|
+
defaultValue: label,
|
|
779
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
780
|
+
id: "" + id,
|
|
781
|
+
name: "" + id,
|
|
782
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
783
|
+
style: wrapperStyle,
|
|
784
|
+
type: 'text'
|
|
785
|
+
})
|
|
786
|
+
})
|
|
787
|
+
}), jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
788
|
+
className: 'form-additional',
|
|
789
|
+
verticalAlign: 'middle',
|
|
790
|
+
children: children
|
|
791
|
+
}), jsxRuntime.jsx(semanticUiReact.Grid.Column, {
|
|
792
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
793
|
+
iconType: 'mini',
|
|
794
|
+
className: 'array-item-remove',
|
|
795
|
+
disabled: disabled || readonly,
|
|
796
|
+
onClick: onDropPropertyClick(label),
|
|
797
|
+
uiSchema: uiSchema,
|
|
798
|
+
registry: registry
|
|
799
|
+
})
|
|
800
|
+
})]
|
|
801
|
+
})
|
|
802
|
+
})
|
|
803
|
+
}, id + "-key");
|
|
753
804
|
}
|
|
754
805
|
|
|
755
806
|
function generateTemplates() {
|
|
@@ -818,20 +869,20 @@ function CheckboxWidget(props) {
|
|
|
818
869
|
var _onFocus = function _onFocus() {
|
|
819
870
|
return onFocus && onFocus(id, value);
|
|
820
871
|
};
|
|
821
|
-
var checked = value ==
|
|
822
|
-
return
|
|
872
|
+
var checked = value == 'true' || value == true;
|
|
873
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Checkbox, _extends({
|
|
823
874
|
id: id,
|
|
824
875
|
name: id,
|
|
825
876
|
disabled: disabled || readonly,
|
|
826
877
|
autoFocus: autofocus
|
|
827
878
|
}, semanticProps, {
|
|
828
|
-
checked: typeof value ===
|
|
879
|
+
checked: typeof value === 'undefined' ? false : checked,
|
|
829
880
|
error: rawErrors.length > 0,
|
|
830
881
|
onChange: _onChange,
|
|
831
882
|
onBlur: _onBlur,
|
|
832
883
|
onFocus: _onFocus,
|
|
833
884
|
required: required,
|
|
834
|
-
label: label ||
|
|
885
|
+
label: label || '',
|
|
835
886
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
836
887
|
}));
|
|
837
888
|
}
|
|
@@ -857,7 +908,7 @@ function CheckboxesWidget(props) {
|
|
|
857
908
|
_props$rawErrors = props.rawErrors,
|
|
858
909
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
859
910
|
registry = props.registry;
|
|
860
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
911
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
861
912
|
var enumOptions = options.enumOptions,
|
|
862
913
|
enumDisabled = options.enumDisabled,
|
|
863
914
|
inline = options.inline;
|
|
@@ -893,34 +944,37 @@ function CheckboxesWidget(props) {
|
|
|
893
944
|
} : {
|
|
894
945
|
grouped: true
|
|
895
946
|
};
|
|
896
|
-
return
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
947
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
948
|
+
children: [title && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
949
|
+
id: utils.titleId(id),
|
|
950
|
+
title: title,
|
|
951
|
+
schema: schema,
|
|
952
|
+
uiSchema: uiSchema,
|
|
953
|
+
registry: registry
|
|
954
|
+
}), jsxRuntime.jsx(semanticUiReact.Form.Group, _extends({
|
|
955
|
+
id: id,
|
|
956
|
+
name: id
|
|
957
|
+
}, inlineOption, {
|
|
958
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
959
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
960
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
961
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Checkbox, _extends({
|
|
962
|
+
id: utils.optionId(id, index),
|
|
963
|
+
name: id,
|
|
964
|
+
label: option.label
|
|
965
|
+
}, semanticProps, {
|
|
966
|
+
checked: checked,
|
|
967
|
+
error: rawErrors.length > 0,
|
|
968
|
+
disabled: disabled || itemDisabled || readonly,
|
|
969
|
+
autoFocus: autofocus && index === 0,
|
|
970
|
+
onChange: _onChange(index),
|
|
971
|
+
onBlur: _onBlur,
|
|
972
|
+
onFocus: _onFocus,
|
|
973
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
974
|
+
}), index);
|
|
975
|
+
})
|
|
976
|
+
}))]
|
|
977
|
+
});
|
|
924
978
|
}
|
|
925
979
|
|
|
926
980
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
@@ -965,26 +1019,28 @@ function RadioWidget(props) {
|
|
|
965
1019
|
} : {
|
|
966
1020
|
grouped: true
|
|
967
1021
|
};
|
|
968
|
-
return
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1022
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Group, _extends({}, inlineOption, {
|
|
1023
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
1024
|
+
var checked = utils.enumOptionsIsSelected(option.value, value);
|
|
1025
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
1026
|
+
return /*#__PURE__*/react.createElement(semanticUiReact.Form.Field, _extends({
|
|
1027
|
+
required: required,
|
|
1028
|
+
control: semanticUiReact.Radio,
|
|
1029
|
+
id: utils.optionId(id, index),
|
|
1030
|
+
name: id
|
|
1031
|
+
}, semanticProps, {
|
|
1032
|
+
onFocus: _onFocus,
|
|
1033
|
+
onBlur: _onBlur,
|
|
1034
|
+
onChange: _onChange,
|
|
1035
|
+
label: option.label,
|
|
1036
|
+
value: String(index),
|
|
1037
|
+
error: rawErrors.length > 0,
|
|
1038
|
+
key: index,
|
|
1039
|
+
checked: checked,
|
|
1040
|
+
disabled: disabled || itemDisabled || readonly,
|
|
1041
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1042
|
+
}));
|
|
1043
|
+
})
|
|
988
1044
|
}));
|
|
989
1045
|
}
|
|
990
1046
|
|
|
@@ -1019,7 +1075,7 @@ function RangeWidget(props) {
|
|
|
1019
1075
|
// eslint-disable-next-line no-shadow
|
|
1020
1076
|
var _onChange = function _onChange(_ref) {
|
|
1021
1077
|
var value = _ref.target.value;
|
|
1022
|
-
return onChange && onChange(value ===
|
|
1078
|
+
return onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1023
1079
|
};
|
|
1024
1080
|
var _onBlur = function _onBlur() {
|
|
1025
1081
|
return onBlur && onBlur(id, value);
|
|
@@ -1027,21 +1083,24 @@ function RangeWidget(props) {
|
|
|
1027
1083
|
var _onFocus = function _onFocus() {
|
|
1028
1084
|
return onFocus && onFocus(id, value);
|
|
1029
1085
|
};
|
|
1030
|
-
return
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1086
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1087
|
+
children: [jsxRuntime.jsx(semanticUiReact.Input, _extends({
|
|
1088
|
+
id: id,
|
|
1089
|
+
name: id,
|
|
1090
|
+
type: 'range',
|
|
1091
|
+
required: required,
|
|
1092
|
+
disabled: disabled || readonly
|
|
1093
|
+
}, utils.rangeSpec(schema), semanticProps, {
|
|
1094
|
+
value: value || '',
|
|
1095
|
+
error: rawErrors.length > 0,
|
|
1096
|
+
onChange: _onChange,
|
|
1097
|
+
onBlur: _onBlur,
|
|
1098
|
+
onFocus: _onFocus,
|
|
1099
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1100
|
+
}), id), jsxRuntime.jsx("span", {
|
|
1101
|
+
children: value
|
|
1102
|
+
})]
|
|
1103
|
+
});
|
|
1045
1104
|
}
|
|
1046
1105
|
|
|
1047
1106
|
/**
|
|
@@ -1093,7 +1152,7 @@ function SelectWidget(props) {
|
|
|
1093
1152
|
formContext: formContext,
|
|
1094
1153
|
options: options,
|
|
1095
1154
|
defaultSchemaProps: {
|
|
1096
|
-
inverted:
|
|
1155
|
+
inverted: 'false',
|
|
1097
1156
|
selection: true,
|
|
1098
1157
|
fluid: true,
|
|
1099
1158
|
scrolling: true,
|
|
@@ -1103,7 +1162,7 @@ function SelectWidget(props) {
|
|
|
1103
1162
|
var enumDisabled = options.enumDisabled,
|
|
1104
1163
|
enumOptions = options.enumOptions,
|
|
1105
1164
|
optEmptyVal = options.emptyValue;
|
|
1106
|
-
var emptyValue = multiple ? [] :
|
|
1165
|
+
var emptyValue = multiple ? [] : '';
|
|
1107
1166
|
var dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
|
|
1108
1167
|
var _onChange = function _onChange(_, _ref2) {
|
|
1109
1168
|
var value = _ref2.value;
|
|
@@ -1119,13 +1178,12 @@ function SelectWidget(props) {
|
|
|
1119
1178
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1120
1179
|
};
|
|
1121
1180
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1122
|
-
return
|
|
1123
|
-
key: id,
|
|
1181
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Dropdown, _extends({
|
|
1124
1182
|
id: id,
|
|
1125
1183
|
name: id,
|
|
1126
1184
|
label: label || schema.title,
|
|
1127
|
-
multiple: typeof multiple ===
|
|
1128
|
-
value: typeof value ===
|
|
1185
|
+
multiple: typeof multiple === 'undefined' ? false : multiple,
|
|
1186
|
+
value: typeof value === 'undefined' ? emptyValue : selectedIndexes,
|
|
1129
1187
|
error: rawErrors.length > 0,
|
|
1130
1188
|
disabled: disabled,
|
|
1131
1189
|
placeholder: placeholder
|
|
@@ -1138,7 +1196,7 @@ function SelectWidget(props) {
|
|
|
1138
1196
|
onBlur: _onBlur,
|
|
1139
1197
|
onFocus: _onFocus,
|
|
1140
1198
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1141
|
-
}));
|
|
1199
|
+
}), id);
|
|
1142
1200
|
}
|
|
1143
1201
|
|
|
1144
1202
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
@@ -1175,7 +1233,7 @@ function TextareaWidget(props) {
|
|
|
1175
1233
|
// eslint-disable-next-line no-shadow
|
|
1176
1234
|
var _onChange = function _onChange(_ref) {
|
|
1177
1235
|
var value = _ref.target.value;
|
|
1178
|
-
return onChange && onChange(value ===
|
|
1236
|
+
return onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1179
1237
|
};
|
|
1180
1238
|
var _onBlur = function _onBlur() {
|
|
1181
1239
|
return onBlur && onBlur(id, value);
|
|
@@ -1184,9 +1242,8 @@ function TextareaWidget(props) {
|
|
|
1184
1242
|
return onFocus && onFocus(id, value);
|
|
1185
1243
|
};
|
|
1186
1244
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
1187
|
-
return
|
|
1245
|
+
return jsxRuntime.jsx(semanticUiReact.Form.TextArea, _extends({
|
|
1188
1246
|
id: id,
|
|
1189
|
-
key: id,
|
|
1190
1247
|
name: id,
|
|
1191
1248
|
label: displayLabel ? label || schema.title : false,
|
|
1192
1249
|
placeholder: placeholder,
|
|
@@ -1194,14 +1251,14 @@ function TextareaWidget(props) {
|
|
|
1194
1251
|
required: required,
|
|
1195
1252
|
disabled: disabled || readonly
|
|
1196
1253
|
}, semanticProps, {
|
|
1197
|
-
value: value ||
|
|
1254
|
+
value: value || '',
|
|
1198
1255
|
error: rawErrors.length > 0,
|
|
1199
1256
|
rows: options.rows || 5,
|
|
1200
1257
|
onChange: _onChange,
|
|
1201
1258
|
onBlur: _onBlur,
|
|
1202
1259
|
onFocus: _onFocus,
|
|
1203
1260
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1204
|
-
}));
|
|
1261
|
+
}), id);
|
|
1205
1262
|
}
|
|
1206
1263
|
|
|
1207
1264
|
function generateWidgets() {
|