@rjsf/semantic-ui 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +183 -183
- package/README.md +15 -12
- package/dist/semantic-ui.cjs.development.js +383 -335
- 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 +383 -334
- package/dist/semantic-ui.esm.js.map +1 -1
- package/dist/semantic-ui.umd.development.js +385 -338
- 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() {
|
|
@@ -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,14 +155,14 @@ 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
|
+
display: 'grid',
|
|
165
166
|
gridTemplateColumns: "1fr " + (vertical ? 65 : 110) + "px"
|
|
166
167
|
};
|
|
167
168
|
};
|
|
@@ -193,40 +194,47 @@ function ArrayFieldItemTemplate(props) {
|
|
|
193
194
|
horizontalButtons = _uiOptions$semantic$h === void 0 ? false : _uiOptions$semantic$h,
|
|
194
195
|
_uiOptions$semantic$w = _uiOptions$semantic.wrapItem,
|
|
195
196
|
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
|
-
|
|
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
|
+
});
|
|
230
238
|
}
|
|
231
239
|
|
|
232
240
|
var _excluded$2 = ["key", "uiSchema"];
|
|
@@ -263,57 +271,58 @@ function ArrayFieldTemplate(props) {
|
|
|
263
271
|
wrapItem: wrapItem
|
|
264
272
|
};
|
|
265
273
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
266
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
267
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
268
|
-
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);
|
|
269
277
|
// Button templates are not overridden in the uiSchema
|
|
270
278
|
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
|
-
|
|
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
|
+
});
|
|
317
326
|
}
|
|
318
327
|
|
|
319
328
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
@@ -331,6 +340,7 @@ function BaseInputTemplate(props) {
|
|
|
331
340
|
readonly = props.readonly,
|
|
332
341
|
disabled = props.disabled,
|
|
333
342
|
onChange = props.onChange,
|
|
343
|
+
onChangeOverride = props.onChangeOverride,
|
|
334
344
|
onBlur = props.onBlur,
|
|
335
345
|
onFocus = props.onFocus,
|
|
336
346
|
autofocus = props.autofocus,
|
|
@@ -351,7 +361,7 @@ function BaseInputTemplate(props) {
|
|
|
351
361
|
var schemaUtils = registry.schemaUtils;
|
|
352
362
|
var _onChange = function _onChange(_ref) {
|
|
353
363
|
var value = _ref.target.value;
|
|
354
|
-
return onChange(value ===
|
|
364
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
355
365
|
};
|
|
356
366
|
var _onBlur = function _onBlur() {
|
|
357
367
|
return onBlur && onBlur(id, value);
|
|
@@ -360,32 +370,33 @@ function BaseInputTemplate(props) {
|
|
|
360
370
|
return onFocus && onFocus(id, value);
|
|
361
371
|
};
|
|
362
372
|
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
|
-
|
|
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
|
+
});
|
|
389
400
|
}
|
|
390
401
|
|
|
391
402
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -398,10 +409,11 @@ function DescriptionField(props) {
|
|
|
398
409
|
if (!description) {
|
|
399
410
|
return null;
|
|
400
411
|
}
|
|
401
|
-
return
|
|
412
|
+
return jsxRuntime.jsx("p", {
|
|
402
413
|
id: id,
|
|
403
|
-
className:
|
|
404
|
-
|
|
414
|
+
className: 'sui-description',
|
|
415
|
+
children: description
|
|
416
|
+
});
|
|
405
417
|
}
|
|
406
418
|
|
|
407
419
|
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
@@ -412,13 +424,18 @@ function ErrorList(_ref) {
|
|
|
412
424
|
var errors = _ref.errors,
|
|
413
425
|
registry = _ref.registry;
|
|
414
426
|
var translateString = registry.translateString;
|
|
415
|
-
return
|
|
416
|
-
negative: true
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
+
});
|
|
422
439
|
}
|
|
423
440
|
|
|
424
441
|
var _excluded$1 = ["icon", "iconType", "color", "className", "uiSchema", "registry"];
|
|
@@ -428,7 +445,7 @@ function IconButton(props) {
|
|
|
428
445
|
color = props.color,
|
|
429
446
|
className = props.className,
|
|
430
447
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
431
|
-
return
|
|
448
|
+
return jsxRuntime.jsx(semanticUiReact.Button, _extends({
|
|
432
449
|
icon: icon,
|
|
433
450
|
size: iconType,
|
|
434
451
|
color: color,
|
|
@@ -437,33 +454,33 @@ function IconButton(props) {
|
|
|
437
454
|
}
|
|
438
455
|
function MoveDownButton(props) {
|
|
439
456
|
var translateString = props.registry.translateString;
|
|
440
|
-
return
|
|
457
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
441
458
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
442
459
|
}, props, {
|
|
443
|
-
icon:
|
|
460
|
+
icon: 'angle down'
|
|
444
461
|
}));
|
|
445
462
|
}
|
|
446
463
|
function MoveUpButton(props) {
|
|
447
464
|
var translateString = props.registry.translateString;
|
|
448
|
-
return
|
|
465
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
449
466
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
450
467
|
}, props, {
|
|
451
|
-
icon:
|
|
468
|
+
icon: 'angle up'
|
|
452
469
|
}));
|
|
453
470
|
}
|
|
454
471
|
function RemoveButton(props) {
|
|
455
472
|
var translateString = props.registry.translateString;
|
|
456
|
-
return
|
|
473
|
+
return jsxRuntime.jsx(IconButton, _extends({
|
|
457
474
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
458
475
|
}, props, {
|
|
459
|
-
icon:
|
|
476
|
+
icon: 'trash'
|
|
460
477
|
}));
|
|
461
478
|
}
|
|
462
479
|
|
|
463
480
|
var DEFAULT_OPTIONS$1 = {
|
|
464
481
|
options: {
|
|
465
|
-
pointing:
|
|
466
|
-
size:
|
|
482
|
+
pointing: 'above',
|
|
483
|
+
size: 'small'
|
|
467
484
|
}
|
|
468
485
|
};
|
|
469
486
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -485,19 +502,21 @@ function FieldErrorTemplate(_ref) {
|
|
|
485
502
|
size = options.size;
|
|
486
503
|
if (errors && errors.length > 0) {
|
|
487
504
|
var id = utils.errorId(idSchema);
|
|
488
|
-
return
|
|
505
|
+
return jsxRuntime.jsx(semanticUiReact.Label, {
|
|
489
506
|
id: id,
|
|
490
|
-
color:
|
|
491
|
-
pointing: pointing ||
|
|
492
|
-
size: size ||
|
|
493
|
-
basic: true
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
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
|
+
});
|
|
501
520
|
}
|
|
502
521
|
return null;
|
|
503
522
|
}
|
|
@@ -511,8 +530,8 @@ function FieldHelpTemplate(props) {
|
|
|
511
530
|
help = props.help;
|
|
512
531
|
if (help) {
|
|
513
532
|
var id = utils.helpId(idSchema);
|
|
514
|
-
return
|
|
515
|
-
size:
|
|
533
|
+
return jsxRuntime.jsx(semanticUiReact.Message, {
|
|
534
|
+
size: 'mini',
|
|
516
535
|
info: true,
|
|
517
536
|
id: id,
|
|
518
537
|
content: help
|
|
@@ -546,16 +565,17 @@ function FieldTemplate(props) {
|
|
|
546
565
|
var wrapLabel = semanticProps.wrapLabel,
|
|
547
566
|
wrapContent = semanticProps.wrapContent;
|
|
548
567
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
549
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
550
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
568
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
569
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
551
570
|
if (hidden) {
|
|
552
|
-
return
|
|
571
|
+
return jsxRuntime.jsx("div", {
|
|
553
572
|
style: {
|
|
554
|
-
display:
|
|
555
|
-
}
|
|
556
|
-
|
|
573
|
+
display: 'none'
|
|
574
|
+
},
|
|
575
|
+
children: children
|
|
576
|
+
});
|
|
557
577
|
}
|
|
558
|
-
return
|
|
578
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, _extends({
|
|
559
579
|
classNames: classNames,
|
|
560
580
|
style: style,
|
|
561
581
|
id: id,
|
|
@@ -563,23 +583,27 @@ function FieldTemplate(props) {
|
|
|
563
583
|
registry: registry,
|
|
564
584
|
schema: schema,
|
|
565
585
|
uiSchema: uiSchema
|
|
566
|
-
}, otherProps
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
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
|
+
}));
|
|
583
607
|
}
|
|
584
608
|
|
|
585
609
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -602,42 +626,48 @@ function ObjectFieldTemplate(props) {
|
|
|
602
626
|
idSchema = props.idSchema,
|
|
603
627
|
registry = props.registry;
|
|
604
628
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
605
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
606
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
629
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
630
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
607
631
|
// Button templates are not overridden in the uiSchema
|
|
608
632
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
609
633
|
var fieldTitle = uiOptions.title || title;
|
|
610
634
|
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
|
-
|
|
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
|
+
});
|
|
641
671
|
}
|
|
642
672
|
|
|
643
673
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -652,10 +682,12 @@ function SubmitButton(_ref) {
|
|
|
652
682
|
if (norender) {
|
|
653
683
|
return null;
|
|
654
684
|
}
|
|
655
|
-
return
|
|
656
|
-
type:
|
|
685
|
+
return jsxRuntime.jsx(semanticUiReact.Button, _extends({
|
|
686
|
+
type: 'submit',
|
|
657
687
|
primary: true
|
|
658
|
-
}, submitButtonProps
|
|
688
|
+
}, submitButtonProps, {
|
|
689
|
+
children: submitText
|
|
690
|
+
}));
|
|
659
691
|
}
|
|
660
692
|
|
|
661
693
|
var DEFAULT_OPTIONS = {
|
|
@@ -677,11 +709,12 @@ function TitleField(_ref) {
|
|
|
677
709
|
if (!title) {
|
|
678
710
|
return null;
|
|
679
711
|
}
|
|
680
|
-
return
|
|
712
|
+
return jsxRuntime.jsx(semanticUiReact.Header, _extends({
|
|
681
713
|
id: id
|
|
682
714
|
}, semanticProps, {
|
|
683
|
-
as:
|
|
684
|
-
|
|
715
|
+
as: 'h5',
|
|
716
|
+
children: title
|
|
717
|
+
}));
|
|
685
718
|
}
|
|
686
719
|
|
|
687
720
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -714,51 +747,60 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
714
747
|
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
715
748
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
716
749
|
if (!additional) {
|
|
717
|
-
return
|
|
750
|
+
return jsxRuntime.jsx("div", {
|
|
718
751
|
className: classNames,
|
|
719
|
-
style: style
|
|
720
|
-
|
|
752
|
+
style: style,
|
|
753
|
+
children: children
|
|
754
|
+
});
|
|
721
755
|
}
|
|
722
756
|
var handleBlur = function handleBlur(_ref) {
|
|
723
757
|
var target = _ref.target;
|
|
724
758
|
return onKeyChange(target.value);
|
|
725
759
|
};
|
|
726
|
-
return
|
|
760
|
+
return jsxRuntime.jsx("div", {
|
|
727
761
|
className: classNames,
|
|
728
762
|
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
|
-
|
|
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");
|
|
762
804
|
}
|
|
763
805
|
|
|
764
806
|
function generateTemplates() {
|
|
@@ -827,20 +869,20 @@ function CheckboxWidget(props) {
|
|
|
827
869
|
var _onFocus = function _onFocus() {
|
|
828
870
|
return onFocus && onFocus(id, value);
|
|
829
871
|
};
|
|
830
|
-
var checked = value ==
|
|
831
|
-
return
|
|
872
|
+
var checked = value == 'true' || value == true;
|
|
873
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Checkbox, _extends({
|
|
832
874
|
id: id,
|
|
833
875
|
name: id,
|
|
834
876
|
disabled: disabled || readonly,
|
|
835
877
|
autoFocus: autofocus
|
|
836
878
|
}, semanticProps, {
|
|
837
|
-
checked: typeof value ===
|
|
879
|
+
checked: typeof value === 'undefined' ? false : checked,
|
|
838
880
|
error: rawErrors.length > 0,
|
|
839
881
|
onChange: _onChange,
|
|
840
882
|
onBlur: _onBlur,
|
|
841
883
|
onFocus: _onFocus,
|
|
842
884
|
required: required,
|
|
843
|
-
label: label ||
|
|
885
|
+
label: label || '',
|
|
844
886
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
845
887
|
}));
|
|
846
888
|
}
|
|
@@ -866,7 +908,7 @@ function CheckboxesWidget(props) {
|
|
|
866
908
|
_props$rawErrors = props.rawErrors,
|
|
867
909
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
868
910
|
registry = props.registry;
|
|
869
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
911
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, options);
|
|
870
912
|
var enumOptions = options.enumOptions,
|
|
871
913
|
enumDisabled = options.enumDisabled,
|
|
872
914
|
inline = options.inline;
|
|
@@ -902,34 +944,37 @@ function CheckboxesWidget(props) {
|
|
|
902
944
|
} : {
|
|
903
945
|
grouped: true
|
|
904
946
|
};
|
|
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
|
-
|
|
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
|
+
});
|
|
933
978
|
}
|
|
934
979
|
|
|
935
980
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
@@ -974,26 +1019,28 @@ function RadioWidget(props) {
|
|
|
974
1019
|
} : {
|
|
975
1020
|
grouped: true
|
|
976
1021
|
};
|
|
977
|
-
return
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
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
|
+
})
|
|
997
1044
|
}));
|
|
998
1045
|
}
|
|
999
1046
|
|
|
@@ -1028,7 +1075,7 @@ function RangeWidget(props) {
|
|
|
1028
1075
|
// eslint-disable-next-line no-shadow
|
|
1029
1076
|
var _onChange = function _onChange(_ref) {
|
|
1030
1077
|
var value = _ref.target.value;
|
|
1031
|
-
return onChange && onChange(value ===
|
|
1078
|
+
return onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1032
1079
|
};
|
|
1033
1080
|
var _onBlur = function _onBlur() {
|
|
1034
1081
|
return onBlur && onBlur(id, value);
|
|
@@ -1036,21 +1083,24 @@ function RangeWidget(props) {
|
|
|
1036
1083
|
var _onFocus = function _onFocus() {
|
|
1037
1084
|
return onFocus && onFocus(id, value);
|
|
1038
1085
|
};
|
|
1039
|
-
return
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
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
|
+
});
|
|
1054
1104
|
}
|
|
1055
1105
|
|
|
1056
1106
|
/**
|
|
@@ -1102,7 +1152,7 @@ function SelectWidget(props) {
|
|
|
1102
1152
|
formContext: formContext,
|
|
1103
1153
|
options: options,
|
|
1104
1154
|
defaultSchemaProps: {
|
|
1105
|
-
inverted:
|
|
1155
|
+
inverted: 'false',
|
|
1106
1156
|
selection: true,
|
|
1107
1157
|
fluid: true,
|
|
1108
1158
|
scrolling: true,
|
|
@@ -1112,7 +1162,7 @@ function SelectWidget(props) {
|
|
|
1112
1162
|
var enumDisabled = options.enumDisabled,
|
|
1113
1163
|
enumOptions = options.enumOptions,
|
|
1114
1164
|
optEmptyVal = options.emptyValue;
|
|
1115
|
-
var emptyValue = multiple ? [] :
|
|
1165
|
+
var emptyValue = multiple ? [] : '';
|
|
1116
1166
|
var dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
|
|
1117
1167
|
var _onChange = function _onChange(_, _ref2) {
|
|
1118
1168
|
var value = _ref2.value;
|
|
@@ -1128,13 +1178,12 @@ function SelectWidget(props) {
|
|
|
1128
1178
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1129
1179
|
};
|
|
1130
1180
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1131
|
-
return
|
|
1132
|
-
key: id,
|
|
1181
|
+
return jsxRuntime.jsx(semanticUiReact.Form.Dropdown, _extends({
|
|
1133
1182
|
id: id,
|
|
1134
1183
|
name: id,
|
|
1135
1184
|
label: label || schema.title,
|
|
1136
|
-
multiple: typeof multiple ===
|
|
1137
|
-
value: typeof value ===
|
|
1185
|
+
multiple: typeof multiple === 'undefined' ? false : multiple,
|
|
1186
|
+
value: typeof value === 'undefined' ? emptyValue : selectedIndexes,
|
|
1138
1187
|
error: rawErrors.length > 0,
|
|
1139
1188
|
disabled: disabled,
|
|
1140
1189
|
placeholder: placeholder
|
|
@@ -1147,7 +1196,7 @@ function SelectWidget(props) {
|
|
|
1147
1196
|
onBlur: _onBlur,
|
|
1148
1197
|
onFocus: _onFocus,
|
|
1149
1198
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1150
|
-
}));
|
|
1199
|
+
}), id);
|
|
1151
1200
|
}
|
|
1152
1201
|
|
|
1153
1202
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
@@ -1184,7 +1233,7 @@ function TextareaWidget(props) {
|
|
|
1184
1233
|
// eslint-disable-next-line no-shadow
|
|
1185
1234
|
var _onChange = function _onChange(_ref) {
|
|
1186
1235
|
var value = _ref.target.value;
|
|
1187
|
-
return onChange && onChange(value ===
|
|
1236
|
+
return onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1188
1237
|
};
|
|
1189
1238
|
var _onBlur = function _onBlur() {
|
|
1190
1239
|
return onBlur && onBlur(id, value);
|
|
@@ -1193,9 +1242,8 @@ function TextareaWidget(props) {
|
|
|
1193
1242
|
return onFocus && onFocus(id, value);
|
|
1194
1243
|
};
|
|
1195
1244
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
1196
|
-
return
|
|
1245
|
+
return jsxRuntime.jsx(semanticUiReact.Form.TextArea, _extends({
|
|
1197
1246
|
id: id,
|
|
1198
|
-
key: id,
|
|
1199
1247
|
name: id,
|
|
1200
1248
|
label: displayLabel ? label || schema.title : false,
|
|
1201
1249
|
placeholder: placeholder,
|
|
@@ -1203,14 +1251,14 @@ function TextareaWidget(props) {
|
|
|
1203
1251
|
required: required,
|
|
1204
1252
|
disabled: disabled || readonly
|
|
1205
1253
|
}, semanticProps, {
|
|
1206
|
-
value: value ||
|
|
1254
|
+
value: value || '',
|
|
1207
1255
|
error: rawErrors.length > 0,
|
|
1208
1256
|
rows: options.rows || 5,
|
|
1209
1257
|
onChange: _onChange,
|
|
1210
1258
|
onBlur: _onBlur,
|
|
1211
1259
|
onFocus: _onFocus,
|
|
1212
1260
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1213
|
-
}));
|
|
1261
|
+
}), id);
|
|
1214
1262
|
}
|
|
1215
1263
|
|
|
1216
1264
|
function generateWidgets() {
|