source: trip-planner-front/node_modules/@angular/material/esm2015/grid-list/grid-list.js

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: 19.2 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 */
8import { Component, ViewEncapsulation, Input, ContentChildren, QueryList, ElementRef, Optional, ChangeDetectionStrategy, } from '@angular/core';
9import { MatGridTile } from './grid-tile';
10import { TileCoordinator } from './tile-coordinator';
11import { FitTileStyler, RatioTileStyler, FixedTileStyler, } from './tile-styler';
12import { Directionality } from '@angular/cdk/bidi';
13import { coerceNumberProperty } from '@angular/cdk/coercion';
14import { MAT_GRID_LIST } from './grid-list-base';
15// TODO(kara): Conditional (responsive) column count / row size.
16// TODO(kara): Re-layout on window resize / media change (debounced).
17// TODO(kara): gridTileHeader and gridTileFooter.
18const MAT_FIT_MODE = 'fit';
19export class MatGridList {
20 constructor(_element, _dir) {
21 this._element = _element;
22 this._dir = _dir;
23 /** The amount of space between tiles. This will be something like '5px' or '2em'. */
24 this._gutter = '1px';
25 }
26 /** Amount of columns in the grid list. */
27 get cols() { return this._cols; }
28 set cols(value) {
29 this._cols = Math.max(1, Math.round(coerceNumberProperty(value)));
30 }
31 /** Size of the grid list's gutter in pixels. */
32 get gutterSize() { return this._gutter; }
33 set gutterSize(value) { this._gutter = `${value == null ? '' : value}`; }
34 /** Set internal representation of row height from the user-provided value. */
35 get rowHeight() { return this._rowHeight; }
36 set rowHeight(value) {
37 const newValue = `${value == null ? '' : value}`;
38 if (newValue !== this._rowHeight) {
39 this._rowHeight = newValue;
40 this._setTileStyler(this._rowHeight);
41 }
42 }
43 ngOnInit() {
44 this._checkCols();
45 this._checkRowHeight();
46 }
47 /**
48 * The layout calculation is fairly cheap if nothing changes, so there's little cost
49 * to run it frequently.
50 */
51 ngAfterContentChecked() {
52 this._layoutTiles();
53 }
54 /** Throw a friendly error if cols property is missing */
55 _checkCols() {
56 if (!this.cols && (typeof ngDevMode === 'undefined' || ngDevMode)) {
57 throw Error(`mat-grid-list: must pass in number of columns. ` +
58 `Example: <mat-grid-list cols="3">`);
59 }
60 }
61 /** Default to equal width:height if rowHeight property is missing */
62 _checkRowHeight() {
63 if (!this._rowHeight) {
64 this._setTileStyler('1:1');
65 }
66 }
67 /** Creates correct Tile Styler subtype based on rowHeight passed in by user */
68 _setTileStyler(rowHeight) {
69 if (this._tileStyler) {
70 this._tileStyler.reset(this);
71 }
72 if (rowHeight === MAT_FIT_MODE) {
73 this._tileStyler = new FitTileStyler();
74 }
75 else if (rowHeight && rowHeight.indexOf(':') > -1) {
76 this._tileStyler = new RatioTileStyler(rowHeight);
77 }
78 else {
79 this._tileStyler = new FixedTileStyler(rowHeight);
80 }
81 }
82 /** Computes and applies the size and position for all children grid tiles. */
83 _layoutTiles() {
84 if (!this._tileCoordinator) {
85 this._tileCoordinator = new TileCoordinator();
86 }
87 const tracker = this._tileCoordinator;
88 const tiles = this._tiles.filter(tile => !tile._gridList || tile._gridList === this);
89 const direction = this._dir ? this._dir.value : 'ltr';
90 this._tileCoordinator.update(this.cols, tiles);
91 this._tileStyler.init(this.gutterSize, tracker, this.cols, direction);
92 tiles.forEach((tile, index) => {
93 const pos = tracker.positions[index];
94 this._tileStyler.setStyle(tile, pos.row, pos.col);
95 });
96 this._setListStyle(this._tileStyler.getComputedHeight());
97 }
98 /** Sets style on the main grid-list element, given the style name and value. */
99 _setListStyle(style) {
100 if (style) {
101 this._element.nativeElement.style[style[0]] = style[1];
102 }
103 }
104}
105MatGridList.decorators = [
106 { type: Component, args: [{
107 selector: 'mat-grid-list',
108 exportAs: 'matGridList',
109 template: "<div>\n <ng-content></ng-content>\n</div>",
110 host: {
111 'class': 'mat-grid-list',
112 // Ensures that the "cols" input value is reflected in the DOM. This is
113 // needed for the grid-list harness.
114 '[attr.cols]': 'cols',
115 },
116 providers: [{
117 provide: MAT_GRID_LIST,
118 useExisting: MatGridList
119 }],
120 changeDetection: ChangeDetectionStrategy.OnPush,
121 encapsulation: ViewEncapsulation.None,
122 styles: [".mat-grid-list{display:block;position:relative}.mat-grid-tile{display:block;position:absolute;overflow:hidden}.mat-grid-tile .mat-grid-tile-header,.mat-grid-tile .mat-grid-tile-footer{display:flex;align-items:center;height:48px;color:#fff;background:rgba(0,0,0,.38);overflow:hidden;padding:0 16px;position:absolute;left:0;right:0}.mat-grid-tile .mat-grid-tile-header>*,.mat-grid-tile .mat-grid-tile-footer>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-grid-tile .mat-grid-tile-header.mat-2-line,.mat-grid-tile .mat-grid-tile-footer.mat-2-line{height:68px}.mat-grid-tile .mat-grid-list-text{display:flex;flex-direction:column;flex:auto;box-sizing:border-box;overflow:hidden}.mat-grid-tile .mat-grid-list-text>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-grid-tile .mat-grid-list-text:empty{display:none}.mat-grid-tile .mat-grid-tile-header{top:0}.mat-grid-tile .mat-grid-tile-footer{bottom:0}.mat-grid-tile .mat-grid-avatar{padding-right:16px}[dir=rtl] .mat-grid-tile .mat-grid-avatar{padding-right:0;padding-left:16px}.mat-grid-tile .mat-grid-avatar:empty{display:none}.mat-grid-tile-content{top:0;left:0;right:0;bottom:0;position:absolute;display:flex;align-items:center;justify-content:center;height:100%;padding:0;margin:0}\n"]
123 },] }
124];
125MatGridList.ctorParameters = () => [
126 { type: ElementRef },
127 { type: Directionality, decorators: [{ type: Optional }] }
128];
129MatGridList.propDecorators = {
130 _tiles: [{ type: ContentChildren, args: [MatGridTile, { descendants: true },] }],
131 cols: [{ type: Input }],
132 gutterSize: [{ type: Input }],
133 rowHeight: [{ type: Input }]
134};
135//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JpZC1saXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vL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