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