UNPKG

8 kBTypeScriptView Raw
1import { EventEmitter, OnChanges, SimpleChanges, TemplateRef } from '@angular/core';
2import * as i0 from "@angular/core";
3/**
4 * A context for the
5 * * `NgbPaginationFirst`
6 * * `NgbPaginationPrevious`
7 * * `NgbPaginationNext`
8 * * `NgbPaginationLast`
9 * * `NgbPaginationEllipsis`
10 * * `NgbPaginationPages`
11 *
12 * link templates in case you want to override one.
13 *
14 * @since 4.1.0
15 */
16export interface NgbPaginationLinkContext {
17 /**
18 * Page number displayed by the current link.
19 */
20 currentPage: number;
21 /**
22 * If `true`, the current link is disabled.
23 */
24 disabled: boolean;
25}
26/**
27 * A context for the `NgbPaginationNumber` link template in case you want to override one.
28 *
29 * Extends `NgbPaginationLinkContext`.
30 *
31 * @since 4.1.0
32 */
33export interface NgbPaginationNumberContext extends NgbPaginationLinkContext {
34 /**
35 * The page number, displayed by the current page link.
36 */
37 $implicit: number;
38}
39/**
40 * A context for the `NgbPaginationPages` pages template in case you want to override
41 * the way all pages are displayed.
42 *
43 * @since 9.1.0
44 */
45export interface NgbPaginationPagesContext {
46 /**
47 * The currently selected page number.
48 */
49 $implicit: number;
50 /**
51 * If `true`, pagination is disabled.
52 */
53 disabled: boolean;
54 /**
55 * Pages numbers that should be rendered starting with 1.
56 */
57 pages: number[];
58}
59/**
60 * A directive to match the 'ellipsis' link template
61 *
62 * @since 4.1.0
63 */
64export declare class NgbPaginationEllipsis {
65 templateRef: TemplateRef<any>;
66 static ɵfac: i0.ɵɵFactoryDeclaration<NgbPaginationEllipsis, never>;
67 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbPaginationEllipsis, "ng-template[ngbPaginationEllipsis]", never, {}, {}, never, never, true, never>;
68}
69/**
70 * A directive to match the 'first' link template
71 *
72 * @since 4.1.0
73 */
74export declare class NgbPaginationFirst {
75 templateRef: TemplateRef<any>;
76 static ɵfac: i0.ɵɵFactoryDeclaration<NgbPaginationFirst, never>;
77 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbPaginationFirst, "ng-template[ngbPaginationFirst]", never, {}, {}, never, never, true, never>;
78}
79/**
80 * A directive to match the 'last' link template
81 *
82 * @since 4.1.0
83 */
84export declare class NgbPaginationLast {
85 templateRef: TemplateRef<any>;
86 static ɵfac: i0.ɵɵFactoryDeclaration<NgbPaginationLast, never>;
87 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbPaginationLast, "ng-template[ngbPaginationLast]", never, {}, {}, never, never, true, never>;
88}
89/**
90 * A directive to match the 'next' link template
91 *
92 * @since 4.1.0
93 */
94export declare class NgbPaginationNext {
95 templateRef: TemplateRef<any>;
96 static ɵfac: i0.ɵɵFactoryDeclaration<NgbPaginationNext, never>;
97 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbPaginationNext, "ng-template[ngbPaginationNext]", never, {}, {}, never, never, true, never>;
98}
99/**
100 * A directive to match the page 'number' link template
101 *
102 * @since 4.1.0
103 */
104export declare class NgbPaginationNumber {
105 templateRef: TemplateRef<any>;
106 static ɵfac: i0.ɵɵFactoryDeclaration<NgbPaginationNumber, never>;
107 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbPaginationNumber, "ng-template[ngbPaginationNumber]", never, {}, {}, never, never, true, never>;
108}
109/**
110 * A directive to match the 'previous' link template
111 *
112 * @since 4.1.0
113 */
114export declare class NgbPaginationPrevious {
115 templateRef: TemplateRef<any>;
116 static ɵfac: i0.ɵɵFactoryDeclaration<NgbPaginationPrevious, never>;
117 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbPaginationPrevious, "ng-template[ngbPaginationPrevious]", never, {}, {}, never, never, true, never>;
118}
119/**
120 * A directive to match the 'pages' whole content
121 *
122 * @since 9.1.0
123 */
124export declare class NgbPaginationPages {
125 templateRef: TemplateRef<any>;
126 static ɵfac: i0.ɵɵFactoryDeclaration<NgbPaginationPages, never>;
127 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbPaginationPages, "ng-template[ngbPaginationPages]", never, {}, {}, never, never, true, never>;
128}
129/**
130 * A component that displays page numbers and allows to customize them in several ways.
131 */
132export declare class NgbPagination implements OnChanges {
133 private _config;
134 pageCount: number;
135 pages: number[];
136 tplEllipsis?: NgbPaginationEllipsis;
137 tplFirst?: NgbPaginationFirst;
138 tplLast?: NgbPaginationLast;
139 tplNext?: NgbPaginationNext;
140 tplNumber?: NgbPaginationNumber;
141 tplPrevious?: NgbPaginationPrevious;
142 tplPages?: NgbPaginationPages;
143 /**
144 * If `true`, pagination links will be disabled.
145 */
146 disabled: boolean;
147 /**
148 * If `true`, the "First" and "Last" page links are shown.
149 */
150 boundaryLinks: boolean;
151 /**
152 * If `true`, the "Next" and "Previous" page links are shown.
153 */
154 directionLinks: boolean;
155 /**
156 * If `true`, the ellipsis symbols and first/last page numbers will be shown when `maxSize` > number of pages.
157 */
158 ellipses: boolean;
159 /**
160 * Whether to rotate pages when `maxSize` > number of pages.
161 *
162 * The current page always stays in the middle if `true`.
163 */
164 rotate: boolean;
165 /**
166 * The number of items in your paginated collection.
167 *
168 * Note, that this is not the number of pages. Page numbers are calculated dynamically based on
169 * `collectionSize` and `pageSize`. Ex. if you have 100 items in your collection and displaying 20 items per page,
170 * you'll end up with 5 pages.
171 */
172 collectionSize: number;
173 /**
174 * The maximum number of pages to display.
175 */
176 maxSize: number;
177 /**
178 * The current page.
179 *
180 * Page numbers start with `1`.
181 */
182 page: number;
183 /**
184 * The number of items per page.
185 */
186 pageSize: number;
187 /**
188 * An event fired when the page is changed. Will fire only if collection size is set and all values are valid.
189 *
190 * Event payload is the number of the newly selected page.
191 *
192 * Page numbers start with `1`.
193 */
194 pageChange: EventEmitter<number>;
195 /**
196 * The pagination display size.
197 *
198 * Bootstrap currently supports small and large sizes.
199 *
200 * If the passed value is a string (ex. 'custom'), it will just add the `pagination-custom` css class
201 */
202 size: string | null;
203 hasPrevious(): boolean;
204 hasNext(): boolean;
205 nextDisabled(): boolean;
206 previousDisabled(): boolean;
207 selectPage(pageNumber: number): void;
208 ngOnChanges(changes: SimpleChanges): void;
209 isEllipsis(pageNumber: any): boolean;
210 /**
211 * Appends ellipses and first/last page number to the displayed pages
212 */
213 private _applyEllipses;
214 /**
215 * Rotates page numbers based on maxSize items visible.
216 * Currently selected page stays in the middle:
217 *
218 * Ex. for selected page = 6:
219 * [5,*6*,7] for maxSize = 3
220 * [4,5,*6*,7] for maxSize = 4
221 */
222 private _applyRotation;
223 /**
224 * Paginates page numbers based on maxSize items per page.
225 */
226 private _applyPagination;
227 private _setPageInRange;
228 private _updatePages;
229 static ɵfac: i0.ɵɵFactoryDeclaration<NgbPagination, never>;
230 static ɵcmp: i0.ɵɵComponentDeclaration<NgbPagination, "ngb-pagination", never, { "disabled": { "alias": "disabled"; "required": false; }; "boundaryLinks": { "alias": "boundaryLinks"; "required": false; }; "directionLinks": { "alias": "directionLinks"; "required": false; }; "ellipses": { "alias": "ellipses"; "required": false; }; "rotate": { "alias": "rotate"; "required": false; }; "collectionSize": { "alias": "collectionSize"; "required": true; }; "maxSize": { "alias": "maxSize"; "required": false; }; "page": { "alias": "page"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "size": { "alias": "size"; "required": false; }; }, { "pageChange": "pageChange"; }, ["tplEllipsis", "tplFirst", "tplLast", "tplNext", "tplNumber", "tplPrevious", "tplPages"], never, true, never>;
231}