small reapply validator fix

This commit is contained in:
amentis 2024-02-09 16:16:46 +02:00
parent 1a6e776b41
commit 075573ffaf
2 changed files with 11 additions and 10 deletions

View File

@ -389,7 +389,7 @@ export class DescriptionPropertyDefinitionFieldSetItemEditorModel implements Des
const control = fields?.get(key);
DescriptionFieldEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup,
rootPath: `${rootPath}fields.`,
rootPath: `${rootPath}fields[${key}].`,
validationErrorModel: validationErrorModel
})
});

View File

@ -234,15 +234,16 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist {
}): void {
const { formGroup, rootPath, validationErrorModel } = params;
const context = DmpPropertiesEditorModel.createValidationContext({
rootPath,
validationErrorModel
});
['dmpBlueprintValues'].forEach(keyField => {
const control = formGroup?.get(keyField);
control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators);
const dmpBlueprintValues = formGroup?.get('dmpBlueprintValues') as UntypedFormGroup;
const keys = Object.keys(dmpBlueprintValues.value as Object);
keys.forEach((key) => {
const control = dmpBlueprintValues?.get(key);
DmpBlueprintValueEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup,
rootPath: `${rootPath}dmpBlueprintValues[${key}].`,
validationErrorModel: validationErrorModel
})
});
(formGroup.get('contacts') as FormArray).controls?.forEach(