@rjsf/antd 5.9.0 → 5.11.1

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