@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
package/dist/semantic-ui.esm.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { withTheme } from '@rjsf/core';
|
|
2
2
|
import { Button, Icon, Segment, Grid, Form, Message, Label, List, Header, Radio, Input } from 'semantic-ui-react';
|
|
3
|
-
import
|
|
4
|
-
import { getUiOptions, getTemplate, isFixedItems, UI_OPTIONS_KEY, getInputProps, examplesId, ariaDescribedByIds, descriptionId, titleId, canExpand, getSubmitButtonOptions, ADDITIONAL_PROPERTY_FLAG, schemaRequiresTrueValue, enumOptionsIsSelected, optionId, enumOptionsSelectValue, enumOptionsDeselectValue, enumOptionsValueForIndex, rangeSpec, enumOptionsIndexForValue } from '@rjsf/utils';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { TranslatableString, getUiOptions, getTemplate, isFixedItems, UI_OPTIONS_KEY, getInputProps, examplesId, ariaDescribedByIds, errorId, helpId, descriptionId, titleId, canExpand, getSubmitButtonOptions, ADDITIONAL_PROPERTY_FLAG, schemaRequiresTrueValue, enumOptionsIsSelected, optionId, enumOptionsSelectValue, enumOptionsDeselectValue, enumOptionsValueForIndex, rangeSpec, enumOptionsIndexForValue } from '@rjsf/utils';
|
|
5
5
|
import { nanoid } from 'nanoid';
|
|
6
|
+
import { createElement } from 'react';
|
|
6
7
|
import map from 'lodash-es/map';
|
|
7
8
|
|
|
8
9
|
function _extends() {
|
|
@@ -36,16 +37,19 @@ var _excluded$4 = ["uiSchema", "registry", "color"];
|
|
|
36
37
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
37
38
|
*/
|
|
38
39
|
function AddButton(_ref) {
|
|
39
|
-
var
|
|
40
|
+
var registry = _ref.registry,
|
|
41
|
+
color = _ref.color,
|
|
40
42
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
var translateString = registry.translateString;
|
|
44
|
+
return jsx(Button, _extends({
|
|
45
|
+
title: translateString(TranslatableString.AddItemButton),
|
|
43
46
|
color: color
|
|
44
47
|
}, props, {
|
|
45
48
|
icon: true,
|
|
46
|
-
size:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
size: 'tiny',
|
|
50
|
+
children: jsx(Icon, {
|
|
51
|
+
name: 'plus'
|
|
52
|
+
})
|
|
49
53
|
}));
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -99,8 +103,8 @@ function getSemanticErrorProps(_ref2) {
|
|
|
99
103
|
options = _ref2$options === void 0 ? {} : _ref2$options,
|
|
100
104
|
_ref2$defaultProps = _ref2.defaultProps,
|
|
101
105
|
defaultProps = _ref2$defaultProps === void 0 ? {
|
|
102
|
-
size:
|
|
103
|
-
pointing:
|
|
106
|
+
size: 'small',
|
|
107
|
+
pointing: 'above'
|
|
104
108
|
} : _ref2$defaultProps;
|
|
105
109
|
var formContextProps = formContext.semantic && formContext.semantic.errorOptions;
|
|
106
110
|
var semanticOptions = getUiOptions(uiSchema).semantic;
|
|
@@ -130,7 +134,7 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
130
134
|
// returning them as a string
|
|
131
135
|
return [].concat(new Set(classList.filter(function (cn) {
|
|
132
136
|
return !omit.includes(cn);
|
|
133
|
-
}))).join(
|
|
137
|
+
}))).join(' ');
|
|
134
138
|
}
|
|
135
139
|
/**
|
|
136
140
|
*
|
|
@@ -143,14 +147,14 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
143
147
|
function MaybeWrap(_ref3) {
|
|
144
148
|
var wrap = _ref3.wrap,
|
|
145
149
|
_ref3$component = _ref3.component,
|
|
146
|
-
Component = _ref3$component === void 0 ?
|
|
150
|
+
Component = _ref3$component === void 0 ? 'div' : _ref3$component,
|
|
147
151
|
props = _objectWithoutPropertiesLoose(_ref3, _excluded$3);
|
|
148
|
-
return wrap ?
|
|
152
|
+
return wrap ? jsx(Component, _extends({}, props)) : props.children;
|
|
149
153
|
}
|
|
150
154
|
|
|
151
155
|
var gridStyle = function gridStyle(vertical) {
|
|
152
156
|
return {
|
|
153
|
-
display:
|
|
157
|
+
display: 'grid',
|
|
154
158
|
gridTemplateColumns: "1fr " + (vertical ? 65 : 110) + "px"
|
|
155
159
|
};
|
|
156
160
|
};
|
|
@@ -182,40 +186,47 @@ function ArrayFieldItemTemplate(props) {
|
|
|
182
186
|
horizontalButtons = _uiOptions$semantic$h === void 0 ? false : _uiOptions$semantic$h,
|
|
183
187
|
_uiOptions$semantic$w = _uiOptions$semantic.wrapItem,
|
|
184
188
|
wrapItem = _uiOptions$semantic$w === void 0 ? false : _uiOptions$semantic$w;
|
|
185
|
-
return
|
|
186
|
-
className:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
189
|
+
return jsx("div", {
|
|
190
|
+
className: 'array-item',
|
|
191
|
+
children: jsx(MaybeWrap, {
|
|
192
|
+
wrap: wrapItem,
|
|
193
|
+
component: Segment,
|
|
194
|
+
children: jsxs(Grid, {
|
|
195
|
+
style: index !== 0 ? _extends({}, gridStyle(!horizontalButtons), {
|
|
196
|
+
alignItems: 'center'
|
|
197
|
+
}) : gridStyle(!horizontalButtons),
|
|
198
|
+
children: [jsx(Grid.Column, {
|
|
199
|
+
width: 16,
|
|
200
|
+
verticalAlign: 'middle',
|
|
201
|
+
children: children
|
|
202
|
+
}), hasToolbar && jsx(Grid.Column, {
|
|
203
|
+
children: (hasMoveUp || hasMoveDown || hasRemove) && jsxs(Button.Group, {
|
|
204
|
+
size: 'mini',
|
|
205
|
+
vertical: !horizontalButtons,
|
|
206
|
+
children: [(hasMoveUp || hasMoveDown) && jsx(MoveUpButton, {
|
|
207
|
+
className: 'array-item-move-up',
|
|
208
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
209
|
+
onClick: onReorderClick(index, index - 1),
|
|
210
|
+
uiSchema: uiSchema,
|
|
211
|
+
registry: registry
|
|
212
|
+
}), (hasMoveUp || hasMoveDown) && jsx(MoveDownButton, {
|
|
213
|
+
className: 'array-item-move-down',
|
|
214
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
215
|
+
onClick: onReorderClick(index, index + 1),
|
|
216
|
+
uiSchema: uiSchema,
|
|
217
|
+
registry: registry
|
|
218
|
+
}), hasRemove && jsx(RemoveButton, {
|
|
219
|
+
className: 'array-item-remove',
|
|
220
|
+
disabled: disabled || readonly,
|
|
221
|
+
onClick: onDropIndexClick(index),
|
|
222
|
+
uiSchema: uiSchema,
|
|
223
|
+
registry: registry
|
|
224
|
+
})]
|
|
225
|
+
})
|
|
226
|
+
})]
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
});
|
|
219
230
|
}
|
|
220
231
|
|
|
221
232
|
var _excluded$2 = ["key", "uiSchema"];
|
|
@@ -252,57 +263,58 @@ function ArrayFieldTemplate(props) {
|
|
|
252
263
|
wrapItem: wrapItem
|
|
253
264
|
};
|
|
254
265
|
var uiOptions = getUiOptions(uiSchema);
|
|
255
|
-
var ArrayFieldDescriptionTemplate = getTemplate(
|
|
256
|
-
var ArrayFieldItemTemplate = getTemplate(
|
|
257
|
-
var ArrayFieldTitleTemplate = getTemplate(
|
|
266
|
+
var ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
267
|
+
var ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
268
|
+
var ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
258
269
|
// Button templates are not overridden in the uiSchema
|
|
259
270
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
260
|
-
return
|
|
261
|
-
className: cleanClassNames([className, isFixedItems(schema) ?
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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
|
-
|
|
271
|
+
return jsxs("div", {
|
|
272
|
+
className: cleanClassNames([className, isFixedItems(schema) ? '' : 'sortable-form-fields']),
|
|
273
|
+
children: [jsx(ArrayFieldTitleTemplate, {
|
|
274
|
+
idSchema: idSchema,
|
|
275
|
+
title: uiOptions.title || title,
|
|
276
|
+
schema: schema,
|
|
277
|
+
uiSchema: uiSchema,
|
|
278
|
+
required: required,
|
|
279
|
+
registry: registry
|
|
280
|
+
}), jsx(ArrayFieldDescriptionTemplate, {
|
|
281
|
+
idSchema: idSchema,
|
|
282
|
+
description: uiOptions.description || schema.description,
|
|
283
|
+
schema: schema,
|
|
284
|
+
uiSchema: uiSchema,
|
|
285
|
+
registry: registry
|
|
286
|
+
}), jsxs("div", {
|
|
287
|
+
children: [jsx("div", {
|
|
288
|
+
className: 'row array-item-list',
|
|
289
|
+
children: items && items.map(function (_ref) {
|
|
290
|
+
var _extends2;
|
|
291
|
+
var key = _ref.key,
|
|
292
|
+
_ref$uiSchema = _ref.uiSchema,
|
|
293
|
+
itemUiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema,
|
|
294
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
295
|
+
// Merge in the semantic props from the ArrayFieldTemplate into each of the items
|
|
296
|
+
var mergedUiSchema = _extends({}, itemUiSchema, (_extends2 = {}, _extends2[UI_OPTIONS_KEY] = _extends({}, itemUiSchema[UI_OPTIONS_KEY], {
|
|
297
|
+
semantic: semantic
|
|
298
|
+
}), _extends2));
|
|
299
|
+
return jsx(ArrayFieldItemTemplate, _extends({}, props, {
|
|
300
|
+
uiSchema: mergedUiSchema
|
|
301
|
+
}), key);
|
|
302
|
+
})
|
|
303
|
+
}), canAdd && jsx("div", {
|
|
304
|
+
style: {
|
|
305
|
+
marginTop: '1rem',
|
|
306
|
+
position: 'relative',
|
|
307
|
+
textAlign: 'right'
|
|
308
|
+
},
|
|
309
|
+
children: jsx(AddButton, {
|
|
310
|
+
onClick: onAddClick,
|
|
311
|
+
disabled: disabled || readonly,
|
|
312
|
+
uiSchema: uiSchema,
|
|
313
|
+
registry: registry
|
|
314
|
+
})
|
|
315
|
+
})]
|
|
316
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
317
|
+
});
|
|
306
318
|
}
|
|
307
319
|
|
|
308
320
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
@@ -320,6 +332,7 @@ function BaseInputTemplate(props) {
|
|
|
320
332
|
readonly = props.readonly,
|
|
321
333
|
disabled = props.disabled,
|
|
322
334
|
onChange = props.onChange,
|
|
335
|
+
onChangeOverride = props.onChangeOverride,
|
|
323
336
|
onBlur = props.onBlur,
|
|
324
337
|
onFocus = props.onFocus,
|
|
325
338
|
autofocus = props.autofocus,
|
|
@@ -340,7 +353,7 @@ function BaseInputTemplate(props) {
|
|
|
340
353
|
var schemaUtils = registry.schemaUtils;
|
|
341
354
|
var _onChange = function _onChange(_ref) {
|
|
342
355
|
var value = _ref.target.value;
|
|
343
|
-
return onChange(value ===
|
|
356
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
344
357
|
};
|
|
345
358
|
var _onBlur = function _onBlur() {
|
|
346
359
|
return onBlur && onBlur(id, value);
|
|
@@ -349,32 +362,33 @@ function BaseInputTemplate(props) {
|
|
|
349
362
|
return onFocus && onFocus(id, value);
|
|
350
363
|
};
|
|
351
364
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
352
|
-
return
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
365
|
+
return jsxs(Fragment, {
|
|
366
|
+
children: [jsx(Form.Input, _extends({
|
|
367
|
+
id: id,
|
|
368
|
+
name: id,
|
|
369
|
+
placeholder: placeholder
|
|
370
|
+
}, inputProps, {
|
|
371
|
+
label: displayLabel ? label || schema.title : false,
|
|
372
|
+
required: required,
|
|
373
|
+
autoFocus: autofocus,
|
|
374
|
+
disabled: disabled || readonly,
|
|
375
|
+
list: schema.examples ? examplesId(id) : undefined
|
|
376
|
+
}, semanticProps, {
|
|
377
|
+
value: value || value === 0 ? value : '',
|
|
378
|
+
error: rawErrors.length > 0,
|
|
379
|
+
onChange: onChangeOverride || _onChange,
|
|
380
|
+
onBlur: _onBlur,
|
|
381
|
+
onFocus: _onFocus,
|
|
382
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
383
|
+
}), id), Array.isArray(schema.examples) && jsx("datalist", {
|
|
384
|
+
id: examplesId(id),
|
|
385
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
386
|
+
return jsx("option", {
|
|
387
|
+
value: example
|
|
388
|
+
}, example);
|
|
389
|
+
})
|
|
390
|
+
})]
|
|
391
|
+
});
|
|
378
392
|
}
|
|
379
393
|
|
|
380
394
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
@@ -387,10 +401,11 @@ function DescriptionField(props) {
|
|
|
387
401
|
if (!description) {
|
|
388
402
|
return null;
|
|
389
403
|
}
|
|
390
|
-
return
|
|
404
|
+
return jsx("p", {
|
|
391
405
|
id: id,
|
|
392
|
-
className:
|
|
393
|
-
|
|
406
|
+
className: 'sui-description',
|
|
407
|
+
children: description
|
|
408
|
+
});
|
|
394
409
|
}
|
|
395
410
|
|
|
396
411
|
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
@@ -398,14 +413,21 @@ function DescriptionField(props) {
|
|
|
398
413
|
* @param props - The `ErrorListProps` for this component
|
|
399
414
|
*/
|
|
400
415
|
function ErrorList(_ref) {
|
|
401
|
-
var errors = _ref.errors
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
416
|
+
var errors = _ref.errors,
|
|
417
|
+
registry = _ref.registry;
|
|
418
|
+
var translateString = registry.translateString;
|
|
419
|
+
return jsxs(Message, {
|
|
420
|
+
negative: true,
|
|
421
|
+
children: [jsx(Message.Header, {
|
|
422
|
+
children: translateString(TranslatableString.ErrorsLabel)
|
|
423
|
+
}), jsx(Message.List, {
|
|
424
|
+
children: errors.map(function (error, index) {
|
|
425
|
+
return jsx(Message.Item, {
|
|
426
|
+
children: error.stack
|
|
427
|
+
}, "error-" + index);
|
|
428
|
+
})
|
|
429
|
+
})]
|
|
430
|
+
});
|
|
409
431
|
}
|
|
410
432
|
|
|
411
433
|
var _excluded$1 = ["icon", "iconType", "color", "className", "uiSchema", "registry"];
|
|
@@ -415,7 +437,7 @@ function IconButton(props) {
|
|
|
415
437
|
color = props.color,
|
|
416
438
|
className = props.className,
|
|
417
439
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
418
|
-
return
|
|
440
|
+
return jsx(Button, _extends({
|
|
419
441
|
icon: icon,
|
|
420
442
|
size: iconType,
|
|
421
443
|
color: color,
|
|
@@ -423,31 +445,34 @@ function IconButton(props) {
|
|
|
423
445
|
}, otherProps));
|
|
424
446
|
}
|
|
425
447
|
function MoveDownButton(props) {
|
|
426
|
-
|
|
427
|
-
|
|
448
|
+
var translateString = props.registry.translateString;
|
|
449
|
+
return jsx(IconButton, _extends({
|
|
450
|
+
title: translateString(TranslatableString.MoveDownButton)
|
|
428
451
|
}, props, {
|
|
429
|
-
icon:
|
|
452
|
+
icon: 'angle down'
|
|
430
453
|
}));
|
|
431
454
|
}
|
|
432
455
|
function MoveUpButton(props) {
|
|
433
|
-
|
|
434
|
-
|
|
456
|
+
var translateString = props.registry.translateString;
|
|
457
|
+
return jsx(IconButton, _extends({
|
|
458
|
+
title: translateString(TranslatableString.MoveUpButton)
|
|
435
459
|
}, props, {
|
|
436
|
-
icon:
|
|
460
|
+
icon: 'angle up'
|
|
437
461
|
}));
|
|
438
462
|
}
|
|
439
463
|
function RemoveButton(props) {
|
|
440
|
-
|
|
441
|
-
|
|
464
|
+
var translateString = props.registry.translateString;
|
|
465
|
+
return jsx(IconButton, _extends({
|
|
466
|
+
title: translateString(TranslatableString.RemoveButton)
|
|
442
467
|
}, props, {
|
|
443
|
-
icon:
|
|
468
|
+
icon: 'trash'
|
|
444
469
|
}));
|
|
445
470
|
}
|
|
446
471
|
|
|
447
472
|
var DEFAULT_OPTIONS$1 = {
|
|
448
473
|
options: {
|
|
449
|
-
pointing:
|
|
450
|
-
size:
|
|
474
|
+
pointing: 'above',
|
|
475
|
+
size: 'small'
|
|
451
476
|
}
|
|
452
477
|
};
|
|
453
478
|
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
@@ -468,20 +493,22 @@ function FieldErrorTemplate(_ref) {
|
|
|
468
493
|
var pointing = options.pointing,
|
|
469
494
|
size = options.size;
|
|
470
495
|
if (errors && errors.length > 0) {
|
|
471
|
-
var id = idSchema
|
|
472
|
-
return
|
|
496
|
+
var id = errorId(idSchema);
|
|
497
|
+
return jsx(Label, {
|
|
473
498
|
id: id,
|
|
474
|
-
color:
|
|
475
|
-
pointing: pointing ||
|
|
476
|
-
size: size ||
|
|
477
|
-
basic: true
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
499
|
+
color: 'red',
|
|
500
|
+
pointing: pointing || 'above',
|
|
501
|
+
size: size || 'small',
|
|
502
|
+
basic: true,
|
|
503
|
+
children: jsx(List, {
|
|
504
|
+
bulleted: true,
|
|
505
|
+
children: errors.map(function (error) {
|
|
506
|
+
return jsx(List.Item, {
|
|
507
|
+
children: error
|
|
508
|
+
}, nanoid());
|
|
509
|
+
})
|
|
510
|
+
})
|
|
511
|
+
});
|
|
485
512
|
}
|
|
486
513
|
return null;
|
|
487
514
|
}
|
|
@@ -494,9 +521,9 @@ function FieldHelpTemplate(props) {
|
|
|
494
521
|
var idSchema = props.idSchema,
|
|
495
522
|
help = props.help;
|
|
496
523
|
if (help) {
|
|
497
|
-
var id = idSchema
|
|
498
|
-
return
|
|
499
|
-
size:
|
|
524
|
+
var id = helpId(idSchema);
|
|
525
|
+
return jsx(Message, {
|
|
526
|
+
size: 'mini',
|
|
500
527
|
info: true,
|
|
501
528
|
id: id,
|
|
502
529
|
content: help
|
|
@@ -530,16 +557,17 @@ function FieldTemplate(props) {
|
|
|
530
557
|
var wrapLabel = semanticProps.wrapLabel,
|
|
531
558
|
wrapContent = semanticProps.wrapContent;
|
|
532
559
|
var uiOptions = getUiOptions(uiSchema);
|
|
533
|
-
var WrapIfAdditionalTemplate = getTemplate(
|
|
534
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
560
|
+
var WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
561
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
535
562
|
if (hidden) {
|
|
536
|
-
return
|
|
563
|
+
return jsx("div", {
|
|
537
564
|
style: {
|
|
538
|
-
display:
|
|
539
|
-
}
|
|
540
|
-
|
|
565
|
+
display: 'none'
|
|
566
|
+
},
|
|
567
|
+
children: children
|
|
568
|
+
});
|
|
541
569
|
}
|
|
542
|
-
return
|
|
570
|
+
return jsx(WrapIfAdditionalTemplate, _extends({
|
|
543
571
|
classNames: classNames,
|
|
544
572
|
style: style,
|
|
545
573
|
id: id,
|
|
@@ -547,23 +575,27 @@ function FieldTemplate(props) {
|
|
|
547
575
|
registry: registry,
|
|
548
576
|
schema: schema,
|
|
549
577
|
uiSchema: uiSchema
|
|
550
|
-
}, otherProps
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
578
|
+
}, otherProps, {
|
|
579
|
+
children: jsx(Form.Group, {
|
|
580
|
+
widths: 'equal',
|
|
581
|
+
grouped: true,
|
|
582
|
+
children: jsxs(MaybeWrap, {
|
|
583
|
+
wrap: wrapContent,
|
|
584
|
+
className: 'sui-field-content',
|
|
585
|
+
children: [children, displayLabel && rawDescription && jsx(MaybeWrap, {
|
|
586
|
+
wrap: wrapLabel,
|
|
587
|
+
className: 'sui-field-label',
|
|
588
|
+
children: rawDescription && jsx(DescriptionFieldTemplate, {
|
|
589
|
+
id: descriptionId(id),
|
|
590
|
+
description: rawDescription,
|
|
591
|
+
schema: schema,
|
|
592
|
+
uiSchema: uiSchema,
|
|
593
|
+
registry: registry
|
|
594
|
+
})
|
|
595
|
+
}), help, errors]
|
|
596
|
+
})
|
|
597
|
+
}, id)
|
|
598
|
+
}));
|
|
567
599
|
}
|
|
568
600
|
|
|
569
601
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -586,42 +618,48 @@ function ObjectFieldTemplate(props) {
|
|
|
586
618
|
idSchema = props.idSchema,
|
|
587
619
|
registry = props.registry;
|
|
588
620
|
var uiOptions = getUiOptions(uiSchema);
|
|
589
|
-
var TitleFieldTemplate = getTemplate(
|
|
590
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
621
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
622
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
591
623
|
// Button templates are not overridden in the uiSchema
|
|
592
624
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
593
625
|
var fieldTitle = uiOptions.title || title;
|
|
594
626
|
var fieldDescription = uiOptions.description || description;
|
|
595
|
-
return
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
627
|
+
return jsxs(Fragment, {
|
|
628
|
+
children: [fieldTitle && jsx(TitleFieldTemplate, {
|
|
629
|
+
id: titleId(idSchema),
|
|
630
|
+
title: fieldTitle,
|
|
631
|
+
required: required,
|
|
632
|
+
schema: schema,
|
|
633
|
+
uiSchema: uiSchema,
|
|
634
|
+
registry: registry
|
|
635
|
+
}), fieldDescription && jsx(DescriptionFieldTemplate, {
|
|
636
|
+
id: descriptionId(idSchema),
|
|
637
|
+
description: fieldDescription,
|
|
638
|
+
schema: schema,
|
|
639
|
+
uiSchema: uiSchema,
|
|
640
|
+
registry: registry
|
|
641
|
+
}), properties.map(function (prop) {
|
|
642
|
+
return prop.content;
|
|
643
|
+
}), canExpand(schema, uiSchema, formData) && jsx(Grid.Column, {
|
|
644
|
+
width: 16,
|
|
645
|
+
verticalAlign: 'middle',
|
|
646
|
+
children: jsx(Grid.Row, {
|
|
647
|
+
children: jsx("div", {
|
|
648
|
+
style: {
|
|
649
|
+
marginTop: '1rem',
|
|
650
|
+
position: 'relative',
|
|
651
|
+
textAlign: 'right'
|
|
652
|
+
},
|
|
653
|
+
children: jsx(AddButton, {
|
|
654
|
+
onClick: onAddClick(schema),
|
|
655
|
+
disabled: disabled || readonly,
|
|
656
|
+
uiSchema: uiSchema,
|
|
657
|
+
registry: registry
|
|
658
|
+
})
|
|
659
|
+
})
|
|
660
|
+
})
|
|
661
|
+
})]
|
|
662
|
+
});
|
|
625
663
|
}
|
|
626
664
|
|
|
627
665
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -636,10 +674,12 @@ function SubmitButton(_ref) {
|
|
|
636
674
|
if (norender) {
|
|
637
675
|
return null;
|
|
638
676
|
}
|
|
639
|
-
return
|
|
640
|
-
type:
|
|
677
|
+
return jsx(Button, _extends({
|
|
678
|
+
type: 'submit',
|
|
641
679
|
primary: true
|
|
642
|
-
}, submitButtonProps
|
|
680
|
+
}, submitButtonProps, {
|
|
681
|
+
children: submitText
|
|
682
|
+
}));
|
|
643
683
|
}
|
|
644
684
|
|
|
645
685
|
var DEFAULT_OPTIONS = {
|
|
@@ -661,11 +701,12 @@ function TitleField(_ref) {
|
|
|
661
701
|
if (!title) {
|
|
662
702
|
return null;
|
|
663
703
|
}
|
|
664
|
-
return
|
|
704
|
+
return jsx(Header, _extends({
|
|
665
705
|
id: id
|
|
666
706
|
}, semanticProps, {
|
|
667
|
-
as:
|
|
668
|
-
|
|
707
|
+
as: 'h5',
|
|
708
|
+
children: title
|
|
709
|
+
}));
|
|
669
710
|
}
|
|
670
711
|
|
|
671
712
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -687,60 +728,71 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
687
728
|
schema = props.schema,
|
|
688
729
|
uiSchema = props.uiSchema,
|
|
689
730
|
registry = props.registry;
|
|
731
|
+
var templates = registry.templates,
|
|
732
|
+
translateString = registry.translateString;
|
|
690
733
|
// Button templates are not overridden in the uiSchema
|
|
691
|
-
var RemoveButton =
|
|
734
|
+
var RemoveButton = templates.ButtonTemplates.RemoveButton;
|
|
735
|
+
var keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
692
736
|
var _registry$formContext = registry.formContext,
|
|
693
737
|
_registry$formContext2 = _registry$formContext.readonlyAsDisabled,
|
|
694
738
|
readonlyAsDisabled = _registry$formContext2 === void 0 ? true : _registry$formContext2,
|
|
695
739
|
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
696
|
-
var keyLabel = label + " Key"; // i18n ?
|
|
697
740
|
var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
698
741
|
if (!additional) {
|
|
699
|
-
return
|
|
742
|
+
return jsx("div", {
|
|
700
743
|
className: classNames,
|
|
701
|
-
style: style
|
|
702
|
-
|
|
744
|
+
style: style,
|
|
745
|
+
children: children
|
|
746
|
+
});
|
|
703
747
|
}
|
|
704
748
|
var handleBlur = function handleBlur(_ref) {
|
|
705
749
|
var target = _ref.target;
|
|
706
750
|
return onKeyChange(target.value);
|
|
707
751
|
};
|
|
708
|
-
return
|
|
752
|
+
return jsx("div", {
|
|
709
753
|
className: classNames,
|
|
710
754
|
style: style,
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
755
|
+
children: jsx(Grid, {
|
|
756
|
+
columns: 'equal',
|
|
757
|
+
children: jsxs(Grid.Row, {
|
|
758
|
+
children: [jsx(Grid.Column, {
|
|
759
|
+
className: 'form-additional',
|
|
760
|
+
children: jsx(Form.Group, {
|
|
761
|
+
widths: 'equal',
|
|
762
|
+
grouped: true,
|
|
763
|
+
children: jsx(Form.Input, {
|
|
764
|
+
className: 'form-group',
|
|
765
|
+
hasFeedback: true,
|
|
766
|
+
fluid: true,
|
|
767
|
+
htmlFor: "" + id,
|
|
768
|
+
label: keyLabel,
|
|
769
|
+
required: required,
|
|
770
|
+
defaultValue: label,
|
|
771
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
772
|
+
id: "" + id,
|
|
773
|
+
name: "" + id,
|
|
774
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
775
|
+
style: wrapperStyle,
|
|
776
|
+
type: 'text'
|
|
777
|
+
})
|
|
778
|
+
})
|
|
779
|
+
}), jsx(Grid.Column, {
|
|
780
|
+
className: 'form-additional',
|
|
781
|
+
verticalAlign: 'middle',
|
|
782
|
+
children: children
|
|
783
|
+
}), jsx(Grid.Column, {
|
|
784
|
+
children: jsx(RemoveButton, {
|
|
785
|
+
iconType: 'mini',
|
|
786
|
+
className: 'array-item-remove',
|
|
787
|
+
disabled: disabled || readonly,
|
|
788
|
+
onClick: onDropPropertyClick(label),
|
|
789
|
+
uiSchema: uiSchema,
|
|
790
|
+
registry: registry
|
|
791
|
+
})
|
|
792
|
+
})]
|
|
793
|
+
})
|
|
794
|
+
})
|
|
795
|
+
}, id + "-key");
|
|
744
796
|
}
|
|
745
797
|
|
|
746
798
|
function generateTemplates() {
|
|
@@ -809,20 +861,20 @@ function CheckboxWidget(props) {
|
|
|
809
861
|
var _onFocus = function _onFocus() {
|
|
810
862
|
return onFocus && onFocus(id, value);
|
|
811
863
|
};
|
|
812
|
-
var checked = value ==
|
|
813
|
-
return
|
|
864
|
+
var checked = value == 'true' || value == true;
|
|
865
|
+
return jsx(Form.Checkbox, _extends({
|
|
814
866
|
id: id,
|
|
815
867
|
name: id,
|
|
816
868
|
disabled: disabled || readonly,
|
|
817
869
|
autoFocus: autofocus
|
|
818
870
|
}, semanticProps, {
|
|
819
|
-
checked: typeof value ===
|
|
871
|
+
checked: typeof value === 'undefined' ? false : checked,
|
|
820
872
|
error: rawErrors.length > 0,
|
|
821
873
|
onChange: _onChange,
|
|
822
874
|
onBlur: _onBlur,
|
|
823
875
|
onFocus: _onFocus,
|
|
824
876
|
required: required,
|
|
825
|
-
label: label ||
|
|
877
|
+
label: label || '',
|
|
826
878
|
"aria-describedby": ariaDescribedByIds(id)
|
|
827
879
|
}));
|
|
828
880
|
}
|
|
@@ -848,7 +900,7 @@ function CheckboxesWidget(props) {
|
|
|
848
900
|
_props$rawErrors = props.rawErrors,
|
|
849
901
|
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
850
902
|
registry = props.registry;
|
|
851
|
-
var TitleFieldTemplate = getTemplate(
|
|
903
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, options);
|
|
852
904
|
var enumOptions = options.enumOptions,
|
|
853
905
|
enumDisabled = options.enumDisabled,
|
|
854
906
|
inline = options.inline;
|
|
@@ -884,34 +936,37 @@ function CheckboxesWidget(props) {
|
|
|
884
936
|
} : {
|
|
885
937
|
grouped: true
|
|
886
938
|
};
|
|
887
|
-
return
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
939
|
+
return jsxs(Fragment, {
|
|
940
|
+
children: [title && jsx(TitleFieldTemplate, {
|
|
941
|
+
id: titleId(id),
|
|
942
|
+
title: title,
|
|
943
|
+
schema: schema,
|
|
944
|
+
uiSchema: uiSchema,
|
|
945
|
+
registry: registry
|
|
946
|
+
}), jsx(Form.Group, _extends({
|
|
947
|
+
id: id,
|
|
948
|
+
name: id
|
|
949
|
+
}, inlineOption, {
|
|
950
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
951
|
+
var checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
952
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
953
|
+
return jsx(Form.Checkbox, _extends({
|
|
954
|
+
id: optionId(id, index),
|
|
955
|
+
name: id,
|
|
956
|
+
label: option.label
|
|
957
|
+
}, semanticProps, {
|
|
958
|
+
checked: checked,
|
|
959
|
+
error: rawErrors.length > 0,
|
|
960
|
+
disabled: disabled || itemDisabled || readonly,
|
|
961
|
+
autoFocus: autofocus && index === 0,
|
|
962
|
+
onChange: _onChange(index),
|
|
963
|
+
onBlur: _onBlur,
|
|
964
|
+
onFocus: _onFocus,
|
|
965
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
966
|
+
}), index);
|
|
967
|
+
})
|
|
968
|
+
}))]
|
|
969
|
+
});
|
|
915
970
|
}
|
|
916
971
|
|
|
917
972
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
@@ -956,26 +1011,28 @@ function RadioWidget(props) {
|
|
|
956
1011
|
} : {
|
|
957
1012
|
grouped: true
|
|
958
1013
|
};
|
|
959
|
-
return
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1014
|
+
return jsx(Form.Group, _extends({}, inlineOption, {
|
|
1015
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
1016
|
+
var checked = enumOptionsIsSelected(option.value, value);
|
|
1017
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
1018
|
+
return /*#__PURE__*/createElement(Form.Field, _extends({
|
|
1019
|
+
required: required,
|
|
1020
|
+
control: Radio,
|
|
1021
|
+
id: optionId(id, index),
|
|
1022
|
+
name: id
|
|
1023
|
+
}, semanticProps, {
|
|
1024
|
+
onFocus: _onFocus,
|
|
1025
|
+
onBlur: _onBlur,
|
|
1026
|
+
onChange: _onChange,
|
|
1027
|
+
label: option.label,
|
|
1028
|
+
value: String(index),
|
|
1029
|
+
error: rawErrors.length > 0,
|
|
1030
|
+
key: index,
|
|
1031
|
+
checked: checked,
|
|
1032
|
+
disabled: disabled || itemDisabled || readonly,
|
|
1033
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1034
|
+
}));
|
|
1035
|
+
})
|
|
979
1036
|
}));
|
|
980
1037
|
}
|
|
981
1038
|
|
|
@@ -1010,7 +1067,7 @@ function RangeWidget(props) {
|
|
|
1010
1067
|
// eslint-disable-next-line no-shadow
|
|
1011
1068
|
var _onChange = function _onChange(_ref) {
|
|
1012
1069
|
var value = _ref.target.value;
|
|
1013
|
-
return onChange && onChange(value ===
|
|
1070
|
+
return onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1014
1071
|
};
|
|
1015
1072
|
var _onBlur = function _onBlur() {
|
|
1016
1073
|
return onBlur && onBlur(id, value);
|
|
@@ -1018,21 +1075,24 @@ function RangeWidget(props) {
|
|
|
1018
1075
|
var _onFocus = function _onFocus() {
|
|
1019
1076
|
return onFocus && onFocus(id, value);
|
|
1020
1077
|
};
|
|
1021
|
-
return
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1078
|
+
return jsxs(Fragment, {
|
|
1079
|
+
children: [jsx(Input, _extends({
|
|
1080
|
+
id: id,
|
|
1081
|
+
name: id,
|
|
1082
|
+
type: 'range',
|
|
1083
|
+
required: required,
|
|
1084
|
+
disabled: disabled || readonly
|
|
1085
|
+
}, rangeSpec(schema), semanticProps, {
|
|
1086
|
+
value: value || '',
|
|
1087
|
+
error: rawErrors.length > 0,
|
|
1088
|
+
onChange: _onChange,
|
|
1089
|
+
onBlur: _onBlur,
|
|
1090
|
+
onFocus: _onFocus,
|
|
1091
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1092
|
+
}), id), jsx("span", {
|
|
1093
|
+
children: value
|
|
1094
|
+
})]
|
|
1095
|
+
});
|
|
1036
1096
|
}
|
|
1037
1097
|
|
|
1038
1098
|
/**
|
|
@@ -1084,7 +1144,7 @@ function SelectWidget(props) {
|
|
|
1084
1144
|
formContext: formContext,
|
|
1085
1145
|
options: options,
|
|
1086
1146
|
defaultSchemaProps: {
|
|
1087
|
-
inverted:
|
|
1147
|
+
inverted: 'false',
|
|
1088
1148
|
selection: true,
|
|
1089
1149
|
fluid: true,
|
|
1090
1150
|
scrolling: true,
|
|
@@ -1094,7 +1154,7 @@ function SelectWidget(props) {
|
|
|
1094
1154
|
var enumDisabled = options.enumDisabled,
|
|
1095
1155
|
enumOptions = options.enumOptions,
|
|
1096
1156
|
optEmptyVal = options.emptyValue;
|
|
1097
|
-
var emptyValue = multiple ? [] :
|
|
1157
|
+
var emptyValue = multiple ? [] : '';
|
|
1098
1158
|
var dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
|
|
1099
1159
|
var _onChange = function _onChange(_, _ref2) {
|
|
1100
1160
|
var value = _ref2.value;
|
|
@@ -1110,13 +1170,12 @@ function SelectWidget(props) {
|
|
|
1110
1170
|
return onFocus(id, enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1111
1171
|
};
|
|
1112
1172
|
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1113
|
-
return
|
|
1114
|
-
key: id,
|
|
1173
|
+
return jsx(Form.Dropdown, _extends({
|
|
1115
1174
|
id: id,
|
|
1116
1175
|
name: id,
|
|
1117
1176
|
label: label || schema.title,
|
|
1118
|
-
multiple: typeof multiple ===
|
|
1119
|
-
value: typeof value ===
|
|
1177
|
+
multiple: typeof multiple === 'undefined' ? false : multiple,
|
|
1178
|
+
value: typeof value === 'undefined' ? emptyValue : selectedIndexes,
|
|
1120
1179
|
error: rawErrors.length > 0,
|
|
1121
1180
|
disabled: disabled,
|
|
1122
1181
|
placeholder: placeholder
|
|
@@ -1129,7 +1188,7 @@ function SelectWidget(props) {
|
|
|
1129
1188
|
onBlur: _onBlur,
|
|
1130
1189
|
onFocus: _onFocus,
|
|
1131
1190
|
"aria-describedby": ariaDescribedByIds(id)
|
|
1132
|
-
}));
|
|
1191
|
+
}), id);
|
|
1133
1192
|
}
|
|
1134
1193
|
|
|
1135
1194
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
@@ -1166,7 +1225,7 @@ function TextareaWidget(props) {
|
|
|
1166
1225
|
// eslint-disable-next-line no-shadow
|
|
1167
1226
|
var _onChange = function _onChange(_ref) {
|
|
1168
1227
|
var value = _ref.target.value;
|
|
1169
|
-
return onChange && onChange(value ===
|
|
1228
|
+
return onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1170
1229
|
};
|
|
1171
1230
|
var _onBlur = function _onBlur() {
|
|
1172
1231
|
return onBlur && onBlur(id, value);
|
|
@@ -1175,9 +1234,8 @@ function TextareaWidget(props) {
|
|
|
1175
1234
|
return onFocus && onFocus(id, value);
|
|
1176
1235
|
};
|
|
1177
1236
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
1178
|
-
return
|
|
1237
|
+
return jsx(Form.TextArea, _extends({
|
|
1179
1238
|
id: id,
|
|
1180
|
-
key: id,
|
|
1181
1239
|
name: id,
|
|
1182
1240
|
label: displayLabel ? label || schema.title : false,
|
|
1183
1241
|
placeholder: placeholder,
|
|
@@ -1185,14 +1243,14 @@ function TextareaWidget(props) {
|
|
|
1185
1243
|
required: required,
|
|
1186
1244
|
disabled: disabled || readonly
|
|
1187
1245
|
}, semanticProps, {
|
|
1188
|
-
value: value ||
|
|
1246
|
+
value: value || '',
|
|
1189
1247
|
error: rawErrors.length > 0,
|
|
1190
1248
|
rows: options.rows || 5,
|
|
1191
1249
|
onChange: _onChange,
|
|
1192
1250
|
onBlur: _onBlur,
|
|
1193
1251
|
onFocus: _onFocus,
|
|
1194
1252
|
"aria-describedby": ariaDescribedByIds(id)
|
|
1195
|
-
}));
|
|
1253
|
+
}), id);
|
|
1196
1254
|
}
|
|
1197
1255
|
|
|
1198
1256
|
function generateWidgets() {
|