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