@rjsf/semantic-ui 5.0.0-beta.10 → 5.0.0-beta.12
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/dist/semantic-ui.cjs.development.js +69 -109
- 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 +69 -109
- package/dist/semantic-ui.esm.js.map +1 -1
- package/dist/semantic-ui.umd.development.js +69 -109
- 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 +13 -14
|
@@ -42,7 +42,6 @@ function AddButton(_ref) {
|
|
|
42
42
|
* @param {Object?} params.defaultContextProps
|
|
43
43
|
* @returns {any}
|
|
44
44
|
*/
|
|
45
|
-
|
|
46
45
|
function getSemanticProps(_ref) {
|
|
47
46
|
let {
|
|
48
47
|
formContext = {},
|
|
@@ -56,10 +55,12 @@ function getSemanticProps(_ref) {
|
|
|
56
55
|
} = _ref;
|
|
57
56
|
const formContextProps = formContext.semantic;
|
|
58
57
|
const schemaProps = utils.getUiOptions(uiSchema).semantic;
|
|
59
|
-
const optionProps = options.semantic;
|
|
60
|
-
|
|
61
|
-
return Object.assign({}, {
|
|
62
|
-
|
|
58
|
+
const optionProps = options.semantic;
|
|
59
|
+
// formContext props should overide other props
|
|
60
|
+
return Object.assign({}, {
|
|
61
|
+
...defaultSchemaProps
|
|
62
|
+
}, {
|
|
63
|
+
...defaultContextProps
|
|
63
64
|
}, schemaProps, optionProps, formContextProps);
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
@@ -71,7 +72,6 @@ function getSemanticProps(_ref) {
|
|
|
71
72
|
* @param {Object?} params.defaultProps
|
|
72
73
|
* @returns {any}
|
|
73
74
|
*/
|
|
74
|
-
|
|
75
75
|
function getSemanticErrorProps(_ref2) {
|
|
76
76
|
let {
|
|
77
77
|
formContext = {},
|
|
@@ -86,7 +86,8 @@ function getSemanticErrorProps(_ref2) {
|
|
|
86
86
|
const semanticOptions = utils.getUiOptions(uiSchema).semantic;
|
|
87
87
|
const schemaProps = semanticOptions && semanticOptions.errorOptions;
|
|
88
88
|
const optionProps = options.semantic && options.semantic.errorOptions;
|
|
89
|
-
return Object.assign({}, {
|
|
89
|
+
return Object.assign({}, {
|
|
90
|
+
...defaultProps
|
|
90
91
|
}, schemaProps, optionProps, formContextProps);
|
|
91
92
|
}
|
|
92
93
|
/**
|
|
@@ -98,17 +99,15 @@ function getSemanticErrorProps(_ref2) {
|
|
|
98
99
|
* @param {Array} omit
|
|
99
100
|
* @returns {string}
|
|
100
101
|
*/
|
|
101
|
-
|
|
102
102
|
function cleanClassNames(classNameArr, omit) {
|
|
103
103
|
if (omit === void 0) {
|
|
104
104
|
omit = [];
|
|
105
105
|
}
|
|
106
|
-
|
|
107
106
|
// Split each arg on whitespace, and add it to an array. Skip false-y args
|
|
108
107
|
// like "" and undefined.
|
|
109
|
-
const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []);
|
|
108
|
+
const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []);
|
|
109
|
+
// Remove any class names from omit, and make the rest unique before
|
|
110
110
|
// returning them as a string
|
|
111
|
-
|
|
112
111
|
return [...new Set(classList.filter(cn => !omit.includes(cn)))].join(" ");
|
|
113
112
|
}
|
|
114
113
|
/**
|
|
@@ -119,22 +118,21 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
119
118
|
* @returns {*}
|
|
120
119
|
* @constructor
|
|
121
120
|
*/
|
|
122
|
-
|
|
123
121
|
function MaybeWrap(_ref3) {
|
|
124
122
|
let {
|
|
125
123
|
wrap,
|
|
126
124
|
component: Component = "div",
|
|
127
125
|
...props
|
|
128
126
|
} = _ref3;
|
|
129
|
-
return wrap ? /*#__PURE__*/React__default["default"].createElement(Component, {
|
|
127
|
+
return wrap ? /*#__PURE__*/React__default["default"].createElement(Component, {
|
|
128
|
+
...props
|
|
130
129
|
}) : props.children;
|
|
131
130
|
}
|
|
132
131
|
|
|
133
132
|
const gridStyle = vertical => ({
|
|
134
133
|
display: "grid",
|
|
135
|
-
gridTemplateColumns:
|
|
134
|
+
gridTemplateColumns: `1fr ${vertical ? 65 : 110}px`
|
|
136
135
|
});
|
|
137
|
-
|
|
138
136
|
const ArrayFieldItemTemplate = props => {
|
|
139
137
|
const {
|
|
140
138
|
children,
|
|
@@ -155,8 +153,8 @@ const ArrayFieldItemTemplate = props => {
|
|
|
155
153
|
MoveUpButton,
|
|
156
154
|
RemoveButton
|
|
157
155
|
} = registry.templates.ButtonTemplates;
|
|
158
|
-
const uiOptions = utils.getUiOptions(uiSchema);
|
|
159
|
-
|
|
156
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
157
|
+
// Pull the semantic props out of the uiOptions that were put in via the ArrayFieldTemplate
|
|
160
158
|
const {
|
|
161
159
|
horizontalButtons = false,
|
|
162
160
|
wrapItem = false
|
|
@@ -167,7 +165,8 @@ const ArrayFieldItemTemplate = props => {
|
|
|
167
165
|
wrap: wrapItem,
|
|
168
166
|
component: semanticUiReact.Segment
|
|
169
167
|
}, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid, {
|
|
170
|
-
style: index !== 0 ? {
|
|
168
|
+
style: index !== 0 ? {
|
|
169
|
+
...gridStyle(!horizontalButtons),
|
|
171
170
|
alignItems: "center"
|
|
172
171
|
} : gridStyle(!horizontalButtons)
|
|
173
172
|
}, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Column, {
|
|
@@ -231,30 +230,30 @@ function ArrayFieldTemplate(_ref) {
|
|
|
231
230
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
232
231
|
const ArrayFieldDescriptionTemplate = utils.getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
|
|
233
232
|
const ArrayFieldItemTemplate = utils.getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
|
|
234
|
-
const ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
|
|
235
|
-
|
|
233
|
+
const ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
|
|
234
|
+
// Button templates are not overridden in the uiSchema
|
|
236
235
|
const {
|
|
237
236
|
ButtonTemplates: {
|
|
238
237
|
AddButton
|
|
239
238
|
}
|
|
240
239
|
} = registry.templates;
|
|
241
|
-
const fieldTitle = uiOptions.title || title;
|
|
242
|
-
const fieldDescription = uiOptions.description || schema.description;
|
|
243
240
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
244
241
|
className: cleanClassNames([className, utils.isFixedItems(schema) ? "" : "sortable-form-fields"])
|
|
245
242
|
}, /*#__PURE__*/React__default["default"].createElement(ArrayFieldTitleTemplate, {
|
|
246
243
|
idSchema: idSchema,
|
|
247
|
-
title:
|
|
244
|
+
title: uiOptions.title || title,
|
|
245
|
+
schema: schema,
|
|
248
246
|
uiSchema: uiSchema,
|
|
249
247
|
required: required,
|
|
250
248
|
registry: registry
|
|
251
|
-
}),
|
|
249
|
+
}), /*#__PURE__*/React__default["default"].createElement(ArrayFieldDescriptionTemplate, {
|
|
252
250
|
idSchema: idSchema,
|
|
253
|
-
description:
|
|
251
|
+
description: uiOptions.description || schema.description,
|
|
252
|
+
schema: schema,
|
|
254
253
|
uiSchema: uiSchema,
|
|
255
254
|
registry: registry
|
|
256
255
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
257
|
-
key:
|
|
256
|
+
key: `array-item-list-${idSchema.$id}`
|
|
258
257
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
259
258
|
className: "row array-item-list"
|
|
260
259
|
}, items && items.map(_ref2 => {
|
|
@@ -264,8 +263,10 @@ function ArrayFieldTemplate(_ref) {
|
|
|
264
263
|
...props
|
|
265
264
|
} = _ref2;
|
|
266
265
|
// Merge in the semantic props from the ArrayFieldTemplate into each of the items
|
|
267
|
-
const mergedUiSchema = {
|
|
268
|
-
|
|
266
|
+
const mergedUiSchema = {
|
|
267
|
+
...itemUiSchema,
|
|
268
|
+
[utils.UI_OPTIONS_KEY]: {
|
|
269
|
+
...itemUiSchema[utils.UI_OPTIONS_KEY],
|
|
269
270
|
semantic
|
|
270
271
|
}
|
|
271
272
|
};
|
|
@@ -317,7 +318,6 @@ function BaseInputTemplate(props) {
|
|
|
317
318
|
const {
|
|
318
319
|
schemaUtils
|
|
319
320
|
} = registry;
|
|
320
|
-
|
|
321
321
|
const _onChange = _ref => {
|
|
322
322
|
let {
|
|
323
323
|
target: {
|
|
@@ -326,11 +326,8 @@ function BaseInputTemplate(props) {
|
|
|
326
326
|
} = _ref;
|
|
327
327
|
return onChange(value === "" ? options.emptyValue : value);
|
|
328
328
|
};
|
|
329
|
-
|
|
330
329
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
331
|
-
|
|
332
330
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
333
|
-
|
|
334
331
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
335
332
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Input, {
|
|
336
333
|
key: id,
|
|
@@ -342,7 +339,7 @@ function BaseInputTemplate(props) {
|
|
|
342
339
|
required: required,
|
|
343
340
|
autoFocus: autofocus,
|
|
344
341
|
disabled: disabled || readonly,
|
|
345
|
-
list: schema.examples ?
|
|
342
|
+
list: schema.examples ? `examples_${id}` : undefined,
|
|
346
343
|
...semanticProps,
|
|
347
344
|
value: value || value === 0 ? value : "",
|
|
348
345
|
error: rawErrors.length > 0,
|
|
@@ -350,7 +347,7 @@ function BaseInputTemplate(props) {
|
|
|
350
347
|
onBlur: _onBlur,
|
|
351
348
|
onFocus: _onFocus
|
|
352
349
|
}), schema.examples && /*#__PURE__*/React__default["default"].createElement("datalist", {
|
|
353
|
-
id:
|
|
350
|
+
id: `examples_${id}`
|
|
354
351
|
}, schema.examples.concat(schema.default ? [schema.default] : []).map(example => {
|
|
355
352
|
return /*#__PURE__*/React__default["default"].createElement("option", {
|
|
356
353
|
key: example,
|
|
@@ -364,11 +361,9 @@ function DescriptionField(_ref) {
|
|
|
364
361
|
description,
|
|
365
362
|
id
|
|
366
363
|
} = _ref;
|
|
367
|
-
|
|
368
364
|
if (!description) {
|
|
369
365
|
return null;
|
|
370
366
|
}
|
|
371
|
-
|
|
372
367
|
return /*#__PURE__*/React__default["default"].createElement("p", {
|
|
373
368
|
id: id,
|
|
374
369
|
className: "sui-description"
|
|
@@ -381,7 +376,6 @@ function DescriptionField(_ref) {
|
|
|
381
376
|
* @returns {*}
|
|
382
377
|
* @constructor
|
|
383
378
|
*/
|
|
384
|
-
|
|
385
379
|
function ErrorList(_ref) {
|
|
386
380
|
let {
|
|
387
381
|
errors
|
|
@@ -389,7 +383,7 @@ function ErrorList(_ref) {
|
|
|
389
383
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message, {
|
|
390
384
|
negative: true
|
|
391
385
|
}, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.Header, null, "Errors"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.List, null, errors.map((error, index) => /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.Item, {
|
|
392
|
-
key:
|
|
386
|
+
key: `error-${index}`
|
|
393
387
|
}, error.stack))));
|
|
394
388
|
}
|
|
395
389
|
|
|
@@ -446,7 +440,6 @@ const DEFAULT_OPTIONS$1 = {
|
|
|
446
440
|
* @constructor
|
|
447
441
|
* @return {null}
|
|
448
442
|
*/
|
|
449
|
-
|
|
450
443
|
function FieldErrorTemplate(_ref) {
|
|
451
444
|
let {
|
|
452
445
|
errors,
|
|
@@ -466,9 +459,8 @@ function FieldErrorTemplate(_ref) {
|
|
|
466
459
|
pointing,
|
|
467
460
|
size
|
|
468
461
|
} = options;
|
|
469
|
-
|
|
470
462
|
if (errors && errors.length > 0) {
|
|
471
|
-
const id = idSchema.$id
|
|
463
|
+
const id = `${idSchema.$id}__error`;
|
|
472
464
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Label, {
|
|
473
465
|
id: id,
|
|
474
466
|
color: "red",
|
|
@@ -481,22 +473,19 @@ function FieldErrorTemplate(_ref) {
|
|
|
481
473
|
key: nanoid.nanoid()
|
|
482
474
|
}, error))));
|
|
483
475
|
}
|
|
484
|
-
|
|
485
476
|
return null;
|
|
486
477
|
}
|
|
487
478
|
|
|
488
479
|
/**
|
|
489
480
|
* @return {null}
|
|
490
481
|
*/
|
|
491
|
-
|
|
492
482
|
function FieldHelpTemplate(_ref) {
|
|
493
483
|
let {
|
|
494
484
|
help,
|
|
495
485
|
idSchema
|
|
496
486
|
} = _ref;
|
|
497
|
-
|
|
498
487
|
if (help) {
|
|
499
|
-
const id = idSchema.$id
|
|
488
|
+
const id = `${idSchema.$id}__help`;
|
|
500
489
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message, {
|
|
501
490
|
size: "mini",
|
|
502
491
|
info: true,
|
|
@@ -504,7 +493,6 @@ function FieldHelpTemplate(_ref) {
|
|
|
504
493
|
content: help
|
|
505
494
|
});
|
|
506
495
|
}
|
|
507
|
-
|
|
508
496
|
return null;
|
|
509
497
|
}
|
|
510
498
|
|
|
@@ -520,6 +508,7 @@ function FieldTemplate(_ref) {
|
|
|
520
508
|
hidden,
|
|
521
509
|
rawDescription,
|
|
522
510
|
registry,
|
|
511
|
+
schema,
|
|
523
512
|
uiSchema,
|
|
524
513
|
...props
|
|
525
514
|
} = _ref;
|
|
@@ -531,7 +520,6 @@ function FieldTemplate(_ref) {
|
|
|
531
520
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
532
521
|
const WrapIfAdditionalTemplate = utils.getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
|
|
533
522
|
const DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
|
|
534
|
-
|
|
535
523
|
if (hidden) {
|
|
536
524
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
537
525
|
style: {
|
|
@@ -539,12 +527,12 @@ function FieldTemplate(_ref) {
|
|
|
539
527
|
}
|
|
540
528
|
}, children);
|
|
541
529
|
}
|
|
542
|
-
|
|
543
530
|
return /*#__PURE__*/React__default["default"].createElement(WrapIfAdditionalTemplate, {
|
|
544
531
|
classNames: classNames,
|
|
545
532
|
id: id,
|
|
546
533
|
label: label,
|
|
547
534
|
registry: registry,
|
|
535
|
+
schema: schema,
|
|
548
536
|
uiSchema: uiSchema,
|
|
549
537
|
...props
|
|
550
538
|
}, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, {
|
|
@@ -558,8 +546,10 @@ function FieldTemplate(_ref) {
|
|
|
558
546
|
wrap: wrapLabel,
|
|
559
547
|
className: "sui-field-label"
|
|
560
548
|
}, rawDescription && /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
|
|
561
|
-
id: id
|
|
549
|
+
id: `${id}-description`,
|
|
562
550
|
description: rawDescription,
|
|
551
|
+
schema: schema,
|
|
552
|
+
uiSchema: uiSchema,
|
|
563
553
|
registry: registry
|
|
564
554
|
})), help, errors)));
|
|
565
555
|
}
|
|
@@ -581,8 +571,8 @@ function ObjectFieldTemplate(_ref) {
|
|
|
581
571
|
} = _ref;
|
|
582
572
|
const uiOptions = utils.getUiOptions(uiSchema);
|
|
583
573
|
const TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, uiOptions);
|
|
584
|
-
const DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
|
|
585
|
-
|
|
574
|
+
const DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
|
|
575
|
+
// Button templates are not overridden in the uiSchema
|
|
586
576
|
const {
|
|
587
577
|
ButtonTemplates: {
|
|
588
578
|
AddButton
|
|
@@ -591,14 +581,17 @@ function ObjectFieldTemplate(_ref) {
|
|
|
591
581
|
const fieldTitle = uiOptions.title || title;
|
|
592
582
|
const fieldDescription = uiOptions.description || description;
|
|
593
583
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, fieldTitle && /*#__PURE__*/React__default["default"].createElement(TitleFieldTemplate, {
|
|
594
|
-
id: idSchema.$id
|
|
584
|
+
id: `${idSchema.$id}-title`,
|
|
595
585
|
title: fieldTitle,
|
|
596
586
|
required: required,
|
|
587
|
+
schema: schema,
|
|
597
588
|
uiSchema: uiSchema,
|
|
598
589
|
registry: registry
|
|
599
590
|
}), fieldDescription && /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
|
|
600
|
-
id: idSchema.$id
|
|
591
|
+
id: `${idSchema.$id}-description`,
|
|
601
592
|
description: fieldDescription,
|
|
593
|
+
schema: schema,
|
|
594
|
+
uiSchema: uiSchema,
|
|
602
595
|
registry: registry
|
|
603
596
|
}), properties.map(prop => prop.content), utils.canExpand(schema, uiSchema, formData) && /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Column, {
|
|
604
597
|
width: 16,
|
|
@@ -625,11 +618,9 @@ var SubmitButton = (_ref => {
|
|
|
625
618
|
norender,
|
|
626
619
|
props: submitButtonProps
|
|
627
620
|
} = utils.getSubmitButtonOptions(uiSchema);
|
|
628
|
-
|
|
629
621
|
if (norender) {
|
|
630
622
|
return null;
|
|
631
623
|
}
|
|
632
|
-
|
|
633
624
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, {
|
|
634
625
|
type: "submit",
|
|
635
626
|
primary: true,
|
|
@@ -641,7 +632,6 @@ const DEFAULT_OPTIONS = {
|
|
|
641
632
|
inverted: false,
|
|
642
633
|
dividing: true
|
|
643
634
|
};
|
|
644
|
-
|
|
645
635
|
function TitleField(_ref) {
|
|
646
636
|
let {
|
|
647
637
|
id,
|
|
@@ -652,11 +642,9 @@ function TitleField(_ref) {
|
|
|
652
642
|
uiSchema,
|
|
653
643
|
defaultSchemaProps: DEFAULT_OPTIONS
|
|
654
644
|
});
|
|
655
|
-
|
|
656
645
|
if (!title) {
|
|
657
646
|
return null;
|
|
658
647
|
}
|
|
659
|
-
|
|
660
648
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Header, {
|
|
661
649
|
id: id,
|
|
662
650
|
...semanticProps,
|
|
@@ -687,26 +675,22 @@ const WrapIfAdditionalTemplate = _ref => {
|
|
|
687
675
|
readonlyAsDisabled = true,
|
|
688
676
|
wrapperStyle
|
|
689
677
|
} = registry.formContext;
|
|
690
|
-
const keyLabel = label
|
|
691
|
-
|
|
678
|
+
const keyLabel = `${label} Key`; // i18n ?
|
|
692
679
|
const additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
693
|
-
|
|
694
680
|
if (!additional) {
|
|
695
681
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
696
682
|
className: classNames
|
|
697
683
|
}, children);
|
|
698
684
|
}
|
|
699
|
-
|
|
700
685
|
const handleBlur = _ref2 => {
|
|
701
686
|
let {
|
|
702
687
|
target
|
|
703
688
|
} = _ref2;
|
|
704
689
|
return onKeyChange(target.value);
|
|
705
690
|
};
|
|
706
|
-
|
|
707
691
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
708
692
|
className: classNames,
|
|
709
|
-
key: id
|
|
693
|
+
key: `${id}-key`
|
|
710
694
|
}, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid, {
|
|
711
695
|
columns: "equal"
|
|
712
696
|
}, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Row, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Column, {
|
|
@@ -718,13 +702,13 @@ const WrapIfAdditionalTemplate = _ref => {
|
|
|
718
702
|
className: "form-group",
|
|
719
703
|
hasFeedback: true,
|
|
720
704
|
fluid: true,
|
|
721
|
-
htmlFor:
|
|
705
|
+
htmlFor: `${id}`,
|
|
722
706
|
label: keyLabel,
|
|
723
707
|
required: required,
|
|
724
708
|
defaultValue: label,
|
|
725
709
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
726
|
-
id:
|
|
727
|
-
name:
|
|
710
|
+
id: `${id}`,
|
|
711
|
+
name: `${id}`,
|
|
728
712
|
onBlur: !readonly ? handleBlur : undefined,
|
|
729
713
|
style: wrapperStyle,
|
|
730
714
|
type: "text"
|
|
@@ -792,13 +776,9 @@ function CheckboxWidget(props) {
|
|
|
792
776
|
schemaUtils
|
|
793
777
|
} = registry;
|
|
794
778
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
795
|
-
|
|
796
779
|
const _onChange = (_, data) => onChange && onChange(data.checked);
|
|
797
|
-
|
|
798
780
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
799
|
-
|
|
800
781
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
801
|
-
|
|
802
782
|
const checked = value == "true" || value == true;
|
|
803
783
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Checkbox, {
|
|
804
784
|
id: id,
|
|
@@ -818,16 +798,14 @@ function CheckboxWidget(props) {
|
|
|
818
798
|
|
|
819
799
|
function selectValue(value, selected, all) {
|
|
820
800
|
const at = all.indexOf(value);
|
|
821
|
-
const updated = selected.slice(0, at).concat(value, selected.slice(at));
|
|
801
|
+
const updated = selected.slice(0, at).concat(value, selected.slice(at));
|
|
802
|
+
// As inserting values at predefined index positions doesn't work with empty
|
|
822
803
|
// arrays, we need to reorder the updated selection to match the initial order
|
|
823
|
-
|
|
824
804
|
return updated.sort((a, b) => all.indexOf(a) > all.indexOf(b));
|
|
825
805
|
}
|
|
826
|
-
|
|
827
806
|
function deselectValue(value, selected) {
|
|
828
807
|
return selected.filter(v => v !== value);
|
|
829
808
|
}
|
|
830
|
-
|
|
831
809
|
function CheckboxesWidget(props) {
|
|
832
810
|
const {
|
|
833
811
|
id,
|
|
@@ -862,7 +840,6 @@ function CheckboxesWidget(props) {
|
|
|
862
840
|
inverted: false
|
|
863
841
|
}
|
|
864
842
|
});
|
|
865
|
-
|
|
866
843
|
const _onChange = option => _ref => {
|
|
867
844
|
let {
|
|
868
845
|
target: {
|
|
@@ -876,26 +853,23 @@ function CheckboxesWidget(props) {
|
|
|
876
853
|
} = _ref2;
|
|
877
854
|
return value;
|
|
878
855
|
}) : [];
|
|
879
|
-
|
|
880
856
|
if (checked) {
|
|
881
857
|
onChange(selectValue(option.value, value, all));
|
|
882
858
|
} else {
|
|
883
859
|
onChange(deselectValue(option.value, value));
|
|
884
860
|
}
|
|
885
861
|
};
|
|
886
|
-
|
|
887
862
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
888
|
-
|
|
889
863
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
890
|
-
|
|
891
864
|
const inlineOption = inline ? {
|
|
892
865
|
inline: true
|
|
893
866
|
} : {
|
|
894
867
|
grouped: true
|
|
895
868
|
};
|
|
896
869
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, title && /*#__PURE__*/React__default["default"].createElement(TitleFieldTemplate, {
|
|
897
|
-
id: id
|
|
870
|
+
id: `${id}-title`,
|
|
898
871
|
title: title,
|
|
872
|
+
schema: schema,
|
|
899
873
|
uiSchema: uiSchema,
|
|
900
874
|
registry: registry
|
|
901
875
|
}), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, {
|
|
@@ -906,7 +880,7 @@ function CheckboxesWidget(props) {
|
|
|
906
880
|
const checked = value.indexOf(option.value) !== -1;
|
|
907
881
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
908
882
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Checkbox, {
|
|
909
|
-
id: id
|
|
883
|
+
id: `${id}-${option.value}`,
|
|
910
884
|
name: id,
|
|
911
885
|
key: option.value,
|
|
912
886
|
label: option.label,
|
|
@@ -946,37 +920,35 @@ function RadioWidget(props) {
|
|
|
946
920
|
formContext,
|
|
947
921
|
options,
|
|
948
922
|
uiSchema
|
|
949
|
-
});
|
|
950
|
-
|
|
923
|
+
});
|
|
924
|
+
// eslint-disable-next-line no-shadow
|
|
951
925
|
const _onChange = (_, _ref) => {
|
|
952
926
|
let {
|
|
953
927
|
value: eventValue
|
|
954
928
|
} = _ref;
|
|
955
929
|
return onChange && onChange(schema.type === "boolean" ? eventValue !== "false" : eventValue);
|
|
956
930
|
};
|
|
957
|
-
|
|
958
931
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
959
|
-
|
|
960
932
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
961
|
-
|
|
962
933
|
const inlineOption = options.inline ? {
|
|
963
934
|
inline: true
|
|
964
935
|
} : {
|
|
965
936
|
grouped: true
|
|
966
937
|
};
|
|
967
|
-
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, {
|
|
938
|
+
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, {
|
|
939
|
+
...inlineOption
|
|
968
940
|
}, Array.isArray(enumOptions) && enumOptions.map(option => {
|
|
969
941
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
970
942
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Field, {
|
|
971
943
|
required: required,
|
|
972
944
|
control: semanticUiReact.Radio,
|
|
973
|
-
id: id
|
|
945
|
+
id: `${id}-${option.value}`,
|
|
974
946
|
name: id,
|
|
975
947
|
...semanticProps,
|
|
976
948
|
onFocus: _onFocus,
|
|
977
949
|
onBlur: _onBlur,
|
|
978
|
-
label:
|
|
979
|
-
value:
|
|
950
|
+
label: `${option.label}`,
|
|
951
|
+
value: `${option.value}`,
|
|
980
952
|
error: rawErrors.length > 0,
|
|
981
953
|
key: option.value,
|
|
982
954
|
checked: value == option.value,
|
|
@@ -1009,8 +981,8 @@ function RangeWidget(props) {
|
|
|
1009
981
|
defaultSchemaProps: {
|
|
1010
982
|
fluid: true
|
|
1011
983
|
}
|
|
1012
|
-
});
|
|
1013
|
-
|
|
984
|
+
});
|
|
985
|
+
// eslint-disable-next-line no-shadow
|
|
1014
986
|
const _onChange = _ref => {
|
|
1015
987
|
let {
|
|
1016
988
|
target: {
|
|
@@ -1019,11 +991,8 @@ function RangeWidget(props) {
|
|
|
1019
991
|
} = _ref;
|
|
1020
992
|
return onChange && onChange(value === "" ? options.emptyValue : value);
|
|
1021
993
|
};
|
|
1022
|
-
|
|
1023
994
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
1024
|
-
|
|
1025
995
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
1026
|
-
|
|
1027
996
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Input, {
|
|
1028
997
|
id: id,
|
|
1029
998
|
key: id,
|
|
@@ -1047,7 +1016,6 @@ function RangeWidget(props) {
|
|
|
1047
1016
|
* @param {array} enumDisabled - array of enum option values to disable
|
|
1048
1017
|
* @returns {*}
|
|
1049
1018
|
*/
|
|
1050
|
-
|
|
1051
1019
|
function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled) {
|
|
1052
1020
|
const disabledOptions = enumDisabled || [];
|
|
1053
1021
|
const options = map__default["default"](enumOptions, _ref => {
|
|
@@ -1064,7 +1032,6 @@ function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled) {
|
|
|
1064
1032
|
});
|
|
1065
1033
|
return options;
|
|
1066
1034
|
}
|
|
1067
|
-
|
|
1068
1035
|
function SelectWidget(props) {
|
|
1069
1036
|
const {
|
|
1070
1037
|
schema,
|
|
@@ -1103,15 +1070,13 @@ function SelectWidget(props) {
|
|
|
1103
1070
|
} = options;
|
|
1104
1071
|
const emptyValue = multiple ? [] : "";
|
|
1105
1072
|
const dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
|
|
1106
|
-
|
|
1107
1073
|
const _onChange = (_, _ref2) => {
|
|
1108
1074
|
let {
|
|
1109
1075
|
value
|
|
1110
1076
|
} = _ref2;
|
|
1111
1077
|
return onChange && onChange(utils.processSelectValue(schema, value, options));
|
|
1112
|
-
};
|
|
1113
|
-
|
|
1114
|
-
|
|
1078
|
+
};
|
|
1079
|
+
// eslint-disable-next-line no-shadow
|
|
1115
1080
|
const _onBlur = (_, _ref3) => {
|
|
1116
1081
|
let {
|
|
1117
1082
|
target: {
|
|
@@ -1120,7 +1085,6 @@ function SelectWidget(props) {
|
|
|
1120
1085
|
} = _ref3;
|
|
1121
1086
|
return onBlur && onBlur(id, utils.processSelectValue(schema, value, options));
|
|
1122
1087
|
};
|
|
1123
|
-
|
|
1124
1088
|
const _onFocus = (_, _ref4) => {
|
|
1125
1089
|
let {
|
|
1126
1090
|
// eslint-disable-next-line no-shadow
|
|
@@ -1130,7 +1094,6 @@ function SelectWidget(props) {
|
|
|
1130
1094
|
} = _ref4;
|
|
1131
1095
|
return onFocus && onFocus(id, utils.processSelectValue(schema, value, options));
|
|
1132
1096
|
};
|
|
1133
|
-
|
|
1134
1097
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Dropdown, {
|
|
1135
1098
|
key: id,
|
|
1136
1099
|
id: id,
|
|
@@ -1181,8 +1144,8 @@ function TextareaWidget(props) {
|
|
|
1181
1144
|
});
|
|
1182
1145
|
const {
|
|
1183
1146
|
schemaUtils
|
|
1184
|
-
} = registry;
|
|
1185
|
-
|
|
1147
|
+
} = registry;
|
|
1148
|
+
// eslint-disable-next-line no-shadow
|
|
1186
1149
|
const _onChange = _ref => {
|
|
1187
1150
|
let {
|
|
1188
1151
|
target: {
|
|
@@ -1191,11 +1154,8 @@ function TextareaWidget(props) {
|
|
|
1191
1154
|
} = _ref;
|
|
1192
1155
|
return onChange && onChange(value === "" ? options.emptyValue : value);
|
|
1193
1156
|
};
|
|
1194
|
-
|
|
1195
1157
|
const _onBlur = () => onBlur && onBlur(id, value);
|
|
1196
|
-
|
|
1197
1158
|
const _onFocus = () => onFocus && onFocus(id, value);
|
|
1198
|
-
|
|
1199
1159
|
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
1200
1160
|
return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.TextArea, {
|
|
1201
1161
|
id: id,
|