@rjsf/core 5.2.1 → 5.3.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.
@@ -9,13 +9,14 @@ var get = require('lodash/get');
9
9
  var isEmpty = require('lodash/isEmpty');
10
10
  var _pick = require('lodash/pick');
11
11
  var _toPath = require('lodash/toPath');
12
+ var cloneDeep = require('lodash/cloneDeep');
12
13
  var isObject = require('lodash/isObject');
13
14
  var set = require('lodash/set');
14
15
  var nanoid = require('nanoid');
15
16
  var omit = require('lodash/omit');
17
+ var Markdown = require('markdown-to-jsx');
16
18
  var has = require('lodash/has');
17
19
  var unset = require('lodash/unset');
18
- var Markdown = require('markdown-to-jsx');
19
20
 
20
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
22
 
@@ -23,12 +24,13 @@ var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
23
24
  var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
24
25
  var _pick__default = /*#__PURE__*/_interopDefaultLegacy(_pick);
25
26
  var _toPath__default = /*#__PURE__*/_interopDefaultLegacy(_toPath);
27
+ var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
26
28
  var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
27
29
  var set__default = /*#__PURE__*/_interopDefaultLegacy(set);
28
30
  var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
31
+ var Markdown__default = /*#__PURE__*/_interopDefaultLegacy(Markdown);
29
32
  var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
30
33
  var unset__default = /*#__PURE__*/_interopDefaultLegacy(unset);
31
- var Markdown__default = /*#__PURE__*/_interopDefaultLegacy(Markdown);
32
34
 
