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