UNPKG

11.9 kBJavaScriptView Raw
1/**
2 * The default template and styles for the pagination links are borrowed directly
3 * from Zurb Foundation 6: http://foundation.zurb.com/sites/docs/pagination.html
4 */
5export const DEFAULT_TEMPLATE = `
6 <pagination-template #p="paginationApi"
7 [id]="id"
8 [maxSize]="maxSize"
9 (pageChange)="pageChange.emit($event)"
10 (pageBoundsCorrection)="pageBoundsCorrection.emit($event)">
11 <nav role="navigation" [attr.aria-label]="screenReaderPaginationLabel">
12 <ul class="ngx-pagination"
13 [class.responsive]="responsive"
14 *ngIf="!(autoHide && p.pages.length <= 1)">
15
16 <li class="pagination-previous" [class.disabled]="p.isFirstPage()" *ngIf="directionLinks">
17 <a tabindex="0" *ngIf="1 < p.getCurrent()" (keyup.enter)="p.previous()" (click)="p.previous()">
18 {{ previousLabel }} <span class="show-for-sr">{{ screenReaderPageLabel }}</span>
19 </a>
20 <span *ngIf="p.isFirstPage()" aria-disabled="true">
21 {{ previousLabel }} <span class="show-for-sr">{{ screenReaderPageLabel }}</span>
22 </span>
23 </li>
24
25 <li class="small-screen">
26 {{ p.getCurrent() }} / {{ p.getLastPage() }}
27 </li>
28
29 <li [class.current]="p.getCurrent() === page.value"
30 [class.ellipsis]="page.label === '...'"
31 *ngFor="let page of p.pages; trackBy: trackByIndex">
32 <a tabindex="0" (keyup.enter)="p.setCurrent(page.value)" (click)="p.setCurrent(page.value)" *ngIf="p.getCurrent() !== page.value">
33 <span class="show-for-sr">{{ screenReaderPageLabel }} </span>
34 <span>{{ (page.label === '...') ? page.label : (page.label | number:'') }}</span>
35 </a>
36 <ng-container *ngIf="p.getCurrent() === page.value">
37 <span aria-live="polite">
38 <span class="show-for-sr">{{ screenReaderCurrentLabel }} </span>
39 <span>{{ (page.label === '...') ? page.label : (page.label | number:'') }}</span>
40 </span>
41 </ng-container>
42 </li>
43
44 <li class="pagination-next" [class.disabled]="p.isLastPage()" *ngIf="directionLinks">
45 <a tabindex="0" *ngIf="!p.isLastPage()" (keyup.enter)="p.next()" (click)="p.next()">
46 {{ nextLabel }} <span class="show-for-sr">{{ screenReaderPageLabel }}</span>
47 </a>
48 <span *ngIf="p.isLastPage()" aria-disabled="true">
49 {{ nextLabel }} <span class="show-for-sr">{{ screenReaderPageLabel }}</span>
50 </span>
51 </li>
52
53 </ul>
54 </nav>
55 </pagination-template>
56 `;
57export const DEFAULT_STYLES = `
58.ngx-pagination {
59 margin-left: 0;
60 margin-bottom: 1rem; }
61 .ngx-pagination::before, .ngx-pagination::after {
62 content: ' ';
63 display: table; }
64 .ngx-pagination::after {
65 clear: both; }
66 .ngx-pagination li {
67 -moz-user-select: none;
68 -webkit-user-select: none;
69 -ms-user-select: none;
70 margin-right: 0.0625rem;
71 border-radius: 0; }
72 .ngx-pagination li {
73 display: inline-block; }
74 .ngx-pagination a,
75 .ngx-pagination button {
76 color: #0a0a0a;
77 display: block;
78 padding: 0.1875rem 0.625rem;
79 border-radius: 0; }
80 .ngx-pagination a:hover,
81 .ngx-pagination button:hover {
82 background: #e6e6e6; }
83 .ngx-pagination .current {
84 padding: 0.1875rem 0.625rem;
85 background: #2199e8;
86 color: #fefefe;
87 cursor: default; }
88 .ngx-pagination .disabled {
89 padding: 0.1875rem 0.625rem;
90 color: #cacaca;
91 cursor: default; }
92 .ngx-pagination .disabled:hover {
93 background: transparent; }
94 .ngx-pagination a, .ngx-pagination button {
95 cursor: pointer; }
96
97.ngx-pagination .pagination-previous a::before,
98.ngx-pagination .pagination-previous.disabled::before {
99 content: '«';
100 display: inline-block;
101 margin-right: 0.5rem; }
102
103.ngx-pagination .pagination-next a::after,
104.ngx-pagination .pagination-next.disabled::after {
105 content: '»';
106 display: inline-block;
107 margin-left: 0.5rem; }
108
109.ngx-pagination .show-for-sr {
110 position: absolute !important;
111 width: 1px;
112 height: 1px;
113 overflow: hidden;
114 clip: rect(0, 0, 0, 0); }
115.ngx-pagination .small-screen {
116 display: none; }
117@media screen and (max-width: 601px) {
118 .ngx-pagination.responsive .small-screen {
119 display: inline-block; }
120 .ngx-pagination.responsive li:not(.small-screen):not(.pagination-previous):not(.pagination-next) {
121 display: none; }
122}
123 `;
124//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVtcGxhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtcGFnaW5hdGlvbi9zcmMvbGliL3RlbXBsYXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7R0FHRztBQUVILE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7S0FtRDNCLENBQUM7QUFFTixNQUFNLENBQUMsTUFBTSxjQUFjLEdBQUc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQWtFM0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxyXG4gKiBUaGUgZGVmYXVsdCB0ZW1wbGF0ZSBhbmQgc3R5bGVzIGZvciB0aGUgcGFnaW5hdGlvbiBsaW5rcyBhcmUgYm9ycm93ZWQgZGlyZWN0bHlcclxuICogZnJvbSBadXJiIEZvdW5kYXRpb24gNjogaHR0cDovL2ZvdW5kYXRpb24uenVyYi5jb20vc2l0ZXMvZG9jcy9wYWdpbmF0aW9uLmh0bWxcclxuICovXHJcblxyXG5leHBvcnQgY29uc3QgREVGQVVMVF9URU1QTEFURSA9IGBcclxuICAgIDxwYWdpbmF0aW9uLXRlbXBsYXRlICAjcD1cInBhZ2luYXRpb25BcGlcIlxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgW2lkXT1cImlkXCJcclxuICAgICAgICAgICAgICAgICAgICAgICAgIFttYXhTa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