index.d.ts 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. import { M as MatLine, a as MatLineModule } from '../line.d-C-QdueRc.js';
  2. import * as i0 from '@angular/core';
  3. import { AfterContentInit, QueryList, OnInit, AfterContentChecked } from '@angular/core';
  4. import { M as MatCommonModule } from '../common-module.d-C8xzHJDr.js';
  5. import { NumberInput } from '@angular/cdk/coercion';
  6. import '@angular/cdk/bidi';
  7. /**
  8. * Interface describing a tile.
  9. * @docs-private
  10. */
  11. interface Tile {
  12. /** Amount of rows that the tile takes up. */
  13. rowspan: number;
  14. /** Amount of columns that the tile takes up. */
  15. colspan: number;
  16. }
  17. /**
  18. * Class for determining, from a list of tiles, the (row, col) position of each of those tiles
  19. * in the grid. This is necessary (rather than just rendering the tiles in normal document flow)
  20. * because the tiles can have a rowspan.
  21. *
  22. * The positioning algorithm greedily places each tile as soon as it encounters a gap in the grid
  23. * large enough to accommodate it so that the tiles still render in the same order in which they
  24. * are given.
  25. *
  26. * The basis of the algorithm is the use of an array to track the already placed tiles. Each
  27. * element of the array corresponds to a column, and the value indicates how many cells in that
  28. * column are already occupied; zero indicates an empty cell. Moving "down" to the next row
  29. * decrements each value in the tracking array (indicating that the column is one cell closer to
  30. * being free).
  31. *
  32. * @docs-private
  33. */
  34. declare class TileCoordinator {
  35. /** Tracking array (see class description). */
  36. tracker: number[];
  37. /** Index at which the search for the next gap will start. */
  38. columnIndex: number;
  39. /** The current row index. */
  40. rowIndex: number;
  41. /** Gets the total number of rows occupied by tiles */
  42. get rowCount(): number;
  43. /**
  44. * Gets the total span of rows occupied by tiles.
  45. * Ex: A list with 1 row that contains a tile with rowspan 2 will have a total rowspan of 2.
  46. */
  47. get rowspan(): number;
  48. /** The computed (row, col) position of each tile (the output). */
  49. positions: TilePosition[];
  50. /**
  51. * Updates the tile positions.
  52. * @param numColumns Amount of columns in the grid.
  53. * @param tiles Tiles to be positioned.
  54. */
  55. update(numColumns: number, tiles: Tile[]): void;
  56. /** Calculates the row and col position of a tile. */
  57. private _trackTile;
  58. /** Finds the next available space large enough to fit the tile. */
  59. private _findMatchingGap;
  60. /** Move "down" to the next row. */
  61. private _nextRow;
  62. /**
  63. * Finds the end index (exclusive) of a gap given the index from which to start looking.
  64. * The gap ends when a non-zero value is found.
  65. */
  66. private _findGapEndIndex;
  67. /** Update the tile tracker to account for the given tile in the given space. */
  68. private _markTilePosition;
  69. }
  70. /**
  71. * Simple data structure for tile position (row, col).
  72. * @docs-private
  73. */
  74. declare class TilePosition {
  75. row: number;
  76. col: number;
  77. constructor(row: number, col: number);
  78. }
  79. /**
  80. * Base interface for a `MatGridList`.
  81. * @docs-private
  82. */
  83. interface MatGridListBase {
  84. cols: number;
  85. gutterSize: string;
  86. rowHeight: number | string;
  87. }
  88. declare class MatGridTile {
  89. private _element;
  90. _gridList?: MatGridListBase | null | undefined;
  91. _rowspan: number;
  92. _colspan: number;
  93. constructor(...args: unknown[]);
  94. /** Amount of rows that the grid tile takes up. */
  95. get rowspan(): number;
  96. set rowspan(value: NumberInput);
  97. /** Amount of columns that the grid tile takes up. */
  98. get colspan(): number;
  99. set colspan(value: NumberInput);
  100. /**
  101. * Sets the style of the grid-tile element. Needs to be set manually to avoid
  102. * "Changed after checked" errors that would occur with HostBinding.
  103. */
  104. _setStyle(property: string, value: any): void;
  105. static ɵfac: i0.ɵɵFactoryDeclaration<MatGridTile, never>;
  106. static ɵcmp: i0.ɵɵComponentDeclaration<MatGridTile, "mat-grid-tile", ["matGridTile"], { "rowspan": { "alias": "rowspan"; "required": false; }; "colspan": { "alias": "colspan"; "required": false; }; }, {}, never, ["*"], true, never>;
  107. }
  108. declare class MatGridTileText implements AfterContentInit {
  109. private _element;
  110. _lines: QueryList<MatLine>;
  111. constructor(...args: unknown[]);
  112. ngAfterContentInit(): void;
  113. static ɵfac: i0.ɵɵFactoryDeclaration<MatGridTileText, never>;
  114. static ɵcmp: i0.ɵɵComponentDeclaration<MatGridTileText, "mat-grid-tile-header, mat-grid-tile-footer", never, {}, {}, ["_lines"], ["[mat-grid-avatar], [matGridAvatar]", "[mat-line], [matLine]", "*"], true, never>;
  115. }
  116. /**
  117. * Directive whose purpose is to add the mat- CSS styling to this selector.
  118. * @docs-private
  119. */
  120. declare class MatGridAvatarCssMatStyler {
  121. static ɵfac: i0.ɵɵFactoryDeclaration<MatGridAvatarCssMatStyler, never>;
  122. static ɵdir: i0.ɵɵDirectiveDeclaration<MatGridAvatarCssMatStyler, "[mat-grid-avatar], [matGridAvatar]", never, {}, {}, never, never, true, never>;
  123. }
  124. /**
  125. * Directive whose purpose is to add the mat- CSS styling to this selector.
  126. * @docs-private
  127. */
  128. declare class MatGridTileHeaderCssMatStyler {
  129. static ɵfac: i0.ɵɵFactoryDeclaration<MatGridTileHeaderCssMatStyler, never>;
  130. static ɵdir: i0.ɵɵDirectiveDeclaration<MatGridTileHeaderCssMatStyler, "mat-grid-tile-header", never, {}, {}, never, never, true, never>;
  131. }
  132. /**
  133. * Directive whose purpose is to add the mat- CSS styling to this selector.
  134. * @docs-private
  135. */
  136. declare class MatGridTileFooterCssMatStyler {
  137. static ɵfac: i0.ɵɵFactoryDeclaration<MatGridTileFooterCssMatStyler, never>;
  138. static ɵdir: i0.ɵɵDirectiveDeclaration<MatGridTileFooterCssMatStyler, "mat-grid-tile-footer", never, {}, {}, never, never, true, never>;
  139. }
  140. /** Object that can be styled by the `TileStyler`. */
  141. interface TileStyleTarget {
  142. _setListStyle(style: [string, string | null] | null): void;
  143. _tiles: QueryList<MatGridTile>;
  144. }
  145. declare class MatGridList implements MatGridListBase, OnInit, AfterContentChecked, TileStyleTarget {
  146. private _element;
  147. private _dir;
  148. /** Number of columns being rendered. */
  149. private _cols;
  150. /** Used for determining the position of each tile in the grid. */
  151. private _tileCoordinator;
  152. /**
  153. * Row height value passed in by user. This can be one of three types:
  154. * - Number value (ex: "100px"): sets a fixed row height to that value
  155. * - Ratio value (ex: "4:3"): sets the row height based on width:height ratio
  156. * - "Fit" mode (ex: "fit"): sets the row height to total height divided by number of rows
  157. */
  158. private _rowHeight;
  159. /** The amount of space between tiles. This will be something like '5px' or '2em'. */
  160. private _gutter;
  161. /** Sets position and size styles for a tile */
  162. private _tileStyler;
  163. /** Query list of tiles that are being rendered. */
  164. _tiles: QueryList<MatGridTile>;
  165. constructor(...args: unknown[]);
  166. /** Amount of columns in the grid list. */
  167. get cols(): number;
  168. set cols(value: NumberInput);
  169. /** Size of the grid list's gutter in pixels. */
  170. get gutterSize(): string;
  171. set gutterSize(value: string);
  172. /** Set internal representation of row height from the user-provided value. */
  173. get rowHeight(): string | number;
  174. set rowHeight(value: string | number);
  175. ngOnInit(): void;
  176. /**
  177. * The layout calculation is fairly cheap if nothing changes, so there's little cost
  178. * to run it frequently.
  179. */
  180. ngAfterContentChecked(): void;
  181. /** Throw a friendly error if cols property is missing */
  182. private _checkCols;
  183. /** Default to equal width:height if rowHeight property is missing */
  184. private _checkRowHeight;
  185. /** Creates correct Tile Styler subtype based on rowHeight passed in by user */
  186. private _setTileStyler;
  187. /** Computes and applies the size and position for all children grid tiles. */
  188. private _layoutTiles;
  189. /** Sets style on the main grid-list element, given the style name and value. */
  190. _setListStyle(style: [string, string | null] | null): void;
  191. static ɵfac: i0.ɵɵFactoryDeclaration<MatGridList, never>;
  192. static ɵcmp: i0.ɵɵComponentDeclaration<MatGridList, "mat-grid-list", ["matGridList"], { "cols": { "alias": "cols"; "required": false; }; "gutterSize": { "alias": "gutterSize"; "required": false; }; "rowHeight": { "alias": "rowHeight"; "required": false; }; }, {}, ["_tiles"], ["*"], true, never>;
  193. }
  194. declare class MatGridListModule {
  195. static ɵfac: i0.ɵɵFactoryDeclaration<MatGridListModule, never>;
  196. static ɵmod: i0.ɵɵNgModuleDeclaration<MatGridListModule, never, [typeof MatLineModule, typeof MatCommonModule, typeof MatGridList, typeof MatGridTile, typeof MatGridTileText, typeof MatGridTileHeaderCssMatStyler, typeof MatGridTileFooterCssMatStyler, typeof MatGridAvatarCssMatStyler], [typeof MatGridList, typeof MatGridTile, typeof MatGridTileText, typeof MatLineModule, typeof MatCommonModule, typeof MatGridTileHeaderCssMatStyler, typeof MatGridTileFooterCssMatStyler, typeof MatGridAvatarCssMatStyler]>;
  197. static ɵinj: i0.ɵɵInjectorDeclaration<MatGridListModule>;
  198. }
  199. declare const ɵTileCoordinator: typeof TileCoordinator;
  200. export { MatGridAvatarCssMatStyler, MatGridList, MatGridListModule, MatGridTile, MatGridTileFooterCssMatStyler, MatGridTileHeaderCssMatStyler, MatGridTileText, MatLine, ɵTileCoordinator };