@cngx/common 0.1.0-rc.9 → 0.3.0
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/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +19 -8
- package/data/README.md +10 -10
- package/fesm2022/cngx-common-a11y.mjs +701 -263
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +83 -64
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-button.mjs +1084 -0
- package/fesm2022/cngx-common-button.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +135 -76
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +749 -296
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +51 -29
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +695 -405
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +112 -112
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +668 -308
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7066 -2739
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2121 -492
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-menu-button.mjs +557 -0
- package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1207 -569
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +256 -261
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +202 -262
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +28 -61
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +10 -10
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +30 -19
- package/layout/README.md +1 -1
- package/menu-button/README.md +234 -0
- package/package.json +14 -4
- package/popover/README.md +42 -5
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/ng-add/index.js +7 -7
- package/schematics/ng-add/schema.json +5 -0
- package/stepper/README.md +0 -1
- package/theming/components/cngx-accordion.css +36 -7
- package/theming/components/cngx-async.css +185 -37
- package/theming/components/cngx-backdrop.css +3 -1
- package/theming/components/cngx-badge.css +20 -5
- package/theming/components/cngx-bottom-sheet.css +2 -0
- package/theming/components/cngx-breadcrumb.css +3 -1
- package/theming/components/cngx-button-group.css +325 -0
- package/theming/components/cngx-button-toggle.css +55 -23
- package/theming/components/cngx-button.css +975 -0
- package/theming/components/cngx-data-grid.css +2 -0
- package/theming/components/cngx-dialog.css +3 -1
- package/theming/components/cngx-divider.css +24 -9
- package/theming/components/cngx-drawer.css +153 -0
- package/theming/components/cngx-icon-glyph.css +76 -0
- package/theming/components/cngx-listbox.css +79 -25
- package/theming/components/cngx-menu.css +112 -52
- package/theming/components/cngx-nav.css +1220 -0
- package/theming/components/cngx-popover-sheet.css +43 -11
- package/theming/components/cngx-popover.css +37 -13
- package/theming/components/cngx-recycler-placeholder.css +2 -0
- package/theming/components/cngx-ripple.css +74 -16
- package/theming/components/cngx-sidebar.css +71 -0
- package/theming/components/cngx-slider.css +3 -1
- package/theming/components/cngx-tooltip.css +2 -0
- package/timeline/README.md +2 -2
- package/types/cngx-common-a11y.d.ts +343 -120
- package/types/cngx-common-audio.d.ts +60 -88
- package/types/cngx-common-button.d.ts +698 -0
- package/types/cngx-common-card.d.ts +104 -78
- package/types/cngx-common-chart.d.ts +671 -384
- package/types/cngx-common-command.d.ts +44 -47
- package/types/cngx-common-data.d.ts +350 -342
- package/types/cngx-common-dialog.d.ts +91 -120
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4350 -1723
- package/types/cngx-common-layout.d.ts +1365 -286
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +671 -289
- package/types/cngx-common-stepper.d.ts +217 -347
- package/types/cngx-common-tabs.d.ts +173 -386
- package/types/cngx-common-timeline.d.ts +25 -104
|
@@ -12,8 +12,6 @@ import { CngxMessage } from '@cngx/core/i18n';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A single sort entry: the active field key and its direction.
|
|
15
|
-
*
|
|
16
|
-
* @category common/data/sort
|
|
17
15
|
*/
|
|
18
16
|
interface SortEntry {
|
|
19
17
|
active: string;
|
|
@@ -42,16 +40,15 @@ interface SortEntry {
|
|
|
42
40
|
* Consumer connects this to a table or list via a `computed()` - nothing is
|
|
43
41
|
* injected automatically.
|
|
44
42
|
*
|
|
45
|
-
* @category common/data/sort
|
|
46
|
-
* @docsKind primary
|
|
47
43
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/sort/sort.directive.ts
|
|
48
|
-
* @since 0.
|
|
44
|
+
* @since 0.3.0
|
|
49
45
|
* @relatedTo CngxSortHeader, CngxFilter, CngxPaginate, CngxSmartDataSource
|
|
50
46
|
*
|
|
51
|
-
* <example-url
|
|
52
|
-
* <example-url
|
|
53
|
-
* <example-url
|
|
54
|
-
* <example-url
|
|
47
|
+
* <example-url>/#/common/data/sort/basic</example-url>
|
|
48
|
+
* <example-url>/#/common/data/sort/multi-sort</example-url>
|
|
49
|
+
* <example-url>/#/common/data/sort/controlled</example-url>
|
|
50
|
+
* <example-url>/#/common/data/sort/aria-and-keyboard</example-url>
|
|
51
|
+
* @axis level atom
|
|
55
52
|
*/
|
|
56
53
|
declare class CngxSort {
|
|
57
54
|
/** Controlled active column. When bound, takes precedence over internal state (single-sort only). */
|
|
@@ -147,17 +144,15 @@ declare class CngxSort {
|
|
|
147
144
|
* </div>
|
|
148
145
|
* ```
|
|
149
146
|
*
|
|
150
|
-
* @category common/data/sort
|
|
151
|
-
* @docsKind primary
|
|
152
147
|
* @wcag AA
|
|
153
148
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/sort/sort-header.directive.ts
|
|
154
|
-
* @since 0.
|
|
149
|
+
* @since 0.3.0
|
|
155
150
|
* @relatedTo CngxSort, CngxFilter, CngxPaginate
|
|
156
151
|
*
|
|
157
|
-
* <example-url
|
|
158
|
-
* <example-url
|
|
159
|
-
* <example-url
|
|
160
|
-
* <example-url
|
|
152
|
+
* <example-url>/#/common/data/sort/basic</example-url>
|
|
153
|
+
* <example-url>/#/common/data/sort/multi-sort</example-url>
|
|
154
|
+
* <example-url>/#/common/data/sort/controlled</example-url>
|
|
155
|
+
* <example-url>/#/common/data/sort/aria-and-keyboard</example-url>
|
|
161
156
|
*/
|
|
162
157
|
declare class CngxSortHeader {
|
|
163
158
|
/** The field key this header cell represents. */
|
|
@@ -189,8 +184,6 @@ declare class CngxSortHeader {
|
|
|
189
184
|
*
|
|
190
185
|
* Pure derivation over a single {@link CngxSort} source plus an imperative
|
|
191
186
|
* `toggle`. No async state, no signal writes outside `toggle`.
|
|
192
|
-
*
|
|
193
|
-
* @category common/data/sort
|
|
194
187
|
*/
|
|
195
188
|
interface SortHeaderState {
|
|
196
189
|
/** The active sort entry for this column, or `undefined` when the column is not sorted. */
|
|
@@ -225,8 +218,7 @@ interface SortHeaderState {
|
|
|
225
218
|
* @param field Getter for the column's field key.
|
|
226
219
|
* @returns The derived `{ entry, isActive, isAsc, isDesc, priority, toggle }` bundle.
|
|
227
220
|
*
|
|
228
|
-
* @
|
|
229
|
-
* @since 0.1.0
|
|
221
|
+
* @since 0.3.0
|
|
230
222
|
* @relatedTo CngxSort, CngxSortHeader
|
|
231
223
|
*/
|
|
232
224
|
declare function createSortHeaderState(sort: () => CngxSort, field: () => string): SortHeaderState;
|
|
@@ -262,17 +254,15 @@ declare function createSortHeaderState(sort: () => CngxSort, field: () => string
|
|
|
262
254
|
*
|
|
263
255
|
* @typeParam T - The item type the predicate operates on.
|
|
264
256
|
*
|
|
265
|
-
* @category common/data/filter
|
|
266
|
-
* @docsKind primary
|
|
267
257
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter/filter.directive.ts
|
|
268
|
-
* @since 0.
|
|
258
|
+
* @since 0.3.0
|
|
269
259
|
* @relatedTo CngxFilterChips, CngxSort, CngxPaginate, CngxSmartDataSource
|
|
270
260
|
*
|
|
271
|
-
* <example-url
|
|
272
|
-
* <example-url
|
|
273
|
-
* <example-url
|
|
274
|
-
* <example-url
|
|
275
|
-
* <example-url
|
|
261
|
+
* <example-url>/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>
|
|
262
|
+
* <example-url>/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>
|
|
263
|
+
* <example-url>/#/common/data/smart-data-source/auto-wired</example-url>
|
|
264
|
+
* <example-url>/#/common/data/smart-data-source/how-it-works-hostdirectives-inject</example-url>
|
|
265
|
+
* <example-url>/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>
|
|
276
266
|
*/
|
|
277
267
|
declare class CngxFilter<T = unknown> {
|
|
278
268
|
/** Controlled predicate. When bound, takes precedence over the `'default'` internal predicate. */
|
|
@@ -332,8 +322,6 @@ declare class CngxFilter<T = unknown> {
|
|
|
332
322
|
* the consumer's component, NOT the bridge's inner
|
|
333
323
|
* `<cngx-multi-chip-group>`, so a consumer-supplied
|
|
334
324
|
* `cngxChipInGroup` would fail to resolve `CNGX_CHIP_GROUP_HOST`).
|
|
335
|
-
*
|
|
336
|
-
* @category common/data/filter
|
|
337
325
|
*/
|
|
338
326
|
interface CngxFilterChipContext<TItem = unknown, TValue = unknown> {
|
|
339
327
|
readonly $implicit: TItem;
|
|
@@ -348,13 +336,12 @@ interface CngxFilterChipContext<TItem = unknown, TValue = unknown> {
|
|
|
348
336
|
* wraps that decoration in `cngxChipInGroup`-bound chip wrappers
|
|
349
337
|
* automatically. Absence falls back to the default text-only label.
|
|
350
338
|
*
|
|
351
|
-
* @category common/data/filter
|
|
352
339
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter-chips/filter-chips.component.ts
|
|
353
|
-
* @since 0.
|
|
340
|
+
* @since 0.3.0
|
|
354
341
|
* @relatedTo CngxFilterChips, CngxFilter
|
|
355
342
|
*
|
|
356
|
-
* <example-url
|
|
357
|
-
* <example-url
|
|
343
|
+
* <example-url>/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>
|
|
344
|
+
* <example-url>/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>
|
|
358
345
|
*/
|
|
359
346
|
declare class CngxFilterChip<TItem = unknown, TValue = unknown> {
|
|
360
347
|
readonly template: TemplateRef<CngxFilterChipContext<TItem, TValue>>;
|
|
@@ -432,22 +419,44 @@ declare class CngxFilterChip<TItem = unknown, TValue = unknown> {
|
|
|
432
419
|
* </ng-container>
|
|
433
420
|
* ```
|
|
434
421
|
*
|
|
435
|
-
* @category common/data/filter
|
|
436
|
-
* @docsKind primary
|
|
437
422
|
* @wcag AA
|
|
438
423
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter-chips/filter-chips.component.ts
|
|
439
|
-
* @since 0.
|
|
424
|
+
* @since 0.3.0
|
|
440
425
|
* @relatedTo CngxFilter, CngxFilterChip, CngxMultiChipGroup
|
|
441
426
|
* @slot cngxFilterChip Renders one active filter chip; gets the filter entry and a remove callback.
|
|
442
427
|
*
|
|
443
|
-
* <example-url
|
|
444
|
-
* <example-url
|
|
428
|
+
* <example-url>/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>
|
|
429
|
+
* <example-url>/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>
|
|
430
|
+
* @axis level molecule
|
|
445
431
|
*/
|
|
446
432
|
declare class CngxFilterChips<TItem = unknown, TValue = unknown, TListItem = TItem> {
|
|
433
|
+
/**
|
|
434
|
+
* Name of the facet this strip filters. Renders as the visible, `aria-hidden`
|
|
435
|
+
* `.cngx-filter-chips__label` caption and is passed to the inner chip group
|
|
436
|
+
* as its accessible name.
|
|
437
|
+
*/
|
|
447
438
|
readonly label: _angular_core.InputSignal<string>;
|
|
439
|
+
/**
|
|
440
|
+
* Chip pool: one chip is rendered per item, in array order. A selected value
|
|
441
|
+
* whose option is no longer in the array is dropped from `selectedValues`.
|
|
442
|
+
*/
|
|
448
443
|
readonly options: _angular_core.InputSignal<readonly TItem[]>;
|
|
444
|
+
/**
|
|
445
|
+
* Maps an option to its chip text. It is the default chip body and the
|
|
446
|
+
* `label` field of the `cngxFilterChip` template context, which replaces the
|
|
447
|
+
* default body when projected.
|
|
448
|
+
*/
|
|
449
449
|
readonly optionLabel: _angular_core.InputSignal<(item: TItem) => string>;
|
|
450
|
+
/**
|
|
451
|
+
* Maps an option to the value that chip toggles into `selectedValues`. While
|
|
452
|
+
* `itemValue` is unbound it is also applied to the filtered list items to
|
|
453
|
+
* read the value the predicate compares against.
|
|
454
|
+
*/
|
|
450
455
|
readonly optionValue: _angular_core.InputSignal<(item: TItem) => TValue>;
|
|
456
|
+
/**
|
|
457
|
+
* The `CngxFilter` this strip registers its predicate on, under `filterKey`.
|
|
458
|
+
* Rebinding moves the registration to the new filter.
|
|
459
|
+
*/
|
|
451
460
|
readonly filterRef: _angular_core.InputSignal<CngxFilter<TListItem>>;
|
|
452
461
|
/**
|
|
453
462
|
* Extracts the comparable value from a filtered list item, when the list
|
|
@@ -458,7 +467,17 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown, TListItem = TIt
|
|
|
458
467
|
* which fits a list shaped like the options.
|
|
459
468
|
*/
|
|
460
469
|
readonly itemValue: _angular_core.InputSignal<((item: TListItem) => TValue | readonly TValue[]) | undefined>;
|
|
470
|
+
/**
|
|
471
|
+
* Key the predicate is registered under on `filterRef`. Rebinding moves the
|
|
472
|
+
* registration; teardown removes the key only while it still maps to this
|
|
473
|
+
* strip's own predicate.
|
|
474
|
+
*/
|
|
461
475
|
readonly filterKey: _angular_core.InputSignal<string>;
|
|
476
|
+
/**
|
|
477
|
+
* Async state forwarded to the inner chip group, which reflects `loading` as
|
|
478
|
+
* `aria-busy`. When unset, the group falls back to an ancestor
|
|
479
|
+
* `CNGX_STATEFUL` provider.
|
|
480
|
+
*/
|
|
462
481
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
463
482
|
/**
|
|
464
483
|
* Form-state surface forwarded transparently to the inner
|
|
@@ -468,9 +487,28 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown, TListItem = TIt
|
|
|
468
487
|
* / `CngxButtonToggleGroup` precedent.
|
|
469
488
|
*/
|
|
470
489
|
readonly disabled: _angular_core.ModelSignal<boolean>;
|
|
490
|
+
/**
|
|
491
|
+
* Two-way flag forwarded to the inner chip group, which sets
|
|
492
|
+
* `aria-required="true"` while it is true. Default `false`.
|
|
493
|
+
*/
|
|
471
494
|
readonly required: _angular_core.ModelSignal<boolean>;
|
|
495
|
+
/**
|
|
496
|
+
* Two-way flag forwarded to the inner chip group, which sets
|
|
497
|
+
* `aria-invalid="true"` while it is true or the group's own error state is
|
|
498
|
+
* active. Default `false`.
|
|
499
|
+
*/
|
|
472
500
|
readonly invalid: _angular_core.ModelSignal<boolean>;
|
|
501
|
+
/**
|
|
502
|
+
* Id of an external error element, forwarded to the inner chip group as
|
|
503
|
+
* `aria-errormessage`. The consumer renders the element. Default `null`
|
|
504
|
+
* omits the attribute.
|
|
505
|
+
*/
|
|
473
506
|
readonly errorMessageId: _angular_core.InputSignal<string | null>;
|
|
507
|
+
/**
|
|
508
|
+
* Layout and arrow-key axis of the strip. `'vertical'` stacks the chips and
|
|
509
|
+
* adds the `cngx-filter-chips--vertical` host class; the value is forwarded
|
|
510
|
+
* to the inner chip group's roving tabindex. Default `'horizontal'`.
|
|
511
|
+
*/
|
|
474
512
|
readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
|
|
475
513
|
/**
|
|
476
514
|
* Membership key extractor for object-valued chip values. When
|
|
@@ -541,17 +579,16 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown, TListItem = TIt
|
|
|
541
579
|
* [length]="pg.total()" [pageIndex]="pg.pageIndex()" [pageSize]="pg.pageSize()"
|
|
542
580
|
* (page)="pg.setPageSize($event.pageSize, false); pg.setPage($event.pageIndex)" />
|
|
543
581
|
* ```
|
|
544
|
-
* @category common/data/paginate
|
|
545
|
-
* @docsKind primary
|
|
546
582
|
* @wcag AA
|
|
547
583
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate.directive.ts
|
|
548
|
-
* @since 0.
|
|
584
|
+
* @since 0.3.0
|
|
549
585
|
* @relatedTo CngxSort, CngxFilter, CngxSmartDataSource
|
|
550
586
|
*
|
|
551
|
-
* <example-url
|
|
552
|
-
* <example-url
|
|
553
|
-
* <example-url
|
|
554
|
-
* <example-url
|
|
587
|
+
* <example-url>/#/common/data/data-source/datasource-cngxpaginate-manual-pipeline</example-url>
|
|
588
|
+
* <example-url>/#/common/data/paginate-list/paginated-list-cngxpaginate</example-url>
|
|
589
|
+
* <example-url>/#/common/data/paginate-list/uncontrolled-mode-zero-class-boilerplate</example-url>
|
|
590
|
+
* <example-url>/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>
|
|
591
|
+
* @axis level atom
|
|
555
592
|
*/
|
|
556
593
|
declare class CngxPaginate {
|
|
557
594
|
/** Controlled page index. When bound, takes precedence over internal state. */
|
|
@@ -646,8 +683,7 @@ declare class CngxPaginate {
|
|
|
646
683
|
* is byte-identical across all three. Call inside an injection context
|
|
647
684
|
* (constructor or field initialiser).
|
|
648
685
|
*
|
|
649
|
-
* @
|
|
650
|
-
* @since 0.1.0
|
|
686
|
+
* @since 0.3.0
|
|
651
687
|
*/
|
|
652
688
|
declare function connectPaginateResetOn(paginate: CngxPaginate, key: () => unknown): void;
|
|
653
689
|
/**
|
|
@@ -664,13 +700,11 @@ declare function connectPaginateResetOn(paginate: CngxPaginate, key: () => unkno
|
|
|
664
700
|
* ```html
|
|
665
701
|
* <table cngxPaginate [cngxPaginateResetOn]="filter()"><!-- ... --></table>
|
|
666
702
|
* ```
|
|
667
|
-
* <example-url
|
|
703
|
+
* <example-url>/#/ui/paginator/paginator-behaviors/reset-on-filter</example-url>
|
|
668
704
|
*
|
|
669
|
-
* @category common/data/paginate
|
|
670
|
-
* @docsKind primary
|
|
671
705
|
* @wcag AA
|
|
672
706
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate-reset.directive.ts
|
|
673
|
-
* @since 0.
|
|
707
|
+
* @since 0.3.0
|
|
674
708
|
* @relatedTo CngxPaginate, CngxPaginator, CngxMatPaginator
|
|
675
709
|
*/
|
|
676
710
|
declare class CngxPaginateResetOn {
|
|
@@ -686,8 +720,7 @@ declare class CngxPaginateResetOn {
|
|
|
686
720
|
* Handlers the two-way emit bridge forwards page changes to - typically a
|
|
687
721
|
* host component's `pageIndexChange` / `pageSizeChange` output emitters.
|
|
688
722
|
*
|
|
689
|
-
* @
|
|
690
|
-
* @since 0.1.0
|
|
723
|
+
* @since 0.3.0
|
|
691
724
|
*/
|
|
692
725
|
interface CngxPaginateEmitHandlers {
|
|
693
726
|
/** Called once per effective page-index change. */
|
|
@@ -718,8 +751,7 @@ interface CngxPaginateEmitHandlers {
|
|
|
718
751
|
* injection context (constructor or field initialiser) - it reads `DestroyRef`
|
|
719
752
|
* and creates effects.
|
|
720
753
|
*
|
|
721
|
-
* @
|
|
722
|
-
* @since 0.1.0
|
|
754
|
+
* @since 0.3.0
|
|
723
755
|
*/
|
|
724
756
|
declare function connectPaginateEmit(paginate: CngxPaginate, handlers: CngxPaginateEmitHandlers): void;
|
|
725
757
|
|
|
@@ -741,13 +773,12 @@ declare function connectPaginateEmit(paginate: CngxPaginate, handlers: CngxPagin
|
|
|
741
773
|
* inert no-op (a dev-mode warning is logged). Framework-agnostic of any UI - it
|
|
742
774
|
* needs only the brain and the router.
|
|
743
775
|
*
|
|
744
|
-
* @category common/data/paginate
|
|
745
|
-
* @docsKind primary
|
|
746
776
|
* @wcag AA
|
|
747
777
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate-routing.directive.ts
|
|
748
|
-
* @since 0.
|
|
778
|
+
* @since 0.3.0
|
|
749
779
|
* @relatedTo CngxPaginate, CngxPaginator, CngxMatPaginator
|
|
750
|
-
* <example-url
|
|
780
|
+
* <example-url>/#/ui/paginator/paginator-behaviors/url-synced-paging</example-url>
|
|
781
|
+
* @axis level organism
|
|
751
782
|
*/
|
|
752
783
|
declare class CngxPaginateRouting implements OnInit {
|
|
753
784
|
private readonly paginate;
|
|
@@ -773,9 +804,8 @@ declare class CngxPaginateRouting implements OnInit {
|
|
|
773
804
|
* presentation segment never needs it, only the label to render and the
|
|
774
805
|
* derived empty/active state to reflect.
|
|
775
806
|
*
|
|
776
|
-
* @category common/data/paginate
|
|
777
807
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts
|
|
778
|
-
* @since 0.
|
|
808
|
+
* @since 0.3.0
|
|
779
809
|
*/
|
|
780
810
|
interface CngxBucketPaginateView {
|
|
781
811
|
/** Human-readable bucket label, e.g. `'A-C'`. Rendered as the chip text. */
|
|
@@ -793,9 +823,8 @@ interface CngxBucketPaginateView {
|
|
|
793
823
|
* through the directive's `active` model so the toggle invariant (re-selecting
|
|
794
824
|
* the active bucket clears it) holds in one place.
|
|
795
825
|
*
|
|
796
|
-
* @category common/data/paginate
|
|
797
826
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts
|
|
798
|
-
* @since 0.
|
|
827
|
+
* @since 0.3.0
|
|
799
828
|
*/
|
|
800
829
|
interface CngxBucketPaginateHost {
|
|
801
830
|
/** The buckets to render, in declaration order. One chip per entry. */
|
|
@@ -822,10 +851,9 @@ interface CngxBucketPaginateHost {
|
|
|
822
851
|
* concrete directive class, keeping the strip decompose-ready and the model
|
|
823
852
|
* swappable.
|
|
824
853
|
*
|
|
825
|
-
* @category common/data/paginate
|
|
826
854
|
* @wcag AA
|
|
827
855
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts
|
|
828
|
-
* @since 0.
|
|
856
|
+
* @since 0.3.0
|
|
829
857
|
*/
|
|
830
858
|
declare const CNGX_BUCKET_PAGINATE_HOST: InjectionToken<CngxBucketPaginateHost>;
|
|
831
859
|
|
|
@@ -834,8 +862,6 @@ declare const CNGX_BUCKET_PAGINATE_HOST: InjectionToken<CngxBucketPaginateHost>;
|
|
|
834
862
|
* into it. The predicate keeps the model content-agnostic - the same directive
|
|
835
863
|
* buckets by letter range, date band, price tier, or any other partition the
|
|
836
864
|
* consumer expresses, without the brain knowing what it is bucketing.
|
|
837
|
-
*
|
|
838
|
-
* @category common/data/paginate
|
|
839
865
|
*/
|
|
840
866
|
interface CngxBucket<T> {
|
|
841
867
|
/** Human-readable bucket label, e.g. `'A-C'`. Rendered as the chip text. */
|
|
@@ -871,13 +897,12 @@ interface CngxBucket<T> {
|
|
|
871
897
|
* </div>
|
|
872
898
|
* ```
|
|
873
899
|
*
|
|
874
|
-
* @category common/data/paginate
|
|
875
|
-
* @docsKind primary
|
|
876
900
|
* @wcag AA
|
|
877
901
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate.directive.ts
|
|
878
|
-
* @since 0.
|
|
902
|
+
* @since 0.3.0
|
|
879
903
|
* @relatedTo CngxPaginate, CngxFilter
|
|
880
|
-
* <example-url
|
|
904
|
+
* <example-url>/#/ui/paginator/paginator-modes/alphabetical</example-url>
|
|
905
|
+
* @axis level organism
|
|
881
906
|
*/
|
|
882
907
|
declare class CngxBucketPaginate<T = unknown> implements CngxBucketPaginateHost {
|
|
883
908
|
/** The buckets to partition into, in render order. One chip per entry. */
|
|
@@ -928,17 +953,24 @@ declare class CngxBucketPaginate<T = unknown> implements CngxBucketPaginateHost
|
|
|
928
953
|
*
|
|
929
954
|
* @typeParam T - The row item type.
|
|
930
955
|
*
|
|
931
|
-
* @category common/data/data-source
|
|
932
|
-
* @docsKind primary
|
|
933
956
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/data-source.ts
|
|
934
|
-
* @since 0.
|
|
957
|
+
* @since 0.3.0
|
|
935
958
|
* @relatedTo CngxSmartDataSource, CngxSort, CngxFilter, CngxPaginate
|
|
936
959
|
*/
|
|
937
960
|
declare class CngxDataSource<T> extends DataSource<T> {
|
|
938
961
|
private readonly data;
|
|
939
962
|
private readonly injector;
|
|
940
963
|
constructor(data: Signal<T[]>);
|
|
964
|
+
/**
|
|
965
|
+
* CDK `DataSource` contract, called by the CDK table when it attaches. Returns
|
|
966
|
+
* an observable of the source signal that emits the array each time the
|
|
967
|
+
* signal changes.
|
|
968
|
+
*/
|
|
941
969
|
connect(): Observable<T[]>;
|
|
970
|
+
/**
|
|
971
|
+
* CDK `DataSource` contract, called by the CDK table when it detaches. No-op;
|
|
972
|
+
* the `toObservable` subscription ends with the injector's `DestroyRef`.
|
|
973
|
+
*/
|
|
942
974
|
disconnect(): void;
|
|
943
975
|
}
|
|
944
976
|
/**
|
|
@@ -949,15 +981,11 @@ declare class CngxDataSource<T> extends DataSource<T> {
|
|
|
949
981
|
* ```typescript
|
|
950
982
|
* readonly dataSource = injectDataSource(this.items);
|
|
951
983
|
* ```
|
|
952
|
-
*
|
|
953
|
-
* @category common/data/data-source
|
|
954
984
|
*/
|
|
955
985
|
declare function injectDataSource<T>(data: Signal<T[]>): CngxDataSource<T>;
|
|
956
986
|
|
|
957
987
|
/**
|
|
958
988
|
* Optional customization for {@link CngxSmartDataSource}.
|
|
959
|
-
*
|
|
960
|
-
* @category common/data/data-source
|
|
961
989
|
*/
|
|
962
990
|
interface CngxSmartDataSourceOptions<T> {
|
|
963
991
|
/**
|
|
@@ -1031,11 +1059,13 @@ interface CngxSmartDataSourceOptions<T> {
|
|
|
1031
1059
|
*
|
|
1032
1060
|
* @typeParam T - The row item type.
|
|
1033
1061
|
*
|
|
1034
|
-
* @category common/data/data-source
|
|
1035
|
-
* @docsKind primary
|
|
1036
1062
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/smart-data-source.ts
|
|
1037
|
-
* @since 0.
|
|
1063
|
+
* @since 0.3.0
|
|
1038
1064
|
* @relatedTo CngxDataSource, CngxSort, CngxFilter, CngxPaginate
|
|
1065
|
+
* <example-url>/#/common/data/smart-data-source/auto-wired</example-url>
|
|
1066
|
+
* <example-url>/#/common/data/smart-data-source/how-it-works-hostdirectives-inject</example-url>
|
|
1067
|
+
* <example-url>/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>
|
|
1068
|
+
* <example-url>/#/ui/data-grid-accordion/smart-data-source-options-sort</example-url>
|
|
1039
1069
|
*/
|
|
1040
1070
|
declare class CngxSmartDataSource<T> extends DataSource<T> {
|
|
1041
1071
|
private readonly options?;
|
|
@@ -1073,7 +1103,16 @@ declare class CngxSmartDataSource<T> extends DataSource<T> {
|
|
|
1073
1103
|
/** `true` when data is empty AND no operation is running. */
|
|
1074
1104
|
readonly isEmpty: Signal<boolean>;
|
|
1075
1105
|
constructor(source: Signal<T[]> | CngxAsyncState<T[]>, options?: CngxSmartDataSourceOptions<T> | undefined);
|
|
1106
|
+
/**
|
|
1107
|
+
* CDK `DataSource` contract, called by the CDK table when it attaches. Returns
|
|
1108
|
+
* an observable of `processed` (filtered, searched, sorted and paginated rows)
|
|
1109
|
+
* that emits each time it changes.
|
|
1110
|
+
*/
|
|
1076
1111
|
connect(): Observable<T[]>;
|
|
1112
|
+
/**
|
|
1113
|
+
* CDK `DataSource` contract, called by the CDK table when it detaches. No-op;
|
|
1114
|
+
* the `toObservable` subscription ends with the injector's `DestroyRef`.
|
|
1115
|
+
*/
|
|
1077
1116
|
disconnect(): void;
|
|
1078
1117
|
}
|
|
1079
1118
|
/**
|
|
@@ -1091,8 +1130,7 @@ declare class CngxSmartDataSource<T> extends DataSource<T> {
|
|
|
1091
1130
|
* readonly residents = injectAsyncState(() => this.api.getAll());
|
|
1092
1131
|
* readonly dataSource = injectSmartDataSource(this.residents);
|
|
1093
1132
|
* ```
|
|
1094
|
-
*
|
|
1095
|
-
* @category common/data/data-source
|
|
1133
|
+
* <example-url>/#/ui/data-grid-accordion/smart-data-source-options-sort</example-url>
|
|
1096
1134
|
*/
|
|
1097
1135
|
declare function injectSmartDataSource<T>(source: Signal<T[]> | CngxAsyncState<T[]>, options?: CngxSmartDataSourceOptions<T>): CngxSmartDataSource<T>;
|
|
1098
1136
|
|
|
@@ -1101,8 +1139,6 @@ declare function injectSmartDataSource<T>(source: Signal<T[]> | CngxAsyncState<T
|
|
|
1101
1139
|
*
|
|
1102
1140
|
* Returned by `createManualState()` - provides imperative setters
|
|
1103
1141
|
* while the read-side stays the standard `CngxAsyncState` interface.
|
|
1104
|
-
*
|
|
1105
|
-
* @category common/data/async-state
|
|
1106
1142
|
*/
|
|
1107
1143
|
interface ManualAsyncState<T> extends CngxAsyncState<T> {
|
|
1108
1144
|
/** Set the status directly. */
|
|
@@ -1123,7 +1159,10 @@ interface ManualAsyncState<T> extends CngxAsyncState<T> {
|
|
|
1123
1159
|
setIdle(): void;
|
|
1124
1160
|
/** Set progress (0–100). */
|
|
1125
1161
|
setProgress(value: number | undefined): void;
|
|
1126
|
-
/**
|
|
1162
|
+
/**
|
|
1163
|
+
* Reset to `idle` and clear data, error, progress and `lastUpdated`.
|
|
1164
|
+
* `isFirstLoad()` reads `true` again.
|
|
1165
|
+
*/
|
|
1127
1166
|
reset(): void;
|
|
1128
1167
|
}
|
|
1129
1168
|
/**
|
|
@@ -1142,15 +1181,11 @@ interface ManualAsyncState<T> extends CngxAsyncState<T> {
|
|
|
1142
1181
|
* this.processState.setSuccess(result);
|
|
1143
1182
|
* }
|
|
1144
1183
|
* ```
|
|
1145
|
-
*
|
|
1146
|
-
* @category common/data/async-state
|
|
1147
1184
|
*/
|
|
1148
1185
|
declare function createManualState<T>(): ManualAsyncState<T>;
|
|
1149
1186
|
|
|
1150
1187
|
/**
|
|
1151
1188
|
* Configuration options for `createAsyncState`.
|
|
1152
|
-
*
|
|
1153
|
-
* @category common/data/async-state
|
|
1154
1189
|
*/
|
|
1155
1190
|
interface CreateAsyncStateOptions {
|
|
1156
1191
|
/**
|
|
@@ -1171,16 +1206,18 @@ interface CreateAsyncStateOptions {
|
|
|
1171
1206
|
*
|
|
1172
1207
|
* Extends the read-only `CngxAsyncState` with an `execute()` method
|
|
1173
1208
|
* that runs an async action and manages the full lifecycle.
|
|
1174
|
-
*
|
|
1175
|
-
* @category common/data/async-state
|
|
1176
1209
|
*/
|
|
1177
1210
|
interface MutableAsyncState<T> extends CngxAsyncState<T> {
|
|
1178
1211
|
/**
|
|
1179
1212
|
* Execute an async action.
|
|
1180
1213
|
*
|
|
1181
|
-
* Sets status to `pending`, then `success` or `error` on completion.
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1214
|
+
* Sets status to `pending`, then `success` or `error` on completion. An
|
|
1215
|
+
* Observable that completes without a value settles `success` with
|
|
1216
|
+
* `undefined` data. Supersedes any in-flight execution. An Observable action is unsubscribed
|
|
1217
|
+
* on supersede, `reset()` and destroy, so an `HttpClient` request is
|
|
1218
|
+
* cancelled; a Promise action keeps running and its result is dropped. The
|
|
1219
|
+
* returned promise resolves when the run settles or is cancelled. After the
|
|
1220
|
+
* owner is destroyed, `execute()` resolves at once without calling `fn`.
|
|
1184
1221
|
*/
|
|
1185
1222
|
execute(fn: () => Promise<T> | Observable<T>): Promise<void>;
|
|
1186
1223
|
/** Report progress (0–100) during execution. */
|
|
@@ -1203,8 +1240,6 @@ interface MutableAsyncState<T> extends CngxAsyncState<T> {
|
|
|
1203
1240
|
* );
|
|
1204
1241
|
* }
|
|
1205
1242
|
* ```
|
|
1206
|
-
*
|
|
1207
|
-
* @category common/data/async-state
|
|
1208
1243
|
*/
|
|
1209
1244
|
declare function createAsyncState<T>(options?: CreateAsyncStateOptions): MutableAsyncState<T>;
|
|
1210
1245
|
|
|
@@ -1222,7 +1257,10 @@ declare function createAsyncState<T>(options?: CreateAsyncStateOptions): Mutable
|
|
|
1222
1257
|
* source on each access, so bridges observe transitions of whatever is bound
|
|
1223
1258
|
* right now. With nothing bound it reports a quiet `idle` state rather than
|
|
1224
1259
|
* throwing, which is what lets a bridge sit inside a timeline that has not
|
|
1225
|
-
* been given a state yet
|
|
1260
|
+
* been given a state yet: `status()` is `idle`, `isFirstLoad()` and
|
|
1261
|
+
* `isEmpty()` are true, which `resolveAsyncView` maps to `none`. Note the
|
|
1262
|
+
* difference to `buildAsyncStateView`, which defaults `isFirstLoad` to false
|
|
1263
|
+
* when a producer passes none.
|
|
1226
1264
|
*
|
|
1227
1265
|
* Contrast the select family, which provides `CNGX_STATEFUL` with
|
|
1228
1266
|
* `useFactory` over a concrete `commitState` field - no forwarding needed
|
|
@@ -1237,16 +1275,14 @@ declare function createAsyncState<T>(options?: CreateAsyncStateOptions): Mutable
|
|
|
1237
1275
|
* { provide: CNGX_STATEFUL, useFactory: () => ({ state: inject(Host).asyncState }) }
|
|
1238
1276
|
* ```
|
|
1239
1277
|
*
|
|
1240
|
-
* @category common/data/async-state
|
|
1241
1278
|
* @relatedTo createAsyncState, createManualState
|
|
1242
|
-
* @since 0.
|
|
1279
|
+
* @since 0.3.0
|
|
1280
|
+
* <example-url>/#/common/data/async-state/forwarded-state-through-an-input</example-url>
|
|
1243
1281
|
*/
|
|
1244
1282
|
declare function createForwardedAsyncState<T>(source: () => CngxAsyncState<T> | undefined): CngxAsyncState<T>;
|
|
1245
1283
|
|
|
1246
1284
|
/**
|
|
1247
1285
|
* Configuration options for `injectAsyncState`.
|
|
1248
|
-
*
|
|
1249
|
-
* @category common/data/async-state
|
|
1250
1286
|
*/
|
|
1251
1287
|
interface InjectAsyncStateOptions {
|
|
1252
1288
|
/**
|
|
@@ -1278,11 +1314,9 @@ interface InjectAsyncStateOptions {
|
|
|
1278
1314
|
*
|
|
1279
1315
|
* Extends the read-only `CngxAsyncState` with a `refresh()` method
|
|
1280
1316
|
* to explicitly re-trigger the query.
|
|
1281
|
-
*
|
|
1282
|
-
* @category common/data/async-state
|
|
1283
1317
|
*/
|
|
1284
1318
|
interface ReactiveAsyncState<T> extends CngxAsyncState<T> {
|
|
1285
|
-
/** Explicitly re-trigger the query. */
|
|
1319
|
+
/** Explicitly re-trigger the query. Does nothing after the owner is destroyed. */
|
|
1286
1320
|
refresh(): void;
|
|
1287
1321
|
}
|
|
1288
1322
|
/**
|
|
@@ -1298,17 +1332,15 @@ interface ReactiveAsyncState<T> extends CngxAsyncState<T> {
|
|
|
1298
1332
|
* );
|
|
1299
1333
|
* // Loads automatically when filter() changes.
|
|
1300
1334
|
* // Caches last result during refresh (refreshing state).
|
|
1301
|
-
* //
|
|
1335
|
+
* // A newer run cancels the one in flight (an Observable is unsubscribed,
|
|
1336
|
+
* // a Promise result is dropped). Of several changes inside the debounce
|
|
1337
|
+
* // window (50 ms by default) only the last result is consumed.
|
|
1302
1338
|
* ```
|
|
1303
|
-
*
|
|
1304
|
-
* @category common/data/async-state
|
|
1305
1339
|
*/
|
|
1306
1340
|
declare function injectAsyncState<T>(fn: () => Promise<T> | Observable<T>, options?: InjectAsyncStateOptions): ReactiveAsyncState<T>;
|
|
1307
1341
|
|
|
1308
1342
|
/**
|
|
1309
1343
|
* Possible view states for async content rendering.
|
|
1310
|
-
*
|
|
1311
|
-
* @category common/data/async-state
|
|
1312
1344
|
*/
|
|
1313
1345
|
type AsyncView = 'none' | 'skeleton' | 'content' | 'empty' | 'error' | 'content+error';
|
|
1314
1346
|
/**
|
|
@@ -1326,8 +1358,6 @@ type AsyncView = 'none' | 'skeleton' | 'content' | 'empty' | 'error' | 'content+
|
|
|
1326
1358
|
* | success | * | true | empty |
|
|
1327
1359
|
* | error | false | * | content+error |
|
|
1328
1360
|
* | (all other) | * | * | content |
|
|
1329
|
-
*
|
|
1330
|
-
* @category common/data/async-state
|
|
1331
1361
|
*/
|
|
1332
1362
|
declare function resolveAsyncView(status: AsyncStatus, firstLoad: boolean, empty: boolean): AsyncView;
|
|
1333
1363
|
|
|
@@ -1337,8 +1367,7 @@ declare function resolveAsyncView(status: AsyncStatus, firstLoad: boolean, empty
|
|
|
1337
1367
|
* The `key` (and optional `label`) travel with the state so per-source
|
|
1338
1368
|
* attribution never relies on a parallel index array (Pillar 1).
|
|
1339
1369
|
*
|
|
1340
|
-
* @
|
|
1341
|
-
* @since 0.1.0
|
|
1370
|
+
* @since 0.3.0
|
|
1342
1371
|
*/
|
|
1343
1372
|
interface AggregateSource<T = unknown> {
|
|
1344
1373
|
/** Stable identity for this source, used to key attribution and `@for`. */
|
|
@@ -1351,8 +1380,7 @@ interface AggregateSource<T = unknown> {
|
|
|
1351
1380
|
/**
|
|
1352
1381
|
* One errored source, surfaced by {@link CngxAsyncBoundary.failures}.
|
|
1353
1382
|
*
|
|
1354
|
-
* @
|
|
1355
|
-
* @since 0.1.0
|
|
1383
|
+
* @since 0.3.0
|
|
1356
1384
|
*/
|
|
1357
1385
|
interface AggregateFailure {
|
|
1358
1386
|
/** The failing source's key. */
|
|
@@ -1373,20 +1401,27 @@ interface AggregateFailure {
|
|
|
1373
1401
|
* `[state]` wiring. `failures` exposes the errored sources - keyed, so a
|
|
1374
1402
|
* consumer's `@for` can render per-source attribution through any feedback
|
|
1375
1403
|
* component. `state.error` stays the first error for the single-error path.
|
|
1404
|
+
* The errors are `unknown`; `messageOf` below is a component helper that
|
|
1405
|
+
* reads a `message` property, so an `HttpErrorResponse` does not print as
|
|
1406
|
+
* `[object Object]`.
|
|
1376
1407
|
*
|
|
1377
1408
|
* ```html
|
|
1378
|
-
* <div [cngxAsyncBoundary]="sources" #b="cngxAsyncBoundary"
|
|
1409
|
+
* <div [cngxAsyncBoundary]="sources" #b="cngxAsyncBoundary"
|
|
1410
|
+
* cngxToastOn [toastError]="'Loading failed'">
|
|
1379
1411
|
* <cngx-async-container [state]="b.state"> ... </cngx-async-container>
|
|
1380
|
-
* <cngx-toast-on />
|
|
1381
1412
|
* @for (f of b.failures(); track f.key) {
|
|
1382
|
-
* <cngx-
|
|
1413
|
+
* <cngx-alert severity="error" [title]="f.label ?? f.key">{{ messageOf(f.error) }}</cngx-alert>
|
|
1383
1414
|
* }
|
|
1384
1415
|
* </div>
|
|
1385
1416
|
* ```
|
|
1386
1417
|
*
|
|
1387
|
-
* @category common/data/async-state
|
|
1388
1418
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-state/async-boundary.directive.ts
|
|
1389
|
-
* @since 0.
|
|
1419
|
+
* @since 0.3.0
|
|
1420
|
+
* <example-url>/#/ui/feedback/async-container/async-boundary-bridges-aggregate-vs-per-source</example-url>
|
|
1421
|
+
* <example-url>/#/ui/feedback/async-container/async-boundary-per-source-errors-surface</example-url>
|
|
1422
|
+
* <example-url>/#/common/data/async-boundary/all-settled-renders-content</example-url>
|
|
1423
|
+
* <example-url>/#/common/data/async-boundary/any-loading-shows-skeleton</example-url>
|
|
1424
|
+
* @axis level molecule
|
|
1390
1425
|
*/
|
|
1391
1426
|
declare class CngxAsyncBoundary implements CngxStateful<readonly unknown[]> {
|
|
1392
1427
|
/** The keyed source list to aggregate. */
|
|
@@ -1403,17 +1438,19 @@ declare class CngxAsyncBoundary implements CngxStateful<readonly unknown[]> {
|
|
|
1403
1438
|
/**
|
|
1404
1439
|
* Bridge that projects an Angular `Resource<T>` onto `CngxAsyncState<T>`.
|
|
1405
1440
|
*
|
|
1406
|
-
* Must be called in an injection context
|
|
1407
|
-
* `hadSuccess` requires one).
|
|
1441
|
+
* Must be called in an injection context.
|
|
1408
1442
|
*
|
|
1409
1443
|
* All signals are derived reactively from the resource - no manual
|
|
1410
1444
|
* synchronization. The resource stays the single source of truth.
|
|
1411
1445
|
*
|
|
1446
|
+
* "First load" is per request: a failed reload keeps the last good value, a
|
|
1447
|
+
* params change or `idle` starts over with no data and `isFirstLoad()` true.
|
|
1448
|
+
*
|
|
1412
1449
|
* ```typescript
|
|
1413
1450
|
* private readonly res = resource({
|
|
1414
|
-
*
|
|
1415
|
-
* loader: ({
|
|
1416
|
-
* fetch(`/api/items?q=${
|
|
1451
|
+
* params: () => ({ filter: this.filter() }),
|
|
1452
|
+
* loader: ({ params, abortSignal }) =>
|
|
1453
|
+
* fetch(`/api/items?q=${params.filter}`, { signal: abortSignal })
|
|
1417
1454
|
* .then(r => r.json()),
|
|
1418
1455
|
* });
|
|
1419
1456
|
*
|
|
@@ -1421,8 +1458,6 @@ declare class CngxAsyncBoundary implements CngxStateful<readonly unknown[]> {
|
|
|
1421
1458
|
* // items.status(), items.data(), items.isFirstLoad() - all work
|
|
1422
1459
|
* // <cngx-async-container [state]="items"> - direct binding
|
|
1423
1460
|
* ```
|
|
1424
|
-
*
|
|
1425
|
-
* @category common/data/async-state
|
|
1426
1461
|
*/
|
|
1427
1462
|
declare function fromResource<T>(ref: Resource<T>): CngxAsyncState<T>;
|
|
1428
1463
|
|
|
@@ -1466,8 +1501,6 @@ interface HttpResourceLike<T> extends Resource<T> {
|
|
|
1466
1501
|
* // items.progress() tracks download progress 0-100
|
|
1467
1502
|
* // <cngx-progress [state]="items"> - auto-wired progress bar
|
|
1468
1503
|
* ```
|
|
1469
|
-
*
|
|
1470
|
-
* @category common/data/async-state
|
|
1471
1504
|
*/
|
|
1472
1505
|
declare function fromHttpResource<T>(ref: HttpResourceLike<T>): CngxAsyncState<T>;
|
|
1473
1506
|
|
|
@@ -1495,8 +1528,9 @@ interface AsyncStateSink<T> {
|
|
|
1495
1528
|
* read via the sink's `isFirstLoad`; an explicit `options.status` wins).
|
|
1496
1529
|
* On next: calls `setSuccess(value)`.
|
|
1497
1530
|
* On error: calls `setError(err)` and **re-throws** (does not swallow).
|
|
1498
|
-
* On
|
|
1499
|
-
* resets the sink to `idle` so a cancelled
|
|
1531
|
+
* On complete without a value: calls `setSuccess(undefined)`.
|
|
1532
|
+
* On unsubscribe before any value: resets the sink to `idle` so a cancelled
|
|
1533
|
+
* request never leaves it busy.
|
|
1500
1534
|
*
|
|
1501
1535
|
* The Observable passes through unchanged - `tapAsyncState` is a side-effect operator.
|
|
1502
1536
|
*
|
|
@@ -1510,8 +1544,6 @@ interface AsyncStateSink<T> {
|
|
|
1510
1544
|
* ).subscribe();
|
|
1511
1545
|
* }
|
|
1512
1546
|
* ```
|
|
1513
|
-
*
|
|
1514
|
-
* @category common/data/async-state
|
|
1515
1547
|
*/
|
|
1516
1548
|
declare function tapAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
1517
1549
|
status?: 'loading' | 'refreshing' | 'pending';
|
|
@@ -1520,7 +1552,8 @@ declare function tapAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
|
1520
1552
|
* RxJS operator that extracts upload/download progress from an
|
|
1521
1553
|
* `HttpEvent` stream and reports it to a `ManualAsyncState`.
|
|
1522
1554
|
*
|
|
1523
|
-
* Filters progress events, calculates percentage
|
|
1555
|
+
* Filters progress events, calculates an integer percentage clamped to
|
|
1556
|
+
* 0-100, calls `setProgress()`.
|
|
1524
1557
|
* Non-progress events pass through unchanged.
|
|
1525
1558
|
*
|
|
1526
1559
|
* Use with `{ observe: 'events', reportProgress: true }` on HttpClient.
|
|
@@ -1538,8 +1571,7 @@ declare function tapAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
|
1538
1571
|
* ).subscribe();
|
|
1539
1572
|
* }
|
|
1540
1573
|
* ```
|
|
1541
|
-
*
|
|
1542
|
-
* @category common/data/async-state
|
|
1574
|
+
* <example-url>/#/common/data/async-operators/tap-async-progress</example-url>
|
|
1543
1575
|
*/
|
|
1544
1576
|
declare function tapAsyncProgress<E>(state: Pick<AsyncStateSink<unknown>, 'setProgress'>): MonoTypeOperatorFunction<E>;
|
|
1545
1577
|
/**
|
|
@@ -1554,7 +1586,7 @@ declare function tapAsyncProgress<E>(state: Pick<AsyncStateSink<unknown>, 'setPr
|
|
|
1554
1586
|
* 5. Call `setError(err)` on error
|
|
1555
1587
|
*
|
|
1556
1588
|
* The output Observable emits the **response body** (not HttpEvents).
|
|
1557
|
-
* Throws a `CngxRuntimeError` with code `CNGX1054` if the response body is
|
|
1589
|
+
* Throws a `CngxRuntimeError` with code [`CNGX1054`](/error-codes/cngx1054.md) if the response body is
|
|
1558
1590
|
* `null`; the sink receives it through `setError(err)`.
|
|
1559
1591
|
*
|
|
1560
1592
|
* ```typescript
|
|
@@ -1571,8 +1603,7 @@ declare function tapAsyncProgress<E>(state: Pick<AsyncStateSink<unknown>, 'setPr
|
|
|
1571
1603
|
* // upload.status(), upload.progress(), upload.data() - all wired
|
|
1572
1604
|
* }
|
|
1573
1605
|
* ```
|
|
1574
|
-
*
|
|
1575
|
-
* @category common/data/async-state
|
|
1606
|
+
* <example-url>/#/common/data/async-operators/tap-http-async-state</example-url>
|
|
1576
1607
|
*/
|
|
1577
1608
|
declare function tapHttpAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
1578
1609
|
status?: 'loading' | 'refreshing' | 'pending';
|
|
@@ -1580,8 +1611,6 @@ declare function tapHttpAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
|
1580
1611
|
|
|
1581
1612
|
/**
|
|
1582
1613
|
* Read-only snapshot of one registered async operation.
|
|
1583
|
-
*
|
|
1584
|
-
* @category common/data/async-registry
|
|
1585
1614
|
*/
|
|
1586
1615
|
interface CngxAsyncOperation {
|
|
1587
1616
|
/** Per-operation uid minted at registration (`register`'s return value). */
|
|
@@ -1612,8 +1641,6 @@ interface CngxAsyncOperation {
|
|
|
1612
1641
|
* status reactivity flows through each entry's `CngxAsyncState` signals; the
|
|
1613
1642
|
* Map signal's `mapKeySetEqual` short-circuits register/unregister churn
|
|
1614
1643
|
* without hiding status changes.
|
|
1615
|
-
*
|
|
1616
|
-
* @category common/data/async-registry
|
|
1617
1644
|
*/
|
|
1618
1645
|
declare class CngxAsyncRegistry {
|
|
1619
1646
|
private readonly entriesState;
|
|
@@ -1649,16 +1676,13 @@ declare class CngxAsyncRegistry {
|
|
|
1649
1676
|
* providers: [provideAsyncRegistry()],
|
|
1650
1677
|
* });
|
|
1651
1678
|
* ```
|
|
1652
|
-
*
|
|
1653
|
-
* @category common/data/async-registry
|
|
1679
|
+
* <example-url>/#/common/data/async-registry/http-requests-in-the-registry</example-url>
|
|
1654
1680
|
*/
|
|
1655
1681
|
declare function provideAsyncRegistry(): EnvironmentProviders;
|
|
1656
1682
|
/**
|
|
1657
1683
|
* Returns the ambient {@link CngxAsyncRegistry}, or `null` when the consumer
|
|
1658
1684
|
* did not opt in via {@link provideAsyncRegistry}. Must run in an injection
|
|
1659
1685
|
* context.
|
|
1660
|
-
*
|
|
1661
|
-
* @category common/data/async-registry
|
|
1662
1686
|
*/
|
|
1663
1687
|
declare function injectAsyncRegistry(): CngxAsyncRegistry | null;
|
|
1664
1688
|
|
|
@@ -1679,9 +1703,8 @@ declare function injectAsyncRegistry(): CngxAsyncRegistry | null;
|
|
|
1679
1703
|
*
|
|
1680
1704
|
* @returns A probe over `CngxAsyncRegistry.isAnythingLoading`.
|
|
1681
1705
|
*
|
|
1682
|
-
* @category common/data/async-registry
|
|
1683
1706
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-registry/inject-latency-probe.ts
|
|
1684
|
-
* @since 0.
|
|
1707
|
+
* @since 0.3.0
|
|
1685
1708
|
* @relatedTo provideAsyncRegistry, injectAsyncRegistry, createLatencyProbe
|
|
1686
1709
|
*/
|
|
1687
1710
|
declare function injectLatencyProbe(): CngxLatencyProbe;
|
|
@@ -1689,16 +1712,12 @@ declare function injectLatencyProbe(): CngxLatencyProbe;
|
|
|
1689
1712
|
/**
|
|
1690
1713
|
* Per-request label surfaced in `CngxAsyncRegistry.activeOperations` when the
|
|
1691
1714
|
* request is tracked by `cngxAsyncInterceptor`. Display only, never a key.
|
|
1692
|
-
*
|
|
1693
|
-
* @category common/data/async-registry
|
|
1694
1715
|
*/
|
|
1695
1716
|
declare const CNGX_ASYNC_LABEL: HttpContextToken<string | undefined>;
|
|
1696
1717
|
/**
|
|
1697
1718
|
* Per-request opt-out. When `true`, `cngxAsyncInterceptor` passes the request
|
|
1698
1719
|
* through without registering it - keeps polling / telemetry pings out of the
|
|
1699
1720
|
* aggregate without a global allow-list.
|
|
1700
|
-
*
|
|
1701
|
-
* @category common/data/async-registry
|
|
1702
1721
|
*/
|
|
1703
1722
|
declare const CNGX_ASYNC_SKIP: HttpContextToken<boolean>;
|
|
1704
1723
|
/**
|
|
@@ -1708,8 +1727,7 @@ declare const CNGX_ASYNC_SKIP: HttpContextToken<boolean>;
|
|
|
1708
1727
|
* ```typescript
|
|
1709
1728
|
* this.http.get('/api/users', { context: withAsyncLabel('users') });
|
|
1710
1729
|
* ```
|
|
1711
|
-
*
|
|
1712
|
-
* @category common/data/async-registry
|
|
1730
|
+
* <example-url>/#/common/data/async-registry/label-and-skip-requests</example-url>
|
|
1713
1731
|
*/
|
|
1714
1732
|
declare function withAsyncLabel(label: string, context?: HttpContext): HttpContext;
|
|
1715
1733
|
/**
|
|
@@ -1719,8 +1737,7 @@ declare function withAsyncLabel(label: string, context?: HttpContext): HttpConte
|
|
|
1719
1737
|
* ```typescript
|
|
1720
1738
|
* this.http.get('/api/ping', { context: withAsyncSkip() });
|
|
1721
1739
|
* ```
|
|
1722
|
-
*
|
|
1723
|
-
* @category common/data/async-registry
|
|
1740
|
+
* <example-url>/#/common/data/async-registry/label-and-skip-requests</example-url>
|
|
1724
1741
|
*/
|
|
1725
1742
|
declare function withAsyncSkip(context?: HttpContext): HttpContext;
|
|
1726
1743
|
|
|
@@ -1734,17 +1751,17 @@ declare function withAsyncSkip(context?: HttpContext): HttpContext;
|
|
|
1734
1751
|
* request straight through when no registry is provided - zero behaviour
|
|
1735
1752
|
* change for consumers who do not opt in.
|
|
1736
1753
|
* - Passes through without registering when `CNGX_ASYNC_SKIP` is set.
|
|
1737
|
-
* - Otherwise registers a fresh `createManualState` (set `loading`)
|
|
1738
|
-
*
|
|
1739
|
-
* `unregister`s in a `finalize` that fires on success **and** error (and
|
|
1740
|
-
* unsubscribe)
|
|
1754
|
+
* - Otherwise registers a fresh `createManualState` (set `loading`) per
|
|
1755
|
+
* subscription, under its own uid, maps the final response / error onto it,
|
|
1756
|
+
* and `unregister`s in a `finalize` that fires on success **and** error (and
|
|
1757
|
+
* on unsubscribe). Every retry attempt is tracked for exactly its own
|
|
1758
|
+
* lifetime, and a request nobody subscribes to is never registered.
|
|
1741
1759
|
*
|
|
1742
1760
|
* Per-request uid identity (from `CngxAsyncRegistry`) means concurrent requests
|
|
1743
1761
|
* sharing a label never evict one another - completing one leaves the other
|
|
1744
1762
|
* tracked. The interceptor does not swallow errors: `setError` records the
|
|
1745
1763
|
* failure, then the error propagates to the caller unchanged.
|
|
1746
|
-
*
|
|
1747
|
-
* @category common/data/async-registry
|
|
1764
|
+
* <example-url>/#/common/data/async-registry/http-requests-in-the-registry</example-url>
|
|
1748
1765
|
*/
|
|
1749
1766
|
declare const cngxAsyncInterceptor: HttpInterceptorFn;
|
|
1750
1767
|
/**
|
|
@@ -1772,8 +1789,6 @@ declare const cngxAsyncInterceptor: HttpInterceptorFn;
|
|
|
1772
1789
|
* ```ts
|
|
1773
1790
|
* provideHttpClient(withFetch(), withInterceptors([authInterceptor, cngxAsyncInterceptor]))
|
|
1774
1791
|
* ```
|
|
1775
|
-
*
|
|
1776
|
-
* @category common/data/async-registry
|
|
1777
1792
|
*/
|
|
1778
1793
|
declare function provideAsyncHttpObservability(): EnvironmentProviders;
|
|
1779
1794
|
|
|
@@ -1781,7 +1796,10 @@ declare function provideAsyncHttpObservability(): EnvironmentProviders;
|
|
|
1781
1796
|
* Template context for the `*cngxAsync` content template.
|
|
1782
1797
|
* `$implicit` provides the data value, typed via `ngTemplateContextGuard`.
|
|
1783
1798
|
*
|
|
1784
|
-
*
|
|
1799
|
+
* Typed as `T` for template ergonomics, but the content view receives the
|
|
1800
|
+
* state's `data()` as is: a producer whose data goes `undefined` while it stays
|
|
1801
|
+
* in the content view (e.g. `refreshing` after a cleared value) passes
|
|
1802
|
+
* `undefined` through. Guard with `@if` / `?.` when the producer can do that.
|
|
1785
1803
|
*/
|
|
1786
1804
|
interface CngxAsyncContext<T> {
|
|
1787
1805
|
/** The data value - bound via `let data` in microsyntax. */
|
|
@@ -1803,6 +1821,14 @@ interface CngxAsyncContext<T> {
|
|
|
1803
1821
|
* directive renders exactly one template, so the error half is flattened
|
|
1804
1822
|
* away here; surface it separately (toast, alert) when it must be visible
|
|
1805
1823
|
*
|
|
1824
|
+
* ### Focus across a view switch
|
|
1825
|
+
* When a switch destroys the view that holds focus, focus moves to the first
|
|
1826
|
+
* focusable element (outside any `inert` subtree) of the next rendered view, so
|
|
1827
|
+
* a focused Retry button does not drop keyboard users onto `<body>`. One view
|
|
1828
|
+
* without a focusable element (a skeleton) is bridged; after that the hand-off
|
|
1829
|
+
* lapses. Focus that sits outside the directive, or that the user moved
|
|
1830
|
+
* elsewhere in the meantime, is never touched.
|
|
1831
|
+
*
|
|
1806
1832
|
* ### Minimal - just content
|
|
1807
1833
|
* ```html
|
|
1808
1834
|
* <ul *cngxAsync="residents; let data">
|
|
@@ -1829,23 +1855,24 @@ interface CngxAsyncContext<T> {
|
|
|
1829
1855
|
* </ng-template>
|
|
1830
1856
|
* ```
|
|
1831
1857
|
*
|
|
1832
|
-
* @category common/data/async-state
|
|
1833
|
-
* @docsKind primary
|
|
1834
1858
|
* @wcag AA
|
|
1835
1859
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async/async.directive.ts
|
|
1836
|
-
* @since 0.
|
|
1860
|
+
* @since 0.3.0
|
|
1837
1861
|
* @relatedTo injectAsyncState, createAsyncState, createManualState
|
|
1838
1862
|
*
|
|
1839
|
-
* <example-url
|
|
1840
|
-
* <example-url
|
|
1841
|
-
* <example-url
|
|
1842
|
-
* <example-url
|
|
1843
|
-
* <example-url
|
|
1844
|
-
* <example-url
|
|
1863
|
+
* <example-url>/#/ui/feedback/async-container/cngx-async-container-full-control-toast</example-url>
|
|
1864
|
+
* <example-url>/#/ui/feedback/async-container/cngxasync-one-line</example-url>
|
|
1865
|
+
* <example-url>/#/ui/feedback/async-container/cngxasync-with-custom-templates</example-url>
|
|
1866
|
+
* <example-url>/#/ui/feedback/async-container/composition-overlay-container-toast</example-url>
|
|
1867
|
+
* <example-url>/#/ui/feedback/async-container/createasyncstate-mutation</example-url>
|
|
1868
|
+
* <example-url>/#/ui/feedback/async-container/injectasyncstate-reactive-query</example-url>
|
|
1869
|
+
* @axis level molecule
|
|
1845
1870
|
*/
|
|
1846
1871
|
declare class CngxAsync<T> {
|
|
1847
1872
|
private readonly vcr;
|
|
1848
1873
|
private readonly contentTpl;
|
|
1874
|
+
private readonly doc;
|
|
1875
|
+
private readonly injector;
|
|
1849
1876
|
/** The async state to render. */
|
|
1850
1877
|
readonly cngxAsync: _angular_core.InputSignal<CngxAsyncState<T>>;
|
|
1851
1878
|
/** Optional skeleton template shown during first load. */
|
|
@@ -1857,9 +1884,16 @@ declare class CngxAsync<T> {
|
|
|
1857
1884
|
$implicit: unknown;
|
|
1858
1885
|
}> | undefined>;
|
|
1859
1886
|
private readonly view;
|
|
1887
|
+
private readonly slotTemplate;
|
|
1860
1888
|
private currentView;
|
|
1889
|
+
private currentTemplate;
|
|
1861
1890
|
private contentViewRef;
|
|
1891
|
+
private focusSwitchesLeft;
|
|
1862
1892
|
constructor();
|
|
1893
|
+
private renderedRoots;
|
|
1894
|
+
private renderedViewHoldsFocus;
|
|
1895
|
+
private restoreFocus;
|
|
1896
|
+
private firstFocusable;
|
|
1863
1897
|
private updateContentContext;
|
|
1864
1898
|
private renderView;
|
|
1865
1899
|
private renderTemplate;
|
|
@@ -1896,15 +1930,14 @@ declare class CngxAsync<T> {
|
|
|
1896
1930
|
* </cngx-card>
|
|
1897
1931
|
* ```
|
|
1898
1932
|
*
|
|
1899
|
-
* @category common/data/metric
|
|
1900
|
-
* @docsKind primary
|
|
1901
1933
|
* @wcag AA
|
|
1902
1934
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/metric/metric.component.ts
|
|
1903
|
-
* @since 0.
|
|
1935
|
+
* @since 0.3.0
|
|
1904
1936
|
* @relatedTo CngxTrend, CngxCard
|
|
1905
1937
|
*
|
|
1906
|
-
* <example-url
|
|
1907
|
-
* <example-url
|
|
1938
|
+
* <example-url>/#/common/data/metric/inside-a-card</example-url>
|
|
1939
|
+
* <example-url>/#/common/data/metric/standalone-metrics</example-url>
|
|
1940
|
+
* @axis level atom
|
|
1908
1941
|
*/
|
|
1909
1942
|
declare class CngxMetric {
|
|
1910
1943
|
private readonly locale;
|
|
@@ -1960,15 +1993,14 @@ declare class CngxMetric {
|
|
|
1960
1993
|
* </cngx-card>
|
|
1961
1994
|
* ```
|
|
1962
1995
|
*
|
|
1963
|
-
* @category common/data/metric
|
|
1964
|
-
* @docsKind primary
|
|
1965
1996
|
* @wcag AA
|
|
1966
1997
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/trend/trend.component.ts
|
|
1967
|
-
* @since 0.
|
|
1998
|
+
* @since 0.3.0
|
|
1968
1999
|
* @relatedTo CngxMetric, CngxCard
|
|
1969
2000
|
*
|
|
1970
|
-
* <example-url
|
|
1971
|
-
* <example-url
|
|
2001
|
+
* <example-url>/#/common/data/trend/composed-with-metric-in-a-card</example-url>
|
|
2002
|
+
* <example-url>/#/common/data/trend/trend-directions</example-url>
|
|
2003
|
+
* @axis level atom
|
|
1972
2004
|
*/
|
|
1973
2005
|
declare class CngxTrend {
|
|
1974
2006
|
private readonly locale;
|
|
@@ -2027,14 +2059,13 @@ type DeltaMode = 'percent' | 'absolute';
|
|
|
2027
2059
|
* <cngx-delta [value]="1240" mode="absolute" [format]="{ maximumFractionDigits: 0 }" />
|
|
2028
2060
|
* ```
|
|
2029
2061
|
*
|
|
2030
|
-
* @category common/data/metric
|
|
2031
|
-
* @docsKind primary
|
|
2032
2062
|
* @wcag AA
|
|
2033
2063
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/delta/delta.component.ts
|
|
2034
|
-
* @since 0.
|
|
2064
|
+
* @since 0.3.0
|
|
2035
2065
|
* @relatedTo CngxTrend, CngxMetric, CngxStat
|
|
2036
2066
|
*
|
|
2037
|
-
* <example-url
|
|
2067
|
+
* <example-url>/#/common/data/delta/sentiment-polarity</example-url>
|
|
2068
|
+
* @axis level atom
|
|
2038
2069
|
*/
|
|
2039
2070
|
declare class CngxDelta {
|
|
2040
2071
|
private readonly locale;
|
|
@@ -2081,8 +2112,7 @@ declare class CngxDelta {
|
|
|
2081
2112
|
* (`CNGX_LOCALE`); the per-instance `label` / `valueTextFormat` inputs still
|
|
2082
2113
|
* win over the bundle.
|
|
2083
2114
|
*
|
|
2084
|
-
* @
|
|
2085
|
-
* @since 0.1.0
|
|
2115
|
+
* @since 0.3.0
|
|
2086
2116
|
*/
|
|
2087
2117
|
interface CngxKpiI18n {
|
|
2088
2118
|
/** `CngxDelta` accessible name: formatted magnitude plus the sentiment word. */
|
|
@@ -2108,29 +2138,25 @@ interface CngxKpiI18n {
|
|
|
2108
2138
|
* app locale; the value is a `Signal`, shared by every reader under one
|
|
2109
2139
|
* injector.
|
|
2110
2140
|
*
|
|
2111
|
-
* @category common/data/i18n
|
|
2112
2141
|
* @wcag AA
|
|
2113
2142
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/shared/kpi-i18n.ts
|
|
2114
|
-
* @since 0.
|
|
2143
|
+
* @since 0.3.0
|
|
2115
2144
|
* @relatedTo CngxDelta, CngxTrend, CngxGoal
|
|
2116
2145
|
*/
|
|
2117
2146
|
declare const CNGX_KPI_I18N: InjectionToken<Signal<CngxKpiI18n>>;
|
|
2118
2147
|
/**
|
|
2119
|
-
*
|
|
2148
|
+
* A label override feature of `provideKpiI18n`.
|
|
2120
2149
|
*
|
|
2121
|
-
* @
|
|
2122
|
-
* @
|
|
2150
|
+
* @since 0.3.0
|
|
2151
|
+
* @relatedTo CNGX_KPI_I18N, withKpiI18nLabels
|
|
2123
2152
|
*/
|
|
2124
|
-
type CngxKpiI18nFeature = (
|
|
2125
|
-
readonly _target: 'i18n';
|
|
2126
|
-
};
|
|
2153
|
+
type CngxKpiI18nFeature = (bundle: Signal<CngxKpiI18n>) => Signal<CngxKpiI18n>;
|
|
2127
2154
|
/**
|
|
2128
2155
|
* Override KPI labels via a partial bundle - unset keys keep the language
|
|
2129
2156
|
* pack's copy, or the English default. Pass a `Signal` of a partial bundle to switch languages at
|
|
2130
2157
|
* runtime.
|
|
2131
2158
|
*
|
|
2132
|
-
* @
|
|
2133
|
-
* @since 0.1.0
|
|
2159
|
+
* @since 0.3.0
|
|
2134
2160
|
*/
|
|
2135
2161
|
declare function withKpiI18nLabels(overrides: Partial<CngxKpiI18n> | Signal<Partial<CngxKpiI18n>>): CngxKpiI18nFeature;
|
|
2136
2162
|
/**
|
|
@@ -2150,16 +2176,14 @@ declare function withKpiI18nLabels(overrides: Partial<CngxKpiI18n> | Signal<Part
|
|
|
2150
2176
|
* });
|
|
2151
2177
|
* ```
|
|
2152
2178
|
*
|
|
2153
|
-
* @
|
|
2154
|
-
* @since 0.1.0
|
|
2179
|
+
* @since 0.3.0
|
|
2155
2180
|
*/
|
|
2156
2181
|
declare function provideKpiI18n(...features: readonly CngxKpiI18nFeature[]): Provider;
|
|
2157
2182
|
/**
|
|
2158
2183
|
* Inject the resolved KPI i18n bundle signal. Read it inside a `computed()`
|
|
2159
2184
|
* or template so a runtime override flip re-derives.
|
|
2160
2185
|
*
|
|
2161
|
-
* @
|
|
2162
|
-
* @since 0.1.0
|
|
2186
|
+
* @since 0.3.0
|
|
2163
2187
|
*/
|
|
2164
2188
|
declare function injectKpiI18n(): Signal<CngxKpiI18n>;
|
|
2165
2189
|
|
|
@@ -2205,9 +2229,8 @@ declare const CNGX_STAT: InjectionToken<CngxStatRegistry>;
|
|
|
2205
2229
|
* Same shape as `CngxPaginate` behind `CNGX_PAGINATOR_HOST`, which
|
|
2206
2230
|
* `CngxPaginator` and `CngxIncrementalList` share the same way.
|
|
2207
2231
|
*
|
|
2208
|
-
* @category common/data/metric
|
|
2209
2232
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat-coordinator.directive.ts
|
|
2210
|
-
* @since 0.
|
|
2233
|
+
* @since 0.3.0
|
|
2211
2234
|
* @relatedTo CngxStat, CNGX_STAT
|
|
2212
2235
|
*/
|
|
2213
2236
|
declare class CngxStatCoordinator implements CngxStatRegistry {
|
|
@@ -2254,14 +2277,13 @@ declare class CngxStatCoordinator implements CngxStatRegistry {
|
|
|
2254
2277
|
* </cngx-stat>
|
|
2255
2278
|
* ```
|
|
2256
2279
|
*
|
|
2257
|
-
* @category common/data/metric
|
|
2258
|
-
* @docsKind primary
|
|
2259
2280
|
* @wcag AA
|
|
2260
2281
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat.component.ts
|
|
2261
|
-
* @since 0.
|
|
2282
|
+
* @since 0.3.0
|
|
2262
2283
|
* @relatedTo CngxMetric, CngxDelta, CngxTrend, CngxStatCoordinator
|
|
2263
2284
|
*
|
|
2264
|
-
* <example-url
|
|
2285
|
+
* <example-url>/#/common/data/stat/composed-kpi</example-url>
|
|
2286
|
+
* @axis level molecule
|
|
2265
2287
|
*/
|
|
2266
2288
|
declare class CngxStat {
|
|
2267
2289
|
/** @internal The shared slot-id brain, applied as a host directive. */
|
|
@@ -2279,8 +2301,7 @@ declare class CngxStat {
|
|
|
2279
2301
|
* Marks the label element of a {@link CngxStat}. Its generated id leads the
|
|
2280
2302
|
* molecule's `aria-labelledby`.
|
|
2281
2303
|
*
|
|
2282
|
-
* @
|
|
2283
|
-
* @since 0.1.0
|
|
2304
|
+
* @since 0.3.0
|
|
2284
2305
|
* @relatedTo CngxStat
|
|
2285
2306
|
*/
|
|
2286
2307
|
declare class CngxStatLabel {
|
|
@@ -2293,8 +2314,7 @@ declare class CngxStatLabel {
|
|
|
2293
2314
|
* Marks the primary value element of a {@link CngxStat} (typically a
|
|
2294
2315
|
* `<cngx-metric>`).
|
|
2295
2316
|
*
|
|
2296
|
-
* @
|
|
2297
|
-
* @since 0.1.0
|
|
2317
|
+
* @since 0.3.0
|
|
2298
2318
|
* @relatedTo CngxStat
|
|
2299
2319
|
*/
|
|
2300
2320
|
declare class CngxStatValue {
|
|
@@ -2307,8 +2327,7 @@ declare class CngxStatValue {
|
|
|
2307
2327
|
* Marks the delta element of a {@link CngxStat} (typically a `<cngx-delta>`
|
|
2308
2328
|
* or `<cngx-trend>`).
|
|
2309
2329
|
*
|
|
2310
|
-
* @
|
|
2311
|
-
* @since 0.1.0
|
|
2330
|
+
* @since 0.3.0
|
|
2312
2331
|
* @relatedTo CngxStat
|
|
2313
2332
|
*/
|
|
2314
2333
|
declare class CngxStatDelta {
|
|
@@ -2321,8 +2340,7 @@ declare class CngxStatDelta {
|
|
|
2321
2340
|
* Marks the caption element of a {@link CngxStat} - the trailing context
|
|
2322
2341
|
* line (e.g. "vs. last quarter").
|
|
2323
2342
|
*
|
|
2324
|
-
* @
|
|
2325
|
-
* @since 0.1.0
|
|
2343
|
+
* @since 0.3.0
|
|
2326
2344
|
* @relatedTo CngxStat
|
|
2327
2345
|
*/
|
|
2328
2346
|
declare class CngxStatCaption {
|
|
@@ -2349,14 +2367,13 @@ declare class CngxStatCaption {
|
|
|
2349
2367
|
* <cngx-goal [value]="q()" [max]="target()" [valueTextFormat]="quotaText" />
|
|
2350
2368
|
* ```
|
|
2351
2369
|
*
|
|
2352
|
-
* @category common/data/metric
|
|
2353
|
-
* @docsKind primary
|
|
2354
2370
|
* @wcag AA
|
|
2355
2371
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/goal/goal.component.ts
|
|
2356
|
-
* @since 0.
|
|
2372
|
+
* @since 0.3.0
|
|
2357
2373
|
* @relatedTo CngxSegmentedProgress, CngxMetric
|
|
2358
2374
|
*
|
|
2359
|
-
* <example-url
|
|
2375
|
+
* <example-url>/#/common/data/goal/quota-attainment</example-url>
|
|
2376
|
+
* @axis level atom
|
|
2360
2377
|
*/
|
|
2361
2378
|
declare class CngxGoal {
|
|
2362
2379
|
private readonly i18n;
|
|
@@ -2394,8 +2411,6 @@ declare class CngxGoal {
|
|
|
2394
2411
|
/**
|
|
2395
2412
|
* I18n interface for recycler SR announcements.
|
|
2396
2413
|
* All methods return the announcement text. No hardcoded strings.
|
|
2397
|
-
*
|
|
2398
|
-
* @category common/data/recycler
|
|
2399
2414
|
*/
|
|
2400
2415
|
interface RecyclerI18n {
|
|
2401
2416
|
/** Announced when new items are loaded (infinite scroll). */
|
|
@@ -2413,26 +2428,22 @@ interface RecyclerI18n {
|
|
|
2413
2428
|
* of the active language pack over English, counts formatted for the app
|
|
2414
2429
|
* locale. Override with `provideRecyclerI18n()`.
|
|
2415
2430
|
*
|
|
2416
|
-
* @category common/data/recycler
|
|
2417
2431
|
* @wcag AA
|
|
2418
2432
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler.ts
|
|
2419
|
-
* @since 0.
|
|
2433
|
+
* @since 0.3.0
|
|
2420
2434
|
*/
|
|
2421
2435
|
declare const CNGX_RECYCLER_I18N: InjectionToken<Signal<RecyclerI18n>>;
|
|
2422
2436
|
/**
|
|
2423
|
-
*
|
|
2437
|
+
* A label override feature of `provideRecyclerI18n`.
|
|
2424
2438
|
*
|
|
2425
|
-
* @
|
|
2439
|
+
* @since 0.3.0
|
|
2440
|
+
* @relatedTo CNGX_RECYCLER_I18N, withRecyclerI18nLabels
|
|
2426
2441
|
*/
|
|
2427
|
-
type CngxRecyclerI18nFeature = (
|
|
2428
|
-
readonly _target: 'i18n';
|
|
2429
|
-
};
|
|
2442
|
+
type CngxRecyclerI18nFeature = (bundle: Signal<RecyclerI18n>) => Signal<RecyclerI18n>;
|
|
2430
2443
|
/**
|
|
2431
2444
|
* Override recycler announcements via a partial bundle - keys you leave out
|
|
2432
2445
|
* keep the language pack's text, or the English default. Pass a `Signal` to
|
|
2433
2446
|
* switch the language at runtime.
|
|
2434
|
-
*
|
|
2435
|
-
* @category common/data/recycler
|
|
2436
2447
|
*/
|
|
2437
2448
|
declare function withRecyclerI18nLabels(overrides: Partial<RecyclerI18n> | Signal<Partial<RecyclerI18n>>): CngxRecyclerI18nFeature;
|
|
2438
2449
|
/**
|
|
@@ -2449,14 +2460,10 @@ declare function withRecyclerI18nLabels(overrides: Partial<RecyclerI18n> | Signa
|
|
|
2449
2460
|
* ),
|
|
2450
2461
|
* ]
|
|
2451
2462
|
* ```
|
|
2452
|
-
*
|
|
2453
|
-
* @category common/data/recycler
|
|
2454
2463
|
*/
|
|
2455
2464
|
declare function provideRecyclerI18n(...features: readonly CngxRecyclerI18nFeature[]): Provider;
|
|
2456
2465
|
/**
|
|
2457
2466
|
* Configuration for {@link injectRecycler}.
|
|
2458
|
-
*
|
|
2459
|
-
* @category common/data/recycler
|
|
2460
2467
|
*/
|
|
2461
2468
|
interface RecyclerConfig {
|
|
2462
2469
|
/** Scroll container. CSS selector, native element, or `ElementRef`. */
|
|
@@ -2487,11 +2494,17 @@ interface RecyclerConfig {
|
|
|
2487
2494
|
/** Debounce for scroll events in ms. Default: 16 (~1 frame). */
|
|
2488
2495
|
scrollDebounce?: number;
|
|
2489
2496
|
/**
|
|
2490
|
-
* Delay before skeletons are shown (ms).
|
|
2491
|
-
* E.g. 300 means `showSkeleton` only becomes `true`
|
|
2492
|
-
* fast loads (< 300ms) never show a skeleton.
|
|
2497
|
+
* Delay before skeletons are shown (ms). Overrides `CNGX_LOADING_CONFIG.showDelay`;
|
|
2498
|
+
* default is the config value. E.g. 300 means `showSkeleton` only becomes `true`
|
|
2499
|
+
* after 300ms - fast loads (< 300ms) never show a skeleton.
|
|
2493
2500
|
*/
|
|
2494
2501
|
skeletonDelay?: number;
|
|
2502
|
+
/**
|
|
2503
|
+
* Minimum time (ms) a shown skeleton stays. Overrides
|
|
2504
|
+
* `CNGX_LOADING_CONFIG.minDwell`; default is the config value. `0` swaps the
|
|
2505
|
+
* skeleton for the rows as soon as the first load ends.
|
|
2506
|
+
*/
|
|
2507
|
+
skeletonMinDwell?: number;
|
|
2495
2508
|
/**
|
|
2496
2509
|
* Async state source. When set, the recycler derives skeleton rendering,
|
|
2497
2510
|
* refresh state, and empty state from it - same convention as
|
|
@@ -2507,8 +2520,6 @@ interface RecyclerConfig {
|
|
|
2507
2520
|
/**
|
|
2508
2521
|
* Signal-based virtualizer returned by {@link injectRecycler}.
|
|
2509
2522
|
* All derived values are `computed()` - the system cannot become inconsistent.
|
|
2510
|
-
*
|
|
2511
|
-
* @category common/data/recycler
|
|
2512
2523
|
*/
|
|
2513
2524
|
interface CngxRecycler {
|
|
2514
2525
|
/** Start index (inclusive) of the rendered range, including overscan. */
|
|
@@ -2538,11 +2549,18 @@ interface CngxRecycler {
|
|
|
2538
2549
|
readonly isLoading: Signal<boolean>;
|
|
2539
2550
|
/** `true` during refresh (`state.isRefreshing()`). Data remains visible. */
|
|
2540
2551
|
readonly isRefreshing: Signal<boolean>;
|
|
2541
|
-
/**
|
|
2552
|
+
/**
|
|
2553
|
+
* `true` when `totalCount === 0` and not busy. Stays `false` while the
|
|
2554
|
+
* first-load skeleton is held (`showSkeleton`), so an empty first load shows
|
|
2555
|
+
* the skeleton to its dwell, never an empty-then-skeleton flicker.
|
|
2556
|
+
*/
|
|
2542
2557
|
readonly isEmpty: Signal<boolean>;
|
|
2543
2558
|
/** How many skeleton items fit in the viewport: `ceil(clientHeight / estimateSize)`. */
|
|
2544
2559
|
readonly skeletonSlots: Signal<number>;
|
|
2545
|
-
/**
|
|
2560
|
+
/**
|
|
2561
|
+
* `isLoading` after the show delay, held for at least `minDwell`. Prevents
|
|
2562
|
+
* skeleton flicker on fast loads and a jarring disappearance on slow ones.
|
|
2563
|
+
*/
|
|
2546
2564
|
readonly showSkeleton: Signal<boolean>;
|
|
2547
2565
|
/** First actually visible index (without overscan). For UI display. */
|
|
2548
2566
|
readonly firstVisible: Signal<number>;
|
|
@@ -2643,8 +2661,6 @@ interface CngxRecycler {
|
|
|
2643
2661
|
* state: this.state,
|
|
2644
2662
|
* });
|
|
2645
2663
|
* ```
|
|
2646
|
-
*
|
|
2647
|
-
* @category common/data/recycler
|
|
2648
2664
|
*/
|
|
2649
2665
|
declare function injectRecycler(config: RecyclerConfig): CngxRecycler;
|
|
2650
2666
|
|
|
@@ -2665,18 +2681,16 @@ declare function injectRecycler(config: RecyclerConfig): CngxRecycler;
|
|
|
2665
2681
|
* }
|
|
2666
2682
|
* ```
|
|
2667
2683
|
*
|
|
2668
|
-
* @category common/data/recycler
|
|
2669
|
-
* @docsKind primary
|
|
2670
2684
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/measure.directive.ts
|
|
2671
|
-
* @since 0.
|
|
2685
|
+
* @since 0.3.0
|
|
2672
2686
|
* @relatedTo CngxVirtualItem, CngxRecyclerAnnouncer, injectRecycler
|
|
2673
2687
|
*
|
|
2674
|
-
* <example-url
|
|
2675
|
-
* <example-url
|
|
2676
|
-
* <example-url
|
|
2677
|
-
* <example-url
|
|
2678
|
-
* <example-url
|
|
2679
|
-
* <example-url
|
|
2688
|
+
* <example-url>/#/common/data/recycler/basic-list-fixed-item-height</example-url>
|
|
2689
|
+
* <example-url>/#/common/data/recycler/content-visibility-css-only</example-url>
|
|
2690
|
+
* <example-url>/#/common/data/recycler/infinite-scroll-recycler</example-url>
|
|
2691
|
+
* <example-url>/#/common/data/recycler/scrolltoindex-deep-link</example-url>
|
|
2692
|
+
* <example-url>/#/common/data/recycler/variable-heights-cngxmeasure</example-url>
|
|
2693
|
+
* <example-url>/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>
|
|
2680
2694
|
*/
|
|
2681
2695
|
declare class CngxMeasure {
|
|
2682
2696
|
/** The recycler instance to report measurements to. */
|
|
@@ -2709,19 +2723,17 @@ declare class CngxMeasure {
|
|
|
2709
2723
|
* }
|
|
2710
2724
|
* ```
|
|
2711
2725
|
*
|
|
2712
|
-
* @category common/data/recycler
|
|
2713
|
-
* @docsKind primary
|
|
2714
2726
|
* @wcag AA
|
|
2715
2727
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/virtual-item.directive.ts
|
|
2716
|
-
* @since 0.
|
|
2728
|
+
* @since 0.3.0
|
|
2717
2729
|
* @relatedTo CngxMeasure, CngxRecyclerAnnouncer, injectRecycler
|
|
2718
2730
|
*
|
|
2719
|
-
* <example-url
|
|
2720
|
-
* <example-url
|
|
2721
|
-
* <example-url
|
|
2722
|
-
* <example-url
|
|
2723
|
-
* <example-url
|
|
2724
|
-
* <example-url
|
|
2731
|
+
* <example-url>/#/common/data/recycler/basic-list-fixed-item-height</example-url>
|
|
2732
|
+
* <example-url>/#/common/data/recycler/content-visibility-css-only</example-url>
|
|
2733
|
+
* <example-url>/#/common/data/recycler/infinite-scroll-recycler</example-url>
|
|
2734
|
+
* <example-url>/#/common/data/recycler/scrolltoindex-deep-link</example-url>
|
|
2735
|
+
* <example-url>/#/common/data/recycler/variable-heights-cngxmeasure</example-url>
|
|
2736
|
+
* <example-url>/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>
|
|
2725
2737
|
*/
|
|
2726
2738
|
declare class CngxVirtualItem {
|
|
2727
2739
|
/** The recycler instance providing `ariaSetSize`. */
|
|
@@ -2783,13 +2795,12 @@ declare class CngxVirtualItem {
|
|
|
2783
2795
|
* [style.height.px]="recycler.offsetBefore()"></div>
|
|
2784
2796
|
* ```
|
|
2785
2797
|
*
|
|
2786
|
-
* @category common/data/recycler
|
|
2787
|
-
* @docsKind primary
|
|
2788
2798
|
* @wcag AA
|
|
2789
2799
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-placeholder.directive.ts
|
|
2790
|
-
* @since 0.
|
|
2800
|
+
* @since 0.3.0
|
|
2791
2801
|
* @relatedTo injectRecycler, CngxRecyclerRow, CngxVirtualItem, CngxMeasure
|
|
2792
|
-
* <example-url
|
|
2802
|
+
* <example-url>/#/common/data/recycler/fast-fling-placeholders</example-url>
|
|
2803
|
+
* @axis level molecule
|
|
2793
2804
|
*/
|
|
2794
2805
|
declare class CngxRecyclerPlaceholder {
|
|
2795
2806
|
/**
|
|
@@ -2830,8 +2841,6 @@ declare class CngxRecyclerPlaceholder {
|
|
|
2830
2841
|
*
|
|
2831
2842
|
* The real-row branch (item defined) binds `$implicit` to the item value
|
|
2832
2843
|
* instead; that context is internal and narrowed by `ngTemplateContextGuard`.
|
|
2833
|
-
*
|
|
2834
|
-
* @category common/data/recycler
|
|
2835
2844
|
*/
|
|
2836
2845
|
interface CngxRecyclerRowContext {
|
|
2837
2846
|
/** The absolute dataset index of this slot. Alias of `index`. */
|
|
@@ -2853,15 +2862,11 @@ interface CngxRecyclerRowRealContext<T> {
|
|
|
2853
2862
|
* the cascade: microsyntax `placeholder:` template wins over this, and this wins
|
|
2854
2863
|
* over the built-in imperative `<li>` default. Defaults to `null` (imperative
|
|
2855
2864
|
* default applies).
|
|
2856
|
-
*
|
|
2857
|
-
* @category common/data/recycler
|
|
2858
2865
|
*/
|
|
2859
2866
|
declare const CNGX_RECYCLER_PLACEHOLDER_ROW: InjectionToken<TemplateRef<CngxRecyclerRowContext> | null>;
|
|
2860
2867
|
/**
|
|
2861
2868
|
* Provides an app-wide default placeholder template for every `*cngxRecyclerRow`
|
|
2862
2869
|
* that supplies no `placeholder:` template of its own.
|
|
2863
|
-
*
|
|
2864
|
-
* @category common/data/recycler
|
|
2865
2870
|
*/
|
|
2866
2871
|
declare function provideRecyclerPlaceholderRow(template: TemplateRef<CngxRecyclerRowContext>): Provider;
|
|
2867
2872
|
/**
|
|
@@ -2915,13 +2920,12 @@ declare function provideRecyclerPlaceholderRow(template: TemplateRef<CngxRecycle
|
|
|
2915
2920
|
* </ul>
|
|
2916
2921
|
* ```
|
|
2917
2922
|
*
|
|
2918
|
-
* @category common/data/recycler
|
|
2919
|
-
* @docsKind primary
|
|
2920
2923
|
* @wcag AA
|
|
2921
2924
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-row.directive.ts
|
|
2922
|
-
* @since 0.
|
|
2925
|
+
* @since 0.3.0
|
|
2923
2926
|
* @relatedTo injectRecycler, CngxRecyclerPlaceholder, CngxVirtualItem, CngxMeasure
|
|
2924
|
-
* <example-url
|
|
2927
|
+
* <example-url>/#/common/data/recycler/windowed-data-availability</example-url>
|
|
2928
|
+
* @axis level molecule
|
|
2925
2929
|
*/
|
|
2926
2930
|
declare class CngxRecyclerRow<T> {
|
|
2927
2931
|
private readonly vcr;
|
|
@@ -2968,19 +2972,17 @@ declare class CngxRecyclerRow<T> {
|
|
|
2968
2972
|
* <cngx-recycler-announcer [cngxRecyclerAnnouncer]="recycler" />
|
|
2969
2973
|
* ```
|
|
2970
2974
|
*
|
|
2971
|
-
* @category common/data/recycler
|
|
2972
|
-
* @docsKind primary
|
|
2973
2975
|
* @wcag AA
|
|
2974
2976
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-announcer.component.ts
|
|
2975
|
-
* @since 0.
|
|
2977
|
+
* @since 0.3.0
|
|
2976
2978
|
* @relatedTo CngxMeasure, CngxVirtualItem, injectRecycler, CNGX_RECYCLER_I18N
|
|
2977
2979
|
*
|
|
2978
|
-
* <example-url
|
|
2979
|
-
* <example-url
|
|
2980
|
-
* <example-url
|
|
2981
|
-
* <example-url
|
|
2982
|
-
* <example-url
|
|
2983
|
-
* <example-url
|
|
2980
|
+
* <example-url>/#/common/data/recycler/basic-list-fixed-item-height</example-url>
|
|
2981
|
+
* <example-url>/#/common/data/recycler/content-visibility-css-only</example-url>
|
|
2982
|
+
* <example-url>/#/common/data/recycler/infinite-scroll-recycler</example-url>
|
|
2983
|
+
* <example-url>/#/common/data/recycler/scrolltoindex-deep-link</example-url>
|
|
2984
|
+
* <example-url>/#/common/data/recycler/variable-heights-cngxmeasure</example-url>
|
|
2985
|
+
* <example-url>/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>
|
|
2984
2986
|
*/
|
|
2985
2987
|
declare class CngxRecyclerAnnouncer {
|
|
2986
2988
|
/** The recycler instance providing `announcement()`. */
|
|
@@ -3017,8 +3019,6 @@ declare class CngxRecyclerAnnouncer {
|
|
|
3017
3019
|
* }
|
|
3018
3020
|
* }
|
|
3019
3021
|
* ```
|
|
3020
|
-
*
|
|
3021
|
-
* @category common/data/recycler
|
|
3022
3022
|
*/
|
|
3023
3023
|
declare function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRovingTabindex): void;
|
|
3024
3024
|
|
|
@@ -3029,11 +3029,10 @@ declare function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRov
|
|
|
3029
3029
|
* When the AD directive navigates to an item whose index is not in the
|
|
3030
3030
|
* recycler's rendered range, it sets `pendingHighlight` (via the
|
|
3031
3031
|
* `virtualCount` path). This helper watches that signal and scrolls
|
|
3032
|
-
* the recycler to the target index; AD
|
|
3033
|
-
*
|
|
3034
|
-
*
|
|
3035
|
-
*
|
|
3036
|
-
* rendered range).
|
|
3032
|
+
* the recycler to the target index; AD clears the pending state on its
|
|
3033
|
+
* own once a re-render brings the target into the rendered range, and
|
|
3034
|
+
* does not raise it again when the window later moves away from an
|
|
3035
|
+
* unchanged highlight, so a scroll by the user is never pulled back.
|
|
3037
3036
|
*
|
|
3038
3037
|
* Unlike {@link /projects/common/data/src/recycler/connect-recycler-roving.ts
|
|
3039
3038
|
* connectRecyclerToRoving}, we don't re-focus a DOM element after the
|
|
@@ -3061,8 +3060,6 @@ declare function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRov
|
|
|
3061
3060
|
* }
|
|
3062
3061
|
* }
|
|
3063
3062
|
* ```
|
|
3064
|
-
*
|
|
3065
|
-
* @category common/data/recycler
|
|
3066
3063
|
*/
|
|
3067
3064
|
declare function connectRecyclerToActiveDescendant(recycler: CngxRecycler, ad: CngxActiveDescendant): void;
|
|
3068
3065
|
|
|
@@ -3072,8 +3069,6 @@ declare function connectRecyclerToActiveDescendant(recycler: CngxRecycler, ad: C
|
|
|
3072
3069
|
* when a newer commit supersedes it. Action runtimes (RxJS subscription
|
|
3073
3070
|
* teardown, AbortController abort, plain flag) implement the handle
|
|
3074
3071
|
* however they need.
|
|
3075
|
-
*
|
|
3076
|
-
* @category common/data/commit
|
|
3077
3072
|
*/
|
|
3078
3073
|
interface CngxCommitHandle {
|
|
3079
3074
|
readonly cancel: () => void;
|
|
@@ -3092,8 +3087,6 @@ interface CngxCommitHandle {
|
|
|
3092
3087
|
* `onRefused` is for an action that declined on purpose (a `false`
|
|
3093
3088
|
* answer): nothing changed, so the controller stores no error. A runner
|
|
3094
3089
|
* whose action shape has no refusal (the select family) never calls it.
|
|
3095
|
-
*
|
|
3096
|
-
* @category common/data/commit
|
|
3097
3090
|
*/
|
|
3098
3091
|
type CngxCommitRunner<T> = (handlers: {
|
|
3099
3092
|
readonly onSuccess: (committed: T | undefined) => void;
|
|
@@ -3107,8 +3100,6 @@ type CngxCommitRunner<T> = (handlers: {
|
|
|
3107
3100
|
* fires). `onRefused` is optional because only families whose action can
|
|
3108
3101
|
* refuse (the stepper) route it; when it is omitted a refusal still
|
|
3109
3102
|
* settles the state slot.
|
|
3110
|
-
*
|
|
3111
|
-
* @category common/data/commit
|
|
3112
3103
|
*/
|
|
3113
3104
|
interface CngxCommitBeginHandlers<T> {
|
|
3114
3105
|
readonly onSuccess: (committed: T | undefined) => void;
|
|
@@ -3139,8 +3130,6 @@ interface CngxCommitBeginHandlers<T> {
|
|
|
3139
3130
|
* The controller is intentionally **not** an Angular service or
|
|
3140
3131
|
* provider. It's a plain factory so it works in any injection context
|
|
3141
3132
|
* (including outside Angular, for headless tests).
|
|
3142
|
-
*
|
|
3143
|
-
* @category common/data/commit
|
|
3144
3133
|
*/
|
|
3145
3134
|
interface CngxCommitController<T> {
|
|
3146
3135
|
/** Read-only async-state view of the commit lifecycle. */
|
|
@@ -3159,6 +3148,15 @@ interface CngxCommitController<T> {
|
|
|
3159
3148
|
* previous runner's cancel handle fires synchronously, and the
|
|
3160
3149
|
* previous outcome callbacks become no-ops if they fire late.
|
|
3161
3150
|
*
|
|
3151
|
+
* At most one outcome fires per call: after the runner's first
|
|
3152
|
+
* `onSuccess` / `onError` / `onRefused` (or its synchronous throw),
|
|
3153
|
+
* every further route call of that runner is ignored.
|
|
3154
|
+
*
|
|
3155
|
+
* A runner that throws synchronously before any outcome settles the
|
|
3156
|
+
* commit as `'error'` with the thrown value and calls
|
|
3157
|
+
* `handlers.onError`; `begin()` does not throw. A throw after the
|
|
3158
|
+
* runner already settled is rethrown unchanged.
|
|
3159
|
+
*
|
|
3162
3160
|
* @param runner variant-specific action runner (closes over the
|
|
3163
3161
|
* action and the intended value)
|
|
3164
3162
|
* @param intended the value the user clicked
|
|
@@ -3177,8 +3175,10 @@ interface CngxCommitController<T> {
|
|
|
3177
3175
|
* By default the state slot keeps its current status (a destroyed
|
|
3178
3176
|
* host never reads it again). Pass `settle: true` when the surface
|
|
3179
3177
|
* lives on - an explicit back-navigation or reset that supersedes a
|
|
3180
|
-
* pending commit must
|
|
3181
|
-
*
|
|
3178
|
+
* pending commit must not leave `busy` latched true forever. It
|
|
3179
|
+
* resets the slot: `'idle'` with data, error, progress and
|
|
3180
|
+
* `lastUpdated` cleared and `isFirstLoad()` true again, and it
|
|
3181
|
+
* clears `intendedValue`.
|
|
3182
3182
|
*/
|
|
3183
3183
|
cancel(options?: {
|
|
3184
3184
|
readonly settle?: boolean;
|
|
@@ -3189,9 +3189,7 @@ interface CngxCommitController<T> {
|
|
|
3189
3189
|
*
|
|
3190
3190
|
* Plain function, not a class - matches the rest of the repo
|
|
3191
3191
|
* (`createManualState`, `createAsyncState`, `createTransitionTracker`).
|
|
3192
|
-
*
|
|
3193
|
-
*
|
|
3194
|
-
* @category common/data/commit
|
|
3192
|
+
* <example-url>/#/common/data/commit-controller/begin-supersede-cancel</example-url>
|
|
3195
3193
|
*/
|
|
3196
3194
|
declare function createCommitController<T>(): CngxCommitController<T>;
|
|
3197
3195
|
|
|
@@ -3213,8 +3211,6 @@ declare function createCommitController<T>(): CngxCommitController<T>;
|
|
|
3213
3211
|
* are still two events; a host that only moves the index (a closed tab
|
|
3214
3212
|
* before the origin) copies the sequence instead of bumping it, so
|
|
3215
3213
|
* nothing downstream treats the shift as a new outcome.
|
|
3216
|
-
*
|
|
3217
|
-
* @category common/data/commit
|
|
3218
3214
|
*/
|
|
3219
3215
|
interface CngxTransitionOutcome {
|
|
3220
3216
|
readonly kind: 'refused' | 'failed';
|
|
@@ -3226,8 +3222,7 @@ interface CngxTransitionOutcome {
|
|
|
3226
3222
|
* Options for {@link createRefusedPhrase}. Every field is a plain
|
|
3227
3223
|
* reactive read, so the factory stays independent of any host type.
|
|
3228
3224
|
*
|
|
3229
|
-
* @
|
|
3230
|
-
* @since 0.1.0
|
|
3225
|
+
* @since 0.3.0
|
|
3231
3226
|
*/
|
|
3232
3227
|
interface CngxRefusedPhraseOptions {
|
|
3233
3228
|
/** The host's last refused or failed outcome, `undefined` once cleared. */
|
|
@@ -3274,10 +3269,9 @@ interface CngxRefusedPhraseOptions {
|
|
|
3274
3269
|
* });
|
|
3275
3270
|
* ```
|
|
3276
3271
|
*
|
|
3277
|
-
* @category common/data/commit
|
|
3278
3272
|
* @wcag AA
|
|
3279
3273
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/commit/refused-phrase.ts
|
|
3280
|
-
* @since 0.
|
|
3274
|
+
* @since 0.3.0
|
|
3281
3275
|
* @relatedTo CngxTransitionOutcome, createAnnouncementPhrase
|
|
3282
3276
|
*/
|
|
3283
3277
|
declare function createRefusedPhrase(options: CngxRefusedPhraseOptions): Signal<string>;
|
|
@@ -3289,8 +3283,6 @@ declare function createRefusedPhrase(options: CngxRefusedPhraseOptions): Signal<
|
|
|
3289
3283
|
* inject retry-with-backoff, offline queues, telemetry, or any
|
|
3290
3284
|
* other enterprise-specific commit lifecycle - without forking the
|
|
3291
3285
|
* features that consume it (select family, stepper, future wizards).
|
|
3292
|
-
*
|
|
3293
|
-
* @category common/data/commit
|
|
3294
3286
|
*/
|
|
3295
3287
|
type CngxCommitControllerFactory = <T>() => CngxCommitController<T>;
|
|
3296
3288
|
/**
|
|
@@ -3301,23 +3293,49 @@ type CngxCommitControllerFactory = <T>() => CngxCommitController<T>;
|
|
|
3301
3293
|
*
|
|
3302
3294
|
* Symmetrical to `CNGX_SELECT_COMMIT_CONTROLLER_FACTORY`
|
|
3303
3295
|
* (`@cngx/forms/select`); the select-side token's default factory
|
|
3304
|
-
* delegates to this one, so
|
|
3305
|
-
* every select variant
|
|
3296
|
+
* delegates to this one in the root injector, so an app-level override
|
|
3297
|
+
* here cascades into every select variant. A subtree override reaches
|
|
3298
|
+
* the stepper and tabs presenters, not the select family: override
|
|
3299
|
+
* `CNGX_SELECT_COMMIT_CONTROLLER_FACTORY` there.
|
|
3300
|
+
*
|
|
3301
|
+
* A replacement must honour `cancel({ settle: true })`, or `busy` stays
|
|
3302
|
+
* latched where the surface lives on. A custom factory usually wraps the
|
|
3303
|
+
* default one, here to time each commit that settles (`reportCommit`
|
|
3304
|
+
* stands for your telemetry call):
|
|
3306
3305
|
*
|
|
3307
3306
|
* ```ts
|
|
3307
|
+
* function createTimedCommitController<T>(): CngxCommitController<T> {
|
|
3308
|
+
* const inner = createCommitController<T>();
|
|
3309
|
+
* const begin: CngxCommitController<T>['begin'] = (runner, intended, previous, handlers) => {
|
|
3310
|
+
* const started = performance.now();
|
|
3311
|
+
* const report = (outcome: string) => reportCommit(outcome, performance.now() - started);
|
|
3312
|
+
* inner.begin(runner, intended, previous, {
|
|
3313
|
+
* onSuccess: (committed) => {
|
|
3314
|
+
* report('success');
|
|
3315
|
+
* handlers.onSuccess(committed);
|
|
3316
|
+
* },
|
|
3317
|
+
* onError: (err, prev) => {
|
|
3318
|
+
* report('error');
|
|
3319
|
+
* handlers.onError(err, prev);
|
|
3320
|
+
* },
|
|
3321
|
+
* onRefused: (prev) => {
|
|
3322
|
+
* report('refused');
|
|
3323
|
+
* handlers.onRefused?.(prev);
|
|
3324
|
+
* },
|
|
3325
|
+
* });
|
|
3326
|
+
* };
|
|
3327
|
+
* return { ...inner, begin };
|
|
3328
|
+
* }
|
|
3329
|
+
*
|
|
3308
3330
|
* bootstrapApplication(App, {
|
|
3309
3331
|
* providers: [
|
|
3310
|
-
* {
|
|
3311
|
-
* provide: CNGX_COMMIT_CONTROLLER_FACTORY,
|
|
3312
|
-
* useValue: <T>() => createRetryingCommitController<T>({ attempts: 3 }),
|
|
3313
|
-
* },
|
|
3332
|
+
* { provide: CNGX_COMMIT_CONTROLLER_FACTORY, useValue: createTimedCommitController },
|
|
3314
3333
|
* ],
|
|
3315
3334
|
* });
|
|
3316
3335
|
* ```
|
|
3317
3336
|
*
|
|
3318
|
-
* @category common/data/commit
|
|
3319
3337
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/commit/commit-controller.token.ts
|
|
3320
|
-
* @since 0.
|
|
3338
|
+
* @since 0.3.0
|
|
3321
3339
|
*/
|
|
3322
3340
|
declare const CNGX_COMMIT_CONTROLLER_FACTORY: InjectionToken<CngxCommitControllerFactory>;
|
|
3323
3341
|
|
|
@@ -3328,8 +3346,6 @@ declare const CNGX_COMMIT_CONTROLLER_FACTORY: InjectionToken<CngxCommitControlle
|
|
|
3328
3346
|
* own event/property shape to a host-agnostic `Signal<number>` /
|
|
3329
3347
|
* `Observable<number>` / getter / setter at the directive boundary. \
|
|
3330
3348
|
* That keeps `@cngx/common/data` independent of `@angular/material`.
|
|
3331
|
-
*
|
|
3332
|
-
* @category common/data/material-bridge
|
|
3333
3349
|
*/
|
|
3334
3350
|
interface CngxMaterialBidirectionalSyncOptions {
|
|
3335
3351
|
/**
|
|
@@ -3372,8 +3388,6 @@ interface CngxMaterialBidirectionalSyncOptions {
|
|
|
3372
3388
|
}
|
|
3373
3389
|
/**
|
|
3374
3390
|
* Handle returned by {@link createMaterialBidirectionalSync}.
|
|
3375
|
-
*
|
|
3376
|
-
* @category common/data/material-bridge
|
|
3377
3391
|
*/
|
|
3378
3392
|
interface CngxMaterialBidirectionalSyncHandle {
|
|
3379
3393
|
/**
|
|
@@ -3438,8 +3452,6 @@ interface CngxMaterialBidirectionalSyncHandle {
|
|
|
3438
3452
|
* and ping-pong against the in-flight navigation (the demo freezes).
|
|
3439
3453
|
* Matching the echo by the value we wrote drops it regardless of where
|
|
3440
3454
|
* the presenter has moved.
|
|
3441
|
-
*
|
|
3442
|
-
* @category common/data/material-bridge
|
|
3443
3455
|
*/
|
|
3444
3456
|
declare function createMaterialBidirectionalSync(opts: CngxMaterialBidirectionalSyncOptions): CngxMaterialBidirectionalSyncHandle;
|
|
3445
3457
|
|
|
@@ -3448,8 +3460,7 @@ declare function createMaterialBidirectionalSync(opts: CngxMaterialBidirectional
|
|
|
3448
3460
|
* `CngxMetric`, `CngxDelta`, `CngxTrend` and `CngxGoal`. Magnitudes reach the
|
|
3449
3461
|
* messages already formatted for the app locale.
|
|
3450
3462
|
*
|
|
3451
|
-
* @
|
|
3452
|
-
* @since 0.1.0
|
|
3463
|
+
* @since 0.3.0
|
|
3453
3464
|
* @relatedTo CNGX_KPI_I18N
|
|
3454
3465
|
*/
|
|
3455
3466
|
interface CngxKpiLanguageSection {
|
|
@@ -3476,8 +3487,7 @@ interface CngxKpiLanguageSection {
|
|
|
3476
3487
|
* The English kpi section: the single source of the KPI atoms' English copy.
|
|
3477
3488
|
* `CNGX_KPI_I18N` defaults to it.
|
|
3478
3489
|
*
|
|
3479
|
-
* @
|
|
3480
|
-
* @since 0.1.0
|
|
3490
|
+
* @since 0.3.0
|
|
3481
3491
|
* @relatedTo CNGX_KPI_I18N
|
|
3482
3492
|
*/
|
|
3483
3493
|
declare const CNGX_KPI_LANGUAGE_EN: CngxKpiLanguageSection;
|
|
@@ -3491,8 +3501,7 @@ declare module '@cngx/core/i18n' {
|
|
|
3491
3501
|
* The recycler section of a {@link CngxLanguagePack}: the screen-reader
|
|
3492
3502
|
* announcements of a virtualised list.
|
|
3493
3503
|
*
|
|
3494
|
-
* @
|
|
3495
|
-
* @since 0.1.0
|
|
3504
|
+
* @since 0.3.0
|
|
3496
3505
|
* @relatedTo CNGX_RECYCLER_I18N
|
|
3497
3506
|
*/
|
|
3498
3507
|
interface CngxRecyclerLanguageSection {
|
|
@@ -3509,8 +3518,7 @@ interface CngxRecyclerLanguageSection {
|
|
|
3509
3518
|
* The English recycler section: the single source of the recycler's English
|
|
3510
3519
|
* copy. `CNGX_RECYCLER_I18N` defaults to it.
|
|
3511
3520
|
*
|
|
3512
|
-
* @
|
|
3513
|
-
* @since 0.1.0
|
|
3521
|
+
* @since 0.3.0
|
|
3514
3522
|
* @relatedTo CNGX_RECYCLER_I18N
|
|
3515
3523
|
*/
|
|
3516
3524
|
declare const CNGX_RECYCLER_LANGUAGE_EN: CngxRecyclerLanguageSection;
|