@rjsf/antd 5.1.0 → 5.2.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.
package/dist/antd.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { withTheme } from '@rjsf/core';
2
- import React, { useState, useEffect } from 'react';
2
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import Button from 'antd/es/button';
4
4
  import Col from 'antd/es/col';
5
5
  import Row from 'antd/es/row';
6
- import { getUiOptions, getTemplate, getInputProps, ariaDescribedByIds, examplesId, errorId, titleId, descriptionId, canExpand, getSubmitButtonOptions, UI_OPTIONS_KEY, ADDITIONAL_PROPERTY_FLAG, parseDateString, toDateString, pad, enumOptionsIndexForValue, optionId, enumOptionsValueForIndex, rangeSpec } from '@rjsf/utils';
6
+ import { getUiOptions, getTemplate, getInputProps, ariaDescribedByIds, examplesId, TranslatableString, errorId, titleId, descriptionId, canExpand, getSubmitButtonOptions, UI_OPTIONS_KEY, ADDITIONAL_PROPERTY_FLAG, parseDateString, toDateString, pad, enumOptionsIndexForValue, optionId, enumOptionsValueForIndex, rangeSpec } from '@rjsf/utils';
7
7
  import classNames from 'classnames';
8
8
  import { ConfigConsumer } from 'antd/es/config-provider/context';
9
9
  import Input from 'antd/es/input';
@@ -20,6 +20,7 @@ import Form$1 from 'antd/es/form';
20
20
  import isObject from 'lodash-es/isObject';
21
21
  import isNumber from 'lodash-es/isNumber';
22
22
  import isString from 'lodash-es/isString';
23
+ import { useState, useEffect } from 'react';
23
24
  import Checkbox from 'antd/es/checkbox';
24
25
  import dayjs from 'dayjs';
25
26
  import dayjsGenerateConfig from 'rc-picker/es/generate/dayjs';
@@ -29,10 +30,10 @@ import Slider from 'antd/es/slider';
29
30
  import Select from 'antd/es/select';
30
31
 
31
32
  var BTN_GRP_STYLE = {
32
- width: "100%"
33
+ width: '100%'
33
34
  };
34
35
  var BTN_STYLE = {
35
- width: "calc(100% / 3)"
36
+ width: 'calc(100% / 3)'
36
37
  };
37
38
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
38
39
  *
@@ -59,36 +60,39 @@ function ArrayFieldItemTemplate(props) {
59
60
  _registry$formContext2 = _registry$formContext.rowGutter,
60
61
  rowGutter = _registry$formContext2 === void 0 ? 24 : _registry$formContext2,
61
62
  _registry$formContext3 = _registry$formContext.toolbarAlign,
62
- toolbarAlign = _registry$formContext3 === void 0 ? "top" : _registry$formContext3;
63
- return /*#__PURE__*/React.createElement(Row, {
63
+ toolbarAlign = _registry$formContext3 === void 0 ? 'top' : _registry$formContext3;
64
+ return jsxs(Row, {
64
65
  align: toolbarAlign,
65
- key: "array-item-" + index,
66
- gutter: rowGutter
67
- }, /*#__PURE__*/React.createElement(Col, {
68
- flex: "1"
69
- }, children), hasToolbar && /*#__PURE__*/React.createElement(Col, {
70
- flex: "192px"
71
- }, /*#__PURE__*/React.createElement(Button.Group, {
72
- style: BTN_GRP_STYLE
73
- }, (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveUpButton, {
74
- disabled: disabled || readonly || !hasMoveUp,
75
- onClick: onReorderClick(index, index - 1),
76
- style: BTN_STYLE,
77
- uiSchema: uiSchema,
78
- registry: registry
79
- }), (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveDownButton, {
80
- disabled: disabled || readonly || !hasMoveDown,
81
- onClick: onReorderClick(index, index + 1),
82
- style: BTN_STYLE,
83
- uiSchema: uiSchema,
84
- registry: registry
85
- }), hasRemove && /*#__PURE__*/React.createElement(RemoveButton, {
86
- disabled: disabled || readonly,
87
- onClick: onDropIndexClick(index),
88
- style: BTN_STYLE,
89
- uiSchema: uiSchema,
90
- registry: registry
91
- }))));
66
+ gutter: rowGutter,
67
+ children: [jsx(Col, {
68
+ flex: '1',
69
+ children: children
70
+ }), hasToolbar && jsx(Col, {
71
+ flex: '192px',
72
+ children: jsxs(Button.Group, {
73
+ style: BTN_GRP_STYLE,
74
+ children: [(hasMoveUp || hasMoveDown) && jsx(MoveUpButton, {
75
+ disabled: disabled || readonly || !hasMoveUp,
76
+ onClick: onReorderClick(index, index - 1),
77
+ style: BTN_STYLE,
78
+ uiSchema: uiSchema,
79
+ registry: registry
80
+ }), (hasMoveUp || hasMoveDown) && jsx(MoveDownButton, {
81
+ disabled: disabled || readonly || !hasMoveDown,
82
+ onClick: onReorderClick(index, index + 1),
83
+ style: BTN_STYLE,
84
+ uiSchema: uiSchema,
85
+ registry: registry
86
+ }), hasRemove && jsx(RemoveButton, {
87
+ disabled: disabled || readonly,
88
+ onClick: onDropIndexClick(index),
89
+ style: BTN_STYLE,
90
+ uiSchema: uiSchema,
91
+ registry: registry
92
+ })]
93
+ })
94
+ })]
95
+ }, "array-item-" + index);
92
96
  }
93
97
 
