@rjsf/antd 4.2.3 → 5.0.0-beta.4

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 (35) hide show
  1. package/README.md +4 -2
  2. package/dist/antd.cjs.development.js +1048 -1344
  3. package/dist/antd.cjs.development.js.map +1 -1
  4. package/dist/antd.cjs.production.min.js +1 -1
  5. package/dist/antd.cjs.production.min.js.map +1 -1
  6. package/dist/antd.esm.js +973 -1294
  7. package/dist/antd.esm.js.map +1 -1
  8. package/dist/antd.umd.development.js +1028 -1348
  9. package/dist/antd.umd.development.js.map +1 -1
  10. package/dist/antd.umd.production.min.js +1 -1
  11. package/dist/antd.umd.production.min.js.map +1 -1
  12. package/dist/components/DatePicker/index.d.ts +15 -22
  13. package/dist/index.d.ts +29 -27
  14. package/dist/templates/{ArrayFieldTemplate/ArrayFieldTemplateItem.d.ts → ArrayFieldItemTemplate/index.d.ts} +6 -5
  15. package/dist/templates/ArrayFieldTemplate/index.d.ts +2 -27
  16. package/dist/{widgets/TextWidget → templates/BaseInputTemplate}/index.d.ts +2 -1
  17. package/dist/{fields → templates}/DescriptionField/index.d.ts +0 -0
  18. package/dist/{ErrorList.d.ts → templates/ErrorList/index.d.ts} +0 -0
  19. package/dist/templates/FieldTemplate/WrapIfAdditional.d.ts +2 -1
  20. package/dist/templates/IconButton/index.d.ts +5 -0
  21. package/dist/templates/ObjectFieldTemplate/index.d.ts +1 -1
  22. package/dist/{widgets/SubmitButton/SubmitButton.d.ts → templates/SubmitButton/index.d.ts} +0 -0
  23. package/dist/templates/TitleField/index.d.ts +2 -0
  24. package/dist/widgets/AltDateTimeWidget/index.d.ts +1 -1
  25. package/dist/widgets/AltDateWidget/index.d.ts +9 -9
  26. package/dist/widgets/SelectWidget/index.d.ts +2 -2
  27. package/package.json +53 -45
  28. package/dist/fields/TitleField/index.d.ts +0 -2
  29. package/dist/templates/ArrayFieldTemplate/FixedArrayFieldTemplate.d.ts +0 -2
  30. package/dist/templates/ArrayFieldTemplate/NormalArrayFieldTemplate.d.ts +0 -2
  31. package/dist/widgets/ColorWidget/index.d.ts +0 -12
  32. package/dist/widgets/EmailWidget/index.d.ts +0 -13
  33. package/dist/widgets/SubmitButton/index.d.ts +0 -2
  34. package/dist/widgets/URLWidget/index.d.ts +0 -13
  35. package/dist/widgets/UpDownWidget/index.d.ts +0 -12
package/dist/antd.esm.js CHANGED
@@ -1,32 +1,94 @@
1
- import { utils, withTheme } from '@rjsf/core';
1
+ import { withTheme } from '@rjsf/core';
2
2
  import React, { useState, useEffect } from 'react';
3
+ import Button from 'antd/es/button';
4
+ import Col from 'antd/es/col';
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';
3
7
  import classNames from 'classnames';
4
- import { withConfigConsumer } from 'antd/lib/config-provider/context';
5
- import Form$1 from 'antd/lib/form';
6
- import Button from 'antd/lib/button';
7
- import Col from 'antd/lib/col';
8
- import Input from 'antd/lib/input';
9
- import Row from 'antd/lib/row';
10
- import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
11
- import _ from 'lodash-es';
12
- import PlusCircleOutlined from '@ant-design/icons/PlusCircleOutlined';
8
+ import { withConfigConsumer } from 'antd/es/config-provider/context';
9
+ import Input from 'antd/es/input';
10
+ import InputNumber from 'antd/es/input-number';
11
+ import Alert from 'antd/es/alert';
12
+ import List from 'antd/es/list';
13
+ import Space from 'antd/es/space';
14
+ import ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined';
13
15
  import ArrowDownOutlined from '@ant-design/icons/ArrowDownOutlined';
14
16
  import ArrowUpOutlined from '@ant-design/icons/ArrowUpOutlined';
15
- import Checkbox from 'antd/lib/checkbox';
17
+ import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
18
+ import PlusCircleOutlined from '@ant-design/icons/PlusCircleOutlined';
19
+ import Form$1 from 'antd/es/form';
20
+ import isObject from 'lodash-es/isObject';
21
+ import isNumber from 'lodash-es/isNumber';
22
+ import Checkbox from 'antd/es/checkbox';
16
23
  import dayjs from 'dayjs';
17
- import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
18
- import generatePicker from 'antd/lib/date-picker/generatePicker';
19
- import Radio from 'antd/lib/radio';
20
- import Slider from 'antd/lib/slider';
21
- import Select from 'antd/lib/select';
22
- import InputNumber from 'antd/lib/input-number';
23
- import Alert from 'antd/lib/alert';
24
- import List from 'antd/lib/list';
25
- import Space from 'antd/lib/space';
26
- import ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined';
24
+ import dayjsGenerateConfig from 'rc-picker/es/generate/dayjs';
25
+ import generatePicker from 'antd/es/date-picker/generatePicker';
26
+ import Radio from 'antd/es/radio';
27
+ import Slider from 'antd/es/slider';
28
+ import Select from 'antd/es/select';
29
+
30
+ const BTN_GRP_STYLE = {
31
+ width: "100%"
32
+ };
33
+ const BTN_STYLE = {
34
+ width: "calc(100% / 3)"
35
+ };
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
+ } = _ref;
52
+ const {
53
+ MoveDownButton,
54
+ MoveUpButton,
55
+ RemoveButton
56
+ } = registry.templates.ButtonTemplates;
57
+ const {
58
+ rowGutter = 24,
59
+ toolbarAlign = "top"
60
+ } = formContext;
61
+ return /*#__PURE__*/React.createElement(Row, {
62
+ align: toolbarAlign,
63
+ key: "array-item-" + index,
64
+ gutter: rowGutter
65
+ }, /*#__PURE__*/React.createElement(Col, {
66
+ flex: "1"
67
+ }, children), hasToolbar && /*#__PURE__*/React.createElement(Col, {
68
+ flex: "192px"
69
+ }, /*#__PURE__*/React.createElement(Button.Group, {
70
+ style: BTN_GRP_STYLE
71
+ }, (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveUpButton, {
72
+ disabled: disabled || readonly || !hasMoveUp,
73
+ onClick: onReorderClick(index, index - 1),
74
+ style: BTN_STYLE
75
+ }), (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveDownButton, {
76
+ disabled: disabled || readonly || !hasMoveDown,
77
+ onClick: onReorderClick(index, index + 1),
78
+ style: BTN_STYLE
79
+ }), hasRemove && /*#__PURE__*/React.createElement(RemoveButton, {
80
+ disabled: disabled || readonly,
81
+ onClick: onDropIndexClick(index),
82
+ style: BTN_STYLE
83
+ }))));
84
+ };
85
+
86
+ ArrayFieldItemTemplate.defaultProps = {
87
+ formContext: {}
88
+ };
27
89
 
28
90
  function _extends() {
29
- _extends = Object.assign || function (target) {
91
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
30
92
  for (var i = 1; i < arguments.length; i++) {
31
93
  var source = arguments[i];
32
94
 
@@ -39,116 +101,297 @@ function _extends() {
39
101
 
40
102
  return target;
41
103
  };
42
-
43
104
  return _extends.apply(this, arguments);
44
105
  }
45
106
 
46
- function _objectWithoutPropertiesLoose(source, excluded) {
47
- if (source == null) return {};
48
- var target = {};
49
- var sourceKeys = Object.keys(source);
50
- var key, i;
107
+ const DESCRIPTION_COL_STYLE$1 = {
108
+ paddingBottom: "8px"
109
+ };
51
110
 
52
- for (i = 0; i < sourceKeys.length; i++) {
53
- key = sourceKeys[i];
54
- if (excluded.indexOf(key) >= 0) continue;
55
- target[key] = source[key];
56
- }
111
+ const ArrayFieldTemplate = _ref => {
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
+ };
57
186
 
58
- return target;
59
- }
187
+ var ArrayFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
188
+ prefixCls: "form"
189
+ })(ArrayFieldTemplate);
60
190
 
61
- var DescriptionField = function DescriptionField(_ref) {
62
- var description = _ref.description,
63
- id = _ref.id;
64
- return /*#__PURE__*/React.createElement("span", {
65
- id: id
66
- }, description);
191
+ const INPUT_STYLE$2 = {
192
+ width: "100%"
67
193
  };
68
194
 
69
- var TitleField = function TitleField(_ref) {
70
- var _classNames;
195
+ const TextWidget = _ref => {
196
+ let {
197
+ // autofocus,
198
+ disabled,
199
+ formContext,
200
+ id,
201
+ // label,
202
+ onBlur,
203
+ onChange,
204
+ onFocus,
205
+ options,
206
+ placeholder,
207
+ readonly,
208
+ // required,
209
+ schema,
210
+ value,
211
+ type
212
+ } = _ref;
213
+ const inputProps = getInputProps(schema, type, options, false);
214
+ const {
215
+ readonlyAsDisabled = true
216
+ } = formContext;
217
+
218
+ const handleNumberChange = nextValue => onChange(nextValue);
219
+
220
+ const handleTextChange = _ref2 => {
221
+ let {
222
+ target
223
+ } = _ref2;
224
+ return onChange(target.value === "" ? options.emptyValue : target.value);
225
+ };
226
+
227
+ const handleBlur = _ref3 => {
228
+ let {
229
+ target
230
+ } = _ref3;
231
+ return onBlur(id, target.value);
232
+ };
71
233
 
72
- var formContext = _ref.formContext,
73
- id = _ref.id,
74
- prefixCls = _ref.prefixCls,
75
- required = _ref.required,
76
- title = _ref.title;
77
- var _formContext$colon = formContext.colon,
78
- colon = _formContext$colon === void 0 ? true : _formContext$colon;
79
- var labelChildren = title;
234
+ const handleFocus = _ref4 => {
235
+ let {
236
+ target
237
+ } = _ref4;
238
+ return onFocus(id, target.value);
239
+ };
80
240
 
81
- if (colon && typeof title === 'string' && title.trim() !== '') {
82
- labelChildren = title.replace(/[::]\s*$/, '');
83
- }
241
+ const input = inputProps.type === "number" || inputProps.type === "integer" ? /*#__PURE__*/React.createElement(InputNumber, _extends({
242
+ disabled: disabled || readonlyAsDisabled && readonly,
243
+ id: id,
244
+ name: id,
245
+ onBlur: !readonly ? handleBlur : undefined,
246
+ onChange: !readonly ? handleNumberChange : undefined,
247
+ onFocus: !readonly ? handleFocus : undefined,
248
+ placeholder: placeholder,
249
+ style: INPUT_STYLE$2,
250
+ list: schema.examples ? "examples_" + id : undefined
251
+ }, inputProps, {
252
+ value: value
253
+ })) : /*#__PURE__*/React.createElement(Input, _extends({
254
+ disabled: disabled || readonlyAsDisabled && readonly,
255
+ id: id,
256
+ name: id,
257
+ onBlur: !readonly ? handleBlur : undefined,
258
+ onChange: !readonly ? handleTextChange : undefined,
259
+ onFocus: !readonly ? handleFocus : undefined,
260
+ placeholder: placeholder,
261
+ style: INPUT_STYLE$2,
262
+ list: schema.examples ? "examples_" + id : undefined
263
+ }, inputProps, {
264
+ value: value
265
+ }));
266
+ return /*#__PURE__*/React.createElement(React.Fragment, null, input, schema.examples && /*#__PURE__*/React.createElement("datalist", {
267
+ id: "examples_" + id
268
+ }, schema.examples.concat(schema.default ? [schema.default] : []).map(example => {
269
+ return /*#__PURE__*/React.createElement("option", {
270
+ key: example,
271
+ value: example
272
+ });
273
+ })));
274
+ };
84
275
 
85
- var labelClassName = classNames((_classNames = {}, _classNames[prefixCls + "-item-required"] = required, _classNames[prefixCls + "-item-no-colon"] = !colon, _classNames));
276
+ const DescriptionField = _ref => {
277
+ let {
278
+ description,
279
+ id // registry,
86
280
 
87
- var handleLabelClick = function handleLabelClick() {
88
- if (!id) {
89
- return;
90
- }
281
+ } = _ref;
282
+ return /*#__PURE__*/React.createElement("span", {
283
+ id: id
284
+ }, description);
285
+ };
91
286
 
92
- var control = document.querySelector("[id=\"" + id + "\"]");
287
+ const ErrorList = _ref => {
288
+ let {
289
+ // errorSchema,
290
+ errors // formContext,
291
+ // schema,
292
+ // uiSchema,
93
293
 
94
- if (control && control.focus) {
95
- control.focus();
96
- }
97
- };
294
+ } = _ref;
98
295
 
99
- return title ? /*#__PURE__*/React.createElement("label", {
100
- className: labelClassName,
101
- htmlFor: id,
102
- onClick: handleLabelClick,
103
- title: typeof title === 'string' ? title : ''
104
- }, labelChildren) : null;
105
- };
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))));
106
302
 
