@rjsf/utils 5.2.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/utils.esm.js CHANGED
@@ -13,7 +13,8 @@ import mergeAllOf from 'json-schema-merge-allof';
13
13
  import union from 'lodash-es/union';
14
14
  import isEqual from 'lodash-es/isEqual';
15
15
  import cloneDeep from 'lodash-es/cloneDeep';
16
- import React from 'react';
16
+ import { jsx } from 'react/jsx-runtime';
17
+ import { createElement } from 'react';
17
18
  import ReactIs from 'react-is';
18
19
 
19
20
  /** Determines whether a `thing` is an object for the purposes of RSJF. In this case, `thing` is an object if it has
@@ -23,13 +24,13 @@ import ReactIs from 'react-is';
23
24
  * @returns - True if it is a non-null, non-array, non-File object
24
25
  */
25
26
  function isObject(thing) {
26
- if (typeof File !== "undefined" && thing instanceof File) {
27
+ if (typeof File !== 'undefined' && thing instanceof File) {
27
28
  return false;
28
29
  }
29
- if (typeof Date !== "undefined" && thing instanceof Date) {
30
+ if (typeof Date !== 'undefined' && thing instanceof Date) {
30
31
  return false;
31
32
  }
32
- return typeof thing === "object" && thing !== null && !Array.isArray(thing);
33
+ return typeof thing === 'object' && thing !== null && !Array.isArray(thing);
33
34
  }
34
35
 
35
36
  /** Checks the schema to see if it is allowing additional items, by verifying that `schema.additionalItems` is an
@@ -40,7 +41,7 @@ function isObject(thing) {
40
41
  */
41
42
  function allowAdditionalItems(schema) {
42
43
  if (schema.additionalItems === true) {
43
- console.warn("additionalItems=true is currently not supported");
44
+ console.warn('additionalItems=true is currently not supported');
44
45
  }
45
46
  return isObject(schema.additionalItems);
46
47
  }
@@ -55,7 +56,7 @@ function allowAdditionalItems(schema) {
55
56
  * @returns - The `value` converted to a number when appropriate, otherwise the `value`
56
57
  */
57
58
  function asNumber(value) {
58
- if (value === "") {
59
+ if (value === '') {
59
60
  return undefined;
60
61
  }
61
62
  if (value === null) {
@@ -77,7 +78,7 @@ function asNumber(value) {
77
78
  return value;
78
79
  }
79
80
  var n = Number(value);
80
- var valid = typeof n === "number" && !Number.isNaN(n);
81
+ var valid = typeof n === 'number' && !Number.isNaN(n);
81
82
  return valid ? n : value;
82
83
  }
83
84
 
@@ -147,28 +148,28 @@ function _toPropertyKey(arg) {
147
148
  * `RJSF_ADDITONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()`
148
149
  * utility.
149
150
  */
150
- var ADDITIONAL_PROPERTY_FLAG = "__additional_property";
151
- var ADDITIONAL_PROPERTIES_KEY = "additionalProperties";
152
- var ALL_OF_KEY = "allOf";
153
- var ANY_OF_KEY = "anyOf";
154
- var CONST_KEY = "const";
155
- var DEFAULT_KEY = "default";
156
- var DEFINITIONS_KEY = "definitions";
157
- var DEPENDENCIES_KEY = "dependencies";
158
- var ENUM_KEY = "enum";
159
- var ERRORS_KEY = "__errors";
160
- var ID_KEY = "$id";
161
- var ITEMS_KEY = "items";
162
- var NAME_KEY = "$name";
163
- var ONE_OF_KEY = "oneOf";
164
- var PROPERTIES_KEY = "properties";
165
- var REQUIRED_KEY = "required";
166
- var SUBMIT_BTN_OPTIONS_KEY = "submitButtonOptions";
167
- var REF_KEY = "$ref";
168
- var RJSF_ADDITONAL_PROPERTIES_FLAG = "__rjsf_additionalProperties";
169
- var UI_FIELD_KEY = "ui:field";
170
- var UI_WIDGET_KEY = "ui:widget";
171
- var UI_OPTIONS_KEY = "ui:options";
151
+ var ADDITIONAL_PROPERTY_FLAG = '__additional_property';
152
+ var ADDITIONAL_PROPERTIES_KEY = 'additionalProperties';
153
+ var ALL_OF_KEY = 'allOf';
154
+ var ANY_OF_KEY = 'anyOf';
155
+ var CONST_KEY = 'const';
156
+ var DEFAULT_KEY = 'default';
157
+ var DEFINITIONS_KEY = 'definitions';
158
+ var DEPENDENCIES_KEY = 'dependencies';
159
+ var ENUM_KEY = 'enum';
160
+ var ERRORS_KEY = '__errors';
161
+ var ID_KEY = '$id';
162
+ var ITEMS_KEY = 'items';
163
+ var NAME_KEY = '$name';
164
+ var ONE_OF_KEY = 'oneOf';
165
+ var PROPERTIES_KEY = 'properties';
166
+ var REQUIRED_KEY = 'required';
167
+ var SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';
168
+ var REF_KEY = '$ref';
169
+ var RJSF_ADDITONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';
170
+ var UI_FIELD_KEY = 'ui:field';
171
+ var UI_WIDGET_KEY = 'ui:widget';
172
+ var UI_OPTIONS_KEY = 'ui:options';
172
173
 
173
174
  /** Get all passed options from ui:options, and ui:<optionName>, returning them in an object with the `ui:`
174
175
  * stripped off.
@@ -181,12 +182,12 @@ function getUiOptions(uiSchema) {
181
182
  uiSchema = {};
182
183
  }
183
184
  return Object.keys(uiSchema).filter(function (key) {
184
- return key.indexOf("ui:") === 0;
185
+ return key.indexOf('ui:') === 0;
185
186
  }).reduce(function (options, key) {
186
187
  var _extends2;
187
188
  var value = uiSchema[key];
188
189
  if (key === UI_WIDGET_KEY && isObject(value)) {
189
- console.error("Setting options via ui:widget object is no longer supported, use ui:options instead");
190
+ console.error('Setting options via ui:widget object is no longer supported, use ui:options instead');
190
191
  return options;
191
192
  }
192
193
  if (key === UI_OPTIONS_KEY && isObject(value)) {
@@ -235,7 +236,7 @@ function canExpand(schema, uiSchema, formData) {
235
236
  */
236
237
  function deepEquals(a, b) {
237
238
  return isEqualWith(a, b, function (obj, other) {
238
- if (typeof obj === "function" && typeof other === "function") {
239
+ if (typeof obj === 'function' && typeof other === 'function') {
239
240
  // Assume all functions are equivalent
240
241
  // see https://github.com/rjsf-team/react-jsonschema-form/issues/255
241
242
  return true;
@@ -270,8 +271,8 @@ function findSchemaDefinition($ref, rootSchema) {
270
271
  if (rootSchema === void 0) {
271
272
  rootSchema = {};
272
273
  }
273
- var ref = $ref || "";
274
- if (ref.startsWith("#")) {
274
+ var ref = $ref || '';
275
+ if (ref.startsWith('#')) {
275
276
  // Decode URI fragment representation.
276
277
  ref = decodeURIComponent(ref.substring(1));
277
278
  } else {
@@ -379,25 +380,25 @@ function getFirstMatchingOption(validator, formData, options, rootSchema) {
379
380
  */
380
381
  function guessType(value) {
381
382
  if (Array.isArray(value)) {
382
- return "array";
383
+ return 'array';
383
384
  }
384
- if (typeof value === "string") {
385
- return "string";
385
+ if (typeof value === 'string') {
386
+ return 'string';
386
387
  }
387
388
  if (value == null) {
388
- return "null";
389
+ return 'null';
389
390
  }
390
- if (typeof value === "boolean") {
391
- return "boolean";
391
+ if (typeof value === 'boolean') {
392
+ return 'boolean';
392
393
  }
393
394
  if (!isNaN(value)) {
394
- return "number";
395
+ return 'number';
395
396
  }
396
- if (typeof value === "object") {
397
- return "object";
397
+ if (typeof value === 'object') {
398
+ return 'object';
398
399
  }
399
400
  // Default to string if we can't figure it out
400
- return "string";
401
+ return 'string';
401
402
  }
402
403
 
403
404
  /** Gets the type of a given `schema`. If the type is not explicitly defined, then an attempt is made to infer it from
@@ -417,14 +418,14 @@ function getSchemaType(schema) {
417
418
  return guessType(schema["const"]);
418
419
  }
419
420
  if (!type && schema["enum"]) {
420
- return "string";
421
+ return 'string';
421
422
  }
422
423
  if (!type && (schema.properties || schema.additionalProperties)) {
423
- return "object";
424
+ return 'object';
424
425
  }
425
- if (Array.isArray(type) && type.length === 2 && type.includes("null")) {
426
+ if (Array.isArray(type) && type.length === 2 && type.includes('null')) {
426
427
  type = type.find(function (type) {
427
- return type !== "null";
428
+ return type !== 'null';
428
429
  });
429
430
  }
430
431
  return type;
@@ -445,7 +446,7 @@ function mergeSchemas(obj1, obj2) {
445
446
  right = obj2[key];
446
447
  if (obj1 && key in obj1 && isObject(right)) {
447
448
  acc[key] = mergeSchemas(left, right);
448
- } else if (obj1 && obj2 && (getSchemaType(obj1) === "object" || getSchemaType(obj2) === "object") && key === REQUIRED_KEY && Array.isArray(left) && Array.isArray(right)) {
449
+ } else if (obj1 && obj2 && (getSchemaType(obj1) === 'object' || getSchemaType(obj2) === 'object') && key === REQUIRED_KEY && Array.isArray(left) && Array.isArray(right)) {
449
450
  // Don't include duplicate values when merging 'required' fields.
450
451
  acc[key] = union(left, right);
451
452
  } else {
@@ -475,7 +476,7 @@ function resolveCondition(validator, schema, rootSchema, formData) {
475
476
  otherwise = schema["else"],
476
477
  resolvedSchemaLessConditional = _objectWithoutPropertiesLoose(schema, _excluded$1);
477
478
  var conditionalSchema = validator.isValid(expression, formData, rootSchema) ? then : otherwise;
478
- if (conditionalSchema && typeof conditionalSchema !== "boolean") {
479
+ if (conditionalSchema && typeof conditionalSchema !== 'boolean') {
479
480
  return retrieveSchema(validator, mergeSchemas(resolvedSchemaLessConditional, retrieveSchema(validator, conditionalSchema, rootSchema, formData)), rootSchema, formData);
480
481
  }
481
482
  return retrieveSchema(validator, resolvedSchemaLessConditional, rootSchema, formData);
@@ -547,16 +548,16 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
547
548
  return;
548
549
  }
549
550
  var additionalProperties = {};
550
- if (typeof schema.additionalProperties !== "boolean") {
551
+ if (typeof schema.additionalProperties !== 'boolean') {
551
552
  if (REF_KEY in schema.additionalProperties) {
552
553
  additionalProperties = retrieveSchema(validator, {
553
554
  $ref: get(schema.additionalProperties, [REF_KEY])
554
555
  }, rootSchema, formData);
555
- } else if ("type" in schema.additionalProperties) {
556
+ } else if ('type' in schema.additionalProperties) {
556
557
  additionalProperties = _extends({}, schema.additionalProperties);
557
558
  } else if (ANY_OF_KEY in schema.additionalProperties || ONE_OF_KEY in schema.additionalProperties) {
558
559
  additionalProperties = _extends({
559
- type: "object"
560
+ type: 'object'
560
561
  }, schema.additionalProperties);
561
562
  } else {
562
563
  additionalProperties = {
@@ -593,7 +594,7 @@ function retrieveSchema(validator, schema, rootSchema, rawFormData) {
593
594
  return {};
594
595
  }
595
596
  var resolvedSchema = resolveSchema(validator, schema, rootSchema, rawFormData);
596
- if ("if" in schema) {
597
+ if ('if' in schema) {
597
598
  return resolveCondition(validator, schema, rootSchema, rawFormData);
598
599
  }
599
600
  var formData = rawFormData || {};
@@ -603,7 +604,7 @@ function retrieveSchema(validator, schema, rootSchema, rawFormData) {
603
604
  deep: false
604
605
  });
605
606
  } catch (e) {
606
- console.warn("could not merge subschemas in allOf:\n" + e);
607
+ console.warn('could not merge subschemas in allOf:\n' + e);
607
608
  var _resolvedSchema = resolvedSchema,
608
609
  resolvedSchemaWithoutAllOf = _objectWithoutPropertiesLoose(_resolvedSchema, _excluded3);
609
610
  return resolvedSchemaWithoutAllOf;
@@ -704,7 +705,7 @@ function withDependentSchema(validator, schema, rootSchema, dependencyKey, depen
704
705
  }
705
706
  // Resolve $refs inside oneOf.
706
707
  var resolvedOneOf = oneOf.map(function (subschema) {
707
- if (typeof subschema === "boolean" || !(REF_KEY in subschema)) {
708
+ if (typeof subschema === 'boolean' || !(REF_KEY in subschema)) {
708
709
  return subschema;
709
710
  }
710
711
  return resolveReference(validator, subschema, rootSchema, formData);
@@ -723,14 +724,14 @@ function withDependentSchema(validator, schema, rootSchema, dependencyKey, depen
723
724
  */
724
725
  function withExactlyOneSubschema(validator, schema, rootSchema, dependencyKey, oneOf, formData) {
725
726
  var validSubschemas = oneOf.filter(function (subschema) {
726
- if (typeof subschema === "boolean" || !subschema || !subschema.properties) {
727
+ if (typeof subschema === 'boolean' || !subschema || !subschema.properties) {
727
728
  return false;
728
729
  }
729
730
  var conditionPropertySchema = subschema.properties[dependencyKey];
730
731
  if (conditionPropertySchema) {
731
732
  var _properties;
732
733
  var conditionSchema = {
733
- type: "object",
734
+ type: 'object',
734
735
  properties: (_properties = {}, _properties[dependencyKey] = conditionPropertySchema, _properties)
735
736
  };
736
737
  var _validator$validateFo = validator.validateFormData(formData, conditionSchema),
@@ -756,10 +757,10 @@ function withExactlyOneSubschema(validator, schema, rootSchema, dependencyKey, o
756
757
  * the first item
757
758
  */
758
759
  var JUNK_OPTION = {
759
- type: "object",
760
+ type: 'object',
760
761
  properties: {
761
762
  __not_really_there__: {
762
- type: "number"
763
+ type: 'number'
763
764
  }
764
765
  }
765
766
  };
@@ -792,7 +793,7 @@ function calculateIndexScore(validator, rootSchema, schema, formData) {
792
793
  if (isObject$1(schema.properties)) {
793
794
  totalScore += reduce(schema.properties, function (score, value, key) {
794
795
  var formValue = get(formData, key);
795
- if (typeof value === "boolean") {
796
+ if (typeof value === 'boolean') {
796
797
  return score;
797
798
  }
798
799
  if (has(value, REF_KEY)) {
@@ -802,7 +803,7 @@ function calculateIndexScore(validator, rootSchema, schema, formData) {
802
803
  if (has(value, ONE_OF_KEY) && formValue) {
803
804
  return score + getClosestMatchingOption(validator, rootSchema, formValue, get(value, ONE_OF_KEY));
804
805
  }
805
- if (value.type === "object") {
806
+ if (value.type === 'object') {
806
807
  return score + calculateIndexScore(validator, rootSchema, value, formValue || {});
807
808
  }
808
809
  if (value.type === guessType(formValue)) {
@@ -962,7 +963,7 @@ function mergeObjects(obj1, obj2, concatArrays) {
962
963
  acc[key] = mergeObjects(left, right, concatArrays);
963
964
  } else if (concatArrays && Array.isArray(left) && Array.isArray(right)) {
964
965
  var toMerge = right;
965
- if (concatArrays === "preventDuplicates") {
966
+ if (concatArrays === 'preventDuplicates') {
966
967
  toMerge = right.reduce(function (result, value) {
967
968
  if (!left.includes(value)) {
968
969
  result.push(value);
@@ -1006,7 +1007,7 @@ function isSelect(validator, theSchema, rootSchema) {
1006
1007
  }
1007
1008
  if (Array.isArray(altSchemas)) {
1008
1009
  return altSchemas.every(function (altSchemas) {
1009
- return typeof altSchemas !== "boolean" && isConstant(altSchemas);
1010
+ return typeof altSchemas !== 'boolean' && isConstant(altSchemas);
1010
1011
  });
1011
1012
  }
1012
1013
  return false;
@@ -1020,7 +1021,7 @@ function isSelect(validator, theSchema, rootSchema) {
1020
1021
  * @returns - True if schema contains a multi-select, otherwise false
1021
1022
  */
1022
1023
  function isMultiSelect(validator, schema, rootSchema) {
1023
- if (!schema.uniqueItems || !schema.items || typeof schema.items === "boolean") {
1024
+ if (!schema.uniqueItems || !schema.items || typeof schema.items === 'boolean') {
1024
1025
  return false;
1025
1026
  }
1026
1027
  return isSelect(validator, schema.items, rootSchema);
@@ -1059,11 +1060,11 @@ function getInnerSchemaForArrayItem(schema, additionalItems, idx) {
1059
1060
  if (idx >= 0) {
1060
1061
  if (Array.isArray(schema.items) && idx < schema.items.length) {
1061
1062
  var item = schema.items[idx];
1062
- if (typeof item !== "boolean") {
1063
+ if (typeof item !== 'boolean') {
1063
1064
  return item;
1064
1065
  }
1065
1066
  }
1066
- } else if (schema.items && !Array.isArray(schema.items) && typeof schema.items !== "boolean") {
1067
+ } else if (schema.items && !Array.isArray(schema.items) && typeof schema.items !== 'boolean') {
1067
1068
  return schema.items;
1068
1069
  }
1069
1070
  if (additionalItems !== AdditionalItemsHandling.Ignore && isObject(schema.additionalItems)) {
@@ -1155,12 +1156,12 @@ function computeDefaults(validator, rawSchema, parentDefaults, rootSchema, rawFo
1155
1156
  schema = schema.anyOf[getClosestMatchingOption(validator, rootSchema, isEmpty(formData) ? undefined : formData, schema.anyOf, 0)];
1156
1157
  }
1157
1158
  // Not defaults defined for this node, fallback to generic typed ones.
1158
- if (typeof defaults === "undefined") {
1159
+ if (typeof defaults === 'undefined') {
1159
1160
  defaults = schema["default"];
1160
1161
  }
1161
1162
  switch (getSchemaType(schema)) {
1162
1163
  // We need to recur for object schema inner default values.
1163
- case "object":
1164
+ case 'object':
1164
1165
  {
1165
1166
  var objectDefaults = Object.keys(schema.properties || {}).reduce(function (acc, key) {
1166
1167
  // Compute the defaults for this node, with the parent defaults we might
@@ -1180,7 +1181,7 @@ function computeDefaults(validator, rawSchema, parentDefaults, rootSchema, rawFo
1180
1181
  }
1181
1182
  return objectDefaults;
1182
1183
  }
1183
- case "array":
1184
+ case 'array':
1184
1185
  // Inject defaults into existing array defaults
1185
1186
  if (Array.isArray(defaults)) {
1186
1187
  defaults = defaults.map(function (item, idx) {
@@ -1230,11 +1231,11 @@ function getDefaultFormState(validator, theSchema, formData, rootSchema, include
1230
1231
  includeUndefinedValues = false;
1231
1232
  }
1232
1233
  if (!isObject(theSchema)) {
1233
- throw new Error("Invalid schema: " + theSchema);
1234
+ throw new Error('Invalid schema: ' + theSchema);
1234
1235
  }
1235
1236
  var schema = retrieveSchema(validator, theSchema, rootSchema, formData);
1236
1237
  var defaults = computeDefaults(validator, schema, undefined, rootSchema, formData, includeUndefinedValues);
1237
- if (typeof formData === "undefined" || formData === null || typeof formData === "number" && isNaN(formData)) {
1238
+ if (typeof formData === 'undefined' || formData === null || typeof formData === 'number' && isNaN(formData)) {
1238
1239
  // No form data? Use schema defaults.
1239
1240
  return defaults;
1240
1241
  }
@@ -1259,7 +1260,7 @@ function isCustomWidget(uiSchema) {
1259
1260
  return (
1260
1261
  // TODO: Remove the `&& uiSchema['ui:widget'] !== 'hidden'` once we support hidden widgets for arrays.
1261
1262
  // https://react-jsonschema-form.readthedocs.io/en/latest/usage/widgets/#hidden-widgets
1262
- "widget" in getUiOptions(uiSchema) && getUiOptions(uiSchema)["widget"] !== "hidden"
1263
+ 'widget' in getUiOptions(uiSchema) && getUiOptions(uiSchema)['widget'] !== 'hidden'
1263
1264
  );
1264
1265
  }
1265
1266
 
@@ -1275,12 +1276,12 @@ function isFilesArray(validator, schema, uiSchema, rootSchema) {
1275
1276
  if (uiSchema === void 0) {
1276
1277
  uiSchema = {};
1277
1278
  }
1278
- if (uiSchema[UI_WIDGET_KEY] === "files") {
1279
+ if (uiSchema[UI_WIDGET_KEY] === 'files') {
1279
1280
  return true;
1280
1281
  }
1281
1282
  if (schema.items) {
1282
1283
  var itemsSchema = retrieveSchema(validator, schema.items, rootSchema);
1283
- return itemsSchema.type === "string" && itemsSchema.format === "data-url";
1284
+ return itemsSchema.type === 'string' && itemsSchema.format === 'data-url';
1284
1285
  }
1285
1286
  return false;
1286
1287
  }
@@ -1303,13 +1304,13 @@ function getDisplayLabel(validator, schema, uiSchema, rootSchema) {
1303
1304
  label = _uiOptions$label === void 0 ? true : _uiOptions$label;
1304
1305
  var displayLabel = !!label;
1305
1306
  var schemaType = getSchemaType(schema);
1306
- if (schemaType === "array") {
1307
+ if (schemaType === 'array') {
1307
1308
  displayLabel = isMultiSelect(validator, schema, rootSchema) || isFilesArray(validator, schema, uiSchema, rootSchema) || isCustomWidget(uiSchema);
1308
1309
  }
1309
- if (schemaType === "object") {
1310
+ if (schemaType === 'object') {
1310
1311
  displayLabel = false;
1311
1312
  }
1312
- if (schemaType === "boolean" && !uiSchema[UI_WIDGET_KEY]) {
1313
+ if (schemaType === 'boolean' && !uiSchema[UI_WIDGET_KEY]) {
1313
1314
  displayLabel = false;
1314
1315
  }
1315
1316
  if (uiSchema[UI_FIELD_KEY]) {
@@ -1346,7 +1347,7 @@ function mergeValidationData(validator, validationData, additionalErrorSchema) {
1346
1347
  };
1347
1348
  }
1348
1349
 
1349
- var NO_VALUE = /*#__PURE__*/Symbol("no Value");
1350
+ var NO_VALUE = /*#__PURE__*/Symbol('no Value');
1350
1351
  /** Sanitize the `data` associated with the `oldSchema` so it is considered appropriate for the `newSchema`. If the new
1351
1352
  * schema does not contain any properties, then `undefined` is returned to clear all the form data. Due to the nature
1352
1353
  * of schemas, this sanitization happens recursively for nested objects of data. Also, any properties in the old schema
@@ -1427,8 +1428,8 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1427
1428
  newKeyedSchema = retrieveSchema(validator, newKeyedSchema, rootSchema, formValue);
1428
1429
  }
1429
1430
  // Now get types and see if they are the same
1430
- var oldSchemaTypeForKey = get(oldKeyedSchema, "type");
1431
- var newSchemaTypeForKey = get(newKeyedSchema, "type");
1431
+ var oldSchemaTypeForKey = get(oldKeyedSchema, 'type');
1432
+ var newSchemaTypeForKey = get(newKeyedSchema, 'type');
1432
1433
  // Check if the old option has the same key with the same type
1433
1434
  if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
1434
1435
  if (has(removeOldSchemaData, key)) {
@@ -1436,10 +1437,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1436
1437
  delete removeOldSchemaData[key];
1437
1438
  }
1438
1439
  // If it is an object, we'll recurse and store the resulting sanitized data for the key
1439
- if (newSchemaTypeForKey === "object" || newSchemaTypeForKey === "array" && Array.isArray(formValue)) {
1440
+ if (newSchemaTypeForKey === 'object' || newSchemaTypeForKey === 'array' && Array.isArray(formValue)) {
1440
1441
  // SIDE-EFFECT: process the new schema type of object recursively to save iterations
1441
1442
  var itemData = sanitizeDataForNewSchema(validator, rootSchema, newKeyedSchema, oldKeyedSchema, formValue);
1442
- if (itemData !== undefined || newSchemaTypeForKey === "array") {
1443
+ if (itemData !== undefined || newSchemaTypeForKey === 'array') {
1443
1444
  // only put undefined values for the array type and not the object type
1444
1445
  nestedData[key] = itemData;
1445
1446
  }
@@ -1447,19 +1448,19 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1447
1448
  // Ok, the non-object types match, let's make sure that a default or a const of a different value is replaced
1448
1449
  // with the new default or const. This allows the case where two schemas differ that only by the default/const
1449
1450
  // value to be properly selected
1450
- var newOptionDefault = get(newKeyedSchema, "default", NO_VALUE);
1451
- var oldOptionDefault = get(oldKeyedSchema, "default", NO_VALUE);
1451
+ var newOptionDefault = get(newKeyedSchema, 'default', NO_VALUE);
1452
+ var oldOptionDefault = get(oldKeyedSchema, 'default', NO_VALUE);
1452
1453
  if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
1453
1454
  if (oldOptionDefault === formValue) {
1454
1455
  // If the old default matches the formValue, we'll update the new value to match the new default
1455
1456
  removeOldSchemaData[key] = newOptionDefault;
1456
- } else if (get(newKeyedSchema, "readOnly") === true) {
1457
+ } else if (get(newKeyedSchema, 'readOnly') === true) {
1457
1458
  // If the new schema has the default set to read-only, treat it like a const and remove the value
1458
1459
  removeOldSchemaData[key] = undefined;
1459
1460
  }
1460
1461
  }
1461
- var newOptionConst = get(newKeyedSchema, "const", NO_VALUE);
1462
- var oldOptionConst = get(oldKeyedSchema, "const", NO_VALUE);
1462
+ var newOptionConst = get(newKeyedSchema, 'const', NO_VALUE);
1463
+ var oldOptionConst = get(oldKeyedSchema, 'const', NO_VALUE);
1463
1464
  if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
1464
1465
  // Since this is a const, if the old value matches, replace the value with the new const otherwise clear it
1465
1466
  removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : undefined;
@@ -1469,12 +1470,12 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1469
1470
  });
1470
1471
  newFormData = _extends({}, data, removeOldSchemaData, nestedData);
1471
1472
  // First apply removing the old schema data, then apply the nested data, then apply the old data keys to keep
1472
- } else if (get(oldSchema, "type") === "array" && get(newSchema, "type") === "array" && Array.isArray(data)) {
1473
- var oldSchemaItems = get(oldSchema, "items");
1474
- var newSchemaItems = get(newSchema, "items");
1473
+ } else if (get(oldSchema, 'type') === 'array' && get(newSchema, 'type') === 'array' && Array.isArray(data)) {
1474
+ var oldSchemaItems = get(oldSchema, 'items');
1475
+ var newSchemaItems = get(newSchema, 'items');
1475
1476
  // If any of the array types `items` are arrays (remember arrays are objects) then we'll just drop the data
1476
1477
  // Eventually, we may want to deal with when either of the `items` are arrays since those tuple validations
1477
- if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
1478
+ if (typeof oldSchemaItems === 'object' && typeof newSchemaItems === 'object' && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
1478
1479
  if (has(oldSchemaItems, REF_KEY)) {
1479
1480
  oldSchemaItems = retrieveSchema(validator, oldSchemaItems, rootSchema, data);
1480
1481
  }
@@ -1482,12 +1483,12 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1482
1483
  newSchemaItems = retrieveSchema(validator, newSchemaItems, rootSchema, data);
1483
1484
  }
1484
1485
  // Now get types and see if they are the same
1485
- var oldSchemaType = get(oldSchemaItems, "type");
1486
- var newSchemaType = get(newSchemaItems, "type");
1486
+ var oldSchemaType = get(oldSchemaItems, 'type');
1487
+ var newSchemaType = get(newSchemaItems, 'type');
1487
1488
  // Check if the old option has the same key with the same type
1488
1489
  if (!oldSchemaType || oldSchemaType === newSchemaType) {
1489
- var maxItems = get(newSchema, "maxItems", -1);
1490
- if (newSchemaType === "object") {
1490
+ var maxItems = get(newSchema, 'maxItems', -1);
1491
+ if (newSchemaType === 'object') {
1491
1492
  newFormData = data.reduce(function (newValue, aValue) {
1492
1493
  var itemValue = sanitizeDataForNewSchema(validator, rootSchema, newSchemaItems, oldSchemaItems, aValue);
1493
1494
  if (itemValue !== undefined && (maxItems < 0 || newValue.length < maxItems)) {
@@ -1499,7 +1500,7 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1499
1500
  newFormData = maxItems > 0 && data.length > maxItems ? data.slice(0, maxItems) : data;
1500
1501
  }
1501
1502
  }
1502
- } else if (typeof oldSchemaItems === "boolean" && typeof newSchemaItems === "boolean" && oldSchemaItems === newSchemaItems) {
1503
+ } else if (typeof oldSchemaItems === 'boolean' && typeof newSchemaItems === 'boolean' && oldSchemaItems === newSchemaItems) {
1503
1504
  // If they are both booleans and have the same value just return the data as is otherwise fall-thru to undefined
1504
1505
  newFormData = data;
1505
1506
  }
@@ -1522,10 +1523,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1522
1523
  */
1523
1524
  function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix, idSeparator) {
1524
1525
  if (idPrefix === void 0) {
1525
- idPrefix = "root";
1526
+ idPrefix = 'root';
1526
1527
  }
1527
1528
  if (idSeparator === void 0) {
1528
- idSeparator = "_";
1529
+ idSeparator = '_';
1529
1530
  }
1530
1531
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
1531
1532
  var _schema = retrieveSchema(validator, schema, rootSchema, formData);
@@ -1538,7 +1539,7 @@ function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix, idSep
1538
1539
  var idSchema = {
1539
1540
  $id: $id
1540
1541
  };
1541
- if (schema.type === "object" && PROPERTIES_KEY in schema) {
1542
+ if (schema.type === 'object' && PROPERTIES_KEY in schema) {
1542
1543
  for (var name in schema.properties) {
1543
1544
  var field = get(schema, [PROPERTIES_KEY, name]);
1544
1545
  var fieldId = idSchema[ID_KEY] + idSeparator + name;
@@ -1563,13 +1564,13 @@ function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix, idSep
1563
1564
  function toPathSchema(validator, schema, name, rootSchema, formData) {
1564
1565
  var _pathSchema;
1565
1566
  if (name === void 0) {
1566
- name = "";
1567
+ name = '';
1567
1568
  }
1568
1569
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
1569
1570
  var _schema = retrieveSchema(validator, schema, rootSchema, formData);
1570
1571
  return toPathSchema(validator, _schema, name, rootSchema, formData);
1571
1572
  }
1572
- var pathSchema = (_pathSchema = {}, _pathSchema[NAME_KEY] = name.replace(/^\./, ""), _pathSchema);
1573
+ var pathSchema = (_pathSchema = {}, _pathSchema[NAME_KEY] = name.replace(/^\./, ''), _pathSchema);
1573
1574
  if (ONE_OF_KEY in schema) {
1574
1575
  var index = getClosestMatchingOption(validator, rootSchema, formData, schema.oneOf, 0);
1575
1576
  var _schema2 = schema.oneOf[index];
@@ -1772,10 +1773,10 @@ var SchemaUtils = /*#__PURE__*/function () {
1772
1773
  */;
1773
1774
  _proto.toIdSchema = function toIdSchema$1(schema, id, formData, idPrefix, idSeparator) {
1774
1775
  if (idPrefix === void 0) {
1775
- idPrefix = "root";
1776
+ idPrefix = 'root';
1776
1777
  }
1777
1778
  if (idSeparator === void 0) {
1778
- idSeparator = "_";
1779
+ idSeparator = '_';
1779
1780
  }
1780
1781
  return toIdSchema(this.validator, schema, id, this.rootSchema, formData, idPrefix, idSeparator);
1781
1782
  }
@@ -1810,38 +1811,48 @@ function createSchemaUtils(validator, rootSchema) {
1810
1811
  */
1811
1812
  function dataURItoBlob(dataURI) {
1812
1813
  // Split metadata from data
1813
- var splitted = dataURI.split(",");
1814
+ var splitted = dataURI.split(',');
1814
1815
  // Split params
1815
- var params = splitted[0].split(";");
1816
+ var params = splitted[0].split(';');
1816
1817
  // Get mime-type from params
1817
- var type = params[0].replace("data:", "");
1818
+ var type = params[0].replace('data:', '');
1818
1819
  // Filter the name property from params
1819
1820
  var properties = params.filter(function (param) {
1820
- return param.split("=")[0] === "name";
1821
+ return param.split('=')[0] === 'name';
1821
1822
  });
1822
1823
  // Look for the name and use unknown if no name property.
1823
1824
  var name;
1824
1825
  if (properties.length !== 1) {
1825
- name = "unknown";
1826
+ name = 'unknown';
1826
1827
  } else {
1827
1828
  // Because we filtered out the other property,
1828
- // we only have the name case here.
1829
- name = properties[0].split("=")[1];
1829
+ // we only have the name case here, which we decode to make it human-readable
1830
+ name = decodeURI(properties[0].split('=')[1]);
1830
1831
  }
1831
1832
  // Built the Uint8Array Blob parameter from the base64 string.
1832
- var binary = atob(splitted[1]);
1833
- var array = [];
1834
- for (var i = 0; i < binary.length; i++) {
1835
- array.push(binary.charCodeAt(i));
1836
- }
1837
- // Create the blob object
1838
- var blob = new window.Blob([new Uint8Array(array)], {
1839
- type: type
1840
- });
1841
- return {
1842
- blob: blob,
1843
- name: name
1844
- };
1833
+ try {
1834
+ var binary = atob(splitted[1]);
1835
+ var array = [];
1836
+ for (var i = 0; i < binary.length; i++) {
1837
+ array.push(binary.charCodeAt(i));
1838
+ }
1839
+ // Create the blob object
1840
+ var blob = new window.Blob([new Uint8Array(array)], {
1841
+ type: type
1842
+ });
1843
+ return {
1844
+ blob: blob,
1845
+ name: name
1846
+ };
1847
+ } catch (error) {
1848
+ return {
1849
+ blob: {
1850
+ size: 0,
1851
+ type: error.message
1852
+ },
1853
+ name: dataURI
1854
+ };
1855
+ }
1845
1856
  }
1846
1857
 
1847
1858
  /** Potentially substitutes all replaceable parameters with the associated value(s) from the `params` if available. When
@@ -1855,9 +1866,16 @@ function dataURItoBlob(dataURI) {
1855
1866
  function replaceStringParameters(inputString, params) {
1856
1867
  var output = inputString;
1857
1868
  if (Array.isArray(params)) {
1869
+ var parts = output.split(/(%\d)/);
1858
1870
  params.forEach(function (param, index) {
1859
- output = output.replace("%" + (index + 1), param);
1871
+ var partIndex = parts.findIndex(function (part) {
1872
+ return part === "%" + (index + 1);
1873
+ });
1874
+ if (partIndex >= 0) {
1875
+ parts[partIndex] = param;
1876
+ }
1860
1877
  });
1878
+ output = parts.join('');
1861
1879
  }
1862
1880
  return output;
1863
1881
  }
@@ -1897,7 +1915,7 @@ function enumOptionsValueForIndex(valueIndex, allEnumOptions, emptyValue) {
1897
1915
  });
1898
1916
  }
1899
1917
  // So Number(null) and Number('') both return 0, so use emptyValue for those two values
1900
- var index = valueIndex === "" || valueIndex === null ? -1 : Number(valueIndex);
1918
+ var index = valueIndex === '' || valueIndex === null ? -1 : Number(valueIndex);
1901
1919
  var option = allEnumOptions[index];
1902
1920
  return option ? option.value : emptyValue;
1903
1921
  }
@@ -1963,7 +1981,7 @@ function enumOptionsIndexForValue(value, allEnumOptions, multiple) {
1963
1981
  var selectedIndexes = allEnumOptions.map(function (opt, index) {
1964
1982
  return enumOptionsIsSelected(opt.value, value) ? String(index) : undefined;
1965
1983
  }).filter(function (opt) {
1966
- return typeof opt !== "undefined";
1984
+ return typeof opt !== 'undefined';
1967
1985
  });
1968
1986
  if (!multiple) {
1969
1987
  return selectedIndexes[0];
@@ -2031,7 +2049,7 @@ var ErrorSchemaBuilder = /*#__PURE__*/function () {
2031
2049
  * @private
2032
2050
  */
2033
2051
  _proto.getOrCreateErrorBlock = function getOrCreateErrorBlock(pathOfError) {
2034
- var hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === "string";
2052
+ var hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === 'string';
2035
2053
  var errorBlock = hasPath ? get(this.errorSchema, pathOfError) : this.errorSchema;
2036
2054
  if (!errorBlock && pathOfError) {
2037
2055
  errorBlock = {};
@@ -2143,23 +2161,23 @@ function getInputProps(schema, defaultType, options, autoDefaultStepAny) {
2143
2161
  autoDefaultStepAny = true;
2144
2162
  }
2145
2163
  var inputProps = _extends({
2146
- type: defaultType || "text"
2164
+ type: defaultType || 'text'
2147
2165
  }, rangeSpec(schema));
2148
2166
  // If options.inputType is set use that as the input type
2149
2167
  if (options.inputType) {
2150
2168
  inputProps.type = options.inputType;
2151
2169
  } else if (!defaultType) {
2152
2170
  // If the schema is of type number or integer, set the input type to number
2153
- if (schema.type === "number") {
2154
- inputProps.type = "number";
2171
+ if (schema.type === 'number') {
2172
+ inputProps.type = 'number';
2155
2173
  // Only add step if one isn't already defined and we are auto-defaulting the "any" step
2156
2174
  if (autoDefaultStepAny && inputProps.step === undefined) {
2157
2175
  // Setting step to 'any' fixes a bug in Safari where decimals are not
2158
2176
  // allowed in number inputs
2159
- inputProps.step = "any";
2177
+ inputProps.step = 'any';
2160
2178
  }
2161
- } else if (schema.type === "integer") {
2162
- inputProps.type = "number";
2179
+ } else if (schema.type === 'integer') {
2180
+ inputProps.type = 'number';
2163
2181
  // Only add step if one isn't already defined
2164
2182
  if (inputProps.step === undefined) {
2165
2183
  // Since this is integer, you always want to step up or down in multiples of 1
@@ -2179,7 +2197,7 @@ var DEFAULT_OPTIONS = {
2179
2197
  props: {
2180
2198
  disabled: false
2181
2199
  },
2182
- submitText: "Submit",
2200
+ submitText: 'Submit',
2183
2201
  norender: false
2184
2202
  };
2185
2203
  /** Extracts any `ui:submitButtonOptions` from the `uiSchema` and merges them onto the `DEFAULT_OPTIONS`
@@ -2212,7 +2230,7 @@ function getTemplate(name, registry, uiOptions) {
2212
2230
  uiOptions = {};
2213
2231
  }
2214
2232
  var templates = registry.templates;
2215
- if (name === "ButtonTemplates") {
2233
+ if (name === 'ButtonTemplates') {
2216
2234
  return templates[name];
2217
2235
  }
2218
2236
  return (
@@ -2227,53 +2245,53 @@ var _excluded = ["options"];
2227
2245
  */
2228
2246
  var widgetMap = {
2229
2247
  "boolean": {
2230
- checkbox: "CheckboxWidget",
2231
- radio: "RadioWidget",
2232
- select: "SelectWidget",
2233
- hidden: "HiddenWidget"
2248
+ checkbox: 'CheckboxWidget',
2249
+ radio: 'RadioWidget',
2250
+ select: 'SelectWidget',
2251
+ hidden: 'HiddenWidget'
2234
2252
  },
2235
2253
  string: {
2236
- text: "TextWidget",
2237
- password: "PasswordWidget",
2238
- email: "EmailWidget",
2239
- hostname: "TextWidget",
2240
- ipv4: "TextWidget",
2241
- ipv6: "TextWidget",
2242
- uri: "URLWidget",
2243
- "data-url": "FileWidget",
2244
- radio: "RadioWidget",
2245
- select: "SelectWidget",
2246
- textarea: "TextareaWidget",
2247
- hidden: "HiddenWidget",
2248
- date: "DateWidget",
2249
- datetime: "DateTimeWidget",
2250
- "date-time": "DateTimeWidget",
2251
- "alt-date": "AltDateWidget",
2252
- "alt-datetime": "AltDateTimeWidget",
2253
- color: "ColorWidget",
2254
- file: "FileWidget"
2254
+ text: 'TextWidget',
2255
+ password: 'PasswordWidget',
2256
+ email: 'EmailWidget',
2257
+ hostname: 'TextWidget',
2258
+ ipv4: 'TextWidget',
2259
+ ipv6: 'TextWidget',
2260
+ uri: 'URLWidget',
2261
+ 'data-url': 'FileWidget',
2262
+ radio: 'RadioWidget',
2263
+ select: 'SelectWidget',
2264
+ textarea: 'TextareaWidget',
2265
+ hidden: 'HiddenWidget',
2266
+ date: 'DateWidget',
2267
+ datetime: 'DateTimeWidget',
2268
+ 'date-time': 'DateTimeWidget',
2269
+ 'alt-date': 'AltDateWidget',
2270
+ 'alt-datetime': 'AltDateTimeWidget',
2271
+ color: 'ColorWidget',
2272
+ file: 'FileWidget'
2255
2273
  },
2256
2274
  number: {
2257
- text: "TextWidget",
2258
- select: "SelectWidget",
2259
- updown: "UpDownWidget",
2260
- range: "RangeWidget",
2261
- radio: "RadioWidget",
2262
- hidden: "HiddenWidget"
2275
+ text: 'TextWidget',
2276
+ select: 'SelectWidget',
2277
+ updown: 'UpDownWidget',
2278
+ range: 'RangeWidget',
2279
+ radio: 'RadioWidget',
2280
+ hidden: 'HiddenWidget'
2263
2281
  },
2264
2282
  integer: {
2265
- text: "TextWidget",
2266
- select: "SelectWidget",
2267
- updown: "UpDownWidget",
2268
- range: "RangeWidget",
2269
- radio: "RadioWidget",
2270
- hidden: "HiddenWidget"
2283
+ text: 'TextWidget',
2284
+ select: 'SelectWidget',
2285
+ updown: 'UpDownWidget',
2286
+ range: 'RangeWidget',
2287
+ radio: 'RadioWidget',
2288
+ hidden: 'HiddenWidget'
2271
2289
  },
2272
2290
  array: {
2273
- select: "SelectWidget",
2274
- checkboxes: "CheckboxesWidget",
2275
- files: "FileWidget",
2276
- hidden: "HiddenWidget"
2291
+ select: 'SelectWidget',
2292
+ checkboxes: 'CheckboxesWidget',
2293
+ files: 'FileWidget',
2294
+ hidden: 'HiddenWidget'
2277
2295
  }
2278
2296
  };
2279
2297
  /** Wraps the given widget with stateless functional component that will merge any `defaultProps.options` with the
@@ -2284,18 +2302,18 @@ var widgetMap = {
2284
2302
  * @returns - The wrapper widget
2285
2303
  */
2286
2304
  function mergeWidgetOptions(AWidget) {
2287
- var MergedWidget = get(AWidget, "MergedWidget");
2305
+ var MergedWidget = get(AWidget, 'MergedWidget');
2288
2306
  // cache return value as property of widget for proper react reconciliation
2289
2307
  if (!MergedWidget) {
2290
2308
  var defaultOptions = AWidget.defaultProps && AWidget.defaultProps.options || {};
2291
2309
  MergedWidget = function MergedWidget(_ref) {
2292
2310
  var options = _ref.options,
2293
2311
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
2294
- return /*#__PURE__*/React.createElement(AWidget, _extends({
2312
+ return jsx(AWidget, _extends({
2295
2313
  options: _extends({}, defaultOptions, options)
2296
2314
  }, props));
2297
2315
  };
2298
- set(AWidget, "MergedWidget", MergedWidget);
2316
+ set(AWidget, 'MergedWidget', MergedWidget);
2299
2317
  }
2300
2318
  return MergedWidget;
2301
2319
  }
@@ -2315,17 +2333,17 @@ function getWidget(schema, widget, registeredWidgets) {
2315
2333
  registeredWidgets = {};
2316
2334
  }
2317
2335
  var type = getSchemaType(schema);
2318
- if (typeof widget === "function" || widget && ReactIs.isForwardRef( /*#__PURE__*/React.createElement(widget)) || ReactIs.isMemo(widget)) {
2336
+ if (typeof widget === 'function' || widget && ReactIs.isForwardRef( /*#__PURE__*/createElement(widget)) || ReactIs.isMemo(widget)) {
2319
2337
  return mergeWidgetOptions(widget);
2320
2338
  }
2321
- if (typeof widget !== "string") {
2339
+ if (typeof widget !== 'string') {
2322
2340
  throw new Error("Unsupported widget definition: " + typeof widget);
2323
2341
  }
2324
2342
  if (widget in registeredWidgets) {
2325
2343
  var registeredWidget = registeredWidgets[widget];
2326
2344
  return getWidget(schema, registeredWidget, registeredWidgets);
2327
2345
  }
2328
- if (typeof type === "string") {
2346
+ if (typeof type === 'string') {
2329
2347
  if (!(type in widgetMap)) {
2330
2348
  throw new Error("No widget for type '" + type + "'");
2331
2349
  }
@@ -2354,7 +2372,7 @@ function hasWidget(schema, widget, registeredWidgets) {
2354
2372
  return true;
2355
2373
  } catch (e) {
2356
2374
  var err = e;
2357
- if (err.message && (err.message.startsWith("No widget") || err.message.startsWith("Unsupported widget"))) {
2375
+ if (err.message && (err.message.startsWith('No widget') || err.message.startsWith('Unsupported widget'))) {
2358
2376
  return false;
2359
2377
  }
2360
2378
  throw e;
@@ -2376,7 +2394,7 @@ function idGenerator(id, suffix) {
2376
2394
  * @returns - The consistent id for the field description element from the given `id`
2377
2395
  */
2378
2396
  function descriptionId(id) {
2379
- return idGenerator(id, "description");
2397
+ return idGenerator(id, 'description');
2380
2398
  }
2381
2399
  /** Return a consistent `id` for the field error element
2382
2400
  *
@@ -2384,7 +2402,7 @@ function descriptionId(id) {
2384
2402
  * @returns - The consistent id for the field error element from the given `id`
2385
2403
  */
2386
2404
  function errorId(id) {
2387
- return idGenerator(id, "error");
2405
+ return idGenerator(id, 'error');
2388
2406
  }
2389
2407
  /** Return a consistent `id` for the field examples element
2390
2408
  *
@@ -2392,7 +2410,7 @@ function errorId(id) {
2392
2410
  * @returns - The consistent id for the field examples element from the given `id`
2393
2411
  */
2394
2412
  function examplesId(id) {
2395
- return idGenerator(id, "examples");
2413
+ return idGenerator(id, 'examples');
2396
2414
  }
2397
2415
  /** Return a consistent `id` for the field help element
2398
2416
  *
@@ -2400,7 +2418,7 @@ function examplesId(id) {
2400
2418
  * @returns - The consistent id for the field help element from the given `id`
2401
2419
  */
2402
2420
  function helpId(id) {
2403
- return idGenerator(id, "help");
2421
+ return idGenerator(id, 'help');
2404
2422
  }
2405
2423
  /** Return a consistent `id` for the field title element
2406
2424
  *
@@ -2408,7 +2426,7 @@ function helpId(id) {
2408
2426
  * @returns - The consistent id for the field title element from the given `id`
2409
2427
  */
2410
2428
  function titleId(id) {
2411
- return idGenerator(id, "title");
2429
+ return idGenerator(id, 'title');
2412
2430
  }
2413
2431
  /** Return a list of element ids that contain additional information about the field that can be used to as the aria
2414
2432
  * description of the field. This is correctly omitting `titleId` which would be "labeling" rather than "describing" the
@@ -2422,7 +2440,7 @@ function ariaDescribedByIds(id, includeExamples) {
2422
2440
  if (includeExamples === void 0) {
2423
2441
  includeExamples = false;
2424
2442
  }
2425
- var examples = includeExamples ? " " + examplesId(id) : "";
2443
+ var examples = includeExamples ? " " + examplesId(id) : '';
2426
2444
  return errorId(id) + " " + descriptionId(id) + " " + helpId(id) + examples;
2427
2445
  }
2428
2446
  /** Return a consistent `id` for the `optionIndex`s of a `Radio` or `Checkboxes` widget
@@ -2458,7 +2476,7 @@ function toConstant(schema) {
2458
2476
  if (CONST_KEY in schema) {
2459
2477
  return schema["const"];
2460
2478
  }
2461
- throw new Error("schema cannot be inferred as a constant");
2479
+ throw new Error('schema cannot be inferred as a constant');
2462
2480
  }
2463
2481
 
2464
2482
  /** Gets the list of options from the schema. If the schema has an enum list, then those enum values are returned. The
@@ -2473,8 +2491,8 @@ function optionsList(schema) {
2473
2491
  // enumNames was deprecated in v5 and is intentionally omitted from the RJSFSchema type.
2474
2492
  // Cast the type to include enumNames so the feature still works.
2475
2493
  var schemaWithEnumNames = schema;
2476
- if (schemaWithEnumNames.enumNames && process.env.NODE_ENV !== "production") {
2477
- console.warn("The enumNames property is deprecated and may be removed in a future major release.");
2494
+ if (schemaWithEnumNames.enumNames && process.env.NODE_ENV !== 'production') {
2495
+ console.warn('The enumNames property is deprecated and may be removed in a future major release.');
2478
2496
  }
2479
2497
  if (schema["enum"]) {
2480
2498
  return schema["enum"].map(function (value, i) {
@@ -2523,21 +2541,21 @@ function orderProperties(properties, order) {
2523
2541
  };
2524
2542
  var propertyHash = arrayToHash(properties);
2525
2543
  var orderFiltered = order.filter(function (prop) {
2526
- return prop === "*" || propertyHash[prop];
2544
+ return prop === '*' || propertyHash[prop];
2527
2545
  });
2528
2546
  var orderHash = arrayToHash(orderFiltered);
2529
2547
  var rest = properties.filter(function (prop) {
2530
2548
  return !orderHash[prop];
2531
2549
  });
2532
- var restIndex = orderFiltered.indexOf("*");
2550
+ var restIndex = orderFiltered.indexOf('*');
2533
2551
  if (restIndex === -1) {
2534
2552
  if (rest.length) {
2535
2553
  throw new Error("uiSchema order list does not contain " + errorPropList(rest));
2536
2554
  }
2537
2555
  return orderFiltered;
2538
2556
  }
2539
- if (restIndex !== orderFiltered.lastIndexOf("*")) {
2540
- throw new Error("uiSchema order list contains more than one wildcard item");
2557
+ if (restIndex !== orderFiltered.lastIndexOf('*')) {
2558
+ throw new Error('uiSchema order list contains more than one wildcard item');
2541
2559
  }
2542
2560
  var complete = [].concat(orderFiltered);
2543
2561
  complete.splice.apply(complete, [restIndex, 1].concat(rest));
@@ -2553,7 +2571,7 @@ function orderProperties(properties, order) {
2553
2571
  function pad(num, width) {
2554
2572
  var s = String(num);
2555
2573
  while (s.length < width) {
2556
- s = "0" + s;
2574
+ s = '0' + s;
2557
2575
  }
2558
2576
  return s;
2559
2577
  }
@@ -2581,7 +2599,7 @@ function parseDateString(dateString, includeTime) {
2581
2599
  }
2582
2600
  var date = new Date(dateString);
2583
2601
  if (Number.isNaN(date.getTime())) {
2584
- throw new Error("Unable to parse date " + dateString);
2602
+ throw new Error('Unable to parse date ' + dateString);
2585
2603
  }
2586
2604
  return {
2587
2605
  year: date.getUTCFullYear(),
@@ -2675,7 +2693,7 @@ function toDateString(dateObject, time) {
2675
2693
  */
2676
2694
  function utcToLocal(jsonDate) {
2677
2695
  if (!jsonDate) {
2678
- return "";
2696
+ return '';
2679
2697
  }
2680
2698
  // required format of `'yyyy-MM-ddThh:mm' followed by optional ':ss' or ':ss.SSS'
2681
2699
  // https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type%3Ddatetime-local)