UNPKG

30.2 kBJavaScriptView Raw
1import * as i0 from '@angular/core';
2import { Injectable, forwardRef, EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
3import { NG_VALUE_ACCESSOR } from '@angular/forms';
4import * as i2 from '@angular/common';
5import { CommonModule } from '@angular/common';
6
7// todo: split
8/** Provides default values for Pagination and pager components */
9class PaginationConfig {
10 constructor() {
11 this.main = {
12 itemsPerPage: 10,
13 boundaryLinks: false,
14 directionLinks: true,
15 firstText: 'First',
16 previousText: 'Previous',
17 nextText: 'Next',
18 lastText: 'Last',
19 pageBtnClass: '',
20 rotate: true
21 };
22 this.pager = {
23 itemsPerPage: 15,
24 previousText: '« Previous',
25 nextText: 'Next »',
26 pageBtnClass: '',
27 align: true
28 };
29 }
30}
31PaginationConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
32PaginationConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationConfig, providedIn: 'root' });
33i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationConfig, decorators: [{
34 type: Injectable,
35 args: [{
36 providedIn: 'root'
37 }]
38 }] });
39
40const PAGER_CONTROL_VALUE_ACCESSOR = {
41 provide: NG_VALUE_ACCESSOR,
42 useExisting: forwardRef(() => PagerComponent),
43 multi: true
44};
45class PagerComponent {
46 constructor(elementRef, paginationConfig, changeDetection) {
47 this.elementRef = elementRef;
48 this.changeDetection = changeDetection;
49 /** if `true` aligns each link to the sides of pager */
50 this.align = false;
51 /** if false first and last buttons will be hidden */
52 this.boundaryLinks = false;
53 /** if false previous and next buttons will be hidden */
54 this.directionLinks = true;
55 // labels
56 /** first button text */
57 this.firstText = 'First';
58 /** previous button text */
59 this.previousText = '« Previous';
60 /** next button text */
61 this.nextText = 'Next »';
62 /** last button text */
63 this.lastText = 'Last';
64 /** if true current page will in the middle of pages list */
65 this.rotate = true;
66 // css
67 /** add class to <code><li\></code> */
68 this.pageBtnClass = '';
69 /** if true pagination component will be disabled */
70 this.disabled = false;
71 /** fired when total pages count changes, $event:number equals to total pages count */
72 this.numPages = new EventEmitter();
73 /** fired when page was changed, $event:{page, itemsPerPage} equals to
74 * object with current page index and number of items per page
75 */
76 this.pageChanged = new EventEmitter();
77 this.onChange = Function.prototype;
78 this.onTouched = Function.prototype;
79 this.classMap = '';
80 this.inited = false;
81 this._itemsPerPage = 15;
82 this._totalItems = 0;
83 this._totalPages = 0;
84 this._page = 1;
85 this.elementRef = elementRef;
86 if (!this.config) {
87 this.configureOptions(Object.assign({}, paginationConfig.main, paginationConfig.pager));
88 }
89 }
90 /** maximum number of items per page. If value less than 1 will display all items on one page */
91 get itemsPerPage() {
92 return this._itemsPerPage;
93 }
94 set itemsPerPage(v) {
95 this._itemsPerPage = v;
96 this.totalPages = this.calculateTotalPages();
97 }
98 /** total number of items in all pages */
99 get totalItems() {
100 return this._totalItems;
101 }
102 set totalItems(v) {
103 this._totalItems = v;
104 this.totalPages = this.calculateTotalPages();
105 }
106 get totalPages() {
107 return this._totalPages;
108 }
109 set totalPages(v) {
110 this._totalPages = v;
111 this.numPages.emit(v);
112 if (this.inited) {
113 this.selectPage(this.page);
114 }
115 }
116 get page() {
117 return this._page;
118 }
119 set page(value) {
120 const _previous = this._page;
121 this._page = value > this.totalPages ? this.totalPages : value || 1;
122 this.changeDetection.markForCheck();
123 if (_previous === this._page || typeof _previous === 'undefined') {
124 return;
125 }
126 this.pageChanged.emit({
127 page: this._page,
128 itemsPerPage: this.itemsPerPage
129 });
130 }
131 configureOptions(config) {
132 this.config = Object.assign({}, config);
133 }
134 ngOnInit() {
135 var _a, _b, _c, _d, _e, _f;
136 if (typeof window !== 'undefined') {
137 this.classMap = this.elementRef.nativeElement.getAttribute('class') || '';
138 }
139 // watch for maxSize
140 if (typeof this.maxSize === 'undefined') {
141 this.maxSize = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.maxSize) || 0;
142 }
143 if (typeof this.rotate === 'undefined') {
144 this.rotate = !!((_b = this.config) === null || _b === void 0 ? void 0 : _b.rotate);
145 }
146 if (typeof this.boundaryLinks === 'undefined') {
147 this.boundaryLinks = !!((_c = this.config) === null || _c === void 0 ? void 0 : _c.boundaryLinks);
148 }
149 if (typeof this.directionLinks === 'undefined') {
150 this.directionLinks = !!((_d = this.config) === null || _d === void 0 ? void 0 : _d.directionLinks);
151 }
152 if (typeof this.pageBtnClass === 'undefined') {
153 this.pageBtnClass = ((_e = this.config) === null || _e === void 0 ? void 0 : _e.pageBtnClass) || '';
154 }
155 // base class
156 if (typeof this.itemsPerPage === 'undefined') {
157 this.itemsPerPage = ((_f = this.config) === null || _f === void 0 ? void 0 : _f.itemsPerPage) || 0;
158 }
159 this.totalPages = this.calculateTotalPages();
160 // this class
161 this.pages = this.getPages(this.page, this.totalPages);
162 this.inited = true;
163 }
164 writeValue(value) {
165 this.page = value;
166 this.pages = this.getPages(this.page, this.totalPages);
167 }
168 getText(key) {
169 // eslint-disable-next-line @typescript-eslint/no-explicit-any
170 return this[`${key}Text`] || this.config[`${key}Text`];
171 }
172 noPrevious() {
173 return this.page === 1;
174 }
175 noNext() {
176 return this.page === this.totalPages;
177 }
178 registerOnChange(fn) {
179 this.onChange = fn;
180 }
181 registerOnTouched(fn) {
182 this.onTouched = fn;
183 }
184 selectPage(page, event) {
185 if (event) {
186 event.preventDefault();
187 }
188 if (!this.disabled) {
189 if (event && event.target) {
190 // eslint-disable-next-line @typescript-eslint/no-explicit-any
191 const target = event.target;
192 target.blur();
193 }
194 this.writeValue(page);
195 this.onChange(this.page);
196 }
197 }
198 // Create page object used in template
199 makePage(num, text, active) {
200 return { text, number: num, active };
201 }
202 getPages(currentPage, totalPages) {
203 const pages = [];
204 // Default page limits
205 let startPage = 1;
206 let endPage = totalPages;
207 const isMaxSized = typeof this.maxSize !== 'undefined' && this.maxSize < totalPages;
208 // recompute if maxSize
209 if (isMaxSized && this.maxSize) {
210 if (this.rotate) {
211 // Current page is displayed in the middle of the visible ones
212 startPage = Math.max(currentPage - Math.floor(this.maxSize / 2), 1);
213 endPage = startPage + this.maxSize - 1;
214 // Adjust if limit is exceeded
215 if (endPage > totalPages) {
216 endPage = totalPages;
217 startPage = endPage - this.maxSize + 1;
218 }
219 }
220 else {
221 // Visible pages are paginated with maxSize
222 startPage =
223 (Math.ceil(currentPage / this.maxSize) - 1) * this.maxSize + 1;
224 // Adjust last page if limit is exceeded
225 endPage = Math.min(startPage + this.maxSize - 1, totalPages);
226 }
227 }
228 // Add page number links
229 for (let num = startPage; num <= endPage; num++) {
230 const page = this.makePage(num, num.toString(), num === currentPage);
231 pages.push(page);
232 }
233 // Add links to move between page sets
234 if (isMaxSized && !this.rotate) {
235 if (startPage > 1) {
236 const previousPageSet = this.makePage(startPage - 1, '...', false);
237 pages.unshift(previousPageSet);
238 }
239 if (endPage < totalPages) {
240 const nextPageSet = this.makePage(endPage + 1, '...', false);
241 pages.push(nextPageSet);
242 }
243 }
244 return pages;
245 }
246 // base class
247 calculateTotalPages() {
248 const totalPages = this.itemsPerPage < 1
249 ? 1
250 : Math.ceil(this.totalItems / this.itemsPerPage);
251 return Math.max(totalPages || 0, 1);
252 }
253}
254PagerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PagerComponent, deps: [{ token: i0.ElementRef }, { token: PaginationConfig }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
255PagerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: PagerComponent, selector: "pager", inputs: { align: "align", maxSize: "maxSize", boundaryLinks: "boundaryLinks", directionLinks: "directionLinks", firstText: "firstText", previousText: "previousText", nextText: "nextText", lastText: "lastText", rotate: "rotate", pageBtnClass: "pageBtnClass", disabled: "disabled", itemsPerPage: "itemsPerPage", totalItems: "totalItems" }, outputs: { numPages: "numPages", pageChanged: "pageChanged" }, providers: [PAGER_CONTROL_VALUE_ACCESSOR], ngImport: i0, template: "<ul class=\"pager\">\n <li [class.disabled]=\"noPrevious()\" [class.previous]=\"align\"\n [ngClass]=\"{'pull-left': align, 'float-left': align}\"\n class=\"{{ pageBtnClass }}\">\n <a href (click)=\"selectPage(page - 1, $event)\">{{ getText('previous') }}</a>\n </li>\n <li [class.disabled]=\"noNext()\" [class.next]=\"align\"\n [ngClass]=\"{'pull-right': align, 'float-right': align}\"\n class=\"{{ pageBtnClass }}\">\n <a href (click)=\"selectPage(page + 1, $event)\">{{ getText('next') }}</a>\n </li>\n</ul>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
256i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PagerComponent, decorators: [{
257 type: Component,
258 args: [{ selector: 'pager', providers: [PAGER_CONTROL_VALUE_ACCESSOR], template: "<ul class=\"pager\">\n <li [class.disabled]=\"noPrevious()\" [class.previous]=\"align\"\n [ngClass]=\"{'pull-left': align, 'float-left': align}\"\n class=\"{{ pageBtnClass }}\">\n <a href (click)=\"selectPage(page - 1, $event)\">{{ getText('previous') }}</a>\n </li>\n <li [class.disabled]=\"noNext()\" [class.next]=\"align\"\n [ngClass]=\"{'pull-right': align, 'float-right': align}\"\n class=\"{{ pageBtnClass }}\">\n <a href (click)=\"selectPage(page + 1, $event)\">{{ getText('next') }}</a>\n </li>\n</ul>\n" }]
259 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: PaginationConfig }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { align: [{
260 type: Input
261 }], maxSize: [{
262 type: Input
263 }], boundaryLinks: [{
264 type: Input
265 }], directionLinks: [{
266 type: Input
267 }], firstText: [{
268 type: Input
269 }], previousText: [{
270 type: Input
271 }], nextText: [{
272 type: Input
273 }], lastText: [{
274 type: Input
275 }], rotate: [{
276 type: Input
277 }], pageBtnClass: [{
278 type: Input
279 }], disabled: [{
280 type: Input
281 }], numPages: [{
282 type: Output
283 }], pageChanged: [{
284 type: Output
285 }], itemsPerPage: [{
286 type: Input
287 }], totalItems: [{
288 type: Input
289 }] } });
290
291const PAGINATION_CONTROL_VALUE_ACCESSOR = {
292 provide: NG_VALUE_ACCESSOR,
293 useExisting: forwardRef(() => PaginationComponent),
294 multi: true
295};
296class PaginationComponent {
297 constructor(elementRef, paginationConfig, changeDetection) {
298 this.elementRef = elementRef;
299 this.changeDetection = changeDetection;
300 /** if `true` aligns each link to the sides of pager */
301 this.align = true;
302 /** if false first and last buttons will be hidden */
303 this.boundaryLinks = false;
304 /** if false previous and next buttons will be hidden */
305 this.directionLinks = true;
306 /** if true current page will in the middle of pages list */
307 this.rotate = true;
308 // css
309 /** add class to <code><li\></code> */
310 this.pageBtnClass = '';
311 /** if true pagination component will be disabled */
312 this.disabled = false;
313 /** fired when total pages count changes, $event:number equals to total pages count */
314 this.numPages = new EventEmitter();
315 /** fired when page was changed, $event:{page, itemsPerPage} equals to object
316 * with current page index and number of items per page
317 */
318 this.pageChanged = new EventEmitter();
319 this.onChange = Function.prototype;
320 this.onTouched = Function.prototype;
321 this.classMap = '';
322 this.inited = false;
323 this._itemsPerPage = 10;
324 this._totalItems = 0;
325 this._totalPages = 0;
326 this._page = 1;
327 this.elementRef = elementRef;
328 if (!this.config) {
329 this.configureOptions(paginationConfig.main);
330 }
331 }
332 /** maximum number of items per page. If value less than 1 will display all items on one page */
333 get itemsPerPage() {
334 return this._itemsPerPage;
335 }
336 set itemsPerPage(v) {
337 this._itemsPerPage = v;
338 this.totalPages = this.calculateTotalPages();
339 }
340 /** total number of items in all pages */
341 get totalItems() {
342 return this._totalItems;
343 }
344 set totalItems(v) {
345 this._totalItems = v;
346 this.totalPages = this.calculateTotalPages();
347 }
348 get totalPages() {
349 return this._totalPages;
350 }
351 set totalPages(v) {
352 this._totalPages = v;
353 this.numPages.emit(v);
354 if (this.inited) {
355 this.selectPage(this.page);
356 }
357 }
358 get page() {
359 return this._page;
360 }
361 set page(value) {
362 const _previous = this._page;
363 this._page = value > this.totalPages ? this.totalPages : value || 1;
364 this.changeDetection.markForCheck();
365 if (_previous === this._page || typeof _previous === 'undefined') {
366 return;
367 }
368 this.pageChanged.emit({
369 page: this._page,
370 itemsPerPage: this.itemsPerPage
371 });
372 }
373 configureOptions(config) {
374 this.config = Object.assign({}, config);
375 }
376 ngOnInit() {
377 var _a, _b, _c, _d, _e, _f;
378 if (typeof window !== 'undefined') {
379 this.classMap = this.elementRef.nativeElement.getAttribute('class') || '';
380 }
381 // watch for maxSize
382 if (typeof this.maxSize === 'undefined') {
383 this.maxSize = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.maxSize) || 0;
384 }
385 if (typeof this.rotate === 'undefined') {
386 this.rotate = !!((_b = this.config) === null || _b === void 0 ? void 0 : _b.rotate);
387 }
388 if (typeof this.boundaryLinks === 'undefined') {
389 this.boundaryLinks = !!((_c = this.config) === null || _c === void 0 ? void 0 : _c.boundaryLinks);
390 }
391 if (typeof this.directionLinks === 'undefined') {
392 this.directionLinks = !!((_d = this.config) === null || _d === void 0 ? void 0 : _d.directionLinks);
393 }
394 if (typeof this.pageBtnClass === 'undefined') {
395 this.pageBtnClass = ((_e = this.config) === null || _e === void 0 ? void 0 : _e.pageBtnClass) || '';
396 }
397 // base class
398 if (typeof this.itemsPerPage === 'undefined') {
399 this.itemsPerPage = ((_f = this.config) === null || _f === void 0 ? void 0 : _f.itemsPerPage) || 0;
400 }
401 this.totalPages = this.calculateTotalPages();
402 // this class
403 this.pages = this.getPages(this.page, this.totalPages);
404 this.inited = true;
405 }
406 writeValue(value) {
407 this.page = value;
408 this.pages = this.getPages(this.page, this.totalPages);
409 }
410 getText(key) {
411 // eslint-disable-next-line @typescript-eslint/no-explicit-any
412 return this[`${key}Text`] || this.config[`${key}Text`];
413 }
414 noPrevious() {
415 return this.page === 1;
416 }
417 noNext() {
418 return this.page === this.totalPages;
419 }
420 registerOnChange(fn) {
421 this.onChange = fn;
422 }
423 registerOnTouched(fn) {
424 this.onTouched = fn;
425 }
426 selectPage(page, event) {
427 if (event) {
428 event.preventDefault();
429 }
430 if (!this.disabled) {
431 if (event && event.target) {
432 // eslint-disable-next-line @typescript-eslint/no-explicit-any
433 const target = event.target;
434 target.blur();
435 }
436 this.writeValue(page);
437 this.onChange(this.page);
438 }
439 }
440 // Create page object used in template
441 makePage(num, text, active) {
442 return { text, number: num, active };
443 }
444 getPages(currentPage, totalPages) {
445 const pages = [];
446 // Default page limits
447 let startPage = 1;
448 let endPage = totalPages;
449 const isMaxSized = typeof this.maxSize !== 'undefined' && this.maxSize < totalPages;
450 // recompute if maxSize
451 if (isMaxSized && this.maxSize) {
452 if (this.rotate) {
453 // Current page is displayed in the middle of the visible ones
454 startPage = Math.max(currentPage - Math.floor(this.maxSize / 2), 1);
455 endPage = startPage + this.maxSize - 1;
456 // Adjust if limit is exceeded
457 if (endPage > totalPages) {
458 endPage = totalPages;
459 startPage = endPage - this.maxSize + 1;
460 }
461 }
462 else {
463 // Visible pages are paginated with maxSize
464 startPage =
465 (Math.ceil(currentPage / this.maxSize) - 1) * this.maxSize + 1;
466 // Adjust last page if limit is exceeded
467 endPage = Math.min(startPage + this.maxSize - 1, totalPages);
468 }
469 }
470 // Add page number links
471 for (let num = startPage; num <= endPage; num++) {
472 const page = this.makePage(num, num.toString(), num === currentPage);
473 pages.push(page);
474 }
475 // Add links to move between page sets
476 if (isMaxSized && !this.rotate) {
477 if (startPage > 1) {
478 const previousPageSet = this.makePage(startPage - 1, '...', false);
479 pages.unshift(previousPageSet);
480 }
481 if (endPage < totalPages) {
482 const nextPageSet = this.makePage(endPage + 1, '...', false);
483 pages.push(nextPageSet);
484 }
485 }
486 return pages;
487 }
488 // base class
489 calculateTotalPages() {
490 const totalPages = this.itemsPerPage < 1
491 ? 1
492 : Math.ceil(this.totalItems / this.itemsPerPage);
493 return Math.max(totalPages || 0, 1);
494 }
495}
496PaginationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationComponent, deps: [{ token: i0.ElementRef }, { token: PaginationConfig }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
497PaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: PaginationComponent, selector: "pagination", inputs: { align: "align", maxSize: "maxSize", boundaryLinks: "boundaryLinks", directionLinks: "directionLinks", firstText: "firstText", previousText: "previousText", nextText: "nextText", lastText: "lastText", rotate: "rotate", pageBtnClass: "pageBtnClass", disabled: "disabled", customPageTemplate: "customPageTemplate", customNextTemplate: "customNextTemplate", customPreviousTemplate: "customPreviousTemplate", customFirstTemplate: "customFirstTemplate", customLastTemplate: "customLastTemplate", itemsPerPage: "itemsPerPage", totalItems: "totalItems" }, outputs: { numPages: "numPages", pageChanged: "pageChanged" }, providers: [PAGINATION_CONTROL_VALUE_ACCESSOR], ngImport: i0, template: "<ul class=\"pagination\" [ngClass]=\"classMap\">\n <li class=\"pagination-first page-item\"\n *ngIf=\"boundaryLinks\"\n [class.disabled]=\"noPrevious() || disabled\">\n <a class=\"page-link\" href (click)=\"selectPage(1, $event)\">\n <ng-container [ngTemplateOutlet]=\"customFirstTemplate || defaultFirstTemplate\"\n [ngTemplateOutletContext]=\"{disabled: noPrevious() || disabled, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n\n <li class=\"pagination-prev page-item\"\n *ngIf=\"directionLinks\"\n [class.disabled]=\"noPrevious() || disabled\">\n <a class=\"page-link\" href (click)=\"selectPage(page - 1, $event)\">\n <ng-container [ngTemplateOutlet]=\"customPreviousTemplate || defaultPreviousTemplate\"\n [ngTemplateOutletContext]=\"{disabled: noPrevious() || disabled, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n\n <li *ngFor=\"let pg of pages\"\n [class.active]=\"pg.active\"\n [class.disabled]=\"disabled && !pg.active\"\n class=\"pagination-page page-item\">\n <a class=\"page-link\" href (click)=\"selectPage(pg.number, $event)\">\n <ng-container [ngTemplateOutlet]=\"customPageTemplate || defaultPageTemplate\"\n [ngTemplateOutletContext]=\"{disabled: disabled, $implicit: pg, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n\n <li class=\"pagination-next page-item\"\n *ngIf=\"directionLinks\"\n [class.disabled]=\"noNext() || disabled\">\n <a class=\"page-link\" href (click)=\"selectPage(page + 1, $event)\">\n <ng-container [ngTemplateOutlet]=\"customNextTemplate || defaultNextTemplate\"\n [ngTemplateOutletContext]=\"{disabled: noNext() || disabled, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n\n <li class=\"pagination-last page-item\"\n *ngIf=\"boundaryLinks\"\n [class.disabled]=\"noNext() || disabled\">\n <a class=\"page-link\" href (click)=\"selectPage(totalPages, $event)\">\n <ng-container [ngTemplateOutlet]=\"customLastTemplate || defaultLastTemplate\"\n [ngTemplateOutletContext]=\"{disabled: noNext() || disabled, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n</ul>\n\n<ng-template #defaultPageTemplate let-page>{{ page.text }}</ng-template>\n\n<ng-template #defaultNextTemplate>{{ getText('next') }}</ng-template>\n\n<ng-template #defaultPreviousTemplate>{{ getText('previous') }}</ng-template>\n\n<ng-template #defaultFirstTemplate>{{ getText('first') }}</ng-template>\n\n<ng-template #defaultLastTemplate>{{ getText('last') }}</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
498i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationComponent, decorators: [{
499 type: Component,
500 args: [{ selector: 'pagination', providers: [PAGINATION_CONTROL_VALUE_ACCESSOR], template: "<ul class=\"pagination\" [ngClass]=\"classMap\">\n <li class=\"pagination-first page-item\"\n *ngIf=\"boundaryLinks\"\n [class.disabled]=\"noPrevious() || disabled\">\n <a class=\"page-link\" href (click)=\"selectPage(1, $event)\">\n <ng-container [ngTemplateOutlet]=\"customFirstTemplate || defaultFirstTemplate\"\n [ngTemplateOutletContext]=\"{disabled: noPrevious() || disabled, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n\n <li class=\"pagination-prev page-item\"\n *ngIf=\"directionLinks\"\n [class.disabled]=\"noPrevious() || disabled\">\n <a class=\"page-link\" href (click)=\"selectPage(page - 1, $event)\">\n <ng-container [ngTemplateOutlet]=\"customPreviousTemplate || defaultPreviousTemplate\"\n [ngTemplateOutletContext]=\"{disabled: noPrevious() || disabled, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n\n <li *ngFor=\"let pg of pages\"\n [class.active]=\"pg.active\"\n [class.disabled]=\"disabled && !pg.active\"\n class=\"pagination-page page-item\">\n <a class=\"page-link\" href (click)=\"selectPage(pg.number, $event)\">\n <ng-container [ngTemplateOutlet]=\"customPageTemplate || defaultPageTemplate\"\n [ngTemplateOutletContext]=\"{disabled: disabled, $implicit: pg, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n\n <li class=\"pagination-next page-item\"\n *ngIf=\"directionLinks\"\n [class.disabled]=\"noNext() || disabled\">\n <a class=\"page-link\" href (click)=\"selectPage(page + 1, $event)\">\n <ng-container [ngTemplateOutlet]=\"customNextTemplate || defaultNextTemplate\"\n [ngTemplateOutletContext]=\"{disabled: noNext() || disabled, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n\n <li class=\"pagination-last page-item\"\n *ngIf=\"boundaryLinks\"\n [class.disabled]=\"noNext() || disabled\">\n <a class=\"page-link\" href (click)=\"selectPage(totalPages, $event)\">\n <ng-container [ngTemplateOutlet]=\"customLastTemplate || defaultLastTemplate\"\n [ngTemplateOutletContext]=\"{disabled: noNext() || disabled, currentPage: page}\">\n </ng-container>\n </a>\n </li>\n</ul>\n\n<ng-template #defaultPageTemplate let-page>{{ page.text }}</ng-template>\n\n<ng-template #defaultNextTemplate>{{ getText('next') }}</ng-template>\n\n<ng-template #defaultPreviousTemplate>{{ getText('previous') }}</ng-template>\n\n<ng-template #defaultFirstTemplate>{{ getText('first') }}</ng-template>\n\n<ng-template #defaultLastTemplate>{{ getText('last') }}</ng-template>\n" }]
501 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: PaginationConfig }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { align: [{
502 type: Input
503 }], maxSize: [{
504 type: Input
505 }], boundaryLinks: [{
506 type: Input
507 }], directionLinks: [{
508 type: Input
509 }], firstText: [{
510 type: Input
511 }], previousText: [{
512 type: Input
513 }], nextText: [{
514 type: Input
515 }], lastText: [{
516 type: Input
517 }], rotate: [{
518 type: Input
519 }], pageBtnClass: [{
520 type: Input
521 }], disabled: [{
522 type: Input
523 }], customPageTemplate: [{
524 type: Input
525 }], customNextTemplate: [{
526 type: Input
527 }], customPreviousTemplate: [{
528 type: Input
529 }], customFirstTemplate: [{
530 type: Input
531 }], customLastTemplate: [{
532 type: Input
533 }], numPages: [{
534 type: Output
535 }], pageChanged: [{
536 type: Output
537 }], itemsPerPage: [{
538 type: Input
539 }], totalItems: [{
540 type: Input
541 }] } });
542
543class PaginationModule {
544 static forRoot() {
545 return { ngModule: PaginationModule, providers: [] };
546 }
547}
548PaginationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
549PaginationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.6", ngImport: i0, type: PaginationModule, declarations: [PagerComponent, PaginationComponent], imports: [CommonModule], exports: [PagerComponent, PaginationComponent] });
550PaginationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationModule, imports: [CommonModule] });
551i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationModule, decorators: [{
552 type: NgModule,
553 args: [{
554 imports: [CommonModule],
555 declarations: [PagerComponent, PaginationComponent],
556 exports: [PagerComponent, PaginationComponent]
557 }]
558 }] });
559
560/**
561 * Generated bundle index. Do not edit.
562 */
563
564export { PagerComponent, PaginationComponent, PaginationConfig, PaginationModule };
565//# sourceMappingURL=ngx-bootstrap-pagination.mjs.map