@angular/material
Version:
Angular Material
10 lines (9 loc) • 11.6 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/cdk/bidi"),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/cdk/bidi","@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.cdk.bidi,e.ng.common,e.ng.material.core,e.ng.cdk.coercion,e.rxjs,e.rxjs.operators)}(this,function(e,t,r,a,o,n,i,l,s){"use strict";function c(e,t){function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=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])},d=function(e){function o(t,r,a,o,n){var i=e.call(this,t,r,a,o,n)||this;return i._differs=t,i._changeDetectorRef=r,i._elementRef=a,i._dir=n,i.stickyCssClass="mat-table-sticky",i}return c(o,e),o.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}]}],o.ctorParameters=function(){return[{type:t.IterableDiffers},{type:t.ChangeDetectorRef},{type:t.ElementRef},{type:void 0,decorators:[{type:t.Attribute,args:["role"]}]},{type:a.Directionality,decorators:[{type:t.Optional}]}]},o}(r.CdkTable),p=function(e){function a(t){var r=e.call(this,t)||this;return r.template=t,r}return c(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matCellDef]",providers:[{provide:r.CdkCellDef,useExisting:a}]}]}],a.ctorParameters=function(){return[{type:t.TemplateRef}]},a}(r.CdkCellDef),f=function(e){function a(t){var r=e.call(this,t)||this;return r.template=t,r}return c(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matHeaderCellDef]",providers:[{provide:r.CdkHeaderCellDef,useExisting:a}]}]}],a.ctorParameters=function(){return[{type:t.TemplateRef}]},a}(r.CdkHeaderCellDef),m=function(e){function a(t){var r=e.call(this,t)||this;return r.template=t,r}return c(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matFooterCellDef]",providers:[{provide:r.CdkFooterCellDef,useExisting:a}]}]}],a.ctorParameters=function(){return[{type:t.TemplateRef}]},a}(r.CdkFooterCellDef),h=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return c(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matColumnDef]",providers:[{provide:r.CdkColumnDef,useExisting:a}]}]}],a.propDecorators={name:[{type:t.Input,args:["matColumnDef"]}],sticky:[{type:t.Input}],stickyEnd:[{type:t.Input}]},a}(r.CdkColumnDef),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 c(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),y=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 c(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 c(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(t,r){return e.call(this,t,r)||this}return c(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matHeaderRowDef]",providers:[{provide:r.CdkHeaderRowDef,useExisting:a}],inputs:["columns: matHeaderRowDef","sticky: matHeaderRowDefSticky"]}]}],a.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.IterableDiffers}]},a}(r.CdkHeaderRowDef),b=function(e){function a(t,r){return e.call(this,t,r)||this}return c(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matFooterRowDef]",providers:[{provide:r.CdkFooterRowDef,useExisting:a}],inputs:["columns: matFooterRowDef","sticky: matFooterRowDefSticky"]}]}],a.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.IterableDiffers}]},a}(r.CdkFooterRowDef),w=function(e){function a(t,r){return e.call(this,t,r)||this}return c(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matRowDef]",providers:[{provide:r.CdkRowDef,useExisting:a}],inputs:["columns: matRowDefColumns","when: matRowDefWhen"]}]}],a.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.IterableDiffers}]},a}(r.CdkRowDef),v=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return c(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",providers:[{provide:r.CdkHeaderRow,useExisting:a}]}]}],a}(r.CdkHeaderRow),_=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return c(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",providers:[{provide:r.CdkFooterRow,useExisting:a}]}]}],a}(r.CdkFooterRow),x=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return c(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",providers:[{provide:r.CdkRow,useExisting:a}]}]}],a}(r.CdkRow),k=[d,f,C,h,p,w,m,b,g,D,y,v,x,_],R=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[r.CdkTableModule,o.CommonModule,n.MatCommonModule],exports:k,declarations:k}]}],e}(),E=function(e){function t(t){void 0===t&&(t=[]);var r=e.call(this)||this;return r._renderData=new l.BehaviorSubject([]),r._filter=new l.BehaviorSubject(""),r._renderChangesSubscription=l.Subscription.EMPTY,r.sortingDataAccessor=function(e,t){var r=e[t];return i._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 l.BehaviorSubject(t),r._updateChangeSubscription(),r}return c(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?l.merge(this._sort.sortChange,this._sort.initialized):l.of(null),r=this._paginator?l.merge(this._paginator.page,this._paginator.initialized):l.of(null),a=this._data,o=l.combineLatest(a,this._filter).pipe(s.map(function(t){var r=t[0];return e._filterData(r)})),n=l.combineLatest(o,t).pipe(s.map(function(t){var r=t[0];return e._orderData(r)})),i=l.combineLatest(n,r).pipe(s.map(function(t){var r=t[0];return e._pageData(r)}));this._renderChangesSubscription.unsubscribe(),this._renderChangesSubscription=i.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=p,e.MatHeaderCellDef=f,e.MatFooterCellDef=m,e.MatColumnDef=h,e.MatHeaderCell=g,e.MatFooterCell=y,e.MatCell=D,e.MatTable=d,e.MatHeaderRowDef=C,e.MatFooterRowDef=b,e.MatRowDef=w,e.MatHeaderRow=v,e.MatFooterRow=_,e.MatRow=x,e.MatTableDataSource=E,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=material-table.umd.min.js.map