@rjsf/antd 4.2.2 → 5.0.0-beta.2

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 +2 -2
  2. package/dist/antd.cjs.development.js +1037 -1343
  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 +962 -1293
  7. package/dist/antd.esm.js.map +1 -1
  8. package/dist/antd.umd.development.js +1017 -1347
  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,287 @@ 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
+ return 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
+ }, inputProps, {
251
+ value: value
252
+ })) : /*#__PURE__*/React.createElement(Input, _extends({
253
+ disabled: disabled || readonlyAsDisabled && readonly,
254
+ id: id,
255
+ name: id,
256
+ onBlur: !readonly ? handleBlur : undefined,
257
+ onChange: !readonly ? handleTextChange : undefined,
258
+ onFocus: !readonly ? handleFocus : undefined,
259
+ placeholder: placeholder,
260
+ style: INPUT_STYLE$2
261
+ }, inputProps, {
262
+ value: value
263
+ }));
264
+ };
84
265
 
85
- var labelClassName = classNames((_classNames = {}, _classNames[prefixCls + "-item-required"] = required, _classNames[prefixCls + "-item-no-colon"] = !colon, _classNames));
266
+ const DescriptionField = _ref => {
267
+ let {
268
+ description,
269
+ id // registry,
86
270
 
87
- var handleLabelClick = function handleLabelClick() {
88
- if (!id) {
89
- return;
90
- }
271
+ } = _ref;
272
+ return /*#__PURE__*/React.createElement("span", {
273
+ id: id
274
+ }, description);
275
+ };
91
276
 
92
- var control = document.querySelector("[id=\"" + id + "\"]");
277
+ const ErrorList = _ref => {
278
+ let {
279
+ // errorSchema,
280
+ errors // formContext,
281
+ // schema,
282
+ // uiSchema,
93
283
 
94
- if (control && control.focus) {
95
- control.focus();
96
- }
97
- };
284
+ } = _ref;
98
285
 
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
- };
286
+ const renderErrors = () => /*#__PURE__*/React.createElement(List, {
287
+ className: "list-group",
288
+ size: "small"
289
+ }, errors.map((error, index) => /*#__PURE__*/React.createElement(List.Item, {
290
+ key: index
291
+ }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null), error.stack))));
106
292
 
107
- TitleField.defaultProps = {
108
- formContext: {}
293
+ return /*#__PURE__*/React.createElement(Alert, {
294
+ className: "panel panel-danger errors",
295
+ description: renderErrors(),
296
+ message: "Errors",
297
+ type: "error"
298
+ });
109
299
  };
110
- var TitleField$1 = /*#__PURE__*/withConfigConsumer({
111
- prefixCls: 'form'
112
- })(TitleField);
113
300
 
114
- var ADDITIONAL_PROPERTY_FLAG = utils.ADDITIONAL_PROPERTY_FLAG;
115
- var VERTICAL_LABEL_COL = {
301
+ function IconButton(props) {
302
+ const {
303
+ iconType = "default",
304
+ icon,
305
+ ...otherProps
306
+ } = props;
307
+ return /*#__PURE__*/React.createElement(Button, _extends({
308
+ type: iconType,
309
+ icon: icon
310
+ }, otherProps));
311
+ }
312
+ function AddButton(props) {
313
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
314
+ title: "Add Item"
315
+ }, props, {
316
+ block: true,
317
+ iconType: "primary",
318
+ icon: /*#__PURE__*/React.createElement(PlusCircleOutlined, null)
319
+ }));
320
+ }
321
+ function MoveDownButton(props) {
322
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
323
+ title: "Move down"
324
+ }, props, {
325
+ icon: /*#__PURE__*/React.createElement(ArrowDownOutlined, null)
326
+ }));
327
+ }
328
+ function MoveUpButton(props) {
329
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
330
+ title: "Move up"
331
+ }, props, {
332
+ icon: /*#__PURE__*/React.createElement(ArrowUpOutlined, null)
333
+ }));
334
+ }
335
+ function RemoveButton(props) {
336
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
337
+ title: "Remove"
338
+ }, props, {
339
+ danger: true,
340
+ iconType: "primary",
341
+ icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
342
+ }));
343
+ }
344
+
345
+ const VERTICAL_LABEL_COL$1 = {
116
346
  span: 24
117
347
  };
118
- var VERTICAL_WRAPPER_COL = {
348
+ const VERTICAL_WRAPPER_COL$1 = {
119
349
  span: 24
120
350
  };
121
- var INPUT_STYLE = {
122
- width: '100%'
351
+ const INPUT_STYLE$1 = {
352
+ width: "100%"
123
353
  };
124
354
 
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);
355
+ const WrapIfAdditional = _ref => {
356
+ let {
357
+ children,
358
+ classNames,
359
+ disabled,
360
+ formContext,
361
+ id,
362
+ label,
363
+ onDropPropertyClick,
364
+ onKeyChange,
365
+ readonly,
366
+ required,
367
+ registry,
368
+ schema
369
+ } = _ref;
370
+ const {
371
+ colon,
372
+ labelCol = VERTICAL_LABEL_COL$1,
373
+ readonlyAsDisabled = true,
374
+ rowGutter = 24,
375
+ toolbarAlign = "top",
376
+ wrapperCol = VERTICAL_WRAPPER_COL$1,
377
+ wrapperStyle
378
+ } = formContext;
379
+ const {
380
+ RemoveButton
381
+ } = registry.templates.ButtonTemplates;
382
+ const keyLabel = label + " Key"; // i18n ?
383
+
384
+ const additional = (ADDITIONAL_PROPERTY_FLAG in schema);
152
385
 
153
386
  if (!additional) {
154
387
  return /*#__PURE__*/React.createElement("div", {
@@ -156,8 +389,10 @@ var WrapIfAdditional = function WrapIfAdditional(_ref) {
156
389
  }, children);
157
390
  }
158
391
 
159
- var handleBlur = function handleBlur(_ref2) {
160
- var target = _ref2.target;
392
+ const handleBlur = _ref2 => {
393
+ let {
394
+ target
395
+ } = _ref2;
161
396
  return onKeyChange(target.value);
162
397
  };
163
398
 
@@ -188,55 +423,57 @@ var WrapIfAdditional = function WrapIfAdditional(_ref) {
188
423
  id: id + "-key",
189
424
  name: id + "-key",
190
425
  onBlur: !readonly ? handleBlur : undefined,
191
- style: INPUT_STYLE,
426
+ style: INPUT_STYLE$1,
192
427
  type: "text"
193
428
  })))), /*#__PURE__*/React.createElement(Col, {
194
429
  className: "form-additional",
195
430
  flex: "1"
196
431
  }, children), /*#__PURE__*/React.createElement(Col, {
197
432
  flex: "192px"
198
- }, /*#__PURE__*/React.createElement(Button, {
433
+ }, /*#__PURE__*/React.createElement(RemoveButton, {
199
434
  block: true,
200
435
  className: "array-item-remove",
201
- danger: true,
202
436
  disabled: disabled || readonly,
203
- icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
204
- onClick: onDropPropertyClick(label),
205
- type: "primary"
437
+ onClick: onDropPropertyClick(label)
206
438
  }))));
