ngx-bootstrap-fix-datepicker
Version:
Native Angular Bootstrap Components
2 lines • 12.7 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-bootstrap/pagination",["exports","@angular/core","@angular/forms","@angular/common"],e):e(((t=t||self)["ngx-bootstrap"]=t["ngx-bootstrap"]||{},t["ngx-bootstrap"].pagination={}),t.ng.core,t.ng.forms,t.ng.common)}(this,(function(t,e,i,n){"use strict";var a=function(){function t(){this.main={maxSize:void 0,itemsPerPage:10,boundaryLinks:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",pageBtnClass:"",rotate:!0},this.pager={itemsPerPage:15,previousText:"« Previous",nextText:"Next »",pageBtnClass:"",align:!0}}return t.decorators=[{type:e.Injectable}],t}();var s={provide:i.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return o})),multi:!0},o=function(){function t(t,i,n){this.elementRef=t,this.changeDetection=n,this.numPages=new e.EventEmitter,this.pageChanged=new e.EventEmitter,this.onChange=Function.prototype,this.onTouched=Function.prototype,this.inited=!1,this._page=1,this.elementRef=t,this.config||this.configureOptions(Object.assign({},i.main,i.pager))}return Object.defineProperty(t.prototype,"itemsPerPage",{get:function(){return this._itemsPerPage},set:function(t){this._itemsPerPage=t,this.totalPages=this.calculateTotalPages()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"totalItems",{get:function(){return this._totalItems},set:function(t){this._totalItems=t,this.totalPages=this.calculateTotalPages()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"totalPages",{get:function(){return this._totalPages},set:function(t){this._totalPages=t,this.numPages.emit(t),this.inited&&this.selectPage(this.page)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"page",{get:function(){return this._page},set:function(t){var e=this._page;this._page=t>this.totalPages?this.totalPages:t||1,this.changeDetection.markForCheck(),e!==this._page&&void 0!==e&&this.pageChanged.emit({page:this._page,itemsPerPage:this.itemsPerPage})},enumerable:!0,configurable:!0}),t.prototype.configureOptions=function(t){this.config=Object.assign({},t)},t.prototype.ngOnInit=function(){"undefined"!=typeof window&&(this.classMap=this.elementRef.nativeElement.getAttribute("class")||""),this.maxSize=void 0!==this.maxSize?this.maxSize:this.config.maxSize,this.rotate=void 0!==this.rotate?this.rotate:this.config.rotate,this.boundaryLinks=void 0!==this.boundaryLinks?this.boundaryLinks:this.config.boundaryLinks,this.directionLinks=void 0!==this.directionLinks?this.directionLinks:this.config.directionLinks,this.pageBtnClass=void 0!==this.pageBtnClass?this.pageBtnClass:this.config.pageBtnClass,this.itemsPerPage=void 0!==this.itemsPerPage?this.itemsPerPage:this.config.itemsPerPage,this.totalPages=this.calculateTotalPages(),this.pages=this.getPages(this.page,this.totalPages),this.inited=!0},t.prototype.writeValue=function(t){this.page=t,this.pages=this.getPages(this.page,this.totalPages)},t.prototype.getText=function(t){return this[t+"Text"]||this.config[t+"Text"]},t.prototype.noPrevious=function(){return 1===this.page},t.prototype.noNext=function(){return this.page===this.totalPages},t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},t.prototype.selectPage=function(t,e){if(e&&e.preventDefault(),!this.disabled){if(e&&e.target)e.target.blur();this.writeValue(t),this.onChange(this.page)}},t.prototype.makePage=function(t,e,i){return{text:e,number:t,active:i}},t.prototype.getPages=function(t,e){var i=[],n=1,a=e,s=void 0!==this.maxSize&&this.maxSize<e;s&&(this.rotate?(a=(n=Math.max(t-Math.floor(this.maxSize/2),1))+this.maxSize-1)>e&&(n=(a=e)-this.maxSize+1):(n=(Math.ceil(t/this.maxSize)-1)*this.maxSize+1,a=Math.min(n+this.maxSize-1,e)));for(var o=n;o<=a;o++){var r=this.makePage(o,o.toString(),o===t);i.push(r)}if(s&&!this.rotate){if(n>1){var g=this.makePage(n-1,"...",!1);i.unshift(g)}if(a<e){var p=this.makePage(a+1,"...",!1);i.push(p)}}return i},t.prototype.calculateTotalPages=function(){var t=this.itemsPerPage<1?1:Math.ceil(this.totalItems/this.itemsPerPage);return Math.max(t||0,1)},t.decorators=[{type:e.Component,args:[{selector:"pager",template:'<ul class="pager">\n <li [class.disabled]="noPrevious()" [class.previous]="align"\n [ngClass]="{\'pull-left\': align, \'float-left\': align}"\n class="{{ pageBtnClass }}">\n <a href (click)="selectPage(page - 1, $event)">{{ getText(\'previous\') }}</a>\n </li>\n <li [class.disabled]="noNext()" [class.next]="align"\n [ngClass]="{\'pull-right\': align, \'float-right\': align}"\n class="{{ pageBtnClass }}">\n <a href (click)="selectPage(page + 1, $event)">{{ getText(\'next\') }}</a>\n </li>\n</ul>\n',providers:[s]}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:a},{type:e.ChangeDetectorRef}]},t.propDecorators={align:[{type:e.Input}],maxSize:[{type:e.Input}],boundaryLinks:[{type:e.Input}],directionLinks:[{type:e.Input}],firstText:[{type:e.Input}],previousText:[{type:e.Input}],nextText:[{type:e.Input}],lastText:[{type:e.Input}],rotate:[{type:e.Input}],pageBtnClass:[{type:e.Input}],disabled:[{type:e.Input}],numPages:[{type:e.Output}],pageChanged:[{type:e.Output}],itemsPerPage:[{type:e.Input}],totalItems:[{type:e.Input}]},t}();var r={provide:i.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return g})),multi:!0},g=function(){function t(t,i,n){this.elementRef=t,this.changeDetection=n,this.numPages=new e.EventEmitter,this.pageChanged=new e.EventEmitter,this.onChange=Function.prototype,this.onTouched=Function.prototype,this.inited=!1,this._page=1,this.elementRef=t,this.config||this.configureOptions(i.main)}return Object.defineProperty(t.prototype,"itemsPerPage",{get:function(){return this._itemsPerPage},set:function(t){this._itemsPerPage=t,this.totalPages=this.calculateTotalPages()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"totalItems",{get:function(){return this._totalItems},set:function(t){this._totalItems=t,this.totalPages=this.calculateTotalPages()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"totalPages",{get:function(){return this._totalPages},set:function(t){this._totalPages=t,this.numPages.emit(t),this.inited&&this.selectPage(this.page)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"page",{get:function(){return this._page},set:function(t){var e=this._page;this._page=t>this.totalPages?this.totalPages:t||1,this.changeDetection.markForCheck(),e!==this._page&&void 0!==e&&this.pageChanged.emit({page:this._page,itemsPerPage:this.itemsPerPage})},enumerable:!0,configurable:!0}),t.prototype.configureOptions=function(t){this.config=Object.assign({},t)},t.prototype.ngOnInit=function(){"undefined"!=typeof window&&(this.classMap=this.elementRef.nativeElement.getAttribute("class")||""),this.maxSize=void 0!==this.maxSize?this.maxSize:this.config.maxSize,this.rotate=void 0!==this.rotate?this.rotate:this.config.rotate,this.boundaryLinks=void 0!==this.boundaryLinks?this.boundaryLinks:this.config.boundaryLinks,this.directionLinks=void 0!==this.directionLinks?this.directionLinks:this.config.directionLinks,this.pageBtnClass=void 0!==this.pageBtnClass?this.pageBtnClass:this.config.pageBtnClass,this.itemsPerPage=void 0!==this.itemsPerPage?this.itemsPerPage:this.config.itemsPerPage,this.totalPages=this.calculateTotalPages(),this.pages=this.getPages(this.page,this.totalPages),this.inited=!0},t.prototype.writeValue=function(t){this.page=t,this.pages=this.getPages(this.page,this.totalPages)},t.prototype.getText=function(t){return this[t+"Text"]||this.config[t+"Text"]},t.prototype.noPrevious=function(){return 1===this.page},t.prototype.noNext=function(){return this.page===this.totalPages},t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},t.prototype.selectPage=function(t,e){if(e&&e.preventDefault(),!this.disabled){if(e&&e.target)e.target.blur();this.writeValue(t),this.onChange(this.page)}},t.prototype.makePage=function(t,e,i){return{text:e,number:t,active:i}},t.prototype.getPages=function(t,e){var i=[],n=1,a=e,s=void 0!==this.maxSize&&this.maxSize<e;s&&(this.rotate?(a=(n=Math.max(t-Math.floor(this.maxSize/2),1))+this.maxSize-1)>e&&(n=(a=e)-this.maxSize+1):(n=(Math.ceil(t/this.maxSize)-1)*this.maxSize+1,a=Math.min(n+this.maxSize-1,e)));for(var o=n;o<=a;o++){var r=this.makePage(o,o.toString(),o===t);i.push(r)}if(s&&!this.rotate){if(n>1){var g=this.makePage(n-1,"...",!1);i.unshift(g)}if(a<e){var p=this.makePage(a+1,"...",!1);i.push(p)}}return i},t.prototype.calculateTotalPages=function(){var t=this.itemsPerPage<1?1:Math.ceil(this.totalItems/this.itemsPerPage);return Math.max(t||0,1)},t.decorators=[{type:e.Component,args:[{selector:"pagination",template:'<ul class="pagination" [ngClass]="classMap">\n <li class="pagination-first page-item"\n *ngIf="boundaryLinks"\n [class.disabled]="noPrevious() || disabled">\n <a class="page-link" href (click)="selectPage(1, $event)">\n <ng-container [ngTemplateOutlet]="customFirstTemplate || defaultFirstTemplate"\n [ngTemplateOutletContext]="{disabled: noPrevious() || disabled, currentPage: page}">\n </ng-container>\n </a>\n </li>\n\n <li class="pagination-prev page-item"\n *ngIf="directionLinks"\n [class.disabled]="noPrevious() || disabled">\n <a class="page-link" href (click)="selectPage(page - 1, $event)">\n <ng-container [ngTemplateOutlet]="customPreviousTemplate || defaultPreviousTemplate"\n [ngTemplateOutletContext]="{disabled: noPrevious() || disabled, currentPage: page}">\n </ng-container>\n </a>\n </li>\n\n <li *ngFor="let pg of pages"\n [class.active]="pg.active"\n [class.disabled]="disabled && !pg.active"\n class="pagination-page page-item">\n <a class="page-link" href (click)="selectPage(pg.number, $event)">\n <ng-container [ngTemplateOutlet]="customPageTemplate || defaultPageTemplate"\n [ngTemplateOutletContext]="{disabled: disabled, $implicit: pg, currentPage: page}">\n </ng-container>\n </a>\n </li>\n\n <li class="pagination-next page-item"\n *ngIf="directionLinks"\n [class.disabled]="noNext() || disabled">\n <a class="page-link" href (click)="selectPage(page + 1, $event)">\n <ng-container [ngTemplateOutlet]="customNextTemplate || defaultNextTemplate"\n [ngTemplateOutletContext]="{disabled: noNext() || disabled, currentPage: page}">\n </ng-container>\n </a>\n </li>\n\n <li class="pagination-last page-item"\n *ngIf="boundaryLinks"\n [class.disabled]="noNext() || disabled">\n <a class="page-link" href (click)="selectPage(totalPages, $event)">\n <ng-container [ngTemplateOutlet]="customLastTemplate || defaultLastTemplate"\n [ngTemplateOutletContext]="{disabled: noNext() || disabled, currentPage: page}">\n </ng-container>\n </a>\n </li>\n</ul>\n\n<ng-template #defaultPageTemplate let-page>{{ page.text }}</ng-template>\n\n<ng-template #defaultNextTemplate>{{ getText(\'next\') }}</ng-template>\n\n<ng-template #defaultPreviousTemplate>{{ getText(\'previous\') }}</ng-template>\n\n<ng-template #defaultFirstTemplate>{{ getText(\'first\') }}</ng-template>\n\n<ng-template #defaultLastTemplate>{{ getText(\'last\') }}</ng-template>\n',providers:[r]}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:a},{type:e.ChangeDetectorRef}]},t.propDecorators={align:[{type:e.Input}],maxSize:[{type:e.Input}],boundaryLinks:[{type:e.Input}],directionLinks:[{type:e.Input}],firstText:[{type:e.Input}],previousText:[{type:e.Input}],nextText:[{type:e.Input}],lastText:[{type:e.Input}],rotate:[{type:e.Input}],pageBtnClass:[{type:e.Input}],disabled:[{type:e.Input}],customPageTemplate:[{type:e.Input}],customNextTemplate:[{type:e.Input}],customPreviousTemplate:[{type:e.Input}],customFirstTemplate:[{type:e.Input}],customLastTemplate:[{type:e.Input}],numPages:[{type:e.Output}],pageChanged:[{type:e.Output}],itemsPerPage:[{type:e.Input}],totalItems:[{type:e.Input}]},t}();var p=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[a]}},t.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule],declarations:[o,g],exports:[o,g]}]}],t}();t.PagerComponent=o,t.PaginationComponent=g,t.PaginationConfig=a,t.PaginationModule=p,t.ɵa=s,t.ɵb=r,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-bootstrap-pagination.umd.min.js.map