107
- TitleField.defaultProps = {
108
- formContext: {}
303
+ return /*#__PURE__*/React.createElement(Alert, {
304
+ className: "panel panel-danger errors",
305
+ description: renderErrors(),
306
+ message: "Errors",
307
+ type: "error"
308
+ });
109
309
  };
110
- var TitleField$1 = /*#__PURE__*/withConfigConsumer({
111
- prefixCls: 'form'
112
- })(TitleField);
113
310
 
114
- var ADDITIONAL_PROPERTY_FLAG = utils.ADDITIONAL_PROPERTY_FLAG;
115
- var VERTICAL_LABEL_COL = {
311
+ function IconButton(props) {
312
+ const {
313
+ iconType = "default",
314
+ icon,
315
+ ...otherProps
316
+ } = props;
317
+ return /*#__PURE__*/React.createElement(Button, _extends({
318
+ type: iconType,
319
+ icon: icon
320
+ }, otherProps));
321
+ }
322
+ function AddButton(props) {
323
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
324
+ title: "Add Item"
325
+ }, props, {
326
+ block: true,
327
+ iconType: "primary",
328
+ icon: /*#__PURE__*/React.createElement(PlusCircleOutlined, null)
329
+ }));
330
+ }
331
+ function MoveDownButton(props) {
332
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
333
+ title: "Move down"
334
+ }, props, {
335
+ icon: /*#__PURE__*/React.createElement(ArrowDownOutlined, null)
336
+ }));
337
+ }
338
+ function MoveUpButton(props) {
339
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
340
+ title: "Move up"
341
+ }, props, {
342
+ icon: /*#__PURE__*/React.createElement(ArrowUpOutlined, null)
343
+ }));
344
+ }
345
+ function RemoveButton(props) {
346
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
347
+ title: "Remove"
348
+ }, props, {
349
+ danger: true,
350
+ iconType: "primary",
351
+ icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
352
+ }));
353
+ }
354
+
355
+ const VERTICAL_LABEL_COL$1 = {
116
356
  span: 24
117
357
  };
118
- var VERTICAL_WRAPPER_COL = {
358
+ const VERTICAL_WRAPPER_COL$1 = {
119
359
  span: 24
120
360
  };
121
- var INPUT_STYLE = {
122
- width: '100%'
361
+ const INPUT_STYLE$1 = {
362
+ width: "100%"
123
363
  };
124
364
 
125
- var WrapIfAdditional = function WrapIfAdditional(_ref) {
126
- var children = _ref.children,
127
- classNames = _ref.classNames,
128
- disabled = _ref.disabled,
129
- formContext = _ref.formContext,
130
- id = _ref.id,
131
- label = _ref.label,
132
- onDropPropertyClick = _ref.onDropPropertyClick,
133
- onKeyChange = _ref.onKeyChange,
134
- readonly = _ref.readonly,
135
- required = _ref.required,
136
- schema = _ref.schema;
137
- var colon = formContext.colon,
138
- _formContext$labelCol = formContext.labelCol,
139
- labelCol = _formContext$labelCol === void 0 ? VERTICAL_LABEL_COL : _formContext$labelCol,
140
- _formContext$readonly = formContext.readonlyAsDisabled,
141
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly,
142
- _formContext$rowGutte = formContext.rowGutter,
143
- rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte,
144
- _formContext$toolbarA = formContext.toolbarAlign,
145
- toolbarAlign = _formContext$toolbarA === void 0 ? 'top' : _formContext$toolbarA,
146
- _formContext$wrapperC = formContext.wrapperCol,
147
- wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL : _formContext$wrapperC,
148
- wrapperStyle = formContext.wrapperStyle;
149
- var keyLabel = label + " Key"; // i18n ?
150
-
151
- var additional = schema.hasOwnProperty(ADDITIONAL_PROPERTY_FLAG);
365
+ const WrapIfAdditional = _ref => {
366
+ let {
367
+ children,
368
+ classNames,
369
+ disabled,
370
+ formContext,
371
+ id,
372
+ label,
373
+ onDropPropertyClick,
374
+ onKeyChange,
375
+ readonly,
376
+ required,
377
+ registry,
378
+ schema
379
+ } = _ref;
380
+ const {
381
+ colon,
382
+ labelCol = VERTICAL_LABEL_COL$1,
383
+ readonlyAsDisabled = true,
384
+ rowGutter = 24,
385
+ toolbarAlign = "top",
386
+ wrapperCol = VERTICAL_WRAPPER_COL$1,
387
+ wrapperStyle
388
+ } = formContext;
389
+ const {
390
+ RemoveButton
391
+ } = registry.templates.ButtonTemplates;
392
+ const keyLabel = label + " Key"; // i18n ?
393
+
394
+ const additional = (ADDITIONAL_PROPERTY_FLAG in schema);
152
395
 
153
396
  if (!additional) {
154
397
  return /*#__PURE__*/React.createElement("div", {
@@ -156,8 +399,10 @@ var WrapIfAdditional = function WrapIfAdditional(_ref) {
156
399
  }, children);
157
400
  }
158
401
 
159
- var handleBlur = function handleBlur(_ref2) {
160
- var target = _ref2.target;
402
+ const handleBlur = _ref2 => {
403
+ let {
404
+ target
405
+ } = _ref2;
161
406
  return onKeyChange(target.value);
162
407
  };
163
408
 
@@ -188,55 +433,57 @@ var WrapIfAdditional = function WrapIfAdditional(_ref) {
188
433
  id: id + "-key",
189
434
  name: id + "-key",
190
435
  onBlur: !readonly ? handleBlur : undefined,
191
- style: INPUT_STYLE,
436
+ style: INPUT_STYLE$1,
192
437
  type: "text"
193
438
  })))), /*#__PURE__*/React.createElement(Col, {
194
439
  className: "form-additional",
195
440
  flex: "1"
196
441
  }, children), /*#__PURE__*/React.createElement(Col, {
197
442
  flex: "192px"
198
- }, /*#__PURE__*/React.createElement(Button, {
443
+ }, /*#__PURE__*/React.createElement(RemoveButton, {
199
444
  block: true,
200
445
  className: "array-item-remove",
201
- danger: true,
202
446
  disabled: disabled || readonly,
203
- icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
204
- onClick: onDropPropertyClick(label),
205
- type: "primary"
447
+ onClick: onDropPropertyClick(label)
206
448
  }))));
207
449
  };
208
450
 