207
439
  };
208
440
 
209
- var VERTICAL_LABEL_COL$1 = {
441
+ const VERTICAL_LABEL_COL = {
210
442
  span: 24
211
443
  };
212
- var VERTICAL_WRAPPER_COL$1 = {
444
+ const VERTICAL_WRAPPER_COL = {
213
445
  span: 24
214
446
  };
215
447
 
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;
448
+ const FieldTemplate = _ref => {
449
+ let {
450
+ children,
451
+ classNames,
452
+ description,
453
+ disabled,
454
+ displayLabel,
455
+ // errors,
456
+ formContext,
457
+ help,
458
+ hidden,
459
+ id,
460
+ label,
461
+ onDropPropertyClick,
462
+ onKeyChange,
463
+ rawErrors,
464
+ rawHelp,
465
+ readonly,
466
+ registry,
467
+ required,
468
+ schema // uiSchema,
469
+
470
+ } = _ref;
471
+ const {
472
+ colon,
473
+ labelCol = VERTICAL_LABEL_COL,
474
+ wrapperCol = VERTICAL_WRAPPER_COL,
475
+ wrapperStyle
476
+ } = formContext;
240
477
 
241
478
  if (hidden) {
242
479
  return /*#__PURE__*/React.createElement("div", {
@@ -244,13 +481,9 @@ var FieldTemplate = function FieldTemplate(_ref) {
244
481
  }, children);
245
482
  }
246
483
 
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
- };
484
+ const renderFieldErrors = () => [...new Set(rawErrors)].map(error => /*#__PURE__*/React.createElement("div", {
485
+ key: "field-" + id + "-error-" + error
486
+ }, error));
254
487
 
255
488
  return /*#__PURE__*/React.createElement(WrapIfAdditional, {
256
489
  classNames: classNames,
@@ -262,85 +495,84 @@ var FieldTemplate = function FieldTemplate(_ref) {
262
495
  onKeyChange: onKeyChange,
263
496
  readonly: readonly,
264
497
  required: required,
265
- schema: schema
266
- }, id === 'root' ? children : /*#__PURE__*/React.createElement(Form$1.Item, {
498
+ schema: schema,
499
+ registry: registry
500
+ }, id === "root" ? children : /*#__PURE__*/React.createElement(Form$1.Item, {
267
501
  colon: colon,
268
502
  extra: description,
269
- hasFeedback: schema.type !== 'array' && schema.type !== 'object',
503
+ hasFeedback: schema.type !== "array" && schema.type !== "object",
270
504
  help: !!rawHelp && help || !!rawErrors && renderFieldErrors(),
271
505
  htmlFor: id,
272
506
  label: displayLabel && label,
273
507
  labelCol: labelCol,
274
508
  required: required,
275
509
  style: wrapperStyle,
276
- validateStatus: rawErrors ? 'error' : undefined,
510
+ validateStatus: rawErrors ? "error" : undefined,
277
511
  wrapperCol: wrapperCol
278
512
  }, children));
279
513
  };
280
514
 
281
- var canExpand = utils.canExpand;
282
- var DESCRIPTION_COL_STYLE = {
283
- paddingBottom: '8px'
515
+ const DESCRIPTION_COL_STYLE = {
516
+ paddingBottom: "8px"
284
517
  };
285
518
 
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,
519
+ const ObjectFieldTemplate = _ref => {
520
+ let {
521
+ description,
522
+ disabled,
523
+ formContext,
524
+ formData,
525
+ idSchema,
526
+ onAddClick,
527
+ prefixCls,
528
+ properties,
529
+ readonly,
530
+ required,
531
+ registry,
532
+ schema,
533
+ title,
534
+ uiSchema
535
+ } = _ref;
536
+ const uiOptions = getUiOptions(uiSchema);
537
+ const TitleFieldTemplate = getTemplate("TitleFieldTemplate", registry, uiOptions);
538
+ const DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry, uiOptions); // Button templates are not overridden in the uiSchema
539
+
540
+ const {
541
+ ButtonTemplates: {
542
+ AddButton
543
+ }
544
+ } = registry.templates;
545
+ const {
546
+ colSpan = 24,
547
+ labelAlign = "right",
548
+ rowGutter = 24
549
+ } = formContext;
550
+ const labelClsBasic = prefixCls + "-item-label";
551
+ const labelColClassName = classNames(labelClsBasic, labelAlign === "left" && labelClsBasic + "-left" // labelCol.className,
310
552
  );
311
553
 
312
- var findSchema = function findSchema(element) {
313
- return element.content.props.schema;
314
- };
554
+ const findSchema = element => element.content.props.schema;
315
555
 
316
- var findSchemaType = function findSchemaType(element) {
317
- return findSchema(element).type;
318
- };
556
+ const findSchemaType = element => findSchema(element).type;
319
557
 
320
- var findUiSchema = function findUiSchema(element) {
321
- return element.content.props.uiSchema;
322
- };
558
+ const findUiSchema = element => element.content.props.uiSchema;
323
559
 
324
- var findUiSchemaField = function findUiSchemaField(element) {
325
- return findUiSchema(element)['ui:field'];
326
- };
560
+ const findUiSchemaField = element => getUiOptions(findUiSchema(element)).field;
327
561
 
328
- var findUiSchemaWidget = function findUiSchemaWidget(element) {
329
- return findUiSchema(element)['ui:widget'];
330
- };
562
+ const findUiSchemaWidget = element => getUiOptions(findUiSchema(element)).widget;
331
563
 
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;
564
+ const calculateColSpan = element => {
565
+ const type = findSchemaType(element);
566
+ const field = findUiSchemaField(element);
567
+ const widget = findUiSchemaWidget(element);
568
+ const defaultColSpan = properties.length < 2 || // Single or no field in object.
569
+ type === "object" || type === "array" || widget === "textarea" ? 24 : 12;
338
570
 
339
- if (_.isObject(colSpan)) {
571
+ if (isObject(colSpan)) {
340
572
  return colSpan[widget] || colSpan[field] || colSpan[type] || defaultColSpan;
341
573
  }
342
574
 
343
- if (_.isNumber(colSpan)) {
575
+ if (isNumber(colSpan)) {
344
576
  return colSpan;
345
577
  }
346
578
 
@@ -351,416 +583,120 @@ var ObjectFieldTemplate = function ObjectFieldTemplate(_ref) {
351
583
  id: idSchema.$id
352
584
  }, /*#__PURE__*/React.createElement(Row, {
353
585
  gutter: rowGutter
354
- }, uiSchema['ui:title'] !== false && (uiSchema['ui:title'] || title) && /*#__PURE__*/React.createElement(Col, {
586
+ }, uiOptions.title !== false && (uiOptions.title || title) && /*#__PURE__*/React.createElement(Col, {
355
587
  className: labelColClassName,
356
588
  span: 24
357
- }, /*#__PURE__*/React.createElement(TitleField, {
589
+ }, /*#__PURE__*/React.createElement(TitleFieldTemplate, {
358
590
  id: idSchema.$id + "-title",
359
591
  required: required,
360
- title: uiSchema['ui:title'] || title
361
- })), uiSchema['ui:description'] !== false && (uiSchema['ui:description'] || description) && /*#__PURE__*/React.createElement(Col, {
592
+ title: uiOptions.title || title,
593
+ uiSchema: uiSchema,
594
+ registry: registry
595
+ })), uiOptions.description !== false && (uiOptions.description || description) && /*#__PURE__*/React.createElement(Col, {
362
596
  span: 24,
363
597
  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, {
598
+ }, /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
599
+ description: uiOptions.description || description,
600
+ id: idSchema.$id + "-description",
601
+ registry: registry
602
+ })), properties.filter(e => !e.hidden).map(element => /*#__PURE__*/React.createElement(Col, {
603
+ key: element.name,
604
+ span: calculateColSpan(element)
605
+ }, element.content))), canExpand(schema, uiSchema, formData) && /*#__PURE__*/React.createElement(Col, {
375
606
  span: 24
376
607
  }, /*#__PURE__*/React.createElement(Row, {
377
608
  gutter: rowGutter,
378
609
  justify: "end"
379
610
  }, /*#__PURE__*/React.createElement(Col, {
380
611
  flex: "192px"
381
- }, /*#__PURE__*/React.createElement(Button, {
382
- block: true,
612
+ }, /*#__PURE__*/React.createElement(AddButton, {
383
613
  className: "object-property-expand",
384
614
  disabled: disabled || readonly,
385
- onClick: onAddClick(schema),
386
- type: "primary"
387
- }, /*#__PURE__*/React.createElement(PlusCircleOutlined, null), " Add Item")))));
615
+ onClick: onAddClick(schema)
616
+ })))));
388
617
  };
389
618
 
390
619
  var ObjectFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
391
- prefixCls: 'form'
620
+ prefixCls: "form"
392
621
  })(ObjectFieldTemplate);
