mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 19:12:50 +00:00
fix: update conditional requirement validation to allow expressions using anyOf without a field
This commit is contained in:
@@ -94,10 +94,16 @@ export function DocumentRequirementEditorDrawer({
|
||||
return;
|
||||
}
|
||||
if (!draft.name.en?.trim()) return;
|
||||
// A condition is either a single-field check or an anyOf list — the CoP
|
||||
// watch_rating_certificate requirement is seeded with anyOf and no field.
|
||||
const hasCondition =
|
||||
Boolean(draft.conditionExpression?.field) ||
|
||||
Boolean(draft.conditionExpression?.anyOf?.length);
|
||||
if (draft.mode === 'CONDITIONAL' && !hasCondition) {
|
||||
if (
|
||||
draft.mode === 'CONDITIONAL' &&
|
||||
!hasCondition &&
|
||||
!draft.conditionExpression?.anyOf?.length
|
||||
) {
|
||||
setKeyError(t('certReq.doc.conditionRequired', 'A conditional requirement needs a condition'));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user