mirror of
https://github.com/angular/angular.git
synced 2026-11-23 07:05:14 -05:00
`FlatTreeControl` from `@angular/cdk/tree` and `MatTreeFlattener` from `@angular/material/tree` are deprecated in favor of the tree's `levelAccessor`/`childrenAccessor` APIs. The component tree (directive forest) isn't rendered with a CDK tree but as a flat list in a virtual scroll viewport. It only used `FlatTreeControl` to track which nodes are expanded, and `MatTreeFlattener` to flatten the forest and compute the visible nodes. Replace them with: - An `ExpansionModel` that tracks expanded nodes with a `SelectionModel`, like `FlatTreeControl` did internally, and exposes the `expand`, `collapse`, `toggle`, `isExpanded` and `changed` members used by devtools. - Local helpers in `ComponentDataSource` that flatten the forest in depth-first order and return the nodes whose ancestors are all expanded, matching the previous behavior. Also add a spec covering which nodes are visible as nodes are expanded and collapsed.