@rjsf/utils 6.5.3 → 6.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +618 -433
- package/dist/index.cjs.map +4 -4
- package/dist/utils.esm.js +614 -429
- package/dist/utils.esm.js.map +4 -4
- package/dist/utils.umd.js +623 -438
- package/lib/ErrorSchemaBuilder.js.map +1 -1
- package/lib/canExpand.js.map +1 -1
- package/lib/constIsAjvDataReference.js +1 -1
- package/lib/constIsAjvDataReference.js.map +1 -1
- package/lib/createSchemaUtils.js +3 -3
- package/lib/createSchemaUtils.js.map +1 -1
- package/lib/enumOptionSelectedValue.js.map +1 -1
- package/lib/enumOptionValueDecoder.js.map +1 -1
- package/lib/enumOptionsDeselectValue.js +1 -1
- package/lib/enumOptionsDeselectValue.js.map +1 -1
- package/lib/enumOptionsIndexForValue.js.map +1 -1
- package/lib/enumOptionsIsSelected.js.map +1 -1
- package/lib/enumOptionsSelectValue.js +1 -1
- package/lib/enumOptionsSelectValue.js.map +1 -1
- package/lib/enumOptionsValueForIndex.js +2 -2
- package/lib/enumOptionsValueForIndex.js.map +1 -1
- package/lib/findSchemaDefinition.js +4 -4
- package/lib/findSchemaDefinition.js.map +1 -1
- package/lib/getChangedFields.js +3 -3
- package/lib/getChangedFields.js.map +1 -1
- package/lib/getDiscriminatorFieldFromSchema.js.map +1 -1
- package/lib/getOptionMatchingSimpleDiscriminator.js.map +1 -1
- package/lib/getTestIds.d.ts +1 -1
- package/lib/getTestIds.js +4 -3
- package/lib/getTestIds.js.map +1 -1
- package/lib/getWidget.js +1 -1
- package/lib/getWidget.js.map +1 -1
- package/lib/idGenerators.js.map +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/isFormDataAvailable.js +1 -1
- package/lib/isFormDataAvailable.js.map +1 -1
- package/lib/isRootSchema.js +1 -1
- package/lib/isRootSchema.js.map +1 -1
- package/lib/mergeDefaultsWithFormData.js +1 -1
- package/lib/mergeDefaultsWithFormData.js.map +1 -1
- package/lib/parser/ParserValidator.js +1 -1
- package/lib/parser/ParserValidator.js.map +1 -1
- package/lib/parser/index.d.ts +1 -1
- package/lib/parser/index.js.map +1 -1
- package/lib/parser/schemaParser.js +2 -2
- package/lib/parser/schemaParser.js.map +1 -1
- package/lib/removeOptionalEmptyObjects.d.ts +2 -0
- package/lib/removeOptionalEmptyObjects.js +8 -29
- package/lib/removeOptionalEmptyObjects.js.map +1 -1
- package/lib/schema/findFieldInSchema.js +1 -1
- package/lib/schema/findFieldInSchema.js.map +1 -1
- package/lib/schema/findSelectedOptionInXxxOf.js +1 -1
- package/lib/schema/findSelectedOptionInXxxOf.js.map +1 -1
- package/lib/schema/getClosestMatchingOption.js +3 -3
- package/lib/schema/getClosestMatchingOption.js.map +1 -1
- package/lib/schema/getDefaultFormState.d.ts +4 -4
- package/lib/schema/getDefaultFormState.js +17 -22
- package/lib/schema/getDefaultFormState.js.map +1 -1
- package/lib/schema/getFromSchema.js +1 -1
- package/lib/schema/getFromSchema.js.map +1 -1
- package/lib/schema/index.d.ts +4 -4
- package/lib/schema/index.js +4 -4
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/isMultiSelect.js.map +1 -1
- package/lib/schema/omitExtraData.d.ts +18 -8
- package/lib/schema/omitExtraData.js +352 -16
- package/lib/schema/omitExtraData.js.map +1 -1
- package/lib/schema/retrieveSchema.d.ts +15 -0
- package/lib/schema/retrieveSchema.js +36 -13
- package/lib/schema/retrieveSchema.js.map +1 -1
- package/lib/schema/sanitizeDataForNewSchema.js.map +1 -1
- package/lib/schema/shallowAllOfMerge.d.ts +11 -0
- package/lib/schema/shallowAllOfMerge.js +18 -0
- package/lib/schema/shallowAllOfMerge.js.map +1 -0
- package/lib/schema/toPathSchema.d.ts +1 -0
- package/lib/schema/toPathSchema.js +2 -1
- package/lib/schema/toPathSchema.js.map +1 -1
- package/lib/shouldRenderOptionalField.js +1 -1
- package/lib/shouldRenderOptionalField.js.map +1 -1
- package/lib/toErrorSchema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types.d.ts +4 -1
- package/lib/useFileWidgetProps.d.ts +1 -1
- package/lib/useFileWidgetProps.js +9 -10
- package/lib/useFileWidgetProps.js.map +1 -1
- package/lib/withIdRefPrefix.js +1 -1
- package/lib/withIdRefPrefix.js.map +1 -1
- package/package.json +10 -10
- package/src/ErrorSchemaBuilder.ts +1 -1
- package/src/canExpand.ts +1 -1
- package/src/constIsAjvDataReference.ts +3 -2
- package/src/createSchemaUtils.ts +18 -17
- package/src/enumOptionSelectedValue.ts +1 -1
- package/src/enumOptionValueDecoder.ts +1 -1
- package/src/enumOptionsDeselectValue.ts +2 -2
- package/src/enumOptionsIndexForValue.ts +1 -1
- package/src/enumOptionsIsSelected.ts +1 -1
- package/src/enumOptionsSelectValue.ts +3 -2
- package/src/enumOptionsValueForIndex.ts +2 -2
- package/src/findSchemaDefinition.ts +4 -4
- package/src/getChangedFields.ts +4 -3
- package/src/getDiscriminatorFieldFromSchema.ts +1 -1
- package/src/getOptionMatchingSimpleDiscriminator.ts +1 -0
- package/src/getTestIds.ts +4 -3
- package/src/getWidget.tsx +2 -2
- package/src/idGenerators.ts +1 -1
- package/src/index.ts +6 -6
- package/src/isFormDataAvailable.ts +1 -1
- package/src/isRootSchema.ts +1 -1
- package/src/mergeDefaultsWithFormData.ts +2 -2
- package/src/parser/ParserValidator.ts +1 -1
- package/src/parser/index.ts +1 -1
- package/src/parser/schemaParser.ts +3 -3
- package/src/removeOptionalEmptyObjects.ts +8 -30
- package/src/schema/findFieldInSchema.ts +2 -2
- package/src/schema/findSelectedOptionInXxxOf.ts +1 -1
- package/src/schema/getClosestMatchingOption.ts +4 -4
- package/src/schema/getDefaultFormState.ts +18 -24
- package/src/schema/getFromSchema.ts +2 -2
- package/src/schema/index.ts +5 -3
- package/src/schema/isMultiSelect.ts +0 -1
- package/src/schema/omitExtraData.ts +398 -19
- package/src/schema/retrieveSchema.ts +41 -15
- package/src/schema/sanitizeDataForNewSchema.ts +1 -1
- package/src/schema/shallowAllOfMerge.ts +19 -0
- package/src/schema/toPathSchema.ts +2 -1
- package/src/shouldRenderOptionalField.ts +2 -2
- package/src/toErrorSchema.ts +1 -1
- package/src/tsconfig.json +0 -1
- package/src/types.ts +4 -1
- package/src/useFileWidgetProps.ts +9 -10
- package/src/withIdRefPrefix.ts +2 -1
package/dist/utils.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash/isPlainObject'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'lodash/isPlainObject', 'fast-equals', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/utils"] = {}, global.isPlainObject2, global.
|
|
5
|
-
})(this, (function (exports, isPlainObject2,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash/isPlainObject'), require('lodash/get'), require('fast-equals'), require('fast-uri'), require('jsonpointer'), require('lodash/isEmpty'), require('lodash/isObject'), require('lodash/omit'), require('lodash/has'), require('lodash/isString'), require('lodash/flattenDeep'), require('lodash/merge'), require('lodash/set'), require('lodash/times'), require('lodash/transform'), require('lodash/uniq'), require('lodash/union'), require('lodash/isNumber'), require('@x0k/json-schema-merge'), require('@x0k/json-schema-merge/lib/array'), require('lodash/reduce'), require('lodash/isNil'), require('lodash/pick'), require('lodash/cloneDeep'), require('lodash/setWith'), require('lodash/difference'), require('lodash/keys'), require('lodash/pickBy'), require('lodash/uniqueId'), require('react'), require('react-is'), require('react/jsx-runtime'), require('lodash/toPath'), require('lodash/forEach')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'lodash/isPlainObject', 'lodash/get', 'fast-equals', 'fast-uri', 'jsonpointer', 'lodash/isEmpty', 'lodash/isObject', 'lodash/omit', 'lodash/has', 'lodash/isString', 'lodash/flattenDeep', 'lodash/merge', 'lodash/set', 'lodash/times', 'lodash/transform', 'lodash/uniq', 'lodash/union', 'lodash/isNumber', '@x0k/json-schema-merge', '@x0k/json-schema-merge/lib/array', 'lodash/reduce', 'lodash/isNil', 'lodash/pick', 'lodash/cloneDeep', 'lodash/setWith', 'lodash/difference', 'lodash/keys', 'lodash/pickBy', 'lodash/uniqueId', 'react', 'react-is', 'react/jsx-runtime', 'lodash/toPath', 'lodash/forEach'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/utils"] = {}, global.isPlainObject2, global.get15, global.fastEquals, global.UriResolver, global.jsonpointer, global.isEmpty4, global.isObject2, global.omit, global.has5, global.isString, global.flattenDeep, global.merge, global.set, global.times, global.transform, global.uniq, global.union, global.isNumber, global.jsonSchemaMerge, global.array, global.reduce, global.isNil, global.pick, global.cloneDeep, global.setWith, global.difference, global.keys, global.pickBy, global.uniqueId, global.react, global.ReactIs, global.jsxRuntime, global.toPath, global.forEach));
|
|
5
|
+
})(this, (function (exports, isPlainObject2, get15, fastEquals, UriResolver, jsonpointer, isEmpty4, isObject2, omit, has5, isString, flattenDeep, merge, set, times, transform, uniq, union, isNumber, jsonSchemaMerge, array, reduce, isNil, pick, cloneDeep, setWith, difference, keys, pickBy, uniqueId, react, ReactIs, jsxRuntime, toPath, forEach) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// src/isObject.ts
|
|
8
8
|
function isObject(thing) {
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
return void 0;
|
|
180
180
|
}
|
|
181
181
|
function makeAllReferencesAbsolute(schema, baseURI) {
|
|
182
|
-
const currentURI =
|
|
182
|
+
const currentURI = get15(schema, ID_KEY, baseURI);
|
|
183
183
|
if (REF_KEY in schema) {
|
|
184
184
|
schema = { ...schema, [REF_KEY]: UriResolver.resolve(currentURI, schema[REF_KEY]) };
|
|
185
185
|
}
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
const remaining = omit(object, [key]);
|
|
201
201
|
return [remaining, value];
|
|
202
202
|
}
|
|
203
|
-
function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [], baseURI =
|
|
203
|
+
function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [], baseURI = get15(rootSchema, [ID_KEY])) {
|
|
204
204
|
const ref = $ref || "";
|
|
205
205
|
let current = void 0;
|
|
206
206
|
if (ref.startsWith("#")) {
|
|
@@ -250,13 +250,13 @@
|
|
|
250
250
|
}
|
|
251
251
|
return current;
|
|
252
252
|
}
|
|
253
|
-
function findSchemaDefinition($ref, rootSchema = {}, baseURI =
|
|
253
|
+
function findSchemaDefinition($ref, rootSchema = {}, baseURI = get15(rootSchema, [ID_KEY])) {
|
|
254
254
|
const recurseList = [];
|
|
255
255
|
return findSchemaDefinitionRecursive($ref, rootSchema, recurseList, baseURI);
|
|
256
256
|
}
|
|
257
257
|
function getDiscriminatorFieldFromSchema(schema) {
|
|
258
258
|
let discriminator;
|
|
259
|
-
const maybeString =
|
|
259
|
+
const maybeString = get15(schema, DISCRIMINATOR_PATH);
|
|
260
260
|
if (isString(maybeString)) {
|
|
261
261
|
discriminator = maybeString;
|
|
262
262
|
} else if (maybeString !== void 0) {
|
|
@@ -327,13 +327,13 @@
|
|
|
327
327
|
}
|
|
328
328
|
function getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField) {
|
|
329
329
|
if (formData && discriminatorField) {
|
|
330
|
-
const value =
|
|
330
|
+
const value = get15(formData, discriminatorField);
|
|
331
331
|
if (value === void 0) {
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
334
|
for (let i = 0; i < options.length; i++) {
|
|
335
335
|
const option = options[i];
|
|
336
|
-
const discriminator =
|
|
336
|
+
const discriminator = get15(option, [PROPERTIES_KEY, discriminatorField], {});
|
|
337
337
|
if (discriminator.type === "object" || discriminator.type === "array") {
|
|
338
338
|
continue;
|
|
339
339
|
}
|
|
@@ -360,8 +360,8 @@
|
|
|
360
360
|
for (let i = 0; i < options.length; i++) {
|
|
361
361
|
const option = options[i];
|
|
362
362
|
if (discriminatorField && has5(option, [PROPERTIES_KEY, discriminatorField])) {
|
|
363
|
-
const value =
|
|
364
|
-
const discriminator =
|
|
363
|
+
const value = get15(formData, discriminatorField);
|
|
364
|
+
const discriminator = get15(option, [PROPERTIES_KEY, discriminatorField], {});
|
|
365
365
|
if (validator.isValid(discriminator, value, rootSchema)) {
|
|
366
366
|
return i;
|
|
367
367
|
}
|
|
@@ -394,6 +394,12 @@
|
|
|
394
394
|
}
|
|
395
395
|
return 0;
|
|
396
396
|
}
|
|
397
|
+
var { compareSchemaDefinitions, compareSchemaValues } = jsonSchemaMerge.createComparator();
|
|
398
|
+
var { mergeArrayOfSchemaDefinitions } = jsonSchemaMerge.createMerger({
|
|
399
|
+
intersectJson: array.createIntersector(compareSchemaValues),
|
|
400
|
+
deduplicateJsonSchemaDef: array.createDeduplicator(compareSchemaDefinitions)
|
|
401
|
+
});
|
|
402
|
+
var shallowAllOfMerge_default = jsonSchemaMerge.createShallowAllOfMerge(mergeArrayOfSchemaDefinitions);
|
|
397
403
|
|
|
398
404
|
// src/schema/retrieveSchema.ts
|
|
399
405
|
function retrieveSchema(validator, schema, rootSchema = {}, rawFormData, experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs = false) {
|
|
@@ -641,7 +647,7 @@
|
|
|
641
647
|
validator,
|
|
642
648
|
{ [ALL_OF_KEY]: Object.values(matchingProperties) },
|
|
643
649
|
rootSchema,
|
|
644
|
-
|
|
650
|
+
get15(formData, [key]),
|
|
645
651
|
experimental_customMergeAllOf
|
|
646
652
|
);
|
|
647
653
|
set(schema.properties, [key, ADDITIONAL_PROPERTY_FLAG], true);
|
|
@@ -654,7 +660,7 @@
|
|
|
654
660
|
if (REF_KEY in schema.additionalProperties) {
|
|
655
661
|
additionalProperties = retrieveSchema(
|
|
656
662
|
validator,
|
|
657
|
-
{ [REF_KEY]:
|
|
663
|
+
{ [REF_KEY]: get15(schema.additionalProperties, [REF_KEY]) },
|
|
658
664
|
rootSchema,
|
|
659
665
|
formData,
|
|
660
666
|
experimental_customMergeAllOf
|
|
@@ -667,10 +673,10 @@
|
|
|
667
673
|
...schema.additionalProperties
|
|
668
674
|
};
|
|
669
675
|
} else {
|
|
670
|
-
additionalProperties = { type: guessType(
|
|
676
|
+
additionalProperties = { type: guessType(get15(formData, [key])) };
|
|
671
677
|
}
|
|
672
678
|
} else {
|
|
673
|
-
additionalProperties = { type: guessType(
|
|
679
|
+
additionalProperties = { type: guessType(get15(formData, [key])) };
|
|
674
680
|
}
|
|
675
681
|
schema.properties[key] = additionalProperties;
|
|
676
682
|
set(schema.properties, [key, ADDITIONAL_PROPERTY_FLAG], true);
|
|
@@ -681,14 +687,8 @@
|
|
|
681
687
|
});
|
|
682
688
|
return schema;
|
|
683
689
|
}
|
|
684
|
-
var { compareSchemaDefinitions, compareSchemaValues } = jsonSchemaMerge.createComparator();
|
|
685
|
-
var { mergeArrayOfSchemaDefinitions } = jsonSchemaMerge.createMerger({
|
|
686
|
-
intersectJson: array.createIntersector(compareSchemaValues),
|
|
687
|
-
deduplicateJsonSchemaDef: array.createDeduplicator(compareSchemaDefinitions)
|
|
688
|
-
});
|
|
689
|
-
var shallowAllOfMerge = jsonSchemaMerge.createShallowAllOfMerge(mergeArrayOfSchemaDefinitions);
|
|
690
690
|
function mergeAllOf(schema) {
|
|
691
|
-
return
|
|
691
|
+
return shallowAllOfMerge_default(schema);
|
|
692
692
|
}
|
|
693
693
|
function retrieveSchemaInternal(validator, schema, rootSchema, rawFormData, expandAllBranches = false, recurseList = [], experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs) {
|
|
694
694
|
if (!isObject(schema)) {
|
|
@@ -754,7 +754,7 @@
|
|
|
754
754
|
validator,
|
|
755
755
|
{ allOf: [schema2.properties[key], ...Object.values(matchingProperties)] },
|
|
756
756
|
rootSchema,
|
|
757
|
-
|
|
757
|
+
get15(rawFormData, [key]),
|
|
758
758
|
experimental_customMergeAllOf
|
|
759
759
|
);
|
|
760
760
|
}
|
|
@@ -795,12 +795,23 @@
|
|
|
795
795
|
});
|
|
796
796
|
const option = getFirstMatchingOption(validator, formData, anyOrOneOf, rootSchema, discriminator);
|
|
797
797
|
if (expandAllBranches) {
|
|
798
|
+
const relaxed = relaxOptionsForScoring(anyOrOneOf, false, rootSchema);
|
|
799
|
+
getFirstMatchingOption(validator, formData, relaxed, rootSchema, discriminator);
|
|
798
800
|
return anyOrOneOf.map((item) => mergeSchemas(remaining, item));
|
|
799
801
|
}
|
|
800
802
|
schema = mergeSchemas(remaining, anyOrOneOf[option]);
|
|
801
803
|
}
|
|
802
804
|
return [schema];
|
|
803
805
|
}
|
|
806
|
+
function relaxOptionsForScoring(options, resolveRefs = false, rootSchema) {
|
|
807
|
+
return options.map((d) => {
|
|
808
|
+
if (!isObject(d)) {
|
|
809
|
+
return d ? {} : { not: {} };
|
|
810
|
+
}
|
|
811
|
+
const schema = resolveRefs && rootSchema ? resolveAllReferences(d, rootSchema, []) : d;
|
|
812
|
+
return schema.additionalProperties === false ? { ...schema, additionalProperties: true } : schema;
|
|
813
|
+
});
|
|
814
|
+
}
|
|
804
815
|
function resolveDependencies(validator, schema, rootSchema, expandAllBranches, recurseList, formData, experimental_customMergeAllOf) {
|
|
805
816
|
const { dependencies, ...remainingSchema } = schema;
|
|
806
817
|
const resolvedSchemas = resolveAnyOrOneOfSchemas(
|
|
@@ -826,7 +837,7 @@
|
|
|
826
837
|
function processDependencies(validator, dependencies, resolvedSchema, rootSchema, expandAllBranches, recurseList, formData, experimental_customMergeAllOf) {
|
|
827
838
|
let schemas = [resolvedSchema];
|
|
828
839
|
for (const dependencyKey in dependencies) {
|
|
829
|
-
if (!expandAllBranches &&
|
|
840
|
+
if (!expandAllBranches && get15(formData, [dependencyKey]) === void 0) {
|
|
830
841
|
continue;
|
|
831
842
|
}
|
|
832
843
|
if (resolvedSchema.properties && !(dependencyKey in resolvedSchema.properties)) {
|
|
@@ -957,11 +968,11 @@
|
|
|
957
968
|
const xxxOfs = schema[xxx].map(
|
|
958
969
|
(xxxOf) => retrieveSchema(validator, xxxOf, rootSchema, formData, experimental_customMergeAllOf)
|
|
959
970
|
);
|
|
960
|
-
const data =
|
|
971
|
+
const data = get15(formData, selectorField);
|
|
961
972
|
if (data !== void 0) {
|
|
962
973
|
return xxxOfs.find((xxx2) => {
|
|
963
974
|
return deepEquals_default(
|
|
964
|
-
|
|
975
|
+
get15(xxx2, [PROPERTIES_KEY, selectorField, DEFAULT_KEY], get15(xxx2, [PROPERTIES_KEY, selectorField, CONST_KEY])),
|
|
965
976
|
data
|
|
966
977
|
);
|
|
967
978
|
});
|
|
@@ -980,7 +991,7 @@
|
|
|
980
991
|
const pathList = Array.isArray(path) ? [...path] : path.split(".");
|
|
981
992
|
const [part, ...nestedPath] = pathList;
|
|
982
993
|
if (part !== void 0 && part !== "" && has5(fieldSchema, part)) {
|
|
983
|
-
fieldSchema =
|
|
994
|
+
fieldSchema = get15(fieldSchema, part);
|
|
984
995
|
return getFromSchemaInternal(
|
|
985
996
|
validator,
|
|
986
997
|
rootSchema,
|
|
@@ -1023,7 +1034,7 @@
|
|
|
1023
1034
|
parentField,
|
|
1024
1035
|
fieldNameKey,
|
|
1025
1036
|
ONE_OF_KEY,
|
|
1026
|
-
|
|
1037
|
+
get15(formData, subPath),
|
|
1027
1038
|
experimental_customMergeAllOf
|
|
1028
1039
|
);
|
|
1029
1040
|
} else if (has5(parentField, ANY_OF_KEY)) {
|
|
@@ -1033,7 +1044,7 @@
|
|
|
1033
1044
|
parentField,
|
|
1034
1045
|
fieldNameKey,
|
|
1035
1046
|
ANY_OF_KEY,
|
|
1036
|
-
|
|
1047
|
+
get15(formData, subPath),
|
|
1037
1048
|
experimental_customMergeAllOf
|
|
1038
1049
|
);
|
|
1039
1050
|
}
|
|
@@ -1101,7 +1112,7 @@
|
|
|
1101
1112
|
totalScore += reduce(
|
|
1102
1113
|
schema.properties,
|
|
1103
1114
|
(score, value, key) => {
|
|
1104
|
-
const formValue =
|
|
1115
|
+
const formValue = get15(formData, key);
|
|
1105
1116
|
if (typeof value === "boolean") {
|
|
1106
1117
|
return score;
|
|
1107
1118
|
}
|
|
@@ -1128,7 +1139,7 @@
|
|
|
1128
1139
|
validator,
|
|
1129
1140
|
rootSchema,
|
|
1130
1141
|
formValue,
|
|
1131
|
-
|
|
1142
|
+
get15(value, key2),
|
|
1132
1143
|
-1,
|
|
1133
1144
|
discriminator,
|
|
1134
1145
|
experimental_customMergeAllOf
|
|
@@ -1200,6 +1211,16 @@
|
|
|
1200
1211
|
}
|
|
1201
1212
|
return bestIndex;
|
|
1202
1213
|
}
|
|
1214
|
+
function constIsAjvDataReference(schema) {
|
|
1215
|
+
const schemaConst = schema[CONST_KEY];
|
|
1216
|
+
const schemaType = getSchemaType(schema);
|
|
1217
|
+
return isObject(schemaConst) && isString(schemaConst?.$data) && schemaType !== "object" && schemaType !== "array";
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
// src/isConstant.ts
|
|
1221
|
+
function isConstant(schema) {
|
|
1222
|
+
return Array.isArray(schema.enum) && schema.enum.length === 1 || CONST_KEY in schema;
|
|
1223
|
+
}
|
|
1203
1224
|
|
|
1204
1225
|
// src/isFixedItems.ts
|
|
1205
1226
|
function isFixedItems(schema) {
|
|
@@ -1230,22 +1251,22 @@
|
|
|
1230
1251
|
if (isObject(formData)) {
|
|
1231
1252
|
const acc = Object.assign({}, defaults);
|
|
1232
1253
|
return Object.keys(formData).reduce((acc2, key) => {
|
|
1233
|
-
const keyValue =
|
|
1254
|
+
const keyValue = get15(formData, key);
|
|
1234
1255
|
const keyExistsInDefaults = isObject(defaults) && key in defaults;
|
|
1235
1256
|
const keyExistsInFormData = key in formData;
|
|
1236
|
-
const keyDefault =
|
|
1257
|
+
const keyDefault = get15(defaults, key) ?? {};
|
|
1237
1258
|
const defaultValueIsNestedObject = keyExistsInDefaults && isObject(keyDefault) && Object.values(keyDefault).some((v) => isObject(v));
|
|
1238
|
-
const keyDefaultIsObject = keyExistsInDefaults && isObject(
|
|
1259
|
+
const keyDefaultIsObject = keyExistsInDefaults && isObject(get15(defaults, key));
|
|
1239
1260
|
const keyHasFormDataObject = keyExistsInFormData && isObject(keyValue);
|
|
1240
1261
|
if (keyDefaultIsObject && keyHasFormDataObject && !defaultValueIsNestedObject) {
|
|
1241
1262
|
acc2[key] = {
|
|
1242
|
-
...
|
|
1263
|
+
...get15(defaults, key),
|
|
1243
1264
|
...keyValue
|
|
1244
1265
|
};
|
|
1245
1266
|
return acc2;
|
|
1246
1267
|
}
|
|
1247
1268
|
acc2[key] = mergeDefaultsWithFormData(
|
|
1248
|
-
|
|
1269
|
+
get15(defaults, key),
|
|
1249
1270
|
keyValue,
|
|
1250
1271
|
mergeExtraArrayDefaults,
|
|
1251
1272
|
defaultSupercedesUndefined,
|
|
@@ -1289,37 +1310,6 @@
|
|
|
1289
1310
|
);
|
|
1290
1311
|
}
|
|
1291
1312
|
|
|
1292
|
-
// src/isConstant.ts
|
|
1293
|
-
function isConstant(schema) {
|
|
1294
|
-
return Array.isArray(schema.enum) && schema.enum.length === 1 || CONST_KEY in schema;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
// src/schema/isSelect.ts
|
|
1298
|
-
function isSelect(validator, theSchema, rootSchema = {}, experimental_customMergeAllOf) {
|
|
1299
|
-
const schema = retrieveSchema(validator, theSchema, rootSchema, void 0, experimental_customMergeAllOf);
|
|
1300
|
-
const altSchemas = schema.oneOf || schema.anyOf;
|
|
1301
|
-
if (Array.isArray(schema.enum)) {
|
|
1302
|
-
return true;
|
|
1303
|
-
}
|
|
1304
|
-
if (Array.isArray(altSchemas)) {
|
|
1305
|
-
return altSchemas.every((altSchemas2) => typeof altSchemas2 !== "boolean" && isConstant(altSchemas2));
|
|
1306
|
-
}
|
|
1307
|
-
return false;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
// src/schema/isMultiSelect.ts
|
|
1311
|
-
function isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) {
|
|
1312
|
-
if (!schema.uniqueItems || !schema.items || typeof schema.items === "boolean") {
|
|
1313
|
-
return false;
|
|
1314
|
-
}
|
|
1315
|
-
return isSelect(validator, schema.items, rootSchema, experimental_customMergeAllOf);
|
|
1316
|
-
}
|
|
1317
|
-
function constIsAjvDataReference(schema) {
|
|
1318
|
-
const schemaConst = schema[CONST_KEY];
|
|
1319
|
-
const schemaType = getSchemaType(schema);
|
|
1320
|
-
return isObject(schemaConst) && isString(schemaConst?.$data) && schemaType !== "object" && schemaType !== "array";
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
1313
|
// src/toConstant.ts
|
|
1324
1314
|
function toConstant(schema) {
|
|
1325
1315
|
if (ENUM_KEY in schema && Array.isArray(schema.enum) && schema.enum.length === 1) {
|
|
@@ -1382,8 +1372,8 @@
|
|
|
1382
1372
|
let value;
|
|
1383
1373
|
let label = title;
|
|
1384
1374
|
if (selectorField) {
|
|
1385
|
-
const innerSchema =
|
|
1386
|
-
value =
|
|
1375
|
+
const innerSchema = get15(aSchema, [PROPERTIES_KEY, selectorField], {});
|
|
1376
|
+
value = get15(innerSchema, DEFAULT_KEY, get15(innerSchema, CONST_KEY));
|
|
1387
1377
|
label = label || innerSchema?.title || aSchema.title || String(value);
|
|
1388
1378
|
} else {
|
|
1389
1379
|
value = toConstant(aSchema);
|
|
@@ -1397,6 +1387,27 @@
|
|
|
1397
1387
|
});
|
|
1398
1388
|
}
|
|
1399
1389
|
|
|
1390
|
+
// src/schema/isSelect.ts
|
|
1391
|
+
function isSelect(validator, theSchema, rootSchema = {}, experimental_customMergeAllOf) {
|
|
1392
|
+
const schema = retrieveSchema(validator, theSchema, rootSchema, void 0, experimental_customMergeAllOf);
|
|
1393
|
+
const altSchemas = schema.oneOf || schema.anyOf;
|
|
1394
|
+
if (Array.isArray(schema.enum)) {
|
|
1395
|
+
return true;
|
|
1396
|
+
}
|
|
1397
|
+
if (Array.isArray(altSchemas)) {
|
|
1398
|
+
return altSchemas.every((altSchemas2) => typeof altSchemas2 !== "boolean" && isConstant(altSchemas2));
|
|
1399
|
+
}
|
|
1400
|
+
return false;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
// src/schema/isMultiSelect.ts
|
|
1404
|
+
function isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) {
|
|
1405
|
+
if (!schema.uniqueItems || !schema.items || typeof schema.items === "boolean") {
|
|
1406
|
+
return false;
|
|
1407
|
+
}
|
|
1408
|
+
return isSelect(validator, schema.items, rootSchema, experimental_customMergeAllOf);
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1400
1411
|
// src/schema/getDefaultFormState.ts
|
|
1401
1412
|
var PRIMITIVE_TYPES = ["string", "number", "integer", "boolean", "null"];
|
|
1402
1413
|
function getInnerSchemaForArrayItem(schema, additionalItems = 0 /* Ignore */, idx = -1) {
|
|
@@ -1630,7 +1641,7 @@
|
|
|
1630
1641
|
const parentConst = retrievedSchema[CONST_KEY];
|
|
1631
1642
|
const objectDefaults = Object.keys(retrievedSchema.properties || {}).reduce(
|
|
1632
1643
|
(acc, key) => {
|
|
1633
|
-
const propertySchema =
|
|
1644
|
+
const propertySchema = get15(retrievedSchema, [PROPERTIES_KEY, key], {});
|
|
1634
1645
|
const hasParentConst = isObject(parentConst) && parentConst[key] !== void 0;
|
|
1635
1646
|
const hasConst = (isObject(propertySchema) && CONST_KEY in propertySchema || hasParentConst) && experimental_defaultFormStateBehavior?.constAsDefaults !== "never" && !constIsAjvDataReference(propertySchema);
|
|
1636
1647
|
const computedDefault = computeDefaults(validator, propertySchema, {
|
|
@@ -1639,8 +1650,8 @@
|
|
|
1639
1650
|
experimental_defaultFormStateBehavior,
|
|
1640
1651
|
experimental_customMergeAllOf,
|
|
1641
1652
|
includeUndefinedValues: includeUndefinedValues === true,
|
|
1642
|
-
parentDefaults:
|
|
1643
|
-
rawFormData:
|
|
1653
|
+
parentDefaults: get15(defaults, [key]),
|
|
1654
|
+
rawFormData: get15(formData, [key]),
|
|
1644
1655
|
required: retrievedSchema.required?.includes(key),
|
|
1645
1656
|
shouldMergeDefaultsIntoFormData,
|
|
1646
1657
|
initialDefaultsGenerated
|
|
@@ -1678,8 +1689,8 @@
|
|
|
1678
1689
|
experimental_defaultFormStateBehavior,
|
|
1679
1690
|
experimental_customMergeAllOf,
|
|
1680
1691
|
includeUndefinedValues: includeUndefinedValues === true,
|
|
1681
|
-
parentDefaults:
|
|
1682
|
-
rawFormData:
|
|
1692
|
+
parentDefaults: get15(defaults, [key]),
|
|
1693
|
+
rawFormData: get15(formData, [key]),
|
|
1683
1694
|
required: retrievedSchema.required?.includes(key),
|
|
1684
1695
|
shouldMergeDefaultsIntoFormData,
|
|
1685
1696
|
initialDefaultsGenerated
|
|
@@ -1746,7 +1757,7 @@
|
|
|
1746
1757
|
experimental_defaultFormStateBehavior,
|
|
1747
1758
|
experimental_customMergeAllOf,
|
|
1748
1759
|
rawFormData: item,
|
|
1749
|
-
parentDefaults:
|
|
1760
|
+
parentDefaults: get15(defaults, [idx]),
|
|
1750
1761
|
required,
|
|
1751
1762
|
shouldMergeDefaultsIntoFormData,
|
|
1752
1763
|
initialDefaultsGenerated
|
|
@@ -1756,14 +1767,11 @@
|
|
|
1756
1767
|
defaults = mergeDefaultsWithFormData(defaults, itemDefaults, mergeExtraDefaults);
|
|
1757
1768
|
}
|
|
1758
1769
|
}
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
if (ignoreMinItemsFlagSet && !required) {
|
|
1765
|
-
return defaults ? defaults : void 0;
|
|
1766
|
-
}
|
|
1770
|
+
if (neverPopulate) {
|
|
1771
|
+
return defaults ?? emptyDefault;
|
|
1772
|
+
}
|
|
1773
|
+
if (ignoreMinItemsFlagSet && !required) {
|
|
1774
|
+
return defaults ? defaults : void 0;
|
|
1767
1775
|
}
|
|
1768
1776
|
let arrayDefault;
|
|
1769
1777
|
const defaultsLength = Array.isArray(defaults) ? defaults.length : 0;
|
|
@@ -1872,7 +1880,7 @@
|
|
|
1872
1880
|
let displayLabel = Boolean(label);
|
|
1873
1881
|
if (displayLabel) {
|
|
1874
1882
|
const schemaType = getSchemaType(schema);
|
|
1875
|
-
const addedByAdditionalProperty =
|
|
1883
|
+
const addedByAdditionalProperty = get15(schema, ADDITIONAL_PROPERTY_FLAG, false);
|
|
1876
1884
|
if (schemaType === "array") {
|
|
1877
1885
|
displayLabel = addedByAdditionalProperty || isMultiSelect(validator, schema, rootSchema, experimental_customMergeAllOf) || isFilesArray(validator, schema, uiSchema, rootSchema, experimental_customMergeAllOf) || isCustomWidget(uiSchema);
|
|
1878
1886
|
}
|
|
@@ -1888,133 +1896,6 @@
|
|
|
1888
1896
|
}
|
|
1889
1897
|
return displayLabel;
|
|
1890
1898
|
}
|
|
1891
|
-
function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
|
|
1892
|
-
if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema || IF_KEY in schema) {
|
|
1893
|
-
const _schema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
|
|
1894
|
-
const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals_default(item, _schema));
|
|
1895
|
-
if (sameSchemaIndex === -1) {
|
|
1896
|
-
return toPathSchemaInternal(
|
|
1897
|
-
validator,
|
|
1898
|
-
_schema,
|
|
1899
|
-
name,
|
|
1900
|
-
rootSchema,
|
|
1901
|
-
formData,
|
|
1902
|
-
_recurseList.concat(_schema),
|
|
1903
|
-
experimental_customMergeAllOf
|
|
1904
|
-
);
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
let pathSchema = {
|
|
1908
|
-
[NAME_KEY]: name.replace(/^\./, "")
|
|
1909
|
-
};
|
|
1910
|
-
if (ONE_OF_KEY in schema || ANY_OF_KEY in schema) {
|
|
1911
|
-
const xxxOf = ONE_OF_KEY in schema ? schema.oneOf : schema.anyOf;
|
|
1912
|
-
const discriminator = getDiscriminatorFieldFromSchema(schema);
|
|
1913
|
-
const index = getClosestMatchingOption(
|
|
1914
|
-
validator,
|
|
1915
|
-
rootSchema,
|
|
1916
|
-
formData,
|
|
1917
|
-
xxxOf,
|
|
1918
|
-
0,
|
|
1919
|
-
discriminator,
|
|
1920
|
-
experimental_customMergeAllOf
|
|
1921
|
-
);
|
|
1922
|
-
const _schema = xxxOf[index];
|
|
1923
|
-
pathSchema = {
|
|
1924
|
-
...pathSchema,
|
|
1925
|
-
...toPathSchemaInternal(
|
|
1926
|
-
validator,
|
|
1927
|
-
_schema,
|
|
1928
|
-
name,
|
|
1929
|
-
rootSchema,
|
|
1930
|
-
formData,
|
|
1931
|
-
_recurseList,
|
|
1932
|
-
experimental_customMergeAllOf
|
|
1933
|
-
)
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
|
|
1937
|
-
set(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
|
|
1938
|
-
const additionalSchema = isObject2(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {};
|
|
1939
|
-
const definedProperties = get16(schema, PROPERTIES_KEY, {});
|
|
1940
|
-
for (const key of Object.keys(formData ?? {})) {
|
|
1941
|
-
if (!(key in definedProperties)) {
|
|
1942
|
-
pathSchema[key] = toPathSchemaInternal(
|
|
1943
|
-
validator,
|
|
1944
|
-
additionalSchema,
|
|
1945
|
-
`${name}.${key}`,
|
|
1946
|
-
rootSchema,
|
|
1947
|
-
get16(formData, [key]),
|
|
1948
|
-
_recurseList,
|
|
1949
|
-
experimental_customMergeAllOf
|
|
1950
|
-
);
|
|
1951
|
-
}
|
|
1952
|
-
}
|
|
1953
|
-
}
|
|
1954
|
-
if (ITEMS_KEY in schema && Array.isArray(formData)) {
|
|
1955
|
-
const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;
|
|
1956
|
-
if (Array.isArray(schemaItems)) {
|
|
1957
|
-
formData.forEach((element, i) => {
|
|
1958
|
-
if (schemaItems[i]) {
|
|
1959
|
-
pathSchema[i] = toPathSchemaInternal(
|
|
1960
|
-
validator,
|
|
1961
|
-
schemaItems[i],
|
|
1962
|
-
`${name}.${i}`,
|
|
1963
|
-
rootSchema,
|
|
1964
|
-
element,
|
|
1965
|
-
_recurseList,
|
|
1966
|
-
experimental_customMergeAllOf
|
|
1967
|
-
);
|
|
1968
|
-
} else if (schemaAdditionalItems) {
|
|
1969
|
-
pathSchema[i] = toPathSchemaInternal(
|
|
1970
|
-
validator,
|
|
1971
|
-
schemaAdditionalItems,
|
|
1972
|
-
`${name}.${i}`,
|
|
1973
|
-
rootSchema,
|
|
1974
|
-
element,
|
|
1975
|
-
_recurseList,
|
|
1976
|
-
experimental_customMergeAllOf
|
|
1977
|
-
);
|
|
1978
|
-
} else {
|
|
1979
|
-
console.warn(`Unable to generate path schema for "${name}.${i}". No schema defined for it`);
|
|
1980
|
-
}
|
|
1981
|
-
});
|
|
1982
|
-
} else {
|
|
1983
|
-
formData.forEach((element, i) => {
|
|
1984
|
-
pathSchema[i] = toPathSchemaInternal(
|
|
1985
|
-
validator,
|
|
1986
|
-
schemaItems,
|
|
1987
|
-
`${name}.${i}`,
|
|
1988
|
-
rootSchema,
|
|
1989
|
-
element,
|
|
1990
|
-
_recurseList,
|
|
1991
|
-
experimental_customMergeAllOf
|
|
1992
|
-
);
|
|
1993
|
-
});
|
|
1994
|
-
}
|
|
1995
|
-
} else if (PROPERTIES_KEY in schema) {
|
|
1996
|
-
for (const property in schema.properties) {
|
|
1997
|
-
const field = get16(schema, [PROPERTIES_KEY, property], {});
|
|
1998
|
-
pathSchema[property] = toPathSchemaInternal(
|
|
1999
|
-
validator,
|
|
2000
|
-
field,
|
|
2001
|
-
`${name}.${property}`,
|
|
2002
|
-
rootSchema,
|
|
2003
|
-
// It's possible that formData is not an object -- this can happen if an
|
|
2004
|
-
// array item has just been added, but not populated with data yet
|
|
2005
|
-
get16(formData, [property]),
|
|
2006
|
-
_recurseList,
|
|
2007
|
-
experimental_customMergeAllOf
|
|
2008
|
-
);
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
return pathSchema;
|
|
2012
|
-
}
|
|
2013
|
-
function toPathSchema(validator, schema, name = "", rootSchema, formData, experimental_customMergeAllOf) {
|
|
2014
|
-
return toPathSchemaInternal(validator, schema, name, rootSchema, formData, void 0, experimental_customMergeAllOf);
|
|
2015
|
-
}
|
|
2016
|
-
|
|
2017
|
-
// src/schema/omitExtraData.ts
|
|
2018
1899
|
function getUsedFormData(formData, fields) {
|
|
2019
1900
|
if (fields.length === 0 && typeof formData !== "object") {
|
|
2020
1901
|
return formData;
|
|
@@ -2040,7 +1921,7 @@
|
|
|
2040
1921
|
}
|
|
2041
1922
|
} else if (key === NAME_KEY && data !== "") {
|
|
2042
1923
|
paths.forEach((path) => {
|
|
2043
|
-
const formValue =
|
|
1924
|
+
const formValue = get15(formData, path);
|
|
2044
1925
|
const isLeaf = objKeys.length === 1;
|
|
2045
1926
|
if (formValueHasData(formValue, isLeaf) || Array.isArray(formValue) && formValue.every((val) => formValueHasData(val, isLeaf))) {
|
|
2046
1927
|
acc.push(path);
|
|
@@ -2052,82 +1933,272 @@
|
|
|
2052
1933
|
};
|
|
2053
1934
|
return getAllPaths(pathSchema);
|
|
2054
1935
|
}
|
|
2055
|
-
function
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
1936
|
+
function isValueEmpty(value) {
|
|
1937
|
+
if (isNil(value) || value === "") {
|
|
1938
|
+
return true;
|
|
1939
|
+
}
|
|
1940
|
+
if (Array.isArray(value)) {
|
|
1941
|
+
return value.length === 0;
|
|
1942
|
+
}
|
|
1943
|
+
if (isObject(value)) {
|
|
1944
|
+
return Object.values(value).every(isValueEmpty);
|
|
1945
|
+
}
|
|
1946
|
+
return false;
|
|
2063
1947
|
}
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
1948
|
+
function doMergeAllOf(schema, experimental_customMergeAllOf) {
|
|
1949
|
+
return experimental_customMergeAllOf ? experimental_customMergeAllOf(schema) : shallowAllOfMerge_default(schema);
|
|
1950
|
+
}
|
|
1951
|
+
function omitExtraData(validator, schema, rootSchema = {}, formData, experimental_customMergeAllOf) {
|
|
1952
|
+
function isObjectValue(value) {
|
|
1953
|
+
return isObject(value);
|
|
1954
|
+
}
|
|
1955
|
+
function isSchemaObj(schemaDef) {
|
|
1956
|
+
return isObject(schemaDef);
|
|
1957
|
+
}
|
|
1958
|
+
function handleObject(schema2, source, target) {
|
|
1959
|
+
const { properties, additionalProperties, patternProperties, propertyNames } = schema2;
|
|
1960
|
+
const requiredSet = new Set(schema2.required ?? []);
|
|
1961
|
+
function setProperty(key, schemaDef, value, required = false) {
|
|
1962
|
+
const v = omit3(schemaDef, value, target[key]);
|
|
1963
|
+
if (!required && isObject(v)) {
|
|
1964
|
+
let sd = isSchemaObj(schemaDef) ? schemaDef : {};
|
|
1965
|
+
if (sd.$ref !== void 0) {
|
|
1966
|
+
sd = findSchemaDefinition(sd.$ref, rootSchema);
|
|
2074
1967
|
}
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
const nestedData = {};
|
|
2079
|
-
keys2.forEach((key) => {
|
|
2080
|
-
const formValue = get16(data, key);
|
|
2081
|
-
let oldKeyedSchema = get16(oldSchema, [PROPERTIES_KEY, key], {});
|
|
2082
|
-
let newKeyedSchema = get16(newSchema, [PROPERTIES_KEY, key], {});
|
|
2083
|
-
if (has5(oldKeyedSchema, REF_KEY)) {
|
|
2084
|
-
oldKeyedSchema = retrieveSchema(
|
|
2085
|
-
validator,
|
|
2086
|
-
oldKeyedSchema,
|
|
2087
|
-
rootSchema,
|
|
2088
|
-
formValue,
|
|
2089
|
-
experimental_customMergeAllOf
|
|
1968
|
+
const innerRequired = new Set(sd.required ?? []);
|
|
1969
|
+
const shouldDrop = Object.entries(v).every(
|
|
1970
|
+
([k, val]) => !innerRequired.has(k) && isValueEmpty(val)
|
|
2090
1971
|
);
|
|
1972
|
+
if (shouldDrop) {
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
2091
1975
|
}
|
|
2092
|
-
if (
|
|
2093
|
-
|
|
2094
|
-
validator,
|
|
2095
|
-
newKeyedSchema,
|
|
2096
|
-
rootSchema,
|
|
2097
|
-
formValue,
|
|
2098
|
-
experimental_customMergeAllOf
|
|
2099
|
-
);
|
|
1976
|
+
if (v !== void 0) {
|
|
1977
|
+
target[key] = v;
|
|
2100
1978
|
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
1979
|
+
}
|
|
1980
|
+
if (properties !== void 0) {
|
|
1981
|
+
for (const [key, schemaDef] of Object.entries(properties)) {
|
|
1982
|
+
setProperty(key, schemaDef, source[key], requiredSet.has(key));
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
let patternPropertiesRest;
|
|
1986
|
+
if (patternProperties !== void 0) {
|
|
1987
|
+
patternPropertiesRest = [];
|
|
1988
|
+
const patterns = Object.entries(patternProperties).map(([pattern, schemaDef]) => [
|
|
1989
|
+
new RegExp(pattern),
|
|
1990
|
+
schemaDef
|
|
1991
|
+
]);
|
|
1992
|
+
const knownProperties = new Set(Object.keys(properties ?? {}));
|
|
1993
|
+
for (const [key, value] of Object.entries(source)) {
|
|
1994
|
+
if (knownProperties.has(key)) {
|
|
1995
|
+
continue;
|
|
2106
1996
|
}
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
1997
|
+
const matched = patterns.find(([re]) => re.test(key));
|
|
1998
|
+
if (matched === void 0) {
|
|
1999
|
+
patternPropertiesRest.push(key);
|
|
2000
|
+
continue;
|
|
2001
|
+
}
|
|
2002
|
+
setProperty(key, matched[1], value);
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
if (additionalProperties !== void 0 && additionalProperties !== false) {
|
|
2006
|
+
const addlSchema = additionalProperties;
|
|
2007
|
+
if (patternPropertiesRest !== void 0) {
|
|
2008
|
+
for (const key of patternPropertiesRest) {
|
|
2009
|
+
setProperty(key, addlSchema, source[key]);
|
|
2010
|
+
}
|
|
2011
|
+
} else {
|
|
2012
|
+
const knownProperties = new Set(Object.keys(properties ?? {}));
|
|
2013
|
+
for (const [key, value] of Object.entries(source)) {
|
|
2014
|
+
if (knownProperties.has(key)) {
|
|
2015
|
+
continue;
|
|
2016
|
+
}
|
|
2017
|
+
setProperty(key, addlSchema, value);
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
if (propertyNames !== void 0) {
|
|
2022
|
+
for (const [key, value] of Object.entries(source)) {
|
|
2023
|
+
target[key] = value;
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
return target;
|
|
2027
|
+
}
|
|
2028
|
+
function handleArray(schema2, source, target) {
|
|
2029
|
+
const { items, additionalItems } = schema2;
|
|
2030
|
+
if (items !== void 0) {
|
|
2031
|
+
if (Array.isArray(items)) {
|
|
2032
|
+
for (let i = 0; i < items.length; i++) {
|
|
2033
|
+
target.push(omit3(items[i], source[i]));
|
|
2034
|
+
}
|
|
2035
|
+
} else {
|
|
2036
|
+
for (let i = 0; i < source.length; i++) {
|
|
2037
|
+
target.push(omit3(items, source[i]));
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
if (additionalItems) {
|
|
2042
|
+
for (let i = target.length; i < source.length; i++) {
|
|
2043
|
+
target.push(omit3(additionalItems, source[i]));
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
return target;
|
|
2047
|
+
}
|
|
2048
|
+
function handleConditions(schema2, source, target) {
|
|
2049
|
+
const { if: condition, then, else: otherwise } = schema2;
|
|
2050
|
+
if (condition === void 0) {
|
|
2051
|
+
return target;
|
|
2052
|
+
}
|
|
2053
|
+
const isThenBranch = isSchemaObj(condition) ? validator.isValid(condition, source, rootSchema) : condition;
|
|
2054
|
+
const branch = isThenBranch ? then : otherwise;
|
|
2055
|
+
return branch === void 0 ? target : omit3(branch, source, target);
|
|
2056
|
+
}
|
|
2057
|
+
function handleOneOf(oneOf, schema2, source, target) {
|
|
2058
|
+
if (!Array.isArray(oneOf) || isSelect(validator, schema2, rootSchema, experimental_customMergeAllOf)) {
|
|
2059
|
+
return target;
|
|
2060
|
+
}
|
|
2061
|
+
const scoringOptions = relaxOptionsForScoring(oneOf, true, rootSchema);
|
|
2062
|
+
const bestIndex = getClosestMatchingOption(
|
|
2063
|
+
validator,
|
|
2064
|
+
rootSchema,
|
|
2065
|
+
source,
|
|
2066
|
+
scoringOptions,
|
|
2067
|
+
0,
|
|
2068
|
+
getDiscriminatorFieldFromSchema(schema2),
|
|
2069
|
+
experimental_customMergeAllOf
|
|
2070
|
+
);
|
|
2071
|
+
const winning = oneOf[bestIndex];
|
|
2072
|
+
const resolved = isObject(winning) ? resolveAllReferences(winning, rootSchema, []) : scoringOptions[bestIndex];
|
|
2073
|
+
return omit3(resolved, source, target);
|
|
2074
|
+
}
|
|
2075
|
+
function handleAnyOf(schema2, source, target) {
|
|
2076
|
+
const { anyOf } = schema2;
|
|
2077
|
+
if (!Array.isArray(anyOf)) {
|
|
2078
|
+
return target;
|
|
2079
|
+
}
|
|
2080
|
+
if (source === void 0 || Array.isArray(source) && source.length === 0 || isObject(source) && Object.keys(source).length === 0) {
|
|
2081
|
+
for (const branch of anyOf) {
|
|
2082
|
+
target = omit3(branch, source, target);
|
|
2083
|
+
}
|
|
2084
|
+
return target;
|
|
2085
|
+
}
|
|
2086
|
+
return handleOneOf(anyOf, schema2, source, target);
|
|
2087
|
+
}
|
|
2088
|
+
function handleDependencies(schema2, source, target) {
|
|
2089
|
+
const { dependencies } = schema2;
|
|
2090
|
+
if (dependencies === void 0 || !isObjectValue(source)) {
|
|
2091
|
+
return target;
|
|
2092
|
+
}
|
|
2093
|
+
for (const [key, deps] of Object.entries(dependencies)) {
|
|
2094
|
+
if (!(key in source) || Array.isArray(deps)) {
|
|
2095
|
+
continue;
|
|
2096
|
+
}
|
|
2097
|
+
target = omit3(deps, source, target);
|
|
2098
|
+
}
|
|
2099
|
+
return target;
|
|
2100
|
+
}
|
|
2101
|
+
function omit3(schemaDef, source, target) {
|
|
2102
|
+
if (source === void 0 || schemaDef === false) {
|
|
2103
|
+
return void 0;
|
|
2104
|
+
}
|
|
2105
|
+
if (schemaDef === true || isEmpty4(schemaDef)) {
|
|
2106
|
+
return source;
|
|
2107
|
+
}
|
|
2108
|
+
let schema2 = schemaDef;
|
|
2109
|
+
const { $ref: ref, allOf } = schema2;
|
|
2110
|
+
if (ref !== void 0) {
|
|
2111
|
+
return omit3(findSchemaDefinition(ref, rootSchema), source, target);
|
|
2112
|
+
}
|
|
2113
|
+
if (allOf) {
|
|
2114
|
+
schema2 = doMergeAllOf(schema2, experimental_customMergeAllOf);
|
|
2115
|
+
}
|
|
2116
|
+
target = handleAnyOf(schema2, source, handleOneOf(schema2.oneOf, schema2, source, target));
|
|
2117
|
+
const type = getSchemaType(schema2);
|
|
2118
|
+
if (type === "object") {
|
|
2119
|
+
if (!isObjectValue(source)) {
|
|
2120
|
+
return void 0;
|
|
2121
|
+
}
|
|
2122
|
+
target = handleObject(schema2, source, isObjectValue(target) ? target : {});
|
|
2123
|
+
} else if (type === "array") {
|
|
2124
|
+
if (!Array.isArray(source)) {
|
|
2125
|
+
return void 0;
|
|
2126
|
+
}
|
|
2127
|
+
target = handleArray(schema2, source, Array.isArray(target) ? target : []);
|
|
2128
|
+
} else if (target === void 0) {
|
|
2129
|
+
target = source;
|
|
2130
|
+
}
|
|
2131
|
+
return handleDependencies(schema2, source, handleConditions(schema2, source, target));
|
|
2132
|
+
}
|
|
2133
|
+
return omit3(schema, formData);
|
|
2134
|
+
}
|
|
2135
|
+
var NO_VALUE = /* @__PURE__ */ Symbol("no Value");
|
|
2136
|
+
function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, data = {}, experimental_customMergeAllOf) {
|
|
2137
|
+
let newFormData;
|
|
2138
|
+
if (has5(newSchema, PROPERTIES_KEY)) {
|
|
2139
|
+
const removeOldSchemaData = {};
|
|
2140
|
+
if (has5(oldSchema, PROPERTIES_KEY)) {
|
|
2141
|
+
const properties = get15(oldSchema, PROPERTIES_KEY, {});
|
|
2142
|
+
Object.keys(properties).forEach((key) => {
|
|
2143
|
+
if (has5(data, key)) {
|
|
2144
|
+
removeOldSchemaData[key] = void 0;
|
|
2145
|
+
}
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
const keys2 = Object.keys(get15(newSchema, PROPERTIES_KEY, {}));
|
|
2149
|
+
const nestedData = {};
|
|
2150
|
+
keys2.forEach((key) => {
|
|
2151
|
+
const formValue = get15(data, key);
|
|
2152
|
+
let oldKeyedSchema = get15(oldSchema, [PROPERTIES_KEY, key], {});
|
|
2153
|
+
let newKeyedSchema = get15(newSchema, [PROPERTIES_KEY, key], {});
|
|
2154
|
+
if (has5(oldKeyedSchema, REF_KEY)) {
|
|
2155
|
+
oldKeyedSchema = retrieveSchema(
|
|
2156
|
+
validator,
|
|
2157
|
+
oldKeyedSchema,
|
|
2158
|
+
rootSchema,
|
|
2159
|
+
formValue,
|
|
2160
|
+
experimental_customMergeAllOf
|
|
2161
|
+
);
|
|
2162
|
+
}
|
|
2163
|
+
if (has5(newKeyedSchema, REF_KEY)) {
|
|
2164
|
+
newKeyedSchema = retrieveSchema(
|
|
2165
|
+
validator,
|
|
2166
|
+
newKeyedSchema,
|
|
2167
|
+
rootSchema,
|
|
2168
|
+
formValue,
|
|
2169
|
+
experimental_customMergeAllOf
|
|
2170
|
+
);
|
|
2171
|
+
}
|
|
2172
|
+
const oldSchemaTypeForKey = get15(oldKeyedSchema, "type");
|
|
2173
|
+
const newSchemaTypeForKey = get15(newKeyedSchema, "type");
|
|
2174
|
+
if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
|
|
2175
|
+
if (has5(removeOldSchemaData, key)) {
|
|
2176
|
+
delete removeOldSchemaData[key];
|
|
2177
|
+
}
|
|
2178
|
+
if (newSchemaTypeForKey === "object" || newSchemaTypeForKey === "array" && Array.isArray(formValue)) {
|
|
2179
|
+
const itemData = sanitizeDataForNewSchema(
|
|
2180
|
+
validator,
|
|
2181
|
+
rootSchema,
|
|
2182
|
+
newKeyedSchema,
|
|
2183
|
+
oldKeyedSchema,
|
|
2184
|
+
formValue,
|
|
2185
|
+
experimental_customMergeAllOf
|
|
2186
|
+
);
|
|
2187
|
+
if (itemData !== void 0 || newSchemaTypeForKey === "array") {
|
|
2117
2188
|
nestedData[key] = itemData;
|
|
2118
2189
|
}
|
|
2119
2190
|
} else {
|
|
2120
|
-
const newOptionDefault =
|
|
2121
|
-
const oldOptionDefault =
|
|
2191
|
+
const newOptionDefault = get15(newKeyedSchema, "default", NO_VALUE);
|
|
2192
|
+
const oldOptionDefault = get15(oldKeyedSchema, "default", NO_VALUE);
|
|
2122
2193
|
if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
|
|
2123
2194
|
if (oldOptionDefault === formValue) {
|
|
2124
2195
|
removeOldSchemaData[key] = newOptionDefault;
|
|
2125
|
-
} else if (
|
|
2196
|
+
} else if (get15(newKeyedSchema, "readOnly") === true) {
|
|
2126
2197
|
removeOldSchemaData[key] = void 0;
|
|
2127
2198
|
}
|
|
2128
2199
|
}
|
|
2129
|
-
const newOptionConst =
|
|
2130
|
-
const oldOptionConst =
|
|
2200
|
+
const newOptionConst = get15(newKeyedSchema, "const", NO_VALUE);
|
|
2201
|
+
const oldOptionConst = get15(oldKeyedSchema, "const", NO_VALUE);
|
|
2131
2202
|
if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
|
|
2132
2203
|
removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : void 0;
|
|
2133
2204
|
}
|
|
@@ -2139,9 +2210,9 @@
|
|
|
2139
2210
|
...removeOldSchemaData,
|
|
2140
2211
|
...nestedData
|
|
2141
2212
|
};
|
|
2142
|
-
} else if (
|
|
2143
|
-
let oldSchemaItems =
|
|
2144
|
-
let newSchemaItems =
|
|
2213
|
+
} else if (get15(oldSchema, "type") === "array" && get15(newSchema, "type") === "array" && Array.isArray(data)) {
|
|
2214
|
+
let oldSchemaItems = get15(oldSchema, "items");
|
|
2215
|
+
let newSchemaItems = get15(newSchema, "items");
|
|
2145
2216
|
if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
|
|
2146
2217
|
if (has5(oldSchemaItems, REF_KEY)) {
|
|
2147
2218
|
oldSchemaItems = retrieveSchema(
|
|
@@ -2161,10 +2232,10 @@
|
|
|
2161
2232
|
experimental_customMergeAllOf
|
|
2162
2233
|
);
|
|
2163
2234
|
}
|
|
2164
|
-
const oldSchemaType =
|
|
2165
|
-
const newSchemaType =
|
|
2235
|
+
const oldSchemaType = get15(oldSchemaItems, "type");
|
|
2236
|
+
const newSchemaType = get15(newSchemaItems, "type");
|
|
2166
2237
|
if (!oldSchemaType || oldSchemaType === newSchemaType) {
|
|
2167
|
-
const maxItems =
|
|
2238
|
+
const maxItems = get15(newSchema, "maxItems", -1);
|
|
2168
2239
|
if (newSchemaType === "object") {
|
|
2169
2240
|
newFormData = data.reduce((newValue, aValue) => {
|
|
2170
2241
|
const itemValue = sanitizeDataForNewSchema(
|
|
@@ -2190,6 +2261,133 @@
|
|
|
2190
2261
|
}
|
|
2191
2262
|
return newFormData;
|
|
2192
2263
|
}
|
|
2264
|
+
function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
|
|
2265
|
+
if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema || IF_KEY in schema) {
|
|
2266
|
+
const _schema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
|
|
2267
|
+
const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals_default(item, _schema));
|
|
2268
|
+
if (sameSchemaIndex === -1) {
|
|
2269
|
+
return toPathSchemaInternal(
|
|
2270
|
+
validator,
|
|
2271
|
+
_schema,
|
|
2272
|
+
name,
|
|
2273
|
+
rootSchema,
|
|
2274
|
+
formData,
|
|
2275
|
+
_recurseList.concat(_schema),
|
|
2276
|
+
experimental_customMergeAllOf
|
|
2277
|
+
);
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
let pathSchema = {
|
|
2281
|
+
[NAME_KEY]: name.replace(/^\./, "")
|
|
2282
|
+
};
|
|
2283
|
+
if (ONE_OF_KEY in schema || ANY_OF_KEY in schema) {
|
|
2284
|
+
const xxxOf = ONE_OF_KEY in schema ? schema.oneOf : schema.anyOf;
|
|
2285
|
+
const discriminator = getDiscriminatorFieldFromSchema(schema);
|
|
2286
|
+
const index = getClosestMatchingOption(
|
|
2287
|
+
validator,
|
|
2288
|
+
rootSchema,
|
|
2289
|
+
formData,
|
|
2290
|
+
xxxOf,
|
|
2291
|
+
0,
|
|
2292
|
+
discriminator,
|
|
2293
|
+
experimental_customMergeAllOf
|
|
2294
|
+
);
|
|
2295
|
+
const _schema = xxxOf[index];
|
|
2296
|
+
pathSchema = {
|
|
2297
|
+
...pathSchema,
|
|
2298
|
+
...toPathSchemaInternal(
|
|
2299
|
+
validator,
|
|
2300
|
+
_schema,
|
|
2301
|
+
name,
|
|
2302
|
+
rootSchema,
|
|
2303
|
+
formData,
|
|
2304
|
+
_recurseList,
|
|
2305
|
+
experimental_customMergeAllOf
|
|
2306
|
+
)
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
|
|
2310
|
+
set(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
|
|
2311
|
+
const additionalSchema = isObject2(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {};
|
|
2312
|
+
const definedProperties = get15(schema, PROPERTIES_KEY, {});
|
|
2313
|
+
for (const key of Object.keys(formData ?? {})) {
|
|
2314
|
+
if (!(key in definedProperties)) {
|
|
2315
|
+
pathSchema[key] = toPathSchemaInternal(
|
|
2316
|
+
validator,
|
|
2317
|
+
additionalSchema,
|
|
2318
|
+
`${name}.${key}`,
|
|
2319
|
+
rootSchema,
|
|
2320
|
+
get15(formData, [key]),
|
|
2321
|
+
_recurseList,
|
|
2322
|
+
experimental_customMergeAllOf
|
|
2323
|
+
);
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
if (ITEMS_KEY in schema && Array.isArray(formData)) {
|
|
2328
|
+
const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;
|
|
2329
|
+
if (Array.isArray(schemaItems)) {
|
|
2330
|
+
formData.forEach((element, i) => {
|
|
2331
|
+
if (schemaItems[i]) {
|
|
2332
|
+
pathSchema[i] = toPathSchemaInternal(
|
|
2333
|
+
validator,
|
|
2334
|
+
schemaItems[i],
|
|
2335
|
+
`${name}.${i}`,
|
|
2336
|
+
rootSchema,
|
|
2337
|
+
element,
|
|
2338
|
+
_recurseList,
|
|
2339
|
+
experimental_customMergeAllOf
|
|
2340
|
+
);
|
|
2341
|
+
} else if (schemaAdditionalItems) {
|
|
2342
|
+
pathSchema[i] = toPathSchemaInternal(
|
|
2343
|
+
validator,
|
|
2344
|
+
schemaAdditionalItems,
|
|
2345
|
+
`${name}.${i}`,
|
|
2346
|
+
rootSchema,
|
|
2347
|
+
element,
|
|
2348
|
+
_recurseList,
|
|
2349
|
+
experimental_customMergeAllOf
|
|
2350
|
+
);
|
|
2351
|
+
} else {
|
|
2352
|
+
console.warn(`Unable to generate path schema for "${name}.${i}". No schema defined for it`);
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
} else {
|
|
2356
|
+
formData.forEach((element, i) => {
|
|
2357
|
+
pathSchema[i] = toPathSchemaInternal(
|
|
2358
|
+
validator,
|
|
2359
|
+
schemaItems,
|
|
2360
|
+
`${name}.${i}`,
|
|
2361
|
+
rootSchema,
|
|
2362
|
+
element,
|
|
2363
|
+
_recurseList,
|
|
2364
|
+
experimental_customMergeAllOf
|
|
2365
|
+
);
|
|
2366
|
+
});
|
|
2367
|
+
}
|
|
2368
|
+
} else if (PROPERTIES_KEY in schema) {
|
|
2369
|
+
for (const property in schema.properties) {
|
|
2370
|
+
const field = get15(schema, [PROPERTIES_KEY, property], {});
|
|
2371
|
+
pathSchema[property] = toPathSchemaInternal(
|
|
2372
|
+
validator,
|
|
2373
|
+
field,
|
|
2374
|
+
`${name}.${property}`,
|
|
2375
|
+
rootSchema,
|
|
2376
|
+
// It's possible that formData is not an object -- this can happen if an
|
|
2377
|
+
// array item has just been added, but not populated with data yet
|
|
2378
|
+
get15(formData, [property]),
|
|
2379
|
+
_recurseList,
|
|
2380
|
+
experimental_customMergeAllOf
|
|
2381
|
+
);
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
return pathSchema;
|
|
2385
|
+
}
|
|
2386
|
+
function toPathSchema(validator, schema, name = "", rootSchema, formData, experimental_customMergeAllOf) {
|
|
2387
|
+
return toPathSchemaInternal(validator, schema, name, rootSchema, formData, void 0, experimental_customMergeAllOf);
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
// src/createSchemaUtils.ts
|
|
2193
2391
|
var SchemaUtils = class {
|
|
2194
2392
|
/** Constructs the `SchemaUtils` instance with the given `validator` and `rootSchema` stored as instance variables
|
|
2195
2393
|
*
|
|
@@ -2200,7 +2398,7 @@
|
|
|
2200
2398
|
*/
|
|
2201
2399
|
constructor(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
|
|
2202
2400
|
if (rootSchema && rootSchema[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
|
|
2203
|
-
this.rootSchema = makeAllReferencesAbsolute(rootSchema,
|
|
2401
|
+
this.rootSchema = makeAllReferencesAbsolute(rootSchema, get15(rootSchema, ID_KEY, "#"));
|
|
2204
2402
|
} else {
|
|
2205
2403
|
this.rootSchema = rootSchema;
|
|
2206
2404
|
}
|
|
@@ -2529,31 +2727,6 @@
|
|
|
2529
2727
|
return options;
|
|
2530
2728
|
}
|
|
2531
2729
|
|
|
2532
|
-
// src/shallowEquals.ts
|
|
2533
|
-
function shallowEquals(a, b) {
|
|
2534
|
-
if (Object.is(a, b)) {
|
|
2535
|
-
return true;
|
|
2536
|
-
}
|
|
2537
|
-
if (a == null || b == null) {
|
|
2538
|
-
return false;
|
|
2539
|
-
}
|
|
2540
|
-
if (typeof a !== "object" || typeof b !== "object") {
|
|
2541
|
-
return false;
|
|
2542
|
-
}
|
|
2543
|
-
const keysA = Object.keys(a);
|
|
2544
|
-
const keysB = Object.keys(b);
|
|
2545
|
-
if (keysA.length !== keysB.length) {
|
|
2546
|
-
return false;
|
|
2547
|
-
}
|
|
2548
|
-
for (let i = 0; i < keysA.length; i++) {
|
|
2549
|
-
const key = keysA[i];
|
|
2550
|
-
if (!Object.prototype.hasOwnProperty.call(b, key) || !Object.is(a[key], b[key])) {
|
|
2551
|
-
return false;
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
return true;
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
2730
|
// src/replaceStringParameters.ts
|
|
2558
2731
|
function replaceStringParameters(inputString, params) {
|
|
2559
2732
|
let output = inputString;
|
|
@@ -2575,6 +2748,25 @@
|
|
|
2575
2748
|
return replaceStringParameters(stringToTranslate, params);
|
|
2576
2749
|
}
|
|
2577
2750
|
|
|
2751
|
+
// src/enumOptionsValueForIndex.ts
|
|
2752
|
+
function enumOptionsValueForIndex(valueIndex, allEnumOptions = [], emptyValue) {
|
|
2753
|
+
if (Array.isArray(valueIndex)) {
|
|
2754
|
+
return valueIndex.map((index2) => enumOptionsValueForIndex(index2, allEnumOptions)).filter((val) => val !== void 0);
|
|
2755
|
+
}
|
|
2756
|
+
const index = valueIndex === "" || valueIndex === null ? -1 : Number(valueIndex);
|
|
2757
|
+
const option = allEnumOptions[index];
|
|
2758
|
+
return option ? option.value : emptyValue;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
// src/enumOptionsDeselectValue.ts
|
|
2762
|
+
function enumOptionsDeselectValue(valueIndex, selected, allEnumOptions = []) {
|
|
2763
|
+
const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
|
|
2764
|
+
if (Array.isArray(selected)) {
|
|
2765
|
+
return selected.filter((v) => !deepEquals_default(v, value));
|
|
2766
|
+
}
|
|
2767
|
+
return deepEquals_default(value, selected) ? void 0 : selected;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2578
2770
|
// src/enumOptionsIsSelected.ts
|
|
2579
2771
|
function enumOptionsIsSelected(value, selected) {
|
|
2580
2772
|
if (Array.isArray(selected)) {
|
|
@@ -2604,15 +2796,15 @@
|
|
|
2604
2796
|
const indexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
2605
2797
|
return typeof indexes === "undefined" ? emptyValue : indexes;
|
|
2606
2798
|
}
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2799
|
+
function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
|
|
2800
|
+
const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
|
|
2801
|
+
if (!isNil(value)) {
|
|
2802
|
+
const index = allEnumOptions.findIndex((opt) => value === opt.value);
|
|
2803
|
+
const all = allEnumOptions.map(({ value: val }) => val);
|
|
2804
|
+
const updated = selected.slice(0, index).concat(value, selected.slice(index));
|
|
2805
|
+
return updated.sort((a, b) => Number(all.indexOf(a) > all.indexOf(b)));
|
|
2612
2806
|
}
|
|
2613
|
-
|
|
2614
|
-
const option = allEnumOptions[index];
|
|
2615
|
-
return option ? option.value : emptyValue;
|
|
2807
|
+
return selected;
|
|
2616
2808
|
}
|
|
2617
2809
|
|
|
2618
2810
|
// src/enumOptionValueDecoder.ts
|
|
@@ -2651,25 +2843,6 @@
|
|
|
2651
2843
|
}
|
|
2652
2844
|
return String(value);
|
|
2653
2845
|
}
|
|
2654
|
-
|
|
2655
|
-
// src/enumOptionsDeselectValue.ts
|
|
2656
|
-
function enumOptionsDeselectValue(valueIndex, selected, allEnumOptions = []) {
|
|
2657
|
-
const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
|
|
2658
|
-
if (Array.isArray(selected)) {
|
|
2659
|
-
return selected.filter((v) => !deepEquals_default(v, value));
|
|
2660
|
-
}
|
|
2661
|
-
return deepEquals_default(value, selected) ? void 0 : selected;
|
|
2662
|
-
}
|
|
2663
|
-
function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
|
|
2664
|
-
const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
|
|
2665
|
-
if (!isNil(value)) {
|
|
2666
|
-
const index = allEnumOptions.findIndex((opt) => value === opt.value);
|
|
2667
|
-
const all = allEnumOptions.map(({ value: val }) => val);
|
|
2668
|
-
const updated = selected.slice(0, index).concat(value, selected.slice(index));
|
|
2669
|
-
return updated.sort((a, b) => Number(all.indexOf(a) > all.indexOf(b)));
|
|
2670
|
-
}
|
|
2671
|
-
return selected;
|
|
2672
|
-
}
|
|
2673
2846
|
var ErrorSchemaBuilder = class {
|
|
2674
2847
|
/** Construct an `ErrorSchemaBuilder` with an optional initial set of errors in an `ErrorSchema`.
|
|
2675
2848
|
*
|
|
@@ -2696,7 +2869,7 @@
|
|
|
2696
2869
|
*/
|
|
2697
2870
|
getOrCreateErrorBlock(pathOfError) {
|
|
2698
2871
|
const hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === "string";
|
|
2699
|
-
let errorBlock = hasPath ?
|
|
2872
|
+
let errorBlock = hasPath ? get15(this.errorSchema, pathOfError) : this.errorSchema;
|
|
2700
2873
|
if (!errorBlock && pathOfError) {
|
|
2701
2874
|
errorBlock = {};
|
|
2702
2875
|
setWith(this.errorSchema, pathOfError, errorBlock, Object);
|
|
@@ -2722,7 +2895,7 @@
|
|
|
2722
2895
|
*/
|
|
2723
2896
|
addErrors(errorOrList, pathOfError) {
|
|
2724
2897
|
const errorBlock = this.getOrCreateErrorBlock(pathOfError);
|
|
2725
|
-
let errorsList =
|
|
2898
|
+
let errorsList = get15(errorBlock, ERRORS_KEY);
|
|
2726
2899
|
if (!Array.isArray(errorsList)) {
|
|
2727
2900
|
errorsList = [];
|
|
2728
2901
|
errorBlock[ERRORS_KEY] = errorsList;
|
|
@@ -2772,7 +2945,7 @@
|
|
|
2772
2945
|
} else if (!aIsPlainObject && bIsPlainObject) {
|
|
2773
2946
|
return keys(b);
|
|
2774
2947
|
} else {
|
|
2775
|
-
const unequalFields = keys(pickBy(a, (value, key) => !deepEquals_default(value,
|
|
2948
|
+
const unequalFields = keys(pickBy(a, (value, key) => !deepEquals_default(value, get15(b, key))));
|
|
2776
2949
|
const diffFields = difference(keys(b), keys(a));
|
|
2777
2950
|
return [...unequalFields, ...diffFields];
|
|
2778
2951
|
}
|
|
@@ -2898,7 +3071,7 @@
|
|
|
2898
3071
|
);
|
|
2899
3072
|
}
|
|
2900
3073
|
function getTestIds() {
|
|
2901
|
-
if (
|
|
3074
|
+
if (get15(globalThis, "process.env.NODE_ENV") !== "test") {
|
|
2902
3075
|
return {};
|
|
2903
3076
|
}
|
|
2904
3077
|
const ids = /* @__PURE__ */ new Map();
|
|
@@ -2967,7 +3140,7 @@
|
|
|
2967
3140
|
}
|
|
2968
3141
|
};
|
|
2969
3142
|
function mergeWidgetOptions(AWidget) {
|
|
2970
|
-
let MergedWidget =
|
|
3143
|
+
let MergedWidget = get15(AWidget, "MergedWidget");
|
|
2971
3144
|
if (!MergedWidget) {
|
|
2972
3145
|
const defaultOptions = AWidget.defaultProps && AWidget.defaultProps.options || {};
|
|
2973
3146
|
MergedWidget = ({ options, ...props }) => {
|
|
@@ -3097,80 +3270,28 @@
|
|
|
3097
3270
|
if (has5(regOrFc, FORM_CONTEXT_NAME)) {
|
|
3098
3271
|
lookupPath.unshift(FORM_CONTEXT_NAME);
|
|
3099
3272
|
}
|
|
3100
|
-
return
|
|
3101
|
-
}
|
|
3102
|
-
function isValueEmpty(value) {
|
|
3103
|
-
if (isNil(value) || value === "") {
|
|
3104
|
-
return true;
|
|
3105
|
-
}
|
|
3106
|
-
if (Array.isArray(value)) {
|
|
3107
|
-
return value.length === 0;
|
|
3108
|
-
}
|
|
3109
|
-
if (isObject(value)) {
|
|
3110
|
-
const obj = value;
|
|
3111
|
-
const keys2 = Object.keys(obj);
|
|
3112
|
-
return keys2.every((key) => isValueEmpty(obj[key]));
|
|
3113
|
-
}
|
|
3114
|
-
return false;
|
|
3273
|
+
return get15(regOrFc, [...lookupPath, toLookup], fallback);
|
|
3115
3274
|
}
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
if (Array.isArray(formData)) {
|
|
3122
|
-
const itemsSchema = resolvedSchema.items;
|
|
3123
|
-
if (!itemsSchema) {
|
|
3124
|
-
return formData;
|
|
3125
|
-
}
|
|
3126
|
-
let hasChanges = false;
|
|
3127
|
-
const mapped = formData.map((item, index) => {
|
|
3128
|
-
let itemSchema = itemsSchema;
|
|
3129
|
-
if (Array.isArray(itemsSchema)) {
|
|
3130
|
-
itemSchema = itemsSchema[index] || resolvedSchema.additionalItems || {};
|
|
3131
|
-
}
|
|
3132
|
-
const cleaned = removeOptionalEmptyObjects(validator, itemSchema, rootSchema, item);
|
|
3133
|
-
if (cleaned !== item) {
|
|
3134
|
-
hasChanges = true;
|
|
3135
|
-
}
|
|
3136
|
-
return cleaned === void 0 ? {} : cleaned;
|
|
3137
|
-
});
|
|
3138
|
-
return hasChanges ? mapped : formData;
|
|
3139
|
-
}
|
|
3140
|
-
const { properties, required: requiredFields = [] } = resolvedSchema;
|
|
3141
|
-
if (!isObject(formData) || !properties) {
|
|
3142
|
-
return formData;
|
|
3275
|
+
|
|
3276
|
+
// src/nameGenerators.ts
|
|
3277
|
+
var bracketNameGenerator = (path, idPrefix, isMultiValue) => {
|
|
3278
|
+
if (!path || path.length === 0) {
|
|
3279
|
+
return idPrefix;
|
|
3143
3280
|
}
|
|
3144
|
-
const
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
for (const key of Object.keys(data)) {
|
|
3148
|
-
const value = data[key];
|
|
3149
|
-
const propertySchema = properties[key] || {};
|
|
3150
|
-
const isRequired = requiredFields.includes(key);
|
|
3151
|
-
const isObj = isObject(value);
|
|
3152
|
-
const isArr = Array.isArray(value);
|
|
3153
|
-
if ((isObj || isArr) && properties[key]) {
|
|
3154
|
-
const cleaned = removeOptionalEmptyObjects(validator, propertySchema, rootSchema, value);
|
|
3155
|
-
if (!isRequired && isValueEmpty(cleaned)) {
|
|
3156
|
-
continue;
|
|
3157
|
-
}
|
|
3158
|
-
result[key] = cleaned;
|
|
3159
|
-
hasAnyValue = true;
|
|
3160
|
-
} else if (!isRequired && isValueEmpty(value) && properties[key]) {
|
|
3161
|
-
continue;
|
|
3162
|
-
} else {
|
|
3163
|
-
result[key] = value;
|
|
3164
|
-
if (!isValueEmpty(value)) {
|
|
3165
|
-
hasAnyValue = true;
|
|
3166
|
-
}
|
|
3281
|
+
const baseName = path.reduce((acc, pathUnit, index) => {
|
|
3282
|
+
if (index === 0) {
|
|
3283
|
+
return `${idPrefix}[${String(pathUnit)}]`;
|
|
3167
3284
|
}
|
|
3285
|
+
return `${acc}[${String(pathUnit)}]`;
|
|
3286
|
+
}, "");
|
|
3287
|
+
return isMultiValue ? `${baseName}[]` : baseName;
|
|
3288
|
+
};
|
|
3289
|
+
var dotNotationNameGenerator = (path, idPrefix, _isMultiValue) => {
|
|
3290
|
+
if (!path || path.length === 0) {
|
|
3291
|
+
return idPrefix;
|
|
3168
3292
|
}
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
}
|
|
3172
|
-
return result;
|
|
3173
|
-
}
|
|
3293
|
+
return `${idPrefix}.${path.map(String).join(".")}`;
|
|
3294
|
+
};
|
|
3174
3295
|
|
|
3175
3296
|
// src/orderProperties.ts
|
|
3176
3297
|
function orderProperties(properties, order) {
|
|
@@ -3227,6 +3348,64 @@
|
|
|
3227
3348
|
second: includeTime ? date.getUTCSeconds() : 0
|
|
3228
3349
|
};
|
|
3229
3350
|
}
|
|
3351
|
+
|
|
3352
|
+
// src/removeOptionalEmptyObjects.ts
|
|
3353
|
+
function removeOptionalEmptyObjects(validator, schema, rootSchema, formData) {
|
|
3354
|
+
if (!isObject(schema)) {
|
|
3355
|
+
return formData;
|
|
3356
|
+
}
|
|
3357
|
+
const resolvedSchema = retrieveSchema(validator, schema, rootSchema, formData);
|
|
3358
|
+
if (Array.isArray(formData)) {
|
|
3359
|
+
const itemsSchema = resolvedSchema.items;
|
|
3360
|
+
if (!itemsSchema) {
|
|
3361
|
+
return formData;
|
|
3362
|
+
}
|
|
3363
|
+
let hasChanges = false;
|
|
3364
|
+
const mapped = formData.map((item, index) => {
|
|
3365
|
+
let itemSchema = itemsSchema;
|
|
3366
|
+
if (Array.isArray(itemsSchema)) {
|
|
3367
|
+
itemSchema = itemsSchema[index] || resolvedSchema.additionalItems || {};
|
|
3368
|
+
}
|
|
3369
|
+
const cleaned = removeOptionalEmptyObjects(validator, itemSchema, rootSchema, item);
|
|
3370
|
+
if (cleaned !== item) {
|
|
3371
|
+
hasChanges = true;
|
|
3372
|
+
}
|
|
3373
|
+
return cleaned === void 0 ? {} : cleaned;
|
|
3374
|
+
});
|
|
3375
|
+
return hasChanges ? mapped : formData;
|
|
3376
|
+
}
|
|
3377
|
+
const { properties, required: requiredFields = [] } = resolvedSchema;
|
|
3378
|
+
if (!isObject(formData) || !properties) {
|
|
3379
|
+
return formData;
|
|
3380
|
+
}
|
|
3381
|
+
const result = {};
|
|
3382
|
+
const data = formData;
|
|
3383
|
+
let hasAnyValue = false;
|
|
3384
|
+
for (const key of Object.keys(data)) {
|
|
3385
|
+
const value = data[key];
|
|
3386
|
+
const propertySchema = properties[key] || {};
|
|
3387
|
+
const isRequired = requiredFields.includes(key);
|
|
3388
|
+
const isObj = isObject(value);
|
|
3389
|
+
const isArr = Array.isArray(value);
|
|
3390
|
+
if ((isObj || isArr) && properties[key]) {
|
|
3391
|
+
const cleaned = removeOptionalEmptyObjects(validator, propertySchema, rootSchema, value);
|
|
3392
|
+
if (!isRequired && isValueEmpty(cleaned)) {
|
|
3393
|
+
continue;
|
|
3394
|
+
}
|
|
3395
|
+
result[key] = cleaned;
|
|
3396
|
+
hasAnyValue = true;
|
|
3397
|
+
} else if (isRequired || !isValueEmpty(value) || !properties[key]) {
|
|
3398
|
+
result[key] = value;
|
|
3399
|
+
if (!isValueEmpty(value)) {
|
|
3400
|
+
hasAnyValue = true;
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
if (!hasAnyValue && Object.keys(result).length === 0) {
|
|
3405
|
+
return void 0;
|
|
3406
|
+
}
|
|
3407
|
+
return result;
|
|
3408
|
+
}
|
|
3230
3409
|
function resolveUiSchema(schema, localUiSchema, registry) {
|
|
3231
3410
|
const ref = schema[RJSF_REF_KEY] ?? schema[REF_KEY];
|
|
3232
3411
|
const definitions = registry.uiSchemaDefinitions;
|
|
@@ -3295,6 +3474,31 @@
|
|
|
3295
3474
|
return false;
|
|
3296
3475
|
}
|
|
3297
3476
|
|
|
3477
|
+
// src/shallowEquals.ts
|
|
3478
|
+
function shallowEquals(a, b) {
|
|
3479
|
+
if (Object.is(a, b)) {
|
|
3480
|
+
return true;
|
|
3481
|
+
}
|
|
3482
|
+
if (a == null || b == null) {
|
|
3483
|
+
return false;
|
|
3484
|
+
}
|
|
3485
|
+
if (typeof a !== "object" || typeof b !== "object") {
|
|
3486
|
+
return false;
|
|
3487
|
+
}
|
|
3488
|
+
const keysA = Object.keys(a);
|
|
3489
|
+
const keysB = Object.keys(b);
|
|
3490
|
+
if (keysA.length !== keysB.length) {
|
|
3491
|
+
return false;
|
|
3492
|
+
}
|
|
3493
|
+
for (let i = 0; i < keysA.length; i++) {
|
|
3494
|
+
const key = keysA[i];
|
|
3495
|
+
if (!Object.prototype.hasOwnProperty.call(b, key) || !Object.is(a[key], b[key])) {
|
|
3496
|
+
return false;
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
return true;
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3298
3502
|
// src/shouldRender.ts
|
|
3299
3503
|
function shouldRender(component, nextProps, nextState, updateStrategy = "customDeep") {
|
|
3300
3504
|
if (updateStrategy === "always") {
|
|
@@ -3572,15 +3776,14 @@
|
|
|
3572
3776
|
[value]
|
|
3573
3777
|
);
|
|
3574
3778
|
const handleChange = react.useCallback(
|
|
3575
|
-
(files) => {
|
|
3576
|
-
processFiles(files)
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
});
|
|
3779
|
+
async (files) => {
|
|
3780
|
+
const filesInfoEvent = await processFiles(files);
|
|
3781
|
+
const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL || null);
|
|
3782
|
+
if (multiple) {
|
|
3783
|
+
onChange(values.concat(...newValue));
|
|
3784
|
+
} else {
|
|
3785
|
+
onChange(newValue[0]);
|
|
3786
|
+
}
|
|
3584
3787
|
},
|
|
3585
3788
|
[values, multiple, onChange]
|
|
3586
3789
|
);
|
|
@@ -3658,26 +3861,6 @@
|
|
|
3658
3861
|
return schemaNode;
|
|
3659
3862
|
}
|
|
3660
3863
|
|
|
3661
|
-
// src/nameGenerators.ts
|
|
3662
|
-
var bracketNameGenerator = (path, idPrefix, isMultiValue) => {
|
|
3663
|
-
if (!path || path.length === 0) {
|
|
3664
|
-
return idPrefix;
|
|
3665
|
-
}
|
|
3666
|
-
const baseName = path.reduce((acc, pathUnit, index) => {
|
|
3667
|
-
if (index === 0) {
|
|
3668
|
-
return `${idPrefix}[${String(pathUnit)}]`;
|
|
3669
|
-
}
|
|
3670
|
-
return `${acc}[${String(pathUnit)}]`;
|
|
3671
|
-
}, "");
|
|
3672
|
-
return isMultiValue ? `${baseName}[]` : baseName;
|
|
3673
|
-
};
|
|
3674
|
-
var dotNotationNameGenerator = (path, idPrefix, _isMultiValue) => {
|
|
3675
|
-
if (!path || path.length === 0) {
|
|
3676
|
-
return idPrefix;
|
|
3677
|
-
}
|
|
3678
|
-
return `${idPrefix}.${path.map(String).join(".")}`;
|
|
3679
|
-
};
|
|
3680
|
-
|
|
3681
3864
|
// src/enums.ts
|
|
3682
3865
|
var TranslatableString = /* @__PURE__ */ ((TranslatableString2) => {
|
|
3683
3866
|
TranslatableString2["ArrayItemTitle"] = "Item";
|
|
@@ -3744,7 +3927,7 @@
|
|
|
3744
3927
|
* @param hash - The hash value at which to map the schema
|
|
3745
3928
|
*/
|
|
3746
3929
|
addSchema(schema, hash) {
|
|
3747
|
-
const key =
|
|
3930
|
+
const key = get15(schema, ID_KEY, hash);
|
|
3748
3931
|
const identifiedSchema = { ...schema, [ID_KEY]: key };
|
|
3749
3932
|
const existing = this.schemaMap[key];
|
|
3750
3933
|
if (!existing) {
|
|
@@ -3937,6 +4120,7 @@
|
|
|
3937
4120
|
exports.isObject = isObject;
|
|
3938
4121
|
exports.isRootSchema = isRootSchema;
|
|
3939
4122
|
exports.isSelect = isSelect;
|
|
4123
|
+
exports.isValueEmpty = isValueEmpty;
|
|
3940
4124
|
exports.labelValue = labelValue;
|
|
3941
4125
|
exports.localToUTC = localToUTC;
|
|
3942
4126
|
exports.lookupFromFormContext = lookupFromFormContext;
|
|
@@ -3951,6 +4135,7 @@
|
|
|
3951
4135
|
exports.pad = pad;
|
|
3952
4136
|
exports.parseDateString = parseDateString;
|
|
3953
4137
|
exports.rangeSpec = rangeSpec;
|
|
4138
|
+
exports.relaxOptionsForScoring = relaxOptionsForScoring;
|
|
3954
4139
|
exports.removeOptionalEmptyObjects = removeOptionalEmptyObjects;
|
|
3955
4140
|
exports.replaceStringParameters = replaceStringParameters;
|
|
3956
4141
|
exports.resolveUiSchema = resolveUiSchema;
|