@rjsf/utils 6.5.2 → 6.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.
Files changed (146) hide show
  1. package/dist/index.cjs +628 -441
  2. package/dist/index.cjs.map +4 -4
  3. package/dist/utils.esm.js +624 -437
  4. package/dist/utils.esm.js.map +4 -4
  5. package/dist/utils.umd.js +632 -445
  6. package/lib/ErrorSchemaBuilder.js.map +1 -1
  7. package/lib/canExpand.js.map +1 -1
  8. package/lib/constIsAjvDataReference.js +1 -1
  9. package/lib/constIsAjvDataReference.js.map +1 -1
  10. package/lib/createSchemaUtils.js +3 -3
  11. package/lib/createSchemaUtils.js.map +1 -1
  12. package/lib/enumOptionSelectedValue.js.map +1 -1
  13. package/lib/enumOptionValueDecoder.js.map +1 -1
  14. package/lib/enumOptionsDeselectValue.js +1 -1
  15. package/lib/enumOptionsDeselectValue.js.map +1 -1
  16. package/lib/enumOptionsIndexForValue.js.map +1 -1
  17. package/lib/enumOptionsIsSelected.js.map +1 -1
  18. package/lib/enumOptionsSelectValue.js +1 -1
  19. package/lib/enumOptionsSelectValue.js.map +1 -1
  20. package/lib/enumOptionsValueForIndex.js +2 -2
  21. package/lib/enumOptionsValueForIndex.js.map +1 -1
  22. package/lib/enums.d.ts +2 -0
  23. package/lib/enums.js +2 -0
  24. package/lib/enums.js.map +1 -1
  25. package/lib/findSchemaDefinition.js +4 -4
  26. package/lib/findSchemaDefinition.js.map +1 -1
  27. package/lib/getChangedFields.js +3 -3
  28. package/lib/getChangedFields.js.map +1 -1
  29. package/lib/getDiscriminatorFieldFromSchema.js.map +1 -1
  30. package/lib/getOptionMatchingSimpleDiscriminator.js.map +1 -1
  31. package/lib/getTestIds.d.ts +1 -1
  32. package/lib/getTestIds.js +4 -3
  33. package/lib/getTestIds.js.map +1 -1
  34. package/lib/getWidget.js +1 -1
  35. package/lib/getWidget.js.map +1 -1
  36. package/lib/idGenerators.js.map +1 -1
  37. package/lib/index.d.ts +6 -6
  38. package/lib/index.js +6 -6
  39. package/lib/index.js.map +1 -1
  40. package/lib/isFormDataAvailable.js +1 -1
  41. package/lib/isFormDataAvailable.js.map +1 -1
  42. package/lib/isRootSchema.js +1 -1
  43. package/lib/isRootSchema.js.map +1 -1
  44. package/lib/jsonSchemaAugmentation.d.ts +19 -0
  45. package/lib/jsonSchemaAugmentation.js +2 -0
  46. package/lib/jsonSchemaAugmentation.js.map +1 -0
  47. package/lib/mergeDefaultsWithFormData.js +2 -2
  48. package/lib/mergeDefaultsWithFormData.js.map +1 -1
  49. package/lib/parser/ParserValidator.js +1 -1
  50. package/lib/parser/ParserValidator.js.map +1 -1
  51. package/lib/parser/index.d.ts +1 -1
  52. package/lib/parser/index.js.map +1 -1
  53. package/lib/parser/schemaParser.js +2 -2
  54. package/lib/parser/schemaParser.js.map +1 -1
  55. package/lib/removeOptionalEmptyObjects.d.ts +2 -0
  56. package/lib/removeOptionalEmptyObjects.js +8 -29
  57. package/lib/removeOptionalEmptyObjects.js.map +1 -1
  58. package/lib/schema/findFieldInSchema.d.ts +2 -2
  59. package/lib/schema/findFieldInSchema.js +7 -6
  60. package/lib/schema/findFieldInSchema.js.map +1 -1
  61. package/lib/schema/findSelectedOptionInXxxOf.js +1 -1
  62. package/lib/schema/findSelectedOptionInXxxOf.js.map +1 -1
  63. package/lib/schema/getClosestMatchingOption.js +3 -3
  64. package/lib/schema/getClosestMatchingOption.js.map +1 -1
  65. package/lib/schema/getDefaultFormState.d.ts +4 -4
  66. package/lib/schema/getDefaultFormState.js +17 -22
  67. package/lib/schema/getDefaultFormState.js.map +1 -1
  68. package/lib/schema/getFromSchema.d.ts +3 -3
  69. package/lib/schema/getFromSchema.js +3 -3
  70. package/lib/schema/getFromSchema.js.map +1 -1
  71. package/lib/schema/index.d.ts +4 -4
  72. package/lib/schema/index.js +4 -4
  73. package/lib/schema/index.js.map +1 -1
  74. package/lib/schema/isMultiSelect.js.map +1 -1
  75. package/lib/schema/omitExtraData.d.ts +18 -8
  76. package/lib/schema/omitExtraData.js +352 -16
  77. package/lib/schema/omitExtraData.js.map +1 -1
  78. package/lib/schema/retrieveSchema.d.ts +15 -0
  79. package/lib/schema/retrieveSchema.js +36 -13
  80. package/lib/schema/retrieveSchema.js.map +1 -1
  81. package/lib/schema/sanitizeDataForNewSchema.js.map +1 -1
  82. package/lib/schema/shallowAllOfMerge.d.ts +11 -0
  83. package/lib/schema/shallowAllOfMerge.js +18 -0
  84. package/lib/schema/shallowAllOfMerge.js.map +1 -0
  85. package/lib/schema/toPathSchema.d.ts +1 -0
  86. package/lib/schema/toPathSchema.js +2 -1
  87. package/lib/schema/toPathSchema.js.map +1 -1
  88. package/lib/shouldRenderOptionalField.js +1 -1
  89. package/lib/shouldRenderOptionalField.js.map +1 -1
  90. package/lib/toErrorSchema.js.map +1 -1
  91. package/lib/tsconfig.tsbuildinfo +1 -1
  92. package/lib/types.d.ts +17 -5
  93. package/lib/types.js +1 -1
  94. package/lib/types.js.map +1 -1
  95. package/lib/useFileWidgetProps.d.ts +1 -1
  96. package/lib/useFileWidgetProps.js +9 -10
  97. package/lib/useFileWidgetProps.js.map +1 -1
  98. package/lib/withIdRefPrefix.js +1 -1
  99. package/lib/withIdRefPrefix.js.map +1 -1
  100. package/package.json +11 -11
  101. package/src/ErrorSchemaBuilder.ts +1 -1
  102. package/src/canExpand.ts +1 -1
  103. package/src/constIsAjvDataReference.ts +3 -2
  104. package/src/createSchemaUtils.ts +22 -20
  105. package/src/enumOptionSelectedValue.ts +1 -1
  106. package/src/enumOptionValueDecoder.ts +1 -1
  107. package/src/enumOptionsDeselectValue.ts +2 -2
  108. package/src/enumOptionsIndexForValue.ts +1 -1
  109. package/src/enumOptionsIsSelected.ts +1 -1
  110. package/src/enumOptionsSelectValue.ts +3 -2
  111. package/src/enumOptionsValueForIndex.ts +2 -2
  112. package/src/enums.ts +2 -0
  113. package/src/findSchemaDefinition.ts +4 -4
  114. package/src/getChangedFields.ts +4 -3
  115. package/src/getDiscriminatorFieldFromSchema.ts +1 -1
  116. package/src/getOptionMatchingSimpleDiscriminator.ts +1 -0
  117. package/src/getTestIds.ts +4 -3
  118. package/src/getWidget.tsx +2 -2
  119. package/src/idGenerators.ts +1 -1
  120. package/src/index.ts +6 -6
  121. package/src/isFormDataAvailable.ts +1 -1
  122. package/src/isRootSchema.ts +1 -1
  123. package/src/jsonSchemaAugmentation.ts +21 -0
  124. package/src/mergeDefaultsWithFormData.ts +4 -3
  125. package/src/parser/ParserValidator.ts +1 -1
  126. package/src/parser/index.ts +1 -1
  127. package/src/parser/schemaParser.ts +3 -3
  128. package/src/removeOptionalEmptyObjects.ts +8 -30
  129. package/src/schema/findFieldInSchema.ts +10 -8
  130. package/src/schema/findSelectedOptionInXxxOf.ts +1 -1
  131. package/src/schema/getClosestMatchingOption.ts +4 -4
  132. package/src/schema/getDefaultFormState.ts +18 -24
  133. package/src/schema/getFromSchema.ts +15 -8
  134. package/src/schema/index.ts +5 -3
  135. package/src/schema/isMultiSelect.ts +0 -1
  136. package/src/schema/omitExtraData.ts +398 -19
  137. package/src/schema/retrieveSchema.ts +41 -15
  138. package/src/schema/sanitizeDataForNewSchema.ts +1 -1
  139. package/src/schema/shallowAllOfMerge.ts +19 -0
  140. package/src/schema/toPathSchema.ts +2 -1
  141. package/src/shouldRenderOptionalField.ts +2 -2
  142. package/src/toErrorSchema.ts +1 -1
  143. package/src/tsconfig.json +0 -1
  144. package/src/types.ts +18 -5
  145. package/src/useFileWidgetProps.ts +9 -10
  146. package/src/withIdRefPrefix.ts +2 -1
package/dist/utils.esm.js CHANGED
@@ -144,6 +144,9 @@ function createErrorHandler(formData) {
144
144
  return handler;
145
145
  }
