!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),require("@angular/cdk/bidi"),require("@angular/cdk/coercion"),require("@angular/cdk/collections"),require("@angular/cdk/platform"),require("@angular/common"),require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/cdk/table",["exports","tslib","@angular/cdk/bidi","@angular/cdk/coercion","@angular/cdk/collections","@angular/cdk/platform","@angular/common","@angular/core","rxjs","rxjs/operators"],t):t(((e=e||self).ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.table={}),e.tslib,e.ng.cdk.bidi,e.ng.cdk.coercion,e.ng.cdk.collections,e.ng.cdk.platform,e.ng.common,e.ng.core,e.rxjs,e.rxjs.operators)}(this,(function(e,t,o,r,n,i,s,a,c,l){"use strict"; /** * @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 u(e){return function(e){function o(){for(var o=[],r=0;r",D=function(){function e(e,t){this.template=e,this._differs=t}return e.prototype.ngOnChanges=function(e){if(!this._columnsDiffer){var t=e.columns&&e.columns.currentValue||[];this._columnsDiffer=this._differs.find(t).create(),this._columnsDiffer.diff(t)}},e.prototype.getColumnsDiff=function(){return this._columnsDiffer.diff(this.columns)},e.prototype.extractCellTemplate=function(e){return this instanceof C?e.headerCell.template:this instanceof k?e.footerCell.template:e.cell.template},e}(),C=function(e){function o(t,o){return e.call(this,t,o)||this}return t.__extends(o,e),o.prototype.ngOnChanges=function(t){e.prototype.ngOnChanges.call(this,t)},o.decorators=[{type:a.Directive,args:[{selector:"[cdkHeaderRowDef]",inputs:["columns: cdkHeaderRowDef","sticky: cdkHeaderRowDefSticky"]}]}],o.ctorParameters=function(){return[{type:a.TemplateRef},{type:a.IterableDiffers}]},o}(u(function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(o,e),o}(D))),k=function(e){function o(t,o){return e.call(this,t,o)||this}return t.__extends(o,e),o.prototype.ngOnChanges=function(t){e.prototype.ngOnChanges.call(this,t)},o.decorators=[{type:a.Directive,args:[{selector:"[cdkFooterRowDef]",inputs:["columns: cdkFooterRowDef","sticky: cdkFooterRowDefSticky"]}]}],o.ctorParameters=function(){return[{type:a.TemplateRef},{type:a.IterableDiffers}]},o}(u(function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(o,e),o}(D))),v=function(e){function o(t,o){return e.call(this,t,o)||this}return t.__extends(o,e),o.decorators=[{type:a.Directive,args:[{selector:"[cdkRowDef]",inputs:["columns: cdkRowDefColumns","when: cdkRowDefWhen"]}]}],o.ctorParameters=function(){return[{type:a.TemplateRef},{type:a.IterableDiffers}]},o}(D),S=function(){function e(t){this._viewContainer=t,e.mostRecentCellOutlet=this}return e.prototype.ngOnDestroy=function(){e.mostRecentCellOutlet===this&&(e.mostRecentCellOutlet=null)},e.mostRecentCellOutlet=null,e.decorators=[{type:a.Directive,args:[{selector:"[cdkCellOutlet]"}]}],e.ctorParameters=function(){return[{type:a.ViewContainerRef}]},e}(),b=function(){function e(){}return e.decorators=[{type:a.Component,args:[{selector:"cdk-header-row, tr[cdk-header-row]",template:R,host:{class:"cdk-header-row",role:"row"},changeDetection:a.ChangeDetectionStrategy.Default,encapsulation:a.ViewEncapsulation.None}]}],e}(),O=function(){function e(){}return e.decorators=[{type:a.Component,args:[{selector:"cdk-footer-row, tr[cdk-footer-row]",template:R,host:{class:"cdk-footer-row",role:"row"},changeDetection:a.ChangeDetectionStrategy.Default,encapsulation:a.ViewEncapsulation.None}]}],e}(),x=function(){function e(){}return e.decorators=[{type:a.Component,args:[{selector:"cdk-row, tr[cdk-row]",template:R,host:{class:"cdk-row",role:"row"},changeDetection:a.ChangeDetectionStrategy.Default,encapsulation:a.ViewEncapsulation.None}]}],e}(),E=["top","bottom","left","right"],T=function(){function e(e,t,o,r){void 0===r&&(r=!0),this._isNativeHtmlTable=e,this._stickCellCss=t,this.direction=o,this._isBrowser=r}return e.prototype.clearStickyPositioning=function(e,o){var r,n;try{for(var i=t.__values(e),s=i.next();!s.done;s=i.next()){var a=s.value;if(a.nodeType===a.ELEMENT_NODE){this._removeStickyStyle(a,o);for(var c=0;c0;n--)t[n]&&(o[n]=r,r+=e[n]);return o},e}(); /** * @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 I(e){return Error('Could not find column with id "'+e+'".')} /** * @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 */ var P,N=function(){function e(e,t){this.viewContainer=e,this.elementRef=t}return e.decorators=[{type:a.Directive,args:[{selector:"[rowOutlet]"}]}],e.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},e}(),H=function(){function e(e,t){this.viewContainer=e,this.elementRef=t}return e.decorators=[{type:a.Directive,args:[{selector:"[headerRowOutlet]"}]}],e.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},e}(),F=function(){function e(e,t){this.viewContainer=e,this.elementRef=t}return e.decorators=[{type:a.Directive,args:[{selector:"[footerRowOutlet]"}]}],e.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},e}(),B='\n \n \n \n \n',A=(t.__extends((function j(){return null!==P&&P.apply(this,arguments)||this}),P=a.EmbeddedViewRef),function(){function e(e,t,o,r,n,i,s){this._differs=e,this._changeDetectorRef=t,this._elementRef=o,this._dir=n,this._platform=s,this._onDestroy=new c.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 c.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(e.prototype,"trackBy",{get:function(){return this._trackByFn},set:function(e){a.isDevMode()&&null!=e&&"function"!=typeof e&&console&&console.warn&&console.warn("trackBy must be a function, but received "+JSON.stringify(e)+"."),this._trackByFn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataSource",{get:function(){return this._dataSource},set:function(e){this._dataSource!==e&&this._switchDataSource(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"multiTemplateDataRows",{get:function(){return this._multiTemplateDataRows},set:function(e){this._multiTemplateDataRows=r.coerceBooleanProperty(e),this._rowOutlet&&this._rowOutlet.viewContainer.length&&this._forceRenderDataRows()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this._setupStickyStyler(),this._isNativeHtmlTable&&this._applyNativeTableSections(),this._dataDiffer=this._differs.find([]).create((function(t,o){return e.trackBy?e.trackBy(o.dataIndex,o.data):o}))},e.prototype.ngAfterContentChecked=function(){if(this._cacheRowDefs(),this._cacheColumnDefs(),!this._headerRowDefs.length&&!this._footerRowDefs.length&&!this._rowDefs.length)throw function e(){return Error("Missing definitions for header, footer, and row; cannot determine which columns should be rendered.")}();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()},e.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)},e.prototype.renderRows=function(){var e=this;this._renderRows=this._getAllRenderRows();var t=this._dataDiffer.diff(this._renderRows);if(t){var o=this._rowOutlet.viewContainer;t.forEachOperation((function(t,r,n){if(null==t.previousIndex)e._insertRow(t.item,n);else if(null==n)o.remove(r);else{var i=o.get(r);o.move(i,n)}})),this._updateRowIndexContext(),t.forEachIdentityChange((function(e){o.get(e.currentIndex).context.$implicit=e.item.data})),this.updateStickyColumnStyles()}},e.prototype.setHeaderRowDef=function(e){this._customHeaderRowDefs=new Set([e]),this._headerRowDefChanged=!0},e.prototype.setFooterRowDef=function(e){this._customFooterRowDefs=new Set([e]),this._footerRowDefChanged=!0},e.prototype.addColumnDef=function(e){this._customColumnDefs.add(e)},e.prototype.removeColumnDef=function(e){this._customColumnDefs.delete(e)},e.prototype.addRowDef=function(e){this._customRowDefs.add(e)},e.prototype.removeRowDef=function(e){this._customRowDefs.delete(e)},e.prototype.addHeaderRowDef=function(e){this._customHeaderRowDefs.add(e),this._headerRowDefChanged=!0},e.prototype.removeHeaderRowDef=function(e){this._customHeaderRowDefs.delete(e),this._headerRowDefChanged=!0},e.prototype.addFooterRowDef=function(e){this._customFooterRowDefs.add(e),this._footerRowDefChanged=!0},e.prototype.removeFooterRowDef=function(e){this._customFooterRowDefs.delete(e),this._footerRowDefChanged=!0},e.prototype.updateStickyHeaderRowStyles=function(){var e=this._getRenderedRows(this._headerRowOutlet),t=this._elementRef.nativeElement.querySelector("thead");t&&(t.style.display=e.length?"":"none");var o=this._headerRowDefs.map((function(e){return e.sticky}));this._stickyStyler.clearStickyPositioning(e,["top"]),this._stickyStyler.stickRows(e,o,"top"),this._headerRowDefs.forEach((function(e){return e.resetStickyChanged()}))},e.prototype.updateStickyFooterRowStyles=function(){var e=this._getRenderedRows(this._footerRowOutlet),t=this._elementRef.nativeElement.querySelector("tfoot");t&&(t.style.display=e.length?"":"none");var o=this._footerRowDefs.map((function(e){return e.sticky}));this._stickyStyler.clearStickyPositioning(e,["bottom"]),this._stickyStyler.stickRows(e,o,"bottom"),this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement,o),this._footerRowDefs.forEach((function(e){return e.resetStickyChanged()}))},e.prototype.updateStickyColumnStyles=function(){var e=this,o=this._getRenderedRows(this._headerRowOutlet),r=this._getRenderedRows(this._rowOutlet),n=this._getRenderedRows(this._footerRowOutlet);this._stickyStyler.clearStickyPositioning(t.__spread(o,r,n),["left","right"]),o.forEach((function(t,o){e._addStickyColumnStyles([t],e._headerRowDefs[o])})),this._rowDefs.forEach((function(t){for(var o=[],n=0;n1)throw function t(){return Error("There can only be one default row without a when predicate function.")}();this._defaultRowDef=e[0]},e.prototype._renderUpdatedColumns=function(){var e=function(e,t){return e||!!t.getColumnsDiff()};this._rowDefs.reduce(e,!1)&&this._forceRenderDataRows(),this._headerRowDefs.reduce(e,!1)&&this._forceRenderHeaderRows(),this._footerRowDefs.reduce(e,!1)&&this._forceRenderFooterRows()},e.prototype._switchDataSource=function(e){this._data=[],n.isDataSource(this.dataSource)&&this.dataSource.disconnect(this),this._renderChangeSubscription&&(this._renderChangeSubscription.unsubscribe(),this._renderChangeSubscription=null),e||(this._dataDiffer&&this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear()),this._dataSource=e},e.prototype._observeRenderChanges=function(){var e=this;if(this.dataSource){var t;if(n.isDataSource(this.dataSource)?t=this.dataSource.connect(this):c.isObservable(this.dataSource)?t=this.dataSource:Array.isArray(this.dataSource)&&(t=c.of(this.dataSource)),void 0===t)throw function o(){return Error("Provided data source did not match an array, Observable, or DataSource")}();this._renderChangeSubscription=t.pipe(l.takeUntil(this._onDestroy)).subscribe((function(t){e._data=t||[],e.renderRows()}))}},e.prototype._forceRenderHeaderRows=function(){var e=this;this._headerRowOutlet.viewContainer.length>0&&this._headerRowOutlet.viewContainer.clear(),this._headerRowDefs.forEach((function(t,o){return e._renderRow(e._headerRowOutlet,t,o)})),this.updateStickyHeaderRowStyles(),this.updateStickyColumnStyles()},e.prototype._forceRenderFooterRows=function(){var e=this;this._footerRowOutlet.viewContainer.length>0&&this._footerRowOutlet.viewContainer.clear(),this._footerRowDefs.forEach((function(t,o){return e._renderRow(e._footerRowOutlet,t,o)})),this.updateStickyFooterRowStyles(),this.updateStickyColumnStyles()},e.prototype._addStickyColumnStyles=function(e,t){var o=this,r=Array.from(t.columns||[]).map((function(e){var t=o._columnDefsByName.get(e);if(!t)throw I(e);return t})),n=r.map((function(e){return e.sticky})),i=r.map((function(e){return e.stickyEnd}));this._stickyStyler.updateStickyColumns(e,n,i)},e.prototype._getRenderedRows=function(e){for(var t=[],o=0;o\n \n {{headerText}}\n \n \n {{dataAccessor(data, name)}}\n \n \n ',encapsulation:a.ViewEncapsulation.None,changeDetection:a.ChangeDetectionStrategy.Default}]}],e.ctorParameters=function(){return[{type:A,decorators:[{type:a.Optional}]},{type:void 0,decorators:[{type:a.Optional},{type:a.Inject,args:[V]}]}]},e.propDecorators={name:[{type:a.Input}],headerText:[{type:a.Input}],dataAccessor:[{type:a.Input}],justify:[{type:a.Input}],columnDef:[{type:a.ViewChild,args:[y,{static:!0}]}],cell:[{type:a.ViewChild,args:[d,{static:!0}]}],headerCell:[{type:a.ViewChild,args:[h,{static:!0}]}]},e}(),L=[A,v,d,S,h,p,y,g,x,m,w,b,C,O,k,N,H,F,q],U=function(){function e(){}return e.decorators=[{type:a.NgModule,args:[{exports:L,declarations:L}]}],e}(); /** * @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 */ Object.defineProperty(e,"DataSource",{enumerable:!0,get:function(){return n.DataSource}}),e.BaseCdkCell=f,e.BaseRowDef=D,e.CDK_ROW_TEMPLATE=R,e.CDK_TABLE_TEMPLATE=B,e.CdkCell=g,e.CdkCellDef=d,e.CdkCellOutlet=S,e.CdkColumnDef=y,e.CdkFooterCell=w,e.CdkFooterCellDef=p,e.CdkFooterRow=O,e.CdkFooterRowDef=k,e.CdkHeaderCell=m,e.CdkHeaderCellDef=h,e.CdkHeaderRow=b,e.CdkHeaderRowDef=C,e.CdkRow=x,e.CdkRowDef=v,e.CdkTable=A,e.CdkTableModule=U,e.CdkTextColumn=q,e.DataRowOutlet=N,e.FooterRowOutlet=F,e.HeaderRowOutlet=H,e.STICKY_DIRECTIONS=E,e.StickyStyler=T,e.TEXT_COLUMN_OPTIONS=V,e.mixinHasStickyInput=u,Object.defineProperty(e,"__esModule",{value:!0})}));