@rjsf/semantic-ui 4.2.2 → 5.0.0-beta.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/README.md +3 -3
- package/dist/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +2 -0
- package/dist/ArrayFieldItemTemplate/index.d.ts +2 -0
- package/dist/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +17 -1
- package/dist/BaseInputTemplate/BaseInputTemplate.d.ts +2 -0
- package/dist/BaseInputTemplate/index.d.ts +2 -0
- package/dist/DescriptionField/DescriptionField.d.ts +2 -1
- package/dist/ErrorList/ErrorList.d.ts +1 -2
- package/dist/FieldTemplate/FieldTemplate.d.ts +4 -2
- package/dist/FieldTemplate/WrapIfAdditional.d.ts +2 -1
- package/dist/HelpField/HelpField.d.ts +2 -3
- package/dist/IconButton/IconButton.d.ts +5 -3
- package/dist/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +2 -3
- package/dist/RawErrors/RawErrors.d.ts +2 -3
- package/dist/SemanticUIForm/SemanticUIForm.d.ts +1 -2
- package/dist/Templates/Templates.d.ts +31 -0
- package/dist/Templates/index.d.ts +2 -0
- package/dist/Theme/Theme.d.ts +4 -30
- package/dist/TitleField/TitleField.d.ts +3 -17
- package/dist/Widgets/Widgets.d.ts +0 -16
- package/dist/index.d.ts +2 -5
- package/dist/semantic-ui.cjs.development.js +754 -1126
- 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 +754 -1123
- package/dist/semantic-ui.esm.js.map +1 -1
- package/dist/semantic-ui.umd.development.js +757 -1130
- 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/dist/util.d.ts +2 -2
- package/package.json +35 -68
- package/dist/DateTimeWidget/DateTimeWidget.d.ts +0 -2
- package/dist/DateTimeWidget/index.d.ts +0 -2
- package/dist/DateWidget/DateWidget.d.ts +0 -2
- package/dist/DateWidget/index.d.ts +0 -2
- package/dist/EmailWidget/EmailWidget.d.ts +0 -2
- package/dist/EmailWidget/index.d.ts +0 -2
- package/dist/Fields/Fields.d.ts +0 -7
- package/dist/Fields/index.d.ts +0 -2
- package/dist/PasswordWidget/PasswordWidget.d.ts +0 -2
- package/dist/PasswordWidget/index.d.ts +0 -2
- package/dist/TextWidget/TextWidget.d.ts +0 -2
- package/dist/TextWidget/index.d.ts +0 -2
- package/dist/URLWidget/URLWidget.d.ts +0 -2
- package/dist/URLWidget/index.d.ts +0 -2
- package/dist/UpDownWidget/UpDownWidget.d.ts +0 -2
- package/dist/UpDownWidget/index.d.ts +0 -2
|
@@ -7,12 +7,13 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
7
7
|
var core = require('@rjsf/core');
|
|
8
8
|
var semanticUiReact = require('semantic-ui-react');
|
|
9
9
|
var React = _interopDefault(require('react'));
|
|
10
|
+
var utils = require('@rjsf/utils');
|
|
10
11
|
var PropTypes = _interopDefault(require('prop-types'));
|
|
11
12
|
var nanoid = require('nanoid');
|
|
12
13
|
var _ = _interopDefault(require('lodash'));
|
|
13
14
|
|
|
14
15
|
function _extends() {
|
|
15
|
-
_extends = Object.assign
|
|
16
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
16
17
|
for (var i = 1; i < arguments.length; i++) {
|
|
17
18
|
var source = arguments[i];
|
|
18
19
|
|
|
@@ -25,33 +26,19 @@ function _extends() {
|
|
|
25
26
|
|
|
26
27
|
return target;
|
|
27
28
|
};
|
|
28
|
-
|
|
29
29
|
return _extends.apply(this, arguments);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
33
|
-
if (source == null) return {};
|
|
34
|
-
var target = {};
|
|
35
|
-
var sourceKeys = Object.keys(source);
|
|
36
|
-
var key, i;
|
|
37
|
-
|
|
38
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
39
|
-
key = sourceKeys[i];
|
|
40
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
41
|
-
target[key] = source[key];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return target;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
32
|
function AddButton(props) {
|
|
48
|
-
return React.createElement(semanticUiReact.Button, _extends({
|
|
33
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Button, _extends({
|
|
34
|
+
title: "Add Item"
|
|
35
|
+
}, props, {
|
|
49
36
|
icon: true,
|
|
50
37
|
size: "tiny",
|
|
51
38
|
labelPosition: "left"
|
|
52
|
-
}), React.createElement(semanticUiReact.Icon, {
|
|
39
|
+
}), /*#__PURE__*/React.createElement(semanticUiReact.Icon, {
|
|
53
40
|
name: "plus"
|
|
54
|
-
})
|
|
41
|
+
}));
|
|
55
42
|
}
|
|
56
43
|
|
|
57
44
|
/**
|
|
@@ -67,24 +54,23 @@ function AddButton(props) {
|
|
|
67
54
|
*/
|
|
68
55
|
|
|
69
56
|
function getSemanticProps(_ref) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return Object.assign({}, _extends({}, defaultSchemaProps && defaultSchemaProps), _extends({}, defaultContextProps && defaultContextProps), schemaProps, optionProps, formContextProps);
|
|
57
|
+
let {
|
|
58
|
+
formContext = {},
|
|
59
|
+
uiSchema = {},
|
|
60
|
+
options = {},
|
|
61
|
+
defaultSchemaProps = {
|
|
62
|
+
fluid: true,
|
|
63
|
+
inverted: false
|
|
64
|
+
},
|
|
65
|
+
defaultContextProps = {}
|
|
66
|
+
} = _ref;
|
|
67
|
+
const formContextProps = formContext.semantic;
|
|
68
|
+
let schemaProps = uiSchema["ui:options"] && uiSchema["ui:options"].semantic;
|
|
69
|
+
let optionProps = options.semantic; // formContext props should overide other props
|
|
70
|
+
|
|
71
|
+
return Object.assign({}, { ...(defaultSchemaProps && defaultSchemaProps)
|
|
72
|
+
}, { ...(defaultContextProps && defaultContextProps)
|
|
73
|
+
}, schemaProps, optionProps, formContextProps);
|
|
88
74
|
}
|
|
89
75
|
/**
|
|
90
76
|
* Extract error props meant for semantic UI components from props that are
|
|
@@ -97,21 +83,20 @@ function getSemanticProps(_ref) {
|
|
|
97
83
|
*/
|
|
98
84
|
|
|
99
85
|
function getSemanticErrorProps(_ref2) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return Object.assign({}, _extends({}, defaultProps && defaultProps), schemaProps, optionProps, formContextProps);
|
|
86
|
+
let {
|
|
87
|
+
formContext = {},
|
|
88
|
+
uiSchema = {},
|
|
89
|
+
options = {},
|
|
90
|
+
defaultProps = {
|
|
91
|
+
size: "small",
|
|
92
|
+
pointing: "above"
|
|
93
|
+
}
|
|
94
|
+
} = _ref2;
|
|
95
|
+
const formContextProps = formContext.semantic && formContext.semantic.errorOptions;
|
|
96
|
+
const schemaProps = uiSchema["ui:options"] && uiSchema["ui:options"].semantic && uiSchema["ui:options"].semantic.errorOptions;
|
|
97
|
+
const optionProps = options.semantic && options.semantic.errorOptions;
|
|
98
|
+
return Object.assign({}, { ...(defaultProps && defaultProps)
|
|
99
|
+
}, schemaProps, optionProps, formContextProps);
|
|
115
100
|
}
|
|
116
101
|
/**
|
|
117
102
|
* Combine multiple strings containing class names into a single string,
|
|
@@ -130,14 +115,10 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
130
115
|
|
|
131
116
|
// Split each arg on whitespace, and add it to an array. Skip false-y args
|
|
132
117
|
// like "" and undefined.
|
|
133
|
-
|
|
134
|
-
return previous.concat(current.trim().split(/\s+/));
|
|
135
|
-
}, []); // Remove any class names from omit, and make the rest unique before
|
|
118
|
+
const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []); // Remove any class names from omit, and make the rest unique before
|
|
136
119
|
// returning them as a string
|
|
137
120
|
|
|
138
|
-
return [
|
|
139
|
-
return !omit.includes(cn);
|
|
140
|
-
}))).join(" ");
|
|
121
|
+
return [...new Set(classList.filter(cn => !omit.includes(cn)))].join(" ");
|
|
141
122
|
}
|
|
142
123
|
/**
|
|
143
124
|
*
|
|
@@ -149,235 +130,237 @@ function cleanClassNames(classNameArr, omit) {
|
|
|
149
130
|
*/
|
|
150
131
|
|
|
151
132
|
function MaybeWrap(_ref3) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return wrap ? React.createElement(Component, props) : props.children;
|
|
133
|
+
let {
|
|
134
|
+
wrap,
|
|
135
|
+
component: Component = "div",
|
|
136
|
+
...props
|
|
137
|
+
} = _ref3;
|
|
138
|
+
return wrap ? /*#__PURE__*/React.createElement(Component, props) : props.children;
|
|
158
139
|
}
|
|
159
140
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
idSchema = _ref.idSchema,
|
|
165
|
-
uiSchema = _ref.uiSchema,
|
|
166
|
-
title = _ref.title;
|
|
167
|
-
|
|
168
|
-
if (!title) {
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
var id = idSchema.$id + "__title";
|
|
173
|
-
return React.createElement(TitleField, {
|
|
174
|
-
id: id,
|
|
175
|
-
title: title,
|
|
176
|
-
options: uiSchema["ui:options"]
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
function ArrayFieldDescription(_ref2) {
|
|
181
|
-
var DescriptionField = _ref2.DescriptionField,
|
|
182
|
-
idSchema = _ref2.idSchema,
|
|
183
|
-
description = _ref2.description;
|
|
184
|
-
|
|
185
|
-
if (!description) {
|
|
186
|
-
// See #312: Ensure compatibility with old versions of React.
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
var id = idSchema.$id + "__description";
|
|
191
|
-
return React.createElement(DescriptionField, {
|
|
192
|
-
id: id,
|
|
193
|
-
description: description
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
var gridStyle = function gridStyle(vertical) {
|
|
198
|
-
return {
|
|
199
|
-
display: "grid",
|
|
200
|
-
gridTemplateColumns: "1fr " + (vertical ? 65 : 110) + "px"
|
|
201
|
-
};
|
|
202
|
-
}; // checks if its the first array item
|
|
141
|
+
const gridStyle = vertical => ({
|
|
142
|
+
display: "grid",
|
|
143
|
+
gridTemplateColumns: "1fr " + (vertical ? 65 : 110) + "px"
|
|
144
|
+
}); // checks if it's the first array item
|
|
203
145
|
|
|
204
146
|
|
|
205
147
|
function isInitialArrayItem(props) {
|
|
206
148
|
// no underscore because im not sure if we want to import a library here
|
|
207
|
-
|
|
149
|
+
const {
|
|
150
|
+
idSchema
|
|
151
|
+
} = props.children.props;
|
|
208
152
|
return idSchema.target && idSchema.conditions;
|
|
209
|
-
}
|
|
210
|
-
|
|
153
|
+
}
|
|
211
154
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
155
|
+
const ArrayFieldItemTemplate = props => {
|
|
156
|
+
const {
|
|
157
|
+
children,
|
|
158
|
+
disabled,
|
|
159
|
+
hasToolbar,
|
|
160
|
+
hasMoveDown,
|
|
161
|
+
hasMoveUp,
|
|
162
|
+
hasRemove,
|
|
163
|
+
horizontalButtons,
|
|
164
|
+
index,
|
|
165
|
+
onDropIndexClick,
|
|
166
|
+
onReorderClick,
|
|
167
|
+
readonly,
|
|
168
|
+
wrapItem,
|
|
169
|
+
registry
|
|
170
|
+
} = props;
|
|
171
|
+
const {
|
|
172
|
+
MoveDownButton,
|
|
173
|
+
MoveUpButton,
|
|
174
|
+
RemoveButton
|
|
175
|
+
} = registry.templates.ButtonTemplates;
|
|
176
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
177
|
+
className: "array-item"
|
|
178
|
+
}, /*#__PURE__*/React.createElement(MaybeWrap, {
|
|
179
|
+
wrap: wrapItem,
|
|
218
180
|
component: semanticUiReact.Segment
|
|
219
|
-
}, React.createElement(semanticUiReact.Grid, {
|
|
220
|
-
style: !isInitialArrayItem(props) ?
|
|
181
|
+
}, /*#__PURE__*/React.createElement(semanticUiReact.Grid, {
|
|
182
|
+
style: !isInitialArrayItem(props) ? { ...gridStyle(!horizontalButtons),
|
|
221
183
|
alignItems: "center"
|
|
222
|
-
}
|
|
223
|
-
}, React.createElement(semanticUiReact.Grid.Column, {
|
|
184
|
+
} : gridStyle(!horizontalButtons)
|
|
185
|
+
}, /*#__PURE__*/React.createElement(semanticUiReact.Grid.Column, {
|
|
224
186
|
width: 16,
|
|
225
187
|
verticalAlign: "middle"
|
|
226
|
-
},
|
|
188
|
+
}, children), hasToolbar && /*#__PURE__*/React.createElement(semanticUiReact.Grid.Column, null, (hasMoveUp || hasMoveDown || hasRemove) && /*#__PURE__*/React.createElement(semanticUiReact.Button.Group, {
|
|
227
189
|
size: "mini",
|
|
228
|
-
vertical: !
|
|
229
|
-
}, (
|
|
230
|
-
icon: "angle up",
|
|
190
|
+
vertical: !horizontalButtons
|
|
191
|
+
}, (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveUpButton, {
|
|
231
192
|
className: "array-item-move-up",
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}), (props.hasMoveUp || props.hasMoveDown) && React.createElement(semanticUiReact.Button, {
|
|
236
|
-
icon: "angle down",
|
|
193
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
194
|
+
onClick: onReorderClick(index, index - 1)
|
|
195
|
+
}), (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveDownButton, {
|
|
237
196
|
className: "array-item-move-down",
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}), props.hasRemove && React.createElement(semanticUiReact.Button, {
|
|
242
|
-
icon: "trash",
|
|
197
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
198
|
+
onClick: onReorderClick(index, index + 1)
|
|
199
|
+
}), hasRemove && /*#__PURE__*/React.createElement(RemoveButton, {
|
|
243
200
|
className: "array-item-remove",
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
onClick: props.onDropIndexClick(props.index)
|
|
201
|
+
disabled: disabled || readonly,
|
|
202
|
+
onClick: onDropIndexClick(index)
|
|
247
203
|
}))))));
|
|
248
|
-
}
|
|
249
|
-
// (displayed as a multi select or checkboxes)
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
function DefaultFixedArrayFieldTemplate(_ref3) {
|
|
253
|
-
var uiSchema = _ref3.uiSchema,
|
|
254
|
-
idSchema = _ref3.idSchema,
|
|
255
|
-
canAdd = _ref3.canAdd,
|
|
256
|
-
className = _ref3.className,
|
|
257
|
-
classNames = _ref3.classNames,
|
|
258
|
-
disabled = _ref3.disabled,
|
|
259
|
-
items = _ref3.items,
|
|
260
|
-
onAddClick = _ref3.onAddClick,
|
|
261
|
-
readOnly = _ref3.readOnly,
|
|
262
|
-
required = _ref3.required,
|
|
263
|
-
schema = _ref3.schema,
|
|
264
|
-
title = _ref3.title,
|
|
265
|
-
TitleField = _ref3.TitleField,
|
|
266
|
-
itemProps = _ref3.itemProps;
|
|
267
|
-
var fieldTitle = uiSchema["ui:title"] || title;
|
|
268
|
-
var fieldDescription = uiSchema["ui:description"] || schema.description;
|
|
269
|
-
return React.createElement("div", {
|
|
270
|
-
className: cleanClassNames([className, classNames])
|
|
271
|
-
}, React.createElement(ArrayFieldTitle, {
|
|
272
|
-
key: "array-field-title-" + idSchema.$id,
|
|
273
|
-
TitleField: TitleField,
|
|
274
|
-
idSchema: idSchema,
|
|
275
|
-
uiSchema: uiSchema,
|
|
276
|
-
title: fieldTitle,
|
|
277
|
-
required: required
|
|
278
|
-
}), fieldDescription && React.createElement("div", {
|
|
279
|
-
className: "field-description",
|
|
280
|
-
key: "field-description-" + idSchema.$id
|
|
281
|
-
}, fieldDescription), React.createElement("div", {
|
|
282
|
-
key: "array-item-list-" + idSchema.$id
|
|
283
|
-
}, React.createElement("div", {
|
|
284
|
-
className: "row array-item-list"
|
|
285
|
-
}, items && items.map(function (p) {
|
|
286
|
-
return DefaultArrayItem(_extends({}, p, itemProps));
|
|
287
|
-
})), canAdd && React.createElement("div", {
|
|
288
|
-
style: {
|
|
289
|
-
marginTop: "1rem",
|
|
290
|
-
position: "relative",
|
|
291
|
-
textAlign: "right"
|
|
292
|
-
}
|
|
293
|
-
}, React.createElement(AddButton, {
|
|
294
|
-
onClick: onAddClick,
|
|
295
|
-
disabled: disabled || readOnly
|
|
296
|
-
}))));
|
|
297
|
-
}
|
|
204
|
+
};
|
|
298
205
|
|
|
299
|
-
function
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
206
|
+
function ArrayFieldTemplate(_ref) {
|
|
207
|
+
let {
|
|
208
|
+
uiSchema,
|
|
209
|
+
idSchema,
|
|
210
|
+
canAdd,
|
|
211
|
+
className,
|
|
212
|
+
classNames,
|
|
213
|
+
disabled,
|
|
214
|
+
formContext,
|
|
215
|
+
items,
|
|
216
|
+
onAddClick,
|
|
217
|
+
options,
|
|
218
|
+
readOnly,
|
|
219
|
+
required,
|
|
220
|
+
schema,
|
|
221
|
+
title,
|
|
222
|
+
registry
|
|
223
|
+
} = _ref;
|
|
224
|
+
const semanticProps = getSemanticProps({
|
|
225
|
+
options,
|
|
226
|
+
uiSchema,
|
|
227
|
+
formContext,
|
|
228
|
+
defaultSchemaProps: {
|
|
229
|
+
horizontalButtons: false,
|
|
230
|
+
wrapItem: false
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
const {
|
|
234
|
+
horizontalButtons,
|
|
235
|
+
wrapItem
|
|
236
|
+
} = semanticProps;
|
|
237
|
+
const itemProps = {
|
|
238
|
+
horizontalButtons,
|
|
239
|
+
wrapItem
|
|
240
|
+
};
|
|
241
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
242
|
+
const ArrayFieldDescriptionTemplate = utils.getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
|
|
243
|
+
const ArrayFieldItemTemplate = utils.getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
|
|
244
|
+
const ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions); // Button templates are not overridden in the uiSchema
|
|
245
|
+
|
|
246
|
+
const {
|
|
247
|
+
ButtonTemplates: {
|
|
248
|
+
AddButton
|
|
249
|
+
}
|
|
250
|
+
} = registry.templates;
|
|
251
|
+
const fieldTitle = uiOptions.title || title;
|
|
252
|
+
const fieldDescription = uiOptions.description || schema.description;
|
|
253
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
254
|
+
className: cleanClassNames([className, classNames, utils.isFixedItems(schema) ? "" : "sortable-form-fields"])
|
|
255
|
+
}, /*#__PURE__*/React.createElement(ArrayFieldTitleTemplate, {
|
|
322
256
|
idSchema: idSchema,
|
|
323
|
-
uiSchema: uiSchema,
|
|
324
257
|
title: fieldTitle,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
258
|
+
uiSchema: uiSchema,
|
|
259
|
+
required: required,
|
|
260
|
+
registry: registry
|
|
261
|
+
}), fieldDescription && /*#__PURE__*/React.createElement(ArrayFieldDescriptionTemplate, {
|
|
329
262
|
idSchema: idSchema,
|
|
330
|
-
description: fieldDescription
|
|
331
|
-
|
|
263
|
+
description: fieldDescription,
|
|
264
|
+
uiSchema: uiSchema,
|
|
265
|
+
registry: registry
|
|
266
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
332
267
|
key: "array-item-list-" + idSchema.$id
|
|
333
|
-
}, React.createElement("div", {
|
|
268
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
334
269
|
className: "row array-item-list"
|
|
335
|
-
}, items && items.map(
|
|
336
|
-
return DefaultArrayItem(_extends({}, p, itemProps));
|
|
337
|
-
})), canAdd && React.createElement("div", {
|
|
270
|
+
}, items && items.map(props => /*#__PURE__*/React.createElement(ArrayFieldItemTemplate, _extends({}, props, itemProps)))), canAdd && /*#__PURE__*/React.createElement("div", {
|
|
338
271
|
style: {
|
|
339
272
|
marginTop: "1rem",
|
|
340
273
|
position: "relative",
|
|
341
274
|
textAlign: "right"
|
|
342
275
|
}
|
|
343
|
-
}, React.createElement(AddButton, {
|
|
276
|
+
}, /*#__PURE__*/React.createElement(AddButton, {
|
|
344
277
|
onClick: onAddClick,
|
|
345
278
|
disabled: disabled || readOnly
|
|
346
279
|
}))));
|
|
347
280
|
}
|
|
348
281
|
|
|
349
|
-
function
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
282
|
+
function BaseInputTemplate(props) {
|
|
283
|
+
const {
|
|
284
|
+
id,
|
|
285
|
+
placeholder,
|
|
286
|
+
name,
|
|
287
|
+
label,
|
|
288
|
+
value,
|
|
289
|
+
required,
|
|
290
|
+
readonly,
|
|
291
|
+
disabled,
|
|
292
|
+
onChange,
|
|
293
|
+
onBlur,
|
|
294
|
+
onFocus,
|
|
295
|
+
autofocus,
|
|
296
|
+
options,
|
|
297
|
+
schema,
|
|
298
|
+
uiSchema,
|
|
299
|
+
formContext,
|
|
300
|
+
type,
|
|
301
|
+
registry,
|
|
302
|
+
rawErrors = []
|
|
303
|
+
} = props;
|
|
304
|
+
const inputProps = utils.getInputProps(schema, type, options);
|
|
305
|
+
const semanticProps = getSemanticProps({
|
|
306
|
+
uiSchema,
|
|
307
|
+
formContext,
|
|
308
|
+
options
|
|
362
309
|
});
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
310
|
+
const {
|
|
311
|
+
schemaUtils
|
|
312
|
+
} = registry; // eslint-disable-next-line no-shadow
|
|
313
|
+
|
|
314
|
+
const _onChange = _ref => {
|
|
315
|
+
let {
|
|
316
|
+
target: {
|
|
317
|
+
value
|
|
318
|
+
}
|
|
319
|
+
} = _ref;
|
|
320
|
+
return onChange(value === "" ? options.emptyValue : value);
|
|
368
321
|
};
|
|
369
322
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}));
|
|
374
|
-
}
|
|
323
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
324
|
+
|
|
325
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
375
326
|
|
|
376
|
-
|
|
377
|
-
|
|
327
|
+
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
328
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Form.Input, _extends({
|
|
329
|
+
key: id,
|
|
330
|
+
id: id,
|
|
331
|
+
placeholder: placeholder
|
|
332
|
+
}, inputProps, {
|
|
333
|
+
label: displayLabel ? label || schema.title : false,
|
|
334
|
+
required: required,
|
|
335
|
+
autoFocus: autofocus,
|
|
336
|
+
disabled: disabled || readonly,
|
|
337
|
+
name: name
|
|
338
|
+
}, semanticProps, {
|
|
339
|
+
value: value || value === 0 ? value : "",
|
|
340
|
+
error: rawErrors.length > 0,
|
|
341
|
+
onChange: _onChange,
|
|
342
|
+
onBlur: _onBlur,
|
|
343
|
+
onFocus: _onFocus
|
|
378
344
|
}));
|
|
379
345
|
}
|
|
380
346
|
|
|
347
|
+
/* eslint-disable react/prop-types */
|
|
348
|
+
|
|
349
|
+
function DescriptionField(_ref) {
|
|
350
|
+
let {
|
|
351
|
+
className,
|
|
352
|
+
description,
|
|
353
|
+
id
|
|
354
|
+
} = _ref;
|
|
355
|
+
|
|
356
|
+
if (description) {
|
|
357
|
+
return /*#__PURE__*/React.createElement("p", {
|
|
358
|
+
id: id,
|
|
359
|
+
className: className || "sui-description"
|
|
360
|
+
}, description);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
381
364
|
/* eslint-disable react/no-array-index-key */
|
|
382
365
|
/**
|
|
383
366
|
*
|
|
@@ -387,61 +370,59 @@ function ArrayFieldTemplate(props) {
|
|
|
387
370
|
*/
|
|
388
371
|
|
|
389
372
|
function ErrorList(_ref) {
|
|
390
|
-
|
|
391
|
-
|
|
373
|
+
let {
|
|
374
|
+
errors
|
|
375
|
+
} = _ref;
|
|
376
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Message, {
|
|
392
377
|
negative: true
|
|
393
|
-
}, React.createElement(semanticUiReact.Message.Header, null, "Errors"), React.createElement(semanticUiReact.Message.List, null, errors.map(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}, error.stack);
|
|
397
|
-
})));
|
|
378
|
+
}, /*#__PURE__*/React.createElement(semanticUiReact.Message.Header, null, "Errors"), /*#__PURE__*/React.createElement(semanticUiReact.Message.List, null, errors.map((error, index) => /*#__PURE__*/React.createElement(semanticUiReact.Message.Item, {
|
|
379
|
+
key: "error-" + index
|
|
380
|
+
}, error.stack))));
|
|
398
381
|
}
|
|
399
382
|
|
|
400
383
|
ErrorList.propTypes = {
|
|
401
384
|
errors: PropTypes.array
|
|
402
385
|
};
|
|
403
386
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function TitleField(_ref) {
|
|
418
|
-
var title = _ref.title,
|
|
419
|
-
options = _ref.options;
|
|
420
|
-
var semantic = options.semantic;
|
|
421
|
-
|
|
422
|
-
if (title) {
|
|
423
|
-
return React.createElement(semanticUiReact.Header, _extends({}, semantic, {
|
|
424
|
-
as: "h5"
|
|
425
|
-
}), title);
|
|
426
|
-
}
|
|
387
|
+
function IconButton(props) {
|
|
388
|
+
const {
|
|
389
|
+
icon,
|
|
390
|
+
iconType,
|
|
391
|
+
className,
|
|
392
|
+
...otherProps
|
|
393
|
+
} = props;
|
|
394
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Button, _extends({
|
|
395
|
+
icon: icon,
|
|
396
|
+
size: iconType,
|
|
397
|
+
className: className
|
|
398
|
+
}, otherProps));
|
|
427
399
|
}
|
|
428
400
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
inverted: false,
|
|
433
|
-
dividing: true
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
TitleField.propTypes = {
|
|
438
|
-
options: PropTypes.object
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
var Fields = {
|
|
442
|
-
DescriptionField: DescriptionField,
|
|
443
|
-
TitleField: TitleField
|
|
401
|
+
IconButton.propTypes = {
|
|
402
|
+
icon: PropTypes.string.isRequired,
|
|
403
|
+
className: PropTypes.string
|
|
444
404
|
};
|
|
405
|
+
function MoveDownButton(props) {
|
|
406
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
407
|
+
title: "Move down"
|
|
408
|
+
}, props, {
|
|
409
|
+
icon: "angle down"
|
|
410
|
+
}));
|
|
411
|
+
}
|
|
412
|
+
function MoveUpButton(props) {
|
|
413
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
414
|
+
title: "Move up"
|
|
415
|
+
}, props, {
|
|
416
|
+
icon: "angle up"
|
|
417
|
+
}));
|
|
418
|
+
}
|
|
419
|
+
function RemoveButton(props) {
|
|
420
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
421
|
+
title: "Remove"
|
|
422
|
+
}, props, {
|
|
423
|
+
icon: "trash"
|
|
424
|
+
}));
|
|
425
|
+
}
|
|
445
426
|
|
|
446
427
|
/* eslint-disable react/prop-types */
|
|
447
428
|
/**
|
|
@@ -449,11 +430,13 @@ var Fields = {
|
|
|
449
430
|
*/
|
|
450
431
|
|
|
451
432
|
function HelpField(_ref) {
|
|
452
|
-
|
|
453
|
-
|
|
433
|
+
let {
|
|
434
|
+
helpText,
|
|
435
|
+
id
|
|
436
|
+
} = _ref;
|
|
454
437
|
|
|
455
438
|
if (helpText) {
|
|
456
|
-
return React.createElement(semanticUiReact.Message, {
|
|
439
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Message, {
|
|
457
440
|
size: "mini",
|
|
458
441
|
info: true,
|
|
459
442
|
id: id,
|
|
@@ -480,25 +463,27 @@ HelpField.propTypes = {
|
|
|
480
463
|
*/
|
|
481
464
|
|
|
482
465
|
function RawErrors(_ref) {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
466
|
+
let {
|
|
467
|
+
errors,
|
|
468
|
+
options
|
|
469
|
+
} = _ref;
|
|
470
|
+
const {
|
|
471
|
+
pointing,
|
|
472
|
+
size
|
|
473
|
+
} = options;
|
|
487
474
|
|
|
488
475
|
if (errors && errors.length > 0) {
|
|
489
|
-
return React.createElement(semanticUiReact.Label, {
|
|
476
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Label, {
|
|
490
477
|
color: "red",
|
|
491
478
|
pointing: pointing || "above",
|
|
492
479
|
size: size || "small",
|
|
493
480
|
basic: true
|
|
494
|
-
}, React.createElement(semanticUiReact.List, {
|
|
481
|
+
}, /*#__PURE__*/React.createElement(semanticUiReact.List, {
|
|
495
482
|
bulleted: true
|
|
496
|
-
}, errors.map(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
});
|
|
501
|
-
})));
|
|
483
|
+
}, errors.map(error => /*#__PURE__*/React.createElement(semanticUiReact.List.Item, {
|
|
484
|
+
key: nanoid.nanoid(),
|
|
485
|
+
content: error
|
|
486
|
+
}))));
|
|
502
487
|
}
|
|
503
488
|
|
|
504
489
|
return null;
|
|
@@ -515,47 +500,56 @@ RawErrors.propTypes = {
|
|
|
515
500
|
errors: PropTypes.array
|
|
516
501
|
};
|
|
517
502
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
503
|
+
const WrapIfAdditional = _ref => {
|
|
504
|
+
let {
|
|
505
|
+
children,
|
|
506
|
+
classNames,
|
|
507
|
+
disabled,
|
|
508
|
+
formContext,
|
|
509
|
+
id,
|
|
510
|
+
label,
|
|
511
|
+
onDropPropertyClick,
|
|
512
|
+
onKeyChange,
|
|
513
|
+
readonly,
|
|
514
|
+
required,
|
|
515
|
+
schema,
|
|
516
|
+
registry
|
|
517
|
+
} = _ref;
|
|
518
|
+
const {
|
|
519
|
+
RemoveButton
|
|
520
|
+
} = registry.templates.ButtonTemplates;
|
|
521
|
+
const {
|
|
522
|
+
readonlyAsDisabled = true,
|
|
523
|
+
wrapperStyle
|
|
524
|
+
} = formContext;
|
|
525
|
+
const keyLabel = label + " Key"; // i18n ?
|
|
526
|
+
|
|
527
|
+
const additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
538
528
|
|
|
539
529
|
if (!additional) {
|
|
540
|
-
return React.createElement(
|
|
530
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
531
|
+
className: classNames
|
|
532
|
+
}, children);
|
|
541
533
|
}
|
|
542
534
|
|
|
543
|
-
|
|
544
|
-
|
|
535
|
+
const handleBlur = _ref2 => {
|
|
536
|
+
let {
|
|
537
|
+
target
|
|
538
|
+
} = _ref2;
|
|
545
539
|
return onKeyChange(target.value);
|
|
546
540
|
};
|
|
547
541
|
|
|
548
|
-
return React.createElement("div", {
|
|
542
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
549
543
|
className: classNames,
|
|
550
544
|
key: id + "-key"
|
|
551
|
-
}, React.createElement(semanticUiReact.Grid, {
|
|
545
|
+
}, /*#__PURE__*/React.createElement(semanticUiReact.Grid, {
|
|
552
546
|
columns: "equal"
|
|
553
|
-
}, React.createElement(semanticUiReact.Grid.Row, null, React.createElement(semanticUiReact.Grid.Column, {
|
|
547
|
+
}, /*#__PURE__*/React.createElement(semanticUiReact.Grid.Row, null, /*#__PURE__*/React.createElement(semanticUiReact.Grid.Column, {
|
|
554
548
|
className: "form-additional"
|
|
555
|
-
}, React.createElement(semanticUiReact.Form.Group, {
|
|
549
|
+
}, /*#__PURE__*/React.createElement(semanticUiReact.Form.Group, {
|
|
556
550
|
widths: "equal",
|
|
557
551
|
grouped: true
|
|
558
|
-
}, React.createElement(semanticUiReact.Form.Input, {
|
|
552
|
+
}, /*#__PURE__*/React.createElement(semanticUiReact.Form.Input, {
|
|
559
553
|
className: "form-group",
|
|
560
554
|
hasFeedback: true,
|
|
561
555
|
fluid: true,
|
|
@@ -569,159 +563,243 @@ var WrapIfAdditional = function WrapIfAdditional(_ref) {
|
|
|
569
563
|
onBlur: !readonly ? handleBlur : undefined,
|
|
570
564
|
style: wrapperStyle,
|
|
571
565
|
type: "text"
|
|
572
|
-
}))), React.createElement(semanticUiReact.Grid.Column, {
|
|
566
|
+
}))), /*#__PURE__*/React.createElement(semanticUiReact.Grid.Column, {
|
|
573
567
|
className: "form-additional",
|
|
574
568
|
verticalAlign: "middle"
|
|
575
|
-
}, children), React.createElement(semanticUiReact.Grid.Column, null, React.createElement(
|
|
576
|
-
|
|
577
|
-
icon: "trash",
|
|
569
|
+
}, children), /*#__PURE__*/React.createElement(semanticUiReact.Grid.Column, null, /*#__PURE__*/React.createElement(RemoveButton, {
|
|
570
|
+
iconType: "mini",
|
|
578
571
|
className: "array-item-remove",
|
|
579
|
-
tabIndex: "-1",
|
|
580
572
|
disabled: disabled || readonly,
|
|
581
573
|
onClick: onDropPropertyClick(label)
|
|
582
574
|
})))));
|
|
583
575
|
};
|
|
584
576
|
|
|
585
577
|
function FieldTemplate(_ref) {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
578
|
+
let {
|
|
579
|
+
id,
|
|
580
|
+
children,
|
|
581
|
+
className,
|
|
582
|
+
// pass className for styling libs (like styled-components)
|
|
583
|
+
classNames,
|
|
584
|
+
displayLabel,
|
|
585
|
+
label,
|
|
586
|
+
rawErrors = [],
|
|
587
|
+
rawHelp,
|
|
588
|
+
hidden,
|
|
589
|
+
rawDescription,
|
|
590
|
+
registry,
|
|
591
|
+
uiSchema,
|
|
592
|
+
...props
|
|
593
|
+
} = _ref;
|
|
594
|
+
const semanticProps = getSemanticProps(props);
|
|
595
|
+
const {
|
|
596
|
+
wrapLabel,
|
|
597
|
+
wrapContent
|
|
598
|
+
} = semanticProps;
|
|
599
|
+
const errorOptions = getSemanticErrorProps(props);
|
|
600
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
601
|
+
const DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
|
|
602
602
|
|
|
603
603
|
if (hidden) {
|
|
604
|
-
return
|
|
604
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
605
|
+
style: {
|
|
606
|
+
display: "none"
|
|
607
|
+
}
|
|
608
|
+
}, children);
|
|
605
609
|
}
|
|
606
610
|
|
|
607
|
-
return React.createElement(WrapIfAdditional, _extends({
|
|
611
|
+
return /*#__PURE__*/React.createElement(WrapIfAdditional, _extends({
|
|
608
612
|
classNames: classNames,
|
|
609
613
|
id: id,
|
|
610
|
-
label: label
|
|
611
|
-
|
|
614
|
+
label: label,
|
|
615
|
+
registry: registry
|
|
616
|
+
}, props), /*#__PURE__*/React.createElement(semanticUiReact.Form.Group, {
|
|
612
617
|
key: id,
|
|
613
618
|
widths: "equal",
|
|
614
619
|
grouped: true
|
|
615
|
-
}, React.createElement(MaybeWrap, {
|
|
620
|
+
}, /*#__PURE__*/React.createElement(MaybeWrap, {
|
|
616
621
|
wrap: wrapContent,
|
|
617
622
|
className: "sui-field-content"
|
|
618
|
-
}, children, displayLabel && rawDescription && React.createElement(MaybeWrap, {
|
|
623
|
+
}, children, displayLabel && rawDescription && /*#__PURE__*/React.createElement(MaybeWrap, {
|
|
619
624
|
wrap: wrapLabel,
|
|
620
625
|
className: "sui-field-label"
|
|
621
|
-
}, rawDescription && React.createElement(
|
|
626
|
+
}, rawDescription && /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
|
|
627
|
+
id: id + "-description",
|
|
622
628
|
description: rawDescription
|
|
623
|
-
})), React.createElement(HelpField, {
|
|
629
|
+
})), /*#__PURE__*/React.createElement(HelpField, {
|
|
624
630
|
helpText: rawHelp,
|
|
625
631
|
id: id + "__help"
|
|
626
|
-
}), React.createElement(RawErrors, {
|
|
632
|
+
}), /*#__PURE__*/React.createElement(RawErrors, {
|
|
627
633
|
errors: rawErrors,
|
|
628
634
|
options: errorOptions
|
|
629
635
|
}))));
|
|
630
636
|
}
|
|
631
637
|
|
|
632
638
|
/* eslint-disable react/prop-types */
|
|
633
|
-
var canExpand = core.utils.canExpand;
|
|
634
639
|
|
|
635
640
|
function ObjectFieldTemplate(_ref) {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
641
|
+
let {
|
|
642
|
+
description,
|
|
643
|
+
onAddClick,
|
|
644
|
+
title,
|
|
645
|
+
properties,
|
|
646
|
+
disabled,
|
|
647
|
+
readOnly,
|
|
648
|
+
required,
|
|
649
|
+
uiSchema,
|
|
650
|
+
schema,
|
|
651
|
+
formData,
|
|
652
|
+
idSchema,
|
|
653
|
+
registry
|
|
654
|
+
} = _ref;
|
|
655
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
656
|
+
const TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, uiOptions);
|
|
657
|
+
const DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions); // Button templates are not overridden in the uiSchema
|
|
658
|
+
|
|
659
|
+
const {
|
|
660
|
+
ButtonTemplates: {
|
|
661
|
+
AddButton
|
|
662
|
+
}
|
|
663
|
+
} = registry.templates;
|
|
664
|
+
const fieldTitle = uiOptions.title || title;
|
|
665
|
+
const fieldDescription = uiOptions.description || description;
|
|
666
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, fieldTitle && /*#__PURE__*/React.createElement(TitleFieldTemplate, {
|
|
652
667
|
id: idSchema.$id + "-title",
|
|
653
668
|
title: fieldTitle,
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
669
|
+
required: required,
|
|
670
|
+
uiSchema: uiSchema,
|
|
671
|
+
registry: registry
|
|
672
|
+
}), fieldDescription && /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
|
|
657
673
|
id: idSchema.$id + "-description",
|
|
658
|
-
description: fieldDescription
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}), canExpand(schema, uiSchema, formData) && React.createElement(semanticUiReact.Grid.Column, {
|
|
674
|
+
description: fieldDescription,
|
|
675
|
+
registry: registry
|
|
676
|
+
}), properties.map(prop => prop.content), utils.canExpand(schema, uiSchema, formData) && /*#__PURE__*/React.createElement(semanticUiReact.Grid.Column, {
|
|
662
677
|
width: 16,
|
|
663
678
|
verticalAlign: "middle"
|
|
664
|
-
}, React.createElement(semanticUiReact.Grid.Row, null, React.createElement("div", {
|
|
679
|
+
}, /*#__PURE__*/React.createElement(semanticUiReact.Grid.Row, null, /*#__PURE__*/React.createElement("div", {
|
|
665
680
|
style: {
|
|
666
681
|
marginTop: "1rem",
|
|
667
682
|
position: "relative",
|
|
668
683
|
textAlign: "right"
|
|
669
684
|
}
|
|
670
|
-
}, React.createElement(AddButton, {
|
|
685
|
+
}, /*#__PURE__*/React.createElement(AddButton, {
|
|
671
686
|
onClick: onAddClick(schema),
|
|
672
687
|
disabled: disabled || readOnly
|
|
673
688
|
})))));
|
|
674
689
|
}
|
|
675
690
|
|
|
676
|
-
var
|
|
691
|
+
var SubmitButton = (_ref => {
|
|
692
|
+
let {
|
|
693
|
+
uiSchema
|
|
694
|
+
} = _ref;
|
|
695
|
+
const {
|
|
696
|
+
submitText,
|
|
697
|
+
norender,
|
|
698
|
+
props: submitButtonProps
|
|
699
|
+
} = utils.getSubmitButtonOptions(uiSchema);
|
|
700
|
+
|
|
701
|
+
if (norender) {
|
|
702
|
+
return null;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Button, _extends({
|
|
706
|
+
type: "submit",
|
|
707
|
+
primary: true
|
|
708
|
+
}, submitButtonProps), submitText);
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
const DEFAULT_OPTIONS = {
|
|
712
|
+
semantic: {
|
|
713
|
+
inverted: false,
|
|
714
|
+
dividing: true
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
function TitleField(_ref) {
|
|
719
|
+
let {
|
|
720
|
+
id,
|
|
721
|
+
title,
|
|
722
|
+
uiSchema
|
|
723
|
+
} = _ref;
|
|
724
|
+
const uiOptions = utils.getUiOptions(uiSchema);
|
|
725
|
+
const {
|
|
726
|
+
semantic
|
|
727
|
+
} = uiOptions.options || DEFAULT_OPTIONS;
|
|
728
|
+
|
|
729
|
+
if (title) {
|
|
730
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Header, _extends({
|
|
731
|
+
id: id
|
|
732
|
+
}, semantic, {
|
|
733
|
+
as: "h5"
|
|
734
|
+
}), title);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
var Templates = {
|
|
739
|
+
ArrayFieldItemTemplate,
|
|
740
|
+
ArrayFieldTemplate,
|
|
741
|
+
BaseInputTemplate,
|
|
742
|
+
ButtonTemplates: {
|
|
743
|
+
AddButton,
|
|
744
|
+
MoveDownButton,
|
|
745
|
+
MoveUpButton,
|
|
746
|
+
RemoveButton,
|
|
747
|
+
SubmitButton
|
|
748
|
+
},
|
|
749
|
+
DescriptionFieldTemplate: DescriptionField,
|
|
750
|
+
ErrorListTemplate: ErrorList,
|
|
751
|
+
FieldTemplate,
|
|
752
|
+
ObjectFieldTemplate,
|
|
753
|
+
TitleFieldTemplate: TitleField
|
|
754
|
+
};
|
|
677
755
|
|
|
678
756
|
function CheckboxWidget(props) {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
757
|
+
const {
|
|
758
|
+
id,
|
|
759
|
+
value,
|
|
760
|
+
required,
|
|
761
|
+
disabled,
|
|
762
|
+
readonly,
|
|
763
|
+
label,
|
|
764
|
+
autofocus,
|
|
765
|
+
onChange,
|
|
766
|
+
onBlur,
|
|
767
|
+
options,
|
|
768
|
+
onFocus,
|
|
769
|
+
formContext,
|
|
770
|
+
schema,
|
|
771
|
+
uiSchema,
|
|
772
|
+
registry,
|
|
773
|
+
rawErrors = []
|
|
774
|
+
} = props;
|
|
775
|
+
const semanticProps = getSemanticProps({
|
|
776
|
+
options,
|
|
777
|
+
formContext,
|
|
778
|
+
schema,
|
|
779
|
+
uiSchema,
|
|
698
780
|
defaultSchemaProps: {
|
|
699
781
|
inverted: false
|
|
700
782
|
}
|
|
701
783
|
});
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
784
|
+
const {
|
|
785
|
+
schemaUtils
|
|
786
|
+
} = registry;
|
|
787
|
+
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
705
788
|
|
|
706
|
-
|
|
707
|
-
return onChange && onChange(data.checked);
|
|
708
|
-
};
|
|
789
|
+
const _onChange = (event, data) => onChange && onChange(data.checked);
|
|
709
790
|
|
|
710
|
-
|
|
711
|
-
return onBlur && onBlur(id, value);
|
|
712
|
-
};
|
|
791
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
713
792
|
|
|
714
|
-
|
|
715
|
-
return onFocus && onFocus(id, value);
|
|
716
|
-
};
|
|
793
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
717
794
|
|
|
718
|
-
|
|
719
|
-
return React.createElement(semanticUiReact.Form.Checkbox, _extends({
|
|
795
|
+
const checked = value == "true" || value == true;
|
|
796
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Form.Checkbox, _extends({
|
|
720
797
|
id: id,
|
|
721
798
|
disabled: disabled || readonly,
|
|
722
799
|
autoFocus: autofocus
|
|
723
800
|
}, semanticProps, {
|
|
724
801
|
checked: typeof value === "undefined" ? false : checked,
|
|
802
|
+
error: rawErrors.length > 0,
|
|
725
803
|
onChange: _onChange,
|
|
726
804
|
onBlur: _onBlur,
|
|
727
805
|
onFocus: _onFocus,
|
|
@@ -731,89 +809,100 @@ function CheckboxWidget(props) {
|
|
|
731
809
|
}
|
|
732
810
|
|
|
733
811
|
function selectValue(value, selected, all) {
|
|
734
|
-
|
|
735
|
-
|
|
812
|
+
const at = all.indexOf(value);
|
|
813
|
+
const updated = selected.slice(0, at).concat(value, selected.slice(at)); // As inserting values at predefined index positions doesn't work with empty
|
|
736
814
|
// arrays, we need to reorder the updated selection to match the initial order
|
|
737
815
|
|
|
738
|
-
return updated.sort(
|
|
739
|
-
return all.indexOf(a) > all.indexOf(b);
|
|
740
|
-
});
|
|
816
|
+
return updated.sort((a, b) => all.indexOf(a) > all.indexOf(b));
|
|
741
817
|
}
|
|
742
818
|
|
|
743
819
|
function deselectValue(value, selected) {
|
|
744
|
-
return selected.filter(
|
|
745
|
-
return v !== value;
|
|
746
|
-
});
|
|
820
|
+
return selected.filter(v => v !== value);
|
|
747
821
|
}
|
|
748
822
|
|
|
749
823
|
function CheckboxesWidget(props) {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
824
|
+
const {
|
|
825
|
+
id,
|
|
826
|
+
disabled,
|
|
827
|
+
options,
|
|
828
|
+
value,
|
|
829
|
+
autofocus,
|
|
830
|
+
readonly,
|
|
831
|
+
onChange,
|
|
832
|
+
onBlur,
|
|
833
|
+
onFocus,
|
|
834
|
+
formContext,
|
|
835
|
+
schema,
|
|
836
|
+
uiSchema,
|
|
837
|
+
rawErrors = [],
|
|
838
|
+
registry
|
|
839
|
+
} = props;
|
|
840
|
+
const TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, options);
|
|
841
|
+
const {
|
|
842
|
+
enumOptions,
|
|
843
|
+
enumDisabled,
|
|
844
|
+
inline
|
|
845
|
+
} = options;
|
|
846
|
+
const {
|
|
847
|
+
title
|
|
848
|
+
} = schema;
|
|
849
|
+
const semanticProps = getSemanticProps({
|
|
850
|
+
options,
|
|
851
|
+
formContext,
|
|
852
|
+
schema,
|
|
853
|
+
uiSchema,
|
|
771
854
|
defaultSchemaProps: {
|
|
772
855
|
inverted: false
|
|
773
856
|
}
|
|
774
857
|
});
|
|
775
858
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
var all = enumOptions.map(function (_ref2) {
|
|
781
|
-
var value = _ref2.value;
|
|
782
|
-
return value;
|
|
783
|
-
});
|
|
784
|
-
|
|
785
|
-
if (checked) {
|
|
786
|
-
onChange(selectValue(option.value, value, all));
|
|
787
|
-
} else {
|
|
788
|
-
onChange(deselectValue(option.value, value));
|
|
859
|
+
const _onChange = option => _ref => {
|
|
860
|
+
let {
|
|
861
|
+
target: {
|
|
862
|
+
checked
|
|
789
863
|
}
|
|
790
|
-
};
|
|
791
|
-
|
|
864
|
+
} = _ref;
|
|
865
|
+
// eslint-disable-next-line no-shadow
|
|
866
|
+
const all = enumOptions.map(_ref2 => {
|
|
867
|
+
let {
|
|
868
|
+
value
|
|
869
|
+
} = _ref2;
|
|
870
|
+
return value;
|
|
871
|
+
});
|
|
792
872
|
|
|
793
|
-
|
|
794
|
-
|
|
873
|
+
if (checked) {
|
|
874
|
+
onChange(selectValue(option.value, value, all));
|
|
875
|
+
} else {
|
|
876
|
+
onChange(deselectValue(option.value, value));
|
|
877
|
+
}
|
|
795
878
|
};
|
|
796
879
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
880
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
881
|
+
|
|
882
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
800
883
|
|
|
801
|
-
|
|
884
|
+
const inlineOption = inline ? {
|
|
802
885
|
inline: true
|
|
803
886
|
} : {
|
|
804
887
|
grouped: true
|
|
805
888
|
};
|
|
806
|
-
return React.createElement(React.Fragment, null, title && React.createElement(
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
889
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, title && /*#__PURE__*/React.createElement(TitleFieldTemplate, {
|
|
890
|
+
id: id + "-title",
|
|
891
|
+
title: title,
|
|
892
|
+
uiSchema: uiSchema,
|
|
893
|
+
registry: registry
|
|
894
|
+
}), /*#__PURE__*/React.createElement(semanticUiReact.Form.Group, _extends({
|
|
895
|
+
id: id
|
|
896
|
+
}, inlineOption), enumOptions.map((option, index) => {
|
|
897
|
+
const checked = value.indexOf(option.value) !== -1;
|
|
898
|
+
const itemDisabled = enumDisabled && enumDisabled.indexOf(option.value) !== -1;
|
|
899
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Form.Checkbox, _extends({
|
|
812
900
|
id: id + "_" + index,
|
|
813
901
|
key: id + "_" + index,
|
|
814
902
|
label: option.label
|
|
815
903
|
}, semanticProps, {
|
|
816
904
|
checked: checked,
|
|
905
|
+
error: rawErrors.length > 0,
|
|
817
906
|
disabled: disabled || itemDisabled || readonly,
|
|
818
907
|
autoFocus: autofocus && index === 0,
|
|
819
908
|
onChange: _onChange(option),
|
|
@@ -823,116 +912,60 @@ function CheckboxesWidget(props) {
|
|
|
823
912
|
})));
|
|
824
913
|
}
|
|
825
914
|
|
|
826
|
-
var getDisplayLabel$1 = core.utils.getDisplayLabel;
|
|
827
|
-
|
|
828
|
-
function PasswordWidget(props) {
|
|
829
|
-
var id = props.id,
|
|
830
|
-
required = props.required,
|
|
831
|
-
readonly = props.readonly,
|
|
832
|
-
disabled = props.disabled,
|
|
833
|
-
label = props.label,
|
|
834
|
-
name = props.name,
|
|
835
|
-
value = props.value,
|
|
836
|
-
onChange = props.onChange,
|
|
837
|
-
onBlur = props.onBlur,
|
|
838
|
-
onFocus = props.onFocus,
|
|
839
|
-
autofocus = props.autofocus,
|
|
840
|
-
options = props.options,
|
|
841
|
-
schema = props.schema,
|
|
842
|
-
uiSchema = props.uiSchema,
|
|
843
|
-
formContext = props.formContext;
|
|
844
|
-
var semanticProps = getSemanticProps({
|
|
845
|
-
schema: schema,
|
|
846
|
-
uiSchema: uiSchema,
|
|
847
|
-
formContext: formContext,
|
|
848
|
-
options: options
|
|
849
|
-
}); // eslint-disable-next-line no-shadow
|
|
850
|
-
|
|
851
|
-
var _onChange = function _onChange(_ref) {
|
|
852
|
-
var value = _ref.target.value;
|
|
853
|
-
return onChange && onChange(value === "" ? options.emptyValue : value);
|
|
854
|
-
};
|
|
855
|
-
|
|
856
|
-
var _onBlur = function _onBlur() {
|
|
857
|
-
return onBlur && onBlur(id, value);
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
var _onFocus = function _onFocus() {
|
|
861
|
-
return onFocus && onFocus(id, value);
|
|
862
|
-
};
|
|
863
|
-
|
|
864
|
-
var displayLabel = getDisplayLabel$1(schema, uiSchema
|
|
865
|
-
/* TODO: , rootSchema */
|
|
866
|
-
);
|
|
867
|
-
return React.createElement(semanticUiReact.Form.Input, _extends({
|
|
868
|
-
id: id,
|
|
869
|
-
key: id,
|
|
870
|
-
label: displayLabel ? label || schema.title : false,
|
|
871
|
-
autoFocus: autofocus,
|
|
872
|
-
required: required,
|
|
873
|
-
disabled: disabled || readonly,
|
|
874
|
-
name: name
|
|
875
|
-
}, semanticProps, {
|
|
876
|
-
type: "password",
|
|
877
|
-
value: value || "",
|
|
878
|
-
onChange: _onChange,
|
|
879
|
-
onBlur: _onBlur,
|
|
880
|
-
onFocus: _onFocus
|
|
881
|
-
}));
|
|
882
|
-
}
|
|
883
|
-
|
|
884
915
|
function RadioWidget(props) {
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
916
|
+
const {
|
|
917
|
+
id,
|
|
918
|
+
value,
|
|
919
|
+
required,
|
|
920
|
+
disabled,
|
|
921
|
+
readonly,
|
|
922
|
+
onChange,
|
|
923
|
+
onBlur,
|
|
924
|
+
onFocus,
|
|
925
|
+
schema,
|
|
926
|
+
options,
|
|
927
|
+
formContext,
|
|
928
|
+
uiSchema,
|
|
929
|
+
rawErrors = []
|
|
930
|
+
} = props;
|
|
931
|
+
const {
|
|
932
|
+
enumOptions,
|
|
933
|
+
enumDisabled
|
|
934
|
+
} = options;
|
|
935
|
+
const semanticProps = getSemanticProps({
|
|
936
|
+
formContext,
|
|
937
|
+
options,
|
|
938
|
+
uiSchema
|
|
905
939
|
}); // eslint-disable-next-line no-shadow
|
|
906
940
|
|
|
907
|
-
|
|
908
|
-
|
|
941
|
+
const _onChange = (event, _ref) => {
|
|
942
|
+
let {
|
|
943
|
+
value: eventValue
|
|
944
|
+
} = _ref;
|
|
909
945
|
return onChange && onChange(schema.type === "boolean" ? eventValue !== "false" : eventValue);
|
|
910
946
|
};
|
|
911
947
|
|
|
912
|
-
|
|
913
|
-
return onBlur && onBlur(id, value);
|
|
914
|
-
};
|
|
948
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
915
949
|
|
|
916
|
-
|
|
917
|
-
return onFocus && onFocus(id, value);
|
|
918
|
-
};
|
|
950
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
919
951
|
|
|
920
|
-
|
|
952
|
+
const inlineOption = options.inline ? {
|
|
921
953
|
inline: true
|
|
922
954
|
} : {
|
|
923
955
|
grouped: true
|
|
924
956
|
};
|
|
925
|
-
return React.createElement(semanticUiReact.Form.Group, inlineOption, enumOptions.map(
|
|
926
|
-
|
|
927
|
-
return React.createElement(semanticUiReact.Form.Field, _extends({
|
|
957
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Form.Group, inlineOption, enumOptions.map((option, i) => {
|
|
958
|
+
const itemDisabled = enumDisabled && enumDisabled.indexOf(option.value) !== -1;
|
|
959
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Form.Field, _extends({
|
|
928
960
|
required: required,
|
|
929
961
|
control: semanticUiReact.Radio,
|
|
930
|
-
name:
|
|
962
|
+
name: id + "-radio-" + option.value
|
|
931
963
|
}, semanticProps, {
|
|
932
964
|
onFocus: _onFocus,
|
|
933
965
|
onBlur: _onBlur,
|
|
934
966
|
label: "" + option.label,
|
|
935
967
|
value: "" + option.value,
|
|
968
|
+
error: rawErrors.length > 0,
|
|
936
969
|
key: option.value + "-" + i,
|
|
937
970
|
checked: value == option.value,
|
|
938
971
|
onChange: _onChange,
|
|
@@ -941,62 +974,61 @@ function RadioWidget(props) {
|
|
|
941
974
|
}));
|
|
942
975
|
}
|
|
943
976
|
|
|
944
|
-
var rangeSpec = core.utils.rangeSpec;
|
|
945
|
-
|
|
946
977
|
function RangeWidget(props) {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
978
|
+
const {
|
|
979
|
+
id,
|
|
980
|
+
name,
|
|
981
|
+
value,
|
|
982
|
+
required,
|
|
983
|
+
readonly,
|
|
984
|
+
disabled,
|
|
985
|
+
onChange,
|
|
986
|
+
onBlur,
|
|
987
|
+
onFocus,
|
|
988
|
+
options,
|
|
989
|
+
schema,
|
|
990
|
+
uiSchema,
|
|
991
|
+
formContext,
|
|
992
|
+
rawErrors = []
|
|
993
|
+
} = props;
|
|
994
|
+
const semanticProps = getSemanticProps({
|
|
995
|
+
formContext,
|
|
996
|
+
options,
|
|
997
|
+
uiSchema,
|
|
964
998
|
defaultSchemaProps: {
|
|
965
999
|
fluid: true
|
|
966
1000
|
}
|
|
967
1001
|
}); // eslint-disable-next-line no-shadow
|
|
968
1002
|
|
|
969
|
-
|
|
970
|
-
|
|
1003
|
+
const _onChange = _ref => {
|
|
1004
|
+
let {
|
|
1005
|
+
target: {
|
|
1006
|
+
value
|
|
1007
|
+
}
|
|
1008
|
+
} = _ref;
|
|
971
1009
|
return onChange && onChange(value === "" ? options.emptyValue : value);
|
|
972
1010
|
};
|
|
973
1011
|
|
|
974
|
-
|
|
975
|
-
return onBlur && onBlur(id, value);
|
|
976
|
-
};
|
|
1012
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
977
1013
|
|
|
978
|
-
|
|
979
|
-
return onFocus && onFocus(id, value);
|
|
980
|
-
};
|
|
1014
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
981
1015
|
|
|
982
|
-
return React.createElement(React.Fragment, null, React.createElement(semanticUiReact.Input, _extends({
|
|
1016
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(semanticUiReact.Input, _extends({
|
|
983
1017
|
id: id,
|
|
984
1018
|
key: id,
|
|
985
1019
|
name: name,
|
|
986
1020
|
type: "range",
|
|
987
1021
|
required: required,
|
|
988
1022
|
disabled: disabled || readonly
|
|
989
|
-
}, rangeSpec(schema), semanticProps, {
|
|
1023
|
+
}, utils.rangeSpec(schema), semanticProps, {
|
|
990
1024
|
value: value || "",
|
|
1025
|
+
error: rawErrors.length > 0,
|
|
991
1026
|
onChange: _onChange,
|
|
992
1027
|
onBlur: _onBlur,
|
|
993
1028
|
onFocus: _onFocus
|
|
994
|
-
})), React.createElement("span", null, value));
|
|
1029
|
+
})), /*#__PURE__*/React.createElement("span", null, value));
|
|
995
1030
|
}
|
|
996
1031
|
|
|
997
|
-
var asNumber = core.utils.asNumber,
|
|
998
|
-
guessType = core.utils.guessType;
|
|
999
|
-
var nums = /*#__PURE__*/new Set(["number", "integer"]);
|
|
1000
1032
|
/**
|
|
1001
1033
|
* * Returns and creates an array format required for semantic drop down
|
|
1002
1034
|
* @param {array} enumOptions- array of items for the dropdown
|
|
@@ -1005,82 +1037,50 @@ var nums = /*#__PURE__*/new Set(["number", "integer"]);
|
|
|
1005
1037
|
*/
|
|
1006
1038
|
|
|
1007
1039
|
function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled) {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
options = _.map(enumOptions,
|
|
1012
|
-
|
|
1013
|
-
|
|
1040
|
+
const disabledOptions = enumDisabled || [];
|
|
1041
|
+
let options = []; // eslint-disable-next-line no-shadow
|
|
1042
|
+
|
|
1043
|
+
options = _.map(enumOptions, _ref => {
|
|
1044
|
+
let {
|
|
1045
|
+
label,
|
|
1046
|
+
value
|
|
1047
|
+
} = _ref;
|
|
1014
1048
|
return {
|
|
1015
1049
|
disabled: disabledOptions.indexOf(value) !== -1,
|
|
1016
1050
|
key: label,
|
|
1017
1051
|
text: label,
|
|
1018
|
-
value
|
|
1052
|
+
value
|
|
1019
1053
|
};
|
|
1020
1054
|
});
|
|
1021
1055
|
return options;
|
|
1022
1056
|
}
|
|
1023
|
-
/**
|
|
1024
|
-
* This is a silly limitation in the DOM where option change event values are
|
|
1025
|
-
* always retrieved as strings.
|
|
1026
|
-
*/
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
var processValue = function processValue(schema, value) {
|
|
1030
|
-
// "enum" is a reserved word, so only "type" and "items" can be destructured
|
|
1031
|
-
var type = schema.type,
|
|
1032
|
-
items = schema.items;
|
|
1033
|
-
|
|
1034
|
-
if (value === "") {
|
|
1035
|
-
return undefined;
|
|
1036
|
-
} else if (type === "array" && items && nums.has(items.type)) {
|
|
1037
|
-
return value.map(asNumber);
|
|
1038
|
-
} else if (type === "boolean") {
|
|
1039
|
-
return value === "true" || value === true;
|
|
1040
|
-
} else if (type === "number") {
|
|
1041
|
-
return asNumber(value);
|
|
1042
|
-
} // If type is undefined, but an enum is present, try and infer the type from
|
|
1043
|
-
// the enum values
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
if (schema.enum) {
|
|
1047
|
-
if (schema.enum.every(function (x) {
|
|
1048
|
-
return guessType(x) === "number";
|
|
1049
|
-
})) {
|
|
1050
|
-
return asNumber(value);
|
|
1051
|
-
} else if (schema.enum.every(function (x) {
|
|
1052
|
-
return guessType(x) === "boolean";
|
|
1053
|
-
})) {
|
|
1054
|
-
return value === "true";
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
return value;
|
|
1059
|
-
};
|
|
1060
1057
|
|
|
1061
1058
|
function SelectWidget(props) {
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1059
|
+
const {
|
|
1060
|
+
schema,
|
|
1061
|
+
uiSchema,
|
|
1062
|
+
formContext,
|
|
1063
|
+
id,
|
|
1064
|
+
options,
|
|
1065
|
+
name,
|
|
1066
|
+
label,
|
|
1067
|
+
required,
|
|
1068
|
+
disabled,
|
|
1069
|
+
readonly,
|
|
1070
|
+
value,
|
|
1071
|
+
multiple,
|
|
1072
|
+
placeholder,
|
|
1073
|
+
autofocus,
|
|
1074
|
+
onChange,
|
|
1075
|
+
onBlur,
|
|
1076
|
+
onFocus,
|
|
1077
|
+
rawErrors = []
|
|
1078
|
+
} = props;
|
|
1079
|
+
const semanticProps = getSemanticProps({
|
|
1080
|
+
schema,
|
|
1081
|
+
uiSchema,
|
|
1082
|
+
formContext,
|
|
1083
|
+
options,
|
|
1084
1084
|
defaultSchemaProps: {
|
|
1085
1085
|
inverted: "false",
|
|
1086
1086
|
selection: true,
|
|
@@ -1089,34 +1089,48 @@ function SelectWidget(props) {
|
|
|
1089
1089
|
upward: false
|
|
1090
1090
|
}
|
|
1091
1091
|
});
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1092
|
+
const {
|
|
1093
|
+
enumDisabled,
|
|
1094
|
+
enumOptions
|
|
1095
|
+
} = options;
|
|
1096
|
+
const emptyValue = multiple ? [] : "";
|
|
1097
|
+
const dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
|
|
1098
|
+
|
|
1099
|
+
const _onChange = (event, // eslint-disable-next-line no-shadow
|
|
1100
|
+
_ref2) => {
|
|
1101
|
+
let {
|
|
1102
|
+
value
|
|
1103
|
+
} = _ref2;
|
|
1104
|
+
return onChange && onChange(utils.processSelectValue(schema, value, options));
|
|
1101
1105
|
}; // eslint-disable-next-line no-shadow
|
|
1102
1106
|
|
|
1103
1107
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1108
|
+
const _onBlur = _ref3 => {
|
|
1109
|
+
let {
|
|
1110
|
+
target: {
|
|
1111
|
+
value
|
|
1112
|
+
}
|
|
1113
|
+
} = _ref3;
|
|
1114
|
+
return onBlur && onBlur(id, utils.processSelectValue(schema, value, options));
|
|
1107
1115
|
};
|
|
1108
1116
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1117
|
+
const _onFocus = _ref4 => {
|
|
1118
|
+
let {
|
|
1119
|
+
// eslint-disable-next-line no-shadow
|
|
1120
|
+
target: {
|
|
1121
|
+
value
|
|
1122
|
+
}
|
|
1123
|
+
} = _ref4;
|
|
1124
|
+
return onFocus && onFocus(id, utils.processSelectValue(schema, value, options));
|
|
1112
1125
|
};
|
|
1113
1126
|
|
|
1114
|
-
return React.createElement(semanticUiReact.Form.Dropdown, _extends({
|
|
1127
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Form.Dropdown, _extends({
|
|
1115
1128
|
key: id,
|
|
1116
1129
|
name: name,
|
|
1117
1130
|
label: label || schema.title,
|
|
1118
1131
|
multiple: typeof multiple === "undefined" ? false : multiple,
|
|
1119
1132
|
value: typeof value === "undefined" ? emptyValue : value,
|
|
1133
|
+
error: rawErrors.length > 0,
|
|
1120
1134
|
disabled: disabled,
|
|
1121
1135
|
placeholder: placeholder
|
|
1122
1136
|
}, semanticProps, {
|
|
@@ -1130,50 +1144,53 @@ function SelectWidget(props) {
|
|
|
1130
1144
|
}));
|
|
1131
1145
|
}
|
|
1132
1146
|
|
|
1133
|
-
var getDisplayLabel$2 = core.utils.getDisplayLabel;
|
|
1134
|
-
|
|
1135
1147
|
function TextareaWidget(props) {
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1148
|
+
const {
|
|
1149
|
+
id,
|
|
1150
|
+
placeholder,
|
|
1151
|
+
value,
|
|
1152
|
+
required,
|
|
1153
|
+
disabled,
|
|
1154
|
+
autofocus,
|
|
1155
|
+
label,
|
|
1156
|
+
name,
|
|
1157
|
+
readonly,
|
|
1158
|
+
onBlur,
|
|
1159
|
+
onFocus,
|
|
1160
|
+
onChange,
|
|
1161
|
+
options,
|
|
1162
|
+
schema,
|
|
1163
|
+
uiSchema,
|
|
1164
|
+
formContext,
|
|
1165
|
+
registry,
|
|
1166
|
+
rawErrors = []
|
|
1167
|
+
} = props;
|
|
1168
|
+
const semanticProps = getSemanticProps({
|
|
1169
|
+
formContext,
|
|
1170
|
+
options,
|
|
1155
1171
|
defaultSchemaProps: {
|
|
1156
1172
|
inverted: false
|
|
1157
1173
|
}
|
|
1158
|
-
});
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1174
|
+
});
|
|
1175
|
+
const {
|
|
1176
|
+
schemaUtils
|
|
1177
|
+
} = registry; // eslint-disable-next-line no-shadow
|
|
1178
|
+
|
|
1179
|
+
const _onChange = _ref => {
|
|
1180
|
+
let {
|
|
1181
|
+
target: {
|
|
1182
|
+
value
|
|
1183
|
+
}
|
|
1184
|
+
} = _ref;
|
|
1162
1185
|
return onChange && onChange(value === "" ? options.emptyValue : value);
|
|
1163
1186
|
};
|
|
1164
1187
|
|
|
1165
|
-
|
|
1166
|
-
return onBlur && onBlur(id, value);
|
|
1167
|
-
};
|
|
1188
|
+
const _onBlur = () => onBlur && onBlur(id, value);
|
|
1168
1189
|
|
|
1169
|
-
|
|
1170
|
-
return onFocus && onFocus(id, value);
|
|
1171
|
-
};
|
|
1190
|
+
const _onFocus = () => onFocus && onFocus(id, value);
|
|
1172
1191
|
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
);
|
|
1176
|
-
return React.createElement(semanticUiReact.Form.TextArea, _extends({
|
|
1192
|
+
const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
|
|
1193
|
+
return /*#__PURE__*/React.createElement(semanticUiReact.Form.TextArea, _extends({
|
|
1177
1194
|
id: id,
|
|
1178
1195
|
key: id,
|
|
1179
1196
|
label: displayLabel ? label || schema.title : false,
|
|
@@ -1184,6 +1201,7 @@ function TextareaWidget(props) {
|
|
|
1184
1201
|
name: name
|
|
1185
1202
|
}, semanticProps, {
|
|
1186
1203
|
value: value || "",
|
|
1204
|
+
error: rawErrors.length > 0,
|
|
1187
1205
|
rows: options.rows || 5,
|
|
1188
1206
|
onChange: _onChange,
|
|
1189
1207
|
onBlur: _onBlur,
|
|
@@ -1191,415 +1209,25 @@ function TextareaWidget(props) {
|
|
|
1191
1209
|
}));
|
|
1192
1210
|
}
|
|
1193
1211
|
|
|
1194
|
-
var getDisplayLabel$3 = core.utils.getDisplayLabel;
|
|
1195
|
-
|
|
1196
|
-
function TextWidget(props) {
|
|
1197
|
-
var id = props.id,
|
|
1198
|
-
placeholder = props.placeholder,
|
|
1199
|
-
name = props.name,
|
|
1200
|
-
label = props.label,
|
|
1201
|
-
value = props.value,
|
|
1202
|
-
required = props.required,
|
|
1203
|
-
readonly = props.readonly,
|
|
1204
|
-
disabled = props.disabled,
|
|
1205
|
-
onChange = props.onChange,
|
|
1206
|
-
onBlur = props.onBlur,
|
|
1207
|
-
onFocus = props.onFocus,
|
|
1208
|
-
autofocus = props.autofocus,
|
|
1209
|
-
options = props.options,
|
|
1210
|
-
schema = props.schema,
|
|
1211
|
-
uiSchema = props.uiSchema,
|
|
1212
|
-
formContext = props.formContext;
|
|
1213
|
-
var semanticProps = getSemanticProps({
|
|
1214
|
-
formContext: formContext,
|
|
1215
|
-
options: options,
|
|
1216
|
-
uiSchema: uiSchema
|
|
1217
|
-
}); // eslint-disable-next-line no-shadow
|
|
1218
|
-
|
|
1219
|
-
var _onChange = function _onChange(_ref) {
|
|
1220
|
-
var value = _ref.target.value;
|
|
1221
|
-
return onChange(value === "" ? options.emptyValue : value);
|
|
1222
|
-
};
|
|
1223
|
-
|
|
1224
|
-
var _onBlur = function _onBlur() {
|
|
1225
|
-
return onBlur && onBlur(id, value);
|
|
1226
|
-
};
|
|
1227
|
-
|
|
1228
|
-
var _onFocus = function _onFocus() {
|
|
1229
|
-
return onFocus && onFocus(id, value);
|
|
1230
|
-
};
|
|
1231
|
-
|
|
1232
|
-
var displayLabel = getDisplayLabel$3(schema, uiSchema
|
|
1233
|
-
/* TODO: , rootSchema */
|
|
1234
|
-
);
|
|
1235
|
-
return React.createElement(semanticUiReact.Form.Input, _extends({
|
|
1236
|
-
key: id,
|
|
1237
|
-
id: id,
|
|
1238
|
-
placeholder: placeholder,
|
|
1239
|
-
type: schema.type === 'string' ? 'text' : "" + schema.type,
|
|
1240
|
-
label: displayLabel ? label || schema.title : false,
|
|
1241
|
-
required: required,
|
|
1242
|
-
autoFocus: autofocus,
|
|
1243
|
-
disabled: disabled || readonly,
|
|
1244
|
-
name: name
|
|
1245
|
-
}, semanticProps, {
|
|
1246
|
-
value: value || value === 0 ? value : "",
|
|
1247
|
-
onChange: _onChange,
|
|
1248
|
-
onBlur: _onBlur,
|
|
1249
|
-
onFocus: _onFocus
|
|
1250
|
-
}));
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
var getDisplayLabel$4 = core.utils.getDisplayLabel;
|
|
1254
|
-
|
|
1255
|
-
function UpDownWidget(props) {
|
|
1256
|
-
var id = props.id,
|
|
1257
|
-
name = props.name,
|
|
1258
|
-
label = props.label,
|
|
1259
|
-
value = props.value,
|
|
1260
|
-
required = props.required,
|
|
1261
|
-
readonly = props.readonly,
|
|
1262
|
-
disabled = props.disabled,
|
|
1263
|
-
onChange = props.onChange,
|
|
1264
|
-
onBlur = props.onBlur,
|
|
1265
|
-
onFocus = props.onFocus,
|
|
1266
|
-
autofocus = props.autofocus,
|
|
1267
|
-
options = props.options,
|
|
1268
|
-
schema = props.schema,
|
|
1269
|
-
uiSchema = props.uiSchema,
|
|
1270
|
-
formContext = props.formContext;
|
|
1271
|
-
var semanticProps = getSemanticProps({
|
|
1272
|
-
formContext: formContext,
|
|
1273
|
-
options: options,
|
|
1274
|
-
uiSchema: uiSchema
|
|
1275
|
-
}); // eslint-disable-next-line no-shadow
|
|
1276
|
-
|
|
1277
|
-
var _onChange = function _onChange(_ref) {
|
|
1278
|
-
var value = _ref.target.value;
|
|
1279
|
-
return onChange && onChange(value);
|
|
1280
|
-
};
|
|
1281
|
-
|
|
1282
|
-
var _onBlur = function _onBlur() {
|
|
1283
|
-
return onBlur && onBlur(id, value);
|
|
1284
|
-
};
|
|
1285
|
-
|
|
1286
|
-
var _onFocus = function _onFocus() {
|
|
1287
|
-
return onFocus && onFocus(id, value);
|
|
1288
|
-
};
|
|
1289
|
-
|
|
1290
|
-
var displayLabel = getDisplayLabel$4(schema, uiSchema
|
|
1291
|
-
/* TODO: , rootSchema */
|
|
1292
|
-
);
|
|
1293
|
-
return React.createElement(React.Fragment, null, React.createElement(semanticUiReact.Form.Input, _extends({
|
|
1294
|
-
id: id,
|
|
1295
|
-
key: id,
|
|
1296
|
-
autoFocus: autofocus,
|
|
1297
|
-
required: required,
|
|
1298
|
-
type: "number",
|
|
1299
|
-
label: displayLabel ? label || schema.title : false,
|
|
1300
|
-
disabled: disabled || readonly,
|
|
1301
|
-
name: name
|
|
1302
|
-
}, semanticProps, {
|
|
1303
|
-
value: value || value === 0 ? value : "",
|
|
1304
|
-
onChange: _onChange,
|
|
1305
|
-
onBlur: _onBlur,
|
|
1306
|
-
onFocus: _onFocus
|
|
1307
|
-
})));
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
var getDisplayLabel$5 = core.utils.getDisplayLabel;
|
|
1311
|
-
|
|
1312
|
-
function DateWidget(props) {
|
|
1313
|
-
var id = props.id,
|
|
1314
|
-
required = props.required,
|
|
1315
|
-
readonly = props.readonly,
|
|
1316
|
-
disabled = props.disabled,
|
|
1317
|
-
name = props.name,
|
|
1318
|
-
label = props.label,
|
|
1319
|
-
value = props.value,
|
|
1320
|
-
onChange = props.onChange,
|
|
1321
|
-
onBlur = props.onBlur,
|
|
1322
|
-
onFocus = props.onFocus,
|
|
1323
|
-
autofocus = props.autofocus,
|
|
1324
|
-
options = props.options,
|
|
1325
|
-
formContext = props.formContext,
|
|
1326
|
-
schema = props.schema,
|
|
1327
|
-
uiSchema = props.uiSchema;
|
|
1328
|
-
var semanticProps = getSemanticProps({
|
|
1329
|
-
uiSchema: uiSchema,
|
|
1330
|
-
schema: schema,
|
|
1331
|
-
formContext: formContext,
|
|
1332
|
-
options: options
|
|
1333
|
-
});
|
|
1334
|
-
|
|
1335
|
-
var _onChange = function _onChange(_ref) {
|
|
1336
|
-
var value = _ref.target.value;
|
|
1337
|
-
return onChange && onChange(value);
|
|
1338
|
-
};
|
|
1339
|
-
|
|
1340
|
-
var _onBlur = function _onBlur() {
|
|
1341
|
-
return onBlur && onBlur(id, value);
|
|
1342
|
-
};
|
|
1343
|
-
|
|
1344
|
-
var _onFocus = function _onFocus() {
|
|
1345
|
-
return onFocus && onFocus(id, value);
|
|
1346
|
-
};
|
|
1347
|
-
|
|
1348
|
-
var displayLabel = getDisplayLabel$5(schema, uiSchema
|
|
1349
|
-
/* TODO: , rootSchema */
|
|
1350
|
-
);
|
|
1351
|
-
return React.createElement(semanticUiReact.Form.Input, _extends({
|
|
1352
|
-
key: id,
|
|
1353
|
-
id: id,
|
|
1354
|
-
type: "date",
|
|
1355
|
-
label: displayLabel ? label || schema.title : false,
|
|
1356
|
-
required: required,
|
|
1357
|
-
autoFocus: autofocus,
|
|
1358
|
-
disabled: disabled || readonly,
|
|
1359
|
-
name: name
|
|
1360
|
-
}, semanticProps, {
|
|
1361
|
-
value: value || value === 0 ? value : "",
|
|
1362
|
-
onChange: _onChange,
|
|
1363
|
-
onBlur: _onBlur,
|
|
1364
|
-
onFocus: _onFocus
|
|
1365
|
-
}));
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
var localToUTC = core.utils.localToUTC,
|
|
1369
|
-
utcToLocal = core.utils.utcToLocal,
|
|
1370
|
-
getDisplayLabel$6 = core.utils.getDisplayLabel;
|
|
1371
|
-
|
|
1372
|
-
function DateTimeWidget(props) {
|
|
1373
|
-
var id = props.id,
|
|
1374
|
-
required = props.required,
|
|
1375
|
-
readonly = props.readonly,
|
|
1376
|
-
disabled = props.disabled,
|
|
1377
|
-
name = props.name,
|
|
1378
|
-
label = props.label,
|
|
1379
|
-
schema = props.schema,
|
|
1380
|
-
uiSchema = props.uiSchema,
|
|
1381
|
-
value = props.value,
|
|
1382
|
-
onChange = props.onChange,
|
|
1383
|
-
onBlur = props.onBlur,
|
|
1384
|
-
onFocus = props.onFocus,
|
|
1385
|
-
autofocus = props.autofocus,
|
|
1386
|
-
options = props.options,
|
|
1387
|
-
formContext = props.formContext;
|
|
1388
|
-
var semanticProps = getSemanticProps({
|
|
1389
|
-
uiSchema: uiSchema,
|
|
1390
|
-
schema: schema,
|
|
1391
|
-
formContext: formContext,
|
|
1392
|
-
options: options
|
|
1393
|
-
});
|
|
1394
|
-
|
|
1395
|
-
var _onChange = function _onChange(_ref) {
|
|
1396
|
-
var value = _ref.target.value;
|
|
1397
|
-
return onChange && onChange(localToUTC(value));
|
|
1398
|
-
};
|
|
1399
|
-
|
|
1400
|
-
var _onBlur = function _onBlur() {
|
|
1401
|
-
return onBlur && onBlur(id, value);
|
|
1402
|
-
};
|
|
1403
|
-
|
|
1404
|
-
var _onFocus = function _onFocus() {
|
|
1405
|
-
return onFocus && onFocus(id, value);
|
|
1406
|
-
};
|
|
1407
|
-
|
|
1408
|
-
var dateValue = utcToLocal(value);
|
|
1409
|
-
var displayLabel = getDisplayLabel$6(schema, uiSchema
|
|
1410
|
-
/* TODO: , rootSchema */
|
|
1411
|
-
);
|
|
1412
|
-
return React.createElement(semanticUiReact.Form.Input, _extends({
|
|
1413
|
-
key: id,
|
|
1414
|
-
id: id,
|
|
1415
|
-
type: "datetime-local",
|
|
1416
|
-
label: displayLabel ? label || schema.title : false,
|
|
1417
|
-
required: required,
|
|
1418
|
-
autoFocus: autofocus,
|
|
1419
|
-
disabled: disabled || readonly,
|
|
1420
|
-
name: name
|
|
1421
|
-
}, semanticProps, {
|
|
1422
|
-
value: dateValue,
|
|
1423
|
-
onChange: _onChange,
|
|
1424
|
-
onBlur: _onBlur,
|
|
1425
|
-
onFocus: _onFocus
|
|
1426
|
-
}));
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
var getDisplayLabel$7 = core.utils.getDisplayLabel;
|
|
1430
|
-
|
|
1431
|
-
function EmailWidget(props) {
|
|
1432
|
-
var id = props.id,
|
|
1433
|
-
required = props.required,
|
|
1434
|
-
readonly = props.readonly,
|
|
1435
|
-
disabled = props.disabled,
|
|
1436
|
-
name = props.name,
|
|
1437
|
-
label = props.label,
|
|
1438
|
-
schema = props.schema,
|
|
1439
|
-
uiSchema = props.uiSchema,
|
|
1440
|
-
value = props.value,
|
|
1441
|
-
onChange = props.onChange,
|
|
1442
|
-
onBlur = props.onBlur,
|
|
1443
|
-
onFocus = props.onFocus,
|
|
1444
|
-
autofocus = props.autofocus,
|
|
1445
|
-
options = props.options,
|
|
1446
|
-
formContext = props.formContext;
|
|
1447
|
-
var semanticProps = getSemanticProps({
|
|
1448
|
-
schema: schema,
|
|
1449
|
-
uiSchema: uiSchema,
|
|
1450
|
-
formContext: formContext,
|
|
1451
|
-
options: options
|
|
1452
|
-
}); // eslint-disable-next-line no-shadow
|
|
1453
|
-
|
|
1454
|
-
var _onChange = function _onChange(_ref) {
|
|
1455
|
-
var value = _ref.target.value;
|
|
1456
|
-
return onChange(value === "" ? options.emptyValue : value);
|
|
1457
|
-
};
|
|
1458
|
-
|
|
1459
|
-
var _onBlur = function _onBlur() {
|
|
1460
|
-
return onBlur && onBlur(id, value);
|
|
1461
|
-
};
|
|
1462
|
-
|
|
1463
|
-
var _onFocus = function _onFocus() {
|
|
1464
|
-
return onFocus && onFocus(id, value);
|
|
1465
|
-
};
|
|
1466
|
-
|
|
1467
|
-
var displayLabel = getDisplayLabel$7(schema, uiSchema
|
|
1468
|
-
/* TODO: , rootSchema */
|
|
1469
|
-
);
|
|
1470
|
-
return React.createElement(semanticUiReact.Form.Input, _extends({
|
|
1471
|
-
key: id,
|
|
1472
|
-
id: id,
|
|
1473
|
-
type: "email",
|
|
1474
|
-
label: displayLabel ? label || schema.title : false,
|
|
1475
|
-
required: required,
|
|
1476
|
-
autoFocus: autofocus,
|
|
1477
|
-
disabled: disabled || readonly,
|
|
1478
|
-
name: name
|
|
1479
|
-
}, semanticProps, {
|
|
1480
|
-
value: value || value === 0 ? value : "",
|
|
1481
|
-
onChange: _onChange,
|
|
1482
|
-
onBlur: _onBlur,
|
|
1483
|
-
onFocus: _onFocus
|
|
1484
|
-
}));
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
var getDisplayLabel$8 = core.utils.getDisplayLabel;
|
|
1488
|
-
|
|
1489
|
-
function URLWidget(props) {
|
|
1490
|
-
var id = props.id,
|
|
1491
|
-
name = props.name,
|
|
1492
|
-
label = props.label,
|
|
1493
|
-
value = props.value,
|
|
1494
|
-
required = props.required,
|
|
1495
|
-
readonly = props.readonly,
|
|
1496
|
-
disabled = props.disabled,
|
|
1497
|
-
onChange = props.onChange,
|
|
1498
|
-
onBlur = props.onBlur,
|
|
1499
|
-
onFocus = props.onFocus,
|
|
1500
|
-
autofocus = props.autofocus,
|
|
1501
|
-
options = props.options,
|
|
1502
|
-
schema = props.schema,
|
|
1503
|
-
uiSchema = props.uiSchema,
|
|
1504
|
-
formContext = props.formContext;
|
|
1505
|
-
var semanticProps = getSemanticProps({
|
|
1506
|
-
formContext: formContext,
|
|
1507
|
-
options: options,
|
|
1508
|
-
uiSchema: uiSchema
|
|
1509
|
-
}); // eslint-disable-next-line no-shadow
|
|
1510
|
-
|
|
1511
|
-
var _onChange = function _onChange(_ref) {
|
|
1512
|
-
var value = _ref.target.value;
|
|
1513
|
-
return onChange(value === "" ? options.emptyValue : value);
|
|
1514
|
-
};
|
|
1515
|
-
|
|
1516
|
-
var _onBlur = function _onBlur() {
|
|
1517
|
-
return onBlur && onBlur(id, value);
|
|
1518
|
-
};
|
|
1519
|
-
|
|
1520
|
-
var _onFocus = function _onFocus() {
|
|
1521
|
-
return onFocus && onFocus(id, value);
|
|
1522
|
-
};
|
|
1523
|
-
|
|
1524
|
-
var displayLabel = getDisplayLabel$8(schema, uiSchema
|
|
1525
|
-
/* TODO: , rootSchema */
|
|
1526
|
-
);
|
|
1527
|
-
return React.createElement(semanticUiReact.Form.Input, _extends({
|
|
1528
|
-
key: id,
|
|
1529
|
-
id: id,
|
|
1530
|
-
type: "url",
|
|
1531
|
-
label: displayLabel ? label || schema.title : false,
|
|
1532
|
-
required: required,
|
|
1533
|
-
autoFocus: autofocus,
|
|
1534
|
-
disabled: disabled || readonly,
|
|
1535
|
-
name: name
|
|
1536
|
-
}, semanticProps, {
|
|
1537
|
-
value: value || value === 0 ? value : "",
|
|
1538
|
-
onChange: _onChange,
|
|
1539
|
-
onBlur: _onBlur,
|
|
1540
|
-
onFocus: _onFocus
|
|
1541
|
-
}));
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
var getSubmitButtonOptions = core.utils.getSubmitButtonOptions;
|
|
1545
|
-
var SubmitButton = (function (_ref) {
|
|
1546
|
-
var uiSchema = _ref.uiSchema;
|
|
1547
|
-
|
|
1548
|
-
var _getSubmitButtonOptio = getSubmitButtonOptions(uiSchema),
|
|
1549
|
-
submitText = _getSubmitButtonOptio.submitText,
|
|
1550
|
-
norender = _getSubmitButtonOptio.norender,
|
|
1551
|
-
submitButtonProps = _getSubmitButtonOptio.props;
|
|
1552
|
-
|
|
1553
|
-
if (norender) {
|
|
1554
|
-
return null;
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
|
-
return React.createElement(semanticUiReact.Button, _extends({
|
|
1558
|
-
type: "submit",
|
|
1559
|
-
primary: true
|
|
1560
|
-
}, submitButtonProps), submitText);
|
|
1561
|
-
});
|
|
1562
|
-
|
|
1563
1212
|
var Widgets = {
|
|
1564
|
-
CheckboxWidget
|
|
1565
|
-
CheckboxesWidget
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
URLWidget: URLWidget,
|
|
1571
|
-
RadioWidget: RadioWidget,
|
|
1572
|
-
RangeWidget: RangeWidget,
|
|
1573
|
-
SelectWidget: SelectWidget,
|
|
1574
|
-
TextareaWidget: TextareaWidget,
|
|
1575
|
-
TextWidget: TextWidget,
|
|
1576
|
-
UpDownWidget: UpDownWidget,
|
|
1577
|
-
SubmitButton: SubmitButton
|
|
1213
|
+
CheckboxWidget,
|
|
1214
|
+
CheckboxesWidget,
|
|
1215
|
+
RadioWidget,
|
|
1216
|
+
RangeWidget,
|
|
1217
|
+
SelectWidget,
|
|
1218
|
+
TextareaWidget
|
|
1578
1219
|
};
|
|
1579
1220
|
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
widgets = _getDefaultRegistry.widgets;
|
|
1585
|
-
|
|
1586
|
-
var Theme = {
|
|
1587
|
-
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
1588
|
-
ErrorList: ErrorList,
|
|
1589
|
-
fields: /*#__PURE__*/_extends({}, fields, Fields),
|
|
1590
|
-
FieldTemplate: FieldTemplate,
|
|
1591
|
-
ObjectFieldTemplate: ObjectFieldTemplate,
|
|
1592
|
-
_internalFormWrapper: semanticUiReact.Form,
|
|
1593
|
-
widgets: /*#__PURE__*/_extends({}, widgets, Widgets)
|
|
1221
|
+
const Theme = {
|
|
1222
|
+
templates: Templates,
|
|
1223
|
+
widgets: Widgets,
|
|
1224
|
+
_internalFormWrapper: semanticUiReact.Form
|
|
1594
1225
|
};
|
|
1595
1226
|
|
|
1596
|
-
|
|
1227
|
+
const SemanticUIForm = /*#__PURE__*/core.withTheme(Theme);
|
|
1597
1228
|
|
|
1598
|
-
exports.
|
|
1599
|
-
exports.
|
|
1600
|
-
exports.Fields = Fields;
|
|
1601
|
-
exports.ObjectFieldTemplate = ObjectFieldTemplate;
|
|
1602
|
-
exports.SemanticUIForm = SemanticUIForm;
|
|
1229
|
+
exports.Form = SemanticUIForm;
|
|
1230
|
+
exports.Templates = Templates;
|
|
1603
1231
|
exports.Theme = Theme;
|
|
1604
1232
|
exports.Widgets = Widgets;
|
|
1605
1233
|
exports.default = SemanticUIForm;
|