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 | pageBoundsCorrection: EventEmitter<number>;
|
19 | pages: Page[];
|
20 | private changeSub;
|
21 | constructor(service: PaginationService, changeDetectorRef: ChangeDetectorRef);
|
22 | ngOnInit(): void;
|
23 | ngOnChanges(changes: any): void;
|
24 | ngOnDestroy(): void;
|
25 | /**
|
26 | * Go to the previous page
|
27 | */
|
28 | previous(): void;
|
29 | /**
|
30 | * Go to the next page
|
31 | */
|
32 | next(): void;
|
33 | /**
|
34 | * Returns true if current page is first page
|
35 | */
|
36 | isFirstPage(): boolean;
|
37 | /**
|
38 | * Returns true if current page is last page
|
39 | */
|
40 | isLastPage(): boolean;
|
41 | /**
|
42 | * Set the current page number.
|
43 | */
|
44 | setCurrent(page: number): void;
|
45 | /**
|
46 | * Get the current page number.
|
47 | */
|
48 | getCurrent(): number;
|
49 | /**
|
50 | * Returns the last page number
|
51 | */
|
52 | getLastPage(): number;
|
53 | getTotalItems(): number;
|
54 | private checkValidId;
|
55 | /**
|
56 | * Updates the page links and checks that the current page is valid. Should run whenever the
|
57 | * PaginationService.change stream emits a value matching the current ID, or when any of the
|
58 | * input values changes.
|
59 | */
|
60 | private updatePageLinks;
|
61 | /**
|
62 | * Checks that the instance.currentPage property is within bounds for the current page range.
|
63 | * If not, return a correct value for currentPage, or the current value if OK.
|
64 | */
|
65 | private outOfBoundCorrection;
|
66 | /**
|
67 | * Returns an array of Page objects to use in the pagination controls.
|
68 | */
|
69 | private createPageArray;
|
70 | /**
|
71 | * Given the position in the sequence of pagination links [i],
|
72 | * figure out what page number corresponds to that position.
|
73 | */
|
74 | private calculatePageNumber;
|
75 | }
|