@cngx/ui 0.1.0-rc.1 → 0.1.0-rc.3

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.
@@ -17,6 +17,7 @@ import * as i2 from '@cngx/common/a11y';
17
17
  * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stepper/stepper.component.ts
18
18
  * @since 0.1.0
19
19
  * @relatedTo CngxStepperPresenter, CngxStep, CngxRovingTabindex, CngxFocusRestore, CngxLiveRegion
20
+ * @playground Material theme coverage across all skins ./examples/material-theme-coverage/skins-coverage.component.ts
20
21
  * <example-url>http://localhost:4200/#/ui/stepper/stepper-horizontal/three-step-wizard</example-url>
21
22
  * <example-url>http://localhost:4200/#/ui/stepper/stepper-vertical/vertical-sidebar-layout</example-url>
22
23
  * <example-url>http://localhost:4200/#/ui/stepper/stepper-linear/linear-gating-with-completion-checkboxes</example-url>
@@ -34,6 +35,9 @@ import * as i2 from '@cngx/common/a11y';
34
35
  * <example-url>http://localhost:4200/#/ui/stepper/stepper-skins/path-chevron-vertical</example-url>
35
36
  * <example-url>http://localhost:4200/#/ui/stepper/stepper-skins/pill-segment-vertical</example-url>
36
37
  * <example-url>http://localhost:4200/#/ui/stepper/stepper-skins/chips-vertical</example-url>
38
+ * <example-url>http://localhost:4200/#/ui/stepper/stepper-density/flat-steps-auto-density</example-url>
39
+ * <example-url>http://localhost:4200/#/ui/stepper/stepper-density/density-across-skins</example-url>
40
+ * <example-url>http://localhost:4200/#/ui/stepper/stepper-density/distance-weighted-collapse</example-url>
37
41
  */