94
98
  function _extends() {
@@ -120,7 +124,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
120
124
 
121
125
  var _excluded$1 = ["key"];
122
126
  var DESCRIPTION_COL_STYLE$1 = {
123
- paddingBottom: "8px"
127
+ paddingBottom: '8px'
124
128
  };
125
129
  /** The `ArrayFieldTemplate` component is the template used to render all items in an array.
126
130
  *
@@ -141,75 +145,83 @@ function ArrayFieldTemplate(props) {
141
145
  title = props.title,
142
146
  uiSchema = props.uiSchema;
143
147
  var uiOptions = getUiOptions(uiSchema);
144
- var ArrayFieldDescriptionTemplate = getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
145
- var ArrayFieldItemTemplate = getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
146
- var ArrayFieldTitleTemplate = getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
148
+ var ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
149
+ var ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
150
+ var ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
147
151
  // Button templates are not overridden in the uiSchema
148
152
  var AddButton = registry.templates.ButtonTemplates.AddButton;
149
153
  var _formContext$labelAli = formContext.labelAlign,
150
- labelAlign = _formContext$labelAli === void 0 ? "right" : _formContext$labelAli,
154
+ labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
151
155
  _formContext$rowGutte = formContext.rowGutter,
152
156
  rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
153
- return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (configProps) {
154
- var getPrefixCls = configProps.getPrefixCls;
155
- var prefixCls = getPrefixCls("form");
156
- var labelClsBasic = prefixCls + "-item-label";
157
- var labelColClassName = classNames(labelClsBasic, labelAlign === "left" && labelClsBasic + "-left"
158
- // labelCol.className,
159
- );
157
+ return jsx(ConfigConsumer, {
158
+ children: function children(configProps) {
159
+ var getPrefixCls = configProps.getPrefixCls;
160
+ var prefixCls = getPrefixCls('form');
161
+ var labelClsBasic = prefixCls + "-item-label";
162
+ var labelColClassName = classNames(labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left"
163
+ // labelCol.className,
164
+ );
160
165
 
161
- return /*#__PURE__*/React.createElement("fieldset", {
162
- className: className,
163
- id: idSchema.$id
164
- }, /*#__PURE__*/React.createElement(Row, {
165
- gutter: rowGutter
166
- }, (uiOptions.title || title) && /*#__PURE__*/React.createElement(Col, {
167
- className: labelColClassName,
168
- span: 24
169
- }, /*#__PURE__*/React.createElement(ArrayFieldTitleTemplate, {
170
- idSchema: idSchema,
171
- required: required,
172
- title: uiOptions.title || title,
173
- schema: schema,
174
- uiSchema: uiSchema,
175
- registry: registry
176
- })), (uiOptions.description || schema.description) && /*#__PURE__*/React.createElement(Col, {
177
- span: 24,
178
- style: DESCRIPTION_COL_STYLE$1
179
- }, /*#__PURE__*/React.createElement(ArrayFieldDescriptionTemplate, {
180
- description: uiOptions.description || schema.description || "",
181
- idSchema: idSchema,
182
- schema: schema,
183
- uiSchema: uiSchema,
184
- registry: registry
185
- })), /*#__PURE__*/React.createElement(Col, {
186
- className: "row array-item-list",
187
- span: 24
188
- }, items && items.map(function (_ref) {
189
- var key = _ref.key,
190
- itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
191
- return /*#__PURE__*/React.createElement(ArrayFieldItemTemplate, _extends({
192
- key: key
193
- }, itemProps));
194
- })), canAdd && /*#__PURE__*/React.createElement(Col, {
195
- span: 24
196
- }, /*#__PURE__*/React.createElement(Row, {
197
- gutter: rowGutter,
198
- justify: "end"
199
- }, /*#__PURE__*/React.createElement(Col, {
200
- flex: "192px"
201
- }, /*#__PURE__*/React.createElement(AddButton, {
202
- className: "array-item-add",
203
- disabled: disabled || readonly,
204
- onClick: onAddClick,
205
- uiSchema: uiSchema,
206
- registry: registry
207
- }))))));
166
+ return jsx("fieldset", {
167
+ className: className,
168
+ id: idSchema.$id,
169
+ children: jsxs(Row, {
170
+ gutter: rowGutter,
171
+ children: [(uiOptions.title || title) && jsx(Col, {
172
+ className: labelColClassName,
173
+ span: 24,
174
+ children: jsx(ArrayFieldTitleTemplate, {
175
+ idSchema: idSchema,
176
+ required: required,
177
+ title: uiOptions.title || title,
178
+ schema: schema,
179
+ uiSchema: uiSchema,
180
+ registry: registry
181
+ })
182
+ }), (uiOptions.description || schema.description) && jsx(Col, {
183
+ span: 24,
184
+ style: DESCRIPTION_COL_STYLE$1,
185
+ children: jsx(ArrayFieldDescriptionTemplate, {
186
+ description: uiOptions.description || schema.description || '',
187
+ idSchema: idSchema,
188
+ schema: schema,
189
+ uiSchema: uiSchema,
190
+ registry: registry
191
+ })
192
+ }), jsx(Col, {
193
+ className: 'row array-item-list',
194
+ span: 24,
195
+ children: items && items.map(function (_ref) {
196
+ var key = _ref.key,
197
+ itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
198
+ return jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
199
+ })
200
+ }), canAdd && jsx(Col, {
201
+ span: 24,
202
+ children: jsx(Row, {
203
+ gutter: rowGutter,
204
+ justify: 'end',
205
+ children: jsx(Col, {
206
+ flex: '192px',
207
+ children: jsx(AddButton, {
208
+ className: 'array-item-add',
209
+ disabled: disabled || readonly,
210
+ onClick: onAddClick,
211
+ uiSchema: uiSchema,
212
+ registry: registry
213
+ })
214
+ })
215
+ })
216
+ })]
217
+ })
218
+ });
219
+ }
208
220
  });
209
221
  }
210
222
 
211
223
  var INPUT_STYLE$2 = {
212
- width: "100%"
224
+ width: '100%'
213
225
  };
214
226
  /** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
215
227
  * It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
@@ -223,6 +235,7 @@ function BaseInputTemplate(props) {
223
235
  id = props.id,
224
236
  onBlur = props.onBlur,
225
237
  onChange = props.onChange,
238
+ onChangeOverride = props.onChangeOverride,
226
239
  onFocus = props.onFocus,
227
240
  options = props.options,
228
241
  placeholder = props.placeholder,
@@ -236,9 +249,9 @@ function BaseInputTemplate(props) {
236
249
  var handleNumberChange = function handleNumberChange(nextValue) {
237
250
  return onChange(nextValue);
238
251
  };
239
- var handleTextChange = function handleTextChange(_ref) {
252
+ var handleTextChange = onChangeOverride ? onChangeOverride : function (_ref) {
240
253
  var target = _ref.target;
241
- return onChange(target.value === "" ? options.emptyValue : target.value);
254
+ return onChange(target.value === '' ? options.emptyValue : target.value);
242
255
  };
243
256
  var handleBlur = function handleBlur(_ref2) {
244
257
  var target = _ref2.target;
@@ -248,7 +261,7 @@ function BaseInputTemplate(props) {
248
261
  var target = _ref3.target;
249
262
  return onFocus(id, target.value);
250
263
  };
251
- var input = inputProps.type === "number" || inputProps.type === "integer" ? /*#__PURE__*/React.createElement(InputNumber, _extends({
264
+ var input = inputProps.type === 'number' || inputProps.type === 'integer' ? jsx(InputNumber, _extends({
252
265
  disabled: disabled || readonlyAsDisabled && readonly,
253
266
  id: id,
254
267
  name: id,
@@ -261,7 +274,7 @@ function BaseInputTemplate(props) {
261
274
  }, inputProps, {
262
275
  value: value,
263
276
  "aria-describedby": ariaDescribedByIds(id, !!schema.examples)
264
- })) : /*#__PURE__*/React.createElement(Input, _extends({
277
+ })) : jsx(Input, _extends({
265
278
  disabled: disabled || readonlyAsDisabled && readonly,
266
279
  id: id,
267
280
  name: id,
@@ -275,14 +288,16 @@ function BaseInputTemplate(props) {
275
288
  value: value,
276
289
  "aria-describedby": ariaDescribedByIds(id, !!schema.examples)
277
290
  }));
278
- return /*#__PURE__*/React.createElement(React.Fragment, null, input, Array.isArray(schema.examples) && /*#__PURE__*/React.createElement("datalist", {
279
- id: examplesId(id)
280
- }, schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
281
- return /*#__PURE__*/React.createElement("option", {
282
- key: example,
283
- value: example
284
- });
285
- })));
291
+ return jsxs(Fragment, {
292
+ children: [input, Array.isArray(schema.examples) && jsx("datalist", {
293
+ id: examplesId(id),
294
+ children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
295
+ return jsx("option", {
296
+ value: example
297
+ }, example);
298
+ })
299
+ })]
300
+ });
286
301
  }
