1 | import * as i0 from '@angular/core';
|
2 | import { Injectable, forwardRef, EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
|
3 | import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
4 | import * as i2 from '@angular/common';
|
5 | import { CommonModule } from '@angular/common';
|
6 |
|
7 |
|
8 |
|
9 | class 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 | }
|
31 | PaginationConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
32 | PaginationConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationConfig, providedIn: 'root' });
|
33 | i0.ɵɵ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 |
|
40 | const PAGER_CONTROL_VALUE_ACCESSOR = {
|
41 | provide: NG_VALUE_ACCESSOR,
|
42 | useExisting: forwardRef(() => PagerComponent),
|
43 | multi: true
|
44 | };
|
45 | class PagerComponent {
|
46 | constructor(elementRef, paginationConfig, changeDetection) {
|
47 | this.elementRef = elementRef;
|
48 | this.changeDetection = changeDetection;
|
49 |
|
50 | this.align = false;
|
51 |
|
52 | this.boundaryLinks = false;
|
53 |
|
54 | this.directionLinks = true;
|
55 |
|
56 |
|
57 | this.firstText = 'First';
|
58 |
|
59 | this.previousText = '« Previous';
|
60 |
|
61 | this.nextText = 'Next »';
|
62 |
|
63 | this.lastText = 'Last';
|
64 |
|
65 | this.rotate = true;
|
66 |
|
67 |
|
68 | this.pageBtnClass = '';
|
69 |
|
70 | this.disabled = false;
|
71 |
|
72 | this.numPages = new EventEmitter();
|
73 | |
74 |
|
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 |
|
91 | get itemsPerPage() {
|
92 | return this._itemsPerPage;
|
93 | }
|
94 | set itemsPerPage(v) {
|
95 | this._itemsPerPage = v;
|
96 | this.totalPages = this.calculateTotalPages();
|
97 | }
|
98 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
191 | const target = event.target;
|
192 | target.blur();
|
193 | }
|
194 | this.writeValue(page);
|
195 | this.onChange(this.page);
|
196 | }
|
197 | }
|
198 |
|
199 | makePage(num, text, active) {
|
200 | return { text, number: num, active };
|
201 | }
|
202 | getPages(currentPage, totalPages) {
|
203 | const pages = [];
|
204 |
|
205 | let startPage = 1;
|
206 | let endPage = totalPages;
|
207 | const isMaxSized = typeof this.maxSize !== 'undefined' && this.maxSize < totalPages;
|
208 |
|
209 | if (isMaxSized && this.maxSize) {
|
210 | if (this.rotate) {
|
211 |
|
212 | startPage = Math.max(currentPage - Math.floor(this.maxSize / 2), 1);
|
213 | endPage = startPage + this.maxSize - 1;
|
214 |
|
215 | if (endPage > totalPages) {
|
216 | endPage = totalPages;
|
217 | startPage = endPage - this.maxSize + 1;
|
218 | }
|
219 | }
|
220 | else {
|
221 |
|
222 | startPage =
|
223 | (Math.ceil(currentPage / this.maxSize) - 1) * this.maxSize + 1;
|
224 |
|
225 | endPage = Math.min(startPage + this.maxSize - 1, totalPages);
|
226 | }
|
227 | }
|
228 |
|
229 | for (let num = startPage; num <= endPage; num++) {
|
230 | const page = this.makePage(num, num.toString(), num === currentPage);
|
231 | pages.push(page);
|
232 | }
|
233 |
|
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 |
|
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 | }
|
254 | PagerComponent.ɵ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 });
|
255 | PagerComponent.ɵ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"] }] });
|
256 | i0.ɵɵ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 |
|
291 | const PAGINATION_CONTROL_VALUE_ACCESSOR = {
|
292 | provide: NG_VALUE_ACCESSOR,
|
293 | useExisting: forwardRef(() => PaginationComponent),
|
294 | multi: true
|
295 | };
|
296 | class PaginationComponent {
|
297 | constructor(elementRef, paginationConfig, changeDetection) {
|
298 | this.elementRef = elementRef;
|
299 | this.changeDetection = changeDetection;
|
300 |
|
301 | this.align = true;
|
302 |
|
303 | this.boundaryLinks = false;
|
304 |
|
305 | this.directionLinks = true;
|
306 |
|
307 | this.rotate = true;
|
308 |
|
309 |
|
310 | this.pageBtnClass = '';
|
311 |
|
312 | this.disabled = false;
|
313 |
|
314 | this.numPages = new EventEmitter();
|
315 | |
316 |
|
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 |
|
333 | get itemsPerPage() {
|
334 | return this._itemsPerPage;
|
335 | }
|
336 | set itemsPerPage(v) {
|
337 | this._itemsPerPage = v;
|
338 | this.totalPages = this.calculateTotalPages();
|
339 | }
|
340 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
433 | const target = event.target;
|
434 | target.blur();
|
435 | }
|
436 | this.writeValue(page);
|
437 | this.onChange(this.page);
|
438 | }
|
439 | }
|
440 |
|
441 | makePage(num, text, active) {
|
442 | return { text, number: num, active };
|
443 | }
|
444 | getPages(currentPage, totalPages) {
|
445 | const pages = [];
|
446 |
|
447 | let startPage = 1;
|
448 | let endPage = totalPages;
|
449 | const isMaxSized = typeof this.maxSize !== 'undefined' && this.maxSize < totalPages;
|
450 |
|
451 | if (isMaxSized && this.maxSize) {
|
452 | if (this.rotate) {
|
453 |
|
454 | startPage = Math.max(currentPage - Math.floor(this.maxSize / 2), 1);
|
455 | endPage = startPage + this.maxSize - 1;
|
456 |
|
457 | if (endPage > totalPages) {
|
458 | endPage = totalPages;
|
459 | startPage = endPage - this.maxSize + 1;
|
460 | }
|
461 | }
|
462 | else {
|
463 |
|
464 | startPage =
|
465 | (Math.ceil(currentPage / this.maxSize) - 1) * this.maxSize + 1;
|
466 |
|
467 | endPage = Math.min(startPage + this.maxSize - 1, totalPages);
|
468 | }
|
469 | }
|
470 |
|
471 | for (let num = startPage; num <= endPage; num++) {
|
472 | const page = this.makePage(num, num.toString(), num === currentPage);
|
473 | pages.push(page);
|
474 | }
|
475 |
|
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 |
|
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 | }
|
496 | PaginationComponent.ɵ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 });
|
497 | PaginationComponent.ɵ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"] }] });
|
498 | i0.ɵɵ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 |
|
543 | class PaginationModule {
|
544 | static forRoot() {
|
545 | return { ngModule: PaginationModule, providers: [] };
|
546 | }
|
547 | }
|
548 | PaginationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
549 | PaginationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.6", ngImport: i0, type: PaginationModule, declarations: [PagerComponent, PaginationComponent], imports: [CommonModule], exports: [PagerComponent, PaginationComponent] });
|
550 | PaginationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: PaginationModule, imports: [CommonModule] });
|
551 | i0.ɵɵ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 |
|
562 |
|
563 |
|
564 | export { PagerComponent, PaginationComponent, PaginationConfig, PaginationModule };
|
565 |
|