@angular/cdk 18.1.1 → 18.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/a11y/index.d.ts +283 -2
  2. package/coercion/private/index.d.ts +9 -0
  3. package/drag-drop/index.d.ts +12 -1
  4. package/esm2022/a11y/key-manager/list-key-manager.mjs +18 -38
  5. package/esm2022/a11y/key-manager/noop-tree-key-manager.mjs +94 -0
  6. package/esm2022/a11y/key-manager/tree-key-manager-strategy.mjs +9 -0
  7. package/esm2022/a11y/key-manager/tree-key-manager.mjs +345 -0
  8. package/esm2022/a11y/key-manager/typeahead.mjs +91 -0
  9. package/esm2022/a11y/public-api.mjs +4 -1
  10. package/esm2022/coercion/private/index.mjs +9 -0
  11. package/esm2022/coercion/private/observable.mjs +19 -0
  12. package/esm2022/coercion/private/private_public_index.mjs +5 -0
  13. package/esm2022/drag-drop/directives/drag.mjs +16 -3
  14. package/esm2022/drag-drop/drag-ref.mjs +8 -2
  15. package/esm2022/drag-drop/sorting/single-axis-sort-strategy.mjs +4 -3
  16. package/esm2022/tree/control/base-tree-control.mjs +7 -2
  17. package/esm2022/tree/control/flat-tree-control.mjs +8 -2
  18. package/esm2022/tree/control/nested-tree-control.mjs +11 -2
  19. package/esm2022/tree/control/tree-control.mjs +1 -1
  20. package/esm2022/tree/nested-node.mjs +6 -15
  21. package/esm2022/tree/padding.mjs +2 -4
  22. package/esm2022/tree/toggle.mjs +15 -8
  23. package/esm2022/tree/tree-errors.mjs +7 -6
  24. package/esm2022/tree/tree.mjs +817 -63
  25. package/esm2022/version.mjs +1 -1
  26. package/fesm2022/a11y.mjs +520 -40
  27. package/fesm2022/a11y.mjs.map +1 -1
  28. package/fesm2022/cdk.mjs +1 -1
  29. package/fesm2022/cdk.mjs.map +1 -1
  30. package/fesm2022/coercion/private.mjs +19 -0
  31. package/fesm2022/coercion/private.mjs.map +1 -0
  32. package/fesm2022/drag-drop.mjs +25 -5
  33. package/fesm2022/drag-drop.mjs.map +1 -1
  34. package/fesm2022/tree.mjs +858 -94
  35. package/fesm2022/tree.mjs.map +1 -1
  36. package/package.json +9 -3
  37. package/schematics/ng-add/index.js +1 -1
  38. package/schematics/ng-add/index.mjs +1 -1
  39. package/tree/index.d.ts +304 -25
package/tree/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import { AfterContentChecked } from '@angular/core';
2
2
  import { AfterContentInit } from '@angular/core';
3
+ import { AfterViewInit } from '@angular/core';
3
4
  import { BehaviorSubject } from 'rxjs';
4
5
  import { ChangeDetectorRef } from '@angular/core';
5
6
  import { CollectionViewer } from '@angular/cdk/collections';
6
7
  import { DataSource } from '@angular/cdk/collections';
7
8
  import { Directionality } from '@angular/cdk/bidi';
8
9
  import { ElementRef } from '@angular/core';
9
- import { FocusableOption } from '@angular/cdk/a11y';
10
+ import { EventEmitter } from '@angular/core';
10
11
  import * as i0 from '@angular/core';
11
12
  import { InjectionToken } from '@angular/core';
12
13
  import { IterableDiffer } from '@angular/core';
@@ -19,9 +20,16 @@ import { SelectionModel } from '@angular/cdk/collections';
19
20
  import { Subject } from 'rxjs';
20
21
  import { TemplateRef } from '@angular/core';
21
22
  import { TrackByFunction } from '@angular/core';
23
+ import { TreeKeyManagerItem } from '@angular/cdk/a11y';
24
+ import { TreeKeyManagerStrategy } from '@angular/cdk/a11y';
22
25
  import { ViewContainerRef } from '@angular/core';
23
26
 