393
622
 
394
- var BTN_GRP_STYLE = {
395
- width: '100%'
396
- };
397
- var BTN_STYLE = {
398
- width: 'calc(100% / 3)'
399
- };
400
-
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
- };
623
+ var SubmitButton = (_ref => {
624
+ let {
625
+ uiSchema
626
+ } = _ref;
627
+ const {
628
+ submitText,
629
+ norender,
630
+ props: submitButtonProps
631
+ } = getSubmitButtonOptions(uiSchema);
448
632
 
449
- ArrayFieldTemplateItem.defaultProps = {
450
- formContext: {}
451
- };
452
-
453
- var DESCRIPTION_COL_STYLE$1 = {
454
- paddingBottom: '8px'
455
- };
633
+ if (norender) {
634
+ return null;
635
+ }
456
636
 
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
- };
637
+ return /*#__PURE__*/React.createElement(Button, _extends({
638
+ type: "submit"
639
+ }, submitButtonProps, {
640
+ htmlType: "submit"
641
+ }), submitText);
642
+ });
522
643
 
523
- var FixedArrayFieldTemplate$1 = /*#__PURE__*/withConfigConsumer({
524
- prefixCls: 'form'
525
- })(FixedArrayFieldTemplate);
644
+ const TitleField = _ref => {
645
+ let {
646
+ id,
647
+ prefixCls,
648
+ required,
649
+ registry,
650
+ title
651
+ } = _ref;
652
+ const {
653
+ formContext
654
+ } = registry;
655
+ const {
656
+ colon = true
657
+ } = formContext;
658
+ let labelChildren = title;
659
+
660
+ if (colon && typeof title === "string" && title.trim() !== "") {
661
+ labelChildren = title.replace(/[::]\s*$/, "");
662
+ }
526
663
 
527
- var DESCRIPTION_COL_STYLE$2 = {
528
- paddingBottom: '8px'
529
- };
664
+ const labelClassName = classNames({
665
+ [prefixCls + "-item-required"]: required,
666
+ [prefixCls + "-item-no-colon"]: !colon
667
+ });
530
668
 
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
- };
669
+ const handleLabelClick = () => {
670
+ if (!id) {
671
+ return;
672
+ }
596
673
 
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
- };
674
+ const control = document.querySelector("[id=\"" + id + "\"]");
665
675
 
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
- });
676
+ if (control && control.focus) {
677
+ control.focus();
678
+ }
697
679
  };
