@rjsf/semantic-ui 5.10.0 → 5.11.2
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 +649 -632
- 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 +649 -632
- package/dist/semantic-ui.esm.js.map +1 -1
- package/dist/semantic-ui.umd.development.js +649 -632
- package/dist/semantic-ui.umd.development.js.map +1 -1
- package/dist/semantic-ui.umd.production.min.js +1 -1
- package/dist/semantic-ui.umd.production.min.js.map +1 -1
- package/package.json +11 -11
package/dist/semantic-ui.esm.js
CHANGED
|
@@ -6,54 +6,29 @@ import { nanoid } from 'nanoid';
|
|
|
6
6
|
import { createElement } from 'react';
|
|
7
7
|
import map from 'lodash-es/map';
|
|
8
8
|
|
|
9
|
-
function _extends() {
|
|
10
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
11
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
12
|
-
var source = arguments[i];
|
|
13
|
-
for (var key in source) {
|
|
14
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
15
|
-
target[key] = source[key];
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
|
-
return _extends.apply(this, arguments);
|
|
22
|
-
}
|
|
23
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
24
|
-
if (source == null) return {};
|
|
25
|
-
var target = {};
|
|
26
|
-
var sourceKeys = Object.keys(source);
|
|
27
|
-
var key, i;
|
|
28
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
29
|
-
key = sourceKeys[i];
|
|
30
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
31
|
-
target[key] = source[key];
|
|
32
|
-
}
|
|
33
|
-
return target;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var _excluded$4 = ["uiSchema", "registry", "color"];
|
|
37
9
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
38
10
|
*/
|
|
39
|
-
function AddButton(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
11
|
+
function AddButton({
|
|
12
|
+
uiSchema,
|
|
13
|
+
registry,
|
|
14
|
+
color,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const {
|
|
18
|
+
translateString
|
|
19
|
+
} = registry;
|
|
20
|
+
return jsx(Button, {
|
|
45
21
|
title: translateString(TranslatableString.AddItemButton),
|
|
46
|
-
color: color
|
|
47
|
-
|
|
22
|
+
color: color,
|
|
23
|
+
...props,
|
|
48
24
|
icon: true,
|
|
49
25
|
size: 'tiny',
|
|
50
26
|
children: jsx(Icon, {
|
|
51
27
|
name: 'plus'
|
|
52
28
|
})
|
|
53
|
-
})
|
|
29
|
+
});
|
|
54
30
|
}
|
|
55
31
|
|
|
56
|
-
var _excluded$3 = ["wrap", "component"];
|
|
57
32
|
/**
|
|
58
33
|
* Extract props meant for semantic UI components from props that are
|
|
59
34
|
* passed to Widgets, Templates and Fields.
|
|
@@ -65,25 +40,25 @@ var _excluded$3 = ["wrap", "component"];
|
|
|
65
40
|
* @param {Object?} params.defaultContextProps
|
|
66
41
|
* @returns {any}
|
|
67
42
|
*/
|
|
68
|
-
function getSemanticProps(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
defaultContextProps = _ref$defaultContextPr === void 0 ? {} : _ref$defaultContextPr;
|
|
82
|
-
var formContextProps = formContext.semantic;
|
|
83
|
-
var schemaProps = getUiOptions(uiSchema).semantic;
|
|
84
|
-
var optionProps = options.semantic;
|
|
43
|
+
function getSemanticProps({
|
|
44
|
+
formContext = {},
|
|
45
|
+
uiSchema = {},
|
|
46
|
+
options = {},
|
|
47
|
+
defaultSchemaProps = {
|
|
48
|
+
fluid: true,
|
|
49
|
+
inverted: false
|
|
50
|
+
},
|
|
51
|
+
defaultContextProps = {}
|
|
52
|
+
}) {
|
|
53
|
+
const formContextProps = formContext.semantic;
|
|
54
|
+
const schemaProps = getUiOptions(uiSchema).semantic;
|
|
55
|
+
const optionProps = options.semantic;
|
|
85
56
|
// formContext props should overide other props
|
|
86
|
-
return Object.assign({},
|
|
57
|
+
return Object.assign({}, {
|
|
58
|
+
...defaultSchemaProps
|
|
59
|
+
}, {
|
|
60
|
+
...defaultContextProps
|
|
61
|
+
}, schemaProps, optionProps, formContextProps);
|
|
87
62
|
}
|
|
88
63
|
/**
|
|
89
64
|
* Extract error props meant for semantic UI components from props that are
|
|
@@ -94,23 +69,22 @@ function getSemanticProps(_ref) {
|
|
|
94
69
|
* @param {Object?} params.defaultProps
|
|
95
70
|
* @returns {any}
|
|
96
71
|
*/
|
|
97
|
-
function getSemanticErrorProps(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return Object.assign({}, _extends({}, defaultProps), schemaProps, optionProps, formContextProps);
|
|
72
|
+
function getSemanticErrorProps({
|
|
73
|
+
formContext = {},
|
|
74
|
+
uiSchema = {},
|
|
75
|
+
options = {},
|
|
76
|
+
defaultProps = {
|
|
77
|
+
size: 'small',
|
|
78
|
+
pointing: 'above'
|
|
79
|
+
}
|
|
80
|
+
}) {
|
|
81
|
+
const formContextProps = formContext.semantic && formContext.semantic.errorOptions;
|
|
82
|
+
const semanticOptions = getUiOptions(uiSchema).semantic;
|
|
83
|
+
const schemaProps = semanticOptions && semanticOptions.errorOptions;
|
|
84
|
+
const optionProps = options.semantic && options.semantic.errorOptions;
|
|
85
|
+
return Object.assign({}, {
|
|
86
|
+
...defaultProps
|
|
87
|
+
}, schemaProps, optionProps, formContextProps);
|
|
114
88
|
}
|
|
115
89
|
/**
|
|
116
90
|
* Combine multiple strings containing class names into a single string,
|
|
@@ -121,20 +95,13 @@ function getSemanticErrorProps(_ref2) {
|
|
|
121
95
|
* @param {Array} omit
|
|
122
96
|
* @returns {string}
|
|
123
97
|
*/
|
|
124
|
-
function cleanClassNames(classNameArr, omit) {
|
|
125
|
-
if (omit === void 0) {
|
|
126
|
-
omit = [];
|
|
127
|
-
}
|
|
98
|
+
function cleanClassNames(classNameArr, omit = []) {
|
|
128
99
|
// Split each arg on whitespace, and add it to an array. Skip false-y args
|
|
129
100
|
// like "" and undefined.
|
|
130
|
-
|
|
131
|
-
return previous.concat(current.trim().split(/\s+/));
|
|
132
|
-
}, []);
|
|
101
|
+
const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []);
|
|
133
102
|
// Remove any class names from omit, and make the rest unique before
|
|
134
103
|
// returning them as a string
|
|
135
|
-
return [
|
|
136
|
-
return !omit.includes(cn);
|
|
137
|
-
}))).join(' ');
|
|
104
|
+
return [...new Set(classList.filter(cn => !omit.includes(cn)))].join(' ');
|
|
138
105
|
}
|
|
139
106
|
/**
|
|
140
107
|
*
|
|
@@ -144,60 +111,63 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
144
111
|
* @returns {*}
|
|
145
112
|
* @constructor
|
|
146
113
|
*/
|
|
147
|
-
function MaybeWrap(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return wrap ? jsx(Component,
|
|
114
|
+
function MaybeWrap({
|
|
115
|
+
wrap,
|
|
116
|
+
component: Component = 'div',
|
|
117
|
+
...props
|
|
118
|
+
}) {
|
|
119
|
+
return wrap ? jsx(Component, {
|
|
120
|
+
...props
|
|
121
|
+
}) : props.children;
|
|
153
122
|
}
|
|
154
123
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
};
|
|
160
|
-
};
|
|
124
|
+
const gridStyle = vertical => ({
|
|
125
|
+
display: 'grid',
|
|
126
|
+
gridTemplateColumns: `1fr ${vertical ? 65 : 150}px`
|
|
127
|
+
});
|
|
161
128
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
162
129
|
*
|
|
163
130
|
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
164
131
|
*/
|
|
165
132
|
function ArrayFieldItemTemplate(props) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
133
|
+
const {
|
|
134
|
+
children,
|
|
135
|
+
disabled,
|
|
136
|
+
hasToolbar,
|
|
137
|
+
hasCopy,
|
|
138
|
+
hasMoveDown,
|
|
139
|
+
hasMoveUp,
|
|
140
|
+
hasRemove,
|
|
141
|
+
index,
|
|
142
|
+
onCopyIndexClick,
|
|
143
|
+
onDropIndexClick,
|
|
144
|
+
onReorderClick,
|
|
145
|
+
readonly,
|
|
146
|
+
uiSchema,
|
|
147
|
+
registry
|
|
148
|
+
} = props;
|
|
149
|
+
const {
|
|
150
|
+
CopyButton,
|
|
151
|
+
MoveDownButton,
|
|
152
|
+
MoveUpButton,
|
|
153
|
+
RemoveButton
|
|
154
|
+
} = registry.templates.ButtonTemplates;
|
|
155
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
186
156
|
// Pull the semantic props out of the uiOptions that were put in via the ArrayFieldTemplate
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
wrapItem = _uiOptions$semantic$w === void 0 ? false : _uiOptions$semantic$w;
|
|
157
|
+
const {
|
|
158
|
+
horizontalButtons = true,
|
|
159
|
+
wrapItem = false
|
|
160
|
+
} = uiOptions.semantic;
|
|
192
161
|
return jsx("div", {
|
|
193
162
|
className: 'array-item',
|
|
194
163
|
children: jsx(MaybeWrap, {
|
|
195
164
|
wrap: wrapItem,
|
|
196
165
|
component: Segment,
|
|
197
166
|
children: jsxs(Grid, {
|
|
198
|
-
style:
|
|
167
|
+
style: {
|
|
168
|
+
...gridStyle(!horizontalButtons),
|
|
199
169
|
alignItems: 'center'
|
|
200
|
-
}
|
|
170
|
+
},
|
|
201
171
|
children: [jsx(Grid.Column, {
|
|
202
172
|
width: 16,
|
|
203
173
|
verticalAlign: 'middle',
|
|
@@ -238,45 +208,54 @@ function ArrayFieldItemTemplate(props) {
|
|
|
238
208
|
});
|
|
239
209
|
}
|
|
240
210
|
|
|
241
|
-
var _excluded$2 = ["key", "uiSchema"];
|
|
242
211
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
243
212
|
*
|
|
244
213
|
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
245
214
|
*/
|
|
246
215
|
function ArrayFieldTemplate(props) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
216
|
+
const {
|
|
217
|
+
uiSchema,
|
|
218
|
+
idSchema,
|
|
219
|
+
canAdd,
|
|
220
|
+
className,
|
|
221
|
+
// classNames, This is not part of the type, so it is likely never passed in
|
|
222
|
+
disabled,
|
|
223
|
+
formContext,
|
|
224
|
+
items,
|
|
225
|
+
onAddClick,
|
|
226
|
+
// options, This is not part of the type, so it is likely never passed in
|
|
227
|
+
readonly,
|
|
228
|
+
required,
|
|
229
|
+
schema,
|
|
230
|
+
title,
|
|
231
|
+
registry
|
|
232
|
+
} = props;
|
|
233
|
+
const semanticProps = getSemanticProps({
|
|
234
|
+
uiSchema,
|
|
235
|
+
formContext,
|
|
263
236
|
defaultSchemaProps: {
|
|
264
237
|
horizontalButtons: true,
|
|
265
238
|
wrapItem: false
|
|
266
239
|
}
|
|
267
240
|
});
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
241
|
+
const {
|
|
242
|
+
horizontalButtons,
|
|
243
|
+
wrapItem
|
|
244
|
+
} = semanticProps;
|
|
245
|
+
const semantic = {
|
|
246
|
+
horizontalButtons,
|
|
247
|
+
wrapItem
|
|
273
248
|
};
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
249
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
250
|
+
const ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
251
|
+
const ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
252
|
+
const ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
278
253
|
// Button templates are not overridden in the uiSchema
|
|
279
|
-
|
|
254
|
+
const {
|
|
255
|
+
ButtonTemplates: {
|
|
256
|
+
AddButton
|
|
257
|
+
}
|
|
258
|
+
} = registry.templates;
|
|
280
259
|
return jsxs("div", {
|
|
281
260
|
className: cleanClassNames([className, isFixedItems(schema) ? '' : 'sortable-form-fields']),
|
|
282
261
|
children: [jsx(ArrayFieldTitleTemplate, {
|
|
@@ -295,19 +274,23 @@ function ArrayFieldTemplate(props) {
|
|
|
295
274
|
}), jsxs("div", {
|
|
296
275
|
children: [jsx("div", {
|
|
297
276
|
className: 'row array-item-list',
|
|
298
|
-
children: items && items.map(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
277
|
+
children: items && items.map(({
|
|
278
|
+
key,
|
|
279
|
+
uiSchema: itemUiSchema = {},
|
|
280
|
+
...props
|
|
281
|
+
}) => {
|
|
304
282
|
// Merge in the semantic props from the ArrayFieldTemplate into each of the items
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
283
|
+
const mergedUiSchema = {
|
|
284
|
+
...itemUiSchema,
|
|
285
|
+
[UI_OPTIONS_KEY]: {
|
|
286
|
+
...itemUiSchema[UI_OPTIONS_KEY],
|
|
287
|
+
semantic
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
return jsx(ArrayFieldItemTemplate, {
|
|
291
|
+
...props,
|
|
309
292
|
uiSchema: mergedUiSchema
|
|
310
|
-
}
|
|
293
|
+
}, key);
|
|
311
294
|
})
|
|
312
295
|
}), canAdd && jsx("div", {
|
|
313
296
|
style: {
|
|
@@ -322,7 +305,7 @@ function ArrayFieldTemplate(props) {
|
|
|
322
305
|
registry: registry
|
|
323
306
|
})
|
|
324
307
|
})]
|
|
325
|
-
},
|
|
308
|
+
}, `array-item-list-${idSchema.$id}`)]
|
|
326
309
|
});
|
|
327
310
|
}
|
|
328
311
|
|
|
@@ -333,63 +316,61 @@ function ArrayFieldTemplate(props) {
|
|
|
333
316
|
* @param props - The `WidgetProps` for this template
|
|
334
317
|
*/
|
|
335
318
|
function BaseInputTemplate(props) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
rawErrors =
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
319
|
+
const {
|
|
320
|
+
id,
|
|
321
|
+
placeholder,
|
|
322
|
+
label,
|
|
323
|
+
hideLabel,
|
|
324
|
+
value,
|
|
325
|
+
required,
|
|
326
|
+
readonly,
|
|
327
|
+
disabled,
|
|
328
|
+
onChange,
|
|
329
|
+
onChangeOverride,
|
|
330
|
+
onBlur,
|
|
331
|
+
onFocus,
|
|
332
|
+
autofocus,
|
|
333
|
+
options,
|
|
334
|
+
schema,
|
|
335
|
+
uiSchema,
|
|
336
|
+
formContext,
|
|
337
|
+
type,
|
|
338
|
+
rawErrors = []
|
|
339
|
+
} = props;
|
|
340
|
+
const inputProps = getInputProps(schema, type, options);
|
|
341
|
+
const semanticProps = getSemanticProps({
|
|
342
|
+
uiSchema,
|
|
343
|
+
formContext,
|
|
344
|
+
options
|
|
361
345
|
});
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
var _onFocus = function _onFocus() {
|
|
370
|
-
return onFocus && onFocus(id, value);
|
|
371
|
-
};
|
|
346
|
+
const _onChange = ({
|
|
347
|
+
target: {
|
|
348
|
+
value
|
|
349
|
+
}
|
|
350
|
+
}) => onChange(value === '' ? options.emptyValue : value);
|
|
351
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
352
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
372
353
|
return jsxs(Fragment, {
|
|
373
|
-
children: [jsx(Form.Input,
|
|
354
|
+
children: [jsx(Form.Input, {
|
|
374
355
|
id: id,
|
|
375
356
|
name: id,
|
|
376
|
-
placeholder: placeholder
|
|
377
|
-
|
|
357
|
+
placeholder: placeholder,
|
|
358
|
+
...inputProps,
|
|
378
359
|
label: labelValue(label || undefined, hideLabel, false),
|
|
379
360
|
required: required,
|
|
380
361
|
autoFocus: autofocus,
|
|
381
362
|
disabled: disabled || readonly,
|
|
382
|
-
list: schema.examples ? examplesId(id) : undefined
|
|
383
|
-
|
|
363
|
+
list: schema.examples ? examplesId(id) : undefined,
|
|
364
|
+
...semanticProps,
|
|
384
365
|
value: value || value === 0 ? value : '',
|
|
385
366
|
error: rawErrors.length > 0,
|
|
386
367
|
onChange: onChangeOverride || _onChange,
|
|
387
368
|
onBlur: _onBlur,
|
|
388
369
|
onFocus: _onFocus,
|
|
389
370
|
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
390
|
-
}
|
|
371
|
+
}, id), Array.isArray(schema.examples) && jsx("datalist", {
|
|
391
372
|
id: examplesId(id),
|
|
392
|
-
children: schema.examples.concat(schema
|
|
373
|
+
children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map(example => {
|
|
393
374
|
return jsx("option", {
|
|
394
375
|
value: example
|
|
395
376
|
}, example);
|
|
@@ -403,8 +384,10 @@ function BaseInputTemplate(props) {
|
|
|
403
384
|
* @param props - The `DescriptionFieldProps` for this component
|
|
404
385
|
*/
|
|
405
386
|
function DescriptionField(props) {
|
|
406
|
-
|
|
407
|
-
|
|
387
|
+
const {
|
|
388
|
+
id,
|
|
389
|
+
description
|
|
390
|
+
} = props;
|
|
408
391
|
if (!description) {
|
|
409
392
|
return null;
|
|
410
393
|
}
|
|
@@ -419,72 +402,93 @@ function DescriptionField(props) {
|
|
|
419
402
|
*
|
|
420
403
|
* @param props - The `ErrorListProps` for this component
|
|
421
404
|
*/
|
|
422
|
-
function ErrorList(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
405
|
+
function ErrorList({
|
|
406
|
+
errors,
|
|
407
|
+
registry
|
|
408
|
+
}) {
|
|
409
|
+
const {
|
|
410
|
+
translateString
|
|
411
|
+
} = registry;
|
|
426
412
|
return jsxs(Message, {
|
|
427
413
|
negative: true,
|
|
428
414
|
children: [jsx(Message.Header, {
|
|
429
415
|
children: translateString(TranslatableString.ErrorsLabel)
|
|
430
416
|
}), jsx(Message.List, {
|
|
431
|
-
children: errors.map(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}, "error-" + index);
|
|
435
|
-
})
|
|
417
|
+
children: errors.map((error, index) => jsx(Message.Item, {
|
|
418
|
+
children: error.stack
|
|
419
|
+
}, `error-${index}`))
|
|
436
420
|
})]
|
|
437
421
|
});
|
|
438
422
|
}
|
|
439
423
|
|
|
440
|
-
var _excluded$1 = ["icon", "iconType", "color", "className", "uiSchema", "registry"];
|
|
441
424
|
function IconButton(props) {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
425
|
+
const {
|
|
426
|
+
icon,
|
|
427
|
+
iconType,
|
|
428
|
+
color,
|
|
429
|
+
className,
|
|
430
|
+
uiSchema,
|
|
431
|
+
registry,
|
|
432
|
+
...otherProps
|
|
433
|
+
} = props;
|
|
434
|
+
return jsx(Button, {
|
|
448
435
|
icon: icon,
|
|
449
436
|
size: iconType,
|
|
450
437
|
color: color,
|
|
451
|
-
className: className
|
|
452
|
-
|
|
438
|
+
className: className,
|
|
439
|
+
...otherProps
|
|
440
|
+
});
|
|
453
441
|
}
|
|
454
442
|
function CopyButton(props) {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
443
|
+
const {
|
|
444
|
+
registry: {
|
|
445
|
+
translateString
|
|
446
|
+
}
|
|
447
|
+
} = props;
|
|
448
|
+
return jsx(IconButton, {
|
|
449
|
+
title: translateString(TranslatableString.CopyButton),
|
|
450
|
+
...props,
|
|
459
451
|
icon: 'copy'
|
|
460
|
-
})
|
|
452
|
+
});
|
|
461
453
|
}
|
|
462
454
|
function MoveDownButton(props) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
455
|
+
const {
|
|
456
|
+
registry: {
|
|
457
|
+
translateString
|
|
458
|
+
}
|
|
459
|
+
} = props;
|
|
460
|
+
return jsx(IconButton, {
|
|
461
|
+
title: translateString(TranslatableString.MoveDownButton),
|
|
462
|
+
...props,
|
|
467
463
|
icon: 'angle down'
|
|
468
|
-
})
|
|
464
|
+
});
|
|
469
465
|
}
|
|
470
466
|
function MoveUpButton(props) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
467
|
+
const {
|
|
468
|
+
registry: {
|
|
469
|
+
translateString
|
|
470
|
+
}
|
|
471
|
+
} = props;
|
|
472
|
+
return jsx(IconButton, {
|
|
473
|
+
title: translateString(TranslatableString.MoveUpButton),
|
|
474
|
+
...props,
|
|
475
475
|
icon: 'angle up'
|
|
476
|
-
})
|
|
476
|
+
});
|
|
477
477
|
}
|
|
478
478
|
function RemoveButton(props) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
479
|
+
const {
|
|
480
|
+
registry: {
|
|
481
|
+
translateString
|
|
482
|
+
}
|
|
483
|
+
} = props;
|
|
484
|
+
return jsx(IconButton, {
|
|
485
|
+
title: translateString(TranslatableString.RemoveButton),
|
|
486
|
+
...props,
|
|
483
487
|
icon: 'trash'
|
|
484
|
-
})
|
|
488
|
+
});
|
|
485
489
|
}
|
|
486
490
|
|
|
487
|
-
|
|
491
|
+
const DEFAULT_OPTIONS$1 = {
|
|
488
492
|
options: {
|
|
489
493
|
pointing: 'above',
|
|
490
494
|
size: 'small'
|
|
@@ -494,21 +498,26 @@ var DEFAULT_OPTIONS$1 = {
|
|
|
494
498
|
*
|
|
495
499
|
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
496
500
|
*/
|
|
497
|
-
function FieldErrorTemplate(
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
formContext
|
|
505
|
-
|
|
501
|
+
function FieldErrorTemplate({
|
|
502
|
+
errors,
|
|
503
|
+
idSchema,
|
|
504
|
+
uiSchema,
|
|
505
|
+
registry
|
|
506
|
+
}) {
|
|
507
|
+
const {
|
|
508
|
+
formContext
|
|
509
|
+
} = registry;
|
|
510
|
+
const options = getSemanticErrorProps({
|
|
511
|
+
formContext,
|
|
512
|
+
uiSchema,
|
|
506
513
|
defaultProps: DEFAULT_OPTIONS$1
|
|
507
514
|
});
|
|
508
|
-
|
|
509
|
-
|
|
515
|
+
const {
|
|
516
|
+
pointing,
|
|
517
|
+
size
|
|
518
|
+
} = options;
|
|
510
519
|
if (errors && errors.length > 0) {
|
|
511
|
-
|
|
520
|
+
const id = errorId(idSchema);
|
|
512
521
|
return jsx(Label, {
|
|
513
522
|
id: id,
|
|
514
523
|
color: 'red',
|
|
@@ -517,11 +526,9 @@ function FieldErrorTemplate(_ref) {
|
|
|
517
526
|
basic: true,
|
|
518
527
|
children: jsx(List, {
|
|
519
528
|
bulleted: true,
|
|
520
|
-
children: errors.map(
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
}, nanoid());
|
|
524
|
-
})
|
|
529
|
+
children: errors.map(error => jsx(List.Item, {
|
|
530
|
+
children: error
|
|
531
|
+
}, nanoid()))
|
|
525
532
|
})
|
|
526
533
|
});
|
|
527
534
|
}
|
|
@@ -533,10 +540,12 @@ function FieldErrorTemplate(_ref) {
|
|
|
533
540
|
* @param props - The `FieldHelpProps` to be rendered
|
|
534
541
|
*/
|
|
535
542
|
function FieldHelpTemplate(props) {
|
|
536
|
-
|
|
537
|
-
|
|
543
|
+
const {
|
|
544
|
+
idSchema,
|
|
545
|
+
help
|
|
546
|
+
} = props;
|
|
538
547
|
if (help) {
|
|
539
|
-
|
|
548
|
+
const id = helpId(idSchema);
|
|
540
549
|
return jsx(Message, {
|
|
541
550
|
size: 'mini',
|
|
542
551
|
info: true,
|
|
@@ -547,33 +556,36 @@ function FieldHelpTemplate(props) {
|
|
|
547
556
|
return null;
|
|
548
557
|
}
|
|
549
558
|
|
|
550
|
-
var _excluded = ["id", "children", "classNames", "style", "displayLabel", "label", "errors", "help", "hidden", "description", "rawDescription", "registry", "schema", "uiSchema"];
|
|
551
559
|
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
552
560
|
* content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.
|
|
553
561
|
*
|
|
554
562
|
* @param props - The `FieldTemplateProps` for this component
|
|
555
563
|
*/
|
|
556
564
|
function FieldTemplate(props) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
565
|
+
const {
|
|
566
|
+
id,
|
|
567
|
+
children,
|
|
568
|
+
classNames,
|
|
569
|
+
style,
|
|
570
|
+
displayLabel,
|
|
571
|
+
label,
|
|
572
|
+
errors,
|
|
573
|
+
help,
|
|
574
|
+
hidden,
|
|
575
|
+
description,
|
|
576
|
+
rawDescription,
|
|
577
|
+
registry,
|
|
578
|
+
schema,
|
|
579
|
+
uiSchema,
|
|
580
|
+
...otherProps
|
|
581
|
+
} = props;
|
|
582
|
+
const semanticProps = getSemanticProps(otherProps);
|
|
583
|
+
const {
|
|
584
|
+
wrapLabel,
|
|
585
|
+
wrapContent
|
|
586
|
+
} = semanticProps;
|
|
587
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
588
|
+
const WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
577
589
|
if (hidden) {
|
|
578
590
|
return jsx("div", {
|
|
579
591
|
style: {
|
|
@@ -582,15 +594,15 @@ function FieldTemplate(props) {
|
|
|
582
594
|
children: children
|
|
583
595
|
});
|
|
584
596
|
}
|
|
585
|
-
return jsx(WrapIfAdditionalTemplate,
|
|
597
|
+
return jsx(WrapIfAdditionalTemplate, {
|
|
586
598
|
classNames: classNames,
|
|
587
599
|
style: style,
|
|
588
600
|
id: id,
|
|
589
601
|
label: label,
|
|
590
602
|
registry: registry,
|
|
591
603
|
schema: schema,
|
|
592
|
-
uiSchema: uiSchema
|
|
593
|
-
|
|
604
|
+
uiSchema: uiSchema,
|
|
605
|
+
...otherProps,
|
|
594
606
|
children: jsx(Form.Group, {
|
|
595
607
|
widths: 'equal',
|
|
596
608
|
grouped: true,
|
|
@@ -604,7 +616,7 @@ function FieldTemplate(props) {
|
|
|
604
616
|
}), help, errors]
|
|
605
617
|
})
|
|
606
618
|
}, id)
|
|
607
|
-
})
|
|
619
|
+
});
|
|
608
620
|
}
|
|
609
621
|
|
|
610
622
|
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
@@ -614,23 +626,29 @@ function FieldTemplate(props) {
|
|
|
614
626
|
* @param props - The `ObjectFieldTemplateProps` for this component
|
|
615
627
|
*/
|
|
616
628
|
function ObjectFieldTemplate(props) {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
629
|
+
const {
|
|
630
|
+
description,
|
|
631
|
+
onAddClick,
|
|
632
|
+
title,
|
|
633
|
+
properties,
|
|
634
|
+
disabled,
|
|
635
|
+
readonly,
|
|
636
|
+
required,
|
|
637
|
+
uiSchema,
|
|
638
|
+
schema,
|
|
639
|
+
formData,
|
|
640
|
+
idSchema,
|
|
641
|
+
registry
|
|
642
|
+
} = props;
|
|
643
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
644
|
+
const TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
645
|
+
const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
632
646
|
// Button templates are not overridden in the uiSchema
|
|
633
|
-
|
|
647
|
+
const {
|
|
648
|
+
ButtonTemplates: {
|
|
649
|
+
AddButton
|
|
650
|
+
}
|
|
651
|
+
} = registry.templates;
|
|
634
652
|
return jsxs(Fragment, {
|
|
635
653
|
children: [title && jsx(TitleFieldTemplate, {
|
|
636
654
|
id: titleId(idSchema),
|
|
@@ -645,9 +663,7 @@ function ObjectFieldTemplate(props) {
|
|
|
645
663
|
schema: schema,
|
|
646
664
|
uiSchema: uiSchema,
|
|
647
665
|
registry: registry
|
|
648
|
-
}), properties.map(
|
|
649
|
-
return prop.content;
|
|
650
|
-
}), canExpand(schema, uiSchema, formData) && jsx(Grid.Column, {
|
|
666
|
+
}), properties.map(prop => prop.content), canExpand(schema, uiSchema, formData) && jsx(Grid.Column, {
|
|
651
667
|
width: 16,
|
|
652
668
|
verticalAlign: 'middle',
|
|
653
669
|
children: jsx(Grid.Row, {
|
|
@@ -671,25 +687,26 @@ function ObjectFieldTemplate(props) {
|
|
|
671
687
|
|
|
672
688
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
673
689
|
*/
|
|
674
|
-
function SubmitButton(
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
submitButtonProps =
|
|
690
|
+
function SubmitButton({
|
|
691
|
+
uiSchema
|
|
692
|
+
}) {
|
|
693
|
+
const {
|
|
694
|
+
submitText,
|
|
695
|
+
norender,
|
|
696
|
+
props: submitButtonProps = {}
|
|
697
|
+
} = getSubmitButtonOptions(uiSchema);
|
|
681
698
|
if (norender) {
|
|
682
699
|
return null;
|
|
683
700
|
}
|
|
684
|
-
return jsx(Button,
|
|
701
|
+
return jsx(Button, {
|
|
685
702
|
type: 'submit',
|
|
686
|
-
primary: true
|
|
687
|
-
|
|
703
|
+
primary: true,
|
|
704
|
+
...submitButtonProps,
|
|
688
705
|
children: submitText
|
|
689
|
-
})
|
|
706
|
+
});
|
|
690
707
|
}
|
|
691
708
|
|
|
692
|
-
|
|
709
|
+
const DEFAULT_OPTIONS = {
|
|
693
710
|
inverted: false,
|
|
694
711
|
dividing: true
|
|
695
712
|
};
|
|
@@ -697,23 +714,24 @@ var DEFAULT_OPTIONS = {
|
|
|
697
714
|
*
|
|
698
715
|
* @param props - The `TitleFieldProps` for this component
|
|
699
716
|
*/
|
|
700
|
-
function TitleField(
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
717
|
+
function TitleField({
|
|
718
|
+
id,
|
|
719
|
+
title,
|
|
720
|
+
uiSchema
|
|
721
|
+
}) {
|
|
722
|
+
const semanticProps = getSemanticProps({
|
|
723
|
+
uiSchema,
|
|
706
724
|
defaultSchemaProps: DEFAULT_OPTIONS
|
|
707
725
|
});
|
|
708
726
|
if (!title) {
|
|
709
727
|
return null;
|
|
710
728
|
}
|
|
711
|
-
return jsx(Header,
|
|
712
|
-
id: id
|
|
713
|
-
|
|
729
|
+
return jsx(Header, {
|
|
730
|
+
id: id,
|
|
731
|
+
...semanticProps,
|
|
714
732
|
as: 'h5',
|
|
715
733
|
children: title
|
|
716
|
-
})
|
|
734
|
+
});
|
|
717
735
|
}
|
|
718
736
|
|
|
719
737
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -722,29 +740,35 @@ function TitleField(_ref) {
|
|
|
722
740
|
* @param props - The `WrapIfAdditionalProps` for this component
|
|
723
741
|
*/
|
|
724
742
|
function WrapIfAdditionalTemplate(props) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
743
|
+
const {
|
|
744
|
+
children,
|
|
745
|
+
classNames,
|
|
746
|
+
style,
|
|
747
|
+
disabled,
|
|
748
|
+
id,
|
|
749
|
+
label,
|
|
750
|
+
onDropPropertyClick,
|
|
751
|
+
onKeyChange,
|
|
752
|
+
readonly,
|
|
753
|
+
required,
|
|
754
|
+
schema,
|
|
755
|
+
uiSchema,
|
|
756
|
+
registry
|
|
757
|
+
} = props;
|
|
758
|
+
const {
|
|
759
|
+
templates,
|
|
760
|
+
translateString
|
|
761
|
+
} = registry;
|
|
740
762
|
// Button templates are not overridden in the uiSchema
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
763
|
+
const {
|
|
764
|
+
RemoveButton
|
|
765
|
+
} = templates.ButtonTemplates;
|
|
766
|
+
const keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
767
|
+
const {
|
|
768
|
+
readonlyAsDisabled = true,
|
|
769
|
+
wrapperStyle
|
|
770
|
+
} = registry.formContext;
|
|
771
|
+
const additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
748
772
|
if (!additional) {
|
|
749
773
|
return jsx("div", {
|
|
750
774
|
className: classNames,
|
|
@@ -752,10 +776,9 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
752
776
|
children: children
|
|
753
777
|
});
|
|
754
778
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
};
|
|
779
|
+
const handleBlur = ({
|
|
780
|
+
target
|
|
781
|
+
}) => onKeyChange(target.value);
|
|
759
782
|
return jsx("div", {
|
|
760
783
|
className: classNames,
|
|
761
784
|
style: style,
|
|
@@ -771,13 +794,13 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
771
794
|
className: 'form-group',
|
|
772
795
|
hasFeedback: true,
|
|
773
796
|
fluid: true,
|
|
774
|
-
htmlFor:
|
|
797
|
+
htmlFor: `${id}`,
|
|
775
798
|
label: keyLabel,
|
|
776
799
|
required: required,
|
|
777
800
|
defaultValue: label,
|
|
778
801
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
779
|
-
id:
|
|
780
|
-
name:
|
|
802
|
+
id: `${id}`,
|
|
803
|
+
name: `${id}`,
|
|
781
804
|
onBlur: !readonly ? handleBlur : undefined,
|
|
782
805
|
style: wrapperStyle,
|
|
783
806
|
type: 'text'
|
|
@@ -799,30 +822,30 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
799
822
|
})]
|
|
800
823
|
})
|
|
801
824
|
})
|
|
802
|
-
}, id
|
|
825
|
+
}, `${id}-key`);
|
|
803
826
|
}
|
|
804
827
|
|
|
805
828
|
function generateTemplates() {
|
|
806
829
|
return {
|
|
807
|
-
ArrayFieldItemTemplate
|
|
808
|
-
ArrayFieldTemplate
|
|
809
|
-
BaseInputTemplate
|
|
830
|
+
ArrayFieldItemTemplate,
|
|
831
|
+
ArrayFieldTemplate,
|
|
832
|
+
BaseInputTemplate,
|
|
810
833
|
ButtonTemplates: {
|
|
811
|
-
AddButton
|
|
812
|
-
CopyButton
|
|
813
|
-
MoveDownButton
|
|
814
|
-
MoveUpButton
|
|
815
|
-
RemoveButton
|
|
816
|
-
SubmitButton
|
|
834
|
+
AddButton,
|
|
835
|
+
CopyButton,
|
|
836
|
+
MoveDownButton,
|
|
837
|
+
MoveUpButton,
|
|
838
|
+
RemoveButton,
|
|
839
|
+
SubmitButton
|
|
817
840
|
},
|
|
818
841
|
DescriptionFieldTemplate: DescriptionField,
|
|
819
842
|
ErrorListTemplate: ErrorList,
|
|
820
|
-
FieldErrorTemplate
|
|
821
|
-
FieldHelpTemplate
|
|
822
|
-
FieldTemplate
|
|
823
|
-
ObjectFieldTemplate
|
|
843
|
+
FieldErrorTemplate,
|
|
844
|
+
FieldHelpTemplate,
|
|
845
|
+
FieldTemplate,
|
|
846
|
+
ObjectFieldTemplate,
|
|
824
847
|
TitleFieldTemplate: TitleField,
|
|
825
|
-
WrapIfAdditionalTemplate
|
|
848
|
+
WrapIfAdditionalTemplate
|
|
826
849
|
};
|
|
827
850
|
}
|
|
828
851
|
var Templates = /*#__PURE__*/generateTemplates();
|
|
@@ -833,49 +856,42 @@ var Templates = /*#__PURE__*/generateTemplates();
|
|
|
833
856
|
* @param props - The `WidgetProps` for this component
|
|
834
857
|
*/
|
|
835
858
|
function CheckboxWidget(props) {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
value
|
|
839
|
-
disabled
|
|
840
|
-
readonly
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
uiSchema: uiSchema,
|
|
859
|
+
const {
|
|
860
|
+
id,
|
|
861
|
+
value,
|
|
862
|
+
disabled,
|
|
863
|
+
readonly,
|
|
864
|
+
label = '',
|
|
865
|
+
hideLabel,
|
|
866
|
+
autofocus,
|
|
867
|
+
onChange,
|
|
868
|
+
onBlur,
|
|
869
|
+
options,
|
|
870
|
+
onFocus,
|
|
871
|
+
formContext,
|
|
872
|
+
schema,
|
|
873
|
+
uiSchema,
|
|
874
|
+
rawErrors = [],
|
|
875
|
+
registry
|
|
876
|
+
} = props;
|
|
877
|
+
const semanticProps = getSemanticProps({
|
|
878
|
+
options,
|
|
879
|
+
formContext,
|
|
880
|
+
uiSchema,
|
|
859
881
|
defaultSchemaProps: {
|
|
860
882
|
inverted: 'false'
|
|
861
883
|
}
|
|
862
884
|
});
|
|
863
|
-
|
|
885
|
+
const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
|
|
864
886
|
// Because an unchecked checkbox will cause html5 validation to fail, only add
|
|
865
887
|
// the "required" attribute if the field value must be "true", due to the
|
|
866
888
|
// "const" or "enum" keywords
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
};
|
|
874
|
-
var _onFocus = function _onFocus() {
|
|
875
|
-
return onFocus && onFocus(id, value);
|
|
876
|
-
};
|
|
877
|
-
var checked = value == 'true' || value == true;
|
|
878
|
-
var description = (_options$description = options.description) != null ? _options$description : schema.description;
|
|
889
|
+
const required = schemaRequiresTrueValue(schema);
|
|
890
|
+
const _onChange = (_, data) => onChange && onChange(data.checked);
|
|
891
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
892
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
893
|
+
const checked = value == 'true' || value == true;
|
|
894
|
+
const description = options.description ?? schema.description;
|
|
879
895
|
return jsxs(Fragment, {
|
|
880
896
|
children: [!hideLabel && !!description && jsx(DescriptionFieldTemplate, {
|
|
881
897
|
id: descriptionId(id),
|
|
@@ -883,12 +899,12 @@ function CheckboxWidget(props) {
|
|
|
883
899
|
schema: schema,
|
|
884
900
|
uiSchema: uiSchema,
|
|
885
901
|
registry: registry
|
|
886
|
-
}), jsx(Form.Checkbox,
|
|
902
|
+
}), jsx(Form.Checkbox, {
|
|
887
903
|
id: id,
|
|
888
904
|
name: id,
|
|
889
905
|
disabled: disabled || readonly,
|
|
890
|
-
autoFocus: autofocus
|
|
891
|
-
|
|
906
|
+
autoFocus: autofocus,
|
|
907
|
+
...semanticProps,
|
|
892
908
|
checked: typeof value === 'undefined' ? false : checked,
|
|
893
909
|
error: rawErrors.length > 0,
|
|
894
910
|
onChange: _onChange,
|
|
@@ -897,7 +913,7 @@ function CheckboxWidget(props) {
|
|
|
897
913
|
required: required,
|
|
898
914
|
label: labelValue(label, hideLabel, false),
|
|
899
915
|
"aria-describedby": ariaDescribedByIds(id)
|
|
900
|
-
})
|
|
916
|
+
})]
|
|
901
917
|
});
|
|
902
918
|
}
|
|
903
919
|
|
|
@@ -907,54 +923,54 @@ function CheckboxWidget(props) {
|
|
|
907
923
|
* @param props - The `WidgetProps` for this component
|
|
908
924
|
*/
|
|
909
925
|
function CheckboxesWidget(props) {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
rawErrors =
|
|
926
|
-
registry
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
926
|
+
const {
|
|
927
|
+
id,
|
|
928
|
+
disabled,
|
|
929
|
+
options,
|
|
930
|
+
value,
|
|
931
|
+
autofocus,
|
|
932
|
+
readonly,
|
|
933
|
+
label,
|
|
934
|
+
hideLabel,
|
|
935
|
+
onChange,
|
|
936
|
+
onBlur,
|
|
937
|
+
onFocus,
|
|
938
|
+
formContext,
|
|
939
|
+
schema,
|
|
940
|
+
uiSchema,
|
|
941
|
+
rawErrors = [],
|
|
942
|
+
registry
|
|
943
|
+
} = props;
|
|
944
|
+
const TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, options);
|
|
945
|
+
const {
|
|
946
|
+
enumOptions,
|
|
947
|
+
enumDisabled,
|
|
948
|
+
inline
|
|
949
|
+
} = options;
|
|
950
|
+
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
951
|
+
const semanticProps = getSemanticProps({
|
|
952
|
+
options,
|
|
953
|
+
formContext,
|
|
954
|
+
uiSchema,
|
|
936
955
|
defaultSchemaProps: {
|
|
937
956
|
inverted: 'false'
|
|
938
957
|
}
|
|
939
958
|
});
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
var _onBlur = function _onBlur() {
|
|
952
|
-
return onBlur(id, value);
|
|
953
|
-
};
|
|
954
|
-
var _onFocus = function _onFocus() {
|
|
955
|
-
return onFocus(id, value);
|
|
959
|
+
const _onChange = index => ({
|
|
960
|
+
target: {
|
|
961
|
+
checked
|
|
962
|
+
}
|
|
963
|
+
}) => {
|
|
964
|
+
// eslint-disable-next-line no-shadow
|
|
965
|
+
if (checked) {
|
|
966
|
+
onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions));
|
|
967
|
+
} else {
|
|
968
|
+
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
969
|
+
}
|
|
956
970
|
};
|
|
957
|
-
|
|
971
|
+
const _onBlur = () => onBlur(id, value);
|
|
972
|
+
const _onFocus = () => onFocus(id, value);
|
|
973
|
+
const inlineOption = inline ? {
|
|
958
974
|
inline: true
|
|
959
975
|
} : {
|
|
960
976
|
grouped: true
|
|
@@ -966,18 +982,18 @@ function CheckboxesWidget(props) {
|
|
|
966
982
|
schema: schema,
|
|
967
983
|
uiSchema: uiSchema,
|
|
968
984
|
registry: registry
|
|
969
|
-
}), jsx(Form.Group,
|
|
985
|
+
}), jsx(Form.Group, {
|
|
970
986
|
id: id,
|
|
971
|
-
name: id
|
|
972
|
-
|
|
973
|
-
children: Array.isArray(enumOptions) && enumOptions.map(
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
return jsx(Form.Checkbox,
|
|
987
|
+
name: id,
|
|
988
|
+
...inlineOption,
|
|
989
|
+
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
990
|
+
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
991
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
992
|
+
return jsx(Form.Checkbox, {
|
|
977
993
|
id: optionId(id, index),
|
|
978
994
|
name: id,
|
|
979
|
-
label: option.label
|
|
980
|
-
|
|
995
|
+
label: option.label,
|
|
996
|
+
...semanticProps,
|
|
981
997
|
checked: checked,
|
|
982
998
|
error: rawErrors.length > 0,
|
|
983
999
|
disabled: disabled || itemDisabled || readonly,
|
|
@@ -986,9 +1002,9 @@ function CheckboxesWidget(props) {
|
|
|
986
1002
|
onBlur: _onBlur,
|
|
987
1003
|
onFocus: _onFocus,
|
|
988
1004
|
"aria-describedby": ariaDescribedByIds(id)
|
|
989
|
-
}
|
|
1005
|
+
}, index);
|
|
990
1006
|
})
|
|
991
|
-
})
|
|
1007
|
+
})]
|
|
992
1008
|
});
|
|
993
1009
|
}
|
|
994
1010
|
|
|
@@ -998,52 +1014,53 @@ function CheckboxesWidget(props) {
|
|
|
998
1014
|
* @param props - The `WidgetProps` for this component
|
|
999
1015
|
*/
|
|
1000
1016
|
function RadioWidget(props) {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
rawErrors =
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1017
|
+
const {
|
|
1018
|
+
id,
|
|
1019
|
+
value,
|
|
1020
|
+
required,
|
|
1021
|
+
disabled,
|
|
1022
|
+
readonly,
|
|
1023
|
+
onChange,
|
|
1024
|
+
onBlur,
|
|
1025
|
+
onFocus,
|
|
1026
|
+
options,
|
|
1027
|
+
formContext,
|
|
1028
|
+
uiSchema,
|
|
1029
|
+
rawErrors = []
|
|
1030
|
+
} = props;
|
|
1031
|
+
const {
|
|
1032
|
+
enumOptions,
|
|
1033
|
+
enumDisabled,
|
|
1034
|
+
emptyValue
|
|
1035
|
+
} = options;
|
|
1036
|
+
const semanticProps = getSemanticProps({
|
|
1037
|
+
formContext,
|
|
1038
|
+
options,
|
|
1039
|
+
uiSchema
|
|
1021
1040
|
});
|
|
1022
|
-
|
|
1023
|
-
|
|
1041
|
+
const _onChange = (_, {
|
|
1042
|
+
value: eventValue
|
|
1043
|
+
}) => {
|
|
1024
1044
|
return onChange(enumOptionsValueForIndex(eventValue, enumOptions, emptyValue));
|
|
1025
1045
|
};
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
var _onFocus = function _onFocus() {
|
|
1030
|
-
return onFocus(id, value);
|
|
1031
|
-
};
|
|
1032
|
-
var inlineOption = options.inline ? {
|
|
1046
|
+
const _onBlur = () => onBlur(id, value);
|
|
1047
|
+
const _onFocus = () => onFocus(id, value);
|
|
1048
|
+
const inlineOption = options.inline ? {
|
|
1033
1049
|
inline: true
|
|
1034
1050
|
} : {
|
|
1035
1051
|
grouped: true
|
|
1036
1052
|
};
|
|
1037
|
-
return jsx(Form.Group,
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1053
|
+
return jsx(Form.Group, {
|
|
1054
|
+
...inlineOption,
|
|
1055
|
+
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1056
|
+
const checked = enumOptionsIsSelected(option.value, value);
|
|
1057
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
1058
|
+
return /*#__PURE__*/createElement(Form.Field, {
|
|
1042
1059
|
required: required,
|
|
1043
1060
|
control: Radio,
|
|
1044
1061
|
id: optionId(id, index),
|
|
1045
|
-
name: id
|
|
1046
|
-
|
|
1062
|
+
name: id,
|
|
1063
|
+
...semanticProps,
|
|
1047
1064
|
onFocus: _onFocus,
|
|
1048
1065
|
onBlur: _onBlur,
|
|
1049
1066
|
onChange: _onChange,
|
|
@@ -1054,9 +1071,9 @@ function RadioWidget(props) {
|
|
|
1054
1071
|
checked: checked,
|
|
1055
1072
|
disabled: disabled || itemDisabled || readonly,
|
|
1056
1073
|
"aria-describedby": ariaDescribedByIds(id)
|
|
1057
|
-
})
|
|
1074
|
+
});
|
|
1058
1075
|
})
|
|
1059
|
-
})
|
|
1076
|
+
});
|
|
1060
1077
|
}
|
|
1061
1078
|
|
|
1062
1079
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
@@ -1065,54 +1082,53 @@ function RadioWidget(props) {
|
|
|
1065
1082
|
* @param props - The `WidgetProps` for this component
|
|
1066
1083
|
*/
|
|
1067
1084
|
function RangeWidget(props) {
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
rawErrors =
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1085
|
+
const {
|
|
1086
|
+
id,
|
|
1087
|
+
value,
|
|
1088
|
+
required,
|
|
1089
|
+
readonly,
|
|
1090
|
+
disabled,
|
|
1091
|
+
onChange,
|
|
1092
|
+
onBlur,
|
|
1093
|
+
onFocus,
|
|
1094
|
+
options,
|
|
1095
|
+
schema,
|
|
1096
|
+
uiSchema,
|
|
1097
|
+
formContext,
|
|
1098
|
+
rawErrors = []
|
|
1099
|
+
} = props;
|
|
1100
|
+
const semanticProps = getSemanticProps({
|
|
1101
|
+
formContext,
|
|
1102
|
+
options,
|
|
1103
|
+
uiSchema,
|
|
1086
1104
|
defaultSchemaProps: {
|
|
1087
1105
|
fluid: true
|
|
1088
1106
|
}
|
|
1089
1107
|
});
|
|
1090
1108
|
// eslint-disable-next-line no-shadow
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
var _onFocus = function _onFocus() {
|
|
1099
|
-
return onFocus && onFocus(id, value);
|
|
1100
|
-
};
|
|
1109
|
+
const _onChange = ({
|
|
1110
|
+
target: {
|
|
1111
|
+
value
|
|
1112
|
+
}
|
|
1113
|
+
}) => onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1114
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
1115
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
1101
1116
|
return jsxs(Fragment, {
|
|
1102
|
-
children: [jsx(Input,
|
|
1117
|
+
children: [jsx(Input, {
|
|
1103
1118
|
id: id,
|
|
1104
1119
|
name: id,
|
|
1105
1120
|
type: 'range',
|
|
1106
1121
|
required: required,
|
|
1107
|
-
disabled: disabled || readonly
|
|
1108
|
-
|
|
1122
|
+
disabled: disabled || readonly,
|
|
1123
|
+
...rangeSpec(schema),
|
|
1124
|
+
...semanticProps,
|
|
1109
1125
|
value: value || '',
|
|
1110
1126
|
error: rawErrors.length > 0,
|
|
1111
1127
|
onChange: _onChange,
|
|
1112
1128
|
onBlur: _onBlur,
|
|
1113
1129
|
onFocus: _onFocus,
|
|
1114
1130
|
"aria-describedby": ariaDescribedByIds(id)
|
|
1115
|
-
}
|
|
1131
|
+
}, id), jsx("span", {
|
|
1116
1132
|
children: value
|
|
1117
1133
|
})]
|
|
1118
1134
|
});
|
|
@@ -1125,17 +1141,16 @@ function RangeWidget(props) {
|
|
|
1125
1141
|
* @returns {*}
|
|
1126
1142
|
*/
|
|
1127
1143
|
function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled) {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
});
|
|
1144
|
+
const disabledOptions = enumDisabled || [];
|
|
1145
|
+
const options = map(enumOptions, ({
|
|
1146
|
+
label,
|
|
1147
|
+
value
|
|
1148
|
+
}, index) => ({
|
|
1149
|
+
disabled: disabledOptions.indexOf(value) !== -1,
|
|
1150
|
+
key: label,
|
|
1151
|
+
text: label,
|
|
1152
|
+
value: String(index)
|
|
1153
|
+
}));
|
|
1139
1154
|
return options;
|
|
1140
1155
|
}
|
|
1141
1156
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
@@ -1144,28 +1159,29 @@ function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled) {
|
|
|
1144
1159
|
* @param props - The `WidgetProps` for this component
|
|
1145
1160
|
*/
|
|
1146
1161
|
function SelectWidget(props) {
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
rawErrors =
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1162
|
+
const {
|
|
1163
|
+
uiSchema,
|
|
1164
|
+
formContext,
|
|
1165
|
+
id,
|
|
1166
|
+
options,
|
|
1167
|
+
label,
|
|
1168
|
+
hideLabel,
|
|
1169
|
+
required,
|
|
1170
|
+
disabled,
|
|
1171
|
+
readonly,
|
|
1172
|
+
value,
|
|
1173
|
+
multiple,
|
|
1174
|
+
placeholder,
|
|
1175
|
+
autofocus,
|
|
1176
|
+
onChange,
|
|
1177
|
+
onBlur,
|
|
1178
|
+
onFocus,
|
|
1179
|
+
rawErrors = []
|
|
1180
|
+
} = props;
|
|
1181
|
+
const semanticProps = getSemanticProps({
|
|
1182
|
+
uiSchema,
|
|
1183
|
+
formContext,
|
|
1184
|
+
options,
|
|
1169
1185
|
defaultSchemaProps: {
|
|
1170
1186
|
inverted: 'false',
|
|
1171
1187
|
selection: true,
|
|
@@ -1174,26 +1190,29 @@ function SelectWidget(props) {
|
|
|
1174
1190
|
upward: false
|
|
1175
1191
|
}
|
|
1176
1192
|
});
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1193
|
+
const {
|
|
1194
|
+
enumDisabled,
|
|
1195
|
+
enumOptions,
|
|
1196
|
+
emptyValue: optEmptyVal
|
|
1197
|
+
} = options;
|
|
1198
|
+
const emptyValue = multiple ? [] : '';
|
|
1199
|
+
const dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
|
|
1200
|
+
const _onChange = (_, {
|
|
1201
|
+
value
|
|
1202
|
+
}) => onChange(enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1186
1203
|
// eslint-disable-next-line no-shadow
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1204
|
+
const _onBlur = (_, {
|
|
1205
|
+
target: {
|
|
1206
|
+
value
|
|
1207
|
+
}
|
|
1208
|
+
}) => onBlur(id, enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1209
|
+
const _onFocus = (_, {
|
|
1210
|
+
target: {
|
|
1211
|
+
value
|
|
1212
|
+
}
|
|
1213
|
+
}) => onFocus(id, enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
|
|
1214
|
+
const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1215
|
+
return jsx(Form.Dropdown, {
|
|
1197
1216
|
id: id,
|
|
1198
1217
|
name: id,
|
|
1199
1218
|
label: labelValue(label || undefined, hideLabel, false),
|
|
@@ -1201,8 +1220,8 @@ function SelectWidget(props) {
|
|
|
1201
1220
|
value: typeof value === 'undefined' ? emptyValue : selectedIndexes,
|
|
1202
1221
|
error: rawErrors.length > 0,
|
|
1203
1222
|
disabled: disabled,
|
|
1204
|
-
placeholder: placeholder
|
|
1205
|
-
|
|
1223
|
+
placeholder: placeholder,
|
|
1224
|
+
...semanticProps,
|
|
1206
1225
|
required: required,
|
|
1207
1226
|
autoFocus: autofocus,
|
|
1208
1227
|
readOnly: readonly,
|
|
@@ -1211,7 +1230,7 @@ function SelectWidget(props) {
|
|
|
1211
1230
|
onBlur: _onBlur,
|
|
1212
1231
|
onFocus: _onFocus,
|
|
1213
1232
|
"aria-describedby": ariaDescribedByIds(id)
|
|
1214
|
-
}
|
|
1233
|
+
}, id);
|
|
1215
1234
|
}
|
|
1216
1235
|
|
|
1217
1236
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
@@ -1219,49 +1238,47 @@ function SelectWidget(props) {
|
|
|
1219
1238
|
* @param props - The `WidgetProps` for this component
|
|
1220
1239
|
*/
|
|
1221
1240
|
function TextareaWidget(props) {
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
rawErrors =
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
+
const {
|
|
1242
|
+
id,
|
|
1243
|
+
placeholder,
|
|
1244
|
+
value,
|
|
1245
|
+
required,
|
|
1246
|
+
disabled,
|
|
1247
|
+
autofocus,
|
|
1248
|
+
label,
|
|
1249
|
+
hideLabel,
|
|
1250
|
+
readonly,
|
|
1251
|
+
onBlur,
|
|
1252
|
+
onFocus,
|
|
1253
|
+
onChange,
|
|
1254
|
+
options,
|
|
1255
|
+
formContext,
|
|
1256
|
+
rawErrors = []
|
|
1257
|
+
} = props;
|
|
1258
|
+
const semanticProps = getSemanticProps({
|
|
1259
|
+
formContext,
|
|
1260
|
+
options,
|
|
1241
1261
|
defaultSchemaProps: {
|
|
1242
1262
|
inverted: 'false'
|
|
1243
1263
|
}
|
|
1244
1264
|
});
|
|
1245
1265
|
// eslint-disable-next-line no-shadow
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
return onFocus && onFocus(id, value);
|
|
1255
|
-
};
|
|
1256
|
-
return jsx(Form.TextArea, _extends({
|
|
1266
|
+
const _onChange = ({
|
|
1267
|
+
target: {
|
|
1268
|
+
value
|
|
1269
|
+
}
|
|
1270
|
+
}) => onChange && onChange(value === '' ? options.emptyValue : value);
|
|
1271
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
1272
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
1273
|
+
return jsx(Form.TextArea, {
|
|
1257
1274
|
id: id,
|
|
1258
1275
|
name: id,
|
|
1259
1276
|
label: labelValue(label || undefined, hideLabel, false),
|
|
1260
1277
|
placeholder: placeholder,
|
|
1261
1278
|
autoFocus: autofocus,
|
|
1262
1279
|
required: required,
|
|
1263
|
-
disabled: disabled || readonly
|
|
1264
|
-
|
|
1280
|
+
disabled: disabled || readonly,
|
|
1281
|
+
...semanticProps,
|
|
1265
1282
|
value: value || '',
|
|
1266
1283
|
error: rawErrors.length > 0,
|
|
1267
1284
|
rows: options.rows || 5,
|
|
@@ -1269,17 +1286,17 @@ function TextareaWidget(props) {
|
|
|
1269
1286
|
onBlur: _onBlur,
|
|
1270
1287
|
onFocus: _onFocus,
|
|
1271
1288
|
"aria-describedby": ariaDescribedByIds(id)
|
|
1272
|
-
}
|
|
1289
|
+
}, id);
|
|
1273
1290
|
}
|
|
1274
1291
|
|
|
1275
1292
|
function generateWidgets() {
|
|
1276
1293
|
return {
|
|
1277
|
-
CheckboxWidget
|
|
1278
|
-
CheckboxesWidget
|
|
1279
|
-
RadioWidget
|
|
1280
|
-
RangeWidget
|
|
1281
|
-
SelectWidget
|
|
1282
|
-
TextareaWidget
|
|
1294
|
+
CheckboxWidget,
|
|
1295
|
+
CheckboxesWidget,
|
|
1296
|
+
RadioWidget,
|
|
1297
|
+
RangeWidget,
|
|
1298
|
+
SelectWidget,
|
|
1299
|
+
TextareaWidget
|
|
1283
1300
|
};
|
|
1284
1301
|
}
|
|
1285
1302
|
var Widgets = /*#__PURE__*/generateWidgets();
|