[TLC-1202] Disable fields hidden by type bind, so they are not validated

This commit is contained in:
Kim Shepherd
2025-09-18 14:39:48 +02:00
parent 80865efc2b
commit c47d988bca
2 changed files with 31 additions and 13 deletions

View File

@@ -13,6 +13,8 @@ import {
DynamicFormControlModel,
DynamicFormControlRelation,
DynamicFormRelationService,
MATCH_DISABLED,
MATCH_ENABLED,
MATCH_VISIBLE,
OR_OPERATOR,
} from '@ng-dynamic-forms/core';
@@ -228,11 +230,18 @@ export class DsDynamicTypeBindRelationService {
value: value,
});
});
return [{
return [
{
match: MATCH_ENABLED,
operator: OR_OPERATOR,
when: bindValues,
},
{
match: MATCH_VISIBLE,
operator: OR_OPERATOR,
when: bindValues,
}];
},
];
}
}

View File

@@ -5,6 +5,8 @@ import {
import {
DynamicFormControlLayout,
DynamicFormControlRelation,
MATCH_DISABLED,
MATCH_ENABLED,
MATCH_VISIBLE,
OR_OPERATOR,
} from '@ng-dynamic-forms/core';
@@ -381,11 +383,18 @@ export abstract class FieldParser {
// Example: Field [x] will be VISIBLE if item type = book OR item type = book_part
//
// The opposing match value will be the dc.type for the workspace item
return [{
return [
{
match: MATCH_ENABLED,
operator: OR_OPERATOR,
when: bindValues,
},
{
match: MATCH_VISIBLE,
operator: OR_OPERATOR,
when: bindValues,
}];
},
];
}
protected hasRegex() {