mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-09 03:38:18 +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;
|
return;
|
||||||
}
|
}
|
||||||
if (!draft.name.en?.trim()) 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 =
|
const hasCondition =
|
||||||
Boolean(draft.conditionExpression?.field) ||
|
Boolean(draft.conditionExpression?.field) ||
|
||||||
Boolean(draft.conditionExpression?.anyOf?.length);
|
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'));
|
setKeyError(t('certReq.doc.conditionRequired', 'A conditional requirement needs a condition'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user