549 lines
55 KiB
JavaScript
549 lines
55 KiB
JavaScript
|
|
import { Component, ContentChild, Directive, EventEmitter, Input, Output, ChangeDetectionStrategy, } from '@angular/core';
|
||
|
|
import { getValueInRange, isNumber } from '../util/util';
|
||
|
|
import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
|
||
|
|
import * as i0 from "@angular/core";
|
||
|
|
import * as i1 from "./pagination-config";
|
||
|
|
/**
|
||
|
|
* A directive to match the 'ellipsis' link template
|
||
|
|
*
|
||
|
|
* @since 4.1.0
|
||
|
|
*/
|
||
|
|
export class NgbPaginationEllipsis {
|
||
|
|
constructor(templateRef) {
|
||
|
|
this.templateRef = templateRef;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbPaginationEllipsis.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationEllipsis, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
||
|
|
NgbPaginationEllipsis.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: NgbPaginationEllipsis, isStandalone: true, selector: "ng-template[ngbPaginationEllipsis]", ngImport: i0 });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationEllipsis, decorators: [{
|
||
|
|
type: Directive,
|
||
|
|
args: [{ selector: 'ng-template[ngbPaginationEllipsis]', standalone: true }]
|
||
|
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
||
|
|
/**
|
||
|
|
* A directive to match the 'first' link template
|
||
|
|
*
|
||
|
|
* @since 4.1.0
|
||
|
|
*/
|
||
|
|
export class NgbPaginationFirst {
|
||
|
|
constructor(templateRef) {
|
||
|
|
this.templateRef = templateRef;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbPaginationFirst.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationFirst, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
||
|
|
NgbPaginationFirst.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: NgbPaginationFirst, isStandalone: true, selector: "ng-template[ngbPaginationFirst]", ngImport: i0 });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationFirst, decorators: [{
|
||
|
|
type: Directive,
|
||
|
|
args: [{ selector: 'ng-template[ngbPaginationFirst]', standalone: true }]
|
||
|
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
||
|
|
/**
|
||
|
|
* A directive to match the 'last' link template
|
||
|
|
*
|
||
|
|
* @since 4.1.0
|
||
|
|
*/
|
||
|
|
export class NgbPaginationLast {
|
||
|
|
constructor(templateRef) {
|
||
|
|
this.templateRef = templateRef;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbPaginationLast.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationLast, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
||
|
|
NgbPaginationLast.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: NgbPaginationLast, isStandalone: true, selector: "ng-template[ngbPaginationLast]", ngImport: i0 });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationLast, decorators: [{
|
||
|
|
type: Directive,
|
||
|
|
args: [{ selector: 'ng-template[ngbPaginationLast]', standalone: true }]
|
||
|
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
||
|
|
/**
|
||
|
|
* A directive to match the 'next' link template
|
||
|
|
*
|
||
|
|
* @since 4.1.0
|
||
|
|
*/
|
||
|
|
export class NgbPaginationNext {
|
||
|
|
constructor(templateRef) {
|
||
|
|
this.templateRef = templateRef;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbPaginationNext.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationNext, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
||
|
|
NgbPaginationNext.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: NgbPaginationNext, isStandalone: true, selector: "ng-template[ngbPaginationNext]", ngImport: i0 });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationNext, decorators: [{
|
||
|
|
type: Directive,
|
||
|
|
args: [{ selector: 'ng-template[ngbPaginationNext]', standalone: true }]
|
||
|
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
||
|
|
/**
|
||
|
|
* A directive to match the page 'number' link template
|
||
|
|
*
|
||
|
|
* @since 4.1.0
|
||
|
|
*/
|
||
|
|
export class NgbPaginationNumber {
|
||
|
|
constructor(templateRef) {
|
||
|
|
this.templateRef = templateRef;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbPaginationNumber.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationNumber, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
||
|
|
NgbPaginationNumber.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: NgbPaginationNumber, isStandalone: true, selector: "ng-template[ngbPaginationNumber]", ngImport: i0 });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationNumber, decorators: [{
|
||
|
|
type: Directive,
|
||
|
|
args: [{ selector: 'ng-template[ngbPaginationNumber]', standalone: true }]
|
||
|
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
||
|
|
/**
|
||
|
|
* A directive to match the 'previous' link template
|
||
|
|
*
|
||
|
|
* @since 4.1.0
|
||
|
|
*/
|
||
|
|
export class NgbPaginationPrevious {
|
||
|
|
constructor(templateRef) {
|
||
|
|
this.templateRef = templateRef;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbPaginationPrevious.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationPrevious, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
||
|
|
NgbPaginationPrevious.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: NgbPaginationPrevious, isStandalone: true, selector: "ng-template[ngbPaginationPrevious]", ngImport: i0 });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationPrevious, decorators: [{
|
||
|
|
type: Directive,
|
||
|
|
args: [{ selector: 'ng-template[ngbPaginationPrevious]', standalone: true }]
|
||
|
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
||
|
|
/**
|
||
|
|
* A directive to match the 'pages' whole content
|
||
|
|
*
|
||
|
|
* @since 9.1.0
|
||
|
|
*/
|
||
|
|
export class NgbPaginationPages {
|
||
|
|
constructor(templateRef) {
|
||
|
|
this.templateRef = templateRef;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbPaginationPages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationPages, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
||
|
|
NgbPaginationPages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: NgbPaginationPages, isStandalone: true, selector: "ng-template[ngbPaginationPages]", ngImport: i0 });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPaginationPages, decorators: [{
|
||
|
|
type: Directive,
|
||
|
|
args: [{ selector: 'ng-template[ngbPaginationPages]', standalone: true }]
|
||
|
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
||
|
|
/**
|
||
|
|
* A component that displays page numbers and allows to customize them in several ways.
|
||
|
|
*/
|
||
|
|
export class NgbPagination {
|
||
|
|
constructor(config) {
|
||
|
|
this.pageCount = 0;
|
||
|
|
this.pages = [];
|
||
|
|
/**
|
||
|
|
* The current page.
|
||
|
|
*
|
||
|
|
* Page numbers start with `1`.
|
||
|
|
*/
|
||
|
|
this.page = 1;
|
||
|
|
/**
|
||
|
|
* An event fired when the page is changed. Will fire only if collection size is set and all values are valid.
|
||
|
|
*
|
||
|
|
* Event payload is the number of the newly selected page.
|
||
|
|
*
|
||
|
|
* Page numbers start with `1`.
|
||
|
|
*/
|
||
|
|
this.pageChange = new EventEmitter(true);
|
||
|
|
this.disabled = config.disabled;
|
||
|
|
this.boundaryLinks = config.boundaryLinks;
|
||
|
|
this.directionLinks = config.directionLinks;
|
||
|
|
this.ellipses = config.ellipses;
|
||
|
|
this.maxSize = config.maxSize;
|
||
|
|
this.pageSize = config.pageSize;
|
||
|
|
this.rotate = config.rotate;
|
||
|
|
this.size = config.size;
|
||
|
|
}
|
||
|
|
hasPrevious() {
|
||
|
|
return this.page > 1;
|
||
|
|
}
|
||
|
|
hasNext() {
|
||
|
|
return this.page < this.pageCount;
|
||
|
|
}
|
||
|
|
nextDisabled() {
|
||
|
|
return !this.hasNext() || this.disabled;
|
||
|
|
}
|
||
|
|
previousDisabled() {
|
||
|
|
return !this.hasPrevious() || this.disabled;
|
||
|
|
}
|
||
|
|
selectPage(pageNumber) {
|
||
|
|
this._updatePages(pageNumber);
|
||
|
|
}
|
||
|
|
ngOnChanges(changes) {
|
||
|
|
this._updatePages(this.page);
|
||
|
|
}
|
||
|
|
isEllipsis(pageNumber) {
|
||
|
|
return pageNumber === -1;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Appends ellipses and first/last page number to the displayed pages
|
||
|
|
*/
|
||
|
|
_applyEllipses(start, end) {
|
||
|
|
if (this.ellipses) {
|
||
|
|
if (start > 0) {
|
||
|
|
// The first page will always be included. If the displayed range
|
||
|
|
// starts after the third page, then add ellipsis. But if the range
|
||
|
|
// starts on the third page, then add the second page instead of
|
||
|
|
// an ellipsis, because the ellipsis would only hide a single page.
|
||
|
|
if (start > 2) {
|
||
|
|
this.pages.unshift(-1);
|
||
|
|
}
|
||
|
|
else if (start === 2) {
|
||
|
|
this.pages.unshift(2);
|
||
|
|
}
|
||
|
|
this.pages.unshift(1);
|
||
|
|
}
|
||
|
|
if (end < this.pageCount) {
|
||
|
|
// The last page will always be included. If the displayed range
|
||
|
|
// ends before the third-last page, then add ellipsis. But if the range
|
||
|
|
// ends on third-last page, then add the second-last page instead of
|
||
|
|
// an ellipsis, because the ellipsis would only hide a single page.
|
||
|
|
if (end < this.pageCount - 2) {
|
||
|
|
this.pages.push(-1);
|
||
|
|
}
|
||
|
|
else if (end === this.pageCount - 2) {
|
||
|
|
this.pages.push(this.pageCount - 1);
|
||
|
|
}
|
||
|
|
this.pages.push(this.pageCount);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Rotates page numbers based on maxSize items visible.
|
||
|
|
* Currently selected page stays in the middle:
|
||
|
|
*
|
||
|
|
* Ex. for selected page = 6:
|
||
|
|
* [5,*6*,7] for maxSize = 3
|
||
|
|
* [4,5,*6*,7] for maxSize = 4
|
||
|
|
*/
|
||
|
|
_applyRotation() {
|
||
|
|
let start = 0;
|
||
|
|
let end = this.pageCount;
|
||
|
|
let leftOffset = Math.floor(this.maxSize / 2);
|
||
|
|
let rightOffset = this.maxSize % 2 === 0 ? leftOffset - 1 : leftOffset;
|
||
|
|
if (this.page <= leftOffset) {
|
||
|
|
// very beginning, no rotation -> [0..maxSize]
|
||
|
|
end = this.maxSize;
|
||
|
|
}
|
||
|
|
else if (this.pageCount - this.page < leftOffset) {
|
||
|
|
// very end, no rotation -> [len-maxSize..len]
|
||
|
|
start = this.pageCount - this.maxSize;
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
// rotate
|
||
|
|
start = this.page - leftOffset - 1;
|
||
|
|
end = this.page + rightOffset;
|
||
|
|
}
|
||
|
|
return [start, end];
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Paginates page numbers based on maxSize items per page.
|
||
|
|
*/
|
||
|
|
_applyPagination() {
|
||
|
|
let page = Math.ceil(this.page / this.maxSize) - 1;
|
||
|
|
let start = page * this.maxSize;
|
||
|
|
let end = start + this.maxSize;
|
||
|
|
return [start, end];
|
||
|
|
}
|
||
|
|
_setPageInRange(newPageNo) {
|
||
|
|
const prevPageNo = this.page;
|
||
|
|
this.page = getValueInRange(newPageNo, this.pageCount, 1);
|
||
|
|
if (this.page !== prevPageNo && isNumber(this.collectionSize)) {
|
||
|
|
this.pageChange.emit(this.page);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
_updatePages(newPage) {
|
||
|
|
this.pageCount = Math.ceil(this.collectionSize / this.pageSize);
|
||
|
|
if (!isNumber(this.pageCount)) {
|
||
|
|
this.pageCount = 0;
|
||
|
|
}
|
||
|
|
// fill-in model needed to render pages
|
||
|
|
this.pages.length = 0;
|
||
|
|
for (let i = 1; i <= this.pageCount; i++) {
|
||
|
|
this.pages.push(i);
|
||
|
|
}
|
||
|
|
// set page within 1..max range
|
||
|
|
this._setPageInRange(newPage);
|
||
|
|
// apply maxSize if necessary
|
||
|
|
if (this.maxSize > 0 && this.pageCount > this.maxSize) {
|
||
|
|
let start = 0;
|
||
|
|
let end = this.pageCount;
|
||
|
|
// either paginating or rotating page numbers
|
||
|
|
if (this.rotate) {
|
||
|
|
[start, end] = this._applyRotation();
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
[start, end] = this._applyPagination();
|
||
|
|
}
|
||
|
|
this.pages = this.pages.slice(start, end);
|
||
|
|
// adding ellipses
|
||
|
|
this._applyEllipses(start, end);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
NgbPagination.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPagination, deps: [{ token: i1.NgbPaginationConfig }], target: i0.ɵɵFactoryTarget.Component });
|
||
|
|
NgbPagination.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: NgbPagination, isStandalone: true, selector: "ngb-pagination", inputs: { disabled: "disabled", boundaryLinks: "boundaryLinks", directionLinks: "directionLinks", ellipses: "ellipses", rotate: "rotate", collectionSize: "collectionSize", maxSize: "maxSize", page: "page", pageSize: "pageSize", size: "size" }, outputs: { pageChange: "pageChange" }, host: { attributes: { "role": "navigation" } }, queries: [{ propertyName: "tplEllipsis", first: true, predicate: NgbPaginationEllipsis, descendants: true }, { propertyName: "tplFirst", first: true, predicate: NgbPaginationFirst, descendants: true }, { propertyName: "tplLast", first: true, predicate: NgbPaginationLast, descendants: true }, { propertyName: "tplNext", first: true, predicate: NgbPaginationNext, descendants: true }, { propertyName: "tplNumber", first: true, predicate: NgbPaginationNumber, descendants: true }, { propertyName: "tplPrevious", first: true, predicate: NgbPaginationPrevious, descendants: true }, { propertyName: "tplPages", first: true, predicate: NgbPaginationPages, descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
||
|
|
<ng-template #first><span aria-hidden="true" i18n="@@ngb.pagination.first">««</span></ng-template>
|
||
|
|
<ng-template #previous><span aria-hidden="true" i18n="@@ngb.pagination.previous">«</span></ng-template>
|
||
|
|
<ng-template #next><span aria-hidden="true" i18n="@@ngb.pagination.next">»</span></ng-template>
|
||
|
|
<ng-template #last><span aria-hidden="true" i18n="@@ngb.pagination.last">»»</span></ng-template>
|
||
|
|
<ng-template #ellipsis>...</ng-template>
|
||
|
|
<ng-template #defaultNumber let-page let-currentPage="currentPage">{{ page }}</ng-template>
|
||
|
|
<ng-template #defaultPages let-page let-pages="pages" let-disabled="disabled">
|
||
|
|
<li
|
||
|
|
*ngFor="let pageNumber of pages"
|
||
|
|
class="page-item"
|
||
|
|
[class.active]="pageNumber === page"
|
||
|
|
[class.disabled]="isEllipsis(pageNumber) || disabled"
|
||
|
|
[attr.aria-current]="pageNumber === page ? 'page' : null"
|
||
|
|
>
|
||
|
|
<a *ngIf="isEllipsis(pageNumber)" class="page-link" tabindex="-1" aria-disabled="true">
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplEllipsis?.templateRef || ellipsis"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: true, currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
<a
|
||
|
|
*ngIf="!isEllipsis(pageNumber)"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(pageNumber); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="disabled ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="disabled ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplNumber?.templateRef || defaultNumber"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: disabled, $implicit: pageNumber, currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
</ng-template>
|
||
|
|
<ul [class]="'pagination' + (size ? ' pagination-' + size : '')">
|
||
|
|
<li *ngIf="boundaryLinks" class="page-item" [class.disabled]="previousDisabled()">
|
||
|
|
<a
|
||
|
|
aria-label="First"
|
||
|
|
i18n-aria-label="@@ngb.pagination.first-aria"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(1); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="previousDisabled() ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="previousDisabled() ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplFirst?.templateRef || first"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: previousDisabled(), currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
|
||
|
|
<li *ngIf="directionLinks" class="page-item" [class.disabled]="previousDisabled()">
|
||
|
|
<a
|
||
|
|
aria-label="Previous"
|
||
|
|
i18n-aria-label="@@ngb.pagination.previous-aria"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(page - 1); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="previousDisabled() ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="previousDisabled() ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplPrevious?.templateRef || previous"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: previousDisabled() }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplPages?.templateRef || defaultPages"
|
||
|
|
[ngTemplateOutletContext]="{ $implicit: page, pages: pages, disabled: disabled }"
|
||
|
|
>
|
||
|
|
</ng-template>
|
||
|
|
<li *ngIf="directionLinks" class="page-item" [class.disabled]="nextDisabled()">
|
||
|
|
<a
|
||
|
|
aria-label="Next"
|
||
|
|
i18n-aria-label="@@ngb.pagination.next-aria"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(page + 1); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="nextDisabled() ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="nextDisabled() ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplNext?.templateRef || next"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: nextDisabled(), currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
|
||
|
|
<li *ngIf="boundaryLinks" class="page-item" [class.disabled]="nextDisabled()">
|
||
|
|
<a
|
||
|
|
aria-label="Last"
|
||
|
|
i18n-aria-label="@@ngb.pagination.last-aria"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(pageCount); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="nextDisabled() ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="nextDisabled() ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplLast?.templateRef || last"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: nextDisabled(), currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
</ul>
|
||
|
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
||
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NgbPagination, decorators: [{
|
||
|
|
type: Component,
|
||
|
|
args: [{
|
||
|
|
selector: 'ngb-pagination',
|
||
|
|
standalone: true,
|
||
|
|
imports: [NgIf, NgFor, NgTemplateOutlet],
|
||
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||
|
|
host: { role: 'navigation' },
|
||
|
|
template: `
|
||
|
|
<ng-template #first><span aria-hidden="true" i18n="@@ngb.pagination.first">««</span></ng-template>
|
||
|
|
<ng-template #previous><span aria-hidden="true" i18n="@@ngb.pagination.previous">«</span></ng-template>
|
||
|
|
<ng-template #next><span aria-hidden="true" i18n="@@ngb.pagination.next">»</span></ng-template>
|
||
|
|
<ng-template #last><span aria-hidden="true" i18n="@@ngb.pagination.last">»»</span></ng-template>
|
||
|
|
<ng-template #ellipsis>...</ng-template>
|
||
|
|
<ng-template #defaultNumber let-page let-currentPage="currentPage">{{ page }}</ng-template>
|
||
|
|
<ng-template #defaultPages let-page let-pages="pages" let-disabled="disabled">
|
||
|
|
<li
|
||
|
|
*ngFor="let pageNumber of pages"
|
||
|
|
class="page-item"
|
||
|
|
[class.active]="pageNumber === page"
|
||
|
|
[class.disabled]="isEllipsis(pageNumber) || disabled"
|
||
|
|
[attr.aria-current]="pageNumber === page ? 'page' : null"
|
||
|
|
>
|
||
|
|
<a *ngIf="isEllipsis(pageNumber)" class="page-link" tabindex="-1" aria-disabled="true">
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplEllipsis?.templateRef || ellipsis"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: true, currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
<a
|
||
|
|
*ngIf="!isEllipsis(pageNumber)"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(pageNumber); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="disabled ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="disabled ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplNumber?.templateRef || defaultNumber"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: disabled, $implicit: pageNumber, currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
</ng-template>
|
||
|
|
<ul [class]="'pagination' + (size ? ' pagination-' + size : '')">
|
||
|
|
<li *ngIf="boundaryLinks" class="page-item" [class.disabled]="previousDisabled()">
|
||
|
|
<a
|
||
|
|
aria-label="First"
|
||
|
|
i18n-aria-label="@@ngb.pagination.first-aria"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(1); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="previousDisabled() ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="previousDisabled() ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplFirst?.templateRef || first"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: previousDisabled(), currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
|
||
|
|
<li *ngIf="directionLinks" class="page-item" [class.disabled]="previousDisabled()">
|
||
|
|
<a
|
||
|
|
aria-label="Previous"
|
||
|
|
i18n-aria-label="@@ngb.pagination.previous-aria"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(page - 1); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="previousDisabled() ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="previousDisabled() ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplPrevious?.templateRef || previous"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: previousDisabled() }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplPages?.templateRef || defaultPages"
|
||
|
|
[ngTemplateOutletContext]="{ $implicit: page, pages: pages, disabled: disabled }"
|
||
|
|
>
|
||
|
|
</ng-template>
|
||
|
|
<li *ngIf="directionLinks" class="page-item" [class.disabled]="nextDisabled()">
|
||
|
|
<a
|
||
|
|
aria-label="Next"
|
||
|
|
i18n-aria-label="@@ngb.pagination.next-aria"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(page + 1); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="nextDisabled() ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="nextDisabled() ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplNext?.templateRef || next"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: nextDisabled(), currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
|
||
|
|
<li *ngIf="boundaryLinks" class="page-item" [class.disabled]="nextDisabled()">
|
||
|
|
<a
|
||
|
|
aria-label="Last"
|
||
|
|
i18n-aria-label="@@ngb.pagination.last-aria"
|
||
|
|
class="page-link"
|
||
|
|
href
|
||
|
|
(click)="selectPage(pageCount); $event.preventDefault()"
|
||
|
|
[attr.tabindex]="nextDisabled() ? '-1' : null"
|
||
|
|
[attr.aria-disabled]="nextDisabled() ? 'true' : null"
|
||
|
|
>
|
||
|
|
<ng-template
|
||
|
|
[ngTemplateOutlet]="tplLast?.templateRef || last"
|
||
|
|
[ngTemplateOutletContext]="{ disabled: nextDisabled(), currentPage: page }"
|
||
|
|
></ng-template>
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
</ul>
|
||
|
|
`,
|
||
|
|
}]
|
||
|
|
}], ctorParameters: function () { return [{ type: i1.NgbPaginationConfig }]; }, propDecorators: { tplEllipsis: [{
|
||
|
|
type: ContentChild,
|
||
|
|
args: [NgbPaginationEllipsis, { static: false }]
|
||
|
|
}], tplFirst: [{
|
||
|
|
type: ContentChild,
|
||
|
|
args: [NgbPaginationFirst, { static: false }]
|
||
|
|
}], tplLast: [{
|
||
|
|
type: ContentChild,
|
||
|
|
args: [NgbPaginationLast, { static: false }]
|
||
|
|
}], tplNext: [{
|
||
|
|
type: ContentChild,
|
||
|
|
args: [NgbPaginationNext, { static: false }]
|
||
|
|
}], tplNumber: [{
|
||
|
|
type: ContentChild,
|
||
|
|
args: [NgbPaginationNumber, { static: false }]
|
||
|
|
}], tplPrevious: [{
|
||
|
|
type: ContentChild,
|
||
|
|
args: [NgbPaginationPrevious, { static: false }]
|
||
|
|
}], tplPages: [{
|
||
|
|
type: ContentChild,
|
||
|
|
args: [NgbPaginationPages, { static: false }]
|
||
|
|
}], disabled: [{
|
||
|
|
type: Input
|
||
|
|
}], boundaryLinks: [{
|
||
|
|
type: Input
|
||
|
|
}], directionLinks: [{
|
||
|
|
type: Input
|
||
|
|
}], ellipses: [{
|
||
|
|
type: Input
|
||
|
|
}], rotate: [{
|
||
|
|
type: Input
|
||
|
|
}], collectionSize: [{
|
||
|
|
type: Input
|
||
|
|
}], maxSize: [{
|
||
|
|
type: Input
|
||
|
|
}], page: [{
|
||
|
|
type: Input
|
||
|
|
}], pageSize: [{
|
||
|
|
type: Input
|
||
|
|
}], pageChange: [{
|
||
|
|
type: Output
|
||
|
|
}], size: [{
|
||
|
|
type: Input
|
||
|
|
}] } });
|
||
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFnaW5hdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9wYWdpbmF0aW9uL3BhZ2luYXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNOLFNBQVMsRUFDVCxZQUFZLEVBQ1osU0FBUyxFQUNULFlBQVksRUFDWixLQUFLLEVBQ0wsTUFBTSxFQUVOLHVCQUF1QixHQUd2QixNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsZUFBZSxFQUFFLFFBQVEsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUV6RCxPQUFPLEVBQUUsS0FBSyxFQUFFLElBQUksRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGlCQUFpQixDQUFDOzs7QUFnRWhFOzs7O0dBSUc7QUFFSCxNQUFNLE9BQU8scUJBQXFCO0lBQ2pDLFlBQW1CLFdBQWtEO1FBQWxELGdCQUFXLEdBQVgsV0FBVyxDQUF1QztJQUFHLENBQUM7O2tIQUQ3RCxxQkFBcUI7c0dBQXJCLHFCQUFxQjsyRkFBckIscUJBQXFCO2tCQURqQyxTQUFTO21CQUFDLEVBQUUsUUFBUS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