@nanahoshi/mona-ui 0.24.6 → 0.24.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +14 -4
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +233 -231
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-CD_ODHpU.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DdyHnUIr.mjs} +24 -12
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-B6gq7Hu3.mjs +208 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DdUY3I7P.mjs +1100 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-Sa1aAtJ-.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-DG8Bu4Dy.mjs} +34 -21
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BvUM9nPt.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CVqpbMcb.mjs} +2565 -928
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +79 -11
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +20 -4
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +335 -45
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +565 -197
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +28 -2
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +598 -208
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +193 -74
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +69 -11
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +78 -11
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +367 -463
- package/fesm2022/nanahoshi-mona-ui-query.mjs +317 -122
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +205 -140
- package/i18n/catalogs/en-US.messages.json +64 -17
- package/locales/ar-sa/ar-sa.messages.json +58 -11
- package/locales/de-de/de-de.messages.json +58 -11
- package/locales/es-es/es-es.messages.json +58 -11
- package/locales/fr-fr/fr-fr.messages.json +58 -11
- package/locales/id-id/id-id.messages.json +58 -11
- package/locales/it-it/it-it.messages.json +58 -11
- package/locales/ja-jp/ja-jp.messages.json +58 -11
- package/locales/ko-kr/ko-kr.messages.json +58 -11
- package/locales/pt-br/pt-br.messages.json +58 -11
- package/locales/ru-ru/ru-ru.messages.json +58 -11
- package/locales/tr-tr/tr-tr.messages.json +58 -11
- package/locales/zh-cn/zh-cn.messages.json +58 -11
- package/locales/zh-tw/zh-tw.messages.json +58 -11
- package/package.json +1 -1
- package/types/nanahoshi-mona-ui-check-box.d.ts +11 -1
- package/types/nanahoshi-mona-ui-filter.d.ts +54 -32
- package/types/nanahoshi-mona-ui-grid.d.ts +359 -110
- package/types/nanahoshi-mona-ui-i18n.d.ts +97 -6
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +14 -2
- package/types/nanahoshi-mona-ui-internal-list.d.ts +89 -10
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +155 -40
- package/types/nanahoshi-mona-ui-internal.d.ts +10 -2
- package/types/nanahoshi-mona-ui-list-box.d.ts +148 -47
- package/types/nanahoshi-mona-ui-list-view.d.ts +111 -21
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +53 -6
- package/types/nanahoshi-mona-ui-pager.d.ts +159 -76
- package/types/nanahoshi-mona-ui-query.d.ts +45 -14
- package/types/nanahoshi-mona-ui-tree-view.d.ts +84 -40
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-0jN7I1jo.mjs +0 -176
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BI_iE7pl.mjs +0 -946
|
@@ -1,58 +1,24 @@
|
|
|
1
1
|
import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
import * as i1 from '@angular/forms';
|
|
5
|
-
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { inject, TemplateRef, Directive, input, signal, DestroyRef, ElementRef, Injector, contentChildren, computed, linkedSignal, contentChild, viewChild, booleanAttribute, output, model, effect, untracked, afterRenderEffect, afterNextRender, Component } from '@angular/core';
|
|
6
4
|
import { LucideEllipsis, LucideChevronsLeft, LucideChevronLeft, LucideChevronRight, LucideChevronsRight } from '@lucide/angular';
|
|
7
|
-
import { range } from '@mirei/ts-collections';
|
|
8
5
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
9
|
-
import { PreventableEvent, SlicePipe } from '@nanahoshi/mona-ui/common';
|
|
10
6
|
import { DropdownListComponent, DropdownListValueTemplateDirective } from '@nanahoshi/mona-ui/dropdown-list';
|
|
11
7
|
import { DropdownVirtualScrollDirective, DropdownItemTemplateDirective } from '@nanahoshi/mona-ui/dropdowns';
|
|
12
|
-
import { themeRaisedBackdropClasses, NavigationKeys } from '@nanahoshi/mona-ui/internal';
|
|
13
8
|
import { formatNumber, injectComponentDirection, MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
9
|
+
import { themeRaisedBackdropClasses, createElementControlId, NavigationKeys } from '@nanahoshi/mona-ui/internal';
|
|
14
10
|
import { NumericTextBoxComponent } from '@nanahoshi/mona-ui/numeric-text-box';
|
|
15
11
|
import { twMerge } from 'tailwind-merge';
|
|
12
|
+
import { PreventableEvent } from '@nanahoshi/mona-ui/common';
|
|
16
13
|
import { cva } from 'class-variance-authority';
|
|
17
14
|
|
|
18
|
-
// Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
|
|
19
|
-
// Edit the JSON file and run `npm run generate:locale-catalogs`.
|
|
20
|
-
function localizeNumber(value, options) {
|
|
21
|
-
return formatNumber(value, "en-US", options);
|
|
22
|
-
}
|
|
23
|
-
const PAGER_DEFAULT_MESSAGES = {
|
|
24
|
-
firstPageLabel: "First page",
|
|
25
|
-
jumpBackwardLabel: (pages) => `Jump back ${localizeNumber(pages)} pages`,
|
|
26
|
-
jumpForwardLabel: (pages) => `Jump forward ${localizeNumber(pages)} pages`,
|
|
27
|
-
lastPageLabel: "Last page",
|
|
28
|
-
nextPageLabel: "Next page",
|
|
29
|
-
ofText: "of",
|
|
30
|
-
pageLabel: (page) => `Page ${localizeNumber(page)}`,
|
|
31
|
-
pageSizeLabel: (pageSize) => `${localizeNumber(pageSize)} / page`,
|
|
32
|
-
pageStatus: (page, totalPages) => `Page ${localizeNumber(page)} of ${localizeNumber(totalPages)}`,
|
|
33
|
-
pageText: "Page",
|
|
34
|
-
previousPageLabel: "Previous page",
|
|
35
|
-
rangeStatus: (start, end, total) => `${localizeNumber(start)} - ${localizeNumber(end)} of ${localizeNumber(total)} items`
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
class PagerFocusableDirective {
|
|
39
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PagerFocusableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
40
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PagerFocusableDirective, isStandalone: true, selector: "[monaPagerFocusable]", host: { properties: { "attr.data-mona-pager-focusable": "'true'" } }, ngImport: i0 }); }
|
|
41
|
-
}
|
|
42
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PagerFocusableDirective, decorators: [{
|
|
43
|
-
type: Directive,
|
|
44
|
-
args: [{
|
|
45
|
-
selector: "[monaPagerFocusable]",
|
|
46
|
-
host: {
|
|
47
|
-
"[attr.data-mona-pager-focusable]": "'true'"
|
|
48
|
-
}
|
|
49
|
-
}]
|
|
50
|
-
}] });
|
|
51
|
-
|
|
52
15
|
class PagerInfoTemplateDirective {
|
|
53
16
|
constructor() {
|
|
54
17
|
this.templateRef = inject(TemplateRef);
|
|
55
18
|
}
|
|
19
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
56
22
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PagerInfoTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
57
23
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PagerInfoTemplateDirective, isStandalone: true, selector: "ng-template[monaPagerInfoTemplate]", ngImport: i0 }); }
|
|
58
24
|
}
|
|
@@ -69,6 +35,9 @@ class PagerNavigationButtonsTemplateDirective {
|
|
|
69
35
|
this.type = input.required(/* @ts-ignore */
|
|
70
36
|
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
71
37
|
}
|
|
38
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
72
41
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PagerNavigationButtonsTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
73
42
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: PagerNavigationButtonsTemplateDirective, isStandalone: true, selector: "ng-template[monaPagerNavigationButtonsTemplate]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
74
43
|
}
|
|
@@ -83,6 +52,9 @@ class PagerNumericButtonsTemplateDirective {
|
|
|
83
52
|
constructor() {
|
|
84
53
|
this.templateRef = inject(TemplateRef);
|
|
85
54
|
}
|
|
55
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
86
58
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PagerNumericButtonsTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
87
59
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PagerNumericButtonsTemplateDirective, isStandalone: true, selector: "ng-template[monaPagerNumericButtonsTemplate]", ngImport: i0 }); }
|
|
88
60
|
}
|
|
@@ -94,6 +66,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
94
66
|
}] });
|
|
95
67
|
|
|
96
68
|
class PagerPageSizeTemplateDirective {
|
|
69
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
97
72
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PagerPageSizeTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
98
73
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PagerPageSizeTemplateDirective, isStandalone: true, selector: "ng-template[monaPagerPageSizeTemplate]", ngImport: i0 }); }
|
|
99
74
|
}
|
|
@@ -104,16 +79,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
104
79
|
}]
|
|
105
80
|
}] });
|
|
106
81
|
|
|
82
|
+
// Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
|
|
83
|
+
// Edit the JSON file and run `npm run generate:locale-catalogs`.
|
|
84
|
+
function localizeNumber(value, options) {
|
|
85
|
+
return formatNumber(value, "en-US", options);
|
|
86
|
+
}
|
|
87
|
+
const PLURAL_RULES = new Intl.PluralRules("en-US");
|
|
88
|
+
function plural(category, forms) {
|
|
89
|
+
return (forms[category] ?? forms.other)();
|
|
90
|
+
}
|
|
91
|
+
const PAGER_DEFAULT_MESSAGES = {
|
|
92
|
+
firstPageLabel: "First page",
|
|
93
|
+
itemsPerPageLabel: "Items per page",
|
|
94
|
+
jumpBackwardLabel: (pages) => `Jump back ${plural(PLURAL_RULES.select(pages), { one: () => `${localizeNumber(pages)} page`, other: () => `${localizeNumber(pages)} pages` })}`,
|
|
95
|
+
jumpForwardLabel: (pages) => `Jump forward ${plural(PLURAL_RULES.select(pages), { one: () => `${localizeNumber(pages)} page`, other: () => `${localizeNumber(pages)} pages` })}`,
|
|
96
|
+
lastPageLabel: "Last page",
|
|
97
|
+
nextPageLabel: "Next page",
|
|
98
|
+
ofText: "of",
|
|
99
|
+
pageInputPrefix: (_totalPages) => "Page",
|
|
100
|
+
pageInputSuffix: (totalPages) => `of ${localizeNumber(totalPages)}`,
|
|
101
|
+
pageLabel: (page) => `Page ${localizeNumber(page)}`,
|
|
102
|
+
pageSelectLabel: "Page",
|
|
103
|
+
pageSizeLabel: (pageSize) => `${localizeNumber(pageSize)} / page`,
|
|
104
|
+
pageStatus: (page, totalPages) => `Page ${localizeNumber(page)} of ${localizeNumber(totalPages)}`,
|
|
105
|
+
pageText: "Page",
|
|
106
|
+
pagerLabel: "Pagination",
|
|
107
|
+
previousPageLabel: "Previous page",
|
|
108
|
+
rangeStatus: (start, end, total) => `${localizeNumber(start)} - ${localizeNumber(end)} of ${plural(PLURAL_RULES.select(total), { one: () => `${localizeNumber(total)} item`, other: () => `${localizeNumber(total)} items` })}`
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** The cancelable payload of the pager's `pageSizeSelect` event. */
|
|
107
112
|
class PageSizeChangeEvent extends PreventableEvent {
|
|
108
113
|
constructor(newPageSize, oldPageSize) {
|
|
109
|
-
super("
|
|
114
|
+
super("pageSizeSelect");
|
|
110
115
|
this.newPageSize = newPageSize;
|
|
111
116
|
this.oldPageSize = oldPageSize;
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
const pagerBaseThemeVariants = cva(`
|
|
116
|
-
flex px-2 py-1
|
|
121
|
+
flex flex-wrap items-center gap-y-1 px-2 py-1
|
|
117
122
|
text-sm
|
|
118
123
|
bg-(--mona-pager-background) ${themeRaisedBackdropClasses} text-foreground
|
|
119
124
|
border border-border-subtle
|
|
@@ -165,58 +170,54 @@ const pagerListItemThemeVariants = cva("", {
|
|
|
165
170
|
}
|
|
166
171
|
});
|
|
167
172
|
|
|
168
|
-
|
|
169
|
-
const
|
|
173
|
+
/** Below this width (in CSS pixels) a responsive pager replaces its page buttons with a page dropdown. */
|
|
174
|
+
const COMPACT_WIDTH = 480;
|
|
175
|
+
const DEFAULT_PAGE_SIZE = 5;
|
|
176
|
+
const DEFAULT_PAGE_SIZES = [5, 10, 20, 50, 100];
|
|
177
|
+
/** A whole number at least `minimum`, or `fallback` when the value isn't a finite number. */
|
|
178
|
+
function toCount(value, fallback, minimum) {
|
|
179
|
+
const numeric = typeof value === "number" ? value : Number(value);
|
|
180
|
+
return Number.isFinite(numeric) ? Math.max(minimum, Math.floor(numeric)) : fallback;
|
|
181
|
+
}
|
|
170
182
|
class PagerComponent {
|
|
183
|
+
#compact;
|
|
184
|
+
#destroyRef;
|
|
171
185
|
#direction;
|
|
172
186
|
#document;
|
|
173
187
|
#hostElementRef;
|
|
174
188
|
#i18n;
|
|
175
|
-
#
|
|
176
|
-
#
|
|
177
|
-
#managedFocusTargets;
|
|
178
|
-
#originalTabIndices;
|
|
179
|
-
#skip;
|
|
180
|
-
#previousPageSize;
|
|
189
|
+
#id;
|
|
190
|
+
#injector;
|
|
181
191
|
#widthObserver;
|
|
182
192
|
constructor() {
|
|
193
|
+
this.#compact = signal(false, /* @ts-ignore */
|
|
194
|
+
...(ngDevMode ? [{ debugName: "#compact" }] : /* istanbul ignore next */ []));
|
|
195
|
+
this.#destroyRef = inject(DestroyRef);
|
|
183
196
|
this.#direction = injectComponentDirection();
|
|
184
197
|
this.#document = inject(DOCUMENT);
|
|
185
198
|
this.#hostElementRef = inject(ElementRef);
|
|
186
199
|
this.#i18n = inject(MonaI18nService);
|
|
187
|
-
this.#
|
|
188
|
-
|
|
189
|
-
this.#innerNavigationActive = signal(false, /* @ts-ignore */
|
|
190
|
-
...(ngDevMode ? [{ debugName: "#innerNavigationActive" }] : /* istanbul ignore next */ []));
|
|
191
|
-
this.#managedFocusTargets = new Set();
|
|
192
|
-
this.#originalTabIndices = new WeakMap();
|
|
193
|
-
this.#skip = linkedSignal(() => this.skip(), /* @ts-ignore */
|
|
194
|
-
...(ngDevMode ? [{ debugName: "#skip" }] : /* istanbul ignore next */ []));
|
|
195
|
-
this.#previousPageSize = 10;
|
|
200
|
+
this.#id = createElementControlId();
|
|
201
|
+
this.#injector = inject(Injector);
|
|
196
202
|
this.#widthObserver = null;
|
|
197
203
|
this.navigationButtonsTemplateList = contentChildren(PagerNavigationButtonsTemplateDirective, /* @ts-ignore */
|
|
198
204
|
...(ngDevMode ? [{ debugName: "navigationButtonsTemplateList" }] : /* istanbul ignore next */ []));
|
|
199
|
-
this.baseClasses = computed(() => {
|
|
200
|
-
const rounded = this.rounded();
|
|
201
|
-
const userClasses = this.userClasses();
|
|
202
|
-
const classes = pagerBaseThemeVariants({ rounded });
|
|
203
|
-
return twMerge(classes, userClasses);
|
|
204
|
-
}, /* @ts-ignore */
|
|
205
|
+
this.baseClasses = computed(() => twMerge(pagerBaseThemeVariants({ rounded: this.rounded(), size: this.size() }), this.userClasses()), /* @ts-ignore */
|
|
205
206
|
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
206
|
-
this.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
207
|
+
this.compact = this.#compact.asReadonly();
|
|
208
|
+
/** The position of the last item on the current page, or 0 when there are no items. */
|
|
209
|
+
this.end = computed(() => this.hasPages() ? Math.min(this.page() * this.pageSizeValue(), this.total()) : 0, /* @ts-ignore */
|
|
210
|
+
...(ngDevMode ? [{ debugName: "end" }] : /* istanbul ignore next */ []));
|
|
211
|
+
this.firstNavigationContext = computed(() => this.createNavigationContext("first"), /* @ts-ignore */
|
|
212
|
+
...(ngDevMode ? [{ debugName: "firstNavigationContext" }] : /* istanbul ignore next */ []));
|
|
213
|
+
this.firstPageNavigationTemplate = computed(() => this.findNavigationTemplate("first"), /* @ts-ignore */
|
|
210
214
|
...(ngDevMode ? [{ debugName: "firstPageNavigationTemplate" }] : /* istanbul ignore next */ []));
|
|
211
215
|
this.hasPages = computed(() => this.pageCount() > 0, /* @ts-ignore */
|
|
212
216
|
...(ngDevMode ? [{ debugName: "hasPages" }] : /* istanbul ignore next */ []));
|
|
213
217
|
this.iconSize = computed(() => {
|
|
214
|
-
|
|
215
|
-
switch (size) {
|
|
218
|
+
switch (this.size()) {
|
|
216
219
|
case "small":
|
|
217
220
|
return 18;
|
|
218
|
-
case "medium":
|
|
219
|
-
return 20;
|
|
220
221
|
case "large":
|
|
221
222
|
return 22;
|
|
222
223
|
default:
|
|
@@ -224,156 +225,168 @@ class PagerComponent {
|
|
|
224
225
|
}
|
|
225
226
|
}, /* @ts-ignore */
|
|
226
227
|
...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
|
|
227
|
-
this.infoClasses =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
this.infoVisible = computed(() => {
|
|
232
|
-
const showInfo = this.showInfo();
|
|
233
|
-
const visible = this.#infoVisible();
|
|
234
|
-
return showInfo && visible;
|
|
228
|
+
this.infoClasses = pagerInfoThemeVariants();
|
|
229
|
+
this.infoContext = computed(() => {
|
|
230
|
+
const context = this.pagerContext();
|
|
231
|
+
return { ...context, $implicit: context };
|
|
235
232
|
}, /* @ts-ignore */
|
|
236
|
-
...(ngDevMode ? [{ debugName: "
|
|
237
|
-
this.inputClasses =
|
|
238
|
-
return pagerInputThemeVariants();
|
|
239
|
-
}, /* @ts-ignore */
|
|
240
|
-
...(ngDevMode ? [{ debugName: "inputClasses" }] : /* istanbul ignore next */ []));
|
|
233
|
+
...(ngDevMode ? [{ debugName: "infoContext" }] : /* istanbul ignore next */ []));
|
|
234
|
+
this.inputClasses = pagerInputThemeVariants();
|
|
241
235
|
this.inputValue = linkedSignal(() => this.page(), /* @ts-ignore */
|
|
242
236
|
...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
|
|
243
237
|
this.jumpNextLabel = computed(() => this.messages().jumpForwardLabel(this.visiblePages()), /* @ts-ignore */
|
|
244
238
|
...(ngDevMode ? [{ debugName: "jumpNextLabel" }] : /* istanbul ignore next */ []));
|
|
245
239
|
this.jumpPreviousLabel = computed(() => this.messages().jumpBackwardLabel(this.visiblePages()), /* @ts-ignore */
|
|
246
240
|
...(ngDevMode ? [{ debugName: "jumpPreviousLabel" }] : /* istanbul ignore next */ []));
|
|
247
|
-
this.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}, /* @ts-ignore */
|
|
241
|
+
this.lastNavigationContext = computed(() => this.createNavigationContext("last"), /* @ts-ignore */
|
|
242
|
+
...(ngDevMode ? [{ debugName: "lastNavigationContext" }] : /* istanbul ignore next */ []));
|
|
243
|
+
this.lastPageNavigationTemplate = computed(() => this.findNavigationTemplate("last"), /* @ts-ignore */
|
|
251
244
|
...(ngDevMode ? [{ debugName: "lastPageNavigationTemplate" }] : /* istanbul ignore next */ []));
|
|
252
|
-
this.listClasses =
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
...(ngDevMode ? [{ debugName: "
|
|
245
|
+
this.listClasses = pagerListThemeVariants();
|
|
246
|
+
/** Announces page changes made by the user; programmatic changes stay silent. */
|
|
247
|
+
this.liveStatus = signal("", /* @ts-ignore */
|
|
248
|
+
...(ngDevMode ? [{ debugName: "liveStatus" }] : /* istanbul ignore next */ []));
|
|
256
249
|
this.messages = this.#i18n.componentMessages("pager", PAGER_DEFAULT_MESSAGES);
|
|
257
|
-
this.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
return pages.length > visiblePages && pages[pages.length - 1].page - pages[pages.length - 2].page > 1;
|
|
261
|
-
}, /* @ts-ignore */
|
|
262
|
-
...(ngDevMode ? [{ debugName: "nextJumperVisible" }] : /* istanbul ignore next */ []));
|
|
263
|
-
this.nextPageNavigationTemplate = computed(() => {
|
|
264
|
-
const navigationTemplates = this.navigationButtonsTemplateList();
|
|
265
|
-
return navigationTemplates.find(t => t.type() === "next");
|
|
266
|
-
}, /* @ts-ignore */
|
|
250
|
+
this.nextNavigationContext = computed(() => this.createNavigationContext("next"), /* @ts-ignore */
|
|
251
|
+
...(ngDevMode ? [{ debugName: "nextNavigationContext" }] : /* istanbul ignore next */ []));
|
|
252
|
+
this.nextPageNavigationTemplate = computed(() => this.findNavigationTemplate("next"), /* @ts-ignore */
|
|
267
253
|
...(ngDevMode ? [{ debugName: "nextPageNavigationTemplate" }] : /* istanbul ignore next */ []));
|
|
254
|
+
this.numericButtonsContext = computed(() => {
|
|
255
|
+
const context = this.pagerContext();
|
|
256
|
+
const pages = this.pageItems()
|
|
257
|
+
.filter(item => item.kind === "page")
|
|
258
|
+
.map(item => item.page);
|
|
259
|
+
return { ...context, $implicit: context, pages };
|
|
260
|
+
}, /* @ts-ignore */
|
|
261
|
+
...(ngDevMode ? [{ debugName: "numericButtonsContext" }] : /* istanbul ignore next */ []));
|
|
268
262
|
this.numericButtonsTemplate = contentChild(PagerNumericButtonsTemplateDirective, /* @ts-ignore */
|
|
269
263
|
...(ngDevMode ? [{ debugName: "numericButtonsTemplate" }] : /* istanbul ignore next */ []));
|
|
270
|
-
|
|
264
|
+
/** The current page: the page holding `skip`, clamped to the last page. */
|
|
265
|
+
this.page = computed(() => {
|
|
266
|
+
const pageCount = this.pageCount();
|
|
267
|
+
const page = Math.floor(this.skipValue() / this.pageSizeValue()) + 1;
|
|
268
|
+
return pageCount === 0 ? 1 : Math.min(page, pageCount);
|
|
269
|
+
}, /* @ts-ignore */
|
|
271
270
|
...(ngDevMode ? [{ debugName: "page" }] : /* istanbul ignore next */ []));
|
|
272
|
-
this.pageCount = computed(() => Math.ceil(this.total() / this.
|
|
271
|
+
this.pageCount = computed(() => Math.ceil(this.total() / this.pageSizeValue()), /* @ts-ignore */
|
|
273
272
|
...(ngDevMode ? [{ debugName: "pageCount" }] : /* istanbul ignore next */ []));
|
|
274
|
-
this.
|
|
275
|
-
|
|
276
|
-
this.
|
|
277
|
-
|
|
278
|
-
|
|
273
|
+
this.pageInputId = `${this.#id}-page`;
|
|
274
|
+
this.pageInputLabelledBy = `${this.#id}-page-prefix ${this.#id}-page ${this.#id}-page-suffix`;
|
|
275
|
+
this.pageInputPrefixId = `${this.#id}-page-prefix`;
|
|
276
|
+
this.pageInputSuffixId = `${this.#id}-page-suffix`;
|
|
277
|
+
this.pageItems = computed(() => this.buildPageItems(this.page(), this.visiblePages(), this.pageCount()), /* @ts-ignore */
|
|
278
|
+
...(ngDevMode ? [{ debugName: "pageItems" }] : /* istanbul ignore next */ []));
|
|
279
|
+
this.pageList = computed(() => Array.from({ length: this.pageCount() }, (_, index) => index + 1), /* @ts-ignore */
|
|
279
280
|
...(ngDevMode ? [{ debugName: "pageList" }] : /* istanbul ignore next */ []));
|
|
280
|
-
this.
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
this.pageSizeContext = computed(() => ({
|
|
282
|
+
...this.pagerContext(),
|
|
283
|
+
$implicit: this.pageSizeOptions()
|
|
284
|
+
}), /* @ts-ignore */
|
|
285
|
+
...(ngDevMode ? [{ debugName: "pageSizeContext" }] : /* istanbul ignore next */ []));
|
|
286
|
+
this.pageSizeDropdownList = viewChild("pageSizeDropdownList", /* @ts-ignore */
|
|
287
|
+
...(ngDevMode ? [{ debugName: "pageSizeDropdownList" }] : /* istanbul ignore next */ []));
|
|
288
|
+
this.pageSizeOptions = computed(() => {
|
|
283
289
|
const values = this.pageSizeValues();
|
|
284
|
-
if (values === false
|
|
290
|
+
if (values === false) {
|
|
285
291
|
return [];
|
|
286
292
|
}
|
|
287
|
-
|
|
288
|
-
return values;
|
|
289
|
-
}
|
|
290
|
-
return [5, 10, 20, 50, 100];
|
|
293
|
+
return Array.isArray(values) ? values : DEFAULT_PAGE_SIZES;
|
|
291
294
|
}, /* @ts-ignore */
|
|
292
|
-
...(ngDevMode ? [{ debugName: "
|
|
293
|
-
this.pageSizeDropdownList = viewChild("pageSizeDropdownList", /* @ts-ignore */
|
|
294
|
-
...(ngDevMode ? [{ debugName: "pageSizeDropdownList" }] : /* istanbul ignore next */ []));
|
|
295
|
+
...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : /* istanbul ignore next */ []));
|
|
295
296
|
this.pageSizeTemplate = contentChild(PagerPageSizeTemplateDirective, { ...(ngDevMode ? { debugName: "pageSizeTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
/** The page size in use: `pageSize`, or the size the user picked since, as a whole number of at least 1. */
|
|
298
|
+
this.pageSizeValue = computed(() => toCount(this.pageSize(), DEFAULT_PAGE_SIZE, 1), /* @ts-ignore */
|
|
299
|
+
...(ngDevMode ? [{ debugName: "pageSizeValue" }] : /* istanbul ignore next */ []));
|
|
300
|
+
this.pagerContext = computed(() => ({
|
|
301
|
+
currentPage: this.page(),
|
|
302
|
+
end: this.end(),
|
|
303
|
+
goToPage: (page) => this.goToPage(page),
|
|
304
|
+
pageSize: this.pageSizeValue(),
|
|
305
|
+
pageSizes: this.pageSizeOptions(),
|
|
306
|
+
setPageSize: (pageSize) => this.changePageSize(pageSize),
|
|
307
|
+
skip: (this.page() - 1) * this.pageSizeValue(),
|
|
308
|
+
start: this.start(),
|
|
309
|
+
total: this.total(),
|
|
310
|
+
totalPages: this.pageCount()
|
|
311
|
+
}), /* @ts-ignore */
|
|
312
|
+
...(ngDevMode ? [{ debugName: "pagerContext" }] : /* istanbul ignore next */ []));
|
|
313
|
+
this.pagerInfo = computed(() => this.messages().rangeStatus(this.start(), this.end(), this.total()), /* @ts-ignore */
|
|
301
314
|
...(ngDevMode ? [{ debugName: "pagerInfo" }] : /* istanbul ignore next */ []));
|
|
302
315
|
this.pagerInfoTemplate = contentChild(PagerInfoTemplateDirective, /* @ts-ignore */
|
|
303
316
|
...(ngDevMode ? [{ debugName: "pagerInfoTemplate" }] : /* istanbul ignore next */ []));
|
|
304
|
-
this.
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
pageSize: this.pagerPageSize(),
|
|
308
|
-
skip: this.#skip(),
|
|
309
|
-
total: this.total(),
|
|
310
|
-
totalPages: this.pageCount()
|
|
311
|
-
};
|
|
312
|
-
}, /* @ts-ignore */
|
|
313
|
-
...(ngDevMode ? [{ debugName: "pagerInfoTemplateContext" }] : /* istanbul ignore next */ []));
|
|
314
|
-
this.pagerPageSize = linkedSignal(() => this.pageSize(), /* @ts-ignore */
|
|
315
|
-
...(ngDevMode ? [{ debugName: "pagerPageSize" }] : /* istanbul ignore next */ []));
|
|
316
|
-
this.pages = computed(() => {
|
|
317
|
-
return this.preparePages(this.page(), this.visiblePages(), this.pageCount());
|
|
318
|
-
}, /* @ts-ignore */
|
|
319
|
-
...(ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []));
|
|
320
|
-
this.previousJumperVisible = computed(() => this.pages().length > this.visiblePages() && this.pages()[1].page - 1 > 1, /* @ts-ignore */
|
|
321
|
-
...(ngDevMode ? [{ debugName: "previousJumperVisible" }] : /* istanbul ignore next */ []));
|
|
322
|
-
this.previousPageNavigationTemplate = computed(() => {
|
|
323
|
-
const navigationTemplates = this.navigationButtonsTemplateList();
|
|
324
|
-
return navigationTemplates.find(t => t.type() === "previous");
|
|
325
|
-
}, /* @ts-ignore */
|
|
317
|
+
this.previousNavigationContext = computed(() => this.createNavigationContext("previous"), /* @ts-ignore */
|
|
318
|
+
...(ngDevMode ? [{ debugName: "previousNavigationContext" }] : /* istanbul ignore next */ []));
|
|
319
|
+
this.previousPageNavigationTemplate = computed(() => this.findNavigationTemplate("previous"), /* @ts-ignore */
|
|
326
320
|
...(ngDevMode ? [{ debugName: "previousPageNavigationTemplate" }] : /* istanbul ignore next */ []));
|
|
321
|
+
/** `skip` as a whole number of at least 0. */
|
|
322
|
+
this.skipValue = computed(() => toCount(this.skip(), 0, 0), /* @ts-ignore */
|
|
323
|
+
...(ngDevMode ? [{ debugName: "skipValue" }] : /* istanbul ignore next */ []));
|
|
324
|
+
/** The position of the first item on the current page, or 0 when there are no items. */
|
|
325
|
+
this.start = computed(() => (this.hasPages() ? (this.page() - 1) * this.pageSizeValue() + 1 : 0), /* @ts-ignore */
|
|
326
|
+
...(ngDevMode ? [{ debugName: "start" }] : /* istanbul ignore next */ []));
|
|
327
|
+
/**
|
|
328
|
+
* @description Accessible name of the pager's navigation landmark. Defaults to the localized "Pagination";
|
|
329
|
+
* name each pager when a page has several.
|
|
330
|
+
*/
|
|
331
|
+
this.ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
332
|
+
/**
|
|
333
|
+
* @description Id of the element that names the pager. Takes precedence over {@link ariaLabel}.
|
|
334
|
+
*/
|
|
335
|
+
this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
|
|
327
336
|
/**
|
|
328
337
|
* @description Shows the first and last page navigation buttons.
|
|
329
338
|
* @default true
|
|
330
339
|
*/
|
|
331
|
-
this.firstLast = input(true, /*
|
|
332
|
-
...(ngDevMode ? [{ debugName: "firstLast" }] : /* istanbul ignore next */ []));
|
|
340
|
+
this.firstLast = input(true, { ...(ngDevMode ? { debugName: "firstLast" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
333
341
|
/**
|
|
334
|
-
* @description Enables
|
|
342
|
+
* @description Enables page shortcuts while a pager button has focus: Page Up and Page Down go to the
|
|
343
|
+
* previous and next page, Home and End to the first and last, and the left and right arrows to the previous
|
|
344
|
+
* and next page (mirrored right to left). The buttons themselves are always ordinary tab stops.
|
|
335
345
|
* @default true
|
|
336
346
|
*/
|
|
337
|
-
this.navigable = input(true, /*
|
|
338
|
-
...(ngDevMode ? [{ debugName: "navigable" }] : /* istanbul ignore next */ []));
|
|
347
|
+
this.navigable = input(true, { ...(ngDevMode ? { debugName: "navigable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
339
348
|
/**
|
|
340
|
-
* @description Emitted when the
|
|
349
|
+
* @description Emitted when the user changes the page or the page size, or when the pager corrects a `skip`
|
|
350
|
+
* that is past the last page or not on a page boundary. Setting `skip` or `pageSize` from code to a valid
|
|
351
|
+
* value doesn't emit it.
|
|
341
352
|
*/
|
|
342
353
|
this.pageChange = output();
|
|
343
354
|
/**
|
|
344
355
|
* @description Shows a numeric input for jumping directly to a page.
|
|
345
356
|
* @default false
|
|
346
357
|
*/
|
|
347
|
-
this.pageInput = input(false, /*
|
|
348
|
-
...(ngDevMode ? [{ debugName: "pageInput" }] : /* istanbul ignore next */ []));
|
|
358
|
+
this.pageInput = input(false, { ...(ngDevMode ? { debugName: "pageInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
349
359
|
/**
|
|
350
|
-
* @description Number of items displayed per page.
|
|
360
|
+
* @description Number of items displayed per page; values below 1 count as 1. Supports two-way binding
|
|
361
|
+
* (`[(pageSize)]`): `pageSizeChange` emits the new size after the user changes it, and `pageChange` reports it
|
|
362
|
+
* as `take`.
|
|
351
363
|
* @default 5
|
|
352
364
|
*/
|
|
353
|
-
this.pageSize =
|
|
365
|
+
this.pageSize = model(DEFAULT_PAGE_SIZE, /* @ts-ignore */
|
|
354
366
|
...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
355
367
|
/**
|
|
356
|
-
* @description Emitted when the page size
|
|
368
|
+
* @description Emitted when the user picks a page size, before it is applied. Call `preventDefault()` on the
|
|
369
|
+
* event to keep the current size.
|
|
357
370
|
*/
|
|
358
|
-
this.
|
|
371
|
+
this.pageSizeSelect = output();
|
|
359
372
|
/**
|
|
360
|
-
* @description Page-size options shown in the page-size dropdown.
|
|
373
|
+
* @description Page-size options shown in the page-size dropdown. `true` shows the default options; `false`
|
|
374
|
+
* or an empty array hides the dropdown.
|
|
361
375
|
* @default [5, 10, 20, 50, 100]
|
|
362
376
|
*/
|
|
363
|
-
this.pageSizeValues = input(
|
|
377
|
+
this.pageSizeValues = input(DEFAULT_PAGE_SIZES, /* @ts-ignore */
|
|
364
378
|
...(ngDevMode ? [{ debugName: "pageSizeValues" }] : /* istanbul ignore next */ []));
|
|
365
379
|
/**
|
|
366
380
|
* @description Shows the previous and next page navigation buttons.
|
|
367
381
|
* @default true
|
|
368
382
|
*/
|
|
369
|
-
this.previousNext = input(true, /*
|
|
370
|
-
...(ngDevMode ? [{ debugName: "previousNext" }] : /* istanbul ignore next */ []));
|
|
383
|
+
this.previousNext = input(true, { ...(ngDevMode ? { debugName: "previousNext" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
371
384
|
/**
|
|
372
|
-
* @description
|
|
385
|
+
* @description Replaces the page buttons with a page dropdown when the pager is narrower than 480px.
|
|
386
|
+
* Other sections wrap onto a new line instead of being hidden.
|
|
373
387
|
* @default true
|
|
374
388
|
*/
|
|
375
|
-
this.responsive = input(true, /*
|
|
376
|
-
...(ngDevMode ? [{ debugName: "responsive" }] : /* istanbul ignore next */ []));
|
|
389
|
+
this.responsive = input(true, { ...(ngDevMode ? { debugName: "responsive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
377
390
|
/**
|
|
378
391
|
* @description Border-radius preset applied to the component.
|
|
379
392
|
* @default "medium"
|
|
@@ -384,8 +397,7 @@ class PagerComponent {
|
|
|
384
397
|
* @description Displays the summary of the current page range and total item count.
|
|
385
398
|
* @default true
|
|
386
399
|
*/
|
|
387
|
-
this.showInfo = input(true, /*
|
|
388
|
-
...(ngDevMode ? [{ debugName: "showInfo" }] : /* istanbul ignore next */ []));
|
|
400
|
+
this.showInfo = input(true, { ...(ngDevMode ? { debugName: "showInfo" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
389
401
|
/**
|
|
390
402
|
* @description Size preset controlling the component's dimensions.
|
|
391
403
|
* @default "medium"
|
|
@@ -393,17 +405,17 @@ class PagerComponent {
|
|
|
393
405
|
this.size = input("medium", /* @ts-ignore */
|
|
394
406
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
395
407
|
/**
|
|
396
|
-
* @description Number of items
|
|
408
|
+
* @description Number of items before the current page. Supports two-way binding. A value past the last page,
|
|
409
|
+
* or between page boundaries, is corrected to the start of the page that holds it, and `pageChange` reports it.
|
|
397
410
|
* @default 0
|
|
398
411
|
*/
|
|
399
|
-
this.skip =
|
|
412
|
+
this.skip = model(0, /* @ts-ignore */
|
|
400
413
|
...(ngDevMode ? [{ debugName: "skip" }] : /* istanbul ignore next */ []));
|
|
401
414
|
/**
|
|
402
415
|
* @description Total number of items in the paged collection.
|
|
403
416
|
* @default 0
|
|
404
417
|
*/
|
|
405
|
-
this.total = input(0, /*
|
|
406
|
-
...(ngDevMode ? [{ debugName: "total" }] : /* istanbul ignore next */ []));
|
|
418
|
+
this.total = input(0, { ...(ngDevMode ? { debugName: "total" } : /* istanbul ignore next */ {}), transform: (value) => toCount(value, 0, 0) });
|
|
407
419
|
/**
|
|
408
420
|
* @description Visual mode of the pager: numeric page buttons, or a page-jump input.
|
|
409
421
|
* @default "numeric"
|
|
@@ -416,347 +428,237 @@ class PagerComponent {
|
|
|
416
428
|
*/
|
|
417
429
|
this.userClasses = input("", { ...(ngDevMode ? { debugName: "userClasses" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
418
430
|
/**
|
|
419
|
-
* @description Number of
|
|
431
|
+
* @description Number of page buttons shown between the first and last page before the rest collapse into
|
|
432
|
+
* jump buttons. At least 1.
|
|
420
433
|
* @default 5
|
|
421
434
|
*/
|
|
422
|
-
this.visiblePages = input(5, /*
|
|
423
|
-
...(ngDevMode ? [{ debugName: "visiblePages" }] : /* istanbul ignore next */ []));
|
|
424
|
-
effect(() => {
|
|
425
|
-
const pageSize = this.pageSize();
|
|
426
|
-
untracked(() => (this.#previousPageSize = pageSize));
|
|
427
|
-
});
|
|
435
|
+
this.visiblePages = input(5, { ...(ngDevMode ? { debugName: "visiblePages" } : /* istanbul ignore next */ {}), transform: (value) => toCount(value, 5, 1) });
|
|
428
436
|
effect(() => {
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
});
|
|
437
|
+
const pageCount = this.pageCount();
|
|
438
|
+
const skip = this.skip();
|
|
439
|
+
const alignedSkip = (this.page() - 1) * this.pageSizeValue();
|
|
440
|
+
if (pageCount === 0 || skip === alignedSkip) {
|
|
441
|
+
return;
|
|
435
442
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
443
|
+
untracked(() => {
|
|
444
|
+
this.skip.set(alignedSkip);
|
|
445
|
+
this.emitPageChange();
|
|
446
|
+
});
|
|
440
447
|
});
|
|
441
448
|
afterRenderEffect(() => {
|
|
442
|
-
if (this.responsive()) {
|
|
443
|
-
this.#widthObserver
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
this.pageListVisible.set(this.#hostElementRef.nativeElement.clientWidth >= 480);
|
|
448
|
-
});
|
|
449
|
-
});
|
|
450
|
-
this.#widthObserver.observe(this.#hostElementRef.nativeElement);
|
|
449
|
+
if (!this.responsive()) {
|
|
450
|
+
this.#widthObserver?.disconnect();
|
|
451
|
+
this.#widthObserver = null;
|
|
452
|
+
untracked(() => this.#compact.set(false));
|
|
453
|
+
return;
|
|
451
454
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
this.
|
|
456
|
-
this.pageListVisible.set(true);
|
|
455
|
+
if (this.#widthObserver == null) {
|
|
456
|
+
const host = this.#hostElementRef.nativeElement;
|
|
457
|
+
this.#widthObserver = new ResizeObserver(() => {
|
|
458
|
+
untracked(() => this.#compact.set(host.clientWidth < COMPACT_WIDTH));
|
|
457
459
|
});
|
|
458
|
-
this.#widthObserver.
|
|
459
|
-
this.#widthObserver = null;
|
|
460
|
+
this.#widthObserver.observe(host);
|
|
460
461
|
}
|
|
461
462
|
});
|
|
462
|
-
|
|
463
|
-
this.navigable();
|
|
464
|
-
this.#innerNavigationActive();
|
|
465
|
-
this.firstLast();
|
|
466
|
-
this.page();
|
|
467
|
-
this.pageCount();
|
|
468
|
-
this.pageInput();
|
|
469
|
-
this.pageInputVisible();
|
|
470
|
-
this.pageListVisible();
|
|
471
|
-
this.pageSizeDropdownData();
|
|
472
|
-
this.pages();
|
|
473
|
-
this.previousNext();
|
|
474
|
-
this.type();
|
|
475
|
-
untracked(() => this.syncFocusableTabIndexes());
|
|
476
|
-
});
|
|
477
|
-
inject(DestroyRef).onDestroy(() => this.#widthObserver?.disconnect());
|
|
463
|
+
this.#destroyRef.onDestroy(() => this.#widthObserver?.disconnect());
|
|
478
464
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
465
|
+
changePageSize(value) {
|
|
466
|
+
const previous = this.pageSizeValue();
|
|
467
|
+
if (value == null || !Number.isFinite(value) || value < 1 || value === previous) {
|
|
468
|
+
return;
|
|
482
469
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
onJumpNextClick() {
|
|
489
|
-
const page = Math.min(this.page() + this.visiblePages(), this.pageCount());
|
|
490
|
-
this.setPage(page);
|
|
491
|
-
}
|
|
492
|
-
onJumpPreviousClick() {
|
|
493
|
-
const page = Math.max(this.page() - this.visiblePages(), 1);
|
|
494
|
-
this.setPage(page);
|
|
495
|
-
}
|
|
496
|
-
onKeydown(event) {
|
|
497
|
-
if (!this.navigable()) {
|
|
470
|
+
const event = new PageSizeChangeEvent(value, previous);
|
|
471
|
+
this.pageSizeSelect.emit(event);
|
|
472
|
+
if (event.isDefaultPrevented()) {
|
|
473
|
+
this.pageSizeDropdownList()?.setValue(previous);
|
|
498
474
|
return;
|
|
499
475
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
476
|
+
const firstItemSkip = (this.page() - 1) * previous;
|
|
477
|
+
const focused = this.focusedInside();
|
|
478
|
+
this.pageSize.set(value);
|
|
479
|
+
this.skip.set(Math.floor(firstItemSkip / value) * value);
|
|
480
|
+
this.emitPageChange();
|
|
481
|
+
this.afterUserChange(focused);
|
|
482
|
+
}
|
|
483
|
+
commitPageInput() {
|
|
484
|
+
const value = this.inputValue();
|
|
485
|
+
if (value == null || !Number.isFinite(value) || !this.hasPages()) {
|
|
486
|
+
this.inputValue.set(this.page());
|
|
503
487
|
return;
|
|
504
488
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
489
|
+
const page = Math.min(Math.max(Math.round(value), 1), this.pageCount());
|
|
490
|
+
this.inputValue.set(page);
|
|
491
|
+
this.goToPage(page);
|
|
492
|
+
}
|
|
493
|
+
formatPageNumber(value) {
|
|
494
|
+
return formatNumber(value, this.#i18n.localeId(), { maximumFractionDigits: 0 });
|
|
495
|
+
}
|
|
496
|
+
/** Goes to a page (clamped to the page range), as a user action: emits `pageChange` and announces the range. */
|
|
497
|
+
goToPage(page) {
|
|
498
|
+
if (page == null || !Number.isFinite(page) || !this.hasPages()) {
|
|
508
499
|
return;
|
|
509
500
|
}
|
|
510
|
-
|
|
511
|
-
|
|
501
|
+
const target = Math.min(Math.max(Math.round(page), 1), this.pageCount());
|
|
502
|
+
const skip = (target - 1) * this.pageSizeValue();
|
|
503
|
+
if (target === this.page() && skip === this.skip()) {
|
|
512
504
|
return;
|
|
513
505
|
}
|
|
514
|
-
|
|
506
|
+
const focused = this.focusedInside();
|
|
507
|
+
this.skip.set(skip);
|
|
508
|
+
this.emitPageChange();
|
|
509
|
+
this.afterUserChange(focused);
|
|
510
|
+
}
|
|
511
|
+
onKeydown(event) {
|
|
512
|
+
if (!this.navigable() ||
|
|
513
|
+
event.defaultPrevented ||
|
|
514
|
+
event.altKey ||
|
|
515
|
+
event.ctrlKey ||
|
|
516
|
+
event.metaKey ||
|
|
517
|
+
!(event.target instanceof HTMLButtonElement) ||
|
|
518
|
+
!this.hasPages()) {
|
|
515
519
|
return;
|
|
516
520
|
}
|
|
521
|
+
const rtl = this.#direction() === "rtl";
|
|
522
|
+
let page;
|
|
517
523
|
switch (event.key) {
|
|
518
|
-
case NavigationKeys.
|
|
519
|
-
|
|
520
|
-
this.activateInnerNavigation();
|
|
521
|
-
break;
|
|
522
|
-
case NavigationKeys.ArrowLeft: {
|
|
523
|
-
event.preventDefault();
|
|
524
|
-
const delta = this.#direction() === "rtl" ? 1 : -1;
|
|
525
|
-
this.setKeyboardPage(this.page() + delta);
|
|
524
|
+
case NavigationKeys.Home:
|
|
525
|
+
page = 1;
|
|
526
526
|
break;
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
event.preventDefault();
|
|
530
|
-
const delta = this.#direction() === "rtl" ? -1 : 1;
|
|
531
|
-
this.setKeyboardPage(this.page() + delta);
|
|
527
|
+
case NavigationKeys.End:
|
|
528
|
+
page = this.pageCount();
|
|
532
529
|
break;
|
|
533
|
-
}
|
|
534
530
|
case NavigationKeys.PageUp:
|
|
535
|
-
|
|
536
|
-
this.setKeyboardPage(this.page() - 1);
|
|
531
|
+
page = this.page() - 1;
|
|
537
532
|
break;
|
|
538
533
|
case NavigationKeys.PageDown:
|
|
539
|
-
|
|
540
|
-
this.setKeyboardPage(this.page() + 1);
|
|
534
|
+
page = this.page() + 1;
|
|
541
535
|
break;
|
|
536
|
+
case NavigationKeys.ArrowLeft:
|
|
537
|
+
page = this.page() + (rtl ? 1 : -1);
|
|
538
|
+
break;
|
|
539
|
+
case NavigationKeys.ArrowRight:
|
|
540
|
+
page = this.page() + (rtl ? -1 : 1);
|
|
541
|
+
break;
|
|
542
|
+
default:
|
|
543
|
+
return;
|
|
542
544
|
}
|
|
545
|
+
event.preventDefault();
|
|
546
|
+
this.goToPage(page);
|
|
543
547
|
}
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
}
|
|
548
|
-
onPageClick(page) {
|
|
549
|
-
if (page === this.page()) {
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
this.setPage(page);
|
|
553
|
-
}
|
|
554
|
-
onPageInputBlur() {
|
|
555
|
-
if (this.inputValue() === null || this.inputValue() === this.page()) {
|
|
556
|
-
this.inputValue.set(this.page());
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
if (this.inputValue() < 1) {
|
|
560
|
-
this.inputValue.set(1);
|
|
561
|
-
}
|
|
562
|
-
else if (this.inputValue() > this.pageCount()) {
|
|
563
|
-
this.inputValue.set(this.pageCount());
|
|
564
|
-
}
|
|
565
|
-
this.setPage(this.inputValue());
|
|
566
|
-
}
|
|
567
|
-
onPageSizeValueChange(value) {
|
|
568
|
-
if (value === this.pagerPageSize()) {
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
const event = new PageSizeChangeEvent(value, this.pagerPageSize());
|
|
572
|
-
const pageSizeDropdownList = this.pageSizeDropdownList();
|
|
573
|
-
this.pageSizeChange.emit(event);
|
|
574
|
-
if (event.isDefaultPrevented()) {
|
|
575
|
-
this.pagerPageSize.set(this.#previousPageSize);
|
|
576
|
-
if (pageSizeDropdownList) {
|
|
577
|
-
pageSizeDropdownList.setValue(this.#previousPageSize);
|
|
578
|
-
}
|
|
548
|
+
onPageInputEnter(event) {
|
|
549
|
+
const keyboardEvent = event;
|
|
550
|
+
if (keyboardEvent.isComposing || keyboardEvent.keyCode === 229) {
|
|
579
551
|
return;
|
|
580
552
|
}
|
|
581
|
-
|
|
582
|
-
this.
|
|
583
|
-
if (pageSizeDropdownList) {
|
|
584
|
-
pageSizeDropdownList.setValue(value);
|
|
585
|
-
}
|
|
586
|
-
this.setPage(1);
|
|
587
|
-
}
|
|
588
|
-
onPreviousPageClick() {
|
|
589
|
-
const page = Math.max(this.page() - 1, 1);
|
|
590
|
-
this.setPage(page);
|
|
553
|
+
keyboardEvent.preventDefault();
|
|
554
|
+
this.commitPageInput();
|
|
591
555
|
}
|
|
592
556
|
pageItemClasses(active) {
|
|
593
557
|
return pagerListItemThemeVariants({ active });
|
|
594
558
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
559
|
+
/**
|
|
560
|
+
* After a user change: announces the new range, and keeps focus in the pager when the focused control was
|
|
561
|
+
* removed or disabled (a jump button that is no longer needed, Next on the last page).
|
|
562
|
+
*/
|
|
563
|
+
afterUserChange(focusedInside) {
|
|
564
|
+
this.liveStatus.set(this.pagerInfo());
|
|
565
|
+
if (!focusedInside) {
|
|
598
566
|
return;
|
|
599
567
|
}
|
|
600
|
-
this.#innerNavigationActive.set(true);
|
|
601
|
-
targets[0].focus();
|
|
602
|
-
}
|
|
603
|
-
focusNextTarget(backwards) {
|
|
604
|
-
const targets = this.getFocusableTargets();
|
|
605
|
-
if (targets.length === 0) {
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
const activeElement = this.#document.activeElement;
|
|
609
|
-
const currentIndex = activeElement
|
|
610
|
-
? targets.findIndex(target => target === activeElement || target.contains(activeElement))
|
|
611
|
-
: -1;
|
|
612
|
-
const nextIndex = currentIndex === -1 ? 0 : (currentIndex + (backwards ? -1 : 1) + targets.length) % targets.length;
|
|
613
|
-
targets[nextIndex].focus();
|
|
614
|
-
}
|
|
615
|
-
getFocusableTargets() {
|
|
616
568
|
const host = this.#hostElementRef.nativeElement;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
569
|
+
afterNextRender({
|
|
570
|
+
read: () => {
|
|
571
|
+
const active = this.#document.activeElement;
|
|
572
|
+
if (active instanceof HTMLElement && host.contains(active) && !this.isDisabled(active)) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
const target = host.querySelector("button[aria-current='page']") ??
|
|
576
|
+
Array.from(host.querySelectorAll("button")).find(b => !b.disabled);
|
|
577
|
+
target?.focus();
|
|
624
578
|
}
|
|
625
|
-
|
|
626
|
-
targets.push(target);
|
|
627
|
-
}
|
|
628
|
-
return targets;
|
|
629
|
-
}
|
|
630
|
-
handleInnerNavigationKeydown(event) {
|
|
631
|
-
if (event.key === NavigationKeys.Escape) {
|
|
632
|
-
event.preventDefault();
|
|
633
|
-
this.#innerNavigationActive.set(false);
|
|
634
|
-
this.#hostElementRef.nativeElement.focus();
|
|
635
|
-
return;
|
|
636
|
-
}
|
|
637
|
-
if (event.key === "Tab") {
|
|
638
|
-
event.preventDefault();
|
|
639
|
-
this.focusNextTarget(event.shiftKey);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
isElementDisabled(element) {
|
|
643
|
-
if ((element instanceof HTMLButtonElement ||
|
|
644
|
-
element instanceof HTMLInputElement ||
|
|
645
|
-
element instanceof HTMLSelectElement ||
|
|
646
|
-
element instanceof HTMLTextAreaElement) &&
|
|
647
|
-
element.disabled) {
|
|
648
|
-
return true;
|
|
649
|
-
}
|
|
650
|
-
return element.getAttribute("aria-disabled") === "true" || element.hasAttribute("disabled");
|
|
579
|
+
}, { injector: this.#injector });
|
|
651
580
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
581
|
+
/**
|
|
582
|
+
* The page buttons: the first and last page, a window of `visiblePages` pages around the current one, and a
|
|
583
|
+
* jump button for each longer gap. A gap of one page shows that page instead.
|
|
584
|
+
*/
|
|
585
|
+
buildPageItems(current, visible, count) {
|
|
586
|
+
const page = (value) => ({ key: `page-${value}`, kind: "page", page: value });
|
|
587
|
+
if (count === 0) {
|
|
588
|
+
return [];
|
|
589
|
+
}
|
|
590
|
+
if (count <= visible + 2) {
|
|
591
|
+
return Array.from({ length: count }, (_, index) => page(index + 1));
|
|
592
|
+
}
|
|
593
|
+
const windowStart = Math.min(Math.max(current - Math.floor((visible - 1) / 2), 2), count - visible);
|
|
594
|
+
const windowEnd = windowStart + visible - 1;
|
|
595
|
+
const items = [page(1)];
|
|
596
|
+
if (windowStart === 3) {
|
|
597
|
+
items.push(page(2));
|
|
598
|
+
}
|
|
599
|
+
else if (windowStart > 3) {
|
|
600
|
+
items.push({
|
|
601
|
+
direction: "backward",
|
|
602
|
+
key: "jump-backward",
|
|
603
|
+
kind: "jump",
|
|
604
|
+
page: Math.max(current - visible, 1)
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
for (let value = windowStart; value <= windowEnd; value++) {
|
|
608
|
+
items.push(page(value));
|
|
609
|
+
}
|
|
610
|
+
if (windowEnd === count - 2) {
|
|
611
|
+
items.push(page(count - 1));
|
|
612
|
+
}
|
|
613
|
+
else if (windowEnd < count - 2) {
|
|
614
|
+
items.push({
|
|
615
|
+
direction: "forward",
|
|
616
|
+
key: "jump-forward",
|
|
617
|
+
kind: "jump",
|
|
618
|
+
page: Math.min(current + visible, count)
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
items.push(page(count));
|
|
622
|
+
return items;
|
|
658
623
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
pages.push({ page: index, text: this.formatPageNumber(index) });
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
else if (currentPage < visiblePages) {
|
|
677
|
-
pages.push({ page: first, text: this.formatPageNumber(first) });
|
|
678
|
-
for (index = 2; index < (maxPages < visiblePages ? maxPages : visiblePages) + 1; index++) {
|
|
679
|
-
pages.push({ page: index, text: this.formatPageNumber(index) });
|
|
680
|
-
}
|
|
681
|
-
pages.push({ page: maxPages, text: this.formatPageNumber(maxPages) });
|
|
682
|
-
}
|
|
683
|
-
else if (currentPage >= visiblePages && currentPage <= maxPages - visiblePages) {
|
|
684
|
-
pages.push({ page: first, text: this.formatPageNumber(first) });
|
|
685
|
-
for (index = currentPage - half; index < currentPage + visiblePages - half; index++) {
|
|
686
|
-
pages.push({ page: index, text: this.formatPageNumber(index) });
|
|
687
|
-
}
|
|
688
|
-
pages.push({ page: maxPages, text: this.formatPageNumber(maxPages) });
|
|
689
|
-
}
|
|
690
|
-
else if (currentPage >= maxPages - visiblePages) {
|
|
691
|
-
pages.push({ page: first, text: this.formatPageNumber(first) });
|
|
692
|
-
index = maxPages - visiblePages < currentPage ? maxPages - visiblePages : currentPage;
|
|
693
|
-
for (; index <= maxPages; index++) {
|
|
694
|
-
pages.push({ page: index, text: this.formatPageNumber(index) });
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
return pages;
|
|
624
|
+
createNavigationContext(type) {
|
|
625
|
+
const context = this.pagerContext();
|
|
626
|
+
const page = this.page();
|
|
627
|
+
const pageCount = this.pageCount();
|
|
628
|
+
const backward = type === "first" || type === "previous";
|
|
629
|
+
const targetPage = type === "first" ? 1 : type === "previous" ? page - 1 : type === "next" ? page + 1 : pageCount;
|
|
630
|
+
const disabled = !this.hasPages() || (backward ? page <= 1 : page >= pageCount);
|
|
631
|
+
return {
|
|
632
|
+
...context,
|
|
633
|
+
$implicit: context,
|
|
634
|
+
disabled,
|
|
635
|
+
navigate: () => this.goToPage(targetPage),
|
|
636
|
+
targetPage: Math.min(Math.max(targetPage, 1), Math.max(pageCount, 1))
|
|
637
|
+
};
|
|
698
638
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
}
|
|
703
|
-
return (Array.from(element.querySelectorAll(FOCUSABLE_TARGET_SELECTOR)).find(target => !this.isElementDisabled(target) && !this.isElementHidden(target)) ?? null);
|
|
639
|
+
emitPageChange() {
|
|
640
|
+
const take = this.pageSizeValue();
|
|
641
|
+
this.pageChange.emit({ page: this.page(), skip: (this.page() - 1) * take, take });
|
|
704
642
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
if (originalTabIndex == null) {
|
|
708
|
-
element.removeAttribute("tabindex");
|
|
709
|
-
}
|
|
710
|
-
else {
|
|
711
|
-
element.setAttribute("tabindex", originalTabIndex);
|
|
712
|
-
}
|
|
713
|
-
this.#managedFocusTargets.delete(element);
|
|
643
|
+
findNavigationTemplate(type) {
|
|
644
|
+
return this.navigationButtonsTemplateList().find(template => template.type() === type);
|
|
714
645
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
}
|
|
646
|
+
focusedInside() {
|
|
647
|
+
const active = this.#document.activeElement;
|
|
648
|
+
return active != null && this.#hostElementRef.nativeElement.contains(active);
|
|
719
649
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
if (pageCount < 1) {
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
this.setPage(Math.min(Math.max(page, 1), pageCount));
|
|
726
|
-
}
|
|
727
|
-
setPage(page) {
|
|
728
|
-
if (!this.hasPages() || !Number.isInteger(page) || page < 1) {
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
this.#skip.set((Math.min(page, this.pageCount()) - 1) * this.pagerPageSize());
|
|
732
|
-
}
|
|
733
|
-
syncFocusableTabIndexes() {
|
|
734
|
-
const focusableTargets = this.getFocusableTargets();
|
|
735
|
-
const currentTargets = new Set(focusableTargets);
|
|
736
|
-
for (const element of Array.from(this.#managedFocusTargets)) {
|
|
737
|
-
if (!this.navigable() || !currentTargets.has(element)) {
|
|
738
|
-
this.restoreManagedFocusTarget(element);
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
if (!this.navigable()) {
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
for (const target of focusableTargets) {
|
|
745
|
-
this.overrideTabIndex(target);
|
|
746
|
-
}
|
|
650
|
+
isDisabled(element) {
|
|
651
|
+
return element.disabled === true || element.getAttribute("aria-disabled") === "true";
|
|
747
652
|
}
|
|
748
653
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
749
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PagerComponent, isStandalone: true, selector: "mona-pager", inputs: { firstLast: { classPropertyName: "firstLast", publicName: "firstLast", isSignal: true, isRequired: false, transformFunction: null }, navigable: { classPropertyName: "navigable", publicName: "navigable", isSignal: true, isRequired: false, transformFunction: null }, pageInput: { classPropertyName: "pageInput", publicName: "pageInput", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizeValues: { classPropertyName: "pageSizeValues", publicName: "pageSizeValues", isSignal: true, isRequired: false, transformFunction: null }, previousNext: { classPropertyName: "previousNext", publicName: "previousNext", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showInfo: { classPropertyName: "showInfo", publicName: "showInfo", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, skip: { classPropertyName: "skip", publicName: "skip", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, userClasses: { classPropertyName: "userClasses", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, visiblePages: { classPropertyName: "visiblePages", publicName: "visiblePages", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageChange: "pageChange", pageSizeChange: "pageSizeChange" }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.tabindex": "navigable() ? 0 : null", "class": "baseClasses()" } }, queries: [{ propertyName: "navigationButtonsTemplateList", predicate: PagerNavigationButtonsTemplateDirective, isSignal: true }, { propertyName: "numericButtonsTemplate", first: true, predicate: PagerNumericButtonsTemplateDirective, descendants: true, isSignal: true }, { propertyName: "pageSizeTemplate", first: true, predicate: PagerPageSizeTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "pagerInfoTemplate", first: true, predicate: PagerInfoTemplateDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "pageSizeDropdownList", first: true, predicate: ["pageSizeDropdownList"], descendants: true, isSignal: true }], ngImport: i0, template: "@let numericButtonsTemplateRef = numericButtonsTemplate()?.templateRef;\n@let pageSizeTemplateRef = pageSizeTemplate();\n@let pagerInfoTemplateRef = pagerInfoTemplate()?.templateRef;\n\n@if (type() === \"numeric\") {\n @if (pageListVisible()) {\n <ol [class]=\"listClasses()\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n\n @if (numericButtonsTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"numericButtonsTemplateRef\"\n [ngTemplateOutletContext]=\"{ totalPages: pageCount() }\"></ng-container>\n } @else {\n @if (pages().length !== 0) {\n <li [class]=\"pageItemClasses(page() === 1)\">\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [selected]=\"page() === 1\"\n [attr.aria-label]=\"messages().pageLabel(1)\"\n [attr.aria-current]=\"page() === 1 ? 'page' : null\"\n (click)=\"onPageClick(1)\">\n {{ formatPageNumber(1) }}\n </button>\n </li>\n }\n @if (previousJumperVisible()) {\n <li>\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"jumpPreviousLabel()\"\n (click)=\"onJumpPreviousClick()\">\n <svg lucideEllipsis [size]=\"iconSize()\"></svg>\n </button>\n </li>\n }\n\n @for (pageItem of pages() | monaSlice: 1 : pages().length - 1; track $index) {\n <li [attr.data-page]=\"pageItem.page\" [class]=\"pageItemClasses(page() === pageItem.page)\">\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [selected]=\"page() === pageItem.page\"\n [attr.aria-label]=\"messages().pageLabel(pageItem.page)\"\n [attr.aria-current]=\"page() === pageItem.page ? 'page' : null\"\n (click)=\"onPageClick(pageItem.page)\">\n {{ pageItem.text }}\n </button>\n </li>\n }\n\n @if (nextJumperVisible()) {\n <li>\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"jumpNextLabel()\"\n (click)=\"onJumpNextClick()\">\n <svg lucideEllipsis [size]=\"iconSize()\"></svg>\n </button>\n </li>\n }\n\n @if (pages().length > 1) {\n <li [class]=\"pageItemClasses(page() === pageCount())\">\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [selected]=\"page() === pageCount()\"\n [attr.aria-label]=\"messages().pageLabel(pageCount())\"\n [attr.aria-current]=\"page() === pageCount() ? 'page' : null\"\n (click)=\"onPageClick(pageCount())\">\n {{ formatPageNumber(pageCount()) }}\n </button>\n </li>\n }\n }\n\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n\n @if (hasPages() && pageInputVisible() && pageInput()) {\n <li>\n <mona-numeric-text-box\n monaPagerFocusable\n [spinners]=\"false\"\n [minValue]=\"1\"\n [maxValue]=\"pageCount()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [aria-label]=\"messages().pageStatus(page(), pageCount())\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"inputValue.set($event)\"\n (inputBlur)=\"onPageInputBlur()\"></mona-numeric-text-box>\n </li>\n }\n\n @if (pageInputVisible() && pageSizeDropdownData().length > 0) {\n <li>\n @if (pageSizeTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"pageSizeTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: pageSizeDropdownData() }\">\n </ng-container>\n } @else {\n <mona-dropdown-list\n monaPagerFocusable\n [data]=\"pageSizeDropdownData()\"\n [aria-label]=\"messages().pageSizeLabel(pageSize())\"\n [ngModel]=\"pageSize()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (ngModelChange)=\"onPageSizeValueChange($event)\"\n #pageSizeDropdownList>\n <ng-template monaDropDownListValueTemplate let-item>\n <span>{{ messages().pageSizeLabel(item) }}</span>\n </ng-template>\n <ng-template monaDropDownItemTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n </mona-dropdown-list>\n }\n </li>\n }\n </ol>\n }\n @if (infoVisible()) {\n @if (pagerInfoTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"pagerInfoTemplateRef\"\n [ngTemplateOutletContext]=\"pagerInfoTemplateContext()\"></ng-container>\n } @else {\n <span [class]=\"infoClasses()\">{{ pagerInfo() }}</span>\n }\n }\n}\n@if (type() === \"input\") {\n <div [class]=\"inputClasses()\">\n @if (pageListVisible()) {\n <ol [class]=\"listClasses()\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n @if (hasPages()) {\n <li class=\"flex items-center gap-2 mx-2\">\n <span>{{ messages().pageText }}</span>\n <mona-numeric-text-box\n monaPagerFocusable\n [spinners]=\"false\"\n [minValue]=\"1\"\n [maxValue]=\"pageCount()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [aria-label]=\"messages().pageStatus(page(), pageCount())\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"inputValue.set($event)\"\n (inputBlur)=\"onPageInputBlur()\"></mona-numeric-text-box>\n <span>{{ messages().ofText }}</span>\n <span>{{ formatPageNumber(pageCount()) }}</span>\n </li>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n </ol>\n }\n </div>\n @if (infoVisible()) {\n @if (pagerInfoTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"pagerInfoTemplateRef\"\n [ngTemplateOutletContext]=\"pagerInfoTemplateContext()\"></ng-container>\n } @else {\n <span [class]=\"infoClasses()\">{{ pagerInfo() }}</span>\n }\n }\n}\n@if (!pageListVisible()) {\n <ol [class]=\"listClasses()\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n @if (pageCount() !== 0) {\n <li>\n <mona-dropdown-list\n monaPagerFocusable\n [data]=\"pageList()\"\n [ngModel]=\"page()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n monaDropDownVirtualScroll\n (ngModelChange)=\"onPageClick($event)\"\n style=\"width: 75px\">\n <ng-template monaDropDownListValueTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n <ng-template monaDropDownItemTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n </mona-dropdown-list>\n </li>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n </ol>\n}\n\n<ng-template #firstPageButton>\n <li>\n @let firstPageTemplate = firstPageNavigationTemplate();\n @if (firstPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"firstPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"{\n totalPages: pageCount(),\n pageSize: pagerPageSize(),\n disabled: !hasPages() || page() <= 1\n }\">\n </ng-container>\n } @else {\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"messages().firstPageLabel\"\n (click)=\"onPageClick(1)\"\n [disabled]=\"!hasPages() || page() <= 1\">\n <svg lucideChevronsLeft class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #previousPageButton>\n <li>\n @let previousPageTemplate = previousPageNavigationTemplate();\n @if (previousPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"previousPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"{\n totalPages: pageCount(),\n pageSize: pagerPageSize(),\n disabled: !hasPages() || page() <= 1\n }\">\n </ng-container>\n } @else {\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [disabled]=\"!hasPages() || page() <= 1\"\n [attr.aria-label]=\"messages().previousPageLabel\"\n (click)=\"onPreviousPageClick()\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #nextPageButton>\n <li>\n @let nextPageTemplate = nextPageNavigationTemplate();\n @if (nextPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"nextPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"{\n totalPages: pageCount(),\n pageSize: pagerPageSize(),\n disabled: !hasPages() || page() < 1 || page() >= pageCount()\n }\">\n </ng-container>\n } @else {\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [disabled]=\"!hasPages() || page() < 1 || page() >= pageCount()\"\n [attr.aria-label]=\"messages().nextPageLabel\"\n (click)=\"onNextPageClick()\">\n <svg lucideChevronRight class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #lastPageButton>\n <li>\n @let lastPageTemplate = lastPageNavigationTemplate();\n @if (lastPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"lastPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"{\n totalPages: pageCount(),\n pageSize: pagerPageSize(),\n disabled: !hasPages() || page() >= pageCount()\n }\">\n </ng-container>\n } @else {\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"messages().lastPageLabel\"\n (click)=\"onPageClick(pageCount())\"\n [disabled]=\"!hasPages() || page() >= pageCount()\">\n <svg lucideChevronsRight class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class"], outputs: ["lookChange", "selectedChange"] }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["formatter", "maxValue", "minValue", "step", "value"], outputs: ["valueChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: DropdownListComponent, selector: "mona-dropdown-list", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "data", "disabled", "invalid", "itemDisabled", "loading", "placeholder", "popupClass", "popupHeight", "popupWidth", "readonly", "required", "rounded", "showClearButton", "size", "textField", "touched", "class", "value", "valueField", "valuePrimitive"], outputs: ["close", "closed", "open", "opened", "touch", "valueChange"] }, { kind: "directive", type: PagerFocusableDirective, selector: "[monaPagerFocusable]" }, { kind: "directive", type: DropdownVirtualScrollDirective, selector: " mona-auto-complete[monaDropDownVirtualScroll], mona-dropdown-list[monaDropDownVirtualScroll], mona-combo-box[monaDropDownVirtualScroll], mona-multi-select[monaDropDownVirtualScroll] ", inputs: ["monaDropDownVirtualScroll"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: DropdownListValueTemplateDirective, selector: "ng-template[monaDropDownListValueTemplate]" }, { kind: "directive", type: DropdownItemTemplateDirective, selector: " ng-template[monaDropDownItemTemplate], ng-template[monaAutoCompleteItemTemplate], ng-template[monaDropDownListItemTemplate], ng-template[monaComboBoxItemTemplate], ng-template[monaMultiSelectItemTemplate] " }, { kind: "component", type: LucideEllipsis, selector: "svg[lucideEllipsis], svg[lucideMoreHorizontal]" }, { kind: "component", type: LucideChevronsLeft, selector: "svg[lucideChevronsLeft]" }, { kind: "component", type: LucideChevronLeft, selector: "svg[lucideChevronLeft]" }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "component", type: LucideChevronsRight, selector: "svg[lucideChevronsRight]" }, { kind: "pipe", type: SlicePipe, name: "monaSlice" }] }); }
|
|
654
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PagerComponent, isStandalone: true, selector: "mona-pager", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, firstLast: { classPropertyName: "firstLast", publicName: "firstLast", isSignal: true, isRequired: false, transformFunction: null }, navigable: { classPropertyName: "navigable", publicName: "navigable", isSignal: true, isRequired: false, transformFunction: null }, pageInput: { classPropertyName: "pageInput", publicName: "pageInput", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizeValues: { classPropertyName: "pageSizeValues", publicName: "pageSizeValues", isSignal: true, isRequired: false, transformFunction: null }, previousNext: { classPropertyName: "previousNext", publicName: "previousNext", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showInfo: { classPropertyName: "showInfo", publicName: "showInfo", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, skip: { classPropertyName: "skip", publicName: "skip", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, userClasses: { classPropertyName: "userClasses", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, visiblePages: { classPropertyName: "visiblePages", publicName: "visiblePages", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageChange: "pageChange", pageSize: "pageSizeChange", pageSizeSelect: "pageSizeSelect", skip: "skipChange" }, host: { attributes: { "role": "navigation" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.aria-label": "ariaLabelledBy() ? null : ariaLabel() || messages().pagerLabel", "attr.aria-labelledby": "ariaLabelledBy() || null", "class": "baseClasses()" } }, queries: [{ propertyName: "navigationButtonsTemplateList", predicate: PagerNavigationButtonsTemplateDirective, isSignal: true }, { propertyName: "numericButtonsTemplate", first: true, predicate: PagerNumericButtonsTemplateDirective, descendants: true, isSignal: true }, { propertyName: "pageSizeTemplate", first: true, predicate: PagerPageSizeTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "pagerInfoTemplate", first: true, predicate: PagerInfoTemplateDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "pageSizeDropdownList", first: true, predicate: ["pageSizeDropdownList"], descendants: true, isSignal: true }], ngImport: i0, template: "@let numericButtonsTemplateRef = numericButtonsTemplate()?.templateRef;\n@let pageSizeTemplateRef = pageSizeTemplate();\n@let pagerInfoTemplateRef = pagerInfoTemplate()?.templateRef;\n\n@if (compact()) {\n <ol [class]=\"listClasses\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n @if (hasPages()) {\n <li>\n <mona-dropdown-list\n class=\"w-20\"\n [data]=\"pageList()\"\n [value]=\"page()\"\n [aria-label]=\"messages().pageSelectLabel\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n monaDropDownVirtualScroll\n (valueChange)=\"goToPage($event)\">\n <ng-template monaDropDownListValueTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n <ng-template monaDropDownItemTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n </mona-dropdown-list>\n </li>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n <ng-container [ngTemplateOutlet]=\"pageSizeSelector\"></ng-container>\n </ol>\n} @else if (type() === \"numeric\") {\n <ol [class]=\"listClasses\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n\n @if (numericButtonsTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"numericButtonsTemplateRef\"\n [ngTemplateOutletContext]=\"numericButtonsContext()\"></ng-container>\n } @else {\n @for (item of pageItems(); track item.key) {\n @if (item.kind === \"page\") {\n <li [attr.data-page]=\"item.page\" [class]=\"pageItemClasses(page() === item.page)\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [selected]=\"page() === item.page\"\n [attr.aria-label]=\"messages().pageLabel(item.page)\"\n [attr.aria-current]=\"page() === item.page ? 'page' : null\"\n (click)=\"goToPage(item.page)\">\n {{ formatPageNumber(item.page) }}\n </button>\n </li>\n } @else {\n <li>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"item.direction === 'backward' ? jumpPreviousLabel() : jumpNextLabel()\"\n (click)=\"goToPage(item.page)\">\n <svg lucideEllipsis [size]=\"iconSize()\"></svg>\n </button>\n </li>\n }\n }\n }\n\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n\n @if (hasPages() && pageInput()) {\n <li>\n <mona-numeric-text-box\n [inputId]=\"pageInputId\"\n [spinners]=\"false\"\n [minValue]=\"1\"\n [maxValue]=\"pageCount()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [aria-label]=\"messages().pageSelectLabel\"\n [value]=\"inputValue()\"\n (valueChange)=\"inputValue.set($event)\"\n (keydown.enter)=\"onPageInputEnter($event)\"\n (inputBlur)=\"commitPageInput()\"></mona-numeric-text-box>\n </li>\n }\n <ng-container [ngTemplateOutlet]=\"pageSizeSelector\"></ng-container>\n </ol>\n} @else {\n <div [class]=\"inputClasses\">\n <ol [class]=\"listClasses\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n @if (hasPages()) {\n <li class=\"flex items-center gap-2 mx-2\">\n <span [id]=\"pageInputPrefixId\">{{ messages().pageInputPrefix(pageCount()) }}</span>\n <mona-numeric-text-box\n [inputId]=\"pageInputId\"\n [spinners]=\"false\"\n [minValue]=\"1\"\n [maxValue]=\"pageCount()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [aria-labelledby]=\"pageInputLabelledBy\"\n [value]=\"inputValue()\"\n (valueChange)=\"inputValue.set($event)\"\n (keydown.enter)=\"onPageInputEnter($event)\"\n (inputBlur)=\"commitPageInput()\"></mona-numeric-text-box>\n <span [id]=\"pageInputSuffixId\">{{ messages().pageInputSuffix(pageCount()) }}</span>\n </li>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n </ol>\n </div>\n}\n\n@if (showInfo()) {\n @if (pagerInfoTemplateRef) {\n <ng-container [ngTemplateOutlet]=\"pagerInfoTemplateRef\" [ngTemplateOutletContext]=\"infoContext()\"></ng-container>\n } @else {\n <span [class]=\"infoClasses\">{{ pagerInfo() }}</span>\n }\n}\n<span class=\"sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ liveStatus() }}</span>\n\n<ng-template #pageSizeSelector>\n @if (pageSizeOptions().length > 0) {\n <li>\n @if (pageSizeTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"pageSizeTemplateRef\"\n [ngTemplateOutletContext]=\"pageSizeContext()\"></ng-container>\n } @else {\n <mona-dropdown-list\n [data]=\"pageSizeOptions()\"\n [aria-label]=\"messages().itemsPerPageLabel\"\n [value]=\"pageSizeValue()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (valueChange)=\"changePageSize($event)\"\n #pageSizeDropdownList>\n <ng-template monaDropDownListValueTemplate let-item>\n <span>{{ messages().pageSizeLabel(item) }}</span>\n </ng-template>\n <ng-template monaDropDownItemTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n </mona-dropdown-list>\n }\n </li>\n }\n</ng-template>\n\n<ng-template #firstPageButton>\n <li>\n @let firstPageTemplate = firstPageNavigationTemplate();\n @if (firstPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"firstPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"firstNavigationContext()\"></ng-container>\n } @else {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"messages().firstPageLabel\"\n [disabled]=\"firstNavigationContext().disabled\"\n (click)=\"goToPage(1)\">\n <svg lucideChevronsLeft class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #previousPageButton>\n <li>\n @let previousPageTemplate = previousPageNavigationTemplate();\n @if (previousPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"previousPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"previousNavigationContext()\"></ng-container>\n } @else {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [disabled]=\"previousNavigationContext().disabled\"\n [attr.aria-label]=\"messages().previousPageLabel\"\n (click)=\"goToPage(page() - 1)\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #nextPageButton>\n <li>\n @let nextPageTemplate = nextPageNavigationTemplate();\n @if (nextPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"nextPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"nextNavigationContext()\"></ng-container>\n } @else {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [disabled]=\"nextNavigationContext().disabled\"\n [attr.aria-label]=\"messages().nextPageLabel\"\n (click)=\"goToPage(page() + 1)\">\n <svg lucideChevronRight class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #lastPageButton>\n <li>\n @let lastPageTemplate = lastPageNavigationTemplate();\n @if (lastPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"lastPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"lastNavigationContext()\"></ng-container>\n } @else {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"messages().lastPageLabel\"\n [disabled]=\"lastNavigationContext().disabled\"\n (click)=\"goToPage(pageCount())\">\n <svg lucideChevronsRight class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class"], outputs: ["lookChange", "selectedChange"] }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["formatter", "maxValue", "minValue", "step", "value"], outputs: ["valueChange"] }, { kind: "component", type: DropdownListComponent, selector: "mona-dropdown-list", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "data", "disabled", "invalid", "itemDisabled", "loading", "placeholder", "popupClass", "popupHeight", "popupWidth", "readonly", "required", "rounded", "showClearButton", "size", "textField", "touched", "class", "value", "valueField", "valuePrimitive"], outputs: ["close", "closed", "open", "opened", "touch", "valueChange"] }, { kind: "directive", type: DropdownVirtualScrollDirective, selector: " mona-auto-complete[monaDropDownVirtualScroll], mona-dropdown-list[monaDropDownVirtualScroll], mona-combo-box[monaDropDownVirtualScroll], mona-multi-select[monaDropDownVirtualScroll] ", inputs: ["monaDropDownVirtualScroll"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: DropdownListValueTemplateDirective, selector: "ng-template[monaDropDownListValueTemplate]" }, { kind: "directive", type: DropdownItemTemplateDirective, selector: " ng-template[monaDropDownItemTemplate], ng-template[monaAutoCompleteItemTemplate], ng-template[monaDropDownListItemTemplate], ng-template[monaComboBoxItemTemplate], ng-template[monaMultiSelectItemTemplate] " }, { kind: "component", type: LucideEllipsis, selector: "svg[lucideEllipsis], svg[lucideMoreHorizontal]" }, { kind: "component", type: LucideChevronsLeft, selector: "svg[lucideChevronsLeft]" }, { kind: "component", type: LucideChevronLeft, selector: "svg[lucideChevronLeft]" }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "component", type: LucideChevronsRight, selector: "svg[lucideChevronsRight]" }] }); }
|
|
750
655
|
}
|
|
751
656
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PagerComponent, decorators: [{
|
|
752
657
|
type: Component,
|
|
753
658
|
args: [{ selector: "mona-pager", imports: [
|
|
754
659
|
ButtonDirective,
|
|
755
660
|
NumericTextBoxComponent,
|
|
756
|
-
FormsModule,
|
|
757
661
|
DropdownListComponent,
|
|
758
|
-
PagerFocusableDirective,
|
|
759
|
-
SlicePipe,
|
|
760
662
|
DropdownVirtualScrollDirective,
|
|
761
663
|
NgTemplateOutlet,
|
|
762
664
|
DropdownListValueTemplateDirective,
|
|
@@ -767,11 +669,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
767
669
|
LucideChevronRight,
|
|
768
670
|
LucideChevronsRight
|
|
769
671
|
], host: {
|
|
770
|
-
"[attr.
|
|
672
|
+
"[attr.aria-label]": "ariaLabelledBy() ? null : ariaLabel() || messages().pagerLabel",
|
|
673
|
+
"[attr.aria-labelledby]": "ariaLabelledBy() || null",
|
|
771
674
|
"[class]": "baseClasses()",
|
|
772
|
-
"(keydown)": "onKeydown($event)"
|
|
773
|
-
}, template: "@let numericButtonsTemplateRef = numericButtonsTemplate()?.templateRef;\n@let pageSizeTemplateRef = pageSizeTemplate();\n@let pagerInfoTemplateRef = pagerInfoTemplate()?.templateRef;\n\n@if (type() === \"numeric\") {\n @if (pageListVisible()) {\n <ol [class]=\"listClasses()\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n\n @if (numericButtonsTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"numericButtonsTemplateRef\"\n [ngTemplateOutletContext]=\"{ totalPages: pageCount() }\"></ng-container>\n } @else {\n @if (pages().length !== 0) {\n <li [class]=\"pageItemClasses(page() === 1)\">\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [selected]=\"page() === 1\"\n [attr.aria-label]=\"messages().pageLabel(1)\"\n [attr.aria-current]=\"page() === 1 ? 'page' : null\"\n (click)=\"onPageClick(1)\">\n {{ formatPageNumber(1) }}\n </button>\n </li>\n }\n @if (previousJumperVisible()) {\n <li>\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"jumpPreviousLabel()\"\n (click)=\"onJumpPreviousClick()\">\n <svg lucideEllipsis [size]=\"iconSize()\"></svg>\n </button>\n </li>\n }\n\n @for (pageItem of pages() | monaSlice: 1 : pages().length - 1; track $index) {\n <li [attr.data-page]=\"pageItem.page\" [class]=\"pageItemClasses(page() === pageItem.page)\">\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [selected]=\"page() === pageItem.page\"\n [attr.aria-label]=\"messages().pageLabel(pageItem.page)\"\n [attr.aria-current]=\"page() === pageItem.page ? 'page' : null\"\n (click)=\"onPageClick(pageItem.page)\">\n {{ pageItem.text }}\n </button>\n </li>\n }\n\n @if (nextJumperVisible()) {\n <li>\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"jumpNextLabel()\"\n (click)=\"onJumpNextClick()\">\n <svg lucideEllipsis [size]=\"iconSize()\"></svg>\n </button>\n </li>\n }\n\n @if (pages().length > 1) {\n <li [class]=\"pageItemClasses(page() === pageCount())\">\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [selected]=\"page() === pageCount()\"\n [attr.aria-label]=\"messages().pageLabel(pageCount())\"\n [attr.aria-current]=\"page() === pageCount() ? 'page' : null\"\n (click)=\"onPageClick(pageCount())\">\n {{ formatPageNumber(pageCount()) }}\n </button>\n </li>\n }\n }\n\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n\n @if (hasPages() && pageInputVisible() && pageInput()) {\n <li>\n <mona-numeric-text-box\n monaPagerFocusable\n [spinners]=\"false\"\n [minValue]=\"1\"\n [maxValue]=\"pageCount()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [aria-label]=\"messages().pageStatus(page(), pageCount())\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"inputValue.set($event)\"\n (inputBlur)=\"onPageInputBlur()\"></mona-numeric-text-box>\n </li>\n }\n\n @if (pageInputVisible() && pageSizeDropdownData().length > 0) {\n <li>\n @if (pageSizeTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"pageSizeTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: pageSizeDropdownData() }\">\n </ng-container>\n } @else {\n <mona-dropdown-list\n monaPagerFocusable\n [data]=\"pageSizeDropdownData()\"\n [aria-label]=\"messages().pageSizeLabel(pageSize())\"\n [ngModel]=\"pageSize()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (ngModelChange)=\"onPageSizeValueChange($event)\"\n #pageSizeDropdownList>\n <ng-template monaDropDownListValueTemplate let-item>\n <span>{{ messages().pageSizeLabel(item) }}</span>\n </ng-template>\n <ng-template monaDropDownItemTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n </mona-dropdown-list>\n }\n </li>\n }\n </ol>\n }\n @if (infoVisible()) {\n @if (pagerInfoTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"pagerInfoTemplateRef\"\n [ngTemplateOutletContext]=\"pagerInfoTemplateContext()\"></ng-container>\n } @else {\n <span [class]=\"infoClasses()\">{{ pagerInfo() }}</span>\n }\n }\n}\n@if (type() === \"input\") {\n <div [class]=\"inputClasses()\">\n @if (pageListVisible()) {\n <ol [class]=\"listClasses()\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n @if (hasPages()) {\n <li class=\"flex items-center gap-2 mx-2\">\n <span>{{ messages().pageText }}</span>\n <mona-numeric-text-box\n monaPagerFocusable\n [spinners]=\"false\"\n [minValue]=\"1\"\n [maxValue]=\"pageCount()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [aria-label]=\"messages().pageStatus(page(), pageCount())\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"inputValue.set($event)\"\n (inputBlur)=\"onPageInputBlur()\"></mona-numeric-text-box>\n <span>{{ messages().ofText }}</span>\n <span>{{ formatPageNumber(pageCount()) }}</span>\n </li>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n </ol>\n }\n </div>\n @if (infoVisible()) {\n @if (pagerInfoTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"pagerInfoTemplateRef\"\n [ngTemplateOutletContext]=\"pagerInfoTemplateContext()\"></ng-container>\n } @else {\n <span [class]=\"infoClasses()\">{{ pagerInfo() }}</span>\n }\n }\n}\n@if (!pageListVisible()) {\n <ol [class]=\"listClasses()\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n @if (pageCount() !== 0) {\n <li>\n <mona-dropdown-list\n monaPagerFocusable\n [data]=\"pageList()\"\n [ngModel]=\"page()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n monaDropDownVirtualScroll\n (ngModelChange)=\"onPageClick($event)\"\n style=\"width: 75px\">\n <ng-template monaDropDownListValueTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n <ng-template monaDropDownItemTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n </mona-dropdown-list>\n </li>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n </ol>\n}\n\n<ng-template #firstPageButton>\n <li>\n @let firstPageTemplate = firstPageNavigationTemplate();\n @if (firstPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"firstPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"{\n totalPages: pageCount(),\n pageSize: pagerPageSize(),\n disabled: !hasPages() || page() <= 1\n }\">\n </ng-container>\n } @else {\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"messages().firstPageLabel\"\n (click)=\"onPageClick(1)\"\n [disabled]=\"!hasPages() || page() <= 1\">\n <svg lucideChevronsLeft class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #previousPageButton>\n <li>\n @let previousPageTemplate = previousPageNavigationTemplate();\n @if (previousPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"previousPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"{\n totalPages: pageCount(),\n pageSize: pagerPageSize(),\n disabled: !hasPages() || page() <= 1\n }\">\n </ng-container>\n } @else {\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [disabled]=\"!hasPages() || page() <= 1\"\n [attr.aria-label]=\"messages().previousPageLabel\"\n (click)=\"onPreviousPageClick()\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #nextPageButton>\n <li>\n @let nextPageTemplate = nextPageNavigationTemplate();\n @if (nextPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"nextPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"{\n totalPages: pageCount(),\n pageSize: pagerPageSize(),\n disabled: !hasPages() || page() < 1 || page() >= pageCount()\n }\">\n </ng-container>\n } @else {\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [disabled]=\"!hasPages() || page() < 1 || page() >= pageCount()\"\n [attr.aria-label]=\"messages().nextPageLabel\"\n (click)=\"onNextPageClick()\">\n <svg lucideChevronRight class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #lastPageButton>\n <li>\n @let lastPageTemplate = lastPageNavigationTemplate();\n @if (lastPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"lastPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"{\n totalPages: pageCount(),\n pageSize: pagerPageSize(),\n disabled: !hasPages() || page() >= pageCount()\n }\">\n </ng-container>\n } @else {\n <button\n monaPagerFocusable\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"messages().lastPageLabel\"\n (click)=\"onPageClick(pageCount())\"\n [disabled]=\"!hasPages() || page() >= pageCount()\">\n <svg lucideChevronsRight class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n" }]
|
|
774
|
-
}], ctorParameters: () => [], propDecorators: { navigationButtonsTemplateList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PagerNavigationButtonsTemplateDirective), { isSignal: true }] }], numericButtonsTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PagerNumericButtonsTemplateDirective), { isSignal: true }] }], pageSizeDropdownList: [{ type: i0.ViewChild, args: ["pageSizeDropdownList", { isSignal: true }] }], pageSizeTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PagerPageSizeTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], pagerInfoTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PagerInfoTemplateDirective), { isSignal: true }] }], firstLast: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstLast", required: false }] }], navigable: [{ type: i0.Input, args: [{ isSignal: true, alias: "navigable", required: false }] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageInput", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], pageSizeChange: [{ type: i0.Output, args: ["pageSizeChange"] }], pageSizeValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizeValues", required: false }] }], previousNext: [{ type: i0.Input, args: [{ isSignal: true, alias: "previousNext", required: false }] }], responsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "responsive", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "showInfo", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], skip: [{ type: i0.Input, args: [{ isSignal: true, alias: "skip", required: false }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], userClasses: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], visiblePages: [{ type: i0.Input, args: [{ isSignal: true, alias: "visiblePages", required: false }] }] } });
|
|
675
|
+
"(keydown)": "onKeydown($event)",
|
|
676
|
+
role: "navigation"
|
|
677
|
+
}, template: "@let numericButtonsTemplateRef = numericButtonsTemplate()?.templateRef;\n@let pageSizeTemplateRef = pageSizeTemplate();\n@let pagerInfoTemplateRef = pagerInfoTemplate()?.templateRef;\n\n@if (compact()) {\n <ol [class]=\"listClasses\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n @if (hasPages()) {\n <li>\n <mona-dropdown-list\n class=\"w-20\"\n [data]=\"pageList()\"\n [value]=\"page()\"\n [aria-label]=\"messages().pageSelectLabel\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n monaDropDownVirtualScroll\n (valueChange)=\"goToPage($event)\">\n <ng-template monaDropDownListValueTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n <ng-template monaDropDownItemTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n </mona-dropdown-list>\n </li>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n <ng-container [ngTemplateOutlet]=\"pageSizeSelector\"></ng-container>\n </ol>\n} @else if (type() === \"numeric\") {\n <ol [class]=\"listClasses\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n\n @if (numericButtonsTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"numericButtonsTemplateRef\"\n [ngTemplateOutletContext]=\"numericButtonsContext()\"></ng-container>\n } @else {\n @for (item of pageItems(); track item.key) {\n @if (item.kind === \"page\") {\n <li [attr.data-page]=\"item.page\" [class]=\"pageItemClasses(page() === item.page)\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [selected]=\"page() === item.page\"\n [attr.aria-label]=\"messages().pageLabel(item.page)\"\n [attr.aria-current]=\"page() === item.page ? 'page' : null\"\n (click)=\"goToPage(item.page)\">\n {{ formatPageNumber(item.page) }}\n </button>\n </li>\n } @else {\n <li>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"item.direction === 'backward' ? jumpPreviousLabel() : jumpNextLabel()\"\n (click)=\"goToPage(item.page)\">\n <svg lucideEllipsis [size]=\"iconSize()\"></svg>\n </button>\n </li>\n }\n }\n }\n\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n\n @if (hasPages() && pageInput()) {\n <li>\n <mona-numeric-text-box\n [inputId]=\"pageInputId\"\n [spinners]=\"false\"\n [minValue]=\"1\"\n [maxValue]=\"pageCount()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [aria-label]=\"messages().pageSelectLabel\"\n [value]=\"inputValue()\"\n (valueChange)=\"inputValue.set($event)\"\n (keydown.enter)=\"onPageInputEnter($event)\"\n (inputBlur)=\"commitPageInput()\"></mona-numeric-text-box>\n </li>\n }\n <ng-container [ngTemplateOutlet]=\"pageSizeSelector\"></ng-container>\n </ol>\n} @else {\n <div [class]=\"inputClasses\">\n <ol [class]=\"listClasses\">\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"firstPageButton\"></ng-container>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"previousPageButton\"></ng-container>\n }\n @if (hasPages()) {\n <li class=\"flex items-center gap-2 mx-2\">\n <span [id]=\"pageInputPrefixId\">{{ messages().pageInputPrefix(pageCount()) }}</span>\n <mona-numeric-text-box\n [inputId]=\"pageInputId\"\n [spinners]=\"false\"\n [minValue]=\"1\"\n [maxValue]=\"pageCount()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [aria-labelledby]=\"pageInputLabelledBy\"\n [value]=\"inputValue()\"\n (valueChange)=\"inputValue.set($event)\"\n (keydown.enter)=\"onPageInputEnter($event)\"\n (inputBlur)=\"commitPageInput()\"></mona-numeric-text-box>\n <span [id]=\"pageInputSuffixId\">{{ messages().pageInputSuffix(pageCount()) }}</span>\n </li>\n }\n @if (previousNext()) {\n <ng-container [ngTemplateOutlet]=\"nextPageButton\"></ng-container>\n }\n @if (firstLast()) {\n <ng-container [ngTemplateOutlet]=\"lastPageButton\"></ng-container>\n }\n </ol>\n </div>\n}\n\n@if (showInfo()) {\n @if (pagerInfoTemplateRef) {\n <ng-container [ngTemplateOutlet]=\"pagerInfoTemplateRef\" [ngTemplateOutletContext]=\"infoContext()\"></ng-container>\n } @else {\n <span [class]=\"infoClasses\">{{ pagerInfo() }}</span>\n }\n}\n<span class=\"sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ liveStatus() }}</span>\n\n<ng-template #pageSizeSelector>\n @if (pageSizeOptions().length > 0) {\n <li>\n @if (pageSizeTemplateRef) {\n <ng-container\n [ngTemplateOutlet]=\"pageSizeTemplateRef\"\n [ngTemplateOutletContext]=\"pageSizeContext()\"></ng-container>\n } @else {\n <mona-dropdown-list\n [data]=\"pageSizeOptions()\"\n [aria-label]=\"messages().itemsPerPageLabel\"\n [value]=\"pageSizeValue()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n (valueChange)=\"changePageSize($event)\"\n #pageSizeDropdownList>\n <ng-template monaDropDownListValueTemplate let-item>\n <span>{{ messages().pageSizeLabel(item) }}</span>\n </ng-template>\n <ng-template monaDropDownItemTemplate let-item>\n <span>{{ formatPageNumber(item) }}</span>\n </ng-template>\n </mona-dropdown-list>\n }\n </li>\n }\n</ng-template>\n\n<ng-template #firstPageButton>\n <li>\n @let firstPageTemplate = firstPageNavigationTemplate();\n @if (firstPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"firstPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"firstNavigationContext()\"></ng-container>\n } @else {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"messages().firstPageLabel\"\n [disabled]=\"firstNavigationContext().disabled\"\n (click)=\"goToPage(1)\">\n <svg lucideChevronsLeft class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #previousPageButton>\n <li>\n @let previousPageTemplate = previousPageNavigationTemplate();\n @if (previousPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"previousPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"previousNavigationContext()\"></ng-container>\n } @else {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [disabled]=\"previousNavigationContext().disabled\"\n [attr.aria-label]=\"messages().previousPageLabel\"\n (click)=\"goToPage(page() - 1)\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #nextPageButton>\n <li>\n @let nextPageTemplate = nextPageNavigationTemplate();\n @if (nextPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"nextPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"nextNavigationContext()\"></ng-container>\n } @else {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [disabled]=\"nextNavigationContext().disabled\"\n [attr.aria-label]=\"messages().nextPageLabel\"\n (click)=\"goToPage(page() + 1)\">\n <svg lucideChevronRight class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n\n<ng-template #lastPageButton>\n <li>\n @let lastPageTemplate = lastPageNavigationTemplate();\n @if (lastPageTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"lastPageTemplate.templateRef\"\n [ngTemplateOutletContext]=\"lastNavigationContext()\"></ng-container>\n } @else {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [attr.aria-label]=\"messages().lastPageLabel\"\n [disabled]=\"lastNavigationContext().disabled\"\n (click)=\"goToPage(pageCount())\">\n <svg lucideChevronsRight class=\"rtl:rotate-180\" [size]=\"iconSize()\"></svg>\n </button>\n }\n </li>\n</ng-template>\n" }]
|
|
678
|
+
}], ctorParameters: () => [], propDecorators: { navigationButtonsTemplateList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PagerNavigationButtonsTemplateDirective), { isSignal: true }] }], numericButtonsTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PagerNumericButtonsTemplateDirective), { isSignal: true }] }], pageSizeDropdownList: [{ type: i0.ViewChild, args: ["pageSizeDropdownList", { isSignal: true }] }], pageSizeTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PagerPageSizeTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], pagerInfoTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PagerInfoTemplateDirective), { isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], firstLast: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstLast", required: false }] }], navigable: [{ type: i0.Input, args: [{ isSignal: true, alias: "navigable", required: false }] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageInput", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }, { type: i0.Output, args: ["pageSizeChange"] }], pageSizeSelect: [{ type: i0.Output, args: ["pageSizeSelect"] }], pageSizeValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizeValues", required: false }] }], previousNext: [{ type: i0.Input, args: [{ isSignal: true, alias: "previousNext", required: false }] }], responsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "responsive", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "showInfo", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], skip: [{ type: i0.Input, args: [{ isSignal: true, alias: "skip", required: false }] }, { type: i0.Output, args: ["skipChange"] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], userClasses: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], visiblePages: [{ type: i0.Input, args: [{ isSignal: true, alias: "visiblePages", required: false }] }] } });
|
|
775
679
|
|
|
776
680
|
/*
|
|
777
681
|
* Public API Surface of @nanahoshi/mona-ui/pager
|