38
42
  declare class CngxStepper implements CngxStepPanelHost {
39
43
  readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
@@ -83,6 +87,21 @@ declare class CngxStepper implements CngxStepPanelHost {
83
87
  */
84
88
  protected readonly templates: _cngx_common_stepper.CngxStepperTemplateBindings;
85
89
  protected readonly displayMode: Signal<"classic" | "text" | "dots">;
90
+ /**
91
+ * Space-driven density rung for the classic strip, measured off the
92
+ * host element's own width via {@link createStripDensity}. `'full'`
93
+ * under the `'comfortable'` default. Drives `[data-density]` (the CSS
94
+ * label-degradation ladder) and the auto-vertical flip below.
95
+ */
96
+ protected readonly stripDensity: Signal<_cngx_common_stepper.CngxStripDensity>;
97
+ /**
98
+ * `true` when `density: 'auto'` is active. Drives `[data-density-auto]`,
99
+ * which makes the strip absorb a too-narrow container by shrinking +
100
+ * ellipsis-truncating labels in flow rather than growing a horizontal
101
+ * scrollbar - so no rung ever overflows, independent of how the px
102
+ * thresholds resolve.
103
+ */
104
+ protected readonly isDensityAuto: Signal<boolean>;
86
105
  constructor();
87
106
  /** Stepper landmark role-description with config + i18n cascade. */
88
107
  protected readonly stepperRoleDescription: Signal<string>;
@@ -118,9 +137,39 @@ declare class CngxStepper implements CngxStepPanelHost {
118
137
  /** Mobile-dot `aria-label`, appending the errored status when the dot has an error. */
119
138
  protected mobileDotAriaLabel(node: CngxStepNode, index: number): string;
120
139
  protected readonly groupRoleDescription: Signal<string>;
140
+ /**
141
+ * `true` when a rendered strip group header is folded under the
142
+ * focus-driven policy: `groupCollapse === 'expand-active'`, the group
143
+ * has children, and it does not hold the active step. Drives the
144
+ * `--collapsed` visual de-emphasis. Reads `activeGroupId` reactively,
145
+ * never a one-shot write.
146
+ *
147
+ * The fold is a density optimisation, not a disclosure widget:
148
+ * collapse is focus-driven (no toggle control), so the header carries
149
+ * no `aria-expanded` - an unsupported pairing on `role="group"`
150
+ * (ARIA 1.2) that would also imply a false disclosure affordance.
151
+ * A collapsed header does offer a pointer shortcut into the group (see
152
+ * {@link handleGroupHeaderClick}), but that selects the group's first
153
+ * step rather than expanding it in place, so it stays navigation, not
154
+ * disclosure. Keyboard users reach the same steps via the documented
155
+ * arrow-key contract, which already steps into a collapsed group.
156
+ */
157
+ protected isGroupCollapsed(node: CngxStepNode): boolean;
158
+ /**
159
+ * Collapsed-group summary view (`groupCollapseSummary`). Level-2 factory
160
+ * keeps the count/progress/status derivation out of the organism; the
161
+ * template reads `groupSummary.text(node)` / `.showStatus(node)` /
162
+ * `.srText(node)` on collapsed group headers.
163
+ */
164
+ protected readonly groupSummary: _cngx_common_stepper.CngxStepperGroupSummaryView;
165
+ /**
166
+ * Collapsed-group pointer-navigation view. `isNavigable` drives the
167
+ * `--navigable` cursor cue; `select` is the header click handler that
168
+ * enters the branch at its first reachable step. Level-2 factory.
169
+ */
170
+ protected readonly groupNavigation: _cngx_common_stepper.CngxStepperGroupNavigationView;
121
171
  /**
122
172
  * `aria-label` cascade: input → `ariaLabels.stepperRegion` → `i18n.stepperLabel`.
123
- * Pillar 2.
124
173
  */
125
174
  protected readonly resolvedAriaLabel: Signal<string | null>;
126
175
  private readonly stepDirectiveById;
@@ -129,10 +178,21 @@ declare class CngxStepper implements CngxStepPanelHost {
129
178
  readonly activeStepId: Signal<string | null>;
130
179
  protected readonly stepsOnly: Signal<readonly CngxStepNode[]>;
131
180
  /**
132
- * Position in the step-only flat projection. Group nodes carry `-1`;
133
- * callers must guard on `kind === 'step'`.
181
+ * Strip projection honouring the focus-driven group-collapse policy.
182
+ * Drives the classic strip `@for`; collapsed groups contribute their
183
+ * header node alone. Sourced from the presenter, never re-derived here
184
+ * (host-token contract). Panels still render every step via
185
+ * {@link stepsOnly}, so collapsed steps keep their panel ids in the DOM.
186
+ */
187
+ protected readonly visibleStripNodes: Signal<readonly CngxStepNode[]>;
188
+ /**
189
+ * Distance of a step from the active one, published per-step as
190
+ * `--cngx-step-distance` under `density: 'auto'`. Drives the
191
+ * distance-weighted label budget so the step furthest from the active
192
+ * one collapses first. `flatIndex` is `-1` for group nodes, but only
193
+ * step nodes carry the binding. Pure derived data - no layout read.
134
194
  */
135
- protected stepIndexOf(node: CngxStepNode): number;
195
+ protected stepDistanceOf(node: CngxStepNode): number;
136
196
  /** Per-step predicates + slot-context builders (Level-2 factory). */
137
197
  protected readonly slotContext: _cngx_common_stepper.CngxStepperSlotContextBuilders;
138
198
  /**
@@ -149,7 +209,7 @@ declare class CngxStepper implements CngxStepPanelHost {
149
209
  * collapsed mode, so this line is the only error surface.
150
210
  */
151
211
  protected readonly mobileErrorSummary: Signal<string>;
152
- /** Commit-in-flight flag - drives the host `aria-busy` binding. Pillar 2. */
212
+ /** Commit-in-flight flag - drives the host `aria-busy` binding.*/
153
213
  protected readonly isCommitting: Signal<boolean>;
154
214
  protected stepHeaderId(node: CngxStepNode): string;
155
215
  protected stepPanelId(node: CngxStepNode): string;
@@ -211,6 +271,7 @@ declare class CngxStepper implements CngxStepPanelHost {
211
271
  * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stepper/progress-bar-stepper.component.ts
212
272
  * @since 0.1.0
213
273
  * @relatedTo CngxStepperPresenter, CngxProgress, CngxDotStepper, CngxTextStepper
274
+ * @playground Material theme coverage across variants ./examples/material-theme-coverage/variants-coverage.component.ts
214
275
  * <example-url>http://localhost:4200/#/ui/stepper/progress-bar/onboarding-flow</example-url>
215
276
  */
216
277
  declare class CngxProgressBarStepper {
@@ -274,7 +335,6 @@ declare class CngxProgressBarStepper {
274
335
  * @since 0.1.0
275
336
  * @relatedTo CngxStepperPresenter, CngxProgressBarStepper, CngxTextStepper
276
337
  * <example-url>http://localhost:4200/#/ui/stepper/dot-stepper/mobile-carousel</example-url>
277
- * <example-url>http://localhost:4200/#/ui/stepper/dot-stepper/icon-dots-via-code-cngxdotstepperdot-code</example-url>
278
338
  */
279
339
  declare class CngxDotStepper {
280
340
  readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
@@ -6,8 +6,9 @@ import * as i2 from '@cngx/common/a11y';
6
6
  import { CngxPopover } from '@cngx/common/popover';
7
7
 
8
8
  /**
9
- * CNGX tab-group organism. Thin shell over {@link CngxTabGroupPresenter}
10
- * + `CngxFocusRestore` via `hostDirectives`. The APG tablist keyboard
9
+ * CNGX tab-group organism. \
10
+ * Thin shell over {@link CngxTabGroupPresenter}
11
+ * and `CngxFocusRestore` via `hostDirectives`. The APG tablist keyboard
11
12
  * model (automatic activation: arrow keys move focus AND select; Home/End
12
13
  * jump to first/last; the active tab is the lone tab stop) lives in
13
14
  * {@link createTabKeyboardNav}, deriving the roving stop from the
@@ -19,7 +20,14 @@ import { CngxPopover } from '@cngx/common/popover';
19
20
  * host directive: its `role="status"` would clobber the wrapper's
20
21
  * `role="group"` landmark.
21
22
  *
23
+ * @playground Material theme coverage across all skins ./examples/material-theme-coverage/skins-coverage.component.ts
24
+ * @playground Overflow "More" menu under resize ./examples/overflow-resize/overflow-resize.component.ts
25
+ * @playground Async commit-action (optimistic / pessimistic) ./examples/async-commit/async-commit.component.ts
26
+ * @playground Dismissable + addable tabs ./examples/dynamic-tabs/dynamic-tabs.component.ts
27
+ * @playground Data-driven tabs via HTTP (Material) ./examples/http-commit/http-commit-material.component.ts
28
+ * @playground Data-driven tabs via HTTP (default theme) ./examples/http-commit/http-commit-plain.component.ts
22
29
  * @playground Form error aggregation ./examples/form-errors/form-errors.component.ts
30
+ * @playground Routed tabs with a CanDeactivate guard ./examples/routed-outlet/routed-outlet.component.ts
23
31
  * @see {@link CngxMatTabs} for the Material `<mat-tab-group>` variant with `[cngxMatTabError]`.
24
32
  *
25
33
  * @category ui/tabs
@@ -30,12 +38,12 @@ import { CngxPopover } from '@cngx/common/popover';
30
38
  * @relatedTo CngxTabOverflow, CngxTabGroupPresenter, CngxTab, CngxFocusRestore
31
39
  * <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
32
40
  * <example-url>http://localhost:4200/#/ui/tabs/tab-error-aggregation/per-tab-error-badges</example-url>
33
- * <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
34
- * <example-url>http://localhost:4200/#/ui/tabs/tab-group/three-tab-navigation</example-url>
35
- * <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
36
- * <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
37
- * <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
38
- * <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
41
+ * <example-url>http://localhost:4200/#/ui/tabs/tab-skins/all-skins-side-by-side</example-url>
42
+ * <example-url>http://localhost:4200/#/ui/tabs/tab-skins/contained</example-url>
43
+ * <example-url>http://localhost:4200/#/ui/tabs/tab-skins/line</example-url>
44
+ * <example-url>http://localhost:4200/#/ui/tabs/tab-skins/pill</example-url>
45
+ * <example-url>http://localhost:4200/#/ui/tabs/tab-skins/pill-vs-toggle-group</example-url>
46
+ * <example-url>http://localhost:4200/#/ui/tabs/tab-skins/vertical-skins</example-url>
39
47
  */
40
48
  declare class CngxTabGroup implements CngxTabPanelHost {
41
49
  readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
@@ -256,6 +264,72 @@ declare class CngxTabGroup implements CngxTabPanelHost {
256
264
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTabGroup, "cngx-tab-group", ["cngxTabGroup"], { "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "skin": { "alias": "skin"; "required": false; "isSignal": true; }; "iconLayout": { "alias": "iconLayout"; "required": false; "isSignal": true; }; "panelMode": { "alias": "panelMode"; "required": false; "isSignal": true; }; "fitted": { "alias": "fitted"; "required": false; "isSignal": true; }; "tabAlign": { "alias": "tabAlign"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "addable": { "alias": "addable"; "required": false; "isSignal": true; }; }, {}, ["tabDirectives", "errorBadgeSlot", "rejectionIconSlot", "busySpinnerSlot", "iconSlot", "closeIconSlot", "addIconSlot"], ["cngx-tab-overflow", "*"], true, [{ directive: typeof _cngx_common_tabs.CngxTabGroupPresenter; inputs: { "activeIndex": "activeIndex"; "orientation": "orientation"; "loop": "loop"; "commitAction": "commitAction"; "commitMode": "commitMode"; }; outputs: { "activeIndexChange": "activeIndexChange"; "tabClose": "tabClose"; "tabAdd": "tabAdd"; }; }, { directive: typeof i2.CngxFocusRestore; inputs: {}; outputs: {}; }]>;
257
265
  }
258
266
 
267
+ /**
268
+ * CNGX tab-nav organism. \
269
+ * A `role="navigation"` landmark that wraps consumer-authored
270
+ * `<a cngxTabLink routerLink>` anchors into a tab bar. Native parallel of
271
+ * `[cngxMatTabNav]` in `@cngx/ui/mat-tabs`, and the link-driven sibling of
272
+ * the programmatic `<cngx-tab-group>` tablist: a navigation of natively
273
+ * focusable links is a different WAI-ARIA pattern than an automatic-
274
+ * activation tablist, so it is a separate organism, not a skin flag.
275
+ *
276
+ * Thin shell over {@link CngxTabGroupPresenter} via `hostDirectives` - the
277
+ * registry, `activeIndex`, and `activeId` come from the same brain the
278
+ * tablist organism and the Material bridge compose. There is no keyboard
279
+ * model and no commit gating: links are natural `Tab` stops, `Enter`
280
+ * activates the `routerLink`, and the router runs `CanDeactivate` natively.
281
+ * Add `[cngxTabsRouteSync]` to drive the active link from the route - it
282
+ * reflects `NavigationEnd` onto `activeIndex`; its commit-action stays
283
+ * dormant because nothing here calls `presenter.select()`.
284
+ *
285
+ * `CngxLiveRegion` is mounted as a child `<span>` rather than a host
286
+ * directive: its `role="status"` would clobber the host's `role="navigation"`
287
+ * landmark. Its content is the active link's label (Pillar 2 - the active
288
+ * change is announced).
289
+ *
290
+ * ```html
291
+ * <cngx-tab-nav cngxTabsRouteSync aria-label="Sections">
292
+ * <a cngxTabLink id="overview" routerLink="overview">Overview</a>
293
+ * <a cngxTabLink id="profile" routerLink="profile">Profile</a>
294
+ * </cngx-tab-nav>
295
+ * <router-outlet></router-outlet>
296
+ * ```
297
+ *
298
+ * @playground Native router tabs with a CanDeactivate guard ./examples/routed-nav/routed-nav.component.ts
299
+ * @see {@link CngxTabGroup} for the programmatic tablist organism.
300
+ *
301
+ * @category ui/tabs
302
+ * @docsKind primary
303
+ * @wcag AA
304
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/tabs/tab-nav.component.ts
305
+ * @since 0.1.0
306
+ * @relatedTo CngxTabLink, CngxTabsRouteSync, CngxTabGroup, CngxMatTabNav
307
+ */
308
+ declare class CngxTabNav {
309
+ readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
310
+ readonly ariaLabelledBy: _angular_core.InputSignal<string | undefined>;
311
+ /**
312
+ * Visual skin. Cascade `input ?? config ?? 'line'`, reflected onto
313
+ * `[data-skin]`. Resolved inline (single axis) rather than via
314
+ * `createTabsHostAttrs`: that helper resolves five tablist axes the nav
315
+ * does not use, so pulling it here would fabricate dead inputs - inline
316
+ * resolution is Komposition statt Konfiguration (Pillar 3).
317
+ */
318
+ readonly skin: _angular_core.InputSignal<CngxTabsSkin | undefined>;
319
+ protected readonly presenter: _cngx_common_tabs.CngxTabGroupHost;
320
+ private readonly config;
321
+ protected readonly resolvedSkin: Signal<CngxTabsSkin>;
322
+ /**
323
+ * Active link's accessible label, fed to the polite live region. Derived
324
+ * from `activeId` through the registered handle (Pillar 1 - single
325
+ * source, the route-fed active index). Empty string before any link is
326
+ * active so the region stays silent.
327
+ */
328
+ protected readonly liveAnnouncement: Signal<string>;
329
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTabNav, never>;
330
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTabNav, "cngx-tab-nav", ["cngxTabNav"], { "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "skin": { "alias": "skin"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof _cngx_common_tabs.CngxTabGroupPresenter; inputs: { "activeIndex": "activeIndex"; "orientation": "orientation"; }; outputs: { "activeIndexChange": "activeIndexChange"; }; }]>;
331
+ }
332
+
259
333
  /**
260
334
  * Opt-in overflow indicator for `<cngx-tab-group>`. Surfaces clipped
261
335
  * tab buttons through a "More" `CngxPopover` dropdown. Talks to the
@@ -278,6 +352,8 @@ declare class CngxTabGroup implements CngxTabPanelHost {
278
352
  * @since 0.1.0
279
353
  * @relatedTo CngxTabGroup, CngxPopover, CngxActiveDescendant
280
354
  * <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
355
+ * <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/all-skins-horizontal</example-url>
356
+ * <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/all-skins-vertical</example-url>
281
357
  */
282
358
  declare class CngxTabOverflow {
283
359
  protected readonly panelHost: CngxTabPanelHost;
@@ -326,4 +402,4 @@ declare class CngxTabOverflow {
326
402
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTabOverflow, "cngx-tab-overflow", ["cngxTabOverflow"], {}, {}, ["triggerSlot", "itemSlot"], never, true, never>;
327
403
  }
328
404
 
329
- export { CngxTabGroup, CngxTabOverflow };
405
+ export { CngxTabGroup, CngxTabNav, CngxTabOverflow };
@@ -1,90 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { input, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import * as i1 from '@angular/material/paginator';
4
- import { MatPaginatorModule } from '@angular/material/paginator';
5
-
6
- /**
7
- * Material paginator wrapper that connects to a {@link CngxPaginate} directive
8
- * via an explicit `[cngxPaginateRef]` input - no ancestor injection.
9
- *
10
- * ```html
11
- * <div cngxPaginate #pg="cngxPaginate" [total]="items.length">
12
- * <!-- table / list -->
13
- * </div>
14
- * <cngx-mat-paginator [cngxPaginateRef]="pg" />
15
- * ```
16
- *
17
- * For SmartDataSource integration, expose `filteredCount` from the data source
18
- * and bind it to `[total]` on the element that carries `cngxPaginate`:
19
- * ```html
20
- * <div cngxPaginate #pg="cngxPaginate" [total]="ds.filteredCount()">
21
- * <mat-table [dataSource]="ds" />
22
- * </div>
23
- * <cngx-mat-paginator [cngxPaginateRef]="pg" />
24
- * ```
25
- *
26
- * @category ui/material
27
- * @docsKind primary
28
- * @wcag AA
29
- * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/material/mat-paginator.ts
30
- * @since 0.1.0
31
- * @relatedTo CngxPaginate, CngxDataSource
32
- * <example-url>http://localhost:4200/#/common/data/data-source/datasource-cngxpaginate-manual-pipeline</example-url>
33
- * <example-url>http://localhost:4200/#/common/data/data-source/signal-observable-bridge</example-url>
34
- * <example-url>http://localhost:4200/#/common/data/paginate-list/paginated-list-cngxpaginate-cngxmatpaginator</example-url>
35
- * <example-url>http://localhost:4200/#/common/data/paginate-list/uncontrolled-mode-zero-class-boilerplate</example-url>
36
- */
37
- class CngxMatPaginator {
38
- /** The `CngxPaginate` directive instance to connect to. */
39
- cngxPaginateRef = input.required({ ...(ngDevMode ? { debugName: "cngxPaginateRef" } : /* istanbul ignore next */ {}), alias: 'cngxPaginateRef' });
40
- /** Options for the page-size selector. */
41
- pageSizeOptions = input([5, 10, 25], ...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : /* istanbul ignore next */ []));
42
- ref = this.cngxPaginateRef;
43
- handlePage(event) {
44
- // setPageSize(..., false) suppresses the implicit page reset so the
45
- // explicit setPage below lands the index mat-paginator already computed.
46
- this.ref().setPageSize(event.pageSize, false);
47
- this.ref().setPage(event.pageIndex);
48
- }
49
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatPaginator, deps: [], target: i0.ɵɵFactoryTarget.Component });
50
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxMatPaginator, isStandalone: true, selector: "cngx-mat-paginator", inputs: { cngxPaginateRef: { classPropertyName: "cngxPaginateRef", publicName: "cngxPaginateRef", isSignal: true, isRequired: true, transformFunction: null }, pageSizeOptions: { classPropertyName: "pageSizeOptions", publicName: "pageSizeOptions", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
51
- <mat-paginator
52
- [length]="ref().total()"
53
- [pageIndex]="ref().pageIndex()"
54
- [pageSize]="ref().pageSize()"
55
- [pageSizeOptions]="pageSizeOptions()"
56
- [disabled]="ref().isBusy()"
57
- (page)="handlePage($event)"
58
- />
59
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i1.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
60
- }
61
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatPaginator, decorators: [{
62
- type: Component,
63
- args: [{
64
- selector: 'cngx-mat-paginator',
65
- standalone: true,
66
- changeDetection: ChangeDetectionStrategy.OnPush,
67
- imports: [MatPaginatorModule],
68
- template: `
69
- <mat-paginator
70
- [length]="ref().total()"
71
- [pageIndex]="ref().pageIndex()"
72
- [pageSize]="ref().pageSize()"
73
- [pageSizeOptions]="pageSizeOptions()"
74
- [disabled]="ref().isBusy()"
75
- (page)="handlePage($event)"
76
- />
77
- `,
78
- }]
79
- }], propDecorators: { cngxPaginateRef: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxPaginateRef", required: true }] }], pageSizeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizeOptions", required: false }] }] } });
80
-
81
- /**
82
- * @module @cngx/ui/material
83
- */
84
-
85
- /**
86
- * Generated bundle index. Do not edit.
87
- */
88
-
89
- export { CngxMatPaginator };
90
- //# sourceMappingURL=cngx-ui-material.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cngx-ui-material.mjs","sources":["../../../projects/ui/material/mat-paginator.ts","../../../projects/ui/material/public-api.ts","../../../projects/ui/material/cngx-ui-material.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { MatPaginatorModule, type PageEvent } from '@angular/material/paginator';\nimport { type CngxPaginate } from '@cngx/common/data';\n\n/**\n * Material paginator wrapper that connects to a {@link CngxPaginate} directive\n * via an explicit `[cngxPaginateRef]` input - no ancestor injection.\n *\n * ```html\n * <div cngxPaginate #pg=\"cngxPaginate\" [total]=\"items.length\">\n * <!-- table / list -->\n * </div>\n * <cngx-mat-paginator [cngxPaginateRef]=\"pg\" />\n * ```\n *\n * For SmartDataSource integration, expose `filteredCount` from the data source\n * and bind it to `[total]` on the element that carries `cngxPaginate`:\n * ```html\n * <div cngxPaginate #pg=\"cngxPaginate\" [total]=\"ds.filteredCount()\">\n * <mat-table [dataSource]=\"ds\" />\n * </div>\n * <cngx-mat-paginator [cngxPaginateRef]=\"pg\" />\n * ```\n *\n * @category ui/material\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/material/mat-paginator.ts\n * @since 0.1.0\n * @relatedTo CngxPaginate, CngxDataSource\n * <example-url>http://localhost:4200/#/common/data/data-source/datasource-cngxpaginate-manual-pipeline</example-url>\n * <example-url>http://localhost:4200/#/common/data/data-source/signal-observable-bridge</example-url>\n * <example-url>http://localhost:4200/#/common/data/paginate-list/paginated-list-cngxpaginate-cngxmatpaginator</example-url>\n * <example-url>http://localhost:4200/#/common/data/paginate-list/uncontrolled-mode-zero-class-boilerplate</example-url>\n */\n@Component({\n selector: 'cngx-mat-paginator',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [MatPaginatorModule],\n template: `\n <mat-paginator\n [length]=\"ref().total()\"\n [pageIndex]=\"ref().pageIndex()\"\n [pageSize]=\"ref().pageSize()\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n [disabled]=\"ref().isBusy()\"\n (page)=\"handlePage($event)\"\n />\n `,\n})\nexport class CngxMatPaginator {\n /** The `CngxPaginate` directive instance to connect to. */\n readonly cngxPaginateRef = input.required<CngxPaginate>({ alias: 'cngxPaginateRef' });\n /** Options for the page-size selector. */\n readonly pageSizeOptions = input<number[]>([5, 10, 25]);\n\n protected readonly ref = this.cngxPaginateRef;\n\n protected handlePage(event: PageEvent): void {\n // setPageSize(..., false) suppresses the implicit page reset so the\n // explicit setPage below lands the index mat-paginator already computed.\n this.ref().setPageSize(event.pageSize, false);\n this.ref().setPage(event.pageIndex);\n }\n}\n","/**\n * @module @cngx/ui/material\n */\nexport { CngxMatPaginator } from './mat-paginator';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;MAiBU,gBAAgB,CAAA;;IAElB,eAAe,GAAG,KAAK,CAAC,QAAQ,sFAAiB,KAAK,EAAE,iBAAiB,EAAA,CAAG;;IAE5E,eAAe,GAAG,KAAK,CAAW,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,iBAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;AAEpC,IAAA,GAAG,GAAG,IAAI,CAAC,eAAe;AAEnC,IAAA,UAAU,CAAC,KAAgB,EAAA;;;AAGnC,QAAA,IAAI,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC;QAC7C,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;IACrC;uGAbW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,eAAA,EAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,eAAA,EAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAXjB;;;;;;;;;AAST,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAVS,kBAAkB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,YAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,WAAA,EAAA,QAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,cAAA,EAAA,sBAAA,EAAA,cAAA,EAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,MAAA,CAAA,EAAA,QAAA,EAAA,CAAA,cAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAYjB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAhB5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,UAAU,EAAE,IAAI;oBAChB,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,OAAO,EAAE,CAAC,kBAAkB,CAAC;AAC7B,oBAAA,QAAQ,EAAE;;;;;;;;;AAST,EAAA,CAAA;AACF,iBAAA;;;AClDD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1,90 +0,0 @@
1
- # CngxMatPaginator
2
-
3
- Material paginator wrapper connecting to a CngxPaginate directive via explicit `[cngxPaginateRef]` input.
4
-
5
- ## Import
6
-
7
- ```typescript
8
- import { CngxMatPaginator } from '@cngx/ui/material';
9
- ```
10
-
11
- ## Quick Start
12
-
13
- ```typescript
14
- import { Component, signal } from '@angular/core';
15
- import { MatTableModule } from '@angular/material/table';
16
- import { CngxPaginate } from '@cngx/common/data';
17
- import { CngxMatPaginator } from '@cngx/ui/material';
18
-
19
- @Component({
20
- selector: 'app-example',
21
- template: `
22
- <div cngxPaginate #pg="cngxPaginate" [total]="items.length">
23
- <table mat-table [dataSource]="paginatedItems()">
24
- <!-- table columns -->
25
- </table>
26
- </div>
27
- <cngx-mat-paginator [cngxPaginateRef]="pg" />
28
- `,
29
- imports: [MatTableModule, CngxMatPaginator],
30
- })
31
- export class ExampleComponent {
32
- readonly items = [];
33
-
34
- readonly paginatedItems = computed(() => {
35
- const pg = inject(CngxPaginate);
36
- return this.items.slice(pg.pageIndex() * pg.pageSize(), (pg.pageIndex() + 1) * pg.pageSize());
37
- });
38
- }
39
- ```
40
-
41
- ## Overview
42
-
43
- `CngxMatPaginator` is a Material Design paginator component that wraps the Material `mat-paginator` element and wires it to a `CngxPaginate` directive. It provides:
44
-
45
- - **Type-safe integration** - Explicit `[cngxPaginateRef]` input (no ancestor injection)
46
- - **Automatic state sync** - Page index, page size, and total count are automatically synchronized
47
- - **Page size selector** - Customizable page size options via `[pageSizeOptions]`
48
- - **Disabled state** - Paginator disables when `CngxPaginate.isBusy()` is true
49
-
50
- The component requires an explicit reference to the `CngxPaginate` directive instance - no hidden ancestor injection, no implicit wiring.
51
-
52
- ## Accessibility
53
-
54
- `CngxMatPaginator` delegates accessibility to Material's `mat-paginator` component. The Material paginator is fully accessible with:
55
-
56
- - **ARIA labels** - Paginator navigation and page size controls are properly labeled
57
- - **Keyboard navigation** - Tab order and keyboard shortcuts for page navigation
58
- - **Disabled state** - When `isBusy()` is true, controls are disabled and announced to screen readers
59
-
60
- ## Composition
61
-
62
- `CngxMatPaginator` composes:
63
-
64
- - **Material paginator** - `mat-paginator` component from `@angular/material/paginator`
65
- - **CngxPaginate directive** - Manages pagination state (page index, page size, total)
66
- - **Event handling** - Subscribes to Material paginator's `page` event and updates directive state
67
-
68
- ## How It Works
69
-
70
- 1. **Setup** - Consumer applies `cngxPaginate` on a container element and assigns a template reference
71
- 2. **Data binding** - Consumer passes `[total]="items.length"` to the directive
72
- 3. **Component wire-up** - `CngxMatPaginator` binds to the directive via `[cngxPaginateRef]`
73
- 4. **State sync** - Component reads `ref.pageIndex()`, `ref.pageSize()`, `ref.total()` and binds to Material's `mat-paginator`
74
- 5. **User interaction** - When user changes page or page size, Material's `page` event fires
75
- 6. **State update** - `CngxMatPaginator.handlePage()` calls `ref.setPageSize()` and `ref.setPage()` to update directive state
76
- 7. **Data refresh** - Consumer reactively filters/slices data based on directive signals
77
-
78
- ## Material Theming
79
-
80
- `CngxMatPaginator` uses the standard Material `mat-paginator` component, which inherits theming from your Material theme automatically. No additional theme configuration needed - include the Material theme in your global stylesheet.
81
-
82
- ```scss
83
- @use '@angular/material' as mat;
84
-
85
- $theme: mat.define-theme((...));
86
-
87
- html {
88
- @include mat.all-component-themes($theme);
89
- }
90
- ```
@@ -1,47 +0,0 @@
1
- import * as _angular_core from '@angular/core';
2
- import { PageEvent } from '@angular/material/paginator';
3
- import { CngxPaginate } from '@cngx/common/data';
4
-
5
- /**
6
- * Material paginator wrapper that connects to a {@link CngxPaginate} directive
7
- * via an explicit `[cngxPaginateRef]` input - no ancestor injection.
8
- *
9
- * ```html
10
- * <div cngxPaginate #pg="cngxPaginate" [total]="items.length">
11
- * <!-- table / list -->
12
- * </div>
13
- * <cngx-mat-paginator [cngxPaginateRef]="pg" />
14
- * ```
15
- *
16
- * For SmartDataSource integration, expose `filteredCount` from the data source
17
- * and bind it to `[total]` on the element that carries `cngxPaginate`:
18
- * ```html
19
- * <div cngxPaginate #pg="cngxPaginate" [total]="ds.filteredCount()">
20
- * <mat-table [dataSource]="ds" />
21
- * </div>
22
- * <cngx-mat-paginator [cngxPaginateRef]="pg" />
23
- * ```
24
- *
25
- * @category ui/material
26
- * @docsKind primary
27
- * @wcag AA
28
- * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/material/mat-paginator.ts
29
- * @since 0.1.0
30
- * @relatedTo CngxPaginate, CngxDataSource
31
- * <example-url>http://localhost:4200/#/common/data/data-source/datasource-cngxpaginate-manual-pipeline</example-url>
32
- * <example-url>http://localhost:4200/#/common/data/data-source/signal-observable-bridge</example-url>
33
- * <example-url>http://localhost:4200/#/common/data/paginate-list/paginated-list-cngxpaginate-cngxmatpaginator</example-url>
34
- * <example-url>http://localhost:4200/#/common/data/paginate-list/uncontrolled-mode-zero-class-boilerplate</example-url>
35
- */
36
- declare class CngxMatPaginator {
37
- /** The `CngxPaginate` directive instance to connect to. */
38
- readonly cngxPaginateRef: _angular_core.InputSignal<CngxPaginate>;
39
- /** Options for the page-size selector. */
40
- readonly pageSizeOptions: _angular_core.InputSignal<number[]>;
41
- protected readonly ref: _angular_core.InputSignal<CngxPaginate>;
42
- protected handlePage(event: PageEvent): void;
43
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxMatPaginator, never>;
44
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxMatPaginator, "cngx-mat-paginator", never, { "cngxPaginateRef": { "alias": "cngxPaginateRef"; "required": true; "isSignal": true; }; "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
45
- }
46
-
47
- export { CngxMatPaginator };