33
35
  function _defineProperties(target, props) {
34
36
  for (var i = 0; i < props.length; i++) {
@@ -165,6 +167,31 @@ var ArrayField = /*#__PURE__*/function (_Component) {
165
167
  _this._handleAddClick(event, index);
166
168
  };
167
169
  };
170
+ _this.onCopyIndexClick = function (index) {
171
+ return function (event) {
172
+ if (event) {
173
+ event.preventDefault();
174
+ }
175
+ var onChange = _this.props.onChange;
176
+ var keyedFormData = _this.state.keyedFormData;
177
+ var newKeyedFormDataRow = {
178
+ key: generateRowId(),
179
+ item: cloneDeep__default["default"](keyedFormData[index].item)
180
+ };
181
+ var newKeyedFormData = [].concat(keyedFormData);
182
+ if (index !== undefined) {
183
+ newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);
184
+ } else {
185
+ newKeyedFormData.push(newKeyedFormDataRow);
186
+ }
187
+ _this.setState({
188
+ keyedFormData: newKeyedFormData,
189
+ updatedKeyedFormData: true
190
+ }, function () {
191
+ return onChange(keyedToPlainFormData(newKeyedFormData));
192
+ });
193
+ };
194
+ };
168
195
  _this.onDropIndexClick = function (index) {
169
196
  return function (event) {
170
197
  if (event) {
@@ -324,8 +351,9 @@ var ArrayField = /*#__PURE__*/function (_Component) {
324
351
  _proto.canAddItem = function canAddItem(formItems) {
325
352
  var _this$props6 = this.props,
326
353
  schema = _this$props6.schema,
327
- uiSchema = _this$props6.uiSchema;
328
- var _getUiOptions = utils.getUiOptions(uiSchema),
354
+ uiSchema = _this$props6.uiSchema,
355
+ registry = _this$props6.registry;
356
+ var _getUiOptions = utils.getUiOptions(uiSchema, registry.globalUiOptions),
329
357
  addable = _getUiOptions.addable;
330
358
  if (addable !== false) {
331
359
  // if ui:options.addable was not explicitly set to false, we can add
@@ -767,10 +795,8 @@ var ArrayField = /*#__PURE__*/function (_Component) {
767
795
  canAdd = props.canAdd,
768
796
  _props$canRemove = props.canRemove,
769
797
  canRemove = _props$canRemove === void 0 ? true : _props$canRemove,
770
- _props$canMoveUp = props.canMoveUp,
771
- canMoveUp = _props$canMoveUp === void 0 ? true : _props$canMoveUp,
772
- _props$canMoveDown = props.canMoveDown,
773
- canMoveDown = _props$canMoveDown === void 0 ? true : _props$canMoveDown,
798
+ canMoveUp = props.canMoveUp,
799
+ canMoveDown = props.canMoveDown,
774
800
  itemSchema = props.itemSchema,
775
801
  itemData = props.itemData,
776
802
  itemUiSchema = props.itemUiSchema,
@@ -792,16 +818,20 @@ var ArrayField = /*#__PURE__*/function (_Component) {
792
818
  formContext = _this$props13.formContext;
793
819
  var _registry$fields = registry.fields,
794
820
  ArraySchemaField = _registry$fields.ArraySchemaField,
795
- SchemaField = _registry$fields.SchemaField;
821
+ SchemaField = _registry$fields.SchemaField,
822
+ globalUiOptions = registry.globalUiOptions;
796
823
  var ItemSchemaField = ArraySchemaField || SchemaField;
797
- var _getUiOptions5 = utils.getUiOptions(uiSchema),
824
+ var _getUiOptions5 = utils.getUiOptions(uiSchema, globalUiOptions),
798
825
  _getUiOptions5$ordera = _getUiOptions5.orderable,
799
826
  orderable = _getUiOptions5$ordera === void 0 ? true : _getUiOptions5$ordera,
800
827
  _getUiOptions5$remova = _getUiOptions5.removable,
801
- removable = _getUiOptions5$remova === void 0 ? true : _getUiOptions5$remova;
828
+ removable = _getUiOptions5$remova === void 0 ? true : _getUiOptions5$remova,
829
+ _getUiOptions5$copyab = _getUiOptions5.copyable,
830
+ copyable = _getUiOptions5$copyab === void 0 ? false : _getUiOptions5$copyab;
802
831
  var has = {
803
832
  moveUp: orderable && canMoveUp,
804
833
  moveDown: orderable && canMoveDown,
834
+ copy: copyable && canAdd,
805
835
  remove: removable && canRemove,
806
836
  toolbar: false
807
837
  };
@@ -834,6 +864,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
834
864
  className: 'array-item',
835
865
  disabled: disabled,
836
866
  canAdd: canAdd,
867
+ hasCopy: has.copy,
837
868
  hasToolbar: has.toolbar,
838
869
  hasMoveUp: has.moveUp,
839
870
  hasMoveDown: has.moveDown,
@@ -842,6 +873,7 @@ var ArrayField = /*#__PURE__*/function (_Component) {
842
873
  totalItems: totalItems,
843
874
  key: key,
844
875
  onAddIndexClick: this.onAddIndexClick,
876
+ onCopyIndexClick: this.onCopyIndexClick,
845
877
  onDropIndexClick: this.onDropIndexClick,
846
878
  onReorderClick: this.onReorderClick,
847
879
  readonly: readonly,
@@ -1294,8 +1326,10 @@ var ObjectField = /*#__PURE__*/function (_Component) {
1294
1326
  };
1295
1327
  };
1296
1328
  _this.getAvailableKey = function (preferredKey, formData) {
1297
- var uiSchema = _this.props.uiSchema;
1298
- var _getUiOptions = utils.getUiOptions(uiSchema),
1329
+ var _this$props3 = _this.props,
1330
+ uiSchema = _this$props3.uiSchema,
1331
+ registry = _this$props3.registry;
1332
+ var _getUiOptions = utils.getUiOptions(uiSchema, registry.globalUiOptions),
1299
1333
  _getUiOptions$duplica = _getUiOptions.duplicateKeySuffixSeparator,
1300
1334
  duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ? '-' : _getUiOptions$duplica;
1301
1335
  var index = 0;
@@ -1311,10 +1345,10 @@ var ObjectField = /*#__PURE__*/function (_Component) {
1311
1345
  if (oldValue === value) {
1312
1346
  return;
1313
1347
  }
1314
- var _this$props3 = _this.props,
1315
- formData = _this$props3.formData,
1316
- onChange = _this$props3.onChange,
1317
- errorSchema = _this$props3.errorSchema;
1348
+ var _this$props4 = _this.props,
1349
+ formData = _this$props4.formData,
1350
+ onChange = _this$props4.onChange,
1351
+ errorSchema = _this$props4.errorSchema;
1318
1352
  value = _this.getAvailableKey(value, formData);
1319
1353
  var newFormData = _extends({}, formData);
1320
1354
  var newKeys = (_newKeys = {}, _newKeys[oldValue] = value, _newKeys);
@@ -1335,10 +1369,10 @@ var ObjectField = /*#__PURE__*/function (_Component) {
1335
1369
  if (!schema.additionalProperties) {
1336
1370
  return;
1337
1371
  }
1338
- var _this$props4 = _this.props,
1339
- formData = _this$props4.formData,
1340
- onChange = _this$props4.onChange,
1341
- registry = _this$props4.registry;
1372
+ var _this$props5 = _this.props,
1373
+ formData = _this$props5.formData,
1374
+ onChange = _this$props5.onChange,
1375
+ registry = _this$props5.registry;
1342
1376
  var newFormData = _extends({}, formData);
1343
1377
  var type = undefined;
1344
1378
  if (isObject__default["default"](schema.additionalProperties)) {
@@ -1413,35 +1447,36 @@ var ObjectField = /*#__PURE__*/function (_Component) {
1413
1447
  */
1414
1448
  _proto.render = function render() {
1415
1449
  var _this2 = this;
1416
- var _this$props5 = this.props,
1417
- rawSchema = _this$props5.schema,
1418
- _this$props5$uiSchema = _this$props5.uiSchema,
1419
- uiSchema = _this$props5$uiSchema === void 0 ? {} : _this$props5$uiSchema,
1420
- formData = _this$props5.formData,
1421
- errorSchema = _this$props5.errorSchema,
1422
- idSchema = _this$props5.idSchema,
1423
- name = _this$props5.name,
1424
- _this$props5$required = _this$props5.required,
1425
- required = _this$props5$required === void 0 ? false : _this$props5$required,
1426
- _this$props5$disabled = _this$props5.disabled,
1427
- disabled = _this$props5$disabled === void 0 ? false : _this$props5$disabled,
1428
- _this$props5$readonly = _this$props5.readonly,
1429
- readonly = _this$props5$readonly === void 0 ? false : _this$props5$readonly,
1430
- hideError = _this$props5.hideError,
1431
- idPrefix = _this$props5.idPrefix,
1432
- idSeparator = _this$props5.idSeparator,
1433
- onBlur = _this$props5.onBlur,
1434
- onFocus = _this$props5.onFocus,
1435
- registry = _this$props5.registry;
1450
+ var _this$props6 = this.props,
1451
+ rawSchema = _this$props6.schema,
1452
+ _this$props6$uiSchema = _this$props6.uiSchema,
1453
+ uiSchema = _this$props6$uiSchema === void 0 ? {} : _this$props6$uiSchema,
1454
+ formData = _this$props6.formData,
1455
+ errorSchema = _this$props6.errorSchema,
1456
+ idSchema = _this$props6.idSchema,
1457
+ name = _this$props6.name,
1458
+ _this$props6$required = _this$props6.required,
1459
+ required = _this$props6$required === void 0 ? false : _this$props6$required,
1460
+ _this$props6$disabled = _this$props6.disabled,
1461
+ disabled = _this$props6$disabled === void 0 ? false : _this$props6$disabled,
1462
+ _this$props6$readonly = _this$props6.readonly,
1463
+ readonly = _this$props6$readonly === void 0 ? false : _this$props6$readonly,
1464
+ hideError = _this$props6.hideError,
1465
+ idPrefix = _this$props6.idPrefix,
1466
+ idSeparator = _this$props6.idSeparator,
1467
+ onBlur = _this$props6.onBlur,
1468
+ onFocus = _this$props6.onFocus,
1469
+ registry = _this$props6.registry;
1436
1470
  var fields = registry.fields,
1437
1471
  formContext = registry.formContext,
1438
- schemaUtils = registry.schemaUtils;
1472
+ schemaUtils = registry.schemaUtils,
1473
+ translateString = registry.translateString;
1439
1474
  var SchemaField = fields.SchemaField;
1440
1475
  var schema = schemaUtils.retrieveSchema(rawSchema, formData);
1441
1476
  var uiOptions = utils.getUiOptions(uiSchema);
1442
1477
  var _schema$properties = schema.properties,
1443
1478
  schemaProperties = _schema$properties === void 0 ? {} : _schema$properties;
1444
- var title = schema.title === undefined ? name : schema.title;
1479
+ var title = uiOptions.title || (schema.title === undefined ? name : schema.title);
1445
1480
  var description = uiOptions.description || schema.description;
1446
1481
  var orderedProperties;
1447
1482
  try {
@@ -1449,14 +1484,14 @@ var ObjectField = /*#__PURE__*/function (_Component) {
1449
1484
  orderedProperties = utils.orderProperties(properties, uiOptions.order);
1450
1485
  } catch (err) {
1451
1486
  return jsxRuntime.jsxs("div", {
1452
- children: [jsxRuntime.jsxs("p", {
1487
+ children: [jsxRuntime.jsx("p", {
1453
1488
  className: 'config-error',
1454
1489
  style: {
1455
1490
  color: 'red'
1456
1491
  },
1457
- children: ["Invalid ", name || 'root', " object field configuration:", jsxRuntime.jsx("em", {
1458
- children: err.message
1459
- }), "."]
1492
+ children: jsxRuntime.jsx(Markdown__default["default"], {
1493
+ children: translateString(utils.TranslatableString.InvalidObjectField, [name || 'root', err.message])
1494
+ })
1460
1495
  }), jsxRuntime.jsx("pre", {
1461
1496
  children: JSON.stringify(schema)
1462
1497
  })]
@@ -1464,7 +1499,7 @@ var ObjectField = /*#__PURE__*/function (_Component) {
1464
1499
  }
1465
1500
  var Template = utils.getTemplate('ObjectFieldTemplate', registry, uiOptions);
1466
1501
  var templateProps = {
1467
- title: uiOptions.title || title,
1502
+ title: title,
1468
1503
  description: description,
1469
1504
  properties: orderedProperties.map(function (name) {
1470
1505
  var addedByAdditionalProperties = has__default["default"](schema, [utils.PROPERTIES_KEY, name, utils.ADDITIONAL_PROPERTY_FLAG]);
@@ -1592,8 +1627,9 @@ function SchemaFieldRender(props) {
1592
1627
  _props$wasPropertyKey = props.wasPropertyKeyModified,
1593
1628
  wasPropertyKeyModified = _props$wasPropertyKey === void 0 ? false : _props$wasPropertyKey;
1594
1629
  var formContext = registry.formContext,
1595
- schemaUtils = registry.schemaUtils;
1596
- var uiOptions = utils.getUiOptions(uiSchema);
1630
+ schemaUtils = registry.schemaUtils,
1631
+ globalUiOptions = registry.globalUiOptions;
1632
+ var uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
1597
1633
  var FieldTemplate = utils.getTemplate('FieldTemplate', registry, uiOptions);
1598
1634
  var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
1599
1635
  var FieldHelpTemplate = utils.getTemplate('FieldHelpTemplate', registry, uiOptions);
@@ -1618,7 +1654,7 @@ function SchemaFieldRender(props) {
1618
1654
  if (Object.keys(schema).length === 0) {
1619
1655
  return null;
1620
1656
  }
1621
- var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
1657
+ var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
1622
1658
  var _ref = errorSchema || {},
1623
1659
  __errors = _ref.__errors,
1624
1660
  fieldErrorSchema = _objectWithoutPropertiesLoose(_ref, _excluded$6);
@@ -1915,13 +1951,16 @@ function ArrayFieldItemTemplate(props) {
1915
1951
  hasMoveDown = props.hasMoveDown,
1916
1952
  hasMoveUp = props.hasMoveUp,
1917
1953
  hasRemove = props.hasRemove,
1954
+ hasCopy = props.hasCopy,
1918
1955
  index = props.index,
1956
+ onCopyIndexClick = props.onCopyIndexClick,
1919
1957
  onDropIndexClick = props.onDropIndexClick,
1920
1958
  onReorderClick = props.onReorderClick,
1921
1959
  readonly = props.readonly,
1922
1960
  registry = props.registry,
1923
1961
  uiSchema = props.uiSchema;
1924
1962
  var _registry$templates$B = registry.templates.ButtonTemplates,
1963
+ CopyButton = _registry$templates$B.CopyButton,
1925
1964
  MoveDownButton = _registry$templates$B.MoveDownButton,
1926
1965
  MoveUpButton = _registry$templates$B.MoveUpButton,
1927
1966
  RemoveButton = _registry$templates$B.RemoveButton;
@@ -1956,6 +1995,12 @@ function ArrayFieldItemTemplate(props) {
1956
1995
  onClick: onReorderClick(index, index + 1),
1957
1996
  uiSchema: uiSchema,
1958
1997
  registry: registry
1998
+ }), hasCopy && jsxRuntime.jsx(CopyButton, {
1999
+ style: btnStyle,
2000
+ disabled: disabled || readonly,
2001
+ onClick: onCopyIndexClick(index),
2002
+ uiSchema: uiSchema,
2003
+ registry: registry
1959
2004
  }), hasRemove && jsxRuntime.jsx(RemoveButton, {
1960
2005
  style: btnStyle,
1961
2006
  disabled: disabled || readonly,
@@ -2164,6 +2209,15 @@ function IconButton(props) {
2164
2209
  })
2165
2210
  }));
2166
2211
  }
2212
+ function CopyButton(props) {
2213
+ var translateString = props.registry.translateString;
2214
+ return jsxRuntime.jsx(IconButton, _extends({
2215
+ title: translateString(utils.TranslatableString.CopyButton),
2216
+ className: 'array-item-copy'
2217
+ }, props, {
2218
+ icon: 'copy'
2219
+ }));
2220
+ }
2167
2221
  function MoveDownButton(props) {
2168
2222
  var translateString = props.registry.translateString;
2169
2223
  return jsxRuntime.jsx(IconButton, _extends({
@@ -2222,6 +2276,7 @@ function buttonTemplates() {
2222
2276
  return {
2223
2277
  SubmitButton: SubmitButton,
2224
2278
  AddButton: AddButton,
2279
+ CopyButton: CopyButton,
2225
2280
  MoveDownButton: MoveDownButton,
2226
2281
  MoveUpButton: MoveUpButton,
2227
2282
  RemoveButton: RemoveButton
@@ -2703,22 +2758,25 @@ function AltDateWidget(_ref2) {
2703
2758
  onChange = _ref2.onChange,
2704
2759
  value = _ref2.value;
2705
2760
  var translateString = registry.translateString;
2761
+ var _useState = react.useState(value),
2762
+ lastValue = _useState[0],
2763
+ setLastValue = _useState[1];
2706
2764
  var _useReducer = react.useReducer(function (state, action) {
2707
2765
  return _extends({}, state, action);
2708
2766
  }, utils.parseDateString(value, time)),
2709
2767
  state = _useReducer[0],
2710
2768
  setState = _useReducer[1];
2711
2769
  react.useEffect(function () {
2712
- if (value && value !== utils.toDateString(state, time)) {
2770
+ var stateValue = utils.toDateString(state, time);
2771
+ if (readyForChange(state) && stateValue !== value) {
2772
+ // The user changed the date to a new valid data via the comboboxes, so call onChange
2773
+ onChange(stateValue);
2774
+ } else if (lastValue !== value) {
2775
+ // We got a new value in the props
2776
+ setLastValue(value);
2713
2777
  setState(utils.parseDateString(value, time));
2714
2778
  }
2715
- }, [value, state, time]);
2716
- react.useEffect(function () {
2717
- if (readyForChange(state)) {
2718
- // Only propagate to parent state if we have a complete date{time}
2719
- onChange(utils.toDateString(state, time));
2720
- }
2721
- }, [state, time, onChange]);
2779
+ }, [time, value, onChange, state, lastValue]);
2722
2780
  var handleChange = react.useCallback(function (property, value) {
2723
2781
  var _setState;
2724
2782
  setState((_setState = {}, _setState[property] = value, _setState));
@@ -2728,17 +2786,16 @@ function AltDateWidget(_ref2) {
2728
2786
  if (disabled || readonly) {
2729
2787
  return;
2730
2788
  }
2731
- var nowDateObj = utils.parseDateString(new Date().toJSON(), time);
2732
- setState(nowDateObj);
2789
+ var nextState = utils.parseDateString(new Date().toJSON(), time);
2790
+ onChange(utils.toDateString(nextState, time));
2733
2791
  }, [disabled, readonly, time]);
2734
2792
  var handleClear = react.useCallback(function (event) {
2735
2793
  event.preventDefault();
2736
2794
  if (disabled || readonly) {
2737
2795
  return;
2738
2796
  }
2739
- setState(utils.parseDateString('', time));
2740
2797
  onChange(undefined);
2741
- }, [disabled, readonly, time, onChange]);
2798
+ }, [disabled, readonly, onChange]);
2742
2799
  return jsxRuntime.jsxs("ul", {
2743
2800
  className: 'list-inline',
2744
2801
  children: [dateElementProps(state, time, options.yearsRange).map(function (elemProps, i) {
@@ -3382,6 +3439,26 @@ function TextWidget(props) {
3382
3439
  return jsxRuntime.jsx(BaseInputTemplate, _extends({}, props));
3383
3440
  }
3384
3441
 
3442
+ /** The `TimeWidget` component uses the `BaseInputTemplate` changing the type to `time` and transforms
3443
+ * the value to undefined when it is falsy during the `onChange` handling.
3444
+ *
3445
+ * @param props - The `WidgetProps` for this component
3446
+ */
3447
+ function TimeWidget(props) {
3448
+ var onChange = props.onChange,
3449
+ options = props.options,
3450
+ registry = props.registry;
3451
+ var BaseInputTemplate = utils.getTemplate('BaseInputTemplate', registry, options);
3452
+ var handleChange = react.useCallback(function (value) {
3453
+ return onChange(value ? value + ":00" : undefined);
3454
+ }, [onChange]);
3455
+ return jsxRuntime.jsx(BaseInputTemplate, _extends({
3456
+ type: 'time'
3457
+ }, props, {
3458
+ onChange: handleChange
3459
+ }));
3460
+ }
3461
+
3385
3462
  /** The `URLWidget` component uses the `BaseInputTemplate` changing the type to `url`.
3386
3463
  *
3387
3464
  * @param props - The `WidgetProps` for this component
@@ -3410,24 +3487,25 @@ function UpDownWidget(props) {
3410
3487
 
3411
3488
  function widgets() {
3412
3489
  return {
3490
+ AltDateWidget: AltDateWidget,
3491
+ AltDateTimeWidget: AltDateTimeWidget,
3492
+ CheckboxWidget: CheckboxWidget,
3493
+ CheckboxesWidget: CheckboxesWidget,
3494
+ ColorWidget: ColorWidget,
3495
+ DateWidget: DateWidget,
3496
+ DateTimeWidget: DateTimeWidget,
3497
+ EmailWidget: EmailWidget,
3498
+ FileWidget: FileWidget,
3499
+ HiddenWidget: HiddenWidget,
3413
3500
  PasswordWidget: PasswordWidget,
3414
3501
  RadioWidget: RadioWidget,
3415
- UpDownWidget: UpDownWidget,
3416
3502
  RangeWidget: RangeWidget,
3417
3503
  SelectWidget: SelectWidget,
3418
3504
  TextWidget: TextWidget,
3419
- DateWidget: DateWidget,
3420
- DateTimeWidget: DateTimeWidget,
3421
- AltDateWidget: AltDateWidget,
3422
- AltDateTimeWidget: AltDateTimeWidget,
3423
- EmailWidget: EmailWidget,
3424
- URLWidget: URLWidget,
3425
3505
  TextareaWidget: TextareaWidget,
3426
- HiddenWidget: HiddenWidget,
3427
- ColorWidget: ColorWidget,
3428
- FileWidget: FileWidget,
3429
- CheckboxWidget: CheckboxWidget,
3430
- CheckboxesWidget: CheckboxesWidget
3506
+ TimeWidget: TimeWidget,
3507
+ UpDownWidget: UpDownWidget,
3508
+ URLWidget: URLWidget
3431
3509
  };
3432
3510
  }
3433
3511
 
@@ -3571,6 +3649,21 @@ var Form = /*#__PURE__*/function (_Component) {
3571
3649
  return onChange && onChange(_extends({}, _this.state, state), id);
3572
3650
  });
3573
3651
  };
3652
+ _this.reset = function () {
3653
+ var onChange = _this.props.onChange;
3654
+ var newState = _this.getStateFromProps(_this.props, undefined);
3655
+ var newFormData = newState.formData;
3656
+ var state = {
3657
+ formData: newFormData,
3658
+ errorSchema: {},
3659
+ errors: [],
3660
+ schemaValidationErrors: [],
3661
+ schemaValidationErrorSchema: {}
3662
+ };
3663
+ _this.setState(state, function () {
3664
+ return onChange && onChange(_extends({}, _this.state, state));
3665
+ });
3666
+ };
3574
3667
  _this.onBlur = function (id, data) {
3575
3668
  var onBlur = _this.props.onBlur;
3576
3669
  if (onBlur) {
@@ -3784,7 +3877,10 @@ var Form = /*#__PURE__*/function (_Component) {
3784
3877
  /** Returns the registry for the form */
3785
3878
  _proto.getRegistry = function getRegistry() {
3786
3879
  var _this$props$templates;
3787
- var customTranslateString = this.props.translateString;
3880
+ var _this$props4 = this.props,
3881
+ customTranslateString = _this$props4.translateString,
3882
+ _this$props4$uiSchema = _this$props4.uiSchema,
3883
+ uiSchema = _this$props4$uiSchema === void 0 ? {} : _this$props4$uiSchema;
3788
3884
  var schemaUtils = this.state.schemaUtils;
3789
3885
  var _getDefaultRegistry = getDefaultRegistry(),
3790
3886
  fields = _getDefaultRegistry.fields,
@@ -3801,7 +3897,8 @@ var Form = /*#__PURE__*/function (_Component) {
3801
3897
  rootSchema: this.props.schema,
3802
3898
  formContext: this.props.formContext || formContext,
3803
3899
  schemaUtils: schemaUtils,
3804
- translateString: customTranslateString || translateString
3900
+ translateString: customTranslateString || translateString,
3901
+ globalUiOptions: uiSchema[utils.UI_GLOBAL_OPTIONS_KEY]
3805
3902
  };
3806
3903
  }
3807
3904
  /** Provides a function that can be used to programmatically submit the `Form` */;
@@ -3820,11 +3917,11 @@ var Form = /*#__PURE__*/function (_Component) {
3820
3917
  * @param error - The error on which to focus
3821
3918
  */;
3822
3919
  _proto.focusOnError = function focusOnError(error) {
3823
- var _this$props4 = this.props,
3824
- _this$props4$idPrefix = _this$props4.idPrefix,
3825
- idPrefix = _this$props4$idPrefix === void 0 ? 'root' : _this$props4$idPrefix,
3826
- _this$props4$idSepara = _this$props4.idSeparator,
3827
- idSeparator = _this$props4$idSepara === void 0 ? '_' : _this$props4$idSepara;
3920
+ var _this$props5 = this.props,
3921
+ _this$props5$idPrefix = _this$props5.idPrefix,
3922
+ idPrefix = _this$props5$idPrefix === void 0 ? 'root' : _this$props5$idPrefix,
3923
+ _this$props5$idSepara = _this$props5.idSeparator,
3924
+ idSeparator = _this$props5$idSepara === void 0 ? '_' : _this$props5$idSepara;
3828
3925
  var property = error.property;
3829
3926
  var path = _toPath__default["default"](property);
3830
3927
  if (path[0] === '') {
@@ -3850,10 +3947,10 @@ var Form = /*#__PURE__*/function (_Component) {
3850
3947
  * @returns - True if the form is valid, false otherwise.
3851
3948
  */;
3852
3949
  _proto.validateForm = function validateForm() {
3853
- var _this$props5 = this.props,
3854
- extraErrors = _this$props5.extraErrors,
3855
- focusOnFirstError = _this$props5.focusOnFirstError,
3856
- onError = _this$props5.onError;
3950
+ var _this$props6 = this.props,
3951
+ extraErrors = _this$props6.extraErrors,
3952
+ focusOnFirstError = _this$props6.focusOnFirstError,
3953
+ onError = _this$props6.onError;
3857
3954
  var formData = this.state.formData;
3858
3955
  var schemaUtils = this.state.schemaUtils;
3859
3956
  var schemaValidation = this.validate(formData);
@@ -3890,31 +3987,31 @@ var Form = /*#__PURE__*/function (_Component) {
3890
3987
  * needed along with the submit button or any children of the form.
3891
3988
  */;
3892
3989
  _proto.render = function render() {
3893
- var _this$props6 = this.props,
3894
- children = _this$props6.children,
3895
- id = _this$props6.id,
3896
- idPrefix = _this$props6.idPrefix,
3897
- idSeparator = _this$props6.idSeparator,
3898
- _this$props6$classNam = _this$props6.className,
3899
- className = _this$props6$classNam === void 0 ? '' : _this$props6$classNam,
3900
- tagName = _this$props6.tagName,
3901
- name = _this$props6.name,
3902
- method = _this$props6.method,
3903
- target = _this$props6.target,
3904
- action = _this$props6.action,
3905
- autoComplete = _this$props6.autoComplete,
3906
- enctype = _this$props6.enctype,
3907
- acceptcharset = _this$props6.acceptcharset,
3908
- _this$props6$noHtml5V = _this$props6.noHtml5Validate,
3909
- noHtml5Validate = _this$props6$noHtml5V === void 0 ? false : _this$props6$noHtml5V,
3910
- _this$props6$disabled = _this$props6.disabled,
3911
- disabled = _this$props6$disabled === void 0 ? false : _this$props6$disabled,
3912
- _this$props6$readonly = _this$props6.readonly,
3913
- readonly = _this$props6$readonly === void 0 ? false : _this$props6$readonly,
3914
- formContext = _this$props6.formContext,
3915
- _this$props6$showErro = _this$props6.showErrorList,
3916
- showErrorList = _this$props6$showErro === void 0 ? 'top' : _this$props6$showErro,
3917
- _internalFormWrapper = _this$props6._internalFormWrapper;
3990
+ var _this$props7 = this.props,
3991
+ children = _this$props7.children,
3992
+ id = _this$props7.id,
3993
+ idPrefix = _this$props7.idPrefix,
3994
+ idSeparator = _this$props7.idSeparator,
3995
+ _this$props7$classNam = _this$props7.className,
3996
+ className = _this$props7$classNam === void 0 ? '' : _this$props7$classNam,
3997
+ tagName = _this$props7.tagName,
3998
+ name = _this$props7.name,
3999
+ method = _this$props7.method,
4000
+ target = _this$props7.target,
4001
+ action = _this$props7.action,
4002
+ autoComplete = _this$props7.autoComplete,
4003
+ enctype = _this$props7.enctype,
4004
+ acceptcharset = _this$props7.acceptcharset,
4005
+ _this$props7$noHtml5V = _this$props7.noHtml5Validate,
4006
+ noHtml5Validate = _this$props7$noHtml5V === void 0 ? false : _this$props7$noHtml5V,
4007
+ _this$props7$disabled = _this$props7.disabled,
4008
+ disabled = _this$props7$disabled === void 0 ? false : _this$props7$disabled,
4009
+ _this$props7$readonly = _this$props7.readonly,
4010
+ readonly = _this$props7$readonly === void 0 ? false : _this$props7$readonly,
4011
+ formContext = _this$props7.formContext,
4012
+ _this$props7$showErro = _this$props7.showErrorList,
4013
+ showErrorList = _this$props7$showErro === void 0 ? 'top' : _this$props7$showErro,
4014
+ _internalFormWrapper = _this$props7._internalFormWrapper;
3918
4015
  var _this$state4 = this.state,
3919
4016
  schema = _this$state4.schema,
3920
4017
  uiSchema = _this$state4.uiSchema,