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