@rjsf/utils 5.5.2 → 5.6.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.
@@ -1,11 +1,12 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash-es/isEqualWith'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('jsonpointer'), require('lodash-es/omit'), require('lodash-es/has'), require('lodash-es/isObject'), require('lodash-es/isString'), require('lodash-es/reduce'), require('lodash-es/times'), require('lodash-es/set'), require('json-schema-merge-allof'), require('lodash-es/union'), require('lodash-es/isEqual'), require('lodash-es/cloneDeep'), require('react/jsx-runtime'), require('react'), require('react-is')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'lodash-es/isEqualWith', 'lodash-es/get', 'lodash-es/isEmpty', 'jsonpointer', 'lodash-es/omit', 'lodash-es/has', 'lodash-es/isObject', 'lodash-es/isString', 'lodash-es/reduce', 'lodash-es/times', 'lodash-es/set', 'json-schema-merge-allof', 'lodash-es/union', 'lodash-es/isEqual', 'lodash-es/cloneDeep', 'react/jsx-runtime', 'react', 'react-is'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/utils"] = {}, global.isEqualWith, global.get, global.isEmpty, global.jsonpointer, global.omit, global.has, global.isObject$1, global.isString, global.reduce, global.times, global.set, global.mergeAllOf, global.union, global.isEqual, global.cloneDeep, global.jsxRuntime, global.React, global.ReactIs));
5
- })(this, (function (exports, isEqualWith, get, isEmpty, jsonpointer, omit, has, isObject$1, isString, reduce, times, set, mergeAllOf, union, isEqual, cloneDeep, jsxRuntime, react, ReactIs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash-es/isPlainObject'), require('lodash-es/isEqualWith'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('jsonpointer'), require('lodash-es/omit'), require('lodash-es/has'), require('lodash-es/isObject'), require('lodash-es/isString'), require('lodash-es/reduce'), require('lodash-es/times'), require('lodash-es/set'), require('json-schema-merge-allof'), require('lodash-es/union'), require('lodash-es/isEqual'), require('lodash-es/cloneDeep'), require('react/jsx-runtime'), require('react'), require('react-is'), require('lodash-es/toPath')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'lodash-es/isPlainObject', 'lodash-es/isEqualWith', 'lodash-es/get', 'lodash-es/isEmpty', 'jsonpointer', 'lodash-es/omit', 'lodash-es/has', 'lodash-es/isObject', 'lodash-es/isString', 'lodash-es/reduce', 'lodash-es/times', 'lodash-es/set', 'json-schema-merge-allof', 'lodash-es/union', 'lodash-es/isEqual', 'lodash-es/cloneDeep', 'react/jsx-runtime', 'react', 'react-is', 'lodash-es/toPath'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/utils"] = {}, global.isPlainObject, global.isEqualWith, global.get, global.isEmpty, global.jsonpointer, global.omit, global.has, global.isObject$1, global.isString, global.reduce, global.times, global.set, global.mergeAllOf, global.union, global.isEqual, global.cloneDeep, global.jsxRuntime, global.React, global.ReactIs, global.toPath));
5
+ })(this, (function (exports, isPlainObject, isEqualWith, get, isEmpty, jsonpointer, omit, has, isObject$1, isString, reduce, times, set, mergeAllOf, union, isEqual, cloneDeep, jsxRuntime, react, ReactIs, toPath) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
+ var isPlainObject__default = /*#__PURE__*/_interopDefaultLegacy(isPlainObject);
9
10
  var isEqualWith__default = /*#__PURE__*/_interopDefaultLegacy(isEqualWith);
10
11
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
11
12
  var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
@@ -22,6 +23,7 @@
22
23
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
23
24
  var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
24
25
  var ReactIs__default = /*#__PURE__*/_interopDefaultLegacy(ReactIs);
26
+ var toPath__default = /*#__PURE__*/_interopDefaultLegacy(toPath);
25
27
 
26
28
  /** Determines whether a `thing` is an object for the purposes of RSJF. In this case, `thing` is an object if it has
27
29
  * the type `object` but is NOT null, an array or a File.
@@ -173,6 +175,7 @@
173
175
  var SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';
174
176
  var REF_KEY = '$ref';
175
177
  var RJSF_ADDITONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';
178
+ var ROOT_SCHEMA_PREFIX = '__rjsf_rootSchema';
176
179
  var UI_FIELD_KEY = 'ui:field';
177
180
  var UI_WIDGET_KEY = 'ui:widget';
178
181
  var UI_OPTIONS_KEY = 'ui:options';
@@ -238,6 +241,32 @@
238
241
  return true;
239
242
  }
240
243
 
244
+ /** Given a `formData` object, recursively creates a `FormValidation` error handling structure around it
245
+ *
246
+ * @param formData - The form data around which the error handler is created
247
+ * @returns - A `FormValidation` object based on the `formData` structure
248
+ */
249
+ function createErrorHandler(formData) {
250
+ var _handler;
251
+ var handler = (_handler = {}, _handler[ERRORS_KEY] = [], _handler.addError = function addError(message) {
252
+ this[ERRORS_KEY].push(message);
253
+ }, _handler);
254
+ if (Array.isArray(formData)) {
255
+ return formData.reduce(function (acc, value, key) {
256
+ var _extends2;
257
+ return _extends({}, acc, (_extends2 = {}, _extends2[key] = createErrorHandler(value), _extends2));
258
+ }, handler);
259
+ }
260
+ if (isPlainObject__default["default"](formData)) {
261
+ var formObject = formData;
262
+ return Object.keys(formObject).reduce(function (acc, key) {
263
+ var _extends3;
264
+ return _extends({}, acc, (_extends3 = {}, _extends3[key] = createErrorHandler(formObject[key]), _extends3));
265
+ }, handler);
266
+ }
267
+ return handler;
268
+ }
269
+
241
270
  /** Implements a deep equals using the `lodash.isEqualWith` function, that provides a customized comparator that
242
271
  * assumes all functions are equivalent.
243
272
  *
@@ -313,10 +342,12 @@
313
342
  * @param formData - The current formData, if any, used to figure out a match
314
343
  * @param options - The list of options to find a matching options from
315
344
  * @param rootSchema - The root schema, used to primarily to look up `$ref`s
345
+ * @param [discriminatorField] - The optional name of the field within the options object whose value is used to
346
+ * determine which option is selected
316
347
  * @returns - The index of the matched option or 0 if none is available
317
348
  * @deprecated
318
349
  */
319
- function getMatchingOption(validator, formData, options, rootSchema) {
350
+ function getMatchingOption(validator, formData, options, rootSchema, discriminatorField) {
320
351
  // For performance, skip validating subschemas if formData is undefined. We just
321
352
  // want to get the first option in that case.
322
353
  if (formData === undefined) {
@@ -324,18 +355,26 @@
324
355
  }
325
356
  for (var i = 0; i < options.length; i++) {
326
357
  var option = options[i];
327
- // If the schema describes an object then we need to add slightly more
328
- // strict matching to the schema, because unless the schema uses the
329
- // "requires" keyword, an object will match the schema as long as it
330
- // doesn't have matching keys with a conflicting type. To do this we use an
331
- // "anyOf" with an array of requires. This augmentation expresses that the
332
- // schema should match if any of the keys in the schema are present on the
333
- // object and pass validation.
334
- if (option.properties) {
358
+ // If we have a discriminator field, then we will use this to make the determination
359
+ if (discriminatorField && has__default["default"](option, [PROPERTIES_KEY, discriminatorField])) {
360
+ var value = get__default["default"](formData, discriminatorField);
361
+ var discriminator = get__default["default"](option, [PROPERTIES_KEY, discriminatorField], {});
362
+ if (validator.isValid(discriminator, value, rootSchema)) {
363
+ return i;
364
+ }
365
+ } else if (option[PROPERTIES_KEY]) {
366
+ // If the schema describes an object then we need to add slightly more
367
+ // strict matching to the schema, because unless the schema uses the
368
+ // "requires" keyword, an object will match the schema as long as it
369
+ // doesn't have matching keys with a conflicting type. To do this we use an
370
+ // "anyOf" with an array of requires. This augmentation expresses that the
371
+ // schema should match if any of the keys in the schema are present on the
372
+ // object and pass validation.
373
+ //
335
374
  // Create an "anyOf" schema that requires at least one of the keys in the
336
375
  // "properties" object
337
376
  var requiresAnyOf = {
338
- anyOf: Object.keys(option.properties).map(function (key) {
377
+ anyOf: Object.keys(option[PROPERTIES_KEY]).map(function (key) {
339
378
  return {
340
379
  required: [key]
341
380
  };
@@ -377,10 +416,12 @@
377
416
  * @param formData - The current formData, if any, used to figure out a match
378
417
  * @param options - The list of options to find a matching options from
379
418
  * @param rootSchema - The root schema, used to primarily to look up `$ref`s
419
+ * @param [discriminatorField] - The optional name of the field within the options object whose value is used to
420
+ * determine which option is selected
380
421
  * @returns - The index of the first matched option or 0 if none is available
381
422
  */
382
- function getFirstMatchingOption(validator, formData, options, rootSchema) {
383
- return getMatchingOption(validator, formData, options, rootSchema);
423
+ function getFirstMatchingOption(validator, formData, options, rootSchema, discriminatorField) {
424
+ return getMatchingOption(validator, formData, options, rootSchema, discriminatorField);
384
425
  }
385
426
 
386
427
  /** Given a specific `value` attempts to guess the type of a schema element. In the case where we have to implicitly
@@ -856,16 +897,18 @@
856
897
  * @param formData - The form data associated with the schema
857
898
  * @param options - The list of options that can be selected from
858
899
  * @param [selectedOption=-1] - The index of the currently selected option, defaulted to -1 if not specified
900
+ * @param [discriminatorField] - The optional name of the field within the options object whose value is used to
901
+ * determine which option is selected
859
902
  * @returns - The index of the option that is the closest match to the `formData` or the `selectedOption` if no match
860
903
  */
861
- function getClosestMatchingOption(validator, rootSchema, formData, options, selectedOption) {
904
+ function getClosestMatchingOption(validator, rootSchema, formData, options, selectedOption, discriminatorField) {
862
905
  if (selectedOption === void 0) {
863
906
  selectedOption = -1;
864
907
  }
865
908
  // Reduce the array of options down to a list of the indexes that are considered matching options
866
909
  var allValidIndexes = options.reduce(function (validList, option, index) {
867
910
  var testOptions = [JUNK_OPTION, option];
868
- var match = getFirstMatchingOption(validator, formData, testOptions, rootSchema);
911
+ var match = getFirstMatchingOption(validator, formData, testOptions, rootSchema, discriminatorField);
869
912
  // The match is the real option, so add its index to list of valid indexes
870
913
  if (match === 1) {
871
914
  validList.push(index);
@@ -1359,6 +1402,8 @@
1359
1402
  * @param validationData - The current `ValidationData` into which to merge the additional errors
1360
1403
  * @param [additionalErrorSchema] - The additional set of errors in an `ErrorSchema`
1361
1404
  * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
1405
+ * @deprecated - Use the `validationDataMerge()` function exported from `@rjsf/utils` instead. This function will be
1406
+ * removed in the next major release.
1362
1407
  */
1363
1408
  function mergeValidationData(validator, validationData, additionalErrorSchema) {
1364
1409
  if (!additionalErrorSchema) {
@@ -1574,7 +1619,7 @@
1574
1619
  var idSchema = {
1575
1620
  $id: $id
1576
1621
  };
1577
- if (schema.type === 'object' && PROPERTIES_KEY in schema) {
1622
+ if (getSchemaType(schema) === 'object' && PROPERTIES_KEY in schema) {
1578
1623
  for (var name in schema.properties) {
1579
1624
  var field = get__default["default"](schema, [PROPERTIES_KEY, name]);
1580
1625
  var fieldId = idSchema[ID_KEY] + idSeparator + name;
@@ -1752,31 +1797,37 @@
1752
1797
  * @param formData - The form data associated with the schema
1753
1798
  * @param options - The list of options that can be selected from
1754
1799
  * @param [selectedOption] - The index of the currently selected option, defaulted to -1 if not specified
1800
+ * @param [discriminatorField] - The optional name of the field within the options object whose value is used to
1801
+ * determine which option is selected
1755
1802
  * @returns - The index of the option that is the closest match to the `formData` or the `selectedOption` if no match
1756
1803
  */;
1757
- _proto.getClosestMatchingOption = function getClosestMatchingOption$1(formData, options, selectedOption) {
1758
- return getClosestMatchingOption(this.validator, this.rootSchema, formData, options, selectedOption);
1804
+ _proto.getClosestMatchingOption = function getClosestMatchingOption$1(formData, options, selectedOption, discriminatorField) {
1805
+ return getClosestMatchingOption(this.validator, this.rootSchema, formData, options, selectedOption, discriminatorField);
1759
1806
  }
1760
1807
  /** Given the `formData` and list of `options`, attempts to find the index of the first option that matches the data.
1761
1808
  * Always returns the first option if there is nothing that matches.
1762
1809
  *
1763
1810
  * @param formData - The current formData, if any, used to figure out a match
1764
1811
  * @param options - The list of options to find a matching options from
1812
+ * @param [discriminatorField] - The optional name of the field within the options object whose value is used to
1813
+ * determine which option is selected
1765
1814
  * @returns - The firstindex of the matched option or 0 if none is available
1766
1815
  */;
1767
- _proto.getFirstMatchingOption = function getFirstMatchingOption$1(formData, options) {
1768
- return getFirstMatchingOption(this.validator, formData, options, this.rootSchema);
1816
+ _proto.getFirstMatchingOption = function getFirstMatchingOption$1(formData, options, discriminatorField) {
1817
+ return getFirstMatchingOption(this.validator, formData, options, this.rootSchema, discriminatorField);
1769
1818
  }
1770
1819
  /** Given the `formData` and list of `options`, attempts to find the index of the option that best matches the data.
1771
1820
  * Deprecated, use `getFirstMatchingOption()` instead.
1772
1821
  *
1773
1822
  * @param formData - The current formData, if any, onto which to provide any missing defaults
1774
1823
  * @param options - The list of options to find a matching options from
1824
+ * @param [discriminatorField] - The optional name of the field within the options object whose value is used to
1825
+ * determine which option is selected
1775
1826
  * @returns - The index of the matched option or 0 if none is available
1776
1827
  * @deprecated
1777
1828
  */;
1778
- _proto.getMatchingOption = function getMatchingOption$1(formData, options) {
1779
- return getMatchingOption(this.validator, formData, options, this.rootSchema);
1829
+ _proto.getMatchingOption = function getMatchingOption$1(formData, options, discriminatorField) {
1830
+ return getMatchingOption(this.validator, formData, options, this.rootSchema, discriminatorField);
1780
1831
  }
1781
1832
  /** Checks to see if the `schema` and `uiSchema` combination represents an array of files
1782
1833
  *
@@ -1811,6 +1862,8 @@
1811
1862
  * @param validationData - The current `ValidationData` into which to merge the additional errors
1812
1863
  * @param [additionalErrorSchema] - The additional set of errors
1813
1864
  * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
1865
+ * @deprecated - Use the `validationDataMerge()` function exported from `@rjsf/utils` instead. This function will be
1866
+ * removed in the next major release.
1814
1867
  */;
1815
1868
  _proto.mergeValidationData = function mergeValidationData$1(validationData, additionalErrorSchema) {
1816
1869
  return mergeValidationData(this.validator, validationData, additionalErrorSchema);
@@ -2768,6 +2821,102 @@
2768
2821
  return time ? datetime : datetime.slice(0, 10);
2769
2822
  }
2770
2823
 
2824
+ /** Converts an `errorSchema` into a list of `RJSFValidationErrors`
2825
+ *
2826
+ * @param errorSchema - The `ErrorSchema` instance to convert
2827
+ * @param [fieldPath=[]] - The current field path, defaults to [] if not specified
2828
+ * @returns - The list of `RJSFValidationErrors` extracted from the `errorSchema`
2829
+ */
2830
+ function toErrorList(errorSchema, fieldPath) {
2831
+ if (fieldPath === void 0) {
2832
+ fieldPath = [];
2833
+ }
2834
+ if (!errorSchema) {
2835
+ return [];
2836
+ }
2837
+ var errorList = [];
2838
+ if (ERRORS_KEY in errorSchema) {
2839
+ errorList = errorList.concat(errorSchema[ERRORS_KEY].map(function (message) {
2840
+ var property = "." + fieldPath.join('.');
2841
+ return {
2842
+ property: property,
2843
+ message: message,
2844
+ stack: property + " " + message
2845
+ };
2846
+ }));
2847
+ }
2848
+ return Object.keys(errorSchema).reduce(function (acc, key) {
2849
+ if (key !== ERRORS_KEY) {
2850
+ var childSchema = errorSchema[key];
2851
+ if (isPlainObject__default["default"](childSchema)) {
2852
+ acc = acc.concat(toErrorList(childSchema, [].concat(fieldPath, [key])));
2853
+ }
2854
+ }
2855
+ return acc;
2856
+ }, errorList);
2857
+ }
2858
+
2859
+ /** Transforms a rjsf validation errors list:
2860
+ * [
2861
+ * {property: '.level1.level2[2].level3', message: 'err a'},
2862
+ * {property: '.level1.level2[2].level3', message: 'err b'},
2863
+ * {property: '.level1.level2[4].level3', message: 'err b'},
2864
+ * ]
2865
+ * Into an error tree:
2866
+ * {
2867
+ * level1: {
2868
+ * level2: {
2869
+ * 2: {level3: {errors: ['err a', 'err b']}},
2870
+ * 4: {level3: {errors: ['err b']}},
2871
+ * }
2872
+ * }
2873
+ * };
2874
+ *
2875
+ * @param errors - The list of RJSFValidationError objects
2876
+ * @returns - The `ErrorSchema` built from the list of `RJSFValidationErrors`
2877
+ */
2878
+ function toErrorSchema(errors) {
2879
+ var builder = new ErrorSchemaBuilder();
2880
+ if (errors.length) {
2881
+ errors.forEach(function (error) {
2882
+ var property = error.property,
2883
+ message = error.message;
2884
+ // When the property is the root element, just use an empty array for the path
2885
+ var path = property === '.' ? [] : toPath__default["default"](property);
2886
+ // If the property is at the root (.level1) then toPath creates
2887
+ // an empty array element at the first index. Remove it.
2888
+ if (path.length > 0 && path[0] === '') {
2889
+ path.splice(0, 1);
2890
+ }
2891
+ if (message) {
2892
+ builder.addErrors(message, path);
2893
+ }
2894
+ });
2895
+ }
2896
+ return builder.ErrorSchema;
2897
+ }
2898
+
2899
+ /** Unwraps the `errorHandler` structure into the associated `ErrorSchema`, stripping the `addError()` functions from it
2900
+ *
2901
+ * @param errorHandler - The `FormValidation` error handling structure
2902
+ * @returns - The `ErrorSchema` resulting from the stripping of the `addError()` function
2903
+ */
2904
+ function unwrapErrorHandler(errorHandler) {
2905
+ return Object.keys(errorHandler).reduce(function (acc, key) {
2906
+ if (key === 'addError') {
2907
+ return acc;
2908
+ } else {
2909
+ var _extends3;
2910
+ var childSchema = errorHandler[key];
2911
+ if (isPlainObject__default["default"](childSchema)) {
2912
+ var _extends2;
2913
+ return _extends({}, acc, (_extends2 = {}, _extends2[key] = unwrapErrorHandler(childSchema), _extends2));
2914
+ }
2915
+ return _extends({}, acc, (_extends3 = {}, _extends3[key] = childSchema, _extends3));
2916
+ }
2917
+ }, {});
2918
+ }
2919
+
2771
2920
  /** Converts a UTC date string into a local Date format
2772
2921
  *
2773
2922
  * @param jsonDate - A UTC date string
@@ -2793,6 +2942,77 @@
2793
2942
  return yyyy + "-" + MM + "-" + dd + "T" + hh + ":" + mm + ":" + ss + "." + SSS;
2794
2943
  }
2795
2944
 
2945
+ /** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the
2946
+ * two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
2947
+ * `toErrorList()` on the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
2948
+ * `validationData` is returned.
2949
+ *
2950
+ * @param validationData - The current `ValidationData` into which to merge the additional errors
2951
+ * @param [additionalErrorSchema] - The optional additional set of errors in an `ErrorSchema`
2952
+ * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
2953
+ */
2954
+ function validationDataMerge(validationData, additionalErrorSchema) {
2955
+ if (!additionalErrorSchema) {
2956
+ return validationData;
2957
+ }
2958
+ var oldErrors = validationData.errors,
2959
+ oldErrorSchema = validationData.errorSchema;
2960
+ var errors = toErrorList(additionalErrorSchema);
2961
+ var errorSchema = additionalErrorSchema;
2962
+ if (!isEmpty__default["default"](oldErrorSchema)) {
2963
+ errorSchema = mergeObjects(oldErrorSchema, additionalErrorSchema, true);
2964
+ errors = [].concat(oldErrors).concat(errors);
2965
+ }
2966
+ return {
2967
+ errorSchema: errorSchema,
2968
+ errors: errors
2969
+ };
2970
+ }
2971
+
2972
+ /** Takes a `node` object and transforms any contained `$ref` node variables with a prefix, recursively calling
2973
+ * `withIdRefPrefix` for any other elements.
2974
+ *
2975
+ * @param node - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it
2976
+ */
2977
+ function withIdRefPrefixObject(node) {
2978
+ for (var key in node) {
2979
+ var realObj = node;
2980
+ var value = realObj[key];
2981
+ if (key === REF_KEY && typeof value === 'string' && value.startsWith('#')) {
2982
+ realObj[key] = ROOT_SCHEMA_PREFIX + value;
2983
+ } else {
2984
+ realObj[key] = withIdRefPrefix(value);
2985
+ }
2986
+ }
2987
+ return node;
2988
+ }
2989
+ /** Takes a `node` object list and transforms any contained `$ref` node variables with a prefix, recursively calling
2990
+ * `withIdRefPrefix` for any other elements.
2991
+ *
2992
+ * @param node - The list of object nodes to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it
2993
+ */
2994
+ function withIdRefPrefixArray(node) {
2995
+ for (var i = 0; i < node.length; i++) {
2996
+ node[i] = withIdRefPrefix(node[i]);
2997
+ }
2998
+ return node;
2999
+ }
3000
+ /** Recursively prefixes all `$ref`s in a schema with the value of the `ROOT_SCHEMA_PREFIX` constant.
3001
+ * This is used in isValid to make references to the rootSchema
3002
+ *
3003
+ * @param schemaNode - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it
3004
+ * @returns - A copy of the `schemaNode` with updated `$ref`s
3005
+ */
3006
+ function withIdRefPrefix(schemaNode) {
3007
+ if (schemaNode.constructor === Object) {
3008
+ return withIdRefPrefixObject(_extends({}, schemaNode));
3009
+ }
3010
+ if (Array.isArray(schemaNode)) {
3011
+ return withIdRefPrefixArray([].concat(schemaNode));
3012
+ }
3013
+ return schemaNode;
3014
+ }
3015
+
2796
3016
  /** An enumeration of all the translatable strings used by `@rjsf/core` and its themes. The value of each of the
2797
3017
  * enumeration keys is expected to be the actual english string. Some strings contain replaceable parameter values
2798
3018
  * as indicated by `%1`, `%2`, etc. The number after the `%` indicates the order of the parameter. The ordering of
@@ -2888,6 +3108,7 @@
2888
3108
  exports.REF_KEY = REF_KEY;
2889
3109
  exports.REQUIRED_KEY = REQUIRED_KEY;
2890
3110
  exports.RJSF_ADDITONAL_PROPERTIES_FLAG = RJSF_ADDITONAL_PROPERTIES_FLAG;
3111
+ exports.ROOT_SCHEMA_PREFIX = ROOT_SCHEMA_PREFIX;
2891
3112
  exports.SUBMIT_BTN_OPTIONS_KEY = SUBMIT_BTN_OPTIONS_KEY;
2892
3113
  exports.UI_FIELD_KEY = UI_FIELD_KEY;
2893
3114
  exports.UI_GLOBAL_OPTIONS_KEY = UI_GLOBAL_OPTIONS_KEY;
@@ -2897,6 +3118,7 @@
2897
3118
  exports.ariaDescribedByIds = ariaDescribedByIds;
2898
3119
  exports.asNumber = asNumber;
2899
3120
  exports.canExpand = canExpand;
3121
+ exports.createErrorHandler = createErrorHandler;
2900
3122
  exports.createSchemaUtils = createSchemaUtils;
2901
3123
  exports.dataURItoBlob = dataURItoBlob;
2902
3124
  exports.deepEquals = deepEquals;
@@ -2951,9 +3173,14 @@
2951
3173
  exports.titleId = titleId;
2952
3174
  exports.toConstant = toConstant;
2953
3175
  exports.toDateString = toDateString;
3176
+ exports.toErrorList = toErrorList;
3177
+ exports.toErrorSchema = toErrorSchema;
2954
3178
  exports.toIdSchema = toIdSchema;
2955
3179
  exports.toPathSchema = toPathSchema;
3180
+ exports.unwrapErrorHandler = unwrapErrorHandler;
2956
3181
  exports.utcToLocal = utcToLocal;
3182
+ exports.validationDataMerge = validationDataMerge;
3183
+ exports.withIdRefPrefix = withIdRefPrefix;
2957
3184
 
2958
3185
  Object.defineProperty(exports, '__esModule', { value: true });
2959
3186