tree-adapter.d.ts 1.0 KB

1234567891011121314151617181920212223242526
  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 { SelectionModel } from './selection';
  9. /**
  10. * Interface for a class that can flatten hierarchical structured data and re-expand the flattened
  11. * data back into its original structure. Should be used in conjunction with the cdk-tree.
  12. */
  13. export interface TreeDataNodeFlattener<T> {
  14. /** Transforms a set of hierarchical structured data into a flattened data array. */
  15. flattenNodes(structuredData: any[]): T[];
  16. /**
  17. * Expands a flattened array of data into its hierarchical form using the provided expansion
  18. * model.
  19. */
  20. expandFlattenedNodes(nodes: T[], expansionModel: SelectionModel<T>): T[];
  21. /**
  22. * Put node descendants of node in array.
  23. * If `onlyExpandable` is true, then only process expandable descendants.
  24. */
  25. nodeDescendents(node: T, nodes: T[], onlyExpandable: boolean): void;
  26. }