-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fc39ee
commit 25977c8
Showing
6 changed files
with
256 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
projects/ngx-formentry/src/form-entry/value-adapters/diagnosis-helper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ArrayNode, LeafNode } from '../form-factory/form-node'; | ||
|
||
export function processFormNode(formNode, key, formDiagnosisNodes) { | ||
if (!formNode.children) return; | ||
|
||
const { children } = formNode; | ||
|
||
// Condition for diagnosisGroup nodes | ||
const childNodeForKey = children[key]; | ||
if ( | ||
childNodeForKey instanceof ArrayNode && | ||
childNodeForKey.question.extras.type === 'diagnosisGroup' | ||
) { | ||
return [...Object.values(childNodeForKey.children)]; | ||
} | ||
|
||
// Condition for diagnosis nodes | ||
Object.values(children).forEach((child: LeafNode) => { | ||
const { question, nodeIndex } = child; | ||
if ( | ||
question.extras?.type === 'diagnosis' && | ||
!formDiagnosisNodes.some((x) => x.nodeIndex === nodeIndex) | ||
) { | ||
return child; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters