UNPKG

@angular2-material/grid-list

Version:
613 lines (604 loc) 32.7 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular2-material/core')) : typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular2-material/core'], factory) : (factory((global.md = global.md || {}, global.md.gridList = global.md.gridList || {}),global.ng.core,global.md.core)); }(this, (function (exports,_angular_core,_angular2Material_core) { 'use strict'; /** * Converts values into strings. Falsy values become empty strings. * TODO: internal */ function coerceToString(value) { return "" + (value || ''); } /** * Converts a value that might be a string into a number. * TODO: internal */ function coerceToNumber(value) { return typeof value === 'string' ? parseInt(value, 10) : value; } var __decorate$1 = (window && window.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata$1 = (window && window.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var MdGridTile = (function () { function MdGridTile(_renderer, _element) { this._renderer = _renderer; this._element = _element; this._rowspan = 1; this._colspan = 1; } Object.defineProperty(MdGridTile.prototype, "rowspan", { get: function () { return this._rowspan; }, set: function (value) { this._rowspan = coerceToNumber(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdGridTile.prototype, "colspan", { get: function () { return this._colspan; }, set: function (value) { this._colspan = coerceToNumber(value); }, enumerable: true, configurable: true }); /** * Sets the style of the grid-tile element. Needs to be set manually to avoid * "Changed after checked" errors that would occur with HostBinding. */ MdGridTile.prototype._setStyle = function (property, value) { this._renderer.setElementStyle(this._element.nativeElement, property, value); }; __decorate$1([ _angular_core.Input(), __metadata$1('design:type', Object) ], MdGridTile.prototype, "rowspan", null); __decorate$1([ _angular_core.Input(), __metadata$1('design:type', Object) ], MdGridTile.prototype, "colspan", null); MdGridTile = __decorate$1([ _angular_core.Component({selector: 'md-grid-tile', host: { 'role': 'listitem' }, template: "<!-- TODO(kara): Revisit why this is a figure.--> <figure> <ng-content></ng-content> </figure>", styles: ["/** * This mixin will ensure that lines that overflow the container will * hide the overflow and truncate neatly with an ellipsis. */ /** * This mixin provides all md-line styles, changing secondary font size * based on whether the list is in dense mode. */ /** * This mixin provides base styles for the wrapper around md-line * elements in a list. */ /** * This mixin normalizes default element styles, e.g. font weight for heading text. */ /* height of tile header or footer if it has one line */ /* height of tile header or footer if it has two lines */ /* side padding for text in tile headers and footers */ /* font styles for text in tile headers and footers */ md-grid-list { display: block; position: relative; } md-grid-tile { display: block; position: absolute; } md-grid-tile figure { display: flex; position: absolute; align-items: center; justify-content: center; height: 100%; top: 0; right: 0; bottom: 0; left: 0; padding: 0; margin: 0; } md-grid-tile md-grid-tile-header, md-grid-tile md-grid-tile-footer { display: flex; align-items: center; height: 48px; color: #fff; background: rgba(0, 0, 0, 0.18); overflow: hidden; padding: 0 16px; font-size: 16px; position: absolute; left: 0; right: 0; } md-grid-tile md-grid-tile-header [md-line], md-grid-tile md-grid-tile-footer [md-line] { white-space: nowrap; overflow-x: hidden; text-overflow: ellipsis; display: block; box-sizing: border-box; } md-grid-tile md-grid-tile-header [md-line]:nth-child(n+2), md-grid-tile md-grid-tile-footer [md-line]:nth-child(n+2) { font-size: 12px; } md-grid-tile md-grid-tile-header > *, md-grid-tile md-grid-tile-footer > * { margin: 0; padding: 0; font-weight: normal; font-size: inherit; } md-grid-tile md-grid-tile-header.md-2-line, md-grid-tile md-grid-tile-footer.md-2-line { height: 68px; } md-grid-tile .md-grid-list-text { display: flex; flex-direction: column; width: 100%; box-sizing: border-box; overflow: hidden; } md-grid-tile .md-grid-list-text > * { margin: 0; padding: 0; font-weight: normal; font-size: inherit; } md-grid-tile .md-grid-list-text:empty { display: none; } md-grid-tile md-grid-tile-header { top: 0; } md-grid-tile md-grid-tile-footer { bottom: 0; } md-grid-tile [md-grid-avatar] { padding-right: 16px; } [dir='rtl'] md-grid-tile [md-grid-avatar] { padding-right: 0; padding-left: 16px; } md-grid-tile [md-grid-avatar]:empty { display: none; } /*# sourceMappingURL=grid-list.css.map */ "], encapsulation: _angular_core.ViewEncapsulation.None, }), __metadata$1('design:paramtypes', [_angular_core.Renderer, _angular_core.ElementRef]) ], MdGridTile); return MdGridTile; }()); var MdGridTileText = (function () { function MdGridTileText(_renderer, _element) { this._renderer = _renderer; this._element = _element; } MdGridTileText.prototype.ngAfterContentInit = function () { this._lineSetter = new _angular2Material_core.MdLineSetter(this._lines, this._renderer, this._element); }; __decorate$1([ _angular_core.ContentChildren(_angular2Material_core.MdLine), __metadata$1('design:type', _angular_core.QueryList) ], MdGridTileText.prototype, "_lines", void 0); MdGridTileText = __decorate$1([ _angular_core.Component({selector: 'md-grid-tile-header, md-grid-tile-footer', template: "<ng-content select=\"[md-grid-avatar]\"></ng-content> <div class=\"md-grid-list-text\"><ng-content select=\"[md-line]\"></ng-content></div> <ng-content></ng-content>" }), __metadata$1('design:paramtypes', [_angular_core.Renderer, _angular_core.ElementRef]) ], MdGridTileText); return MdGridTileText; }()); var __extends = (window && window.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /** * Exception thrown when cols property is missing from grid-list */ var MdGridListColsError = (function (_super) { __extends(MdGridListColsError, _super); function MdGridListColsError() { _super.call(this, "md-grid-list: must pass in number of columns. Example: <md-grid-list cols=\"3\">"); } return MdGridListColsError; }(_angular2Material_core.MdError)); /** * Exception thrown when a tile's colspan is longer than the number of cols in list */ var MdGridTileTooWideError = (function (_super) { __extends(MdGridTileTooWideError, _super); function MdGridTileTooWideError(cols, listLength) { _super.call(this, "md-grid-list: tile with colspan " + cols + " is wider than grid with cols=\"" + listLength + "\"."); } return MdGridTileTooWideError; }(_angular2Material_core.MdError)); /** * Exception thrown when an invalid ratio is passed in as a rowHeight */ var MdGridListBadRatioError = (function (_super) { __extends(MdGridListBadRatioError, _super); function MdGridListBadRatioError(value) { _super.call(this, "md-grid-list: invalid ratio given for row-height: \"" + value + "\""); } return MdGridListBadRatioError; }(_angular2Material_core.MdError)); /** * Class for determining, from a list of tiles, the (row, col) position of each of those tiles * in the grid. This is necessary (rather than just rendering the tiles in normal document flow) * because the tiles can have a rowspan. * * The positioning algorithm greedily places each tile as soon as it encounters a gap in the grid * large enough to accommodate it so that the tiles still render in the same order in which they * are given. * * The basis of the algorithm is the use of an array to track the already placed tiles. Each * element of the array corresponds to a column, and the value indicates how many cells in that * column are already occupied; zero indicates an empty cell. Moving "down" to the next row * decrements each value in the tracking array (indicating that the column is one cell closer to * being free). */ var TileCoordinator = (function () { function TileCoordinator(numColumns, tiles) { var _this = this; /** Index at which the search for the next gap will start. */ this.columnIndex = 0; /** The current row index. */ this.rowIndex = 0; this.tracker = new Array(numColumns); this.tracker.fill(0, 0, this.tracker.length); this.positions = tiles.map(function (tile) { return _this._trackTile(tile); }); } Object.defineProperty(TileCoordinator.prototype, "rowCount", { /** Gets the total number of rows occupied by tiles */ get: function () { return this.rowIndex + 1; }, enumerable: true, configurable: true }); Object.defineProperty(TileCoordinator.prototype, "rowspan", { /** Gets the total span of rows occupied by tiles. * Ex: A list with 1 row that contains a tile with rowspan 2 will have a total rowspan of 2. */ get: function () { var lastRowMax = Math.max.apply(Math, this.tracker); // if any of the tiles has a rowspan that pushes it beyond the total row count, // add the difference to the rowcount return lastRowMax > 1 ? this.rowCount + lastRowMax - 1 : this.rowCount; }, enumerable: true, configurable: true }); /** Calculates the row and col position of a tile. */ TileCoordinator.prototype._trackTile = function (tile) { // Find a gap large enough for this tile. var gapStartIndex = this._findMatchingGap(tile.colspan); // Place tile in the resulting gap. this._markTilePosition(gapStartIndex, tile); // The next time we look for a gap, the search will start at columnIndex, which should be // immediately after the tile that has just been placed. this.columnIndex = gapStartIndex + tile.colspan; return new TilePosition(this.rowIndex, gapStartIndex); }; /** Finds the next available space large enough to fit the tile. */ TileCoordinator.prototype._findMatchingGap = function (tileCols) { if (tileCols > this.tracker.length) { throw new MdGridTileTooWideError(tileCols, this.tracker.length); } // Start index is inclusive, end index is exclusive. var gapStartIndex = -1; var gapEndIndex = -1; // Look for a gap large enough to fit the given tile. Empty spaces are marked with a zero. do { // If we've reached the end of the row, go to the next row. if (this.columnIndex + tileCols > this.tracker.length) { this._nextRow(); continue; } gapStartIndex = this.tracker.indexOf(0, this.columnIndex); // If there are no more empty spaces in this row at all, move on to the next row. if (gapStartIndex == -1) { this._nextRow(); continue; } gapEndIndex = this._findGapEndIndex(gapStartIndex); // If a gap large enough isn't found, we want to start looking immediately after the current // gap on the next iteration. this.columnIndex = gapStartIndex + 1; } while (gapEndIndex - gapStartIndex < tileCols); return gapStartIndex; }; /** Move "down" to the next row. */ TileCoordinator.prototype._nextRow = function () { this.columnIndex = 0; this.rowIndex++; // Decrement all spaces by one to reflect moving down one row. for (var i = 0; i < this.tracker.length; i++) { this.tracker[i] = Math.max(0, this.tracker[i] - 1); } }; /** * Finds the end index (exclusive) of a gap given the index from which to start looking. * The gap ends when a non-zero value is found. */ TileCoordinator.prototype._findGapEndIndex = function (gapStartIndex) { for (var i = gapStartIndex + 1; i < this.tracker.length; i++) { if (this.tracker[i] != 0) { return i; } } // The gap ends with the end of the row. return this.tracker.length; }; /** Update the tile tracker to account for the given tile in the given space. */ TileCoordinator.prototype._markTilePosition = function (start, tile) { for (var i = 0; i < tile.colspan; i++) { this.tracker[start + i] = tile.rowspan; } }; return TileCoordinator; }()); /** Simple data structure for tile position (row, col). */ var TilePosition = (function () { function TilePosition(row, col) { this.row = row; this.col = col; } return TilePosition; }()); var __extends$1 = (window && window.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /** * Sets the style properties for an individual tile, given the position calculated by the * Tile Coordinator. * TODO: internal */ var TileStyler = (function () { function TileStyler() { this._rows = 0; this._rowspan = 0; } /** * Adds grid-list layout info once it is available. Cannot be processed in the constructor * because these properties haven't been calculated by that point. */ TileStyler.prototype.init = function (_gutterSize, tracker, cols, direction) { this._gutterSize = normalizeUnits(_gutterSize); this._rows = tracker.rowCount; this._rowspan = tracker.rowspan; this._cols = cols; this._direction = direction; }; /** * Computes the amount of space a single 1x1 tile would take up (width or height). * Used as a basis for other calculations. * @param sizePercent Percent of the total grid-list space that one 1x1 tile would take up. * @param gutterFraction Fraction of the gutter size taken up by one 1x1 tile. * @return The size of a 1x1 tile as an expression that can be evaluated via CSS calc(). */ TileStyler.prototype.getBaseTileSize = function (sizePercent, gutterFraction) { // Take the base size percent (as would be if evenly dividing the size between cells), // and then subtracting the size of one gutter. However, since there are no gutters on the // edges, each tile only uses a fraction (gutterShare = numGutters / numCells) of the gutter // size. (Imagine having one gutter per tile, and then breaking up the extra gutter on the // edge evenly among the cells). return "(" + sizePercent + "% - ( " + this._gutterSize + " * " + gutterFraction + " ))"; }; /** * Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value. * @param offset Number of tiles that have already been rendered in the row/column. * @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize). * @return Position of the tile as a CSS calc() expression. */ TileStyler.prototype.getTilePosition = function (baseSize, offset) { // The position comes the size of a 1x1 tile plus gutter for each previous tile in the // row/column (offset). return calc("(" + baseSize + " + " + this._gutterSize + ") * " + offset); }; /** * Gets the actual size of a tile, e.g., width or height, taking rowspan or colspan into account. * @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize). * @param span The tile's rowspan or colspan. * @return Size of the tile as a CSS calc() expression. */ TileStyler.prototype.getTileSize = function (baseSize, span) { return "(" + baseSize + " * " + span + ") + (" + (span - 1) + " * " + this._gutterSize + ")"; }; /** Gets the style properties to be applied to a tile for the given row and column index. */ TileStyler.prototype.setStyle = function (tile, rowIndex, colIndex) { // Percent of the available horizontal space that one column takes up. var percentWidthPerTile = 100 / this._cols; // Fraction of the vertical gutter size that each column takes up. // For example, if there are 5 columns, each column uses 4/5 = 0.8 times the gutter width. var gutterWidthFractionPerTile = (this._cols - 1) / this._cols; this.setColStyles(tile, colIndex, percentWidthPerTile, gutterWidthFractionPerTile); this.setRowStyles(tile, rowIndex, percentWidthPerTile, gutterWidthFractionPerTile); }; /** Sets the horizontal placement of the tile in the list. */ TileStyler.prototype.setColStyles = function (tile, colIndex, percentWidth, gutterWidth) { // Base horizontal size of a column. var baseTileWidth = this.getBaseTileSize(percentWidth, gutterWidth); // The width and horizontal position of each tile is always calculated the same way, but the // height and vertical position depends on the rowMode. var side = this._direction === 'ltr' ? 'left' : 'right'; tile._setStyle(side, this.getTilePosition(baseTileWidth, colIndex)); tile._setStyle('width', calc(this.getTileSize(baseTileWidth, tile.colspan))); }; /** Calculates the total size taken up by gutters across one axis of a list. */ TileStyler.prototype.getGutterSpan = function () { return this._gutterSize + " * (" + this._rowspan + " - 1)"; }; /** Calculates the total size taken up by tiles across one axis of a list. */ TileStyler.prototype.getTileSpan = function (tileHeight) { return this._rowspan + " * " + this.getTileSize(tileHeight, 1); }; /** * Sets the vertical placement of the tile in the list. * This method will be implemented by each type of TileStyler. */ TileStyler.prototype.setRowStyles = function (tile, rowIndex, percentWidth, gutterWidth) { }; /** * Calculates the computed height and returns the correct style property to set. * This method will be implemented by each type of TileStyler. */ TileStyler.prototype.getComputedHeight = function () { return null; }; return TileStyler; }()); /** * This type of styler is instantiated when the user passes in a fixed row height. * Example <md-grid-list cols="3" rowHeight="100px"> * TODO: internal */ var FixedTileStyler = (function (_super) { __extends$1(FixedTileStyler, _super); function FixedTileStyler(fixedRowHeight) { _super.call(this); this.fixedRowHeight = fixedRowHeight; } FixedTileStyler.prototype.init = function (gutterSize, tracker, cols, direction) { _super.prototype.init.call(this, gutterSize, tracker, cols, direction); this.fixedRowHeight = normalizeUnits(this.fixedRowHeight); }; FixedTileStyler.prototype.setRowStyles = function (tile, rowIndex, percentWidth, gutterWidth) { tile._setStyle('top', this.getTilePosition(this.fixedRowHeight, rowIndex)); tile._setStyle('height', calc(this.getTileSize(this.fixedRowHeight, tile.rowspan))); }; FixedTileStyler.prototype.getComputedHeight = function () { return [ 'height', calc(this.getTileSpan(this.fixedRowHeight) + " + " + this.getGutterSpan()) ]; }; return FixedTileStyler; }(TileStyler)); /** * This type of styler is instantiated when the user passes in a width:height ratio * for the row height. Example <md-grid-list cols="3" rowHeight="3:1"> * TODO: internal */ var RatioTileStyler = (function (_super) { __extends$1(RatioTileStyler, _super); function RatioTileStyler(value) { _super.call(this); this._parseRatio(value); } RatioTileStyler.prototype.setRowStyles = function (tile, rowIndex, percentWidth, gutterWidth) { var percentHeightPerTile = percentWidth / this.rowHeightRatio; this.baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterWidth); // Use paddingTop and marginTop to maintain the given aspect ratio, as // a percentage-based value for these properties is applied versus the *width* of the // containing block. See http://www.w3.org/TR/CSS2/box.html#margin-properties tile._setStyle('marginTop', this.getTilePosition(this.baseTileHeight, rowIndex)); tile._setStyle('paddingTop', calc(this.getTileSize(this.baseTileHeight, tile.rowspan))); }; RatioTileStyler.prototype.getComputedHeight = function () { return [ 'paddingBottom', calc(this.getTileSpan(this.baseTileHeight) + " + " + this.getGutterSpan()) ]; }; RatioTileStyler.prototype._parseRatio = function (value) { var ratioParts = value.split(':'); if (ratioParts.length !== 2) { throw new MdGridListBadRatioError(value); } this.rowHeightRatio = parseFloat(ratioParts[0]) / parseFloat(ratioParts[1]); }; return RatioTileStyler; }(TileStyler)); /* This type of styler is instantiated when the user selects a "fit" row height mode. * In other words, the row height will reflect the total height of the container divided * by the number of rows. Example <md-grid-list cols="3" rowHeight="fit"> */ var FitTileStyler = (function (_super) { __extends$1(FitTileStyler, _super); function FitTileStyler() { _super.apply(this, arguments); } FitTileStyler.prototype.setRowStyles = function (tile, rowIndex, percentWidth, gutterWidth) { // Percent of the available vertical space that one row takes up. var percentHeightPerTile = 100 / this._rowspan; // Fraction of the horizontal gutter size that each column takes up. var gutterHeightPerTile = (this._rows - 1) / this._rows; // Base vertical size of a column. var baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterHeightPerTile); tile._setStyle('top', this.getTilePosition(baseTileHeight, rowIndex)); tile._setStyle('height', calc(this.getTileSize(baseTileHeight, tile.rowspan))); }; return FitTileStyler; }(TileStyler)); /** Wraps a CSS string in a calc function */ function calc(exp) { return "calc(" + exp + ")"; } /** Appends pixels to a CSS string if no units are given. */ function normalizeUnits(value) { return (value.match(/px|em|rem/)) ? value : value + 'px'; } var __decorate = (window && window.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (window && window.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (window && window.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; // TODO(kara): Conditional (responsive) column count / row size. // TODO(kara): Re-layout on window resize / media change (debounced). // TODO(kara): gridTileHeader and gridTileFooter. var MD_FIT_MODE = 'fit'; var MdGridList = (function () { function MdGridList(_renderer, _element, _dir) { this._renderer = _renderer; this._element = _element; this._dir = _dir; /** The amount of space between tiles. This will be something like '5px' or '2em'. */ this._gutter = '1px'; } Object.defineProperty(MdGridList.prototype, "cols", { get: function () { return this._cols; }, set: function (value) { this._cols = coerceToNumber(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdGridList.prototype, "gutterSize", { get: function () { return this._gutter; }, set: function (value) { this._gutter = coerceToString(value); }, enumerable: true, configurable: true }); Object.defineProperty(MdGridList.prototype, "rowHeight", { /** Set internal representation of row height from the user-provided value. */ set: function (value) { this._rowHeight = coerceToString(value); this._setTileStyler(); }, enumerable: true, configurable: true }); /** TODO: internal */ MdGridList.prototype.ngOnInit = function () { this._checkCols(); this._checkRowHeight(); }; /** * The layout calculation is fairly cheap if nothing changes, so there's little cost * to run it frequently. * TODO: internal */ MdGridList.prototype.ngAfterContentChecked = function () { this._layoutTiles(); }; /** Throw a friendly error if cols property is missing */ MdGridList.prototype._checkCols = function () { if (!this.cols) { throw new MdGridListColsError(); } }; /** Default to equal width:height if rowHeight property is missing */ MdGridList.prototype._checkRowHeight = function () { if (!this._rowHeight) { this._tileStyler = new RatioTileStyler('1:1'); } }; /** Creates correct Tile Styler subtype based on rowHeight passed in by user */ MdGridList.prototype._setTileStyler = function () { if (this._rowHeight === MD_FIT_MODE) { this._tileStyler = new FitTileStyler(); } else if (this._rowHeight && this._rowHeight.match(/:/g)) { this._tileStyler = new RatioTileStyler(this._rowHeight); } else { this._tileStyler = new FixedTileStyler(this._rowHeight); } }; /** Computes and applies the size and position for all children grid tiles. */ MdGridList.prototype._layoutTiles = function () { var tiles = this._tiles.toArray(); var tracker = new TileCoordinator(this.cols, tiles); var direction = this._dir ? this._dir.value : 'ltr'; this._tileStyler.init(this.gutterSize, tracker, this.cols, direction); for (var i = 0; i < tiles.length; i++) { var pos = tracker.positions[i]; var tile = tiles[i]; this._tileStyler.setStyle(tile, pos.row, pos.col); } this._setListStyle(this._tileStyler.getComputedHeight()); }; /** Sets style on the main grid-list element, given the style name and value. */ MdGridList.prototype._setListStyle = function (style) { if (style) { this._renderer.setElementStyle(this._element.nativeElement, style[0], style[1]); } }; __decorate([ _angular_core.ContentChildren(MdGridTile), __metadata('design:type', _angular_core.QueryList) ], MdGridList.prototype, "_tiles", void 0); __decorate([ _angular_core.Input(), __metadata('design:type', Object) ], MdGridList.prototype, "cols", null); __decorate([ _angular_core.Input('gutterSize'), __metadata('design:type', Object) ], MdGridList.prototype, "gutterSize", null); __decorate([ _angular_core.Input(), __metadata('design:type', Object), __metadata('design:paramtypes', [Object]) ], MdGridList.prototype, "rowHeight", null); MdGridList = __decorate([ _angular_core.Component({selector: 'md-grid-list', template: "<div class=\"md-grid-list\"> <ng-content></ng-content> </div>", styles: ["/** * This mixin will ensure that lines that overflow the container will * hide the overflow and truncate neatly with an ellipsis. */ /** * This mixin provides all md-line styles, changing secondary font size * based on whether the list is in dense mode. */ /** * This mixin provides base styles for the wrapper around md-line * elements in a list. */ /** * This mixin normalizes default element styles, e.g. font weight for heading text. */ /* height of tile header or footer if it has one line */ /* height of tile header or footer if it has two lines */ /* side padding for text in tile headers and footers */ /* font styles for text in tile headers and footers */ md-grid-list { display: block; position: relative; } md-grid-tile { display: block; position: absolute; } md-grid-tile figure { display: flex; position: absolute; align-items: center; justify-content: center; height: 100%; top: 0; right: 0; bottom: 0; left: 0; padding: 0; margin: 0; } md-grid-tile md-grid-tile-header, md-grid-tile md-grid-tile-footer { display: flex; align-items: center; height: 48px; color: #fff; background: rgba(0, 0, 0, 0.18); overflow: hidden; padding: 0 16px; font-size: 16px; position: absolute; left: 0; right: 0; } md-grid-tile md-grid-tile-header [md-line], md-grid-tile md-grid-tile-footer [md-line] { white-space: nowrap; overflow-x: hidden; text-overflow: ellipsis; display: block; box-sizing: border-box; } md-grid-tile md-grid-tile-header [md-line]:nth-child(n+2), md-grid-tile md-grid-tile-footer [md-line]:nth-child(n+2) { font-size: 12px; } md-grid-tile md-grid-tile-header > *, md-grid-tile md-grid-tile-footer > * { margin: 0; padding: 0; font-weight: normal; font-size: inherit; } md-grid-tile md-grid-tile-header.md-2-line, md-grid-tile md-grid-tile-footer.md-2-line { height: 68px; } md-grid-tile .md-grid-list-text { display: flex; flex-direction: column; width: 100%; box-sizing: border-box; overflow: hidden; } md-grid-tile .md-grid-list-text > * { margin: 0; padding: 0; font-weight: normal; font-size: inherit; } md-grid-tile .md-grid-list-text:empty { display: none; } md-grid-tile md-grid-tile-header { top: 0; } md-grid-tile md-grid-tile-footer { bottom: 0; } md-grid-tile [md-grid-avatar] { padding-right: 16px; } [dir='rtl'] md-grid-tile [md-grid-avatar] { padding-right: 0; padding-left: 16px; } md-grid-tile [md-grid-avatar]:empty { display: none; } /*# sourceMappingURL=grid-list.css.map */ "], encapsulation: _angular_core.ViewEncapsulation.None, }), __param(2, _angular_core.Optional()), __metadata('design:paramtypes', [_angular_core.Renderer, _angular_core.ElementRef, _angular2Material_core.Dir]) ], MdGridList); return MdGridList; }()); var MdGridListModule = (function () { function MdGridListModule() { } MdGridListModule.forRoot = function () { return { ngModule: MdGridListModule, providers: [] }; }; MdGridListModule = __decorate([ _angular_core.NgModule({ imports: [_angular2Material_core.MdLineModule], exports: [MdGridList, MdGridTile, MdGridTileText, _angular2Material_core.MdLineModule], declarations: [MdGridList, MdGridTile, MdGridTileText], }), __metadata('design:paramtypes', []) ], MdGridListModule); return MdGridListModule; }()); exports.MdGridList = MdGridList; exports.MdGridListModule = MdGridListModule; Object.defineProperty(exports, '__esModule', { value: true }); })));