@angular/material
Version:
Angular Material
23 lines • 11.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common"),require("@angular/core"),require("@angular/material/button"),require("@angular/material/select"),require("@angular/material/tooltip"),require("tslib"),require("@angular/cdk/coercion"),require("rxjs"),require("@angular/material/core")):"function"==typeof define&&define.amd?define("@angular/material/paginator",["exports","@angular/common","@angular/core","@angular/material/button","@angular/material/select","@angular/material/tooltip","tslib","@angular/cdk/coercion","rxjs","@angular/material/core"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.paginator={}),e.ng.common,e.ng.core,e.ng.material.button,e.ng.material.select,e.ng.material.tooltip,e.tslib,e.ng.cdk.coercion,e.rxjs,e.ng.material.core)}(this,(function(e,t,a,n,i,o,r,s,p,g){"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 l=function(){function e(){this.changes=new p.Subject,this.itemsPerPageLabel="Items per page:",this.nextPageLabel="Next page",this.previousPageLabel="Previous page",this.firstPageLabel="First page",this.lastPageLabel="Last page",this.getRangeLabel=function(e,t,a){if(0==a||0==t)return"0 of "+a;var n=e*t;return n+1+" – "+(n<(a=Math.max(a,0))?Math.min(n+t,a):n+t)+" of "+a}}return e.decorators=[{type:a.Injectable,args:[{providedIn:"root"}]}],e.ɵprov=a.ɵɵdefineInjectable({factory:function t(){return new e},token:e,providedIn:"root"}),e}();function u(e){return e||new l}var c={provide:l,deps:[[new a.Optional,new a.SkipSelf,l]],useFactory:u},d=function d(){},h=function(e){function t(t,n){var i=e.call(this)||this;return i._intl=t,i._changeDetectorRef=n,i._pageIndex=0,i._length=0,i._pageSizeOptions=[],i._hidePageSize=!1,i._showFirstLastButtons=!1,i.page=new a.EventEmitter,i._intlChanges=t.changes.subscribe((function(){return i._changeDetectorRef.markForCheck()})),i}return r.__extends(t,e),Object.defineProperty(t.prototype,"pageIndex",{get:function(){return this._pageIndex},set:function(e){this._pageIndex=Math.max(s.coerceNumberProperty(e),0),this._changeDetectorRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._length},set:function(e){this._length=s.coerceNumberProperty(e),this._changeDetectorRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pageSize",{get:function(){return this._pageSize},set:function(e){this._pageSize=Math.max(s.coerceNumberProperty(e),0),this._updateDisplayedPageSizeOptions()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pageSizeOptions",{get:function(){return this._pageSizeOptions},set:function(e){this._pageSizeOptions=(e||[]).map((function(e){return s.coerceNumberProperty(e)})),this._updateDisplayedPageSizeOptions()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hidePageSize",{get:function(){return this._hidePageSize},set:function(e){this._hidePageSize=s.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showFirstLastButtons",{get:function(){return this._showFirstLastButtons},set:function(e){this._showFirstLastButtons=s.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){this._initialized=!0,this._updateDisplayedPageSizeOptions(),this._markInitialized()},t.prototype.ngOnDestroy=function(){this._intlChanges.unsubscribe()},t.prototype.nextPage=function(){if(this.hasNextPage()){var e=this.pageIndex;this.pageIndex++,this._emitPageEvent(e)}},t.prototype.previousPage=function(){if(this.hasPreviousPage()){var e=this.pageIndex;this.pageIndex--,this._emitPageEvent(e)}},t.prototype.firstPage=function(){if(this.hasPreviousPage()){var e=this.pageIndex;this.pageIndex=0,this._emitPageEvent(e)}},t.prototype.lastPage=function(){if(this.hasNextPage()){var e=this.pageIndex;this.pageIndex=this.getNumberOfPages()-1,this._emitPageEvent(e)}},t.prototype.hasPreviousPage=function(){return this.pageIndex>=1&&0!=this.pageSize},t.prototype.hasNextPage=function(){var e=this.getNumberOfPages()-1;return this.pageIndex<e&&0!=this.pageSize},t.prototype.getNumberOfPages=function(){return this.pageSize?Math.ceil(this.length/this.pageSize):0},t.prototype._changePageSize=function(e){var t=this.pageIndex;this.pageIndex=Math.floor(this.pageIndex*this.pageSize/e)||0,this.pageSize=e,this._emitPageEvent(t)},t.prototype._nextButtonsDisabled=function(){return this.disabled||!this.hasNextPage()},t.prototype._previousButtonsDisabled=function(){return this.disabled||!this.hasPreviousPage()},t.prototype._updateDisplayedPageSizeOptions=function(){this._initialized&&(this.pageSize||(this._pageSize=0!=this.pageSizeOptions.length?this.pageSizeOptions[0]:50),this._displayedPageSizeOptions=this.pageSizeOptions.slice(),-1===this._displayedPageSizeOptions.indexOf(this.pageSize)&&this._displayedPageSizeOptions.push(this.pageSize),this._displayedPageSizeOptions.sort((function(e,t){return e-t})),this._changeDetectorRef.markForCheck())},t.prototype._emitPageEvent=function(e){this.page.emit({previousPageIndex:e,pageIndex:this.pageIndex,pageSize:this.pageSize,length:this.length})},t.decorators=[{type:a.Component,args:[{selector:"mat-paginator",exportAs:"matPaginator",template:'<div class="mat-paginator-outer-container">\n <div class="mat-paginator-container">\n <div class="mat-paginator-page-size" *ngIf="!hidePageSize">\n <div class="mat-paginator-page-size-label">\n {{_intl.itemsPerPageLabel}}\n </div>\n\n <mat-form-field\n *ngIf="_displayedPageSizeOptions.length > 1"\n [color]="color"\n class="mat-paginator-page-size-select">\n <mat-select\n [value]="pageSize"\n [disabled]="disabled"\n [aria-label]="_intl.itemsPerPageLabel"\n (selectionChange)="_changePageSize($event.value)">\n <mat-option *ngFor="let pageSizeOption of _displayedPageSizeOptions" [value]="pageSizeOption">\n {{pageSizeOption}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <div\n class="mat-paginator-page-size-value"\n *ngIf="_displayedPageSizeOptions.length <= 1">{{pageSize}}</div>\n </div>\n\n <div class="mat-paginator-range-actions">\n <div class="mat-paginator-range-label">\n {{_intl.getRangeLabel(pageIndex, pageSize, length)}}\n </div>\n\n <button mat-icon-button type="button"\n class="mat-paginator-navigation-first"\n (click)="firstPage()"\n [attr.aria-label]="_intl.firstPageLabel"\n [matTooltip]="_intl.firstPageLabel"\n [matTooltipDisabled]="_previousButtonsDisabled()"\n [matTooltipPosition]="\'above\'"\n [disabled]="_previousButtonsDisabled()"\n *ngIf="showFirstLastButtons">\n <svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false">\n <path d="M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"/>\n </svg>\n </button>\n <button mat-icon-button type="button"\n class="mat-paginator-navigation-previous"\n (click)="previousPage()"\n [attr.aria-label]="_intl.previousPageLabel"\n [matTooltip]="_intl.previousPageLabel"\n [matTooltipDisabled]="_previousButtonsDisabled()"\n [matTooltipPosition]="\'above\'"\n [disabled]="_previousButtonsDisabled()">\n <svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false">\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>\n </svg>\n </button>\n <button mat-icon-button type="button"\n class="mat-paginator-navigation-next"\n (click)="nextPage()"\n [attr.aria-label]="_intl.nextPageLabel"\n [matTooltip]="_intl.nextPageLabel"\n [matTooltipDisabled]="_nextButtonsDisabled()"\n [matTooltipPosition]="\'above\'"\n [disabled]="_nextButtonsDisabled()">\n <svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false">\n <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>\n </svg>\n </button>\n <button mat-icon-button type="button"\n class="mat-paginator-navigation-last"\n (click)="lastPage()"\n [attr.aria-label]="_intl.lastPageLabel"\n [matTooltip]="_intl.lastPageLabel"\n [matTooltipDisabled]="_nextButtonsDisabled()"\n [matTooltipPosition]="\'above\'"\n [disabled]="_nextButtonsDisabled()"\n *ngIf="showFirstLastButtons">\n <svg class="mat-paginator-icon" viewBox="0 0 24 24" focusable="false">\n <path d="M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"/>\n </svg>\n </button>\n </div>\n </div>\n</div>\n',inputs:["disabled"],host:{class:"mat-paginator"},changeDetection:a.ChangeDetectionStrategy.OnPush,encapsulation:a.ViewEncapsulation.None,styles:[".mat-paginator{display:block}.mat-paginator-outer-container{display:flex}.mat-paginator-container{display:flex;align-items:center;justify-content:flex-end;min-height:56px;padding:0 8px;flex-wrap:wrap-reverse;width:100%}.mat-paginator-page-size{display:flex;align-items:baseline;margin-right:8px}[dir=rtl] .mat-paginator-page-size{margin-right:0;margin-left:8px}.mat-paginator-page-size-label{margin:0 4px}.mat-paginator-page-size-select{margin:6px 4px 0 4px;width:56px}.mat-paginator-page-size-select.mat-form-field-appearance-outline{width:64px}.mat-paginator-page-size-select.mat-form-field-appearance-fill{width:64px}.mat-paginator-range-label{margin:0 32px 0 24px}.mat-paginator-range-actions{display:flex;align-items:center}.mat-paginator-icon{width:28px;fill:currentColor}[dir=rtl] .mat-paginator-icon{transform:rotate(180deg)}\n"]}]}],t.ctorParameters=function(){return[{type:l},{type:a.ChangeDetectorRef}]},t.propDecorators={color:[{type:a.Input}],pageIndex:[{type:a.Input}],length:[{type:a.Input}],pageSize:[{type:a.Input}],pageSizeOptions:[{type:a.Input}],hidePageSize:[{type:a.Input}],showFirstLastButtons:[{type:a.Input}],page:[{type:a.Output}]},t}(g.mixinDisabled(g.mixinInitialized((function m(){})))),f=function(){function e(){}return e.decorators=[{type:a.NgModule,args:[{imports:[t.CommonModule,n.MatButtonModule,i.MatSelectModule,o.MatTooltipModule],exports:[h],declarations:[h],providers:[c]}]}],e}();
/**
* @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.MAT_PAGINATOR_INTL_PROVIDER=c,e.MAT_PAGINATOR_INTL_PROVIDER_FACTORY=u,e.MatPaginator=h,e.MatPaginatorIntl=l,e.MatPaginatorModule=f,e.PageEvent=d,Object.defineProperty(e,"__esModule",{value:!0})}));