index.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. import * as i1 from '@angular/cdk/tree';
  2. import { CdkTreeNode, CdkTreeNodeDef, CdkNestedTreeNode, CdkTreeNodePadding, CdkTreeNodeOutlet, CdkTree, CdkTreeNodeToggle, TreeControl, FlatTreeControl } from '@angular/cdk/tree';
  3. import * as i0 from '@angular/core';
  4. import { OnInit, OnDestroy, AfterContentInit, ViewContainerRef } from '@angular/core';
  5. import { M as MatCommonModule } from '../common-module.d-C8xzHJDr.js';
  6. import { DataSource, CollectionViewer } from '@angular/cdk/collections';
  7. import { Observable } from 'rxjs';
  8. import '@angular/cdk/bidi';
  9. /**
  10. * Wrapper for the CdkTree node with Material design styles.
  11. */
  12. declare class MatTreeNode<T, K = T> extends CdkTreeNode<T, K> implements OnInit, OnDestroy {
  13. /**
  14. * The tabindex of the tree node.
  15. *
  16. * @deprecated By default MatTreeNode manages focus using TreeKeyManager instead of tabIndex.
  17. * Recommend to avoid setting tabIndex directly to prevent TreeKeyManager form getting into
  18. * an unexpected state. Tabindex to be removed in a future version.
  19. * @breaking-change 21.0.0 Remove this attribute.
  20. */
  21. get tabIndexInputBinding(): number;
  22. set tabIndexInputBinding(value: number);
  23. private _tabIndexInputBinding;
  24. /**
  25. * The default tabindex of the tree node.
  26. *
  27. * @deprecated By default MatTreeNode manages focus using TreeKeyManager instead of tabIndex.
  28. * Recommend to avoid setting tabIndex directly to prevent TreeKeyManager form getting into
  29. * an unexpected state. Tabindex to be removed in a future version.
  30. * @breaking-change 21.0.0 Remove this attribute.
  31. */
  32. defaultTabIndex: number;
  33. protected _getTabindexAttribute(): number | null;
  34. /**
  35. * Whether the component is disabled.
  36. *
  37. * @deprecated This is an alias for `isDisabled`.
  38. * @breaking-change 21.0.0 Remove this input
  39. */
  40. get disabled(): boolean;
  41. set disabled(value: boolean);
  42. constructor(...args: unknown[]);
  43. ngOnInit(): void;
  44. ngOnDestroy(): void;
  45. static ɵfac: i0.ɵɵFactoryDeclaration<MatTreeNode<any, any>, never>;
  46. static ɵdir: i0.ɵɵDirectiveDeclaration<MatTreeNode<any, any>, "mat-tree-node", ["matTreeNode"], { "tabIndexInputBinding": { "alias": "tabIndex"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "activation": "activation"; "expandedChange": "expandedChange"; }, never, never, true, never>;
  47. static ngAcceptInputType_tabIndexInputBinding: unknown;
  48. static ngAcceptInputType_disabled: unknown;
  49. }
  50. /**
  51. * Wrapper for the CdkTree node definition with Material design styles.
  52. * Captures the node's template and a when predicate that describes when this node should be used.
  53. */
  54. declare class MatTreeNodeDef<T> extends CdkTreeNodeDef<T> {
  55. data: T;
  56. static ɵfac: i0.ɵɵFactoryDeclaration<MatTreeNodeDef<any>, never>;
  57. static ɵdir: i0.ɵɵDirectiveDeclaration<MatTreeNodeDef<any>, "[matTreeNodeDef]", never, { "when": { "alias": "matTreeNodeDefWhen"; "required": false; }; "data": { "alias": "matTreeNode"; "required": false; }; }, {}, never, never, true, never>;
  58. }
  59. /**
  60. * Wrapper for the CdkTree nested node with Material design styles.
  61. */
  62. declare class MatNestedTreeNode<T, K = T> extends CdkNestedTreeNode<T, K> implements AfterContentInit, OnDestroy, OnInit {
  63. node: T;
  64. /**
  65. * Whether the node is disabled.
  66. *
  67. * @deprecated This is an alias for `isDisabled`.
  68. * @breaking-change 21.0.0 Remove this input
  69. */
  70. get disabled(): boolean;
  71. set disabled(value: boolean);
  72. /** Tabindex of the node. */
  73. get tabIndex(): number;
  74. set tabIndex(value: number);
  75. private _tabIndex;
  76. ngOnInit(): void;
  77. ngAfterContentInit(): void;
  78. ngOnDestroy(): void;
  79. static ɵfac: i0.ɵɵFactoryDeclaration<MatNestedTreeNode<any, any>, never>;
  80. static ɵdir: i0.ɵɵDirectiveDeclaration<MatNestedTreeNode<any, any>, "mat-nested-tree-node", ["matNestedTreeNode"], { "node": { "alias": "matNestedTreeNode"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; }, { "activation": "activation"; "expandedChange": "expandedChange"; }, never, never, true, never>;
  81. static ngAcceptInputType_disabled: unknown;
  82. static ngAcceptInputType_tabIndex: unknown;
  83. }
  84. /**
  85. * Wrapper for the CdkTree padding with Material design styles.
  86. */
  87. declare class MatTreeNodePadding<T, K = T> extends CdkTreeNodePadding<T, K> {
  88. /** The level of depth of the tree node. The padding will be `level * indent` pixels. */
  89. get level(): number;
  90. set level(value: number);
  91. /** The indent for each level. Default number 40px from material design menu sub-menu spec. */
  92. get indent(): number | string;
  93. set indent(indent: number | string);
  94. static ɵfac: i0.ɵɵFactoryDeclaration<MatTreeNodePadding<any, any>, never>;
  95. static ɵdir: i0.ɵɵDirectiveDeclaration<MatTreeNodePadding<any, any>, "[matTreeNodePadding]", never, { "level": { "alias": "matTreeNodePadding"; "required": false; }; "indent": { "alias": "matTreeNodePaddingIndent"; "required": false; }; }, {}, never, never, true, never>;
  96. static ngAcceptInputType_level: unknown;
  97. }
  98. /**
  99. * Outlet for nested CdkNode. Put `[matTreeNodeOutlet]` on a tag to place children dataNodes
  100. * inside the outlet.
  101. */
  102. declare class MatTreeNodeOutlet implements CdkTreeNodeOutlet {
  103. viewContainer: ViewContainerRef;
  104. _node: {} | null;
  105. static ɵfac: i0.ɵɵFactoryDeclaration<MatTreeNodeOutlet, never>;
  106. static ɵdir: i0.ɵɵDirectiveDeclaration<MatTreeNodeOutlet, "[matTreeNodeOutlet]", never, {}, {}, never, never, true, never>;
  107. }
  108. /**
  109. * Wrapper for the CdkTable with Material design styles.
  110. */
  111. declare class MatTree<T, K = T> extends CdkTree<T, K> {
  112. _nodeOutlet: MatTreeNodeOutlet;
  113. static ɵfac: i0.ɵɵFactoryDeclaration<MatTree<any, any>, never>;
  114. static ɵcmp: i0.ɵɵComponentDeclaration<MatTree<any, any>, "mat-tree", ["matTree"], {}, {}, never, never, true, never>;
  115. }
  116. /**
  117. * Wrapper for the CdkTree's toggle with Material design styles.
  118. */
  119. declare class MatTreeNodeToggle<T, K = T> extends CdkTreeNodeToggle<T, K> {
  120. static ɵfac: i0.ɵɵFactoryDeclaration<MatTreeNodeToggle<any, any>, never>;
  121. static ɵdir: i0.ɵɵDirectiveDeclaration<MatTreeNodeToggle<any, any>, "[matTreeNodeToggle]", never, { "recursive": { "alias": "matTreeNodeToggleRecursive"; "required": false; }; }, {}, never, never, true, never>;
  122. }
  123. declare class MatTreeModule {
  124. static ɵfac: i0.ɵɵFactoryDeclaration<MatTreeModule, never>;
  125. static ɵmod: i0.ɵɵNgModuleDeclaration<MatTreeModule, never, [typeof i1.CdkTreeModule, typeof MatCommonModule, typeof MatNestedTreeNode, typeof MatTreeNodeDef, typeof MatTreeNodePadding, typeof MatTreeNodeToggle, typeof MatTree, typeof MatTreeNode, typeof MatTreeNodeOutlet], [typeof MatCommonModule, typeof MatNestedTreeNode, typeof MatTreeNodeDef, typeof MatTreeNodePadding, typeof MatTreeNodeToggle, typeof MatTree, typeof MatTreeNode, typeof MatTreeNodeOutlet]>;
  126. static ɵinj: i0.ɵɵInjectorDeclaration<MatTreeModule>;
  127. }
  128. /**
  129. * Tree flattener to convert a normal type of node to node with children & level information.
  130. * Transform nested nodes of type `T` to flattened nodes of type `F`.
  131. *
  132. * For example, the input data of type `T` is nested, and contains its children data:
  133. * SomeNode: {
  134. * key: 'Fruits',
  135. * children: [
  136. * NodeOne: {
  137. * key: 'Apple',
  138. * },
  139. * NodeTwo: {
  140. * key: 'Pear',
  141. * }
  142. * ]
  143. * }
  144. * After flattener flatten the tree, the structure will become
  145. * SomeNode: {
  146. * key: 'Fruits',
  147. * expandable: true,
  148. * level: 1
  149. * },
  150. * NodeOne: {
  151. * key: 'Apple',
  152. * expandable: false,
  153. * level: 2
  154. * },
  155. * NodeTwo: {
  156. * key: 'Pear',
  157. * expandable: false,
  158. * level: 2
  159. * }
  160. * and the output flattened type is `F` with additional information.
  161. *
  162. * @deprecated Use MatTree#childrenAccessor and MatTreeNode#isExpandable
  163. * instead. To be removed in a future version.
  164. * @breaking-change 21.0.0
  165. */
  166. declare class MatTreeFlattener<T, F, K = F> {
  167. transformFunction: (node: T, level: number) => F;
  168. getLevel: (node: F) => number;
  169. isExpandable: (node: F) => boolean;
  170. getChildren: (node: T) => Observable<T[]> | T[] | undefined | null;
  171. constructor(transformFunction: (node: T, level: number) => F, getLevel: (node: F) => number, isExpandable: (node: F) => boolean, getChildren: (node: T) => Observable<T[]> | T[] | undefined | null);
  172. _flattenNode(node: T, level: number, resultNodes: F[], parentMap: boolean[]): F[];
  173. _flattenChildren(children: T[], level: number, resultNodes: F[], parentMap: boolean[]): void;
  174. /**
  175. * Flatten a list of node type T to flattened version of node F.
  176. * Please note that type T may be nested, and the length of `structuredData` may be different
  177. * from that of returned list `F[]`.
  178. */
  179. flattenNodes(structuredData: T[]): F[];
  180. /**
  181. * Expand flattened node with current expansion status.
  182. * The returned list may have different length.
  183. */
  184. expandFlattenedNodes(nodes: F[], treeControl: TreeControl<F, K>): F[];
  185. }
  186. /**
  187. * Data source for flat tree.
  188. * The data source need to handle expansion/collapsion of the tree node and change the data feed
  189. * to `MatTree`.
  190. * The nested tree nodes of type `T` are flattened through `MatTreeFlattener`, and converted
  191. * to type `F` for `MatTree` to consume.
  192. *
  193. * @deprecated Use one of levelAccessor or childrenAccessor instead. To be removed in a future
  194. * version.
  195. * @breaking-change 21.0.0
  196. */
  197. declare class MatTreeFlatDataSource<T, F, K = F> extends DataSource<F> {
  198. private _treeControl;
  199. private _treeFlattener;
  200. private readonly _flattenedData;
  201. private readonly _expandedData;
  202. get data(): T[];
  203. set data(value: T[]);
  204. private readonly _data;
  205. constructor(_treeControl: FlatTreeControl<F, K>, _treeFlattener: MatTreeFlattener<T, F, K>, initialData?: T[]);
  206. connect(collectionViewer: CollectionViewer): Observable<F[]>;
  207. disconnect(): void;
  208. }
  209. /**
  210. * Data source for nested tree.
  211. *
  212. * The data source for nested tree doesn't have to consider node flattener, or the way to expand
  213. * or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
  214. */
  215. declare class MatTreeNestedDataSource<T> extends DataSource<T> {
  216. /**
  217. * Data for the nested tree
  218. */
  219. get data(): T[];
  220. set data(value: T[]);
  221. private readonly _data;
  222. connect(collectionViewer: CollectionViewer): Observable<T[]>;
  223. disconnect(): void;
  224. }
  225. export { MatNestedTreeNode, MatTree, MatTreeFlatDataSource, MatTreeFlattener, MatTreeModule, MatTreeNestedDataSource, MatTreeNode, MatTreeNodeDef, MatTreeNodeOutlet, MatTreeNodePadding, MatTreeNodeToggle };