@rjsf/utils 5.2.0 → 5.3.0

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.
@@ -17,7 +17,8 @@ var mergeAllOf = require('json-schema-merge-allof');
17
17
  var union = require('lodash/union');
18
18
  var isEqual = require('lodash/isEqual');
19
19
  var cloneDeep = require('lodash/cloneDeep');
20
- var React = require('react');
20
+ var jsxRuntime = require('react/jsx-runtime');
21
+ var react = require('react');
21
22
  var ReactIs = require('react-is');
22
23
 
23
24
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -37,7 +38,6 @@ var mergeAllOf__default = /*#__PURE__*/_interopDefaultLegacy(mergeAllOf);
37
38
  var union__default = /*#__PURE__*/_interopDefaultLegacy(union);
38
39
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
39
40
  var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
40
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
41
  var ReactIs__default = /*#__PURE__*/_interopDefaultLegacy(ReactIs);
42
42
 
43
43
  /** Determines whether a `thing` is an object for the purposes of RSJF. In this case, `thing` is an object if it has
@@ -47,13 +47,13 @@ var ReactIs__default = /*#__PURE__*/_interopDefaultLegacy(ReactIs);
47
47
  * @returns - True if it is a non-null, non-array, non-File object
48
48
  */
49
49
  function isObject(thing) {
50
- if (typeof File !== "undefined" && thing instanceof File) {
50
+ if (typeof File !== 'undefined' && thing instanceof File) {
51
51
  return false;
52
52
  }
53
- if (typeof Date !== "undefined" && thing instanceof Date) {
53
+ if (typeof Date !== 'undefined' && thing instanceof Date) {
54
54
  return false;
55
55
  }
56
- return typeof thing === "object" && thing !== null && !Array.isArray(thing);
56
+ return typeof thing === 'object' && thing !== null && !Array.isArray(thing);
57
57
  }
58
58
 
59
59
  /** Checks the schema to see if it is allowing additional items, by verifying that `schema.additionalItems` is an
@@ -64,7 +64,7 @@ function isObject(thing) {
64
64
  */
65
65
  function allowAdditionalItems(schema) {
66
66
  if (schema.additionalItems === true) {
67
- console.warn("additionalItems=true is currently not supported");
67
+ console.warn('additionalItems=true is currently not supported');
68
68
  }
69
69
  return isObject(schema.additionalItems);
70
70
  }
@@ -79,7 +79,7 @@ function allowAdditionalItems(schema) {
79
79
  * @returns - The `value` converted to a number when appropriate, otherwise the `value`
80
80
  */
81
81
  function asNumber(value) {
82
- if (value === "") {
82
+ if (value === '') {
83
83
  return undefined;
84
84
  }
85
85
  if (value === null) {
@@ -101,7 +101,7 @@ function asNumber(value) {
101
101
  return value;
102
102
  }
103
103
  var n = Number(value);
104
- var valid = typeof n === "number" && !Number.isNaN(n);
104
+ var valid = typeof n === 'number' && !Number.isNaN(n);
105
105
  return valid ? n : value;
106
106
  }
107
107
 
@@ -171,53 +171,58 @@ function _toPropertyKey(arg) {
171
171
  * `RJSF_ADDITONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()`
172
172
  * utility.
173
173
  */
174
- var ADDITIONAL_PROPERTY_FLAG = "__additional_property";
175
- var ADDITIONAL_PROPERTIES_KEY = "additionalProperties";
176
- var ALL_OF_KEY = "allOf";
177
- var ANY_OF_KEY = "anyOf";
178
- var CONST_KEY = "const";
179
- var DEFAULT_KEY = "default";
180
- var DEFINITIONS_KEY = "definitions";
181
- var DEPENDENCIES_KEY = "dependencies";
182
- var ENUM_KEY = "enum";
183
- var ERRORS_KEY = "__errors";
184
- var ID_KEY = "$id";
185
- var ITEMS_KEY = "items";
186
- var NAME_KEY = "$name";
187
- var ONE_OF_KEY = "oneOf";
188
- var PROPERTIES_KEY = "properties";
189
- var REQUIRED_KEY = "required";
190
- var SUBMIT_BTN_OPTIONS_KEY = "submitButtonOptions";
191
- var REF_KEY = "$ref";
192
- var RJSF_ADDITONAL_PROPERTIES_FLAG = "__rjsf_additionalProperties";
193
- var UI_FIELD_KEY = "ui:field";
194
- var UI_WIDGET_KEY = "ui:widget";
195
- var UI_OPTIONS_KEY = "ui:options";
174
+ var ADDITIONAL_PROPERTY_FLAG = '__additional_property';
175
+ var ADDITIONAL_PROPERTIES_KEY = 'additionalProperties';
176
+ var ALL_OF_KEY = 'allOf';
177
+ var ANY_OF_KEY = 'anyOf';
178
+ var CONST_KEY = 'const';
179
+ var DEFAULT_KEY = 'default';
180
+ var DEFINITIONS_KEY = 'definitions';
181
+ var DEPENDENCIES_KEY = 'dependencies';
182
+ var ENUM_KEY = 'enum';
183
+ var ERRORS_KEY = '__errors';
184
+ var ID_KEY = '$id';
185
+ var ITEMS_KEY = 'items';
186
+ var NAME_KEY = '$name';
187
+ var ONE_OF_KEY = 'oneOf';
188
+ var PROPERTIES_KEY = 'properties';
189
+ var REQUIRED_KEY = 'required';
190
+ var SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';
191
+ var REF_KEY = '$ref';
192
+ var RJSF_ADDITONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';
193
+ var UI_FIELD_KEY = 'ui:field';
194
+ var UI_WIDGET_KEY = 'ui:widget';
195
+ var UI_OPTIONS_KEY = 'ui:options';
196
+ var UI_GLOBAL_OPTIONS_KEY = 'ui:globalOptions';
196
197
 
197
198
  /** Get all passed options from ui:options, and ui:<optionName>, returning them in an object with the `ui:`
198
- * stripped off.
199
+ * stripped off. Any `globalOptions` will always be returned, unless they are overridden by options in the `uiSchema`.
199
200
  *
200
201
  * @param [uiSchema={}] - The UI Schema from which to get any `ui:xxx` options
201
- * @returns - An object containing all the `ui:xxx` options with the stripped off
202
+ * @param [globalOptions={}] - The optional Global UI Schema from which to get any fallback `xxx` options
203
+ * @returns - An object containing all the `ui:xxx` options with the `ui:` stripped off along with all `globalOptions`
202
204
  */
203
- function getUiOptions(uiSchema) {
205
+ function getUiOptions(uiSchema, globalOptions) {
204
206
  if (uiSchema === void 0) {
205
207
  uiSchema = {};
206
208
  }
209
+ if (globalOptions === void 0) {
210
+ globalOptions = {};
211
+ }
207
212
  return Object.keys(uiSchema).filter(function (key) {
208
- return key.indexOf("ui:") === 0;
213
+ return key.indexOf('ui:') === 0;
209
214
  }).reduce(function (options, key) {
210
215
  var _extends2;
211
216
  var value = uiSchema[key];
212
217
  if (key === UI_WIDGET_KEY && isObject(value)) {
213
- console.error("Setting options via ui:widget object is no longer supported, use ui:options instead");
218
+ console.error('Setting options via ui:widget object is no longer supported, use ui:options instead');
214
219
  return options;
215
220
  }
216
221
  if (key === UI_OPTIONS_KEY && isObject(value)) {
217
222
  return _extends({}, options, value);
218
223
  }
219
224
  return _extends({}, options, (_extends2 = {}, _extends2[key.substring(3)] = value, _extends2));
220
- }, {});
225
+ }, _extends({}, globalOptions));
221
226
  }
222
227
 
223
228
  /** Checks whether the field described by `schema`, having the `uiSchema` and `formData` supports expanding. The UI for
@@ -259,7 +264,7 @@ function canExpand(schema, uiSchema, formData) {
259
264
  */
260
265
  function deepEquals(a, b) {
261
266
  return isEqualWith__default["default"](a, b, function (obj, other) {
262
- if (typeof obj === "function" && typeof other === "function") {
267
+ if (typeof obj === 'function' && typeof other === 'function') {
263
268
  // Assume all functions are equivalent
264
269
  // see https://github.com/rjsf-team/react-jsonschema-form/issues/255
265
270
  return true;
@@ -294,8 +299,8 @@ function findSchemaDefinition($ref, rootSchema) {
294
299
  if (rootSchema === void 0) {
295
300
  rootSchema = {};
296
301
  }
297
- var ref = $ref || "";
298
- if (ref.startsWith("#")) {
302
+ var ref = $ref || '';
303
+ if (ref.startsWith('#')) {
299
304
  // Decode URI fragment representation.
300
305
  ref = decodeURIComponent(ref.substring(1));
301
306
  } else {
@@ -403,25 +408,25 @@ function getFirstMatchingOption(validator, formData, options, rootSchema) {
403
408
  */
404
409
  function guessType(value) {
405
410
  if (Array.isArray(value)) {
406
- return "array";
411
+ return 'array';
407
412
  }
408
- if (typeof value === "string") {
409
- return "string";
413
+ if (typeof value === 'string') {
414
+ return 'string';
410
415
  }
411
416
  if (value == null) {
412
- return "null";
417
+ return 'null';
413
418
  }
414
- if (typeof value === "boolean") {
415
- return "boolean";
419
+ if (typeof value === 'boolean') {
420
+ return 'boolean';
416
421
  }
417
422
  if (!isNaN(value)) {
418
- return "number";
423
+ return 'number';
419
424
  }
420
- if (typeof value === "object") {
421
- return "object";
425
+ if (typeof value === 'object') {
426
+ return 'object';
422
427
  }
423
428
  // Default to string if we can't figure it out
424
- return "string";
429
+ return 'string';
425
430
  }
426
431
 
427
432
  /** Gets the type of a given `schema`. If the type is not explicitly defined, then an attempt is made to infer it from
@@ -441,14 +446,14 @@ function getSchemaType(schema) {
441
446
  return guessType(schema["const"]);
442
447
  }
443
448
  if (!type && schema["enum"]) {
444
- return "string";
449
+ return 'string';
445
450
  }
446
451
  if (!type && (schema.properties || schema.additionalProperties)) {
447
- return "object";
452
+ return 'object';
448
453
  }
449
- if (Array.isArray(type) && type.length === 2 && type.includes("null")) {
454
+ if (Array.isArray(type) && type.length === 2 && type.includes('null')) {
450
455
  type = type.find(function (type) {
451
- return type !== "null";
456
+ return type !== 'null';
452
457
  });
453
458
  }
454
459
  return type;
@@ -469,7 +474,7 @@ function mergeSchemas(obj1, obj2) {
469
474
  right = obj2[key];
470
475
  if (obj1 && key in obj1 && isObject(right)) {
471
476
  acc[key] = mergeSchemas(left, right);
472
- } else if (obj1 && obj2 && (getSchemaType(obj1) === "object" || getSchemaType(obj2) === "object") && key === REQUIRED_KEY && Array.isArray(left) && Array.isArray(right)) {
477
+ } else if (obj1 && obj2 && (getSchemaType(obj1) === 'object' || getSchemaType(obj2) === 'object') && key === REQUIRED_KEY && Array.isArray(left) && Array.isArray(right)) {
473
478
  // Don't include duplicate values when merging 'required' fields.
474
479
  acc[key] = union__default["default"](left, right);
475
480
  } else {
@@ -499,7 +504,7 @@ function resolveCondition(validator, schema, rootSchema, formData) {
499
504
  otherwise = schema["else"],
500
505
  resolvedSchemaLessConditional = _objectWithoutPropertiesLoose(schema, _excluded$1);
501
506
  var conditionalSchema = validator.isValid(expression, formData, rootSchema) ? then : otherwise;
502
- if (conditionalSchema && typeof conditionalSchema !== "boolean") {
507
+ if (conditionalSchema && typeof conditionalSchema !== 'boolean') {
503
508
  return retrieveSchema(validator, mergeSchemas(resolvedSchemaLessConditional, retrieveSchema(validator, conditionalSchema, rootSchema, formData)), rootSchema, formData);
504
509
  }
505
510
  return retrieveSchema(validator, resolvedSchemaLessConditional, rootSchema, formData);
@@ -571,16 +576,16 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
571
576
  return;
572
577
  }
573
578
  var additionalProperties = {};
574
- if (typeof schema.additionalProperties !== "boolean") {
579
+ if (typeof schema.additionalProperties !== 'boolean') {
575
580
  if (REF_KEY in schema.additionalProperties) {
576
581
  additionalProperties = retrieveSchema(validator, {
577
582
  $ref: get__default["default"](schema.additionalProperties, [REF_KEY])
578
583
  }, rootSchema, formData);
579
- } else if ("type" in schema.additionalProperties) {
584
+ } else if ('type' in schema.additionalProperties) {
580
585
  additionalProperties = _extends({}, schema.additionalProperties);
581
586
  } else if (ANY_OF_KEY in schema.additionalProperties || ONE_OF_KEY in schema.additionalProperties) {
582
587
  additionalProperties = _extends({
583
- type: "object"
588
+ type: 'object'
584
589
  }, schema.additionalProperties);
585
590
  } else {
586
591
  additionalProperties = {
@@ -617,7 +622,7 @@ function retrieveSchema(validator, schema, rootSchema, rawFormData) {
617
622
  return {};
618
623
  }
619
624
  var resolvedSchema = resolveSchema(validator, schema, rootSchema, rawFormData);
620
- if ("if" in schema) {
625
+ if ('if' in schema) {
621
626
  return resolveCondition(validator, schema, rootSchema, rawFormData);
622
627
  }
623
628
  var formData = rawFormData || {};
@@ -627,7 +632,7 @@ function retrieveSchema(validator, schema, rootSchema, rawFormData) {
627
632
  deep: false
628
633
  });
629
634
  } catch (e) {
630
- console.warn("could not merge subschemas in allOf:\n" + e);
635
+ console.warn('could not merge subschemas in allOf:\n' + e);
631
636
  var _resolvedSchema = resolvedSchema,
632
637
  resolvedSchemaWithoutAllOf = _objectWithoutPropertiesLoose(_resolvedSchema, _excluded3);
633
638
  return resolvedSchemaWithoutAllOf;
@@ -728,7 +733,7 @@ function withDependentSchema(validator, schema, rootSchema, dependencyKey, depen
728
733
  }
729
734
  // Resolve $refs inside oneOf.
730
735
  var resolvedOneOf = oneOf.map(function (subschema) {
731
- if (typeof subschema === "boolean" || !(REF_KEY in subschema)) {
736
+ if (typeof subschema === 'boolean' || !(REF_KEY in subschema)) {
732
737
  return subschema;
733
738
  }
734
739
  return resolveReference(validator, subschema, rootSchema, formData);
@@ -747,14 +752,14 @@ function withDependentSchema(validator, schema, rootSchema, dependencyKey, depen
747
752
  */
748
753
  function withExactlyOneSubschema(validator, schema, rootSchema, dependencyKey, oneOf, formData) {
749
754
  var validSubschemas = oneOf.filter(function (subschema) {
750
- if (typeof subschema === "boolean" || !subschema || !subschema.properties) {
755
+ if (typeof subschema === 'boolean' || !subschema || !subschema.properties) {
751
756
  return false;
752
757
  }
753
758
  var conditionPropertySchema = subschema.properties[dependencyKey];
754
759
  if (conditionPropertySchema) {
755
760
  var _properties;
756
761
  var conditionSchema = {
757
- type: "object",
762
+ type: 'object',
758
763
  properties: (_properties = {}, _properties[dependencyKey] = conditionPropertySchema, _properties)
759
764
  };
760
765
  var _validator$validateFo = validator.validateFormData(formData, conditionSchema),
@@ -780,10 +785,10 @@ function withExactlyOneSubschema(validator, schema, rootSchema, dependencyKey, o
780
785
  * the first item
781
786
  */
782
787
  var JUNK_OPTION = {
783
- type: "object",
788
+ type: 'object',
784
789
  properties: {
785
790
  __not_really_there__: {
786
- type: "number"
791
+ type: 'number'
787
792
  }
788
793
  }
789
794
  };
@@ -816,7 +821,7 @@ function calculateIndexScore(validator, rootSchema, schema, formData) {
816
821
  if (isObject__default["default"](schema.properties)) {
817
822
  totalScore += reduce__default["default"](schema.properties, function (score, value, key) {
818
823
  var formValue = get__default["default"](formData, key);
819
- if (typeof value === "boolean") {
824
+ if (typeof value === 'boolean') {
820
825
  return score;
821
826
  }
822
827
  if (has__default["default"](value, REF_KEY)) {
@@ -826,7 +831,7 @@ function calculateIndexScore(validator, rootSchema, schema, formData) {
826
831
  if (has__default["default"](value, ONE_OF_KEY) && formValue) {
827
832
  return score + getClosestMatchingOption(validator, rootSchema, formValue, get__default["default"](value, ONE_OF_KEY));
828
833
  }
829
- if (value.type === "object") {
834
+ if (value.type === 'object') {
830
835
  return score + calculateIndexScore(validator, rootSchema, value, formValue || {});
831
836
  }
832
837
  if (value.type === guessType(formValue)) {
@@ -986,7 +991,7 @@ function mergeObjects(obj1, obj2, concatArrays) {
986
991
  acc[key] = mergeObjects(left, right, concatArrays);
987
992
  } else if (concatArrays && Array.isArray(left) && Array.isArray(right)) {
988
993
  var toMerge = right;
989
- if (concatArrays === "preventDuplicates") {
994
+ if (concatArrays === 'preventDuplicates') {
990
995
  toMerge = right.reduce(function (result, value) {
991
996
  if (!left.includes(value)) {
992
997
  result.push(value);
@@ -1030,7 +1035,7 @@ function isSelect(validator, theSchema, rootSchema) {
1030
1035
  }
1031
1036
  if (Array.isArray(altSchemas)) {
1032
1037
  return altSchemas.every(function (altSchemas) {
1033
- return typeof altSchemas !== "boolean" && isConstant(altSchemas);
1038
+ return typeof altSchemas !== 'boolean' && isConstant(altSchemas);
1034
1039
  });
1035
1040
  }
1036
1041
  return false;
@@ -1044,7 +1049,7 @@ function isSelect(validator, theSchema, rootSchema) {
1044
1049
  * @returns - True if schema contains a multi-select, otherwise false
1045
1050
  */
1046
1051
  function isMultiSelect(validator, schema, rootSchema) {
1047
- if (!schema.uniqueItems || !schema.items || typeof schema.items === "boolean") {
1052
+ if (!schema.uniqueItems || !schema.items || typeof schema.items === 'boolean') {
1048
1053
  return false;
1049
1054
  }
1050
1055
  return isSelect(validator, schema.items, rootSchema);
@@ -1083,11 +1088,11 @@ function getInnerSchemaForArrayItem(schema, additionalItems, idx) {
1083
1088
  if (idx >= 0) {
1084
1089
  if (Array.isArray(schema.items) && idx < schema.items.length) {
1085
1090
  var item = schema.items[idx];
1086
- if (typeof item !== "boolean") {
1091
+ if (typeof item !== 'boolean') {
1087
1092
  return item;
1088
1093
  }
1089
1094
  }
1090
- } else if (schema.items && !Array.isArray(schema.items) && typeof schema.items !== "boolean") {
1095
+ } else if (schema.items && !Array.isArray(schema.items) && typeof schema.items !== 'boolean') {
1091
1096
  return schema.items;
1092
1097
  }
1093
1098
  if (additionalItems !== AdditionalItemsHandling.Ignore && isObject(schema.additionalItems)) {
@@ -1179,12 +1184,12 @@ function computeDefaults(validator, rawSchema, parentDefaults, rootSchema, rawFo
1179
1184
  schema = schema.anyOf[getClosestMatchingOption(validator, rootSchema, isEmpty__default["default"](formData) ? undefined : formData, schema.anyOf, 0)];
1180
1185
  }
1181
1186
  // Not defaults defined for this node, fallback to generic typed ones.
1182
- if (typeof defaults === "undefined") {
1187
+ if (typeof defaults === 'undefined') {
1183
1188
  defaults = schema["default"];
1184
1189
  }
1185
1190
  switch (getSchemaType(schema)) {
1186
1191
  // We need to recur for object schema inner default values.
1187
- case "object":
1192
+ case 'object':
1188
1193
  {
1189
1194
  var objectDefaults = Object.keys(schema.properties || {}).reduce(function (acc, key) {
1190
1195
  // Compute the defaults for this node, with the parent defaults we might
@@ -1204,7 +1209,7 @@ function computeDefaults(validator, rawSchema, parentDefaults, rootSchema, rawFo
1204
1209
  }
1205
1210
  return objectDefaults;
1206
1211
  }
1207
- case "array":
1212
+ case 'array':
1208
1213
  // Inject defaults into existing array defaults
1209
1214
  if (Array.isArray(defaults)) {
1210
1215
  defaults = defaults.map(function (item, idx) {
@@ -1254,11 +1259,11 @@ function getDefaultFormState(validator, theSchema, formData, rootSchema, include
1254
1259
  includeUndefinedValues = false;
1255
1260
  }
1256
1261
  if (!isObject(theSchema)) {
1257
- throw new Error("Invalid schema: " + theSchema);
1262
+ throw new Error('Invalid schema: ' + theSchema);
1258
1263
  }
1259
1264
  var schema = retrieveSchema(validator, theSchema, rootSchema, formData);
1260
1265
  var defaults = computeDefaults(validator, schema, undefined, rootSchema, formData, includeUndefinedValues);
1261
- if (typeof formData === "undefined" || formData === null || typeof formData === "number" && isNaN(formData)) {
1266
+ if (typeof formData === 'undefined' || formData === null || typeof formData === 'number' && isNaN(formData)) {
1262
1267
  // No form data? Use schema defaults.
1263
1268
  return defaults;
1264
1269
  }
@@ -1282,8 +1287,8 @@ function isCustomWidget(uiSchema) {
1282
1287
  }
1283
1288
  return (
1284
1289
  // TODO: Remove the `&& uiSchema['ui:widget'] !== 'hidden'` once we support hidden widgets for arrays.
1285
- // https://react-jsonschema-form.readthedocs.io/en/latest/usage/widgets/#hidden-widgets
1286
- "widget" in getUiOptions(uiSchema) && getUiOptions(uiSchema)["widget"] !== "hidden"
1290
+ // https://rjsf-team.github.io/react-jsonschema-form/docs/usage/widgets/#hidden-widgets
1291
+ 'widget' in getUiOptions(uiSchema) && getUiOptions(uiSchema)['widget'] !== 'hidden'
1287
1292
  );
1288
1293
  }
1289
1294
 
@@ -1299,12 +1304,12 @@ function isFilesArray(validator, schema, uiSchema, rootSchema) {
1299
1304
  if (uiSchema === void 0) {
1300
1305
  uiSchema = {};
1301
1306
  }
1302
- if (uiSchema[UI_WIDGET_KEY] === "files") {
1307
+ if (uiSchema[UI_WIDGET_KEY] === 'files') {
1303
1308
  return true;
1304
1309
  }
1305
1310
  if (schema.items) {
1306
1311
  var itemsSchema = retrieveSchema(validator, schema.items, rootSchema);
1307
- return itemsSchema.type === "string" && itemsSchema.format === "data-url";
1312
+ return itemsSchema.type === 'string' && itemsSchema.format === 'data-url';
1308
1313
  }
1309
1314
  return false;
1310
1315
  }
@@ -1316,24 +1321,25 @@ function isFilesArray(validator, schema, uiSchema, rootSchema) {
1316
1321
  * @param schema - The schema for which the display label flag is desired
1317
1322
  * @param [uiSchema={}] - The UI schema from which to derive potentially displayable information
1318
1323
  * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
1324
+ * @param [globalOptions={}] - The optional Global UI Schema from which to get any fallback `xxx` options
1319
1325
  * @returns - True if the label should be displayed or false if it should not
1320
1326
  */
1321
- function getDisplayLabel(validator, schema, uiSchema, rootSchema) {
1327
+ function getDisplayLabel(validator, schema, uiSchema, rootSchema, globalOptions) {
1322
1328
  if (uiSchema === void 0) {
1323
1329
  uiSchema = {};
1324
1330
  }
1325
- var uiOptions = getUiOptions(uiSchema);
1331
+ var uiOptions = getUiOptions(uiSchema, globalOptions);
1326
1332
  var _uiOptions$label = uiOptions.label,
1327
1333
  label = _uiOptions$label === void 0 ? true : _uiOptions$label;
1328
1334
  var displayLabel = !!label;
1329
1335
  var schemaType = getSchemaType(schema);
1330
- if (schemaType === "array") {
1336
+ if (schemaType === 'array') {
1331
1337
  displayLabel = isMultiSelect(validator, schema, rootSchema) || isFilesArray(validator, schema, uiSchema, rootSchema) || isCustomWidget(uiSchema);
1332
1338
  }
1333
- if (schemaType === "object") {
1339
+ if (schemaType === 'object') {
1334
1340
  displayLabel = false;
1335
1341
  }
1336
- if (schemaType === "boolean" && !uiSchema[UI_WIDGET_KEY]) {
1342
+ if (schemaType === 'boolean' && !uiSchema[UI_WIDGET_KEY]) {
1337
1343
  displayLabel = false;
1338
1344
  }
1339
1345
  if (uiSchema[UI_FIELD_KEY]) {
@@ -1370,7 +1376,7 @@ function mergeValidationData(validator, validationData, additionalErrorSchema) {
1370
1376
  };
1371
1377
  }
1372
1378
 
1373
- var NO_VALUE = /*#__PURE__*/Symbol("no Value");
1379
+ var NO_VALUE = /*#__PURE__*/Symbol('no Value');
1374
1380
  /** Sanitize the `data` associated with the `oldSchema` so it is considered appropriate for the `newSchema`. If the new
1375
1381
  * schema does not contain any properties, then `undefined` is returned to clear all the form data. Due to the nature
1376
1382
  * of schemas, this sanitization happens recursively for nested objects of data. Also, any properties in the old schema
@@ -1451,8 +1457,8 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1451
1457
  newKeyedSchema = retrieveSchema(validator, newKeyedSchema, rootSchema, formValue);
1452
1458
  }
1453
1459
  // Now get types and see if they are the same
1454
- var oldSchemaTypeForKey = get__default["default"](oldKeyedSchema, "type");
1455
- var newSchemaTypeForKey = get__default["default"](newKeyedSchema, "type");
1460
+ var oldSchemaTypeForKey = get__default["default"](oldKeyedSchema, 'type');
1461
+ var newSchemaTypeForKey = get__default["default"](newKeyedSchema, 'type');
1456
1462
  // Check if the old option has the same key with the same type
1457
1463
  if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
1458
1464
  if (has__default["default"](removeOldSchemaData, key)) {
@@ -1460,10 +1466,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1460
1466
  delete removeOldSchemaData[key];
1461
1467
  }
1462
1468
  // If it is an object, we'll recurse and store the resulting sanitized data for the key
1463
- if (newSchemaTypeForKey === "object" || newSchemaTypeForKey === "array" && Array.isArray(formValue)) {
1469
+ if (newSchemaTypeForKey === 'object' || newSchemaTypeForKey === 'array' && Array.isArray(formValue)) {
1464
1470
  // SIDE-EFFECT: process the new schema type of object recursively to save iterations
1465
1471
  var itemData = sanitizeDataForNewSchema(validator, rootSchema, newKeyedSchema, oldKeyedSchema, formValue);
1466
- if (itemData !== undefined || newSchemaTypeForKey === "array") {
1472
+ if (itemData !== undefined || newSchemaTypeForKey === 'array') {
1467
1473
  // only put undefined values for the array type and not the object type
1468
1474
  nestedData[key] = itemData;
1469
1475
  }
@@ -1471,19 +1477,19 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1471
1477
  // Ok, the non-object types match, let's make sure that a default or a const of a different value is replaced
1472
1478
  // with the new default or const. This allows the case where two schemas differ that only by the default/const
1473
1479
  // value to be properly selected
1474
- var newOptionDefault = get__default["default"](newKeyedSchema, "default", NO_VALUE);
1475
- var oldOptionDefault = get__default["default"](oldKeyedSchema, "default", NO_VALUE);
1480
+ var newOptionDefault = get__default["default"](newKeyedSchema, 'default', NO_VALUE);
1481
+ var oldOptionDefault = get__default["default"](oldKeyedSchema, 'default', NO_VALUE);
1476
1482
  if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
1477
1483
  if (oldOptionDefault === formValue) {
1478
1484
  // If the old default matches the formValue, we'll update the new value to match the new default
1479
1485
  removeOldSchemaData[key] = newOptionDefault;
1480
- } else if (get__default["default"](newKeyedSchema, "readOnly") === true) {
1486
+ } else if (get__default["default"](newKeyedSchema, 'readOnly') === true) {
1481
1487
  // If the new schema has the default set to read-only, treat it like a const and remove the value
1482
1488
  removeOldSchemaData[key] = undefined;
1483
1489
  }
1484
1490
  }
1485
- var newOptionConst = get__default["default"](newKeyedSchema, "const", NO_VALUE);
1486
- var oldOptionConst = get__default["default"](oldKeyedSchema, "const", NO_VALUE);
1491
+ var newOptionConst = get__default["default"](newKeyedSchema, 'const', NO_VALUE);
1492
+ var oldOptionConst = get__default["default"](oldKeyedSchema, 'const', NO_VALUE);
1487
1493
  if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
1488
1494
  // Since this is a const, if the old value matches, replace the value with the new const otherwise clear it
1489
1495
  removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : undefined;
@@ -1493,12 +1499,12 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1493
1499
  });
1494
1500
  newFormData = _extends({}, data, removeOldSchemaData, nestedData);
1495
1501
  // First apply removing the old schema data, then apply the nested data, then apply the old data keys to keep
1496
- } else if (get__default["default"](oldSchema, "type") === "array" && get__default["default"](newSchema, "type") === "array" && Array.isArray(data)) {
1497
- var oldSchemaItems = get__default["default"](oldSchema, "items");
1498
- var newSchemaItems = get__default["default"](newSchema, "items");
1502
+ } else if (get__default["default"](oldSchema, 'type') === 'array' && get__default["default"](newSchema, 'type') === 'array' && Array.isArray(data)) {
1503
+ var oldSchemaItems = get__default["default"](oldSchema, 'items');
1504
+ var newSchemaItems = get__default["default"](newSchema, 'items');
1499
1505
  // If any of the array types `items` are arrays (remember arrays are objects) then we'll just drop the data
1500
1506
  // Eventually, we may want to deal with when either of the `items` are arrays since those tuple validations
1501
- if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
1507
+ if (typeof oldSchemaItems === 'object' && typeof newSchemaItems === 'object' && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
1502
1508
  if (has__default["default"](oldSchemaItems, REF_KEY)) {
1503
1509
  oldSchemaItems = retrieveSchema(validator, oldSchemaItems, rootSchema, data);
1504
1510
  }
@@ -1506,12 +1512,12 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1506
1512
  newSchemaItems = retrieveSchema(validator, newSchemaItems, rootSchema, data);
1507
1513
  }
1508
1514
  // Now get types and see if they are the same
1509
- var oldSchemaType = get__default["default"](oldSchemaItems, "type");
1510
- var newSchemaType = get__default["default"](newSchemaItems, "type");
1515
+ var oldSchemaType = get__default["default"](oldSchemaItems, 'type');
1516
+ var newSchemaType = get__default["default"](newSchemaItems, 'type');
1511
1517
  // Check if the old option has the same key with the same type
1512
1518
  if (!oldSchemaType || oldSchemaType === newSchemaType) {
1513
- var maxItems = get__default["default"](newSchema, "maxItems", -1);
1514
- if (newSchemaType === "object") {
1519
+ var maxItems = get__default["default"](newSchema, 'maxItems', -1);
1520
+ if (newSchemaType === 'object') {
1515
1521
  newFormData = data.reduce(function (newValue, aValue) {
1516
1522
  var itemValue = sanitizeDataForNewSchema(validator, rootSchema, newSchemaItems, oldSchemaItems, aValue);
1517
1523
  if (itemValue !== undefined && (maxItems < 0 || newValue.length < maxItems)) {
@@ -1523,7 +1529,7 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1523
1529
  newFormData = maxItems > 0 && data.length > maxItems ? data.slice(0, maxItems) : data;
1524
1530
  }
1525
1531
  }
1526
- } else if (typeof oldSchemaItems === "boolean" && typeof newSchemaItems === "boolean" && oldSchemaItems === newSchemaItems) {
1532
+ } else if (typeof oldSchemaItems === 'boolean' && typeof newSchemaItems === 'boolean' && oldSchemaItems === newSchemaItems) {
1527
1533
  // If they are both booleans and have the same value just return the data as is otherwise fall-thru to undefined
1528
1534
  newFormData = data;
1529
1535
  }
@@ -1546,10 +1552,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1546
1552
  */
1547
1553
  function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix, idSeparator) {
1548
1554
  if (idPrefix === void 0) {
1549
- idPrefix = "root";
1555
+ idPrefix = 'root';
1550
1556
  }
1551
1557
  if (idSeparator === void 0) {
1552
- idSeparator = "_";
1558
+ idSeparator = '_';
1553
1559
  }
1554
1560
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
1555
1561
  var _schema = retrieveSchema(validator, schema, rootSchema, formData);
@@ -1562,7 +1568,7 @@ function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix, idSep
1562
1568
  var idSchema = {
1563
1569
  $id: $id
1564
1570
  };
1565
- if (schema.type === "object" && PROPERTIES_KEY in schema) {
1571
+ if (schema.type === 'object' && PROPERTIES_KEY in schema) {
1566
1572
  for (var name in schema.properties) {
1567
1573
  var field = get__default["default"](schema, [PROPERTIES_KEY, name]);
1568
1574
  var fieldId = idSchema[ID_KEY] + idSeparator + name;
@@ -1587,13 +1593,13 @@ function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix, idSep
1587
1593
  function toPathSchema(validator, schema, name, rootSchema, formData) {
1588
1594
  var _pathSchema;
1589
1595
  if (name === void 0) {
1590
- name = "";
1596
+ name = '';
1591
1597
  }
1592
1598
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
1593
1599
  var _schema = retrieveSchema(validator, schema, rootSchema, formData);
1594
1600
  return toPathSchema(validator, _schema, name, rootSchema, formData);
1595
1601
  }
1596
- var pathSchema = (_pathSchema = {}, _pathSchema[NAME_KEY] = name.replace(/^\./, ""), _pathSchema);
1602
+ var pathSchema = (_pathSchema = {}, _pathSchema[NAME_KEY] = name.replace(/^\./, ''), _pathSchema);
1597
1603
  if (ONE_OF_KEY in schema) {
1598
1604
  var index = getClosestMatchingOption(validator, rootSchema, formData, schema.oneOf, 0);
1599
1605
  var _schema2 = schema.oneOf[index];
@@ -1683,10 +1689,11 @@ var SchemaUtils = /*#__PURE__*/function () {
1683
1689
  *
1684
1690
  * @param schema - The schema for which the display label flag is desired
1685
1691
  * @param [uiSchema] - The UI schema from which to derive potentially displayable information
1692
+ * @param [globalOptions={}] - The optional Global UI Schema from which to get any fallback `xxx` options
1686
1693
  * @returns - True if the label should be displayed or false if it should not
1687
1694
  */;
1688
- _proto.getDisplayLabel = function getDisplayLabel$1(schema, uiSchema) {
1689
- return getDisplayLabel(this.validator, schema, uiSchema, this.rootSchema);
1695
+ _proto.getDisplayLabel = function getDisplayLabel$1(schema, uiSchema, globalOptions) {
1696
+ return getDisplayLabel(this.validator, schema, uiSchema, this.rootSchema, globalOptions);
1690
1697
  }
1691
1698
  /** Determines which of the given `options` provided most closely matches the `formData`.
1692
1699
  * Returns the index of the option that is valid and is the closest match, or 0 if there is no match.
@@ -1796,10 +1803,10 @@ var SchemaUtils = /*#__PURE__*/function () {
1796
1803
  */;
1797
1804
  _proto.toIdSchema = function toIdSchema$1(schema, id, formData, idPrefix, idSeparator) {
1798
1805
  if (idPrefix === void 0) {
1799
- idPrefix = "root";
1806
+ idPrefix = 'root';
1800
1807
  }
1801
1808
  if (idSeparator === void 0) {
1802
- idSeparator = "_";
1809
+ idSeparator = '_';
1803
1810
  }
1804
1811
  return toIdSchema(this.validator, schema, id, this.rootSchema, formData, idPrefix, idSeparator);
1805
1812
  }
@@ -1834,38 +1841,48 @@ function createSchemaUtils(validator, rootSchema) {
1834
1841
  */
1835
1842
  function dataURItoBlob(dataURI) {
1836
1843
  // Split metadata from data
1837
- var splitted = dataURI.split(",");
1844
+ var splitted = dataURI.split(',');
1838
1845
  // Split params
1839
- var params = splitted[0].split(";");
1846
+ var params = splitted[0].split(';');
1840
1847
  // Get mime-type from params
1841
- var type = params[0].replace("data:", "");
1848
+ var type = params[0].replace('data:', '');
1842
1849
  // Filter the name property from params
1843
1850
  var properties = params.filter(function (param) {
1844
- return param.split("=")[0] === "name";
1851
+ return param.split('=')[0] === 'name';
1845
1852
  });
1846
1853
  // Look for the name and use unknown if no name property.
1847
1854
  var name;
1848
1855
  if (properties.length !== 1) {
1849
- name = "unknown";
1856
+ name = 'unknown';
1850
1857
  } else {
1851
1858
  // Because we filtered out the other property,
1852
- // we only have the name case here.
1853
- name = properties[0].split("=")[1];
1859
+ // we only have the name case here, which we decode to make it human-readable
1860
+ name = decodeURI(properties[0].split('=')[1]);
1854
1861
  }
1855
1862
  // Built the Uint8Array Blob parameter from the base64 string.
1856
- var binary = atob(splitted[1]);
1857
- var array = [];
1858
- for (var i = 0; i < binary.length; i++) {
1859
- array.push(binary.charCodeAt(i));
1860
- }
1861
- // Create the blob object
1862
- var blob = new window.Blob([new Uint8Array(array)], {
1863
- type: type
1864
- });
1865
- return {
1866
- blob: blob,
1867
- name: name
1868
- };
1863
+ try {
1864
+ var binary = atob(splitted[1]);
1865
+ var array = [];
1866
+ for (var i = 0; i < binary.length; i++) {
1867
+ array.push(binary.charCodeAt(i));
1868
+ }
1869
+ // Create the blob object
1870
+ var blob = new window.Blob([new Uint8Array(array)], {
1871
+ type: type
1872
+ });
1873
+ return {
1874
+ blob: blob,
1875
+ name: name
1876
+ };
1877
+ } catch (error) {
1878
+ return {
1879
+ blob: {
1880
+ size: 0,
1881
+ type: error.message
1882
+ },
1883
+ name: dataURI
1884
+ };
1885
+ }
1869
1886
  }
1870
1887
 
1871
1888
  /** Potentially substitutes all replaceable parameters with the associated value(s) from the `params` if available. When
@@ -1879,9 +1896,16 @@ function dataURItoBlob(dataURI) {
1879
1896
  function replaceStringParameters(inputString, params) {
1880
1897
  var output = inputString;
1881
1898
  if (Array.isArray(params)) {
1899
+ var parts = output.split(/(%\d)/);
1882
1900
  params.forEach(function (param, index) {
1883
- output = output.replace("%" + (index + 1), param);
1901
+ var partIndex = parts.findIndex(function (part) {
1902
+ return part === "%" + (index + 1);
1903
+ });
1904
+ if (partIndex >= 0) {
1905
+ parts[partIndex] = param;
1906
+ }
1884
1907
  });
1908
+ output = parts.join('');
1885
1909
  }
1886
1910
  return output;
1887
1911
  }
@@ -1921,7 +1945,7 @@ function enumOptionsValueForIndex(valueIndex, allEnumOptions, emptyValue) {
1921
1945
  });
1922
1946
  }
1923
1947
  // So Number(null) and Number('') both return 0, so use emptyValue for those two values
1924
- var index = valueIndex === "" || valueIndex === null ? -1 : Number(valueIndex);
1948
+ var index = valueIndex === '' || valueIndex === null ? -1 : Number(valueIndex);
1925
1949
  var option = allEnumOptions[index];
1926
1950
  return option ? option.value : emptyValue;
1927
1951
  }
@@ -1987,7 +2011,7 @@ function enumOptionsIndexForValue(value, allEnumOptions, multiple) {
1987
2011
  var selectedIndexes = allEnumOptions.map(function (opt, index) {
1988
2012
  return enumOptionsIsSelected(opt.value, value) ? String(index) : undefined;
1989
2013
  }).filter(function (opt) {
1990
- return typeof opt !== "undefined";
2014
+ return typeof opt !== 'undefined';
1991
2015
  });
1992
2016
  if (!multiple) {
1993
2017
  return selectedIndexes[0];
@@ -2055,7 +2079,7 @@ var ErrorSchemaBuilder = /*#__PURE__*/function () {
2055
2079
  * @private
2056
2080
  */
2057
2081
  _proto.getOrCreateErrorBlock = function getOrCreateErrorBlock(pathOfError) {
2058
- var hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === "string";
2082
+ var hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === 'string';
2059
2083
  var errorBlock = hasPath ? get__default["default"](this.errorSchema, pathOfError) : this.errorSchema;
2060
2084
  if (!errorBlock && pathOfError) {
2061
2085
  errorBlock = {};
@@ -2167,23 +2191,23 @@ function getInputProps(schema, defaultType, options, autoDefaultStepAny) {
2167
2191
  autoDefaultStepAny = true;
2168
2192
  }
2169
2193
  var inputProps = _extends({
2170
- type: defaultType || "text"
2194
+ type: defaultType || 'text'
2171
2195
  }, rangeSpec(schema));
2172
2196
  // If options.inputType is set use that as the input type
2173
2197
  if (options.inputType) {
2174
2198
  inputProps.type = options.inputType;
2175
2199
  } else if (!defaultType) {
2176
2200
  // If the schema is of type number or integer, set the input type to number
2177
- if (schema.type === "number") {
2178
- inputProps.type = "number";
2201
+ if (schema.type === 'number') {
2202
+ inputProps.type = 'number';
2179
2203
  // Only add step if one isn't already defined and we are auto-defaulting the "any" step
2180
2204
  if (autoDefaultStepAny && inputProps.step === undefined) {
2181
2205
  // Setting step to 'any' fixes a bug in Safari where decimals are not
2182
2206
  // allowed in number inputs
2183
- inputProps.step = "any";
2207
+ inputProps.step = 'any';
2184
2208
  }
2185
- } else if (schema.type === "integer") {
2186
- inputProps.type = "number";
2209
+ } else if (schema.type === 'integer') {
2210
+ inputProps.type = 'number';
2187
2211
  // Only add step if one isn't already defined
2188
2212
  if (inputProps.step === undefined) {
2189
2213
  // Since this is integer, you always want to step up or down in multiples of 1
@@ -2203,7 +2227,7 @@ var DEFAULT_OPTIONS = {
2203
2227
  props: {
2204
2228
  disabled: false
2205
2229
  },
2206
- submitText: "Submit",
2230
+ submitText: 'Submit',
2207
2231
  norender: false
2208
2232
  };
2209
2233
  /** Extracts any `ui:submitButtonOptions` from the `uiSchema` and merges them onto the `DEFAULT_OPTIONS`
@@ -2236,7 +2260,7 @@ function getTemplate(name, registry, uiOptions) {
2236
2260
  uiOptions = {};
2237
2261
  }
2238
2262
  var templates = registry.templates;
2239
- if (name === "ButtonTemplates") {
2263
+ if (name === 'ButtonTemplates') {
2240
2264
  return templates[name];
2241
2265
  }
2242
2266
  return (
@@ -2251,53 +2275,54 @@ var _excluded = ["options"];
2251
2275
  */
2252
2276
  var widgetMap = {
2253
2277
  "boolean": {
2254
- checkbox: "CheckboxWidget",
2255
- radio: "RadioWidget",
2256
- select: "SelectWidget",
2257
- hidden: "HiddenWidget"
2278
+ checkbox: 'CheckboxWidget',
2279
+ radio: 'RadioWidget',
2280
+ select: 'SelectWidget',
2281
+ hidden: 'HiddenWidget'
2258
2282
  },
2259
2283
  string: {
2260
- text: "TextWidget",
2261
- password: "PasswordWidget",
2262
- email: "EmailWidget",
2263
- hostname: "TextWidget",
2264
- ipv4: "TextWidget",
2265
- ipv6: "TextWidget",
2266
- uri: "URLWidget",
2267
- "data-url": "FileWidget",
2268
- radio: "RadioWidget",
2269
- select: "SelectWidget",
2270
- textarea: "TextareaWidget",
2271
- hidden: "HiddenWidget",
2272
- date: "DateWidget",
2273
- datetime: "DateTimeWidget",
2274
- "date-time": "DateTimeWidget",
2275
- "alt-date": "AltDateWidget",
2276
- "alt-datetime": "AltDateTimeWidget",
2277
- color: "ColorWidget",
2278
- file: "FileWidget"
2284
+ text: 'TextWidget',
2285
+ password: 'PasswordWidget',
2286
+ email: 'EmailWidget',
2287
+ hostname: 'TextWidget',
2288
+ ipv4: 'TextWidget',
2289
+ ipv6: 'TextWidget',
2290
+ uri: 'URLWidget',
2291
+ 'data-url': 'FileWidget',
2292
+ radio: 'RadioWidget',
2293
+ select: 'SelectWidget',
2294
+ textarea: 'TextareaWidget',
2295
+ hidden: 'HiddenWidget',
2296
+ date: 'DateWidget',
2297
+ datetime: 'DateTimeWidget',
2298
+ 'date-time': 'DateTimeWidget',
2299
+ 'alt-date': 'AltDateWidget',
2300
+ 'alt-datetime': 'AltDateTimeWidget',
2301
+ time: 'TimeWidget',
2302
+ color: 'ColorWidget',
2303
+ file: 'FileWidget'
2279
2304
  },
2280
2305
  number: {
2281
- text: "TextWidget",
2282
- select: "SelectWidget",
2283
- updown: "UpDownWidget",
2284
- range: "RangeWidget",
2285
- radio: "RadioWidget",
2286
- hidden: "HiddenWidget"
2306
+ text: 'TextWidget',
2307
+ select: 'SelectWidget',
2308
+ updown: 'UpDownWidget',
2309
+ range: 'RangeWidget',
2310
+ radio: 'RadioWidget',
2311
+ hidden: 'HiddenWidget'
2287
2312
  },
2288
2313
  integer: {
2289
- text: "TextWidget",
2290
- select: "SelectWidget",
2291
- updown: "UpDownWidget",
2292
- range: "RangeWidget",
2293
- radio: "RadioWidget",
2294
- hidden: "HiddenWidget"
2314
+ text: 'TextWidget',
2315
+ select: 'SelectWidget',
2316
+ updown: 'UpDownWidget',
2317
+ range: 'RangeWidget',
2318
+ radio: 'RadioWidget',
2319
+ hidden: 'HiddenWidget'
2295
2320
  },
2296
2321
  array: {
2297
- select: "SelectWidget",
2298
- checkboxes: "CheckboxesWidget",
2299
- files: "FileWidget",
2300
- hidden: "HiddenWidget"
2322
+ select: 'SelectWidget',
2323
+ checkboxes: 'CheckboxesWidget',
2324
+ files: 'FileWidget',
2325
+ hidden: 'HiddenWidget'
2301
2326
  }
2302
2327
  };
2303
2328
  /** Wraps the given widget with stateless functional component that will merge any `defaultProps.options` with the
@@ -2308,18 +2333,18 @@ var widgetMap = {
2308
2333
  * @returns - The wrapper widget
2309
2334
  */
2310
2335
  function mergeWidgetOptions(AWidget) {
2311
- var MergedWidget = get__default["default"](AWidget, "MergedWidget");
2336
+ var MergedWidget = get__default["default"](AWidget, 'MergedWidget');
2312
2337
  // cache return value as property of widget for proper react reconciliation
2313
2338
  if (!MergedWidget) {
2314
2339
  var defaultOptions = AWidget.defaultProps && AWidget.defaultProps.options || {};
2315
2340
  MergedWidget = function MergedWidget(_ref) {
2316
2341
  var options = _ref.options,
2317
2342
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
2318
- return /*#__PURE__*/React__default["default"].createElement(AWidget, _extends({
2343
+ return jsxRuntime.jsx(AWidget, _extends({
2319
2344
  options: _extends({}, defaultOptions, options)
2320
2345
  }, props));
2321
2346
  };
2322
- set__default["default"](AWidget, "MergedWidget", MergedWidget);
2347
+ set__default["default"](AWidget, 'MergedWidget', MergedWidget);
2323
2348
  }
2324
2349
  return MergedWidget;
2325
2350
  }
@@ -2339,17 +2364,17 @@ function getWidget(schema, widget, registeredWidgets) {
2339
2364
  registeredWidgets = {};
2340
2365
  }
2341
2366
  var type = getSchemaType(schema);
2342
- if (typeof widget === "function" || widget && ReactIs__default["default"].isForwardRef( /*#__PURE__*/React__default["default"].createElement(widget)) || ReactIs__default["default"].isMemo(widget)) {
2367
+ if (typeof widget === 'function' || widget && ReactIs__default["default"].isForwardRef( /*#__PURE__*/react.createElement(widget)) || ReactIs__default["default"].isMemo(widget)) {
2343
2368
  return mergeWidgetOptions(widget);
2344
2369
  }
2345
- if (typeof widget !== "string") {
2370
+ if (typeof widget !== 'string') {
2346
2371
  throw new Error("Unsupported widget definition: " + typeof widget);
2347
2372
  }
2348
2373
  if (widget in registeredWidgets) {
2349
2374
  var registeredWidget = registeredWidgets[widget];
2350
2375
  return getWidget(schema, registeredWidget, registeredWidgets);
2351
2376
  }
2352
- if (typeof type === "string") {
2377
+ if (typeof type === 'string') {
2353
2378
  if (!(type in widgetMap)) {
2354
2379
  throw new Error("No widget for type '" + type + "'");
2355
2380
  }
@@ -2378,7 +2403,7 @@ function hasWidget(schema, widget, registeredWidgets) {
2378
2403
  return true;
2379
2404
  } catch (e) {
2380
2405
  var err = e;
2381
- if (err.message && (err.message.startsWith("No widget") || err.message.startsWith("Unsupported widget"))) {
2406
+ if (err.message && (err.message.startsWith('No widget') || err.message.startsWith('Unsupported widget'))) {
2382
2407
  return false;
2383
2408
  }
2384
2409
  throw e;
@@ -2400,7 +2425,7 @@ function idGenerator(id, suffix) {
2400
2425
  * @returns - The consistent id for the field description element from the given `id`
2401
2426
  */
2402
2427
  function descriptionId(id) {
2403
- return idGenerator(id, "description");
2428
+ return idGenerator(id, 'description');
2404
2429
  }
2405
2430
  /** Return a consistent `id` for the field error element
2406
2431
  *
@@ -2408,7 +2433,7 @@ function descriptionId(id) {
2408
2433
  * @returns - The consistent id for the field error element from the given `id`
2409
2434
  */
2410
2435
  function errorId(id) {
2411
- return idGenerator(id, "error");
2436
+ return idGenerator(id, 'error');
2412
2437
  }
2413
2438
  /** Return a consistent `id` for the field examples element
2414
2439
  *
@@ -2416,7 +2441,7 @@ function errorId(id) {
2416
2441
  * @returns - The consistent id for the field examples element from the given `id`
2417
2442
  */
2418
2443
  function examplesId(id) {
2419
- return idGenerator(id, "examples");
2444
+ return idGenerator(id, 'examples');
2420
2445
  }
2421
2446
  /** Return a consistent `id` for the field help element
2422
2447
  *
@@ -2424,7 +2449,7 @@ function examplesId(id) {
2424
2449
  * @returns - The consistent id for the field help element from the given `id`
2425
2450
  */
2426
2451
  function helpId(id) {
2427
- return idGenerator(id, "help");
2452
+ return idGenerator(id, 'help');
2428
2453
  }
2429
2454
  /** Return a consistent `id` for the field title element
2430
2455
  *
@@ -2432,7 +2457,7 @@ function helpId(id) {
2432
2457
  * @returns - The consistent id for the field title element from the given `id`
2433
2458
  */
2434
2459
  function titleId(id) {
2435
- return idGenerator(id, "title");
2460
+ return idGenerator(id, 'title');
2436
2461
  }
2437
2462
  /** Return a list of element ids that contain additional information about the field that can be used to as the aria
2438
2463
  * description of the field. This is correctly omitting `titleId` which would be "labeling" rather than "describing" the
@@ -2446,7 +2471,7 @@ function ariaDescribedByIds(id, includeExamples) {
2446
2471
  if (includeExamples === void 0) {
2447
2472
  includeExamples = false;
2448
2473
  }
2449
- var examples = includeExamples ? " " + examplesId(id) : "";
2474
+ var examples = includeExamples ? " " + examplesId(id) : '';
2450
2475
  return errorId(id) + " " + descriptionId(id) + " " + helpId(id) + examples;
2451
2476
  }
2452
2477
  /** Return a consistent `id` for the `optionIndex`s of a `Radio` or `Checkboxes` widget
@@ -2482,7 +2507,7 @@ function toConstant(schema) {
2482
2507
  if (CONST_KEY in schema) {
2483
2508
  return schema["const"];
2484
2509
  }
2485
- throw new Error("schema cannot be inferred as a constant");
2510
+ throw new Error('schema cannot be inferred as a constant');
2486
2511
  }
2487
2512
 
2488
2513
  /** Gets the list of options from the schema. If the schema has an enum list, then those enum values are returned. The
@@ -2497,8 +2522,8 @@ function optionsList(schema) {
2497
2522
  // enumNames was deprecated in v5 and is intentionally omitted from the RJSFSchema type.
2498
2523
  // Cast the type to include enumNames so the feature still works.
2499
2524
  var schemaWithEnumNames = schema;
2500
- if (schemaWithEnumNames.enumNames && "development" !== "production") {
2501
- console.warn("The enumNames property is deprecated and may be removed in a future major release.");
2525
+ if (schemaWithEnumNames.enumNames && "development" !== 'production') {
2526
+ console.warn('The enumNames property is deprecated and may be removed in a future major release.');
2502
2527
  }
2503
2528
  if (schema["enum"]) {
2504
2529
  return schema["enum"].map(function (value, i) {
@@ -2547,21 +2572,21 @@ function orderProperties(properties, order) {
2547
2572
  };
2548
2573
  var propertyHash = arrayToHash(properties);
2549
2574
  var orderFiltered = order.filter(function (prop) {
2550
- return prop === "*" || propertyHash[prop];
2575
+ return prop === '*' || propertyHash[prop];
2551
2576
  });
2552
2577
  var orderHash = arrayToHash(orderFiltered);
2553
2578
  var rest = properties.filter(function (prop) {
2554
2579
  return !orderHash[prop];
2555
2580
  });
2556
- var restIndex = orderFiltered.indexOf("*");
2581
+ var restIndex = orderFiltered.indexOf('*');
2557
2582
  if (restIndex === -1) {
2558
2583
  if (rest.length) {
2559
2584
  throw new Error("uiSchema order list does not contain " + errorPropList(rest));
2560
2585
  }
2561
2586
  return orderFiltered;
2562
2587
  }
2563
- if (restIndex !== orderFiltered.lastIndexOf("*")) {
2564
- throw new Error("uiSchema order list contains more than one wildcard item");
2588
+ if (restIndex !== orderFiltered.lastIndexOf('*')) {
2589
+ throw new Error('uiSchema order list contains more than one wildcard item');
2565
2590
  }
2566
2591
  var complete = [].concat(orderFiltered);
2567
2592
  complete.splice.apply(complete, [restIndex, 1].concat(rest));
@@ -2577,7 +2602,7 @@ function orderProperties(properties, order) {
2577
2602
  function pad(num, width) {
2578
2603
  var s = String(num);
2579
2604
  while (s.length < width) {
2580
- s = "0" + s;
2605
+ s = '0' + s;
2581
2606
  }
2582
2607
  return s;
2583
2608
  }
@@ -2605,7 +2630,7 @@ function parseDateString(dateString, includeTime) {
2605
2630
  }
2606
2631
  var date = new Date(dateString);
2607
2632
  if (Number.isNaN(date.getTime())) {
2608
- throw new Error("Unable to parse date " + dateString);
2633
+ throw new Error('Unable to parse date ' + dateString);
2609
2634
  }
2610
2635
  return {
2611
2636
  year: date.getUTCFullYear(),
@@ -2699,7 +2724,7 @@ function toDateString(dateObject, time) {
2699
2724
  */
2700
2725
  function utcToLocal(jsonDate) {
2701
2726
  if (!jsonDate) {
2702
- return "";
2727
+ return '';
2703
2728
  }
2704
2729
  // required format of `'yyyy-MM-ddThh:mm' followed by optional ':ss' or ':ss.SSS'
2705
2730
  // https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type%3Ddatetime-local)
@@ -2743,6 +2768,8 @@ exports.TranslatableString = void 0;
2743
2768
  TranslatableString["AddButton"] = "Add";
2744
2769
  /** Add button title, used by AddButton */
2745
2770
  TranslatableString["AddItemButton"] = "Add Item";
2771
+ /** Copy button title, used by IconButton */
2772
+ TranslatableString["CopyButton"] = "Copy";
2746
2773
  /** Move down button title, used by IconButton */
2747
2774
  TranslatableString["MoveDownButton"] = "Move down";
2748
2775
  /** Move up button title, used by IconButton */
@@ -2771,6 +2798,8 @@ exports.TranslatableString = void 0;
2771
2798
  /** Key label, where %1 will be replaced by the label as provided by WrapIfAdditionalTemplate */
2772
2799
  TranslatableString["KeyLabel"] = "%1 Key";
2773
2800
  // Strings with replaceable parameters AND/OR that support markdown and html
2801
+ /** Invalid object field configuration as provided by the ObjectField */
2802
+ TranslatableString["InvalidObjectField"] = "Invalid \"%1\" object field configuration: <em>%2</em>.";
2774
2803
  /** Unsupported field schema, used by UnsupportedField */
2775
2804
  TranslatableString["UnsupportedField"] = "Unsupported field schema.";
2776
2805
  /** Unsupported field schema, where %1 will be replaced by the idSchema.$id as provided by UnsupportedField */
@@ -2808,6 +2837,7 @@ exports.REQUIRED_KEY = REQUIRED_KEY;
2808
2837
  exports.RJSF_ADDITONAL_PROPERTIES_FLAG = RJSF_ADDITONAL_PROPERTIES_FLAG;
2809
2838
  exports.SUBMIT_BTN_OPTIONS_KEY = SUBMIT_BTN_OPTIONS_KEY;
2810
2839
  exports.UI_FIELD_KEY = UI_FIELD_KEY;
2840
+ exports.UI_GLOBAL_OPTIONS_KEY = UI_GLOBAL_OPTIONS_KEY;
2811
2841
  exports.UI_OPTIONS_KEY = UI_OPTIONS_KEY;
2812
2842
  exports.UI_WIDGET_KEY = UI_WIDGET_KEY;
2813
2843
  exports.allowAdditionalItems = allowAdditionalItems;