UNPKG

@angular/material

Version:
23 lines 12.4 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("tslib"),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","tslib","@angular/cdk/table","@angular/common","@angular/material/core","@angular/cdk/coercion","rxjs","rxjs/operators"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.table={}),e.ng.core,e.tslib,e.ng.cdk.table,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"; /** * @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 c=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.stickyCssClass="mat-table-sticky",t}return r.__extends(o,e),o.decorators=[{type:t.Component,args:[{selector:"mat-table, table[mat-table]",exportAs:"matTable",template:a.CDK_TABLE_TEMPLATE,host:{class:"mat-table"},providers:[{provide:a.CdkTable,useExisting:o}],encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.Default,styles:['mat-table{display:block}mat-header-row{min-height:56px}mat-row,mat-footer-row{min-height:48px}mat-row,mat-header-row,mat-footer-row{display:flex;border-width:0;border-bottom-width:1px;border-style:solid;align-items:center;box-sizing:border-box}mat-row::after,mat-header-row::after,mat-footer-row::after{display:inline-block;min-height:inherit;content:""}mat-cell:first-of-type,mat-header-cell:first-of-type,mat-footer-cell:first-of-type{padding-left:24px}[dir=rtl] mat-cell:first-of-type,[dir=rtl] mat-header-cell:first-of-type,[dir=rtl] mat-footer-cell:first-of-type{padding-left:0;padding-right:24px}mat-cell:last-of-type,mat-header-cell:last-of-type,mat-footer-cell:last-of-type{padding-right:24px}[dir=rtl] mat-cell:last-of-type,[dir=rtl] mat-header-cell:last-of-type,[dir=rtl] mat-footer-cell:last-of-type{padding-right:0;padding-left:24px}mat-cell,mat-header-cell,mat-footer-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-row,tr.mat-footer-row{height:48px}th.mat-header-cell{text-align:left}[dir=rtl] th.mat-header-cell{text-align:right}th.mat-header-cell,td.mat-cell,td.mat-footer-cell{padding:0;border-bottom-width:1px;border-bottom-style:solid}th.mat-header-cell:first-of-type,td.mat-cell:first-of-type,td.mat-footer-cell:first-of-type{padding-left:24px}[dir=rtl] th.mat-header-cell:first-of-type,[dir=rtl] td.mat-cell:first-of-type,[dir=rtl] td.mat-footer-cell:first-of-type{padding-left:0;padding-right:24px}th.mat-header-cell:last-of-type,td.mat-cell:last-of-type,td.mat-footer-cell:last-of-type{padding-right:24px}[dir=rtl] th.mat-header-cell:last-of-type,[dir=rtl] td.mat-cell:last-of-type,[dir=rtl] td.mat-footer-cell:last-of-type{padding-right:0;padding-left:24px}\n']}]}],o}(a.CdkTable),d=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"[matCellDef]",providers:[{provide:a.CdkCellDef,useExisting:o}]}]}],o}(a.CdkCellDef),u=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"[matHeaderCellDef]",providers:[{provide:a.CdkHeaderCellDef,useExisting:o}]}]}],o}(a.CdkHeaderCellDef),p=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"[matFooterCellDef]",providers:[{provide:a.CdkFooterCellDef,useExisting:o}]}]}],o}(a.CdkFooterCellDef),f=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"[matColumnDef]",inputs:["sticky"],providers:[{provide:a.CdkColumnDef,useExisting:o},{provide:"MAT_SORT_HEADER_COLUMN_DEF",useExisting:o}]}]}],o.propDecorators={name:[{type:t.Input,args:["matColumnDef"]}]},o}(a.CdkColumnDef),m=function(e){function o(t,r){var a=e.call(this,t,r)||this;return r.nativeElement.classList.add("mat-column-"+t.cssClassFriendlyName),a}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"mat-header-cell, th[mat-header-cell]",host:{class:"mat-header-cell",role:"columnheader"}}]}],o.ctorParameters=function(){return[{type:a.CdkColumnDef},{type:t.ElementRef}]},o}(a.CdkHeaderCell),h=function(e){function o(t,r){var a=e.call(this,t,r)||this;return r.nativeElement.classList.add("mat-column-"+t.cssClassFriendlyName),a}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"mat-footer-cell, td[mat-footer-cell]",host:{class:"mat-footer-cell",role:"gridcell"}}]}],o.ctorParameters=function(){return[{type:a.CdkColumnDef},{type:t.ElementRef}]},o}(a.CdkFooterCell),g=function(e){function o(t,r){var a=e.call(this,t,r)||this;return r.nativeElement.classList.add("mat-column-"+t.cssClassFriendlyName),a}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"mat-cell, td[mat-cell]",host:{class:"mat-cell",role:"gridcell"}}]}],o.ctorParameters=function(){return[{type:a.CdkColumnDef},{type:t.ElementRef}]},o}(a.CdkCell),y=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"[matHeaderRowDef]",providers:[{provide:a.CdkHeaderRowDef,useExisting:o}],inputs:["columns: matHeaderRowDef","sticky: matHeaderRowDefSticky"]}]}],o}(a.CdkHeaderRowDef),C=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"[matFooterRowDef]",providers:[{provide:a.CdkFooterRowDef,useExisting:o}],inputs:["columns: matFooterRowDef","sticky: matFooterRowDefSticky"]}]}],o}(a.CdkFooterRowDef),D=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Directive,args:[{selector:"[matRowDef]",providers:[{provide:a.CdkRowDef,useExisting:o}],inputs:["columns: matRowDefColumns","when: matRowDefWhen"]}]}],o}(a.CdkRowDef),_=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Component,args:[{selector:"mat-header-row, tr[mat-header-row]",template:a.CDK_ROW_TEMPLATE,host:{class:"mat-header-row",role:"row"},changeDetection:t.ChangeDetectionStrategy.Default,encapsulation:t.ViewEncapsulation.None,exportAs:"matHeaderRow",providers:[{provide:a.CdkHeaderRow,useExisting:o}]}]}],o}(a.CdkHeaderRow),x=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Component,args:[{selector:"mat-footer-row, tr[mat-footer-row]",template:a.CDK_ROW_TEMPLATE,host:{class:"mat-footer-row",role:"row"},changeDetection:t.ChangeDetectionStrategy.Default,encapsulation:t.ViewEncapsulation.None,exportAs:"matFooterRow",providers:[{provide:a.CdkFooterRow,useExisting:o}]}]}],o}(a.CdkFooterRow),b=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(o,e),o.decorators=[{type:t.Component,args:[{selector:"mat-row, tr[mat-row]",template:a.CDK_ROW_TEMPLATE,host:{class:"mat-row",role:"row"},changeDetection:t.ChangeDetectionStrategy.Default,encapsulation:t.ViewEncapsulation.None,exportAs:"matRow",providers:[{provide:a.CdkRow,useExisting:o}]}]}],o}(a.CdkRow),w=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(a,e),a.decorators=[{type:t.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:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.Default}]}],a}(a.CdkTextColumn),v=[c,u,y,f,d,D,p,C,m,g,h,_,b,x,w],k=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[a.CdkTableModule,o.CommonModule,n.MatCommonModule],exports:v,declarations:v}]}],e}(),R=9007199254740991,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._internalPageChanges=new l.Subject,r._renderChangesSubscription=l.Subscription.EMPTY,r.sortingDataAccessor=function(e,t){var r=e[t];if(i._isNumberValue(r)){var a=Number(r);return a<R?a:r}return 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=Object.keys(e).reduce((function(t,r){return t+e[r]+"◬"}),"").toLowerCase(),a=t.trim().toLowerCase();return-1!=r.indexOf(a)},r._data=new l.BehaviorSubject(t),r._updateChangeSubscription(),r}return r.__extends(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),a=this._paginator?l.merge(this._paginator.page,this._internalPageChanges,this._paginator.initialized):l.of(null),o=l.combineLatest([this._data,this._filter]).pipe(s.map((function(t){var a=r.__read(t,1);return e._filterData(a[0])}))),n=l.combineLatest([o,t]).pipe(s.map((function(t){var a=r.__read(t,1);return e._orderData(a[0])}))),i=l.combineLatest([n,a]).pipe(s.map((function(t){var a=r.__read(t,1);return e._pageData(a[0])})));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(t,t+this.paginator.pageSize)},t.prototype._updatePaginator=function(e){var t=this;Promise.resolve().then((function(){var r=t.paginator;if(r&&(r.length=e,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,t._internalPageChanges.next())}}))},t.prototype.connect=function(){return this._renderData},t.prototype.disconnect=function(){},t}(a.DataSource); /** * @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 */ e.MatCell=g,e.MatCellDef=d,e.MatColumnDef=f,e.MatFooterCell=h,e.MatFooterCellDef=p,e.MatFooterRow=x,e.MatFooterRowDef=C,e.MatHeaderCell=m,e.MatHeaderCellDef=u,e.MatHeaderRow=_,e.MatHeaderRowDef=y,e.MatRow=b,e.MatRowDef=D,e.MatTable=c,e.MatTableDataSource=E,e.MatTableModule=k,e.MatTextColumn=w,Object.defineProperty(e,"__esModule",{value:!0})}));