@cngx/common 0.1.0-rc.3 → 0.1.0-rc.5
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/audio/README.md +180 -0
- package/display/README.md +1 -0
- package/fesm2022/cngx-common-a11y.mjs +123 -3
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +1205 -0
- package/fesm2022/cngx-common-audio.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +8 -8
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +2 -2
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +996 -55
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +320 -8
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +1633 -80
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +187 -3
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +63 -8
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/interactive/README.md +101 -0
- package/layout/README.md +39 -1
- package/package.json +5 -1
- package/theming/components/cngx-accordion.css +147 -0
- package/theming/components/cngx-badge.css +6 -0
- package/theming/components/cngx-bottom-sheet.css +8 -1
- package/theming/components/cngx-breadcrumb.css +108 -0
- package/theming/components/cngx-button-toggle.css +6 -0
- package/theming/components/cngx-data-grid.css +154 -0
- package/theming/components/cngx-dialog.css +4 -0
- package/theming/components/cngx-divider.css +4 -0
- package/theming/components/cngx-listbox.css +6 -0
- package/theming/components/cngx-menu.css +7 -0
- package/theming/components/cngx-slider.css +237 -0
- package/theming/components/cngx-tooltip.css +6 -0
- package/types/cngx-common-a11y.d.ts +67 -2
- package/types/cngx-common-audio.d.ts +736 -0
- package/types/cngx-common-data.d.ts +632 -22
- package/types/cngx-common-display.d.ts +189 -1
- package/types/cngx-common-interactive.d.ts +1028 -31
- package/types/cngx-common-layout.d.ts +88 -3
- package/types/cngx-common-popover.d.ts +25 -4
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Signal, TemplateRef, OnInit, InjectionToken, Resource, EnvironmentProviders, ElementRef, Injector, DestroyRef } from '@angular/core';
|
|
3
3
|
import { CngxAsyncState, AsyncStatus } from '@cngx/core/utils';
|
|
4
4
|
import { DataSource } from '@angular/cdk/collections';
|
|
5
5
|
import { Observable, MonoTypeOperatorFunction, OperatorFunction } from 'rxjs';
|
|
6
|
+
import { HttpContextToken, HttpContext, HttpInterceptorFn } from '@angular/common/http';
|
|
6
7
|
import { CngxRovingTabindex, CngxActiveDescendant } from '@cngx/common/a11y';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -22,6 +23,11 @@ interface SortEntry {
|
|
|
22
23
|
* precedence over the internal state - pair with `sortChange` to keep them
|
|
23
24
|
* in sync.
|
|
24
25
|
*
|
|
26
|
+
* An uncontrolled sort may declare a **starting** column + direction via
|
|
27
|
+
* `[cngxSortInitial]`: it seeds the internal state exactly once on init, then
|
|
28
|
+
* user clicks take over. Distinct from the controlled `cngxSortActive` /
|
|
29
|
+
* `cngxSortDirection` pins - the seed is skipped when a controlled pin is bound.
|
|
30
|
+
*
|
|
25
31
|
* When `multiSort` is `true`, holding **Shift** while clicking a sort header
|
|
26
32
|
* adds it as a secondary (tertiary, …) sort key instead of replacing the
|
|
27
33
|
* primary one. Shift-clicking an active column cycles it asc → desc → removed.
|
|
@@ -40,9 +46,6 @@ interface SortEntry {
|
|
|
40
46
|
* <example-url>http://localhost:4200/#/common/data/sort/multi-sort</example-url>
|
|
41
47
|
* <example-url>http://localhost:4200/#/common/data/sort/controlled</example-url>
|
|
42
48
|
* <example-url>http://localhost:4200/#/common/data/sort/aria-and-keyboard</example-url>
|
|
43
|
-
// * <example-url>http://localhost:4200/#/common/data/smart-data-source/auto-wired</example-url>
|
|
44
|
-
// * <example-url>http://localhost:4200/#/common/data/smart-data-source/how-it-works-hostdirectives-inject</example-url>
|
|
45
|
-
// * <example-url>http://localhost:4200/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>
|
|
46
49
|
*/
|
|
47
50
|
declare class CngxSort {
|
|
48
51
|
/** Controlled active column. When bound, takes precedence over internal state (single-sort only). */
|
|
@@ -54,7 +57,14 @@ declare class CngxSort {
|
|
|
54
57
|
* replacing the current sort.
|
|
55
58
|
*/
|
|
56
59
|
readonly multiSort: _angular_core.InputSignal<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Uncontrolled starting sort. Seeds the internal state once on init if no sort
|
|
62
|
+
* is set yet and no controlled `cngxSortActive` pin is bound; user clicks own
|
|
63
|
+
* it thereafter. Ignored in controlled mode.
|
|
64
|
+
*/
|
|
65
|
+
readonly initialSort: _angular_core.InputSignal<SortEntry | undefined>;
|
|
57
66
|
private readonly sortsState;
|
|
67
|
+
constructor();
|
|
58
68
|
/** The active sort column of the primary entry (controlled takes precedence in single-sort mode). */
|
|
59
69
|
readonly active: _angular_core.Signal<string>;
|
|
60
70
|
/** The active sort direction of the primary entry (controlled takes precedence in single-sort mode). */
|
|
@@ -85,7 +95,7 @@ declare class CngxSort {
|
|
|
85
95
|
* Sets or toggles the sort for `field`.
|
|
86
96
|
*
|
|
87
97
|
* **`additive = false`** (default, plain click):
|
|
88
|
-
* - Same field →
|
|
98
|
+
* - Same field → cycle `asc` → `desc` → cleared (a third click removes the sort)
|
|
89
99
|
* - Different field → replace stack with `{ field, asc }`
|
|
90
100
|
*
|
|
91
101
|
* **`additive = true`** (Shift+click when `multiSort` is enabled on the header):
|
|
@@ -97,7 +107,7 @@ declare class CngxSort {
|
|
|
97
107
|
/** Clears all active sorts. Emits both `sortChange(undefined)` and `sortsChange([])`. */
|
|
98
108
|
clear(): void;
|
|
99
109
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxSort, never>;
|
|
100
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxSort, "[cngxSort]", ["cngxSort"], { "activeInput": { "alias": "cngxSortActive"; "required": false; "isSignal": true; }; "directionInput": { "alias": "cngxSortDirection"; "required": false; "isSignal": true; }; "multiSort": { "alias": "multiSort"; "required": false; "isSignal": true; }; }, { "sortChange": "sortChange"; "sortsChange": "sortsChange"; }, never, never, true, never>;
|
|
110
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxSort, "[cngxSort]", ["cngxSort"], { "activeInput": { "alias": "cngxSortActive"; "required": false; "isSignal": true; }; "directionInput": { "alias": "cngxSortDirection"; "required": false; "isSignal": true; }; "multiSort": { "alias": "multiSort"; "required": false; "isSignal": true; }; "initialSort": { "alias": "cngxSortInitial"; "required": false; "isSignal": true; }; }, { "sortChange": "sortChange"; "sortsChange": "sortsChange"; }, never, never, true, never>;
|
|
101
111
|
}
|
|
102
112
|
|
|
103
113
|
/**
|
|
@@ -139,7 +149,7 @@ declare class CngxSortHeader {
|
|
|
139
149
|
readonly field: _angular_core.InputSignal<string>;
|
|
140
150
|
/** Explicit reference to the owning `CngxSort`. */
|
|
141
151
|
readonly cngxSortRef: _angular_core.InputSignal<CngxSort>;
|
|
142
|
-
private readonly
|
|
152
|
+
private readonly state;
|
|
143
153
|
/** `true` when this column is part of the active sort (primary or secondary). */
|
|
144
154
|
readonly isActive: _angular_core.Signal<boolean>;
|
|
145
155
|
/** `true` when this column is active and sorted ascending. */
|
|
@@ -159,6 +169,53 @@ declare class CngxSortHeader {
|
|
|
159
169
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxSortHeader, "[cngxSortHeader]", ["cngxSortHeader"], { "field": { "alias": "cngxSortHeader"; "required": true; "isSignal": true; }; "cngxSortRef": { "alias": "cngxSortRef"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
160
170
|
}
|
|
161
171
|
|
|
172
|
+
/**
|
|
173
|
+
* The derived sort-header state a header directive exposes for one column.
|
|
174
|
+
*
|
|
175
|
+
* Pure derivation over a single {@link CngxSort} source plus an imperative
|
|
176
|
+
* `toggle`. No async state, no signal writes outside `toggle`.
|
|
177
|
+
*
|
|
178
|
+
* @category common/data/sort
|
|
179
|
+
*/
|
|
180
|
+
interface SortHeaderState {
|
|
181
|
+
/** The active sort entry for this column, or `undefined` when the column is not sorted. */
|
|
182
|
+
readonly entry: Signal<SortEntry | undefined>;
|
|
183
|
+
/** `true` when this column is part of the active sort (primary or secondary). */
|
|
184
|
+
readonly isActive: Signal<boolean>;
|
|
185
|
+
/** `true` when this column is active and sorted ascending. */
|
|
186
|
+
readonly isAsc: Signal<boolean>;
|
|
187
|
+
/** `true` when this column is active and sorted descending. */
|
|
188
|
+
readonly isDesc: Signal<boolean>;
|
|
189
|
+
/**
|
|
190
|
+
* 1-based position of this column in the sort stack, or `0` when it is not active.
|
|
191
|
+
* Only meaningful when `multiSort` is enabled on the owning `CngxSort`.
|
|
192
|
+
*/
|
|
193
|
+
readonly priority: Signal<number>;
|
|
194
|
+
/**
|
|
195
|
+
* Toggles this column's sort through `CngxSort.setSort`. Pass the header's own
|
|
196
|
+
* Shift-key read as `additive`; the `multiSort` gate is applied here so the
|
|
197
|
+
* column only joins the stack additively when the owning sort allows it.
|
|
198
|
+
*/
|
|
199
|
+
toggle(additive?: boolean): void;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Derives the shared sort-header state for one column from a {@link CngxSort} getter.
|
|
203
|
+
*
|
|
204
|
+
* Both {@link CngxSortHeader} (table context, `aria-sort`) and `CngxDgaSortHeader`
|
|
205
|
+
* (disclosure context, `role="button"` + `aria-describedby`) compose this factory
|
|
206
|
+
* and keep only their own a11y presentation. The factory is a11y-agnostic - it
|
|
207
|
+
* returns the plain derived signals each header maps to its own DOM/ARIA surface.
|
|
208
|
+
*
|
|
209
|
+
* @param sort Getter for the owning `CngxSort` engine (`() => sortRef`, `() => grid.sort`).
|
|
210
|
+
* @param field Getter for the column's field key.
|
|
211
|
+
* @returns The derived `{ entry, isActive, isAsc, isDesc, priority, toggle }` bundle.
|
|
212
|
+
*
|
|
213
|
+
* @category common/data/sort
|
|
214
|
+
* @since 0.1.0
|
|
215
|
+
* @relatedTo CngxSort, CngxSortHeader
|
|
216
|
+
*/
|
|
217
|
+
declare function createSortHeaderState(sort: () => CngxSort, field: () => string): SortHeaderState;
|
|
218
|
+
|
|
162
219
|
/**
|
|
163
220
|
* Atom directive that holds one or more named filter predicates.
|
|
164
221
|
*
|
|
@@ -429,14 +486,16 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
429
486
|
/**
|
|
430
487
|
* Atom directive that tracks pagination state (current page index and page size).
|
|
431
488
|
*
|
|
432
|
-
* Supports both **uncontrolled** (internal state) and **controlled** modes.
|
|
489
|
+
* Supports both **uncontrolled** (internal state) and **controlled** modes. \
|
|
433
490
|
* In controlled mode the `cngxPageIndex` / `cngxPageSize` inputs take precedence
|
|
434
|
-
* over internal state - pair with
|
|
491
|
+
* over internal state - pair with \
|
|
492
|
+
* `pageChange` / `pageSizeChange` to keep them
|
|
435
493
|
* in sync.
|
|
436
494
|
*
|
|
437
495
|
* Consumer connects this to a list or table via `range()` - nothing is injected
|
|
438
496
|
* automatically.
|
|
439
497
|
*
|
|
498
|
+
* ```
|
|
440
499
|
* // Headless: read range() from a template ref
|
|
441
500
|
* <div cngxPaginate #pg="cngxPaginate" [total]="items.length">
|
|
442
501
|
* @for (item of items.slice(pg.range()[0], pg.range()[1]); track item.id) { ... }
|
|
@@ -446,7 +505,7 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
446
505
|
* <mat-paginator
|
|
447
506
|
* [length]="pg.total()" [pageIndex]="pg.pageIndex()" [pageSize]="pg.pageSize()"
|
|
448
507
|
* (page)="pg.setPageSize($event.pageSize, false); pg.setPage($event.pageIndex)" />
|
|
449
|
-
*
|
|
508
|
+
* ```
|
|
450
509
|
* @category common/data/paginate
|
|
451
510
|
* @docsKind primary
|
|
452
511
|
* @wcag AA
|
|
@@ -455,8 +514,6 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
455
514
|
* @relatedTo CngxSort, CngxFilter, CngxSmartDataSource
|
|
456
515
|
*
|
|
457
516
|
* <example-url>http://localhost:4200/#/common/data/data-source/datasource-cngxpaginate-manual-pipeline</example-url>
|
|
458
|
-
* <example-url>http://localhost:4200/#/common/data/paginate-list/bridge-announce-page-changes</example-url>
|
|
459
|
-
* <example-url>http://localhost:4200/#/common/data/paginate-list/instrumentation-bridge-cngxmatpaginator</example-url>
|
|
460
517
|
* <example-url>http://localhost:4200/#/common/data/paginate-list/paginated-list-cngxpaginate-cngxmatpaginator</example-url>
|
|
461
518
|
* <example-url>http://localhost:4200/#/common/data/paginate-list/uncontrolled-mode-zero-class-boilerplate</example-url>
|
|
462
519
|
* <example-url>http://localhost:4200/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>
|
|
@@ -548,8 +605,8 @@ declare class CngxPaginate {
|
|
|
548
605
|
declare function connectPaginateResetOn(paginate: CngxPaginate, key: () => unknown): void;
|
|
549
606
|
/**
|
|
550
607
|
* Resets a `cngxPaginate` host to the first page whenever the bound key
|
|
551
|
-
* changes - the composable form of {@link connectPaginateResetOn}.
|
|
552
|
-
* the same element as `cngxPaginate` (or a `CngxPaginator` / `CngxMatPaginator`,
|
|
608
|
+
* changes - the composable form of {@link connectPaginateResetOn}. \
|
|
609
|
+
* Drop it on the same element as `cngxPaginate` (or a `CngxPaginator` / `CngxMatPaginator`,
|
|
553
610
|
* which provide the brain), and bind the sort / filter / search value a result
|
|
554
611
|
* set depends on, so a narrowed result never strands the user on a now-empty
|
|
555
612
|
* page.
|
|
@@ -560,9 +617,11 @@ declare function connectPaginateResetOn(paginate: CngxPaginate, key: () => unkno
|
|
|
560
617
|
* ```html
|
|
561
618
|
* <table cngxPaginate [cngxPaginateResetOn]="filter()"><!-- ... --></table>
|
|
562
619
|
* ```
|
|
620
|
+
* <example-url>http://localhost:4200/#/ui/paginator/paginator-behaviors/reset-on-filter</example-url>
|
|
563
621
|
*
|
|
564
622
|
* @category common/data/paginate
|
|
565
623
|
* @docsKind primary
|
|
624
|
+
* @wcag AA
|
|
566
625
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate-reset.directive.ts
|
|
567
626
|
* @since 0.1.0
|
|
568
627
|
* @relatedTo CngxPaginate, CngxPaginator, CngxMatPaginator
|
|
@@ -576,6 +635,44 @@ declare class CngxPaginateResetOn {
|
|
|
576
635
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPaginateResetOn, "[cngxPaginateResetOn]", ["cngxPaginateResetOn"], { "key": { "alias": "cngxPaginateResetOn"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
577
636
|
}
|
|
578
637
|
|
|
638
|
+
/**
|
|
639
|
+
* Handlers the two-way emit bridge forwards page changes to - typically a
|
|
640
|
+
* host component's `pageIndexChange` / `pageSizeChange` output emitters.
|
|
641
|
+
*
|
|
642
|
+
* @category common/data/paginate
|
|
643
|
+
* @since 0.1.0
|
|
644
|
+
*/
|
|
645
|
+
interface CngxPaginateEmitHandlers {
|
|
646
|
+
/** Called once per effective page-index change. */
|
|
647
|
+
readonly onIndex: (index: number) => void;
|
|
648
|
+
/** Called once per effective page-size change. */
|
|
649
|
+
readonly onSize: (size: number) => void;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Wires the {@link CngxPaginate} brain's page / page-size changes onto a host's
|
|
653
|
+
* two-way outputs with exactly-once emit semantics. Two paths feed each handler,
|
|
654
|
+
* sharing a last-emitted guard:
|
|
655
|
+
* - a subscription forwards the brain's nav-only `pageChange` / `pageSizeChange`
|
|
656
|
+
* - the only signal that captures a controlled-mode `setPage`, because the
|
|
657
|
+
* brain's `pageIndex()` stays pinned to the input until the consumer feeds it
|
|
658
|
+
* back;
|
|
659
|
+
* - an `effect()` reads the effective `pageIndex()` / `pageSize()` and covers a
|
|
660
|
+
* `total`-shrink clamp the nav-only output misses.
|
|
661
|
+
*
|
|
662
|
+
* The shared guard makes a value one path already emitted a no-op on the other,
|
|
663
|
+
* so each change emits exactly once. Seeded with the current effective values,
|
|
664
|
+
* so wiring emits no initial change.
|
|
665
|
+
*
|
|
666
|
+
* Shared verbatim by the `CngxPaginator` shell and the `CngxIncrementalList`
|
|
667
|
+
* organism, so the two-way emit behaviour is byte-identical. Call inside an
|
|
668
|
+
* injection context (constructor or field initialiser) - it reads `DestroyRef`
|
|
669
|
+
* and creates effects.
|
|
670
|
+
*
|
|
671
|
+
* @category common/data/paginate
|
|
672
|
+
* @since 0.1.0
|
|
673
|
+
*/
|
|
674
|
+
declare function connectPaginateEmit(paginate: CngxPaginate, handlers: CngxPaginateEmitHandlers): void;
|
|
675
|
+
|
|
579
676
|
/**
|
|
580
677
|
* Persists a `cngxPaginate` host's page / size in the URL query string, so a
|
|
581
678
|
* paginated view is deep-linkable and survives reload / back / forward.
|
|
@@ -589,7 +686,7 @@ declare class CngxPaginateResetOn {
|
|
|
589
686
|
* ```
|
|
590
687
|
*
|
|
591
688
|
* Two paginators on one route must take distinct param names via
|
|
592
|
-
* `[cngxPaginatePageParam]` / `[cngxPaginateSizeParam]` to avoid a collision.
|
|
689
|
+
* `[cngxPaginatePageParam]` / `[cngxPaginateSizeParam]` to avoid a collision. \
|
|
593
690
|
* Requires `@angular/router` (`provideRouter`); without it the directive is an
|
|
594
691
|
* inert no-op (a dev-mode warning is logged). Framework-agnostic of any UI - it
|
|
595
692
|
* needs only the brain and the router.
|
|
@@ -625,6 +722,8 @@ declare class CngxPaginateRouting implements OnInit {
|
|
|
625
722
|
* derived empty/active state to reflect.
|
|
626
723
|
*
|
|
627
724
|
* @category common/data/paginate
|
|
725
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts
|
|
726
|
+
* @since 0.1.0
|
|
628
727
|
*/
|
|
629
728
|
interface CngxBucketPaginateView {
|
|
630
729
|
/** Human-readable bucket label, e.g. `'A-C'`. Rendered as the chip text. */
|
|
@@ -643,6 +742,8 @@ interface CngxBucketPaginateView {
|
|
|
643
742
|
* the active bucket clears it) holds in one place.
|
|
644
743
|
*
|
|
645
744
|
* @category common/data/paginate
|
|
745
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts
|
|
746
|
+
* @since 0.1.0
|
|
646
747
|
*/
|
|
647
748
|
interface CngxBucketPaginateHost {
|
|
648
749
|
/** The buckets to render, in declaration order. One chip per entry. */
|
|
@@ -1001,6 +1102,18 @@ interface InjectAsyncStateOptions {
|
|
|
1001
1102
|
* @default 50
|
|
1002
1103
|
*/
|
|
1003
1104
|
debounce?: number;
|
|
1105
|
+
/**
|
|
1106
|
+
* Human-readable label surfaced in `CngxAsyncRegistry.activeOperations`.
|
|
1107
|
+
* Display only - never the registry key. Ignored unless `register` is set.
|
|
1108
|
+
*/
|
|
1109
|
+
label?: string;
|
|
1110
|
+
/**
|
|
1111
|
+
* When `true`, register this state in the ambient `CngxAsyncRegistry` (if
|
|
1112
|
+
* one is provided via `provideAsyncRegistry()`) for the injector's lifetime,
|
|
1113
|
+
* and unregister automatically on destroy. Defaults to `false` - a no-op for
|
|
1114
|
+
* existing callers, and a no-op when no registry is provided.
|
|
1115
|
+
*/
|
|
1116
|
+
register?: boolean;
|
|
1004
1117
|
}
|
|
1005
1118
|
/**
|
|
1006
1119
|
* Reactive async state returned by `injectAsyncState`.
|
|
@@ -1216,6 +1329,181 @@ declare function tapHttpAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
|
1216
1329
|
status?: 'loading' | 'refreshing' | 'pending';
|
|
1217
1330
|
}): OperatorFunction<unknown, T>;
|
|
1218
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* Read-only snapshot of one registered async operation.
|
|
1334
|
+
*
|
|
1335
|
+
* @category common/data/async-registry
|
|
1336
|
+
*/
|
|
1337
|
+
interface CngxAsyncOperation {
|
|
1338
|
+
/** Per-operation uid minted at registration (`register`'s return value). */
|
|
1339
|
+
readonly id: string;
|
|
1340
|
+
/** Human-readable label, if one was supplied. Display only, never a key. */
|
|
1341
|
+
readonly label?: string;
|
|
1342
|
+
/** The operation's current status. */
|
|
1343
|
+
readonly status: AsyncStatus;
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Opt-in aggregation registry for in-flight async operations.
|
|
1347
|
+
*
|
|
1348
|
+
* A single derived source for "is anything loading?" across a whole app: the
|
|
1349
|
+
* shell binds one `isAnythingLoading()` instead of N hand-maintained flags.
|
|
1350
|
+
* Producers register their `CngxAsyncState` (via `injectAsyncState({ register:
|
|
1351
|
+
* true })`, the HTTP interceptor, or directly) and unregister on teardown.
|
|
1352
|
+
*
|
|
1353
|
+
* Not `providedIn: 'root'` - consumers opt in with {@link provideAsyncRegistry}.
|
|
1354
|
+
* When the registry is absent, producers skip registration entirely.
|
|
1355
|
+
*
|
|
1356
|
+
* **Keyed by a per-operation uid, not the human label.** Async operations are
|
|
1357
|
+
* transient and collide on label; uid identity keeps N concurrent same-label
|
|
1358
|
+
* (or unlabeled) operations independent, so one `unregister` evicts exactly
|
|
1359
|
+
* its own entry. This is the one deliberate divergence from `CngxErrorRegistry`
|
|
1360
|
+
* (which keys by a stable scope name).
|
|
1361
|
+
*
|
|
1362
|
+
* Both views are `computed()` only - no `effect`, no service calls. Inner
|
|
1363
|
+
* status reactivity flows through each entry's `CngxAsyncState` signals; the
|
|
1364
|
+
* Map signal's `mapKeySetEqual` short-circuits register/unregister churn
|
|
1365
|
+
* without hiding status changes.
|
|
1366
|
+
*
|
|
1367
|
+
* @category common/data/async-registry
|
|
1368
|
+
*/
|
|
1369
|
+
declare class CngxAsyncRegistry {
|
|
1370
|
+
private readonly entriesState;
|
|
1371
|
+
/**
|
|
1372
|
+
* `true` when at least one registered operation reports `isLoading()`
|
|
1373
|
+
* (`loading`, `pending`, or `refreshing`).
|
|
1374
|
+
*/
|
|
1375
|
+
readonly isAnythingLoading: Signal<boolean>;
|
|
1376
|
+
/** Every registered operation with its current status, in registration order. */
|
|
1377
|
+
readonly activeOperations: Signal<readonly CngxAsyncOperation[]>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Registers an async state under a fresh per-operation uid and returns it.
|
|
1380
|
+
* The optional `label` is display metadata only - never the map key, so
|
|
1381
|
+
* concurrent same-label (or unlabeled) operations stay independent.
|
|
1382
|
+
*/
|
|
1383
|
+
register(state: CngxAsyncState<unknown>, label?: string): string;
|
|
1384
|
+
/** Removes the operation with the given uid. No-op if absent. */
|
|
1385
|
+
unregister(id: string): void;
|
|
1386
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAsyncRegistry, never>;
|
|
1387
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CngxAsyncRegistry>;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Provides {@link CngxAsyncRegistry} in the host environment.
|
|
1392
|
+
*
|
|
1393
|
+
* Opt-in - not `providedIn: 'root'`. Add it to `bootstrapApplication`
|
|
1394
|
+
* providers to enable app-wide async observability; producers that opt in
|
|
1395
|
+
* (`injectAsyncState({ register: true })`, `provideAsyncHttpObservability()`)
|
|
1396
|
+
* then surface in `isAnythingLoading()` / `activeOperations()`.
|
|
1397
|
+
*
|
|
1398
|
+
* ```ts
|
|
1399
|
+
* bootstrapApplication(AppComponent, {
|
|
1400
|
+
* providers: [provideAsyncRegistry()],
|
|
1401
|
+
* });
|
|
1402
|
+
* ```
|
|
1403
|
+
*
|
|
1404
|
+
* @category common/data/async-registry
|
|
1405
|
+
*/
|
|
1406
|
+
declare function provideAsyncRegistry(): EnvironmentProviders;
|
|
1407
|
+
/**
|
|
1408
|
+
* Returns the ambient {@link CngxAsyncRegistry}, or `null` when the consumer
|
|
1409
|
+
* did not opt in via {@link provideAsyncRegistry}. Must run in an injection
|
|
1410
|
+
* context.
|
|
1411
|
+
*
|
|
1412
|
+
* @category common/data/async-registry
|
|
1413
|
+
*/
|
|
1414
|
+
declare function injectAsyncRegistry(): CngxAsyncRegistry | null;
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Per-request label surfaced in `CngxAsyncRegistry.activeOperations` when the
|
|
1418
|
+
* request is tracked by `cngxAsyncInterceptor`. Display only, never a key.
|
|
1419
|
+
*
|
|
1420
|
+
* @category common/data/async-registry
|
|
1421
|
+
*/
|
|
1422
|
+
declare const CNGX_ASYNC_LABEL: HttpContextToken<string | undefined>;
|
|
1423
|
+
/**
|
|
1424
|
+
* Per-request opt-out. When `true`, `cngxAsyncInterceptor` passes the request
|
|
1425
|
+
* through without registering it - keeps polling / telemetry pings out of the
|
|
1426
|
+
* aggregate without a global allow-list.
|
|
1427
|
+
*
|
|
1428
|
+
* @category common/data/async-registry
|
|
1429
|
+
*/
|
|
1430
|
+
declare const CNGX_ASYNC_SKIP: HttpContextToken<boolean>;
|
|
1431
|
+
/**
|
|
1432
|
+
* Returns an `HttpContext` that labels the request for async observability.
|
|
1433
|
+
* Pass an existing context to chain with other tokens.
|
|
1434
|
+
*
|
|
1435
|
+
* ```typescript
|
|
1436
|
+
* this.http.get('/api/users', { context: withAsyncLabel('users') });
|
|
1437
|
+
* ```
|
|
1438
|
+
*
|
|
1439
|
+
* @category common/data/async-registry
|
|
1440
|
+
*/
|
|
1441
|
+
declare function withAsyncLabel(label: string, context?: HttpContext): HttpContext;
|
|
1442
|
+
/**
|
|
1443
|
+
* Returns an `HttpContext` that opts the request out of async observability.
|
|
1444
|
+
* Pass an existing context to chain with other tokens.
|
|
1445
|
+
*
|
|
1446
|
+
* ```typescript
|
|
1447
|
+
* this.http.get('/api/ping', { context: withAsyncSkip() });
|
|
1448
|
+
* ```
|
|
1449
|
+
*
|
|
1450
|
+
* @category common/data/async-registry
|
|
1451
|
+
*/
|
|
1452
|
+
declare function withAsyncSkip(context?: HttpContext): HttpContext;
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* Functional HTTP interceptor that surfaces every in-flight `HttpRequest` in
|
|
1456
|
+
* the ambient {@link CngxAsyncRegistry}, so `isAnythingLoading()` aggregates
|
|
1457
|
+
* raw HTTP traffic alongside explicit component states.
|
|
1458
|
+
*
|
|
1459
|
+
* Fully opt-in and self-contained:
|
|
1460
|
+
* - Resolves `inject(CngxAsyncRegistry, { optional: true })` and passes the
|
|
1461
|
+
* request straight through when no registry is provided - zero behaviour
|
|
1462
|
+
* change for consumers who do not opt in.
|
|
1463
|
+
* - Passes through without registering when `CNGX_ASYNC_SKIP` is set.
|
|
1464
|
+
* - Otherwise registers a fresh `createManualState` (set `loading`) under a
|
|
1465
|
+
* per-request uid, maps the final response / error onto it, and
|
|
1466
|
+
* `unregister`s in a `finalize` that fires on success **and** error (and on
|
|
1467
|
+
* unsubscribe), so a request can never pin the global loading state.
|
|
1468
|
+
*
|
|
1469
|
+
* Per-request uid identity (from `CngxAsyncRegistry`) means concurrent requests
|
|
1470
|
+
* sharing a label never evict one another - completing one leaves the other
|
|
1471
|
+
* tracked. The interceptor does not swallow errors: `setError` records the
|
|
1472
|
+
* failure, then the error propagates to the caller unchanged.
|
|
1473
|
+
*
|
|
1474
|
+
* @category common/data/async-registry
|
|
1475
|
+
*/
|
|
1476
|
+
declare const cngxAsyncInterceptor: HttpInterceptorFn;
|
|
1477
|
+
/**
|
|
1478
|
+
* Sets up `HttpClient` with {@link cngxAsyncInterceptor} so every request
|
|
1479
|
+
* surfaces in {@link CngxAsyncRegistry}. Opt-in - add it to
|
|
1480
|
+
* `bootstrapApplication` providers alongside `provideAsyncRegistry()`.
|
|
1481
|
+
*
|
|
1482
|
+
* ```ts
|
|
1483
|
+
* bootstrapApplication(AppComponent, {
|
|
1484
|
+
* providers: [
|
|
1485
|
+
* provideAsyncRegistry(),
|
|
1486
|
+
* provideAsyncHttpObservability(),
|
|
1487
|
+
* ],
|
|
1488
|
+
* });
|
|
1489
|
+
* ```
|
|
1490
|
+
*
|
|
1491
|
+
* **Use this only when cngx owns the `HttpClient` setup.** It calls
|
|
1492
|
+
* `provideHttpClient(withInterceptors([cngxAsyncInterceptor]))` internally, so
|
|
1493
|
+
* an app that already calls `provideHttpClient` (especially with `withFetch()`
|
|
1494
|
+
* or other features) would get a second, feature-less `HttpClient`
|
|
1495
|
+
* configuration - last-provider-wins on `HttpBackend` can silently revert
|
|
1496
|
+
* `withFetch()` to the XHR backend. In that case do not call this; add the
|
|
1497
|
+
* exported {@link cngxAsyncInterceptor} to your own `withInterceptors` instead:
|
|
1498
|
+
*
|
|
1499
|
+
* ```ts
|
|
1500
|
+
* provideHttpClient(withFetch(), withInterceptors([authInterceptor, cngxAsyncInterceptor]))
|
|
1501
|
+
* ```
|
|
1502
|
+
*
|
|
1503
|
+
* @category common/data/async-registry
|
|
1504
|
+
*/
|
|
1505
|
+
declare function provideAsyncHttpObservability(): EnvironmentProviders;
|
|
1506
|
+
|
|
1219
1507
|
/**
|
|
1220
1508
|
* Template context for the `*cngxAsync` content template.
|
|
1221
1509
|
* `$implicit` provides the data value, typed via `ngTemplateContextGuard`.
|
|
@@ -1395,20 +1683,337 @@ declare class CngxMetric {
|
|
|
1395
1683
|
* <example-url>http://localhost:4200/#/common/data/trend/trend-directions</example-url>
|
|
1396
1684
|
*/
|
|
1397
1685
|
declare class CngxTrend {
|
|
1686
|
+
private readonly locale;
|
|
1398
1687
|
/** Trend percentage. Positive = up, negative = down, zero = flat. */
|
|
1399
1688
|
readonly value: _angular_core.InputSignal<number>;
|
|
1400
1689
|
/** Consumer-provided SR label override. When set, replaces the generated default. */
|
|
1401
1690
|
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
1402
1691
|
/** @internal */
|
|
1403
|
-
readonly icon: _angular_core.Signal<
|
|
1692
|
+
protected readonly icon: _angular_core.Signal<string>;
|
|
1404
1693
|
/** @internal */
|
|
1405
|
-
readonly formattedValue: _angular_core.Signal<string>;
|
|
1694
|
+
protected readonly formattedValue: _angular_core.Signal<string>;
|
|
1406
1695
|
/** @internal */
|
|
1407
|
-
readonly resolvedLabel: _angular_core.Signal<string>;
|
|
1696
|
+
protected readonly resolvedLabel: _angular_core.Signal<string>;
|
|
1408
1697
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTrend, never>;
|
|
1409
1698
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTrend, "cngx-trend", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1410
1699
|
}
|
|
1411
1700
|
|
|
1701
|
+
/**
|
|
1702
|
+
* Pure, framework-agnostic helpers that turn a signed delta value into the
|
|
1703
|
+
* three orthogonal signals a KPI atom renders: **direction** (which way the
|
|
1704
|
+
* arrow points), **sentiment** (whether the change is good or bad, which
|
|
1705
|
+
* drives colour and the SR word), and the formatted magnitude.
|
|
1706
|
+
*
|
|
1707
|
+
* Direction and sentiment are deliberately separate. `CngxTrend` colours by
|
|
1708
|
+
* direction (up = green); `CngxDelta` colours by sentiment, so a value that
|
|
1709
|
+
* dropped can still read as an improvement (churn down, latency down). Both
|
|
1710
|
+
* consume these helpers so the direction / glyph / format logic has a single
|
|
1711
|
+
* source of truth (Pillar 1) with no Angular dependency.
|
|
1712
|
+
*/
|
|
1713
|
+
/** Which way the delta moved. `flat` is exactly zero. */
|
|
1714
|
+
type DeltaDirection = 'up' | 'down' | 'flat';
|
|
1715
|
+
/**
|
|
1716
|
+
* How to read the sign of a delta. `neutral` disables sentiment entirely
|
|
1717
|
+
* (direction still renders, colour stays neutral).
|
|
1718
|
+
*/
|
|
1719
|
+
type DeltaPolarity = 'higher-is-better' | 'lower-is-better' | 'neutral';
|
|
1720
|
+
/** Good / bad / indifferent, derived from `direction × polarity`. */
|
|
1721
|
+
type DeltaSentiment = 'positive' | 'negative' | 'neutral';
|
|
1722
|
+
/** Percent (default, one fraction digit + `%`) or a locale-formatted absolute number. */
|
|
1723
|
+
type DeltaMode = 'percent' | 'absolute';
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* Sentiment-aware delta indicator. Where `CngxTrend` colours strictly by
|
|
1727
|
+
* direction (up = green), `CngxDelta` colours by **sentiment**: a `polarity`
|
|
1728
|
+
* of `lower-is-better` makes a drop read as an improvement (churn, latency,
|
|
1729
|
+
* error rate). The arrow glyph always tracks the raw direction, so colour is
|
|
1730
|
+
* never the only signal - a green value can carry a down arrow, and the SR
|
|
1731
|
+
* label speaks the sentiment word.
|
|
1732
|
+
*
|
|
1733
|
+
* Sentiment, direction, glyph and the formatted magnitude are each a
|
|
1734
|
+
* `computed()` off the single `value`/`polarity` input pair (Pillar 1); the
|
|
1735
|
+
* colour class and the arrow are bound from independent signals so they can
|
|
1736
|
+
* diverge (Pillar 2).
|
|
1737
|
+
*
|
|
1738
|
+
* ### Basic (higher-is-better default)
|
|
1739
|
+
* ```html
|
|
1740
|
+
* <cngx-delta [value]="5.3" />
|
|
1741
|
+
* ```
|
|
1742
|
+
*
|
|
1743
|
+
* ### Lower-is-better (a drop is good)
|
|
1744
|
+
* ```html
|
|
1745
|
+
* <cngx-delta [value]="-2.1" polarity="lower-is-better" />
|
|
1746
|
+
* ```
|
|
1747
|
+
*
|
|
1748
|
+
* ### Absolute magnitude
|
|
1749
|
+
* ```html
|
|
1750
|
+
* <cngx-delta [value]="1240" mode="absolute" [format]="{ maximumFractionDigits: 0 }" />
|
|
1751
|
+
* ```
|
|
1752
|
+
*
|
|
1753
|
+
* @category common/data/metric
|
|
1754
|
+
* @docsKind primary
|
|
1755
|
+
* @wcag AA
|
|
1756
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/delta/delta.component.ts
|
|
1757
|
+
* @since 0.1.0
|
|
1758
|
+
* @relatedTo CngxTrend, CngxMetric, CngxStat
|
|
1759
|
+
*
|
|
1760
|
+
* <example-url>http://localhost:4200/#/common/data/delta/sentiment-polarity</example-url>
|
|
1761
|
+
*/
|
|
1762
|
+
declare class CngxDelta {
|
|
1763
|
+
private readonly locale;
|
|
1764
|
+
/** Signed delta. Positive = up, negative = down, zero = flat. */
|
|
1765
|
+
readonly value: _angular_core.InputSignal<number>;
|
|
1766
|
+
/**
|
|
1767
|
+
* How to read the sign. `higher-is-better` (default) treats a rise as
|
|
1768
|
+
* positive; `lower-is-better` inverts it; `neutral` disables sentiment
|
|
1769
|
+
* (direction still renders, colour stays neutral).
|
|
1770
|
+
*/
|
|
1771
|
+
readonly polarity: _angular_core.InputSignal<DeltaPolarity>;
|
|
1772
|
+
/** `percent` (default, one fraction digit + `%`) or `absolute`. */
|
|
1773
|
+
readonly mode: _angular_core.InputSignal<DeltaMode>;
|
|
1774
|
+
/** `Intl.NumberFormatOptions` applied to the magnitude in either mode. */
|
|
1775
|
+
readonly format: _angular_core.InputSignal<Intl.NumberFormatOptions | undefined>;
|
|
1776
|
+
/** Consumer-provided SR label override. Replaces the generated default. */
|
|
1777
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
1778
|
+
/** @internal Raw movement, independent of polarity. Drives the glyph. */
|
|
1779
|
+
protected readonly direction: _angular_core.Signal<DeltaDirection>;
|
|
1780
|
+
/** @internal Good / bad / indifferent. Drives colour and the SR word. */
|
|
1781
|
+
protected readonly sentiment: _angular_core.Signal<DeltaSentiment>;
|
|
1782
|
+
/** @internal Arrow glyph bound from direction only. */
|
|
1783
|
+
protected readonly glyph: _angular_core.Signal<string>;
|
|
1784
|
+
/** @internal Formatted magnitude. */
|
|
1785
|
+
protected readonly formattedValue: _angular_core.Signal<string>;
|
|
1786
|
+
/** @internal Full SR label: magnitude plus the sentiment word. */
|
|
1787
|
+
protected readonly resolvedLabel: _angular_core.Signal<string>;
|
|
1788
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDelta, never>;
|
|
1789
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxDelta, "cngx-delta", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; "polarity": { "alias": "polarity"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
/** The four coordinated slots of a {@link CngxStat}, in reading order. */
|
|
1793
|
+
type CngxStatSlotKind = 'label' | 'value' | 'delta' | 'caption';
|
|
1794
|
+
/**
|
|
1795
|
+
* Slot-registration contract a `CngxStat` exposes to its projected slot
|
|
1796
|
+
* directives. Each slot registers its generated id on init and withdraws it
|
|
1797
|
+
* on destroy; the molecule derives the combined `aria-labelledby` from the
|
|
1798
|
+
* live registration set. Fronted by a DI token (not the concrete `CngxStat`
|
|
1799
|
+
* class) so the slots stay decompose-safe - the ejected skin talks to the
|
|
1800
|
+
* same token the library defines.
|
|
1801
|
+
*/
|
|
1802
|
+
interface CngxStatRegistry {
|
|
1803
|
+
/** Register (or replace) the id contributed by `kind`. */
|
|
1804
|
+
register(kind: CngxStatSlotKind, id: string): void;
|
|
1805
|
+
/** Withdraw the id contributed by `kind`. */
|
|
1806
|
+
unregister(kind: CngxStatSlotKind): void;
|
|
1807
|
+
}
|
|
1808
|
+
/** DI token carrying the {@link CngxStatRegistry} a `CngxStat` provides. */
|
|
1809
|
+
declare const CNGX_STAT: InjectionToken<CngxStatRegistry>;
|
|
1810
|
+
|
|
1811
|
+
/**
|
|
1812
|
+
* Coordination molecule for a KPI stat. Its sole reason to exist is the
|
|
1813
|
+
* screen-reader layer (Pillar 2): hand-assembling a heading, a `<cngx-metric>`
|
|
1814
|
+
* and a `<cngx-delta>` makes a screen reader announce three disconnected
|
|
1815
|
+
* fragments. `CngxStat` projects the label / value / delta / caption slots,
|
|
1816
|
+
* collects the id each slot registers, and derives one `aria-labelledby` that
|
|
1817
|
+
* reads the whole stat as a single accessible name in reading order.
|
|
1818
|
+
*
|
|
1819
|
+
* Composition, never a config bag (Pillar 3): the molecule owns only the id
|
|
1820
|
+
* coordination `computed()` graph; the visuals are whatever atoms the
|
|
1821
|
+
* consumer projects into the slots.
|
|
1822
|
+
*
|
|
1823
|
+
* ```html
|
|
1824
|
+
* <cngx-stat aria-live="polite">
|
|
1825
|
+
* <span cngxStatLabel>Revenue</span>
|
|
1826
|
+
* <cngx-metric cngxStatValue [value]="1.2" unit="M EUR" />
|
|
1827
|
+
* <cngx-delta cngxStatDelta [value]="5.3" />
|
|
1828
|
+
* <span cngxStatCaption>vs. last quarter</span>
|
|
1829
|
+
* </cngx-stat>
|
|
1830
|
+
* ```
|
|
1831
|
+
*
|
|
1832
|
+
* @category common/data/metric
|
|
1833
|
+
* @docsKind primary
|
|
1834
|
+
* @wcag AA
|
|
1835
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat.component.ts
|
|
1836
|
+
* @since 0.1.0
|
|
1837
|
+
* @relatedTo CngxMetric, CngxDelta, CngxTrend
|
|
1838
|
+
*
|
|
1839
|
+
* <example-url>http://localhost:4200/#/common/data/stat/composed-kpi</example-url>
|
|
1840
|
+
*/
|
|
1841
|
+
declare class CngxStat implements CngxStatRegistry {
|
|
1842
|
+
private readonly slots;
|
|
1843
|
+
/**
|
|
1844
|
+
* Politeness of the live region. `off` (default) for a static stat;
|
|
1845
|
+
* `polite` / `assertive` for a KPI whose value updates in place.
|
|
1846
|
+
*/
|
|
1847
|
+
readonly live: _angular_core.InputSignal<"off" | "polite" | "assertive">;
|
|
1848
|
+
/** {@inheritDoc CngxStatRegistry.register} */
|
|
1849
|
+
register(kind: CngxStatSlotKind, id: string): void;
|
|
1850
|
+
/** {@inheritDoc CngxStatRegistry.unregister} */
|
|
1851
|
+
unregister(kind: CngxStatSlotKind): void;
|
|
1852
|
+
/** @internal Present slot ids in reading order; structurally stable. */
|
|
1853
|
+
protected readonly orderedIds: _angular_core.Signal<string[]>;
|
|
1854
|
+
/** @internal Combined accessible name; `null` when no slot is present. */
|
|
1855
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
1856
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStat, never>;
|
|
1857
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxStat, "cngx-stat", never, { "live": { "alias": "live"; "required": false; "isSignal": true; }; }, {}, never, ["[cngxStatLabel]", "[cngxStatValue]", "[cngxStatDelta]", "[cngxStatCaption]"], true, never>;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Marks the label element of a {@link CngxStat}. Its generated id leads the
|
|
1862
|
+
* molecule's `aria-labelledby`.
|
|
1863
|
+
*
|
|
1864
|
+
* @category common/data/metric
|
|
1865
|
+
* @since 0.1.0
|
|
1866
|
+
* @relatedTo CngxStat
|
|
1867
|
+
*/
|
|
1868
|
+
declare class CngxStatLabel {
|
|
1869
|
+
/** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */
|
|
1870
|
+
readonly id: string;
|
|
1871
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStatLabel, never>;
|
|
1872
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxStatLabel, "[cngxStatLabel]", never, {}, {}, never, never, true, never>;
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Marks the primary value element of a {@link CngxStat} (typically a
|
|
1876
|
+
* `<cngx-metric>`).
|
|
1877
|
+
*
|
|
1878
|
+
* @category common/data/metric
|
|
1879
|
+
* @since 0.1.0
|
|
1880
|
+
* @relatedTo CngxStat
|
|
1881
|
+
*/
|
|
1882
|
+
declare class CngxStatValue {
|
|
1883
|
+
/** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */
|
|
1884
|
+
readonly id: string;
|
|
1885
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStatValue, never>;
|
|
1886
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxStatValue, "[cngxStatValue]", never, {}, {}, never, never, true, never>;
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Marks the delta element of a {@link CngxStat} (typically a `<cngx-delta>`
|
|
1890
|
+
* or `<cngx-trend>`).
|
|
1891
|
+
*
|
|
1892
|
+
* @category common/data/metric
|
|
1893
|
+
* @since 0.1.0
|
|
1894
|
+
* @relatedTo CngxStat
|
|
1895
|
+
*/
|
|
1896
|
+
declare class CngxStatDelta {
|
|
1897
|
+
/** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */
|
|
1898
|
+
readonly id: string;
|
|
1899
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStatDelta, never>;
|
|
1900
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxStatDelta, "[cngxStatDelta]", never, {}, {}, never, never, true, never>;
|
|
1901
|
+
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Marks the caption element of a {@link CngxStat} - the trailing context
|
|
1904
|
+
* line (e.g. "vs. last quarter").
|
|
1905
|
+
*
|
|
1906
|
+
* @category common/data/metric
|
|
1907
|
+
* @since 0.1.0
|
|
1908
|
+
* @relatedTo CngxStat
|
|
1909
|
+
*/
|
|
1910
|
+
declare class CngxStatCaption {
|
|
1911
|
+
/** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */
|
|
1912
|
+
readonly id: string;
|
|
1913
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStatCaption, never>;
|
|
1914
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxStatCaption, "[cngxStatCaption]", never, {}, {}, never, never, true, never>;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
/** Semantic health of a {@link CngxStatus}. */
|
|
1918
|
+
type StatusTone = 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
|
1919
|
+
/**
|
|
1920
|
+
* Semantic health indicator - a decorative tone dot paired with a visible
|
|
1921
|
+
* label. Distinct from `CngxBadge` (count overlay), `CngxChip` (interactive)
|
|
1922
|
+
* and `CngxTag` (labeled token): its single job is to communicate a status
|
|
1923
|
+
* (operational / degraded / down / info).
|
|
1924
|
+
*
|
|
1925
|
+
* Colour is never the only signal (Pillar 2): the tone drives the dot colour
|
|
1926
|
+
* *and* a tone glyph, so a colour-blind reader still distinguishes the states,
|
|
1927
|
+
* and the visible `label` carries the meaning for assistive tech (the dot is
|
|
1928
|
+
* `aria-hidden`). Set `live` for a status that changes in place.
|
|
1929
|
+
*
|
|
1930
|
+
* ### Basic
|
|
1931
|
+
* ```html
|
|
1932
|
+
* <cngx-status tone="success" label="Operational" />
|
|
1933
|
+
* ```
|
|
1934
|
+
*
|
|
1935
|
+
* ### Live-updating
|
|
1936
|
+
* ```html
|
|
1937
|
+
* <cngx-status tone="danger" label="Outage" live="assertive" />
|
|
1938
|
+
* ```
|
|
1939
|
+
*
|
|
1940
|
+
* @category common/data/metric
|
|
1941
|
+
* @docsKind primary
|
|
1942
|
+
* @wcag AA
|
|
1943
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/status/status.component.ts
|
|
1944
|
+
* @since 0.1.0
|
|
1945
|
+
* @relatedTo CngxBadge, CngxTag, CngxChip
|
|
1946
|
+
*
|
|
1947
|
+
* <example-url>http://localhost:4200/#/common/data/status/tone-matrix</example-url>
|
|
1948
|
+
*/
|
|
1949
|
+
declare class CngxStatus {
|
|
1950
|
+
private readonly elRef;
|
|
1951
|
+
/** Semantic health. Drives both the dot colour and the tone glyph. */
|
|
1952
|
+
readonly tone: _angular_core.InputSignal<StatusTone>;
|
|
1953
|
+
/** Visible status text. Carries the meaning for assistive tech. */
|
|
1954
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
1955
|
+
/**
|
|
1956
|
+
* Politeness of the live region. `off` (default) for a static status;
|
|
1957
|
+
* `polite` / `assertive` for a status that changes in place.
|
|
1958
|
+
*/
|
|
1959
|
+
readonly live: _angular_core.InputSignal<"off" | "polite" | "assertive">;
|
|
1960
|
+
/** @internal Tone glyph bound into the decorative dot. */
|
|
1961
|
+
protected readonly glyph: _angular_core.Signal<string>;
|
|
1962
|
+
constructor();
|
|
1963
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStatus, never>;
|
|
1964
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxStatus, "cngx-status", never, { "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "live": { "alias": "live"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* Determinate attainment bar - a continuous progress toward a target
|
|
1969
|
+
* (quota reached, budget spent, goal met). Named `CngxGoal` because
|
|
1970
|
+
* `cngx-progress` is the indeterminate async loading bar; this is the
|
|
1971
|
+
* finished-fraction indicator, distinct from that and from the discrete
|
|
1972
|
+
* `CngxSegmentedProgress`.
|
|
1973
|
+
*
|
|
1974
|
+
* Mirrors the `CngxSegmentedProgress` a11y shape: `role="progressbar"` with
|
|
1975
|
+
* the whole `aria-value*` set plus `aria-valuetext` living in the `computed()`
|
|
1976
|
+
* graph (Pillar 2). The value is clamped to `[0, max]`; the fill width is a
|
|
1977
|
+
* derived percent bound as a CSS custom property.
|
|
1978
|
+
*
|
|
1979
|
+
* ```html
|
|
1980
|
+
* <cngx-goal [value]="73" [max]="100" />
|
|
1981
|
+
* <cngx-goal [value]="q()" [max]="target()" [valueTextFormat]="quotaText" />
|
|
1982
|
+
* ```
|
|
1983
|
+
*
|
|
1984
|
+
* @category common/data/metric
|
|
1985
|
+
* @docsKind primary
|
|
1986
|
+
* @wcag AA
|
|
1987
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/goal/goal.component.ts
|
|
1988
|
+
* @since 0.1.0
|
|
1989
|
+
* @relatedTo CngxSegmentedProgress, CngxMetric
|
|
1990
|
+
*
|
|
1991
|
+
* <example-url>http://localhost:4200/#/common/data/goal/quota-attainment</example-url>
|
|
1992
|
+
*/
|
|
1993
|
+
declare class CngxGoal {
|
|
1994
|
+
/** Current attainment. Clamped to `[0, max]`. */
|
|
1995
|
+
readonly value: _angular_core.InputSignal<number>;
|
|
1996
|
+
/** Target the value works toward. Defaults to `100`. */
|
|
1997
|
+
readonly max: _angular_core.InputSignal<number>;
|
|
1998
|
+
/**
|
|
1999
|
+
* Override the `aria-valuetext` string. Receives `(now, max)` - the clamped
|
|
2000
|
+
* value and the target. The default is `(now, max) => \`${now} of ${max}\``.
|
|
2001
|
+
* Supply a localised closure for richer text (e.g.
|
|
2002
|
+
* `(n, m) => \`${n} of ${m}, ${Math.round((n / m) * 100)}% of quota\``).
|
|
2003
|
+
*/
|
|
2004
|
+
readonly valueTextFormat: _angular_core.InputSignal<((now: number, max: number) => string) | undefined>;
|
|
2005
|
+
/** `aria-valuemax` - the target, floored at 0. */
|
|
2006
|
+
protected readonly maxValue: Signal<number>;
|
|
2007
|
+
/** `aria-valuenow` - value clamped into `[0, max]`. */
|
|
2008
|
+
protected readonly now: Signal<number>;
|
|
2009
|
+
/** Fill width as a percent of the target; `0` when the target is `0`. */
|
|
2010
|
+
protected readonly fillPercent: Signal<number>;
|
|
2011
|
+
/** `aria-valuetext` - human-readable attainment via the resolved closure. */
|
|
2012
|
+
protected readonly valueText: Signal<string>;
|
|
2013
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxGoal, never>;
|
|
2014
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxGoal, "cngx-goal", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "valueTextFormat": { "alias": "valueTextFormat"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
1412
2017
|
/**
|
|
1413
2018
|
* I18n interface for recycler SR announcements.
|
|
1414
2019
|
* All methods return the announcement text. No hardcoded strings.
|
|
@@ -1468,8 +2073,13 @@ interface RecyclerConfig {
|
|
|
1468
2073
|
* not the server-side total. Otherwise the sentinel becomes unreachable.
|
|
1469
2074
|
*/
|
|
1470
2075
|
totalCount: () => number;
|
|
1471
|
-
/**
|
|
1472
|
-
|
|
2076
|
+
/**
|
|
2077
|
+
* Estimated height per item (px). A fixed `number`, a `Signal<number>` for a
|
|
2078
|
+
* reactive uniform estimate (e.g. an `input()` bound after construction), or a
|
|
2079
|
+
* `(index) => number` for genuine per-index variable heights. Only the last
|
|
2080
|
+
* form carries per-frame cost; a signal resolves to one uniform value.
|
|
2081
|
+
*/
|
|
2082
|
+
estimateSize: number | Signal<number> | ((index: number) => number);
|
|
1473
2083
|
/** Extra items to render above/below the viewport. Default: 5. */
|
|
1474
2084
|
overscan?: number;
|
|
1475
2085
|
/**
|
|
@@ -2093,5 +2703,5 @@ interface CngxMaterialBidirectionalSyncHandle {
|
|
|
2093
2703
|
*/
|
|
2094
2704
|
declare function createMaterialBidirectionalSync(opts: CngxMaterialBidirectionalSyncOptions): CngxMaterialBidirectionalSyncHandle;
|
|
2095
2705
|
|
|
2096
|
-
export { CNGX_BUCKET_PAGINATE_HOST, CNGX_COMMIT_CONTROLLER_FACTORY, CNGX_RECYCLER_I18N, CngxAsync, CngxBucketPaginate, CngxDataSource, CngxFilter, CngxFilterChip, CngxFilterChips, CngxMeasure, CngxMetric, CngxPaginate, CngxPaginateResetOn, CngxPaginateRouting, CngxRecyclerAnnouncer, CngxSmartDataSource, CngxSort, CngxSortHeader, CngxTrend, CngxVirtualItem, connectPaginateResetOn, connectRecyclerToActiveDescendant, connectRecyclerToRoving, createAsyncState, createCommitController, createManualState, createMaterialBidirectionalSync, fromHttpResource, fromResource, injectAsyncState, injectDataSource, injectRecycler, injectSmartDataSource, provideRecyclerI18n, resolveAsyncView, tapAsyncProgress, tapAsyncState, tapHttpAsyncState };
|
|
2097
|
-
export type { AsyncView, CngxAsyncContext, CngxBucket, CngxBucketPaginateHost, CngxBucketPaginateView, CngxCommitBeginHandlers, CngxCommitController, CngxCommitControllerFactory, CngxCommitHandle, CngxCommitRunner, CngxFilterChipContext, CngxMaterialBidirectionalSyncHandle, CngxMaterialBidirectionalSyncOptions, CngxRecycler, CngxSmartDataSourceOptions, InjectAsyncStateOptions, ManualAsyncState, MutableAsyncState, ReactiveAsyncState, RecyclerConfig, RecyclerI18n, SortEntry };
|
|
2706
|
+
export { CNGX_ASYNC_LABEL, CNGX_ASYNC_SKIP, CNGX_BUCKET_PAGINATE_HOST, CNGX_COMMIT_CONTROLLER_FACTORY, CNGX_RECYCLER_I18N, CNGX_STAT, CngxAsync, CngxAsyncRegistry, CngxBucketPaginate, CngxDataSource, CngxDelta, CngxFilter, CngxFilterChip, CngxFilterChips, CngxGoal, CngxMeasure, CngxMetric, CngxPaginate, CngxPaginateResetOn, CngxPaginateRouting, CngxRecyclerAnnouncer, CngxSmartDataSource, CngxSort, CngxSortHeader, CngxStat, CngxStatCaption, CngxStatDelta, CngxStatLabel, CngxStatValue, CngxStatus, CngxTrend, CngxVirtualItem, cngxAsyncInterceptor, connectPaginateEmit, connectPaginateResetOn, connectRecyclerToActiveDescendant, connectRecyclerToRoving, createAsyncState, createCommitController, createManualState, createMaterialBidirectionalSync, createSortHeaderState, fromHttpResource, fromResource, injectAsyncRegistry, injectAsyncState, injectDataSource, injectRecycler, injectSmartDataSource, provideAsyncHttpObservability, provideAsyncRegistry, provideRecyclerI18n, resolveAsyncView, tapAsyncProgress, tapAsyncState, tapHttpAsyncState, withAsyncLabel, withAsyncSkip };
|
|
2707
|
+
export type { AsyncView, CngxAsyncContext, CngxAsyncOperation, CngxBucket, CngxBucketPaginateHost, CngxBucketPaginateView, CngxCommitBeginHandlers, CngxCommitController, CngxCommitControllerFactory, CngxCommitHandle, CngxCommitRunner, CngxFilterChipContext, CngxMaterialBidirectionalSyncHandle, CngxMaterialBidirectionalSyncOptions, CngxPaginateEmitHandlers, CngxRecycler, CngxSmartDataSourceOptions, CngxStatRegistry, CngxStatSlotKind, DeltaMode, DeltaPolarity, InjectAsyncStateOptions, ManualAsyncState, MutableAsyncState, ReactiveAsyncState, RecyclerConfig, RecyclerI18n, SortEntry, SortHeaderState, StatusTone };
|