@cngx/ui 0.1.0-rc.2 → 0.1.0-rc.4
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/README.md +15 -7
- package/accordion/README.md +86 -0
- package/collection/README.md +167 -0
- package/data-grid-accordion/README.md +137 -0
- package/fesm2022/cngx-ui-accordion.mjs +853 -0
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -0
- package/fesm2022/cngx-ui-action-button.mjs +2 -2
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +1044 -0
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/cngx-ui-collection.mjs +645 -0
- package/fesm2022/cngx-ui-collection.mjs.map +1 -0
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +1135 -0
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -0
- package/fesm2022/cngx-ui-empty-state.mjs +2 -2
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +10 -10
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +229 -0
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -0
- package/fesm2022/cngx-ui-mat-paginator.mjs +215 -0
- package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -0
- package/fesm2022/cngx-ui-paginator.mjs +1937 -0
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -0
- package/fesm2022/cngx-ui-sidenav.mjs +547 -65
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +8 -6
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +2 -2
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-accordion/README.md +48 -0
- package/mat-paginator/README.md +135 -0
- package/package.json +29 -5
- package/paginator/README.md +134 -0
- package/sidenav/README.md +89 -3
- package/types/cngx-ui-accordion.d.ts +801 -0
- package/types/cngx-ui-breadcrumb.d.ts +890 -0
- package/types/cngx-ui-collection.d.ts +396 -0
- package/types/cngx-ui-data-grid-accordion.d.ts +912 -0
- package/types/cngx-ui-mat-accordion.d.ts +63 -0
- package/types/cngx-ui-mat-paginator.d.ts +108 -0
- package/types/cngx-ui-paginator.d.ts +1147 -0
- package/types/cngx-ui-sidenav.d.ts +429 -21
- package/types/cngx-ui-tabs.d.ts +2 -0
- package/fesm2022/cngx-ui-material.mjs +0 -90
- package/fesm2022/cngx-ui-material.mjs.map +0 -1
- package/material/README.md +0 -90
- package/types/cngx-ui-material.d.ts +0 -47
|
@@ -0,0 +1,1937 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { InjectionToken, makeEnvironmentProviders, SkipSelf, Optional, inject, computed, linkedSignal, TemplateRef, Directive, input, booleanAttribute, output, contentChild, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { CngxLiveRegion, CngxRovingTabindex, CngxRovingItem } from '@cngx/common/a11y';
|
|
5
|
+
import * as i1 from '@cngx/common/data';
|
|
6
|
+
import { CngxPaginate, connectPaginateResetOn, connectPaginateEmit, CNGX_BUCKET_PAGINATE_HOST } from '@cngx/common/data';
|
|
7
|
+
import { CngxProgress } from '@cngx/ui/feedback';
|
|
8
|
+
import { CngxIcon } from '@cngx/common/display';
|
|
9
|
+
import { CngxRipple, CngxListbox, CngxListboxTrigger, CngxOption } from '@cngx/common/interactive';
|
|
10
|
+
import { CngxPopover, CngxPopoverTrigger } from '@cngx/common/popover';
|
|
11
|
+
import { CngxInfiniteScroll } from '@cngx/common/layout';
|
|
12
|
+
|
|
13
|
+
/** Library defaults - English. Override via {@link provideCngxPaginatorConfig}. */
|
|
14
|
+
const CNGX_PAGINATOR_DEFAULTS = {
|
|
15
|
+
ariaLabels: {
|
|
16
|
+
label: 'Pagination',
|
|
17
|
+
first: 'First page',
|
|
18
|
+
previous: 'Previous page',
|
|
19
|
+
next: 'Next page',
|
|
20
|
+
last: 'Last page',
|
|
21
|
+
page: (page) => `Page ${page}`,
|
|
22
|
+
morePages: 'More pages',
|
|
23
|
+
itemsPerPage: 'Items per page',
|
|
24
|
+
goToPage: 'Go to page',
|
|
25
|
+
pageOfPages: 'Select page',
|
|
26
|
+
loadMore: 'Load more',
|
|
27
|
+
allLoaded: (total) => `All ${total} loaded`,
|
|
28
|
+
bucket: (label) => label,
|
|
29
|
+
emptyBucket: (label) => `${label}, no items`,
|
|
30
|
+
bucketGroup: 'Categories',
|
|
31
|
+
railPosition: 'Page position',
|
|
32
|
+
},
|
|
33
|
+
announcements: {
|
|
34
|
+
pageChange: (page, totalPages) => `Page ${page} of ${totalPages}`,
|
|
35
|
+
loading: 'Loading',
|
|
36
|
+
updated: 'Updated',
|
|
37
|
+
},
|
|
38
|
+
formats: {
|
|
39
|
+
// The readout segments render the formatter output as sanitised HTML, so the
|
|
40
|
+
// current value (the page, or the item range) is emphasised with `<b>`;
|
|
41
|
+
// Angular's sanitiser keeps `<b>` and strips anything dangerous.
|
|
42
|
+
range: (start, end, total) => `<b>${start}-${end}</b> of ${total}`,
|
|
43
|
+
pageStatus: (page, totalPages) => `Page <b>${page}</b> of ${totalPages}`,
|
|
44
|
+
},
|
|
45
|
+
// Includes the brain's default pageSize (10) so the trigger value is always a
|
|
46
|
+
// member of the panel; a common data-table ladder, locale-neutral.
|
|
47
|
+
pageSizeOptions: [10, 25, 50, 100],
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Configuration cascade token. Resolution priority (high to low):
|
|
51
|
+
* per-instance Input, then `provideCngxPaginatorConfig(...)` at the
|
|
52
|
+
* application root, then the library defaults.
|
|
53
|
+
*
|
|
54
|
+
* @category ui/paginator
|
|
55
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
56
|
+
* @since 0.1.0
|
|
57
|
+
*/
|
|
58
|
+
const CNGX_PAGINATOR_CONFIG = new InjectionToken('CngxPaginatorConfig', {
|
|
59
|
+
providedIn: 'root',
|
|
60
|
+
factory: () => CNGX_PAGINATOR_DEFAULTS,
|
|
61
|
+
});
|
|
62
|
+
/** Reduce a feature list onto a base config, merging each sub-tree in isolation. */
|
|
63
|
+
function applyFeatures(base, features) {
|
|
64
|
+
let ariaLabels = base.ariaLabels;
|
|
65
|
+
let announcements = base.announcements;
|
|
66
|
+
let formats = base.formats;
|
|
67
|
+
let pageSizeOptions = base.pageSizeOptions;
|
|
68
|
+
let templates = base.templates;
|
|
69
|
+
for (const feature of features) {
|
|
70
|
+
if (feature.kind === 'ariaLabels') {
|
|
71
|
+
ariaLabels = { ...ariaLabels, ...feature.payload };
|
|
72
|
+
}
|
|
73
|
+
else if (feature.kind === 'announcements') {
|
|
74
|
+
announcements = { ...announcements, ...feature.payload };
|
|
75
|
+
}
|
|
76
|
+
else if (feature.kind === 'formats') {
|
|
77
|
+
formats = { ...formats, ...feature.payload };
|
|
78
|
+
}
|
|
79
|
+
else if (feature.kind === 'pageSizeOptions') {
|
|
80
|
+
// A size list is one atomic value - replace, do not merge.
|
|
81
|
+
pageSizeOptions = feature.payload;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
templates = { ...templates, ...feature.payload };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return { ariaLabels, announcements, formats, pageSizeOptions, templates };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Override any subset of the paginator accessible-name strings. Per-instance
|
|
91
|
+
* `aria-label` bindings still win over the cascade for the landmark name.
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* provideCngxPaginatorConfig(
|
|
95
|
+
* withPaginatorAriaLabels({ next: 'Nächste Seite', previous: 'Vorige Seite' }),
|
|
96
|
+
* );
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @category ui/paginator
|
|
100
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
101
|
+
* @since 0.1.0
|
|
102
|
+
*/
|
|
103
|
+
function withPaginatorAriaLabels(payload) {
|
|
104
|
+
return { kind: 'ariaLabels', payload };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Override any subset of the paginator live-region announcement phrasing.
|
|
108
|
+
*
|
|
109
|
+
* ```ts
|
|
110
|
+
* provideCngxPaginatorConfig(
|
|
111
|
+
* withPaginatorAnnouncements({
|
|
112
|
+
* pageChange: (page, total) => `Seite ${page} von ${total}`,
|
|
113
|
+
* loading: 'Wird geladen',
|
|
114
|
+
* updated: 'Aktualisiert',
|
|
115
|
+
* }),
|
|
116
|
+
* );
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* @category ui/paginator
|
|
120
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
121
|
+
* @since 0.1.0
|
|
122
|
+
*/
|
|
123
|
+
function withPaginatorAnnouncements(payload) {
|
|
124
|
+
return { kind: 'announcements', payload };
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Override the range-readout format. The `cngx-pgn-range` segment renders the
|
|
128
|
+
* returned string verbatim, so this also localises the `of` connector.
|
|
129
|
+
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* provideCngxPaginatorConfig(
|
|
132
|
+
* withPaginatorRangeFormat((start, end, total) => `${start}-${end} von ${total}`),
|
|
133
|
+
* );
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @category ui/paginator
|
|
137
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
138
|
+
* @since 0.1.0
|
|
139
|
+
*/
|
|
140
|
+
function withPaginatorRangeFormat(range) {
|
|
141
|
+
return { kind: 'formats', payload: { range } };
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Override the page-status format. The `cngx-pgn-status` segment renders the
|
|
145
|
+
* returned string verbatim, so this localises the "Page n of m" readout that
|
|
146
|
+
* the responsive collapse reveals.
|
|
147
|
+
*
|
|
148
|
+
* ```ts
|
|
149
|
+
* provideCngxPaginatorConfig(
|
|
150
|
+
* withPaginatorPageStatusFormat((page, totalPages) => `Seite ${page} von ${totalPages}`),
|
|
151
|
+
* );
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @category ui/paginator
|
|
155
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
156
|
+
* @since 0.1.0
|
|
157
|
+
*/
|
|
158
|
+
function withPaginatorPageStatusFormat(pageStatus) {
|
|
159
|
+
return { kind: 'formats', payload: { pageStatus } };
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Supply the default items-per-page choices for the `cngx-pgn-page-size`
|
|
163
|
+
* dropdown app-wide. The segment renders these when no per-instance `[options]`
|
|
164
|
+
* is bound; a non-empty `[options]` input still wins. The list replaces the
|
|
165
|
+
* library default wholesale - it is one atomic value, not a merged sub-tree.
|
|
166
|
+
*
|
|
167
|
+
* ```ts
|
|
168
|
+
* provideCngxPaginatorConfig(
|
|
169
|
+
* withPaginatorPageSizeOptions([12, 24, 48]),
|
|
170
|
+
* );
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @category ui/paginator
|
|
174
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
175
|
+
* @since 0.1.0
|
|
176
|
+
*/
|
|
177
|
+
function withPaginatorPageSizeOptions(payload) {
|
|
178
|
+
return { kind: 'pageSizeOptions', payload };
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Supply application-wide template-slot defaults for the paginator. The
|
|
182
|
+
* per-instance `*cngxPaginatorLoading` slot still wins over this tier; it only
|
|
183
|
+
* applies where no instance slot is projected.
|
|
184
|
+
*
|
|
185
|
+
* ```ts
|
|
186
|
+
* provideCngxPaginatorConfig(
|
|
187
|
+
* withPaginatorTemplates({ loading: myBrandedSpinnerTemplate }),
|
|
188
|
+
* );
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* @category ui/paginator
|
|
192
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
193
|
+
* @since 0.1.0
|
|
194
|
+
*/
|
|
195
|
+
function withPaginatorTemplates(payload) {
|
|
196
|
+
return { kind: 'templates', payload };
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Application-root configuration cascade for the paginator. Pass any
|
|
200
|
+
* combination of `with*` features in `bootstrapApplication`'s providers.
|
|
201
|
+
* Supplied features deep-merge with the library defaults, so consumers only
|
|
202
|
+
* declare the keys they want to override.
|
|
203
|
+
*
|
|
204
|
+
* @category ui/paginator
|
|
205
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
206
|
+
* @since 0.1.0
|
|
207
|
+
*/
|
|
208
|
+
function provideCngxPaginatorConfig(...features) {
|
|
209
|
+
// Empty-features: leave the root default reference untouched so downstream
|
|
210
|
+
// identity comparisons stay stable.
|
|
211
|
+
if (features.length === 0) {
|
|
212
|
+
return makeEnvironmentProviders([]);
|
|
213
|
+
}
|
|
214
|
+
return makeEnvironmentProviders([
|
|
215
|
+
{ provide: CNGX_PAGINATOR_CONFIG, useValue: applyFeatures(CNGX_PAGINATOR_DEFAULTS, features) },
|
|
216
|
+
]);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Component-scoped paginator configuration override. Pass into a component's
|
|
220
|
+
* or directive's `viewProviders`; features merge on top of the parent config
|
|
221
|
+
* (an enclosing scope or the application root), so a region can re-phrase its
|
|
222
|
+
* announcements or labels without disturbing the rest of the app.
|
|
223
|
+
*
|
|
224
|
+
* @category ui/paginator
|
|
225
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
226
|
+
* @since 0.1.0
|
|
227
|
+
*/
|
|
228
|
+
function provideCngxPaginatorConfigAt(...features) {
|
|
229
|
+
return [
|
|
230
|
+
{
|
|
231
|
+
provide: CNGX_PAGINATOR_CONFIG,
|
|
232
|
+
useFactory: (parent) => applyFeatures(parent ?? CNGX_PAGINATOR_DEFAULTS, features),
|
|
233
|
+
deps: [[new SkipSelf(), new Optional(), CNGX_PAGINATOR_CONFIG]],
|
|
234
|
+
},
|
|
235
|
+
];
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Convenience accessor for the paginator configuration. Runs in injection
|
|
239
|
+
* context; resolves through the cascade. Equivalent to
|
|
240
|
+
* `inject(CNGX_PAGINATOR_CONFIG)`.
|
|
241
|
+
*
|
|
242
|
+
* @category ui/paginator
|
|
243
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-config.ts
|
|
244
|
+
* @since 0.1.0
|
|
245
|
+
*/
|
|
246
|
+
function injectPaginatorConfig() {
|
|
247
|
+
return inject(CNGX_PAGINATOR_CONFIG);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* DI token the `CngxPaginator` shell provides via `useExisting`. Segment
|
|
252
|
+
* parts (`cngx-pgn-prev`, `cngx-pgn-pages`, ...) inject this rather than the
|
|
253
|
+
* concrete component class, keeping the organism decompose-ready.
|
|
254
|
+
*
|
|
255
|
+
* @category ui/paginator
|
|
256
|
+
* @wcag AA
|
|
257
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-host.token.ts
|
|
258
|
+
* @since 0.1.0
|
|
259
|
+
*/
|
|
260
|
+
const CNGX_PAGINATOR_HOST = new InjectionToken('CngxPaginatorHost');
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Builds the paginator live-region message as a single derived signal - no
|
|
264
|
+
* class logic baked into the shell, so the skin still ejects cleanly. The
|
|
265
|
+
* message is a `linkedSignal` over `[pageIndex, totalPages, isBusy]` from
|
|
266
|
+
* {@link CNGX_PAGINATOR_HOST}: it speaks "Page N of M" on every effective-page
|
|
267
|
+
* change (navigation OR a `total`-shrink clamp, so the clamp is never silent),
|
|
268
|
+
* "Loading" while busy, and "Updated" on the first settle after busy. Phrasing
|
|
269
|
+
* comes from {@link injectPaginatorConfig}.
|
|
270
|
+
*
|
|
271
|
+
* The previous source value (held by `linkedSignal`) is what distinguishes a
|
|
272
|
+
* settle from a steady state, so there is no signal write in an `effect` and no
|
|
273
|
+
* imperative `previous` tracking. Identical consecutive messages dedupe through
|
|
274
|
+
* the signal's value equality, so the live region never re-announces a no-op.
|
|
275
|
+
*
|
|
276
|
+
* Must run in an injection context (call as a field initialiser on the shell).
|
|
277
|
+
*
|
|
278
|
+
* @category ui/paginator
|
|
279
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-announcer.ts
|
|
280
|
+
* @since 0.1.0
|
|
281
|
+
*/
|
|
282
|
+
function createPaginatorAnnouncer() {
|
|
283
|
+
const host = inject(CNGX_PAGINATOR_HOST);
|
|
284
|
+
const config = injectPaginatorConfig();
|
|
285
|
+
// Sample the three drivers together so a transition is atomic. The field-wise
|
|
286
|
+
// `equal` keeps the source reference stable across a recompute that yields an
|
|
287
|
+
// identical tuple, so the linkedSignal computation never re-runs on a no-op
|
|
288
|
+
// (equality rule: an object-returning computed carries an explicit equal).
|
|
289
|
+
const source = computed(() => ({
|
|
290
|
+
page: host.pageIndex(),
|
|
291
|
+
totalPages: host.totalPages(),
|
|
292
|
+
busy: host.isBusy(),
|
|
293
|
+
}), { ...(ngDevMode ? { debugName: "source" } : /* istanbul ignore next */ {}), equal: (a, b) => a.page === b.page && a.totalPages === b.totalPages && a.busy === b.busy });
|
|
294
|
+
const message = linkedSignal({ ...(ngDevMode ? { debugName: "message" } : /* istanbul ignore next */ {}), source,
|
|
295
|
+
computation: (current, previous) => {
|
|
296
|
+
const { announcements } = config;
|
|
297
|
+
if (current.busy) {
|
|
298
|
+
return announcements.loading;
|
|
299
|
+
}
|
|
300
|
+
// Just left a busy state: announce the settle once, before page phrasing.
|
|
301
|
+
if (previous?.source.busy) {
|
|
302
|
+
return announcements.updated;
|
|
303
|
+
}
|
|
304
|
+
return announcements.pageChange(current.page + 1, current.totalPages);
|
|
305
|
+
} });
|
|
306
|
+
return { message };
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Swap token for the live-region announcer derivation. The default resolves to
|
|
310
|
+
* {@link createPaginatorAnnouncer}; the shell builds its announcer via
|
|
311
|
+
* `inject(CNGX_PAGINATOR_ANNOUNCER_FACTORY)()` rather than calling the factory
|
|
312
|
+
* directly. Override it to wrap the busy / settle / page-change derivation - a
|
|
313
|
+
* telemetry tap, politeness escalation, or custom phrasing branch - without
|
|
314
|
+
* forking the shell (mirrors `CNGX_COMMIT_ERROR_ANNOUNCER_FACTORY` in the
|
|
315
|
+
* select family). The override runs in the shell's injection context, so it can
|
|
316
|
+
* still `inject(CNGX_PAGINATOR_HOST)` / {@link injectPaginatorConfig}.
|
|
317
|
+
*
|
|
318
|
+
* @category ui/paginator
|
|
319
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-announcer.ts
|
|
320
|
+
* @since 0.1.0
|
|
321
|
+
*/
|
|
322
|
+
const CNGX_PAGINATOR_ANNOUNCER_FACTORY = new InjectionToken('CngxPaginatorAnnouncerFactory', {
|
|
323
|
+
providedIn: 'root',
|
|
324
|
+
factory: () => createPaginatorAnnouncer,
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Overrides the paginator's built-in busy indicator. Project a structural
|
|
329
|
+
* `*cngxPaginatorLoading` template inside `<cngx-paginator>` and the shell
|
|
330
|
+
* renders it - instead of the default `<cngx-progress>` bar - while the bound
|
|
331
|
+
* async state is busy. Resolution cascades instance slot ->
|
|
332
|
+
* `CngxPaginatorConfig.templates.loading` -> built-in `CngxProgress`.
|
|
333
|
+
*
|
|
334
|
+
* ```html
|
|
335
|
+
* <cngx-paginator [state]="state">
|
|
336
|
+
* <ng-template cngxPaginatorLoading>
|
|
337
|
+
* <my-branded-spinner />
|
|
338
|
+
* </ng-template>
|
|
339
|
+
* <cngx-pgn-pages />
|
|
340
|
+
* </cngx-paginator>
|
|
341
|
+
* ```
|
|
342
|
+
*
|
|
343
|
+
* @category ui/paginator
|
|
344
|
+
* @wcag AA
|
|
345
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/loading/busy</example-url>
|
|
346
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator-loading.directive.ts
|
|
347
|
+
* @since 0.1.0
|
|
348
|
+
* @relatedTo CngxPaginator, CngxProgress
|
|
349
|
+
*/
|
|
350
|
+
class CngxPaginatorLoading {
|
|
351
|
+
templateRef = inject(TemplateRef);
|
|
352
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorLoading, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
353
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxPaginatorLoading, isStandalone: true, selector: "[cngxPaginatorLoading]", exportAs: ["cngxPaginatorLoading"], ngImport: i0 });
|
|
354
|
+
}
|
|
355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorLoading, decorators: [{
|
|
356
|
+
type: Directive,
|
|
357
|
+
args: [{ selector: '[cngxPaginatorLoading]', standalone: true, exportAs: 'cngxPaginatorLoading' }]
|
|
358
|
+
}] });
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Declarative, skinnable pagination organism. \
|
|
362
|
+
* A thin shell over the `CngxPaginate` brain (applied as a `hostDirective`), assembled by the
|
|
363
|
+
* consumer from projected segment parts in DOM order - no `show*` config inputs.
|
|
364
|
+
* `skin` / `density` are single paint attributes reflected onto `[data-skin]` / `[data-density]`. \
|
|
365
|
+
*
|
|
366
|
+
* Two-way `[(pageIndex)]` / `[(pageSize)]`: \
|
|
367
|
+
* the brain's controlled inputs are aliased through `hostDirectives` (`cngxPageIndex` -> `pageIndex`, `cngxPageSize` -> `pageSize`); \
|
|
368
|
+
* the shell owns the matching `pageIndexChange` / `pageSizeChange` outputs and is their single emitter,
|
|
369
|
+
* wired through the shared `connectPaginateEmit` bridge (identical to `CngxIncrementalList`). \
|
|
370
|
+
* The bridge feeds each output once from two paths:
|
|
371
|
+
* (1) a subscription forwards the brain's nav-only `pageChange` /
|
|
372
|
+
* `pageSizeChange` - the only signal that captures a controlled-mode `setPage`,
|
|
373
|
+
* because the brain's `pageIndex()` stays pinned to the input until the
|
|
374
|
+
* consumer feeds it back; \
|
|
375
|
+
* (2) an `effect()` reads the effective `pageIndex()` / `pageSize()` and covers a `total`-shrink clamp the nav-only
|
|
376
|
+
* output misses. \
|
|
377
|
+
* The brain output is forwarded, NOT aliased through
|
|
378
|
+
* `hostDirectives`: \
|
|
379
|
+
* a raw alias would bypass the shared guard and double-emit
|
|
380
|
+
* on uncontrolled navigation.
|
|
381
|
+
*
|
|
382
|
+
* All ARIA attributes are signal-driven. `aria-busy` has a single owner here.
|
|
383
|
+
*
|
|
384
|
+
* @category ui/paginator
|
|
385
|
+
* @docsKind primary
|
|
386
|
+
* @wcag AA
|
|
387
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/paginator.component.ts
|
|
388
|
+
* @since 0.1.0
|
|
389
|
+
* @relatedTo CngxPaginate, CngxMatPaginator
|
|
390
|
+
* @playground Material theme coverage across all skins ./examples/material-theme-coverage/skins-coverage.component.ts
|
|
391
|
+
* @playground Data-table footer (Material) ./examples/data-table/data-table.component.ts
|
|
392
|
+
* @playground Live filter with reset-to-first-page ./examples/filter-reset/filter-reset.component.ts
|
|
393
|
+
* @playground Card grid with go-to and responsive collapse ./examples/card-grid/card-grid.component.ts
|
|
394
|
+
* @playground Alphabetical bucket paging ./examples/alpha-mode/alpha-mode.component.ts
|
|
395
|
+
* @playground Load-more (append) paging ./examples/load-more-mode/load-more-mode.component.ts
|
|
396
|
+
* @playground Infinite scroll paging ./examples/infinite-mode/infinite-mode.component.ts
|
|
397
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-skins/numbered</example-url>
|
|
398
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-skins/minimal</example-url>
|
|
399
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-skins/pill</example-url>
|
|
400
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-skins/segmented</example-url>
|
|
401
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-skins/rail</example-url>
|
|
402
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-skins/dots</example-url>
|
|
403
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-skins/bar</example-url>
|
|
404
|
+
*/
|
|
405
|
+
class CngxPaginator {
|
|
406
|
+
/** Accessible name for the navigation landmark. Overrides the config default. */
|
|
407
|
+
ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
408
|
+
/** Visual skin; reflected onto `[data-skin]`. */
|
|
409
|
+
skin = input('numbered', ...(ngDevMode ? [{ debugName: "skin" }] : /* istanbul ignore next */ []));
|
|
410
|
+
/**
|
|
411
|
+
* Private size preset (hit-target + type); reflected onto
|
|
412
|
+
* `[data-paginator-size]`, NOT the global `[data-density]`. Spacing is a
|
|
413
|
+
* global concern derived from `--cngx-space-*`, so a root `[data-density]`
|
|
414
|
+
* compacts this paginator's gaps like every other component; this input keeps
|
|
415
|
+
* only the touch-target sizing the global scale does not yet cover.
|
|
416
|
+
*/
|
|
417
|
+
density = input('default', ...(ngDevMode ? [{ debugName: "density" }] : /* istanbul ignore next */ []));
|
|
418
|
+
/**
|
|
419
|
+
* Opt into the responsive collapse; reflected onto `[data-responsive]`. When
|
|
420
|
+
* set, a `@container` rule swaps the projected `cngx-pgn-pages` number row for
|
|
421
|
+
* a `cngx-pgn-status` "Page n of m" readout once the paginator's own container
|
|
422
|
+
* narrows past the collapse breakpoint. Compose both segments for it to apply.
|
|
423
|
+
*/
|
|
424
|
+
responsive = input(false, { ...(ngDevMode ? { debugName: "responsive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
425
|
+
/**
|
|
426
|
+
* Reset key. When its value changes (after the initial render) the paginator
|
|
427
|
+
* jumps to the first page - bind the sort / filter / search value a result set
|
|
428
|
+
* depends on so a narrowed result never strands the user on a now-empty page.
|
|
429
|
+
* Bind a primitive or a `computed`; an inline array / object literal
|
|
430
|
+
* recomputes every change-detection pass and would reset on each. Shares the
|
|
431
|
+
* `connectPaginateResetOn` implementation with `[cngxPaginateResetOn]`.
|
|
432
|
+
*/
|
|
433
|
+
resetOn = input(undefined, ...(ngDevMode ? [{ debugName: "resetOn" }] : /* istanbul ignore next */ []));
|
|
434
|
+
/** Emits the effective page index on every change - navigation or `total`-shrink clamp. */
|
|
435
|
+
pageIndexChange = output();
|
|
436
|
+
/** Emits the effective page size on every change. */
|
|
437
|
+
pageSizeChange = output();
|
|
438
|
+
paginate = inject(CngxPaginate);
|
|
439
|
+
config = injectPaginatorConfig();
|
|
440
|
+
/**
|
|
441
|
+
* Live-region message source - mounted onto the `cngxLiveRegion` span in the
|
|
442
|
+
* template. Built through the swap token so a consumer can wrap the
|
|
443
|
+
* busy / settle / page-change derivation without forking the shell.
|
|
444
|
+
*/
|
|
445
|
+
announcer = inject(CNGX_PAGINATOR_ANNOUNCER_FACTORY)();
|
|
446
|
+
resolvedAriaLabel = computed(() => this.ariaLabel() ?? this.config.ariaLabels.label, ...(ngDevMode ? [{ debugName: "resolvedAriaLabel" }] : /* istanbul ignore next */ []));
|
|
447
|
+
// Loading-slot cascade: instance *cngxPaginatorLoading -> config default ->
|
|
448
|
+
// built-in <cngx-progress>. Direct contentChild field initialiser (AOT
|
|
449
|
+
// NG8110 rejects it from a helper). Returns existing TemplateRef references
|
|
450
|
+
// or null - reference-stable, so no explicit equal fn is needed.
|
|
451
|
+
loadingSlot = contentChild(CngxPaginatorLoading, { ...(ngDevMode ? { debugName: "loadingSlot" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
452
|
+
loadingTemplate = computed(() => this.loadingSlot() ?? this.config.templates?.loading ?? null, ...(ngDevMode ? [{ debugName: "loadingTemplate" }] : /* istanbul ignore next */ []));
|
|
453
|
+
constructor() {
|
|
454
|
+
// Reset-on-change, shared verbatim with the bridge input and the generic
|
|
455
|
+
// [cngxPaginateResetOn] directive.
|
|
456
|
+
connectPaginateResetOn(this.paginate, this.resetOn);
|
|
457
|
+
// Two-way [(pageIndex)] / [(pageSize)] emit, shared verbatim with
|
|
458
|
+
// CngxIncrementalList through the connectPaginateEmit bridge.
|
|
459
|
+
connectPaginateEmit(this.paginate, {
|
|
460
|
+
onIndex: (index) => this.pageIndexChange.emit(index),
|
|
461
|
+
onSize: (size) => this.pageSizeChange.emit(size),
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginator, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
465
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxPaginator, isStandalone: true, selector: "cngx-paginator", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, skin: { classPropertyName: "skin", publicName: "skin", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null }, resetOn: { classPropertyName: "resetOn", publicName: "resetOn", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageIndexChange: "pageIndexChange", pageSizeChange: "pageSizeChange" }, host: { attributes: { "role": "navigation" }, properties: { "attr.aria-label": "resolvedAriaLabel()", "attr.aria-busy": "paginate.isBusy()", "attr.data-skin": "skin()", "attr.data-paginator-size": "density()", "attr.data-responsive": "responsive() ? '' : null" }, classAttribute: "cngx-paginator" }, providers: [{ provide: CNGX_PAGINATOR_HOST, useExisting: CngxPaginate }], queries: [{ propertyName: "loadingSlot", first: true, predicate: CngxPaginatorLoading, descendants: true, read: TemplateRef, isSignal: true }], exportAs: ["cngxPaginator"], hostDirectives: [{ directive: i1.CngxPaginate, inputs: ["cngxPageIndex", "pageIndex", "cngxPageSize", "pageSize", "total", "total", "state", "state"] }], ngImport: i0, template: "@if (paginate.isBusy()) {\n @if (loadingTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n <cngx-progress\n class=\"cngx-paginator__progress\"\n variant=\"linear\"\n [state]=\"paginate.state()\"\n [label]=\"config.announcements.loading\"\n />\n }\n}\n\n<ng-content />\n\n<span cngxLiveRegion class=\"cngx-paginator__sr\">{{ announcer.message() }}</span>\n", styles: ["@layer cngx.components{.cngx-paginator{position:relative;display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;--cngx-paginator-row-gap: var(--cngx-space-sm);--cngx-paginator-gap: var(--cngx-space-xs);gap:var(--cngx-paginator-row-gap, .75rem);font-family:var( --cngx-paginator-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif );font-size:var(--cngx-paginator-font-size, .875rem)}.cngx-paginator__progress{position:absolute;inset-inline:0;inset-block-start:0;block-size:var(--cngx-paginator-progress-thickness, 2px);--cngx-progress-color: var( --cngx-paginator-progress-color, var(--cngx-color-primary, oklch(.66 .19 50)) )}.cngx-paginator__segment{display:inline-flex;align-items:center}.cngx-paginator__nav-label,.cngx-paginator__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}.cngx-paginator__pages{display:inline-flex;flex-direction:row;align-items:center;gap:var(--cngx-paginator-gap, .25rem)}.cngx-paginator__button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:var(--cngx-paginator-button-size, 2.25rem);height:var(--cngx-paginator-button-size, 2.25rem);padding:var(--cngx-paginator-button-padding, 0 .5rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-button-border-color, transparent);border-radius:var(--cngx-paginator-button-radius, .375rem);background:var(--cngx-paginator-button-bg, transparent);color:var(--cngx-paginator-button-color, currentColor);font:inherit;line-height:1;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background var(--cngx-paginator-transition, .15s ease)}.cngx-paginator__button:hover{background:var( --cngx-paginator-button-hover-bg, color-mix(in oklch, currentColor 10%, transparent) )}.cngx-paginator__button:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__button[aria-disabled=true],.cngx-paginator__button:disabled{cursor:not-allowed;opacity:var(--cngx-paginator-disabled-opacity, .45)}.cngx-paginator__page[aria-current=page]{background:var( --cngx-paginator-current-bg, color-mix(in oklch, currentColor 12%, transparent) );color:var(--cngx-paginator-current-color, currentColor);border-color:var(--cngx-paginator-current-border-color, transparent);font-weight:600}.cngx-paginator__range,.cngx-paginator__status{font-variant-numeric:tabular-nums;color:var(--cngx-paginator-range-color, currentColor);white-space:nowrap}.cngx-paginator__load-more{gap:var(--cngx-paginator-load-more-gap, .5rem);white-space:nowrap}.cngx-paginator__load-more-count{font-variant-numeric:tabular-nums;color:var( --cngx-paginator-load-more-count-color, color-mix(in oklch, currentColor 60%, transparent) )}.cngx-paginator__goto-input{box-sizing:border-box;width:var(--cngx-paginator-goto-width, 3.5rem);height:var(--cngx-paginator-button-size, 2.25rem);padding:var(--cngx-paginator-goto-padding, 0 .5rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-goto-border-color, color-mix(in oklch, currentColor 25%, transparent));border-radius:var(--cngx-paginator-button-radius, .375rem);background:var(--cngx-paginator-button-bg, transparent);color:var(--cngx-paginator-button-color, currentColor);font:inherit;font-variant-numeric:tabular-nums}.cngx-paginator__goto-input:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__select{gap:var(--cngx-paginator-select-gap, .25rem);font-variant-numeric:tabular-nums}.cngx-paginator__select-caret{display:inline-flex;font-size:var(--cngx-paginator-caret-size, 1em);line-height:1;opacity:var(--cngx-paginator-caret-opacity, .55)}.cngx-paginator__select-panel{margin:0;padding:var(--cngx-paginator-panel-padding, .25rem);list-style:none;border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-panel-border-color, color-mix(in oklch, currentColor 20%, transparent));border-radius:var(--cngx-paginator-panel-radius, .5rem);background:var(--cngx-paginator-panel-bg, Canvas);color:var(--cngx-paginator-panel-color, currentColor);box-shadow:var(--cngx-paginator-panel-shadow, 0 4px 12px rgb(0 0 0 / .15))}.cngx-paginator__option{display:flex;align-items:center;min-height:var(--cngx-paginator-option-size, 2rem);padding:var(--cngx-paginator-option-padding, 0 .75rem);border-radius:var(--cngx-paginator-option-radius, .25rem);cursor:pointer;font-variant-numeric:tabular-nums}.cngx-paginator__overflow-panel{margin:0;padding:var(--cngx-paginator-panel-padding, .25rem);list-style:none;display:grid;grid-template-columns:repeat(var(--cngx-paginator-overflow-columns, 5),var(--cngx-paginator-overflow-cell-size, 2rem));gap:var(--cngx-paginator-overflow-gap, .15rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-panel-border-color, color-mix(in oklch, currentColor 20%, transparent));border-radius:var(--cngx-paginator-panel-radius, .5rem);background:var(--cngx-paginator-panel-bg, Canvas);color:var(--cngx-paginator-panel-color, currentColor);box-shadow:var(--cngx-paginator-panel-shadow, 0 4px 12px rgb(0 0 0 / .15))}.cngx-paginator__overflow-panel .cngx-paginator__option{justify-content:center;min-block-size:var(--cngx-paginator-overflow-cell-size, 2rem);padding:var(--cngx-paginator-overflow-cell-padding, 0)}.cngx-paginator__overflow-panel:focus,.cngx-paginator__overflow-panel:focus-visible{outline:none}[popover]:has(>.cngx-paginator__select-panel),[popover]:has(>.cngx-paginator__overflow-panel){margin:0;padding:0;border:0;overflow:visible;background:none}.cngx-paginator__option.cngx-option--highlighted,.cngx-paginator__option.cngx-menu-item--highlighted{background:var( --cngx-paginator-option-hover-bg, color-mix(in oklch, currentColor 10%, transparent) )}.cngx-paginator__option.cngx-option--selected{background:var( --cngx-paginator-option-selected-bg, color-mix(in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 14%, transparent) );color:var(--cngx-paginator-option-selected-color, var(--cngx-color-primary, oklch(.66 .19 50)));font-weight:600}.cngx-paginator[data-paginator-size=compact]{--cngx-paginator-button-size: 1.75rem;font-size:var(--cngx-paginator-font-size-compact, .8125rem)}.cngx-paginator[data-paginator-size=comfortable]{--cngx-paginator-button-size: 2.75rem;font-size:var(--cngx-paginator-font-size-comfortable, .95rem)}.cngx-paginator__dots{display:inline-flex;align-items:center}.cngx-paginator__dots--windowed{overflow-x:clip;overflow-y:visible;max-width:calc(7 * var(--cngx-paginator-dot-size, .5rem) + 6 * var(--cngx-paginator-dot-gap, .5rem))}.cngx-paginator__dots-track{display:inline-flex;flex-direction:row;align-items:center;gap:var(--cngx-paginator-dot-gap, .5rem);transform:translate(calc(var(--cngx-paginator-dots-shift, 0) * -1 * (var(--cngx-paginator-dot-size, .5rem) + var(--cngx-paginator-dot-gap, .5rem))));transition:transform var(--cngx-paginator-motion-duration, .2s) ease}.cngx-paginator__dot{box-sizing:border-box;width:var(--cngx-paginator-dot-size, .5rem);height:var(--cngx-paginator-dot-size, .5rem);padding:0;border:0;border-radius:50%;background:var(--cngx-paginator-dot-color, color-mix(in oklch, currentColor 35%, transparent));cursor:pointer;transition:transform var(--cngx-paginator-transition, .15s ease),background var(--cngx-paginator-transition, .15s ease)}.cngx-paginator__dot[data-size=medium]{transform:scale(var(--cngx-paginator-dot-medium-scale, .7))}.cngx-paginator__dot[data-size=small]{transform:scale(var(--cngx-paginator-dot-small-scale, .45))}.cngx-paginator__dot--current{background:var( --cngx-paginator-dot-current-color, var(--cngx-color-primary, oklch(.66 .19 50)) );transform:scale(var(--cngx-paginator-dot-current-scale, 1.15))}.cngx-paginator__dot:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__dot[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-paginator-disabled-opacity, .45)}.cngx-paginator__rail{position:relative;display:flex;align-items:center;flex:1 1 auto;min-inline-size:var(--cngx-paginator-rail-min-size, 6rem)}.cngx-paginator__rail cngx-progress{flex:1 1 auto;--cngx-progress-height: var(--cngx-paginator-rail-height, .375rem);--cngx-progress-color: var( --cngx-paginator-rail-fill, var(--cngx-color-primary, oklch(.66 .19 50)) );--cngx-progress-track-color: var( --cngx-paginator-rail-track, var(--cngx-color-border, oklch(.9 .005 250)) )}.cngx-paginator__rail-knob{position:absolute;inset-block-start:50%;inset-inline-start:0;inline-size:var(--cngx-paginator-rail-knob-size, .875rem);block-size:var(--cngx-paginator-rail-knob-size, .875rem);border-radius:50%;background:var(--cngx-paginator-rail-knob-bg, oklch(1 0 0));border:var(--cngx-paginator-rail-knob-border-width, 2px) solid var(--cngx-paginator-rail-knob-border-color, oklch(.66 .19 50));transform:translate(-50%,-50%);transition:inset-inline-start var(--cngx-paginator-motion-duration, .2s) cubic-bezier(.3,.7,0,1)}.cngx-paginator__infinite{display:flex;align-items:center;justify-content:center;gap:var(--cngx-paginator-infinite-gap, .5rem);padding:var(--cngx-paginator-infinite-padding, .9rem);color:var(--cngx-paginator-infinite-color, color-mix(in oklch, currentColor 60%, transparent))}.cngx-paginator__infinite-status,.cngx-paginator__infinite-end{font-size:var(--cngx-paginator-infinite-font-size, .8125rem)}.cngx-paginator__infinite-spinner{inline-size:var(--cngx-paginator-infinite-spinner-size, 1rem);block-size:var(--cngx-paginator-infinite-spinner-size, 1rem);border-radius:50%;border:var(--cngx-paginator-infinite-spinner-width, 2px) solid color-mix(in oklch,var(--cngx-color-primary, oklch(.66 .19 50)) 30%,transparent);border-block-start-color:var(--cngx-color-primary, oklch(.66 .19 50));animation:cngx-paginator-spin var(--cngx-paginator-infinite-spinner-duration, .7s) linear infinite}@keyframes cngx-paginator-spin{to{transform:rotate(360deg)}}.cngx-paginator__alpha{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cngx-paginator-alpha-gap, .4rem)}.cngx-paginator__alpha-chip{border-color:var( --cngx-paginator-alpha-chip-border-color, var(--cngx-color-border, oklch(.88 .005 250)) );background:var(--cngx-paginator-alpha-chip-bg, var(--cngx-color-surface, oklch(1 0 0)));font-weight:500}.cngx-paginator__alpha-chip:hover:not([aria-pressed=true]):not(:disabled){border-color:var(--cngx-color-primary, oklch(.66 .19 50));color:var(--cngx-color-primary, oklch(.66 .19 50))}.cngx-paginator__alpha-chip[aria-pressed=true]{background:var(--cngx-paginator-current-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-paginator-current-color, var(--cngx-color-on-primary, oklch(1 0 0)));border-color:var( --cngx-paginator-current-border-color, var(--cngx-color-primary, oklch(.66 .19 50)) );font-weight:600}@media(prefers-reduced-motion:reduce){.cngx-paginator__button,.cngx-paginator__dot,.cngx-paginator__dots-track{transition:none}.cngx-paginator__infinite-spinner{animation:none}}}\n", "@layer cngx.tokens{@property --cngx-paginator-gap{syntax: \"*\"; inherits: true; initial-value: .25rem;}@property --cngx-paginator-row-gap{syntax: \"<length>\"; inherits: true; initial-value: .75rem;}@property --cngx-paginator-font-size{syntax: \"<length>\"; inherits: true; initial-value: .875rem;}@property --cngx-paginator-button-size{syntax: \"<length>\"; inherits: true; initial-value: 2.25rem;}@property --cngx-paginator-button-radius{syntax: \"<length>\"; inherits: true; initial-value: .5rem;}@property --cngx-paginator-button-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-paginator-button-bg{syntax: \"*\"; inherits: true; initial-value: transparent;}@property --cngx-paginator-button-hover-bg{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklch,currentColor 10%,transparent);}@property --cngx-paginator-button-border-color{syntax: \"<color>\"; inherits: true; initial-value: transparent;}@property --cngx-paginator-current-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-paginator-current-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-paginator-current-border-color{syntax: \"<color>\"; inherits: true; initial-value: transparent;}@property --cngx-paginator-focus-ring{syntax: \"*\"; inherits: true; initial-value: 2px solid currentColor;}@property --cngx-paginator-disabled-opacity{syntax: \"<number>\"; inherits: true; initial-value: .45;}@property --cngx-paginator-track-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 0 0);}@property --cngx-paginator-active-shadow{syntax: \"*\"; inherits: true; initial-value: 0 1px 2px oklch(0 0 0 / .06);}@property --cngx-paginator-indicator-thickness{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-paginator-rail-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-paginator-rail-thickness{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-paginator-rail-knob-size{syntax: \"<length>\"; inherits: true; initial-value: .875rem;}@property --cngx-paginator-rail-knob-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-paginator-rail-knob-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-paginator-bar-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-paginator-bar-radius{syntax: \"<length>\"; inherits: true; initial-value: .375rem;}@property --cngx-paginator-hover-scale{syntax: \"<number>\"; inherits: true; initial-value: 1;}@property --cngx-paginator-press-scale{syntax: \"<number>\"; inherits: true; initial-value: 1;}@property --cngx-paginator-motion-duration{syntax: \"<time>\"; inherits: true; initial-value: .2s;}@property --cngx-paginator-fade-duration{syntax: \"<time>\"; inherits: true; initial-value: .25s;}@property --cngx-paginator-busy-opacity{syntax: \"<number>\"; inherits: true; initial-value: .6;}@property --cngx-paginator-focus-halo{syntax: \"*\"; inherits: true; initial-value: 0 0 0 4px color-mix(in oklch,currentColor 18%,transparent);}@property --cngx-paginator-dot-size{syntax: \"<length>\"; inherits: true; initial-value: .5rem;}@property --cngx-paginator-dot-gap{syntax: \"<length>\"; inherits: true; initial-value: .5rem;}@property --cngx-paginator-dot-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.7 0 0 / .35);}@property --cngx-paginator-dot-current-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-paginator-panel-bg{syntax: \"*\"; inherits: true; initial-value: Canvas;}@property --cngx-paginator-panel-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-paginator-panel-border-color{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklch,currentColor 20%,transparent);}@property --cngx-paginator-panel-radius{syntax: \"<length>\"; inherits: true; initial-value: .5rem;}@property --cngx-paginator-panel-padding{syntax: \"*\"; inherits: true; initial-value: .25rem;}@property --cngx-paginator-panel-shadow{syntax: \"*\"; inherits: true; initial-value: 0 4px 12px rgb(0 0 0 / .15);}@property --cngx-paginator-option-size{syntax: \"<length>\"; inherits: true; initial-value: 2rem;}@property --cngx-paginator-option-padding{syntax: \"*\"; inherits: true; initial-value: 0 .75rem;}@property --cngx-paginator-option-radius{syntax: \"<length>\"; inherits: true; initial-value: .25rem;}@property --cngx-paginator-option-hover-bg{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklch,currentColor 10%,transparent);}@property --cngx-paginator-option-selected-bg{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklch,var(--cngx-color-primary, oklch(.66 .19 50)) 14%,transparent);}@property --cngx-paginator-option-selected-color{syntax: \"*\"; inherits: true; initial-value: var(--cngx-color-primary, oklch(.66 .19 50));}@property --cngx-paginator-overflow-columns{syntax: \"<integer>\"; inherits: true; initial-value: 5;}@property --cngx-paginator-overflow-cell-size{syntax: \"<length>\"; inherits: true; initial-value: 2rem;}:root{--cngx-paginator-current-bg: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-border-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-focus-ring: 2px solid var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-focus-halo: 0 0 0 4px color-mix(in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 18%, transparent);--cngx-paginator-dot-current-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{@scope(.cngx-paginator[data-skin=numbered]){:scope{--cngx-paginator-current-bg: transparent;--cngx-paginator-current-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-border-color: transparent;--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 12%, transparent )}.cngx-paginator__page{position:relative}.cngx-paginator__page:after{content:\"\";position:absolute;inset-inline:var(--cngx-paginator-indicator-inset, 18%);inset-block-end:var(--cngx-paginator-indicator-offset, 4px);block-size:var(--cngx-paginator-indicator-thickness, 2px);border-radius:var(--cngx-paginator-indicator-thickness, 2px) var(--cngx-paginator-indicator-thickness, 2px) 0 0;background:var(--cngx-color-primary, oklch(.66 .19 50));transform:scaleX(0);transition:transform var(--cngx-paginator-motion-duration, .2s) ease}.cngx-paginator__page:hover:not([aria-current=page]):after{transform:scaleX(var(--cngx-paginator-indicator-hover-scale, .5))}.cngx-paginator__page[aria-current=page]:after{transform:scaleX(1)}}@scope(.cngx-paginator[data-skin=pill]){:scope{--cngx-paginator-gap: var(--cngx-space-xs);--cngx-paginator-button-radius: 100px;--cngx-paginator-current-bg: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-color: var(--cngx-color-on-primary, oklch(1 0 0));--cngx-paginator-current-border-color: transparent;--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 8%, transparent )}}@scope(.cngx-paginator[data-skin=segmented]){:scope{--cngx-paginator-button-radius: .375rem;--cngx-paginator-track-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 25% );--cngx-paginator-current-bg: var(--cngx-color-surface, oklch(1 0 0));--cngx-paginator-current-color: currentColor;--cngx-paginator-current-border-color: transparent;--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 45% )}.cngx-paginator__pages{background:var(--cngx-paginator-track-bg, oklch(.96 0 0));border-radius:var(--cngx-paginator-button-radius, .375rem);padding:var(--cngx-paginator-segmented-track-padding, .25rem)}.cngx-paginator__page[aria-current=page]{box-shadow:var(--cngx-paginator-active-shadow, 0 1px 2px oklch(0 0 0 / .06))}}@scope(.cngx-paginator[data-skin=minimal]){:scope{--cngx-paginator-row-gap: var(--cngx-space-sm);--cngx-paginator-gap: var(--cngx-space-xs);--cngx-paginator-button-bg: transparent;--cngx-paginator-button-hover-bg: transparent;--cngx-paginator-button-border-color: transparent;--cngx-paginator-current-bg: transparent;--cngx-paginator-current-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-border-color: transparent}.cngx-paginator__page:hover:not([aria-disabled=true]),.cngx-paginator__page[aria-current=page]{text-decoration:underline;text-underline-offset:.25em}.cngx-paginator__status{min-inline-size:var(--cngx-paginator-status-min-size, 5.5rem);text-align:center}:scope[data-nav-labels] .cngx-paginator__nav{gap:var(--cngx-paginator-minimal-nav-gap, .4rem);padding-inline:var(--cngx-paginator-minimal-nav-padding, .85rem);border-color:var(--cngx-color-border, oklch(.88 .005 250))}:scope[data-nav-labels] cngx-pgn-next .cngx-paginator__nav,:scope[data-nav-labels] cngx-pgn-last .cngx-paginator__nav{flex-direction:row-reverse}:scope[data-nav-labels] .cngx-paginator__nav .cngx-paginator__nav-label{position:static;width:auto;height:auto;margin:0;clip:auto;clip-path:none;overflow:visible;white-space:nowrap;font-weight:500}:scope[data-nav-labels] .cngx-paginator__nav:hover:not([aria-disabled=true]){border-color:var(--cngx-color-primary, oklch(.66 .19 50));color:var(--cngx-color-primary, oklch(.66 .19 50))}}@scope(.cngx-paginator[data-skin=rail]){:scope{--cngx-paginator-row-gap: var(--cngx-space-md)}}@scope(.cngx-paginator[data-skin=bar]){:scope{--cngx-paginator-row-gap: 0;--cngx-paginator-gap: 0;--cngx-paginator-button-radius: 0;--cngx-paginator-current-bg: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-color: var(--cngx-color-on-primary, oklch(1 0 0));--cngx-paginator-current-border-color: transparent;--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 10%, transparent );width:max-content;max-width:100%;min-block-size:var(--cngx-paginator-button-size, 2.25rem);border:1px solid var(--cngx-paginator-bar-border-color, oklch(.88 .005 250));border-radius:var(--cngx-paginator-bar-radius, .375rem);overflow:clip;overflow-clip-margin:var(--cngx-paginator-bar-clip-margin, .5rem)}:scope>.cngx-paginator__segment{align-self:stretch;align-items:stretch;border-inline-start:1px solid var(--cngx-paginator-bar-border-color, oklch(.88 .005 250))}:scope>.cngx-paginator__segment:first-child{border-inline-start:0}.cngx-paginator__segment>.cngx-paginator__button{align-self:stretch;block-size:auto;border-radius:0;padding-inline:var(--cngx-paginator-bar-cell-padding, .85rem)}.cngx-paginator__segment:is(cngx-pgn-first,cngx-pgn-prev,cngx-pgn-next,cngx-pgn-last)>.cngx-paginator__button{padding-inline:0}.cngx-paginator__range,.cngx-paginator__status{align-self:center;padding-inline:var(--cngx-paginator-bar-cell-padding, .85rem)}:scope>span.cngx-paginator__segment{align-items:center;padding-inline:var(--cngx-paginator-bar-cell-padding, .85rem)}.cngx-paginator__pages{gap:0;align-self:stretch}.cngx-paginator__pages .cngx-paginator__button{align-self:stretch;block-size:auto;border-radius:0;border-inline-start:1px solid var(--cngx-paginator-bar-border-color, oklch(.88 .005 250));padding-inline:var(--cngx-paginator-bar-page-padding, .5rem)}.cngx-paginator__pages .cngx-paginator__button:first-child{border-inline-start:0}}@scope(.cngx-paginator[data-skin=dots]){:scope{--cngx-paginator-row-gap: var(--cngx-space-md);--cngx-paginator-gap: var(--cngx-space-sm);--cngx-paginator-dot-gap: var(--cngx-space-sm);--cngx-paginator-dot-size: .5625rem;--cngx-paginator-dot-color: color-mix(in oklch, currentColor 30%, transparent);--cngx-paginator-dot-current-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@scope(.cngx-paginator){.cngx-paginator__button{transition:background var(--cngx-paginator-motion-duration, .2s) ease,transform var(--cngx-paginator-motion-duration, .2s) ease,box-shadow var(--cngx-paginator-motion-duration, .2s) ease}.cngx-paginator__button:hover:not([aria-disabled=true]){transform:scale(var(--cngx-paginator-hover-scale, 1))}.cngx-paginator__button:active:not([aria-disabled=true]){transform:scale(var(--cngx-paginator-press-scale, 1))}.cngx-paginator__button:focus-visible{box-shadow:var( --cngx-paginator-focus-halo, 0 0 0 4px color-mix(in oklch, currentColor 18%, transparent) )}.cngx-paginator__pages{transition:opacity var(--cngx-paginator-fade-duration, .25s) ease}:scope[aria-busy=true] .cngx-paginator__pages{opacity:var(--cngx-paginator-busy-opacity, .6)}@media(prefers-reduced-motion:reduce){:scope{--cngx-paginator-hover-scale: 1;--cngx-paginator-press-scale: 1}.cngx-paginator__button,.cngx-paginator__pages,.cngx-paginator__page:after,.cngx-paginator__rail-knob{transition:none}}}.cngx-paginator:not([data-skin=bar]){container-type:inline-size;container-name:cngx-paginator}@container cngx-paginator (max-width: 30rem){cngx-pgn-goto{display:none}}@container cngx-paginator (max-width: 24rem){cngx-pgn-first,cngx-pgn-last{display:none}}.cngx-paginator[data-responsive] cngx-pgn-status{display:none}@container cngx-paginator (max-width: 24rem){.cngx-paginator[data-responsive] cngx-pgn-pages{display:none}.cngx-paginator[data-responsive] cngx-pgn-status{display:inline-flex}}@media(pointer:coarse){.cngx-paginator{--cngx-paginator-button-size: 2.75rem}}[dir=rtl] .cngx-paginator__nav .cngx-icon{transform:scaleX(-1)}}@media(prefers-color-scheme:dark){.cngx-paginator[data-skin=numbered]{--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.72 .18 50)) 24%, transparent )}.cngx-paginator[data-skin=segmented]{--cngx-paginator-active-shadow: 0 1px 3px oklch(0 0 0 / .3)}}\n"], dependencies: [{ kind: "component", type: CngxProgress, selector: "cngx-progress", inputs: ["state", "progress", "variant", "showLabel", "label"] }, { kind: "directive", type: CngxLiveRegion, selector: "[cngxLiveRegion]", inputs: ["politeness", "atomic", "relevant"], exportAs: ["cngxLiveRegion"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
466
|
+
}
|
|
467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginator, decorators: [{
|
|
468
|
+
type: Component,
|
|
469
|
+
args: [{ selector: 'cngx-paginator', exportAs: 'cngxPaginator', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxProgress, CngxLiveRegion, NgTemplateOutlet], hostDirectives: [
|
|
470
|
+
{
|
|
471
|
+
directive: CngxPaginate,
|
|
472
|
+
inputs: ['cngxPageIndex: pageIndex', 'cngxPageSize: pageSize', 'total', 'state'],
|
|
473
|
+
},
|
|
474
|
+
], providers: [{ provide: CNGX_PAGINATOR_HOST, useExisting: CngxPaginate }], host: {
|
|
475
|
+
class: 'cngx-paginator',
|
|
476
|
+
role: 'navigation',
|
|
477
|
+
'[attr.aria-label]': 'resolvedAriaLabel()',
|
|
478
|
+
'[attr.aria-busy]': 'paginate.isBusy()',
|
|
479
|
+
'[attr.data-skin]': 'skin()',
|
|
480
|
+
'[attr.data-paginator-size]': 'density()',
|
|
481
|
+
'[attr.data-responsive]': "responsive() ? '' : null",
|
|
482
|
+
}, template: "@if (paginate.isBusy()) {\n @if (loadingTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n <cngx-progress\n class=\"cngx-paginator__progress\"\n variant=\"linear\"\n [state]=\"paginate.state()\"\n [label]=\"config.announcements.loading\"\n />\n }\n}\n\n<ng-content />\n\n<span cngxLiveRegion class=\"cngx-paginator__sr\">{{ announcer.message() }}</span>\n", styles: ["@layer cngx.components{.cngx-paginator{position:relative;display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;--cngx-paginator-row-gap: var(--cngx-space-sm);--cngx-paginator-gap: var(--cngx-space-xs);gap:var(--cngx-paginator-row-gap, .75rem);font-family:var( --cngx-paginator-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif );font-size:var(--cngx-paginator-font-size, .875rem)}.cngx-paginator__progress{position:absolute;inset-inline:0;inset-block-start:0;block-size:var(--cngx-paginator-progress-thickness, 2px);--cngx-progress-color: var( --cngx-paginator-progress-color, var(--cngx-color-primary, oklch(.66 .19 50)) )}.cngx-paginator__segment{display:inline-flex;align-items:center}.cngx-paginator__nav-label,.cngx-paginator__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}.cngx-paginator__pages{display:inline-flex;flex-direction:row;align-items:center;gap:var(--cngx-paginator-gap, .25rem)}.cngx-paginator__button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:var(--cngx-paginator-button-size, 2.25rem);height:var(--cngx-paginator-button-size, 2.25rem);padding:var(--cngx-paginator-button-padding, 0 .5rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-button-border-color, transparent);border-radius:var(--cngx-paginator-button-radius, .375rem);background:var(--cngx-paginator-button-bg, transparent);color:var(--cngx-paginator-button-color, currentColor);font:inherit;line-height:1;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background var(--cngx-paginator-transition, .15s ease)}.cngx-paginator__button:hover{background:var( --cngx-paginator-button-hover-bg, color-mix(in oklch, currentColor 10%, transparent) )}.cngx-paginator__button:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__button[aria-disabled=true],.cngx-paginator__button:disabled{cursor:not-allowed;opacity:var(--cngx-paginator-disabled-opacity, .45)}.cngx-paginator__page[aria-current=page]{background:var( --cngx-paginator-current-bg, color-mix(in oklch, currentColor 12%, transparent) );color:var(--cngx-paginator-current-color, currentColor);border-color:var(--cngx-paginator-current-border-color, transparent);font-weight:600}.cngx-paginator__range,.cngx-paginator__status{font-variant-numeric:tabular-nums;color:var(--cngx-paginator-range-color, currentColor);white-space:nowrap}.cngx-paginator__load-more{gap:var(--cngx-paginator-load-more-gap, .5rem);white-space:nowrap}.cngx-paginator__load-more-count{font-variant-numeric:tabular-nums;color:var( --cngx-paginator-load-more-count-color, color-mix(in oklch, currentColor 60%, transparent) )}.cngx-paginator__goto-input{box-sizing:border-box;width:var(--cngx-paginator-goto-width, 3.5rem);height:var(--cngx-paginator-button-size, 2.25rem);padding:var(--cngx-paginator-goto-padding, 0 .5rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-goto-border-color, color-mix(in oklch, currentColor 25%, transparent));border-radius:var(--cngx-paginator-button-radius, .375rem);background:var(--cngx-paginator-button-bg, transparent);color:var(--cngx-paginator-button-color, currentColor);font:inherit;font-variant-numeric:tabular-nums}.cngx-paginator__goto-input:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__select{gap:var(--cngx-paginator-select-gap, .25rem);font-variant-numeric:tabular-nums}.cngx-paginator__select-caret{display:inline-flex;font-size:var(--cngx-paginator-caret-size, 1em);line-height:1;opacity:var(--cngx-paginator-caret-opacity, .55)}.cngx-paginator__select-panel{margin:0;padding:var(--cngx-paginator-panel-padding, .25rem);list-style:none;border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-panel-border-color, color-mix(in oklch, currentColor 20%, transparent));border-radius:var(--cngx-paginator-panel-radius, .5rem);background:var(--cngx-paginator-panel-bg, Canvas);color:var(--cngx-paginator-panel-color, currentColor);box-shadow:var(--cngx-paginator-panel-shadow, 0 4px 12px rgb(0 0 0 / .15))}.cngx-paginator__option{display:flex;align-items:center;min-height:var(--cngx-paginator-option-size, 2rem);padding:var(--cngx-paginator-option-padding, 0 .75rem);border-radius:var(--cngx-paginator-option-radius, .25rem);cursor:pointer;font-variant-numeric:tabular-nums}.cngx-paginator__overflow-panel{margin:0;padding:var(--cngx-paginator-panel-padding, .25rem);list-style:none;display:grid;grid-template-columns:repeat(var(--cngx-paginator-overflow-columns, 5),var(--cngx-paginator-overflow-cell-size, 2rem));gap:var(--cngx-paginator-overflow-gap, .15rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-panel-border-color, color-mix(in oklch, currentColor 20%, transparent));border-radius:var(--cngx-paginator-panel-radius, .5rem);background:var(--cngx-paginator-panel-bg, Canvas);color:var(--cngx-paginator-panel-color, currentColor);box-shadow:var(--cngx-paginator-panel-shadow, 0 4px 12px rgb(0 0 0 / .15))}.cngx-paginator__overflow-panel .cngx-paginator__option{justify-content:center;min-block-size:var(--cngx-paginator-overflow-cell-size, 2rem);padding:var(--cngx-paginator-overflow-cell-padding, 0)}.cngx-paginator__overflow-panel:focus,.cngx-paginator__overflow-panel:focus-visible{outline:none}[popover]:has(>.cngx-paginator__select-panel),[popover]:has(>.cngx-paginator__overflow-panel){margin:0;padding:0;border:0;overflow:visible;background:none}.cngx-paginator__option.cngx-option--highlighted,.cngx-paginator__option.cngx-menu-item--highlighted{background:var( --cngx-paginator-option-hover-bg, color-mix(in oklch, currentColor 10%, transparent) )}.cngx-paginator__option.cngx-option--selected{background:var( --cngx-paginator-option-selected-bg, color-mix(in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 14%, transparent) );color:var(--cngx-paginator-option-selected-color, var(--cngx-color-primary, oklch(.66 .19 50)));font-weight:600}.cngx-paginator[data-paginator-size=compact]{--cngx-paginator-button-size: 1.75rem;font-size:var(--cngx-paginator-font-size-compact, .8125rem)}.cngx-paginator[data-paginator-size=comfortable]{--cngx-paginator-button-size: 2.75rem;font-size:var(--cngx-paginator-font-size-comfortable, .95rem)}.cngx-paginator__dots{display:inline-flex;align-items:center}.cngx-paginator__dots--windowed{overflow-x:clip;overflow-y:visible;max-width:calc(7 * var(--cngx-paginator-dot-size, .5rem) + 6 * var(--cngx-paginator-dot-gap, .5rem))}.cngx-paginator__dots-track{display:inline-flex;flex-direction:row;align-items:center;gap:var(--cngx-paginator-dot-gap, .5rem);transform:translate(calc(var(--cngx-paginator-dots-shift, 0) * -1 * (var(--cngx-paginator-dot-size, .5rem) + var(--cngx-paginator-dot-gap, .5rem))));transition:transform var(--cngx-paginator-motion-duration, .2s) ease}.cngx-paginator__dot{box-sizing:border-box;width:var(--cngx-paginator-dot-size, .5rem);height:var(--cngx-paginator-dot-size, .5rem);padding:0;border:0;border-radius:50%;background:var(--cngx-paginator-dot-color, color-mix(in oklch, currentColor 35%, transparent));cursor:pointer;transition:transform var(--cngx-paginator-transition, .15s ease),background var(--cngx-paginator-transition, .15s ease)}.cngx-paginator__dot[data-size=medium]{transform:scale(var(--cngx-paginator-dot-medium-scale, .7))}.cngx-paginator__dot[data-size=small]{transform:scale(var(--cngx-paginator-dot-small-scale, .45))}.cngx-paginator__dot--current{background:var( --cngx-paginator-dot-current-color, var(--cngx-color-primary, oklch(.66 .19 50)) );transform:scale(var(--cngx-paginator-dot-current-scale, 1.15))}.cngx-paginator__dot:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__dot[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-paginator-disabled-opacity, .45)}.cngx-paginator__rail{position:relative;display:flex;align-items:center;flex:1 1 auto;min-inline-size:var(--cngx-paginator-rail-min-size, 6rem)}.cngx-paginator__rail cngx-progress{flex:1 1 auto;--cngx-progress-height: var(--cngx-paginator-rail-height, .375rem);--cngx-progress-color: var( --cngx-paginator-rail-fill, var(--cngx-color-primary, oklch(.66 .19 50)) );--cngx-progress-track-color: var( --cngx-paginator-rail-track, var(--cngx-color-border, oklch(.9 .005 250)) )}.cngx-paginator__rail-knob{position:absolute;inset-block-start:50%;inset-inline-start:0;inline-size:var(--cngx-paginator-rail-knob-size, .875rem);block-size:var(--cngx-paginator-rail-knob-size, .875rem);border-radius:50%;background:var(--cngx-paginator-rail-knob-bg, oklch(1 0 0));border:var(--cngx-paginator-rail-knob-border-width, 2px) solid var(--cngx-paginator-rail-knob-border-color, oklch(.66 .19 50));transform:translate(-50%,-50%);transition:inset-inline-start var(--cngx-paginator-motion-duration, .2s) cubic-bezier(.3,.7,0,1)}.cngx-paginator__infinite{display:flex;align-items:center;justify-content:center;gap:var(--cngx-paginator-infinite-gap, .5rem);padding:var(--cngx-paginator-infinite-padding, .9rem);color:var(--cngx-paginator-infinite-color, color-mix(in oklch, currentColor 60%, transparent))}.cngx-paginator__infinite-status,.cngx-paginator__infinite-end{font-size:var(--cngx-paginator-infinite-font-size, .8125rem)}.cngx-paginator__infinite-spinner{inline-size:var(--cngx-paginator-infinite-spinner-size, 1rem);block-size:var(--cngx-paginator-infinite-spinner-size, 1rem);border-radius:50%;border:var(--cngx-paginator-infinite-spinner-width, 2px) solid color-mix(in oklch,var(--cngx-color-primary, oklch(.66 .19 50)) 30%,transparent);border-block-start-color:var(--cngx-color-primary, oklch(.66 .19 50));animation:cngx-paginator-spin var(--cngx-paginator-infinite-spinner-duration, .7s) linear infinite}@keyframes cngx-paginator-spin{to{transform:rotate(360deg)}}.cngx-paginator__alpha{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cngx-paginator-alpha-gap, .4rem)}.cngx-paginator__alpha-chip{border-color:var( --cngx-paginator-alpha-chip-border-color, var(--cngx-color-border, oklch(.88 .005 250)) );background:var(--cngx-paginator-alpha-chip-bg, var(--cngx-color-surface, oklch(1 0 0)));font-weight:500}.cngx-paginator__alpha-chip:hover:not([aria-pressed=true]):not(:disabled){border-color:var(--cngx-color-primary, oklch(.66 .19 50));color:var(--cngx-color-primary, oklch(.66 .19 50))}.cngx-paginator__alpha-chip[aria-pressed=true]{background:var(--cngx-paginator-current-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-paginator-current-color, var(--cngx-color-on-primary, oklch(1 0 0)));border-color:var( --cngx-paginator-current-border-color, var(--cngx-color-primary, oklch(.66 .19 50)) );font-weight:600}@media(prefers-reduced-motion:reduce){.cngx-paginator__button,.cngx-paginator__dot,.cngx-paginator__dots-track{transition:none}.cngx-paginator__infinite-spinner{animation:none}}}\n", "@layer cngx.tokens{@property --cngx-paginator-gap{syntax: \"*\"; inherits: true; initial-value: .25rem;}@property --cngx-paginator-row-gap{syntax: \"<length>\"; inherits: true; initial-value: .75rem;}@property --cngx-paginator-font-size{syntax: \"<length>\"; inherits: true; initial-value: .875rem;}@property --cngx-paginator-button-size{syntax: \"<length>\"; inherits: true; initial-value: 2.25rem;}@property --cngx-paginator-button-radius{syntax: \"<length>\"; inherits: true; initial-value: .5rem;}@property --cngx-paginator-button-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-paginator-button-bg{syntax: \"*\"; inherits: true; initial-value: transparent;}@property --cngx-paginator-button-hover-bg{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklch,currentColor 10%,transparent);}@property --cngx-paginator-button-border-color{syntax: \"<color>\"; inherits: true; initial-value: transparent;}@property --cngx-paginator-current-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-paginator-current-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-paginator-current-border-color{syntax: \"<color>\"; inherits: true; initial-value: transparent;}@property --cngx-paginator-focus-ring{syntax: \"*\"; inherits: true; initial-value: 2px solid currentColor;}@property --cngx-paginator-disabled-opacity{syntax: \"<number>\"; inherits: true; initial-value: .45;}@property --cngx-paginator-track-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 0 0);}@property --cngx-paginator-active-shadow{syntax: \"*\"; inherits: true; initial-value: 0 1px 2px oklch(0 0 0 / .06);}@property --cngx-paginator-indicator-thickness{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-paginator-rail-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-paginator-rail-thickness{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-paginator-rail-knob-size{syntax: \"<length>\"; inherits: true; initial-value: .875rem;}@property --cngx-paginator-rail-knob-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-paginator-rail-knob-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-paginator-bar-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-paginator-bar-radius{syntax: \"<length>\"; inherits: true; initial-value: .375rem;}@property --cngx-paginator-hover-scale{syntax: \"<number>\"; inherits: true; initial-value: 1;}@property --cngx-paginator-press-scale{syntax: \"<number>\"; inherits: true; initial-value: 1;}@property --cngx-paginator-motion-duration{syntax: \"<time>\"; inherits: true; initial-value: .2s;}@property --cngx-paginator-fade-duration{syntax: \"<time>\"; inherits: true; initial-value: .25s;}@property --cngx-paginator-busy-opacity{syntax: \"<number>\"; inherits: true; initial-value: .6;}@property --cngx-paginator-focus-halo{syntax: \"*\"; inherits: true; initial-value: 0 0 0 4px color-mix(in oklch,currentColor 18%,transparent);}@property --cngx-paginator-dot-size{syntax: \"<length>\"; inherits: true; initial-value: .5rem;}@property --cngx-paginator-dot-gap{syntax: \"<length>\"; inherits: true; initial-value: .5rem;}@property --cngx-paginator-dot-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.7 0 0 / .35);}@property --cngx-paginator-dot-current-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-paginator-panel-bg{syntax: \"*\"; inherits: true; initial-value: Canvas;}@property --cngx-paginator-panel-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-paginator-panel-border-color{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklch,currentColor 20%,transparent);}@property --cngx-paginator-panel-radius{syntax: \"<length>\"; inherits: true; initial-value: .5rem;}@property --cngx-paginator-panel-padding{syntax: \"*\"; inherits: true; initial-value: .25rem;}@property --cngx-paginator-panel-shadow{syntax: \"*\"; inherits: true; initial-value: 0 4px 12px rgb(0 0 0 / .15);}@property --cngx-paginator-option-size{syntax: \"<length>\"; inherits: true; initial-value: 2rem;}@property --cngx-paginator-option-padding{syntax: \"*\"; inherits: true; initial-value: 0 .75rem;}@property --cngx-paginator-option-radius{syntax: \"<length>\"; inherits: true; initial-value: .25rem;}@property --cngx-paginator-option-hover-bg{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklch,currentColor 10%,transparent);}@property --cngx-paginator-option-selected-bg{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklch,var(--cngx-color-primary, oklch(.66 .19 50)) 14%,transparent);}@property --cngx-paginator-option-selected-color{syntax: \"*\"; inherits: true; initial-value: var(--cngx-color-primary, oklch(.66 .19 50));}@property --cngx-paginator-overflow-columns{syntax: \"<integer>\"; inherits: true; initial-value: 5;}@property --cngx-paginator-overflow-cell-size{syntax: \"<length>\"; inherits: true; initial-value: 2rem;}:root{--cngx-paginator-current-bg: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-border-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-focus-ring: 2px solid var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-focus-halo: 0 0 0 4px color-mix(in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 18%, transparent);--cngx-paginator-dot-current-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{@scope(.cngx-paginator[data-skin=numbered]){:scope{--cngx-paginator-current-bg: transparent;--cngx-paginator-current-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-border-color: transparent;--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 12%, transparent )}.cngx-paginator__page{position:relative}.cngx-paginator__page:after{content:\"\";position:absolute;inset-inline:var(--cngx-paginator-indicator-inset, 18%);inset-block-end:var(--cngx-paginator-indicator-offset, 4px);block-size:var(--cngx-paginator-indicator-thickness, 2px);border-radius:var(--cngx-paginator-indicator-thickness, 2px) var(--cngx-paginator-indicator-thickness, 2px) 0 0;background:var(--cngx-color-primary, oklch(.66 .19 50));transform:scaleX(0);transition:transform var(--cngx-paginator-motion-duration, .2s) ease}.cngx-paginator__page:hover:not([aria-current=page]):after{transform:scaleX(var(--cngx-paginator-indicator-hover-scale, .5))}.cngx-paginator__page[aria-current=page]:after{transform:scaleX(1)}}@scope(.cngx-paginator[data-skin=pill]){:scope{--cngx-paginator-gap: var(--cngx-space-xs);--cngx-paginator-button-radius: 100px;--cngx-paginator-current-bg: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-color: var(--cngx-color-on-primary, oklch(1 0 0));--cngx-paginator-current-border-color: transparent;--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 8%, transparent )}}@scope(.cngx-paginator[data-skin=segmented]){:scope{--cngx-paginator-button-radius: .375rem;--cngx-paginator-track-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 25% );--cngx-paginator-current-bg: var(--cngx-color-surface, oklch(1 0 0));--cngx-paginator-current-color: currentColor;--cngx-paginator-current-border-color: transparent;--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 45% )}.cngx-paginator__pages{background:var(--cngx-paginator-track-bg, oklch(.96 0 0));border-radius:var(--cngx-paginator-button-radius, .375rem);padding:var(--cngx-paginator-segmented-track-padding, .25rem)}.cngx-paginator__page[aria-current=page]{box-shadow:var(--cngx-paginator-active-shadow, 0 1px 2px oklch(0 0 0 / .06))}}@scope(.cngx-paginator[data-skin=minimal]){:scope{--cngx-paginator-row-gap: var(--cngx-space-sm);--cngx-paginator-gap: var(--cngx-space-xs);--cngx-paginator-button-bg: transparent;--cngx-paginator-button-hover-bg: transparent;--cngx-paginator-button-border-color: transparent;--cngx-paginator-current-bg: transparent;--cngx-paginator-current-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-border-color: transparent}.cngx-paginator__page:hover:not([aria-disabled=true]),.cngx-paginator__page[aria-current=page]{text-decoration:underline;text-underline-offset:.25em}.cngx-paginator__status{min-inline-size:var(--cngx-paginator-status-min-size, 5.5rem);text-align:center}:scope[data-nav-labels] .cngx-paginator__nav{gap:var(--cngx-paginator-minimal-nav-gap, .4rem);padding-inline:var(--cngx-paginator-minimal-nav-padding, .85rem);border-color:var(--cngx-color-border, oklch(.88 .005 250))}:scope[data-nav-labels] cngx-pgn-next .cngx-paginator__nav,:scope[data-nav-labels] cngx-pgn-last .cngx-paginator__nav{flex-direction:row-reverse}:scope[data-nav-labels] .cngx-paginator__nav .cngx-paginator__nav-label{position:static;width:auto;height:auto;margin:0;clip:auto;clip-path:none;overflow:visible;white-space:nowrap;font-weight:500}:scope[data-nav-labels] .cngx-paginator__nav:hover:not([aria-disabled=true]){border-color:var(--cngx-color-primary, oklch(.66 .19 50));color:var(--cngx-color-primary, oklch(.66 .19 50))}}@scope(.cngx-paginator[data-skin=rail]){:scope{--cngx-paginator-row-gap: var(--cngx-space-md)}}@scope(.cngx-paginator[data-skin=bar]){:scope{--cngx-paginator-row-gap: 0;--cngx-paginator-gap: 0;--cngx-paginator-button-radius: 0;--cngx-paginator-current-bg: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-paginator-current-color: var(--cngx-color-on-primary, oklch(1 0 0));--cngx-paginator-current-border-color: transparent;--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 10%, transparent );width:max-content;max-width:100%;min-block-size:var(--cngx-paginator-button-size, 2.25rem);border:1px solid var(--cngx-paginator-bar-border-color, oklch(.88 .005 250));border-radius:var(--cngx-paginator-bar-radius, .375rem);overflow:clip;overflow-clip-margin:var(--cngx-paginator-bar-clip-margin, .5rem)}:scope>.cngx-paginator__segment{align-self:stretch;align-items:stretch;border-inline-start:1px solid var(--cngx-paginator-bar-border-color, oklch(.88 .005 250))}:scope>.cngx-paginator__segment:first-child{border-inline-start:0}.cngx-paginator__segment>.cngx-paginator__button{align-self:stretch;block-size:auto;border-radius:0;padding-inline:var(--cngx-paginator-bar-cell-padding, .85rem)}.cngx-paginator__segment:is(cngx-pgn-first,cngx-pgn-prev,cngx-pgn-next,cngx-pgn-last)>.cngx-paginator__button{padding-inline:0}.cngx-paginator__range,.cngx-paginator__status{align-self:center;padding-inline:var(--cngx-paginator-bar-cell-padding, .85rem)}:scope>span.cngx-paginator__segment{align-items:center;padding-inline:var(--cngx-paginator-bar-cell-padding, .85rem)}.cngx-paginator__pages{gap:0;align-self:stretch}.cngx-paginator__pages .cngx-paginator__button{align-self:stretch;block-size:auto;border-radius:0;border-inline-start:1px solid var(--cngx-paginator-bar-border-color, oklch(.88 .005 250));padding-inline:var(--cngx-paginator-bar-page-padding, .5rem)}.cngx-paginator__pages .cngx-paginator__button:first-child{border-inline-start:0}}@scope(.cngx-paginator[data-skin=dots]){:scope{--cngx-paginator-row-gap: var(--cngx-space-md);--cngx-paginator-gap: var(--cngx-space-sm);--cngx-paginator-dot-gap: var(--cngx-space-sm);--cngx-paginator-dot-size: .5625rem;--cngx-paginator-dot-color: color-mix(in oklch, currentColor 30%, transparent);--cngx-paginator-dot-current-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@scope(.cngx-paginator){.cngx-paginator__button{transition:background var(--cngx-paginator-motion-duration, .2s) ease,transform var(--cngx-paginator-motion-duration, .2s) ease,box-shadow var(--cngx-paginator-motion-duration, .2s) ease}.cngx-paginator__button:hover:not([aria-disabled=true]){transform:scale(var(--cngx-paginator-hover-scale, 1))}.cngx-paginator__button:active:not([aria-disabled=true]){transform:scale(var(--cngx-paginator-press-scale, 1))}.cngx-paginator__button:focus-visible{box-shadow:var( --cngx-paginator-focus-halo, 0 0 0 4px color-mix(in oklch, currentColor 18%, transparent) )}.cngx-paginator__pages{transition:opacity var(--cngx-paginator-fade-duration, .25s) ease}:scope[aria-busy=true] .cngx-paginator__pages{opacity:var(--cngx-paginator-busy-opacity, .6)}@media(prefers-reduced-motion:reduce){:scope{--cngx-paginator-hover-scale: 1;--cngx-paginator-press-scale: 1}.cngx-paginator__button,.cngx-paginator__pages,.cngx-paginator__page:after,.cngx-paginator__rail-knob{transition:none}}}.cngx-paginator:not([data-skin=bar]){container-type:inline-size;container-name:cngx-paginator}@container cngx-paginator (max-width: 30rem){cngx-pgn-goto{display:none}}@container cngx-paginator (max-width: 24rem){cngx-pgn-first,cngx-pgn-last{display:none}}.cngx-paginator[data-responsive] cngx-pgn-status{display:none}@container cngx-paginator (max-width: 24rem){.cngx-paginator[data-responsive] cngx-pgn-pages{display:none}.cngx-paginator[data-responsive] cngx-pgn-status{display:inline-flex}}@media(pointer:coarse){.cngx-paginator{--cngx-paginator-button-size: 2.75rem}}[dir=rtl] .cngx-paginator__nav .cngx-icon{transform:scaleX(-1)}}@media(prefers-color-scheme:dark){.cngx-paginator[data-skin=numbered]{--cngx-paginator-button-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.72 .18 50)) 24%, transparent )}.cngx-paginator[data-skin=segmented]{--cngx-paginator-active-shadow: 0 1px 3px oklch(0 0 0 / .3)}}\n"] }]
|
|
483
|
+
}], ctorParameters: () => [], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], skin: [{ type: i0.Input, args: [{ isSignal: true, alias: "skin", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], responsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "responsive", required: false }] }], resetOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "resetOn", required: false }] }], pageIndexChange: [{ type: i0.Output, args: ["pageIndexChange"] }], pageSizeChange: [{ type: i0.Output, args: ["pageSizeChange"] }], loadingSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxPaginatorLoading), { ...{ read: TemplateRef }, isSignal: true }] }] } });
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Default text glyphs for the paginator segments. Internal and non-exported -
|
|
487
|
+
* mirrors `CNGX_SELECT_GLYPHS`. The library ships no icon font; these unicode
|
|
488
|
+
* marks are the out-of-the-box chevrons and the overflow ellipsis. Consumers
|
|
489
|
+
* restyle visually via CSS rather than by swapping these characters.
|
|
490
|
+
*
|
|
491
|
+
* Centralised so the chevron / ellipsis literals live in one place instead of
|
|
492
|
+
* being duplicated across the segment classes.
|
|
493
|
+
*/
|
|
494
|
+
const CNGX_PAGINATOR_GLYPHS = {
|
|
495
|
+
/** First-page nav (double left-pointing angle quotation mark). */
|
|
496
|
+
first: '«',
|
|
497
|
+
/** Previous-page nav (single left-pointing angle quotation mark). */
|
|
498
|
+
previous: '‹',
|
|
499
|
+
/** Next-page nav (single right-pointing angle quotation mark). */
|
|
500
|
+
next: '›',
|
|
501
|
+
/** Last-page nav (double right-pointing angle quotation mark). */
|
|
502
|
+
last: '»',
|
|
503
|
+
/** Ellipsis trigger that opens the hidden-pages overflow menu. */
|
|
504
|
+
more: '…',
|
|
505
|
+
/** Dropdown caret on the page-size / page-of-pages select triggers. */
|
|
506
|
+
caret: '▾',
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Shared nav-button glue. Composition, not an abstract base class: each of the
|
|
511
|
+
* four segments calls this factory as a field initialiser and binds the same
|
|
512
|
+
* template, differing only in selector, glyph, and the three options here.
|
|
513
|
+
*/
|
|
514
|
+
function createPaginatorNavCore(options) {
|
|
515
|
+
const host = inject(CNGX_PAGINATOR_HOST);
|
|
516
|
+
const config = injectPaginatorConfig();
|
|
517
|
+
const disabled = computed(() => host.isBusy() || options.atBound(host), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
518
|
+
const ariaLabel = computed(() => config.ariaLabels[options.ariaKey], ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
519
|
+
return {
|
|
520
|
+
disabled,
|
|
521
|
+
ariaLabel,
|
|
522
|
+
activate: () => {
|
|
523
|
+
if (disabled()) {
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
options.action(host);
|
|
527
|
+
},
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
// Shared template - identical across the four segments; only the glyph differs.
|
|
531
|
+
// `aria-disabled` (not native `disabled`) keeps the button focusable so AT users
|
|
532
|
+
// hear the bound state; `activate()` guards the click.
|
|
533
|
+
const NAV_TEMPLATE = `
|
|
534
|
+
<button
|
|
535
|
+
type="button"
|
|
536
|
+
class="cngx-paginator__button cngx-paginator__nav"
|
|
537
|
+
cngxRipple
|
|
538
|
+
[attr.aria-disabled]="core.disabled()"
|
|
539
|
+
(click)="core.activate()"
|
|
540
|
+
>
|
|
541
|
+
<cngx-icon aria-hidden="true">{{ glyph }}</cngx-icon>
|
|
542
|
+
<span class="cngx-paginator__nav-label">{{ core.ariaLabel() }}</span>
|
|
543
|
+
</button>
|
|
544
|
+
`;
|
|
545
|
+
// Angular's compiler needs literal decorator metadata per component (no
|
|
546
|
+
// spreads), so the shared parts are duplicated inline; the behavioural glue
|
|
547
|
+
// stays factored in createPaginatorNavCore and the markup in NAV_TEMPLATE.
|
|
548
|
+
/**
|
|
549
|
+
* First-page segment. Disabled on the first page; calls `host.first()`.
|
|
550
|
+
*
|
|
551
|
+
* @category ui/paginator
|
|
552
|
+
* @wcag AA
|
|
553
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-nav.component.ts
|
|
554
|
+
* @since 0.1.0
|
|
555
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/first/chevron</example-url>
|
|
556
|
+
*/
|
|
557
|
+
class CngxPaginatorFirst {
|
|
558
|
+
glyph = CNGX_PAGINATOR_GLYPHS.first;
|
|
559
|
+
core = createPaginatorNavCore({
|
|
560
|
+
atBound: (host) => host.isFirst(),
|
|
561
|
+
action: (host) => host.first(),
|
|
562
|
+
ariaKey: 'first',
|
|
563
|
+
});
|
|
564
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorFirst, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
565
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxPaginatorFirst, isStandalone: true, selector: "cngx-pgn-first", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnFirst"], ngImport: i0, template: "\n <button\n type=\"button\"\n class=\"cngx-paginator__button cngx-paginator__nav\"\n cngxRipple\n [attr.aria-disabled]=\"core.disabled()\"\n (click)=\"core.activate()\"\n >\n <cngx-icon aria-hidden=\"true\">{{ glyph }}</cngx-icon>\n <span class=\"cngx-paginator__nav-label\">{{ core.ariaLabel() }}</span>\n </button>\n", isInline: true, dependencies: [{ kind: "component", type: CngxIcon, selector: "cngx-icon, [cngxIcon]", inputs: ["label", "size"], exportAs: ["cngxIcon"] }, { kind: "directive", type: CngxRipple, selector: "[cngxRipple]", inputs: ["rippleColor", "rippleCentered", "rippleDisabled"], exportAs: ["cngxRipple"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
566
|
+
}
|
|
567
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorFirst, decorators: [{
|
|
568
|
+
type: Component,
|
|
569
|
+
args: [{
|
|
570
|
+
selector: 'cngx-pgn-first',
|
|
571
|
+
exportAs: 'cngxPgnFirst',
|
|
572
|
+
standalone: true,
|
|
573
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
574
|
+
encapsulation: ViewEncapsulation.None,
|
|
575
|
+
imports: [CngxIcon, CngxRipple],
|
|
576
|
+
template: NAV_TEMPLATE,
|
|
577
|
+
host: { class: 'cngx-paginator__segment' },
|
|
578
|
+
}]
|
|
579
|
+
}] });
|
|
580
|
+
/**
|
|
581
|
+
* Previous-page segment. Disabled on the first page; calls `host.previous()`.
|
|
582
|
+
*
|
|
583
|
+
* @category ui/paginator
|
|
584
|
+
* @wcag AA
|
|
585
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-nav.component.ts
|
|
586
|
+
* @since 0.1.0
|
|
587
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/prev/chevron</example-url>
|
|
588
|
+
*/
|
|
589
|
+
class CngxPaginatorPrev {
|
|
590
|
+
glyph = CNGX_PAGINATOR_GLYPHS.previous;
|
|
591
|
+
core = createPaginatorNavCore({
|
|
592
|
+
atBound: (host) => host.isFirst(),
|
|
593
|
+
action: (host) => host.previous(),
|
|
594
|
+
ariaKey: 'previous',
|
|
595
|
+
});
|
|
596
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorPrev, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
597
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxPaginatorPrev, isStandalone: true, selector: "cngx-pgn-prev", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnPrev"], ngImport: i0, template: "\n <button\n type=\"button\"\n class=\"cngx-paginator__button cngx-paginator__nav\"\n cngxRipple\n [attr.aria-disabled]=\"core.disabled()\"\n (click)=\"core.activate()\"\n >\n <cngx-icon aria-hidden=\"true\">{{ glyph }}</cngx-icon>\n <span class=\"cngx-paginator__nav-label\">{{ core.ariaLabel() }}</span>\n </button>\n", isInline: true, dependencies: [{ kind: "component", type: CngxIcon, selector: "cngx-icon, [cngxIcon]", inputs: ["label", "size"], exportAs: ["cngxIcon"] }, { kind: "directive", type: CngxRipple, selector: "[cngxRipple]", inputs: ["rippleColor", "rippleCentered", "rippleDisabled"], exportAs: ["cngxRipple"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
598
|
+
}
|
|
599
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorPrev, decorators: [{
|
|
600
|
+
type: Component,
|
|
601
|
+
args: [{
|
|
602
|
+
selector: 'cngx-pgn-prev',
|
|
603
|
+
exportAs: 'cngxPgnPrev',
|
|
604
|
+
standalone: true,
|
|
605
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
606
|
+
encapsulation: ViewEncapsulation.None,
|
|
607
|
+
imports: [CngxIcon, CngxRipple],
|
|
608
|
+
template: NAV_TEMPLATE,
|
|
609
|
+
host: { class: 'cngx-paginator__segment' },
|
|
610
|
+
}]
|
|
611
|
+
}] });
|
|
612
|
+
/**
|
|
613
|
+
* Next-page segment. Disabled on the last page; calls `host.next()`.
|
|
614
|
+
*
|
|
615
|
+
* @category ui/paginator
|
|
616
|
+
* @wcag AA
|
|
617
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-nav.component.ts
|
|
618
|
+
* @since 0.1.0
|
|
619
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/next/chevron</example-url>
|
|
620
|
+
*/
|
|
621
|
+
class CngxPaginatorNext {
|
|
622
|
+
glyph = CNGX_PAGINATOR_GLYPHS.next;
|
|
623
|
+
core = createPaginatorNavCore({
|
|
624
|
+
atBound: (host) => host.isLast(),
|
|
625
|
+
action: (host) => host.next(),
|
|
626
|
+
ariaKey: 'next',
|
|
627
|
+
});
|
|
628
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorNext, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
629
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxPaginatorNext, isStandalone: true, selector: "cngx-pgn-next", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnNext"], ngImport: i0, template: "\n <button\n type=\"button\"\n class=\"cngx-paginator__button cngx-paginator__nav\"\n cngxRipple\n [attr.aria-disabled]=\"core.disabled()\"\n (click)=\"core.activate()\"\n >\n <cngx-icon aria-hidden=\"true\">{{ glyph }}</cngx-icon>\n <span class=\"cngx-paginator__nav-label\">{{ core.ariaLabel() }}</span>\n </button>\n", isInline: true, dependencies: [{ kind: "component", type: CngxIcon, selector: "cngx-icon, [cngxIcon]", inputs: ["label", "size"], exportAs: ["cngxIcon"] }, { kind: "directive", type: CngxRipple, selector: "[cngxRipple]", inputs: ["rippleColor", "rippleCentered", "rippleDisabled"], exportAs: ["cngxRipple"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
630
|
+
}
|
|
631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorNext, decorators: [{
|
|
632
|
+
type: Component,
|
|
633
|
+
args: [{
|
|
634
|
+
selector: 'cngx-pgn-next',
|
|
635
|
+
exportAs: 'cngxPgnNext',
|
|
636
|
+
standalone: true,
|
|
637
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
638
|
+
encapsulation: ViewEncapsulation.None,
|
|
639
|
+
imports: [CngxIcon, CngxRipple],
|
|
640
|
+
template: NAV_TEMPLATE,
|
|
641
|
+
host: { class: 'cngx-paginator__segment' },
|
|
642
|
+
}]
|
|
643
|
+
}] });
|
|
644
|
+
/**
|
|
645
|
+
* Last-page segment. Disabled on the last page; calls `host.last()`.
|
|
646
|
+
*
|
|
647
|
+
* @category ui/paginator
|
|
648
|
+
* @wcag AA
|
|
649
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-nav.component.ts
|
|
650
|
+
* @since 0.1.0
|
|
651
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/last/chevron</example-url>
|
|
652
|
+
*/
|
|
653
|
+
class CngxPaginatorLast {
|
|
654
|
+
glyph = CNGX_PAGINATOR_GLYPHS.last;
|
|
655
|
+
core = createPaginatorNavCore({
|
|
656
|
+
atBound: (host) => host.isLast(),
|
|
657
|
+
action: (host) => host.last(),
|
|
658
|
+
ariaKey: 'last',
|
|
659
|
+
});
|
|
660
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorLast, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
661
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxPaginatorLast, isStandalone: true, selector: "cngx-pgn-last", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnLast"], ngImport: i0, template: "\n <button\n type=\"button\"\n class=\"cngx-paginator__button cngx-paginator__nav\"\n cngxRipple\n [attr.aria-disabled]=\"core.disabled()\"\n (click)=\"core.activate()\"\n >\n <cngx-icon aria-hidden=\"true\">{{ glyph }}</cngx-icon>\n <span class=\"cngx-paginator__nav-label\">{{ core.ariaLabel() }}</span>\n </button>\n", isInline: true, dependencies: [{ kind: "component", type: CngxIcon, selector: "cngx-icon, [cngxIcon]", inputs: ["label", "size"], exportAs: ["cngxIcon"] }, { kind: "directive", type: CngxRipple, selector: "[cngxRipple]", inputs: ["rippleColor", "rippleCentered", "rippleDisabled"], exportAs: ["cngxRipple"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
662
|
+
}
|
|
663
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorLast, decorators: [{
|
|
664
|
+
type: Component,
|
|
665
|
+
args: [{
|
|
666
|
+
selector: 'cngx-pgn-last',
|
|
667
|
+
exportAs: 'cngxPgnLast',
|
|
668
|
+
standalone: true,
|
|
669
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
670
|
+
encapsulation: ViewEncapsulation.None,
|
|
671
|
+
imports: [CngxIcon, CngxRipple],
|
|
672
|
+
template: NAV_TEMPLATE,
|
|
673
|
+
host: { class: 'cngx-paginator__segment' },
|
|
674
|
+
}]
|
|
675
|
+
}] });
|
|
676
|
+
|
|
677
|
+
// Internal pure page-window math for `cngx-pgn-pages`. Not part of the public
|
|
678
|
+
// API - the segment is the only consumer. 0-based throughout (matching the
|
|
679
|
+
// brain's `pageIndex`); the rendered display number is `index + 1`.
|
|
680
|
+
function range(start, end) {
|
|
681
|
+
const length = end - start + 1;
|
|
682
|
+
return length > 0 ? Array.from({ length }, (_, i) => start + i) : [];
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Compute the windowed page sequence around `current` for `total` pages. \
|
|
686
|
+
* A run of more than one hidden page collapses into a `gap` carrying the hidden
|
|
687
|
+
* 0-based indices (the ellipsis menu's options); a single hidden page renders
|
|
688
|
+
* as a plain page button instead of a gap.
|
|
689
|
+
*
|
|
690
|
+
* Derived from the MUI `usePagination`
|
|
691
|
+
* range algorithm, 0-based. `siblingCount` is how many pages flank `current` on
|
|
692
|
+
* each side; `boundaryCount` is how many pages are pinned at each end. Both
|
|
693
|
+
* default to `1`, reproducing the v1 window byte-for-byte; the `cngx-pgn-pages`
|
|
694
|
+
* inputs and {@link CNGX_PAGINATOR_PAGE_WINDOW_FACTORY} feed non-default values.
|
|
695
|
+
*/
|
|
696
|
+
function pageWindow(current, total, siblingCount = 1, boundaryCount = 1) {
|
|
697
|
+
const count = Math.max(1, total);
|
|
698
|
+
const page = Math.min(Math.max(current, 0), count - 1) + 1; // 1-based, clamped
|
|
699
|
+
const startPages = range(1, Math.min(boundaryCount, count));
|
|
700
|
+
const endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);
|
|
701
|
+
const siblingsStart = Math.max(Math.min(page - siblingCount, count - boundaryCount - siblingCount * 2 - 1), boundaryCount + 2);
|
|
702
|
+
const siblingsEnd = Math.min(Math.max(page + siblingCount, boundaryCount + siblingCount * 2 + 2), endPages.length > 0 ? endPages[0] - 2 : count - 1);
|
|
703
|
+
const startHidden = range(boundaryCount + 1, siblingsStart - 1);
|
|
704
|
+
const endHidden = range(siblingsEnd + 1, count - boundaryCount);
|
|
705
|
+
const itemList = [
|
|
706
|
+
...startPages,
|
|
707
|
+
...(siblingsStart > boundaryCount + 2
|
|
708
|
+
? ['start-gap']
|
|
709
|
+
: boundaryCount + 1 < count - boundaryCount
|
|
710
|
+
? [boundaryCount + 1]
|
|
711
|
+
: []),
|
|
712
|
+
...range(siblingsStart, siblingsEnd),
|
|
713
|
+
...(siblingsEnd < count - boundaryCount - 1
|
|
714
|
+
? ['end-gap']
|
|
715
|
+
: count - boundaryCount > boundaryCount
|
|
716
|
+
? [count - boundaryCount]
|
|
717
|
+
: []),
|
|
718
|
+
...endPages,
|
|
719
|
+
];
|
|
720
|
+
let gaps = 0;
|
|
721
|
+
const pages = itemList.map((entry) => {
|
|
722
|
+
if (entry === 'start-gap') {
|
|
723
|
+
gaps++;
|
|
724
|
+
return { kind: 'gap', hidden: startHidden.map((n) => n - 1) };
|
|
725
|
+
}
|
|
726
|
+
if (entry === 'end-gap') {
|
|
727
|
+
gaps++;
|
|
728
|
+
return { kind: 'gap', hidden: endHidden.map((n) => n - 1) };
|
|
729
|
+
}
|
|
730
|
+
return { kind: 'page', index: entry - 1 };
|
|
731
|
+
});
|
|
732
|
+
return { pages, gaps };
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Structural equality for two page windows. The `equal` fn for the segment's
|
|
736
|
+
* `computed()` - keeps the reference stable across recomputes that yield an
|
|
737
|
+
* identical window, so downstream `@for` does not churn.
|
|
738
|
+
*/
|
|
739
|
+
function pageWindowEqual(a, b) {
|
|
740
|
+
if (a === b) {
|
|
741
|
+
return true;
|
|
742
|
+
}
|
|
743
|
+
if (a.gaps !== b.gaps || a.pages.length !== b.pages.length) {
|
|
744
|
+
return false;
|
|
745
|
+
}
|
|
746
|
+
for (let i = 0; i < a.pages.length; i++) {
|
|
747
|
+
const pa = a.pages[i];
|
|
748
|
+
const pb = b.pages[i];
|
|
749
|
+
if (pa.kind !== pb.kind) {
|
|
750
|
+
return false;
|
|
751
|
+
}
|
|
752
|
+
if (pa.kind === 'page' && pb.kind === 'page') {
|
|
753
|
+
if (pa.index !== pb.index) {
|
|
754
|
+
return false;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
else if (pa.kind === 'gap' && pb.kind === 'gap') {
|
|
758
|
+
if (pa.hidden.length !== pb.hidden.length || pa.hidden.some((h, j) => h !== pb.hidden[j])) {
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return true;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Default page-window factory. Resolves to the built-in {@link pageWindow} math
|
|
768
|
+
* (one sibling each side, one pinned boundary at each end at the `1 / 1`
|
|
769
|
+
* defaults). The segment builds its window via
|
|
770
|
+
* `inject(CNGX_PAGINATOR_PAGE_WINDOW_FACTORY)()` rather than calling this
|
|
771
|
+
* directly, mirroring {@link createPaginatorAnnouncer}.
|
|
772
|
+
*
|
|
773
|
+
* @category ui/paginator
|
|
774
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-page-window.token.ts
|
|
775
|
+
* @since 0.1.0
|
|
776
|
+
*/
|
|
777
|
+
const createPaginatorPageWindow = () => pageWindow;
|
|
778
|
+
/**
|
|
779
|
+
* Swap token for the page-row truncation algorithm. The default resolves to
|
|
780
|
+
* {@link createPaginatorPageWindow}; override it to replace the whole windowing
|
|
781
|
+
* computation enterprise-wide (via `providers`) or per-component (via
|
|
782
|
+
* `viewProviders`) without forking the segment. Per-instance tweaks to the
|
|
783
|
+
* sibling / boundary counts use the `[siblingCount]` / `[boundaryCount]` inputs
|
|
784
|
+
* on `cngx-pgn-pages` instead. Mirrors {@link CNGX_PAGINATOR_ANNOUNCER_FACTORY}.
|
|
785
|
+
*
|
|
786
|
+
* @category ui/paginator
|
|
787
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-page-window.token.ts
|
|
788
|
+
* @since 0.1.0
|
|
789
|
+
*/
|
|
790
|
+
const CNGX_PAGINATOR_PAGE_WINDOW_FACTORY = new InjectionToken('CngxPaginatorPageWindowFactory', {
|
|
791
|
+
providedIn: 'root',
|
|
792
|
+
factory: () => createPaginatorPageWindow,
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* The numbered page row. One tab stop via `CngxRovingTabindex` (arrows / Home /
|
|
797
|
+
* End move the active page button); the current page carries `aria-current`.
|
|
798
|
+
* A truncation run collapses into an ellipsis button that opens a `CngxListbox`
|
|
799
|
+
* grid of the hidden pages (same select-and-jump model as `cngx-pgn-page-of-pages`,
|
|
800
|
+
* so focus moves into the panel on open).
|
|
801
|
+
*
|
|
802
|
+
* @category ui/paginator
|
|
803
|
+
* @wcag AA
|
|
804
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-pages.component.ts
|
|
805
|
+
* @since 0.1.0
|
|
806
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/pages/number-row</example-url>
|
|
807
|
+
*/
|
|
808
|
+
class CngxPaginatorPages {
|
|
809
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
810
|
+
config = injectPaginatorConfig();
|
|
811
|
+
glyphs = CNGX_PAGINATOR_GLYPHS;
|
|
812
|
+
/** Pages flanking the current page on each side. Defaults to the v1 window. */
|
|
813
|
+
siblingCount = input(1, ...(ngDevMode ? [{ debugName: "siblingCount" }] : /* istanbul ignore next */ []));
|
|
814
|
+
/** Pages pinned at each end. Defaults to the v1 window. */
|
|
815
|
+
boundaryCount = input(1, ...(ngDevMode ? [{ debugName: "boundaryCount" }] : /* istanbul ignore next */ []));
|
|
816
|
+
/** The page-window computation, swappable enterprise-wide via the DI token. */
|
|
817
|
+
pageWindowFn = inject(CNGX_PAGINATOR_PAGE_WINDOW_FACTORY)();
|
|
818
|
+
/**
|
|
819
|
+
* The rendered page window. Structural `equal` keeps the reference stable
|
|
820
|
+
* across recomputes that yield an identical window, so the `@for` does not
|
|
821
|
+
* churn (signal-equality rule).
|
|
822
|
+
*/
|
|
823
|
+
model = computed(() => this.pageWindowFn(this.host.pageIndex(), this.host.totalPages(), this.siblingCount(), this.boundaryCount()), { ...(ngDevMode ? { debugName: "model" } : /* istanbul ignore next */ {}), equal: pageWindowEqual });
|
|
824
|
+
/** Position of the active page within the rendered window (gaps counted). */
|
|
825
|
+
activeWindowIndex = computed(() => {
|
|
826
|
+
const current = this.host.pageIndex();
|
|
827
|
+
const idx = this.model().pages.findIndex((item) => item.kind === 'page' && item.index === current);
|
|
828
|
+
return idx === -1 ? 0 : idx;
|
|
829
|
+
}, ...(ngDevMode ? [{ debugName: "activeWindowIndex" }] : /* istanbul ignore next */ []));
|
|
830
|
+
/**
|
|
831
|
+
* Roving focus cursor for the page row. A `linkedSignal` so the row's single
|
|
832
|
+
* tab stop tracks the active page (Tab lands on `aria-current`) yet still
|
|
833
|
+
* moves freely under the arrow keys between selections: arrow navigation
|
|
834
|
+
* writes the cursor locally, and it re-syncs to the active page whenever the
|
|
835
|
+
* page changes by any path (click / prev / next / Enter). Focus is not
|
|
836
|
+
* selection - the user arrows to a page and Enter commits it.
|
|
837
|
+
*/
|
|
838
|
+
rovingIndex = linkedSignal(() => this.activeWindowIndex(), ...(ngDevMode ? [{ debugName: "rovingIndex" }] : /* istanbul ignore next */ []));
|
|
839
|
+
isCurrent(index) {
|
|
840
|
+
return index === this.host.pageIndex();
|
|
841
|
+
}
|
|
842
|
+
goto(index) {
|
|
843
|
+
this.host.setPage(index);
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Open the overflow popover and move focus into the listbox panel, so a
|
|
847
|
+
* keyboard user lands in the grid (the trigger is a roving page-row item, so
|
|
848
|
+
* the listbox trigger's own focus-move does not fire). `Enter`/`Space` on the
|
|
849
|
+
* button dispatch a native click, so this covers mouse and keyboard alike.
|
|
850
|
+
*/
|
|
851
|
+
openOverflow(popover, panel) {
|
|
852
|
+
popover.toggle();
|
|
853
|
+
if (popover.isVisible()) {
|
|
854
|
+
queueMicrotask(() => panel.focus());
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Restore focus to the ellipsis trigger when the panel closes (Escape /
|
|
859
|
+
* outside click), so a keyboard user is not dropped to the page body. If a
|
|
860
|
+
* selection re-rendered the window away, the trigger is gone and the guard
|
|
861
|
+
* skips it.
|
|
862
|
+
*/
|
|
863
|
+
onOverflowToggle(event, trigger) {
|
|
864
|
+
if (event.newState === 'closed' && trigger.isConnected) {
|
|
865
|
+
trigger.focus();
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
onSelectOverflow(value) {
|
|
869
|
+
if (typeof value === 'number') {
|
|
870
|
+
this.host.setPage(value);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorPages, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
874
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxPaginatorPages, isStandalone: true, selector: "cngx-pgn-pages", inputs: { siblingCount: { classPropertyName: "siblingCount", publicName: "siblingCount", isSignal: true, isRequired: false, transformFunction: null }, boundaryCount: { classPropertyName: "boundaryCount", publicName: "boundaryCount", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnPages"], ngImport: i0, template: `
|
|
875
|
+
<div class="cngx-paginator__pages" cngxRovingTabindex [(activeIndex)]="rovingIndex">
|
|
876
|
+
@for (item of model().pages; track $index) {
|
|
877
|
+
@if (item.kind === 'page') {
|
|
878
|
+
<button
|
|
879
|
+
type="button"
|
|
880
|
+
cngxRovingItem
|
|
881
|
+
class="cngx-paginator__button cngx-paginator__page"
|
|
882
|
+
[class.cngx-paginator__page--current]="isCurrent(item.index)"
|
|
883
|
+
[attr.aria-current]="isCurrent(item.index) ? 'page' : null"
|
|
884
|
+
[attr.aria-label]="config.ariaLabels.page(item.index + 1)"
|
|
885
|
+
[attr.aria-disabled]="host.isBusy() ? 'true' : null"
|
|
886
|
+
(click)="goto(item.index)"
|
|
887
|
+
>
|
|
888
|
+
{{ item.index + 1 }}
|
|
889
|
+
</button>
|
|
890
|
+
} @else {
|
|
891
|
+
<button
|
|
892
|
+
type="button"
|
|
893
|
+
cngxRovingItem
|
|
894
|
+
#moreBtn
|
|
895
|
+
class="cngx-paginator__button cngx-paginator__more"
|
|
896
|
+
[cngxListboxTrigger]="moreList"
|
|
897
|
+
[cngxPopoverTrigger]="morePopover"
|
|
898
|
+
[haspopup]="'listbox'"
|
|
899
|
+
[popover]="morePopover"
|
|
900
|
+
[attr.aria-label]="config.ariaLabels.morePages"
|
|
901
|
+
(click)="openOverflow(morePopover, moreUl)"
|
|
902
|
+
>
|
|
903
|
+
{{ glyphs.more }}
|
|
904
|
+
</button>
|
|
905
|
+
<div
|
|
906
|
+
cngxPopover
|
|
907
|
+
#morePopover="cngxPopover"
|
|
908
|
+
[closeOnOutsideClick]="true"
|
|
909
|
+
(toggle)="onOverflowToggle($event, moreBtn)"
|
|
910
|
+
>
|
|
911
|
+
<ul
|
|
912
|
+
cngxListbox
|
|
913
|
+
#moreList="cngxListbox"
|
|
914
|
+
#moreUl
|
|
915
|
+
tabindex="0"
|
|
916
|
+
class="cngx-paginator__overflow-panel"
|
|
917
|
+
[label]="config.ariaLabels.morePages"
|
|
918
|
+
[value]="null"
|
|
919
|
+
(valueChange)="onSelectOverflow($event)"
|
|
920
|
+
>
|
|
921
|
+
@for (hidden of item.hidden; track hidden) {
|
|
922
|
+
<li cngxOption class="cngx-paginator__option" [value]="hidden">{{ hidden + 1 }}</li>
|
|
923
|
+
}
|
|
924
|
+
</ul>
|
|
925
|
+
</div>
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
</div>
|
|
929
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: CngxRovingTabindex, selector: "[cngxRovingTabindex]", inputs: ["orientation", "loop", "activeIndex", "virtualCount"], outputs: ["orientationChange", "activeIndexChange"], exportAs: ["cngxRovingTabindex"] }, { kind: "directive", type: CngxRovingItem, selector: "[cngxRovingItem]", inputs: ["cngxRovingItemDisabled"], exportAs: ["cngxRovingItem"] }, { kind: "directive", type: CngxListbox, selector: "[cngxListbox]", inputs: ["label", "value", "selectedValues", "multiple", "compareWith", "cngxSearchRef", "externalActivation", "explicitOptions"], outputs: ["valueChange", "selectedValuesChange"], exportAs: ["cngxListbox"] }, { kind: "directive", type: CngxListboxTrigger, selector: "[cngxListboxTrigger]", inputs: ["cngxListboxTrigger", "popover", "closeOnSelect"], outputs: ["backspaceOnEmpty"], exportAs: ["cngxListboxTrigger"] }, { kind: "directive", type: CngxOption, selector: "[cngxOption]", inputs: ["value", "disabled", "label"], exportAs: ["cngxOption"] }, { kind: "directive", type: CngxPopover, selector: "[cngxPopover]", inputs: ["placement", "positionTryFallbacks", "offset", "closeOnEscape", "closeOnOutsideClick", "mode", "cngxPopoverOpen", "exclusive"], exportAs: ["cngxPopover"] }, { kind: "directive", type: CngxPopoverTrigger, selector: "[cngxPopoverTrigger]", inputs: ["cngxPopoverTrigger", "haspopup", "restoreFocus"], exportAs: ["cngxPopoverTrigger"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
930
|
+
}
|
|
931
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorPages, decorators: [{
|
|
932
|
+
type: Component,
|
|
933
|
+
args: [{
|
|
934
|
+
selector: 'cngx-pgn-pages',
|
|
935
|
+
exportAs: 'cngxPgnPages',
|
|
936
|
+
standalone: true,
|
|
937
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
938
|
+
encapsulation: ViewEncapsulation.None,
|
|
939
|
+
imports: [
|
|
940
|
+
CngxRovingTabindex,
|
|
941
|
+
CngxRovingItem,
|
|
942
|
+
CngxListbox,
|
|
943
|
+
CngxListboxTrigger,
|
|
944
|
+
CngxOption,
|
|
945
|
+
CngxPopover,
|
|
946
|
+
CngxPopoverTrigger,
|
|
947
|
+
],
|
|
948
|
+
template: `
|
|
949
|
+
<div class="cngx-paginator__pages" cngxRovingTabindex [(activeIndex)]="rovingIndex">
|
|
950
|
+
@for (item of model().pages; track $index) {
|
|
951
|
+
@if (item.kind === 'page') {
|
|
952
|
+
<button
|
|
953
|
+
type="button"
|
|
954
|
+
cngxRovingItem
|
|
955
|
+
class="cngx-paginator__button cngx-paginator__page"
|
|
956
|
+
[class.cngx-paginator__page--current]="isCurrent(item.index)"
|
|
957
|
+
[attr.aria-current]="isCurrent(item.index) ? 'page' : null"
|
|
958
|
+
[attr.aria-label]="config.ariaLabels.page(item.index + 1)"
|
|
959
|
+
[attr.aria-disabled]="host.isBusy() ? 'true' : null"
|
|
960
|
+
(click)="goto(item.index)"
|
|
961
|
+
>
|
|
962
|
+
{{ item.index + 1 }}
|
|
963
|
+
</button>
|
|
964
|
+
} @else {
|
|
965
|
+
<button
|
|
966
|
+
type="button"
|
|
967
|
+
cngxRovingItem
|
|
968
|
+
#moreBtn
|
|
969
|
+
class="cngx-paginator__button cngx-paginator__more"
|
|
970
|
+
[cngxListboxTrigger]="moreList"
|
|
971
|
+
[cngxPopoverTrigger]="morePopover"
|
|
972
|
+
[haspopup]="'listbox'"
|
|
973
|
+
[popover]="morePopover"
|
|
974
|
+
[attr.aria-label]="config.ariaLabels.morePages"
|
|
975
|
+
(click)="openOverflow(morePopover, moreUl)"
|
|
976
|
+
>
|
|
977
|
+
{{ glyphs.more }}
|
|
978
|
+
</button>
|
|
979
|
+
<div
|
|
980
|
+
cngxPopover
|
|
981
|
+
#morePopover="cngxPopover"
|
|
982
|
+
[closeOnOutsideClick]="true"
|
|
983
|
+
(toggle)="onOverflowToggle($event, moreBtn)"
|
|
984
|
+
>
|
|
985
|
+
<ul
|
|
986
|
+
cngxListbox
|
|
987
|
+
#moreList="cngxListbox"
|
|
988
|
+
#moreUl
|
|
989
|
+
tabindex="0"
|
|
990
|
+
class="cngx-paginator__overflow-panel"
|
|
991
|
+
[label]="config.ariaLabels.morePages"
|
|
992
|
+
[value]="null"
|
|
993
|
+
(valueChange)="onSelectOverflow($event)"
|
|
994
|
+
>
|
|
995
|
+
@for (hidden of item.hidden; track hidden) {
|
|
996
|
+
<li cngxOption class="cngx-paginator__option" [value]="hidden">{{ hidden + 1 }}</li>
|
|
997
|
+
}
|
|
998
|
+
</ul>
|
|
999
|
+
</div>
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
</div>
|
|
1003
|
+
`,
|
|
1004
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1005
|
+
}]
|
|
1006
|
+
}], propDecorators: { siblingCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "siblingCount", required: false }] }], boundaryCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundaryCount", required: false }] }] } });
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Range-readout segment: renders `start-end of total` for the current page.
|
|
1010
|
+
* Pure derivation from the host `range()`/`total()` signals - no local state,
|
|
1011
|
+
* no writes. The text (including the `of` connector) comes from the
|
|
1012
|
+
* config range formatter, so it localises with the rest of the cascade. Tabular
|
|
1013
|
+
* figures keep the numerals from reflowing as the page changes.
|
|
1014
|
+
*
|
|
1015
|
+
* @category ui/paginator
|
|
1016
|
+
* @wcag AA
|
|
1017
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-range.component.ts
|
|
1018
|
+
* @since 0.1.0
|
|
1019
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/range/readout</example-url>
|
|
1020
|
+
*/
|
|
1021
|
+
class CngxPaginatorRange {
|
|
1022
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
1023
|
+
config = injectPaginatorConfig();
|
|
1024
|
+
/** 1-based index of the first item on the current page (0 when empty). */
|
|
1025
|
+
start = computed(() => this.host.total() === 0 ? 0 : this.host.range()[0] + 1, ...(ngDevMode ? [{ debugName: "start" }] : /* istanbul ignore next */ []));
|
|
1026
|
+
/**
|
|
1027
|
+
* 1-based index of the last item on the current page. The brain's `range()`
|
|
1028
|
+
* upper bound is uncapped (`start + pageSize`), so a partial final page is
|
|
1029
|
+
* clamped to `total` here for an honest readout.
|
|
1030
|
+
*/
|
|
1031
|
+
end = computed(() => Math.min(this.host.range()[1], this.host.total()), ...(ngDevMode ? [{ debugName: "end" }] : /* istanbul ignore next */ []));
|
|
1032
|
+
/** Formatted readout from the config range formatter (EN default `start-end of total`). */
|
|
1033
|
+
text = computed(() => this.config.formats.range(this.start(), this.end(), this.host.total()), ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
|
|
1034
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorRange, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1035
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxPaginatorRange, isStandalone: true, selector: "cngx-pgn-range", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnRange"], ngImport: i0, template: `<span class="cngx-paginator__range" [innerHTML]="text()"></span>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1036
|
+
}
|
|
1037
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorRange, decorators: [{
|
|
1038
|
+
type: Component,
|
|
1039
|
+
args: [{
|
|
1040
|
+
selector: 'cngx-pgn-range',
|
|
1041
|
+
exportAs: 'cngxPgnRange',
|
|
1042
|
+
standalone: true,
|
|
1043
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1044
|
+
encapsulation: ViewEncapsulation.None,
|
|
1045
|
+
template: `<span class="cngx-paginator__range" [innerHTML]="text()"></span>`,
|
|
1046
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1047
|
+
}]
|
|
1048
|
+
}] });
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Go-to-page segment: a native `<input type="number">`. \
|
|
1052
|
+
* Typing (or the spinner) navigates live via `input`; Enter / blur additionally clamp and re-sync the
|
|
1053
|
+
* field. The brain clamps out-of-range values, so the field reflects the clamped
|
|
1054
|
+
* page back. Accessible name from config (EN default, Pillar 2).
|
|
1055
|
+
*
|
|
1056
|
+
* @category ui/paginator
|
|
1057
|
+
* @wcag AA
|
|
1058
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-goto.component.ts
|
|
1059
|
+
* @since 0.1.0
|
|
1060
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/goto/input</example-url>
|
|
1061
|
+
*/
|
|
1062
|
+
class CngxPaginatorGoto {
|
|
1063
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
1064
|
+
config = injectPaginatorConfig();
|
|
1065
|
+
/** Live navigation on every keystroke / spinner step - no field re-sync, so
|
|
1066
|
+
* typing is never interrupted; the clamp re-sync happens on commit. */
|
|
1067
|
+
navigate(event) {
|
|
1068
|
+
const value = Number(event.target.value);
|
|
1069
|
+
if (Number.isFinite(value) && value >= 1) {
|
|
1070
|
+
this.host.setPage(value - 1);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
commit(event) {
|
|
1074
|
+
const input = event.target;
|
|
1075
|
+
const value = Number(input.value);
|
|
1076
|
+
if (Number.isFinite(value) && value >= 1) {
|
|
1077
|
+
this.host.setPage(value - 1);
|
|
1078
|
+
}
|
|
1079
|
+
// Re-sync the field to the effective page: the brain may have clamped to a
|
|
1080
|
+
// bound (no signal change, so the [value] binding would not refresh), or
|
|
1081
|
+
// rejected an empty / sub-1 entry. Either way the field shows the truth.
|
|
1082
|
+
input.value = String(this.host.pageIndex() + 1);
|
|
1083
|
+
}
|
|
1084
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorGoto, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1085
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxPaginatorGoto, isStandalone: true, selector: "cngx-pgn-goto", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnGoto"], ngImport: i0, template: `
|
|
1086
|
+
<input
|
|
1087
|
+
type="number"
|
|
1088
|
+
class="cngx-paginator__goto-input"
|
|
1089
|
+
min="1"
|
|
1090
|
+
[max]="host.totalPages()"
|
|
1091
|
+
[value]="host.pageIndex() + 1"
|
|
1092
|
+
[attr.aria-label]="config.ariaLabels.goToPage"
|
|
1093
|
+
[attr.aria-disabled]="host.isBusy() ? 'true' : null"
|
|
1094
|
+
(input)="navigate($event)"
|
|
1095
|
+
(keydown.enter)="commit($event)"
|
|
1096
|
+
(blur)="commit($event)"
|
|
1097
|
+
/>
|
|
1098
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1099
|
+
}
|
|
1100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorGoto, decorators: [{
|
|
1101
|
+
type: Component,
|
|
1102
|
+
args: [{
|
|
1103
|
+
selector: 'cngx-pgn-goto',
|
|
1104
|
+
exportAs: 'cngxPgnGoto',
|
|
1105
|
+
standalone: true,
|
|
1106
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1107
|
+
encapsulation: ViewEncapsulation.None,
|
|
1108
|
+
template: `
|
|
1109
|
+
<input
|
|
1110
|
+
type="number"
|
|
1111
|
+
class="cngx-paginator__goto-input"
|
|
1112
|
+
min="1"
|
|
1113
|
+
[max]="host.totalPages()"
|
|
1114
|
+
[value]="host.pageIndex() + 1"
|
|
1115
|
+
[attr.aria-label]="config.ariaLabels.goToPage"
|
|
1116
|
+
[attr.aria-disabled]="host.isBusy() ? 'true' : null"
|
|
1117
|
+
(input)="navigate($event)"
|
|
1118
|
+
(keydown.enter)="commit($event)"
|
|
1119
|
+
(blur)="commit($event)"
|
|
1120
|
+
/>
|
|
1121
|
+
`,
|
|
1122
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1123
|
+
}]
|
|
1124
|
+
}] });
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Items-per-page segment. A `CngxListbox` dropdown (never a native `<select>`,
|
|
1128
|
+
* never the forms select family - keeps `@cngx/ui/paginator` free of a
|
|
1129
|
+
* `@cngx/forms` dependency). `[options]` is data, not a feature toggle.
|
|
1130
|
+
* Picking a size routes through `host.setPageSize`, which resets to
|
|
1131
|
+
* page 0 (brain semantics). The selected size is derived from `host.pageSize()`,
|
|
1132
|
+
* so the panel selection and the trigger label never drift (Pillar 1).
|
|
1133
|
+
*
|
|
1134
|
+
* @category ui/paginator
|
|
1135
|
+
* @wcag AA
|
|
1136
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-page-size.component.ts
|
|
1137
|
+
* @since 0.1.0
|
|
1138
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/page-size/dropdown</example-url>
|
|
1139
|
+
*/
|
|
1140
|
+
class CngxPaginatorPageSize {
|
|
1141
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
1142
|
+
config = injectPaginatorConfig();
|
|
1143
|
+
glyphs = CNGX_PAGINATOR_GLYPHS;
|
|
1144
|
+
/**
|
|
1145
|
+
* Selectable page sizes. Pure data - the segment is content-agnostic. Leave
|
|
1146
|
+
* unbound (or empty) to fall back to the cascade default
|
|
1147
|
+
* (`CNGX_PAGINATOR_CONFIG.pageSizeOptions`, set app-wide via
|
|
1148
|
+
* `withPaginatorPageSizeOptions`); a non-empty binding wins over it.
|
|
1149
|
+
*/
|
|
1150
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
1151
|
+
/**
|
|
1152
|
+
* The sizes actually rendered: the per-instance `[options]` when non-empty,
|
|
1153
|
+
* otherwise the config cascade default. A pure derivation - no synced state
|
|
1154
|
+
* (Pillar 1).
|
|
1155
|
+
*/
|
|
1156
|
+
resolvedOptions = computed(() => {
|
|
1157
|
+
const instance = this.options();
|
|
1158
|
+
return instance.length > 0 ? instance : this.config.pageSizeOptions;
|
|
1159
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedOptions" }] : /* istanbul ignore next */ []));
|
|
1160
|
+
onSelect(value) {
|
|
1161
|
+
if (typeof value === 'number') {
|
|
1162
|
+
this.host.setPageSize(value);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorPageSize, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1166
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxPaginatorPageSize, isStandalone: true, selector: "cngx-pgn-page-size", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnPageSize"], ngImport: i0, template: `
|
|
1167
|
+
<button
|
|
1168
|
+
type="button"
|
|
1169
|
+
class="cngx-paginator__button cngx-paginator__select"
|
|
1170
|
+
[cngxListboxTrigger]="lb"
|
|
1171
|
+
[cngxPopoverTrigger]="pop"
|
|
1172
|
+
[haspopup]="'listbox'"
|
|
1173
|
+
[popover]="pop"
|
|
1174
|
+
[attr.aria-label]="config.ariaLabels.itemsPerPage"
|
|
1175
|
+
[disabled]="host.isBusy()"
|
|
1176
|
+
(click)="pop.toggle()"
|
|
1177
|
+
>
|
|
1178
|
+
<span class="cngx-paginator__select-label">{{ host.pageSize() }}</span>
|
|
1179
|
+
<span class="cngx-paginator__select-caret" aria-hidden="true">{{ glyphs.caret }}</span>
|
|
1180
|
+
</button>
|
|
1181
|
+
<div cngxPopover #pop="cngxPopover" [closeOnOutsideClick]="true">
|
|
1182
|
+
<ul
|
|
1183
|
+
cngxListbox
|
|
1184
|
+
class="cngx-paginator__select-panel"
|
|
1185
|
+
tabindex="0"
|
|
1186
|
+
[label]="config.ariaLabels.itemsPerPage"
|
|
1187
|
+
[value]="host.pageSize()"
|
|
1188
|
+
(valueChange)="onSelect($event)"
|
|
1189
|
+
#lb="cngxListbox"
|
|
1190
|
+
>
|
|
1191
|
+
@for (option of resolvedOptions(); track option) {
|
|
1192
|
+
<li cngxOption class="cngx-paginator__option" [value]="option">{{ option }}</li>
|
|
1193
|
+
}
|
|
1194
|
+
</ul>
|
|
1195
|
+
</div>
|
|
1196
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: CngxListbox, selector: "[cngxListbox]", inputs: ["label", "value", "selectedValues", "multiple", "compareWith", "cngxSearchRef", "externalActivation", "explicitOptions"], outputs: ["valueChange", "selectedValuesChange"], exportAs: ["cngxListbox"] }, { kind: "directive", type: CngxListboxTrigger, selector: "[cngxListboxTrigger]", inputs: ["cngxListboxTrigger", "popover", "closeOnSelect"], outputs: ["backspaceOnEmpty"], exportAs: ["cngxListboxTrigger"] }, { kind: "directive", type: CngxOption, selector: "[cngxOption]", inputs: ["value", "disabled", "label"], exportAs: ["cngxOption"] }, { kind: "directive", type: CngxPopover, selector: "[cngxPopover]", inputs: ["placement", "positionTryFallbacks", "offset", "closeOnEscape", "closeOnOutsideClick", "mode", "cngxPopoverOpen", "exclusive"], exportAs: ["cngxPopover"] }, { kind: "directive", type: CngxPopoverTrigger, selector: "[cngxPopoverTrigger]", inputs: ["cngxPopoverTrigger", "haspopup", "restoreFocus"], exportAs: ["cngxPopoverTrigger"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1197
|
+
}
|
|
1198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorPageSize, decorators: [{
|
|
1199
|
+
type: Component,
|
|
1200
|
+
args: [{
|
|
1201
|
+
selector: 'cngx-pgn-page-size',
|
|
1202
|
+
exportAs: 'cngxPgnPageSize',
|
|
1203
|
+
standalone: true,
|
|
1204
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1205
|
+
encapsulation: ViewEncapsulation.None,
|
|
1206
|
+
imports: [CngxListbox, CngxListboxTrigger, CngxOption, CngxPopover, CngxPopoverTrigger],
|
|
1207
|
+
template: `
|
|
1208
|
+
<button
|
|
1209
|
+
type="button"
|
|
1210
|
+
class="cngx-paginator__button cngx-paginator__select"
|
|
1211
|
+
[cngxListboxTrigger]="lb"
|
|
1212
|
+
[cngxPopoverTrigger]="pop"
|
|
1213
|
+
[haspopup]="'listbox'"
|
|
1214
|
+
[popover]="pop"
|
|
1215
|
+
[attr.aria-label]="config.ariaLabels.itemsPerPage"
|
|
1216
|
+
[disabled]="host.isBusy()"
|
|
1217
|
+
(click)="pop.toggle()"
|
|
1218
|
+
>
|
|
1219
|
+
<span class="cngx-paginator__select-label">{{ host.pageSize() }}</span>
|
|
1220
|
+
<span class="cngx-paginator__select-caret" aria-hidden="true">{{ glyphs.caret }}</span>
|
|
1221
|
+
</button>
|
|
1222
|
+
<div cngxPopover #pop="cngxPopover" [closeOnOutsideClick]="true">
|
|
1223
|
+
<ul
|
|
1224
|
+
cngxListbox
|
|
1225
|
+
class="cngx-paginator__select-panel"
|
|
1226
|
+
tabindex="0"
|
|
1227
|
+
[label]="config.ariaLabels.itemsPerPage"
|
|
1228
|
+
[value]="host.pageSize()"
|
|
1229
|
+
(valueChange)="onSelect($event)"
|
|
1230
|
+
#lb="cngxListbox"
|
|
1231
|
+
>
|
|
1232
|
+
@for (option of resolvedOptions(); track option) {
|
|
1233
|
+
<li cngxOption class="cngx-paginator__option" [value]="option">{{ option }}</li>
|
|
1234
|
+
}
|
|
1235
|
+
</ul>
|
|
1236
|
+
</div>
|
|
1237
|
+
`,
|
|
1238
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1239
|
+
}]
|
|
1240
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Page-of-pages segment. A `CngxListbox` dropdown of `1..totalPages`; picking
|
|
1244
|
+
* page `n` routes through `host.setPage(n - 1)`. The option list is derived
|
|
1245
|
+
* from `host.totalPages()` and the selected entry from `host.pageIndex()`, so
|
|
1246
|
+
* both track the brain with zero local state (Pillar 1). Like the page-size
|
|
1247
|
+
* segment it avoids native `<select>` and the forms family, keeping the entry
|
|
1248
|
+
* `@cngx/forms`-free.
|
|
1249
|
+
*
|
|
1250
|
+
* @category ui/paginator
|
|
1251
|
+
* @wcag AA
|
|
1252
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-page-of-pages.component.ts
|
|
1253
|
+
* @since 0.1.0
|
|
1254
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/page-of-pages/trigger</example-url>
|
|
1255
|
+
*/
|
|
1256
|
+
class CngxPaginatorPageOfPages {
|
|
1257
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
1258
|
+
config = injectPaginatorConfig();
|
|
1259
|
+
glyphs = CNGX_PAGINATOR_GLYPHS;
|
|
1260
|
+
/**
|
|
1261
|
+
* The 1-based page numbers `1..totalPages`. Length-keyed `equal` keeps the
|
|
1262
|
+
* reference stable while the count is unchanged - the contents are fully
|
|
1263
|
+
* determined by the length, so the `@for` never churns (signal-equality rule).
|
|
1264
|
+
*/
|
|
1265
|
+
pages = computed(() => Array.from({ length: this.host.totalPages() }, (_, i) => i + 1), { ...(ngDevMode ? { debugName: "pages" } : /* istanbul ignore next */ {}), equal: (a, b) => a.length === b.length });
|
|
1266
|
+
onSelect(value) {
|
|
1267
|
+
if (typeof value === 'number') {
|
|
1268
|
+
this.host.setPage(value - 1);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorPageOfPages, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1272
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxPaginatorPageOfPages, isStandalone: true, selector: "cngx-pgn-page-of-pages", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnPageOfPages"], ngImport: i0, template: `
|
|
1273
|
+
<button
|
|
1274
|
+
type="button"
|
|
1275
|
+
class="cngx-paginator__button cngx-paginator__select"
|
|
1276
|
+
[cngxListboxTrigger]="lb"
|
|
1277
|
+
[cngxPopoverTrigger]="pop"
|
|
1278
|
+
[haspopup]="'listbox'"
|
|
1279
|
+
[popover]="pop"
|
|
1280
|
+
[attr.aria-label]="config.ariaLabels.pageOfPages"
|
|
1281
|
+
[disabled]="host.isBusy()"
|
|
1282
|
+
(click)="pop.toggle()"
|
|
1283
|
+
>
|
|
1284
|
+
<span class="cngx-paginator__select-label"
|
|
1285
|
+
><b>{{ host.pageIndex() + 1 }}</b> / {{ host.totalPages() }}</span
|
|
1286
|
+
>
|
|
1287
|
+
<span class="cngx-paginator__select-caret" aria-hidden="true">{{ glyphs.caret }}</span>
|
|
1288
|
+
</button>
|
|
1289
|
+
<div cngxPopover #pop="cngxPopover" [closeOnOutsideClick]="true">
|
|
1290
|
+
<ul
|
|
1291
|
+
cngxListbox
|
|
1292
|
+
class="cngx-paginator__overflow-panel"
|
|
1293
|
+
tabindex="0"
|
|
1294
|
+
[label]="config.ariaLabels.pageOfPages"
|
|
1295
|
+
[value]="host.pageIndex() + 1"
|
|
1296
|
+
(valueChange)="onSelect($event)"
|
|
1297
|
+
#lb="cngxListbox"
|
|
1298
|
+
>
|
|
1299
|
+
@for (page of pages(); track page) {
|
|
1300
|
+
<li cngxOption class="cngx-paginator__option" [value]="page">{{ page }}</li>
|
|
1301
|
+
}
|
|
1302
|
+
</ul>
|
|
1303
|
+
</div>
|
|
1304
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: CngxListbox, selector: "[cngxListbox]", inputs: ["label", "value", "selectedValues", "multiple", "compareWith", "cngxSearchRef", "externalActivation", "explicitOptions"], outputs: ["valueChange", "selectedValuesChange"], exportAs: ["cngxListbox"] }, { kind: "directive", type: CngxListboxTrigger, selector: "[cngxListboxTrigger]", inputs: ["cngxListboxTrigger", "popover", "closeOnSelect"], outputs: ["backspaceOnEmpty"], exportAs: ["cngxListboxTrigger"] }, { kind: "directive", type: CngxOption, selector: "[cngxOption]", inputs: ["value", "disabled", "label"], exportAs: ["cngxOption"] }, { kind: "directive", type: CngxPopover, selector: "[cngxPopover]", inputs: ["placement", "positionTryFallbacks", "offset", "closeOnEscape", "closeOnOutsideClick", "mode", "cngxPopoverOpen", "exclusive"], exportAs: ["cngxPopover"] }, { kind: "directive", type: CngxPopoverTrigger, selector: "[cngxPopoverTrigger]", inputs: ["cngxPopoverTrigger", "haspopup", "restoreFocus"], exportAs: ["cngxPopoverTrigger"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1305
|
+
}
|
|
1306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorPageOfPages, decorators: [{
|
|
1307
|
+
type: Component,
|
|
1308
|
+
args: [{
|
|
1309
|
+
selector: 'cngx-pgn-page-of-pages',
|
|
1310
|
+
exportAs: 'cngxPgnPageOfPages',
|
|
1311
|
+
standalone: true,
|
|
1312
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1313
|
+
encapsulation: ViewEncapsulation.None,
|
|
1314
|
+
imports: [CngxListbox, CngxListboxTrigger, CngxOption, CngxPopover, CngxPopoverTrigger],
|
|
1315
|
+
template: `
|
|
1316
|
+
<button
|
|
1317
|
+
type="button"
|
|
1318
|
+
class="cngx-paginator__button cngx-paginator__select"
|
|
1319
|
+
[cngxListboxTrigger]="lb"
|
|
1320
|
+
[cngxPopoverTrigger]="pop"
|
|
1321
|
+
[haspopup]="'listbox'"
|
|
1322
|
+
[popover]="pop"
|
|
1323
|
+
[attr.aria-label]="config.ariaLabels.pageOfPages"
|
|
1324
|
+
[disabled]="host.isBusy()"
|
|
1325
|
+
(click)="pop.toggle()"
|
|
1326
|
+
>
|
|
1327
|
+
<span class="cngx-paginator__select-label"
|
|
1328
|
+
><b>{{ host.pageIndex() + 1 }}</b> / {{ host.totalPages() }}</span
|
|
1329
|
+
>
|
|
1330
|
+
<span class="cngx-paginator__select-caret" aria-hidden="true">{{ glyphs.caret }}</span>
|
|
1331
|
+
</button>
|
|
1332
|
+
<div cngxPopover #pop="cngxPopover" [closeOnOutsideClick]="true">
|
|
1333
|
+
<ul
|
|
1334
|
+
cngxListbox
|
|
1335
|
+
class="cngx-paginator__overflow-panel"
|
|
1336
|
+
tabindex="0"
|
|
1337
|
+
[label]="config.ariaLabels.pageOfPages"
|
|
1338
|
+
[value]="host.pageIndex() + 1"
|
|
1339
|
+
(valueChange)="onSelect($event)"
|
|
1340
|
+
#lb="cngxListbox"
|
|
1341
|
+
>
|
|
1342
|
+
@for (page of pages(); track page) {
|
|
1343
|
+
<li cngxOption class="cngx-paginator__option" [value]="page">{{ page }}</li>
|
|
1344
|
+
}
|
|
1345
|
+
</ul>
|
|
1346
|
+
</div>
|
|
1347
|
+
`,
|
|
1348
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1349
|
+
}]
|
|
1350
|
+
}] });
|
|
1351
|
+
|
|
1352
|
+
/** Visible dot count in the viewport before the track scrolls. */
|
|
1353
|
+
const VISIBLE = 7;
|
|
1354
|
+
/** Pages flanking the centred current page inside the viewport. */
|
|
1355
|
+
const HALF = Math.floor(VISIBLE / 2);
|
|
1356
|
+
/**
|
|
1357
|
+
* Build the full dot sequence plus the viewport anchor. Every page gets a dot;
|
|
1358
|
+
* for large counts the dots that fall outside the centred `VISIBLE` window are
|
|
1359
|
+
* shrunk to `small` (they sit off-screen behind the viewport clip and shrink as
|
|
1360
|
+
* they glide out), and the two dots at each truncated visible edge step down
|
|
1361
|
+
* medium -> small (iOS page-control edge-shrink). The consumer translates the
|
|
1362
|
+
* track by `firstVisible` so navigation slides the strip instead of reshuffling
|
|
1363
|
+
* the DOM - the active dot stays centred and the row glides under it.
|
|
1364
|
+
*/
|
|
1365
|
+
function buildDots(current, total) {
|
|
1366
|
+
const count = Math.max(0, total);
|
|
1367
|
+
if (count === 0) {
|
|
1368
|
+
return { dots: [], firstVisible: 0, windowed: false };
|
|
1369
|
+
}
|
|
1370
|
+
const windowed = count > VISIBLE;
|
|
1371
|
+
const clamped = Math.min(Math.max(current, 0), count - 1);
|
|
1372
|
+
const firstVisible = windowed ? Math.min(Math.max(clamped - HALF, 0), count - VISIBLE) : 0;
|
|
1373
|
+
const lastVisible = windowed ? firstVisible + VISIBLE - 1 : count - 1;
|
|
1374
|
+
const moreBefore = firstVisible > 0;
|
|
1375
|
+
const moreAfter = lastVisible < count - 1;
|
|
1376
|
+
const dots = [];
|
|
1377
|
+
for (let i = 0; i < count; i++) {
|
|
1378
|
+
let size = 'full';
|
|
1379
|
+
if (windowed) {
|
|
1380
|
+
if (i < firstVisible || i > lastVisible) {
|
|
1381
|
+
size = 'small';
|
|
1382
|
+
}
|
|
1383
|
+
else if (moreBefore && i === firstVisible) {
|
|
1384
|
+
size = 'small';
|
|
1385
|
+
}
|
|
1386
|
+
else if (moreBefore && i === firstVisible + 1) {
|
|
1387
|
+
size = 'medium';
|
|
1388
|
+
}
|
|
1389
|
+
else if (moreAfter && i === lastVisible) {
|
|
1390
|
+
size = 'small';
|
|
1391
|
+
}
|
|
1392
|
+
else if (moreAfter && i === lastVisible - 1) {
|
|
1393
|
+
size = 'medium';
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
dots.push({ index: i, size });
|
|
1397
|
+
}
|
|
1398
|
+
return { dots, firstVisible, windowed };
|
|
1399
|
+
}
|
|
1400
|
+
function dotsEqual(a, b) {
|
|
1401
|
+
if (a === b) {
|
|
1402
|
+
return true;
|
|
1403
|
+
}
|
|
1404
|
+
if (a.firstVisible !== b.firstVisible || a.windowed !== b.windowed) {
|
|
1405
|
+
return false;
|
|
1406
|
+
}
|
|
1407
|
+
if (a.dots.length !== b.dots.length) {
|
|
1408
|
+
return false;
|
|
1409
|
+
}
|
|
1410
|
+
return a.dots.every((d, i) => d.index === b.dots[i].index && d.size === b.dots[i].size);
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* The dots indicator: one circular `<button>` per page inside a clipped viewport
|
|
1414
|
+
* track. The active dot carries `aria-current="page"`; every dot exposes its page
|
|
1415
|
+
* name via `aria-label` (the circle is decorative). Click navigates through the
|
|
1416
|
+
* brain, gated while busy. For large counts the track glides (CSS transform
|
|
1417
|
+
* transition) to keep the active dot centred, iOS page-control style, instead of
|
|
1418
|
+
* reshuffling the DOM. Dot DOM + windowing live here, not in a shared atom.
|
|
1419
|
+
*
|
|
1420
|
+
* @category ui/paginator
|
|
1421
|
+
* @wcag AA
|
|
1422
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-dots.component.ts
|
|
1423
|
+
* @since 0.1.0
|
|
1424
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/dots/dots</example-url>
|
|
1425
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-skins/dots</example-url>
|
|
1426
|
+
*/
|
|
1427
|
+
class CngxPaginatorDots {
|
|
1428
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
1429
|
+
config = injectPaginatorConfig();
|
|
1430
|
+
/**
|
|
1431
|
+
* The rendered dots + viewport anchor. Structural `equal` keeps the reference
|
|
1432
|
+
* stable across recomputes that yield an identical model, so the `@for` does
|
|
1433
|
+
* not churn (signal-equality rule).
|
|
1434
|
+
*/
|
|
1435
|
+
model = computed(() => buildDots(this.host.pageIndex(), this.host.totalPages()), { ...(ngDevMode ? { debugName: "model" } : /* istanbul ignore next */ {}), equal: dotsEqual });
|
|
1436
|
+
isCurrent(index) {
|
|
1437
|
+
return index === this.host.pageIndex();
|
|
1438
|
+
}
|
|
1439
|
+
goto(index) {
|
|
1440
|
+
this.host.setPage(index);
|
|
1441
|
+
}
|
|
1442
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorDots, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1443
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxPaginatorDots, isStandalone: true, selector: "cngx-pgn-dots", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnDots"], ngImport: i0, template: `
|
|
1444
|
+
<div class="cngx-paginator__dots" [class.cngx-paginator__dots--windowed]="model().windowed">
|
|
1445
|
+
<div class="cngx-paginator__dots-track" [style.--cngx-paginator-dots-shift]="model().firstVisible">
|
|
1446
|
+
@for (dot of model().dots; track dot.index) {
|
|
1447
|
+
<button
|
|
1448
|
+
type="button"
|
|
1449
|
+
class="cngx-paginator__dot"
|
|
1450
|
+
[class.cngx-paginator__dot--current]="isCurrent(dot.index)"
|
|
1451
|
+
[attr.data-size]="dot.size"
|
|
1452
|
+
[attr.aria-current]="isCurrent(dot.index) ? 'page' : null"
|
|
1453
|
+
[attr.aria-label]="config.ariaLabels.page(dot.index + 1)"
|
|
1454
|
+
[attr.aria-disabled]="host.isBusy() ? 'true' : null"
|
|
1455
|
+
(click)="goto(dot.index)"
|
|
1456
|
+
></button>
|
|
1457
|
+
}
|
|
1458
|
+
</div>
|
|
1459
|
+
</div>
|
|
1460
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1461
|
+
}
|
|
1462
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorDots, decorators: [{
|
|
1463
|
+
type: Component,
|
|
1464
|
+
args: [{
|
|
1465
|
+
selector: 'cngx-pgn-dots',
|
|
1466
|
+
exportAs: 'cngxPgnDots',
|
|
1467
|
+
standalone: true,
|
|
1468
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1469
|
+
encapsulation: ViewEncapsulation.None,
|
|
1470
|
+
template: `
|
|
1471
|
+
<div class="cngx-paginator__dots" [class.cngx-paginator__dots--windowed]="model().windowed">
|
|
1472
|
+
<div class="cngx-paginator__dots-track" [style.--cngx-paginator-dots-shift]="model().firstVisible">
|
|
1473
|
+
@for (dot of model().dots; track dot.index) {
|
|
1474
|
+
<button
|
|
1475
|
+
type="button"
|
|
1476
|
+
class="cngx-paginator__dot"
|
|
1477
|
+
[class.cngx-paginator__dot--current]="isCurrent(dot.index)"
|
|
1478
|
+
[attr.data-size]="dot.size"
|
|
1479
|
+
[attr.aria-current]="isCurrent(dot.index) ? 'page' : null"
|
|
1480
|
+
[attr.aria-label]="config.ariaLabels.page(dot.index + 1)"
|
|
1481
|
+
[attr.aria-disabled]="host.isBusy() ? 'true' : null"
|
|
1482
|
+
(click)="goto(dot.index)"
|
|
1483
|
+
></button>
|
|
1484
|
+
}
|
|
1485
|
+
</div>
|
|
1486
|
+
</div>
|
|
1487
|
+
`,
|
|
1488
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1489
|
+
}]
|
|
1490
|
+
}] });
|
|
1491
|
+
|
|
1492
|
+
/**
|
|
1493
|
+
* Page-status readout: renders "Page n of m" for the current page. Pure
|
|
1494
|
+
* derivation from the host `pageIndex()`/`totalPages()` signals - no local
|
|
1495
|
+
* state, no writes. It is the visible counterpart of the
|
|
1496
|
+
* `announcements.pageChange` live-region phrasing, and the collapse target the
|
|
1497
|
+
* responsive number row swaps to once the paginator's container narrows. Text
|
|
1498
|
+
* comes from the config `pageStatus` formatter, so it localises with the rest of
|
|
1499
|
+
* the cascade; tabular figures keep the numerals from reflowing as the page
|
|
1500
|
+
* changes.
|
|
1501
|
+
*
|
|
1502
|
+
* @category ui/paginator
|
|
1503
|
+
* @wcag AA
|
|
1504
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-status.component.ts
|
|
1505
|
+
* @since 0.1.0
|
|
1506
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/status/readout</example-url>
|
|
1507
|
+
*/
|
|
1508
|
+
class CngxPaginatorStatus {
|
|
1509
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
1510
|
+
config = injectPaginatorConfig();
|
|
1511
|
+
/** Formatted "Page n of m" readout from the config formatter (1-based page). */
|
|
1512
|
+
text = computed(() => this.config.formats.pageStatus(this.host.pageIndex() + 1, this.host.totalPages()), ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
|
|
1513
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorStatus, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1514
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxPaginatorStatus, isStandalone: true, selector: "cngx-pgn-status", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnStatus"], ngImport: i0, template: `<span class="cngx-paginator__status" [innerHTML]="text()"></span>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1515
|
+
}
|
|
1516
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorStatus, decorators: [{
|
|
1517
|
+
type: Component,
|
|
1518
|
+
args: [{
|
|
1519
|
+
selector: 'cngx-pgn-status',
|
|
1520
|
+
exportAs: 'cngxPgnStatus',
|
|
1521
|
+
standalone: true,
|
|
1522
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1523
|
+
encapsulation: ViewEncapsulation.None,
|
|
1524
|
+
template: `<span class="cngx-paginator__status" [innerHTML]="text()"></span>`,
|
|
1525
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1526
|
+
}]
|
|
1527
|
+
}] });
|
|
1528
|
+
|
|
1529
|
+
/**
|
|
1530
|
+
* Progress-rail segment: a horizontal rail whose fill tracks the current page
|
|
1531
|
+
* position, with an overlaid knob riding the fill edge. The track, fill, and
|
|
1532
|
+
* `role="progressbar"` a11y are composed from the `CngxProgress` atom - not
|
|
1533
|
+
* reinvented here (same precedent as the progress-bar stepper). The only new
|
|
1534
|
+
* part is the position knob, a decorative (`aria-hidden`) dot positioned by an
|
|
1535
|
+
* inline `inset-inline-start.%`, which `CngxProgress` cannot express. The fill
|
|
1536
|
+
* percentage derives purely from the host `pageIndex()`/`totalPages()` signals -
|
|
1537
|
+
* no local state, no writes.
|
|
1538
|
+
*
|
|
1539
|
+
* @category ui/paginator
|
|
1540
|
+
* @wcag AA
|
|
1541
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-rail.component.ts
|
|
1542
|
+
* @since 0.1.0
|
|
1543
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/rail/rail</example-url>
|
|
1544
|
+
*/
|
|
1545
|
+
class CngxPaginatorRail {
|
|
1546
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
1547
|
+
config = injectPaginatorConfig();
|
|
1548
|
+
/**
|
|
1549
|
+
* Fill percentage (0-100) of the current page across the page span. A single
|
|
1550
|
+
* page (or none) reads 0; the last page reads 100. Drives both the composed
|
|
1551
|
+
* `cngx-progress` `[progress]` and the knob's inline position.
|
|
1552
|
+
*/
|
|
1553
|
+
fillPercent = computed(() => {
|
|
1554
|
+
const total = this.host.totalPages();
|
|
1555
|
+
return total <= 1 ? 0 : (this.host.pageIndex() / (total - 1)) * 100;
|
|
1556
|
+
}, ...(ngDevMode ? [{ debugName: "fillPercent" }] : /* istanbul ignore next */ []));
|
|
1557
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorRail, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1558
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxPaginatorRail, isStandalone: true, selector: "cngx-pgn-rail", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnRail"], ngImport: i0, template: `
|
|
1559
|
+
<div class="cngx-paginator__rail">
|
|
1560
|
+
<cngx-progress
|
|
1561
|
+
variant="linear"
|
|
1562
|
+
[progress]="fillPercent()"
|
|
1563
|
+
[label]="config.ariaLabels.railPosition"
|
|
1564
|
+
/>
|
|
1565
|
+
<span
|
|
1566
|
+
class="cngx-paginator__rail-knob"
|
|
1567
|
+
aria-hidden="true"
|
|
1568
|
+
[style.inset-inline-start.%]="fillPercent()"
|
|
1569
|
+
></span>
|
|
1570
|
+
</div>
|
|
1571
|
+
`, isInline: true, dependencies: [{ kind: "component", type: CngxProgress, selector: "cngx-progress", inputs: ["state", "progress", "variant", "showLabel", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1572
|
+
}
|
|
1573
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorRail, decorators: [{
|
|
1574
|
+
type: Component,
|
|
1575
|
+
args: [{
|
|
1576
|
+
selector: 'cngx-pgn-rail',
|
|
1577
|
+
exportAs: 'cngxPgnRail',
|
|
1578
|
+
standalone: true,
|
|
1579
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1580
|
+
encapsulation: ViewEncapsulation.None,
|
|
1581
|
+
imports: [CngxProgress],
|
|
1582
|
+
template: `
|
|
1583
|
+
<div class="cngx-paginator__rail">
|
|
1584
|
+
<cngx-progress
|
|
1585
|
+
variant="linear"
|
|
1586
|
+
[progress]="fillPercent()"
|
|
1587
|
+
[label]="config.ariaLabels.railPosition"
|
|
1588
|
+
/>
|
|
1589
|
+
<span
|
|
1590
|
+
class="cngx-paginator__rail-knob"
|
|
1591
|
+
aria-hidden="true"
|
|
1592
|
+
[style.inset-inline-start.%]="fillPercent()"
|
|
1593
|
+
></span>
|
|
1594
|
+
</div>
|
|
1595
|
+
`,
|
|
1596
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1597
|
+
}]
|
|
1598
|
+
}] });
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* Load-more segment: an append-don't-replace trigger over the same brain. \
|
|
1602
|
+
* One `host.next()` button plus a `shown / total` count readout. The cumulative
|
|
1603
|
+
* slice is derived by the brain (`host.cumulativeRange()`); this segment holds
|
|
1604
|
+
* no accumulation state - the consumer slices its own array from
|
|
1605
|
+
* `cumulativeRange()`.
|
|
1606
|
+
*
|
|
1607
|
+
* Disabled (and so a no-op) on the last page or while busy. \
|
|
1608
|
+
* `aria-disabled` (not native `disabled`) keeps the button focusable so AT hears the bound
|
|
1609
|
+
* state, matching the nav segments; the busy/position reason is already spoken
|
|
1610
|
+
* by the shell live region.
|
|
1611
|
+
*
|
|
1612
|
+
* @category ui/paginator
|
|
1613
|
+
* @wcag AA
|
|
1614
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-load-more.component.ts
|
|
1615
|
+
* @since 0.1.0
|
|
1616
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/load-more/button</example-url>
|
|
1617
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-modes/load-more</example-url>
|
|
1618
|
+
*/
|
|
1619
|
+
class CngxPaginatorLoadMore {
|
|
1620
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
1621
|
+
config = injectPaginatorConfig();
|
|
1622
|
+
/**
|
|
1623
|
+
* Accessible name from the config cascade. On the last page the actionable
|
|
1624
|
+
* `Load more` name is replaced with the exhausted-state `allLoaded` label so
|
|
1625
|
+
* AT does not announce an action on the disabled button.
|
|
1626
|
+
*/
|
|
1627
|
+
ariaLabel = computed(() => this.host.isLast()
|
|
1628
|
+
? this.config.ariaLabels.allLoaded(this.host.total())
|
|
1629
|
+
: this.config.ariaLabels.loadMore, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1630
|
+
/** Disabled on the last page or while busy - the trigger becomes a no-op. */
|
|
1631
|
+
disabled = computed(() => this.host.isLast() || this.host.isBusy(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1632
|
+
/**
|
|
1633
|
+
* Items revealed so far. The brain's `cumulativeRange()` upper bound is
|
|
1634
|
+
* uncapped (`(pageIndex + 1) * pageSize`), so a partial final page is clamped
|
|
1635
|
+
* to `total` here for an honest readout.
|
|
1636
|
+
*/
|
|
1637
|
+
shown = computed(() => Math.min(this.host.cumulativeRange()[1], this.host.total()), ...(ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []));
|
|
1638
|
+
/** Reveal the next page. Guarded so a disabled click is a no-op. */
|
|
1639
|
+
handleClick() {
|
|
1640
|
+
if (this.disabled()) {
|
|
1641
|
+
return;
|
|
1642
|
+
}
|
|
1643
|
+
this.host.next();
|
|
1644
|
+
}
|
|
1645
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorLoadMore, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1646
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxPaginatorLoadMore, isStandalone: true, selector: "cngx-pgn-load-more", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnLoadMore"], ngImport: i0, template: `
|
|
1647
|
+
<button
|
|
1648
|
+
type="button"
|
|
1649
|
+
class="cngx-paginator__button cngx-paginator__load-more"
|
|
1650
|
+
cngxRipple
|
|
1651
|
+
[attr.aria-label]="ariaLabel()"
|
|
1652
|
+
[attr.aria-disabled]="disabled()"
|
|
1653
|
+
(click)="handleClick()"
|
|
1654
|
+
>
|
|
1655
|
+
<span class="cngx-paginator__load-more-label">{{ ariaLabel() }}</span>
|
|
1656
|
+
@if (!host.isLast()) {
|
|
1657
|
+
<span class="cngx-paginator__load-more-count" aria-hidden="true">
|
|
1658
|
+
{{ shown() }} / {{ host.total() }}
|
|
1659
|
+
</span>
|
|
1660
|
+
}
|
|
1661
|
+
</button>
|
|
1662
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: CngxRipple, selector: "[cngxRipple]", inputs: ["rippleColor", "rippleCentered", "rippleDisabled"], exportAs: ["cngxRipple"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1663
|
+
}
|
|
1664
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorLoadMore, decorators: [{
|
|
1665
|
+
type: Component,
|
|
1666
|
+
args: [{
|
|
1667
|
+
selector: 'cngx-pgn-load-more',
|
|
1668
|
+
exportAs: 'cngxPgnLoadMore',
|
|
1669
|
+
standalone: true,
|
|
1670
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1671
|
+
encapsulation: ViewEncapsulation.None,
|
|
1672
|
+
imports: [CngxRipple],
|
|
1673
|
+
template: `
|
|
1674
|
+
<button
|
|
1675
|
+
type="button"
|
|
1676
|
+
class="cngx-paginator__button cngx-paginator__load-more"
|
|
1677
|
+
cngxRipple
|
|
1678
|
+
[attr.aria-label]="ariaLabel()"
|
|
1679
|
+
[attr.aria-disabled]="disabled()"
|
|
1680
|
+
(click)="handleClick()"
|
|
1681
|
+
>
|
|
1682
|
+
<span class="cngx-paginator__load-more-label">{{ ariaLabel() }}</span>
|
|
1683
|
+
@if (!host.isLast()) {
|
|
1684
|
+
<span class="cngx-paginator__load-more-count" aria-hidden="true">
|
|
1685
|
+
{{ shown() }} / {{ host.total() }}
|
|
1686
|
+
</span>
|
|
1687
|
+
}
|
|
1688
|
+
</button>
|
|
1689
|
+
`,
|
|
1690
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1691
|
+
}]
|
|
1692
|
+
}] });
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* Infinite-scroll segment: a bottom-of-list sentinel that auto-advances the
|
|
1696
|
+
* page as it scrolls into view, composing `CngxInfiniteScroll`. \
|
|
1697
|
+
* The in-template sentinel binds the directive's `[enabled]` / `[loading]` inputs and its
|
|
1698
|
+
* `(loadMore)` output directly to the `CNGX_PAGINATOR_HOST` signals, so the
|
|
1699
|
+
* directive's built-in debounce, busy-gate, enabled-disable, and auto-disconnect
|
|
1700
|
+
* own the auto-advance double-fire guard - this segment adds no
|
|
1701
|
+
* `IntersectionObserver` code of its own.
|
|
1702
|
+
*
|
|
1703
|
+
* The directive sits on the sentinel element (not as a `hostDirective`) precisely so its `[enabled]` / `[loading]`
|
|
1704
|
+
* inputs can bind to the host-token signals; a static `hostDirectives`
|
|
1705
|
+
* declaration could not express that wiring.
|
|
1706
|
+
*
|
|
1707
|
+
* Like `cngx-pgn-load-more`, this stays a thin trigger atom: it injects
|
|
1708
|
+
* `CNGX_PAGINATOR_HOST`, holds no accumulation state, and renders no async view
|
|
1709
|
+
* of its own. \
|
|
1710
|
+
* The consumer slices its own array from the brain's
|
|
1711
|
+
* `cumulativeRange()`; the busy / error / end experience belongs to the consumer
|
|
1712
|
+
* or to a composing container, keeping the segment reusable unchanged.
|
|
1713
|
+
*
|
|
1714
|
+
* Exhausted state: once `host.isLast()` the sentinel disables (`enabled` is
|
|
1715
|
+
* `false`, so the observer disconnects). \
|
|
1716
|
+
* It swaps its busy affordance for the
|
|
1717
|
+
* `allLoaded` end label only after the final load settles (`!host.isBusy()`),
|
|
1718
|
+
* so it never claims "all loaded" while the last batch is still arriving, and
|
|
1719
|
+
* the tail is never a silent or stale spinner.
|
|
1720
|
+
*
|
|
1721
|
+
* `[root]` / `[rootMargin]` forward straight to the composed directive so a
|
|
1722
|
+
* consumer can point the sentinel at a bounded scroll container (a feed box)
|
|
1723
|
+
* rather than the viewport, and tune the pre-fetch distance. They are plain
|
|
1724
|
+
* passthrough config - the segment still owns no observer code and no state.
|
|
1725
|
+
*
|
|
1726
|
+
* @category ui/paginator
|
|
1727
|
+
* @wcag AA
|
|
1728
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-infinite.component.ts
|
|
1729
|
+
* @since 0.1.0
|
|
1730
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/infinite/sentinel</example-url>
|
|
1731
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-modes/infinite</example-url>
|
|
1732
|
+
*/
|
|
1733
|
+
class CngxPaginatorInfinite {
|
|
1734
|
+
host = inject(CNGX_PAGINATOR_HOST);
|
|
1735
|
+
config = injectPaginatorConfig();
|
|
1736
|
+
/**
|
|
1737
|
+
* CSS selector for the scroll container the sentinel is watched within.
|
|
1738
|
+
* `null` (default) observes the viewport. Forwarded to `CngxInfiniteScroll`.
|
|
1739
|
+
*/
|
|
1740
|
+
root = input(null, ...(ngDevMode ? [{ debugName: "root" }] : /* istanbul ignore next */ []));
|
|
1741
|
+
/**
|
|
1742
|
+
* Pre-fetch margin around the scroll container, forwarded to
|
|
1743
|
+
* `CngxInfiniteScroll`. The directive default loads ~200px before the
|
|
1744
|
+
* sentinel is visible.
|
|
1745
|
+
*/
|
|
1746
|
+
rootMargin = input('0px 0px 200px 0px', ...(ngDevMode ? [{ debugName: "rootMargin" }] : /* istanbul ignore next */ []));
|
|
1747
|
+
/**
|
|
1748
|
+
* Exhausted: the last page is reached AND its load has settled. Gating on
|
|
1749
|
+
* `!isBusy()` keeps the spinner up while the final batch is still loading, so
|
|
1750
|
+
* the segment never claims "all loaded" before the last rows arrive.
|
|
1751
|
+
*/
|
|
1752
|
+
isExhausted = computed(() => this.host.isLast() && !this.host.isBusy(), ...(ngDevMode ? [{ debugName: "isExhausted" }] : /* istanbul ignore next */ []));
|
|
1753
|
+
/**
|
|
1754
|
+
* Exhausted-state label from the config cascade, reused from the load-more
|
|
1755
|
+
* segment so both append modes speak the same "all N loaded" end state rather
|
|
1756
|
+
* than leaving the tail implicit.
|
|
1757
|
+
*/
|
|
1758
|
+
endLabel = computed(() => this.config.ariaLabels.allLoaded(this.host.total()), ...(ngDevMode ? [{ debugName: "endLabel" }] : /* istanbul ignore next */ []));
|
|
1759
|
+
/** Status text shown beside the spinner while more pages remain. */
|
|
1760
|
+
busyLabel = computed(() => this.config.announcements.loading, ...(ngDevMode ? [{ debugName: "busyLabel" }] : /* istanbul ignore next */ []));
|
|
1761
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorInfinite, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1762
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxPaginatorInfinite, isStandalone: true, selector: "cngx-pgn-infinite", inputs: { root: { classPropertyName: "root", publicName: "root", isSignal: true, isRequired: false, transformFunction: null }, rootMargin: { classPropertyName: "rootMargin", publicName: "rootMargin", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnInfinite"], ngImport: i0, template: `
|
|
1763
|
+
<div
|
|
1764
|
+
class="cngx-paginator__infinite"
|
|
1765
|
+
cngxInfiniteScroll
|
|
1766
|
+
[enabled]="!host.isLast()"
|
|
1767
|
+
[loading]="host.isBusy()"
|
|
1768
|
+
[root]="root()"
|
|
1769
|
+
[rootMargin]="rootMargin()"
|
|
1770
|
+
(loadMore)="host.next()"
|
|
1771
|
+
>
|
|
1772
|
+
@if (isExhausted()) {
|
|
1773
|
+
<span class="cngx-paginator__infinite-end">{{ endLabel() }}</span>
|
|
1774
|
+
} @else {
|
|
1775
|
+
<span class="cngx-paginator__infinite-spinner" aria-hidden="true"></span>
|
|
1776
|
+
<span class="cngx-paginator__infinite-status">{{ busyLabel() }}</span>
|
|
1777
|
+
}
|
|
1778
|
+
</div>
|
|
1779
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: CngxInfiniteScroll, selector: "[cngxInfiniteScroll]", inputs: ["threshold", "rootMargin", "root", "enabled", "loading", "debounceMs"], outputs: ["loadMore"], exportAs: ["cngxInfiniteScroll"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1780
|
+
}
|
|
1781
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorInfinite, decorators: [{
|
|
1782
|
+
type: Component,
|
|
1783
|
+
args: [{
|
|
1784
|
+
selector: 'cngx-pgn-infinite',
|
|
1785
|
+
exportAs: 'cngxPgnInfinite',
|
|
1786
|
+
standalone: true,
|
|
1787
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1788
|
+
encapsulation: ViewEncapsulation.None,
|
|
1789
|
+
imports: [CngxInfiniteScroll],
|
|
1790
|
+
template: `
|
|
1791
|
+
<div
|
|
1792
|
+
class="cngx-paginator__infinite"
|
|
1793
|
+
cngxInfiniteScroll
|
|
1794
|
+
[enabled]="!host.isLast()"
|
|
1795
|
+
[loading]="host.isBusy()"
|
|
1796
|
+
[root]="root()"
|
|
1797
|
+
[rootMargin]="rootMargin()"
|
|
1798
|
+
(loadMore)="host.next()"
|
|
1799
|
+
>
|
|
1800
|
+
@if (isExhausted()) {
|
|
1801
|
+
<span class="cngx-paginator__infinite-end">{{ endLabel() }}</span>
|
|
1802
|
+
} @else {
|
|
1803
|
+
<span class="cngx-paginator__infinite-spinner" aria-hidden="true"></span>
|
|
1804
|
+
<span class="cngx-paginator__infinite-status">{{ busyLabel() }}</span>
|
|
1805
|
+
}
|
|
1806
|
+
</div>
|
|
1807
|
+
`,
|
|
1808
|
+
host: { class: 'cngx-paginator__segment' },
|
|
1809
|
+
}]
|
|
1810
|
+
}], propDecorators: { root: [{ type: i0.Input, args: [{ isSignal: true, alias: "root", required: false }] }], rootMargin: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootMargin", required: false }] }] } });
|
|
1811
|
+
|
|
1812
|
+
/**
|
|
1813
|
+
* Alphabetical / category chips: a `role="group"` toggle strip over the
|
|
1814
|
+
* {@link CngxBucketPaginate} range model. \
|
|
1815
|
+
* One `<button>` per bucket; the active
|
|
1816
|
+
* bucket carries `aria-pressed`, an empty bucket is `disabled`. The model is
|
|
1817
|
+
* injected through `CNGX_BUCKET_PAGINATE_HOST`, never the concrete directive
|
|
1818
|
+
* class, so the strip stays decompose-ready.
|
|
1819
|
+
*
|
|
1820
|
+
* Every chip's pressed / disabled / name state is a `computed()` read of the
|
|
1821
|
+
* host signals - nothing is synced. An empty chip is not a silent dead control: \
|
|
1822
|
+
* its accessible name comes from `ariaLabels.emptyBucket(label)`, which states
|
|
1823
|
+
* the bucket has no items, so AT hears the reason the chip is disabled.
|
|
1824
|
+
*
|
|
1825
|
+
* Keyboard navigation reuses `CngxRovingTabindex` / `CngxRovingItem` (no new
|
|
1826
|
+
* keyboard code, matching `cngx-pgn-pages`): \
|
|
1827
|
+
* arrows move the focus cursor and
|
|
1828
|
+
* skip disabled chips, the single tab stop tracks the active bucket, and
|
|
1829
|
+
* activation commits via `select()`.
|
|
1830
|
+
*
|
|
1831
|
+
* @category ui/paginator
|
|
1832
|
+
* @wcag AA
|
|
1833
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/paginator/segments/paginator-alpha.component.ts
|
|
1834
|
+
* @since 0.1.0
|
|
1835
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-parts/alpha/strip</example-url>
|
|
1836
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-modes/alphabetical</example-url>
|
|
1837
|
+
*/
|
|
1838
|
+
class CngxPaginatorAlpha {
|
|
1839
|
+
host = inject(CNGX_BUCKET_PAGINATE_HOST);
|
|
1840
|
+
config = injectPaginatorConfig();
|
|
1841
|
+
/**
|
|
1842
|
+
* Roving focus cursor. A `linkedSignal` so the strip's single tab stop tracks
|
|
1843
|
+
* the active bucket (Tab lands on the pressed chip) yet still moves freely
|
|
1844
|
+
* under the arrow keys; when nothing is selected it falls back to the first
|
|
1845
|
+
* non-empty chip so Tab never lands on a disabled control.
|
|
1846
|
+
*/
|
|
1847
|
+
rovingIndex = linkedSignal(() => {
|
|
1848
|
+
const buckets = this.host.buckets();
|
|
1849
|
+
const active = this.host.active();
|
|
1850
|
+
if (active !== null) {
|
|
1851
|
+
const index = buckets.findIndex((bucket) => bucket.label === active);
|
|
1852
|
+
if (index !== -1) {
|
|
1853
|
+
return index;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
const firstEnabled = buckets.findIndex((bucket) => !this.host.isEmpty(bucket.label));
|
|
1857
|
+
return firstEnabled === -1 ? 0 : firstEnabled;
|
|
1858
|
+
}, ...(ngDevMode ? [{ debugName: "rovingIndex" }] : /* istanbul ignore next */ []));
|
|
1859
|
+
isActive(label) {
|
|
1860
|
+
return this.host.active() === label;
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Accessible name: the available chip uses `ariaLabels.bucket`; an empty chip
|
|
1864
|
+
* swaps to `ariaLabels.emptyBucket` so the disabled control states its reason.
|
|
1865
|
+
*/
|
|
1866
|
+
chipLabel(label) {
|
|
1867
|
+
return this.host.isEmpty(label)
|
|
1868
|
+
? this.config.ariaLabels.emptyBucket(label)
|
|
1869
|
+
: this.config.ariaLabels.bucket(label);
|
|
1870
|
+
}
|
|
1871
|
+
select(label) {
|
|
1872
|
+
this.host.select(label);
|
|
1873
|
+
}
|
|
1874
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorAlpha, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1875
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxPaginatorAlpha, isStandalone: true, selector: "cngx-pgn-alpha", host: { classAttribute: "cngx-paginator__segment" }, exportAs: ["cngxPgnAlpha"], ngImport: i0, template: `
|
|
1876
|
+
<div
|
|
1877
|
+
class="cngx-paginator__alpha"
|
|
1878
|
+
role="group"
|
|
1879
|
+
[attr.aria-label]="config.ariaLabels.bucketGroup"
|
|
1880
|
+
cngxRovingTabindex
|
|
1881
|
+
[(activeIndex)]="rovingIndex"
|
|
1882
|
+
>
|
|
1883
|
+
@for (bucket of host.buckets(); track bucket.label) {
|
|
1884
|
+
@let isEmpty = host.isEmpty(bucket.label);
|
|
1885
|
+
<button
|
|
1886
|
+
type="button"
|
|
1887
|
+
cngxRovingItem
|
|
1888
|
+
[cngxRovingItemDisabled]="isEmpty"
|
|
1889
|
+
class="cngx-paginator__button cngx-paginator__alpha-chip"
|
|
1890
|
+
[class.cngx-paginator__alpha-chip--active]="isActive(bucket.label)"
|
|
1891
|
+
[attr.aria-pressed]="isActive(bucket.label) ? 'true' : 'false'"
|
|
1892
|
+
[attr.aria-label]="chipLabel(bucket.label)"
|
|
1893
|
+
[disabled]="isEmpty"
|
|
1894
|
+
(click)="select(bucket.label)"
|
|
1895
|
+
>
|
|
1896
|
+
{{ bucket.label }}
|
|
1897
|
+
</button>
|
|
1898
|
+
}
|
|
1899
|
+
</div>
|
|
1900
|
+
`, isInline: true, styles: ["@layer cngx.components{.cngx-paginator{position:relative;display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;--cngx-paginator-row-gap: var(--cngx-space-sm);--cngx-paginator-gap: var(--cngx-space-xs);gap:var(--cngx-paginator-row-gap, .75rem);font-family:var( --cngx-paginator-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif );font-size:var(--cngx-paginator-font-size, .875rem)}.cngx-paginator__progress{position:absolute;inset-inline:0;inset-block-start:0;block-size:var(--cngx-paginator-progress-thickness, 2px);--cngx-progress-color: var( --cngx-paginator-progress-color, var(--cngx-color-primary, oklch(.66 .19 50)) )}.cngx-paginator__segment{display:inline-flex;align-items:center}.cngx-paginator__nav-label,.cngx-paginator__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}.cngx-paginator__pages{display:inline-flex;flex-direction:row;align-items:center;gap:var(--cngx-paginator-gap, .25rem)}.cngx-paginator__button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:var(--cngx-paginator-button-size, 2.25rem);height:var(--cngx-paginator-button-size, 2.25rem);padding:var(--cngx-paginator-button-padding, 0 .5rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-button-border-color, transparent);border-radius:var(--cngx-paginator-button-radius, .375rem);background:var(--cngx-paginator-button-bg, transparent);color:var(--cngx-paginator-button-color, currentColor);font:inherit;line-height:1;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background var(--cngx-paginator-transition, .15s ease)}.cngx-paginator__button:hover{background:var( --cngx-paginator-button-hover-bg, color-mix(in oklch, currentColor 10%, transparent) )}.cngx-paginator__button:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__button[aria-disabled=true],.cngx-paginator__button:disabled{cursor:not-allowed;opacity:var(--cngx-paginator-disabled-opacity, .45)}.cngx-paginator__page[aria-current=page]{background:var( --cngx-paginator-current-bg, color-mix(in oklch, currentColor 12%, transparent) );color:var(--cngx-paginator-current-color, currentColor);border-color:var(--cngx-paginator-current-border-color, transparent);font-weight:600}.cngx-paginator__range,.cngx-paginator__status{font-variant-numeric:tabular-nums;color:var(--cngx-paginator-range-color, currentColor);white-space:nowrap}.cngx-paginator__load-more{gap:var(--cngx-paginator-load-more-gap, .5rem);white-space:nowrap}.cngx-paginator__load-more-count{font-variant-numeric:tabular-nums;color:var( --cngx-paginator-load-more-count-color, color-mix(in oklch, currentColor 60%, transparent) )}.cngx-paginator__goto-input{box-sizing:border-box;width:var(--cngx-paginator-goto-width, 3.5rem);height:var(--cngx-paginator-button-size, 2.25rem);padding:var(--cngx-paginator-goto-padding, 0 .5rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-goto-border-color, color-mix(in oklch, currentColor 25%, transparent));border-radius:var(--cngx-paginator-button-radius, .375rem);background:var(--cngx-paginator-button-bg, transparent);color:var(--cngx-paginator-button-color, currentColor);font:inherit;font-variant-numeric:tabular-nums}.cngx-paginator__goto-input:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__select{gap:var(--cngx-paginator-select-gap, .25rem);font-variant-numeric:tabular-nums}.cngx-paginator__select-caret{display:inline-flex;font-size:var(--cngx-paginator-caret-size, 1em);line-height:1;opacity:var(--cngx-paginator-caret-opacity, .55)}.cngx-paginator__select-panel{margin:0;padding:var(--cngx-paginator-panel-padding, .25rem);list-style:none;border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-panel-border-color, color-mix(in oklch, currentColor 20%, transparent));border-radius:var(--cngx-paginator-panel-radius, .5rem);background:var(--cngx-paginator-panel-bg, Canvas);color:var(--cngx-paginator-panel-color, currentColor);box-shadow:var(--cngx-paginator-panel-shadow, 0 4px 12px rgb(0 0 0 / .15))}.cngx-paginator__option{display:flex;align-items:center;min-height:var(--cngx-paginator-option-size, 2rem);padding:var(--cngx-paginator-option-padding, 0 .75rem);border-radius:var(--cngx-paginator-option-radius, .25rem);cursor:pointer;font-variant-numeric:tabular-nums}.cngx-paginator__overflow-panel{margin:0;padding:var(--cngx-paginator-panel-padding, .25rem);list-style:none;display:grid;grid-template-columns:repeat(var(--cngx-paginator-overflow-columns, 5),var(--cngx-paginator-overflow-cell-size, 2rem));gap:var(--cngx-paginator-overflow-gap, .15rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-panel-border-color, color-mix(in oklch, currentColor 20%, transparent));border-radius:var(--cngx-paginator-panel-radius, .5rem);background:var(--cngx-paginator-panel-bg, Canvas);color:var(--cngx-paginator-panel-color, currentColor);box-shadow:var(--cngx-paginator-panel-shadow, 0 4px 12px rgb(0 0 0 / .15))}.cngx-paginator__overflow-panel .cngx-paginator__option{justify-content:center;min-block-size:var(--cngx-paginator-overflow-cell-size, 2rem);padding:var(--cngx-paginator-overflow-cell-padding, 0)}.cngx-paginator__overflow-panel:focus,.cngx-paginator__overflow-panel:focus-visible{outline:none}[popover]:has(>.cngx-paginator__select-panel),[popover]:has(>.cngx-paginator__overflow-panel){margin:0;padding:0;border:0;overflow:visible;background:none}.cngx-paginator__option.cngx-option--highlighted,.cngx-paginator__option.cngx-menu-item--highlighted{background:var( --cngx-paginator-option-hover-bg, color-mix(in oklch, currentColor 10%, transparent) )}.cngx-paginator__option.cngx-option--selected{background:var( --cngx-paginator-option-selected-bg, color-mix(in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 14%, transparent) );color:var(--cngx-paginator-option-selected-color, var(--cngx-color-primary, oklch(.66 .19 50)));font-weight:600}.cngx-paginator[data-paginator-size=compact]{--cngx-paginator-button-size: 1.75rem;font-size:var(--cngx-paginator-font-size-compact, .8125rem)}.cngx-paginator[data-paginator-size=comfortable]{--cngx-paginator-button-size: 2.75rem;font-size:var(--cngx-paginator-font-size-comfortable, .95rem)}.cngx-paginator__dots{display:inline-flex;align-items:center}.cngx-paginator__dots--windowed{overflow-x:clip;overflow-y:visible;max-width:calc(7 * var(--cngx-paginator-dot-size, .5rem) + 6 * var(--cngx-paginator-dot-gap, .5rem))}.cngx-paginator__dots-track{display:inline-flex;flex-direction:row;align-items:center;gap:var(--cngx-paginator-dot-gap, .5rem);transform:translate(calc(var(--cngx-paginator-dots-shift, 0) * -1 * (var(--cngx-paginator-dot-size, .5rem) + var(--cngx-paginator-dot-gap, .5rem))));transition:transform var(--cngx-paginator-motion-duration, .2s) ease}.cngx-paginator__dot{box-sizing:border-box;width:var(--cngx-paginator-dot-size, .5rem);height:var(--cngx-paginator-dot-size, .5rem);padding:0;border:0;border-radius:50%;background:var(--cngx-paginator-dot-color, color-mix(in oklch, currentColor 35%, transparent));cursor:pointer;transition:transform var(--cngx-paginator-transition, .15s ease),background var(--cngx-paginator-transition, .15s ease)}.cngx-paginator__dot[data-size=medium]{transform:scale(var(--cngx-paginator-dot-medium-scale, .7))}.cngx-paginator__dot[data-size=small]{transform:scale(var(--cngx-paginator-dot-small-scale, .45))}.cngx-paginator__dot--current{background:var( --cngx-paginator-dot-current-color, var(--cngx-color-primary, oklch(.66 .19 50)) );transform:scale(var(--cngx-paginator-dot-current-scale, 1.15))}.cngx-paginator__dot:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__dot[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-paginator-disabled-opacity, .45)}.cngx-paginator__rail{position:relative;display:flex;align-items:center;flex:1 1 auto;min-inline-size:var(--cngx-paginator-rail-min-size, 6rem)}.cngx-paginator__rail cngx-progress{flex:1 1 auto;--cngx-progress-height: var(--cngx-paginator-rail-height, .375rem);--cngx-progress-color: var( --cngx-paginator-rail-fill, var(--cngx-color-primary, oklch(.66 .19 50)) );--cngx-progress-track-color: var( --cngx-paginator-rail-track, var(--cngx-color-border, oklch(.9 .005 250)) )}.cngx-paginator__rail-knob{position:absolute;inset-block-start:50%;inset-inline-start:0;inline-size:var(--cngx-paginator-rail-knob-size, .875rem);block-size:var(--cngx-paginator-rail-knob-size, .875rem);border-radius:50%;background:var(--cngx-paginator-rail-knob-bg, oklch(1 0 0));border:var(--cngx-paginator-rail-knob-border-width, 2px) solid var(--cngx-paginator-rail-knob-border-color, oklch(.66 .19 50));transform:translate(-50%,-50%);transition:inset-inline-start var(--cngx-paginator-motion-duration, .2s) cubic-bezier(.3,.7,0,1)}.cngx-paginator__infinite{display:flex;align-items:center;justify-content:center;gap:var(--cngx-paginator-infinite-gap, .5rem);padding:var(--cngx-paginator-infinite-padding, .9rem);color:var(--cngx-paginator-infinite-color, color-mix(in oklch, currentColor 60%, transparent))}.cngx-paginator__infinite-status,.cngx-paginator__infinite-end{font-size:var(--cngx-paginator-infinite-font-size, .8125rem)}.cngx-paginator__infinite-spinner{inline-size:var(--cngx-paginator-infinite-spinner-size, 1rem);block-size:var(--cngx-paginator-infinite-spinner-size, 1rem);border-radius:50%;border:var(--cngx-paginator-infinite-spinner-width, 2px) solid color-mix(in oklch,var(--cngx-color-primary, oklch(.66 .19 50)) 30%,transparent);border-block-start-color:var(--cngx-color-primary, oklch(.66 .19 50));animation:cngx-paginator-spin var(--cngx-paginator-infinite-spinner-duration, .7s) linear infinite}@keyframes cngx-paginator-spin{to{transform:rotate(360deg)}}.cngx-paginator__alpha{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cngx-paginator-alpha-gap, .4rem)}.cngx-paginator__alpha-chip{border-color:var( --cngx-paginator-alpha-chip-border-color, var(--cngx-color-border, oklch(.88 .005 250)) );background:var(--cngx-paginator-alpha-chip-bg, var(--cngx-color-surface, oklch(1 0 0)));font-weight:500}.cngx-paginator__alpha-chip:hover:not([aria-pressed=true]):not(:disabled){border-color:var(--cngx-color-primary, oklch(.66 .19 50));color:var(--cngx-color-primary, oklch(.66 .19 50))}.cngx-paginator__alpha-chip[aria-pressed=true]{background:var(--cngx-paginator-current-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-paginator-current-color, var(--cngx-color-on-primary, oklch(1 0 0)));border-color:var( --cngx-paginator-current-border-color, var(--cngx-color-primary, oklch(.66 .19 50)) );font-weight:600}@media(prefers-reduced-motion:reduce){.cngx-paginator__button,.cngx-paginator__dot,.cngx-paginator__dots-track{transition:none}.cngx-paginator__infinite-spinner{animation:none}}}\n"], dependencies: [{ kind: "directive", type: CngxRovingTabindex, selector: "[cngxRovingTabindex]", inputs: ["orientation", "loop", "activeIndex", "virtualCount"], outputs: ["orientationChange", "activeIndexChange"], exportAs: ["cngxRovingTabindex"] }, { kind: "directive", type: CngxRovingItem, selector: "[cngxRovingItem]", inputs: ["cngxRovingItemDisabled"], exportAs: ["cngxRovingItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1901
|
+
}
|
|
1902
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPaginatorAlpha, decorators: [{
|
|
1903
|
+
type: Component,
|
|
1904
|
+
args: [{ selector: 'cngx-pgn-alpha', exportAs: 'cngxPgnAlpha', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxRovingTabindex, CngxRovingItem], template: `
|
|
1905
|
+
<div
|
|
1906
|
+
class="cngx-paginator__alpha"
|
|
1907
|
+
role="group"
|
|
1908
|
+
[attr.aria-label]="config.ariaLabels.bucketGroup"
|
|
1909
|
+
cngxRovingTabindex
|
|
1910
|
+
[(activeIndex)]="rovingIndex"
|
|
1911
|
+
>
|
|
1912
|
+
@for (bucket of host.buckets(); track bucket.label) {
|
|
1913
|
+
@let isEmpty = host.isEmpty(bucket.label);
|
|
1914
|
+
<button
|
|
1915
|
+
type="button"
|
|
1916
|
+
cngxRovingItem
|
|
1917
|
+
[cngxRovingItemDisabled]="isEmpty"
|
|
1918
|
+
class="cngx-paginator__button cngx-paginator__alpha-chip"
|
|
1919
|
+
[class.cngx-paginator__alpha-chip--active]="isActive(bucket.label)"
|
|
1920
|
+
[attr.aria-pressed]="isActive(bucket.label) ? 'true' : 'false'"
|
|
1921
|
+
[attr.aria-label]="chipLabel(bucket.label)"
|
|
1922
|
+
[disabled]="isEmpty"
|
|
1923
|
+
(click)="select(bucket.label)"
|
|
1924
|
+
>
|
|
1925
|
+
{{ bucket.label }}
|
|
1926
|
+
</button>
|
|
1927
|
+
}
|
|
1928
|
+
</div>
|
|
1929
|
+
`, host: { class: 'cngx-paginator__segment' }, styles: ["@layer cngx.components{.cngx-paginator{position:relative;display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;--cngx-paginator-row-gap: var(--cngx-space-sm);--cngx-paginator-gap: var(--cngx-space-xs);gap:var(--cngx-paginator-row-gap, .75rem);font-family:var( --cngx-paginator-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif );font-size:var(--cngx-paginator-font-size, .875rem)}.cngx-paginator__progress{position:absolute;inset-inline:0;inset-block-start:0;block-size:var(--cngx-paginator-progress-thickness, 2px);--cngx-progress-color: var( --cngx-paginator-progress-color, var(--cngx-color-primary, oklch(.66 .19 50)) )}.cngx-paginator__segment{display:inline-flex;align-items:center}.cngx-paginator__nav-label,.cngx-paginator__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}.cngx-paginator__pages{display:inline-flex;flex-direction:row;align-items:center;gap:var(--cngx-paginator-gap, .25rem)}.cngx-paginator__button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:var(--cngx-paginator-button-size, 2.25rem);height:var(--cngx-paginator-button-size, 2.25rem);padding:var(--cngx-paginator-button-padding, 0 .5rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-button-border-color, transparent);border-radius:var(--cngx-paginator-button-radius, .375rem);background:var(--cngx-paginator-button-bg, transparent);color:var(--cngx-paginator-button-color, currentColor);font:inherit;line-height:1;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background var(--cngx-paginator-transition, .15s ease)}.cngx-paginator__button:hover{background:var( --cngx-paginator-button-hover-bg, color-mix(in oklch, currentColor 10%, transparent) )}.cngx-paginator__button:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__button[aria-disabled=true],.cngx-paginator__button:disabled{cursor:not-allowed;opacity:var(--cngx-paginator-disabled-opacity, .45)}.cngx-paginator__page[aria-current=page]{background:var( --cngx-paginator-current-bg, color-mix(in oklch, currentColor 12%, transparent) );color:var(--cngx-paginator-current-color, currentColor);border-color:var(--cngx-paginator-current-border-color, transparent);font-weight:600}.cngx-paginator__range,.cngx-paginator__status{font-variant-numeric:tabular-nums;color:var(--cngx-paginator-range-color, currentColor);white-space:nowrap}.cngx-paginator__load-more{gap:var(--cngx-paginator-load-more-gap, .5rem);white-space:nowrap}.cngx-paginator__load-more-count{font-variant-numeric:tabular-nums;color:var( --cngx-paginator-load-more-count-color, color-mix(in oklch, currentColor 60%, transparent) )}.cngx-paginator__goto-input{box-sizing:border-box;width:var(--cngx-paginator-goto-width, 3.5rem);height:var(--cngx-paginator-button-size, 2.25rem);padding:var(--cngx-paginator-goto-padding, 0 .5rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-goto-border-color, color-mix(in oklch, currentColor 25%, transparent));border-radius:var(--cngx-paginator-button-radius, .375rem);background:var(--cngx-paginator-button-bg, transparent);color:var(--cngx-paginator-button-color, currentColor);font:inherit;font-variant-numeric:tabular-nums}.cngx-paginator__goto-input:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__select{gap:var(--cngx-paginator-select-gap, .25rem);font-variant-numeric:tabular-nums}.cngx-paginator__select-caret{display:inline-flex;font-size:var(--cngx-paginator-caret-size, 1em);line-height:1;opacity:var(--cngx-paginator-caret-opacity, .55)}.cngx-paginator__select-panel{margin:0;padding:var(--cngx-paginator-panel-padding, .25rem);list-style:none;border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-panel-border-color, color-mix(in oklch, currentColor 20%, transparent));border-radius:var(--cngx-paginator-panel-radius, .5rem);background:var(--cngx-paginator-panel-bg, Canvas);color:var(--cngx-paginator-panel-color, currentColor);box-shadow:var(--cngx-paginator-panel-shadow, 0 4px 12px rgb(0 0 0 / .15))}.cngx-paginator__option{display:flex;align-items:center;min-height:var(--cngx-paginator-option-size, 2rem);padding:var(--cngx-paginator-option-padding, 0 .75rem);border-radius:var(--cngx-paginator-option-radius, .25rem);cursor:pointer;font-variant-numeric:tabular-nums}.cngx-paginator__overflow-panel{margin:0;padding:var(--cngx-paginator-panel-padding, .25rem);list-style:none;display:grid;grid-template-columns:repeat(var(--cngx-paginator-overflow-columns, 5),var(--cngx-paginator-overflow-cell-size, 2rem));gap:var(--cngx-paginator-overflow-gap, .15rem);border:var(--cngx-paginator-button-border-width, 1px) solid var(--cngx-paginator-panel-border-color, color-mix(in oklch, currentColor 20%, transparent));border-radius:var(--cngx-paginator-panel-radius, .5rem);background:var(--cngx-paginator-panel-bg, Canvas);color:var(--cngx-paginator-panel-color, currentColor);box-shadow:var(--cngx-paginator-panel-shadow, 0 4px 12px rgb(0 0 0 / .15))}.cngx-paginator__overflow-panel .cngx-paginator__option{justify-content:center;min-block-size:var(--cngx-paginator-overflow-cell-size, 2rem);padding:var(--cngx-paginator-overflow-cell-padding, 0)}.cngx-paginator__overflow-panel:focus,.cngx-paginator__overflow-panel:focus-visible{outline:none}[popover]:has(>.cngx-paginator__select-panel),[popover]:has(>.cngx-paginator__overflow-panel){margin:0;padding:0;border:0;overflow:visible;background:none}.cngx-paginator__option.cngx-option--highlighted,.cngx-paginator__option.cngx-menu-item--highlighted{background:var( --cngx-paginator-option-hover-bg, color-mix(in oklch, currentColor 10%, transparent) )}.cngx-paginator__option.cngx-option--selected{background:var( --cngx-paginator-option-selected-bg, color-mix(in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 14%, transparent) );color:var(--cngx-paginator-option-selected-color, var(--cngx-color-primary, oklch(.66 .19 50)));font-weight:600}.cngx-paginator[data-paginator-size=compact]{--cngx-paginator-button-size: 1.75rem;font-size:var(--cngx-paginator-font-size-compact, .8125rem)}.cngx-paginator[data-paginator-size=comfortable]{--cngx-paginator-button-size: 2.75rem;font-size:var(--cngx-paginator-font-size-comfortable, .95rem)}.cngx-paginator__dots{display:inline-flex;align-items:center}.cngx-paginator__dots--windowed{overflow-x:clip;overflow-y:visible;max-width:calc(7 * var(--cngx-paginator-dot-size, .5rem) + 6 * var(--cngx-paginator-dot-gap, .5rem))}.cngx-paginator__dots-track{display:inline-flex;flex-direction:row;align-items:center;gap:var(--cngx-paginator-dot-gap, .5rem);transform:translate(calc(var(--cngx-paginator-dots-shift, 0) * -1 * (var(--cngx-paginator-dot-size, .5rem) + var(--cngx-paginator-dot-gap, .5rem))));transition:transform var(--cngx-paginator-motion-duration, .2s) ease}.cngx-paginator__dot{box-sizing:border-box;width:var(--cngx-paginator-dot-size, .5rem);height:var(--cngx-paginator-dot-size, .5rem);padding:0;border:0;border-radius:50%;background:var(--cngx-paginator-dot-color, color-mix(in oklch, currentColor 35%, transparent));cursor:pointer;transition:transform var(--cngx-paginator-transition, .15s ease),background var(--cngx-paginator-transition, .15s ease)}.cngx-paginator__dot[data-size=medium]{transform:scale(var(--cngx-paginator-dot-medium-scale, .7))}.cngx-paginator__dot[data-size=small]{transform:scale(var(--cngx-paginator-dot-small-scale, .45))}.cngx-paginator__dot--current{background:var( --cngx-paginator-dot-current-color, var(--cngx-color-primary, oklch(.66 .19 50)) );transform:scale(var(--cngx-paginator-dot-current-scale, 1.15))}.cngx-paginator__dot:focus-visible{outline:var(--cngx-paginator-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-paginator-focus-offset, 2px)}.cngx-paginator__dot[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-paginator-disabled-opacity, .45)}.cngx-paginator__rail{position:relative;display:flex;align-items:center;flex:1 1 auto;min-inline-size:var(--cngx-paginator-rail-min-size, 6rem)}.cngx-paginator__rail cngx-progress{flex:1 1 auto;--cngx-progress-height: var(--cngx-paginator-rail-height, .375rem);--cngx-progress-color: var( --cngx-paginator-rail-fill, var(--cngx-color-primary, oklch(.66 .19 50)) );--cngx-progress-track-color: var( --cngx-paginator-rail-track, var(--cngx-color-border, oklch(.9 .005 250)) )}.cngx-paginator__rail-knob{position:absolute;inset-block-start:50%;inset-inline-start:0;inline-size:var(--cngx-paginator-rail-knob-size, .875rem);block-size:var(--cngx-paginator-rail-knob-size, .875rem);border-radius:50%;background:var(--cngx-paginator-rail-knob-bg, oklch(1 0 0));border:var(--cngx-paginator-rail-knob-border-width, 2px) solid var(--cngx-paginator-rail-knob-border-color, oklch(.66 .19 50));transform:translate(-50%,-50%);transition:inset-inline-start var(--cngx-paginator-motion-duration, .2s) cubic-bezier(.3,.7,0,1)}.cngx-paginator__infinite{display:flex;align-items:center;justify-content:center;gap:var(--cngx-paginator-infinite-gap, .5rem);padding:var(--cngx-paginator-infinite-padding, .9rem);color:var(--cngx-paginator-infinite-color, color-mix(in oklch, currentColor 60%, transparent))}.cngx-paginator__infinite-status,.cngx-paginator__infinite-end{font-size:var(--cngx-paginator-infinite-font-size, .8125rem)}.cngx-paginator__infinite-spinner{inline-size:var(--cngx-paginator-infinite-spinner-size, 1rem);block-size:var(--cngx-paginator-infinite-spinner-size, 1rem);border-radius:50%;border:var(--cngx-paginator-infinite-spinner-width, 2px) solid color-mix(in oklch,var(--cngx-color-primary, oklch(.66 .19 50)) 30%,transparent);border-block-start-color:var(--cngx-color-primary, oklch(.66 .19 50));animation:cngx-paginator-spin var(--cngx-paginator-infinite-spinner-duration, .7s) linear infinite}@keyframes cngx-paginator-spin{to{transform:rotate(360deg)}}.cngx-paginator__alpha{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cngx-paginator-alpha-gap, .4rem)}.cngx-paginator__alpha-chip{border-color:var( --cngx-paginator-alpha-chip-border-color, var(--cngx-color-border, oklch(.88 .005 250)) );background:var(--cngx-paginator-alpha-chip-bg, var(--cngx-color-surface, oklch(1 0 0)));font-weight:500}.cngx-paginator__alpha-chip:hover:not([aria-pressed=true]):not(:disabled){border-color:var(--cngx-color-primary, oklch(.66 .19 50));color:var(--cngx-color-primary, oklch(.66 .19 50))}.cngx-paginator__alpha-chip[aria-pressed=true]{background:var(--cngx-paginator-current-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-paginator-current-color, var(--cngx-color-on-primary, oklch(1 0 0)));border-color:var( --cngx-paginator-current-border-color, var(--cngx-color-primary, oklch(.66 .19 50)) );font-weight:600}@media(prefers-reduced-motion:reduce){.cngx-paginator__button,.cngx-paginator__dot,.cngx-paginator__dots-track{transition:none}.cngx-paginator__infinite-spinner{animation:none}}}\n"] }]
|
|
1930
|
+
}] });
|
|
1931
|
+
|
|
1932
|
+
/**
|
|
1933
|
+
* Generated bundle index. Do not edit.
|
|
1934
|
+
*/
|
|
1935
|
+
|
|
1936
|
+
export { CNGX_PAGINATOR_ANNOUNCER_FACTORY, CNGX_PAGINATOR_CONFIG, CNGX_PAGINATOR_DEFAULTS, CNGX_PAGINATOR_HOST, CNGX_PAGINATOR_PAGE_WINDOW_FACTORY, CngxPaginator, CngxPaginatorAlpha, CngxPaginatorDots, CngxPaginatorFirst, CngxPaginatorGoto, CngxPaginatorInfinite, CngxPaginatorLast, CngxPaginatorLoadMore, CngxPaginatorLoading, CngxPaginatorNext, CngxPaginatorPageOfPages, CngxPaginatorPageSize, CngxPaginatorPages, CngxPaginatorPrev, CngxPaginatorRail, CngxPaginatorRange, CngxPaginatorStatus, createPaginatorAnnouncer, createPaginatorPageWindow, injectPaginatorConfig, provideCngxPaginatorConfig, provideCngxPaginatorConfigAt, withPaginatorAnnouncements, withPaginatorAriaLabels, withPaginatorPageSizeOptions, withPaginatorPageStatusFormat, withPaginatorRangeFormat, withPaginatorTemplates };
|
|
1937
|
+
//# sourceMappingURL=cngx-ui-paginator.mjs.map
|