@rjsf/utils 6.6.2 → 6.7.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.
- package/LICENSE.md +201 -0
- package/dist/index.cjs +229 -108
- package/dist/index.cjs.map +4 -4
- package/dist/utils.esm.js +229 -108
- package/dist/utils.esm.js.map +4 -4
- package/dist/utils.umd.js +260 -136
- package/lib/SelectedOptionDescription.d.ts +4 -0
- package/lib/SelectedOptionDescription.js +24 -0
- package/lib/SelectedOptionDescription.js.map +1 -0
- package/lib/constants.d.ts +8 -5
- package/lib/constants.js +10 -7
- package/lib/constants.js.map +1 -1
- package/lib/createSchemaUtils.js +1 -1
- package/lib/createSchemaUtils.js.map +1 -1
- package/lib/enums.d.ts +4 -0
- package/lib/enums.js +4 -0
- package/lib/enums.js.map +1 -1
- package/lib/getSubmitButtonOptions.js +1 -1
- package/lib/getSubmitButtonOptions.js.map +1 -1
- package/lib/getWidget.js +2 -1
- package/lib/getWidget.js.map +1 -1
- package/lib/hashForSchema.d.ts +2 -0
- package/lib/hashForSchema.js +3 -1
- package/lib/hashForSchema.js.map +1 -1
- package/lib/index.d.ts +5 -2
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/isFixedItems.d.ts +2 -2
- package/lib/isFixedItems.js +3 -3
- package/lib/isFixedItems.js.map +1 -1
- package/lib/isRootSchema.js +2 -3
- package/lib/isRootSchema.js.map +1 -1
- package/lib/logUnsupportedDefaultForEnum.d.ts +9 -0
- package/lib/logUnsupportedDefaultForEnum.js +18 -0
- package/lib/logUnsupportedDefaultForEnum.js.map +1 -0
- package/lib/mergeSchemas.js +8 -1
- package/lib/mergeSchemas.js.map +1 -1
- package/lib/optionsList.js +22 -21
- package/lib/optionsList.js.map +1 -1
- package/lib/resolveUiSchema.js.map +1 -1
- package/lib/schema/getDefaultFormState.d.ts +1 -1
- package/lib/schema/getDefaultFormState.js +54 -17
- package/lib/schema/getDefaultFormState.js.map +1 -1
- package/lib/schema/getDisplayLabel.js +2 -3
- package/lib/schema/getDisplayLabel.js.map +1 -1
- package/lib/schema/omitExtraData.js +11 -0
- package/lib/schema/omitExtraData.js.map +1 -1
- package/lib/schema/retrieveSchema.d.ts +5 -1
- package/lib/schema/retrieveSchema.js +49 -14
- package/lib/schema/retrieveSchema.js.map +1 -1
- package/lib/schemaRequiresTrueValue.js +4 -3
- package/lib/schemaRequiresTrueValue.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types.d.ts +24 -0
- package/lib/useAltDateWidgetProps.d.ts +1 -1
- package/lib/useFileWidgetProps.js +2 -2
- package/lib/useFileWidgetProps.js.map +1 -1
- package/package.json +19 -19
- package/src/SelectedOptionDescription.tsx +48 -0
- package/src/constants.ts +10 -7
- package/src/createSchemaUtils.ts +1 -1
- package/src/enums.ts +4 -0
- package/src/getSubmitButtonOptions.ts +1 -1
- package/src/getWidget.tsx +1 -1
- package/src/hashForSchema.ts +3 -1
- package/src/index.ts +6 -0
- package/src/isFixedItems.ts +3 -3
- package/src/isRootSchema.ts +2 -4
- package/src/logUnsupportedDefaultForEnum.ts +28 -0
- package/src/mergeSchemas.ts +9 -2
- package/src/optionsList.ts +20 -22
- package/src/resolveUiSchema.ts +12 -4
- package/src/schema/getDefaultFormState.ts +80 -22
- package/src/schema/getDisplayLabel.ts +3 -4
- package/src/schema/omitExtraData.ts +11 -0
- package/src/schema/retrieveSchema.ts +59 -13
- package/src/schemaRequiresTrueValue.ts +3 -3
- package/src/types.ts +31 -0
- package/src/useFileWidgetProps.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -61,10 +61,13 @@ __export(index_exports, {
|
|
|
61
61
|
REF_KEY: () => REF_KEY,
|
|
62
62
|
REQUIRED_KEY: () => REQUIRED_KEY,
|
|
63
63
|
RJSF_ADDITIONAL_PROPERTIES_FLAG: () => RJSF_ADDITIONAL_PROPERTIES_FLAG,
|
|
64
|
+
RJSF_PREFIX_KEY: () => RJSF_PREFIX_KEY,
|
|
65
|
+
RJSF_REF_CYCLE_KEY: () => RJSF_REF_CYCLE_KEY,
|
|
64
66
|
RJSF_REF_KEY: () => RJSF_REF_KEY,
|
|
65
67
|
ROOT_SCHEMA_PREFIX: () => ROOT_SCHEMA_PREFIX,
|
|
66
68
|
SCHEMA_KEY: () => SCHEMA_KEY,
|
|
67
69
|
SUBMIT_BTN_OPTIONS_KEY: () => SUBMIT_BTN_OPTIONS_KEY,
|
|
70
|
+
SelectedOptionDescription: () => SelectedOptionDescription,
|
|
68
71
|
TranslatableString: () => TranslatableString,
|
|
69
72
|
UI_DEFINITIONS_KEY: () => UI_DEFINITIONS_KEY,
|
|
70
73
|
UI_FIELD_KEY: () => UI_FIELD_KEY,
|
|
@@ -135,6 +138,7 @@ __export(index_exports, {
|
|
|
135
138
|
isValueEmpty: () => isValueEmpty,
|
|
136
139
|
labelValue: () => labelValue,
|
|
137
140
|
localToUTC: () => localToUTC,
|
|
141
|
+
logUnsupportedDefaultForEnum: () => logUnsupportedDefaultForEnum,
|
|
138
142
|
lookupFromFormContext: () => lookupFromFormContext,
|
|
139
143
|
mergeDefaultsWithFormData: () => mergeDefaultsWithFormData,
|
|
140
144
|
mergeObjects: () => mergeObjects,
|
|
@@ -221,7 +225,7 @@ function asNumber(value) {
|
|
|
221
225
|
}
|
|
222
226
|
|
|
223
227
|
// src/constants.ts
|
|
224
|
-
var ADDITIONAL_PROPERTY_FLAG = "__additional_property";
|
|
228
|
+
var ADDITIONAL_PROPERTY_FLAG = /* @__PURE__ */ Symbol("__additional_property");
|
|
225
229
|
var ADDITIONAL_PROPERTIES_KEY = "additionalProperties";
|
|
226
230
|
var ALL_OF_KEY = "allOf";
|
|
227
231
|
var ANY_OF_KEY = "anyOf";
|
|
@@ -243,15 +247,17 @@ var READONLY_KEY = "readonly";
|
|
|
243
247
|
var REQUIRED_KEY = "required";
|
|
244
248
|
var SUBMIT_BTN_OPTIONS_KEY = "submitButtonOptions";
|
|
245
249
|
var REF_KEY = "$ref";
|
|
246
|
-
var RJSF_REF_KEY = "__rjsf_ref";
|
|
250
|
+
var RJSF_REF_KEY = /* @__PURE__ */ Symbol("__rjsf_ref");
|
|
251
|
+
var RJSF_REF_CYCLE_KEY = /* @__PURE__ */ Symbol("__rjsf_ref_cycle");
|
|
247
252
|
var SCHEMA_KEY = "$schema";
|
|
248
253
|
var DEFAULT_ID_PREFIX = "root";
|
|
249
254
|
var DEFAULT_ID_SEPARATOR = "_";
|
|
250
255
|
var DISCRIMINATOR_PATH = ["discriminator", "propertyName"];
|
|
251
256
|
var FORM_CONTEXT_NAME = "formContext";
|
|
252
257
|
var LOOKUP_MAP_NAME = "layoutGridLookupMap";
|
|
253
|
-
var
|
|
254
|
-
var
|
|
258
|
+
var RJSF_PREFIX_KEY = "__rjsf";
|
|
259
|
+
var RJSF_ADDITIONAL_PROPERTIES_FLAG = `${RJSF_PREFIX_KEY}_additionalProperties`;
|
|
260
|
+
var ROOT_SCHEMA_PREFIX = `${RJSF_PREFIX_KEY}_rootSchema`;
|
|
255
261
|
var UI_FIELD_KEY = "ui:field";
|
|
256
262
|
var UI_WIDGET_KEY = "ui:widget";
|
|
257
263
|
var UI_OPTIONS_KEY = "ui:options";
|
|
@@ -322,7 +328,7 @@ function createErrorHandler(formData) {
|
|
|
322
328
|
}
|
|
323
329
|
|
|
324
330
|
// src/createSchemaUtils.ts
|
|
325
|
-
var
|
|
331
|
+
var import_get16 = __toESM(require("lodash/get"), 1);
|
|
326
332
|
|
|
327
333
|
// src/deepEquals.ts
|
|
328
334
|
var import_fast_equals = require("fast-equals");
|
|
@@ -526,7 +532,7 @@ function getSchemaType(schema) {
|
|
|
526
532
|
// src/mergeSchemas.ts
|
|
527
533
|
function mergeSchemas(obj1, obj2) {
|
|
528
534
|
const acc = { ...obj1 };
|
|
529
|
-
|
|
535
|
+
const result = Object.keys(obj2).reduce((accumulator, key) => {
|
|
530
536
|
const left = obj1 ? obj1[key] : {}, right = obj2[key];
|
|
531
537
|
if (obj1 && key in obj1 && isObject(right)) {
|
|
532
538
|
accumulator[key] = mergeSchemas(left, right);
|
|
@@ -537,6 +543,10 @@ function mergeSchemas(obj1, obj2) {
|
|
|
537
543
|
}
|
|
538
544
|
return accumulator;
|
|
539
545
|
}, acc);
|
|
546
|
+
for (const sym of Object.getOwnPropertySymbols(obj2)) {
|
|
547
|
+
result[sym] = obj2[sym];
|
|
548
|
+
}
|
|
549
|
+
return result;
|
|
540
550
|
}
|
|
541
551
|
|
|
542
552
|
// src/schema/getFirstMatchingOption.ts
|
|
@@ -638,6 +648,12 @@ function retrieveSchema(validator, schema, rootSchema = {}, rawFormData, experim
|
|
|
638
648
|
resolveAnyOfOrOneOfRefs
|
|
639
649
|
)[0];
|
|
640
650
|
}
|
|
651
|
+
function normalizeBooleanSchema(schema) {
|
|
652
|
+
if (typeof schema !== "boolean") {
|
|
653
|
+
return schema;
|
|
654
|
+
}
|
|
655
|
+
return schema ? {} : { not: {} };
|
|
656
|
+
}
|
|
641
657
|
function resolveCondition(validator, schema, rootSchema, expandAllBranches, recurseList, formData, experimental_customMergeAllOf) {
|
|
642
658
|
const { if: expression, then, else: otherwise, ...resolvedSchemaLessConditional } = schema;
|
|
643
659
|
const conditionValue = validator.isValid(expression, formData || {}, rootSchema);
|
|
@@ -645,10 +661,11 @@ function resolveCondition(validator, schema, rootSchema, expandAllBranches, recu
|
|
|
645
661
|
let schemas = [];
|
|
646
662
|
if (expandAllBranches) {
|
|
647
663
|
if (then && typeof then !== "boolean") {
|
|
664
|
+
const thenSchema = then;
|
|
648
665
|
schemas = schemas.concat(
|
|
649
666
|
retrieveSchemaInternal(
|
|
650
667
|
validator,
|
|
651
|
-
|
|
668
|
+
thenSchema,
|
|
652
669
|
rootSchema,
|
|
653
670
|
formData,
|
|
654
671
|
expandAllBranches,
|
|
@@ -658,10 +675,11 @@ function resolveCondition(validator, schema, rootSchema, expandAllBranches, recu
|
|
|
658
675
|
);
|
|
659
676
|
}
|
|
660
677
|
if (otherwise && typeof otherwise !== "boolean") {
|
|
678
|
+
const otherwiseSchema = otherwise;
|
|
661
679
|
schemas = schemas.concat(
|
|
662
680
|
retrieveSchemaInternal(
|
|
663
681
|
validator,
|
|
664
|
-
|
|
682
|
+
otherwiseSchema,
|
|
665
683
|
rootSchema,
|
|
666
684
|
formData,
|
|
667
685
|
expandAllBranches,
|
|
@@ -671,8 +689,9 @@ function resolveCondition(validator, schema, rootSchema, expandAllBranches, recu
|
|
|
671
689
|
);
|
|
672
690
|
}
|
|
673
691
|
} else {
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
692
|
+
const conditionalBranch = conditionValue ? then : otherwise;
|
|
693
|
+
if (conditionalBranch !== void 0) {
|
|
694
|
+
const conditionalSchema = normalizeBooleanSchema(conditionalBranch);
|
|
676
695
|
schemas = schemas.concat(
|
|
677
696
|
retrieveSchemaInternal(
|
|
678
697
|
validator,
|
|
@@ -796,7 +815,7 @@ function resolveReference(validator, schema, rootSchema, expandAllBranches, recu
|
|
|
796
815
|
}
|
|
797
816
|
return [schema];
|
|
798
817
|
}
|
|
799
|
-
function resolveAllReferences(schema, rootSchema, recurseList, baseURI, resolveAnyOfOrOneOfRefs) {
|
|
818
|
+
function resolveAllReferences(schema, rootSchema, recurseList, baseURI, resolveAnyOfOrOneOfRefs, markCycleOnDetection = false) {
|
|
800
819
|
if (!isObject(schema)) {
|
|
801
820
|
return schema;
|
|
802
821
|
}
|
|
@@ -805,7 +824,7 @@ function resolveAllReferences(schema, rootSchema, recurseList, baseURI, resolveA
|
|
|
805
824
|
if (REF_KEY in resolvedSchema) {
|
|
806
825
|
const { $ref, ...localSchema } = resolvedSchema;
|
|
807
826
|
if (recurseList.includes($ref)) {
|
|
808
|
-
return resolvedSchema;
|
|
827
|
+
return markCycleOnDetection ? { ...resolvedSchema, [RJSF_REF_CYCLE_KEY]: true } : resolvedSchema;
|
|
809
828
|
}
|
|
810
829
|
recurseList.push($ref);
|
|
811
830
|
const refSchema = findSchemaDefinition($ref, rootSchema, currentBaseURI);
|
|
@@ -820,7 +839,14 @@ function resolveAllReferences(schema, rootSchema, recurseList, baseURI, resolveA
|
|
|
820
839
|
resolvedSchema[PROPERTIES_KEY],
|
|
821
840
|
(acc, value, key) => {
|
|
822
841
|
const childList = [...recurseList];
|
|
823
|
-
acc[key] = resolveAllReferences(
|
|
842
|
+
acc[key] = resolveAllReferences(
|
|
843
|
+
value,
|
|
844
|
+
rootSchema,
|
|
845
|
+
childList,
|
|
846
|
+
currentBaseURI,
|
|
847
|
+
resolveAnyOfOrOneOfRefs,
|
|
848
|
+
!resolveAnyOfOrOneOfRefs
|
|
849
|
+
);
|
|
824
850
|
childrenLists.push(childList);
|
|
825
851
|
},
|
|
826
852
|
{}
|
|
@@ -831,6 +857,7 @@ function resolveAllReferences(schema, rootSchema, recurseList, baseURI, resolveA
|
|
|
831
857
|
if (ITEMS_KEY in resolvedSchema && !Array.isArray(resolvedSchema.items) && typeof resolvedSchema.items !== "boolean") {
|
|
832
858
|
resolvedSchema = {
|
|
833
859
|
...resolvedSchema,
|
|
860
|
+
// Array items are only rendered when data exists, so a $ref cycle here does NOT cause an infinite render.
|
|
834
861
|
items: resolveAllReferences(
|
|
835
862
|
resolvedSchema.items,
|
|
836
863
|
rootSchema,
|
|
@@ -881,7 +908,7 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
|
|
|
881
908
|
(0, import_get5.default)(formData, [key]),
|
|
882
909
|
experimental_customMergeAllOf
|
|
883
910
|
);
|
|
884
|
-
|
|
911
|
+
schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
|
|
885
912
|
return;
|
|
886
913
|
}
|
|
887
914
|
}
|
|
@@ -893,7 +920,7 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
|
|
|
893
920
|
validator,
|
|
894
921
|
{ [REF_KEY]: (0, import_get5.default)(schema.additionalProperties, [REF_KEY]) },
|
|
895
922
|
rootSchema,
|
|
896
|
-
formData,
|
|
923
|
+
(0, import_get5.default)(formData, [key]),
|
|
897
924
|
experimental_customMergeAllOf
|
|
898
925
|
);
|
|
899
926
|
} else if ("type" in schema.additionalProperties) {
|
|
@@ -910,10 +937,10 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
|
|
|
910
937
|
additionalProperties = { type: guessType((0, import_get5.default)(formData, [key])) };
|
|
911
938
|
}
|
|
912
939
|
schema.properties[key] = additionalProperties;
|
|
913
|
-
|
|
940
|
+
schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
|
|
914
941
|
} else {
|
|
915
942
|
schema.properties[key] = { type: "null" };
|
|
916
|
-
|
|
943
|
+
schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
|
|
917
944
|
}
|
|
918
945
|
});
|
|
919
946
|
return schema;
|
|
@@ -956,17 +983,26 @@ function retrieveSchemaInternal(validator, schema, rootSchema, rawFormData, expa
|
|
|
956
983
|
try {
|
|
957
984
|
const withContainsSchemas = [];
|
|
958
985
|
const withoutContainsSchemas = [];
|
|
986
|
+
const allOfSymbols = {};
|
|
959
987
|
resolvedSchema.allOf?.forEach((allOfItem) => {
|
|
960
988
|
if (typeof allOfItem === "object" && allOfItem.contains) {
|
|
961
989
|
withContainsSchemas.push(allOfItem);
|
|
962
990
|
} else {
|
|
963
991
|
withoutContainsSchemas.push(allOfItem);
|
|
992
|
+
for (const sym of Object.getOwnPropertySymbols(allOfItem)) {
|
|
993
|
+
if (!(sym in allOfSymbols)) {
|
|
994
|
+
allOfSymbols[sym] = allOfItem[sym];
|
|
995
|
+
}
|
|
996
|
+
}
|
|
964
997
|
}
|
|
965
998
|
});
|
|
966
999
|
if (withContainsSchemas.length) {
|
|
967
1000
|
resolvedSchema = { ...resolvedSchema, allOf: withoutContainsSchemas };
|
|
968
1001
|
}
|
|
969
1002
|
resolvedSchema = experimental_customMergeAllOf ? experimental_customMergeAllOf(resolvedSchema) : mergeAllOf(resolvedSchema);
|
|
1003
|
+
for (const sym of Object.getOwnPropertySymbols(allOfSymbols)) {
|
|
1004
|
+
resolvedSchema[sym] = allOfSymbols[sym];
|
|
1005
|
+
}
|
|
970
1006
|
if (withContainsSchemas.length) {
|
|
971
1007
|
resolvedSchema.allOf = withContainsSchemas;
|
|
972
1008
|
}
|
|
@@ -1035,7 +1071,7 @@ function resolveAnyOrOneOfSchemas(validator, schema, rootSchema, expandAllBranch
|
|
|
1035
1071
|
function relaxOptionsForScoring(options, resolveRefs = false, rootSchema) {
|
|
1036
1072
|
return options.map((d) => {
|
|
1037
1073
|
if (!isObject(d)) {
|
|
1038
|
-
return d
|
|
1074
|
+
return normalizeBooleanSchema(d);
|
|
1039
1075
|
}
|
|
1040
1076
|
const schema = resolveRefs && rootSchema ? resolveAllReferences(d, rootSchema, []) : d;
|
|
1041
1077
|
return schema.additionalProperties === false ? { ...schema, additionalProperties: true } : schema;
|
|
@@ -1149,7 +1185,7 @@ function withDependentSchema(validator, schema, rootSchema, dependencyKey, depen
|
|
|
1149
1185
|
}
|
|
1150
1186
|
function withExactlyOneSubschema(validator, schema, rootSchema, dependencyKey, oneOf, expandAllBranches, recurseList, formData, experimental_customMergeAllOf) {
|
|
1151
1187
|
const validSubschemas = oneOf.filter((subschema) => {
|
|
1152
|
-
if (typeof subschema === "boolean" || !subschema
|
|
1188
|
+
if (typeof subschema === "boolean" || !subschema?.properties) {
|
|
1153
1189
|
return false;
|
|
1154
1190
|
}
|
|
1155
1191
|
const { [dependencyKey]: conditionPropertySchema } = subschema.properties;
|
|
@@ -1470,7 +1506,7 @@ function isConstant(schema) {
|
|
|
1470
1506
|
|
|
1471
1507
|
// src/isFixedItems.ts
|
|
1472
1508
|
function isFixedItems(schema) {
|
|
1473
|
-
return Array.isArray(schema.items) && schema.items.
|
|
1509
|
+
return Array.isArray(schema.items) && schema.items.every((item) => isObject(item));
|
|
1474
1510
|
}
|
|
1475
1511
|
|
|
1476
1512
|
// src/mergeDefaultsWithFormData.ts
|
|
@@ -1619,7 +1655,7 @@ function optionsList(schema, uiSchema) {
|
|
|
1619
1655
|
const { optionsSchemaSelector = selectorField } = getUiOptions(uiSchema);
|
|
1620
1656
|
selectorField = optionsSchemaSelector;
|
|
1621
1657
|
}
|
|
1622
|
-
return altSchemas
|
|
1658
|
+
return altSchemas?.map((aSchemaDef, index) => {
|
|
1623
1659
|
const { title } = getUiOptions(altUiSchemas?.[index]);
|
|
1624
1660
|
const aSchema = aSchemaDef;
|
|
1625
1661
|
let value;
|
|
@@ -1627,10 +1663,10 @@ function optionsList(schema, uiSchema) {
|
|
|
1627
1663
|
if (selectorField) {
|
|
1628
1664
|
const innerSchema = (0, import_get11.default)(aSchema, [PROPERTIES_KEY, selectorField], {});
|
|
1629
1665
|
value = (0, import_get11.default)(innerSchema, DEFAULT_KEY, (0, import_get11.default)(innerSchema, CONST_KEY));
|
|
1630
|
-
label = label
|
|
1666
|
+
label = label ?? innerSchema?.title ?? aSchema.title ?? String(value);
|
|
1631
1667
|
} else {
|
|
1632
1668
|
value = toConstant(aSchema);
|
|
1633
|
-
label = label
|
|
1669
|
+
label = label ?? aSchema.title ?? String(value);
|
|
1634
1670
|
}
|
|
1635
1671
|
return {
|
|
1636
1672
|
schema: aSchema,
|
|
@@ -1720,8 +1756,8 @@ function computeDefaults(validator, rawSchema, computeDefaultsProps = {}) {
|
|
|
1720
1756
|
rootSchema = {},
|
|
1721
1757
|
includeUndefinedValues = false,
|
|
1722
1758
|
_recurseList = [],
|
|
1723
|
-
experimental_defaultFormStateBehavior
|
|
1724
|
-
experimental_customMergeAllOf
|
|
1759
|
+
experimental_defaultFormStateBehavior,
|
|
1760
|
+
experimental_customMergeAllOf,
|
|
1725
1761
|
required,
|
|
1726
1762
|
shouldMergeDefaultsIntoFormData = false,
|
|
1727
1763
|
initialDefaultsGenerated
|
|
@@ -1729,14 +1765,19 @@ function computeDefaults(validator, rawSchema, computeDefaultsProps = {}) {
|
|
|
1729
1765
|
let formData = isObject(rawFormData) ? rawFormData : {};
|
|
1730
1766
|
const schema = isObject(rawSchema) ? rawSchema : {};
|
|
1731
1767
|
let defaults = parentDefaults;
|
|
1768
|
+
const preferParentDefaults = defaults && experimental_defaultFormStateBehavior?.nestedDefaultsPrecedence === "ancestorWins";
|
|
1732
1769
|
let schemaToCompute = null;
|
|
1733
1770
|
let experimental_dfsb_to_compute = experimental_defaultFormStateBehavior;
|
|
1734
1771
|
let updatedRecurseList = _recurseList;
|
|
1735
1772
|
if (schema[CONST_KEY] !== void 0 && experimental_defaultFormStateBehavior?.constAsDefaults !== "never" && !constIsAjvDataReference(schema)) {
|
|
1736
1773
|
defaults = schema[CONST_KEY];
|
|
1737
1774
|
} else if (isObject(defaults) && isObject(schema.default) && !schema[ANY_OF_KEY] && !schema[ONE_OF_KEY] && !schema[REF_KEY]) {
|
|
1738
|
-
|
|
1739
|
-
|
|
1775
|
+
if (preferParentDefaults) {
|
|
1776
|
+
defaults = mergeObjects(schema.default, defaults);
|
|
1777
|
+
} else {
|
|
1778
|
+
defaults = mergeObjects(defaults, schema.default);
|
|
1779
|
+
}
|
|
1780
|
+
} else if (DEFAULT_KEY in schema && !preferParentDefaults && !schema[ANY_OF_KEY] && !schema[ONE_OF_KEY] && !schema[REF_KEY]) {
|
|
1740
1781
|
defaults = schema.default;
|
|
1741
1782
|
} else if (REF_KEY in schema) {
|
|
1742
1783
|
const refName = schema[REF_KEY];
|
|
@@ -1766,7 +1807,7 @@ function computeDefaults(validator, rawSchema, computeDefaultsProps = {}) {
|
|
|
1766
1807
|
experimental_customMergeAllOf
|
|
1767
1808
|
);
|
|
1768
1809
|
[schemaToCompute] = resolvedSchema;
|
|
1769
|
-
} else if (isFixedItems(schema)) {
|
|
1810
|
+
} else if (isFixedItems(schema) && !preferParentDefaults) {
|
|
1770
1811
|
defaults = schema.items.map(
|
|
1771
1812
|
(itemSchema, idx) => computeDefaults(validator, itemSchema, {
|
|
1772
1813
|
rootSchema,
|
|
@@ -1862,16 +1903,36 @@ function computeDefaults(validator, rawSchema, computeDefaultsProps = {}) {
|
|
|
1862
1903
|
return defaultsWithFormData;
|
|
1863
1904
|
}
|
|
1864
1905
|
function ensureFormDataMatchingSchema(validator, schema, rootSchema, formData, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
|
|
1865
|
-
const
|
|
1906
|
+
const shouldRetrieveAllOf = experimental_defaultFormStateBehavior?.allOf === "populateDefaults" && ALL_OF_KEY in schema;
|
|
1907
|
+
const schemaToMatch = shouldRetrieveAllOf ? retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf) : schema;
|
|
1908
|
+
const isSelectField = !isConstant(schemaToMatch) && isSelect(validator, schemaToMatch, rootSchema, experimental_customMergeAllOf);
|
|
1866
1909
|
let validFormData = formData;
|
|
1867
1910
|
if (isSelectField) {
|
|
1868
|
-
const getOptionsList = optionsList(
|
|
1911
|
+
const getOptionsList = optionsList(schemaToMatch);
|
|
1869
1912
|
const isValid = getOptionsList?.some((option) => deepEquals_default(option.value, formData));
|
|
1870
1913
|
validFormData = isValid ? formData : void 0;
|
|
1871
1914
|
}
|
|
1872
|
-
const constTakesPrecedence =
|
|
1915
|
+
const constTakesPrecedence = schemaToMatch[CONST_KEY] && experimental_defaultFormStateBehavior?.constAsDefaults === "always";
|
|
1873
1916
|
if (constTakesPrecedence) {
|
|
1874
|
-
validFormData =
|
|
1917
|
+
validFormData = schemaToMatch.const;
|
|
1918
|
+
} else if (isObject(validFormData) && isObject(schemaToMatch.properties)) {
|
|
1919
|
+
validFormData = Object.keys(schemaToMatch.properties).reduce(
|
|
1920
|
+
(acc, key) => {
|
|
1921
|
+
const propertySchema = (0, import_get12.default)(schemaToMatch, [PROPERTIES_KEY, key], {});
|
|
1922
|
+
if (key in acc && (shouldRetrieveAllOf || isObject(propertySchema) && ALL_OF_KEY in propertySchema)) {
|
|
1923
|
+
acc[key] = ensureFormDataMatchingSchema(
|
|
1924
|
+
validator,
|
|
1925
|
+
propertySchema,
|
|
1926
|
+
rootSchema,
|
|
1927
|
+
(0, import_get12.default)(acc, key),
|
|
1928
|
+
experimental_defaultFormStateBehavior,
|
|
1929
|
+
experimental_customMergeAllOf
|
|
1930
|
+
);
|
|
1931
|
+
}
|
|
1932
|
+
return acc;
|
|
1933
|
+
},
|
|
1934
|
+
{ ...validFormData }
|
|
1935
|
+
);
|
|
1875
1936
|
}
|
|
1876
1937
|
return validFormData;
|
|
1877
1938
|
}
|
|
@@ -1880,8 +1941,8 @@ function getObjectDefaults(validator, rawSchema, {
|
|
|
1880
1941
|
rootSchema = {},
|
|
1881
1942
|
includeUndefinedValues = false,
|
|
1882
1943
|
_recurseList = [],
|
|
1883
|
-
experimental_defaultFormStateBehavior
|
|
1884
|
-
experimental_customMergeAllOf
|
|
1944
|
+
experimental_defaultFormStateBehavior,
|
|
1945
|
+
experimental_customMergeAllOf,
|
|
1885
1946
|
required,
|
|
1886
1947
|
shouldMergeDefaultsIntoFormData,
|
|
1887
1948
|
initialDefaultsGenerated
|
|
@@ -1965,8 +2026,8 @@ function getArrayDefaults(validator, rawSchema, {
|
|
|
1965
2026
|
rawFormData,
|
|
1966
2027
|
rootSchema = {},
|
|
1967
2028
|
_recurseList = [],
|
|
1968
|
-
experimental_defaultFormStateBehavior
|
|
1969
|
-
experimental_customMergeAllOf
|
|
2029
|
+
experimental_defaultFormStateBehavior,
|
|
2030
|
+
experimental_customMergeAllOf,
|
|
1970
2031
|
required,
|
|
1971
2032
|
requiredAsRoot = false,
|
|
1972
2033
|
shouldMergeDefaultsIntoFormData,
|
|
@@ -2021,14 +2082,21 @@ function getArrayDefaults(validator, rawSchema, {
|
|
|
2021
2082
|
defaults = mergeDefaultsWithFormData(defaults, itemDefaults, mergeExtraDefaults);
|
|
2022
2083
|
}
|
|
2023
2084
|
}
|
|
2085
|
+
const defaultsLength = Array.isArray(defaults) ? defaults.length : 0;
|
|
2024
2086
|
if (neverPopulate) {
|
|
2087
|
+
if (shouldMergeDefaultsIntoFormData) {
|
|
2088
|
+
if (schema.minItems && schema.minItems > defaultsLength) {
|
|
2089
|
+
const fillerEntries = Array.from({ length: schema.minItems - defaultsLength }, () => null);
|
|
2090
|
+
return (defaults ?? []).concat(fillerEntries);
|
|
2091
|
+
}
|
|
2092
|
+
return defaults;
|
|
2093
|
+
}
|
|
2025
2094
|
return defaults ?? emptyDefault;
|
|
2026
2095
|
}
|
|
2027
2096
|
if (ignoreMinItemsFlagSet && !required) {
|
|
2028
2097
|
return defaults || void 0;
|
|
2029
2098
|
}
|
|
2030
2099
|
let arrayDefault;
|
|
2031
|
-
const defaultsLength = Array.isArray(defaults) ? defaults.length : 0;
|
|
2032
2100
|
if (!schema.minItems || isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) || computeSkipPopulate(validator, schema, rootSchema) || schema.minItems <= defaultsLength) {
|
|
2033
2101
|
arrayDefault = defaults || !required && !requiredAsRoot ? defaults : emptyDefault;
|
|
2034
2102
|
} else {
|
|
@@ -2088,9 +2156,17 @@ function getDefaultFormState(validator, theSchema, formData, rootSchema, include
|
|
|
2088
2156
|
if (isObject(formData) || Array.isArray(formData)) {
|
|
2089
2157
|
const { mergeDefaultsIntoFormData } = experimental_defaultFormStateBehavior || {};
|
|
2090
2158
|
const defaultSupercedesUndefined = mergeDefaultsIntoFormData === "useDefaultIfFormDataUndefined";
|
|
2159
|
+
const matchingFormData = ensureFormDataMatchingSchema(
|
|
2160
|
+
validator,
|
|
2161
|
+
schema,
|
|
2162
|
+
rootSchema ?? schema,
|
|
2163
|
+
formData,
|
|
2164
|
+
experimental_defaultFormStateBehavior,
|
|
2165
|
+
experimental_customMergeAllOf
|
|
2166
|
+
);
|
|
2091
2167
|
const result = mergeDefaultsWithFormData(
|
|
2092
2168
|
defaults,
|
|
2093
|
-
|
|
2169
|
+
matchingFormData,
|
|
2094
2170
|
true,
|
|
2095
2171
|
// set to true to add any additional default array entries.
|
|
2096
2172
|
defaultSupercedesUndefined,
|
|
@@ -2102,9 +2178,6 @@ function getDefaultFormState(validator, theSchema, formData, rootSchema, include
|
|
|
2102
2178
|
return defaults;
|
|
2103
2179
|
}
|
|
2104
2180
|
|
|
2105
|
-
// src/schema/getDisplayLabel.ts
|
|
2106
|
-
var import_get13 = __toESM(require("lodash/get"), 1);
|
|
2107
|
-
|
|
2108
2181
|
// src/isCustomWidget.ts
|
|
2109
2182
|
function isCustomWidget(uiSchema = {}) {
|
|
2110
2183
|
return (
|
|
@@ -2139,7 +2212,7 @@ function getDisplayLabel(validator, schema, uiSchema = {}, rootSchema, globalOpt
|
|
|
2139
2212
|
let displayLabel = Boolean(label);
|
|
2140
2213
|
if (displayLabel) {
|
|
2141
2214
|
const schemaType = getSchemaType(schema);
|
|
2142
|
-
const addedByAdditionalProperty = (
|
|
2215
|
+
const addedByAdditionalProperty = Boolean(schema[ADDITIONAL_PROPERTY_FLAG]);
|
|
2143
2216
|
if (schemaType === "array") {
|
|
2144
2217
|
displayLabel = addedByAdditionalProperty || isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) || isFilesArray(validator, schema, uiSchema, rootSchema, experimental_customMergeAllOf) || isCustomWidget(uiSchema);
|
|
2145
2218
|
}
|
|
@@ -2149,7 +2222,7 @@ function getDisplayLabel(validator, schema, uiSchema = {}, rootSchema, globalOpt
|
|
|
2149
2222
|
if (schemaType === "boolean" && uiSchema && !uiSchema[UI_WIDGET_KEY]) {
|
|
2150
2223
|
displayLabel = false;
|
|
2151
2224
|
}
|
|
2152
|
-
if (uiSchema
|
|
2225
|
+
if (uiSchema?.[UI_FIELD_KEY]) {
|
|
2153
2226
|
displayLabel = false;
|
|
2154
2227
|
}
|
|
2155
2228
|
}
|
|
@@ -2157,7 +2230,7 @@ function getDisplayLabel(validator, schema, uiSchema = {}, rootSchema, globalOpt
|
|
|
2157
2230
|
}
|
|
2158
2231
|
|
|
2159
2232
|
// src/schema/omitExtraData.ts
|
|
2160
|
-
var
|
|
2233
|
+
var import_get13 = __toESM(require("lodash/get"), 1);
|
|
2161
2234
|
var import_isEmpty5 = __toESM(require("lodash/isEmpty"), 1);
|
|
2162
2235
|
var import_isNil2 = __toESM(require("lodash/isNil"), 1);
|
|
2163
2236
|
var import_pick = __toESM(require("lodash/pick"), 1);
|
|
@@ -2186,7 +2259,7 @@ function getFieldNames(pathSchema, formData) {
|
|
|
2186
2259
|
}
|
|
2187
2260
|
} else if (key === NAME_KEY && data !== "") {
|
|
2188
2261
|
paths.forEach((path) => {
|
|
2189
|
-
const formValue = (0,
|
|
2262
|
+
const formValue = (0, import_get13.default)(formData, path);
|
|
2190
2263
|
const isLeaf = objKeys.length === 1;
|
|
2191
2264
|
if (formValueHasData(formValue, isLeaf) || Array.isArray(formValue) && formValue.every((val) => formValueHasData(val, isLeaf))) {
|
|
2192
2265
|
acc.push(path);
|
|
@@ -2224,7 +2297,7 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
|
|
|
2224
2297
|
const { properties, additionalProperties, patternProperties, propertyNames } = childSchema;
|
|
2225
2298
|
const requiredSet = new Set(childSchema.required ?? []);
|
|
2226
2299
|
function setProperty(key, schemaDef, value, required = false) {
|
|
2227
|
-
const v =
|
|
2300
|
+
const v = omit2(schemaDef, value, target[key]);
|
|
2228
2301
|
if (!required && isObject(v)) {
|
|
2229
2302
|
let sd = isSchemaObj(schemaDef) ? schemaDef : {};
|
|
2230
2303
|
if (sd.$ref !== void 0) {
|
|
@@ -2293,17 +2366,17 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
|
|
|
2293
2366
|
if (items !== void 0) {
|
|
2294
2367
|
if (Array.isArray(items)) {
|
|
2295
2368
|
for (let i = 0; i < items.length; i += 1) {
|
|
2296
|
-
target.push(
|
|
2369
|
+
target.push(omit2(items[i], source[i]));
|
|
2297
2370
|
}
|
|
2298
2371
|
} else {
|
|
2299
2372
|
for (let i = 0; i < source.length; i += 1) {
|
|
2300
|
-
target.push(
|
|
2373
|
+
target.push(omit2(items, source[i]));
|
|
2301
2374
|
}
|
|
2302
2375
|
}
|
|
2303
2376
|
}
|
|
2304
2377
|
if (additionalItems) {
|
|
2305
2378
|
for (let i = target.length; i < source.length; i += 1) {
|
|
2306
|
-
target.push(
|
|
2379
|
+
target.push(omit2(additionalItems, source[i]));
|
|
2307
2380
|
}
|
|
2308
2381
|
}
|
|
2309
2382
|
return target;
|
|
@@ -2315,7 +2388,7 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
|
|
|
2315
2388
|
}
|
|
2316
2389
|
const isThenBranch = isSchemaObj(condition) ? validator.isValid(condition, source, rootSchema) : condition;
|
|
2317
2390
|
const branch = isThenBranch ? then : otherwise;
|
|
2318
|
-
return branch === void 0 ? target :
|
|
2391
|
+
return branch === void 0 ? target : omit2(branch, source, target);
|
|
2319
2392
|
}
|
|
2320
2393
|
function handleOneOf(oneOf, childSchema, source, target) {
|
|
2321
2394
|
if (!Array.isArray(oneOf) || isSelect(validator, childSchema, rootSchema, experimental_customMergeAllOf)) {
|
|
@@ -2333,7 +2406,7 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
|
|
|
2333
2406
|
);
|
|
2334
2407
|
const winning = oneOf[bestIndex];
|
|
2335
2408
|
const resolved = isObject(winning) ? resolveAllReferences(winning, rootSchema, []) : scoringOptions[bestIndex];
|
|
2336
|
-
return
|
|
2409
|
+
return omit2(resolved, source, target);
|
|
2337
2410
|
}
|
|
2338
2411
|
function handleAnyOf(childSchema, source, target) {
|
|
2339
2412
|
const { anyOf } = childSchema;
|
|
@@ -2343,7 +2416,7 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
|
|
|
2343
2416
|
if (source === void 0 || Array.isArray(source) && source.length === 0 || isObject(source) && Object.keys(source).length === 0) {
|
|
2344
2417
|
let result = target;
|
|
2345
2418
|
for (const branch of anyOf) {
|
|
2346
|
-
result =
|
|
2419
|
+
result = omit2(branch, source, result);
|
|
2347
2420
|
}
|
|
2348
2421
|
return result;
|
|
2349
2422
|
}
|
|
@@ -2357,12 +2430,12 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
|
|
|
2357
2430
|
let result = target;
|
|
2358
2431
|
for (const [key, deps] of Object.entries(dependencies)) {
|
|
2359
2432
|
if (key in source && !Array.isArray(deps)) {
|
|
2360
|
-
result =
|
|
2433
|
+
result = omit2(deps, source, result);
|
|
2361
2434
|
}
|
|
2362
2435
|
}
|
|
2363
2436
|
return result;
|
|
2364
2437
|
}
|
|
2365
|
-
function
|
|
2438
|
+
function omit2(schemaDef, source, target) {
|
|
2366
2439
|
if (source === void 0 || schemaDef === false) {
|
|
2367
2440
|
return void 0;
|
|
2368
2441
|
}
|
|
@@ -2372,10 +2445,16 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
|
|
|
2372
2445
|
let localSchema = schemaDef;
|
|
2373
2446
|
const { $ref: ref, allOf } = localSchema;
|
|
2374
2447
|
if (ref !== void 0) {
|
|
2375
|
-
return
|
|
2448
|
+
return omit2(findSchemaDefinition(ref, rootSchema), source, target);
|
|
2376
2449
|
}
|
|
2377
2450
|
if (allOf) {
|
|
2378
2451
|
localSchema = doMergeAllOf(localSchema, experimental_customMergeAllOf);
|
|
2452
|
+
const remainingAllOf = localSchema.allOf;
|
|
2453
|
+
if (remainingAllOf) {
|
|
2454
|
+
for (let i = 0; i < remainingAllOf.length; i++) {
|
|
2455
|
+
target = omit2(remainingAllOf[i], source, target);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2379
2458
|
}
|
|
2380
2459
|
let filtered = handleAnyOf(localSchema, source, handleOneOf(localSchema.oneOf, localSchema, source, target));
|
|
2381
2460
|
const type = getSchemaType(localSchema);
|
|
@@ -2394,11 +2473,11 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
|
|
|
2394
2473
|
}
|
|
2395
2474
|
return handleDependencies(localSchema, source, handleConditions(localSchema, source, filtered));
|
|
2396
2475
|
}
|
|
2397
|
-
return
|
|
2476
|
+
return omit2(schema, formData);
|
|
2398
2477
|
}
|
|
2399
2478
|
|
|
2400
2479
|
// src/schema/sanitizeDataForNewSchema.ts
|
|
2401
|
-
var
|
|
2480
|
+
var import_get14 = __toESM(require("lodash/get"), 1);
|
|
2402
2481
|
var import_has5 = __toESM(require("lodash/has"), 1);
|
|
2403
2482
|
var NO_VALUE = /* @__PURE__ */ Symbol("no Value");
|
|
2404
2483
|
function enumValuesForSchema(schema) {
|
|
@@ -2422,7 +2501,7 @@ function replacementForInvalidEnumValue(schema, formValue) {
|
|
|
2422
2501
|
if (!enumValues || enumValues.some((value) => deepEquals_default(value, formValue))) {
|
|
2423
2502
|
return NO_VALUE;
|
|
2424
2503
|
}
|
|
2425
|
-
const defaultValue = (0,
|
|
2504
|
+
const defaultValue = (0, import_get14.default)(schema, DEFAULT_KEY, NO_VALUE);
|
|
2426
2505
|
if (defaultValue !== NO_VALUE && enumValues.some((value) => deepEquals_default(value, defaultValue))) {
|
|
2427
2506
|
return defaultValue;
|
|
2428
2507
|
}
|
|
@@ -2433,19 +2512,19 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2433
2512
|
if ((0, import_has5.default)(newSchema, PROPERTIES_KEY)) {
|
|
2434
2513
|
const removeOldSchemaData = {};
|
|
2435
2514
|
if ((0, import_has5.default)(oldSchema, PROPERTIES_KEY)) {
|
|
2436
|
-
const properties = (0,
|
|
2515
|
+
const properties = (0, import_get14.default)(oldSchema, PROPERTIES_KEY, {});
|
|
2437
2516
|
Object.keys(properties).forEach((key) => {
|
|
2438
2517
|
if ((0, import_has5.default)(data, key)) {
|
|
2439
2518
|
removeOldSchemaData[key] = void 0;
|
|
2440
2519
|
}
|
|
2441
2520
|
});
|
|
2442
2521
|
}
|
|
2443
|
-
const keys2 = Object.keys((0,
|
|
2522
|
+
const keys2 = Object.keys((0, import_get14.default)(newSchema, PROPERTIES_KEY, {}));
|
|
2444
2523
|
const nestedData = {};
|
|
2445
2524
|
keys2.forEach((key) => {
|
|
2446
|
-
const formValue = (0,
|
|
2447
|
-
let oldKeyedSchema = (0,
|
|
2448
|
-
let newKeyedSchema = (0,
|
|
2525
|
+
const formValue = (0, import_get14.default)(data, key);
|
|
2526
|
+
let oldKeyedSchema = (0, import_get14.default)(oldSchema, [PROPERTIES_KEY, key], {});
|
|
2527
|
+
let newKeyedSchema = (0, import_get14.default)(newSchema, [PROPERTIES_KEY, key], {});
|
|
2449
2528
|
if ((0, import_has5.default)(oldKeyedSchema, REF_KEY)) {
|
|
2450
2529
|
oldKeyedSchema = retrieveSchema(
|
|
2451
2530
|
validator,
|
|
@@ -2464,8 +2543,8 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2464
2543
|
experimental_customMergeAllOf
|
|
2465
2544
|
);
|
|
2466
2545
|
}
|
|
2467
|
-
const oldSchemaTypeForKey = (0,
|
|
2468
|
-
const newSchemaTypeForKey = (0,
|
|
2546
|
+
const oldSchemaTypeForKey = (0, import_get14.default)(oldKeyedSchema, "type");
|
|
2547
|
+
const newSchemaTypeForKey = (0, import_get14.default)(newKeyedSchema, "type");
|
|
2469
2548
|
if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
|
|
2470
2549
|
if ((0, import_has5.default)(removeOldSchemaData, key)) {
|
|
2471
2550
|
delete removeOldSchemaData[key];
|
|
@@ -2483,17 +2562,17 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2483
2562
|
nestedData[key] = itemData;
|
|
2484
2563
|
}
|
|
2485
2564
|
} else {
|
|
2486
|
-
const newOptionDefault = (0,
|
|
2487
|
-
const oldOptionDefault = (0,
|
|
2565
|
+
const newOptionDefault = (0, import_get14.default)(newKeyedSchema, DEFAULT_KEY, NO_VALUE);
|
|
2566
|
+
const oldOptionDefault = (0, import_get14.default)(oldKeyedSchema, DEFAULT_KEY, NO_VALUE);
|
|
2488
2567
|
if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
|
|
2489
2568
|
if (oldOptionDefault === formValue) {
|
|
2490
2569
|
removeOldSchemaData[key] = newOptionDefault;
|
|
2491
|
-
} else if ((0,
|
|
2570
|
+
} else if ((0, import_get14.default)(newKeyedSchema, "readOnly") === true) {
|
|
2492
2571
|
removeOldSchemaData[key] = void 0;
|
|
2493
2572
|
}
|
|
2494
2573
|
}
|
|
2495
|
-
const newOptionConst = (0,
|
|
2496
|
-
const oldOptionConst = (0,
|
|
2574
|
+
const newOptionConst = (0, import_get14.default)(newKeyedSchema, CONST_KEY, NO_VALUE);
|
|
2575
|
+
const oldOptionConst = (0, import_get14.default)(oldKeyedSchema, CONST_KEY, NO_VALUE);
|
|
2497
2576
|
if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
|
|
2498
2577
|
removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : void 0;
|
|
2499
2578
|
}
|
|
@@ -2511,9 +2590,9 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2511
2590
|
...removeOldSchemaData,
|
|
2512
2591
|
...nestedData
|
|
2513
2592
|
};
|
|
2514
|
-
} else if ((0,
|
|
2515
|
-
let oldSchemaItems = (0,
|
|
2516
|
-
let newSchemaItems = (0,
|
|
2593
|
+
} else if ((0, import_get14.default)(oldSchema, "type") === "array" && (0, import_get14.default)(newSchema, "type") === "array" && Array.isArray(data)) {
|
|
2594
|
+
let oldSchemaItems = (0, import_get14.default)(oldSchema, "items");
|
|
2595
|
+
let newSchemaItems = (0, import_get14.default)(newSchema, "items");
|
|
2517
2596
|
if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
|
|
2518
2597
|
if ((0, import_has5.default)(oldSchemaItems, REF_KEY)) {
|
|
2519
2598
|
oldSchemaItems = retrieveSchema(
|
|
@@ -2533,10 +2612,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2533
2612
|
experimental_customMergeAllOf
|
|
2534
2613
|
);
|
|
2535
2614
|
}
|
|
2536
|
-
const oldSchemaType = (0,
|
|
2537
|
-
const newSchemaType = (0,
|
|
2615
|
+
const oldSchemaType = (0, import_get14.default)(oldSchemaItems, "type");
|
|
2616
|
+
const newSchemaType = (0, import_get14.default)(newSchemaItems, "type");
|
|
2538
2617
|
if (!oldSchemaType || oldSchemaType === newSchemaType) {
|
|
2539
|
-
const maxItems = (0,
|
|
2618
|
+
const maxItems = (0, import_get14.default)(newSchema, "maxItems", -1);
|
|
2540
2619
|
if (newSchemaType === "object") {
|
|
2541
2620
|
newFormData = data.reduce((newValue, aValue) => {
|
|
2542
2621
|
const itemValue = sanitizeDataForNewSchema(
|
|
@@ -2566,7 +2645,7 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2566
2645
|
}
|
|
2567
2646
|
|
|
2568
2647
|
// src/schema/toPathSchema.ts
|
|
2569
|
-
var
|
|
2648
|
+
var import_get15 = __toESM(require("lodash/get"), 1);
|
|
2570
2649
|
var import_isObject12 = __toESM(require("lodash/isObject"), 1);
|
|
2571
2650
|
var import_set2 = __toESM(require("lodash/set"), 1);
|
|
2572
2651
|
function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
|
|
@@ -2617,7 +2696,7 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
|
|
|
2617
2696
|
if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
|
|
2618
2697
|
(0, import_set2.default)(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
|
|
2619
2698
|
const additionalSchema = (0, import_isObject12.default)(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {};
|
|
2620
|
-
const definedProperties = (0,
|
|
2699
|
+
const definedProperties = (0, import_get15.default)(schema, PROPERTIES_KEY, {});
|
|
2621
2700
|
for (const key of Object.keys(formData ?? {})) {
|
|
2622
2701
|
if (!(key in definedProperties)) {
|
|
2623
2702
|
pathSchema[key] = toPathSchemaInternal(
|
|
@@ -2625,7 +2704,7 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
|
|
|
2625
2704
|
additionalSchema,
|
|
2626
2705
|
`${name}.${key}`,
|
|
2627
2706
|
rootSchema,
|
|
2628
|
-
(0,
|
|
2707
|
+
(0, import_get15.default)(formData, [key]),
|
|
2629
2708
|
_recurseList,
|
|
2630
2709
|
experimental_customMergeAllOf
|
|
2631
2710
|
);
|
|
@@ -2675,7 +2754,7 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
|
|
|
2675
2754
|
}
|
|
2676
2755
|
} else if (PROPERTIES_KEY in schema) {
|
|
2677
2756
|
for (const property in schema.properties) {
|
|
2678
|
-
const field = (0,
|
|
2757
|
+
const field = (0, import_get15.default)(schema, [PROPERTIES_KEY, property], {});
|
|
2679
2758
|
pathSchema[property] = toPathSchemaInternal(
|
|
2680
2759
|
validator,
|
|
2681
2760
|
field,
|
|
@@ -2683,7 +2762,7 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
|
|
|
2683
2762
|
rootSchema,
|
|
2684
2763
|
// It's possible that formData is not an object -- this can happen if an
|
|
2685
2764
|
// array item has just been added, but not populated with data yet
|
|
2686
|
-
(0,
|
|
2765
|
+
(0, import_get15.default)(formData, [property]),
|
|
2687
2766
|
_recurseList,
|
|
2688
2767
|
experimental_customMergeAllOf
|
|
2689
2768
|
);
|
|
@@ -2705,8 +2784,8 @@ var SchemaUtils = class {
|
|
|
2705
2784
|
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
|
|
2706
2785
|
*/
|
|
2707
2786
|
constructor(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
|
|
2708
|
-
if (rootSchema
|
|
2709
|
-
this.rootSchema = makeAllReferencesAbsolute(rootSchema, (0,
|
|
2787
|
+
if (rootSchema?.[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
|
|
2788
|
+
this.rootSchema = makeAllReferencesAbsolute(rootSchema, (0, import_get16.default)(rootSchema, ID_KEY, "#"));
|
|
2710
2789
|
} else {
|
|
2711
2790
|
this.rootSchema = rootSchema;
|
|
2712
2791
|
}
|
|
@@ -3163,7 +3242,7 @@ function enumOptionValueEncoder(value, index, format = "indexed") {
|
|
|
3163
3242
|
|
|
3164
3243
|
// src/ErrorSchemaBuilder.ts
|
|
3165
3244
|
var import_cloneDeep = __toESM(require("lodash/cloneDeep"), 1);
|
|
3166
|
-
var
|
|
3245
|
+
var import_get17 = __toESM(require("lodash/get"), 1);
|
|
3167
3246
|
var import_set3 = __toESM(require("lodash/set"), 1);
|
|
3168
3247
|
var import_setWith = __toESM(require("lodash/setWith"), 1);
|
|
3169
3248
|
var ErrorSchemaBuilder = class {
|
|
@@ -3192,7 +3271,7 @@ var ErrorSchemaBuilder = class {
|
|
|
3192
3271
|
*/
|
|
3193
3272
|
getOrCreateErrorBlock(pathOfError) {
|
|
3194
3273
|
const hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === "string";
|
|
3195
|
-
let errorBlock = hasPath ? (0,
|
|
3274
|
+
let errorBlock = hasPath ? (0, import_get17.default)(this.errorSchema, pathOfError) : this.errorSchema;
|
|
3196
3275
|
if (!errorBlock && pathOfError) {
|
|
3197
3276
|
errorBlock = {};
|
|
3198
3277
|
(0, import_setWith.default)(this.errorSchema, pathOfError, errorBlock, Object);
|
|
@@ -3218,7 +3297,7 @@ var ErrorSchemaBuilder = class {
|
|
|
3218
3297
|
*/
|
|
3219
3298
|
addErrors(errorOrList, pathOfError) {
|
|
3220
3299
|
const errorBlock = this.getOrCreateErrorBlock(pathOfError);
|
|
3221
|
-
let errorsList = (0,
|
|
3300
|
+
let errorsList = (0, import_get17.default)(errorBlock, ERRORS_KEY);
|
|
3222
3301
|
if (!Array.isArray(errorsList)) {
|
|
3223
3302
|
errorsList = [];
|
|
3224
3303
|
errorBlock[ERRORS_KEY] = errorsList;
|
|
@@ -3260,7 +3339,7 @@ var ErrorSchemaBuilder = class {
|
|
|
3260
3339
|
|
|
3261
3340
|
// src/getChangedFields.ts
|
|
3262
3341
|
var import_difference = __toESM(require("lodash/difference"), 1);
|
|
3263
|
-
var
|
|
3342
|
+
var import_get18 = __toESM(require("lodash/get"), 1);
|
|
3264
3343
|
var import_isPlainObject2 = __toESM(require("lodash/isPlainObject"), 1);
|
|
3265
3344
|
var import_keys = __toESM(require("lodash/keys"), 1);
|
|
3266
3345
|
var import_pickBy = __toESM(require("lodash/pickBy"), 1);
|
|
@@ -3276,7 +3355,7 @@ function getChangedFields(a, b) {
|
|
|
3276
3355
|
if (!aIsPlainObject && bIsPlainObject) {
|
|
3277
3356
|
return (0, import_keys.default)(b);
|
|
3278
3357
|
}
|
|
3279
|
-
const unequalFields = (0, import_keys.default)((0, import_pickBy.default)(a, (value, key) => !deepEquals_default(value, (0,
|
|
3358
|
+
const unequalFields = (0, import_keys.default)((0, import_pickBy.default)(a, (value, key) => !deepEquals_default(value, (0, import_get18.default)(b, key))));
|
|
3280
3359
|
const diffFields = (0, import_difference.default)((0, import_keys.default)(b), (0, import_keys.default)(a));
|
|
3281
3360
|
return [...unequalFields, ...diffFields];
|
|
3282
3361
|
}
|
|
@@ -3377,7 +3456,7 @@ var DEFAULT_OPTIONS = {
|
|
|
3377
3456
|
};
|
|
3378
3457
|
function getSubmitButtonOptions(uiSchema = {}) {
|
|
3379
3458
|
const uiOptions = getUiOptions(uiSchema);
|
|
3380
|
-
if (uiOptions
|
|
3459
|
+
if (uiOptions?.[SUBMIT_BTN_OPTIONS_KEY]) {
|
|
3381
3460
|
const options = uiOptions[SUBMIT_BTN_OPTIONS_KEY];
|
|
3382
3461
|
return { ...DEFAULT_OPTIONS, ...options };
|
|
3383
3462
|
}
|
|
@@ -3402,10 +3481,10 @@ function getTemplate(name, registry, uiOptions = {}) {
|
|
|
3402
3481
|
}
|
|
3403
3482
|
|
|
3404
3483
|
// src/getTestIds.ts
|
|
3405
|
-
var
|
|
3484
|
+
var import_get19 = __toESM(require("lodash/get"), 1);
|
|
3406
3485
|
var import_uniqueId = __toESM(require("lodash/uniqueId"), 1);
|
|
3407
3486
|
function getTestIds() {
|
|
3408
|
-
if ((0,
|
|
3487
|
+
if ((0, import_get19.default)(globalThis, "process.env.NODE_ENV") !== "test") {
|
|
3409
3488
|
return {};
|
|
3410
3489
|
}
|
|
3411
3490
|
const ids = /* @__PURE__ */ new Map();
|
|
@@ -3424,7 +3503,7 @@ function getTestIds() {
|
|
|
3424
3503
|
|
|
3425
3504
|
// src/getWidget.tsx
|
|
3426
3505
|
var import_react = require("react");
|
|
3427
|
-
var
|
|
3506
|
+
var import_get20 = __toESM(require("lodash/get"), 1);
|
|
3428
3507
|
var import_set4 = __toESM(require("lodash/set"), 1);
|
|
3429
3508
|
var import_react_is = __toESM(require("react-is"), 1);
|
|
3430
3509
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -3481,9 +3560,9 @@ var widgetMap = {
|
|
|
3481
3560
|
}
|
|
3482
3561
|
};
|
|
3483
3562
|
function mergeWidgetOptions(AWidget) {
|
|
3484
|
-
let MergedWidget = (0,
|
|
3563
|
+
let MergedWidget = (0, import_get20.default)(AWidget, "MergedWidget");
|
|
3485
3564
|
if (!MergedWidget) {
|
|
3486
|
-
const defaultOptions = AWidget.defaultProps
|
|
3565
|
+
const defaultOptions = AWidget.defaultProps?.options || {};
|
|
3487
3566
|
MergedWidget = ({ options, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AWidget, { options: { ...defaultOptions, ...options }, ...props });
|
|
3488
3567
|
(0, import_set4.default)(AWidget, "MergedWidget", MergedWidget);
|
|
3489
3568
|
}
|
|
@@ -3535,7 +3614,7 @@ function hashObject(object) {
|
|
|
3535
3614
|
return hashString(sortedJSONStringify(object));
|
|
3536
3615
|
}
|
|
3537
3616
|
function hashForSchema(schema) {
|
|
3538
|
-
return
|
|
3617
|
+
return hashString(sortedJSONStringify(schema));
|
|
3539
3618
|
}
|
|
3540
3619
|
|
|
3541
3620
|
// src/hasWidget.ts
|
|
@@ -3596,7 +3675,6 @@ function isFormDataAvailable(formData) {
|
|
|
3596
3675
|
}
|
|
3597
3676
|
|
|
3598
3677
|
// src/isRootSchema.ts
|
|
3599
|
-
var import_omit2 = __toESM(require("lodash/omit"), 1);
|
|
3600
3678
|
function isRootSchema(registry, schemaToCompare) {
|
|
3601
3679
|
const { rootSchema, schemaUtils } = registry;
|
|
3602
3680
|
if (deepEquals_default(schemaToCompare, rootSchema)) {
|
|
@@ -3604,7 +3682,7 @@ function isRootSchema(registry, schemaToCompare) {
|
|
|
3604
3682
|
}
|
|
3605
3683
|
if (REF_KEY in rootSchema) {
|
|
3606
3684
|
const resolvedSchema = schemaUtils.retrieveSchema(rootSchema);
|
|
3607
|
-
return deepEquals_default(schemaToCompare,
|
|
3685
|
+
return deepEquals_default(schemaToCompare, resolvedSchema);
|
|
3608
3686
|
}
|
|
3609
3687
|
return false;
|
|
3610
3688
|
}
|
|
@@ -3619,15 +3697,24 @@ function localToUTC(dateString) {
|
|
|
3619
3697
|
return dateString ? new Date(dateString).toJSON() : void 0;
|
|
3620
3698
|
}
|
|
3621
3699
|
|
|
3700
|
+
// src/logUnsupportedDefaultForEnum.ts
|
|
3701
|
+
function logUnsupportedDefaultForEnum(id, schema, enumOptions, multiple = false) {
|
|
3702
|
+
if (!multiple && Array.isArray(enumOptions) && schema.default !== void 0 && enumOptionsIndexForValue(schema.default, enumOptions, multiple) === void 0) {
|
|
3703
|
+
console.error(
|
|
3704
|
+
`The schema default value "${schema.default}" is not one of the values in the enum options for "${id}"`
|
|
3705
|
+
);
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3708
|
+
|
|
3622
3709
|
// src/lookupFromFormContext.ts
|
|
3623
|
-
var
|
|
3710
|
+
var import_get21 = __toESM(require("lodash/get"), 1);
|
|
3624
3711
|
var import_has6 = __toESM(require("lodash/has"), 1);
|
|
3625
3712
|
function lookupFromFormContext(regOrFc, toLookup, fallback) {
|
|
3626
3713
|
const lookupPath = [LOOKUP_MAP_NAME];
|
|
3627
3714
|
if ((0, import_has6.default)(regOrFc, FORM_CONTEXT_NAME)) {
|
|
3628
3715
|
lookupPath.unshift(FORM_CONTEXT_NAME);
|
|
3629
3716
|
}
|
|
3630
|
-
return (0,
|
|
3717
|
+
return (0, import_get21.default)(regOrFc, [...lookupPath, toLookup], fallback);
|
|
3631
3718
|
}
|
|
3632
3719
|
|
|
3633
3720
|
// src/nameGenerators.ts
|
|
@@ -3816,13 +3903,13 @@ function schemaRequiresTrueValue(schema) {
|
|
|
3816
3903
|
if (schema.const) {
|
|
3817
3904
|
return true;
|
|
3818
3905
|
}
|
|
3819
|
-
if (schema.enum
|
|
3906
|
+
if (schema.enum?.length === 1 && schema.enum[0] === true) {
|
|
3820
3907
|
return true;
|
|
3821
3908
|
}
|
|
3822
|
-
if (schema.anyOf
|
|
3909
|
+
if (schema.anyOf?.length === 1) {
|
|
3823
3910
|
return schemaRequiresTrueValue(schema.anyOf[0]);
|
|
3824
3911
|
}
|
|
3825
|
-
if (schema.oneOf
|
|
3912
|
+
if (schema.oneOf?.length === 1) {
|
|
3826
3913
|
return schemaRequiresTrueValue(schema.oneOf[0]);
|
|
3827
3914
|
}
|
|
3828
3915
|
if (schema.allOf) {
|
|
@@ -3832,6 +3919,38 @@ function schemaRequiresTrueValue(schema) {
|
|
|
3832
3919
|
return false;
|
|
3833
3920
|
}
|
|
3834
3921
|
|
|
3922
|
+
// src/SelectedOptionDescription.tsx
|
|
3923
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
3924
|
+
function SelectedOptionDescription({ hideLabel, id, multiple, options, registry, uiSchema, value }) {
|
|
3925
|
+
if (multiple || hideLabel) {
|
|
3926
|
+
return null;
|
|
3927
|
+
}
|
|
3928
|
+
const { label = true } = getUiOptions(uiSchema, registry.globalUiOptions);
|
|
3929
|
+
if (!label) {
|
|
3930
|
+
return null;
|
|
3931
|
+
}
|
|
3932
|
+
const option = options.enumOptions?.find(({ value: enumValue }) => enumOptionsIsSelected(enumValue, value));
|
|
3933
|
+
const description = option?.schema?.description;
|
|
3934
|
+
if (!description) {
|
|
3935
|
+
return null;
|
|
3936
|
+
}
|
|
3937
|
+
const DescriptionFieldTemplate = getTemplate(
|
|
3938
|
+
"DescriptionFieldTemplate",
|
|
3939
|
+
registry,
|
|
3940
|
+
options
|
|
3941
|
+
);
|
|
3942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3943
|
+
DescriptionFieldTemplate,
|
|
3944
|
+
{
|
|
3945
|
+
id: descriptionId(id),
|
|
3946
|
+
description,
|
|
3947
|
+
schema: option.schema,
|
|
3948
|
+
uiSchema,
|
|
3949
|
+
registry
|
|
3950
|
+
}
|
|
3951
|
+
);
|
|
3952
|
+
}
|
|
3953
|
+
|
|
3835
3954
|
// src/shallowEquals.ts
|
|
3836
3955
|
function shallowEquals(a, b) {
|
|
3837
3956
|
if (Object.is(a, b)) {
|
|
@@ -3982,7 +4101,7 @@ function unwrapErrorHandler(errorHandler) {
|
|
|
3982
4101
|
|
|
3983
4102
|
// src/useAltDateWidgetProps.tsx
|
|
3984
4103
|
var import_react2 = require("react");
|
|
3985
|
-
var
|
|
4104
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3986
4105
|
function readyForChange(state) {
|
|
3987
4106
|
return Object.values(state).every((value) => value !== -1);
|
|
3988
4107
|
}
|
|
@@ -4005,7 +4124,7 @@ function DateElement(props) {
|
|
|
4005
4124
|
const id = `${rootId}_${type}`;
|
|
4006
4125
|
const { SelectWidget } = registry.widgets;
|
|
4007
4126
|
const onChange = (0, import_react2.useCallback)((newValue) => select(type, newValue), [select, type]);
|
|
4008
|
-
return /* @__PURE__ */ (0,
|
|
4127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4009
4128
|
SelectWidget,
|
|
4010
4129
|
{
|
|
4011
4130
|
schema: { type: "integer" },
|
|
@@ -4095,7 +4214,7 @@ var import_react4 = require("react");
|
|
|
4095
4214
|
function addNameToDataURL(dataURL, name) {
|
|
4096
4215
|
return dataURL.replace(";base64", `;name=${encodeURIComponent(name)};base64`);
|
|
4097
4216
|
}
|
|
4098
|
-
function processFile(file) {
|
|
4217
|
+
async function processFile(file) {
|
|
4099
4218
|
const { name, size, type } = file;
|
|
4100
4219
|
return new Promise((resolve, reject) => {
|
|
4101
4220
|
const reader = new window.FileReader();
|
|
@@ -4120,7 +4239,7 @@ function processFile(file) {
|
|
|
4120
4239
|
reader.readAsDataURL(file);
|
|
4121
4240
|
});
|
|
4122
4241
|
}
|
|
4123
|
-
function processFiles(files) {
|
|
4242
|
+
async function processFiles(files) {
|
|
4124
4243
|
return Promise.all(Array.from(files).map(processFile));
|
|
4125
4244
|
}
|
|
4126
4245
|
function extractFileInfo(dataURLs) {
|
|
@@ -4259,6 +4378,7 @@ var TranslatableString = /* @__PURE__ */ ((TranslatableString2) => {
|
|
|
4259
4378
|
TranslatableString2["AddButton"] = "Add";
|
|
4260
4379
|
TranslatableString2["AddItemButton"] = "Add Item";
|
|
4261
4380
|
TranslatableString2["CopyButton"] = "Copy";
|
|
4381
|
+
TranslatableString2["ExpandButton"] = "Expand Cycle";
|
|
4262
4382
|
TranslatableString2["MoveDownButton"] = "Move down";
|
|
4263
4383
|
TranslatableString2["MoveUpButton"] = "Move up";
|
|
4264
4384
|
TranslatableString2["RemoveButton"] = "Remove";
|
|
@@ -4279,6 +4399,7 @@ var TranslatableString = /* @__PURE__ */ ((TranslatableString2) => {
|
|
|
4279
4399
|
TranslatableString2["TitleOptionPrefix"] = "%1 option %2";
|
|
4280
4400
|
TranslatableString2["KeyLabel"] = "%1 Key";
|
|
4281
4401
|
TranslatableString2["DeprecatedLabel"] = "%1 (deprecated)";
|
|
4402
|
+
TranslatableString2["CycleDetected"] = 'Circular reference ($ref cycle) detected for field "%1". You may choose to expand to the next cycle break';
|
|
4282
4403
|
TranslatableString2["InvalidObjectField"] = 'Invalid "%1" object field configuration: _%2_.';
|
|
4283
4404
|
TranslatableString2["UnsupportedField"] = "Unsupported field schema.";
|
|
4284
4405
|
TranslatableString2["UnsupportedFieldWithId"] = "Unsupported field schema for field `%1`.";
|
|
@@ -4292,7 +4413,7 @@ var TranslatableString = /* @__PURE__ */ ((TranslatableString2) => {
|
|
|
4292
4413
|
var import_forEach = __toESM(require("lodash/forEach"), 1);
|
|
4293
4414
|
|
|
4294
4415
|
// src/parser/ParserValidator.ts
|
|
4295
|
-
var
|
|
4416
|
+
var import_get22 = __toESM(require("lodash/get"), 1);
|
|
4296
4417
|
var ParserValidator = class {
|
|
4297
4418
|
/** Construct the ParserValidator for the given `rootSchema`. This `rootSchema` will be stashed in the `schemaMap`
|
|
4298
4419
|
* first.
|
|
@@ -4318,7 +4439,7 @@ var ParserValidator = class {
|
|
|
4318
4439
|
* @param hash - The hash value at which to map the schema
|
|
4319
4440
|
*/
|
|
4320
4441
|
addSchema(schema, hash) {
|
|
4321
|
-
const key = (0,
|
|
4442
|
+
const key = (0, import_get22.default)(schema, ID_KEY, hash);
|
|
4322
4443
|
const identifiedSchema = { ...schema, [ID_KEY]: key };
|
|
4323
4444
|
const existing = this.schemaMap[key];
|
|
4324
4445
|
if (!existing) {
|