@rjsf/antd 5.0.0-beta.8 → 5.0.0
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/antd.cjs.development.js +1066 -1057
- package/dist/antd.cjs.development.js.map +1 -1
- package/dist/antd.cjs.production.min.js +1 -1
- package/dist/antd.cjs.production.min.js.map +1 -1
- package/dist/antd.esm.js +1062 -1059
- package/dist/antd.esm.js.map +1 -1
- package/dist/antd.umd.development.js +1069 -1061
- package/dist/antd.umd.development.js.map +1 -1
- package/dist/antd.umd.production.min.js +1 -1
- package/dist/antd.umd.production.min.js.map +1 -1
- package/dist/index.d.ts +16 -61
- package/package.json +25 -34
- package/dist/components/DatePicker/index.d.ts +0 -17
- package/dist/templates/ArrayFieldItemTemplate/index.d.ts +0 -20
- package/dist/templates/ArrayFieldTemplate/index.d.ts +0 -2
- package/dist/templates/BaseInputTemplate/index.d.ts +0 -15
- package/dist/templates/DescriptionField/index.d.ts +0 -5
- package/dist/templates/ErrorList/index.d.ts +0 -4
- package/dist/templates/FieldErrorTemplate/index.d.ts +0 -5
- package/dist/templates/FieldTemplate/WrapIfAdditional.d.ts +0 -15
- package/dist/templates/FieldTemplate/index.d.ts +0 -22
- package/dist/templates/IconButton/index.d.ts +0 -5
- package/dist/templates/ObjectFieldTemplate/index.d.ts +0 -2
- package/dist/templates/SubmitButton/index.d.ts +0 -4
- package/dist/templates/TitleField/index.d.ts +0 -2
- package/dist/widgets/AltDateTimeWidget/index.d.ts +0 -13
- package/dist/widgets/AltDateWidget/index.d.ts +0 -26
- package/dist/widgets/CheckboxWidget/index.d.ts +0 -13
- package/dist/widgets/CheckboxesWidget/index.d.ts +0 -13
- package/dist/widgets/DateTimeWidget/index.d.ts +0 -12
- package/dist/widgets/DateWidget/index.d.ts +0 -12
- package/dist/widgets/PasswordWidget/index.d.ts +0 -13
- package/dist/widgets/RadioWidget/index.d.ts +0 -14
- package/dist/widgets/RangeWidget/index.d.ts +0 -15
- package/dist/widgets/SelectWidget/index.d.ts +0 -21
- package/dist/widgets/TextareaWidget/index.d.ts +0 -13
package/dist/antd.esm.js
CHANGED
|
@@ -3,9 +3,9 @@ import React, { useState, useEffect } from 'react';
|
|
|
3
3
|
import Button from 'antd/es/button';
|
|
4
4
|
import Col from 'antd/es/col';
|
|
5
5
|
import Row from 'antd/es/row';
|
|
6
|
-
import { getUiOptions, getTemplate, getInputProps,
|
|
6
|
+
import { getUiOptions, getTemplate, getInputProps, ariaDescribedByIds, examplesId, errorId, titleId, descriptionId, canExpand, getSubmitButtonOptions, UI_OPTIONS_KEY, ADDITIONAL_PROPERTY_FLAG, parseDateString, toDateString, pad, enumOptionsIndexForValue, optionId, enumOptionsValueForIndex, rangeSpec } from '@rjsf/utils';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import {
|
|
8
|
+
import { ConfigConsumer } from 'antd/es/config-provider/context';
|
|
9
9
|
import Input from 'antd/es/input';
|
|
10
10
|
import InputNumber from 'antd/es/input-number';
|
|
11
11
|
import Alert from 'antd/es/alert';
|
|
@@ -19,6 +19,7 @@ import PlusCircleOutlined from '@ant-design/icons/PlusCircleOutlined';
|
|
|
19
19
|
import Form$1 from 'antd/es/form';
|
|
20
20
|
import isObject from 'lodash-es/isObject';
|
|
21
21
|
import isNumber from 'lodash-es/isNumber';
|
|
22
|
+
import isString from 'lodash-es/isString';
|
|
22
23
|
import Checkbox from 'antd/es/checkbox';
|
|
23
24
|
import dayjs from 'dayjs';
|
|
24
25
|
import dayjsGenerateConfig from 'rc-picker/es/generate/dayjs';
|
|
@@ -27,37 +28,38 @@ import Radio from 'antd/es/radio';
|
|
|
27
28
|
import Slider from 'antd/es/slider';
|
|
28
29
|
import Select from 'antd/es/select';
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
var BTN_GRP_STYLE = {
|
|
31
32
|
width: "100%"
|
|
32
33
|
};
|
|
33
|
-
|
|
34
|
+
var BTN_STYLE = {
|
|
34
35
|
width: "calc(100% / 3)"
|
|
35
36
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
37
|
+
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
38
|
+
*
|
|
39
|
+
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
40
|
+
*/
|
|
41
|
+
function ArrayFieldItemTemplate(props) {
|
|
42
|
+
var children = props.children,
|
|
43
|
+
disabled = props.disabled,
|
|
44
|
+
hasMoveDown = props.hasMoveDown,
|
|
45
|
+
hasMoveUp = props.hasMoveUp,
|
|
46
|
+
hasRemove = props.hasRemove,
|
|
47
|
+
hasToolbar = props.hasToolbar,
|
|
48
|
+
index = props.index,
|
|
49
|
+
onDropIndexClick = props.onDropIndexClick,
|
|
50
|
+
onReorderClick = props.onReorderClick,
|
|
51
|
+
readonly = props.readonly,
|
|
52
|
+
registry = props.registry,
|
|
53
|
+
uiSchema = props.uiSchema;
|
|
54
|
+
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
55
|
+
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
56
|
+
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
57
|
+
RemoveButton = _registry$templates$B.RemoveButton;
|
|
58
|
+
var _registry$formContext = registry.formContext,
|
|
59
|
+
_registry$formContext2 = _registry$formContext.rowGutter,
|
|
60
|
+
rowGutter = _registry$formContext2 === void 0 ? 24 : _registry$formContext2,
|
|
61
|
+
_registry$formContext3 = _registry$formContext.toolbarAlign,
|
|
62
|
+
toolbarAlign = _registry$formContext3 === void 0 ? "top" : _registry$formContext3;
|
|
61
63
|
return /*#__PURE__*/React.createElement(Row, {
|
|
62
64
|
align: toolbarAlign,
|
|
63
65
|
key: "array-item-" + index,
|
|
@@ -71,174 +73,182 @@ const ArrayFieldItemTemplate = _ref => {
|
|
|
71
73
|
}, (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveUpButton, {
|
|
72
74
|
disabled: disabled || readonly || !hasMoveUp,
|
|
73
75
|
onClick: onReorderClick(index, index - 1),
|
|
74
|
-
style: BTN_STYLE
|
|
76
|
+
style: BTN_STYLE,
|
|
77
|
+
uiSchema: uiSchema,
|
|
78
|
+
registry: registry
|
|
75
79
|
}), (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveDownButton, {
|
|
76
80
|
disabled: disabled || readonly || !hasMoveDown,
|
|
77
81
|
onClick: onReorderClick(index, index + 1),
|
|
78
|
-
style: BTN_STYLE
|
|
82
|
+
style: BTN_STYLE,
|
|
83
|
+
uiSchema: uiSchema,
|
|
84
|
+
registry: registry
|
|
79
85
|
}), hasRemove && /*#__PURE__*/React.createElement(RemoveButton, {
|
|
80
86
|
disabled: disabled || readonly,
|
|
81
87
|
onClick: onDropIndexClick(index),
|
|
82
|
-
style: BTN_STYLE
|
|
88
|
+
style: BTN_STYLE,
|
|
89
|
+
uiSchema: uiSchema,
|
|
90
|
+
registry: registry
|
|
83
91
|
}))));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
ArrayFieldItemTemplate.defaultProps = {
|
|
87
|
-
formContext: {}
|
|
88
|
-
};
|
|
92
|
+
}
|
|
89
93
|
|
|
90
94
|
function _extends() {
|
|
91
95
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
92
96
|
for (var i = 1; i < arguments.length; i++) {
|
|
93
97
|
var source = arguments[i];
|
|
94
|
-
|
|
95
98
|
for (var key in source) {
|
|
96
99
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
97
100
|
target[key] = source[key];
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
|
|
102
104
|
return target;
|
|
103
105
|
};
|
|
104
106
|
return _extends.apply(this, arguments);
|
|
105
107
|
}
|
|
108
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
109
|
+
if (source == null) return {};
|
|
110
|
+
var target = {};
|
|
111
|
+
var sourceKeys = Object.keys(source);
|
|
112
|
+
var key, i;
|
|
113
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
114
|
+
key = sourceKeys[i];
|
|
115
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
116
|
+
target[key] = source[key];
|
|
117
|
+
}
|
|
118
|
+
return target;
|
|
119
|
+
}
|
|
106
120
|
|
|
107
|
-
|
|
121
|
+
var _excluded$1 = ["key"];
|
|
122
|
+
var DESCRIPTION_COL_STYLE$1 = {
|
|
108
123
|
paddingBottom: "8px"
|
|
109
124
|
};
|
|
125
|
+
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
126
|
+
*
|
|
127
|
+
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
128
|
+
*/
|
|
129
|
+
function ArrayFieldTemplate(props) {
|
|
130
|
+
var canAdd = props.canAdd,
|
|
131
|
+
className = props.className,
|
|
132
|
+
disabled = props.disabled,
|
|
133
|
+
formContext = props.formContext,
|
|
134
|
+
idSchema = props.idSchema,
|
|
135
|
+
items = props.items,
|
|
136
|
+
onAddClick = props.onAddClick,
|
|
137
|
+
readonly = props.readonly,
|
|
138
|
+
registry = props.registry,
|
|
139
|
+
required = props.required,
|
|
140
|
+
schema = props.schema,
|
|
141
|
+
title = props.title,
|
|
142
|
+
uiSchema = props.uiSchema;
|
|
143
|
+
var uiOptions = getUiOptions(uiSchema);
|
|
144
|
+
var ArrayFieldDescriptionTemplate = getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
|
|
145
|
+
var ArrayFieldItemTemplate = getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
|
|
146
|
+
var ArrayFieldTitleTemplate = getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
|
|
147
|
+
// Button templates are not overridden in the uiSchema
|
|
148
|
+
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
149
|
+
var _formContext$labelAli = formContext.labelAlign,
|
|
150
|
+
labelAlign = _formContext$labelAli === void 0 ? "right" : _formContext$labelAli,
|
|
151
|
+
_formContext$rowGutte = formContext.rowGutter,
|
|
152
|
+
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
153
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (configProps) {
|
|
154
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
155
|
+
var prefixCls = getPrefixCls("form");
|
|
156
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
157
|
+
var labelColClassName = classNames(labelClsBasic, labelAlign === "left" && labelClsBasic + "-left"
|
|
158
|
+
// labelCol.className,
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
162
|
+
className: className,
|
|
163
|
+
id: idSchema.$id
|
|
164
|
+
}, /*#__PURE__*/React.createElement(Row, {
|
|
165
|
+
gutter: rowGutter
|
|
166
|
+
}, (uiOptions.title || title) && /*#__PURE__*/React.createElement(Col, {
|
|
167
|
+
className: labelColClassName,
|
|
168
|
+
span: 24
|
|
169
|
+
}, /*#__PURE__*/React.createElement(ArrayFieldTitleTemplate, {
|
|
170
|
+
idSchema: idSchema,
|
|
171
|
+
required: required,
|
|
172
|
+
title: uiOptions.title || title,
|
|
173
|
+
schema: schema,
|
|
174
|
+
uiSchema: uiSchema,
|
|
175
|
+
registry: registry
|
|
176
|
+
})), (uiOptions.description || schema.description) && /*#__PURE__*/React.createElement(Col, {
|
|
177
|
+
span: 24,
|
|
178
|
+
style: DESCRIPTION_COL_STYLE$1
|
|
179
|
+
}, /*#__PURE__*/React.createElement(ArrayFieldDescriptionTemplate, {
|
|
180
|
+
description: uiOptions.description || schema.description || "",
|
|
181
|
+
idSchema: idSchema,
|
|
182
|
+
schema: schema,
|
|
183
|
+
uiSchema: uiSchema,
|
|
184
|
+
registry: registry
|
|
185
|
+
})), /*#__PURE__*/React.createElement(Col, {
|
|
186
|
+
className: "row array-item-list",
|
|
187
|
+
span: 24
|
|
188
|
+
}, items && items.map(function (_ref) {
|
|
189
|
+
var key = _ref.key,
|
|
190
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
191
|
+
return /*#__PURE__*/React.createElement(ArrayFieldItemTemplate, _extends({
|
|
192
|
+
key: key
|
|
193
|
+
}, itemProps));
|
|
194
|
+
})), canAdd && /*#__PURE__*/React.createElement(Col, {
|
|
195
|
+
span: 24
|
|
196
|
+
}, /*#__PURE__*/React.createElement(Row, {
|
|
197
|
+
gutter: rowGutter,
|
|
198
|
+
justify: "end"
|
|
199
|
+
}, /*#__PURE__*/React.createElement(Col, {
|
|
200
|
+
flex: "192px"
|
|
201
|
+
}, /*#__PURE__*/React.createElement(AddButton, {
|
|
202
|
+
className: "array-item-add",
|
|
203
|
+
disabled: disabled || readonly,
|
|
204
|
+
onClick: onAddClick,
|
|
205
|
+
uiSchema: uiSchema,
|
|
206
|
+
registry: registry
|
|
207
|
+
}))))));
|
|
208
|
+
});
|
|
209
|
+
}
|
|
110
210
|
|
|
111
|
-
|
|
112
|
-
let {
|
|
113
|
-
canAdd,
|
|
114
|
-
className,
|
|
115
|
-
disabled,
|
|
116
|
-
formContext,
|
|
117
|
-
// formData,
|
|
118
|
-
idSchema,
|
|
119
|
-
items,
|
|
120
|
-
onAddClick,
|
|
121
|
-
prefixCls,
|
|
122
|
-
readonly,
|
|
123
|
-
registry,
|
|
124
|
-
required,
|
|
125
|
-
schema,
|
|
126
|
-
title,
|
|
127
|
-
uiSchema
|
|
128
|
-
} = _ref;
|
|
129
|
-
const uiOptions = getUiOptions(uiSchema);
|
|
130
|
-
const ArrayFieldDescriptionTemplate = getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
|
|
131
|
-
const ArrayFieldItemTemplate = getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
|
|
132
|
-
const ArrayFieldTitleTemplate = getTemplate("ArrayFieldTitleTemplate", registry, uiOptions); // Button templates are not overridden in the uiSchema
|
|
133
|
-
|
|
134
|
-
const {
|
|
135
|
-
ButtonTemplates: {
|
|
136
|
-
AddButton
|
|
137
|
-
}
|
|
138
|
-
} = registry.templates;
|
|
139
|
-
const {
|
|
140
|
-
labelAlign = "right",
|
|
141
|
-
rowGutter = 24
|
|
142
|
-
} = formContext;
|
|
143
|
-
const labelClsBasic = prefixCls + "-item-label";
|
|
144
|
-
const labelColClassName = classNames(labelClsBasic, labelAlign === "left" && labelClsBasic + "-left" // labelCol.className,
|
|
145
|
-
);
|
|
146
|
-
return /*#__PURE__*/React.createElement("fieldset", {
|
|
147
|
-
className: className,
|
|
148
|
-
id: idSchema.$id
|
|
149
|
-
}, /*#__PURE__*/React.createElement(Row, {
|
|
150
|
-
gutter: rowGutter
|
|
151
|
-
}, (uiOptions.title || title) && /*#__PURE__*/React.createElement(Col, {
|
|
152
|
-
className: labelColClassName,
|
|
153
|
-
span: 24
|
|
154
|
-
}, /*#__PURE__*/React.createElement(ArrayFieldTitleTemplate, {
|
|
155
|
-
idSchema: idSchema,
|
|
156
|
-
required: required,
|
|
157
|
-
title: uiOptions.title || title,
|
|
158
|
-
uiSchema: uiSchema,
|
|
159
|
-
registry: registry
|
|
160
|
-
})), (uiOptions.description || schema.description) && /*#__PURE__*/React.createElement(Col, {
|
|
161
|
-
span: 24,
|
|
162
|
-
style: DESCRIPTION_COL_STYLE$1
|
|
163
|
-
}, /*#__PURE__*/React.createElement(ArrayFieldDescriptionTemplate, {
|
|
164
|
-
description: uiOptions.description || schema.description,
|
|
165
|
-
idSchema: idSchema,
|
|
166
|
-
uiSchema: uiSchema,
|
|
167
|
-
registry: registry
|
|
168
|
-
})), /*#__PURE__*/React.createElement(Col, {
|
|
169
|
-
className: "row array-item-list",
|
|
170
|
-
span: 24
|
|
171
|
-
}, items && items.map(itemProps => /*#__PURE__*/React.createElement(ArrayFieldItemTemplate, _extends({}, itemProps, {
|
|
172
|
-
formContext: formContext
|
|
173
|
-
})))), canAdd && /*#__PURE__*/React.createElement(Col, {
|
|
174
|
-
span: 24
|
|
175
|
-
}, /*#__PURE__*/React.createElement(Row, {
|
|
176
|
-
gutter: rowGutter,
|
|
177
|
-
justify: "end"
|
|
178
|
-
}, /*#__PURE__*/React.createElement(Col, {
|
|
179
|
-
flex: "192px"
|
|
180
|
-
}, /*#__PURE__*/React.createElement(AddButton, {
|
|
181
|
-
className: "array-item-add",
|
|
182
|
-
disabled: disabled || readonly,
|
|
183
|
-
onClick: onAddClick
|
|
184
|
-
}))))));
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
var ArrayFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
|
|
188
|
-
prefixCls: "form"
|
|
189
|
-
})(ArrayFieldTemplate);
|
|
190
|
-
|
|
191
|
-
const INPUT_STYLE$2 = {
|
|
211
|
+
var INPUT_STYLE$2 = {
|
|
192
212
|
width: "100%"
|
|
193
213
|
};
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
readonlyAsDisabled = true
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
let {
|
|
222
|
-
target
|
|
223
|
-
} = _ref2;
|
|
214
|
+
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
215
|
+
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
216
|
+
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
217
|
+
*
|
|
218
|
+
* @param props - The `WidgetProps` for this template
|
|
219
|
+
*/
|
|
220
|
+
function BaseInputTemplate(props) {
|
|
221
|
+
var disabled = props.disabled,
|
|
222
|
+
formContext = props.formContext,
|
|
223
|
+
id = props.id,
|
|
224
|
+
onBlur = props.onBlur,
|
|
225
|
+
onChange = props.onChange,
|
|
226
|
+
onFocus = props.onFocus,
|
|
227
|
+
options = props.options,
|
|
228
|
+
placeholder = props.placeholder,
|
|
229
|
+
readonly = props.readonly,
|
|
230
|
+
schema = props.schema,
|
|
231
|
+
value = props.value,
|
|
232
|
+
type = props.type;
|
|
233
|
+
var inputProps = getInputProps(schema, type, options, false);
|
|
234
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
235
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
236
|
+
var handleNumberChange = function handleNumberChange(nextValue) {
|
|
237
|
+
return onChange(nextValue);
|
|
238
|
+
};
|
|
239
|
+
var handleTextChange = function handleTextChange(_ref) {
|
|
240
|
+
var target = _ref.target;
|
|
224
241
|
return onChange(target.value === "" ? options.emptyValue : target.value);
|
|
225
242
|
};
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
let {
|
|
229
|
-
target
|
|
230
|
-
} = _ref3;
|
|
243
|
+
var handleBlur = function handleBlur(_ref2) {
|
|
244
|
+
var target = _ref2.target;
|
|
231
245
|
return onBlur(id, target.value);
|
|
232
246
|
};
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
let {
|
|
236
|
-
target
|
|
237
|
-
} = _ref4;
|
|
247
|
+
var handleFocus = function handleFocus(_ref3) {
|
|
248
|
+
var target = _ref3.target;
|
|
238
249
|
return onFocus(id, target.value);
|
|
239
250
|
};
|
|
240
|
-
|
|
241
|
-
const input = inputProps.type === "number" || inputProps.type === "integer" ? /*#__PURE__*/React.createElement(InputNumber, _extends({
|
|
251
|
+
var input = inputProps.type === "number" || inputProps.type === "integer" ? /*#__PURE__*/React.createElement(InputNumber, _extends({
|
|
242
252
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
243
253
|
id: id,
|
|
244
254
|
name: id,
|
|
@@ -247,9 +257,10 @@ const TextWidget = _ref => {
|
|
|
247
257
|
onFocus: !readonly ? handleFocus : undefined,
|
|
248
258
|
placeholder: placeholder,
|
|
249
259
|
style: INPUT_STYLE$2,
|
|
250
|
-
list: schema.examples ?
|
|
260
|
+
list: schema.examples ? examplesId(id) : undefined
|
|
251
261
|
}, inputProps, {
|
|
252
|
-
value: value
|
|
262
|
+
value: value,
|
|
263
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
253
264
|
})) : /*#__PURE__*/React.createElement(Input, _extends({
|
|
254
265
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
255
266
|
id: id,
|
|
@@ -259,61 +270,66 @@ const TextWidget = _ref => {
|
|
|
259
270
|
onFocus: !readonly ? handleFocus : undefined,
|
|
260
271
|
placeholder: placeholder,
|
|
261
272
|
style: INPUT_STYLE$2,
|
|
262
|
-
list: schema.examples ?
|
|
273
|
+
list: schema.examples ? examplesId(id) : undefined
|
|
263
274
|
}, inputProps, {
|
|
264
|
-
value: value
|
|
275
|
+
value: value,
|
|
276
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
265
277
|
}));
|
|
266
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, input, schema.examples && /*#__PURE__*/React.createElement("datalist", {
|
|
267
|
-
id:
|
|
268
|
-
}, schema.examples.concat(schema.default ? [schema
|
|
278
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, input, Array.isArray(schema.examples) && /*#__PURE__*/React.createElement("datalist", {
|
|
279
|
+
id: examplesId(id)
|
|
280
|
+
}, schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
269
281
|
return /*#__PURE__*/React.createElement("option", {
|
|
270
282
|
key: example,
|
|
271
283
|
value: example
|
|
272
284
|
});
|
|
273
285
|
})));
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const DescriptionField = _ref => {
|
|
277
|
-
let {
|
|
278
|
-
description,
|
|
279
|
-
id // registry,
|
|
286
|
+
}
|
|
280
287
|
|
|
281
|
-
|
|
282
|
-
|
|
288
|
+
/** The `DescriptionField` is the template to use to render the description of a field
|
|
289
|
+
*
|
|
290
|
+
* @param props - The `DescriptionFieldProps` for this component
|
|
291
|
+
*/
|
|
292
|
+
function DescriptionField(props) {
|
|
293
|
+
var id = props.id,
|
|
294
|
+
description = props.description;
|
|
295
|
+
if (!description) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
283
299
|
id: id
|
|
284
300
|
}, description);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const ErrorList = _ref => {
|
|
288
|
-
let {
|
|
289
|
-
// errorSchema,
|
|
290
|
-
errors // formContext,
|
|
291
|
-
// schema,
|
|
292
|
-
// uiSchema,
|
|
293
|
-
|
|
294
|
-
} = _ref;
|
|
295
|
-
|
|
296
|
-
const renderErrors = () => /*#__PURE__*/React.createElement(List, {
|
|
297
|
-
className: "list-group",
|
|
298
|
-
size: "small"
|
|
299
|
-
}, errors.map((error, index) => /*#__PURE__*/React.createElement(List.Item, {
|
|
300
|
-
key: index
|
|
301
|
-
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null), error.stack))));
|
|
301
|
+
}
|
|
302
302
|
|
|
303
|
+
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
304
|
+
*
|
|
305
|
+
* @param props - The `ErrorListProps` for this component
|
|
306
|
+
*/
|
|
307
|
+
function ErrorList(_ref) {
|
|
308
|
+
var errors = _ref.errors;
|
|
309
|
+
var renderErrors = function renderErrors() {
|
|
310
|
+
return /*#__PURE__*/React.createElement(List, {
|
|
311
|
+
className: "list-group",
|
|
312
|
+
size: "small"
|
|
313
|
+
}, errors.map(function (error, index) {
|
|
314
|
+
return /*#__PURE__*/React.createElement(List.Item, {
|
|
315
|
+
key: index
|
|
316
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null), error.stack));
|
|
317
|
+
}));
|
|
318
|
+
};
|
|
303
319
|
return /*#__PURE__*/React.createElement(Alert, {
|
|
304
320
|
className: "panel panel-danger errors",
|
|
305
321
|
description: renderErrors(),
|
|
306
322
|
message: "Errors",
|
|
307
323
|
type: "error"
|
|
308
324
|
});
|
|
309
|
-
}
|
|
325
|
+
}
|
|
310
326
|
|
|
327
|
+
var _excluded = ["iconType", "icon", "uiSchema", "registry"];
|
|
311
328
|
function IconButton(props) {
|
|
312
|
-
|
|
313
|
-
iconType = "default",
|
|
314
|
-
icon,
|
|
315
|
-
|
|
316
|
-
} = props;
|
|
329
|
+
var _props$iconType = props.iconType,
|
|
330
|
+
iconType = _props$iconType === void 0 ? "default" : _props$iconType,
|
|
331
|
+
icon = props.icon,
|
|
332
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
317
333
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
318
334
|
type: iconType,
|
|
319
335
|
icon: icon
|
|
@@ -343,181 +359,90 @@ function MoveUpButton(props) {
|
|
|
343
359
|
}));
|
|
344
360
|
}
|
|
345
361
|
function RemoveButton(props) {
|
|
362
|
+
// The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
|
|
363
|
+
var options = getUiOptions(props.uiSchema);
|
|
346
364
|
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
347
365
|
title: "Remove"
|
|
348
366
|
}, props, {
|
|
349
367
|
danger: true,
|
|
368
|
+
block: !!options.block,
|
|
350
369
|
iconType: "primary",
|
|
351
370
|
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
|
352
371
|
}));
|
|
353
372
|
}
|
|
354
373
|
|
|
355
|
-
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
356
|
-
*
|
|
357
|
-
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
374
|
+
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
375
|
+
*
|
|
376
|
+
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
358
377
|
*/
|
|
359
|
-
|
|
360
378
|
function FieldErrorTemplate(props) {
|
|
361
|
-
|
|
362
|
-
errors = [],
|
|
363
|
-
idSchema
|
|
364
|
-
} = props;
|
|
365
|
-
|
|
379
|
+
var _props$errors = props.errors,
|
|
380
|
+
errors = _props$errors === void 0 ? [] : _props$errors,
|
|
381
|
+
idSchema = props.idSchema;
|
|
366
382
|
if (errors.length === 0) {
|
|
367
383
|
return null;
|
|
368
384
|
}
|
|
369
|
-
|
|
370
|
-
const id = idSchema.$id + "__error";
|
|
385
|
+
var id = errorId(idSchema);
|
|
371
386
|
return /*#__PURE__*/React.createElement("div", {
|
|
372
387
|
id: id
|
|
373
|
-
}, errors.map(
|
|
374
|
-
key: "field-" + id + "-error-" + error
|
|
375
|
-
}, error)));
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
const VERTICAL_LABEL_COL$1 = {
|
|
379
|
-
span: 24
|
|
380
|
-
};
|
|
381
|
-
const VERTICAL_WRAPPER_COL$1 = {
|
|
382
|
-
span: 24
|
|
383
|
-
};
|
|
384
|
-
const INPUT_STYLE$1 = {
|
|
385
|
-
width: "100%"
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
const WrapIfAdditional = _ref => {
|
|
389
|
-
let {
|
|
390
|
-
children,
|
|
391
|
-
classNames,
|
|
392
|
-
disabled,
|
|
393
|
-
formContext,
|
|
394
|
-
id,
|
|
395
|
-
label,
|
|
396
|
-
onDropPropertyClick,
|
|
397
|
-
onKeyChange,
|
|
398
|
-
readonly,
|
|
399
|
-
required,
|
|
400
|
-
registry,
|
|
401
|
-
schema
|
|
402
|
-
} = _ref;
|
|
403
|
-
const {
|
|
404
|
-
colon,
|
|
405
|
-
labelCol = VERTICAL_LABEL_COL$1,
|
|
406
|
-
readonlyAsDisabled = true,
|
|
407
|
-
rowGutter = 24,
|
|
408
|
-
toolbarAlign = "top",
|
|
409
|
-
wrapperCol = VERTICAL_WRAPPER_COL$1,
|
|
410
|
-
wrapperStyle
|
|
411
|
-
} = formContext;
|
|
412
|
-
const {
|
|
413
|
-
RemoveButton
|
|
414
|
-
} = registry.templates.ButtonTemplates;
|
|
415
|
-
const keyLabel = label + " Key"; // i18n ?
|
|
416
|
-
|
|
417
|
-
const additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
418
|
-
|
|
419
|
-
if (!additional) {
|
|
388
|
+
}, errors.map(function (error) {
|
|
420
389
|
return /*#__PURE__*/React.createElement("div", {
|
|
421
|
-
|
|
422
|
-
},
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
const handleBlur = _ref2 => {
|
|
426
|
-
let {
|
|
427
|
-
target
|
|
428
|
-
} = _ref2;
|
|
429
|
-
return onKeyChange(target.value);
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
433
|
-
className: classNames
|
|
434
|
-
}, /*#__PURE__*/React.createElement(Row, {
|
|
435
|
-
align: toolbarAlign,
|
|
436
|
-
gutter: rowGutter
|
|
437
|
-
}, /*#__PURE__*/React.createElement(Col, {
|
|
438
|
-
className: "form-additional",
|
|
439
|
-
flex: "1"
|
|
440
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
441
|
-
className: "form-group"
|
|
442
|
-
}, /*#__PURE__*/React.createElement(Form$1.Item, {
|
|
443
|
-
colon: colon,
|
|
444
|
-
className: "form-group",
|
|
445
|
-
hasFeedback: true,
|
|
446
|
-
htmlFor: id + "-key",
|
|
447
|
-
label: keyLabel,
|
|
448
|
-
labelCol: labelCol,
|
|
449
|
-
required: required,
|
|
450
|
-
style: wrapperStyle,
|
|
451
|
-
wrapperCol: wrapperCol
|
|
452
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
453
|
-
className: "form-control",
|
|
454
|
-
defaultValue: label,
|
|
455
|
-
disabled: disabled || readonlyAsDisabled && readonly,
|
|
456
|
-
id: id + "-key",
|
|
457
|
-
name: id + "-key",
|
|
458
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
459
|
-
style: INPUT_STYLE$1,
|
|
460
|
-
type: "text"
|
|
461
|
-
})))), /*#__PURE__*/React.createElement(Col, {
|
|
462
|
-
className: "form-additional",
|
|
463
|
-
flex: "1"
|
|
464
|
-
}, children), /*#__PURE__*/React.createElement(Col, {
|
|
465
|
-
flex: "192px"
|
|
466
|
-
}, /*#__PURE__*/React.createElement(RemoveButton, {
|
|
467
|
-
block: true,
|
|
468
|
-
className: "array-item-remove",
|
|
469
|
-
disabled: disabled || readonly,
|
|
470
|
-
onClick: onDropPropertyClick(label)
|
|
471
|
-
}))));
|
|
472
|
-
};
|
|
390
|
+
key: "field-" + id + "-error-" + error
|
|
391
|
+
}, error);
|
|
392
|
+
}));
|
|
393
|
+
}
|
|
473
394
|
|
|
474
|
-
|
|
395
|
+
var VERTICAL_LABEL_COL$1 = {
|
|
475
396
|
span: 24
|
|
476
397
|
};
|
|
477
|
-
|
|
398
|
+
var VERTICAL_WRAPPER_COL$1 = {
|
|
478
399
|
span: 24
|
|
479
400
|
};
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
401
|
+
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
402
|
+
* content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.
|
|
403
|
+
*
|
|
404
|
+
* @param props - The `FieldTemplateProps` for this component
|
|
405
|
+
*/
|
|
406
|
+
function FieldTemplate(props) {
|
|
407
|
+
var children = props.children,
|
|
408
|
+
classNames = props.classNames,
|
|
409
|
+
style = props.style,
|
|
410
|
+
description = props.description,
|
|
411
|
+
disabled = props.disabled,
|
|
412
|
+
displayLabel = props.displayLabel,
|
|
413
|
+
errors = props.errors,
|
|
414
|
+
formContext = props.formContext,
|
|
415
|
+
help = props.help,
|
|
416
|
+
hidden = props.hidden,
|
|
417
|
+
id = props.id,
|
|
418
|
+
label = props.label,
|
|
419
|
+
onDropPropertyClick = props.onDropPropertyClick,
|
|
420
|
+
onKeyChange = props.onKeyChange,
|
|
421
|
+
rawErrors = props.rawErrors,
|
|
422
|
+
rawDescription = props.rawDescription,
|
|
423
|
+
rawHelp = props.rawHelp,
|
|
424
|
+
readonly = props.readonly,
|
|
425
|
+
registry = props.registry,
|
|
426
|
+
required = props.required,
|
|
427
|
+
schema = props.schema,
|
|
428
|
+
uiSchema = props.uiSchema;
|
|
429
|
+
var colon = formContext.colon,
|
|
430
|
+
_formContext$labelCol = formContext.labelCol,
|
|
431
|
+
labelCol = _formContext$labelCol === void 0 ? VERTICAL_LABEL_COL$1 : _formContext$labelCol,
|
|
432
|
+
_formContext$wrapperC = formContext.wrapperCol,
|
|
433
|
+
wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
|
|
434
|
+
wrapperStyle = formContext.wrapperStyle;
|
|
435
|
+
var uiOptions = getUiOptions(uiSchema);
|
|
436
|
+
var WrapIfAdditionalTemplate = getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
|
|
511
437
|
if (hidden) {
|
|
512
438
|
return /*#__PURE__*/React.createElement("div", {
|
|
513
439
|
className: "field-hidden"
|
|
514
440
|
}, children);
|
|
515
441
|
}
|
|
516
|
-
|
|
517
|
-
return /*#__PURE__*/React.createElement(WrapIfAdditional, {
|
|
442
|
+
return /*#__PURE__*/React.createElement(WrapIfAdditionalTemplate, {
|
|
518
443
|
classNames: classNames,
|
|
444
|
+
style: style,
|
|
519
445
|
disabled: disabled,
|
|
520
|
-
formContext: formContext,
|
|
521
446
|
id: id,
|
|
522
447
|
label: label,
|
|
523
448
|
onDropPropertyClick: onDropPropertyClick,
|
|
@@ -525,12 +450,13 @@ const FieldTemplate = _ref => {
|
|
|
525
450
|
readonly: readonly,
|
|
526
451
|
required: required,
|
|
527
452
|
schema: schema,
|
|
453
|
+
uiSchema: uiSchema,
|
|
528
454
|
registry: registry
|
|
529
455
|
}, id === "root" ? children : /*#__PURE__*/React.createElement(Form$1.Item, {
|
|
530
456
|
colon: colon,
|
|
531
|
-
extra: description,
|
|
457
|
+
extra: rawDescription && description,
|
|
532
458
|
hasFeedback: schema.type !== "array" && schema.type !== "object",
|
|
533
|
-
help: !!rawHelp && help || errors,
|
|
459
|
+
help: !!rawHelp && help || (rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? errors : undefined),
|
|
534
460
|
htmlFor: id,
|
|
535
461
|
label: displayLabel && label,
|
|
536
462
|
labelCol: labelCol,
|
|
@@ -539,346 +465,469 @@ const FieldTemplate = _ref => {
|
|
|
539
465
|
validateStatus: rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? "error" : undefined,
|
|
540
466
|
wrapperCol: wrapperCol
|
|
541
467
|
}, children));
|
|
542
|
-
}
|
|
468
|
+
}
|
|
543
469
|
|
|
544
|
-
|
|
470
|
+
var DESCRIPTION_COL_STYLE = {
|
|
545
471
|
paddingBottom: "8px"
|
|
546
472
|
};
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
rowGutter = 24
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
)
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
473
|
+
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
474
|
+
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
|
|
475
|
+
* the properties.
|
|
476
|
+
*
|
|
477
|
+
* @param props - The `ObjectFieldTemplateProps` for this component
|
|
478
|
+
*/
|
|
479
|
+
function ObjectFieldTemplate(props) {
|
|
480
|
+
var description = props.description,
|
|
481
|
+
disabled = props.disabled,
|
|
482
|
+
formContext = props.formContext,
|
|
483
|
+
formData = props.formData,
|
|
484
|
+
idSchema = props.idSchema,
|
|
485
|
+
onAddClick = props.onAddClick,
|
|
486
|
+
properties = props.properties,
|
|
487
|
+
readonly = props.readonly,
|
|
488
|
+
required = props.required,
|
|
489
|
+
registry = props.registry,
|
|
490
|
+
schema = props.schema,
|
|
491
|
+
title = props.title,
|
|
492
|
+
uiSchema = props.uiSchema;
|
|
493
|
+
var uiOptions = getUiOptions(uiSchema);
|
|
494
|
+
var TitleFieldTemplate = getTemplate("TitleFieldTemplate", registry, uiOptions);
|
|
495
|
+
var DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry, uiOptions);
|
|
496
|
+
// Button templates are not overridden in the uiSchema
|
|
497
|
+
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
498
|
+
var _formContext$colSpan = formContext.colSpan,
|
|
499
|
+
colSpan = _formContext$colSpan === void 0 ? 24 : _formContext$colSpan,
|
|
500
|
+
_formContext$labelAli = formContext.labelAlign,
|
|
501
|
+
labelAlign = _formContext$labelAli === void 0 ? "right" : _formContext$labelAli,
|
|
502
|
+
_formContext$rowGutte = formContext.rowGutter,
|
|
503
|
+
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
504
|
+
var findSchema = function findSchema(element) {
|
|
505
|
+
return element.content.props.schema;
|
|
506
|
+
};
|
|
507
|
+
var findSchemaType = function findSchemaType(element) {
|
|
508
|
+
return findSchema(element).type;
|
|
509
|
+
};
|
|
510
|
+
var findUiSchema = function findUiSchema(element) {
|
|
511
|
+
return element.content.props.uiSchema;
|
|
512
|
+
};
|
|
513
|
+
var findUiSchemaField = function findUiSchemaField(element) {
|
|
514
|
+
return getUiOptions(findUiSchema(element)).field;
|
|
515
|
+
};
|
|
516
|
+
var findUiSchemaWidget = function findUiSchemaWidget(element) {
|
|
517
|
+
return getUiOptions(findUiSchema(element)).widget;
|
|
518
|
+
};
|
|
519
|
+
var calculateColSpan = function calculateColSpan(element) {
|
|
520
|
+
var type = findSchemaType(element);
|
|
521
|
+
var field = findUiSchemaField(element);
|
|
522
|
+
var widget = findUiSchemaWidget(element);
|
|
523
|
+
var defaultColSpan = properties.length < 2 ||
|
|
524
|
+
// Single or no field in object.
|
|
598
525
|
type === "object" || type === "array" || widget === "textarea" ? 24 : 12;
|
|
599
|
-
|
|
600
526
|
if (isObject(colSpan)) {
|
|
601
|
-
|
|
527
|
+
var colSpanObj = colSpan;
|
|
528
|
+
if (isString(widget)) {
|
|
529
|
+
return colSpanObj[widget];
|
|
530
|
+
}
|
|
531
|
+
if (isString(field)) {
|
|
532
|
+
return colSpanObj[field];
|
|
533
|
+
}
|
|
534
|
+
if (isString(type)) {
|
|
535
|
+
return colSpanObj[type];
|
|
536
|
+
}
|
|
602
537
|
}
|
|
603
|
-
|
|
604
538
|
if (isNumber(colSpan)) {
|
|
605
539
|
return colSpan;
|
|
606
540
|
}
|
|
607
|
-
|
|
608
541
|
return defaultColSpan;
|
|
609
542
|
};
|
|
543
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (configProps) {
|
|
544
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
545
|
+
var prefixCls = getPrefixCls("form");
|
|
546
|
+
var labelClsBasic = prefixCls + "-item-label";
|
|
547
|
+
var labelColClassName = classNames(labelClsBasic, labelAlign === "left" && labelClsBasic + "-left"
|
|
548
|
+
// labelCol.className,
|
|
549
|
+
);
|
|
550
|
+
|
|
551
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
552
|
+
id: idSchema.$id
|
|
553
|
+
}, /*#__PURE__*/React.createElement(Row, {
|
|
554
|
+
gutter: rowGutter
|
|
555
|
+
}, (uiOptions.title || title) && /*#__PURE__*/React.createElement(Col, {
|
|
556
|
+
className: labelColClassName,
|
|
557
|
+
span: 24
|
|
558
|
+
}, /*#__PURE__*/React.createElement(TitleFieldTemplate, {
|
|
559
|
+
id: titleId(idSchema),
|
|
560
|
+
title: uiOptions.title || title,
|
|
561
|
+
required: required,
|
|
562
|
+
schema: schema,
|
|
563
|
+
uiSchema: uiSchema,
|
|
564
|
+
registry: registry
|
|
565
|
+
})), (uiOptions.description || description) && /*#__PURE__*/React.createElement(Col, {
|
|
566
|
+
span: 24,
|
|
567
|
+
style: DESCRIPTION_COL_STYLE
|
|
568
|
+
}, /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
|
|
569
|
+
id: descriptionId(idSchema),
|
|
570
|
+
description: uiOptions.description || description,
|
|
571
|
+
schema: schema,
|
|
572
|
+
uiSchema: uiSchema,
|
|
573
|
+
registry: registry
|
|
574
|
+
})), properties.filter(function (e) {
|
|
575
|
+
return !e.hidden;
|
|
576
|
+
}).map(function (element) {
|
|
577
|
+
return /*#__PURE__*/React.createElement(Col, {
|
|
578
|
+
key: element.name,
|
|
579
|
+
span: calculateColSpan(element)
|
|
580
|
+
}, element.content);
|
|
581
|
+
})), canExpand(schema, uiSchema, formData) && /*#__PURE__*/React.createElement(Col, {
|
|
582
|
+
span: 24
|
|
583
|
+
}, /*#__PURE__*/React.createElement(Row, {
|
|
584
|
+
gutter: rowGutter,
|
|
585
|
+
justify: "end"
|
|
586
|
+
}, /*#__PURE__*/React.createElement(Col, {
|
|
587
|
+
flex: "192px"
|
|
588
|
+
}, /*#__PURE__*/React.createElement(AddButton, {
|
|
589
|
+
className: "object-property-expand",
|
|
590
|
+
disabled: disabled || readonly,
|
|
591
|
+
onClick: onAddClick(schema),
|
|
592
|
+
uiSchema: uiSchema,
|
|
593
|
+
registry: registry
|
|
594
|
+
})))));
|
|
595
|
+
});
|
|
596
|
+
}
|
|
610
597
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
id: idSchema.$id + "-title",
|
|
620
|
-
required: required,
|
|
621
|
-
title: uiOptions.title || title,
|
|
622
|
-
uiSchema: uiSchema,
|
|
623
|
-
registry: registry
|
|
624
|
-
})), uiOptions.description !== false && (uiOptions.description || description) && /*#__PURE__*/React.createElement(Col, {
|
|
625
|
-
span: 24,
|
|
626
|
-
style: DESCRIPTION_COL_STYLE
|
|
627
|
-
}, /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
|
|
628
|
-
description: uiOptions.description || description,
|
|
629
|
-
id: idSchema.$id + "-description",
|
|
630
|
-
registry: registry
|
|
631
|
-
})), properties.filter(e => !e.hidden).map(element => /*#__PURE__*/React.createElement(Col, {
|
|
632
|
-
key: element.name,
|
|
633
|
-
span: calculateColSpan(element)
|
|
634
|
-
}, element.content))), canExpand(schema, uiSchema, formData) && /*#__PURE__*/React.createElement(Col, {
|
|
635
|
-
span: 24
|
|
636
|
-
}, /*#__PURE__*/React.createElement(Row, {
|
|
637
|
-
gutter: rowGutter,
|
|
638
|
-
justify: "end"
|
|
639
|
-
}, /*#__PURE__*/React.createElement(Col, {
|
|
640
|
-
flex: "192px"
|
|
641
|
-
}, /*#__PURE__*/React.createElement(AddButton, {
|
|
642
|
-
className: "object-property-expand",
|
|
643
|
-
disabled: disabled || readonly,
|
|
644
|
-
onClick: onAddClick(schema)
|
|
645
|
-
})))));
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
var ObjectFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
|
|
649
|
-
prefixCls: "form"
|
|
650
|
-
})(ObjectFieldTemplate);
|
|
651
|
-
|
|
652
|
-
var SubmitButton = (_ref => {
|
|
653
|
-
let {
|
|
654
|
-
uiSchema
|
|
655
|
-
} = _ref;
|
|
656
|
-
const {
|
|
657
|
-
submitText,
|
|
658
|
-
norender,
|
|
659
|
-
props: submitButtonProps
|
|
660
|
-
} = getSubmitButtonOptions(uiSchema);
|
|
661
|
-
|
|
598
|
+
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
599
|
+
*/
|
|
600
|
+
function SubmitButton(_ref) {
|
|
601
|
+
var uiSchema = _ref.uiSchema;
|
|
602
|
+
var _getSubmitButtonOptio = getSubmitButtonOptions(uiSchema),
|
|
603
|
+
submitText = _getSubmitButtonOptio.submitText,
|
|
604
|
+
norender = _getSubmitButtonOptio.norender,
|
|
605
|
+
submitButtonProps = _getSubmitButtonOptio.props;
|
|
662
606
|
if (norender) {
|
|
663
607
|
return null;
|
|
664
608
|
}
|
|
665
|
-
|
|
666
609
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
667
610
|
type: "submit"
|
|
668
611
|
}, submitButtonProps, {
|
|
669
612
|
htmlType: "submit"
|
|
670
613
|
}), submitText);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
const TitleField = _ref => {
|
|
674
|
-
let {
|
|
675
|
-
id,
|
|
676
|
-
prefixCls,
|
|
677
|
-
required,
|
|
678
|
-
registry,
|
|
679
|
-
title
|
|
680
|
-
} = _ref;
|
|
681
|
-
const {
|
|
682
|
-
formContext
|
|
683
|
-
} = registry;
|
|
684
|
-
const {
|
|
685
|
-
colon = true
|
|
686
|
-
} = formContext;
|
|
687
|
-
let labelChildren = title;
|
|
614
|
+
}
|
|
688
615
|
|
|
616
|
+
/** The `TitleField` is the template to use to render the title of a field
|
|
617
|
+
*
|
|
618
|
+
* @param props - The `TitleFieldProps` for this component
|
|
619
|
+
*/
|
|
620
|
+
function TitleField(_ref) {
|
|
621
|
+
var id = _ref.id,
|
|
622
|
+
required = _ref.required,
|
|
623
|
+
registry = _ref.registry,
|
|
624
|
+
title = _ref.title;
|
|
625
|
+
var formContext = registry.formContext;
|
|
626
|
+
var _formContext$colon = formContext.colon,
|
|
627
|
+
colon = _formContext$colon === void 0 ? true : _formContext$colon;
|
|
628
|
+
var labelChildren = title;
|
|
689
629
|
if (colon && typeof title === "string" && title.trim() !== "") {
|
|
690
630
|
labelChildren = title.replace(/[::]\s*$/, "");
|
|
691
631
|
}
|
|
692
|
-
|
|
693
|
-
const labelClassName = classNames({
|
|
694
|
-
[prefixCls + "-item-required"]: required,
|
|
695
|
-
[prefixCls + "-item-no-colon"]: !colon
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
const handleLabelClick = () => {
|
|
632
|
+
var handleLabelClick = function handleLabelClick() {
|
|
699
633
|
if (!id) {
|
|
700
634
|
return;
|
|
701
635
|
}
|
|
702
|
-
|
|
703
|
-
const control = document.querySelector("[id=\"" + id + "\"]");
|
|
704
|
-
|
|
636
|
+
var control = document.querySelector("[id=\"" + id + "\"]");
|
|
705
637
|
if (control && control.focus) {
|
|
706
638
|
control.focus();
|
|
707
639
|
}
|
|
708
640
|
};
|
|
641
|
+
return title ? /*#__PURE__*/React.createElement(ConfigConsumer, null, function (configProps) {
|
|
642
|
+
var _classNames;
|
|
643
|
+
var getPrefixCls = configProps.getPrefixCls;
|
|
644
|
+
var prefixCls = getPrefixCls("form");
|
|
645
|
+
var labelClassName = classNames((_classNames = {}, _classNames[prefixCls + "-item-required"] = required, _classNames[prefixCls + "-item-no-colon"] = !colon, _classNames));
|
|
646
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
647
|
+
className: labelClassName,
|
|
648
|
+
htmlFor: id,
|
|
649
|
+
onClick: handleLabelClick,
|
|
650
|
+
title: typeof title === "string" ? title : ""
|
|
651
|
+
}, labelChildren);
|
|
652
|
+
}) : null;
|
|
653
|
+
}
|
|
709
654
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
htmlFor: id,
|
|
713
|
-
onClick: handleLabelClick,
|
|
714
|
-
title: typeof title === "string" ? title : ""
|
|
715
|
-
}, labelChildren) : null;
|
|
655
|
+
var VERTICAL_LABEL_COL = {
|
|
656
|
+
span: 24
|
|
716
657
|
};
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
658
|
+
var VERTICAL_WRAPPER_COL = {
|
|
659
|
+
span: 24
|
|
660
|
+
};
|
|
661
|
+
var INPUT_STYLE$1 = {
|
|
662
|
+
width: "100%"
|
|
720
663
|
};
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
664
|
+
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
665
|
+
* part of an `additionalProperties` part of a schema.
|
|
666
|
+
*
|
|
667
|
+
* @param props - The `WrapIfAdditionalProps` for this component
|
|
668
|
+
*/
|
|
669
|
+
function WrapIfAdditionalTemplate(props) {
|
|
670
|
+
var _extends2;
|
|
671
|
+
var children = props.children,
|
|
672
|
+
classNames = props.classNames,
|
|
673
|
+
style = props.style,
|
|
674
|
+
disabled = props.disabled,
|
|
675
|
+
id = props.id,
|
|
676
|
+
label = props.label,
|
|
677
|
+
onDropPropertyClick = props.onDropPropertyClick,
|
|
678
|
+
onKeyChange = props.onKeyChange,
|
|
679
|
+
readonly = props.readonly,
|
|
680
|
+
required = props.required,
|
|
681
|
+
registry = props.registry,
|
|
682
|
+
schema = props.schema,
|
|
683
|
+
uiSchema = props.uiSchema;
|
|
684
|
+
var _registry$formContext = registry.formContext,
|
|
685
|
+
colon = _registry$formContext.colon,
|
|
686
|
+
_registry$formContext2 = _registry$formContext.labelCol,
|
|
687
|
+
labelCol = _registry$formContext2 === void 0 ? VERTICAL_LABEL_COL : _registry$formContext2,
|
|
688
|
+
_registry$formContext3 = _registry$formContext.readonlyAsDisabled,
|
|
689
|
+
readonlyAsDisabled = _registry$formContext3 === void 0 ? true : _registry$formContext3,
|
|
690
|
+
_registry$formContext4 = _registry$formContext.rowGutter,
|
|
691
|
+
rowGutter = _registry$formContext4 === void 0 ? 24 : _registry$formContext4,
|
|
692
|
+
_registry$formContext5 = _registry$formContext.toolbarAlign,
|
|
693
|
+
toolbarAlign = _registry$formContext5 === void 0 ? "top" : _registry$formContext5,
|
|
694
|
+
_registry$formContext6 = _registry$formContext.wrapperCol,
|
|
695
|
+
wrapperCol = _registry$formContext6 === void 0 ? VERTICAL_WRAPPER_COL : _registry$formContext6,
|
|
696
|
+
wrapperStyle = _registry$formContext.wrapperStyle;
|
|
697
|
+
// Button templates are not overridden in the uiSchema
|
|
698
|
+
var RemoveButton = registry.templates.ButtonTemplates.RemoveButton;
|
|
699
|
+
var keyLabel = label + " Key"; // i18n ?
|
|
700
|
+
var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
701
|
+
if (!additional) {
|
|
702
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
703
|
+
className: classNames,
|
|
704
|
+
style: style
|
|
705
|
+
}, children);
|
|
706
|
+
}
|
|
707
|
+
var handleBlur = function handleBlur(_ref) {
|
|
708
|
+
var target = _ref.target;
|
|
709
|
+
return onKeyChange(target.value);
|
|
710
|
+
};
|
|
711
|
+
// The `block` prop is not part of the `IconButtonProps` defined in the template, so put it into the uiSchema instead
|
|
712
|
+
var uiOptions = uiSchema ? uiSchema[UI_OPTIONS_KEY] : {};
|
|
713
|
+
var buttonUiOptions = _extends({}, uiSchema, (_extends2 = {}, _extends2[UI_OPTIONS_KEY] = _extends({}, uiOptions, {
|
|
714
|
+
block: true
|
|
715
|
+
}), _extends2));
|
|
716
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
717
|
+
className: classNames,
|
|
718
|
+
style: style
|
|
719
|
+
}, /*#__PURE__*/React.createElement(Row, {
|
|
720
|
+
align: toolbarAlign,
|
|
721
|
+
gutter: rowGutter
|
|
722
|
+
}, /*#__PURE__*/React.createElement(Col, {
|
|
723
|
+
className: "form-additional",
|
|
724
|
+
flex: "1"
|
|
725
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
726
|
+
className: "form-group"
|
|
727
|
+
}, /*#__PURE__*/React.createElement(Form$1.Item, {
|
|
728
|
+
colon: colon,
|
|
729
|
+
className: "form-group",
|
|
730
|
+
hasFeedback: true,
|
|
731
|
+
htmlFor: id + "-key",
|
|
732
|
+
label: keyLabel,
|
|
733
|
+
labelCol: labelCol,
|
|
734
|
+
required: required,
|
|
735
|
+
style: wrapperStyle,
|
|
736
|
+
wrapperCol: wrapperCol
|
|
737
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
738
|
+
className: "form-control",
|
|
739
|
+
defaultValue: label,
|
|
740
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
741
|
+
id: id + "-key",
|
|
742
|
+
name: id + "-key",
|
|
743
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
744
|
+
style: INPUT_STYLE$1,
|
|
745
|
+
type: "text"
|
|
746
|
+
})))), /*#__PURE__*/React.createElement(Col, {
|
|
747
|
+
className: "form-additional",
|
|
748
|
+
flex: "1"
|
|
749
|
+
}, children), /*#__PURE__*/React.createElement(Col, {
|
|
750
|
+
flex: "192px"
|
|
751
|
+
}, /*#__PURE__*/React.createElement(RemoveButton, {
|
|
752
|
+
className: "array-item-remove",
|
|
753
|
+
disabled: disabled || readonly,
|
|
754
|
+
onClick: onDropPropertyClick(label),
|
|
755
|
+
uiSchema: buttonUiOptions,
|
|
756
|
+
registry: registry
|
|
757
|
+
}))));
|
|
758
|
+
}
|
|
724
759
|
|
|
725
|
-
|
|
726
|
-
|
|
760
|
+
function generateTemplates() {
|
|
761
|
+
return {
|
|
762
|
+
ArrayFieldItemTemplate: ArrayFieldItemTemplate,
|
|
763
|
+
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
764
|
+
BaseInputTemplate: BaseInputTemplate,
|
|
765
|
+
ButtonTemplates: {
|
|
766
|
+
AddButton: AddButton,
|
|
767
|
+
MoveDownButton: MoveDownButton,
|
|
768
|
+
MoveUpButton: MoveUpButton,
|
|
769
|
+
RemoveButton: RemoveButton,
|
|
770
|
+
SubmitButton: SubmitButton
|
|
771
|
+
},
|
|
772
|
+
DescriptionFieldTemplate: DescriptionField,
|
|
773
|
+
ErrorListTemplate: ErrorList,
|
|
774
|
+
FieldErrorTemplate: FieldErrorTemplate,
|
|
775
|
+
FieldTemplate: FieldTemplate,
|
|
776
|
+
ObjectFieldTemplate: ObjectFieldTemplate,
|
|
777
|
+
TitleFieldTemplate: TitleField,
|
|
778
|
+
WrapIfAdditionalTemplate: WrapIfAdditionalTemplate
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
var index$1 = /*#__PURE__*/generateTemplates();
|
|
727
782
|
|
|
728
|
-
|
|
783
|
+
var rangeOptions = function rangeOptions(start, stop) {
|
|
784
|
+
var options = [];
|
|
785
|
+
for (var i = start; i <= stop; i++) {
|
|
729
786
|
options.push({
|
|
730
787
|
value: i,
|
|
731
788
|
label: pad(i, 2)
|
|
732
789
|
});
|
|
733
790
|
}
|
|
734
|
-
|
|
735
791
|
return options;
|
|
736
792
|
};
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
793
|
+
var readyForChange = function readyForChange(state) {
|
|
794
|
+
return Object.values(state).every(function (value) {
|
|
795
|
+
return value !== -1;
|
|
796
|
+
});
|
|
740
797
|
};
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
798
|
+
function dateElementProps(state, time, yearsRange) {
|
|
799
|
+
if (yearsRange === void 0) {
|
|
800
|
+
yearsRange = [1900, new Date().getFullYear() + 2];
|
|
801
|
+
}
|
|
802
|
+
var year = state.year,
|
|
803
|
+
month = state.month,
|
|
804
|
+
day = state.day,
|
|
805
|
+
hour = state.hour,
|
|
806
|
+
minute = state.minute,
|
|
807
|
+
second = state.second;
|
|
808
|
+
var data = [{
|
|
809
|
+
type: "year",
|
|
810
|
+
range: yearsRange,
|
|
811
|
+
value: year
|
|
812
|
+
}, {
|
|
813
|
+
type: "month",
|
|
814
|
+
range: [1, 12],
|
|
815
|
+
value: month
|
|
816
|
+
}, {
|
|
817
|
+
type: "day",
|
|
818
|
+
range: [1, 31],
|
|
819
|
+
value: day
|
|
820
|
+
}];
|
|
821
|
+
if (time) {
|
|
822
|
+
data.push({
|
|
823
|
+
type: "hour",
|
|
824
|
+
range: [0, 23],
|
|
825
|
+
value: hour || -1
|
|
826
|
+
}, {
|
|
827
|
+
type: "minute",
|
|
828
|
+
range: [0, 59],
|
|
829
|
+
value: minute || -1
|
|
830
|
+
}, {
|
|
831
|
+
type: "second",
|
|
832
|
+
range: [0, 59],
|
|
833
|
+
value: second || -1
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
return data;
|
|
837
|
+
}
|
|
838
|
+
function AltDateWidget(props) {
|
|
839
|
+
var autofocus = props.autofocus,
|
|
840
|
+
disabled = props.disabled,
|
|
841
|
+
formContext = props.formContext,
|
|
842
|
+
id = props.id,
|
|
843
|
+
onBlur = props.onBlur,
|
|
844
|
+
onChange = props.onChange,
|
|
845
|
+
onFocus = props.onFocus,
|
|
846
|
+
options = props.options,
|
|
847
|
+
readonly = props.readonly,
|
|
848
|
+
registry = props.registry,
|
|
849
|
+
showTime = props.showTime,
|
|
850
|
+
value = props.value;
|
|
851
|
+
var SelectWidget = registry.widgets.SelectWidget;
|
|
852
|
+
var _formContext$rowGutte = formContext.rowGutter,
|
|
853
|
+
rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
|
|
854
|
+
var _useState = useState(parseDateString(value, showTime)),
|
|
855
|
+
state = _useState[0],
|
|
856
|
+
setState = _useState[1];
|
|
857
|
+
useEffect(function () {
|
|
765
858
|
setState(parseDateString(value, showTime));
|
|
766
859
|
}, [showTime, value]);
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
771
|
-
};
|
|
772
|
-
|
|
860
|
+
var handleChange = function handleChange(property, nextValue) {
|
|
861
|
+
var _extends2;
|
|
862
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === "undefined" ? -1 : nextValue, _extends2));
|
|
773
863
|
if (readyForChange(nextState)) {
|
|
774
864
|
onChange(toDateString(nextState, showTime));
|
|
775
865
|
} else {
|
|
776
866
|
setState(nextState);
|
|
777
867
|
}
|
|
778
868
|
};
|
|
779
|
-
|
|
780
|
-
const handleNow = event => {
|
|
869
|
+
var handleNow = function handleNow(event) {
|
|
781
870
|
event.preventDefault();
|
|
782
|
-
|
|
783
871
|
if (disabled || readonly) {
|
|
784
872
|
return;
|
|
785
873
|
}
|
|
786
|
-
|
|
787
|
-
const nextState = parseDateString(new Date().toJSON(), showTime);
|
|
874
|
+
var nextState = parseDateString(new Date().toJSON(), showTime);
|
|
788
875
|
onChange(toDateString(nextState, showTime));
|
|
789
876
|
};
|
|
790
|
-
|
|
791
|
-
const handleClear = event => {
|
|
877
|
+
var handleClear = function handleClear(event) {
|
|
792
878
|
event.preventDefault();
|
|
793
|
-
|
|
794
879
|
if (disabled || readonly) {
|
|
795
880
|
return;
|
|
796
881
|
}
|
|
797
|
-
|
|
798
882
|
onChange(undefined);
|
|
799
883
|
};
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
data.push({
|
|
826
|
-
type: "hour",
|
|
827
|
-
range: [0, 23],
|
|
828
|
-
value: hour
|
|
829
|
-
}, {
|
|
830
|
-
type: "minute",
|
|
831
|
-
range: [0, 59],
|
|
832
|
-
value: minute
|
|
833
|
-
}, {
|
|
834
|
-
type: "second",
|
|
835
|
-
range: [0, 59],
|
|
836
|
-
value: second
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
return data;
|
|
884
|
+
var renderDateElement = function renderDateElement(elemProps) {
|
|
885
|
+
return /*#__PURE__*/React.createElement(SelectWidget, {
|
|
886
|
+
autofocus: elemProps.autofocus,
|
|
887
|
+
className: "form-control",
|
|
888
|
+
disabled: elemProps.disabled,
|
|
889
|
+
id: elemProps.id,
|
|
890
|
+
name: elemProps.name,
|
|
891
|
+
onBlur: elemProps.onBlur,
|
|
892
|
+
onChange: function onChange(elemValue) {
|
|
893
|
+
return elemProps.select(elemProps.type, elemValue);
|
|
894
|
+
},
|
|
895
|
+
onFocus: elemProps.onFocus,
|
|
896
|
+
options: {
|
|
897
|
+
enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1])
|
|
898
|
+
},
|
|
899
|
+
placeholder: elemProps.type,
|
|
900
|
+
readonly: elemProps.readonly,
|
|
901
|
+
schema: {
|
|
902
|
+
type: "integer"
|
|
903
|
+
},
|
|
904
|
+
value: elemProps.value,
|
|
905
|
+
registry: registry,
|
|
906
|
+
label: "",
|
|
907
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
908
|
+
});
|
|
841
909
|
};
|
|
842
|
-
|
|
843
|
-
const renderDateElement = elemProps => /*#__PURE__*/React.createElement(SelectWidget, {
|
|
844
|
-
autofocus: elemProps.autofocus,
|
|
845
|
-
className: "form-control",
|
|
846
|
-
disabled: elemProps.disabled,
|
|
847
|
-
id: elemProps.id,
|
|
848
|
-
onBlur: elemProps.onBlur,
|
|
849
|
-
onChange: elemValue => elemProps.select(elemProps.type, elemValue),
|
|
850
|
-
onFocus: elemProps.onFocus,
|
|
851
|
-
options: {
|
|
852
|
-
enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1])
|
|
853
|
-
},
|
|
854
|
-
placeholder: elemProps.type,
|
|
855
|
-
readonly: elemProps.readonly,
|
|
856
|
-
schema: {
|
|
857
|
-
type: "integer"
|
|
858
|
-
},
|
|
859
|
-
value: elemProps.value
|
|
860
|
-
});
|
|
861
|
-
|
|
862
910
|
return /*#__PURE__*/React.createElement(Row, {
|
|
863
911
|
gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
|
|
864
|
-
}, dateElementProps().map((elemProps, i)
|
|
865
|
-
|
|
912
|
+
}, dateElementProps(state, showTime, options.yearsRange).map(function (elemProps, i) {
|
|
913
|
+
var elemId = id + "_" + elemProps.type;
|
|
866
914
|
return /*#__PURE__*/React.createElement(Col, {
|
|
867
915
|
flex: "88px",
|
|
868
916
|
key: elemId
|
|
869
|
-
}, renderDateElement({
|
|
917
|
+
}, renderDateElement(_extends({}, elemProps, {
|
|
870
918
|
autofocus: autofocus && i === 0,
|
|
871
|
-
disabled,
|
|
919
|
+
disabled: disabled,
|
|
872
920
|
id: elemId,
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
921
|
+
name: id,
|
|
922
|
+
onBlur: onBlur,
|
|
923
|
+
onFocus: onFocus,
|
|
924
|
+
readonly: readonly,
|
|
925
|
+
registry: registry,
|
|
877
926
|
select: handleChange,
|
|
878
927
|
// NOTE: antd components accept -1 rather than issue a warning
|
|
879
928
|
// like material-ui, so we need to convert -1 to undefined here.
|
|
880
929
|
value: elemProps.value < 0 ? undefined : elemProps.value
|
|
881
|
-
}));
|
|
930
|
+
})));
|
|
882
931
|
}), !options.hideNowButton && /*#__PURE__*/React.createElement(Col, {
|
|
883
932
|
flex: "88px"
|
|
884
933
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -895,8 +944,7 @@ const AltDateWidget = _ref => {
|
|
|
895
944
|
onClick: handleClear,
|
|
896
945
|
type: "primary"
|
|
897
946
|
}, "Clear")));
|
|
898
|
-
}
|
|
899
|
-
|
|
947
|
+
}
|
|
900
948
|
AltDateWidget.defaultProps = {
|
|
901
949
|
autofocus: false,
|
|
902
950
|
disabled: false,
|
|
@@ -907,173 +955,159 @@ AltDateWidget.defaultProps = {
|
|
|
907
955
|
showTime: false
|
|
908
956
|
};
|
|
909
957
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
AltDateWidget
|
|
913
|
-
} = props.registry.widgets;
|
|
958
|
+
function AltDateTimeWidget(props) {
|
|
959
|
+
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
914
960
|
return /*#__PURE__*/React.createElement(AltDateWidget, _extends({
|
|
915
961
|
showTime: true
|
|
916
962
|
}, props));
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
AltDateTimeWidget.defaultProps = { ...AltDateWidget.defaultProps,
|
|
963
|
+
}
|
|
964
|
+
AltDateTimeWidget.defaultProps = /*#__PURE__*/_extends({}, AltDateWidget.defaultProps, {
|
|
920
965
|
showTime: true
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
const CheckboxesWidget = _ref => {
|
|
924
|
-
let {
|
|
925
|
-
autofocus,
|
|
926
|
-
disabled,
|
|
927
|
-
formContext,
|
|
928
|
-
id,
|
|
929
|
-
// label,
|
|
930
|
-
onBlur,
|
|
931
|
-
onChange,
|
|
932
|
-
onFocus,
|
|
933
|
-
options,
|
|
934
|
-
// placeholder,
|
|
935
|
-
readonly,
|
|
936
|
-
// required,
|
|
937
|
-
// schema,
|
|
938
|
-
value
|
|
939
|
-
} = _ref;
|
|
940
|
-
const {
|
|
941
|
-
readonlyAsDisabled = true
|
|
942
|
-
} = formContext;
|
|
943
|
-
const {
|
|
944
|
-
enumOptions,
|
|
945
|
-
enumDisabled,
|
|
946
|
-
inline
|
|
947
|
-
} = options;
|
|
948
|
-
|
|
949
|
-
const handleChange = nextValue => onChange(nextValue);
|
|
966
|
+
});
|
|
950
967
|
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
968
|
+
/** The `CheckboxesWidget` is a widget for rendering checkbox groups.
|
|
969
|
+
* It is typically used to represent an array of enums.
|
|
970
|
+
*
|
|
971
|
+
* @param props - The `WidgetProps` for this component
|
|
972
|
+
*/
|
|
973
|
+
function CheckboxesWidget(_ref) {
|
|
974
|
+
var autofocus = _ref.autofocus,
|
|
975
|
+
disabled = _ref.disabled,
|
|
976
|
+
formContext = _ref.formContext,
|
|
977
|
+
id = _ref.id,
|
|
978
|
+
onBlur = _ref.onBlur,
|
|
979
|
+
onChange = _ref.onChange,
|
|
980
|
+
onFocus = _ref.onFocus,
|
|
981
|
+
options = _ref.options,
|
|
982
|
+
readonly = _ref.readonly,
|
|
983
|
+
value = _ref.value;
|
|
984
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
985
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
986
|
+
var enumOptions = options.enumOptions,
|
|
987
|
+
enumDisabled = options.enumDisabled,
|
|
988
|
+
inline = options.inline,
|
|
989
|
+
emptyValue = options.emptyValue;
|
|
990
|
+
var handleChange = function handleChange(nextValue) {
|
|
991
|
+
return onChange(enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
956
992
|
};
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
target
|
|
961
|
-
} = _ref3;
|
|
962
|
-
return onFocus(id, target.value);
|
|
993
|
+
var handleBlur = function handleBlur(_ref2) {
|
|
994
|
+
var target = _ref2.target;
|
|
995
|
+
return onBlur(id, enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
963
996
|
};
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
997
|
+
var handleFocus = function handleFocus(_ref3) {
|
|
998
|
+
var target = _ref3.target;
|
|
999
|
+
return onFocus(id, enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1000
|
+
};
|
|
1001
|
+
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1002
|
+
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1003
|
+
var extraProps = {
|
|
967
1004
|
id: id,
|
|
968
|
-
name: id,
|
|
969
1005
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1006
|
+
onFocus: !readonly ? handleFocus : undefined
|
|
1007
|
+
};
|
|
1008
|
+
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
|
|
1009
|
+
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /*#__PURE__*/React.createElement(Checkbox.Group, _extends({
|
|
1010
|
+
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1011
|
+
name: id,
|
|
970
1012
|
onChange: !readonly ? handleChange : undefined,
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
value: optionValue,
|
|
976
|
-
label: optionLabel
|
|
977
|
-
} = _ref4;
|
|
1013
|
+
value: selectedIndexes
|
|
1014
|
+
}, extraProps, {
|
|
1015
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1016
|
+
}), Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
978
1017
|
return /*#__PURE__*/React.createElement("span", {
|
|
979
|
-
key:
|
|
1018
|
+
key: i
|
|
980
1019
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
1020
|
+
id: optionId(id, i),
|
|
1021
|
+
name: id,
|
|
981
1022
|
autoFocus: i === 0 ? autofocus : false,
|
|
982
|
-
disabled: enumDisabled && enumDisabled.indexOf(value) !== -1,
|
|
983
|
-
value:
|
|
984
|
-
},
|
|
1023
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1024
|
+
value: String(i)
|
|
1025
|
+
}, option.label), !inline && /*#__PURE__*/React.createElement("br", null));
|
|
985
1026
|
})) : null;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
const CheckboxWidget = _ref => {
|
|
989
|
-
let {
|
|
990
|
-
autofocus,
|
|
991
|
-
disabled,
|
|
992
|
-
formContext,
|
|
993
|
-
id,
|
|
994
|
-
label,
|
|
995
|
-
onBlur,
|
|
996
|
-
onChange,
|
|
997
|
-
onFocus,
|
|
998
|
-
// options,
|
|
999
|
-
// placeholder,
|
|
1000
|
-
readonly,
|
|
1001
|
-
// required,
|
|
1002
|
-
// schema,
|
|
1003
|
-
value
|
|
1004
|
-
} = _ref;
|
|
1005
|
-
const {
|
|
1006
|
-
readonlyAsDisabled = true
|
|
1007
|
-
} = formContext;
|
|
1027
|
+
}
|
|
1008
1028
|
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1029
|
+
/** The `CheckBoxWidget` is a widget for rendering boolean properties.
|
|
1030
|
+
* It is typically used to represent a boolean.
|
|
1031
|
+
*
|
|
1032
|
+
* @param props - The `WidgetProps` for this component
|
|
1033
|
+
*/
|
|
1034
|
+
function CheckboxWidget(props) {
|
|
1035
|
+
var autofocus = props.autofocus,
|
|
1036
|
+
disabled = props.disabled,
|
|
1037
|
+
formContext = props.formContext,
|
|
1038
|
+
id = props.id,
|
|
1039
|
+
label = props.label,
|
|
1040
|
+
onBlur = props.onBlur,
|
|
1041
|
+
onChange = props.onChange,
|
|
1042
|
+
onFocus = props.onFocus,
|
|
1043
|
+
readonly = props.readonly,
|
|
1044
|
+
value = props.value;
|
|
1045
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1046
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1047
|
+
var handleChange = function handleChange(_ref) {
|
|
1048
|
+
var target = _ref.target;
|
|
1013
1049
|
return onChange(target.checked);
|
|
1014
1050
|
};
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
let {
|
|
1018
|
-
target
|
|
1019
|
-
} = _ref3;
|
|
1051
|
+
var handleBlur = function handleBlur(_ref2) {
|
|
1052
|
+
var target = _ref2.target;
|
|
1020
1053
|
return onBlur(id, target.checked);
|
|
1021
1054
|
};
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
let {
|
|
1025
|
-
target
|
|
1026
|
-
} = _ref4;
|
|
1055
|
+
var handleFocus = function handleFocus(_ref3) {
|
|
1056
|
+
var target = _ref3.target;
|
|
1027
1057
|
return onFocus(id, target.checked);
|
|
1028
1058
|
};
|
|
1029
|
-
|
|
1030
|
-
|
|
1059
|
+
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1060
|
+
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1061
|
+
var extraProps = {
|
|
1062
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
1063
|
+
onFocus: !readonly ? handleFocus : undefined
|
|
1064
|
+
};
|
|
1065
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({
|
|
1031
1066
|
autoFocus: autofocus,
|
|
1032
1067
|
checked: typeof value === "undefined" ? false : value,
|
|
1033
1068
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1034
1069
|
id: id,
|
|
1035
1070
|
name: id,
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
}, label);
|
|
1040
|
-
}
|
|
1071
|
+
onChange: !readonly ? handleChange : undefined
|
|
1072
|
+
}, extraProps, {
|
|
1073
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1074
|
+
}), label);
|
|
1075
|
+
}
|
|
1041
1076
|
|
|
1042
|
-
|
|
1077
|
+
var DatePicker = /*#__PURE__*/generatePicker(dayjsGenerateConfig);
|
|
1043
1078
|
|
|
1044
|
-
|
|
1079
|
+
var DATE_PICKER_STYLE$1 = {
|
|
1045
1080
|
width: "100%"
|
|
1046
1081
|
};
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
placeholder,
|
|
1060
|
-
readonly,
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1082
|
+
/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
|
|
1083
|
+
* the value to/from utc using the appropriate utility functions.
|
|
1084
|
+
*
|
|
1085
|
+
* @param props - The `WidgetProps` for this component
|
|
1086
|
+
*/
|
|
1087
|
+
function DateTimeWidget(props) {
|
|
1088
|
+
var disabled = props.disabled,
|
|
1089
|
+
formContext = props.formContext,
|
|
1090
|
+
id = props.id,
|
|
1091
|
+
onBlur = props.onBlur,
|
|
1092
|
+
onChange = props.onChange,
|
|
1093
|
+
onFocus = props.onFocus,
|
|
1094
|
+
placeholder = props.placeholder,
|
|
1095
|
+
readonly = props.readonly,
|
|
1096
|
+
value = props.value;
|
|
1097
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1098
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1099
|
+
var handleChange = function handleChange(nextValue) {
|
|
1100
|
+
return onChange(nextValue && nextValue.toISOString());
|
|
1101
|
+
};
|
|
1102
|
+
var handleBlur = function handleBlur() {
|
|
1103
|
+
return onBlur(id, value);
|
|
1104
|
+
};
|
|
1105
|
+
var handleFocus = function handleFocus() {
|
|
1106
|
+
return onFocus(id, value);
|
|
1107
|
+
};
|
|
1108
|
+
var getPopupContainer = function getPopupContainer(node) {
|
|
1109
|
+
return node.parentNode;
|
|
1110
|
+
};
|
|
1077
1111
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
1078
1112
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1079
1113
|
getPopupContainer: getPopupContainer,
|
|
@@ -1085,43 +1119,43 @@ const DateTimeWidget = _ref => {
|
|
|
1085
1119
|
placeholder: placeholder,
|
|
1086
1120
|
showTime: true,
|
|
1087
1121
|
style: DATE_PICKER_STYLE$1,
|
|
1088
|
-
value: value && dayjs(value)
|
|
1122
|
+
value: value && dayjs(value),
|
|
1123
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1089
1124
|
});
|
|
1090
|
-
}
|
|
1125
|
+
}
|
|
1091
1126
|
|
|
1092
|
-
|
|
1127
|
+
var DATE_PICKER_STYLE = {
|
|
1093
1128
|
width: "100%"
|
|
1094
1129
|
};
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
placeholder,
|
|
1108
|
-
readonly,
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1130
|
+
/** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms
|
|
1131
|
+
* the value to undefined when it is falsy during the `onChange` handling.
|
|
1132
|
+
*
|
|
1133
|
+
* @param props - The `WidgetProps` for this component
|
|
1134
|
+
*/
|
|
1135
|
+
function DateWidget(props) {
|
|
1136
|
+
var disabled = props.disabled,
|
|
1137
|
+
formContext = props.formContext,
|
|
1138
|
+
id = props.id,
|
|
1139
|
+
onBlur = props.onBlur,
|
|
1140
|
+
onChange = props.onChange,
|
|
1141
|
+
onFocus = props.onFocus,
|
|
1142
|
+
placeholder = props.placeholder,
|
|
1143
|
+
readonly = props.readonly,
|
|
1144
|
+
value = props.value;
|
|
1145
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1146
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1147
|
+
var handleChange = function handleChange(nextValue) {
|
|
1148
|
+
return onChange(nextValue && nextValue.format("YYYY-MM-DD"));
|
|
1149
|
+
};
|
|
1150
|
+
var handleBlur = function handleBlur() {
|
|
1151
|
+
return onBlur(id, value);
|
|
1152
|
+
};
|
|
1153
|
+
var handleFocus = function handleFocus() {
|
|
1154
|
+
return onFocus(id, value);
|
|
1155
|
+
};
|
|
1156
|
+
var getPopupContainer = function getPopupContainer(node) {
|
|
1157
|
+
return node.parentNode;
|
|
1158
|
+
};
|
|
1125
1159
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
1126
1160
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1127
1161
|
getPopupContainer: getPopupContainer,
|
|
@@ -1133,53 +1167,41 @@ const DateWidget = _ref => {
|
|
|
1133
1167
|
placeholder: placeholder,
|
|
1134
1168
|
showTime: false,
|
|
1135
1169
|
style: DATE_PICKER_STYLE,
|
|
1136
|
-
value: value && dayjs(value)
|
|
1170
|
+
value: value && dayjs(value),
|
|
1171
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1137
1172
|
});
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
const PasswordWidget = _ref => {
|
|
1141
|
-
let {
|
|
1142
|
-
// autofocus,
|
|
1143
|
-
disabled,
|
|
1144
|
-
formContext,
|
|
1145
|
-
id,
|
|
1146
|
-
// label,
|
|
1147
|
-
onBlur,
|
|
1148
|
-
onChange,
|
|
1149
|
-
onFocus,
|
|
1150
|
-
options,
|
|
1151
|
-
placeholder,
|
|
1152
|
-
readonly,
|
|
1153
|
-
// required,
|
|
1154
|
-
// schema,
|
|
1155
|
-
value
|
|
1156
|
-
} = _ref;
|
|
1157
|
-
const {
|
|
1158
|
-
readonlyAsDisabled = true
|
|
1159
|
-
} = formContext;
|
|
1160
|
-
const emptyValue = options.emptyValue || "";
|
|
1173
|
+
}
|
|
1161
1174
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1175
|
+
/** The `PasswordWidget` component uses the `BaseInputTemplate` changing the type to `password`.
|
|
1176
|
+
*
|
|
1177
|
+
* @param props - The `WidgetProps` for this component
|
|
1178
|
+
*/
|
|
1179
|
+
function PasswordWidget(props) {
|
|
1180
|
+
var disabled = props.disabled,
|
|
1181
|
+
formContext = props.formContext,
|
|
1182
|
+
id = props.id,
|
|
1183
|
+
onBlur = props.onBlur,
|
|
1184
|
+
onChange = props.onChange,
|
|
1185
|
+
onFocus = props.onFocus,
|
|
1186
|
+
options = props.options,
|
|
1187
|
+
placeholder = props.placeholder,
|
|
1188
|
+
readonly = props.readonly,
|
|
1189
|
+
value = props.value;
|
|
1190
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1191
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1192
|
+
var emptyValue = options.emptyValue || "";
|
|
1193
|
+
var handleChange = function handleChange(_ref) {
|
|
1194
|
+
var target = _ref.target;
|
|
1166
1195
|
return onChange(target.value === "" ? emptyValue : target.value);
|
|
1167
1196
|
};
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
let {
|
|
1171
|
-
target
|
|
1172
|
-
} = _ref3;
|
|
1197
|
+
var handleBlur = function handleBlur(_ref2) {
|
|
1198
|
+
var target = _ref2.target;
|
|
1173
1199
|
return onBlur(id, target.value);
|
|
1174
1200
|
};
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
let {
|
|
1178
|
-
target
|
|
1179
|
-
} = _ref4;
|
|
1201
|
+
var handleFocus = function handleFocus(_ref3) {
|
|
1202
|
+
var target = _ref3.target;
|
|
1180
1203
|
return onFocus(id, target.value);
|
|
1181
1204
|
};
|
|
1182
|
-
|
|
1183
1205
|
return /*#__PURE__*/React.createElement(Input.Password, {
|
|
1184
1206
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1185
1207
|
id: id,
|
|
@@ -1188,251 +1210,238 @@ const PasswordWidget = _ref => {
|
|
|
1188
1210
|
onChange: !readonly ? handleChange : undefined,
|
|
1189
1211
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1190
1212
|
placeholder: placeholder,
|
|
1191
|
-
value: value || ""
|
|
1213
|
+
value: value || "",
|
|
1214
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1192
1215
|
});
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
/* eslint-disable no-else-return */
|
|
1196
|
-
|
|
1197
|
-
const RadioWidget = _ref => {
|
|
1198
|
-
let {
|
|
1199
|
-
autofocus,
|
|
1200
|
-
disabled,
|
|
1201
|
-
formContext,
|
|
1202
|
-
id,
|
|
1203
|
-
// label,
|
|
1204
|
-
onBlur,
|
|
1205
|
-
onChange,
|
|
1206
|
-
onFocus,
|
|
1207
|
-
options,
|
|
1208
|
-
// placeholder,
|
|
1209
|
-
readonly,
|
|
1210
|
-
// required,
|
|
1211
|
-
schema,
|
|
1212
|
-
value
|
|
1213
|
-
} = _ref;
|
|
1214
|
-
const {
|
|
1215
|
-
readonlyAsDisabled = true
|
|
1216
|
-
} = formContext;
|
|
1217
|
-
const {
|
|
1218
|
-
enumOptions,
|
|
1219
|
-
enumDisabled
|
|
1220
|
-
} = options;
|
|
1216
|
+
}
|
|
1221
1217
|
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1218
|
+
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
1219
|
+
* It is typically used with a string property constrained with enum options.
|
|
1220
|
+
*
|
|
1221
|
+
* @param props - The `WidgetProps` for this component
|
|
1222
|
+
*/
|
|
1223
|
+
function RadioWidget(_ref) {
|
|
1224
|
+
var autofocus = _ref.autofocus,
|
|
1225
|
+
disabled = _ref.disabled,
|
|
1226
|
+
formContext = _ref.formContext,
|
|
1227
|
+
id = _ref.id,
|
|
1228
|
+
onBlur = _ref.onBlur,
|
|
1229
|
+
onChange = _ref.onChange,
|
|
1230
|
+
onFocus = _ref.onFocus,
|
|
1231
|
+
options = _ref.options,
|
|
1232
|
+
readonly = _ref.readonly,
|
|
1233
|
+
value = _ref.value;
|
|
1234
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1235
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1236
|
+
var enumOptions = options.enumOptions,
|
|
1237
|
+
enumDisabled = options.enumDisabled,
|
|
1238
|
+
emptyValue = options.emptyValue;
|
|
1239
|
+
var handleChange = function handleChange(_ref2) {
|
|
1240
|
+
var nextValue = _ref2.target.value;
|
|
1241
|
+
return onChange(enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
1229
1242
|
};
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
target
|
|
1234
|
-
} = _ref3;
|
|
1235
|
-
return onBlur(id, target.value);
|
|
1243
|
+
var handleBlur = function handleBlur(_ref3) {
|
|
1244
|
+
var target = _ref3.target;
|
|
1245
|
+
return onBlur(id, enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1236
1246
|
};
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
target
|
|
1241
|
-
} = _ref4;
|
|
1242
|
-
return onFocus(id, target.value);
|
|
1247
|
+
var handleFocus = function handleFocus(_ref4) {
|
|
1248
|
+
var target = _ref4.target;
|
|
1249
|
+
return onFocus(id, enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
|
|
1243
1250
|
};
|
|
1244
|
-
|
|
1251
|
+
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions);
|
|
1245
1252
|
return /*#__PURE__*/React.createElement(Radio.Group, {
|
|
1246
1253
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1247
1254
|
id: id,
|
|
1248
1255
|
name: id,
|
|
1249
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
1250
1256
|
onChange: !readonly ? handleChange : undefined,
|
|
1257
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
1251
1258
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1252
|
-
value:
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
value: optionValue,
|
|
1256
|
-
label: optionLabel
|
|
1257
|
-
} = _ref5;
|
|
1259
|
+
value: selectedIndexes,
|
|
1260
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1261
|
+
}, Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
|
|
1258
1262
|
return /*#__PURE__*/React.createElement(Radio, {
|
|
1263
|
+
id: optionId(id, i),
|
|
1264
|
+
name: id,
|
|
1259
1265
|
autoFocus: i === 0 ? autofocus : false,
|
|
1260
|
-
disabled: enumDisabled && enumDisabled.indexOf(value) !== -1,
|
|
1261
|
-
key:
|
|
1262
|
-
value:
|
|
1263
|
-
},
|
|
1266
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
|
|
1267
|
+
key: i,
|
|
1268
|
+
value: String(i)
|
|
1269
|
+
}, option.label);
|
|
1264
1270
|
}));
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
/* eslint-disable no-else-return */
|
|
1268
|
-
|
|
1269
|
-
const RangeWidget = _ref => {
|
|
1270
|
-
let {
|
|
1271
|
-
autofocus,
|
|
1272
|
-
disabled,
|
|
1273
|
-
formContext,
|
|
1274
|
-
id,
|
|
1275
|
-
// label,
|
|
1276
|
-
onBlur,
|
|
1277
|
-
onChange,
|
|
1278
|
-
onFocus,
|
|
1279
|
-
options,
|
|
1280
|
-
placeholder,
|
|
1281
|
-
readonly,
|
|
1282
|
-
// required,
|
|
1283
|
-
schema,
|
|
1284
|
-
value
|
|
1285
|
-
} = _ref;
|
|
1286
|
-
const {
|
|
1287
|
-
readonlyAsDisabled = true
|
|
1288
|
-
} = formContext;
|
|
1289
|
-
const {
|
|
1290
|
-
min,
|
|
1291
|
-
max,
|
|
1292
|
-
step
|
|
1293
|
-
} = rangeSpec(schema);
|
|
1294
|
-
const emptyValue = options.emptyValue || "";
|
|
1295
|
-
|
|
1296
|
-
const handleChange = nextValue => onChange(nextValue === "" ? emptyValue : nextValue);
|
|
1297
|
-
|
|
1298
|
-
const handleBlur = () => onBlur(id, value);
|
|
1299
|
-
|
|
1300
|
-
const handleFocus = () => onFocus(id, value);
|
|
1271
|
+
}
|
|
1301
1272
|
|
|
1302
|
-
|
|
1273
|
+
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
1274
|
+
* in a div, with the value along side it.
|
|
1275
|
+
*
|
|
1276
|
+
* @param props - The `WidgetProps` for this component
|
|
1277
|
+
*/
|
|
1278
|
+
function RangeWidget(props) {
|
|
1279
|
+
var autofocus = props.autofocus,
|
|
1280
|
+
disabled = props.disabled,
|
|
1281
|
+
formContext = props.formContext,
|
|
1282
|
+
id = props.id,
|
|
1283
|
+
onBlur = props.onBlur,
|
|
1284
|
+
onChange = props.onChange,
|
|
1285
|
+
onFocus = props.onFocus,
|
|
1286
|
+
options = props.options,
|
|
1287
|
+
placeholder = props.placeholder,
|
|
1288
|
+
readonly = props.readonly,
|
|
1289
|
+
schema = props.schema,
|
|
1290
|
+
value = props.value;
|
|
1291
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1292
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1293
|
+
var _rangeSpec = rangeSpec(schema),
|
|
1294
|
+
min = _rangeSpec.min,
|
|
1295
|
+
max = _rangeSpec.max,
|
|
1296
|
+
step = _rangeSpec.step;
|
|
1297
|
+
var emptyValue = options.emptyValue || "";
|
|
1298
|
+
var handleChange = function handleChange(nextValue) {
|
|
1299
|
+
return onChange(nextValue === "" ? emptyValue : nextValue);
|
|
1300
|
+
};
|
|
1301
|
+
var handleBlur = function handleBlur() {
|
|
1302
|
+
return onBlur(id, value);
|
|
1303
|
+
};
|
|
1304
|
+
var handleFocus = function handleFocus() {
|
|
1305
|
+
return onFocus(id, value);
|
|
1306
|
+
};
|
|
1307
|
+
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1308
|
+
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1309
|
+
var extraProps = {
|
|
1310
|
+
placeholder: placeholder,
|
|
1311
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
1312
|
+
onFocus: !readonly ? handleFocus : undefined
|
|
1313
|
+
};
|
|
1314
|
+
return /*#__PURE__*/React.createElement(Slider, _extends({
|
|
1303
1315
|
autoFocus: autofocus,
|
|
1304
1316
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1305
1317
|
id: id,
|
|
1306
1318
|
max: max,
|
|
1307
1319
|
min: min,
|
|
1308
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
1309
1320
|
onChange: !readonly ? handleChange : undefined,
|
|
1310
|
-
onFocus: !readonly ? handleFocus : undefined,
|
|
1311
|
-
placeholder: placeholder,
|
|
1312
1321
|
range: false,
|
|
1313
1322
|
step: step,
|
|
1314
1323
|
value: value
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1324
|
+
}, extraProps, {
|
|
1325
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1326
|
+
}));
|
|
1327
|
+
}
|
|
1317
1328
|
|
|
1318
|
-
|
|
1319
|
-
const SELECT_STYLE = {
|
|
1329
|
+
var SELECT_STYLE = {
|
|
1320
1330
|
width: "100%"
|
|
1321
1331
|
};
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
readonlyAsDisabled = true
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1332
|
+
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
1333
|
+
* It is typically used with string properties constrained with enum options.
|
|
1334
|
+
*
|
|
1335
|
+
* @param props - The `WidgetProps` for this component
|
|
1336
|
+
*/
|
|
1337
|
+
function SelectWidget(_ref) {
|
|
1338
|
+
var autofocus = _ref.autofocus,
|
|
1339
|
+
disabled = _ref.disabled,
|
|
1340
|
+
_ref$formContext = _ref.formContext,
|
|
1341
|
+
formContext = _ref$formContext === void 0 ? {} : _ref$formContext,
|
|
1342
|
+
id = _ref.id,
|
|
1343
|
+
multiple = _ref.multiple,
|
|
1344
|
+
onBlur = _ref.onBlur,
|
|
1345
|
+
onChange = _ref.onChange,
|
|
1346
|
+
onFocus = _ref.onFocus,
|
|
1347
|
+
options = _ref.options,
|
|
1348
|
+
placeholder = _ref.placeholder,
|
|
1349
|
+
readonly = _ref.readonly,
|
|
1350
|
+
value = _ref.value;
|
|
1351
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1352
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1353
|
+
var enumOptions = options.enumOptions,
|
|
1354
|
+
enumDisabled = options.enumDisabled,
|
|
1355
|
+
emptyValue = options.emptyValue;
|
|
1356
|
+
var handleChange = function handleChange(nextValue) {
|
|
1357
|
+
return onChange(enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
1358
|
+
};
|
|
1359
|
+
var handleBlur = function handleBlur() {
|
|
1360
|
+
return onBlur(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1361
|
+
};
|
|
1362
|
+
var handleFocus = function handleFocus() {
|
|
1363
|
+
return onFocus(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1364
|
+
};
|
|
1365
|
+
var filterOption = function filterOption(input, option) {
|
|
1366
|
+
if (option && isString(option.label)) {
|
|
1367
|
+
// labels are strings in this context
|
|
1368
|
+
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
1369
|
+
}
|
|
1370
|
+
return false;
|
|
1371
|
+
};
|
|
1372
|
+
var getPopupContainer = function getPopupContainer(node) {
|
|
1373
|
+
return node.parentNode;
|
|
1374
|
+
};
|
|
1375
|
+
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
1376
|
+
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1377
|
+
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1378
|
+
var extraProps = {
|
|
1379
|
+
name: id
|
|
1380
|
+
};
|
|
1381
|
+
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
1360
1382
|
autoFocus: autofocus,
|
|
1361
1383
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1362
1384
|
getPopupContainer: getPopupContainer,
|
|
1363
1385
|
id: id,
|
|
1364
1386
|
mode: typeof multiple !== "undefined" ? "multiple" : undefined,
|
|
1365
|
-
name: id,
|
|
1366
1387
|
onBlur: !readonly ? handleBlur : undefined,
|
|
1367
1388
|
onChange: !readonly ? handleChange : undefined,
|
|
1368
1389
|
onFocus: !readonly ? handleFocus : undefined,
|
|
1369
1390
|
placeholder: placeholder,
|
|
1370
1391
|
style: SELECT_STYLE,
|
|
1371
|
-
value:
|
|
1372
|
-
},
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1392
|
+
value: selectedIndexes
|
|
1393
|
+
}, extraProps, {
|
|
1394
|
+
filterOption: filterOption,
|
|
1395
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1396
|
+
}), Array.isArray(enumOptions) && enumOptions.map(function (_ref2, index) {
|
|
1397
|
+
var optionValue = _ref2.value,
|
|
1398
|
+
optionLabel = _ref2.label;
|
|
1377
1399
|
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
1378
|
-
disabled: enumDisabled && enumDisabled.indexOf(optionValue) !== -1,
|
|
1379
|
-
key: String(
|
|
1380
|
-
value: String(
|
|
1400
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
|
|
1401
|
+
key: String(index),
|
|
1402
|
+
value: String(index)
|
|
1381
1403
|
}, optionLabel);
|
|
1382
1404
|
}));
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
SelectWidget.defaultProps = {
|
|
1386
|
-
formContext: {}
|
|
1387
|
-
};
|
|
1405
|
+
}
|
|
1388
1406
|
|
|
1389
|
-
|
|
1407
|
+
var INPUT_STYLE = {
|
|
1390
1408
|
width: "100%"
|
|
1391
1409
|
};
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
onBlur,
|
|
1401
|
-
onChange,
|
|
1402
|
-
onFocus,
|
|
1403
|
-
options,
|
|
1404
|
-
placeholder,
|
|
1405
|
-
readonly,
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
readonlyAsDisabled = true
|
|
1412
|
-
} = formContext;
|
|
1413
|
-
|
|
1414
|
-
const handleChange = _ref2 => {
|
|
1415
|
-
let {
|
|
1416
|
-
target
|
|
1417
|
-
} = _ref2;
|
|
1410
|
+
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
1411
|
+
*
|
|
1412
|
+
* @param props - The `WidgetProps` for this component
|
|
1413
|
+
*/
|
|
1414
|
+
function TextareaWidget(_ref) {
|
|
1415
|
+
var disabled = _ref.disabled,
|
|
1416
|
+
formContext = _ref.formContext,
|
|
1417
|
+
id = _ref.id,
|
|
1418
|
+
onBlur = _ref.onBlur,
|
|
1419
|
+
onChange = _ref.onChange,
|
|
1420
|
+
onFocus = _ref.onFocus,
|
|
1421
|
+
options = _ref.options,
|
|
1422
|
+
placeholder = _ref.placeholder,
|
|
1423
|
+
readonly = _ref.readonly,
|
|
1424
|
+
value = _ref.value;
|
|
1425
|
+
var _formContext$readonly = formContext.readonlyAsDisabled,
|
|
1426
|
+
readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
|
|
1427
|
+
var handleChange = function handleChange(_ref2) {
|
|
1428
|
+
var target = _ref2.target;
|
|
1418
1429
|
return onChange(target.value === "" ? options.emptyValue : target.value);
|
|
1419
1430
|
};
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
let {
|
|
1423
|
-
target
|
|
1424
|
-
} = _ref3;
|
|
1431
|
+
var handleBlur = function handleBlur(_ref3) {
|
|
1432
|
+
var target = _ref3.target;
|
|
1425
1433
|
return onBlur(id, target.value);
|
|
1426
1434
|
};
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
let {
|
|
1430
|
-
target
|
|
1431
|
-
} = _ref4;
|
|
1435
|
+
var handleFocus = function handleFocus(_ref4) {
|
|
1436
|
+
var target = _ref4.target;
|
|
1432
1437
|
return onFocus(id, target.value);
|
|
1433
1438
|
};
|
|
1434
|
-
|
|
1435
|
-
|
|
1439
|
+
// Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
|
|
1440
|
+
// they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
|
|
1441
|
+
var extraProps = {
|
|
1442
|
+
type: "textarea"
|
|
1443
|
+
};
|
|
1444
|
+
return /*#__PURE__*/React.createElement(Input.TextArea, _extends({
|
|
1436
1445
|
disabled: disabled || readonlyAsDisabled && readonly,
|
|
1437
1446
|
id: id,
|
|
1438
1447
|
name: id,
|
|
@@ -1442,46 +1451,40 @@ const TextareaWidget = _ref => {
|
|
|
1442
1451
|
placeholder: placeholder,
|
|
1443
1452
|
rows: options.rows || 4,
|
|
1444
1453
|
style: INPUT_STYLE,
|
|
1445
|
-
type: "textarea",
|
|
1446
1454
|
value: value
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1455
|
+
}, extraProps, {
|
|
1456
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1457
|
+
}));
|
|
1458
|
+
}
|
|
1449
1459
|
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
FieldTemplate,
|
|
1479
|
-
ObjectFieldTemplate: ObjectFieldTemplate$1,
|
|
1480
|
-
TitleFieldTemplate: TitleField$1
|
|
1481
|
-
},
|
|
1482
|
-
widgets: Widgets
|
|
1483
|
-
};
|
|
1484
|
-
const Form = /*#__PURE__*/withTheme(Theme);
|
|
1460
|
+
function generateWidgets() {
|
|
1461
|
+
return {
|
|
1462
|
+
AltDateTimeWidget: AltDateTimeWidget,
|
|
1463
|
+
AltDateWidget: AltDateWidget,
|
|
1464
|
+
CheckboxesWidget: CheckboxesWidget,
|
|
1465
|
+
CheckboxWidget: CheckboxWidget,
|
|
1466
|
+
DateTimeWidget: DateTimeWidget,
|
|
1467
|
+
DateWidget: DateWidget,
|
|
1468
|
+
PasswordWidget: PasswordWidget,
|
|
1469
|
+
RadioWidget: RadioWidget,
|
|
1470
|
+
RangeWidget: RangeWidget,
|
|
1471
|
+
SelectWidget: SelectWidget,
|
|
1472
|
+
TextareaWidget: TextareaWidget
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
var index = /*#__PURE__*/generateWidgets();
|
|
1476
|
+
|
|
1477
|
+
function generateTheme() {
|
|
1478
|
+
return {
|
|
1479
|
+
templates: generateTemplates(),
|
|
1480
|
+
widgets: generateWidgets()
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1483
|
+
var Theme = /*#__PURE__*/generateTheme();
|
|
1484
|
+
function generateForm() {
|
|
1485
|
+
return withTheme(generateTheme());
|
|
1486
|
+
}
|
|
1487
|
+
var Form = /*#__PURE__*/generateForm();
|
|
1485
1488
|
|
|
1486
|
-
export { Form, Theme, Widgets, Form as default };
|
|
1489
|
+
export { Form, index$1 as Templates, Theme, index as Widgets, Form as default, generateForm, generateTemplates, generateTheme, generateWidgets };
|
|
1487
1490
|
//# sourceMappingURL=antd.esm.js.map
|