24
- /** Base tree control. It has basic toggle/expand/collapse operations on a single data node. */
27
+ /**
28
+ * Base tree control. It has basic toggle/expand/collapse operations on a single data node.
29
+ *
30
+ * @deprecated Use one of levelAccessor or childrenAccessor. To be removed in a future version.
31
+ * @breaking-change 21.0.0
32
+ */
25
33
  export declare abstract class BaseTreeControl<T, K = T> implements TreeControl<T, K> {
26
34
  /** Gets a list of descendent data nodes of a subtree rooted at given data node recursively. */
27
35
  abstract getDescendants(dataNode: T): T[];
@@ -105,9 +113,10 @@ export declare class CdkNestedTreeNode<T, K = T> extends CdkTreeNode<T, K> imple
105
113
  * CDK tree component that connects with a data source to retrieve data of type `T` and renders
106
114
  * dataNodes with hierarchy. Updates the dataNodes when new data is provided by the data source.
107
115
  */
108
- export declare class CdkTree<T, K = T> implements AfterContentChecked, CollectionViewer, OnDestroy, OnInit {
116
+ export declare class CdkTree<T, K = T> implements AfterContentChecked, AfterContentInit, AfterViewInit, CollectionViewer, OnDestroy, OnInit {
109
117
  private _differs;
110
118
  private _changeDetectorRef;
119
+ private _dir;
111
120
  /** Subject that emits when the component has been destroyed. */
112
121
  private readonly _onDestroy;
113
122
  /** Differ used to find the changes in the data provided by the data source. */
@@ -118,6 +127,17 @@ export declare class CdkTree<T, K = T> implements AfterContentChecked, Collectio
118
127
  private _dataSubscription;
119
128
  /** Level of nodes */
120
129
  private _levels;
130
+ /** The immediate parents for a node. This is `null` if there is no parent. */
131
+ private _parents;
132
+ /**
133
+ * Nodes grouped into each set, which is a list of nodes displayed together in the DOM.
134
+ *
135
+ * Lookup key is the parent of a set. Root nodes have key of null.
136
+ *
137
+ * Values is a 'set' of tree nodes. Each tree node maps to a treeitem element. Sets are in the
138
+ * order that it is rendered. Each set maps directly to aria-posinset and aria-setsize attributes.
139
+ */
140
+ private _ariaSets;
121
141
  /**
122
142
  * Provides a stream containing the latest data array to render. Influenced by the tree's
123
143
  * stream of view window (what dataNodes are currently on screen).
@@ -126,8 +146,28 @@ export declare class CdkTree<T, K = T> implements AfterContentChecked, Collectio
126
146
  get dataSource(): DataSource<T> | Observable<T[]> | T[];
127
147
  set dataSource(dataSource: DataSource<T> | Observable<T[]> | T[]);
128
148
  private _dataSource;
129
- /** The tree controller */
130
- treeControl: TreeControl<T, K>;
149
+ /**
150
+ * The tree controller
151
+ *
152
+ * @deprecated Use one of `levelAccessor` or `childrenAccessor` instead. To be removed in a
153
+ * future version.
154
+ * @breaking-change 21.0.0
155
+ */
156
+ treeControl?: TreeControl<T, K>;
157
+ /**
158
+ * Given a data node, determines what tree level the node is at.
159
+ *
160
+ * One of levelAccessor or childrenAccessor must be specified, not both.
161
+ * This is enforced at run-time.
162
+ */
163
+ levelAccessor?: (dataNode: T) => number;
164
+ /**
165
+ * Given a data node, determines what the children of that node are.
166
+ *
167
+ * One of levelAccessor or childrenAccessor must be specified, not both.
168
+ * This is enforced at run-time.
169
+ */
170
+ childrenAccessor?: (dataNode: T) => T[] | Observable<T[]>;
131
171
  /**
132
172
  * Tracking function that will be used to check the differences in data changes. Used similarly
133
173
  * to `ngFor` `trackBy` function. Optimize node operations by identifying a node based on its data
@@ -135,6 +175,10 @@ export declare class CdkTree<T, K = T> implements AfterContentChecked, Collectio
135
175
  * Accepts a function that takes two parameters, `index` and `item`.
136
176
  */
137
177
  trackBy: TrackByFunction<T>;
178
+ /**
179
+ * Given a data node, determines the key by which we determine whether or not this node is expanded.
180
+ */
181
+ expansionKey?: (dataNode: T) => K;
138
182
  _nodeOutlet: CdkTreeNodeOutlet;
139
183
  /** The tree node template for the tree */
140
184
  _nodeDefs: QueryList<CdkTreeNodeDef<T>>;
@@ -146,18 +190,58 @@ export declare class CdkTree<T, K = T> implements AfterContentChecked, Collectio
146
190
  start: number;
147
191
  end: number;
148
192
  }>;
149
- constructor(_differs: IterableDiffers, _changeDetectorRef: ChangeDetectorRef);
150
- ngOnInit(): void;
151
- ngOnDestroy(): void;
193
+ /** Keep track of which nodes are expanded. */
194
+ private _expansionModel?;
195
+ /**
196
+ * Maintain a synchronous cache of flattened data nodes. This will only be
197
+ * populated after initial render, and in certain cases, will be delayed due to
198
+ * relying on Observable `getChildren` calls.
199
+ */
200
+ private _flattenedNodes;
201
+ /** The automatically determined node type for the tree. */
202
+ private _nodeType;
203
+ /** The mapping between data and the node that is rendered. */
204
+ private _nodes;
205
+ /**
206
+ * Synchronous cache of nodes for the `TreeKeyManager`. This is separate
207
+ * from `_flattenedNodes` so they can be independently updated at different
208
+ * times.
209
+ */
210
+ private _keyManagerNodes;
211
+ private _keyManagerFactory;
212
+ /** The key manager for this tree. Handles focus and activation based on user keyboard input. */
213
+ _keyManager: TreeKeyManagerStrategy<CdkTreeNode<T, K>>;
214
+ private _viewInit;
215
+ constructor(_differs: IterableDiffers, _changeDetectorRef: ChangeDetectorRef, _dir: Directionality);
216
+ ngAfterContentInit(): void;
152
217
  ngAfterContentChecked(): void;
218
+ ngOnDestroy(): void;
219
+ ngOnInit(): void;
220
+ ngAfterViewInit(): void;
221
+ private _updateDefaultNodeDefinition;
222
+ /**
223
+ * Sets the node type for the tree, if it hasn't been set yet.
224
+ *
225
+ * This will be called by the first node that's rendered in order for the tree
226
+ * to determine what data transformations are required.
227
+ */
228
+ _setNodeTypeIfUnset(nodeType: 'flat' | 'nested'): void;
153
229
  /**
154
230
  * Switch to the provided data source by resetting the data and unsubscribing from the current
155
231
  * render change subscription if one exists. If the data source is null, interpret this by
156
232
  * clearing the node outlet. Otherwise start listening for new data.
157
233
  */
158
234
  private _switchDataSource;
235
+ _getExpansionModel(): SelectionModel<K>;
159
236
  /** Set up a subscription for the data provided by the data source. */
160
- private _observeRenderChanges;
237
+ private _subscribeToDataChanges;
238
+ /** Given an Observable containing a stream of the raw data, returns an Observable containing the RenderingData */
239
+ private _getRenderData;
240
+ private _renderDataChanges;
241
+ private _emitExpansionChanges;
242
+ private _initializeKeyManager;
243
+ private _initializeDataDiffer;
244
+ private _checkTreeControlUsage;
161
245
  /** Check for changes made in the data and render each change (node added/removed/moved). */
162
246
  renderNodeChanges(data: readonly T[], dataDiffer?: IterableDiffer<T>, viewContainer?: ViewContainerRef, parentData?: T): void;
163
247
  /**
@@ -172,8 +256,116 @@ export declare class CdkTree<T, K = T> implements AfterContentChecked, Collectio
172
256
  * within the data node view container.
173
257
  */
174
258
  insertNode(nodeData: T, index: number, viewContainer?: ViewContainerRef, parentData?: T): void;
259
+ /** Whether the data node is expanded or collapsed. Returns true if it's expanded. */
260
+ isExpanded(dataNode: T): boolean;
261
+ /** If the data node is currently expanded, collapse it. Otherwise, expand it. */
262
+ toggle(dataNode: T): void;
263
+ /** Expand the data node. If it is already expanded, does nothing. */
264
+ expand(dataNode: T): void;
265
+ /** Collapse the data node. If it is already collapsed, does nothing. */
266
+ collapse(dataNode: T): void;
267
+ /**
268
+ * If the data node is currently expanded, collapse it and all its descendants.
269
+ * Otherwise, expand it and all its descendants.
270
+ */
271
+ toggleDescendants(dataNode: T): void;
272
+ /**
273
+ * Expand the data node and all its descendants. If they are already expanded, does nothing.
274
+ */
275
+ expandDescendants(dataNode: T): void;
276
+ /** Collapse the data node and all its descendants. If it is already collapsed, does nothing. */
277
+ collapseDescendants(dataNode: T): void;
278
+ /** Expands all data nodes in the tree. */
279
+ expandAll(): void;
280
+ /** Collapse all data nodes in the tree. */
281
+ collapseAll(): void;
282
+ /** Level accessor, used for compatibility between the old Tree and new Tree */
283
+ _getLevelAccessor(): ((dataNode: T) => number) | undefined;
284
+ /** Children accessor, used for compatibility between the old Tree and new Tree */
285
+ _getChildrenAccessor(): ((dataNode: T) => Observable<T[]> | T[] | undefined | null) | undefined;
286
+ /**
287
+ * Gets the direct children of a node; used for compatibility between the old tree and the
288
+ * new tree.
289
+ */
290
+ _getDirectChildren(dataNode: T): Observable<T[]>;
291
+ /**
292
+ * Given the list of flattened nodes, the level accessor, and the level range within
293
+ * which to consider children, finds the children for a given node.
294
+ *
295
+ * For example, for direct children, `levelDelta` would be 1. For all descendants,
296
+ * `levelDelta` would be Infinity.
297
+ */
298
+ private _findChildrenByLevel;
299
+ /**
300
+ * Adds the specified node component to the tree's internal registry.
301
+ *
302
+ * This primarily facilitates keyboard navigation.
303
+ */
304
+ _registerNode(node: CdkTreeNode<T, K>): void;
305
+ /** Removes the specified node component from the tree's internal registry. */
306
+ _unregisterNode(node: CdkTreeNode<T, K>): void;
307
+ /**
308
+ * For the given node, determine the level where this node appears in the tree.
309
+ *
310
+ * This is intended to be used for `aria-level` but is 0-indexed.
311
+ */
312
+ _getLevel(node: T): number | undefined;
313
+ /**
314
+ * For the given node, determine the size of the parent's child set.
315
+ *
316
+ * This is intended to be used for `aria-setsize`.
317
+ */
318
+ _getSetSize(dataNode: T): number;
319
+ /**
320
+ * For the given node, determine the index (starting from 1) of the node in its parent's child set.
321
+ *
322
+ * This is intended to be used for `aria-posinset`.
323
+ */
324
+ _getPositionInSet(dataNode: T): number;
325
+ /** Given a CdkTreeNode, gets the node that renders that node's parent's data. */
326
+ _getNodeParent(node: CdkTreeNode<T, K>): CdkTreeNode<T, K> | null | undefined;
327
+ /** Given a CdkTreeNode, gets the nodes that renders that node's child data. */
328
+ _getNodeChildren(node: CdkTreeNode<T, K>): Observable<CdkTreeNode<T, K>[]>;
329
+ /** `keydown` event handler; this just passes the event to the `TreeKeyManager`. */
330
+ _sendKeydownToKeyManager(event: KeyboardEvent): void;
331
+ /** Gets all nested descendants of a given node. */
332
+ private _getDescendants;
333
+ /**
334
+ * Gets all children and sub-children of the provided node.
335
+ *
336
+ * This will emit multiple times, in the order that the children will appear
337
+ * in the tree, and can be combined with a `reduce` operator.
338
+ */
339
+ private _getAllChildrenRecursively;
340
+ private _getExpansionKey;
341
+ private _getAriaSet;
342
+ /**
343
+ * Finds the parent for the given node. If this is a root node, this
344
+ * returns null. If we're unable to determine the parent, for example,
345
+ * if we don't have cached node data, this returns undefined.
346
+ */
347
+ private _findParentForNode;
348
+ /**
349
+ * Given a set of root nodes and the current node level, flattens any nested
350
+ * nodes into a single array.
351
+ *
352
+ * If any nodes are not expanded, then their children will not be added into the array.
353
+ * This will still traverse all nested children in order to build up our internal data
354
+ * models, but will not include them in the returned array.
355
+ */
356
+ private _flattenNestedNodesWithExpansion;
357
+ /**
358
+ * Converts children for certain tree configurations.
359
+ *
360
+ * This also computes parent, level, and group data.
361
+ */
362
+ private _computeRenderingData;
363
+ private _updateCachedData;
364
+ private _updateKeyManagerItems;
365
+ /** Traverse the flattened node data and compute parents, levels, and group data. */
366
+ private _calculateParents;
175
367
  static ɵfac: i0.ɵɵFactoryDeclaration<CdkTree<any, any>, never>;
176
- static ɵcmp: i0.ɵɵComponentDeclaration<CdkTree<any, any>, "cdk-tree", ["cdkTree"], { "dataSource": { "alias": "dataSource"; "required": false; }; "treeControl": { "alias": "treeControl"; "required": false; }; "trackBy": { "alias": "trackBy"; "required": false; }; }, {}, ["_nodeDefs"], never, true, never>;
368
+ static ɵcmp: i0.ɵɵComponentDeclaration<CdkTree<any, any>, "cdk-tree", ["cdkTree"], { "dataSource": { "alias": "dataSource"; "required": false; }; "treeControl": { "alias": "treeControl"; "required": false; }; "levelAccessor": { "alias": "levelAccessor"; "required": false; }; "childrenAccessor": { "alias": "childrenAccessor"; "required": false; }; "trackBy": { "alias": "trackBy"; "required": false; }; "expansionKey": { "alias": "expansionKey"; "required": false; }; }, {}, ["_nodeDefs"], never, true, never>;
177
369
  }
178
370
 
179
371
  export declare class CdkTreeModule {
@@ -185,17 +377,44 @@ export declare class CdkTreeModule {
185
377
  /**
186
378
  * Tree node for CdkTree. It contains the data in the tree node.
187
379
  */
188
- export declare class CdkTreeNode<T, K = T> implements FocusableOption, OnDestroy, OnInit {
380
+ export declare class CdkTreeNode<T, K = T> implements OnDestroy, OnInit, TreeKeyManagerItem {
189
381
  protected _elementRef: ElementRef<HTMLElement>;
190
382
  protected _tree: CdkTree<T, K>;
383
+ protected _tabindex: number | null;
191
384
  /**
192
385
  * The role of the tree node.
193
- * @deprecated The correct role is 'treeitem', 'group' should not be used. This input will be
194
- * removed in a future version.
195
- * @breaking-change 12.0.0 Remove this input
386
+ *
387
+ * @deprecated This will be ignored; the tree will automatically determine the appropriate role
388
+ * for tree node. This input will be removed in a future version.
389
+ * @breaking-change 21.0.0
196
390
  */
197
391
  get role(): 'treeitem' | 'group';
198
392
  set role(_role: 'treeitem' | 'group');
393
+ /**
394
+ * Whether or not this node is expandable.
395
+ *
396
+ * If not using `FlatTreeControl`, or if `isExpandable` is not provided to
397
+ * `NestedTreeControl`, this should be provided for correct node a11y.
398
+ */
399
+ get isExpandable(): boolean;
400
+ set isExpandable(isExpandable: boolean);
401
+ get isExpanded(): boolean;
402
+ set isExpanded(isExpanded: boolean);
403
+ /**
404
+ * Whether or not this node is disabled. If it's disabled, then the user won't be able to focus
405
+ * or activate this node.
406
+ */
407
+ isDisabled: boolean;
408
+ /**
409
+ * The text used to locate this item during typeahead. If not specified, the `textContent` will
410
+ * will be used.
411
+ */
412
+ typeaheadLabel: string | null;
413
+ getLabel(): string;
414
+ /** This emits when the node has been programatically activated or activated by keyboard. */
415
+ readonly activation: EventEmitter<T>;
416
+ /** This emits when the node's expansion status has been changed. */
417
+ readonly expandedChange: EventEmitter<boolean>;
199
418
  /**
200
419
  * The most recently created `CdkTreeNode`. We save it in static variable so we can retrieve it
201
420
  * in `CdkTree` and set the data to it.
@@ -205,22 +424,64 @@ export declare class CdkTreeNode<T, K = T> implements FocusableOption, OnDestroy
205
424
  protected readonly _destroyed: Subject<void>;
206
425
  /** Emits when the node's data has changed. */
207
426
  readonly _dataChanges: Subject<void>;
427
+ private _inputIsExpandable;
428
+ /**
429
+ * Flag used to determine whether or not we should be focusing the actual element based on
430
+ * some user interaction (click or focus). On click, we don't forcibly focus the element
431
+ * since the click could trigger some other component that wants to grab its own focus
432
+ * (e.g. menu, dialog).
433
+ */
434
+ private _shouldFocus;
208
435
  private _parentNodeAriaLevel;
209
436
  /** The tree node's data. */
210
437
  get data(): T;
211
438
  set data(value: T);
212
439
  protected _data: T;
213
- get isExpanded(): boolean;
440
+ get isLeafNode(): boolean;
214
441
  get level(): number;
442
+ /** Determines if the tree node is expandable. */
443
+ _isExpandable(): boolean;
444
+ /**
445
+ * Determines the value for `aria-expanded`.
446
+ *
447
+ * For non-expandable nodes, this is `null`.
448
+ */
449
+ _getAriaExpanded(): string | null;
450
+ /**
451
+ * Determines the size of this node's parent's child set.
452
+ *
453
+ * This is intended to be used for `aria-setsize`.
454
+ */
455
+ _getSetSize(): number;
456
+ /**
457
+ * Determines the index (starting from 1) of this node in its parent's child set.
458
+ *
459
+ * This is intended to be used for `aria-posinset`.
460
+ */
461
+ _getPositionInSet(): number;
215
462
  private _changeDetectorRef;
216
463
  constructor(_elementRef: ElementRef<HTMLElement>, _tree: CdkTree<T, K>);
217
464
  ngOnInit(): void;
218
465
  ngOnDestroy(): void;
219
- /** Focuses the menu item. Implements for FocusableOption. */
466
+ getParent(): CdkTreeNode<T, K> | null;
467
+ getChildren(): CdkTreeNode<T, K>[] | Observable<CdkTreeNode<T, K>[]>;
468
+ /** Focuses this data node. Implemented for TreeKeyManagerItem. */
220
469
  focus(): void;
221
- protected _setRoleFromData(): void;
470
+ /** Defocus this data node. */
471
+ unfocus(): void;
472
+ /** Emits an activation event. Implemented for TreeKeyManagerItem. */
473
+ activate(): void;
474
+ /** Collapses this data node. Implemented for TreeKeyManagerItem. */
475
+ collapse(): void;
476
+ /** Expands this data node. Implemented for TreeKeyManagerItem. */
477
+ expand(): void;
478
+ _focusItem(): void;
479
+ _setActiveItem(): void;
480
+ _emitExpansionState(expanded: boolean): void;
222
481
  static ɵfac: i0.ɵɵFactoryDeclaration<CdkTreeNode<any, any>, never>;
223
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkTreeNode<any, any>, "cdk-tree-node", ["cdkTreeNode"], { "role": { "alias": "role"; "required": false; }; }, {}, never, never, true, never>;
482
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkTreeNode<any, any>, "cdk-tree-node", ["cdkTreeNode"], { "role": { "alias": "role"; "required": false; }; "isExpandable": { "alias": "isExpandable"; "required": false; }; "isExpanded": { "alias": "isExpanded"; "required": false; }; "isDisabled": { "alias": "isDisabled"; "required": false; }; "typeaheadLabel": { "alias": "cdkTreeNodeTypeaheadLabel"; "required": false; }; }, { "activation": "activation"; "expandedChange": "expandedChange"; }, never, never, true, never>;
483
+ static ngAcceptInputType_isExpandable: unknown;
484
+ static ngAcceptInputType_isDisabled: unknown;
224
485
  }
225
486
 
226
487
  /**
@@ -319,7 +580,7 @@ export declare class CdkTreeNodePadding<T, K = T> implements OnDestroy {
319
580
  }
320
581
 
321
582
  /**
322
- * Node toggle to expand/collapse the node.
583
+ * Node toggle to expand and collapse the node.
323
584
  */
324
585
  export declare class CdkTreeNodeToggle<T, K = T> {
325
586
  protected _tree: CdkTree<T, K>;
@@ -327,13 +588,19 @@ export declare class CdkTreeNodeToggle<T, K = T> {
327
588
  /** Whether expand/collapse the node recursively. */
328
589
  recursive: boolean;
329
590
  constructor(_tree: CdkTree<T, K>, _treeNode: CdkTreeNode<T, K>);
330
- _toggle(event: Event): void;
591
+ _toggle(): void;
331
592
  static ɵfac: i0.ɵɵFactoryDeclaration<CdkTreeNodeToggle<any, any>, never>;
332
593
  static ɵdir: i0.ɵɵDirectiveDeclaration<CdkTreeNodeToggle<any, any>, "[cdkTreeNodeToggle]", never, { "recursive": { "alias": "cdkTreeNodeToggleRecursive"; "required": false; }; }, {}, never, never, true, never>;
333
594
  static ngAcceptInputType_recursive: unknown;
334
595
  }
335
596
 
336
- /** Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. */
597
+ /**
598
+ * Flat tree control. Able to expand/collapse a subtree recursively for flattened tree.
599
+ *
600
+ * @deprecated Use one of levelAccessor or childrenAccessor instead. To be removed in a future
601
+ * version.
602
+ * @breaking-change 21.0.0
603
+ */
337
604
  export declare class FlatTreeControl<T, K = T> extends BaseTreeControl<T, K> {
338
605
  getLevel: (dataNode: T) => number;
339
606
  isExpandable: (dataNode: T) => boolean;
@@ -362,13 +629,14 @@ export declare interface FlatTreeControlOptions<T, K> {
362
629
  }
363
630
 
364
631
  /**
365
- * Returns an error to be thrown when tree control did not implement functions for flat/nested node.
632
+ * Returns an error to be thrown when there are multiple ways of specifying children or level
633
+ * provided to the tree.
366
634
  * @docs-private
367
635
  */
368
- export declare function getTreeControlFunctionsMissingError(): Error;
636
+ export declare function getMultipleTreeControlsError(): Error;
369
637
 
370
638
  /**
371
- * Returns an error to be thrown when there are tree control.
639
+ * Returns an error to be thrown when there is no tree control.
372
640
  * @docs-private
373
641
  */
374
642
  export declare function getTreeControlMissingError(): Error;
@@ -431,7 +699,13 @@ declare namespace i6 {
431
699
  }
432
700
  }
433
701
 
434
- /** Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. */
702
+ /**
703
+ * Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type.
704
+ *
705
+ * @deprecated Use one of levelAccessor or childrenAccessor instead. To be removed in a future
706
+ * version.
707
+ * @breaking-change 21.0.0
708
+ */
435
709
  export declare class NestedTreeControl<T, K = T> extends BaseTreeControl<T, K> {
436
710
  getChildren: (dataNode: T) => Observable<T[]> | T[] | undefined | null;
437
711
  options?: NestedTreeControlOptions<T, K> | undefined;
@@ -452,6 +726,8 @@ export declare class NestedTreeControl<T, K = T> extends BaseTreeControl<T, K> {
452
726
 
453
727
  /** Optional set of configuration that can be provided to the NestedTreeControl. */
454
728
  export declare interface NestedTreeControlOptions<T, K> {
729
+ /** Function to determine if the provided node is expandable. */
730
+ isExpandable?: (dataNode: T) => boolean;
455
731
  trackBy?: (dataNode: T) => K;
456
732
  }
457
733
 
@@ -459,6 +735,9 @@ export declare interface NestedTreeControlOptions<T, K> {
459
735
  * Tree control interface. User can implement TreeControl to expand/collapse dataNodes in the tree.
460
736
  * The CDKTree will use this TreeControl to expand/collapse a node.
461
737
  * User can also use it outside the `<cdk-tree>` to control the expansion status of the tree.
738
+ *
739
+ * @deprecated Use one of levelAccessor or childrenAccessor instead. To be removed in a future version.
740
+ * @breaking-change 21.0.0
462
741
  */
463
742
  export declare interface TreeControl<T, K = T> {
464
743
  /** The saved tree nodes data for `expandAll` action. */