146
146
 
147
+ // src/createSchemaUtils.ts
148
+ import get17 from "lodash/get";
149
+
147
150
  // src/deepEquals.ts
148
151
  import { createCustomEqual } from "fast-equals";
149
152
  var deepEquals = createCustomEqual({
@@ -156,32 +159,13 @@ var deepEquals = createCustomEqual({
156
159
  });
157
160
  var deepEquals_default = deepEquals;
158
161
 
159
- // src/schema/findFieldInSchema.ts
160
- import get8 from "lodash/get";
161
- import has3 from "lodash/has";
162
-
163
- // src/schema/findSelectedOptionInXxxOf.ts
164
- import get6 from "lodash/get";
165
-
166
- // src/schema/retrieveSchema.ts
167
- import get5 from "lodash/get";
168
- import set from "lodash/set";
169
- import times from "lodash/times";
170
- import transform from "lodash/transform";
171
- import merge from "lodash/merge";
172
- import flattenDeep from "lodash/flattenDeep";
173
- import uniq from "lodash/uniq";
174
- import isEmpty2 from "lodash/isEmpty";
175
- import { createComparator, createMerger, createShallowAllOfMerge } from "@x0k/json-schema-merge";
176
- import { createDeduplicator, createIntersector } from "@x0k/json-schema-merge/lib/array";
177
-
178
162
  // src/findSchemaDefinition.ts
179
- import jsonpointer from "jsonpointer";
180
- import omit from "lodash/omit";
181
- import isObject2 from "lodash/isObject";
182
- import isEmpty from "lodash/isEmpty";
183
163
  import UriResolver from "fast-uri";
164
+ import jsonpointer from "jsonpointer";
184
165
  import get from "lodash/get";
166
+ import isEmpty from "lodash/isEmpty";
167
+ import isObject2 from "lodash/isObject";
168
+ import omit from "lodash/omit";
185
169
  function findEmbeddedSchemaRecursive(schema, ref) {
186
170
  if (ID_KEY in schema && UriResolver.equal(schema[ID_KEY], ref)) {
187
171
  return schema;
@@ -282,6 +266,13 @@ function findSchemaDefinition($ref, rootSchema = {}, baseURI = get(rootSchema, [
282
266
  return findSchemaDefinitionRecursive($ref, rootSchema, recurseList, baseURI);
283
267
  }
284
268
 
269
+ // src/schema/findFieldInSchema.ts
270
+ import get8 from "lodash/get";
271
+ import has3 from "lodash/has";
272
+
273
+ // src/schema/findSelectedOptionInXxxOf.ts
274
+ import get6 from "lodash/get";
275
+
285
276
  // src/getDiscriminatorFieldFromSchema.ts
286
277
  import get2 from "lodash/get";
287
278
  import isString from "lodash/isString";
@@ -296,6 +287,16 @@ function getDiscriminatorFieldFromSchema(schema) {
296
287
  return discriminator;
297
288
  }
298
289
 
290
+ // src/schema/retrieveSchema.ts
291
+ import flattenDeep from "lodash/flattenDeep";
292
+ import get5 from "lodash/get";
293
+ import isEmpty2 from "lodash/isEmpty";
294
+ import merge from "lodash/merge";
295
+ import set from "lodash/set";
296
+ import times from "lodash/times";
297
+ import transform from "lodash/transform";
298
+ import uniq from "lodash/uniq";
299
+
299
300
  // src/guessType.ts
300
301
  function guessType(value) {
301
302
  if (Array.isArray(value)) {
@@ -437,6 +438,16 @@ function getFirstMatchingOption(validator, formData, options, rootSchema, discri
437
438
  return 0;
438
439
  }
439
440
 
441
+ // src/schema/shallowAllOfMerge.ts
442
+ import { createComparator, createMerger, createShallowAllOfMerge } from "@x0k/json-schema-merge";
443
+ import { createDeduplicator, createIntersector } from "@x0k/json-schema-merge/lib/array";
444
+ var { compareSchemaDefinitions, compareSchemaValues } = createComparator();
445
+ var { mergeArrayOfSchemaDefinitions } = createMerger({
446
+ intersectJson: createIntersector(compareSchemaValues),
447
+ deduplicateJsonSchemaDef: createDeduplicator(compareSchemaDefinitions)
448
+ });
449
+ var shallowAllOfMerge_default = createShallowAllOfMerge(mergeArrayOfSchemaDefinitions);
450
+
440
451
  // src/schema/retrieveSchema.ts
441
452
  function retrieveSchema(validator, schema, rootSchema = {}, rawFormData, experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs = false) {
442
453
  return retrieveSchemaInternal(
@@ -723,14 +734,8 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
723
734
  });
724
735
  return schema;
725
736
  }
726
- var { compareSchemaDefinitions, compareSchemaValues } = createComparator();
727
- var { mergeArrayOfSchemaDefinitions } = createMerger({
728
- intersectJson: createIntersector(compareSchemaValues),
729
- deduplicateJsonSchemaDef: createDeduplicator(compareSchemaDefinitions)
730
- });
731
- var shallowAllOfMerge = createShallowAllOfMerge(mergeArrayOfSchemaDefinitions);
732
737
  function mergeAllOf(schema) {
733
- return shallowAllOfMerge(schema);
738
+ return shallowAllOfMerge_default(schema);
734
739
  }
735
740
  function retrieveSchemaInternal(validator, schema, rootSchema, rawFormData, expandAllBranches = false, recurseList = [], experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs) {
736
741
  if (!isObject(schema)) {
@@ -837,12 +842,23 @@ function resolveAnyOrOneOfSchemas(validator, schema, rootSchema, expandAllBranch
837
842
  });
838
843
  const option = getFirstMatchingOption(validator, formData, anyOrOneOf, rootSchema, discriminator);
839
844
  if (expandAllBranches) {
845
+ const relaxed = relaxOptionsForScoring(anyOrOneOf, false, rootSchema);
846
+ getFirstMatchingOption(validator, formData, relaxed, rootSchema, discriminator);
840
847
  return anyOrOneOf.map((item) => mergeSchemas(remaining, item));
841
848
  }
842
849
  schema = mergeSchemas(remaining, anyOrOneOf[option]);
843
850
  }
844
851
  return [schema];
845
852
  }
853
+ function relaxOptionsForScoring(options, resolveRefs = false, rootSchema) {
854
+ return options.map((d) => {
855
+ if (!isObject(d)) {
856
+ return d ? {} : { not: {} };
857
+ }
858
+ const schema = resolveRefs && rootSchema ? resolveAllReferences(d, rootSchema, []) : d;
859
+ return schema.additionalProperties === false ? { ...schema, additionalProperties: true } : schema;
860
+ });
861
+ }
846
862
  function resolveDependencies(validator, schema, rootSchema, expandAllBranches, recurseList, formData, experimental_customMergeAllOf) {
847
863
  const { dependencies, ...remainingSchema } = schema;
848
864
  const resolvedSchemas = resolveAnyOrOneOfSchemas(
@@ -1024,9 +1040,9 @@ function getFromSchemaInternal(validator, rootSchema, schema, path, experimental
1024
1040
  if (isEmpty3(path)) {
1025
1041
  return fieldSchema;
1026
1042
  }
1027
- const pathList = Array.isArray(path) ? path : path.split(".");
1043
+ const pathList = Array.isArray(path) ? [...path] : path.split(".");
1028
1044
  const [part, ...nestedPath] = pathList;
1029
- if (part && has2(fieldSchema, part)) {
1045
+ if (part !== void 0 && part !== "" && has2(fieldSchema, part)) {
1030
1046
  fieldSchema = get7(fieldSchema, part);
1031
1047
  return getFromSchemaInternal(
1032
1048
  validator,
@@ -1052,6 +1068,7 @@ function findFieldInSchema(validator, rootSchema, schema, path, formData = {}, e
1052
1068
  const pathList = Array.isArray(path) ? [...path] : path.split(".");
1053
1069
  let parentField = schema;
1054
1070
  const fieldName = pathList.pop();
1071
+ const fieldNameKey = String(fieldName);
1055
1072
  if (pathList.length) {
1056
1073
  pathList.forEach((subPath) => {
1057
1074
  parentField = getFromSchema(
@@ -1067,7 +1084,7 @@ function findFieldInSchema(validator, rootSchema, schema, path, formData = {}, e
1067
1084
  validator,
1068
1085
  rootSchema,
1069
1086
  parentField,
1070
- fieldName,
1087
+ fieldNameKey,
1071
1088
  ONE_OF_KEY,
1072
1089
  get8(formData, subPath),
1073
1090
  experimental_customMergeAllOf
@@ -1077,7 +1094,7 @@ function findFieldInSchema(validator, rootSchema, schema, path, formData = {}, e
1077
1094
  validator,
1078
1095
  rootSchema,
1079
1096
  parentField,
1080
- fieldName,
1097
+ fieldNameKey,
1081
1098
  ANY_OF_KEY,
1082
1099
  get8(formData, subPath),
1083
1100
  experimental_customMergeAllOf
@@ -1090,7 +1107,7 @@ function findFieldInSchema(validator, rootSchema, schema, path, formData = {}, e
1090
1107
  validator,
1091
1108
  rootSchema,
1092
1109
  parentField,
1093
- fieldName,
1110
+ fieldNameKey,
1094
1111
  ONE_OF_KEY,
1095
1112
  formData,
1096
1113
  experimental_customMergeAllOf
@@ -1100,7 +1117,7 @@ function findFieldInSchema(validator, rootSchema, schema, path, formData = {}, e
1100
1117
  validator,
1101
1118
  rootSchema,
1102
1119
  parentField,
1103
- fieldName,
1120
+ fieldNameKey,
1104
1121
  ANY_OF_KEY,
1105
1122
  formData,
1106
1123
  experimental_customMergeAllOf
@@ -1127,15 +1144,11 @@ function findFieldInSchema(validator, rootSchema, schema, path, formData = {}, e
1127
1144
  );
1128
1145
  let isRequired;
1129
1146
  if (field && Array.isArray(requiredArray)) {
1130
- isRequired = requiredArray.includes(fieldName);
1147
+ isRequired = requiredArray.includes(fieldNameKey);
1131
1148
  }
1132
1149
  return { field, isRequired };
1133
1150
  }
1134
1151
 
1135
- // src/schema/getDefaultFormState.ts
1136
- import get12 from "lodash/get";
1137
- import isEmpty4 from "lodash/isEmpty";
1138
-
1139
1152
  // src/schema/getClosestMatchingOption.ts
1140
1153
  import get9 from "lodash/get";
1141
1154
  import has4 from "lodash/has";
@@ -1260,6 +1273,23 @@ function getClosestMatchingOption(validator, rootSchema, formData, options, sele
1260
1273
  return bestIndex;
1261
1274
  }
1262
1275
 
1276
+ // src/schema/getDefaultFormState.ts
1277
+ import get12 from "lodash/get";
1278
+ import isEmpty4 from "lodash/isEmpty";
1279
+
1280
+ // src/constIsAjvDataReference.ts
1281
+ import isString3 from "lodash/isString";
1282
+ function constIsAjvDataReference(schema) {
1283
+ const schemaConst = schema[CONST_KEY];
1284
+ const schemaType = getSchemaType(schema);
1285
+ return isObject(schemaConst) && isString3(schemaConst?.$data) && schemaType !== "object" && schemaType !== "array";
1286
+ }
1287
+
1288
+ // src/isConstant.ts
1289
+ function isConstant(schema) {
1290
+ return Array.isArray(schema.enum) && schema.enum.length === 1 || CONST_KEY in schema;
1291
+ }
1292
+
1263
1293
  // src/isFixedItems.ts
1264
1294
  function isFixedItems(schema) {
1265
1295
  return Array.isArray(schema.items) && schema.items.length > 0 && schema.items.every((item) => isObject(item));
@@ -1297,7 +1327,7 @@ function mergeDefaultsWithFormData(defaults, formData, mergeExtraArrayDefaults =
1297
1327
  const keyExistsInDefaults = isObject(defaults) && key in defaults;
1298
1328
  const keyExistsInFormData = key in formData;
1299
1329
  const keyDefault = get10(defaults, key) ?? {};
1300
- const defaultValueIsNestedObject = keyExistsInDefaults && Object.entries(keyDefault).some(([, v]) => isObject(v));
1330
+ const defaultValueIsNestedObject = keyExistsInDefaults && isObject(keyDefault) && Object.values(keyDefault).some((v) => isObject(v));
1301
1331
  const keyDefaultIsObject = keyExistsInDefaults && isObject(get10(defaults, key));
1302
1332
  const keyHasFormDataObject = keyExistsInFormData && isObject(keyValue);
1303
1333
  if (keyDefaultIsObject && keyHasFormDataObject && !defaultValueIsNestedObject) {
@@ -1352,40 +1382,6 @@ function mergeObjects(obj1, obj2, concatArrays = false) {
1352
1382
  );
1353
1383
  }
1354
1384
 
1355
- // src/isConstant.ts
1356
- function isConstant(schema) {
1357
- return Array.isArray(schema.enum) && schema.enum.length === 1 || CONST_KEY in schema;
1358
- }
1359
-
1360
- // src/schema/isSelect.ts
1361
- function isSelect(validator, theSchema, rootSchema = {}, experimental_customMergeAllOf) {
1362
- const schema = retrieveSchema(validator, theSchema, rootSchema, void 0, experimental_customMergeAllOf);
1363
- const altSchemas = schema.oneOf || schema.anyOf;
1364
- if (Array.isArray(schema.enum)) {
1365
- return true;
1366
- }
1367
- if (Array.isArray(altSchemas)) {
1368
- return altSchemas.every((altSchemas2) => typeof altSchemas2 !== "boolean" && isConstant(altSchemas2));
1369
- }
1370
- return false;
1371
- }
1372
-
1373
- // src/schema/isMultiSelect.ts
1374
- function isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) {
1375
- if (!schema.uniqueItems || !schema.items || typeof schema.items === "boolean") {
1376
- return false;
1377
- }
1378
- return isSelect(validator, schema.items, rootSchema, experimental_customMergeAllOf);
1379
- }
1380
-
1381
- // src/constIsAjvDataReference.ts
1382
- import isString3 from "lodash/isString";
1383
- function constIsAjvDataReference(schema) {
1384
- const schemaConst = schema[CONST_KEY];
1385
- const schemaType = getSchemaType(schema);
1386
- return isObject(schemaConst) && isString3(schemaConst?.$data) && schemaType !== "object" && schemaType !== "array";
1387
- }
1388
-
1389
1385
  // src/optionsList.ts
1390
1386
  import get11 from "lodash/get";
1391
1387
 
@@ -1466,6 +1462,27 @@ function optionsList(schema, uiSchema) {
1466
1462
  });
1467
1463
  }
1468
1464
 
1465
+ // src/schema/isSelect.ts
1466
+ function isSelect(validator, theSchema, rootSchema = {}, experimental_customMergeAllOf) {
1467
+ const schema = retrieveSchema(validator, theSchema, rootSchema, void 0, experimental_customMergeAllOf);
1468
+ const altSchemas = schema.oneOf || schema.anyOf;
1469
+ if (Array.isArray(schema.enum)) {
1470
+ return true;
1471
+ }
1472
+ if (Array.isArray(altSchemas)) {
1473
+ return altSchemas.every((altSchemas2) => typeof altSchemas2 !== "boolean" && isConstant(altSchemas2));
1474
+ }
1475
+ return false;
1476
+ }
1477
+
1478
+ // src/schema/isMultiSelect.ts
1479
+ function isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) {
1480
+ if (!schema.uniqueItems || !schema.items || typeof schema.items === "boolean") {
1481
+ return false;
1482
+ }
1483
+ return isSelect(validator, schema.items, rootSchema, experimental_customMergeAllOf);
1484
+ }
1485
+
1469
1486
  // src/schema/getDefaultFormState.ts
1470
1487
  var PRIMITIVE_TYPES = ["string", "number", "integer", "boolean", "null"];
1471
1488
  function getInnerSchemaForArrayItem(schema, additionalItems = 0 /* Ignore */, idx = -1) {
@@ -1825,14 +1842,11 @@ function getArrayDefaults(validator, rawSchema, {
1825
1842
  defaults = mergeDefaultsWithFormData(defaults, itemDefaults, mergeExtraDefaults);
1826
1843
  }
1827
1844
  }
1828
- const hasConst = isObject(schema) && CONST_KEY in schema && experimental_defaultFormStateBehavior?.constAsDefaults !== "never";
1829
- if (hasConst === false) {
1830
- if (neverPopulate) {
1831
- return defaults ?? emptyDefault;
1832
- }
1833
- if (ignoreMinItemsFlagSet && !required) {
1834
- return defaults ? defaults : void 0;
1835
- }
1845
+ if (neverPopulate) {
1846
+ return defaults ?? emptyDefault;
1847
+ }
1848
+ if (ignoreMinItemsFlagSet && !required) {
1849
+ return defaults ? defaults : void 0;
1836
1850
  }
1837
1851
  let arrayDefault;
1838
1852
  const defaultsLength = Array.isArray(defaults) ? defaults.length : 0;
@@ -1962,210 +1976,269 @@ function getDisplayLabel(validator, schema, uiSchema = {}, rootSchema, globalOpt
1962
1976
  }
1963
1977
 
1964
1978
  // src/schema/omitExtraData.ts
1965
- import pick from "lodash/pick";
1966
- import isEmpty5 from "lodash/isEmpty";
1967
- import get15 from "lodash/get";
1968
-
1969
- // src/schema/toPathSchema.ts
1970
1979
  import get14 from "lodash/get";
1971
- import isObject4 from "lodash/isObject";
1972
- import set2 from "lodash/set";
1973
- function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
1974
- if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema || IF_KEY in schema) {
1975
- const _schema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
1976
- const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals_default(item, _schema));
1977
- if (sameSchemaIndex === -1) {
1978
- return toPathSchemaInternal(
1979
- validator,
1980
- _schema,
1981
- name,
1982
- rootSchema,
1983
- formData,
1984
- _recurseList.concat(_schema),
1985
- experimental_customMergeAllOf
1986
- );
1987
- }
1980
+ import isEmpty5 from "lodash/isEmpty";
1981
+ import isNil2 from "lodash/isNil";
1982
+ import pick from "lodash/pick";
1983
+ function getUsedFormData(formData, fields) {
1984
+ if (fields.length === 0 && typeof formData !== "object") {
1985
+ return formData;
1988
1986
  }
1989
- let pathSchema = {
1990
- [NAME_KEY]: name.replace(/^\./, "")
1987
+ const data = pick(formData, fields);
1988
+ if (Array.isArray(formData)) {
1989
+ return Object.keys(data).map((key) => data[key]);
1990
+ }
1991
+ return data;
1992
+ }
1993
+ function getFieldNames(pathSchema, formData) {
1994
+ const formValueHasData = (value, isLeaf) => typeof value !== "object" || isEmpty5(value) || isLeaf && !isEmpty5(value);
1995
+ const getAllPaths = (_obj, acc = [], paths = [[]]) => {
1996
+ const objKeys = Object.keys(_obj);
1997
+ objKeys.forEach((key) => {
1998
+ const data = _obj[key];
1999
+ if (typeof data === "object") {
2000
+ const newPaths = paths.map((path) => [...path, key]);
2001
+ if (data[RJSF_ADDITIONAL_PROPERTIES_FLAG] && data[NAME_KEY] !== "") {
2002
+ acc.push(data[NAME_KEY]);
2003
+ } else {
2004
+ getAllPaths(data, acc, newPaths);
2005
+ }
2006
+ } else if (key === NAME_KEY && data !== "") {
2007
+ paths.forEach((path) => {
2008
+ const formValue = get14(formData, path);
2009
+ const isLeaf = objKeys.length === 1;
2010
+ if (formValueHasData(formValue, isLeaf) || Array.isArray(formValue) && formValue.every((val) => formValueHasData(val, isLeaf))) {
2011
+ acc.push(path);
2012
+ }
2013
+ });
2014
+ }
2015
+ });
2016
+ return acc;
1991
2017
  };
1992
- if (ONE_OF_KEY in schema || ANY_OF_KEY in schema) {
1993
- const xxxOf = ONE_OF_KEY in schema ? schema.oneOf : schema.anyOf;
1994
- const discriminator = getDiscriminatorFieldFromSchema(schema);
1995
- const index = getClosestMatchingOption(
2018
+ return getAllPaths(pathSchema);
2019
+ }
2020
+ function isValueEmpty(value) {
2021
+ if (isNil2(value) || value === "") {
2022
+ return true;
2023
+ }
2024
+ if (Array.isArray(value)) {
2025
+ return value.length === 0;
2026
+ }
2027
+ if (isObject(value)) {
2028
+ return Object.values(value).every(isValueEmpty);
2029
+ }
2030
+ return false;
2031
+ }
2032
+ function doMergeAllOf(schema, experimental_customMergeAllOf) {
2033
+ return experimental_customMergeAllOf ? experimental_customMergeAllOf(schema) : shallowAllOfMerge_default(schema);
2034
+ }
2035
+ function omitExtraData(validator, schema, rootSchema = {}, formData, experimental_customMergeAllOf) {
2036
+ function isObjectValue(value) {
2037
+ return isObject(value);
2038
+ }
2039
+ function isSchemaObj(schemaDef) {
2040
+ return isObject(schemaDef);
2041
+ }
2042
+ function handleObject(schema2, source, target) {
2043
+ const { properties, additionalProperties, patternProperties, propertyNames } = schema2;
2044
+ const requiredSet = new Set(schema2.required ?? []);
2045
+ function setProperty(key, schemaDef, value, required = false) {
2046
+ const v = omit3(schemaDef, value, target[key]);
2047
+ if (!required && isObject(v)) {
2048
+ let sd = isSchemaObj(schemaDef) ? schemaDef : {};
2049
+ if (sd.$ref !== void 0) {
2050
+ sd = findSchemaDefinition(sd.$ref, rootSchema);
2051
+ }
2052
+ const innerRequired = new Set(sd.required ?? []);
2053
+ const shouldDrop = Object.entries(v).every(
2054
+ ([k, val]) => !innerRequired.has(k) && isValueEmpty(val)
2055
+ );
2056
+ if (shouldDrop) {
2057
+ return;
2058
+ }
2059
+ }
2060
+ if (v !== void 0) {
2061
+ target[key] = v;
2062
+ }
2063
+ }
2064
+ if (properties !== void 0) {
2065
+ for (const [key, schemaDef] of Object.entries(properties)) {
2066
+ setProperty(key, schemaDef, source[key], requiredSet.has(key));
2067
+ }
2068
+ }
2069
+ let patternPropertiesRest;
2070
+ if (patternProperties !== void 0) {
2071
+ patternPropertiesRest = [];
2072
+ const patterns = Object.entries(patternProperties).map(([pattern, schemaDef]) => [
2073
+ new RegExp(pattern),
2074
+ schemaDef
2075
+ ]);
2076
+ const knownProperties = new Set(Object.keys(properties ?? {}));
2077
+ for (const [key, value] of Object.entries(source)) {
2078
+ if (knownProperties.has(key)) {
2079
+ continue;
2080
+ }
2081
+ const matched = patterns.find(([re]) => re.test(key));
2082
+ if (matched === void 0) {
2083
+ patternPropertiesRest.push(key);
2084
+ continue;
2085
+ }
2086
+ setProperty(key, matched[1], value);
2087
+ }
2088
+ }
2089
+ if (additionalProperties !== void 0 && additionalProperties !== false) {
2090
+ const addlSchema = additionalProperties;
2091
+ if (patternPropertiesRest !== void 0) {
2092
+ for (const key of patternPropertiesRest) {
2093
+ setProperty(key, addlSchema, source[key]);
2094
+ }
2095
+ } else {
2096
+ const knownProperties = new Set(Object.keys(properties ?? {}));
2097
+ for (const [key, value] of Object.entries(source)) {
2098
+ if (knownProperties.has(key)) {
2099
+ continue;
2100
+ }
2101
+ setProperty(key, addlSchema, value);
2102
+ }
2103
+ }
2104
+ }
2105
+ if (propertyNames !== void 0) {
2106
+ for (const [key, value] of Object.entries(source)) {
2107
+ target[key] = value;
2108
+ }
2109
+ }
2110
+ return target;
2111
+ }
2112
+ function handleArray(schema2, source, target) {
2113
+ const { items, additionalItems } = schema2;
2114
+ if (items !== void 0) {
2115
+ if (Array.isArray(items)) {
2116
+ for (let i = 0; i < items.length; i++) {
2117
+ target.push(omit3(items[i], source[i]));
2118
+ }
2119
+ } else {
2120
+ for (let i = 0; i < source.length; i++) {
2121
+ target.push(omit3(items, source[i]));
2122
+ }
2123
+ }
2124
+ }
2125
+ if (additionalItems) {
2126
+ for (let i = target.length; i < source.length; i++) {
2127
+ target.push(omit3(additionalItems, source[i]));
2128
+ }
2129
+ }
2130
+ return target;
2131
+ }
2132
+ function handleConditions(schema2, source, target) {
2133
+ const { if: condition, then, else: otherwise } = schema2;
2134
+ if (condition === void 0) {
2135
+ return target;
2136
+ }
2137
+ const isThenBranch = isSchemaObj(condition) ? validator.isValid(condition, source, rootSchema) : condition;
2138
+ const branch = isThenBranch ? then : otherwise;
2139
+ return branch === void 0 ? target : omit3(branch, source, target);
2140
+ }
2141
+ function handleOneOf(oneOf, schema2, source, target) {
2142
+ if (!Array.isArray(oneOf) || isSelect(validator, schema2, rootSchema, experimental_customMergeAllOf)) {
2143
+ return target;
2144
+ }
2145
+ const scoringOptions = relaxOptionsForScoring(oneOf, true, rootSchema);
2146
+ const bestIndex = getClosestMatchingOption(
1996
2147
  validator,
1997
2148
  rootSchema,
1998
- formData,
1999
- xxxOf,
2149
+ source,
2150
+ scoringOptions,
2000
2151
  0,
2001
- discriminator,
2152
+ getDiscriminatorFieldFromSchema(schema2),
2002
2153
  experimental_customMergeAllOf
2003
2154
  );
2004
- const _schema = xxxOf[index];
2005
- pathSchema = {
2006
- ...pathSchema,
2007
- ...toPathSchemaInternal(
2008
- validator,
2009
- _schema,
2010
- name,
2011
- rootSchema,
2012
- formData,
2013
- _recurseList,
2014
- experimental_customMergeAllOf
2015
- )
2016
- };
2017
- }
2018
- if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
2019
- set2(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
2020
- const additionalSchema = isObject4(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {};
2021
- const definedProperties = get14(schema, PROPERTIES_KEY, {});
2022
- for (const key of Object.keys(formData ?? {})) {
2023
- if (!(key in definedProperties)) {
2024
- pathSchema[key] = toPathSchemaInternal(
2025
- validator,
2026
- additionalSchema,
2027
- `${name}.${key}`,
2028
- rootSchema,
2029
- get14(formData, [key]),
2030
- _recurseList,
2031
- experimental_customMergeAllOf
2032
- );
2155
+ const winning = oneOf[bestIndex];
2156
+ const resolved = isObject(winning) ? resolveAllReferences(winning, rootSchema, []) : scoringOptions[bestIndex];
2157
+ return omit3(resolved, source, target);
2158
+ }
2159
+ function handleAnyOf(schema2, source, target) {
2160
+ const { anyOf } = schema2;
2161
+ if (!Array.isArray(anyOf)) {
2162
+ return target;
2163
+ }
2164
+ if (source === void 0 || Array.isArray(source) && source.length === 0 || isObject(source) && Object.keys(source).length === 0) {
2165
+ for (const branch of anyOf) {
2166
+ target = omit3(branch, source, target);
2033
2167
  }
2168
+ return target;
2034
2169
  }
2170
+ return handleOneOf(anyOf, schema2, source, target);
2035
2171
  }
2036
- if (ITEMS_KEY in schema && Array.isArray(formData)) {
2037
- const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;
2038
- if (Array.isArray(schemaItems)) {
2039
- formData.forEach((element, i) => {
2040
- if (schemaItems[i]) {
2041
- pathSchema[i] = toPathSchemaInternal(
2042
- validator,
2043
- schemaItems[i],
2044
- `${name}.${i}`,
2045
- rootSchema,
2046
- element,
2047
- _recurseList,
2048
- experimental_customMergeAllOf
2049
- );
2050
- } else if (schemaAdditionalItems) {
2051
- pathSchema[i] = toPathSchemaInternal(
2052
- validator,
2053
- schemaAdditionalItems,
2054
- `${name}.${i}`,
2055
- rootSchema,
2056
- element,
2057
- _recurseList,
2058
- experimental_customMergeAllOf
2059
- );
2060
- } else {
2061
- console.warn(`Unable to generate path schema for "${name}.${i}". No schema defined for it`);
2062
- }
2063
- });
2064
- } else {
2065
- formData.forEach((element, i) => {
2066
- pathSchema[i] = toPathSchemaInternal(
2067
- validator,
2068
- schemaItems,
2069
- `${name}.${i}`,
2070
- rootSchema,
2071
- element,
2072
- _recurseList,
2073
- experimental_customMergeAllOf
2074
- );
2075
- });
2172
+ function handleDependencies(schema2, source, target) {
2173
+ const { dependencies } = schema2;
2174
+ if (dependencies === void 0 || !isObjectValue(source)) {
2175
+ return target;
2076
2176
  }
2077
- } else if (PROPERTIES_KEY in schema) {
2078
- for (const property in schema.properties) {
2079
- const field = get14(schema, [PROPERTIES_KEY, property], {});
2080
- pathSchema[property] = toPathSchemaInternal(
2081
- validator,
2082
- field,
2083
- `${name}.${property}`,
2084
- rootSchema,
2085
- // It's possible that formData is not an object -- this can happen if an
2086
- // array item has just been added, but not populated with data yet
2087
- get14(formData, [property]),
2088
- _recurseList,
2089
- experimental_customMergeAllOf
2090
- );
2177
+ for (const [key, deps] of Object.entries(dependencies)) {
2178
+ if (!(key in source) || Array.isArray(deps)) {
2179
+ continue;
2180
+ }
2181
+ target = omit3(deps, source, target);
2091
2182
  }
2183
+ return target;
2092
2184
  }
2093
- return pathSchema;
2094
- }
2095
- function toPathSchema(validator, schema, name = "", rootSchema, formData, experimental_customMergeAllOf) {
2096
- return toPathSchemaInternal(validator, schema, name, rootSchema, formData, void 0, experimental_customMergeAllOf);
2097
- }
2098
-
2099
- // src/schema/omitExtraData.ts
2100
- function getUsedFormData(formData, fields) {
2101
- if (fields.length === 0 && typeof formData !== "object") {
2102
- return formData;
2103
- }
2104
- const data = pick(formData, fields);
2105
- if (Array.isArray(formData)) {
2106
- return Object.keys(data).map((key) => data[key]);
2107
- }
2108
- return data;
2109
- }
2110
- function getFieldNames(pathSchema, formData) {
2111
- const formValueHasData = (value, isLeaf) => typeof value !== "object" || isEmpty5(value) || isLeaf && !isEmpty5(value);
2112
- const getAllPaths = (_obj, acc = [], paths = [[]]) => {
2113
- const objKeys = Object.keys(_obj);
2114
- objKeys.forEach((key) => {
2115
- const data = _obj[key];
2116
- if (typeof data === "object") {
2117
- const newPaths = paths.map((path) => [...path, key]);
2118
- if (data[RJSF_ADDITIONAL_PROPERTIES_FLAG] && data[NAME_KEY] !== "") {
2119
- acc.push(data[NAME_KEY]);
2120
- } else {
2121
- getAllPaths(data, acc, newPaths);
2122
- }
2123
- } else if (key === NAME_KEY && data !== "") {
2124
- paths.forEach((path) => {
2125
- const formValue = get15(formData, path);
2126
- const isLeaf = objKeys.length === 1;
2127
- if (formValueHasData(formValue, isLeaf) || Array.isArray(formValue) && formValue.every((val) => formValueHasData(val, isLeaf))) {
2128
- acc.push(path);
2129
- }
2130
- });
2185
+ function omit3(schemaDef, source, target) {
2186
+ if (source === void 0 || schemaDef === false) {
2187
+ return void 0;
2188
+ }
2189
+ if (schemaDef === true || isEmpty5(schemaDef)) {
2190
+ return source;
2191
+ }
2192
+ let schema2 = schemaDef;
2193
+ const { $ref: ref, allOf } = schema2;
2194
+ if (ref !== void 0) {
2195
+ return omit3(findSchemaDefinition(ref, rootSchema), source, target);
2196
+ }
2197
+ if (allOf) {
2198
+ schema2 = doMergeAllOf(schema2, experimental_customMergeAllOf);
2199
+ }
2200
+ target = handleAnyOf(schema2, source, handleOneOf(schema2.oneOf, schema2, source, target));
2201
+ const type = getSchemaType(schema2);
2202
+ if (type === "object") {
2203
+ if (!isObjectValue(source)) {
2204
+ return void 0;
2131
2205
  }
2132
- });
2133
- return acc;
2134
- };
2135
- return getAllPaths(pathSchema);
2136
- }
2137
- function omitExtraData(validator, schema, rootSchema = {}, formData) {
2138
- const retrievedSchema = retrieveSchema(validator, schema, rootSchema, formData);
2139
- const pathSchema = toPathSchema(validator, retrievedSchema, "", rootSchema, formData);
2140
- const fieldNames = getFieldNames(pathSchema, formData);
2141
- const lodashFieldNames = fieldNames.map(
2142
- (fieldPaths) => Array.isArray(fieldPaths) ? fieldPaths.join(".") : fieldPaths
2143
- );
2144
- return getUsedFormData(formData, lodashFieldNames);
2206
+ target = handleObject(schema2, source, isObjectValue(target) ? target : {});
2207
+ } else if (type === "array") {
2208
+ if (!Array.isArray(source)) {
2209
+ return void 0;
2210
+ }
2211
+ target = handleArray(schema2, source, Array.isArray(target) ? target : []);
2212
+ } else if (target === void 0) {
2213
+ target = source;
2214
+ }
2215
+ return handleDependencies(schema2, source, handleConditions(schema2, source, target));
2216
+ }
2217
+ return omit3(schema, formData);
2145
2218
  }
2146
2219
 
2147
2220
  // src/schema/sanitizeDataForNewSchema.ts
2148
- import get16 from "lodash/get";
2221
+ import get15 from "lodash/get";
2149
2222
  import has5 from "lodash/has";
2150
- var NO_VALUE = Symbol("no Value");
2223
+ var NO_VALUE = /* @__PURE__ */ Symbol("no Value");
2151
2224
  function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, data = {}, experimental_customMergeAllOf) {
2152
2225
  let newFormData;
2153
2226
  if (has5(newSchema, PROPERTIES_KEY)) {
2154
2227
  const removeOldSchemaData = {};
2155
2228
  if (has5(oldSchema, PROPERTIES_KEY)) {
2156
- const properties = get16(oldSchema, PROPERTIES_KEY, {});
2229
+ const properties = get15(oldSchema, PROPERTIES_KEY, {});
2157
2230
  Object.keys(properties).forEach((key) => {
2158
2231
  if (has5(data, key)) {
2159
2232
  removeOldSchemaData[key] = void 0;
2160
2233
  }
2161
2234
  });
2162
2235
  }
2163
- const keys2 = Object.keys(get16(newSchema, PROPERTIES_KEY, {}));
2236
+ const keys2 = Object.keys(get15(newSchema, PROPERTIES_KEY, {}));
2164
2237
  const nestedData = {};
2165
2238
  keys2.forEach((key) => {
2166
- const formValue = get16(data, key);
2167
- let oldKeyedSchema = get16(oldSchema, [PROPERTIES_KEY, key], {});
2168
- let newKeyedSchema = get16(newSchema, [PROPERTIES_KEY, key], {});
2239
+ const formValue = get15(data, key);
2240
+ let oldKeyedSchema = get15(oldSchema, [PROPERTIES_KEY, key], {});
2241
+ let newKeyedSchema = get15(newSchema, [PROPERTIES_KEY, key], {});
2169
2242
  if (has5(oldKeyedSchema, REF_KEY)) {
2170
2243
  oldKeyedSchema = retrieveSchema(
2171
2244
  validator,
@@ -2184,8 +2257,8 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2184
2257
  experimental_customMergeAllOf
2185
2258
  );
2186
2259
  }
2187
- const oldSchemaTypeForKey = get16(oldKeyedSchema, "type");
2188
- const newSchemaTypeForKey = get16(newKeyedSchema, "type");
2260
+ const oldSchemaTypeForKey = get15(oldKeyedSchema, "type");
2261
+ const newSchemaTypeForKey = get15(newKeyedSchema, "type");
2189
2262
  if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
2190
2263
  if (has5(removeOldSchemaData, key)) {
2191
2264
  delete removeOldSchemaData[key];
@@ -2203,17 +2276,17 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2203
2276
  nestedData[key] = itemData;
2204
2277
  }
2205
2278
  } else {
2206
- const newOptionDefault = get16(newKeyedSchema, "default", NO_VALUE);
2207
- const oldOptionDefault = get16(oldKeyedSchema, "default", NO_VALUE);
2279
+ const newOptionDefault = get15(newKeyedSchema, "default", NO_VALUE);
2280
+ const oldOptionDefault = get15(oldKeyedSchema, "default", NO_VALUE);
2208
2281
  if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
2209
2282
  if (oldOptionDefault === formValue) {
2210
2283
  removeOldSchemaData[key] = newOptionDefault;
2211
- } else if (get16(newKeyedSchema, "readOnly") === true) {
2284
+ } else if (get15(newKeyedSchema, "readOnly") === true) {
2212
2285
  removeOldSchemaData[key] = void 0;
2213
2286
  }
2214
2287
  }
2215
- const newOptionConst = get16(newKeyedSchema, "const", NO_VALUE);
2216
- const oldOptionConst = get16(oldKeyedSchema, "const", NO_VALUE);
2288
+ const newOptionConst = get15(newKeyedSchema, "const", NO_VALUE);
2289
+ const oldOptionConst = get15(oldKeyedSchema, "const", NO_VALUE);
2217
2290
  if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
2218
2291
  removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : void 0;
2219
2292
  }
@@ -2225,9 +2298,9 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2225
2298
  ...removeOldSchemaData,
2226
2299
  ...nestedData
2227
2300
  };
2228
- } else if (get16(oldSchema, "type") === "array" && get16(newSchema, "type") === "array" && Array.isArray(data)) {
2229
- let oldSchemaItems = get16(oldSchema, "items");
2230
- let newSchemaItems = get16(newSchema, "items");
2301
+ } else if (get15(oldSchema, "type") === "array" && get15(newSchema, "type") === "array" && Array.isArray(data)) {
2302
+ let oldSchemaItems = get15(oldSchema, "items");
2303
+ let newSchemaItems = get15(newSchema, "items");
2231
2304
  if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
2232
2305
  if (has5(oldSchemaItems, REF_KEY)) {
2233
2306
  oldSchemaItems = retrieveSchema(
@@ -2247,10 +2320,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2247
2320
  experimental_customMergeAllOf
2248
2321
  );
2249
2322
  }
2250
- const oldSchemaType = get16(oldSchemaItems, "type");
2251
- const newSchemaType = get16(newSchemaItems, "type");
2323
+ const oldSchemaType = get15(oldSchemaItems, "type");
2324
+ const newSchemaType = get15(newSchemaItems, "type");
2252
2325
  if (!oldSchemaType || oldSchemaType === newSchemaType) {
2253
- const maxItems = get16(newSchema, "maxItems", -1);
2326
+ const maxItems = get15(newSchema, "maxItems", -1);
2254
2327
  if (newSchemaType === "object") {
2255
2328
  newFormData = data.reduce((newValue, aValue) => {
2256
2329
  const itemValue = sanitizeDataForNewSchema(
@@ -2277,8 +2350,137 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2277
2350
  return newFormData;
2278
2351
  }
2279
2352
 
2353
+ // src/schema/toPathSchema.ts
2354
+ import get16 from "lodash/get";
2355
+ import isObject4 from "lodash/isObject";
2356
+ import set2 from "lodash/set";
2357
+ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
2358
+ if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema || IF_KEY in schema) {
2359
+ const _schema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
2360
+ const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals_default(item, _schema));
2361
+ if (sameSchemaIndex === -1) {
2362
+ return toPathSchemaInternal(
2363
+ validator,
2364
+ _schema,
2365
+ name,
2366
+ rootSchema,
2367
+ formData,
2368
+ _recurseList.concat(_schema),
2369
+ experimental_customMergeAllOf
2370
+ );
2371
+ }
2372
+ }
2373
+ let pathSchema = {
2374
+ [NAME_KEY]: name.replace(/^\./, "")
2375
+ };
2376
+ if (ONE_OF_KEY in schema || ANY_OF_KEY in schema) {
2377
+ const xxxOf = ONE_OF_KEY in schema ? schema.oneOf : schema.anyOf;
2378
+ const discriminator = getDiscriminatorFieldFromSchema(schema);
2379
+ const index = getClosestMatchingOption(
2380
+ validator,
2381
+ rootSchema,
2382
+ formData,
2383
+ xxxOf,
2384
+ 0,
2385
+ discriminator,
2386
+ experimental_customMergeAllOf
2387
+ );
2388
+ const _schema = xxxOf[index];
2389
+ pathSchema = {
2390
+ ...pathSchema,
2391
+ ...toPathSchemaInternal(
2392
+ validator,
2393
+ _schema,
2394
+ name,
2395
+ rootSchema,
2396
+ formData,
2397
+ _recurseList,
2398
+ experimental_customMergeAllOf
2399
+ )
2400
+ };
2401
+ }
2402
+ if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
2403
+ set2(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
2404
+ const additionalSchema = isObject4(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {};
2405
+ const definedProperties = get16(schema, PROPERTIES_KEY, {});
2406
+ for (const key of Object.keys(formData ?? {})) {
2407
+ if (!(key in definedProperties)) {
2408
+ pathSchema[key] = toPathSchemaInternal(
2409
+ validator,
2410
+ additionalSchema,
2411
+ `${name}.${key}`,
2412
+ rootSchema,
2413
+ get16(formData, [key]),
2414
+ _recurseList,
2415
+ experimental_customMergeAllOf
2416
+ );
2417
+ }
2418
+ }
2419
+ }
2420
+ if (ITEMS_KEY in schema && Array.isArray(formData)) {
2421
+ const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;
2422
+ if (Array.isArray(schemaItems)) {
2423
+ formData.forEach((element, i) => {
2424
+ if (schemaItems[i]) {
2425
+ pathSchema[i] = toPathSchemaInternal(
2426
+ validator,
2427
+ schemaItems[i],
2428
+ `${name}.${i}`,
2429
+ rootSchema,
2430
+ element,
2431
+ _recurseList,
2432
+ experimental_customMergeAllOf
2433
+ );
2434
+ } else if (schemaAdditionalItems) {
2435
+ pathSchema[i] = toPathSchemaInternal(
2436
+ validator,
2437
+ schemaAdditionalItems,
2438
+ `${name}.${i}`,
2439
+ rootSchema,
2440
+ element,
2441
+ _recurseList,
2442
+ experimental_customMergeAllOf
2443
+ );
2444
+ } else {
2445
+ console.warn(`Unable to generate path schema for "${name}.${i}". No schema defined for it`);
2446
+ }
2447
+ });
2448
+ } else {
2449
+ formData.forEach((element, i) => {
2450
+ pathSchema[i] = toPathSchemaInternal(
2451
+ validator,
2452
+ schemaItems,
2453
+ `${name}.${i}`,
2454
+ rootSchema,
2455
+ element,
2456
+ _recurseList,
2457
+ experimental_customMergeAllOf
2458
+ );
2459
+ });
2460
+ }
2461
+ } else if (PROPERTIES_KEY in schema) {
2462
+ for (const property in schema.properties) {
2463
+ const field = get16(schema, [PROPERTIES_KEY, property], {});
2464
+ pathSchema[property] = toPathSchemaInternal(
2465
+ validator,
2466
+ field,
2467
+ `${name}.${property}`,
2468
+ rootSchema,
2469
+ // It's possible that formData is not an object -- this can happen if an
2470
+ // array item has just been added, but not populated with data yet
2471
+ get16(formData, [property]),
2472
+ _recurseList,
2473
+ experimental_customMergeAllOf
2474
+ );
2475
+ }
2476
+ }
2477
+ return pathSchema;
2478
+ }
2479
+ function toPathSchema(validator, schema, name = "", rootSchema, formData, experimental_customMergeAllOf) {
2480
+ return toPathSchemaInternal(validator, schema, name, rootSchema, formData, void 0, experimental_customMergeAllOf);
2481
+ }
2482
+
2280
2483
  // src/createSchemaUtils.ts
2281
- import get17 from "lodash/get";
2282
2484
  var SchemaUtils = class {
2283
2485
  /** Constructs the `SchemaUtils` instance with the given `validator` and `rootSchema` stored as instance variables
2284
2486
  *
@@ -2618,31 +2820,6 @@ function dateRangeOptions(start, stop) {
2618
2820
  return options;
2619
2821
  }
2620
2822
 
2621
- // src/shallowEquals.ts
2622
- function shallowEquals(a, b) {
2623
- if (Object.is(a, b)) {
2624
- return true;
2625
- }
2626
- if (a == null || b == null) {
2627
- return false;
2628
- }
2629
- if (typeof a !== "object" || typeof b !== "object") {
2630
- return false;
2631
- }
2632
- const keysA = Object.keys(a);
2633
- const keysB = Object.keys(b);
2634
- if (keysA.length !== keysB.length) {
2635
- return false;
2636
- }
2637
- for (let i = 0; i < keysA.length; i++) {
2638
- const key = keysA[i];
2639
- if (!Object.prototype.hasOwnProperty.call(b, key) || !Object.is(a[key], b[key])) {
2640
- return false;
2641
- }
2642
- }
2643
- return true;
2644
- }
2645
-
2646
2823
  // src/replaceStringParameters.ts
2647
2824
  function replaceStringParameters(inputString, params) {
2648
2825
  let output = inputString;
@@ -2656,12 +2833,31 @@ function replaceStringParameters(inputString, params) {
2656
2833
  });
2657
2834
  output = parts.join("");
2658
2835
  }
2659
- return output;
2836
+ return output;
2837
+ }
2838
+
2839
+ // src/englishStringTranslator.ts
2840
+ function englishStringTranslator(stringToTranslate, params) {
2841
+ return replaceStringParameters(stringToTranslate, params);
2842
+ }
2843
+
2844
+ // src/enumOptionsValueForIndex.ts
2845
+ function enumOptionsValueForIndex(valueIndex, allEnumOptions = [], emptyValue) {
2846
+ if (Array.isArray(valueIndex)) {
2847
+ return valueIndex.map((index2) => enumOptionsValueForIndex(index2, allEnumOptions)).filter((val) => val !== void 0);
2848
+ }
2849
+ const index = valueIndex === "" || valueIndex === null ? -1 : Number(valueIndex);
2850
+ const option = allEnumOptions[index];
2851
+ return option ? option.value : emptyValue;
2660
2852
  }
2661
2853
 
2662
- // src/englishStringTranslator.ts
2663
- function englishStringTranslator(stringToTranslate, params) {
2664
- return replaceStringParameters(stringToTranslate, params);
2854
+ // src/enumOptionsDeselectValue.ts
2855
+ function enumOptionsDeselectValue(valueIndex, selected, allEnumOptions = []) {
2856
+ const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
2857
+ if (Array.isArray(selected)) {
2858
+ return selected.filter((v) => !deepEquals_default(v, value));
2859
+ }
2860
+ return deepEquals_default(value, selected) ? void 0 : selected;
2665
2861
  }
2666
2862
 
2667
2863
  // src/enumOptionsIsSelected.ts
@@ -2694,14 +2890,17 @@ function enumOptionSelectedValue(value, enumOptions, multiple, format = "indexed
2694
2890
  return typeof indexes === "undefined" ? emptyValue : indexes;
2695
2891
  }
2696
2892
 
2697
- // src/enumOptionsValueForIndex.ts
2698
- function enumOptionsValueForIndex(valueIndex, allEnumOptions = [], emptyValue) {
2699
- if (Array.isArray(valueIndex)) {
2700
- return valueIndex.map((index2) => enumOptionsValueForIndex(index2, allEnumOptions)).filter((val) => val !== emptyValue);
2893
+ // src/enumOptionsSelectValue.ts
2894
+ import isNil3 from "lodash/isNil";
2895
+ function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
2896
+ const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
2897
+ if (!isNil3(value)) {
2898
+ const index = allEnumOptions.findIndex((opt) => value === opt.value);
2899
+ const all = allEnumOptions.map(({ value: val }) => val);
2900
+ const updated = selected.slice(0, index).concat(value, selected.slice(index));
2901
+ return updated.sort((a, b) => Number(all.indexOf(a) > all.indexOf(b)));
2701
2902
  }
2702
- const index = valueIndex === "" || valueIndex === null ? -1 : Number(valueIndex);
2703
- const option = allEnumOptions[index];
2704
- return option ? option.value : emptyValue;
2903
+ return selected;
2705
2904
  }
2706
2905
 
2707
2906
  // src/enumOptionValueDecoder.ts
@@ -2730,12 +2929,12 @@ function enumOptionValueDecoder(value, enumOptions, format = "indexed", emptyVal
2730
2929
  }
2731
2930
 
2732
2931
  // src/enumOptionValueEncoder.ts
2733
- import isNil2 from "lodash/isNil";
2932
+ import isNil4 from "lodash/isNil";
2734
2933
  function enumOptionValueEncoder(value, index, format = "indexed") {
2735
2934
  if (format !== "realValue") {
2736
2935
  return String(index);
2737
2936
  }
2738
- if (isNil2(value)) {
2937
+ if (isNil4(value)) {
2739
2938
  return "";
2740
2939
  }
2741
2940
  if (typeof value === "object") {
@@ -2744,28 +2943,6 @@ function enumOptionValueEncoder(value, index, format = "indexed") {
2744
2943
  return String(value);
2745
2944
  }
2746
2945
 
2747
- // src/enumOptionsDeselectValue.ts
2748
- function enumOptionsDeselectValue(valueIndex, selected, allEnumOptions = []) {
2749
- const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
2750
- if (Array.isArray(selected)) {
2751
- return selected.filter((v) => !deepEquals_default(v, value));
2752
- }
2753
- return deepEquals_default(value, selected) ? void 0 : selected;
2754
- }
2755
-
2756
- // src/enumOptionsSelectValue.ts
2757
- import isNil3 from "lodash/isNil";
2758
- function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
2759
- const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
2760
- if (!isNil3(value)) {
2761
- const index = allEnumOptions.findIndex((opt) => value === opt.value);
2762
- const all = allEnumOptions.map(({ value: val }) => val);
2763
- const updated = selected.slice(0, index).concat(value, selected.slice(index));
2764
- return updated.sort((a, b) => Number(all.indexOf(a) > all.indexOf(b)));
2765
- }
2766
- return selected;
2767
- }
2768
-
2769
2946
  // src/ErrorSchemaBuilder.ts
2770
2947
  import cloneDeep from "lodash/cloneDeep";
2771
2948
  import get18 from "lodash/get";
@@ -2864,11 +3041,11 @@ var ErrorSchemaBuilder = class {
2864
3041
  };
2865
3042
 
2866
3043
  // src/getChangedFields.ts
3044
+ import difference from "lodash/difference";
3045
+ import get19 from "lodash/get";
3046
+ import isPlainObject2 from "lodash/isPlainObject";
2867
3047
  import keys from "lodash/keys";
2868
3048
  import pickBy from "lodash/pickBy";
2869
- import isPlainObject2 from "lodash/isPlainObject";
2870
- import get19 from "lodash/get";
2871
- import difference from "lodash/difference";
2872
3049
  function getChangedFields(a, b) {
2873
3050
  const aIsPlainObject = isPlainObject2(a);
2874
3051
  const bIsPlainObject = isPlainObject2(b);
@@ -3010,7 +3187,7 @@ function getTemplate(name, registry, uiOptions = {}) {
3010
3187
  import get20 from "lodash/get";
3011
3188
  import uniqueId from "lodash/uniqueId";
3012
3189
  function getTestIds() {
3013
- if (typeof process === "undefined" || get20(process, "env.NODE_ENV") !== "test") {
3190
+ if (get20(globalThis, "process.env.NODE_ENV") !== "test") {
3014
3191
  return {};
3015
3192
  }
3016
3193
  const ids = /* @__PURE__ */ new Map();
@@ -3029,9 +3206,9 @@ function getTestIds() {
3029
3206
 
3030
3207
  // src/getWidget.tsx
3031
3208
  import { createElement } from "react";
3032
- import ReactIs from "react-is";
3033
3209
  import get21 from "lodash/get";
3034
3210
  import set4 from "lodash/set";
3211
+ import ReactIs from "react-is";
3035
3212
  import { jsx } from "react/jsx-runtime";
3036
3213
  var widgetMap = {
3037
3214
  boolean: {
@@ -3192,11 +3369,11 @@ function optionalControlsId(id, element) {
3192
3369
  }
3193
3370
 
3194
3371
  // src/isFormDataAvailable.ts
3195
- import isNil4 from "lodash/isNil";
3196
3372
  import isEmpty6 from "lodash/isEmpty";
3373
+ import isNil5 from "lodash/isNil";
3197
3374
  import isObject5 from "lodash/isObject";
3198
3375
  function isFormDataAvailable(formData) {
3199
- return !isNil4(formData) && (!isObject5(formData) || Array.isArray(formData) || !isEmpty6(formData));
3376
+ return !isNil5(formData) && (!isObject5(formData) || Array.isArray(formData) || !isEmpty6(formData));
3200
3377
  }
3201
3378
 
3202
3379
  // src/isRootSchema.ts
@@ -3234,80 +3411,25 @@ function lookupFromFormContext(regOrFc, toLookup, fallback) {
3234
3411
  return get22(regOrFc, [...lookupPath, toLookup], fallback);
3235
3412
  }
3236
3413
 
3237
- // src/removeOptionalEmptyObjects.ts
3238
- import isNil5 from "lodash/isNil";
3239
- function isValueEmpty(value) {
3240
- if (isNil5(value) || value === "") {
3241
- return true;
3242
- }
3243
- if (Array.isArray(value)) {
3244
- return value.length === 0;
3245
- }
3246
- if (isObject(value)) {
3247
- const obj = value;
3248
- const keys2 = Object.keys(obj);
3249
- return keys2.every((key) => isValueEmpty(obj[key]));
3250
- }
3251
- return false;
3252
- }
3253
- function removeOptionalEmptyObjects(validator, schema, rootSchema, formData) {
3254
- if (!isObject(schema)) {
3255
- return formData;
3256
- }
3257
- const resolvedSchema = retrieveSchema(validator, schema, rootSchema, formData);
3258
- if (Array.isArray(formData)) {
3259
- const itemsSchema = resolvedSchema.items;
3260
- if (!itemsSchema) {
3261
- return formData;
3262
- }
3263
- let hasChanges = false;
3264
- const mapped = formData.map((item, index) => {
3265
- let itemSchema = itemsSchema;
3266
- if (Array.isArray(itemsSchema)) {
3267
- itemSchema = itemsSchema[index] || resolvedSchema.additionalItems || {};
3268
- }
3269
- const cleaned = removeOptionalEmptyObjects(validator, itemSchema, rootSchema, item);
3270
- if (cleaned !== item) {
3271
- hasChanges = true;
3272
- }
3273
- return cleaned === void 0 ? {} : cleaned;
3274
- });
3275
- return hasChanges ? mapped : formData;
3276
- }
3277
- const { properties, required: requiredFields = [] } = resolvedSchema;
3278
- if (!isObject(formData) || !properties) {
3279
- return formData;
3414
+ // src/nameGenerators.ts
3415
+ var bracketNameGenerator = (path, idPrefix, isMultiValue) => {
3416
+ if (!path || path.length === 0) {
3417
+ return idPrefix;
3280
3418
  }
3281
- const result = {};
3282
- const data = formData;
3283
- let hasAnyValue = false;
3284
- for (const key of Object.keys(data)) {
3285
- const value = data[key];
3286
- const propertySchema = properties[key] || {};
3287
- const isRequired = requiredFields.includes(key);
3288
- const isObj = isObject(value);
3289
- const isArr = Array.isArray(value);
3290
- if ((isObj || isArr) && properties[key]) {
3291
- const cleaned = removeOptionalEmptyObjects(validator, propertySchema, rootSchema, value);
3292
- if (!isRequired && isValueEmpty(cleaned)) {
3293
- continue;
3294
- }
3295
- result[key] = cleaned;
3296
- hasAnyValue = true;
3297
- } else if (!isRequired && isValueEmpty(value) && properties[key]) {
3298
- continue;
3299
- } else {
3300
- result[key] = value;
3301
- if (!isValueEmpty(value)) {
3302
- hasAnyValue = true;
3303
- }
3419
+ const baseName = path.reduce((acc, pathUnit, index) => {
3420
+ if (index === 0) {
3421
+ return `${idPrefix}[${String(pathUnit)}]`;
3304
3422
  }
3423
+ return `${acc}[${String(pathUnit)}]`;
3424
+ }, "");
3425
+ return isMultiValue ? `${baseName}[]` : baseName;
3426
+ };
3427
+ var dotNotationNameGenerator = (path, idPrefix, _isMultiValue) => {
3428
+ if (!path || path.length === 0) {
3429
+ return idPrefix;
3305
3430
  }
3306
- if (!hasAnyValue && Object.keys(result).length === 0) {
3307
- return void 0;
3308
- }
3309
- return result;
3310
- }
3431
+ return `${idPrefix}.${path.map(String).join(".")}`;
3432
+ };
3311
3433
 
3312
3434
  // src/orderProperties.ts
3313
3435
  function orderProperties(properties, order) {
@@ -3365,6 +3487,64 @@ function parseDateString(dateString, includeTime = true) {
3365
3487
  };
3366
3488
  }
3367
3489
 
3490
+ // src/removeOptionalEmptyObjects.ts
3491
+ function removeOptionalEmptyObjects(validator, schema, rootSchema, formData) {
3492
+ if (!isObject(schema)) {
3493
+ return formData;
3494
+ }
3495
+ const resolvedSchema = retrieveSchema(validator, schema, rootSchema, formData);
3496
+ if (Array.isArray(formData)) {
3497
+ const itemsSchema = resolvedSchema.items;
3498
+ if (!itemsSchema) {
3499
+ return formData;
3500
+ }
3501
+ let hasChanges = false;
3502
+ const mapped = formData.map((item, index) => {
3503
+ let itemSchema = itemsSchema;
3504
+ if (Array.isArray(itemsSchema)) {
3505
+ itemSchema = itemsSchema[index] || resolvedSchema.additionalItems || {};
3506
+ }
3507
+ const cleaned = removeOptionalEmptyObjects(validator, itemSchema, rootSchema, item);
3508
+ if (cleaned !== item) {
3509
+ hasChanges = true;
3510
+ }
3511
+ return cleaned === void 0 ? {} : cleaned;
3512
+ });
3513
+ return hasChanges ? mapped : formData;
3514
+ }
3515
+ const { properties, required: requiredFields = [] } = resolvedSchema;
3516
+ if (!isObject(formData) || !properties) {
3517
+ return formData;
3518
+ }
3519
+ const result = {};
3520
+ const data = formData;
3521
+ let hasAnyValue = false;
3522
+ for (const key of Object.keys(data)) {
3523
+ const value = data[key];
3524
+ const propertySchema = properties[key] || {};
3525
+ const isRequired = requiredFields.includes(key);
3526
+ const isObj = isObject(value);
3527
+ const isArr = Array.isArray(value);
3528
+ if ((isObj || isArr) && properties[key]) {
3529
+ const cleaned = removeOptionalEmptyObjects(validator, propertySchema, rootSchema, value);
3530
+ if (!isRequired && isValueEmpty(cleaned)) {
3531
+ continue;
3532
+ }
3533
+ result[key] = cleaned;
3534
+ hasAnyValue = true;
3535
+ } else if (isRequired || !isValueEmpty(value) || !properties[key]) {
3536
+ result[key] = value;
3537
+ if (!isValueEmpty(value)) {
3538
+ hasAnyValue = true;
3539
+ }
3540
+ }
3541
+ }
3542
+ if (!hasAnyValue && Object.keys(result).length === 0) {
3543
+ return void 0;
3544
+ }
3545
+ return result;
3546
+ }
3547
+
3368
3548
  // src/resolveUiSchema.ts
3369
3549
  import isEmpty7 from "lodash/isEmpty";
3370
3550
  function resolveUiSchema(schema, localUiSchema, registry) {
@@ -3435,6 +3615,31 @@ function schemaRequiresTrueValue(schema) {
3435
3615
  return false;
3436
3616
  }
3437
3617
 
3618
+ // src/shallowEquals.ts
3619
+ function shallowEquals(a, b) {
3620
+ if (Object.is(a, b)) {
3621
+ return true;
3622
+ }
3623
+ if (a == null || b == null) {
3624
+ return false;
3625
+ }
3626
+ if (typeof a !== "object" || typeof b !== "object") {
3627
+ return false;
3628
+ }
3629
+ const keysA = Object.keys(a);
3630
+ const keysB = Object.keys(b);
3631
+ if (keysA.length !== keysB.length) {
3632
+ return false;
3633
+ }
3634
+ for (let i = 0; i < keysA.length; i++) {
3635
+ const key = keysA[i];
3636
+ if (!Object.prototype.hasOwnProperty.call(b, key) || !Object.is(a[key], b[key])) {
3637
+ return false;
3638
+ }
3639
+ }
3640
+ return true;
3641
+ }
3642
+
3438
3643
  // src/shouldRender.ts
3439
3644
  function shouldRender(component, nextProps, nextState, updateStrategy = "customDeep") {
3440
3645
  if (updateStrategy === "always") {
@@ -3735,15 +3940,14 @@ function useFileWidgetProps(value, onChange, multiple = false) {
3735
3940
  [value]
3736
3941
  );
3737
3942
  const handleChange = useCallback2(
3738
- (files) => {
3739
- processFiles(files).then((filesInfoEvent) => {
3740
- const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL || null);
3741
- if (multiple) {
3742
- onChange(values.concat(...newValue));
3743
- } else {
3744
- onChange(newValue[0]);
3745
- }
3746
- });
3943
+ async (files) => {
3944
+ const filesInfoEvent = await processFiles(files);
3945
+ const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL || null);
3946
+ if (multiple) {
3947
+ onChange(values.concat(...newValue));
3948
+ } else {
3949
+ onChange(newValue[0]);
3950
+ }
3747
3951
  },
3748
3952
  [values, multiple, onChange]
3749
3953
  );
@@ -3827,26 +4031,6 @@ function withIdRefPrefix(schemaNode) {
3827
4031
  return schemaNode;
3828
4032
  }
3829
4033
 
3830
- // src/nameGenerators.ts
3831
- var bracketNameGenerator = (path, idPrefix, isMultiValue) => {
3832
- if (!path || path.length === 0) {
3833
- return idPrefix;
3834
- }
3835
- const baseName = path.reduce((acc, pathUnit, index) => {
3836
- if (index === 0) {
3837
- return `${idPrefix}[${String(pathUnit)}]`;
3838
- }
3839
- return `${acc}[${String(pathUnit)}]`;
3840
- }, "");
3841
- return isMultiValue ? `${baseName}[]` : baseName;
3842
- };
3843
- var dotNotationNameGenerator = (path, idPrefix, _isMultiValue) => {
3844
- if (!path || path.length === 0) {
3845
- return idPrefix;
3846
- }
3847
- return `${idPrefix}.${path.map(String).join(".")}`;
3848
- };
3849
-
3850
4034
  // src/enums.ts
3851
4035
  var TranslatableString = /* @__PURE__ */ ((TranslatableString2) => {
3852
4036
  TranslatableString2["ArrayItemTitle"] = "Item";
@@ -3879,6 +4063,7 @@ var TranslatableString = /* @__PURE__ */ ((TranslatableString2) => {
3879
4063
  TranslatableString2["OptionPrefix"] = "Option %1";
3880
4064
  TranslatableString2["TitleOptionPrefix"] = "%1 option %2";
3881
4065
  TranslatableString2["KeyLabel"] = "%1 Key";
4066
+ TranslatableString2["DeprecatedLabel"] = "%1 (deprecated)";
3882
4067
  TranslatableString2["InvalidObjectField"] = 'Invalid "%1" object field configuration: _%2_.';
3883
4068
  TranslatableString2["UnsupportedField"] = "Unsupported field schema.";
3884
4069
  TranslatableString2["UnsupportedFieldWithId"] = "Unsupported field schema for field `%1`.";
@@ -4111,6 +4296,7 @@ export {
4111
4296
  isObject,
4112
4297
  isRootSchema,
4113
4298
  isSelect,
4299
+ isValueEmpty,
4114
4300
  labelValue,
4115
4301
  localToUTC,
4116
4302
  lookupFromFormContext,
@@ -4125,6 +4311,7 @@ export {
4125
4311
  pad,
4126
4312
  parseDateString,
4127
4313
  rangeSpec,
4314
+ relaxOptionsForScoring,
4128
4315
  removeOptionalEmptyObjects,
4129
4316
  replaceStringParameters,
4130
4317
  resolveUiSchema,