Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<div class="slick-pagination-nav">
<nav aria-label="Page navigation">
<ul class="pagination">
<li class="page-item" [ngClass]="(pageNumber === 1 || totalItems === 0) ? 'disabled' : ''">
<li class="page-item" [ngClass]="isLeftPaginationDisabled ? 'disabled' : ''">
<a class="page-link icon-seek-first fa fa-angle-double-left" aria-label="First"
(click)="changeToFirstPage($event)">
(click)="changeToFirstPage($event)">
</a>
</li>
<li class="page-item" [ngClass]="(pageNumber === 1 || totalItems === 0) ? 'disabled' : ''">
<li class="page-item" [ngClass]="isLeftPaginationDisabled ? 'disabled' : ''">
<a class="page-link icon-seek-prev fa fa-angle-left" aria-label="Previous"
(click)="changeToPreviousPage($event)">
(click)="changeToPreviousPage($event)">
</a>
</li>
</ul>
Expand All @@ -18,20 +18,20 @@
<div class="slick-page-number">
<span>{{textPage}}</span>
<input type="text" class="form-control" data-test="page-number-input" [value]="pageNumber" size="1"
[readOnly]="totalItems === 0" (change)="changeToCurrentPage($event)">
[readOnly]="totalItems === 0" (change)="changeToCurrentPage($event)">
<span>{{textOf}}</span><span data-test="page-count"> {{pageCount}}</span>
</div>

<nav aria-label="Page navigation">
<ul class="pagination">
<li class="page-item" [ngClass]="(pageNumber === pageCount || totalItems === 0) ? 'disabled' : ''">
<li class="page-item" [ngClass]="isRightPaginationDisabled ? 'disabled' : ''">
<a class="page-link icon-seek-next text-center fa fa-lg fa-angle-right" aria-label="Next"
(click)="changeToNextPage($event)">
(click)="changeToNextPage($event)">
</a>
</li>
<li class="page-item" [ngClass]="(pageNumber === pageCount || totalItems === 0) ? 'disabled' : ''">
<li class="page-item" [ngClass]="isRightPaginationDisabled ? 'disabled' : ''">
<a class="page-link icon-seek-end fa fa-lg fa-angle-double-right" aria-label="Last"
(click)="changeToLastPage($event)">
(click)="changeToLastPage($event)">
</a>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ export class SlickPaginationComponent implements OnDestroy, OnInit {
return this.paginationService.dataTo;
}

/** is the left side pagination disabled? */
get isLeftPaginationDisabled(): boolean {
return this.pageNumber === 1 || this.totalItems === 0;
}

/** is the right side pagination disabled? */
get isRightPaginationDisabled(): boolean {
return this.pageNumber === this.pageCount || this.totalItems === 0;
}

get itemsPerPage(): number {
return this.paginationService.itemsPerPage;
}
Expand Down Expand Up @@ -80,20 +90,28 @@ export class SlickPaginationComponent implements OnDestroy, OnInit {
}
}

changeToFirstPage(event: any) {
this.paginationService.goToFirstPage(event);
changeToFirstPage(event: MouseEvent) {
if (!this.isLeftPaginationDisabled) {
this.paginationService.goToFirstPage(event);
}
}

changeToLastPage(event: any) {
this.paginationService.goToLastPage(event);
changeToLastPage(event: MouseEvent) {
if (!this.isRightPaginationDisabled) {
this.paginationService.goToLastPage(event);
}
}

changeToNextPage(event: any) {
this.paginationService.goToNextPage(event);
changeToNextPage(event: MouseEvent) {
if (!this.isRightPaginationDisabled) {
this.paginationService.goToNextPage(event);
}
}

changeToPreviousPage(event: any) {
this.paginationService.goToPreviousPage(event);
changeToPreviousPage(event: MouseEvent) {
if (!this.isLeftPaginationDisabled) {
this.paginationService.goToPreviousPage(event);
}
}

changeToCurrentPage(event: any) {
Expand Down