blob: 801354bc64a52fb208637f515216b3f676be2436 [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/table"),require("@angular/core"),require("@angular/common"),require("@angular/material/core"),require("@angular/cdk/coercion"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/material/table",["exports","@angular/cdk/table","@angular/core","@angular/common","@angular/material/core","@angular/cdk/coercion","rxjs","rxjs/operators"],e):e((t.ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.table={}),t.ng.cdk.table,t.ng.core,t.ng.common,t.ng.material.core,t.ng.cdk.coercion,t.rxjs,t.rxjs.operators)}(this,function(t,e,r,a,o,n,i,l){"use strict";function s(t,e){function r(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var c=function(t,e){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},u=function(t){function a(){var e=null!==t&&t.apply(this,arguments)||this;return e.stickyCssClass="mat-table-sticky",e}return s(a,t),a.decorators=[{type:r.Component,args:[{selector:"mat-table, table[mat-table]",exportAs:"matTable",template:e.CDK_TABLE_TEMPLATE,styles:["mat-table{display:block}mat-header-row{min-height:56px}mat-footer-row,mat-row{min-height:48px}mat-footer-row,mat-header-row,mat-row{display:flex;border-width:0;border-bottom-width:1px;border-style:solid;align-items:center;box-sizing:border-box}mat-footer-row::after,mat-header-row::after,mat-row::after{display:inline-block;min-height:inherit;content:''}mat-cell:first-of-type,mat-footer-cell:first-of-type,mat-header-cell:first-of-type{padding-left:24px}[dir=rtl] mat-cell:first-of-type,[dir=rtl] mat-footer-cell:first-of-type,[dir=rtl] mat-header-cell:first-of-type{padding-left:0;padding-right:24px}mat-cell:last-of-type,mat-footer-cell:last-of-type,mat-header-cell:last-of-type{padding-right:24px}[dir=rtl] mat-cell:last-of-type,[dir=rtl] mat-footer-cell:last-of-type,[dir=rtl] mat-header-cell:last-of-type{padding-right:0;padding-left:24px}mat-cell,mat-footer-cell,mat-header-cell{flex:1;display:flex;align-items:center;overflow:hidden;word-wrap:break-word;min-height:inherit}table.mat-table{border-spacing:0}tr.mat-header-row{height:56px}tr.mat-footer-row,tr.mat-row{height:48px}th.mat-header-cell{text-align:left}[dir=rtl] th.mat-header-cell{text-align:right}td.mat-cell,td.mat-footer-cell,th.mat-header-cell{padding:0;border-bottom-width:1px;border-bottom-style:solid}td.mat-cell:first-of-type,td.mat-footer-cell:first-of-type,th.mat-header-cell:first-of-type{padding-left:24px}[dir=rtl] td.mat-cell:first-of-type,[dir=rtl] td.mat-footer-cell:first-of-type,[dir=rtl] th.mat-header-cell:first-of-type{padding-left:0;padding-right:24px}td.mat-cell:last-of-type,td.mat-footer-cell:last-of-type,th.mat-header-cell:last-of-type{padding-right:24px}[dir=rtl] td.mat-cell:last-of-type,[dir=rtl] td.mat-footer-cell:last-of-type,[dir=rtl] th.mat-header-cell:last-of-type{padding-right:0;padding-left:24px}"],host:{class:"mat-table"},providers:[{provide:e.CdkTable,useExisting:a}],encapsulation:r.ViewEncapsulation.None,changeDetection:r.ChangeDetectionStrategy.Default}]}],a}(e.CdkTable),d=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"[matCellDef]",providers:[{provide:e.CdkCellDef,useExisting:a}]}]}],a}(e.CdkCellDef),p=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"[matHeaderCellDef]",providers:[{provide:e.CdkHeaderCellDef,useExisting:a}]}]}],a}(e.CdkHeaderCellDef),f=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"[matFooterCellDef]",providers:[{provide:e.CdkFooterCellDef,useExisting:a}]}]}],a}(e.CdkFooterCellDef),m=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"[matColumnDef]",providers:[{provide:e.CdkColumnDef,useExisting:a},{provide:"MAT_SORT_HEADER_COLUMN_DEF",useExisting:a}]}]}],a.propDecorators={name:[{type:r.Input,args:["matColumnDef"]}],sticky:[{type:r.Input}],stickyEnd:[{type:r.Input}]},a}(e.CdkColumnDef),h=function(t){function a(e,r){var a=t.call(this,e,r)||this;return r.nativeElement.classList.add("mat-column-"+e.cssClassFriendlyName),a}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"mat-header-cell, th[mat-header-cell]",host:{class:"mat-header-cell",role:"columnheader"}}]}],a.ctorParameters=function(){return[{type:e.CdkColumnDef},{type:r.ElementRef}]},a}(e.CdkHeaderCell),g=function(t){function a(e,r){var a=t.call(this,e,r)||this;return r.nativeElement.classList.add("mat-column-"+e.cssClassFriendlyName),a}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"mat-footer-cell, td[mat-footer-cell]",host:{class:"mat-footer-cell",role:"gridcell"}}]}],a.ctorParameters=function(){return[{type:e.CdkColumnDef},{type:r.ElementRef}]},a}(e.CdkFooterCell),y=function(t){function a(e,r){var a=t.call(this,e,r)||this;return r.nativeElement.classList.add("mat-column-"+e.cssClassFriendlyName),a}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"mat-cell, td[mat-cell]",host:{class:"mat-cell",role:"gridcell"}}]}],a.ctorParameters=function(){return[{type:e.CdkColumnDef},{type:r.ElementRef}]},a}(e.CdkCell),C=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"[matHeaderRowDef]",providers:[{provide:e.CdkHeaderRowDef,useExisting:a}],inputs:["columns: matHeaderRowDef","sticky: matHeaderRowDefSticky"]}]}],a}(e.CdkHeaderRowDef),D=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"[matFooterRowDef]",providers:[{provide:e.CdkFooterRowDef,useExisting:a}],inputs:["columns: matFooterRowDef","sticky: matFooterRowDefSticky"]}]}],a}(e.CdkFooterRowDef),w=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Directive,args:[{selector:"[matRowDef]",providers:[{provide:e.CdkRowDef,useExisting:a}],inputs:["columns: matRowDefColumns","when: matRowDefWhen"]}]}],a}(e.CdkRowDef),b=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Component,args:[{selector:"mat-header-row, tr[mat-header-row]",template:e.CDK_ROW_TEMPLATE,host:{class:"mat-header-row",role:"row"},changeDetection:r.ChangeDetectionStrategy.Default,encapsulation:r.ViewEncapsulation.None,exportAs:"matHeaderRow",providers:[{provide:e.CdkHeaderRow,useExisting:a}]}]}],a}(e.CdkHeaderRow),v=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Component,args:[{selector:"mat-footer-row, tr[mat-footer-row]",template:e.CDK_ROW_TEMPLATE,host:{class:"mat-footer-row",role:"row"},changeDetection:r.ChangeDetectionStrategy.Default,encapsulation:r.ViewEncapsulation.None,exportAs:"matFooterRow",providers:[{provide:e.CdkFooterRow,useExisting:a}]}]}],a}(e.CdkFooterRow),x=function(t){function a(){return null!==t&&t.apply(this,arguments)||this}return s(a,t),a.decorators=[{type:r.Component,args:[{selector:"mat-row, tr[mat-row]",template:e.CDK_ROW_TEMPLATE,host:{class:"mat-row",role:"row"},changeDetection:r.ChangeDetectionStrategy.Default,encapsulation:r.ViewEncapsulation.None,exportAs:"matRow",providers:[{provide:e.CdkRow,useExisting:a}]}]}],a}(e.CdkRow),_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.decorators=[{type:r.Component,args:[{selector:"mat-text-column",template:'\n <ng-container matColumnDef>\n <th mat-header-cell *matHeaderCellDef [style.text-align]="justify">\n {{headerText}}\n </th>\n <td mat-cell *matCellDef="let data" [style.text-align]="justify">\n {{dataAccessor(data, name)}}\n </td>\n </ng-container>\n ',encapsulation:r.ViewEncapsulation.None,changeDetection:r.ChangeDetectionStrategy.Default}]}],e}(e.CdkTextColumn),k=[u,p,C,m,d,w,f,D,h,y,g,b,x,v,_],R=function(){function t(){}return t.decorators=[{type:r.NgModule,args:[{imports:[e.CdkTableModule,a.CommonModule,o.MatCommonModule],exports:k,declarations:k}]}],t}(),E=9007199254740991,M=function(t){function e(e){void 0===e&&(e=[]);var r=t.call(this)||this;return r._renderData=new i.BehaviorSubject([]),r._filter=new i.BehaviorSubject(""),r._internalPageChanges=new i.Subject,r._renderChangesSubscription=i.Subscription.EMPTY,r.sortingDataAccessor=function(t,e){var r=t[e];if(n._isNumberValue(r)){var a=Number(r);return a<E?a:r}return r},r.sortData=function(t,e){var a=e.active,o=e.direction;return a&&""!=o?t.sort(function(t,e){var n=r.sortingDataAccessor(t,a),i=r.sortingDataAccessor(e,a),l=0;return null!=n&&null!=i?n>i?l=1:n<i&&(l=-1):null!=n?l=1:null!=i&&(l=-1),l*("asc"==o?1:-1)}):t},r.filterPredicate=function(t,e){var r=Object.keys(t).reduce(function(e,r){return e+t[r]+"◬"},"").toLowerCase(),a=e.trim().toLowerCase();return-1!=r.indexOf(a)},r._data=new i.BehaviorSubject(e),r._updateChangeSubscription(),r}return s(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this._data.value},set:function(t){this._data.next(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter.value},set:function(t){this._filter.next(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sort",{get:function(){return this._sort},set:function(t){this._sort=t,this._updateChangeSubscription()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paginator",{get:function(){return this._paginator},set:function(t){this._paginator=t,this._updateChangeSubscription()},enumerable:!0,configurable:!0}),e.prototype._updateChangeSubscription=function(){var t=this,e=this._sort?i.merge(this._sort.sortChange,this._sort.initialized):i.of(null),r=this._paginator?i.merge(this._paginator.page,this._internalPageChanges,this._paginator.initialized):i.of(null),a=this._data,o=i.combineLatest(a,this._filter).pipe(l.map(function(e){var r=e[0];return t._filterData(r)})),n=i.combineLatest(o,e).pipe(l.map(function(e){var r=e[0];return t._orderData(r)})),s=i.combineLatest(n,r).pipe(l.map(function(e){var r=e[0];return t._pageData(r)}));this._renderChangesSubscription.unsubscribe(),this._renderChangesSubscription=s.subscribe(function(e){return t._renderData.next(e)})},e.prototype._filterData=function(t){var e=this;return this.filteredData=this.filter?t.filter(function(t){return e.filterPredicate(t,e.filter)}):t,this.paginator&&this._updatePaginator(this.filteredData.length),this.filteredData},e.prototype._orderData=function(t){return this.sort?this.sortData(t.slice(),this.sort):t},e.prototype._pageData=function(t){if(!this.paginator)return t;var e=this.paginator.pageIndex*this.paginator.pageSize;return t.slice().splice(e,this.paginator.pageSize)},e.prototype._updatePaginator=function(t){var e=this;Promise.resolve().then(function(){var r=e.paginator;if(r&&(r.length=t,r.pageIndex>0)){var a=Math.ceil(r.length/r.pageSize)-1||0,o=Math.min(r.pageIndex,a);o!==r.pageIndex&&(r.pageIndex=o,e._internalPageChanges.next())}})},e.prototype.connect=function(){return this._renderData},e.prototype.disconnect=function(){},e}(e.DataSource);t.MatTableModule=R,t.MatCellDef=d,t.MatHeaderCellDef=p,t.MatFooterCellDef=f,t.MatColumnDef=m,t.MatHeaderCell=h,t.MatFooterCell=g,t.MatCell=y,t.MatTable=u,t.MatHeaderRowDef=C,t.MatFooterRowDef=D,t.MatRowDef=w,t.MatHeaderRow=b,t.MatFooterRow=v,t.MatRow=x,t.MatTableDataSource=M,t.MatTextColumn=_,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=material-table.umd.min.js.map