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