/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/cdk/tree/control/tree-control.ts
67 строк
2 KB
Andrew Seguin
refactor: use relative imports within module npm packages (#30588)
12 мар 2025, 00:40
Не верифицирован
12 мар 2025, 00:40
626a465
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {SelectionModel} from '../../collections'; import {Observable} from 'rxjs'; /** * Tree control interface. User can implement TreeControl to expand/collapse dataNodes in the tree. * The CDKTree will use this TreeControl to expand/collapse a node. * User can also use it outside the `<cdk-tree>` to control the expansion status of the tree. * * @deprecated Use one of levelAccessor or childrenAccessor instead. To be removed in a future version. * @breaking-change 21.0.0 */ export interface TreeControl<T, K = T> { /** The saved tree nodes data for `expandAll` action. */ dataNodes: T[]; /** The expansion model */ expansionModel: SelectionModel<K>; /** Whether the data node is expanded or collapsed. Return true if it's expanded. */ isExpanded(dataNode: T): boolean; /** Get all descendants of a data node */ getDescendants(dataNode: T): any[]; /** Expand or collapse data node */ toggle(dataNode: T): void; /** Expand one data node */ expand(dataNode: T): void; /** Collapse one data node */ collapse(dataNode: T): void; /** Expand all the dataNodes in the tree */ expandAll(): void; /** Collapse all the dataNodes in the tree */ collapseAll(): void; /** Toggle a data node by expand/collapse it and all its descendants */ toggleDescendants(dataNode: T): void; /** Expand a data node and all its descendants */ expandDescendants(dataNode: T): void; /** Collapse a data node and all its descendants */ collapseDescendants(dataNode: T): void; /** Get depth of a given data node, return the level number. This is for flat tree node. */ readonly getLevel: (dataNode: T) => number; /** * Whether the data node is expandable. Returns true if expandable. * This is for flat tree node. */ readonly isExpandable: (dataNode: T) => boolean; /** Gets a stream that emits whenever the given data node's children change. */ readonly getChildren: (dataNode: T) => Observable<T[]> | T[] | undefined | null; }