@rjsf/utils 6.0.0-beta.14 → 6.0.0-beta.16

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.
@@ -1438,7 +1438,7 @@ function mergeDefaultsWithFormData(defaults, formData, mergeExtraArrayDefaults =
1438
1438
  return acc2;
1439
1439
  }, acc);
1440
1440
  }
1441
- if (defaultSupercedesUndefined && (!(0, import_isNil.default)(defaults) && (0, import_isNil.default)(formData) || typeof formData === "number" && isNaN(formData)) || overrideFormDataWithDefaults && !(0, import_isNil.default)(formData)) {
1441
+ if (defaultSupercedesUndefined && (!(defaults === void 0) && (0, import_isNil.default)(formData) || typeof formData === "number" && isNaN(formData)) || overrideFormDataWithDefaults && !(0, import_isNil.default)(formData)) {
1442
1442
  return defaults;
1443
1443
  }
1444
1444
  return formData;
@@ -1923,8 +1923,9 @@ function getArrayDefaults(validator, rawSchema, {
1923
1923
  const defaultEntries = defaults || [];
1924
1924
  const fillerSchema = getInnerSchemaForArrayItem(schema, 1 /* Invert */);
1925
1925
  const fillerDefault = fillerSchema.default;
1926
- const fillerEntries = new Array(schema.minItems - defaultsLength).fill(
1927
- computeDefaults(validator, fillerSchema, {
1926
+ const fillerEntries = Array.from(
1927
+ { length: schema.minItems - defaultsLength },
1928
+ () => computeDefaults(validator, fillerSchema, {
1928
1929
  parentDefaults: fillerDefault,
1929
1930
  rootSchema,
1930
1931
  _recurseList,
@@ -2996,8 +2997,8 @@ function getTemplate(name, registry, uiOptions = {}) {
2996
2997
  }
2997
2998
 
2998
2999
  // src/getTestIds.ts
2999
- var import_nanoid = require("nanoid");
3000
3000
  var import_get18 = __toESM(require("lodash/get"), 1);
3001
+ var import_uniqueId = __toESM(require("lodash/uniqueId"), 1);
3001
3002
  function getTestIds() {
3002
3003
  if (typeof process === "undefined" || (0, import_get18.default)(process, "env.NODE_ENV") !== "test") {
3003
3004
  return {};
@@ -3008,7 +3009,7 @@ function getTestIds() {
3008
3009
  {
3009
3010
  get(_obj, prop) {
3010
3011
  if (!ids.has(prop)) {
3011
- ids.set(prop, (0, import_nanoid.nanoid)());
3012
+ ids.set(prop, (0, import_uniqueId.default)("test-id-"));
3012
3013
  }
3013
3014
  return ids.get(prop);
3014
3015
  }
@@ -3091,7 +3092,7 @@ function getWidget(schema, widget, registeredWidgets = {}) {
3091
3092
  return mergeWidgetOptions(widget);
3092
3093
  }
3093
3094
  if (typeof widget !== "string") {
3094
- throw new Error(`Unsupported widget definition: ${typeof widget}`);
3095
+ throw new Error(`Unsupported widget definition: ${typeof widget} in schema: ${JSON.stringify(schema)}`);
3095
3096
  }
3096
3097
  if (widget in registeredWidgets) {
3097
3098
  const registeredWidget = registeredWidgets[widget];
@@ -3099,14 +3100,14 @@ function getWidget(schema, widget, registeredWidgets = {}) {
3099
3100
  }
3100
3101
  if (typeof type === "string") {
3101
3102
  if (!(type in widgetMap)) {
3102
- throw new Error(`No widget for type '${type}'`);
3103
+ throw new Error(`No widget for type '${type}' in schema: ${JSON.stringify(schema)}`);
3103
3104
  }
3104
3105
  if (widget in widgetMap[type]) {
3105
3106
  const registeredWidget = registeredWidgets[widgetMap[type][widget]];
3106
3107
  return getWidget(schema, registeredWidget, registeredWidgets);
3107
3108
  }
3108
3109
  }
3109
- throw new Error(`No widget '${widget}' for type '${type}'`);
3110
+ throw new Error(`No widget '${widget}' for type '${type}' in schema: ${JSON.stringify(schema)}`);
3110
3111
  }
3111
3112
 
3112
3113
  // src/hashForSchema.ts
@@ -3604,4 +3605,4 @@ function schemaParser(rootSchema) {
3604
3605
  parseSchema(validator, recurseList, rootSchema, rootSchema);
3605
3606
  return validator.getSchemaMap();
3606
3607
  }
3607
- //# sourceMappingURL=index.js.map
3608
+ //# sourceMappingURL=index.cjs.map