feat(#13): Show form elements depending on other form element values
This commit is contained in:
@@ -13,10 +13,17 @@ export function useApplicationFormValidator() {
|
||||
return Object.values(ComplianceStatus)[highestComplianceNumber] ?? ComplianceStatus.NonCritical
|
||||
}
|
||||
|
||||
function validateFormElements(formElements: FormElementDto[]): Map<FormElementId, ComplianceStatus> {
|
||||
function validateFormElements(
|
||||
formElements: FormElementDto[],
|
||||
visibilityMap?: Map<string, boolean>
|
||||
): Map<FormElementId, ComplianceStatus> {
|
||||
formElementComplianceMap.value.clear()
|
||||
|
||||
formElements.forEach((formElement) => {
|
||||
if (visibilityMap && visibilityMap.get(formElement.id) === false) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!complianceCheckableElementTypes.includes(formElement.type)) return
|
||||
|
||||
// Reset any previously set compliance status when all options are false
|
||||
|
||||
Reference in New Issue
Block a user