UNPKG

@angular/cdk

Version:

Angular Material Component Development Kit

46 lines 28.7 kB
!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<arguments.length;r++)o[r]=arguments[r];var n=e.apply(this,t.__spread(o))||this;return n._sticky=!1,n._hasStickyChanged=!1,n}return t.__extends(o,e),Object.defineProperty(o.prototype,"sticky",{get:function(){return this._sticky},set:function(e){var t=this._sticky;this._sticky=r.coerceBooleanProperty(e),this._hasStickyChanged=t!==this._sticky},enumerable:!0,configurable:!0}),o.prototype.hasStickyChanged=function(){var e=this._hasStickyChanged;return this._hasStickyChanged=!1,e},o.prototype.resetStickyChanged=function(){this._hasStickyChanged=!1},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 */var f,d=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[cdkCellDef]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),h=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[cdkHeaderCellDef]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),p=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[cdkFooterCellDef]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),y=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t._stickyEnd=!1,t}return t.__extends(o,e),Object.defineProperty(o.prototype,"name",{get:function(){return this._name},set:function(e){e&&(this._name=e,this.cssClassFriendlyName=e.replace(/[^a-z0-9_-]/gi,"-"))},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"stickyEnd",{get:function(){return this._stickyEnd},set:function(e){var t=this._stickyEnd;this._stickyEnd=r.coerceBooleanProperty(e),this._hasStickyChanged=t!==this._stickyEnd},enumerable:!0,configurable:!0}),o.decorators=[{type:a.Directive,args:[{selector:"[cdkColumnDef]",inputs:["sticky"],providers:[{provide:"MAT_SORT_HEADER_COLUMN_DEF",useExisting:o}]}]}],o.propDecorators={name:[{type:a.Input,args:["cdkColumnDef"]}],stickyEnd:[{type:a.Input,args:["stickyEnd"]}],cell:[{type:a.ContentChild,args:[d]}],headerCell:[{type:a.ContentChild,args:[h]}],footerCell:[{type:a.ContentChild,args:[p]}]},o}(u((function _(){}))),m=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:"cdk-header-cell, th[cdk-header-cell]",host:{class:"cdk-header-cell",role:"columnheader"}}]}],o.ctorParameters=function(){return[{type:y},{type:a.ElementRef}]},o}(f=function f(e,t){t.nativeElement.classList.add("cdk-column-"+e.cssClassFriendlyName)}),w=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:"cdk-footer-cell, td[cdk-footer-cell]",host:{class:"cdk-footer-cell",role:"gridcell"}}]}],o.ctorParameters=function(){return[{type:y},{type:a.ElementRef}]},o}(f),g=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:"cdk-cell, td[cdk-cell]",host:{class:"cdk-cell",role:"gridcell"}}]}],o.ctorParameters=function(){return[{type:y},{type:a.ElementRef}]},o}(f),R="<ng-container cdkCellOutlet></ng-container>",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;c<a.children.length;c++)this._removeStickyStyle(a.children[c],o)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},e.prototype.updateStickyColumns=function(e,o,r){var n,i,s=o.some((function(e){return e}))||r.some((function(e){return e}));if(e.length&&s&&this._isBrowser){var a=e[0],c=a.children.length,l=this._getCellWidths(a),u=this._getStickyStartColumnPositions(l,o),f=this._getStickyEndColumnPositions(l,r),d="rtl"===this.direction;try{for(var h=t.__values(e),p=h.next();!p.done;p=h.next())for(var y=p.value,_=0;_<c;_++){var m=y.children[_];o[_]&&this._addStickyStyle(m,d?"right":"left",u[_]),r[_]&&this._addStickyStyle(m,d?"left":"right",f[_])}}catch(e){n={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}}},e.prototype.stickRows=function(e,t,o){if(this._isBrowser)for(var r="bottom"===o?e.reverse():e,n=0,i=0;i<r.length;i++)if(t[i]){var s=r[i];if(this._isNativeHtmlTable)for(var a=0;a<s.children.length;a++)this._addStickyStyle(s.children[a],o,n);else this._addStickyStyle(s,o,n);if(i===r.length-1)return;n+=s.getBoundingClientRect().height}},e.prototype.updateStickyFooterContainer=function(e,t){if(this._isNativeHtmlTable){var o=e.querySelector("tfoot");t.some((function(e){return!e}))?this._removeStickyStyle(o,["bottom"]):this._addStickyStyle(o,"bottom",0)}},e.prototype._removeStickyStyle=function(e,o){var r,n;try{for(var i=t.__values(o),s=i.next();!s.done;s=i.next())e.style[s.value]=""}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.style.zIndex=this._getCalculatedZIndex(e),E.some((function(t){return!!e.style[t]}))||(e.style.position="",e.classList.remove(this._stickCellCss))},e.prototype._addStickyStyle=function(e,t,o){e.classList.add(this._stickCellCss),e.style[t]=o+"px",e.style.cssText+="position: -webkit-sticky; position: sticky; ",e.style.zIndex=this._getCalculatedZIndex(e)},e.prototype._getCalculatedZIndex=function(e){var o,r,n={top:100,bottom:10,left:1,right:1},i=0;try{for(var s=t.__values(E),a=s.next();!a.done;a=s.next()){var c=a.value;e.style[c]&&(i+=n[c])}}catch(e){o={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i?""+i:""},e.prototype._getCellWidths=function(e){for(var t=[],o=e.children,r=0;r<o.length;r++)t.push(o[r].getBoundingClientRect().width);return t},e.prototype._getStickyStartColumnPositions=function(e,t){for(var o=[],r=0,n=0;n<e.length;n++)t[n]&&(o[n]=r,r+=e[n]);return o},e.prototype._getStickyEndColumnPositions=function(e,t){for(var o=[],r=0,n=e.length;n>0;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 <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',A=(t.__extends((function M(){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;n<r.length;n++)e._renderRows[n].rowDef===t&&o.push(r[n]);e._addStickyColumnStyles(o,t)})),n.forEach((function(t,o){e._addStickyColumnStyles([t],e._footerRowDefs[o])})),Array.from(this._columnDefsByName.values()).forEach((function(e){return e.resetStickyChanged()}))},e.prototype._getAllRenderRows=function(){var e=[],t=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,t.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]),e.push(s)}}return e},e.prototype._getRenderRowsForData=function(e,t,o){return this._getRowDefs(e,t).map((function(r){var n=o&&o.has(r)?o.get(r):[];if(n.length){var i=n.shift();return i.dataIndex=t,i}return{data:e,rowDef:r,dataIndex:t}}))},e.prototype._cacheColumnDefs=function(){var e=this;this._columnDefsByName.clear(),j(this._contentColumnDefs,this._customColumnDefs).forEach((function(t){if(e._columnDefsByName.has(t.name))throw function o(e){return Error('Duplicate column definition name provided: "'+e+'".')}(t.name);e._columnDefsByName.set(t.name,t)}))},e.prototype._cacheRowDefs=function(){this._headerRowDefs=j(this._contentHeaderRowDefs,this._customHeaderRowDefs),this._footerRowDefs=j(this._contentFooterRowDefs,this._customFooterRowDefs),this._rowDefs=j(this._contentRowDefs,this._customRowDefs);var e=this._rowDefs.filter((function(e){return!e.when}));if(!this.multiTemplateDataRows&&e.length>1)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):this.dataSource instanceof c.Observable?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<e.viewContainer.length;o++){var r=e.viewContainer.get(o);t.push(r.rootNodes[0])}return t},e.prototype._getRowDefs=function(e,t){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(t,e)}));else{var r=this._rowDefs.find((function(o){return o.when&&o.when(t,e)}))||this._defaultRowDef;r&&o.push(r)}if(!o.length)throw function n(e){return Error("Could not find a matching row definition for theprovided row data: "+JSON.stringify(e))}(e);return o},e.prototype._insertRow=function(e,t){this._renderRow(this._rowOutlet,e.rowDef,t,{$implicit:e.data})},e.prototype._renderRow=function(e,o,r,n){var i,s;void 0===n&&(n={}),e.viewContainer.createEmbeddedView(o.template,n,r);try{for(var a=t.__values(this._getCellTemplates(o)),c=a.next();!c.done;c=a.next())S.mostRecentCellOutlet&&S.mostRecentCellOutlet._viewContainer.createEmbeddedView(c.value,n)}catch(e){i={error:e}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}this._changeDetectorRef.markForCheck()},e.prototype._updateRowIndexContext=function(){for(var e=this._rowOutlet.viewContainer,t=0,o=e.length;t<o;t++){var r=e.get(t).context;r.count=o,r.first=0===t,r.last=t===o-1,r.even=t%2==0,r.odd=!r.even,this.multiTemplateDataRows?(r.dataIndex=this._renderRows[t].dataIndex,r.renderIndex=t):r.index=this._renderRows[t].dataIndex}},e.prototype._getCellTemplates=function(e){var t=this;return e&&e.columns?Array.from(e.columns,(function(o){var r=t._columnDefsByName.get(o);if(!r)throw I(o);return e.extractCellTemplate(r)})):[]},e.prototype._applyNativeTableSections=function(){var e,o,r=this._document.createDocumentFragment(),n=[{tag:"thead",outlet:this._headerRowOutlet},{tag:"tbody",outlet:this._rowOutlet},{tag:"tfoot",outlet:this._footerRowOutlet}];try{for(var i=t.__values(n),s=i.next();!s.done;s=i.next()){var a=s.value,c=this._document.createElement(a.tag);c.setAttribute("role","rowgroup"),c.appendChild(a.outlet.elementRef.nativeElement),r.appendChild(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(e)throw e.error}}this._elementRef.nativeElement.appendChild(r)},e.prototype._forceRenderDataRows=function(){this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear(),this.renderRows(),this.updateStickyColumnStyles()},e.prototype._checkStickyStates=function(){var e=function(e,t){return e||t.hasStickyChanged()};this._headerRowDefs.reduce(e,!1)&&this.updateStickyHeaderRowStyles(),this._footerRowDefs.reduce(e,!1)&&this.updateStickyFooterRowStyles(),Array.from(this._columnDefsByName.values()).reduce(e,!1)&&this.updateStickyColumnStyles()},e.prototype._setupStickyStyler=function(){var e=this;this._stickyStyler=new T(this._isNativeHtmlTable,this.stickyCssClass,this._dir?this._dir.value:"ltr",this._platform.isBrowser),(this._dir?this._dir.change:c.of()).pipe(l.takeUntil(this._onDestroy)).subscribe((function(t){e._stickyStyler.direction=t,e.updateStickyColumnStyles()}))},e.decorators=[{type:a.Component,args:[{selector:"cdk-table, table[cdk-table]",exportAs:"cdkTable",template:B,host:{class:"cdk-table"},encapsulation:a.ViewEncapsulation.None,changeDetection:a.ChangeDetectionStrategy.Default}]}],e.ctorParameters=function(){return[{type:a.IterableDiffers},{type:a.ChangeDetectorRef},{type:a.ElementRef},{type:String,decorators:[{type:a.Attribute,args:["role"]}]},{type:o.Directionality,decorators:[{type:a.Optional}]},{type:void 0,decorators:[{type:a.Inject,args:[s.DOCUMENT]}]},{type:i.Platform}]},e.propDecorators={trackBy:[{type:a.Input}],dataSource:[{type:a.Input}],multiTemplateDataRows:[{type:a.Input}],_rowOutlet:[{type:a.ViewChild,args:[N,{static:!0}]}],_headerRowOutlet:[{type:a.ViewChild,args:[H,{static:!0}]}],_footerRowOutlet:[{type:a.ViewChild,args:[F,{static:!0}]}],_contentColumnDefs:[{type:a.ContentChildren,args:[y,{descendants:!0}]}],_contentRowDefs:[{type:a.ContentChildren,args:[v,{descendants:!0}]}],_contentHeaderRowDefs:[{type:a.ContentChildren,args:[C,{descendants:!0}]}],_contentFooterRowDefs:[{type:a.ContentChildren,args:[k,{descendants:!0}]}]},e}());function j(e,t){return e.toArray().concat(Array.from(t))} /** * @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 V=new a.InjectionToken("text-column-options"),q=function(){function e(e,t){this._table=e,this._options=t,this.justify="start",this._options=t||{}}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e,this._syncColumnDefName()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){if(this._syncColumnDefName(),void 0===this.headerText&&(this.headerText=this._createDefaultHeaderText()),this.dataAccessor||(this.dataAccessor=this._options.defaultDataAccessor||function(e,t){return e[t]}),!this._table)throw function e(){return Error("Text column could not find a parent table for registration.")}();this.columnDef.cell=this.cell,this.columnDef.headerCell=this.headerCell,this._table.addColumnDef(this.columnDef)},e.prototype.ngOnDestroy=function(){this._table&&this._table.removeColumnDef(this.columnDef)},e.prototype._createDefaultHeaderText=function(){var e=this.name;if(a.isDevMode()&&!e)throw function t(){return Error("Table text column must have a name.")}();return this._options&&this._options.defaultHeaderTextTransform?this._options.defaultHeaderTextTransform(e):e[0].toUpperCase()+e.slice(1)},e.prototype._syncColumnDefName=function(){this.columnDef&&(this.columnDef.name=this.name)},e.decorators=[{type:a.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: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:[{imports:[s.CommonModule],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})}));