698
680
 
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
- });
681
+ return title ? /*#__PURE__*/React.createElement("label", {
682
+ className: labelClassName,
683
+ htmlFor: id,
684
+ onClick: handleLabelClick,
685
+ title: typeof title === "string" ? title : ""
686
+ }, labelChildren) : null;
754
687
  };
755
688
 
756
- var pad = utils.pad,
757
- parseDateString = utils.parseDateString,
758
- toDateString = utils.toDateString;
689
+ TitleField.defaultProps = {
690
+ formContext: {}
691
+ };
692
+ var TitleField$1 = /*#__PURE__*/withConfigConsumer({
693
+ prefixCls: "form"
694
+ })(TitleField);
759
695
 
760
- var rangeOptions = function rangeOptions(start, stop) {
761
- var options = [];
696
+ const rangeOptions = (start, stop) => {
697
+ let options = [];
762
698
 
763
- for (var i = start; i <= stop; i++) {
699
+ for (let i = start; i <= stop; i++) {
764
700
  options.push({
765
701
  value: i,
766
702
  label: pad(i, 2)
@@ -770,41 +706,40 @@ var rangeOptions = function rangeOptions(start, stop) {
770
706
  return options;
771
707
  };
772
708
 
773
- var readyForChange = function readyForChange(state) {
774
- return Object.keys(state).every(function (key) {
775
- return typeof state[key] !== "undefined" && state[key] !== -1;
776
- });
709
+ const readyForChange = state => {
710
+ return Object.keys(state).every(key => typeof state[key] !== "undefined" && state[key] !== -1);
777
711
  };
778
712
 
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 () {
713
+ const AltDateWidget = _ref => {
714
+ let {
715
+ autofocus,
716
+ disabled,
717
+ formContext,
718
+ id,
719
+ onBlur,
720
+ onChange,
721
+ onFocus,
722
+ options,
723
+ readonly,
724
+ registry,
725
+ showTime,
726
+ value
727
+ } = _ref;
728
+ const {
729
+ SelectWidget
730
+ } = registry.widgets;
731
+ const {
732
+ rowGutter = 24
733
+ } = formContext;
734
+ const [state, setState] = useState(parseDateString(value, showTime));
735
+ useEffect(() => {
801
736
  setState(parseDateString(value, showTime));
802
737
  }, [showTime, value]);
803
738
 
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));
739
+ const handleChange = (property, nextValue) => {
740
+ const nextState = { ...state,
741
+ [property]: typeof nextValue === "undefined" ? -1 : nextValue
742
+ };
808
743
 
809
744
  if (readyForChange(nextState)) {
810
745
  onChange(toDateString(nextState, showTime));
@@ -813,18 +748,18 @@ var AltDateWidget = function AltDateWidget(_ref) {
813
748
  }
814
749
  };
815
750
 
816
- var handleNow = function handleNow(event) {
751
+ const handleNow = event => {
817
752
  event.preventDefault();
818
753
 
819
754
  if (disabled || readonly) {
820
755
  return;
821
756
  }
822
757
 
823
- var nextState = parseDateString(new Date().toJSON(), showTime);
758
+ const nextState = parseDateString(new Date().toJSON(), showTime);
824
759
  onChange(toDateString(nextState, showTime));
825
760
  };
826
761
 
827
- var handleClear = function handleClear(event) {
762
+ const handleClear = event => {
828
763
  event.preventDefault();
829
764
 
830
765
  if (disabled || readonly) {
@@ -834,14 +769,16 @@ var AltDateWidget = function AltDateWidget(_ref) {
834
769
  onChange(undefined);
835
770
  };
836
771
 
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 = [{
772
+ const dateElementProps = () => {
773
+ const {
774
+ year,
775
+ month,
776
+ day,
777
+ hour,
778
+ minute,
779
+ second
780
+ } = state;
781
+ const data = [{
845
782
  type: "year",
846
783
  range: options.yearsRange,
847
784
  value: year
@@ -874,49 +811,45 @@ var AltDateWidget = function AltDateWidget(_ref) {
874
811
  return data;
875
812
  };
876
813
 
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
- };
814
+ const renderDateElement = elemProps => /*#__PURE__*/React.createElement(SelectWidget, {
815
+ autofocus: elemProps.autofocus,
816
+ className: "form-control",
817
+ disabled: elemProps.disabled,
818
+ id: elemProps.id,
819
+ onBlur: elemProps.onBlur,
820
+ onChange: elemValue => elemProps.select(elemProps.type, elemValue),
821
+ onFocus: elemProps.onFocus,
822
+ options: {
823
+ enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1])
824
+ },
825
+ placeholder: elemProps.type,
826
+ readonly: elemProps.readonly,
827
+ schema: {
828
+ type: "integer"
829
+ },
830
+ value: elemProps.value
831
+ });
899
832
 
900
833
  return /*#__PURE__*/React.createElement(Row, {
901
834
  gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
902
- }, dateElementProps().map(function (elemProps, i) {
903
- var elemId = id + "_" + elemProps.type;
835
+ }, dateElementProps().map((elemProps, i) => {
836
+ const elemId = id + "_" + elemProps.type;
904
837
  return /*#__PURE__*/React.createElement(Col, {
905
838
  flex: "88px",
906
839
  key: elemId
907
- }, renderDateElement(_extends({}, elemProps, {
840
+ }, renderDateElement({ ...elemProps,
908
841
  autofocus: autofocus && i === 0,
909
- disabled: disabled,
842
+ disabled,
910
843
  id: elemId,
911
- onBlur: onBlur,
912
- onFocus: onFocus,
913
- readonly: readonly,
914
- registry: registry,
844
+ onBlur,
845
+ onFocus,
846
+ readonly,
847
+ registry,
915
848
  select: handleChange,
916
849
  // NOTE: antd components accept -1 rather than issue a warning
917
850
  // like material-ui, so we need to convert -1 to undefined here.
918
851
  value: elemProps.value < 0 ? undefined : elemProps.value
919
- })));
852
+ }));
920
853
  }), !options.hideNowButton && /*#__PURE__*/React.createElement(Col, {
921
854
  flex: "88px"
922
855
  }, /*#__PURE__*/React.createElement(Button, {
@@ -945,49 +878,62 @@ AltDateWidget.defaultProps = {
945
878
  showTime: false
946
879
  };
947
880
 
948
- var AltDateTimeWidget = function AltDateTimeWidget(props) {
949
- var AltDateWidget = props.registry.widgets.AltDateWidget;
881
+ const AltDateTimeWidget = props => {
882
+ const {
883
+ AltDateWidget
884
+ } = props.registry.widgets;
950
885
  return /*#__PURE__*/React.createElement(AltDateWidget, _extends({
951
886
  showTime: true
952
887
  }, props));
953
888
  };
954
889
 
955
- AltDateTimeWidget.defaultProps = /*#__PURE__*/_extends({}, AltDateWidget.defaultProps, {
890
+ AltDateTimeWidget.defaultProps = { ...AltDateWidget.defaultProps,
956
891
  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
- };
892
+ };
979
893
 
980
- var handleBlur = function handleBlur(_ref2) {
981
- var target = _ref2.target;
894
+ const CheckboxesWidget = _ref => {
895
+ let {
896
+ autofocus,
897
+ disabled,
898
+ formContext,
899
+ id,
900
+ // label,
901
+ onBlur,
902
+ onChange,
903
+ onFocus,
904
+ options,
905
+ // placeholder,
906
+ readonly,
907
+ // required,
908
+ // schema,
909
+ value
910
+ } = _ref;
911
+ const {
912
+ readonlyAsDisabled = true
913
+ } = formContext;
914
+ const {
915
+ enumOptions,
916
+ enumDisabled,
917
+ inline
918
+ } = options;
919
+
920
+ const handleChange = nextValue => onChange(nextValue);
921
+
922
+ const handleBlur = _ref2 => {
923
+ let {
924
+ target
925
+ } = _ref2;
982
926
  return onBlur(id, target.value);
983
927
  };
984
928
 
985
- var handleFocus = function handleFocus(_ref3) {
986
- var target = _ref3.target;
929
+ const handleFocus = _ref3 => {
930
+ let {
931
+ target
932
+ } = _ref3;
987
933
  return onFocus(id, target.value);
988
934
  };
989
935
 
990
- return !_.isEmpty(enumOptions) ? /*#__PURE__*/React.createElement(Checkbox.Group, {
936
+ return Array.isArray(enumOptions) && enumOptions.length > 0 ? /*#__PURE__*/React.createElement(Checkbox.Group, {
991
937
  disabled: disabled || readonlyAsDisabled && readonly,
992
938
  id: id,
993
939
  name: id,
@@ -995,9 +941,11 @@ var CheckboxesWidget = function CheckboxesWidget(_ref) {
995
941
  onChange: !readonly ? handleChange : undefined,
996
942
  onFocus: !readonly ? handleFocus : undefined,
997
943
  value: value
998
- }, enumOptions.map(function (_ref4, i) {
999
- var optionValue = _ref4.value,
1000
- optionLabel = _ref4.label;
944
+ }, enumOptions.map((_ref4, i) => {
945
+ let {
946
+ value: optionValue,
947
+ label: optionLabel
948
+ } = _ref4;
1001
949
  return /*#__PURE__*/React.createElement("span", {
1002
950
  key: optionValue
1003
951
  }, /*#__PURE__*/React.createElement(Checkbox, {
@@ -1008,38 +956,51 @@ var CheckboxesWidget = function CheckboxesWidget(_ref) {
1008
956
  })) : null;
1009
957
  };
1010
958
 
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;
959
+ const CheckboxWidget = _ref => {
960
+ let {
961
+ autofocus,
962
+ disabled,
963
+ formContext,
964
+ id,
965
+ label,
966
+ onBlur,
967
+ onChange,
968
+ onFocus,
969
+ // options,
970
+ // placeholder,
971
+ readonly,
972
+ // required,
973
+ // schema,
974
+ value
975
+ } = _ref;
976
+ const {
977
+ readonlyAsDisabled = true
978
+ } = formContext;
979
+
980
+ const handleChange = _ref2 => {
981
+ let {
982
+ target
983
+ } = _ref2;
1027
984
  return onChange(target.checked);
1028
985
  };
1029
986
 
1030
- var handleBlur = function handleBlur(_ref3) {
1031
- var target = _ref3.target;
987
+ const handleBlur = _ref3 => {
988
+ let {
989
+ target
990
+ } = _ref3;
1032
991
  return onBlur(id, target.checked);
1033
992
  };
1034
993
 
1035
- var handleFocus = function handleFocus(_ref4) {
1036
- var target = _ref4.target;
994
+ const handleFocus = _ref4 => {
995
+ let {
996
+ target
997
+ } = _ref4;
1037
998
  return onFocus(id, target.checked);
1038
999
  };
1039
1000
 
1040
1001
  return /*#__PURE__*/React.createElement(Checkbox, {
1041
1002
  autoFocus: autofocus,
1042
- checked: typeof value === 'undefined' ? false : value,
1003
+ checked: typeof value === "undefined" ? false : value,
1043
1004
  disabled: disabled || readonlyAsDisabled && readonly,
1044
1005
  id: id,
1045
1006
  name: id,
@@ -1049,86 +1010,40 @@ var CheckboxWidget = function CheckboxWidget(_ref) {
1049
1010
  }, label);
1050
1011
  };
1051
1012
 
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
- };
1013
+ const DatePicker = /*#__PURE__*/generatePicker(dayjsGenerateConfig);
1083
1014
 
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
- });
1015
+ const DATE_PICKER_STYLE$1 = {
1016
+ width: "100%"
1096
1017
  };
1097
1018
 
1098
- var DatePicker = /*#__PURE__*/generatePicker(dayjsGenerateConfig);
1099
-
1100
- var DATE_PICKER_STYLE = {
1101
- width: '100%'
1102
- };
1103
-
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
- };
1019
+ const DateTimeWidget = _ref => {
1020
+ let {
1021
+ // autofocus,
1022
+ disabled,
1023
+ formContext,
1024
+ id,
1025
+ // label,
1026
+ onBlur,
1027
+ onChange,
1028
+ onFocus,
1029
+ // options,
1030
+ placeholder,
1031
+ readonly,
1032
+ // required,
1033
+ // schema,
1034
+ value
1035
+ } = _ref;
1036
+ const {
1037
+ readonlyAsDisabled = true
1038
+ } = formContext;
1039
+
1040
+ const handleChange = nextValue => onChange(nextValue && nextValue.toISOString());
1041
+
1042
+ const handleBlur = () => onBlur(id, value);
1043
+
1044
+ const handleFocus = () => onFocus(id, value);
1045
+
1046
+ const getPopupContainer = node => node.parentNode;
1132
1047
 
1133
1048
  return /*#__PURE__*/React.createElement(DatePicker, {
1134
1049
  disabled: disabled || readonlyAsDisabled && readonly,
@@ -1140,43 +1055,43 @@ var DateTimeWidget = function DateTimeWidget(_ref) {
1140
1055
  onFocus: !readonly ? handleFocus : undefined,
1141
1056
  placeholder: placeholder,
1142
1057
  showTime: true,
1143
- style: DATE_PICKER_STYLE,
1058
+ style: DATE_PICKER_STYLE$1,
1144
1059
  value: value && dayjs(value)
1145
1060
  });
1146
1061
  };
1147
1062
 
1148
- var DATE_PICKER_STYLE$1 = {
1149
- width: '100%'
1063
+ const DATE_PICKER_STYLE = {
1064
+ width: "100%"
1150
1065
  };
1151
1066
 
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
- };
1067
+ const DateWidget = _ref => {
1068
+ let {
1069
+ // autofocus,
1070
+ disabled,
1071
+ formContext,
1072
+ id,
1073
+ // label,
1074
+ onBlur,
1075
+ onChange,
1076
+ onFocus,
1077
+ // options,
1078
+ placeholder,
1079
+ readonly,
1080
+ // required,
1081
+ // schema,
1082
+ value
1083
+ } = _ref;
1084
+ const {
1085
+ readonlyAsDisabled = true
1086
+ } = formContext;
1087
+
1088
+ const handleChange = nextValue => onChange(nextValue && nextValue.format("YYYY-MM-DD"));
1089
+
1090
+ const handleBlur = () => onBlur(id, value);
1091
+
1092
+ const handleFocus = () => onFocus(id, value);
1093
+
1094
+ const getPopupContainer = node => node.parentNode;
1180
1095
 
1181
1096
  return /*#__PURE__*/React.createElement(DatePicker, {
1182
1097
  disabled: disabled || readonlyAsDisabled && readonly,
@@ -1188,85 +1103,51 @@ var DateWidget = function DateWidget(_ref) {
1188
1103
  onFocus: !readonly ? handleFocus : undefined,
1189
1104
  placeholder: placeholder,
1190
1105
  showTime: false,
1191
- style: DATE_PICKER_STYLE$1,
1106
+ style: DATE_PICKER_STYLE,
1192
1107
  value: value && dayjs(value)
1193
1108
  });
1194
1109
  };
1195
1110
 
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;
1111
+ const PasswordWidget = _ref => {
1112
+ let {
1113
+ // autofocus,
1114
+ disabled,
1115
+ formContext,
1116
+ id,
1117
+ // label,
1118
+ onBlur,
1119
+ onChange,
1120
+ onFocus,
1121
+ options,
1122
+ placeholder,
1123
+ readonly,
1124
+ // required,
1125
+ // schema,
1126
+ value
1127
+ } = _ref;
1128
+ const {
1129
+ readonlyAsDisabled = true
1130
+ } = formContext;
1131
+ const emptyValue = options.emptyValue || "";
1132
+
1133
+ const handleChange = _ref2 => {
1134
+ let {
1135
+ target
1136
+ } = _ref2;
1137
+ return onChange(target.value === "" ? emptyValue : target.value);
1138
+ };
1139
+
1140
+ const handleBlur = _ref3 => {
1141
+ let {
1142
+ target
1143
+ } = _ref3;
1221
1144
  return onBlur(id, target.value);
1222
1145
  };
1223
1146
 
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;
1147
+ const handleFocus = _ref4 => {
1148
+ let {
1149
+ target
1150
+ } = _ref4;
1270
1151
  return onFocus(id, target.value);
1271
1152
  };
1272
1153
 
@@ -1278,41 +1159,57 @@ var PasswordWidget = function PasswordWidget(_ref) {
1278
1159
  onChange: !readonly ? handleChange : undefined,
1279
1160
  onFocus: !readonly ? handleFocus : undefined,
1280
1161
  placeholder: placeholder,
1281
- value: value || ''
1162
+ value: value || ""
1282
1163
  });
1283
1164
  };
1284
1165
 
1285
1166
  /* eslint-disable no-else-return */
1286
1167
 
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);
1168
+ const RadioWidget = _ref => {
1169
+ let {
1170
+ autofocus,
1171
+ disabled,
1172
+ formContext,
1173
+ id,
1174
+ // label,
1175
+ onBlur,
1176
+ onChange,
1177
+ onFocus,
1178
+ options,
1179
+ // placeholder,
1180
+ readonly,
1181
+ // required,
1182
+ schema,
1183
+ value
1184
+ } = _ref;
1185
+ const {
1186
+ readonlyAsDisabled = true
1187
+ } = formContext;
1188
+ const {
1189
+ enumOptions,
1190
+ enumDisabled
1191
+ } = options;
1192
+
1193
+ const handleChange = _ref2 => {
1194
+ let {
1195
+ target: {
1196
+ value: nextValue
1197
+ }
1198
+ } = _ref2;
1199
+ return onChange(schema.type === "boolean" ? nextValue !== "false" : nextValue);
1307
1200
  };
1308
1201
 
1309
- var handleBlur = function handleBlur(_ref3) {
1310
- var target = _ref3.target;
1202
+ const handleBlur = _ref3 => {
1203
+ let {
1204
+ target
1205
+ } = _ref3;
1311
1206
  return onBlur(id, target.value);
1312
1207
  };
1313
1208
 
1314
- var handleFocus = function handleFocus(_ref4) {
1315
- var target = _ref4.target;
1209
+ const handleFocus = _ref4 => {
1210
+ let {
1211
+ target
1212
+ } = _ref4;
1316
1213
  return onFocus(id, target.value);
1317
1214
  };
1318
1215
 
@@ -1324,9 +1221,11 @@ var RadioWidget = function RadioWidget(_ref) {
1324
1221
  onChange: !readonly ? handleChange : undefined,
1325
1222
  onFocus: !readonly ? handleFocus : undefined,
1326
1223
  value: "" + value
1327
- }, enumOptions.map(function (_ref5, i) {
1328
- var optionValue = _ref5.value,
1329
- optionLabel = _ref5.label;
1224
+ }, enumOptions.map((_ref5, i) => {
1225
+ let {
1226
+ value: optionValue,
1227
+ label: optionLabel
1228
+ } = _ref5;
1330
1229
  return /*#__PURE__*/React.createElement(Radio, {
1331
1230
  autoFocus: i === 0 ? autofocus : false,
1332
1231
  disabled: enumDisabled && enumDisabled.indexOf(value) !== -1,
@@ -1337,42 +1236,39 @@ var RadioWidget = function RadioWidget(_ref) {
1337
1236
  };
1338
1237
 
1339
1238
  /* 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
1239
 
1369
- var handleBlur = function handleBlur() {
1370
- return onBlur(id, value);
1371
- };
1372
-
1373
- var handleFocus = function handleFocus() {
1374
- return onFocus(id, value);
1375
- };
1240
+ const RangeWidget = _ref => {
1241
+ let {
1242
+ autofocus,
1243
+ disabled,
1244
+ formContext,
1245
+ id,
1246
+ // label,
1247
+ onBlur,
1248
+ onChange,
1249
+ onFocus,
1250
+ options,
1251
+ placeholder,
1252
+ readonly,
1253
+ // required,
1254
+ schema,
1255
+ value
1256
+ } = _ref;
1257
+ const {
1258
+ readonlyAsDisabled = true
1259
+ } = formContext;
1260
+ const {
1261
+ min,
1262
+ max,
1263
+ step
1264
+ } = rangeSpec(schema);
1265
+ const emptyValue = options.emptyValue || "";
1266
+
1267
+ const handleChange = nextValue => onChange(nextValue === "" ? emptyValue : nextValue);
1268
+
1269
+ const handleBlur = () => onBlur(id, value);
1270
+
1271
+ const handleFocus = () => onFocus(id, value);
1376
1272
 
1377
1273
  return /*#__PURE__*/React.createElement(Slider, {
1378
1274
  autoFocus: autofocus,
@@ -1391,104 +1287,64 @@ var RangeWidget = function RangeWidget(_ref) {
1391
1287
  };
1392
1288
 
1393
1289
  /* 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;
1290
+ const SELECT_STYLE = {
1291
+ width: "100%"
1435
1292
  };
1436
1293
 
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
- };
1294
+ const SelectWidget = _ref => {
1295
+ let {
1296
+ autofocus,
1297
+ disabled,
1298
+ formContext,
1299
+ id,
1300
+ // label,
1301
+ multiple,
1302
+ onBlur,
1303
+ onChange,
1304
+ onFocus,
1305
+ options,
1306
+ placeholder,
1307
+ readonly,
1308
+ // required,
1309
+ schema,
1310
+ value
1311
+ } = _ref;
1312
+ const {
1313
+ readonlyAsDisabled = true
1314
+ } = formContext;
1315
+ const {
1316
+ enumOptions,
1317
+ enumDisabled
1318
+ } = options;
1319
+
1320
+ const handleChange = nextValue => onChange(processSelectValue(schema, nextValue, options));
1321
+
1322
+ const handleBlur = () => onBlur(id, processSelectValue(schema, value, options));
1323
+
1324
+ const handleFocus = () => onFocus(id, processSelectValue(schema, value, options));
1325
+
1326
+ const getPopupContainer = node => node.parentNode;
1327
+
1328
+ const stringify = currentValue => Array.isArray(currentValue) ? value.map(String) : String(value);
1475
1329
 
1476
1330
  return /*#__PURE__*/React.createElement(Select, {
1477
1331
  autoFocus: autofocus,
1478
1332
  disabled: disabled || readonlyAsDisabled && readonly,
1479
1333
  getPopupContainer: getPopupContainer,
1480
1334
  id: id,
1481
- mode: typeof multiple !== 'undefined' ? 'multiple' : undefined,
1335
+ mode: typeof multiple !== "undefined" ? "multiple" : undefined,
1482
1336
  name: id,
1483
1337
  onBlur: !readonly ? handleBlur : undefined,
1484
1338
  onChange: !readonly ? handleChange : undefined,
1485
1339
  onFocus: !readonly ? handleFocus : undefined,
1486
1340
  placeholder: placeholder,
1487
1341
  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;
1342
+ value: typeof value !== "undefined" ? stringify(value) : undefined
1343
+ }, enumOptions.map(_ref2 => {
1344
+ let {
1345
+ value: optionValue,
1346
+ label: optionLabel
1347
+ } = _ref2;
1492
1348
  return /*#__PURE__*/React.createElement(Select.Option, {
1493
1349
  disabled: enumDisabled && enumDisabled.indexOf(optionValue) !== -1,
1494
1350
  key: String(optionValue),
@@ -1501,36 +1357,49 @@ SelectWidget.defaultProps = {
1501
1357
  formContext: {}
1502
1358
  };
1503
1359
 
1504
- var INPUT_STYLE$3 = {
1505
- width: '100%'
1360
+ const INPUT_STYLE = {
1361
+ width: "100%"
1506
1362
  };
1507
1363
 
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;
1364
+ const TextareaWidget = _ref => {
1365
+ let {
1366
+ // autofocus,
1367
+ disabled,
1368
+ formContext,
1369
+ id,
1370
+ // label,
1371
+ onBlur,
1372
+ onChange,
1373
+ onFocus,
1374
+ options,
1375
+ placeholder,
1376
+ readonly,
1377
+ // required,
1378
+ // schema,
1379
+ value
1380
+ } = _ref;
1381
+ const {
1382
+ readonlyAsDisabled = true
1383
+ } = formContext;
1384
+
1385
+ const handleChange = _ref2 => {
1386
+ let {
1387
+ target
1388
+ } = _ref2;
1389
+ return onChange(target.value === "" ? options.emptyValue : target.value);
1390
+ };
1391
+
1392
+ const handleBlur = _ref3 => {
1393
+ let {
1394
+ target
1395
+ } = _ref3;
1529
1396
  return onBlur(id, target.value);
1530
1397
  };
1531
1398
 
1532
- var handleFocus = function handleFocus(_ref4) {
1533
- var target = _ref4.target;
1399
+ const handleFocus = _ref4 => {
1400
+ let {
1401
+ target
1402
+ } = _ref4;
1534
1403
  return onFocus(id, target.value);
1535
1404
  };
1536
1405
 
@@ -1543,246 +1412,46 @@ var TextareaWidget = function TextareaWidget(_ref) {
1543
1412
  onFocus: !readonly ? handleFocus : undefined,
1544
1413
  placeholder: placeholder,
1545
1414
  rows: options.rows || 4,
1546
- style: INPUT_STYLE$3,
1415
+ style: INPUT_STYLE,
1547
1416
  type: "textarea",
1548
1417
  value: value
1549
1418
  });
1550
1419
  };
1551
1420
 
1552
- var INPUT_STYLE$4 = {
1553
- width: '100%'
1554
- };
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
- });
1421
+ const Widgets = {
1422
+ AltDateTimeWidget,
1423
+ AltDateWidget,
1424
+ CheckboxesWidget,
1425
+ CheckboxWidget,
1426
+ DateTimeWidget,
1427
+ DateWidget,
1428
+ PasswordWidget,
1429
+ RadioWidget,
1430
+ RangeWidget,
1431
+ SelectWidget,
1432
+ TextareaWidget
1745
1433
  };
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
1434
+ const Theme = {
1435
+ templates: {
1436
+ ArrayFieldItemTemplate,
1437
+ ArrayFieldTemplate: ArrayFieldTemplate$1,
1438
+ BaseInputTemplate: TextWidget,
1439
+ ButtonTemplates: {
1440
+ AddButton,
1441
+ MoveDownButton,
1442
+ MoveUpButton,
1443
+ RemoveButton,
1444
+ SubmitButton
1445
+ },
1446
+ DescriptionFieldTemplate: DescriptionField,
1447
+ ErrorListTemplate: ErrorList,
1448
+ FieldTemplate,
1449
+ ObjectFieldTemplate: ObjectFieldTemplate$1,
1450
+ TitleFieldTemplate: TitleField$1
1451
+ },
1452
+ widgets: Widgets
1783
1453
  };
1784
- var Form = /*#__PURE__*/withTheme(Theme);
1454
+ const Form = /*#__PURE__*/withTheme(Theme);
1785
1455
 
1786
- export default Form;
1787
- export { Fields, Form, Theme, Widgets };
1456
+ export { Form, Theme, Widgets, Form as default };
1788
1457
  //# sourceMappingURL=antd.esm.js.map