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