209
- var VERTICAL_LABEL_COL$1 = {
451
+ const VERTICAL_LABEL_COL = {
210
452
  span: 24
211
453
  };
212
- var VERTICAL_WRAPPER_COL$1 = {
454
+ const VERTICAL_WRAPPER_COL = {
213
455
  span: 24
214
456
  };
215
457
 
216
- var FieldTemplate = function FieldTemplate(_ref) {
217
- var children = _ref.children,
218
- classNames = _ref.classNames,
219
- description = _ref.description,
220
- disabled = _ref.disabled,
221
- displayLabel = _ref.displayLabel,
222
- formContext = _ref.formContext,
223
- help = _ref.help,
224
- hidden = _ref.hidden,
225
- id = _ref.id,
226
- label = _ref.label,
227
- onDropPropertyClick = _ref.onDropPropertyClick,
228
- onKeyChange = _ref.onKeyChange,
229
- rawErrors = _ref.rawErrors,
230
- rawHelp = _ref.rawHelp,
231
- readonly = _ref.readonly,
232
- required = _ref.required,
233
- schema = _ref.schema;
234
- var colon = formContext.colon,
235
- _formContext$labelCol = formContext.labelCol,
236
- labelCol = _formContext$labelCol === void 0 ? VERTICAL_LABEL_COL$1 : _formContext$labelCol,
237
- _formContext$wrapperC = formContext.wrapperCol,
238
- wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
239
- wrapperStyle = formContext.wrapperStyle;
458
+ const FieldTemplate = _ref => {
459
+ let {
460
+ children,
461
+ classNames,
462
+ description,
463
+ disabled,
464
+ displayLabel,
465
+ // errors,
466
+ formContext,
467
+ help,
468
+ hidden,
469
+ id,
470
+ label,
471
+ onDropPropertyClick,
472
+ onKeyChange,
473
+ rawErrors,
474
+ rawHelp,
475
+ readonly,
476
+ registry,
477
+ required,
478
+ schema // uiSchema,
479
+
480
+ } = _ref;
481
+ const {
482
+ colon,
483
+ labelCol = VERTICAL_LABEL_COL,
484
+ wrapperCol = VERTICAL_WRAPPER_COL,
485
+ wrapperStyle
486
+ } = formContext;
240
487
 
241
488
  if (hidden) {
242
489
  return /*#__PURE__*/React.createElement("div", {
@@ -244,13 +491,9 @@ var FieldTemplate = function FieldTemplate(_ref) {
244
491
  }, children);
245
492
  }
246
493
 
247
- var renderFieldErrors = function renderFieldErrors() {
248
- return [].concat(new Set(rawErrors)).map(function (error) {
249
- return /*#__PURE__*/React.createElement("div", {
250
- key: "field-" + id + "-error-" + error
251
- }, error);
252
- });
253
- };
494
+ const renderFieldErrors = () => [...new Set(rawErrors)].map(error => /*#__PURE__*/React.createElement("div", {
495
+ key: "field-" + id + "-error-" + error
496
+ }, error));
254
497
 
255
498
  return /*#__PURE__*/React.createElement(WrapIfAdditional, {
256
499
  classNames: classNames,
@@ -262,85 +505,84 @@ var FieldTemplate = function FieldTemplate(_ref) {
262
505
  onKeyChange: onKeyChange,
263
506
  readonly: readonly,
264
507
  required: required,
265
- schema: schema
266
- }, id === 'root' ? children : /*#__PURE__*/React.createElement(Form$1.Item, {
508
+ schema: schema,
509
+ registry: registry
510
+ }, id === "root" ? children : /*#__PURE__*/React.createElement(Form$1.Item, {
267
511
  colon: colon,
268
512
  extra: description,
269
- hasFeedback: schema.type !== 'array' && schema.type !== 'object',
270
- help: !!rawHelp && help || !!rawErrors && renderFieldErrors(),
513
+ hasFeedback: schema.type !== "array" && schema.type !== "object",
514
+ help: !!rawHelp && help || !!(rawErrors !== null && rawErrors !== void 0 && rawErrors.length) && renderFieldErrors(),
271
515
  htmlFor: id,
272
516
  label: displayLabel && label,
273
517
  labelCol: labelCol,
274
518
  required: required,
275
519
  style: wrapperStyle,
276
- validateStatus: rawErrors ? 'error' : undefined,
520
+ validateStatus: rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? "error" : undefined,
277
521
  wrapperCol: wrapperCol
278
522
  }, children));
279
523
  };
280
524
 
281
- var canExpand = utils.canExpand;
282
- var DESCRIPTION_COL_STYLE = {
283
- paddingBottom: '8px'
525
+ const DESCRIPTION_COL_STYLE = {
526
+ paddingBottom: "8px"
284
527
  };
285
528
 
286
- var ObjectFieldTemplate = function ObjectFieldTemplate(_ref) {
287
- var DescriptionField = _ref.DescriptionField,
288
- TitleField = _ref.TitleField,
289
- description = _ref.description,
290
- disabled = _ref.disabled,
291
- formContext = _ref.formContext,
292
- formData = _ref.formData,
293
- idSchema = _ref.idSchema,
294
- onAddClick = _ref.onAddClick,
295
- prefixCls = _ref.prefixCls,
296
- properties = _ref.properties,
297
- readonly = _ref.readonly,
298
- required = _ref.required,
299
- schema = _ref.schema,
300
- title = _ref.title,
301
- uiSchema = _ref.uiSchema;
302
- var _formContext$colSpan = formContext.colSpan,
303
- colSpan = _formContext$colSpan === void 0 ? 24 : _formContext$colSpan,
304
- _formContext$labelAli = formContext.labelAlign,
305
- labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
306
- _formContext$rowGutte = formContext.rowGutter,
307
- rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
308
- var labelClsBasic = prefixCls + "-item-label";
309
- var labelColClassName = classNames(labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left" // labelCol.className,
529
+ const ObjectFieldTemplate = _ref => {
530
+ let {
531
+ description,
532
+ disabled,
533
+ formContext,
534
+ formData,
535
+ idSchema,
536
+ onAddClick,
537
+ prefixCls,
538
+ properties,
539
+ readonly,
540
+ required,
541
+ registry,
542
+ schema,
543
+ title,
544
+ uiSchema
545
+ } = _ref;
546
+ const uiOptions = getUiOptions(uiSchema);
547
+ const TitleFieldTemplate = getTemplate("TitleFieldTemplate", registry, uiOptions);
548
+ const DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry, uiOptions); // Button templates are not overridden in the uiSchema
549
+
550
+ const {
551
+ ButtonTemplates: {
552
+ AddButton
553
+ }
554
+ } = registry.templates;
555
+ const {
556
+ colSpan = 24,
557
+ labelAlign = "right",
558
+ rowGutter = 24
559
+ } = formContext;
560
+ const labelClsBasic = prefixCls + "-item-label";
561
+ const labelColClassName = classNames(labelClsBasic, labelAlign === "left" && labelClsBasic + "-left" // labelCol.className,
310
562
  );
311
563
 
312
- var findSchema = function findSchema(element) {
313
- return element.content.props.schema;
314
- };
564
+ const findSchema = element => element.content.props.schema;
315
565
 
316
- var findSchemaType = function findSchemaType(element) {
317
- return findSchema(element).type;
318
- };
566
+ const findSchemaType = element => findSchema(element).type;
319
567
 
320
- var findUiSchema = function findUiSchema(element) {
321
- return element.content.props.uiSchema;
322
- };
568
+ const findUiSchema = element => element.content.props.uiSchema;
323
569
 
324
- var findUiSchemaField = function findUiSchemaField(element) {
325
- return findUiSchema(element)['ui:field'];
326
- };
570
+ const findUiSchemaField = element => getUiOptions(findUiSchema(element)).field;
327
571
 
328
- var findUiSchemaWidget = function findUiSchemaWidget(element) {
329
- return findUiSchema(element)['ui:widget'];
330
- };
572
+ const findUiSchemaWidget = element => getUiOptions(findUiSchema(element)).widget;
331
573
 
332
- var calculateColSpan = function calculateColSpan(element) {
333
- var type = findSchemaType(element);
334
- var field = findUiSchemaField(element);
335
- var widget = findUiSchemaWidget(element);
336
- var defaultColSpan = properties.length < 2 || // Single or no field in object.
337
- type === 'object' || type === 'array' || widget === 'textarea' ? 24 : 12;
574
+ const calculateColSpan = element => {
575
+ const type = findSchemaType(element);
576
+ const field = findUiSchemaField(element);
577
+ const widget = findUiSchemaWidget(element);
578
+ const defaultColSpan = properties.length < 2 || // Single or no field in object.
579
+ type === "object" || type === "array" || widget === "textarea" ? 24 : 12;
338
580
 
339
- if (_.isObject(colSpan)) {
581
+ if (isObject(colSpan)) {
340
582
  return colSpan[widget] || colSpan[field] || colSpan[type] || defaultColSpan;
341
583
  }
342
584
 
343
- if (_.isNumber(colSpan)) {
585
+ if (isNumber(colSpan)) {
344
586
  return colSpan;
345
587
  }
346
588
 
@@ -351,416 +593,120 @@ var ObjectFieldTemplate = function ObjectFieldTemplate(_ref) {
351
593
  id: idSchema.$id
352
594
  }, /*#__PURE__*/React.createElement(Row, {
353
595
  gutter: rowGutter
354
- }, uiSchema['ui:title'] !== false && (uiSchema['ui:title'] || title) && /*#__PURE__*/React.createElement(Col, {
596
+ }, uiOptions.title !== false && (uiOptions.title || title) && /*#__PURE__*/React.createElement(Col, {
355
597
  className: labelColClassName,
356
598
  span: 24
357
- }, /*#__PURE__*/React.createElement(TitleField, {
599
+ }, /*#__PURE__*/React.createElement(TitleFieldTemplate, {
358
600
  id: idSchema.$id + "-title",
359
601
  required: required,
360
- title: uiSchema['ui:title'] || title
361
- })), uiSchema['ui:description'] !== false && (uiSchema['ui:description'] || description) && /*#__PURE__*/React.createElement(Col, {
602
+ title: uiOptions.title || title,
603
+ uiSchema: uiSchema,
604
+ registry: registry
605
+ })), uiOptions.description !== false && (uiOptions.description || description) && /*#__PURE__*/React.createElement(Col, {
362
606
  span: 24,
363
607
  style: DESCRIPTION_COL_STYLE
364
- }, /*#__PURE__*/React.createElement(DescriptionField, {
365
- description: uiSchema['ui:description'] || description,
366
- id: idSchema.$id + "-description"
367
- })), properties.filter(function (e) {
368
- return !e.hidden;
369
- }).map(function (element) {
370
- return /*#__PURE__*/React.createElement(Col, {
371
- key: element.name,
372
- span: calculateColSpan(element)
373
- }, element.content);
374
- })), canExpand(schema, uiSchema, formData) && /*#__PURE__*/React.createElement(Col, {
608
+ }, /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
609
+ description: uiOptions.description || description,
610
+ id: idSchema.$id + "-description",
611
+ registry: registry
612
+ })), properties.filter(e => !e.hidden).map(element => /*#__PURE__*/React.createElement(Col, {
613
+ key: element.name,
614
+ span: calculateColSpan(element)
615
+ }, element.content))), canExpand(schema, uiSchema, formData) && /*#__PURE__*/React.createElement(Col, {
375
616
  span: 24
376
617
  }, /*#__PURE__*/React.createElement(Row, {
377
618
  gutter: rowGutter,
378
619
  justify: "end"
379
620
  }, /*#__PURE__*/React.createElement(Col, {
380
621
  flex: "192px"
381
- }, /*#__PURE__*/React.createElement(Button, {
382
- block: true,
622
+ }, /*#__PURE__*/React.createElement(AddButton, {
383
623
  className: "object-property-expand",
384
624
  disabled: disabled || readonly,
385
- onClick: onAddClick(schema),
386
- type: "primary"
387
- }, /*#__PURE__*/React.createElement(PlusCircleOutlined, null), " Add Item")))));
625
+ onClick: onAddClick(schema)
626
+ })))));
388
627
  };
389
628
 
390
629
  var ObjectFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
391
- prefixCls: 'form'
630
+ prefixCls: "form"
392
631
  })(ObjectFieldTemplate);
393
632
 
394
- var BTN_GRP_STYLE = {
395
- width: '100%'
396
- };
397
- var BTN_STYLE = {
398
- width: 'calc(100% / 3)'
399
- };
633
+ var SubmitButton = (_ref => {
634
+ let {
635
+ uiSchema
636
+ } = _ref;
637
+ const {
638
+ submitText,
639
+ norender,
640
+ props: submitButtonProps
641
+ } = getSubmitButtonOptions(uiSchema);
400
642
 
401
- var ArrayFieldTemplateItem = function ArrayFieldTemplateItem(_ref) {
402
- var children = _ref.children,
403
- disabled = _ref.disabled,
404
- formContext = _ref.formContext,
405
- hasMoveDown = _ref.hasMoveDown,
406
- hasMoveUp = _ref.hasMoveUp,
407
- hasRemove = _ref.hasRemove,
408
- hasToolbar = _ref.hasToolbar,
409
- index = _ref.index,
410
- onDropIndexClick = _ref.onDropIndexClick,
411
- onReorderClick = _ref.onReorderClick,
412
- readonly = _ref.readonly;
413
- var _formContext$rowGutte = formContext.rowGutter,
414
- rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte,
415
- _formContext$toolbarA = formContext.toolbarAlign,
416
- toolbarAlign = _formContext$toolbarA === void 0 ? 'top' : _formContext$toolbarA;
417
- return /*#__PURE__*/React.createElement(Row, {
418
- align: toolbarAlign,
419
- key: "array-item-" + index,
420
- gutter: rowGutter
421
- }, /*#__PURE__*/React.createElement(Col, {
422
- flex: "1"
423
- }, children), hasToolbar && /*#__PURE__*/React.createElement(Col, {
424
- flex: "192px"
425
- }, /*#__PURE__*/React.createElement(Button.Group, {
426
- style: BTN_GRP_STYLE
427
- }, (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(Button, {
428
- disabled: disabled || readonly || !hasMoveUp,
429
- icon: /*#__PURE__*/React.createElement(ArrowUpOutlined, null),
430
- onClick: onReorderClick(index, index - 1),
431
- style: BTN_STYLE,
432
- type: "default"
433
- }), (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(Button, {
434
- disabled: disabled || readonly || !hasMoveDown,
435
- icon: /*#__PURE__*/React.createElement(ArrowDownOutlined, null),
436
- onClick: onReorderClick(index, index + 1),
437
- style: BTN_STYLE,
438
- type: "default"
439
- }), hasRemove && /*#__PURE__*/React.createElement(Button, {
440
- danger: true,
441
- disabled: disabled || readonly,
442
- icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
443
- onClick: onDropIndexClick(index),
444
- style: BTN_STYLE,
445
- type: "primary"
446
- }))));
447
- };
448
-
449
- ArrayFieldTemplateItem.defaultProps = {
450
- formContext: {}
451
- };
452
-
453
- var DESCRIPTION_COL_STYLE$1 = {
454
- paddingBottom: '8px'
455
- };
643
+ if (norender) {
644
+ return null;
645
+ }
456
646
 
457
- var FixedArrayFieldTemplate = function FixedArrayFieldTemplate(_ref) {
458
- var canAdd = _ref.canAdd,
459
- className = _ref.className,
460
- DescriptionField = _ref.DescriptionField,
461
- disabled = _ref.disabled,
462
- formContext = _ref.formContext,
463
- idSchema = _ref.idSchema,
464
- items = _ref.items,
465
- onAddClick = _ref.onAddClick,
466
- prefixCls = _ref.prefixCls,
467
- readonly = _ref.readonly,
468
- required = _ref.required,
469
- schema = _ref.schema,
470
- title = _ref.title,
471
- TitleField = _ref.TitleField,
472
- uiSchema = _ref.uiSchema;
473
- var _formContext$labelAli = formContext.labelAlign,
474
- labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
475
- _formContext$rowGutte = formContext.rowGutter,
476
- rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
477
- var labelClsBasic = prefixCls + "-item-label";
478
- var labelColClassName = classNames(labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left" // labelCol.className,
479
- );
480
- return /*#__PURE__*/React.createElement("fieldset", {
481
- className: className,
482
- id: idSchema.$id
483
- }, /*#__PURE__*/React.createElement(Row, {
484
- gutter: rowGutter
485
- }, title && /*#__PURE__*/React.createElement(Col, {
486
- className: labelColClassName,
487
- span: 24
488
- }, /*#__PURE__*/React.createElement(TitleField, {
489
- id: idSchema.$id + "__title",
490
- key: "array-field-title-" + idSchema.$id,
491
- required: required,
492
- title: uiSchema['ui:title'] || title
493
- })), (uiSchema['ui:description'] || schema.description) && /*#__PURE__*/React.createElement(Col, {
494
- span: 24,
495
- style: DESCRIPTION_COL_STYLE$1
496
- }, /*#__PURE__*/React.createElement(DescriptionField, {
497
- description: uiSchema['ui:description'] || schema.description,
498
- id: idSchema.$id + "-description",
499
- key: "array-field-description-" + idSchema.$id
500
- })), /*#__PURE__*/React.createElement(Col, {
501
- className: "row array-item-list",
502
- span: 24
503
- }, items && items.map(function (itemProps) {
504
- return /*#__PURE__*/React.createElement(ArrayFieldTemplateItem, _extends({}, itemProps, {
505
- formContext: formContext
506
- }));
507
- })), canAdd && /*#__PURE__*/React.createElement(Col, {
508
- span: 24
509
- }, /*#__PURE__*/React.createElement(Row, {
510
- gutter: rowGutter,
511
- justify: "end"
512
- }, /*#__PURE__*/React.createElement(Col, {
513
- flex: "192px"
514
- }, /*#__PURE__*/React.createElement(Button, {
515
- block: true,
516
- className: "array-item-add",
517
- disabled: disabled || readonly,
518
- onClick: onAddClick,
519
- type: "primary"
520
- }, /*#__PURE__*/React.createElement(PlusCircleOutlined, null), " Add Item"))))));
521
- };
647
+ return /*#__PURE__*/React.createElement(Button, _extends({
648
+ type: "submit"
649
+ }, submitButtonProps, {
650
+ htmlType: "submit"
651
+ }), submitText);
652
+ });
522
653
 
523
- var FixedArrayFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
524
- prefixCls: 'form'
525
- })(FixedArrayFieldTemplate);
654
+ const TitleField = _ref => {
655
+ let {
656
+ id,
657
+ prefixCls,
658
+ required,
659
+ registry,
660
+ title
661
+ } = _ref;
662
+ const {
663
+ formContext
664
+ } = registry;
665
+ const {
666
+ colon = true
667
+ } = formContext;
668
+ let labelChildren = title;
669
+
670
+ if (colon && typeof title === "string" && title.trim() !== "") {
671
+ labelChildren = title.replace(/[::]\s*$/, "");
672
+ }
526
673
 
527
- var DESCRIPTION_COL_STYLE$2 = {
528
- paddingBottom: '8px'
529
- };
674
+ const labelClassName = classNames({
675
+ [prefixCls + "-item-required"]: required,
676
+ [prefixCls + "-item-no-colon"]: !colon
677
+ });
530
678
 
531
- var NormalArrayFieldTemplate = function NormalArrayFieldTemplate(_ref) {
532
- var canAdd = _ref.canAdd,
533
- className = _ref.className,
534
- DescriptionField = _ref.DescriptionField,
535
- disabled = _ref.disabled,
536
- formContext = _ref.formContext,
537
- idSchema = _ref.idSchema,
538
- items = _ref.items,
539
- onAddClick = _ref.onAddClick,
540
- prefixCls = _ref.prefixCls,
541
- readonly = _ref.readonly,
542
- required = _ref.required,
543
- schema = _ref.schema,
544
- title = _ref.title,
545
- TitleField = _ref.TitleField,
546
- uiSchema = _ref.uiSchema;
547
- var _formContext$labelAli = formContext.labelAlign,
548
- labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
549
- _formContext$rowGutte = formContext.rowGutter,
550
- rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
551
- var labelClsBasic = prefixCls + "-item-label";
552
- var labelColClassName = classNames(labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left" // labelCol.className,
553
- );
554
- return /*#__PURE__*/React.createElement("fieldset", {
555
- className: className,
556
- id: idSchema.$id
557
- }, /*#__PURE__*/React.createElement(Row, {
558
- gutter: rowGutter
559
- }, title && /*#__PURE__*/React.createElement(Col, {
560
- className: labelColClassName,
561
- span: 24
562
- }, /*#__PURE__*/React.createElement(TitleField, {
563
- id: idSchema.$id + "__title",
564
- key: "array-field-title-" + idSchema.$id,
565
- required: required,
566
- title: uiSchema['ui:title'] || title
567
- })), (uiSchema['ui:description'] || schema.description) && /*#__PURE__*/React.createElement(Col, {
568
- span: 24,
569
- style: DESCRIPTION_COL_STYLE$2
570
- }, /*#__PURE__*/React.createElement(DescriptionField, {
571
- description: uiSchema['ui:description'] || schema.description,
572
- id: idSchema.$id + "__description",
573
- key: "array-field-description-" + idSchema.$id
574
- })), /*#__PURE__*/React.createElement(Col, {
575
- className: "row array-item-list",
576
- span: 24
577
- }, items && items.map(function (itemProps) {
578
- return /*#__PURE__*/React.createElement(ArrayFieldTemplateItem, _extends({}, itemProps, {
579
- formContext: formContext
580
- }));
581
- })), canAdd && /*#__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(Button, {
589
- block: true,
590
- className: "array-item-add",
591
- disabled: disabled || readonly,
592
- onClick: onAddClick,
593
- type: "primary"
594
- }, /*#__PURE__*/React.createElement(PlusCircleOutlined, null), " Add Item"))))));
595
- };
679
+ const handleLabelClick = () => {
680
+ if (!id) {
681
+ return;
682
+ }
596
683
 
597
- var NormalArrayFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
598
- prefixCls: 'form'
599
- })(NormalArrayFieldTemplate);
600
-
601
- var getUiOptions = utils.getUiOptions,
602
- getWidget = utils.getWidget,
603
- isFilesArray = utils.isFilesArray,
604
- isFixedItems = utils.isFixedItems,
605
- isMultiSelect = utils.isMultiSelect,
606
- optionsList = utils.optionsList,
607
- retrieveSchema = utils.retrieveSchema;
608
-
609
- var ArrayFieldTemplate = function ArrayFieldTemplate(_ref) {
610
- var DescriptionField = _ref.DescriptionField,
611
- TitleField = _ref.TitleField,
612
- autofocus = _ref.autofocus,
613
- canAdd = _ref.canAdd,
614
- className = _ref.className,
615
- disabled = _ref.disabled,
616
- formContext = _ref.formContext,
617
- formData = _ref.formData,
618
- idSchema = _ref.idSchema,
619
- items = _ref.items,
620
- label = _ref.label,
621
- name = _ref.name,
622
- onAddClick = _ref.onAddClick,
623
- onBlur = _ref.onBlur,
624
- onChange = _ref.onChange,
625
- onFocus = _ref.onFocus,
626
- placeholder = _ref.placeholder,
627
- rawErrors = _ref.rawErrors,
628
- readonly = _ref.readonly,
629
- registry = _ref.registry,
630
- required = _ref.required,
631
- schema = _ref.schema,
632
- title = _ref.title,
633
- uiSchema = _ref.uiSchema;
634
- var fields = registry.fields,
635
- rootSchema = registry.rootSchema,
636
- widgets = registry.widgets;
637
- var UnsupportedField = fields.UnsupportedField;
638
-
639
- var renderFiles = function renderFiles() {
640
- var _getUiOptions = getUiOptions(uiSchema),
641
- _getUiOptions$widget = _getUiOptions.widget,
642
- widget = _getUiOptions$widget === void 0 ? 'files' : _getUiOptions$widget,
643
- options = _objectWithoutPropertiesLoose(_getUiOptions, ["widget"]);
644
-
645
- var Widget = getWidget(schema, widget, widgets);
646
- return /*#__PURE__*/React.createElement(Widget, {
647
- autofocus: autofocus,
648
- disabled: disabled,
649
- formContext: formContext,
650
- id: idSchema && idSchema.$id,
651
- multiple: true,
652
- onBlur: onBlur,
653
- onChange: onChange,
654
- onFocus: onFocus,
655
- options: options,
656
- rawErrors: rawErrors,
657
- readonly: readonly,
658
- registry: registry,
659
- schema: schema,
660
- title: schema.title || name // Why not props.title?
661
- ,
662
- value: formData
663
- });
664
- };
684
+ const control = document.querySelector("[id=\"" + id + "\"]");
665
685
 
666
- var renderMultiSelect = function renderMultiSelect() {
667
- var itemsSchema = retrieveSchema(schema.items, rootSchema, formData);
668
- var enumOptions = optionsList(itemsSchema);
669
-
670
- var _getUiOptions$enumOpt = _extends({}, getUiOptions(uiSchema), {
671
- enumOptions: enumOptions
672
- }),
673
- _getUiOptions$enumOpt2 = _getUiOptions$enumOpt.widget,
674
- widget = _getUiOptions$enumOpt2 === void 0 ? 'select' : _getUiOptions$enumOpt2,
675
- options = _objectWithoutPropertiesLoose(_getUiOptions$enumOpt, ["widget"]);
676
-
677
- var Widget = getWidget(schema, widget, widgets);
678
- return /*#__PURE__*/React.createElement(Widget, {
679
- autofocus: autofocus,
680
- disabled: disabled,
681
- formContext: formContext,
682
- id: idSchema && idSchema.$id,
683
- label: label,
684
- multiple: true,
685
- onBlur: onBlur,
686
- onChange: onChange,
687
- onFocus: onFocus,
688
- options: options,
689
- placeholder: placeholder,
690
- rawErrors: rawErrors,
691
- readonly: readonly,
692
- registry: registry,
693
- required: required,
694
- schema: schema,
695
- value: formData
696
- });
686
+ if (control && control.focus) {
687
+ control.focus();
688
+ }
697
689
  };
698
690
 
699
- if (!Object.prototype.hasOwnProperty.call(schema, 'items')) {
700
- return /*#__PURE__*/React.createElement(UnsupportedField, {
701
- idSchema: idSchema,
702
- reason: "Missing items definition",
703
- schema: schema
704
- });
705
- }
706
-
707
- if (isFixedItems(schema)) {
708
- return /*#__PURE__*/React.createElement(FixedArrayFieldTemplate$1, {
709
- canAdd: canAdd,
710
- className: className,
711
- DescriptionField: DescriptionField,
712
- disabled: disabled,
713
- formContext: formContext,
714
- formData: formData,
715
- idSchema: idSchema,
716
- items: items,
717
- onAddClick: onAddClick,
718
- readonly: readonly,
719
- registry: registry,
720
- required: required,
721
- schema: schema,
722
- title: title,
723
- TitleField: TitleField,
724
- uiSchema: uiSchema
725
- });
726
- }
727
-
728
- if (isFilesArray(schema, uiSchema, rootSchema)) {
729
- return renderFiles();
730
- }
731
-
732
- if (isMultiSelect(schema, rootSchema)) {
733
- return renderMultiSelect();
734
- }
735
-
736
- return /*#__PURE__*/React.createElement(NormalArrayFieldTemplate$1, {
737
- canAdd: canAdd,
738
- className: className,
739
- DescriptionField: DescriptionField,
740
- disabled: disabled,
741
- formContext: formContext,
742
- formData: formData,
743
- idSchema: idSchema,
744
- items: items,
745
- onAddClick: onAddClick,
746
- readonly: readonly,
747
- registry: registry,
748
- required: required,
749
- schema: schema,
750
- title: title,
751
- TitleField: TitleField,
752
- uiSchema: uiSchema
753
- });
691
+ return title ? /*#__PURE__*/React.createElement("label", {
692
+ className: labelClassName,
693
+ htmlFor: id,
694
+ onClick: handleLabelClick,
695
+ title: typeof title === "string" ? title : ""
696
+ }, labelChildren) : null;
754
697
  };
