/** * @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",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;o0;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 \n \n \n \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;n1)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\n \n {{headerText}}\n \n \n {{dataAccessor(data, name)}}\n \n \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