@angular/material
Version:
Angular Material
10 lines (9 loc) • 10.7 kB
JavaScript
/**
* @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(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/cdk/table"),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/core","@angular/cdk/table","@angular/common","@angular/material/core","@angular/cdk/coercion","rxjs","rxjs/operators"],t):t((e.ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.table={}),e.ng.core,e.ng.cdk.table,e.ng.common,e.ng.material.core,e.ng.cdk.coercion,e.Rx,e.Rx.operators)}(this,function(e,t,r,a,o,n,i,l){"use strict";function s(e,t){function r(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},u=function(e){function a(t,r,a,o){var n=e.call(this,t,r,a,o)||this;return n._differs=t,n._changeDetectorRef=r,n._elementRef=a,n}return s(a,e),a.decorators=[{type:t.Component,args:[{selector:"mat-table, table[mat-table]",exportAs:"matTable",template:r.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-child,mat-footer-cell:first-child,mat-header-cell:first-child{padding-left:24px}[dir=rtl] mat-cell:first-child,[dir=rtl] mat-footer-cell:first-child,[dir=rtl] mat-header-cell:first-child{padding-left:0;padding-right:24px}mat-cell:last-child,mat-footer-cell:last-child,mat-header-cell:last-child{padding-right:24px}[dir=rtl] mat-cell:last-child,[dir=rtl] mat-footer-cell:last-child,[dir=rtl] mat-header-cell:last-child{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}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-child,td.mat-footer-cell:first-child,th.mat-header-cell:first-child{padding-left:24px}td.mat-cell:last-child,td.mat-footer-cell:last-child,th.mat-header-cell:last-child{padding-right:24px}"],host:{class:"mat-table"},encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush}]}],a.ctorParameters=function(){return[{type:t.IterableDiffers},{type:t.ChangeDetectorRef},{type:t.ElementRef},{type:void 0,decorators:[{type:t.Attribute,args:["role"]}]}]},a}(r.CdkTable),d=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matCellDef]",providers:[{provide:r.CdkCellDef,useExisting:a}]}]}],a}(r.CdkCellDef),p=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matHeaderCellDef]",providers:[{provide:r.CdkHeaderCellDef,useExisting:a}]}]}],a}(r.CdkHeaderCellDef),f=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matFooterCellDef]",providers:[{provide:r.CdkFooterCellDef,useExisting:a}]}]}],a}(r.CdkFooterCellDef),h=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matColumnDef]",providers:[{provide:r.CdkColumnDef,useExisting:a}]}]}],a.propDecorators={name:[{type:t.Input,args:["matColumnDef"]}]},a}(r.CdkColumnDef),m=function(e){function a(t,r){var a=e.call(this,t,r)||this;return r.nativeElement.classList.add("mat-column-"+t.cssClassFriendlyName),a}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"mat-header-cell, th[mat-header-cell]",host:{class:"mat-header-cell",role:"columnheader"}}]}],a.ctorParameters=function(){return[{type:r.CdkColumnDef},{type:t.ElementRef}]},a}(r.CdkHeaderCell),g=function(e){function a(t,r){var a=e.call(this,t,r)||this;return r.nativeElement.classList.add("mat-column-"+t.cssClassFriendlyName),a}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"mat-footer-cell, td[mat-footer-cell]",host:{class:"mat-footer-cell",role:"gridcell"}}]}],a.ctorParameters=function(){return[{type:r.CdkColumnDef},{type:t.ElementRef}]},a}(r.CdkFooterCell),D=function(e){function a(t,r){var a=e.call(this,t,r)||this;return r.nativeElement.classList.add("mat-column-"+t.cssClassFriendlyName),a}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"mat-cell, td[mat-cell]",host:{class:"mat-cell",role:"gridcell"}}]}],a.ctorParameters=function(){return[{type:r.CdkColumnDef},{type:t.ElementRef}]},a}(r.CdkCell),C=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matHeaderRowDef]",providers:[{provide:r.CdkHeaderRowDef,useExisting:a}],inputs:["columns: matHeaderRowDef"]}]}],a}(r.CdkHeaderRowDef),y=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matFooterRowDef]",providers:[{provide:r.CdkFooterRowDef,useExisting:a}],inputs:["columns: matFooterRowDef"]}]}],a}(r.CdkFooterRowDef),b=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matRowDef]",providers:[{provide:r.CdkRowDef,useExisting:a}],inputs:["columns: matRowDefColumns","when: matRowDefWhen"]}]}],a}(r.CdkRowDef),w=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Component,args:[{selector:"mat-header-row, tr[mat-header-row]",template:r.CDK_ROW_TEMPLATE,host:{class:"mat-header-row",role:"row"},changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,exportAs:"matHeaderRow"}]}],a}(r.CdkHeaderRow),v=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Component,args:[{selector:"mat-footer-row, tr[mat-footer-row]",template:r.CDK_ROW_TEMPLATE,host:{class:"mat-footer-row",role:"row"},changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,exportAs:"matFooterRow"}]}],a}(r.CdkFooterRow),_=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return s(a,e),a.decorators=[{type:t.Component,args:[{selector:"mat-row, tr[mat-row]",template:r.CDK_ROW_TEMPLATE,host:{class:"mat-row",role:"row"},changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,exportAs:"matRow"}]}],a}(r.CdkRow),x=[u,p,C,h,d,b,f,y,m,D,g,w,_,v],R=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[r.CdkTableModule,a.CommonModule,o.MatCommonModule],exports:x,declarations:x}]}],e}(),k=function(e){function t(t){void 0===t&&(t=[]);var r=e.call(this)||this;return r._renderData=new i.BehaviorSubject([]),r._filter=new i.BehaviorSubject(""),r.sortingDataAccessor=function(e,t){var r=e[t];return n._isNumberValue(r)?Number(r):r},r.sortData=function(e,t){var a=t.active,o=t.direction;return a&&""!=o?e.sort(function(e,t){var n=r.sortingDataAccessor(e,a),i=r.sortingDataAccessor(t,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)}):e},r.filterPredicate=function(e,t){var r=function(t,r){return t+e[r]},a=Object.keys(e).reduce(r,"").toLowerCase(),o=t.trim().toLowerCase();return-1!=a.indexOf(o)},r._data=new i.BehaviorSubject(t),r._updateChangeSubscription(),r}return s(t,e),Object.defineProperty(t.prototype,"data",{get:function(){return this._data.value},set:function(e){this._data.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this._filter.value},set:function(e){this._filter.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sort",{get:function(){return this._sort},set:function(e){this._sort=e,this._updateChangeSubscription()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paginator",{get:function(){return this._paginator},set:function(e){this._paginator=e,this._updateChangeSubscription()},enumerable:!0,configurable:!0}),t.prototype._updateChangeSubscription=function(){var e=this,t=this._sort?i.merge(this._sort.sortChange,this._sort.initialized):i.of(null),r=this._paginator?i.merge(this._paginator.page,this._paginator.initialized):i.of(null);this._renderChangesSubscription&&this._renderChangesSubscription.unsubscribe();var a=this._data,o=i.combineLatest(a,this._filter).pipe(l.map(function(t){var r=t[0];return e._filterData(r)})),n=i.combineLatest(o,t).pipe(l.map(function(t){var r=t[0];return e._orderData(r)}));i.combineLatest(n,r).pipe(l.map(function(t){var r=t[0];return e._pageData(r)})).subscribe(function(t){return e._renderData.next(t)})},t.prototype._filterData=function(e){var t=this;return this.filteredData=this.filter?e.filter(function(e){return t.filterPredicate(e,t.filter)}):e,this.paginator&&this._updatePaginator(this.filteredData.length),this.filteredData},t.prototype._orderData=function(e){return this.sort?this.sortData(e.slice(),this.sort):e},t.prototype._pageData=function(e){if(!this.paginator)return e;var t=this.paginator.pageIndex*this.paginator.pageSize;return e.slice().splice(t,this.paginator.pageSize)},t.prototype._updatePaginator=function(e){var t=this;Promise.resolve().then(function(){if(t.paginator&&(t.paginator.length=e,t.paginator.pageIndex>0)){var r=Math.ceil(t.paginator.length/t.paginator.pageSize)-1||0;t.paginator.pageIndex=Math.min(t.paginator.pageIndex,r)}})},t.prototype.connect=function(){return this._renderData},t.prototype.disconnect=function(){},t}(r.DataSource);e.MatTableModule=R,e.MatCellDef=d,e.MatHeaderCellDef=p,e.MatFooterCellDef=f,e.MatColumnDef=h,e.MatHeaderCell=m,e.MatFooterCell=g,e.MatCell=D,e.MatTable=u,e.MatHeaderRowDef=C,e.MatFooterRowDef=y,e.MatRowDef=b,e.MatHeaderRow=w,e.MatFooterRow=v,e.MatRow=_,e.MatTableDataSource=k,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=material-table.umd.min.js.map