nested-node.d.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. */
  8. import { AfterContentInit, ElementRef, IterableDiffers, OnDestroy, QueryList } from '@angular/core';
  9. import { CdkTreeNodeOutlet } from './outlet';
  10. import { CdkTree, CdkTreeNode } from './tree';
  11. /**
  12. * Nested node is a child of `<cdk-tree>`. It works with nested tree.
  13. * By using `cdk-nested-tree-node` component in tree node template, children of the parent node will
  14. * be added in the `cdkTreeNodeOutlet` in tree node template.
  15. * For example:
  16. * ```html
  17. * <cdk-nested-tree-node>
  18. * {{node.name}}
  19. * <ng-template cdkTreeNodeOutlet></ng-template>
  20. * </cdk-nested-tree-node>
  21. * ```
  22. * The children of node will be automatically added to `cdkTreeNodeOutlet`, the result dom will be
  23. * like this:
  24. * ```html
  25. * <cdk-nested-tree-node>
  26. * {{node.name}}
  27. * <cdk-nested-tree-node>{{child1.name}}</cdk-nested-tree-node>
  28. * <cdk-nested-tree-node>{{child2.name}}</cdk-nested-tree-node>
  29. * </cdk-nested-tree-node>
  30. * ```
  31. */
  32. export declare class CdkNestedTreeNode<T> extends CdkTreeNode<T> implements AfterContentInit, OnDestroy {
  33. protected _elementRef: ElementRef<HTMLElement>;
  34. protected _tree: CdkTree<T>;
  35. protected _differs: IterableDiffers;
  36. /** Differ used to find the changes in the data provided by the data source. */
  37. private _dataDiffer;
  38. /** The children data dataNodes of current node. They will be placed in `CdkTreeNodeOutlet`. */
  39. protected _children: T[];
  40. /** The children node placeholder. */
  41. nodeOutlet: QueryList<CdkTreeNodeOutlet>;
  42. constructor(_elementRef: ElementRef<HTMLElement>, _tree: CdkTree<T>, _differs: IterableDiffers);
  43. ngAfterContentInit(): void;
  44. ngOnDestroy(): void;
  45. /** Add children dataNodes to the NodeOutlet */
  46. protected updateChildrenNodes(children?: T[]): void;
  47. /** Clear the children dataNodes. */
  48. protected _clear(): void;
  49. /** Gets the outlet for the current node. */
  50. private _getNodeOutlet;
  51. }