source: trip-planner-front/node_modules/@angular/cdk/tree/control/tree-control.d.ts@ 6fe77af

Last change on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { SelectionModel } from '@angular/cdk/collections';
9import { Observable } from 'rxjs';
10/**
11 * Tree control interface. User can implement TreeControl to expand/collapse dataNodes in the tree.
12 * The CDKTree will use this TreeControl to expand/collapse a node.
13 * User can also use it outside the `<cdk-tree>` to control the expansion status of the tree.
14 */
15export interface TreeControl<T, K = T> {
16 /** The saved tree nodes data for `expandAll` action. */
17 dataNodes: T[];
18 /** The expansion model */
19 expansionModel: SelectionModel<K>;
20 /** Whether the data node is expanded or collapsed. Return true if it's expanded. */
21 isExpanded(dataNode: T): boolean;
22 /** Get all descendants of a data node */
23 getDescendants(dataNode: T): any[];
24 /** Expand or collapse data node */
25 toggle(dataNode: T): void;
26 /** Expand one data node */
27 expand(dataNode: T): void;
28 /** Collapse one data node */
29 collapse(dataNode: T): void;
30 /** Expand all the dataNodes in the tree */
31 expandAll(): void;
32 /** Collapse all the dataNodes in the tree */
33 collapseAll(): void;
34 /** Toggle a data node by expand/collapse it and all its descendants */
35 toggleDescendants(dataNode: T): void;
36 /** Expand a data node and all its descendants */
37 expandDescendants(dataNode: T): void;
38 /** Collapse a data node and all its descendants */
39 collapseDescendants(dataNode: T): void;
40 /** Get depth of a given data node, return the level number. This is for flat tree node. */
41 readonly getLevel: (dataNode: T) => number;
42 /**
43 * Whether the data node is expandable. Returns true if expandable.
44 * This is for flat tree node.
45 */
46 readonly isExpandable: (dataNode: T) => boolean;
47 /** Gets a stream that emits whenever the given data node's children change. */
48 readonly getChildren: (dataNode: T) => Observable<T[]> | T[] | undefined | null;
49}
Note: See TracBrowser for help on using the repository browser.