Gets all nested descendants of a given node.
(dataNode: T)
| 902 | |
| 903 | /** Gets all nested descendants of a given node. */ |
| 904 | private _getDescendants(dataNode: T): Observable<T[]> { |
| 905 | if (this.treeControl) { |
| 906 | return observableOf(this.treeControl.getDescendants(dataNode)); |
| 907 | } |
| 908 | if (this.levelAccessor) { |
| 909 | const results = this._findChildrenByLevel( |
| 910 | this.levelAccessor, |
| 911 | this._flattenedNodes.value, |
| 912 | dataNode, |
| 913 | Infinity, |
| 914 | ); |
| 915 | return observableOf(results); |
| 916 | } |
| 917 | if (this.childrenAccessor) { |
| 918 | return this._getAllChildrenRecursively(dataNode).pipe( |
| 919 | reduce((allChildren: T[], nextChildren) => { |
| 920 | allChildren.push(...nextChildren); |
| 921 | return allChildren; |
| 922 | }, []), |
| 923 | ); |
| 924 | } |
| 925 | throw getTreeControlMissingError(); |
| 926 | } |
| 927 | |
| 928 | /** |
| 929 | * Gets all children and sub-children of the provided node. |
no test coverage detected