287
302
 
288
303
  /** The `DescriptionField` is the template to use to render the description of a field
@@ -295,9 +310,10 @@ function DescriptionField(props) {
295
310
  if (!description) {
296
311
  return null;
297
312
  }
298
- return /*#__PURE__*/React.createElement("span", {
299
- id: id
300
- }, description);
313
+ return jsx("span", {
314
+ id: id,
315
+ children: description
316
+ });
301
317
  }
302
318
 
303
319
  /** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
@@ -305,69 +321,78 @@ function DescriptionField(props) {
305
321
  * @param props - The `ErrorListProps` for this component
306
322
  */
307
323
  function ErrorList(_ref) {
308
- var errors = _ref.errors;
324
+ var errors = _ref.errors,
325
+ registry = _ref.registry;
326
+ var translateString = registry.translateString;
309
327
  var renderErrors = function renderErrors() {
310
- return /*#__PURE__*/React.createElement(List, {
311
- className: "list-group",
312
- size: "small"
313
- }, errors.map(function (error, index) {
314
- return /*#__PURE__*/React.createElement(List.Item, {
315
- key: index
316
- }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null), error.stack));
317
- }));
328
+ return jsx(List, {
329
+ className: 'list-group',
330
+ size: 'small',
331
+ children: errors.map(function (error, index) {
332
+ return jsx(List.Item, {
333
+ children: jsxs(Space, {
334
+ children: [jsx(ExclamationCircleOutlined, {}), error.stack]
335
+ })
336
+ }, index);
337
+ })
338
+ });
318
339
  };
