source: trip-planner-front/node_modules/@angular/material/grid-list/tile-coordinator.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.8 KB
Line 
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/**
9 * Interface describing a tile.
10 * @docs-private
11 */
12export interface Tile {
13 /** Amount of rows that the tile takes up. */
14 rowspan: number;
15 /** Amount of columns that the tile takes up. */
16 colspan: number;
17}
18/**
19 * Class for determining, from a list of tiles, the (row, col) position of each of those tiles
20 * in the grid. This is necessary (rather than just rendering the tiles in normal document flow)
21 * because the tiles can have a rowspan.
22 *
23 * The positioning algorithm greedily places each tile as soon as it encounters a gap in the grid
24 * large enough to accommodate it so that the tiles still render in the same order in which they
25 * are given.
26 *
27 * The basis of the algorithm is the use of an array to track the already placed tiles. Each
28 * element of the array corresponds to a column, and the value indicates how many cells in that
29 * column are already occupied; zero indicates an empty cell. Moving "down" to the next row
30 * decrements each value in the tracking array (indicating that the column is one cell closer to
31 * being free).
32 *
33 * @docs-private
34 */
35export declare class TileCoordinator {
36 /** Tracking array (see class description). */
37 tracker: number[];
38 /** Index at which the search for the next gap will start. */
39 columnIndex: number;
40 /** The current row index. */
41 rowIndex: number;
42 /** Gets the total number of rows occupied by tiles */
43 get rowCount(): number;
44 /**
45 * Gets the total span of rows occupied by tiles.
46 * Ex: A list with 1 row that contains a tile with rowspan 2 will have a total rowspan of 2.
47 */
48 get rowspan(): number;
49 /** The computed (row, col) position of each tile (the output). */
50 positions: TilePosition[];
51 /**
52 * Updates the tile positions.
53 * @param numColumns Amount of columns in the grid.
54 * @param tiles Tiles to be positioned.
55 */
56 update(numColumns: number, tiles: Tile[]): void;
57 /** Calculates the row and col position of a tile. */
58 private _trackTile;
59 /** Finds the next available space large enough to fit the tile. */
60 private _findMatchingGap;
61 /** Move "down" to the next row. */
62 private _nextRow;
63 /**
64 * Finds the end index (exclusive) of a gap given the index from which to start looking.
65 * The gap ends when a non-zero value is found.
66 */
67 private _findGapEndIndex;
68 /** Update the tile tracker to account for the given tile in the given space. */
69 private _markTilePosition;
70}
71/**
72 * Simple data structure for tile position (row, col).
73 * @docs-private
74 */
75export declare class TilePosition {
76 row: number;
77 col: number;
78 constructor(row: number, col: number);
79}
Note: See TracBrowser for help on using the repository browser.