1 | import { ChangeDetectorRef, EventEmitter } from '@angular/core';
|
2 | import { PaginationService } from './pagination.service';
|
3 | export interface Page {
|
4 | label: string;
|
5 | value: any;
|
6 | }
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | export declare class PaginationControlsDirective {
|
13 | private service;
|
14 | private changeDetectorRef;
|
15 | id: string;
|
16 | maxSize: number;
|
17 | pageChange: EventEmitter<number>;
|
18 | pages: Page[];
|
19 | private changeSub;
|
20 | constructor(service: PaginationService, changeDetectorRef: ChangeDetectorRef);
|
21 | ngOnInit(): void;
|
22 | ngOnChanges(changes: any): void;
|
23 | ngOnDestroy(): void;
|
24 | /**
|
25 | * Go to the previous page
|
26 | */
|
27 | previous(): void;
|
28 | /**
|
29 | * Go to the next page
|
30 | */
|
31 | next(): void;
|
32 | /**
|
33 | * Returns true if current page is first page
|
34 | */
|
35 | isFirstPage(): boolean;
|
36 | /**
|
37 | * Returns true if current page is last page
|
38 | */
|
39 | isLastPage(): boolean;
|
40 | /**
|
41 | * Set the current page number.
|
42 | */
|
43 | setCurrent(page: number): void;
|
44 | /**
|
45 | * Get the current page number.
|
46 | */
|
47 | getCurrent(): number;
|
48 | /**
|
49 | * Returns the last page number
|
50 | */
|
51 | getLastPage(): number;
|
52 | private checkValidId();
|
53 | /**
|
54 | * Updates the page links and checks that the current page is valid. Should run whenever the
|
55 | * PaginationService.change stream emits a value matching the current ID, or when any of the
|
56 | * input values changes.
|
57 | */
|
58 | private updatePageLinks();
|
59 | /**
|
60 | * Checks that the instance.currentPage property is within bounds for the current page range.
|
61 | * If not, return a correct value for currentPage, or the current value if OK.
|
62 | */
|
63 | private outOfBoundCorrection(instance);
|
64 | /**
|
65 | * Returns an array of Page objects to use in the pagination controls.
|
66 | */
|
67 | private createPageArray(currentPage, itemsPerPage, totalItems, paginationRange);
|
68 | /**
|
69 | * Given the position in the sequence of pagination links [i],
|
70 | * figure out what page number corresponds to that position.
|
71 | */
|
72 | private calculatePageNumber(i, currentPage, paginationRange, totalPages);
|
73 | }
|