319
- return /*#__PURE__*/React.createElement(Alert, {
320
- className: "panel panel-danger errors",
340
+ return jsx(Alert, {
341
+ className: 'panel panel-danger errors',
321
342
  description: renderErrors(),
322
- message: "Errors",
323
- type: "error"
343
+ message: translateString(TranslatableString.ErrorsLabel),
344
+ type: 'error'
324
345
  });
325
346
  }
326
347
 
327
348
  var _excluded = ["iconType", "icon", "uiSchema", "registry"];
328
349
  function IconButton(props) {
329
350
  var _props$iconType = props.iconType,
330
- iconType = _props$iconType === void 0 ? "default" : _props$iconType,
351
+ iconType = _props$iconType === void 0 ? 'default' : _props$iconType,
331
352
  icon = props.icon,
332
353
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
333
- return /*#__PURE__*/React.createElement(Button, _extends({
354
+ return jsx(Button, _extends({
334
355
  type: iconType,
335
356
  icon: icon
336
357
  }, otherProps));
337
358
  }
338
359
  function AddButton(props) {
339
- return /*#__PURE__*/React.createElement(IconButton, _extends({
340
- title: "Add Item"
360
+ var translateString = props.registry.translateString;
361
+ return jsx(IconButton, _extends({
362
+ title: translateString(TranslatableString.AddItemButton)
341
363
  }, props, {
342
364
  block: true,
343
- iconType: "primary",
344
- icon: /*#__PURE__*/React.createElement(PlusCircleOutlined, null)
365
+ iconType: 'primary',
366
+ icon: jsx(PlusCircleOutlined, {})
345
367
  }));
346
368
  }
347
369
  function MoveDownButton(props) {
348
- return /*#__PURE__*/React.createElement(IconButton, _extends({
349
- title: "Move down"
370
+ var translateString = props.registry.translateString;
371
+ return jsx(IconButton, _extends({
372
+ title: translateString(TranslatableString.MoveDownButton)
350
373
  }, props, {
351
- icon: /*#__PURE__*/React.createElement(ArrowDownOutlined, null)
374
+ icon: jsx(ArrowDownOutlined, {})
352
375
  }));
353
376
  }
354
377
  function MoveUpButton(props) {
355
- return /*#__PURE__*/React.createElement(IconButton, _extends({
356
- title: "Move up"
378
+ var translateString = props.registry.translateString;
379
+ return jsx(IconButton, _extends({
380
+ title: translateString(TranslatableString.MoveUpButton)
357
381
  }, props, {
358
- icon: /*#__PURE__*/React.createElement(ArrowUpOutlined, null)
382
+ icon: jsx(ArrowUpOutlined, {})
359
383
  }));
360
384
  }
361
385
  function RemoveButton(props) {
362
386
  // The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
363
387
  var options = getUiOptions(props.uiSchema);
364
- return /*#__PURE__*/React.createElement(IconButton, _extends({
365
- title: "Remove"
388
+ var translateString = props.registry.translateString;
389
+ return jsx(IconButton, _extends({
390
+ title: translateString(TranslatableString.RemoveButton)
366
391
  }, props, {
367
392
  danger: true,
368
393
  block: !!options.block,
369
- iconType: "primary",
370
- icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
394
+ iconType: 'primary',
395
+ icon: jsx(DeleteOutlined, {})
371
396
  }));
372
397
  }
373
398
 
@@ -383,13 +408,14 @@ function FieldErrorTemplate(props) {
383
408
  return null;
384
409
  }
385
410
  var id = errorId(idSchema);
386
- return /*#__PURE__*/React.createElement("div", {
387
- id: id
388
- }, errors.map(function (error) {
389
- return /*#__PURE__*/React.createElement("div", {
390
- key: "field-" + id + "-error-" + error
391
- }, error);
392
- }));
411
+ return jsx("div", {
412
+ id: id,
413
+ children: errors.map(function (error) {
414
+ return jsx("div", {
415
+ children: error
416
+ }, "field-" + id + "-error-" + error);
417
+ })
418
+ });
393
419
  }
394
420
 
395
421
  var VERTICAL_LABEL_COL$1 = {
@@ -433,13 +459,14 @@ function FieldTemplate(props) {
433
459
  wrapperCol = _formContext$wrapperC === void 0 ? VERTICAL_WRAPPER_COL$1 : _formContext$wrapperC,
434
460
  wrapperStyle = formContext.wrapperStyle;
435
461
  var uiOptions = getUiOptions(uiSchema);
436
- var WrapIfAdditionalTemplate = getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
462
+ var WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
437
463
  if (hidden) {
438
- return /*#__PURE__*/React.createElement("div", {
439
- className: "field-hidden"
440
- }, children);
464
+ return jsx("div", {
465
+ className: 'field-hidden',
466
+ children: children
467
+ });
441
468
  }
442
- return /*#__PURE__*/React.createElement(WrapIfAdditionalTemplate, {
469
+ return jsx(WrapIfAdditionalTemplate, {
443
470
  classNames: classNames,
444
471
  style: style,
445
472
  disabled: disabled,
@@ -451,24 +478,26 @@ function FieldTemplate(props) {
451
478
  required: required,
452
479
  schema: schema,
453
480
  uiSchema: uiSchema,
454
- registry: registry
455
- }, id === "root" ? children : /*#__PURE__*/React.createElement(Form$1.Item, {
456
- colon: colon,
457
- extra: rawDescription && description,
458
- hasFeedback: schema.type !== "array" && schema.type !== "object",
459
- help: !!rawHelp && help || (rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? errors : undefined),
460
- htmlFor: id,
461
- label: displayLabel && label,
462
- labelCol: labelCol,
463
- required: required,
464
- style: wrapperStyle,
465
- validateStatus: rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? "error" : undefined,
466
- wrapperCol: wrapperCol
467
- }, children));
481
+ registry: registry,
482
+ children: id === 'root' ? children : jsx(Form$1.Item, {
483
+ colon: colon,
484
+ extra: rawDescription && description,
485
+ hasFeedback: schema.type !== 'array' && schema.type !== 'object',
486
+ help: !!rawHelp && help || (rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? errors : undefined),
487
+ htmlFor: id,
488
+ label: displayLabel && label,
489
+ labelCol: labelCol,
490
+ required: required,
491
+ style: wrapperStyle,
492
+ validateStatus: rawErrors !== null && rawErrors !== void 0 && rawErrors.length ? 'error' : undefined,
493
+ wrapperCol: wrapperCol,
494
+ children: children
495
+ })
496
+ });
468
497
  }
469
498
 
470
499
  var DESCRIPTION_COL_STYLE = {
471
- paddingBottom: "8px"
500
+ paddingBottom: '8px'
472
501
  };
473
502
  /** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
474
503
  * title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
@@ -491,14 +520,14 @@ function ObjectFieldTemplate(props) {
491
520
  title = props.title,
492
521
  uiSchema = props.uiSchema;
493
522
  var uiOptions = getUiOptions(uiSchema);
494
- var TitleFieldTemplate = getTemplate("TitleFieldTemplate", registry, uiOptions);
495
- var DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry, uiOptions);
523
+ var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
524
+ var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
496
525
  // Button templates are not overridden in the uiSchema
497
526
  var AddButton = registry.templates.ButtonTemplates.AddButton;
498
527
  var _formContext$colSpan = formContext.colSpan,
499
528
  colSpan = _formContext$colSpan === void 0 ? 24 : _formContext$colSpan,
500
529
  _formContext$labelAli = formContext.labelAlign,
501
- labelAlign = _formContext$labelAli === void 0 ? "right" : _formContext$labelAli,
530
+ labelAlign = _formContext$labelAli === void 0 ? 'right' : _formContext$labelAli,
502
531
  _formContext$rowGutte = formContext.rowGutter,
503
532
  rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
504
533
  var findSchema = function findSchema(element) {
@@ -522,7 +551,7 @@ function ObjectFieldTemplate(props) {
522
551
  var widget = findUiSchemaWidget(element);
523
552
  var defaultColSpan = properties.length < 2 ||
524
553
  // Single or no field in object.
525
- type === "object" || type === "array" || widget === "textarea" ? 24 : 12;
554
+ type === 'object' || type === 'array' || widget === 'textarea' ? 24 : 12;
526
555
  if (isObject(colSpan)) {
527
556
  var colSpanObj = colSpan;
528
557
  if (isString(widget)) {
@@ -540,58 +569,67 @@ function ObjectFieldTemplate(props) {
540
569
  }
541
570
  return defaultColSpan;
542
571
  };
543
- return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (configProps) {
544
- var getPrefixCls = configProps.getPrefixCls;
545
- var prefixCls = getPrefixCls("form");
546
- var labelClsBasic = prefixCls + "-item-label";
547
- var labelColClassName = classNames(labelClsBasic, labelAlign === "left" && labelClsBasic + "-left"
548
- // labelCol.className,
549
- );
572
+ return jsx(ConfigConsumer, {
573
+ children: function children(configProps) {
574
+ var getPrefixCls = configProps.getPrefixCls;
575
+ var prefixCls = getPrefixCls('form');
576
+ var labelClsBasic = prefixCls + "-item-label";
577
+ var labelColClassName = classNames(labelClsBasic, labelAlign === 'left' && labelClsBasic + "-left"
578
+ // labelCol.className,
579
+ );
550
580
 
551
- return /*#__PURE__*/React.createElement("fieldset", {
552
- id: idSchema.$id
553
- }, /*#__PURE__*/React.createElement(Row, {
554
- gutter: rowGutter
555
- }, (uiOptions.title || title) && /*#__PURE__*/React.createElement(Col, {
556
- className: labelColClassName,
557
- span: 24
558
- }, /*#__PURE__*/React.createElement(TitleFieldTemplate, {
559
- id: titleId(idSchema),
560
- title: uiOptions.title || title,
561
- required: required,
562
- schema: schema,
563
- uiSchema: uiSchema,
564
- registry: registry
565
- })), (uiOptions.description || description) && /*#__PURE__*/React.createElement(Col, {
566
- span: 24,
567
- style: DESCRIPTION_COL_STYLE
568
- }, /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
569
- id: descriptionId(idSchema),
570
- description: uiOptions.description || description,
571
- schema: schema,
572
- uiSchema: uiSchema,
573
- registry: registry
574
- })), properties.filter(function (e) {
575
- return !e.hidden;
576
- }).map(function (element) {
577
- return /*#__PURE__*/React.createElement(Col, {
578
- key: element.name,
579
- span: calculateColSpan(element)
580
- }, element.content);
581
- })), canExpand(schema, uiSchema, formData) && /*#__PURE__*/React.createElement(Col, {
582
- span: 24
583
- }, /*#__PURE__*/React.createElement(Row, {
584
- gutter: rowGutter,
585
- justify: "end"
586
- }, /*#__PURE__*/React.createElement(Col, {
587
- flex: "192px"
588
- }, /*#__PURE__*/React.createElement(AddButton, {
589
- className: "object-property-expand",
590
- disabled: disabled || readonly,
591
- onClick: onAddClick(schema),
592
- uiSchema: uiSchema,
593
- registry: registry
594
- })))));
581
+ return jsxs("fieldset", {
582
+ id: idSchema.$id,
583
+ children: [jsxs(Row, {
584
+ gutter: rowGutter,
585
+ children: [(uiOptions.title || title) && jsx(Col, {
586
+ className: labelColClassName,
587
+ span: 24,
588
+ children: jsx(TitleFieldTemplate, {
589
+ id: titleId(idSchema),
590
+ title: uiOptions.title || title,
591
+ required: required,
592
+ schema: schema,
593
+ uiSchema: uiSchema,
594
+ registry: registry
595
+ })
596
+ }), (uiOptions.description || description) && jsx(Col, {
597
+ span: 24,
598
+ style: DESCRIPTION_COL_STYLE,
599
+ children: jsx(DescriptionFieldTemplate, {
600
+ id: descriptionId(idSchema),
601
+ description: uiOptions.description || description,
602
+ schema: schema,
603
+ uiSchema: uiSchema,
604
+ registry: registry
605
+ })
606
+ }), properties.filter(function (e) {
607
+ return !e.hidden;
608
+ }).map(function (element) {
609
+ return jsx(Col, {
610
+ span: calculateColSpan(element),
611
+ children: element.content
612
+ }, element.name);
613
+ })]
614
+ }), canExpand(schema, uiSchema, formData) && jsx(Col, {
615
+ span: 24,
616
+ children: jsx(Row, {
617
+ gutter: rowGutter,
618
+ justify: 'end',
619
+ children: jsx(Col, {
620
+ flex: '192px',
621
+ children: jsx(AddButton, {
622
+ className: 'object-property-expand',
623
+ disabled: disabled || readonly,
624
+ onClick: onAddClick(schema),
625
+ uiSchema: uiSchema,
626
+ registry: registry
627
+ })
628
+ })
629
+ })
630
+ })]
631
+ });
632
+ }
595
633
  });
596
634
  }
597
635
 
@@ -606,11 +644,12 @@ function SubmitButton(_ref) {
606
644
  if (norender) {
607
645
  return null;
608
646
  }
609
- return /*#__PURE__*/React.createElement(Button, _extends({
610
- type: "submit"
647
+ return jsx(Button, _extends({
648
+ type: 'submit'
611
649
  }, submitButtonProps, {
612
- htmlType: "submit"
613
- }), submitText);
650
+ htmlType: 'submit',
651
+ children: submitText
652
+ }));
614
653
  }
615
654
 
616
655
  /** The `TitleField` is the template to use to render the title of a field
@@ -626,8 +665,8 @@ function TitleField(_ref) {
626
665
  var _formContext$colon = formContext.colon,
627
666
  colon = _formContext$colon === void 0 ? true : _formContext$colon;
628
667
  var labelChildren = title;
629
- if (colon && typeof title === "string" && title.trim() !== "") {
630
- labelChildren = title.replace(/[::]\s*$/, "");
668
+ if (colon && typeof title === 'string' && title.trim() !== '') {
669
+ labelChildren = title.replace(/[::]\s*$/, '');
631
670
  }
632
671
  var handleLabelClick = function handleLabelClick() {
633
672
  if (!id) {
@@ -638,17 +677,20 @@ function TitleField(_ref) {
638
677
  control.focus();
639
678
  }
640
679
  };
641
- return title ? /*#__PURE__*/React.createElement(ConfigConsumer, null, function (configProps) {
642
- var _classNames;
643
- var getPrefixCls = configProps.getPrefixCls;
644
- var prefixCls = getPrefixCls("form");
645
- var labelClassName = classNames((_classNames = {}, _classNames[prefixCls + "-item-required"] = required, _classNames[prefixCls + "-item-no-colon"] = !colon, _classNames));
646
- return /*#__PURE__*/React.createElement("label", {
647
- className: labelClassName,
648
- htmlFor: id,
649
- onClick: handleLabelClick,
650
- title: typeof title === "string" ? title : ""
651
- }, labelChildren);
680
+ return title ? jsx(ConfigConsumer, {
681
+ children: function children(configProps) {
682
+ var _classNames;
683
+ var getPrefixCls = configProps.getPrefixCls;
684
+ var prefixCls = getPrefixCls('form');
685
+ var labelClassName = classNames((_classNames = {}, _classNames[prefixCls + "-item-required"] = required, _classNames[prefixCls + "-item-no-colon"] = !colon, _classNames));
686
+ return jsx("label", {
687
+ className: labelClassName,
688
+ htmlFor: id,
689
+ onClick: handleLabelClick,
690
+ title: typeof title === 'string' ? title : '',
691
+ children: labelChildren
692
+ });
693
+ }
652
694
  }) : null;
653
695
  }
654
696
 
@@ -659,7 +701,7 @@ var VERTICAL_WRAPPER_COL = {
659
701
  span: 24
660
702
  };
661
703
  var INPUT_STYLE$1 = {
662
- width: "100%"
704
+ width: '100%'
663
705
  };
664
706
  /** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
665
707
  * part of an `additionalProperties` part of a schema.
@@ -690,19 +732,22 @@ function WrapIfAdditionalTemplate(props) {
690
732
  _registry$formContext4 = _registry$formContext.rowGutter,
691
733
  rowGutter = _registry$formContext4 === void 0 ? 24 : _registry$formContext4,
692
734
  _registry$formContext5 = _registry$formContext.toolbarAlign,
693
- toolbarAlign = _registry$formContext5 === void 0 ? "top" : _registry$formContext5,
735
+ toolbarAlign = _registry$formContext5 === void 0 ? 'top' : _registry$formContext5,
694
736
  _registry$formContext6 = _registry$formContext.wrapperCol,
695
737
  wrapperCol = _registry$formContext6 === void 0 ? VERTICAL_WRAPPER_COL : _registry$formContext6,
696
738
  wrapperStyle = _registry$formContext.wrapperStyle;
739
+ var templates = registry.templates,
740
+ translateString = registry.translateString;
697
741
  // Button templates are not overridden in the uiSchema
698
- var RemoveButton = registry.templates.ButtonTemplates.RemoveButton;
699
- var keyLabel = label + " Key"; // i18n ?
742
+ var RemoveButton = templates.ButtonTemplates.RemoveButton;
743
+ var keyLabel = translateString(TranslatableString.KeyLabel, [label]);
700
744
  var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
701
745
  if (!additional) {
702
- return /*#__PURE__*/React.createElement("div", {
746
+ return jsx("div", {
703
747
  className: classNames,
704
- style: style
705
- }, children);
748
+ style: style,
749
+ children: children
750
+ });
706
751
  }
707
752
  var handleBlur = function handleBlur(_ref) {
708
753
  var target = _ref.target;
@@ -713,48 +758,55 @@ function WrapIfAdditionalTemplate(props) {
713
758
  var buttonUiOptions = _extends({}, uiSchema, (_extends2 = {}, _extends2[UI_OPTIONS_KEY] = _extends({}, uiOptions, {
714
759
  block: true
715
760
  }), _extends2));
716
- return /*#__PURE__*/React.createElement("div", {
761
+ return jsx("div", {
717
762
  className: classNames,
718
- style: style
719
- }, /*#__PURE__*/React.createElement(Row, {
720
- align: toolbarAlign,
721
- gutter: rowGutter
722
- }, /*#__PURE__*/React.createElement(Col, {
723
- className: "form-additional",
724
- flex: "1"
725
- }, /*#__PURE__*/React.createElement("div", {
726
- className: "form-group"
727
- }, /*#__PURE__*/React.createElement(Form$1.Item, {
728
- colon: colon,
729
- className: "form-group",
730
- hasFeedback: true,
731
- htmlFor: id + "-key",
732
- label: keyLabel,
733
- labelCol: labelCol,
734
- required: required,
735
- style: wrapperStyle,
736
- wrapperCol: wrapperCol
737
- }, /*#__PURE__*/React.createElement(Input, {
738
- className: "form-control",
739
- defaultValue: label,
740
- disabled: disabled || readonlyAsDisabled && readonly,
741
- id: id + "-key",
742
- name: id + "-key",
743
- onBlur: !readonly ? handleBlur : undefined,
744
- style: INPUT_STYLE$1,
745
- type: "text"
746
- })))), /*#__PURE__*/React.createElement(Col, {
747
- className: "form-additional",
748
- flex: "1"
749
- }, children), /*#__PURE__*/React.createElement(Col, {
750
- flex: "192px"
751
- }, /*#__PURE__*/React.createElement(RemoveButton, {
752
- className: "array-item-remove",
753
- disabled: disabled || readonly,
754
- onClick: onDropPropertyClick(label),
755
- uiSchema: buttonUiOptions,
756
- registry: registry
757
- }))));
763
+ style: style,
764
+ children: jsxs(Row, {
765
+ align: toolbarAlign,
766
+ gutter: rowGutter,
767
+ children: [jsx(Col, {
768
+ className: 'form-additional',
769
+ flex: '1',
770
+ children: jsx("div", {
771
+ className: 'form-group',
772
+ children: jsx(Form$1.Item, {
773
+ colon: colon,
774
+ className: 'form-group',
775
+ hasFeedback: true,
776
+ htmlFor: id + "-key",
777
+ label: keyLabel,
778
+ labelCol: labelCol,
779
+ required: required,
780
+ style: wrapperStyle,
781
+ wrapperCol: wrapperCol,
782
+ children: jsx(Input, {
783
+ className: 'form-control',
784
+ defaultValue: label,
785
+ disabled: disabled || readonlyAsDisabled && readonly,
786
+ id: id + "-key",
787
+ name: id + "-key",
788
+ onBlur: !readonly ? handleBlur : undefined,
789
+ style: INPUT_STYLE$1,
790
+ type: 'text'
791
+ })
792
+ })
793
+ })
794
+ }), jsx(Col, {
795
+ className: 'form-additional',
796
+ flex: '1',
797
+ children: children
798
+ }), jsx(Col, {
799
+ flex: '192px',
800
+ children: jsx(RemoveButton, {
801
+ className: 'array-item-remove',
802
+ disabled: disabled || readonly,
803
+ onClick: onDropPropertyClick(label),
804
+ uiSchema: buttonUiOptions,
805
+ registry: registry
806
+ })
807
+ })]
808
+ })
809
+ });
758
810
  }
759
811
 
760
812
  function generateTemplates() {
@@ -806,29 +858,29 @@ function dateElementProps(state, time, yearsRange) {
806
858
  minute = state.minute,
807
859
  second = state.second;
808
860
  var data = [{
809
- type: "year",
861
+ type: 'year',
810
862
  range: yearsRange,
811
863
  value: year
812
864
  }, {
813
- type: "month",
865
+ type: 'month',
814
866
  range: [1, 12],
815
867
  value: month
816
868
  }, {
817
- type: "day",
869
+ type: 'day',
818
870
  range: [1, 31],
819
871
  value: day
820
872
  }];
821
873
  if (time) {
822
874
  data.push({
823
- type: "hour",
875
+ type: 'hour',
824
876
  range: [0, 23],
825
877
  value: hour || -1
826
878
  }, {
827
- type: "minute",
879
+ type: 'minute',
828
880
  range: [0, 59],
829
881
  value: minute || -1
830
882
  }, {
831
- type: "second",
883
+ type: 'second',
832
884
  range: [0, 59],
833
885
  value: second || -1
834
886
  });
@@ -848,7 +900,9 @@ function AltDateWidget(props) {
848
900
  registry = props.registry,
849
901
  showTime = props.showTime,
850
902
  value = props.value;
851
- var SelectWidget = registry.widgets.SelectWidget;
903
+ var translateString = registry.translateString,
904
+ widgets = registry.widgets;
905
+ var SelectWidget = widgets.SelectWidget;
852
906
  var _formContext$rowGutte = formContext.rowGutter,
853
907
  rowGutter = _formContext$rowGutte === void 0 ? 24 : _formContext$rowGutte;
854
908
  var _useState = useState(parseDateString(value, showTime)),
@@ -859,7 +913,7 @@ function AltDateWidget(props) {
859
913
  }, [showTime, value]);
860
914
  var handleChange = function handleChange(property, nextValue) {
861
915
  var _extends2;
862
- var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === "undefined" ? -1 : nextValue, _extends2));
916
+ var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
863
917
  if (readyForChange(nextState)) {
864
918
  onChange(toDateString(nextState, showTime));
865
919
  } else {
@@ -882,9 +936,9 @@ function AltDateWidget(props) {
882
936
  onChange(undefined);
883
937
  };
884
938
  var renderDateElement = function renderDateElement(elemProps) {
885
- return /*#__PURE__*/React.createElement(SelectWidget, {
939
+ return jsx(SelectWidget, {
886
940
  autofocus: elemProps.autofocus,
887
- className: "form-control",
941
+ className: 'form-control',
888
942
  disabled: elemProps.disabled,
889
943
  id: elemProps.id,
890
944
  name: elemProps.name,
@@ -899,51 +953,56 @@ function AltDateWidget(props) {
899
953
  placeholder: elemProps.type,
900
954
  readonly: elemProps.readonly,
901
955
  schema: {
902
- type: "integer"
956
+ type: 'integer'
903
957
  },
904
958
  value: elemProps.value,
905
959
  registry: registry,
906
- label: "",
960
+ label: '',
907
961
  "aria-describedby": ariaDescribedByIds(id)
908
962
  });
909
963
  };
910
- return /*#__PURE__*/React.createElement(Row, {
911
- gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)]
912
- }, dateElementProps(state, showTime, options.yearsRange).map(function (elemProps, i) {
913
- var elemId = id + "_" + elemProps.type;
914
- return /*#__PURE__*/React.createElement(Col, {
915
- flex: "88px",
916
- key: elemId
917
- }, renderDateElement(_extends({}, elemProps, {
918
- autofocus: autofocus && i === 0,
919
- disabled: disabled,
920
- id: elemId,
921
- name: id,
922
- onBlur: onBlur,
923
- onFocus: onFocus,
924
- readonly: readonly,
925
- registry: registry,
926
- select: handleChange,
927
- // NOTE: antd components accept -1 rather than issue a warning
928
- // like material-ui, so we need to convert -1 to undefined here.
929
- value: elemProps.value < 0 ? undefined : elemProps.value
930
- })));
931
- }), !options.hideNowButton && /*#__PURE__*/React.createElement(Col, {
932
- flex: "88px"
933
- }, /*#__PURE__*/React.createElement(Button, {
934
- block: true,
935
- className: "btn-now",
936
- onClick: handleNow,
937
- type: "primary"
938
- }, "Now")), !options.hideClearButton && /*#__PURE__*/React.createElement(Col, {
939
- flex: "88px"
940
- }, /*#__PURE__*/React.createElement(Button, {
941
- block: true,
942
- className: "btn-clear",
943
- danger: true,
944
- onClick: handleClear,
945
- type: "primary"
946
- }, "Clear")));
964
+ return jsxs(Row, {
965
+ gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)],
966
+ children: [dateElementProps(state, showTime, options.yearsRange).map(function (elemProps, i) {
967
+ var elemId = id + '_' + elemProps.type;
968
+ return jsx(Col, {
969
+ flex: '88px',
970
+ children: renderDateElement(_extends({}, elemProps, {
971
+ autofocus: autofocus && i === 0,
972
+ disabled: disabled,
973
+ id: elemId,
974
+ name: id,
975
+ onBlur: onBlur,
976
+ onFocus: onFocus,
977
+ readonly: readonly,
978
+ registry: registry,
979
+ select: handleChange,
980
+ // NOTE: antd components accept -1 rather than issue a warning
981
+ // like material-ui, so we need to convert -1 to undefined here.
982
+ value: elemProps.value < 0 ? undefined : elemProps.value
983
+ }))
984
+ }, elemId);
985
+ }), !options.hideNowButton && jsx(Col, {
986
+ flex: '88px',
987
+ children: jsx(Button, {
988
+ block: true,
989
+ className: 'btn-now',
990
+ onClick: handleNow,
991
+ type: 'primary',
992
+ children: translateString(TranslatableString.NowLabel)
993
+ })
994
+ }), !options.hideClearButton && jsx(Col, {
995
+ flex: '88px',
996
+ children: jsx(Button, {
997
+ block: true,
998
+ className: 'btn-clear',
999
+ danger: true,
1000
+ onClick: handleClear,
1001
+ type: 'primary',
1002
+ children: translateString(TranslatableString.ClearLabel)
1003
+ })
1004
+ })]
1005
+ });
947
1006
  }
948
1007
  AltDateWidget.defaultProps = {
949
1008
  autofocus: false,
@@ -957,7 +1016,7 @@ AltDateWidget.defaultProps = {
957
1016
 
958
1017
  function AltDateTimeWidget(props) {
959
1018
  var AltDateWidget = props.registry.widgets.AltDateWidget;
960
- return /*#__PURE__*/React.createElement(AltDateWidget, _extends({
1019
+ return jsx(AltDateWidget, _extends({
961
1020
  showTime: true
962
1021
  }, props));
963
1022
  }
@@ -1006,23 +1065,25 @@ function CheckboxesWidget(_ref) {
1006
1065
  onFocus: !readonly ? handleFocus : undefined
1007
1066
  };
1008
1067
  var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
1009
- return Array.isArray(enumOptions) && enumOptions.length > 0 ? /*#__PURE__*/React.createElement(Checkbox.Group, _extends({
1068
+ return Array.isArray(enumOptions) && enumOptions.length > 0 ? jsx(Checkbox.Group, _extends({
1010
1069
  disabled: disabled || readonlyAsDisabled && readonly,
1011
1070
  name: id,
1012
1071
  onChange: !readonly ? handleChange : undefined,
1013
1072
  value: selectedIndexes
1014
1073
  }, extraProps, {
1015
- "aria-describedby": ariaDescribedByIds(id)
1016
- }), Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
1017
- return /*#__PURE__*/React.createElement("span", {
1018
- key: i
1019
- }, /*#__PURE__*/React.createElement(Checkbox, {
1020
- id: optionId(id, i),
1021
- name: id,
1022
- autoFocus: i === 0 ? autofocus : false,
1023
- disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
1024
- value: String(i)
1025
- }, option.label), !inline && /*#__PURE__*/React.createElement("br", null));
1074
+ "aria-describedby": ariaDescribedByIds(id),
1075
+ children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
1076
+ return jsxs("span", {
1077
+ children: [jsx(Checkbox, {
1078
+ id: optionId(id, i),
1079
+ name: id,
1080
+ autoFocus: i === 0 ? autofocus : false,
1081
+ disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
1082
+ value: String(i),
1083
+ children: option.label
1084
+ }), !inline && jsx("br", {})]
1085
+ }, i);
1086
+ })
1026
1087
  })) : null;
1027
1088
  }
1028
1089
 
@@ -1062,22 +1123,23 @@ function CheckboxWidget(props) {
1062
1123
  onBlur: !readonly ? handleBlur : undefined,
1063
1124
  onFocus: !readonly ? handleFocus : undefined
1064
1125
  };
1065
- return /*#__PURE__*/React.createElement(Checkbox, _extends({
1126
+ return jsx(Checkbox, _extends({
1066
1127
  autoFocus: autofocus,
1067
- checked: typeof value === "undefined" ? false : value,
1128
+ checked: typeof value === 'undefined' ? false : value,
1068
1129
  disabled: disabled || readonlyAsDisabled && readonly,
1069
1130
  id: id,
1070
1131
  name: id,
1071
1132
  onChange: !readonly ? handleChange : undefined
1072
1133
  }, extraProps, {
1073
- "aria-describedby": ariaDescribedByIds(id)
1074
- }), label);
1134
+ "aria-describedby": ariaDescribedByIds(id),
1135
+ children: label
1136
+ }));
1075
1137
  }
1076
1138
 
1077
1139
  var DatePicker = /*#__PURE__*/generatePicker(dayjsGenerateConfig);
1078
1140
 
1079
1141
  var DATE_PICKER_STYLE$1 = {
1080
- width: "100%"
1142
+ width: '100%'
1081
1143
  };
1082
1144
  /** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms
1083
1145
  * the value to/from utc using the appropriate utility functions.
@@ -1108,7 +1170,7 @@ function DateTimeWidget(props) {
1108
1170
  var getPopupContainer = function getPopupContainer(node) {
1109
1171
  return node.parentNode;
1110
1172
  };
1111
- return /*#__PURE__*/React.createElement(DatePicker, {
1173
+ return jsx(DatePicker, {
1112
1174
  disabled: disabled || readonlyAsDisabled && readonly,
1113
1175
  getPopupContainer: getPopupContainer,
1114
1176
  id: id,
@@ -1125,7 +1187,7 @@ function DateTimeWidget(props) {
1125
1187
  }
1126
1188
 
1127
1189
  var DATE_PICKER_STYLE = {
1128
- width: "100%"
1190
+ width: '100%'
1129
1191
  };
1130
1192
  /** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms
1131
1193
  * the value to undefined when it is falsy during the `onChange` handling.
@@ -1145,7 +1207,7 @@ function DateWidget(props) {
1145
1207
  var _formContext$readonly = formContext.readonlyAsDisabled,
1146
1208
  readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1147
1209
  var handleChange = function handleChange(nextValue) {
1148
- return onChange(nextValue && nextValue.format("YYYY-MM-DD"));
1210
+ return onChange(nextValue && nextValue.format('YYYY-MM-DD'));
1149
1211
  };
1150
1212
  var handleBlur = function handleBlur() {
1151
1213
  return onBlur(id, value);
@@ -1156,7 +1218,7 @@ function DateWidget(props) {
1156
1218
  var getPopupContainer = function getPopupContainer(node) {
1157
1219
  return node.parentNode;
1158
1220
  };
1159
- return /*#__PURE__*/React.createElement(DatePicker, {
1221
+ return jsx(DatePicker, {
1160
1222
  disabled: disabled || readonlyAsDisabled && readonly,
1161
1223
  getPopupContainer: getPopupContainer,
1162
1224
  id: id,
@@ -1189,10 +1251,10 @@ function PasswordWidget(props) {
1189
1251
  value = props.value;
1190
1252
  var _formContext$readonly = formContext.readonlyAsDisabled,
1191
1253
  readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1192
- var emptyValue = options.emptyValue || "";
1254
+ var emptyValue = options.emptyValue || '';
1193
1255
  var handleChange = function handleChange(_ref) {
1194
1256
  var target = _ref.target;
1195
- return onChange(target.value === "" ? emptyValue : target.value);
1257
+ return onChange(target.value === '' ? emptyValue : target.value);
1196
1258
  };
1197
1259
  var handleBlur = function handleBlur(_ref2) {
1198
1260
  var target = _ref2.target;
@@ -1202,7 +1264,7 @@ function PasswordWidget(props) {
1202
1264
  var target = _ref3.target;
1203
1265
  return onFocus(id, target.value);
1204
1266
  };
1205
- return /*#__PURE__*/React.createElement(Input.Password, {
1267
+ return jsx(Input.Password, {
1206
1268
  disabled: disabled || readonlyAsDisabled && readonly,
1207
1269
  id: id,
1208
1270
  name: id,
@@ -1210,7 +1272,7 @@ function PasswordWidget(props) {
1210
1272
  onChange: !readonly ? handleChange : undefined,
1211
1273
  onFocus: !readonly ? handleFocus : undefined,
1212
1274
  placeholder: placeholder,
1213
- value: value || "",
1275
+ value: value || '',
1214
1276
  "aria-describedby": ariaDescribedByIds(id)
1215
1277
  });
1216
1278
  }
@@ -1249,7 +1311,7 @@ function RadioWidget(_ref) {
1249
1311
  return onFocus(id, enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
1250
1312
  };
1251
1313
  var selectedIndexes = enumOptionsIndexForValue(value, enumOptions);
1252
- return /*#__PURE__*/React.createElement(Radio.Group, {
1314
+ return jsx(Radio.Group, {
1253
1315
  disabled: disabled || readonlyAsDisabled && readonly,
1254
1316
  id: id,
1255
1317
  name: id,
@@ -1257,17 +1319,18 @@ function RadioWidget(_ref) {
1257
1319
  onBlur: !readonly ? handleBlur : undefined,
1258
1320
  onFocus: !readonly ? handleFocus : undefined,
1259
1321
  value: selectedIndexes,
1260
- "aria-describedby": ariaDescribedByIds(id)
1261
- }, Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
1262
- return /*#__PURE__*/React.createElement(Radio, {
1263
- id: optionId(id, i),
1264
- name: id,
1265
- autoFocus: i === 0 ? autofocus : false,
1266
- disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
1267
- key: i,
1268
- value: String(i)
1269
- }, option.label);
1270
- }));
1322
+ "aria-describedby": ariaDescribedByIds(id),
1323
+ children: Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
1324
+ return jsx(Radio, {
1325
+ id: optionId(id, i),
1326
+ name: id,
1327
+ autoFocus: i === 0 ? autofocus : false,
1328
+ disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
1329
+ value: String(i),
1330
+ children: option.label
1331
+ }, i);
1332
+ })
1333
+ });
1271
1334
  }
1272
1335
 
1273
1336
  /** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
@@ -1294,9 +1357,9 @@ function RangeWidget(props) {
1294
1357
  min = _rangeSpec.min,
1295
1358
  max = _rangeSpec.max,
1296
1359
  step = _rangeSpec.step;
1297
- var emptyValue = options.emptyValue || "";
1360
+ var emptyValue = options.emptyValue || '';
1298
1361
  var handleChange = function handleChange(nextValue) {
1299
- return onChange(nextValue === "" ? emptyValue : nextValue);
1362
+ return onChange(nextValue === '' ? emptyValue : nextValue);
1300
1363
  };
1301
1364
  var handleBlur = function handleBlur() {
1302
1365
  return onBlur(id, value);
@@ -1311,7 +1374,7 @@ function RangeWidget(props) {
1311
1374
  onBlur: !readonly ? handleBlur : undefined,
1312
1375
  onFocus: !readonly ? handleFocus : undefined
1313
1376
  };
1314
- return /*#__PURE__*/React.createElement(Slider, _extends({
1377
+ return jsx(Slider, _extends({
1315
1378
  autoFocus: autofocus,
1316
1379
  disabled: disabled || readonlyAsDisabled && readonly,
1317
1380
  id: id,
@@ -1327,7 +1390,7 @@ function RangeWidget(props) {
1327
1390
  }
1328
1391
 
1329
1392
  var SELECT_STYLE = {
1330
- width: "100%"
1393
+ width: '100%'
1331
1394
  };
1332
1395
  /** The `SelectWidget` is a widget for rendering dropdowns.
1333
1396
  * It is typically used with string properties constrained with enum options.
@@ -1378,12 +1441,12 @@ function SelectWidget(_ref) {
1378
1441
  var extraProps = {
1379
1442
  name: id
1380
1443
  };
1381
- return /*#__PURE__*/React.createElement(Select, _extends({
1444
+ return jsx(Select, _extends({
1382
1445
  autoFocus: autofocus,
1383
1446
  disabled: disabled || readonlyAsDisabled && readonly,
1384
1447
  getPopupContainer: getPopupContainer,
1385
1448
  id: id,
1386
- mode: typeof multiple !== "undefined" ? "multiple" : undefined,
1449
+ mode: typeof multiple !== 'undefined' ? 'multiple' : undefined,
1387
1450
  onBlur: !readonly ? handleBlur : undefined,
1388
1451
  onChange: !readonly ? handleChange : undefined,
1389
1452
  onFocus: !readonly ? handleFocus : undefined,
@@ -1392,20 +1455,21 @@ function SelectWidget(_ref) {
1392
1455
  value: selectedIndexes
1393
1456
  }, extraProps, {
1394
1457
  filterOption: filterOption,
1395
- "aria-describedby": ariaDescribedByIds(id)
1396
- }), Array.isArray(enumOptions) && enumOptions.map(function (_ref2, index) {
1397
- var optionValue = _ref2.value,
1398
- optionLabel = _ref2.label;
1399
- return /*#__PURE__*/React.createElement(Select.Option, {
1400
- disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
1401
- key: String(index),
1402
- value: String(index)
1403
- }, optionLabel);
1458
+ "aria-describedby": ariaDescribedByIds(id),
1459
+ children: Array.isArray(enumOptions) && enumOptions.map(function (_ref2, index) {
1460
+ var optionValue = _ref2.value,
1461
+ optionLabel = _ref2.label;
1462
+ return jsx(Select.Option, {
1463
+ disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(optionValue) !== -1,
1464
+ value: String(index),
1465
+ children: optionLabel
1466
+ }, String(index));
1467
+ })
1404
1468
  }));
1405
1469
  }
1406
1470
 
1407
1471
  var INPUT_STYLE = {
1408
- width: "100%"
1472
+ width: '100%'
1409
1473
  };
1410
1474
  /** The `TextareaWidget` is a widget for rendering input fields as textarea.
1411
1475
  *
@@ -1426,7 +1490,7 @@ function TextareaWidget(_ref) {
1426
1490
  readonlyAsDisabled = _formContext$readonly === void 0 ? true : _formContext$readonly;
1427
1491
  var handleChange = function handleChange(_ref2) {
1428
1492
  var target = _ref2.target;
1429
- return onChange(target.value === "" ? options.emptyValue : target.value);
1493
+ return onChange(target.value === '' ? options.emptyValue : target.value);
1430
1494
  };
1431
1495
  var handleBlur = function handleBlur(_ref3) {
1432
1496
  var target = _ref3.target;
@@ -1439,9 +1503,9 @@ function TextareaWidget(_ref) {
1439
1503
  // Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
1440
1504
  // they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
1441
1505
  var extraProps = {
1442
- type: "textarea"
1506
+ type: 'textarea'
1443
1507
  };
1444
- return /*#__PURE__*/React.createElement(Input.TextArea, _extends({
1508
+ return jsx(Input.TextArea, _extends({
1445
1509
  disabled: disabled || readonlyAsDisabled && readonly,
1446
1510
  id: id,
1447
1511
  name: id,