blob: 07231b1c8e4777538349b281db5384a684d6e90a [file] [log] [blame]
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/coercion"),require("@angular/core"),require("@angular/cdk/bidi"),require("@angular/cdk/collections"),require("@angular/cdk/platform"),require("@angular/common"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/cdk/table",["exports","@angular/cdk/coercion","@angular/core","@angular/cdk/bidi","@angular/cdk/collections","@angular/cdk/platform","@angular/common","rxjs","rxjs/operators"],e):e((t.ng=t.ng||{},t.ng.cdk=t.ng.cdk||{},t.ng.cdk.table={}),t.ng.cdk.coercion,t.ng.core,t.ng.cdk.bidi,t.ng.cdk.collections,t.ng.cdk.platform,t.ng.common,t.rxjs,t.rxjs.operators)}(this,function(t,e,o,r,n,i,s,a,c){"use strict";function l(t,e){function o(){this.constructor=t}R(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}function u(t){return function(t){function o(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var r=t.apply(this,e)||this;return r._sticky=!1,r._hasStickyChanged=!1,r}return l(o,t),Object.defineProperty(o.prototype,"sticky",{get:function(){return this._sticky},set:function(t){var o=this._sticky;this._sticky=e.coerceBooleanProperty(t),this._hasStickyChanged=o!==this._sticky},enumerable:!0,configurable:!0}),o.prototype.hasStickyChanged=function(){var t=this._hasStickyChanged;return this._hasStickyChanged=!1,t},o.prototype.resetStickyChanged=function(){this._hasStickyChanged=!1},o}(t)}function f(t){return Error('Could not find column with id "'+t+'".')}function h(t){return Error('Duplicate column definition name provided: "'+t+'".')}function d(){return Error("There can only be one default row without a when predicate function.")}function p(t){return Error("Could not find a matching row definition for theprovided row data: "+JSON.stringify(t))}function y(){return Error("Missing definitions for header, footer, and row; cannot determine which columns should be rendered.")}function _(){return Error("Provided data source did not match an array, Observable, or DataSource")}function m(){return Error("Text column could not find a parent table for registration.")}function w(){return Error("Table text column must have a name.")}function g(t,e){return t.toArray().concat(Array.from(e))}var R=function(t,e){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)},D=function(){function t(t){this.template=t}return t.decorators=[{type:o.Directive,args:[{selector:"[cdkCellDef]"}]}],t.ctorParameters=function(){return[{type:o.TemplateRef}]},t}(),C=function(){function t(t){this.template=t}return t.decorators=[{type:o.Directive,args:[{selector:"[cdkHeaderCellDef]"}]}],t.ctorParameters=function(){return[{type:o.TemplateRef}]},t}(),k=function(){function t(t){this.template=t}return t.decorators=[{type:o.Directive,args:[{selector:"[cdkFooterCellDef]"}]}],t.ctorParameters=function(){return[{type:o.TemplateRef}]},t}(),v=function(){function t(){}return t}(),S=u(v),b=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e._stickyEnd=!1,e}return l(r,t),Object.defineProperty(r.prototype,"name",{get:function(){return this._name},set:function(t){t&&(this._name=t,this.cssClassFriendlyName=t.replace(/[^a-z0-9_-]/gi,"-"))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"stickyEnd",{get:function(){return this._stickyEnd},set:function(t){var o=this._stickyEnd;this._stickyEnd=e.coerceBooleanProperty(t),this._hasStickyChanged=o!==this._stickyEnd},enumerable:!0,configurable:!0}),r.decorators=[{type:o.Directive,args:[{selector:"[cdkColumnDef]",inputs:["sticky"],providers:[{provide:"MAT_SORT_HEADER_COLUMN_DEF",useExisting:r}]}]}],r.propDecorators={name:[{type:o.Input,args:["cdkColumnDef"]}],stickyEnd:[{type:o.Input,args:["stickyEnd"]}],cell:[{type:o.ContentChild,args:[D,{static:!1}]}],headerCell:[{type:o.ContentChild,args:[C,{static:!1}]}],footerCell:[{type:o.ContentChild,args:[k,{static:!1}]}]},r}(S),O=function(){function t(t,e){var o="cdk-column-"+t.cssClassFriendlyName;e.nativeElement.classList.add(o)}return t}(),E=function(t){function e(e,o){return t.call(this,e,o)||this}return l(e,t),e.decorators=[{type:o.Directive,args:[{selector:"cdk-header-cell, th[cdk-header-cell]",host:{class:"cdk-header-cell",role:"columnheader"}}]}],e.ctorParameters=function(){return[{type:b},{type:o.ElementRef}]},e}(O),T=function(t){function e(e,o){return t.call(this,e,o)||this}return l(e,t),e.decorators=[{type:o.Directive,args:[{selector:"cdk-footer-cell, td[cdk-footer-cell]",host:{class:"cdk-footer-cell",role:"gridcell"}}]}],e.ctorParameters=function(){return[{type:b},{type:o.ElementRef}]},e}(O),x=function(t){function e(e,o){return t.call(this,e,o)||this}return l(e,t),e.decorators=[{type:o.Directive,args:[{selector:"cdk-cell, td[cdk-cell]",host:{class:"cdk-cell",role:"gridcell"}}]}],e.ctorParameters=function(){return[{type:b},{type:o.ElementRef}]},e}(O),P="<ng-container cdkCellOutlet></ng-container>",I=function(){function t(t,e){this.template=t,this._differs=e}return t.prototype.ngOnChanges=function(t){if(!this._columnsDiffer){var e=t.columns&&t.columns.currentValue||[];this._columnsDiffer=this._differs.find(e).create(),this._columnsDiffer.diff(e)}},t.prototype.getColumnsDiff=function(){return this._columnsDiffer.diff(this.columns)},t.prototype.extractCellTemplate=function(t){return this instanceof F?t.headerCell.template:this instanceof j?t.footerCell.template:t.cell.template},t}(),N=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e}(I),H=u(N),F=function(t){function e(e,o){return t.call(this,e,o)||this}return l(e,t),e.prototype.ngOnChanges=function(e){t.prototype.ngOnChanges.call(this,e)},e.decorators=[{type:o.Directive,args:[{selector:"[cdkHeaderRowDef]",inputs:["columns: cdkHeaderRowDef","sticky: cdkHeaderRowDefSticky"]}]}],e.ctorParameters=function(){return[{type:o.TemplateRef},{type:o.IterableDiffers}]},e}(H),A=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e}(I),B=u(A),j=function(t){function e(e,o){return t.call(this,e,o)||this}return l(e,t),e.prototype.ngOnChanges=function(e){t.prototype.ngOnChanges.call(this,e)},e.decorators=[{type:o.Directive,args:[{selector:"[cdkFooterRowDef]",inputs:["columns: cdkFooterRowDef","sticky: cdkFooterRowDefSticky"]}]}],e.ctorParameters=function(){return[{type:o.TemplateRef},{type:o.IterableDiffers}]},e}(B),M=function(t){function e(e,o){return t.call(this,e,o)||this}return l(e,t),e.decorators=[{type:o.Directive,args:[{selector:"[cdkRowDef]",inputs:["columns: cdkRowDefColumns","when: cdkRowDefWhen"]}]}],e.ctorParameters=function(){return[{type:o.TemplateRef},{type:o.IterableDiffers}]},e}(I),V=function(){function t(e){this._viewContainer=e,t.mostRecentCellOutlet=this}return t.prototype.ngOnDestroy=function(){t.mostRecentCellOutlet===this&&(t.mostRecentCellOutlet=null)},t.mostRecentCellOutlet=null,t.decorators=[{type:o.Directive,args:[{selector:"[cdkCellOutlet]"}]}],t.ctorParameters=function(){return[{type:o.ViewContainerRef}]},t}(),q=function(){function t(){}return t.decorators=[{type:o.Component,args:[{selector:"cdk-header-row, tr[cdk-header-row]",template:P,host:{class:"cdk-header-row",role:"row"},changeDetection:o.ChangeDetectionStrategy.Default,encapsulation:o.ViewEncapsulation.None}]}],t}(),L=function(){function t(){}return t.decorators=[{type:o.Component,args:[{selector:"cdk-footer-row, tr[cdk-footer-row]",template:P,host:{class:"cdk-footer-row",role:"row"},changeDetection:o.ChangeDetectionStrategy.Default,encapsulation:o.ViewEncapsulation.None}]}],t}(),U=function(){function t(){}return t.decorators=[{type:o.Component,args:[{selector:"cdk-row, tr[cdk-row]",template:P,host:{class:"cdk-row",role:"row"},changeDetection:o.ChangeDetectionStrategy.Default,encapsulation:o.ViewEncapsulation.None}]}],t}(),W=["top","bottom","left","right"],z=function(){function t(t,e,o,r){void 0===r&&(r=!0),this._isNativeHtmlTable=t,this._stickCellCss=e,this.direction=o,this._isBrowser=r}return t.prototype.clearStickyPositioning=function(t,e){for(var o=0,r=t;o<r.length;o++){var n=r[o];if(n.nodeType===n.ELEMENT_NODE){this._removeStickyStyle(n,e);for(var i=0;i<n.children.length;i++){var s=n.children[i];this._removeStickyStyle(s,e)}}}},t.prototype.updateStickyColumns=function(t,e,o){var r=e.some(function(t){return t})||o.some(function(t){return t});if(t.length&&r&&this._isBrowser)for(var n=t[0],i=n.children.length,s=this._getCellWidths(n),a=this._getStickyStartColumnPositions(s,e),c=this._getStickyEndColumnPositions(s,o),l="rtl"===this.direction,u=0,f=t;u<f.length;u++)for(var h=f[u],d=0;d<i;d++){var p=h.children[d];e[d]&&this._addStickyStyle(p,l?"right":"left",a[d]),o[d]&&this._addStickyStyle(p,l?"left":"right",c[d])}},t.prototype.stickRows=function(t,e,o){if(this._isBrowser)for(var r="bottom"===o?t.reverse():t,n=0,i=0;i<r.length;i++)if(e[i]){var s=r[i];if(this._isNativeHtmlTable)for(var a=0;a<s.children.length;a++){var c=s.children[a];this._addStickyStyle(c,o,n)}else this._addStickyStyle(s,o,n);if(i===r.length-1)return;n+=s.getBoundingClientRect().height}},t.prototype.updateStickyFooterContainer=function(t,e){if(this._isNativeHtmlTable){var o=t.querySelector("tfoot");e.some(function(t){return!t})?this._removeStickyStyle(o,["bottom"]):this._addStickyStyle(o,"bottom",0)}},t.prototype._removeStickyStyle=function(t,e){for(var o=0,r=e;o<r.length;o++){var n=r[o];t.style[n]=""}t.style.zIndex=this._getCalculatedZIndex(t),W.some(function(e){return!!t.style[e]})||(t.style.position="",t.classList.remove(this._stickCellCss))},t.prototype._addStickyStyle=function(t,e,o){t.classList.add(this._stickCellCss),t.style[e]=o+"px",t.style.cssText+="position: -webkit-sticky; position: sticky; ",t.style.zIndex=this._getCalculatedZIndex(t)},t.prototype._getCalculatedZIndex=function(t){for(var e={top:100,bottom:10,left:1,right:1},o=0,r=0,n=W;r<n.length;r++){var i=n[r];t.style[i]&&(o+=e[i])}return o?""+o:""},t.prototype._getCellWidths=function(t){for(var e=[],o=t.children,r=0;r<o.length;r++){var n=o[r];e.push(n.getBoundingClientRect().width)}return e},t.prototype._getStickyStartColumnPositions=function(t,e){for(var o=[],r=0,n=0;n<t.length;n++)e[n]&&(o[n]=r,r+=t[n]);return o},t.prototype._getStickyEndColumnPositions=function(t,e){for(var o=[],r=0,n=t.length;n>0;n--)e[n]&&(o[n]=r,r+=t[n]);return o},t}(),K=function(){function t(t,e){this.viewContainer=t,this.elementRef=e}return t.decorators=[{type:o.Directive,args:[{selector:"[rowOutlet]"}]}],t.ctorParameters=function(){return[{type:o.ViewContainerRef},{type:o.ElementRef}]},t}(),Z=function(){function t(t,e){this.viewContainer=t,this.elementRef=e}return t.decorators=[{type:o.Directive,args:[{selector:"[headerRowOutlet]"}]}],t.ctorParameters=function(){return[{type:o.ViewContainerRef},{type:o.ElementRef}]},t}(),J=function(){function t(t,e){this.viewContainer=t,this.elementRef=e}return t.decorators=[{type:o.Directive,args:[{selector:"[footerRowOutlet]"}]}],t.ctorParameters=function(){return[{type:o.ViewContainerRef},{type:o.ElementRef}]},t}(),X='\n <ng-content select="caption"></ng-content>\n <ng-container headerRowOutlet></ng-container>\n <ng-container rowOutlet></ng-container>\n <ng-container footerRowOutlet></ng-container>\n',$=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}l(e,t)}(o.EmbeddedViewRef),function(){function t(t,e,o,r,n,i,s){this._differs=t,this._changeDetectorRef=e,this._elementRef=o,this._dir=n,this._platform=s,this._onDestroy=new a.Subject,this._columnDefsByName=new Map,this._customColumnDefs=new Set,this._customRowDefs=new Set,this._customHeaderRowDefs=new Set,this._customFooterRowDefs=new Set,this._headerRowDefChanged=!0,this._footerRowDefChanged=!0,this._cachedRenderRowsMap=new Map,this.stickyCssClass="cdk-table-sticky",this._multiTemplateDataRows=!1,this.viewChange=new a.BehaviorSubject({start:0,end:Number.MAX_VALUE}),r||this._elementRef.nativeElement.setAttribute("role","grid"),this._document=i,this._isNativeHtmlTable="TABLE"===this._elementRef.nativeElement.nodeName}return Object.defineProperty(t.prototype,"trackBy",{get:function(){return this._trackByFn},set:function(t){o.isDevMode()&&null!=t&&"function"!=typeof t&&console&&console.warn&&console.warn("trackBy must be a function, but received "+JSON.stringify(t)+"."),this._trackByFn=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataSource",{get:function(){return this._dataSource},set:function(t){this._dataSource!==t&&this._switchDataSource(t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"multiTemplateDataRows",{get:function(){return this._multiTemplateDataRows},set:function(t){this._multiTemplateDataRows=e.coerceBooleanProperty(t),this._rowOutlet&&this._rowOutlet.viewContainer.length&&this._forceRenderDataRows()},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this._setupStickyStyler(),this._isNativeHtmlTable&&this._applyNativeTableSections(),this._dataDiffer=this._differs.find([]).create(function(e,o){return t.trackBy?t.trackBy(o.dataIndex,o.data):o})},t.prototype.ngAfterContentChecked=function(){if(this._cacheRowDefs(),this._cacheColumnDefs(),!this._headerRowDefs.length&&!this._footerRowDefs.length&&!this._rowDefs.length)throw y();this._renderUpdatedColumns(),this._headerRowDefChanged&&(this._forceRenderHeaderRows(),this._headerRowDefChanged=!1),this._footerRowDefChanged&&(this._forceRenderFooterRows(),this._footerRowDefChanged=!1),this.dataSource&&this._rowDefs.length>0&&!this._renderChangeSubscription&&this._observeRenderChanges(),this._checkStickyStates()},t.prototype.ngOnDestroy=function(){this._rowOutlet.viewContainer.clear(),this._headerRowOutlet.viewContainer.clear(),this._footerRowOutlet.viewContainer.clear(),this._cachedRenderRowsMap.clear(),this._onDestroy.next(),this._onDestroy.complete(),n.isDataSource(this.dataSource)&&this.dataSource.disconnect(this)},t.prototype.renderRows=function(){var t=this;this._renderRows=this._getAllRenderRows();var e=this._dataDiffer.diff(this._renderRows);if(e){var o=this._rowOutlet.viewContainer;e.forEachOperation(function(e,r,n){if(null==e.previousIndex)t._insertRow(e.item,n);else if(null==n)o.remove(r);else{var i=o.get(r);o.move(i,n)}}),this._updateRowIndexContext(),e.forEachIdentityChange(function(t){o.get(t.currentIndex).context.$implicit=t.item.data}),this.updateStickyColumnStyles()}},t.prototype.setHeaderRowDef=function(t){this._customHeaderRowDefs=new Set([t]),this._headerRowDefChanged=!0},t.prototype.setFooterRowDef=function(t){this._customFooterRowDefs=new Set([t]),this._footerRowDefChanged=!0},t.prototype.addColumnDef=function(t){this._customColumnDefs.add(t)},t.prototype.removeColumnDef=function(t){this._customColumnDefs.delete(t)},t.prototype.addRowDef=function(t){this._customRowDefs.add(t)},t.prototype.removeRowDef=function(t){this._customRowDefs.delete(t)},t.prototype.addHeaderRowDef=function(t){this._customHeaderRowDefs.add(t),this._headerRowDefChanged=!0},t.prototype.removeHeaderRowDef=function(t){this._customHeaderRowDefs.delete(t),this._headerRowDefChanged=!0},t.prototype.addFooterRowDef=function(t){this._customFooterRowDefs.add(t),this._footerRowDefChanged=!0},t.prototype.removeFooterRowDef=function(t){this._customFooterRowDefs.delete(t),this._footerRowDefChanged=!0},t.prototype.updateStickyHeaderRowStyles=function(){var t=this._getRenderedRows(this._headerRowOutlet),e=this._elementRef.nativeElement,o=e.querySelector("thead");o&&(o.style.display=t.length?"":"none");var r=this._headerRowDefs.map(function(t){return t.sticky});this._stickyStyler.clearStickyPositioning(t,["top"]),this._stickyStyler.stickRows(t,r,"top"),this._headerRowDefs.forEach(function(t){return t.resetStickyChanged()})},t.prototype.updateStickyFooterRowStyles=function(){var t=this._getRenderedRows(this._footerRowOutlet),e=this._elementRef.nativeElement,o=e.querySelector("tfoot");o&&(o.style.display=t.length?"":"none");var r=this._footerRowDefs.map(function(t){return t.sticky});this._stickyStyler.clearStickyPositioning(t,["bottom"]),this._stickyStyler.stickRows(t,r,"bottom"),this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement,r),this._footerRowDefs.forEach(function(t){return t.resetStickyChanged()})},t.prototype.updateStickyColumnStyles=function(){var t=this,e=this._getRenderedRows(this._headerRowOutlet),o=this._getRenderedRows(this._rowOutlet),r=this._getRenderedRows(this._footerRowOutlet);this._stickyStyler.clearStickyPositioning(e.concat(o,r),["left","right"]),e.forEach(function(e,o){t._addStickyColumnStyles([e],t._headerRowDefs[o])}),this._rowDefs.forEach(function(e){for(var r=[],n=0;n<o.length;n++)t._renderRows[n].rowDef===e&&r.push(o[n]);t._addStickyColumnStyles(r,e)}),r.forEach(function(e,o){t._addStickyColumnStyles([e],t._footerRowDefs[o])}),Array.from(this._columnDefsByName.values()).forEach(function(t){return t.resetStickyChanged()})},t.prototype._getAllRenderRows=function(){var t=[],e=this._cachedRenderRowsMap;this._cachedRenderRowsMap=new Map;for(var o=0;o<this._data.length;o++){var r=this._data[o],n=this._getRenderRowsForData(r,o,e.get(r));this._cachedRenderRowsMap.has(r)||this._cachedRenderRowsMap.set(r,new WeakMap);for(var i=0;i<n.length;i++){var s=n[i],a=this._cachedRenderRowsMap.get(s.data);a.has(s.rowDef)?a.get(s.rowDef).push(s):a.set(s.rowDef,[s]),t.push(s)}}return t},t.prototype._getRenderRowsForData=function(t,e,o){return this._getRowDefs(t,e).map(function(r){var n=o&&o.has(r)?o.get(r):[];if(n.length){var i=n.shift();return i.dataIndex=e,i}return{data:t,rowDef:r,dataIndex:e}})},t.prototype._cacheColumnDefs=function(){var t=this;this._columnDefsByName.clear(),g(this._contentColumnDefs,this._customColumnDefs).forEach(function(e){if(t._columnDefsByName.has(e.name))throw h(e.name);t._columnDefsByName.set(e.name,e)})},t.prototype._cacheRowDefs=function(){this._headerRowDefs=g(this._contentHeaderRowDefs,this._customHeaderRowDefs),this._footerRowDefs=g(this._contentFooterRowDefs,this._customFooterRowDefs),this._rowDefs=g(this._contentRowDefs,this._customRowDefs);var t=this._rowDefs.filter(function(t){return!t.when});if(!this.multiTemplateDataRows&&t.length>1)throw d();this._defaultRowDef=t[0]},t.prototype._renderUpdatedColumns=function(){var t=function(t,e){return t||!!e.getColumnsDiff()};this._rowDefs.reduce(t,!1)&&this._forceRenderDataRows(),this._headerRowDefs.reduce(t,!1)&&this._forceRenderHeaderRows(),this._footerRowDefs.reduce(t,!1)&&this._forceRenderFooterRows()},t.prototype._switchDataSource=function(t){this._data=[],n.isDataSource(this.dataSource)&&this.dataSource.disconnect(this),this._renderChangeSubscription&&(this._renderChangeSubscription.unsubscribe(),this._renderChangeSubscription=null),t||(this._dataDiffer&&this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear()),this._dataSource=t},t.prototype._observeRenderChanges=function(){var t=this;if(this.dataSource){var e;if(n.isDataSource(this.dataSource)?e=this.dataSource.connect(this):this.dataSource instanceof a.Observable?e=this.dataSource:Array.isArray(this.dataSource)&&(e=a.of(this.dataSource)),void 0===e)throw _();this._renderChangeSubscription=e.pipe(c.takeUntil(this._onDestroy)).subscribe(function(e){t._data=e||[],t.renderRows()})}},t.prototype._forceRenderHeaderRows=function(){var t=this;this._headerRowOutlet.viewContainer.length>0&&this._headerRowOutlet.viewContainer.clear(),this._headerRowDefs.forEach(function(e,o){return t._renderRow(t._headerRowOutlet,e,o)}),this.updateStickyHeaderRowStyles(),this.updateStickyColumnStyles()},t.prototype._forceRenderFooterRows=function(){var t=this;this._footerRowOutlet.viewContainer.length>0&&this._footerRowOutlet.viewContainer.clear(),this._footerRowDefs.forEach(function(e,o){return t._renderRow(t._footerRowOutlet,e,o)}),this.updateStickyFooterRowStyles(),this.updateStickyColumnStyles()},t.prototype._addStickyColumnStyles=function(t,e){var o=this,r=Array.from(e.columns||[]).map(function(t){var e=o._columnDefsByName.get(t);if(!e)throw f(t);return e}),n=r.map(function(t){return t.sticky}),i=r.map(function(t){return t.stickyEnd});this._stickyStyler.updateStickyColumns(t,n,i)},t.prototype._getRenderedRows=function(t){for(var e=[],o=0;o<t.viewContainer.length;o++){var r=t.viewContainer.get(o);e.push(r.rootNodes[0])}return e},t.prototype._getRowDefs=function(t,e){if(1==this._rowDefs.length)return[this._rowDefs[0]];var o=[];if(this.multiTemplateDataRows)o=this._rowDefs.filter(function(o){return!o.when||o.when(e,t)});else{var r=this._rowDefs.find(function(o){return o.when&&o.when(e,t)})||this._defaultRowDef;r&&o.push(r)}if(!o.length)throw p(t);return o},t.prototype._insertRow=function(t,e){var o=t.rowDef,r={$implicit:t.data};this._renderRow(this._rowOutlet,o,e,r)},t.prototype._renderRow=function(t,e,o,r){void 0===r&&(r={}),t.viewContainer.createEmbeddedView(e.template,r,o);for(var n=0,i=this._getCellTemplates(e);n<i.length;n++){var s=i[n];V.mostRecentCellOutlet&&V.mostRecentCellOutlet._viewContainer.createEmbeddedView(s,r)}this._changeDetectorRef.markForCheck()},t.prototype._updateRowIndexContext=function(){for(var t=this._rowOutlet.viewContainer,e=0,o=t.length;e<o;e++){var r=t.get(e),n=r.context;n.count=o,n.first=0===e,n.last=e===o-1,n.even=e%2==0,n.odd=!n.even,this.multiTemplateDataRows?(n.dataIndex=this._renderRows[e].dataIndex,n.renderIndex=e):n.index=this._renderRows[e].dataIndex}},t.prototype._getCellTemplates=function(t){var e=this;return t&&t.columns?Array.from(t.columns,function(o){var r=e._columnDefsByName.get(o);if(!r)throw f(o);return t.extractCellTemplate(r)}):[]},t.prototype._applyNativeTableSections=function(){for(var t=this._document.createDocumentFragment(),e=[{tag:"thead",outlet:this._headerRowOutlet},{tag:"tbody",outlet:this._rowOutlet},{tag:"tfoot",outlet:this._footerRowOutlet}],o=0,r=e;o<r.length;o++){var n=r[o],i=this._document.createElement(n.tag);i.setAttribute("role","rowgroup"),i.appendChild(n.outlet.elementRef.nativeElement),t.appendChild(i)}this._elementRef.nativeElement.appendChild(t)},t.prototype._forceRenderDataRows=function(){this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear(),this.renderRows(),this.updateStickyColumnStyles()},t.prototype._checkStickyStates=function(){var t=function(t,e){return t||e.hasStickyChanged()};this._headerRowDefs.reduce(t,!1)&&this.updateStickyHeaderRowStyles(),this._footerRowDefs.reduce(t,!1)&&this.updateStickyFooterRowStyles(),Array.from(this._columnDefsByName.values()).reduce(t,!1)&&this.updateStickyColumnStyles()},t.prototype._setupStickyStyler=function(){var t=this,e=this._dir?this._dir.value:"ltr";this._stickyStyler=new z(this._isNativeHtmlTable,this.stickyCssClass,e,this._platform.isBrowser),(this._dir?this._dir.change:a.of()).pipe(c.takeUntil(this._onDestroy)).subscribe(function(e){t._stickyStyler.direction=e,t.updateStickyColumnStyles()})},t.decorators=[{type:o.Component,args:[{selector:"cdk-table, table[cdk-table]",exportAs:"cdkTable",template:X,host:{class:"cdk-table"},encapsulation:o.ViewEncapsulation.None,changeDetection:o.ChangeDetectionStrategy.Default}]}],t.ctorParameters=function(){return[{type:o.IterableDiffers},{type:o.ChangeDetectorRef},{type:o.ElementRef},{type:String,decorators:[{type:o.Attribute,args:["role"]}]},{type:r.Directionality,decorators:[{type:o.Optional}]},{type:void 0,decorators:[{type:o.Inject,args:[s.DOCUMENT]}]},{type:i.Platform}]},t.propDecorators={trackBy:[{type:o.Input}],dataSource:[{type:o.Input}],multiTemplateDataRows:[{type:o.Input}],_rowOutlet:[{type:o.ViewChild,args:[K,{static:!0}]}],_headerRowOutlet:[{type:o.ViewChild,args:[Z,{static:!0}]}],_footerRowOutlet:[{type:o.ViewChild,args:[J,{static:!0}]}],_contentColumnDefs:[{type:o.ContentChildren,args:[b]}],_contentRowDefs:[{type:o.ContentChildren,args:[M]}],_contentHeaderRowDefs:[{type:o.ContentChildren,args:[F]}],_contentFooterRowDefs:[{type:o.ContentChildren,args:[j]}]},t}()),Y=new o.InjectionToken("text-column-options"),G=function(){function t(t,e){this._table=t,this._options=e,this.justify="start",this._options=e||{}}return Object.defineProperty(t.prototype,"name",{get:function(){return this._name},set:function(t){this._name=t,this._syncColumnDefName()},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){if(this._syncColumnDefName(),void 0===this.headerText&&(this.headerText=this._createDefaultHeaderText()),this.dataAccessor||(this.dataAccessor=this._options.defaultDataAccessor||function(t,e){return t[e]}),!this._table)throw m();this.columnDef.cell=this.cell,this.columnDef.headerCell=this.headerCell,this._table.addColumnDef(this.columnDef)},t.prototype.ngOnDestroy=function(){this._table&&this._table.removeColumnDef(this.columnDef)},t.prototype._createDefaultHeaderText=function(){var t=this.name;if(o.isDevMode()&&!t)throw w();return this._options&&this._options.defaultHeaderTextTransform?this._options.defaultHeaderTextTransform(t):t[0].toUpperCase()+t.slice(1)},t.prototype._syncColumnDefName=function(){this.columnDef&&(this.columnDef.name=this.name)},t.decorators=[{type:o.Component,args:[{selector:"cdk-text-column",template:'\n <ng-container cdkColumnDef>\n <th cdk-header-cell *cdkHeaderCellDef [style.text-align]="justify">\n {{headerText}}\n </th>\n <td cdk-cell *cdkCellDef="let data" [style.text-align]="justify">\n {{dataAccessor(data, name)}}\n </td>\n </ng-container>\n ',encapsulation:o.ViewEncapsulation.None,changeDetection:o.ChangeDetectionStrategy.Default}]}],t.ctorParameters=function(){return[{type:$,decorators:[{type:o.Optional}]},{type:void 0,decorators:[{type:o.Optional},{type:o.Inject,args:[Y]}]}]},t.propDecorators={name:[{type:o.Input}],headerText:[{type:o.Input}],dataAccessor:[{type:o.Input}],justify:[{type:o.Input}],columnDef:[{type:o.ViewChild,args:[b,{static:!0}]}],cell:[{type:o.ViewChild,args:[D,{static:!0}]}],headerCell:[{type:o.ViewChild,args:[C,{static:!0}]}]},t}(),Q=[$,M,D,V,C,k,b,x,U,E,T,q,F,L,j,K,Z,J,G],tt=function(){function t(){}return t.decorators=[{type:o.NgModule,args:[{imports:[s.CommonModule],exports:Q,declarations:Q}]}],t}();t.DataSource=n.DataSource,t.DataRowOutlet=K,t.HeaderRowOutlet=Z,t.FooterRowOutlet=J,t.CDK_TABLE_TEMPLATE=X,t.CdkTable=$,t.CdkCellDef=D,t.CdkHeaderCellDef=C,t.CdkFooterCellDef=k,t.CdkColumnDef=b,t.BaseCdkCell=O,t.CdkHeaderCell=E,t.CdkFooterCell=T,t.CdkCell=x,t.CDK_ROW_TEMPLATE=P,t.BaseRowDef=I,t.CdkHeaderRowDef=F,t.CdkFooterRowDef=j,t.CdkRowDef=M,t.CdkCellOutlet=V,t.CdkHeaderRow=q,t.CdkFooterRow=L,t.CdkRow=U,t.CdkTableModule=tt,t.STICKY_DIRECTIONS=W,t.StickyStyler=z,t.mixinHasStickyInput=u,t.TEXT_COLUMN_OPTIONS=Y,t.CdkTextColumn=G,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=cdk-table.umd.min.js.map