UNPKG

@angular/material

Version:
10 lines (9 loc) 8.66 kB
/** * @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("rxjs/BehaviorSubject"),require("rxjs/operators/combineLatest"),require("rxjs/operators/map"),require("rxjs/operators/startWith"),require("rxjs/observable/empty"),require("@angular/cdk/coercion")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/cdk/table","@angular/common","@angular/material/core","rxjs/BehaviorSubject","rxjs/operators/combineLatest","rxjs/operators/map","rxjs/operators/startWith","rxjs/observable/empty","@angular/cdk/coercion"],t):t((e.ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.table=e.ng.material.table||{}),e.ng.core,e.ng.cdk.table,e.ng.common,e.ng.material.core,e.Rx,e.Rx.operators,e.Rx.operators,e.Rx.operators,e.Rx.Observable,e.ng.cdk.coercion)}(this,function(e,t,r,a,n,o,i,s,c,u,l){"use strict";function p(e,t){function r(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var d=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])},f=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return p(a,e),a.decorators=[{type:t.Component,args:[{selector:"mat-table",exportAs:"matTable",template:r.CDK_TABLE_TEMPLATE,styles:[".mat-table{display:block}.mat-header-row{min-height:56px}.mat-row{min-height:48px}.mat-header-row,.mat-row{display:flex;border-bottom-width:1px;border-bottom-style:solid;align-items:center;padding:0 24px;box-sizing:border-box}.mat-header-row::after,.mat-row::after{display:inline-block;min-height:inherit;content:''}.mat-cell,.mat-header-cell{flex:1;overflow:hidden;word-wrap:break-word}"],host:{class:"mat-table"},encapsulation:t.ViewEncapsulation.None,preserveWhitespaces:!1,changeDetection:t.ChangeDetectionStrategy.OnPush}]}],a.ctorParameters=function(){return[]},a}(r.CdkTable),h=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return p(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matCellDef]",providers:[{provide:r.CdkCellDef,useExisting:a}]}]}],a.ctorParameters=function(){return[]},a}(r.CdkCellDef),m=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return p(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matHeaderCellDef]",providers:[{provide:r.CdkHeaderCellDef,useExisting:a}]}]}],a.ctorParameters=function(){return[]},a}(r.CdkHeaderCellDef),g=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return p(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matColumnDef]",providers:[{provide:r.CdkColumnDef,useExisting:a}]}]}],a.ctorParameters=function(){return[]},a.propDecorators={name:[{type:t.Input,args:["matColumnDef"]}]},a}(r.CdkColumnDef),b=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 p(a,e),a.decorators=[{type:t.Directive,args:[{selector:"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 p(a,e),a.decorators=[{type:t.Directive,args:[{selector:"mat-cell",host:{class:"mat-cell",role:"gridcell"}}]}],a.ctorParameters=function(){return[{type:r.CdkColumnDef},{type:t.ElementRef}]},a}(r.CdkCell),D=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return p(a,e),a.decorators=[{type:t.Directive,args:[{selector:"[matHeaderRowDef]",providers:[{provide:r.CdkHeaderRowDef,useExisting:a}],inputs:["columns: matHeaderRowDef"]}]}],a.ctorParameters=function(){return[]},a}(r.CdkHeaderRowDef),C=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return p(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[]},a}(r.CdkRowDef),v=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return p(a,e),a.decorators=[{type:t.Component,args:[{selector:"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",preserveWhitespaces:!1}]}],a.ctorParameters=function(){return[]},a}(r.CdkHeaderRow),_=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return p(a,e),a.decorators=[{type:t.Component,args:[{selector:"mat-row",template:r.CDK_ROW_TEMPLATE,host:{class:"mat-row",role:"row"},changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,exportAs:"matRow",preserveWhitespaces:!1}]}],a.ctorParameters=function(){return[]},a}(r.CdkRow),w=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[r.CdkTableModule,a.CommonModule,n.MatCommonModule],exports:[f,h,m,g,b,y,v,_,D,C],declarations:[f,h,m,g,b,y,v,_,D,C]}]}],e.ctorParameters=function(){return[]},e}(),x=function(e){function t(t){void 0===t&&(t=[]);var r=e.call(this)||this;return r._renderData=new o.BehaviorSubject([]),r._filter=new o.BehaviorSubject(""),r.sortingDataAccessor=function(e,t){var r=e[t];return l._isNumberValue(r)?Number(r):r},r.sortData=function(e,t){var a=t.active,n=t.direction;return a&&""!=n?e.sort(function(e,t){var o=r.sortingDataAccessor(e,a),i=r.sortingDataAccessor(t,a),s=0;return o&&i?o>i?s=1:o<i&&(s=-1):o?s=1:i&&(s=-1),s*("asc"==n?1:-1)}):e},r.filterPredicate=function(e,t){var r=function(t,r){return t+e[r]},a=Object.keys(e).reduce(r,"").toLowerCase(),n=t.trim().toLowerCase();return-1!=a.indexOf(n)},r._data=new o.BehaviorSubject(t),r._updateChangeSubscription(),r}return p(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?this._sort.sortChange:u.empty(),r=this._paginator?this._paginator.page:u.empty();this._renderChangesSubscription&&this._renderChangesSubscription.unsubscribe(),this._renderChangesSubscription=this._data.pipe(i.combineLatest(this._filter),s.map(function(t){var r=t[0];return e._filterData(r)}),i.combineLatest(t.pipe(c.startWith(null))),s.map(function(t){var r=t[0];return e._orderData(r)}),i.combineLatest(r.pipe(c.startWith(null))),s.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=w,e.MatCellDef=h,e.MatHeaderCellDef=m,e.MatColumnDef=g,e.MatHeaderCell=b,e.MatCell=y,e.MatTable=f,e.MatHeaderRowDef=D,e.MatRowDef=C,e.MatHeaderRow=v,e.MatRow=_,e.MatTableDataSource=x,Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=material-table.umd.min.js.map