@rjsf/utils 6.4.1 → 6.5.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/dist/index.cjs +198 -84
- package/dist/index.cjs.map +4 -4
- package/dist/utils.esm.js +198 -84
- package/dist/utils.esm.js.map +4 -4
- package/dist/utils.umd.js +185 -80
- package/lib/enumOptionSelectedValue.d.ts +15 -0
- package/lib/enumOptionSelectedValue.js +28 -0
- package/lib/enumOptionSelectedValue.js.map +1 -0
- package/lib/enumOptionValueDecoder.d.ts +17 -0
- package/lib/enumOptionValueDecoder.js +53 -0
- package/lib/enumOptionValueDecoder.js.map +1 -0
- package/lib/enumOptionValueEncoder.d.ts +15 -0
- package/lib/enumOptionValueEncoder.js +27 -0
- package/lib/enumOptionValueEncoder.js.map +1 -0
- package/lib/getInputProps.js +9 -0
- package/lib/getInputProps.js.map +1 -1
- package/lib/getOptionValueFormat.d.ts +16 -0
- package/lib/getOptionValueFormat.js +17 -0
- package/lib/getOptionValueFormat.js.map +1 -0
- package/lib/index.d.ts +7 -2
- package/lib/index.js +7 -2
- package/lib/index.js.map +1 -1
- package/lib/removeOptionalEmptyObjects.d.ts +17 -0
- package/lib/removeOptionalEmptyObjects.js +108 -0
- package/lib/removeOptionalEmptyObjects.js.map +1 -0
- package/lib/resolveUiSchema.d.ts +5 -19
- package/lib/resolveUiSchema.js +49 -95
- package/lib/resolveUiSchema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types.d.ts +27 -1
- package/package.json +4 -4
- package/src/enumOptionSelectedValue.ts +39 -0
- package/src/enumOptionValueDecoder.ts +64 -0
- package/src/enumOptionValueEncoder.ts +33 -0
- package/src/getInputProps.ts +10 -0
- package/src/getOptionValueFormat.ts +17 -0
- package/src/index.ts +11 -2
- package/src/removeOptionalEmptyObjects.ts +127 -0
- package/src/resolveUiSchema.ts +55 -122
- package/src/types.ts +28 -1
package/dist/index.cjs
CHANGED
|
@@ -85,6 +85,9 @@ __export(index_exports, {
|
|
|
85
85
|
descriptionId: () => descriptionId,
|
|
86
86
|
dotNotationNameGenerator: () => dotNotationNameGenerator,
|
|
87
87
|
englishStringTranslator: () => englishStringTranslator,
|
|
88
|
+
enumOptionSelectedValue: () => enumOptionSelectedValue,
|
|
89
|
+
enumOptionValueDecoder: () => enumOptionValueDecoder,
|
|
90
|
+
enumOptionValueEncoder: () => enumOptionValueEncoder,
|
|
88
91
|
enumOptionsDeselectValue: () => enumOptionsDeselectValue,
|
|
89
92
|
enumOptionsIndexForValue: () => enumOptionsIndexForValue,
|
|
90
93
|
enumOptionsIsSelected: () => enumOptionsIsSelected,
|
|
@@ -92,7 +95,6 @@ __export(index_exports, {
|
|
|
92
95
|
enumOptionsValueForIndex: () => enumOptionsValueForIndex,
|
|
93
96
|
errorId: () => errorId,
|
|
94
97
|
examplesId: () => examplesId,
|
|
95
|
-
expandUiSchemaDefinitions: () => expandUiSchemaDefinitions,
|
|
96
98
|
findFieldInSchema: () => findFieldInSchema,
|
|
97
99
|
findSchemaDefinition: () => findSchemaDefinition,
|
|
98
100
|
findSelectedOptionInXxxOf: () => findSelectedOptionInXxxOf,
|
|
@@ -107,6 +109,7 @@ __export(index_exports, {
|
|
|
107
109
|
getFromSchema: () => getFromSchema,
|
|
108
110
|
getInputProps: () => getInputProps,
|
|
109
111
|
getOptionMatchingSimpleDiscriminator: () => getOptionMatchingSimpleDiscriminator,
|
|
112
|
+
getOptionValueFormat: () => getOptionValueFormat,
|
|
110
113
|
getSchemaType: () => getSchemaType,
|
|
111
114
|
getSubmitButtonOptions: () => getSubmitButtonOptions,
|
|
112
115
|
getTemplate: () => getTemplate,
|
|
@@ -143,6 +146,7 @@ __export(index_exports, {
|
|
|
143
146
|
pad: () => pad,
|
|
144
147
|
parseDateString: () => parseDateString,
|
|
145
148
|
rangeSpec: () => rangeSpec,
|
|
149
|
+
removeOptionalEmptyObjects: () => removeOptionalEmptyObjects,
|
|
146
150
|
replaceStringParameters: () => replaceStringParameters,
|
|
147
151
|
resolveUiSchema: () => resolveUiSchema,
|
|
148
152
|
retrieveSchema: () => retrieveSchema,
|
|
@@ -2836,6 +2840,36 @@ function englishStringTranslator(stringToTranslate, params) {
|
|
|
2836
2840
|
return replaceStringParameters(stringToTranslate, params);
|
|
2837
2841
|
}
|
|
2838
2842
|
|
|
2843
|
+
// src/enumOptionsIsSelected.ts
|
|
2844
|
+
function enumOptionsIsSelected(value, selected) {
|
|
2845
|
+
if (Array.isArray(selected)) {
|
|
2846
|
+
return selected.some((sel) => deepEquals(sel, value));
|
|
2847
|
+
}
|
|
2848
|
+
return deepEquals(selected, value);
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
// src/enumOptionsIndexForValue.ts
|
|
2852
|
+
function enumOptionsIndexForValue(value, allEnumOptions = [], multiple = false) {
|
|
2853
|
+
const selectedIndexes = allEnumOptions.map((opt, index) => enumOptionsIsSelected(opt.value, value) ? String(index) : void 0).filter((opt) => typeof opt !== "undefined");
|
|
2854
|
+
if (!multiple) {
|
|
2855
|
+
return selectedIndexes[0];
|
|
2856
|
+
}
|
|
2857
|
+
return selectedIndexes;
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
// src/enumOptionSelectedValue.ts
|
|
2861
|
+
function enumOptionSelectedValue(value, enumOptions, multiple, format = "indexed", emptyValue) {
|
|
2862
|
+
const isEmpty9 = typeof value === "undefined" || multiple && Array.isArray(value) && value.length < 1 || !multiple && value === emptyValue;
|
|
2863
|
+
if (isEmpty9) {
|
|
2864
|
+
return emptyValue;
|
|
2865
|
+
}
|
|
2866
|
+
if (format === "realValue") {
|
|
2867
|
+
return multiple ? value.map(String) : String(value);
|
|
2868
|
+
}
|
|
2869
|
+
const indexes = enumOptionsIndexForValue(value, enumOptions, multiple);
|
|
2870
|
+
return typeof indexes === "undefined" ? emptyValue : indexes;
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2839
2873
|
// src/enumOptionsValueForIndex.ts
|
|
2840
2874
|
function enumOptionsValueForIndex(valueIndex, allEnumOptions = [], emptyValue) {
|
|
2841
2875
|
if (Array.isArray(valueIndex)) {
|
|
@@ -2846,37 +2880,60 @@ function enumOptionsValueForIndex(valueIndex, allEnumOptions = [], emptyValue) {
|
|
|
2846
2880
|
return option ? option.value : emptyValue;
|
|
2847
2881
|
}
|
|
2848
2882
|
|
|
2849
|
-
// src/
|
|
2850
|
-
function
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
return selected.filter((v) => !deepEquals(v, value));
|
|
2883
|
+
// src/enumOptionValueDecoder.ts
|
|
2884
|
+
function decodeSingle(value, enumOptions, emptyValue) {
|
|
2885
|
+
if (value === "" || !Array.isArray(enumOptions)) {
|
|
2886
|
+
return emptyValue;
|
|
2854
2887
|
}
|
|
2855
|
-
|
|
2888
|
+
const match = enumOptions.find((opt) => String(opt.value) === value);
|
|
2889
|
+
if (match) {
|
|
2890
|
+
return match.value;
|
|
2891
|
+
}
|
|
2892
|
+
const index = Number(value);
|
|
2893
|
+
if (!isNaN(index) && index >= 0 && index < enumOptions.length) {
|
|
2894
|
+
return enumOptions[index].value;
|
|
2895
|
+
}
|
|
2896
|
+
return emptyValue;
|
|
2897
|
+
}
|
|
2898
|
+
function enumOptionValueDecoder(value, enumOptions, format = "indexed", emptyValue) {
|
|
2899
|
+
if (format !== "realValue") {
|
|
2900
|
+
return enumOptionsValueForIndex(value, enumOptions, emptyValue);
|
|
2901
|
+
}
|
|
2902
|
+
if (Array.isArray(value)) {
|
|
2903
|
+
return value.map((v) => decodeSingle(v, enumOptions, emptyValue));
|
|
2904
|
+
}
|
|
2905
|
+
return decodeSingle(value, enumOptions, emptyValue);
|
|
2856
2906
|
}
|
|
2857
2907
|
|
|
2858
|
-
// src/
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2908
|
+
// src/enumOptionValueEncoder.ts
|
|
2909
|
+
var import_isNil2 = __toESM(require("lodash/isNil"), 1);
|
|
2910
|
+
function enumOptionValueEncoder(value, index, format = "indexed") {
|
|
2911
|
+
if (format !== "realValue") {
|
|
2912
|
+
return String(index);
|
|
2862
2913
|
}
|
|
2863
|
-
|
|
2914
|
+
if ((0, import_isNil2.default)(value)) {
|
|
2915
|
+
return "";
|
|
2916
|
+
}
|
|
2917
|
+
if (typeof value === "object") {
|
|
2918
|
+
return String(index);
|
|
2919
|
+
}
|
|
2920
|
+
return String(value);
|
|
2864
2921
|
}
|
|
2865
2922
|
|
|
2866
|
-
// src/
|
|
2867
|
-
function
|
|
2868
|
-
const
|
|
2869
|
-
if (
|
|
2870
|
-
return
|
|
2923
|
+
// src/enumOptionsDeselectValue.ts
|
|
2924
|
+
function enumOptionsDeselectValue(valueIndex, selected, allEnumOptions = []) {
|
|
2925
|
+
const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
|
|
2926
|
+
if (Array.isArray(selected)) {
|
|
2927
|
+
return selected.filter((v) => !deepEquals(v, value));
|
|
2871
2928
|
}
|
|
2872
|
-
return
|
|
2929
|
+
return deepEquals(value, selected) ? void 0 : selected;
|
|
2873
2930
|
}
|
|
2874
2931
|
|
|
2875
2932
|
// src/enumOptionsSelectValue.ts
|
|
2876
|
-
var
|
|
2933
|
+
var import_isNil3 = __toESM(require("lodash/isNil"), 1);
|
|
2877
2934
|
function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
|
|
2878
2935
|
const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
|
|
2879
|
-
if (!(0,
|
|
2936
|
+
if (!(0, import_isNil3.default)(value)) {
|
|
2880
2937
|
const index = allEnumOptions.findIndex((opt) => value === opt.value);
|
|
2881
2938
|
const all = allEnumOptions.map(({ value: val }) => val);
|
|
2882
2939
|
const updated = selected.slice(0, index).concat(value, selected.slice(index));
|
|
@@ -3069,6 +3126,14 @@ function getInputProps(schema, defaultType, options = {}, autoDefaultStepAny = t
|
|
|
3069
3126
|
}
|
|
3070
3127
|
}
|
|
3071
3128
|
}
|
|
3129
|
+
if (["date", "datetime-local", "time", "week", "month"].includes(inputProps.type)) {
|
|
3130
|
+
if (schema.formatMinimum !== void 0) {
|
|
3131
|
+
inputProps.min = schema.formatMinimum;
|
|
3132
|
+
}
|
|
3133
|
+
if (schema.formatMaximum !== void 0) {
|
|
3134
|
+
inputProps.max = schema.formatMaximum;
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3072
3137
|
if (options.autocomplete) {
|
|
3073
3138
|
inputProps.autoComplete = options.autocomplete;
|
|
3074
3139
|
}
|
|
@@ -3078,6 +3143,11 @@ function getInputProps(schema, defaultType, options = {}, autoDefaultStepAny = t
|
|
|
3078
3143
|
return inputProps;
|
|
3079
3144
|
}
|
|
3080
3145
|
|
|
3146
|
+
// src/getOptionValueFormat.ts
|
|
3147
|
+
function getOptionValueFormat(options) {
|
|
3148
|
+
return options?.optionValueFormat ?? "indexed";
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3081
3151
|
// src/getSubmitButtonOptions.ts
|
|
3082
3152
|
var DEFAULT_OPTIONS = {
|
|
3083
3153
|
props: {
|
|
@@ -3298,11 +3368,11 @@ function optionalControlsId(id, element) {
|
|
|
3298
3368
|
}
|
|
3299
3369
|
|
|
3300
3370
|
// src/isFormDataAvailable.ts
|
|
3301
|
-
var
|
|
3371
|
+
var import_isNil4 = __toESM(require("lodash/isNil"), 1);
|
|
3302
3372
|
var import_isEmpty6 = __toESM(require("lodash/isEmpty"), 1);
|
|
3303
3373
|
var import_isObject12 = __toESM(require("lodash/isObject"), 1);
|
|
3304
3374
|
function isFormDataAvailable(formData) {
|
|
3305
|
-
return !(0,
|
|
3375
|
+
return !(0, import_isNil4.default)(formData) && (!(0, import_isObject12.default)(formData) || Array.isArray(formData) || !(0, import_isEmpty6.default)(formData));
|
|
3306
3376
|
}
|
|
3307
3377
|
|
|
3308
3378
|
// src/isRootSchema.ts
|
|
@@ -3341,6 +3411,81 @@ function lookupFromFormContext(regOrFc, toLookup, fallback) {
|
|
|
3341
3411
|
return (0, import_get22.default)(regOrFc, [...lookupPath, toLookup], fallback);
|
|
3342
3412
|
}
|
|
3343
3413
|
|
|
3414
|
+
// src/removeOptionalEmptyObjects.ts
|
|
3415
|
+
var import_isNil5 = __toESM(require("lodash/isNil"), 1);
|
|
3416
|
+
function isValueEmpty(value) {
|
|
3417
|
+
if ((0, import_isNil5.default)(value) || value === "") {
|
|
3418
|
+
return true;
|
|
3419
|
+
}
|
|
3420
|
+
if (Array.isArray(value)) {
|
|
3421
|
+
return value.length === 0;
|
|
3422
|
+
}
|
|
3423
|
+
if (isObject(value)) {
|
|
3424
|
+
const obj = value;
|
|
3425
|
+
const keys2 = Object.keys(obj);
|
|
3426
|
+
return keys2.every((key) => isValueEmpty(obj[key]));
|
|
3427
|
+
}
|
|
3428
|
+
return false;
|
|
3429
|
+
}
|
|
3430
|
+
function removeOptionalEmptyObjects(validator, schema, rootSchema, formData) {
|
|
3431
|
+
if (!isObject(schema)) {
|
|
3432
|
+
return formData;
|
|
3433
|
+
}
|
|
3434
|
+
const resolvedSchema = retrieveSchema(validator, schema, rootSchema, formData);
|
|
3435
|
+
if (Array.isArray(formData)) {
|
|
3436
|
+
const itemsSchema = resolvedSchema.items;
|
|
3437
|
+
if (!itemsSchema) {
|
|
3438
|
+
return formData;
|
|
3439
|
+
}
|
|
3440
|
+
let hasChanges = false;
|
|
3441
|
+
const mapped = formData.map((item, index) => {
|
|
3442
|
+
let itemSchema = itemsSchema;
|
|
3443
|
+
if (Array.isArray(itemsSchema)) {
|
|
3444
|
+
itemSchema = itemsSchema[index] || resolvedSchema.additionalItems || {};
|
|
3445
|
+
}
|
|
3446
|
+
const cleaned = removeOptionalEmptyObjects(validator, itemSchema, rootSchema, item);
|
|
3447
|
+
if (cleaned !== item) {
|
|
3448
|
+
hasChanges = true;
|
|
3449
|
+
}
|
|
3450
|
+
return cleaned === void 0 ? {} : cleaned;
|
|
3451
|
+
});
|
|
3452
|
+
return hasChanges ? mapped : formData;
|
|
3453
|
+
}
|
|
3454
|
+
const { properties, required: requiredFields = [] } = resolvedSchema;
|
|
3455
|
+
if (!isObject(formData) || !properties) {
|
|
3456
|
+
return formData;
|
|
3457
|
+
}
|
|
3458
|
+
const result = {};
|
|
3459
|
+
const data = formData;
|
|
3460
|
+
let hasAnyValue = false;
|
|
3461
|
+
for (const key of Object.keys(data)) {
|
|
3462
|
+
const value = data[key];
|
|
3463
|
+
const propertySchema = properties[key] || {};
|
|
3464
|
+
const isRequired = requiredFields.includes(key);
|
|
3465
|
+
const isObj = isObject(value);
|
|
3466
|
+
const isArr = Array.isArray(value);
|
|
3467
|
+
if ((isObj || isArr) && properties[key]) {
|
|
3468
|
+
const cleaned = removeOptionalEmptyObjects(validator, propertySchema, rootSchema, value);
|
|
3469
|
+
if (!isRequired && isValueEmpty(cleaned)) {
|
|
3470
|
+
continue;
|
|
3471
|
+
}
|
|
3472
|
+
result[key] = cleaned;
|
|
3473
|
+
hasAnyValue = true;
|
|
3474
|
+
} else if (!isRequired && isValueEmpty(value) && properties[key]) {
|
|
3475
|
+
continue;
|
|
3476
|
+
} else {
|
|
3477
|
+
result[key] = value;
|
|
3478
|
+
if (!isValueEmpty(value)) {
|
|
3479
|
+
hasAnyValue = true;
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
if (!hasAnyValue && Object.keys(result).length === 0) {
|
|
3484
|
+
return void 0;
|
|
3485
|
+
}
|
|
3486
|
+
return result;
|
|
3487
|
+
}
|
|
3488
|
+
|
|
3344
3489
|
// src/orderProperties.ts
|
|
3345
3490
|
function orderProperties(properties, order) {
|
|
3346
3491
|
if (!Array.isArray(order)) {
|
|
@@ -3398,63 +3543,43 @@ function parseDateString(dateString, includeTime = true) {
|
|
|
3398
3543
|
}
|
|
3399
3544
|
|
|
3400
3545
|
// src/resolveUiSchema.ts
|
|
3401
|
-
var
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
const
|
|
3405
|
-
|
|
3406
|
-
let
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
if (
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
}
|
|
3414
|
-
if (isRecursive) {
|
|
3415
|
-
return result;
|
|
3416
|
-
}
|
|
3417
|
-
try {
|
|
3418
|
-
resolvedSchema = findSchemaDefinition(ref, rootSchema);
|
|
3419
|
-
} catch {
|
|
3420
|
-
resolvedSchema = currentSchema;
|
|
3421
|
-
}
|
|
3546
|
+
var import_isEmpty7 = __toESM(require("lodash/isEmpty"), 1);
|
|
3547
|
+
function resolveUiSchema(schema, localUiSchema, registry) {
|
|
3548
|
+
const ref = schema[RJSF_REF_KEY] ?? schema[REF_KEY];
|
|
3549
|
+
const definitions = registry.uiSchemaDefinitions;
|
|
3550
|
+
const definitionUiSchema = ref && definitions ? definitions[ref] : void 0;
|
|
3551
|
+
let result;
|
|
3552
|
+
if (!definitionUiSchema) {
|
|
3553
|
+
result = localUiSchema || {};
|
|
3554
|
+
} else if (!localUiSchema || (0, import_isEmpty7.default)(localUiSchema)) {
|
|
3555
|
+
result = { ...definitionUiSchema };
|
|
3556
|
+
} else {
|
|
3557
|
+
result = mergeObjects(definitionUiSchema, localUiSchema);
|
|
3422
3558
|
}
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3559
|
+
if (definitions) {
|
|
3560
|
+
let resolvedSchema = schema;
|
|
3561
|
+
if (ref && schema[REF_KEY] && !schema[RJSF_REF_KEY]) {
|
|
3562
|
+
try {
|
|
3563
|
+
resolvedSchema = findSchemaDefinition(ref, registry.rootSchema);
|
|
3564
|
+
} catch (e) {
|
|
3565
|
+
console.warn("could not resolve $ref in resolveUiSchema:\n", e);
|
|
3566
|
+
return result;
|
|
3430
3567
|
}
|
|
3431
3568
|
}
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
const currentUiSchema = result[keyword];
|
|
3437
|
-
if (typeof currentUiSchema !== "function") {
|
|
3438
|
-
const subUiSchema = currentUiSchema || {};
|
|
3439
|
-
const expanded = expandUiSchemaDefinitions(subSchema, subUiSchema, registry, new Set(visited));
|
|
3440
|
-
if (Object.keys(expanded).length > 0) {
|
|
3441
|
-
result[keyword] = expanded;
|
|
3442
|
-
}
|
|
3569
|
+
for (const keyword of [ONE_OF_KEY, ANY_OF_KEY]) {
|
|
3570
|
+
const schemaOptions = resolvedSchema[keyword];
|
|
3571
|
+
if (!Array.isArray(schemaOptions) || schemaOptions.length === 0) {
|
|
3572
|
+
continue;
|
|
3443
3573
|
}
|
|
3444
|
-
}
|
|
3445
|
-
}
|
|
3446
|
-
for (const keyword of ARRAY_KEYWORDS) {
|
|
3447
|
-
const schemaOptions = resolvedSchema[keyword];
|
|
3448
|
-
if (Array.isArray(schemaOptions) && schemaOptions.length > 0) {
|
|
3449
3574
|
const currentUiSchemaArray = result[keyword];
|
|
3450
3575
|
const uiSchemaArray = Array.isArray(currentUiSchemaArray) ? [...currentUiSchemaArray] : [];
|
|
3451
3576
|
let hasExpanded = false;
|
|
3452
3577
|
for (let i = 0; i < schemaOptions.length; i++) {
|
|
3453
|
-
const
|
|
3454
|
-
const
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
uiSchemaArray[i] =
|
|
3578
|
+
const option = schemaOptions[i];
|
|
3579
|
+
const optionRef = option?.[RJSF_REF_KEY] ?? option?.[REF_KEY];
|
|
3580
|
+
if (optionRef && optionRef in definitions) {
|
|
3581
|
+
const optionUiSchema = uiSchemaArray[i] || {};
|
|
3582
|
+
uiSchemaArray[i] = mergeObjects(definitions[optionRef], optionUiSchema);
|
|
3458
3583
|
hasExpanded = true;
|
|
3459
3584
|
}
|
|
3460
3585
|
}
|
|
@@ -3465,17 +3590,6 @@ function expandUiSchemaDefinitions(currentSchema, uiSchema, registry, visited =
|
|
|
3465
3590
|
}
|
|
3466
3591
|
return result;
|
|
3467
3592
|
}
|
|
3468
|
-
function resolveUiSchema(schema, localUiSchema, registry) {
|
|
3469
|
-
const ref = schema[RJSF_REF_KEY] ?? schema[REF_KEY];
|
|
3470
|
-
const definitionUiSchema = ref ? registry.uiSchemaDefinitions?.[ref] : void 0;
|
|
3471
|
-
if (!definitionUiSchema) {
|
|
3472
|
-
return localUiSchema || {};
|
|
3473
|
-
}
|
|
3474
|
-
if (!localUiSchema || Object.keys(localUiSchema).length === 0) {
|
|
3475
|
-
return { ...definitionUiSchema };
|
|
3476
|
-
}
|
|
3477
|
-
return mergeObjects(definitionUiSchema, localUiSchema);
|
|
3478
|
-
}
|
|
3479
3593
|
|
|
3480
3594
|
// src/schemaRequiresTrueValue.ts
|
|
3481
3595
|
function schemaRequiresTrueValue(schema) {
|
|
@@ -3842,7 +3956,7 @@ function utcToLocal(jsonDate) {
|
|
|
3842
3956
|
}
|
|
3843
3957
|
|
|
3844
3958
|
// src/validationDataMerge.ts
|
|
3845
|
-
var
|
|
3959
|
+
var import_isEmpty8 = __toESM(require("lodash/isEmpty"), 1);
|
|
3846
3960
|
function validationDataMerge(validationData, additionalErrorSchema, preventDuplicates = false) {
|
|
3847
3961
|
if (!additionalErrorSchema) {
|
|
3848
3962
|
return validationData;
|
|
@@ -3850,7 +3964,7 @@ function validationDataMerge(validationData, additionalErrorSchema, preventDupli
|
|
|
3850
3964
|
const { errors: oldErrors, errorSchema: oldErrorSchema } = validationData;
|
|
3851
3965
|
let errors = toErrorList(additionalErrorSchema);
|
|
3852
3966
|
let errorSchema = additionalErrorSchema;
|
|
3853
|
-
if (!(0,
|
|
3967
|
+
if (!(0, import_isEmpty8.default)(oldErrorSchema)) {
|
|
3854
3968
|
errorSchema = mergeObjects(
|
|
3855
3969
|
oldErrorSchema,
|
|
3856
3970
|
additionalErrorSchema,
|