755
698
 
756
- var pad = utils.pad,
757
- parseDateString = utils.parseDateString,
758
- toDateString = utils.toDateString;
699
+ TitleField.defaultProps = {
700
+ formContext: {}
701
+ };
702
+ var TitleField$1 = /*#__PURE__*/withConfigConsumer({
703
+ prefixCls: "form"
704
+ })(TitleField);
759
705
 
760
- var rangeOptions = function rangeOptions(start, stop) {
761
- var options = [];
706
+ const rangeOptions = (start, stop) => {
707
+ let options = [];
762
708
 
763
- for (var i = start; i <= stop; i++) {
709
+ for (let i = start; i <= stop; i++) {
764
710
  options.push({
765
711
  value: i,
766
712
  label: pad(i, 2)
@@ -770,41 +716,40 @@ var rangeOptions = function rangeOptions(start, stop) {
770
716
  return options;
771
717
  };
772
718
 
773
- var readyForChange = function readyForChange(state) {
774
- return Object.keys(state).every(function (key) {
775
- return typeof state[key] !== "undefined" && state[key] !== -1;
776
- });
719
+ const readyForChange = state => {
720
+ return Object.keys(state).every(key => typeof state[key] !== "undefined" && state[key] !== -1);
777
721
  };
778
722
 
779
- var AltDateWidget = function AltDateWidget(_ref) {
780
- var autofocus = _ref.autofocus,
781
- disabled = _ref.disabled,
782
- formContext = _ref.formContext,
783
- id = _ref.id,
784
- onBlur = _ref.onBlur,
785
- onChange = _ref.onChange,
786
- onFocus = _ref.onFocus,
787
- options = _ref.options,
788
- readonly = _ref.readonly,
789
- registry = _ref.registry,
790
- showTime = _ref.showTime,
791
- value = _ref.value;
792
- var SelectWidget = registry.widgets.SelectWidget;
793
- var _formContext$rowGutte = formContext.rowGutter,
794
- rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
795
-
796
- var _useState = useState(parseDateString(value, showTime)),
797
- state = _useState[0],
798
- setState = _useState[1];
799
-
800
- useEffect(function () {
723
+ const AltDateWidget = _ref => {
724
+ let {
725
+ autofocus,
726
+ disabled,
727
+ formContext,
728
+ id,
729
+ onBlur,
730
+ onChange,
731
+ onFocus,
732
+ options,
733
+ readonly,
734
+ registry,
735
+ showTime,
736
+ value
737
+ } = _ref;
738
+ const {
739
+ SelectWidget
740
+ } = registry.widgets;
741
+ const {
742
+ rowGutter = 24
743
+ } = formContext;
744
+ const [state, setState] = useState(parseDateString(value, showTime));
745
+ useEffect(() => {
801
746
  setState(parseDateString(value, showTime));
802
747
  }, [showTime, value]);
803
748
 
804
- var handleChange = function handleChange(property, nextValue) {
805
- var _extends2;
806
-
807
- var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === "undefined" ? -1 : nextValue, _extends2));
749
+ const handleChange = (property, nextValue) => {
750
+ const nextState = { ...state,
751
+ [property]: typeof nextValue === "undefined" ? -1 : nextValue
752
+ };
808
753
 
809
754
  if (readyForChange(nextState)) {
810
755
  onChange(toDateString(nextState, showTime));
@@ -813,18 +758,18 @@ var AltDateWidget = function AltDateWidget(_ref) {
813
758
  }
814
759
  };
815
760
 
816
- var handleNow = function handleNow(event) {
761
+ const handleNow = event => {
817
762
  event.preventDefault();
818
763
 
819
764
  if (disabled || readonly) {
820
765
  return;
821
766
  }
822
767
 
823
- var nextState = parseDateString(new Date().toJSON(), showTime);
768
+ const nextState = parseDateString(new Date().toJSON(), showTime);
824
769
  onChange(toDateString(nextState, showTime));
825
770
  };
826
771
 
827
- var handleClear = function handleClear(event) {
772
+ const handleClear = event => {
828
773
  event.preventDefault();
829
774
 
830
775
  if (disabled || readonly) {
@@ -834,14 +779,16 @@ var AltDateWidget = function AltDateWidget(_ref) {
834
779
  onChange(undefined);
835
780
  };
836
781
 
837
- var dateElementProps = function dateElementProps() {
838
- var year = state.year,
839
- month = state.month,
840
- day = state.day,
841
- hour = state.hour,
842
- minute = state.minute,
843
- second = state.second;
844
- var data = [{
782
+ const dateElementProps = () => {
783
+ const {
784
+ year,
785
+ month,
786
+ day,
787
+ hour,
788
+ minute,
789
+ second
790
+ } = state;
791
+ const data = [{
845
792
  type: "year",
846
793
  range: options.yearsRange,
847
794
  value: year
@@ -874,49 +821,45 @@ var AltDateWidget = function AltDateWidget(_ref) {
874
821
  return data;
875
822
  };
876
823
 
877
- var renderDateElement = function renderDateElement(elemProps) {
878
- return /*#__PURE__*/React.createElement(SelectWidget, {
879
- autofocus: elemProps.autofocus,
880
- className: "form-control",
881
- disabled: elemProps.disabled,
882
- id: elemProps.id,
883
- onBlur: elemProps.onBlur,
884
- onChange: function onChange(elemValue) {
885
- return elemProps.select(elemProps.type, elemValue);
886
- },
887
- onFocus: elemProps.onFocus,
888
- options: {
889
- enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1])
890
- },
891
- placeholder: elemProps.type,
892
- readonly: elemProps.readonly,
893
- schema: {
894
- type: "integer"
895
- },
896
- value: elemProps.value
897
- });
898
- };
824
+ const renderDateElement = elemProps => /*#__PURE__*/React.createElement(SelectWidget, {
825
+ autofocus: elemProps.autofocus,
826
+ className: "form-control",
827
+ disabled: elemProps.disabled,
828
+ id: elemProps.id,
829
+ onBlur: elemProps.onBlur,
830
+ onChange: elemValue => elemProps.select(elemProps.type, elemValue),
831
+ onFocus: elemProps.onFocus,
832
+ options: {
833
+ enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1])
834
+ },
835
+ placeholder: elemProps.type,
836
+ readonly: elemProps.readonly,
837
+ schema: {
838
+ type: "integer"
839
+ },
840
+ value: elemProps.value
841
+ });
899
842
 
900
843
  return /*#__PURE__*/React.createElement(Row, {
901
844
  gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
902
- }, dateElementProps().map(function (elemProps, i) {
903
- var elemId = id + "_" + elemProps.type;
845
+ }, dateElementProps().map((elemProps, i) => {
846
+ const elemId = id + "_" + elemProps.type;
904
847
  return /*#__PURE__*/React.createElement(Col, {
905
848
  flex: "88px",
906
849
  key: elemId
907
- }, renderDateElement(_extends({}, elemProps, {
850
+ }, renderDateElement({ ...elemProps,
908
851
  autofocus: autofocus && i === 0,
909
- disabled: disabled,
852
+ disabled,
910
853
  id: elemId,
911
- onBlur: onBlur,
912
- onFocus: onFocus,
913
- readonly: readonly,
914
- registry: registry,
854
+ onBlur,
855
+ onFocus,
856
+ readonly,
857
+ registry,
915
858
  select: handleChange,
916
859
  // NOTE: antd components accept -1 rather than issue a warning
917
860
  // like material-ui, so we need to convert -1 to undefined here.
918
861
  value: elemProps.value < 0 ? undefined : elemProps.value
919
- })));
862
+ }));
920
863
  }), !options.hideNowButton && /*#__PURE__*/React.createElement(Col, {
921
864
  flex: "88px"
922
865
  }, /*#__PURE__*/React.createElement(Button, {
@@ -945,49 +888,62 @@ AltDateWidget.defaultProps = {
945
888
  showTime: false
946
889
  };
947
890
 
948
- var AltDateTimeWidget = function AltDateTimeWidget(props) {
949
- var AltDateWidget = props.registry.widgets.AltDateWidget;
891
+ const AltDateTimeWidget = props => {
892
+ const {
893
+ AltDateWidget
894
+ } = props.registry.widgets;
950
895
  return /*#__PURE__*/React.createElement(AltDateWidget, _extends({
951
896
  showTime: true
952
897
  }, props));
953
898
  };
954
899
 
955
- AltDateTimeWidget.defaultProps = /*#__PURE__*/_extends({}, AltDateWidget.defaultProps, {
900
+ AltDateTimeWidget.defaultProps = { ...AltDateWidget.defaultProps,
956
901
  showTime: true
957
- });
958
-
959
- var CheckboxesWidget = function CheckboxesWidget(_ref) {
960
- var autofocus = _ref.autofocus,
961
- disabled = _ref.disabled,
962
- formContext = _ref.formContext,
963
- id = _ref.id,
964
- onBlur = _ref.onBlur,
965
- onChange = _ref.onChange,
966
- onFocus = _ref.onFocus,
967
- options = _ref.options,
968
- readonly = _ref.readonly,
969
- value = _ref.value;
970
- var _formContext$readonly = formContext.readonlyAsDisabled,
971
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
972
- var enumOptions = options.enumOptions,
973
- enumDisabled = options.enumDisabled,
974
- inline = options.inline;
975
-
976
- var handleChange = function handleChange(nextValue) {
977
- return onChange(nextValue);
978
- };
902
+ };
979
903
 
980
- var handleBlur = function handleBlur(_ref2) {
981
- var target = _ref2.target;
904
+ const CheckboxesWidget = _ref => {
905
+ let {
906
+ autofocus,
907
+ disabled,
908
+ formContext,
909
+ id,
910
+ // label,
911
+ onBlur,
912
+ onChange,
913
+ onFocus,
914
+ options,
915
+ // placeholder,
916
+ readonly,
917
+ // required,
918
+ // schema,
919
+ value
920
+ } = _ref;
921
+ const {
922
+ readonlyAsDisabled = true
923
+ } = formContext;
924
+ const {
925
+ enumOptions,
926
+ enumDisabled,
927
+ inline
928
+ } = options;
929
+
930
+ const handleChange = nextValue => onChange(nextValue);
931
+
932
+ const handleBlur = _ref2 => {
933
+ let {
934
+ target
935
+ } = _ref2;
982
936
  return onBlur(id, target.value);
983
937
  };
984
938
 
985
- var handleFocus = function handleFocus(_ref3) {
986
- var target = _ref3.target;
939
+ const handleFocus = _ref3 => {
940
+ let {
941
+ target
942
+ } = _ref3;
987
943
  return onFocus(id, target.value);
988
944
  };
989
945
 
990
- return !_.isEmpty(enumOptions) ? /*#__PURE__*/React.createElement(Checkbox.Group, {
946
+ return Array.isArray(enumOptions) && enumOptions.length > 0 ? /*#__PURE__*/React.createElement(Checkbox.Group, {
991
947
  disabled: disabled || readonlyAsDisabled && readonly,
992
948
  id: id,
993
949
  name: id,
@@ -995,9 +951,11 @@ var CheckboxesWidget = function CheckboxesWidget(_ref) {
995
951
  onChange: !readonly ? handleChange : undefined,
996
952
  onFocus: !readonly ? handleFocus : undefined,
997
953
  value: value
998
- }, enumOptions.map(function (_ref4, i) {
999
- var optionValue = _ref4.value,
1000
- optionLabel = _ref4.label;
954
+ }, enumOptions.map((_ref4, i) => {
955
+ let {
956
+ value: optionValue,
957
+ label: optionLabel
958
+ } = _ref4;
1001
959
  return /*#__PURE__*/React.createElement("span", {
1002
960
  key: optionValue
1003
961
  }, /*#__PURE__*/React.createElement(Checkbox, {
@@ -1008,38 +966,51 @@ var CheckboxesWidget = function CheckboxesWidget(_ref) {
1008
966
  })) : null;
1009
967
  };
1010
968
 
1011
- var CheckboxWidget = function CheckboxWidget(_ref) {
1012
- var autofocus = _ref.autofocus,
1013
- disabled = _ref.disabled,
1014
- formContext = _ref.formContext,
1015
- id = _ref.id,
1016
- label = _ref.label,
1017
- onBlur = _ref.onBlur,
1018
- onChange = _ref.onChange,
1019
- onFocus = _ref.onFocus,
1020
- readonly = _ref.readonly,
1021
- value = _ref.value;
1022
- var _formContext$readonly = formContext.readonlyAsDisabled,
1023
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1024
-
1025
- var handleChange = function handleChange(_ref2) {
1026
- var target = _ref2.target;
969
+ const CheckboxWidget = _ref => {
970
+ let {
971
+ autofocus,
972
+ disabled,
973
+ formContext,
974
+ id,
975
+ label,
976
+ onBlur,
977
+ onChange,
978
+ onFocus,
979
+ // options,
980
+ // placeholder,
981
+ readonly,
982
+ // required,
983
+ // schema,
984
+ value
985
+ } = _ref;
986
+ const {
987
+ readonlyAsDisabled = true
988
+ } = formContext;
989
+
990
+ const handleChange = _ref2 => {
991
+ let {
992
+ target
993
+ } = _ref2;
1027
994
  return onChange(target.checked);
1028
995
  };
1029
996
 
1030
- var handleBlur = function handleBlur(_ref3) {
1031
- var target = _ref3.target;
997
+ const handleBlur = _ref3 => {
998
+ let {
999
+ target
1000
+ } = _ref3;
1032
1001
  return onBlur(id, target.checked);
1033
1002
  };
1034
1003
 
1035
- var handleFocus = function handleFocus(_ref4) {
1036
- var target = _ref4.target;
1004
+ const handleFocus = _ref4 => {
1005
+ let {
1006
+ target
1007
+ } = _ref4;
1037
1008
  return onFocus(id, target.checked);
1038
1009
  };
1039
1010
 
1040
1011
  return /*#__PURE__*/React.createElement(Checkbox, {
1041
1012
  autoFocus: autofocus,
1042
- checked: typeof value === 'undefined' ? false : value,
1013
+ checked: typeof value === "undefined" ? false : value,
1043
1014
  disabled: disabled || readonlyAsDisabled && readonly,
1044
1015
  id: id,
1045
1016
  name: id,
@@ -1049,86 +1020,40 @@ var CheckboxWidget = function CheckboxWidget(_ref) {
1049
1020
  }, label);
1050
1021
  };
1051
1022
 
1052
- var INPUT_STYLE$1 = {
1053
- width: '100%'
1054
- };
1055
-
1056
- var ColorWidget = function ColorWidget(_ref) {
1057
- var disabled = _ref.disabled,
1058
- formContext = _ref.formContext,
1059
- id = _ref.id,
1060
- onBlur = _ref.onBlur,
1061
- onChange = _ref.onChange,
1062
- onFocus = _ref.onFocus,
1063
- placeholder = _ref.placeholder,
1064
- readonly = _ref.readonly,
1065
- value = _ref.value;
1066
- var _formContext$readonly = formContext.readonlyAsDisabled,
1067
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1068
-
1069
- var handleChange = function handleChange(_ref2) {
1070
- var target = _ref2.target;
1071
- return onChange(target.value);
1072
- };
1073
-
1074
- var handleBlur = function handleBlur(_ref3) {
1075
- var target = _ref3.target;
1076
- return onBlur(id, target.value);
1077
- };
1078
-
1079
- var handleFocus = function handleFocus(_ref4) {
1080
- var target = _ref4.target;
1081
- return onFocus(id, target.value);
1082
- };
1083
-
1084
- return /*#__PURE__*/React.createElement(Checkbox, {
1085
- disabled: disabled || readonlyAsDisabled && readonly,
1086
- id: id,
1087
- name: id,
1088
- onBlur: !readonly ? handleBlur : undefined,
1089
- onChange: !readonly ? handleChange : undefined,
1090
- onFocus: !readonly ? handleFocus : undefined,
1091
- placeholder: placeholder,
1092
- style: INPUT_STYLE$1,
1093
- type: "color",
1094
- value: value
1095
- });
1096
- };
1097
-
1098
- var DatePicker = /*#__PURE__*/generatePicker(dayjsGenerateConfig);
1023
+ const DatePicker = /*#__PURE__*/generatePicker(dayjsGenerateConfig);
1099
1024
 
1100
- var DATE_PICKER_STYLE = {
1101
- width: '100%'
1025
+ const DATE_PICKER_STYLE$1 = {
1026
+ width: "100%"
1102
1027
  };
1103
1028
 
1104
- var DateTimeWidget = function DateTimeWidget(_ref) {
1105
- var disabled = _ref.disabled,
1106
- formContext = _ref.formContext,
1107
- id = _ref.id,
1108
- onBlur = _ref.onBlur,
1109
- onChange = _ref.onChange,
1110
- onFocus = _ref.onFocus,
1111
- placeholder = _ref.placeholder,
1112
- readonly = _ref.readonly,
1113
- value = _ref.value;
1114
- var _formContext$readonly = formContext.readonlyAsDisabled,
1115
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1116
-
1117
- var handleChange = function handleChange(nextValue) {
1118
- return onChange(nextValue && nextValue.toISOString());
1119
- };
1120
-
1121
- var handleBlur = function handleBlur() {
1122
- return onBlur(id, value);
1123
- };
1124
-
1125
- var handleFocus = function handleFocus() {
1126
- return onFocus(id, value);
1127
- };
1128
-
1129
- var getPopupContainer = function getPopupContainer(node) {
1130
- return node.parentNode;
1131
- };
1029
+ const DateTimeWidget = _ref => {
1030
+ let {
1031
+ // autofocus,
1032
+ disabled,
1033
+ formContext,
1034
+ id,
1035
+ // label,
1036
+ onBlur,
1037
+ onChange,
1038
+ onFocus,
1039
+ // options,
1040
+ placeholder,
1041
+ readonly,
1042
+ // required,
1043
+ // schema,
1044
+ value
1045
+ } = _ref;
1046
+ const {
1047
+ readonlyAsDisabled = true
1048
+ } = formContext;
1049
+
1050
+ const handleChange = nextValue => onChange(nextValue && nextValue.toISOString());
1051
+
1052
+ const handleBlur = () => onBlur(id, value);
1053
+
1054
+ const handleFocus = () => onFocus(id, value);
1055
+
1056
+ const getPopupContainer = node => node.parentNode;
1132
1057
 
1133
1058
  return /*#__PURE__*/React.createElement(DatePicker, {
1134
1059
  disabled: disabled || readonlyAsDisabled && readonly,
@@ -1140,43 +1065,43 @@ var DateTimeWidget = function DateTimeWidget(_ref) {
1140
1065
  onFocus: !readonly ? handleFocus : undefined,
1141
1066
  placeholder: placeholder,
1142
1067
  showTime: true,
1143
- style: DATE_PICKER_STYLE,
1068
+ style: DATE_PICKER_STYLE$1,
1144
1069
  value: value && dayjs(value)
1145
1070
  });
1146
1071
  };
1147
1072
 
1148
- var DATE_PICKER_STYLE$1 = {
1149
- width: '100%'
1073
+ const DATE_PICKER_STYLE = {
1074
+ width: "100%"
1150
1075
  };
1151
1076
 
1152
- var DateWidget = function DateWidget(_ref) {
1153
- var disabled = _ref.disabled,
1154
- formContext = _ref.formContext,
1155
- id = _ref.id,
1156
- onBlur = _ref.onBlur,
1157
- onChange = _ref.onChange,
1158
- onFocus = _ref.onFocus,
1159
- placeholder = _ref.placeholder,
1160
- readonly = _ref.readonly,
1161
- value = _ref.value;
1162
- var _formContext$readonly = formContext.readonlyAsDisabled,
1163
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1164
-
1165
- var handleChange = function handleChange(nextValue) {
1166
- return onChange(nextValue && nextValue.format('YYYY-MM-DD'));
1167
- };
1168
-
1169
- var handleBlur = function handleBlur() {
1170
- return onBlur(id, value);
1171
- };
1172
-
1173
- var handleFocus = function handleFocus() {
1174
- return onFocus(id, value);
1175
- };
1176
-
1177
- var getPopupContainer = function getPopupContainer(node) {
1178
- return node.parentNode;
1179
- };
1077
+ const DateWidget = _ref => {
1078
+ let {
1079
+ // autofocus,
1080
+ disabled,
1081
+ formContext,
1082
+ id,
1083
+ // label,
1084
+ onBlur,
1085
+ onChange,
1086
+ onFocus,
1087
+ // options,
1088
+ placeholder,
1089
+ readonly,
1090
+ // required,
1091
+ // schema,
1092
+ value
1093
+ } = _ref;
1094
+ const {
1095
+ readonlyAsDisabled = true
1096
+ } = formContext;
1097
+
1098
+ const handleChange = nextValue => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
1099
+
1100
+ const handleBlur = () => onBlur(id, value);
1101
+
1102
+ const handleFocus = () => onFocus(id, value);
1103
+
1104
+ const getPopupContainer = node => node.parentNode;
1180
1105
 
1181
1106
  return /*#__PURE__*/React.createElement(DatePicker, {
1182
1107
  disabled: disabled || readonlyAsDisabled && readonly,
@@ -1188,85 +1113,51 @@ var DateWidget = function DateWidget(_ref) {
1188
1113
  onFocus: !readonly ? handleFocus : undefined,
1189
1114
  placeholder: placeholder,
1190
1115
  showTime: false,
1191
- style: DATE_PICKER_STYLE$1,
1116
+ style: DATE_PICKER_STYLE,
1192
1117
  value: value && dayjs(value)
1193
1118
  });
1194
1119
  };
1195
1120
 
1196
- var INPUT_STYLE$2 = {
1197
- width: '100%'
1198
- };
1199
-
1200
- var EmailWidget = function EmailWidget(_ref) {
1201
- var disabled = _ref.disabled,
1202
- formContext = _ref.formContext,
1203
- id = _ref.id,
1204
- onBlur = _ref.onBlur,
1205
- onChange = _ref.onChange,
1206
- onFocus = _ref.onFocus,
1207
- options = _ref.options,
1208
- placeholder = _ref.placeholder,
1209
- readonly = _ref.readonly,
1210
- value = _ref.value;
1211
- var _formContext$readonly = formContext.readonlyAsDisabled,
1212
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1213
-
1214
- var handleChange = function handleChange(_ref2) {
1215
- var target = _ref2.target;
1216
- return onChange(target.value === '' ? options.emptyValue : target.value);
1217
- };
1218
-
1219
- var handleBlur = function handleBlur(_ref3) {
1220
- var target = _ref3.target;
1121
+ const PasswordWidget = _ref => {
1122
+ let {
1123
+ // autofocus,
1124
+ disabled,
1125
+ formContext,
1126
+ id,
1127
+ // label,
1128
+ onBlur,
1129
+ onChange,
1130
+ onFocus,
1131
+ options,
1132
+ placeholder,
1133
+ readonly,
1134
+ // required,
1135
+ // schema,
1136
+ value
1137
+ } = _ref;
1138
+ const {
1139
+ readonlyAsDisabled = true
1140
+ } = formContext;
1141
+ const emptyValue = options.emptyValue || "";
1142
+
1143
+ const handleChange = _ref2 => {
1144
+ let {
1145
+ target
1146
+ } = _ref2;
1147
+ return onChange(target.value === "" ? emptyValue : target.value);
1148
+ };
1149
+
1150
+ const handleBlur = _ref3 => {
1151
+ let {
1152
+ target
1153
+ } = _ref3;
1221
1154
  return onBlur(id, target.value);
1222
1155
  };
1223
1156
 
1224
- var handleFocus = function handleFocus(_ref4) {
1225
- var target = _ref4.target;
1226
- return onFocus(id, target.value);
1227
- };
1228
-
1229
- return /*#__PURE__*/React.createElement(Input, {
1230
- disabled: disabled || readonlyAsDisabled && readonly,
1231
- id: id,
1232
- name: id,
1233
- onBlur: !readonly ? handleBlur : undefined,
1234
- onChange: !readonly ? handleChange : undefined,
1235
- onFocus: !readonly ? handleFocus : undefined,
1236
- placeholder: placeholder,
1237
- style: INPUT_STYLE$2,
1238
- type: "email",
1239
- value: value
1240
- });
1241
- };
1242
-
1243
- var PasswordWidget = function PasswordWidget(_ref) {
1244
- var disabled = _ref.disabled,
1245
- formContext = _ref.formContext,
1246
- id = _ref.id,
1247
- onBlur = _ref.onBlur,
1248
- onChange = _ref.onChange,
1249
- onFocus = _ref.onFocus,
1250
- options = _ref.options,
1251
- placeholder = _ref.placeholder,
1252
- readonly = _ref.readonly,
1253
- value = _ref.value;
1254
- var _formContext$readonly = formContext.readonlyAsDisabled,
1255
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1256
- var emptyValue = options.emptyValue || '';
1257
-
1258
- var handleChange = function handleChange(_ref2) {
1259
- var target = _ref2.target;
1260
- return onChange(target.value === '' ? emptyValue : target.value);
1261
- };
1262
-
1263
- var handleBlur = function handleBlur(_ref3) {
1264
- var target = _ref3.target;
1265
- return onBlur(id, target.value);
1266
- };
1267
-
1268
- var handleFocus = function handleFocus(_ref4) {
1269
- var target = _ref4.target;
1157
+ const handleFocus = _ref4 => {
1158
+ let {
1159
+ target
1160
+ } = _ref4;
1270
1161
  return onFocus(id, target.value);
1271
1162
  };
1272
1163
 
@@ -1278,41 +1169,57 @@ var PasswordWidget = function PasswordWidget(_ref) {
1278
1169
  onChange: !readonly ? handleChange : undefined,
1279
1170
  onFocus: !readonly ? handleFocus : undefined,
1280
1171
  placeholder: placeholder,
1281
- value: value || ''
1172
+ value: value || ""
1282
1173
  });
1283
1174
  };
1284
1175
 
1285
1176
  /* eslint-disable no-else-return */
1286
1177
 
1287
- var RadioWidget = function RadioWidget(_ref) {
1288
- var autofocus = _ref.autofocus,
1289
- disabled = _ref.disabled,
1290
- formContext = _ref.formContext,
1291
- id = _ref.id,
1292
- onBlur = _ref.onBlur,
1293
- onChange = _ref.onChange,
1294
- onFocus = _ref.onFocus,
1295
- options = _ref.options,
1296
- readonly = _ref.readonly,
1297
- schema = _ref.schema,
1298
- value = _ref.value;
1299
- var _formContext$readonly = formContext.readonlyAsDisabled,
1300
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1301
- var enumOptions = options.enumOptions,
1302
- enumDisabled = options.enumDisabled;
1303
-
1304
- var handleChange = function handleChange(_ref2) {
1305
- var nextValue = _ref2.target.value;
1306
- return onChange(schema.type === 'boolean' ? nextValue !== 'false' : nextValue);
1178
+ const RadioWidget = _ref => {
1179
+ let {
1180
+ autofocus,
1181
+ disabled,
1182
+ formContext,
1183
+ id,
1184
+ // label,
1185
+ onBlur,
1186
+ onChange,
1187
+ onFocus,
1188
+ options,
1189
+ // placeholder,
1190
+ readonly,
1191
+ // required,
1192
+ schema,
1193
+ value
1194
+ } = _ref;
1195
+ const {
1196
+ readonlyAsDisabled = true
1197
+ } = formContext;
1198
+ const {
1199
+ enumOptions,
1200
+ enumDisabled
1201
+ } = options;
1202
+
1203
+ const handleChange = _ref2 => {
1204
+ let {
1205
+ target: {
1206
+ value: nextValue
1207
+ }
1208
+ } = _ref2;
1209
+ return onChange(schema.type === "boolean" ? nextValue !== "false" : nextValue);
1307
1210
  };
1308
1211
 
1309
- var handleBlur = function handleBlur(_ref3) {
1310
- var target = _ref3.target;
1212
+ const handleBlur = _ref3 => {
1213
+ let {
1214
+ target
1215
+ } = _ref3;
1311
1216
  return onBlur(id, target.value);
1312
1217
  };
1313
1218
 
1314
- var handleFocus = function handleFocus(_ref4) {
1315
- var target = _ref4.target;
1219
+ const handleFocus = _ref4 => {
1220
+ let {
1221
+ target
1222
+ } = _ref4;
1316
1223
  return onFocus(id, target.value);
1317
1224
  };
1318
1225
 
@@ -1324,9 +1231,11 @@ var RadioWidget = function RadioWidget(_ref) {
1324
1231
  onChange: !readonly ? handleChange : undefined,
1325
1232
  onFocus: !readonly ? handleFocus : undefined,
1326
1233
  value: "" + value
1327
- }, enumOptions.map(function (_ref5, i) {
1328
- var optionValue = _ref5.value,
1329
- optionLabel = _ref5.label;
1234
+ }, enumOptions.map((_ref5, i) => {
1235
+ let {
1236
+ value: optionValue,
1237
+ label: optionLabel
1238
+ } = _ref5;
1330
1239
  return /*#__PURE__*/React.createElement(Radio, {
1331
1240
  autoFocus: i === 0 ? autofocus : false,
1332
1241
  disabled: enumDisabled && enumDisabled.indexOf(value) !== -1,
@@ -1337,42 +1246,39 @@ var RadioWidget = function RadioWidget(_ref) {
1337
1246
  };
1338
1247
 
1339
1248
  /* eslint-disable no-else-return */
1340
- var rangeSpec = utils.rangeSpec;
1341
-
1342
- var RangeWidget = function RangeWidget(_ref) {
1343
- var autofocus = _ref.autofocus,
1344
- disabled = _ref.disabled,
1345
- formContext = _ref.formContext,
1346
- id = _ref.id,
1347
- onBlur = _ref.onBlur,
1348
- onChange = _ref.onChange,
1349
- onFocus = _ref.onFocus,
1350
- options = _ref.options,
1351
- placeholder = _ref.placeholder,
1352
- readonly = _ref.readonly,
1353
- schema = _ref.schema,
1354
- value = _ref.value;
1355
- var _formContext$readonly = formContext.readonlyAsDisabled,
1356
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1357
-
1358
- var _rangeSpec = rangeSpec(schema),
1359
- min = _rangeSpec.min,
1360
- max = _rangeSpec.max,
1361
- step = _rangeSpec.step;
1362
-
1363
- var emptyValue = options.emptyValue || '';
1364
-
1365
- var handleChange = function handleChange(nextValue) {
1366
- return onChange(nextValue === '' ? emptyValue : nextValue);
1367
- };
1368
1249
 
1369
- var handleBlur = function handleBlur() {
1370
- return onBlur(id, value);
1371
- };
1372
-
1373
- var handleFocus = function handleFocus() {
1374
- return onFocus(id, value);
1375
- };
1250
+ const RangeWidget = _ref => {
1251
+ let {
1252
+ autofocus,
1253
+ disabled,
1254
+ formContext,
1255
+ id,
1256
+ // label,
1257
+ onBlur,
1258
+ onChange,
1259
+ onFocus,
1260
+ options,
1261
+ placeholder,
1262
+ readonly,
1263
+ // required,
1264
+ schema,
1265
+ value
1266
+ } = _ref;
1267
+ const {
1268
+ readonlyAsDisabled = true
1269
+ } = formContext;
1270
+ const {
1271
+ min,
1272
+ max,
1273
+ step
1274
+ } = rangeSpec(schema);
1275
+ const emptyValue = options.emptyValue || "";
1276
+
1277
+ const handleChange = nextValue => onChange(nextValue === "" ? emptyValue : nextValue);
1278
+
1279
+ const handleBlur = () => onBlur(id, value);
1280
+
1281
+ const handleFocus = () => onFocus(id, value);
1376
1282
 
1377
1283
  return /*#__PURE__*/React.createElement(Slider, {
1378
1284
  autoFocus: autofocus,
@@ -1391,104 +1297,64 @@ var RangeWidget = function RangeWidget(_ref) {
1391
1297
  };
1392
1298
 
1393
1299
  /* eslint-disable no-else-return */
1394
- var asNumber = utils.asNumber,
1395
- guessType = utils.guessType;
1396
- var SELECT_STYLE = {
1397
- width: '100%'
1398
- };
1399
- var nums = /*#__PURE__*/new Set(['number', 'integer']);
1400
- /**
1401
- * This is a silly limitation in the DOM where option change event values are
1402
- * always retrieved as strings.
1403
- */
1404
-
1405
- var processValue = function processValue(schema, value) {
1406
- // "enum" is a reserved word, so only "type" and "items" can be destructured
1407
- var type = schema.type,
1408
- items = schema.items;
1409
-
1410
- if (value === '') {
1411
- return undefined;
1412
- } else if (type === 'array' && items && nums.has(items.type)) {
1413
- return value.map(asNumber);
1414
- } else if (type === 'boolean') {
1415
- return value === 'true';
1416
- } else if (type === 'number') {
1417
- return asNumber(value);
1418
- } // If type is undefined, but an enum is present, try and infer the type from
1419
- // the enum values
1420
-
1421
-
1422
- if (schema.enum) {
1423
- if (schema.enum.every(function (x) {
1424
- return guessType(x) === 'number';
1425
- })) {
1426
- return asNumber(value);
1427
- } else if (schema.enum.every(function (x) {
1428
- return guessType(x) === 'boolean';
1429
- })) {
1430
- return value === 'true';
1431
- }
1432
- }
1433
-
1434
- return value;
1300
+ const SELECT_STYLE = {
1301
+ width: "100%"
1435
1302
  };
1436
1303
 
1437
- var SelectWidget = function SelectWidget(_ref) {
1438
- var autofocus = _ref.autofocus,
1439
- disabled = _ref.disabled,
1440
- formContext = _ref.formContext,
1441
- id = _ref.id,
1442
- multiple = _ref.multiple,
1443
- onBlur = _ref.onBlur,
1444
- onChange = _ref.onChange,
1445
- onFocus = _ref.onFocus,
1446
- options = _ref.options,
1447
- placeholder = _ref.placeholder,
1448
- readonly = _ref.readonly,
1449
- schema = _ref.schema,
1450
- value = _ref.value;
1451
- var _formContext$readonly = formContext.readonlyAsDisabled,
1452
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1453
- var enumOptions = options.enumOptions,
1454
- enumDisabled = options.enumDisabled;
1455
-
1456
- var handleChange = function handleChange(nextValue) {
1457
- return onChange(processValue(schema, nextValue));
1458
- };
1459
-
1460
- var handleBlur = function handleBlur() {
1461
- return onBlur(id, processValue(schema, value));
1462
- };
1463
-
1464
- var handleFocus = function handleFocus() {
1465
- return onFocus(id, processValue(schema, value));
1466
- };
1467
-
1468
- var getPopupContainer = function getPopupContainer(node) {
1469
- return node.parentNode;
1470
- };
1471
-
1472
- var stringify = function stringify(currentValue) {
1473
- return Array.isArray(currentValue) ? value.map(String) : String(value);
1474
- };
1304
+ const SelectWidget = _ref => {
1305
+ let {
1306
+ autofocus,
1307
+ disabled,
1308
+ formContext,
1309
+ id,
1310
+ // label,
1311
+ multiple,
1312
+ onBlur,
1313
+ onChange,
1314
+ onFocus,
1315
+ options,
1316
+ placeholder,
1317
+ readonly,
1318
+ // required,
1319
+ schema,
1320
+ value
1321
+ } = _ref;
1322
+ const {
1323
+ readonlyAsDisabled = true
1324
+ } = formContext;
1325
+ const {
1326
+ enumOptions,
1327
+ enumDisabled
1328
+ } = options;
1329
+
1330
+ const handleChange = nextValue => onChange(processSelectValue(schema, nextValue, options));
1331
+
1332
+ const handleBlur = () => onBlur(id, processSelectValue(schema, value, options));
1333
+
1334
+ const handleFocus = () => onFocus(id, processSelectValue(schema, value, options));
1335
+
1336
+ const getPopupContainer = node => node.parentNode;
1337
+
1338
+ const stringify = currentValue => Array.isArray(currentValue) ? value.map(String) : String(value);
1475
1339
 
1476
1340
  return /*#__PURE__*/React.createElement(Select, {
1477
1341
  autoFocus: autofocus,
1478
1342
  disabled: disabled || readonlyAsDisabled && readonly,
1479
1343
  getPopupContainer: getPopupContainer,
1480
1344
  id: id,
1481
- mode: typeof multiple !== 'undefined' ? 'multiple' : undefined,
1345
+ mode: typeof multiple !== "undefined" ? "multiple" : undefined,
1482
1346
  name: id,
1483
1347
  onBlur: !readonly ? handleBlur : undefined,
1484
1348
  onChange: !readonly ? handleChange : undefined,
1485
1349
  onFocus: !readonly ? handleFocus : undefined,
1486
1350
  placeholder: placeholder,
1487
1351
  style: SELECT_STYLE,
1488
- value: typeof value !== 'undefined' ? stringify(value) : undefined
1489
- }, enumOptions.map(function (_ref2) {
1490
- var optionValue = _ref2.value,
1491
- optionLabel = _ref2.label;
1352
+ value: typeof value !== "undefined" ? stringify(value) : undefined
1353
+ }, enumOptions.map(_ref2 => {
1354
+ let {
1355
+ value: optionValue,
1356
+ label: optionLabel
1357
+ } = _ref2;
1492
1358
  return /*#__PURE__*/React.createElement(Select.Option, {
1493
1359
  disabled: enumDisabled && enumDisabled.indexOf(optionValue) !== -1,
1494
1360
  key: String(optionValue),
@@ -1501,36 +1367,49 @@ SelectWidget.defaultProps = {
1501
1367
  formContext: {}
1502
1368
  };
1503
1369
 
1504
- var INPUT_STYLE$3 = {
1505
- width: '100%'
1370
+ const INPUT_STYLE = {
1371
+ width: "100%"
1506
1372
  };
1507
1373
 
1508
- var TextareaWidget = function TextareaWidget(_ref) {
1509
- var disabled = _ref.disabled,
1510
- formContext = _ref.formContext,
1511
- id = _ref.id,
1512
- onBlur = _ref.onBlur,
1513
- onChange = _ref.onChange,
1514
- onFocus = _ref.onFocus,
1515
- options = _ref.options,
1516
- placeholder = _ref.placeholder,
1517
- readonly = _ref.readonly,
1518
- value = _ref.value;
1519
- var _formContext$readonly = formContext.readonlyAsDisabled,
1520
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1521
-
1522
- var handleChange = function handleChange(_ref2) {
1523
- var target = _ref2.target;
1524
- return onChange(target.value === '' ? options.emptyValue : target.value);
1525
- };
1526
-
1527
- var handleBlur = function handleBlur(_ref3) {
1528
- var target = _ref3.target;
1374
+ const TextareaWidget = _ref => {
1375
+ let {
1376
+ // autofocus,
1377
+ disabled,
1378
+ formContext,
1379
+ id,
1380
+ // label,
1381
+ onBlur,
1382
+ onChange,
1383
+ onFocus,
1384
+ options,
1385
+ placeholder,
1386
+ readonly,
1387
+ // required,
1388
+ // schema,
1389
+ value
1390
+ } = _ref;
1391
+ const {
1392
+ readonlyAsDisabled = true
1393
+ } = formContext;
1394
+
1395
+ const handleChange = _ref2 => {
1396
+ let {
1397
+ target
1398
+ } = _ref2;
1399
+ return onChange(target.value === "" ? options.emptyValue : target.value);
1400
+ };
1401
+
1402
+ const handleBlur = _ref3 => {
1403
+ let {
1404
+ target
1405
+ } = _ref3;
1529
1406
  return onBlur(id, target.value);
1530
1407
  };
1531
1408
 
1532
- var handleFocus = function handleFocus(_ref4) {
1533
- var target = _ref4.target;
1409
+ const handleFocus = _ref4 => {
1410
+ let {
1411
+ target
1412
+ } = _ref4;
1534
1413
  return onFocus(id, target.value);
1535
1414
  };
1536
1415
 
@@ -1543,246 +1422,46 @@ var TextareaWidget = function TextareaWidget(_ref) {
1543
1422
  onFocus: !readonly ? handleFocus : undefined,
1544
1423
  placeholder: placeholder,
1545
1424
  rows: options.rows || 4,
1546
- style: INPUT_STYLE$3,
1425
+ style: INPUT_STYLE,
1547
1426
  type: "textarea",
1548
1427
  value: value
1549
1428
  });
1550
1429
  };
1551
1430
 
1552
- var INPUT_STYLE$4 = {
1553
- width: '100%'
1431
+ const Widgets = {
1432
+ AltDateTimeWidget,
1433
+ AltDateWidget,
1434
+ CheckboxesWidget,
1435
+ CheckboxWidget,
1436
+ DateTimeWidget,
1437
+ DateWidget,
1438
+ PasswordWidget,
1439
+ RadioWidget,
1440
+ RangeWidget,
1441
+ SelectWidget,
1442
+ TextareaWidget
1554
1443
  };
1555
-
1556
- var TextWidget = function TextWidget(_ref) {
1557
- var disabled = _ref.disabled,
1558
- formContext = _ref.formContext,
1559
- id = _ref.id,
1560
- onBlur = _ref.onBlur,
1561
- onChange = _ref.onChange,
1562
- onFocus = _ref.onFocus,
1563
- options = _ref.options,
1564
- placeholder = _ref.placeholder,
1565
- readonly = _ref.readonly,
1566
- schema = _ref.schema,
1567
- value = _ref.value;
1568
- var _formContext$readonly = formContext.readonlyAsDisabled,
1569
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1570
-
1571
- var handleNumberChange = function handleNumberChange(nextValue) {
1572
- return onChange(nextValue);
1573
- };
1574
-
1575
- var handleTextChange = function handleTextChange(_ref2) {
1576
- var target = _ref2.target;
1577
- return onChange(target.value === '' ? options.emptyValue : target.value);
1578
- };
1579
-
1580
- var handleBlur = function handleBlur(_ref3) {
1581
- var target = _ref3.target;
1582
- return onBlur(id, target.value);
1583
- };
1584
-
1585
- var handleFocus = function handleFocus(_ref4) {
1586
- var target = _ref4.target;
1587
- return onFocus(id, target.value);
1588
- };
1589
-
1590
- return schema.type === 'number' || schema.type === 'integer' ? /*#__PURE__*/React.createElement(InputNumber, {
1591
- disabled: disabled || readonlyAsDisabled && readonly,
1592
- id: id,
1593
- name: id,
1594
- onBlur: !readonly ? handleBlur : undefined,
1595
- onChange: !readonly ? handleNumberChange : undefined,
1596
- onFocus: !readonly ? handleFocus : undefined,
1597
- placeholder: placeholder,
1598
- style: INPUT_STYLE$4,
1599
- type: "number",
1600
- value: value
1601
- }) : /*#__PURE__*/React.createElement(Input, {
1602
- disabled: disabled || readonlyAsDisabled && readonly,
1603
- id: id,
1604
- name: id,
1605
- onBlur: !readonly ? handleBlur : undefined,
1606
- onChange: !readonly ? handleTextChange : undefined,
1607
- onFocus: !readonly ? handleFocus : undefined,
1608
- placeholder: placeholder,
1609
- style: INPUT_STYLE$4,
1610
- type: options.inputType || 'text',
1611
- value: value
1612
- });
1613
- };
1614
-
1615
- var INPUT_STYLE$5 = {
1616
- width: '100%'
1617
- };
1618
-
1619
- var UpDownWidget = function UpDownWidget(_ref) {
1620
- var disabled = _ref.disabled,
1621
- formContext = _ref.formContext,
1622
- id = _ref.id,
1623
- onBlur = _ref.onBlur,
1624
- onChange = _ref.onChange,
1625
- onFocus = _ref.onFocus,
1626
- placeholder = _ref.placeholder,
1627
- readonly = _ref.readonly,
1628
- value = _ref.value;
1629
- var _formContext$readonly = formContext.readonlyAsDisabled,
1630
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1631
-
1632
- var handleChange = function handleChange(nextValue) {
1633
- return onChange(nextValue);
1634
- };
1635
-
1636
- var handleBlur = function handleBlur(_ref2) {
1637
- var target = _ref2.target;
1638
- return onBlur(id, target.value);
1639
- };
1640
-
1641
- var handleFocus = function handleFocus(_ref3) {
1642
- var target = _ref3.target;
1643
- return onFocus(id, target.value);
1644
- };
1645
-
1646
- return /*#__PURE__*/React.createElement(InputNumber, {
1647
- disabled: disabled || readonlyAsDisabled && readonly,
1648
- id: id,
1649
- name: id,
1650
- onBlur: !readonly ? handleBlur : undefined,
1651
- onChange: !readonly ? handleChange : undefined,
1652
- onFocus: !readonly ? handleFocus : undefined,
1653
- placeholder: placeholder,
1654
- style: INPUT_STYLE$5,
1655
- type: "number",
1656
- value: value
1657
- });
1658
- };
1659
-
1660
- var INPUT_STYLE$6 = {
1661
- width: '100%'
1662
- };
1663
-
1664
- var URLWidget = function URLWidget(_ref) {
1665
- var disabled = _ref.disabled,
1666
- formContext = _ref.formContext,
1667
- id = _ref.id,
1668
- onBlur = _ref.onBlur,
1669
- onChange = _ref.onChange,
1670
- onFocus = _ref.onFocus,
1671
- options = _ref.options,
1672
- placeholder = _ref.placeholder,
1673
- readonly = _ref.readonly,
1674
- value = _ref.value;
1675
- var _formContext$readonly = formContext.readonlyAsDisabled,
1676
- readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1677
-
1678
- var handleChange = function handleChange(_ref2) {
1679
- var target = _ref2.target;
1680
- return onChange(target.value === '' ? options.emptyValue : target.value);
1681
- };
1682
-
1683
- var handleBlur = function handleBlur(_ref3) {
1684
- var target = _ref3.target;
1685
- return onBlur(id, target.value);
1686
- };
1687
-
1688
- var handleFocus = function handleFocus(_ref4) {
1689
- var target = _ref4.target;
1690
- return onFocus(id, target.value);
1691
- };
1692
-
1693
- return /*#__PURE__*/React.createElement(Input, {
1694
- disabled: disabled || readonlyAsDisabled && readonly,
1695
- id: id,
1696
- name: id,
1697
- onBlur: !readonly ? handleBlur : undefined,
1698
- onChange: !readonly ? handleChange : undefined,
1699
- onFocus: !readonly ? handleFocus : undefined,
1700
- placeholder: placeholder,
1701
- style: INPUT_STYLE$6,
1702
- type: "url",
1703
- value: value
1704
- });
1705
- };
1706
-
1707
- var getSubmitButtonOptions = utils.getSubmitButtonOptions;
1708
- var SubmitButton = (function (_ref) {
1709
- var uiSchema = _ref.uiSchema;
1710
-
1711
- var _getSubmitButtonOptio = getSubmitButtonOptions(uiSchema),
1712
- submitText = _getSubmitButtonOptio.submitText,
1713
- norender = _getSubmitButtonOptio.norender,
1714
- submitButtonProps = _getSubmitButtonOptio.props;
1715
-
1716
- if (norender) {
1717
- return null;
1718
- }
1719
-
1720
- return /*#__PURE__*/React.createElement(Button, _extends({
1721
- htmlType: "submit"
1722
- }, submitButtonProps), submitText);
1723
- });
1724
-
1725
- var ErrorList = function ErrorList(_ref) {
1726
- var errors = _ref.errors;
1727
-
1728
- var renderErrors = function renderErrors() {
1729
- return /*#__PURE__*/React.createElement(List, {
1730
- className: "list-group",
1731
- size: "small"
1732
- }, errors.map(function (error, index) {
1733
- return /*#__PURE__*/React.createElement(List.Item, {
1734
- key: index
1735
- }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null), error.stack));
1736
- }));
1737
- };
1738
-
1739
- return /*#__PURE__*/React.createElement(Alert, {
1740
- className: "panel panel-danger errors",
1741
- description: renderErrors(),
1742
- message: "Errors",
1743
- type: "error"
1744
- });
1745
- };
1746
-
1747
- var getDefaultRegistry = utils.getDefaultRegistry;
1748
-
1749
- var _getDefaultRegistry = /*#__PURE__*/getDefaultRegistry(),
1750
- fields = _getDefaultRegistry.fields,
1751
- widgets = _getDefaultRegistry.widgets;
1752
-
1753
- var Fields = {
1754
- DescriptionField: DescriptionField,
1755
- TitleField: TitleField$1
1756
- };
1757
- var Widgets = {
1758
- AltDateTimeWidget: AltDateTimeWidget,
1759
- AltDateWidget: AltDateWidget,
1760
- CheckboxesWidget: CheckboxesWidget,
1761
- CheckboxWidget: CheckboxWidget,
1762
- ColorWidget: ColorWidget,
1763
- DateTimeWidget: DateTimeWidget,
1764
- DateWidget: DateWidget,
1765
- EmailWidget: EmailWidget,
1766
- PasswordWidget: PasswordWidget,
1767
- RadioWidget: RadioWidget,
1768
- RangeWidget: RangeWidget,
1769
- SelectWidget: SelectWidget,
1770
- TextareaWidget: TextareaWidget,
1771
- TextWidget: TextWidget,
1772
- UpDownWidget: UpDownWidget,
1773
- URLWidget: URLWidget,
1774
- SubmitButton: SubmitButton
1775
- };
1776
- var Theme = {
1777
- ArrayFieldTemplate: ArrayFieldTemplate,
1778
- fields: /*#__PURE__*/_extends({}, fields, Fields),
1779
- FieldTemplate: FieldTemplate,
1780
- ObjectFieldTemplate: ObjectFieldTemplate$1,
1781
- widgets: /*#__PURE__*/_extends({}, widgets, Widgets),
1782
- ErrorList: ErrorList
1444
+ const Theme = {
1445
+ templates: {
1446
+ ArrayFieldItemTemplate,
1447
+ ArrayFieldTemplate: ArrayFieldTemplate$1,
1448
+ BaseInputTemplate: TextWidget,
1449
+ ButtonTemplates: {
1450
+ AddButton,
1451
+ MoveDownButton,
1452
+ MoveUpButton,
1453
+ RemoveButton,
1454
+ SubmitButton
1455
+ },
1456
+ DescriptionFieldTemplate: DescriptionField,
1457
+ ErrorListTemplate: ErrorList,
1458
+ FieldTemplate,
1459
+ ObjectFieldTemplate: ObjectFieldTemplate$1,
1460
+ TitleFieldTemplate: TitleField$1
1461
+ },
1462
+ widgets: Widgets
1783
1463
  };
1784
- var Form = /*#__PURE__*/withTheme(Theme);
1464
+ const Form = /*#__PURE__*/withTheme(Theme);
1785
1465
 
1786
- export default Form;
1787
- export { Fields, Form, Theme, Widgets };
1466
+ export { Form, Theme, Widgets, Form as default };
1788
1467
  //# sourceMappingURL=antd.esm.js.map