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