@angular/cdk
Version:
Angular Material Component Development Kit
68 lines (66 loc) • 32.3 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,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","@angular/cdk/bidi","@angular/cdk/coercion","@angular/cdk/collections","@angular/cdk/platform","@angular/common","@angular/core","rxjs","rxjs/operators"],e):e(((t=t||self).ng=t.ng||{},t.ng.cdk=t.ng.cdk||{},t.ng.cdk.table={}),t.ng.cdk.bidi,t.ng.cdk.coercion,t.ng.cdk.collections,t.ng.cdk.platform,t.ng.common,t.ng.core,t.rxjs,t.rxjs.operators)}(this,(function(t,e,o,r,n,i,a,s,c){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var l=function(t,e){return(l=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)};function u(t,e){function o(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}function f(t){var e="function"==typeof Symbol&&Symbol.iterator,o=e&&t[e],r=0;if(o)return o.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){var o="function"==typeof Symbol&&t[Symbol.iterator];if(!o)return t;var r,n,i=o.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return a}function d(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(h(arguments[e]));return 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
*/
function p(t){return function(t){function e(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var r=t.apply(this,d(e))||this;return r._sticky=!1,r._hasStickyChanged=!1,r}return u(e,t),Object.defineProperty(e.prototype,"sticky",{get:function(){return this._sticky},set:function(t){var e=this._sticky;this._sticky=o.coerceBooleanProperty(t),this._hasStickyChanged=e!==this._sticky},enumerable:!1,configurable:!0}),e.prototype.hasStickyChanged=function(){var t=this._hasStickyChanged;return this._hasStickyChanged=!1,t},e.prototype.resetStickyChanged=function(){this._hasStickyChanged=!1},e}(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 y,_=new a.InjectionToken("CDK_TABLE"),w=new a.InjectionToken("text-column-options"),m=function(){function t(t){this.template=t}return t.decorators=[{type:a.Directive,args:[{selector:"[cdkCellDef]"}]}],t.ctorParameters=function(){return[{type:a.TemplateRef}]},t}(),g=function(){function t(t){this.template=t}return t.decorators=[{type:a.Directive,args:[{selector:"[cdkHeaderCellDef]"}]}],t.ctorParameters=function(){return[{type:a.TemplateRef}]},t}(),D=function(){function t(t){this.template=t}return t.decorators=[{type:a.Directive,args:[{selector:"[cdkFooterCellDef]"}]}],t.ctorParameters=function(){return[{type:a.TemplateRef}]},t}(),R=function(t){function e(e){var o=t.call(this)||this;return o._table=e,o._stickyEnd=!1,o}return u(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(t){t&&(this._name=t,this.cssClassFriendlyName=t.replace(/[^a-z0-9_-]/gi,"-"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stickyEnd",{get:function(){return this._stickyEnd},set:function(t){var e=this._stickyEnd;this._stickyEnd=o.coerceBooleanProperty(t),this._hasStickyChanged=e!==this._stickyEnd},enumerable:!1,configurable:!0}),e.decorators=[{type:a.Directive,args:[{selector:"[cdkColumnDef]",inputs:["sticky"],providers:[{provide:"MAT_SORT_HEADER_COLUMN_DEF",useExisting:e}]}]}],e.ctorParameters=function(){return[{type:void 0,decorators:[{type:a.Inject,args:[_]},{type:a.Optional}]}]},e.propDecorators={name:[{type:a.Input,args:["cdkColumnDef"]}],stickyEnd:[{type:a.Input,args:["stickyEnd"]}],cell:[{type:a.ContentChild,args:[m]}],headerCell:[{type:a.ContentChild,args:[g]}],footerCell:[{type:a.ContentChild,args:[D]}]},e}(p((function C(){}))),v=function(t){function e(e,o){return t.call(this,e,o)||this}return u(e,t),e.decorators=[{type:a.Directive,args:[{selector:"cdk-header-cell, th[cdk-header-cell]",host:{class:"cdk-header-cell",role:"columnheader"}}]}],e.ctorParameters=function(){return[{type:R},{type:a.ElementRef}]},e}(y=function y(t,e){e.nativeElement.classList.add("cdk-column-"+t.cssClassFriendlyName)}),k=function(t){function e(e,o){return t.call(this,e,o)||this}return u(e,t),e.decorators=[{type:a.Directive,args:[{selector:"cdk-footer-cell, td[cdk-footer-cell]",host:{class:"cdk-footer-cell",role:"gridcell"}}]}],e.ctorParameters=function(){return[{type:R},{type:a.ElementRef}]},e}(y),S=function(t){function e(e,o){return t.call(this,e,o)||this}return u(e,t),e.decorators=[{type:a.Directive,args:[{selector:"cdk-cell, td[cdk-cell]",host:{class:"cdk-cell",role:"gridcell"}}]}],e.ctorParameters=function(){return[{type:R},{type:a.ElementRef}]},e}(y),b="<ng-container cdkCellOutlet></ng-container>",O=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 E?t.headerCell.template:this instanceof x?t.footerCell.template:t.cell.template},t.decorators=[{type:a.Directive}],t.ctorParameters=function(){return[{type:a.TemplateRef},{type:a.IterableDiffers}]},t}(),E=function(t){function e(e,o,r){var n=t.call(this,e,o)||this;return n._table=r,n}return u(e,t),e.prototype.ngOnChanges=function(e){t.prototype.ngOnChanges.call(this,e)},e.decorators=[{type:a.Directive,args:[{selector:"[cdkHeaderRowDef]",inputs:["columns: cdkHeaderRowDef","sticky: cdkHeaderRowDefSticky"]}]}],e.ctorParameters=function(){return[{type:a.TemplateRef},{type:a.IterableDiffers},{type:void 0,decorators:[{type:a.Inject,args:[_]},{type:a.Optional}]}]},e}(p(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u(e,t),e}(O))),x=function(t){function e(e,o,r){var n=t.call(this,e,o)||this;return n._table=r,n}return u(e,t),e.prototype.ngOnChanges=function(e){t.prototype.ngOnChanges.call(this,e)},e.decorators=[{type:a.Directive,args:[{selector:"[cdkFooterRowDef]",inputs:["columns: cdkFooterRowDef","sticky: cdkFooterRowDefSticky"]}]}],e.ctorParameters=function(){return[{type:a.TemplateRef},{type:a.IterableDiffers},{type:void 0,decorators:[{type:a.Inject,args:[_]},{type:a.Optional}]}]},e}(p(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u(e,t),e}(O))),T=function(t){function e(e,o,r){var n=t.call(this,e,o)||this;return n._table=r,n}return u(e,t),e.decorators=[{type:a.Directive,args:[{selector:"[cdkRowDef]",inputs:["columns: cdkRowDefColumns","when: cdkRowDefWhen"]}]}],e.ctorParameters=function(){return[{type:a.TemplateRef},{type:a.IterableDiffers},{type:void 0,decorators:[{type:a.Inject,args:[_]},{type:a.Optional}]}]},e}(O),N=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:a.Directive,args:[{selector:"[cdkCellOutlet]"}]}],t.ctorParameters=function(){return[{type:a.ViewContainerRef}]},t}(),I=function(){function t(){}return t.decorators=[{type:a.Component,args:[{selector:"cdk-header-row, tr[cdk-header-row]",template:b,host:{class:"cdk-header-row",role:"row"},changeDetection:a.ChangeDetectionStrategy.Default,encapsulation:a.ViewEncapsulation.None}]}],t}(),P=function(){function t(){}return t.decorators=[{type:a.Component,args:[{selector:"cdk-footer-row, tr[cdk-footer-row]",template:b,host:{class:"cdk-footer-row",role:"row"},changeDetection:a.ChangeDetectionStrategy.Default,encapsulation:a.ViewEncapsulation.None}]}],t}(),H=function(){function t(){}return t.decorators=[{type:a.Component,args:[{selector:"cdk-row, tr[cdk-row]",template:b,host:{class:"cdk-row",role:"row"},changeDetection:a.ChangeDetectionStrategy.Default,encapsulation:a.ViewEncapsulation.None}]}],t}(),F=function(){function t(t){this.templateRef=t}return t.decorators=[{type:a.Directive,args:[{selector:"ng-template[cdkNoDataRow]"}]}],t.ctorParameters=function(){return[{type:a.TemplateRef}]},t}(),j=["top","bottom","left","right"],B=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){var o,r;try{for(var n=f(t),i=n.next();!i.done;i=n.next()){var a=i.value;if(a.nodeType===a.ELEMENT_NODE){this._removeStickyStyle(a,e);for(var s=0;s<a.children.length;s++)this._removeStickyStyle(a.children[s],e)}}}catch(t){o={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}},t.prototype.updateStickyColumns=function(t,e,o){var r,n,i=e.some((function(t){return t}))||o.some((function(t){return t}));if(t.length&&i&&this._isBrowser){var a=t[0],s=a.children.length,c=this._getCellWidths(a),l=this._getStickyStartColumnPositions(c,e),u=this._getStickyEndColumnPositions(c,o),h="rtl"===this.direction;try{for(var d=f(t),p=d.next();!p.done;p=d.next())for(var y=p.value,_=0;_<s;_++){var w=y.children[_];e[_]&&this._addStickyStyle(w,h?"right":"left",l[_]),o[_]&&this._addStickyStyle(w,h?"left":"right",u[_])}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}}},t.prototype.stickRows=function(t,e,o){if(this._isBrowser)for(var r="bottom"===o?t.slice().reverse():t,n="bottom"===o?e.slice().reverse():e,i=0,a=0;a<r.length;a++)if(n[a]){var s=r[a];if(this._isNativeHtmlTable)for(var c=0;c<s.children.length;c++)this._addStickyStyle(s.children[c],o,i);else this._addStickyStyle(s,o,i);if(a===r.length-1)return;i+=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){var o,r;try{for(var n=f(e),i=n.next();!i.done;i=n.next())t.style[i.value]=""}catch(t){o={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}t.style.zIndex=this._getCalculatedZIndex(t),j.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){var e,o,r={top:100,bottom:10,left:1,right:1},n=0;try{for(var i=f(j),a=i.next();!a.done;a=i.next()){var s=a.value;t.style[s]&&(n+=r[s])}}catch(t){e={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(e)throw e.error}}return n?""+n:""},t.prototype._getCellWidths=function(t){for(var e=[],o=t.children,r=0;r<o.length;r++)e.push(o[r].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}();
/**
* @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 A(t){return Error('Could not find column with id "'+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 M,V=function(){function t(t,e){this.viewContainer=t,this.elementRef=e}return t.decorators=[{type:a.Directive,args:[{selector:"[rowOutlet]"}]}],t.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},t}(),L=function(){function t(t,e){this.viewContainer=t,this.elementRef=e}return t.decorators=[{type:a.Directive,args:[{selector:"[headerRowOutlet]"}]}],t.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},t}(),q=function(){function t(t,e){this.viewContainer=t,this.elementRef=e}return t.decorators=[{type:a.Directive,args:[{selector:"[footerRowOutlet]"}]}],t.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},t}(),U=function(){function t(t,e){this.viewContainer=t,this.elementRef=e}return t.decorators=[{type:a.Directive,args:[{selector:"[noDataRowOutlet]"}]}],t.ctorParameters=function(){return[{type:a.ViewContainerRef},{type:a.ElementRef}]},t}(),K='\n <ng-content select="caption"></ng-content>\n <ng-content select="colgroup, col"></ng-content>\n <ng-container headerRowOutlet></ng-container>\n <ng-container rowOutlet></ng-container>\n <ng-container noDataRowOutlet></ng-container>\n <ng-container footerRowOutlet></ng-container>\n',W=(u((function z(){return null!==M&&M.apply(this,arguments)||this}),M=a.EmbeddedViewRef),function(){function t(t,e,o,r,n,i,a){this._differs=t,this._changeDetectorRef=e,this._elementRef=o,this._dir=n,this._platform=a,this._onDestroy=new s.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._isShowingNoDataRow=!1,this._multiTemplateDataRows=!1,this.viewChange=new s.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){a.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:!1,configurable:!0}),Object.defineProperty(t.prototype,"dataSource",{get:function(){return this._dataSource},set:function(t){this._dataSource!==t&&this._switchDataSource(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"multiTemplateDataRows",{get:function(){return this._multiTemplateDataRows},set:function(t){this._multiTemplateDataRows=o.coerceBooleanProperty(t),this._rowOutlet&&this._rowOutlet.viewContainer.length&&this._forceRenderDataRows()},enumerable:!1,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 function t(){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()},t.prototype.ngOnDestroy=function(){this._rowOutlet.viewContainer.clear(),this._noDataRowOutlet.viewContainer.clear(),this._headerRowOutlet.viewContainer.clear(),this._footerRowOutlet.viewContainer.clear(),this._cachedRenderRowsMap.clear(),this._onDestroy.next(),this._onDestroy.complete(),r.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._updateNoDataRow(),this.updateStickyColumnStyles()}},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.querySelector("thead");e&&(e.style.display=t.length?"":"none");var o=this._headerRowDefs.map((function(t){return t.sticky}));this._stickyStyler.clearStickyPositioning(t,["top"]),this._stickyStyler.stickRows(t,o,"top"),this._headerRowDefs.forEach((function(t){return t.resetStickyChanged()}))},t.prototype.updateStickyFooterRowStyles=function(){var t=this._getRenderedRows(this._footerRowOutlet),e=this._elementRef.nativeElement.querySelector("tfoot");e&&(e.style.display=t.length?"":"none");var o=this._footerRowDefs.map((function(t){return t.sticky}));this._stickyStyler.clearStickyPositioning(t,["bottom"]),this._stickyStyler.stickRows(t,o,"bottom"),this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement,o),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(d(e,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 a=n[i],s=this._cachedRenderRowsMap.get(a.data);s.has(a.rowDef)?s.get(a.rowDef).push(a):s.set(a.rowDef,[a]),t.push(a)}}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(),Z(this._getOwnDefs(this._contentColumnDefs),this._customColumnDefs).forEach((function(e){if(t._columnDefsByName.has(e.name))throw function o(t){return Error('Duplicate column definition name provided: "'+t+'".')}(e.name);t._columnDefsByName.set(e.name,e)}))},t.prototype._cacheRowDefs=function(){this._headerRowDefs=Z(this._getOwnDefs(this._contentHeaderRowDefs),this._customHeaderRowDefs),this._footerRowDefs=Z(this._getOwnDefs(this._contentFooterRowDefs),this._customFooterRowDefs),this._rowDefs=Z(this._getOwnDefs(this._contentRowDefs),this._customRowDefs);var t=this._rowDefs.filter((function(t){return!t.when}));if(!this.multiTemplateDataRows&&t.length>1)throw function e(){return Error("There can only be one default row without a when predicate function.")}();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=[],r.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(r.isDataSource(this.dataSource)?e=this.dataSource.connect(this):s.isObservable(this.dataSource)?e=this.dataSource:Array.isArray(this.dataSource)&&(e=s.of(this.dataSource)),void 0===e)throw function o(){return Error("Provided data source did not match an array, Observable, or DataSource")}();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 A(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 function n(t){return Error("Could not find a matching row definition for theprovided row data: "+JSON.stringify(t))}(t);return o},t.prototype._insertRow=function(t,e){this._renderRow(this._rowOutlet,t.rowDef,e,{$implicit:t.data})},t.prototype._renderRow=function(t,e,o,r){var n,i;void 0===r&&(r={}),t.viewContainer.createEmbeddedView(e.template,r,o);try{for(var a=f(this._getCellTemplates(e)),s=a.next();!s.done;s=a.next())N.mostRecentCellOutlet&&N.mostRecentCellOutlet._viewContainer.createEmbeddedView(s.value,r)}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}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).context;r.count=o,r.first=0===e,r.last=e===o-1,r.even=e%2==0,r.odd=!r.even,this.multiTemplateDataRows?(r.dataIndex=this._renderRows[e].dataIndex,r.renderIndex=e):r.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 A(o);return t.extractCellTemplate(r)})):[]},t.prototype._applyNativeTableSections=function(){var t,e,o,r,n=this._document.createDocumentFragment(),i=[{tag:"thead",outlets:[this._headerRowOutlet]},{tag:"tbody",outlets:[this._rowOutlet,this._noDataRowOutlet]},{tag:"tfoot",outlets:[this._footerRowOutlet]}];try{for(var a=f(i),s=a.next();!s.done;s=a.next()){var c=s.value,l=this._document.createElement(c.tag);l.setAttribute("role","rowgroup");try{for(var u=(o=void 0,f(c.outlets)),h=u.next();!h.done;h=u.next())l.appendChild(h.value.elementRef.nativeElement)}catch(t){o={error:t}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(o)throw o.error}}n.appendChild(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}this._elementRef.nativeElement.appendChild(n)},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;this._stickyStyler=new B(this._isNativeHtmlTable,this.stickyCssClass,this._dir?this._dir.value:"ltr",this._platform.isBrowser),(this._dir?this._dir.change:s.of()).pipe(c.takeUntil(this._onDestroy)).subscribe((function(e){t._stickyStyler.direction=e,t.updateStickyColumnStyles()}))},t.prototype._getOwnDefs=function(t){var e=this;return t.filter((function(t){return!t._table||t._table===e}))},t.prototype._updateNoDataRow=function(){if(this._noDataRow){var t=0===this._rowOutlet.viewContainer.length;if(t!==this._isShowingNoDataRow){var e=this._noDataRowOutlet.viewContainer;t?e.createEmbeddedView(this._noDataRow.templateRef):e.clear(),this._isShowingNoDataRow=t}}},t.decorators=[{type:a.Component,args:[{selector:"cdk-table, table[cdk-table]",exportAs:"cdkTable",template:K,host:{class:"cdk-table"},encapsulation:a.ViewEncapsulation.None,changeDetection:a.ChangeDetectionStrategy.Default,providers:[{provide:_,useExisting:t}]}]}],t.ctorParameters=function(){return[{type:a.IterableDiffers},{type:a.ChangeDetectorRef},{type:a.ElementRef},{type:String,decorators:[{type:a.Attribute,args:["role"]}]},{type:e.Directionality,decorators:[{type:a.Optional}]},{type:void 0,decorators:[{type:a.Inject,args:[i.DOCUMENT]}]},{type:n.Platform}]},t.propDecorators={trackBy:[{type:a.Input}],dataSource:[{type:a.Input}],multiTemplateDataRows:[{type:a.Input}],_rowOutlet:[{type:a.ViewChild,args:[V,{static:!0}]}],_headerRowOutlet:[{type:a.ViewChild,args:[L,{static:!0}]}],_footerRowOutlet:[{type:a.ViewChild,args:[q,{static:!0}]}],_noDataRowOutlet:[{type:a.ViewChild,args:[U,{static:!0}]}],_contentColumnDefs:[{type:a.ContentChildren,args:[R,{descendants:!0}]}],_contentRowDefs:[{type:a.ContentChildren,args:[T,{descendants:!0}]}],_contentHeaderRowDefs:[{type:a.ContentChildren,args:[E,{descendants:!0}]}],_contentFooterRowDefs:[{type:a.ContentChildren,args:[x,{descendants:!0}]}],_noDataRow:[{type:a.ContentChild,args:[F]}]},t}());function Z(t,e){return t.concat(Array.from(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 J=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:!1,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 function t(){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)},t.prototype.ngOnDestroy=function(){this._table&&this._table.removeColumnDef(this.columnDef)},t.prototype._createDefaultHeaderText=function(){var t=this.name;if(a.isDevMode()&&!t)throw function e(){return Error("Table text column must have a name.")}();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: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}]}],t.ctorParameters=function(){return[{type:W,decorators:[{type:a.Optional}]},{type:void 0,decorators:[{type:a.Optional},{type:a.Inject,args:[w]}]}]},t.propDecorators={name:[{type:a.Input}],headerText:[{type:a.Input}],dataAccessor:[{type:a.Input}],justify:[{type:a.Input}],columnDef:[{type:a.ViewChild,args:[R,{static:!0}]}],cell:[{type:a.ViewChild,args:[m,{static:!0}]}],headerCell:[{type:a.ViewChild,args:[g,{static:!0}]}]},t}(),X=[W,T,m,N,g,D,R,S,H,v,k,I,E,P,x,V,L,q,J,F,U],$=function(){function t(){}return t.decorators=[{type:a.NgModule,args:[{exports:X,declarations:X}]}],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
*/
/**
* @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(t,"DataSource",{enumerable:!0,get:function(){return r.DataSource}}),t.BaseCdkCell=y,t.BaseRowDef=O,t.CDK_ROW_TEMPLATE=b,t.CDK_TABLE=_,t.CDK_TABLE_TEMPLATE=K,t.CdkCell=S,t.CdkCellDef=m,t.CdkCellOutlet=N,t.CdkColumnDef=R,t.CdkFooterCell=k,t.CdkFooterCellDef=D,t.CdkFooterRow=P,t.CdkFooterRowDef=x,t.CdkHeaderCell=v,t.CdkHeaderCellDef=g,t.CdkHeaderRow=I,t.CdkHeaderRowDef=E,t.CdkNoDataRow=F,t.CdkRow=H,t.CdkRowDef=T,t.CdkTable=W,t.CdkTableModule=$,t.CdkTextColumn=J,t.DataRowOutlet=V,t.FooterRowOutlet=q,t.HeaderRowOutlet=L,t.NoDataRowOutlet=U,t.STICKY_DIRECTIONS=j,t.StickyStyler=B,t.TEXT_COLUMN_OPTIONS=w,t.mixinHasStickyInput=p,Object.defineProperty(t,"__esModule",{value:!0})}));