@cngx/common 0.1.0-rc.8 → 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 +42 -2
- package/data/README.md +15 -12
- package/fesm2022/cngx-common-a11y.mjs +1076 -319
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +99 -77
- 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 +138 -78
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +799 -327
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +101 -25
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +861 -423
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +198 -160
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +693 -329
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7303 -2774
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2174 -442
- 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 +2109 -557
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +548 -419
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +442 -331
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +44 -71
- 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 +17 -1
- package/menu-button/README.md +234 -0
- package/package.json +31 -8
- package/popover/README.md +81 -4
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +96 -0
- package/schematics/package.json +3 -0
- package/stepper/README.md +5 -5
- 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 +434 -0
- package/theming/components/cngx-popover.css +37 -9
- 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 +488 -112
- 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 +677 -389
- package/types/cngx-common-command.d.ts +55 -41
- package/types/cngx-common-data.d.ts +506 -360
- package/types/cngx-common-dialog.d.ts +94 -127
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4383 -1721
- package/types/cngx-common-layout.d.ts +1399 -288
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +990 -268
- package/types/cngx-common-stepper.d.ts +374 -465
- package/types/cngx-common-tabs.d.ts +309 -403
- package/types/cngx-common-timeline.d.ts +50 -109
|
@@ -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,24 +419,65 @@ 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
|
-
declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
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>;
|
|
451
|
-
|
|
456
|
+
/**
|
|
457
|
+
* The `CngxFilter` this strip registers its predicate on, under `filterKey`.
|
|
458
|
+
* Rebinding moves the registration to the new filter.
|
|
459
|
+
*/
|
|
460
|
+
readonly filterRef: _angular_core.InputSignal<CngxFilter<TListItem>>;
|
|
461
|
+
/**
|
|
462
|
+
* Extracts the comparable value from a filtered list item, when the list
|
|
463
|
+
* is shaped unlike the chip options: role options `{ id, label }` filtering
|
|
464
|
+
* an employee list by `employee.roleId`. Return an array for an item that
|
|
465
|
+
* carries several values (`employee.tags`); it matches when any of them is
|
|
466
|
+
* selected. Unbound, the predicate applies `optionValue` to the list items,
|
|
467
|
+
* which fits a list shaped like the options.
|
|
468
|
+
*/
|
|
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
|
+
*/
|
|
452
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
|
+
*/
|
|
453
481
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
454
482
|
/**
|
|
455
483
|
* Form-state surface forwarded transparently to the inner
|
|
@@ -459,9 +487,28 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
459
487
|
* / `CngxButtonToggleGroup` precedent.
|
|
460
488
|
*/
|
|
461
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
|
+
*/
|
|
462
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
|
+
*/
|
|
463
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
|
+
*/
|
|
464
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
|
+
*/
|
|
465
512
|
readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
|
|
466
513
|
/**
|
|
467
514
|
* Membership key extractor for object-valued chip values. When
|
|
@@ -485,14 +532,14 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
485
532
|
/**
|
|
486
533
|
* Build the slot context for a given chip option. `optionValue` is
|
|
487
534
|
* invoked here per option for the chip rendering pass; the predicate
|
|
488
|
-
* closure invokes it again per LIST item for membership filtering
|
|
489
|
-
* Both invocations are necessary
|
|
490
|
-
* pool) and filtered list items (the
|
|
491
|
-
* separate data paths - they
|
|
492
|
-
*
|
|
493
|
-
* across the two paths without conflating them. Consumers
|
|
494
|
-
* keep `optionValue` cheap (typically a property lookup);
|
|
495
|
-
* `[itemValue]`
|
|
535
|
+
* closure invokes it again per LIST item for membership filtering
|
|
536
|
+
* while `[itemValue]` is unbound. Both invocations are necessary
|
|
537
|
+
* because option items (the chip pool) and filtered list items (the
|
|
538
|
+
* consumer's filtered data) are separate data paths - they share a
|
|
539
|
+
* shape only when `[itemValue]` is unbound, and the bridge cannot
|
|
540
|
+
* memoise across the two paths without conflating them. Consumers
|
|
541
|
+
* should keep `optionValue` cheap (typically a property lookup); bind
|
|
542
|
+
* `[itemValue]` when the list is shaped unlike the options.
|
|
496
543
|
*/
|
|
497
544
|
protected readonly chipContext: (option: TItem) => CngxFilterChipContext<TItem, TValue>;
|
|
498
545
|
/**
|
|
@@ -504,8 +551,9 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
504
551
|
*/
|
|
505
552
|
readonly selectedValues: _angular_core.ModelSignal<TValue[]>;
|
|
506
553
|
constructor();
|
|
507
|
-
|
|
508
|
-
static
|
|
554
|
+
private itemKeys;
|
|
555
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxFilterChips<any, any, any>, never>;
|
|
556
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxFilterChips<any, any, any>, "cngx-filter-chips", ["cngxFilterChips"], { "label": { "alias": "label"; "required": true; "isSignal": true; }; "options": { "alias": "options"; "required": true; "isSignal": true; }; "optionLabel": { "alias": "optionLabel"; "required": true; "isSignal": true; }; "optionValue": { "alias": "optionValue"; "required": true; "isSignal": true; }; "filterRef": { "alias": "filterRef"; "required": true; "isSignal": true; }; "itemValue": { "alias": "itemValue"; "required": false; "isSignal": true; }; "filterKey": { "alias": "filterKey"; "required": true; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "errorMessageId": { "alias": "errorMessageId"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "keyFn": { "alias": "keyFn"; "required": false; "isSignal": true; }; "selectedValues": { "alias": "selectedValues"; "required": false; "isSignal": true; }; }, { "disabled": "disabledChange"; "required": "requiredChange"; "invalid": "invalidChange"; "selectedValues": "selectedValuesChange"; }, ["chipTemplate"], never, true, never>;
|
|
509
557
|
}
|
|
510
558
|
|
|
511
559
|
/**
|
|
@@ -531,17 +579,16 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
531
579
|
* [length]="pg.total()" [pageIndex]="pg.pageIndex()" [pageSize]="pg.pageSize()"
|
|
532
580
|
* (page)="pg.setPageSize($event.pageSize, false); pg.setPage($event.pageIndex)" />
|
|
533
581
|
* ```
|
|
534
|
-
* @category common/data/paginate
|
|
535
|
-
* @docsKind primary
|
|
536
582
|
* @wcag AA
|
|
537
583
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate.directive.ts
|
|
538
|
-
* @since 0.
|
|
584
|
+
* @since 0.3.0
|
|
539
585
|
* @relatedTo CngxSort, CngxFilter, CngxSmartDataSource
|
|
540
586
|
*
|
|
541
|
-
* <example-url
|
|
542
|
-
* <example-url
|
|
543
|
-
* <example-url
|
|
544
|
-
* <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
|
|
545
592
|
*/
|
|
546
593
|
declare class CngxPaginate {
|
|
547
594
|
/** Controlled page index. When bound, takes precedence over internal state. */
|
|
@@ -636,8 +683,7 @@ declare class CngxPaginate {
|
|
|
636
683
|
* is byte-identical across all three. Call inside an injection context
|
|
637
684
|
* (constructor or field initialiser).
|
|
638
685
|
*
|
|
639
|
-
* @
|
|
640
|
-
* @since 0.1.0
|
|
686
|
+
* @since 0.3.0
|
|
641
687
|
*/
|
|
642
688
|
declare function connectPaginateResetOn(paginate: CngxPaginate, key: () => unknown): void;
|
|
643
689
|
/**
|
|
@@ -654,13 +700,11 @@ declare function connectPaginateResetOn(paginate: CngxPaginate, key: () => unkno
|
|
|
654
700
|
* ```html
|
|
655
701
|
* <table cngxPaginate [cngxPaginateResetOn]="filter()"><!-- ... --></table>
|
|
656
702
|
* ```
|
|
657
|
-
* <example-url
|
|
703
|
+
* <example-url>/#/ui/paginator/paginator-behaviors/reset-on-filter</example-url>
|
|
658
704
|
*
|
|
659
|
-
* @category common/data/paginate
|
|
660
|
-
* @docsKind primary
|
|
661
705
|
* @wcag AA
|
|
662
706
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate-reset.directive.ts
|
|
663
|
-
* @since 0.
|
|
707
|
+
* @since 0.3.0
|
|
664
708
|
* @relatedTo CngxPaginate, CngxPaginator, CngxMatPaginator
|
|
665
709
|
*/
|
|
666
710
|
declare class CngxPaginateResetOn {
|
|
@@ -676,8 +720,7 @@ declare class CngxPaginateResetOn {
|
|
|
676
720
|
* Handlers the two-way emit bridge forwards page changes to - typically a
|
|
677
721
|
* host component's `pageIndexChange` / `pageSizeChange` output emitters.
|
|
678
722
|
*
|
|
679
|
-
* @
|
|
680
|
-
* @since 0.1.0
|
|
723
|
+
* @since 0.3.0
|
|
681
724
|
*/
|
|
682
725
|
interface CngxPaginateEmitHandlers {
|
|
683
726
|
/** Called once per effective page-index change. */
|
|
@@ -708,8 +751,7 @@ interface CngxPaginateEmitHandlers {
|
|
|
708
751
|
* injection context (constructor or field initialiser) - it reads `DestroyRef`
|
|
709
752
|
* and creates effects.
|
|
710
753
|
*
|
|
711
|
-
* @
|
|
712
|
-
* @since 0.1.0
|
|
754
|
+
* @since 0.3.0
|
|
713
755
|
*/
|
|
714
756
|
declare function connectPaginateEmit(paginate: CngxPaginate, handlers: CngxPaginateEmitHandlers): void;
|
|
715
757
|
|
|
@@ -731,13 +773,12 @@ declare function connectPaginateEmit(paginate: CngxPaginate, handlers: CngxPagin
|
|
|
731
773
|
* inert no-op (a dev-mode warning is logged). Framework-agnostic of any UI - it
|
|
732
774
|
* needs only the brain and the router.
|
|
733
775
|
*
|
|
734
|
-
* @category common/data/paginate
|
|
735
|
-
* @docsKind primary
|
|
736
776
|
* @wcag AA
|
|
737
777
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate-routing.directive.ts
|
|
738
|
-
* @since 0.
|
|
778
|
+
* @since 0.3.0
|
|
739
779
|
* @relatedTo CngxPaginate, CngxPaginator, CngxMatPaginator
|
|
740
|
-
* <example-url
|
|
780
|
+
* <example-url>/#/ui/paginator/paginator-behaviors/url-synced-paging</example-url>
|
|
781
|
+
* @axis level organism
|
|
741
782
|
*/
|
|
742
783
|
declare class CngxPaginateRouting implements OnInit {
|
|
743
784
|
private readonly paginate;
|
|
@@ -763,9 +804,8 @@ declare class CngxPaginateRouting implements OnInit {
|
|
|
763
804
|
* presentation segment never needs it, only the label to render and the
|
|
764
805
|
* derived empty/active state to reflect.
|
|
765
806
|
*
|
|
766
|
-
* @category common/data/paginate
|
|
767
807
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts
|
|
768
|
-
* @since 0.
|
|
808
|
+
* @since 0.3.0
|
|
769
809
|
*/
|
|
770
810
|
interface CngxBucketPaginateView {
|
|
771
811
|
/** Human-readable bucket label, e.g. `'A-C'`. Rendered as the chip text. */
|
|
@@ -783,9 +823,8 @@ interface CngxBucketPaginateView {
|
|
|
783
823
|
* through the directive's `active` model so the toggle invariant (re-selecting
|
|
784
824
|
* the active bucket clears it) holds in one place.
|
|
785
825
|
*
|
|
786
|
-
* @category common/data/paginate
|
|
787
826
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts
|
|
788
|
-
* @since 0.
|
|
827
|
+
* @since 0.3.0
|
|
789
828
|
*/
|
|
790
829
|
interface CngxBucketPaginateHost {
|
|
791
830
|
/** The buckets to render, in declaration order. One chip per entry. */
|
|
@@ -812,10 +851,9 @@ interface CngxBucketPaginateHost {
|
|
|
812
851
|
* concrete directive class, keeping the strip decompose-ready and the model
|
|
813
852
|
* swappable.
|
|
814
853
|
*
|
|
815
|
-
* @category common/data/paginate
|
|
816
854
|
* @wcag AA
|
|
817
855
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts
|
|
818
|
-
* @since 0.
|
|
856
|
+
* @since 0.3.0
|
|
819
857
|
*/
|
|
820
858
|
declare const CNGX_BUCKET_PAGINATE_HOST: InjectionToken<CngxBucketPaginateHost>;
|
|
821
859
|
|
|
@@ -824,8 +862,6 @@ declare const CNGX_BUCKET_PAGINATE_HOST: InjectionToken<CngxBucketPaginateHost>;
|
|
|
824
862
|
* into it. The predicate keeps the model content-agnostic - the same directive
|
|
825
863
|
* buckets by letter range, date band, price tier, or any other partition the
|
|
826
864
|
* consumer expresses, without the brain knowing what it is bucketing.
|
|
827
|
-
*
|
|
828
|
-
* @category common/data/paginate
|
|
829
865
|
*/
|
|
830
866
|
interface CngxBucket<T> {
|
|
831
867
|
/** Human-readable bucket label, e.g. `'A-C'`. Rendered as the chip text. */
|
|
@@ -861,13 +897,12 @@ interface CngxBucket<T> {
|
|
|
861
897
|
* </div>
|
|
862
898
|
* ```
|
|
863
899
|
*
|
|
864
|
-
* @category common/data/paginate
|
|
865
|
-
* @docsKind primary
|
|
866
900
|
* @wcag AA
|
|
867
901
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate.directive.ts
|
|
868
|
-
* @since 0.
|
|
902
|
+
* @since 0.3.0
|
|
869
903
|
* @relatedTo CngxPaginate, CngxFilter
|
|
870
|
-
* <example-url
|
|
904
|
+
* <example-url>/#/ui/paginator/paginator-modes/alphabetical</example-url>
|
|
905
|
+
* @axis level organism
|
|
871
906
|
*/
|
|
872
907
|
declare class CngxBucketPaginate<T = unknown> implements CngxBucketPaginateHost {
|
|
873
908
|
/** The buckets to partition into, in render order. One chip per entry. */
|
|
@@ -918,17 +953,24 @@ declare class CngxBucketPaginate<T = unknown> implements CngxBucketPaginateHost
|
|
|
918
953
|
*
|
|
919
954
|
* @typeParam T - The row item type.
|
|
920
955
|
*
|
|
921
|
-
* @category common/data/data-source
|
|
922
|
-
* @docsKind primary
|
|
923
956
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/data-source.ts
|
|
924
|
-
* @since 0.
|
|
957
|
+
* @since 0.3.0
|
|
925
958
|
* @relatedTo CngxSmartDataSource, CngxSort, CngxFilter, CngxPaginate
|
|
926
959
|
*/
|
|
927
960
|
declare class CngxDataSource<T> extends DataSource<T> {
|
|
928
961
|
private readonly data;
|
|
929
962
|
private readonly injector;
|
|
930
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
|
+
*/
|
|
931
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
|
+
*/
|
|
932
974
|
disconnect(): void;
|
|
933
975
|
}
|
|
934
976
|
/**
|
|
@@ -939,15 +981,11 @@ declare class CngxDataSource<T> extends DataSource<T> {
|
|
|
939
981
|
* ```typescript
|
|
940
982
|
* readonly dataSource = injectDataSource(this.items);
|
|
941
983
|
* ```
|
|
942
|
-
*
|
|
943
|
-
* @category common/data/data-source
|
|
944
984
|
*/
|
|
945
985
|
declare function injectDataSource<T>(data: Signal<T[]>): CngxDataSource<T>;
|
|
946
986
|
|
|
947
987
|
/**
|
|
948
988
|
* Optional customization for {@link CngxSmartDataSource}.
|
|
949
|
-
*
|
|
950
|
-
* @category common/data/data-source
|
|
951
989
|
*/
|
|
952
990
|
interface CngxSmartDataSourceOptions<T> {
|
|
953
991
|
/**
|
|
@@ -1021,11 +1059,13 @@ interface CngxSmartDataSourceOptions<T> {
|
|
|
1021
1059
|
*
|
|
1022
1060
|
* @typeParam T - The row item type.
|
|
1023
1061
|
*
|
|
1024
|
-
* @category common/data/data-source
|
|
1025
|
-
* @docsKind primary
|
|
1026
1062
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/smart-data-source.ts
|
|
1027
|
-
* @since 0.
|
|
1063
|
+
* @since 0.3.0
|
|
1028
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>
|
|
1029
1069
|
*/
|
|
1030
1070
|
declare class CngxSmartDataSource<T> extends DataSource<T> {
|
|
1031
1071
|
private readonly options?;
|
|
@@ -1063,7 +1103,16 @@ declare class CngxSmartDataSource<T> extends DataSource<T> {
|
|
|
1063
1103
|
/** `true` when data is empty AND no operation is running. */
|
|
1064
1104
|
readonly isEmpty: Signal<boolean>;
|
|
1065
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
|
+
*/
|
|
1066
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
|
+
*/
|
|
1067
1116
|
disconnect(): void;
|
|
1068
1117
|
}
|
|
1069
1118
|
/**
|
|
@@ -1081,8 +1130,7 @@ declare class CngxSmartDataSource<T> extends DataSource<T> {
|
|
|
1081
1130
|
* readonly residents = injectAsyncState(() => this.api.getAll());
|
|
1082
1131
|
* readonly dataSource = injectSmartDataSource(this.residents);
|
|
1083
1132
|
* ```
|
|
1084
|
-
*
|
|
1085
|
-
* @category common/data/data-source
|
|
1133
|
+
* <example-url>/#/ui/data-grid-accordion/smart-data-source-options-sort</example-url>
|
|
1086
1134
|
*/
|
|
1087
1135
|
declare function injectSmartDataSource<T>(source: Signal<T[]> | CngxAsyncState<T[]>, options?: CngxSmartDataSourceOptions<T>): CngxSmartDataSource<T>;
|
|
1088
1136
|
|
|
@@ -1091,8 +1139,6 @@ declare function injectSmartDataSource<T>(source: Signal<T[]> | CngxAsyncState<T
|
|
|
1091
1139
|
*
|
|
1092
1140
|
* Returned by `createManualState()` - provides imperative setters
|
|
1093
1141
|
* while the read-side stays the standard `CngxAsyncState` interface.
|
|
1094
|
-
*
|
|
1095
|
-
* @category common/data/async-state
|
|
1096
1142
|
*/
|
|
1097
1143
|
interface ManualAsyncState<T> extends CngxAsyncState<T> {
|
|
1098
1144
|
/** Set the status directly. */
|
|
@@ -1101,9 +1147,22 @@ interface ManualAsyncState<T> extends CngxAsyncState<T> {
|
|
|
1101
1147
|
setSuccess(data: T): void;
|
|
1102
1148
|
/** Transition to `error`. */
|
|
1103
1149
|
setError(error: unknown): void;
|
|
1150
|
+
/**
|
|
1151
|
+
* Transition to `idle` without dropping what the state already holds.
|
|
1152
|
+
*
|
|
1153
|
+
* Clears `error` and `progress`; keeps `data`, `lastUpdated` and the
|
|
1154
|
+
* first-load flag. Use it when an operation ends without changing
|
|
1155
|
+
* anything (a commit the action refused): nothing was replaced, so
|
|
1156
|
+
* nothing is dropped, and no `success` edge is published that a
|
|
1157
|
+
* feedback bridge would report. `reset()` is the full wipe.
|
|
1158
|
+
*/
|
|
1159
|
+
setIdle(): void;
|
|
1104
1160
|
/** Set progress (0–100). */
|
|
1105
1161
|
setProgress(value: number | undefined): void;
|
|
1106
|
-
/**
|
|
1162
|
+
/**
|
|
1163
|
+
* Reset to `idle` and clear data, error, progress and `lastUpdated`.
|
|
1164
|
+
* `isFirstLoad()` reads `true` again.
|
|
1165
|
+
*/
|
|
1107
1166
|
reset(): void;
|
|
1108
1167
|
}
|
|
1109
1168
|
/**
|
|
@@ -1122,15 +1181,11 @@ interface ManualAsyncState<T> extends CngxAsyncState<T> {
|
|
|
1122
1181
|
* this.processState.setSuccess(result);
|
|
1123
1182
|
* }
|
|
1124
1183
|
* ```
|
|
1125
|
-
*
|
|
1126
|
-
* @category common/data/async-state
|
|
1127
1184
|
*/
|
|
1128
1185
|
declare function createManualState<T>(): ManualAsyncState<T>;
|
|
1129
1186
|
|
|
1130
1187
|
/**
|
|
1131
1188
|
* Configuration options for `createAsyncState`.
|
|
1132
|
-
*
|
|
1133
|
-
* @category common/data/async-state
|
|
1134
1189
|
*/
|
|
1135
1190
|
interface CreateAsyncStateOptions {
|
|
1136
1191
|
/**
|
|
@@ -1151,16 +1206,18 @@ interface CreateAsyncStateOptions {
|
|
|
1151
1206
|
*
|
|
1152
1207
|
* Extends the read-only `CngxAsyncState` with an `execute()` method
|
|
1153
1208
|
* that runs an async action and manages the full lifecycle.
|
|
1154
|
-
*
|
|
1155
|
-
* @category common/data/async-state
|
|
1156
1209
|
*/
|
|
1157
1210
|
interface MutableAsyncState<T> extends CngxAsyncState<T> {
|
|
1158
1211
|
/**
|
|
1159
1212
|
* Execute an async action.
|
|
1160
1213
|
*
|
|
1161
|
-
* Sets status to `pending`, then `success` or `error` on completion.
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
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`.
|
|
1164
1221
|
*/
|
|
1165
1222
|
execute(fn: () => Promise<T> | Observable<T>): Promise<void>;
|
|
1166
1223
|
/** Report progress (0–100) during execution. */
|
|
@@ -1183,8 +1240,6 @@ interface MutableAsyncState<T> extends CngxAsyncState<T> {
|
|
|
1183
1240
|
* );
|
|
1184
1241
|
* }
|
|
1185
1242
|
* ```
|
|
1186
|
-
*
|
|
1187
|
-
* @category common/data/async-state
|
|
1188
1243
|
*/
|
|
1189
1244
|
declare function createAsyncState<T>(options?: CreateAsyncStateOptions): MutableAsyncState<T>;
|
|
1190
1245
|
|
|
@@ -1202,7 +1257,10 @@ declare function createAsyncState<T>(options?: CreateAsyncStateOptions): Mutable
|
|
|
1202
1257
|
* source on each access, so bridges observe transitions of whatever is bound
|
|
1203
1258
|
* right now. With nothing bound it reports a quiet `idle` state rather than
|
|
1204
1259
|
* throwing, which is what lets a bridge sit inside a timeline that has not
|
|
1205
|
-
* 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.
|
|
1206
1264
|
*
|
|
1207
1265
|
* Contrast the select family, which provides `CNGX_STATEFUL` with
|
|
1208
1266
|
* `useFactory` over a concrete `commitState` field - no forwarding needed
|
|
@@ -1217,16 +1275,14 @@ declare function createAsyncState<T>(options?: CreateAsyncStateOptions): Mutable
|
|
|
1217
1275
|
* { provide: CNGX_STATEFUL, useFactory: () => ({ state: inject(Host).asyncState }) }
|
|
1218
1276
|
* ```
|
|
1219
1277
|
*
|
|
1220
|
-
* @category common/data/async-state
|
|
1221
1278
|
* @relatedTo createAsyncState, createManualState
|
|
1222
|
-
* @since 0.
|
|
1279
|
+
* @since 0.3.0
|
|
1280
|
+
* <example-url>/#/common/data/async-state/forwarded-state-through-an-input</example-url>
|
|
1223
1281
|
*/
|
|
1224
1282
|
declare function createForwardedAsyncState<T>(source: () => CngxAsyncState<T> | undefined): CngxAsyncState<T>;
|
|
1225
1283
|
|
|
1226
1284
|
/**
|
|
1227
1285
|
* Configuration options for `injectAsyncState`.
|
|
1228
|
-
*
|
|
1229
|
-
* @category common/data/async-state
|
|
1230
1286
|
*/
|
|
1231
1287
|
interface InjectAsyncStateOptions {
|
|
1232
1288
|
/**
|
|
@@ -1258,11 +1314,9 @@ interface InjectAsyncStateOptions {
|
|
|
1258
1314
|
*
|
|
1259
1315
|
* Extends the read-only `CngxAsyncState` with a `refresh()` method
|
|
1260
1316
|
* to explicitly re-trigger the query.
|
|
1261
|
-
*
|
|
1262
|
-
* @category common/data/async-state
|
|
1263
1317
|
*/
|
|
1264
1318
|
interface ReactiveAsyncState<T> extends CngxAsyncState<T> {
|
|
1265
|
-
/** Explicitly re-trigger the query. */
|
|
1319
|
+
/** Explicitly re-trigger the query. Does nothing after the owner is destroyed. */
|
|
1266
1320
|
refresh(): void;
|
|
1267
1321
|
}
|
|
1268
1322
|
/**
|
|
@@ -1278,17 +1332,15 @@ interface ReactiveAsyncState<T> extends CngxAsyncState<T> {
|
|
|
1278
1332
|
* );
|
|
1279
1333
|
* // Loads automatically when filter() changes.
|
|
1280
1334
|
* // Caches last result during refresh (refreshing state).
|
|
1281
|
-
* //
|
|
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.
|
|
1282
1338
|
* ```
|
|
1283
|
-
*
|
|
1284
|
-
* @category common/data/async-state
|
|
1285
1339
|
*/
|
|
1286
1340
|
declare function injectAsyncState<T>(fn: () => Promise<T> | Observable<T>, options?: InjectAsyncStateOptions): ReactiveAsyncState<T>;
|
|
1287
1341
|
|
|
1288
1342
|
/**
|
|
1289
1343
|
* Possible view states for async content rendering.
|
|
1290
|
-
*
|
|
1291
|
-
* @category common/data/async-state
|
|
1292
1344
|
*/
|
|
1293
1345
|
type AsyncView = 'none' | 'skeleton' | 'content' | 'empty' | 'error' | 'content+error';
|
|
1294
1346
|
/**
|
|
@@ -1306,8 +1358,6 @@ type AsyncView = 'none' | 'skeleton' | 'content' | 'empty' | 'error' | 'content+
|
|
|
1306
1358
|
* | success | * | true | empty |
|
|
1307
1359
|
* | error | false | * | content+error |
|
|
1308
1360
|
* | (all other) | * | * | content |
|
|
1309
|
-
*
|
|
1310
|
-
* @category common/data/async-state
|
|
1311
1361
|
*/
|
|
1312
1362
|
declare function resolveAsyncView(status: AsyncStatus, firstLoad: boolean, empty: boolean): AsyncView;
|
|
1313
1363
|
|
|
@@ -1317,8 +1367,7 @@ declare function resolveAsyncView(status: AsyncStatus, firstLoad: boolean, empty
|
|
|
1317
1367
|
* The `key` (and optional `label`) travel with the state so per-source
|
|
1318
1368
|
* attribution never relies on a parallel index array (Pillar 1).
|
|
1319
1369
|
*
|
|
1320
|
-
* @
|
|
1321
|
-
* @since 0.1.0
|
|
1370
|
+
* @since 0.3.0
|
|
1322
1371
|
*/
|
|
1323
1372
|
interface AggregateSource<T = unknown> {
|
|
1324
1373
|
/** Stable identity for this source, used to key attribution and `@for`. */
|
|
@@ -1331,8 +1380,7 @@ interface AggregateSource<T = unknown> {
|
|
|
1331
1380
|
/**
|
|
1332
1381
|
* One errored source, surfaced by {@link CngxAsyncBoundary.failures}.
|
|
1333
1382
|
*
|
|
1334
|
-
* @
|
|
1335
|
-
* @since 0.1.0
|
|
1383
|
+
* @since 0.3.0
|
|
1336
1384
|
*/
|
|
1337
1385
|
interface AggregateFailure {
|
|
1338
1386
|
/** The failing source's key. */
|
|
@@ -1353,20 +1401,27 @@ interface AggregateFailure {
|
|
|
1353
1401
|
* `[state]` wiring. `failures` exposes the errored sources - keyed, so a
|
|
1354
1402
|
* consumer's `@for` can render per-source attribution through any feedback
|
|
1355
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]`.
|
|
1356
1407
|
*
|
|
1357
1408
|
* ```html
|
|
1358
|
-
* <div [cngxAsyncBoundary]="sources" #b="cngxAsyncBoundary"
|
|
1409
|
+
* <div [cngxAsyncBoundary]="sources" #b="cngxAsyncBoundary"
|
|
1410
|
+
* cngxToastOn [toastError]="'Loading failed'">
|
|
1359
1411
|
* <cngx-async-container [state]="b.state"> ... </cngx-async-container>
|
|
1360
|
-
* <cngx-toast-on />
|
|
1361
1412
|
* @for (f of b.failures(); track f.key) {
|
|
1362
|
-
* <cngx-
|
|
1413
|
+
* <cngx-alert severity="error" [title]="f.label ?? f.key">{{ messageOf(f.error) }}</cngx-alert>
|
|
1363
1414
|
* }
|
|
1364
1415
|
* </div>
|
|
1365
1416
|
* ```
|
|
1366
1417
|
*
|
|
1367
|
-
* @category common/data/async-state
|
|
1368
1418
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-state/async-boundary.directive.ts
|
|
1369
|
-
* @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
|
|
1370
1425
|
*/
|
|
1371
1426
|
declare class CngxAsyncBoundary implements CngxStateful<readonly unknown[]> {
|
|
1372
1427
|
/** The keyed source list to aggregate. */
|
|
@@ -1383,17 +1438,19 @@ declare class CngxAsyncBoundary implements CngxStateful<readonly unknown[]> {
|
|
|
1383
1438
|
/**
|
|
1384
1439
|
* Bridge that projects an Angular `Resource<T>` onto `CngxAsyncState<T>`.
|
|
1385
1440
|
*
|
|
1386
|
-
* Must be called in an injection context
|
|
1387
|
-
* `hadSuccess` requires one).
|
|
1441
|
+
* Must be called in an injection context.
|
|
1388
1442
|
*
|
|
1389
1443
|
* All signals are derived reactively from the resource - no manual
|
|
1390
1444
|
* synchronization. The resource stays the single source of truth.
|
|
1391
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
|
+
*
|
|
1392
1449
|
* ```typescript
|
|
1393
1450
|
* private readonly res = resource({
|
|
1394
|
-
*
|
|
1395
|
-
* loader: ({
|
|
1396
|
-
* fetch(`/api/items?q=${
|
|
1451
|
+
* params: () => ({ filter: this.filter() }),
|
|
1452
|
+
* loader: ({ params, abortSignal }) =>
|
|
1453
|
+
* fetch(`/api/items?q=${params.filter}`, { signal: abortSignal })
|
|
1397
1454
|
* .then(r => r.json()),
|
|
1398
1455
|
* });
|
|
1399
1456
|
*
|
|
@@ -1401,26 +1458,35 @@ declare class CngxAsyncBoundary implements CngxStateful<readonly unknown[]> {
|
|
|
1401
1458
|
* // items.status(), items.data(), items.isFirstLoad() - all work
|
|
1402
1459
|
* // <cngx-async-container [state]="items"> - direct binding
|
|
1403
1460
|
* ```
|
|
1404
|
-
*
|
|
1405
|
-
* @category common/data/async-state
|
|
1406
1461
|
*/
|
|
1407
1462
|
declare function fromResource<T>(ref: Resource<T>): CngxAsyncState<T>;
|
|
1408
1463
|
|
|
1464
|
+
/**
|
|
1465
|
+
* Structural subset of Angular's `HttpProgressEvent` - the byte counts the
|
|
1466
|
+
* bridge reads. `total` is absent when the server sends no length.
|
|
1467
|
+
*/
|
|
1468
|
+
interface HttpProgressLike {
|
|
1469
|
+
readonly loaded: number;
|
|
1470
|
+
readonly total?: number;
|
|
1471
|
+
}
|
|
1409
1472
|
/**
|
|
1410
1473
|
* Shape of an `HttpResourceRef` - only the signals we need.
|
|
1411
1474
|
*
|
|
1412
1475
|
* Declared here to avoid a hard dependency on `@angular/common/http`.
|
|
1413
|
-
* The consumer passes the actual `httpResource()` return value
|
|
1414
|
-
*
|
|
1476
|
+
* The consumer passes the actual `httpResource()` return value, whose
|
|
1477
|
+
* `progress` signal carries the latest `HttpProgressEvent`.
|
|
1415
1478
|
*/
|
|
1416
1479
|
interface HttpResourceLike<T> extends Resource<T> {
|
|
1417
|
-
progress: () =>
|
|
1480
|
+
progress: () => HttpProgressLike | undefined;
|
|
1418
1481
|
}
|
|
1419
1482
|
/**
|
|
1420
1483
|
* Bridge that projects an Angular `httpResource()` ref onto `CngxAsyncState<T>`.
|
|
1421
1484
|
*
|
|
1422
1485
|
* Identical to `fromResource` but additionally maps the HTTP progress
|
|
1423
|
-
* signal to `CngxAsyncState.progress` (0
|
|
1486
|
+
* signal to `CngxAsyncState.progress` (0-100 scale): `loaded / total`,
|
|
1487
|
+
* rounded and clamped. With an unknown or zero `total` the progress is
|
|
1488
|
+
* `undefined` (indeterminate). Angular only emits progress events when the
|
|
1489
|
+
* request sets `reportProgress: true`.
|
|
1424
1490
|
*
|
|
1425
1491
|
* Must be called in an injection context.
|
|
1426
1492
|
*
|
|
@@ -1428,14 +1494,13 @@ interface HttpResourceLike<T> extends Resource<T> {
|
|
|
1428
1494
|
* private readonly res = httpResource<Item[]>(() => ({
|
|
1429
1495
|
* url: '/api/items',
|
|
1430
1496
|
* params: { q: this.filter() },
|
|
1497
|
+
* reportProgress: true,
|
|
1431
1498
|
* }));
|
|
1432
1499
|
*
|
|
1433
1500
|
* readonly items = fromHttpResource(this.res);
|
|
1434
|
-
* // items.progress() tracks
|
|
1501
|
+
* // items.progress() tracks download progress 0-100
|
|
1435
1502
|
* // <cngx-progress [state]="items"> - auto-wired progress bar
|
|
1436
1503
|
* ```
|
|
1437
|
-
*
|
|
1438
|
-
* @category common/data/async-state
|
|
1439
1504
|
*/
|
|
1440
1505
|
declare function fromHttpResource<T>(ref: HttpResourceLike<T>): CngxAsyncState<T>;
|
|
1441
1506
|
|
|
@@ -1463,8 +1528,9 @@ interface AsyncStateSink<T> {
|
|
|
1463
1528
|
* read via the sink's `isFirstLoad`; an explicit `options.status` wins).
|
|
1464
1529
|
* On next: calls `setSuccess(value)`.
|
|
1465
1530
|
* On error: calls `setError(err)` and **re-throws** (does not swallow).
|
|
1466
|
-
* On
|
|
1467
|
-
* 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.
|
|
1468
1534
|
*
|
|
1469
1535
|
* The Observable passes through unchanged - `tapAsyncState` is a side-effect operator.
|
|
1470
1536
|
*
|
|
@@ -1478,8 +1544,6 @@ interface AsyncStateSink<T> {
|
|
|
1478
1544
|
* ).subscribe();
|
|
1479
1545
|
* }
|
|
1480
1546
|
* ```
|
|
1481
|
-
*
|
|
1482
|
-
* @category common/data/async-state
|
|
1483
1547
|
*/
|
|
1484
1548
|
declare function tapAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
1485
1549
|
status?: 'loading' | 'refreshing' | 'pending';
|
|
@@ -1488,7 +1552,8 @@ declare function tapAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
|
1488
1552
|
* RxJS operator that extracts upload/download progress from an
|
|
1489
1553
|
* `HttpEvent` stream and reports it to a `ManualAsyncState`.
|
|
1490
1554
|
*
|
|
1491
|
-
* Filters progress events, calculates percentage
|
|
1555
|
+
* Filters progress events, calculates an integer percentage clamped to
|
|
1556
|
+
* 0-100, calls `setProgress()`.
|
|
1492
1557
|
* Non-progress events pass through unchanged.
|
|
1493
1558
|
*
|
|
1494
1559
|
* Use with `{ observe: 'events', reportProgress: true }` on HttpClient.
|
|
@@ -1506,8 +1571,7 @@ declare function tapAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
|
1506
1571
|
* ).subscribe();
|
|
1507
1572
|
* }
|
|
1508
1573
|
* ```
|
|
1509
|
-
*
|
|
1510
|
-
* @category common/data/async-state
|
|
1574
|
+
* <example-url>/#/common/data/async-operators/tap-async-progress</example-url>
|
|
1511
1575
|
*/
|
|
1512
1576
|
declare function tapAsyncProgress<E>(state: Pick<AsyncStateSink<unknown>, 'setProgress'>): MonoTypeOperatorFunction<E>;
|
|
1513
1577
|
/**
|
|
@@ -1522,7 +1586,8 @@ declare function tapAsyncProgress<E>(state: Pick<AsyncStateSink<unknown>, 'setPr
|
|
|
1522
1586
|
* 5. Call `setError(err)` on error
|
|
1523
1587
|
*
|
|
1524
1588
|
* The output Observable emits the **response body** (not HttpEvents).
|
|
1525
|
-
* Throws if the response body is
|
|
1589
|
+
* Throws a `CngxRuntimeError` with code [`CNGX1054`](/error-codes/cngx1054.md) if the response body is
|
|
1590
|
+
* `null`; the sink receives it through `setError(err)`.
|
|
1526
1591
|
*
|
|
1527
1592
|
* ```typescript
|
|
1528
1593
|
* readonly upload = createManualState<UploadResult>();
|
|
@@ -1538,8 +1603,7 @@ declare function tapAsyncProgress<E>(state: Pick<AsyncStateSink<unknown>, 'setPr
|
|
|
1538
1603
|
* // upload.status(), upload.progress(), upload.data() - all wired
|
|
1539
1604
|
* }
|
|
1540
1605
|
* ```
|
|
1541
|
-
*
|
|
1542
|
-
* @category common/data/async-state
|
|
1606
|
+
* <example-url>/#/common/data/async-operators/tap-http-async-state</example-url>
|
|
1543
1607
|
*/
|
|
1544
1608
|
declare function tapHttpAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
1545
1609
|
status?: 'loading' | 'refreshing' | 'pending';
|
|
@@ -1547,8 +1611,6 @@ declare function tapHttpAsyncState<T>(state: AsyncStateSink<T>, options?: {
|
|
|
1547
1611
|
|
|
1548
1612
|
/**
|
|
1549
1613
|
* Read-only snapshot of one registered async operation.
|
|
1550
|
-
*
|
|
1551
|
-
* @category common/data/async-registry
|
|
1552
1614
|
*/
|
|
1553
1615
|
interface CngxAsyncOperation {
|
|
1554
1616
|
/** Per-operation uid minted at registration (`register`'s return value). */
|
|
@@ -1579,8 +1641,6 @@ interface CngxAsyncOperation {
|
|
|
1579
1641
|
* status reactivity flows through each entry's `CngxAsyncState` signals; the
|
|
1580
1642
|
* Map signal's `mapKeySetEqual` short-circuits register/unregister churn
|
|
1581
1643
|
* without hiding status changes.
|
|
1582
|
-
*
|
|
1583
|
-
* @category common/data/async-registry
|
|
1584
1644
|
*/
|
|
1585
1645
|
declare class CngxAsyncRegistry {
|
|
1586
1646
|
private readonly entriesState;
|
|
@@ -1616,16 +1676,13 @@ declare class CngxAsyncRegistry {
|
|
|
1616
1676
|
* providers: [provideAsyncRegistry()],
|
|
1617
1677
|
* });
|
|
1618
1678
|
* ```
|
|
1619
|
-
*
|
|
1620
|
-
* @category common/data/async-registry
|
|
1679
|
+
* <example-url>/#/common/data/async-registry/http-requests-in-the-registry</example-url>
|
|
1621
1680
|
*/
|
|
1622
1681
|
declare function provideAsyncRegistry(): EnvironmentProviders;
|
|
1623
1682
|
/**
|
|
1624
1683
|
* Returns the ambient {@link CngxAsyncRegistry}, or `null` when the consumer
|
|
1625
1684
|
* did not opt in via {@link provideAsyncRegistry}. Must run in an injection
|
|
1626
1685
|
* context.
|
|
1627
|
-
*
|
|
1628
|
-
* @category common/data/async-registry
|
|
1629
1686
|
*/
|
|
1630
1687
|
declare function injectAsyncRegistry(): CngxAsyncRegistry | null;
|
|
1631
1688
|
|
|
@@ -1646,9 +1703,8 @@ declare function injectAsyncRegistry(): CngxAsyncRegistry | null;
|
|
|
1646
1703
|
*
|
|
1647
1704
|
* @returns A probe over `CngxAsyncRegistry.isAnythingLoading`.
|
|
1648
1705
|
*
|
|
1649
|
-
* @category common/data/async-registry
|
|
1650
1706
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-registry/inject-latency-probe.ts
|
|
1651
|
-
* @since 0.
|
|
1707
|
+
* @since 0.3.0
|
|
1652
1708
|
* @relatedTo provideAsyncRegistry, injectAsyncRegistry, createLatencyProbe
|
|
1653
1709
|
*/
|
|
1654
1710
|
declare function injectLatencyProbe(): CngxLatencyProbe;
|
|
@@ -1656,16 +1712,12 @@ declare function injectLatencyProbe(): CngxLatencyProbe;
|
|
|
1656
1712
|
/**
|
|
1657
1713
|
* Per-request label surfaced in `CngxAsyncRegistry.activeOperations` when the
|
|
1658
1714
|
* request is tracked by `cngxAsyncInterceptor`. Display only, never a key.
|
|
1659
|
-
*
|
|
1660
|
-
* @category common/data/async-registry
|
|
1661
1715
|
*/
|
|
1662
1716
|
declare const CNGX_ASYNC_LABEL: HttpContextToken<string | undefined>;
|
|
1663
1717
|
/**
|
|
1664
1718
|
* Per-request opt-out. When `true`, `cngxAsyncInterceptor` passes the request
|
|
1665
1719
|
* through without registering it - keeps polling / telemetry pings out of the
|
|
1666
1720
|
* aggregate without a global allow-list.
|
|
1667
|
-
*
|
|
1668
|
-
* @category common/data/async-registry
|
|
1669
1721
|
*/
|
|
1670
1722
|
declare const CNGX_ASYNC_SKIP: HttpContextToken<boolean>;
|
|
1671
1723
|
/**
|
|
@@ -1675,8 +1727,7 @@ declare const CNGX_ASYNC_SKIP: HttpContextToken<boolean>;
|
|
|
1675
1727
|
* ```typescript
|
|
1676
1728
|
* this.http.get('/api/users', { context: withAsyncLabel('users') });
|
|
1677
1729
|
* ```
|
|
1678
|
-
*
|
|
1679
|
-
* @category common/data/async-registry
|
|
1730
|
+
* <example-url>/#/common/data/async-registry/label-and-skip-requests</example-url>
|
|
1680
1731
|
*/
|
|
1681
1732
|
declare function withAsyncLabel(label: string, context?: HttpContext): HttpContext;
|
|
1682
1733
|
/**
|
|
@@ -1686,8 +1737,7 @@ declare function withAsyncLabel(label: string, context?: HttpContext): HttpConte
|
|
|
1686
1737
|
* ```typescript
|
|
1687
1738
|
* this.http.get('/api/ping', { context: withAsyncSkip() });
|
|
1688
1739
|
* ```
|
|
1689
|
-
*
|
|
1690
|
-
* @category common/data/async-registry
|
|
1740
|
+
* <example-url>/#/common/data/async-registry/label-and-skip-requests</example-url>
|
|
1691
1741
|
*/
|
|
1692
1742
|
declare function withAsyncSkip(context?: HttpContext): HttpContext;
|
|
1693
1743
|
|
|
@@ -1701,17 +1751,17 @@ declare function withAsyncSkip(context?: HttpContext): HttpContext;
|
|
|
1701
1751
|
* request straight through when no registry is provided - zero behaviour
|
|
1702
1752
|
* change for consumers who do not opt in.
|
|
1703
1753
|
* - Passes through without registering when `CNGX_ASYNC_SKIP` is set.
|
|
1704
|
-
* - Otherwise registers a fresh `createManualState` (set `loading`)
|
|
1705
|
-
*
|
|
1706
|
-
* `unregister`s in a `finalize` that fires on success **and** error (and
|
|
1707
|
-
* 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.
|
|
1708
1759
|
*
|
|
1709
1760
|
* Per-request uid identity (from `CngxAsyncRegistry`) means concurrent requests
|
|
1710
1761
|
* sharing a label never evict one another - completing one leaves the other
|
|
1711
1762
|
* tracked. The interceptor does not swallow errors: `setError` records the
|
|
1712
1763
|
* failure, then the error propagates to the caller unchanged.
|
|
1713
|
-
*
|
|
1714
|
-
* @category common/data/async-registry
|
|
1764
|
+
* <example-url>/#/common/data/async-registry/http-requests-in-the-registry</example-url>
|
|
1715
1765
|
*/
|
|
1716
1766
|
declare const cngxAsyncInterceptor: HttpInterceptorFn;
|
|
1717
1767
|
/**
|
|
@@ -1739,8 +1789,6 @@ declare const cngxAsyncInterceptor: HttpInterceptorFn;
|
|
|
1739
1789
|
* ```ts
|
|
1740
1790
|
* provideHttpClient(withFetch(), withInterceptors([authInterceptor, cngxAsyncInterceptor]))
|
|
1741
1791
|
* ```
|
|
1742
|
-
*
|
|
1743
|
-
* @category common/data/async-registry
|
|
1744
1792
|
*/
|
|
1745
1793
|
declare function provideAsyncHttpObservability(): EnvironmentProviders;
|
|
1746
1794
|
|
|
@@ -1748,7 +1796,10 @@ declare function provideAsyncHttpObservability(): EnvironmentProviders;
|
|
|
1748
1796
|
* Template context for the `*cngxAsync` content template.
|
|
1749
1797
|
* `$implicit` provides the data value, typed via `ngTemplateContextGuard`.
|
|
1750
1798
|
*
|
|
1751
|
-
*
|
|
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.
|
|
1752
1803
|
*/
|
|
1753
1804
|
interface CngxAsyncContext<T> {
|
|
1754
1805
|
/** The data value - bound via `let data` in microsyntax. */
|
|
@@ -1770,6 +1821,14 @@ interface CngxAsyncContext<T> {
|
|
|
1770
1821
|
* directive renders exactly one template, so the error half is flattened
|
|
1771
1822
|
* away here; surface it separately (toast, alert) when it must be visible
|
|
1772
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
|
+
*
|
|
1773
1832
|
* ### Minimal - just content
|
|
1774
1833
|
* ```html
|
|
1775
1834
|
* <ul *cngxAsync="residents; let data">
|
|
@@ -1796,23 +1855,24 @@ interface CngxAsyncContext<T> {
|
|
|
1796
1855
|
* </ng-template>
|
|
1797
1856
|
* ```
|
|
1798
1857
|
*
|
|
1799
|
-
* @category common/data/async-state
|
|
1800
|
-
* @docsKind primary
|
|
1801
1858
|
* @wcag AA
|
|
1802
1859
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async/async.directive.ts
|
|
1803
|
-
* @since 0.
|
|
1860
|
+
* @since 0.3.0
|
|
1804
1861
|
* @relatedTo injectAsyncState, createAsyncState, createManualState
|
|
1805
1862
|
*
|
|
1806
|
-
* <example-url
|
|
1807
|
-
* <example-url
|
|
1808
|
-
* <example-url
|
|
1809
|
-
* <example-url
|
|
1810
|
-
* <example-url
|
|
1811
|
-
* <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
|
|
1812
1870
|
*/
|
|
1813
1871
|
declare class CngxAsync<T> {
|
|
1814
1872
|
private readonly vcr;
|
|
1815
1873
|
private readonly contentTpl;
|
|
1874
|
+
private readonly doc;
|
|
1875
|
+
private readonly injector;
|
|
1816
1876
|
/** The async state to render. */
|
|
1817
1877
|
readonly cngxAsync: _angular_core.InputSignal<CngxAsyncState<T>>;
|
|
1818
1878
|
/** Optional skeleton template shown during first load. */
|
|
@@ -1824,9 +1884,16 @@ declare class CngxAsync<T> {
|
|
|
1824
1884
|
$implicit: unknown;
|
|
1825
1885
|
}> | undefined>;
|
|
1826
1886
|
private readonly view;
|
|
1887
|
+
private readonly slotTemplate;
|
|
1827
1888
|
private currentView;
|
|
1889
|
+
private currentTemplate;
|
|
1828
1890
|
private contentViewRef;
|
|
1891
|
+
private focusSwitchesLeft;
|
|
1829
1892
|
constructor();
|
|
1893
|
+
private renderedRoots;
|
|
1894
|
+
private renderedViewHoldsFocus;
|
|
1895
|
+
private restoreFocus;
|
|
1896
|
+
private firstFocusable;
|
|
1830
1897
|
private updateContentContext;
|
|
1831
1898
|
private renderView;
|
|
1832
1899
|
private renderTemplate;
|
|
@@ -1863,15 +1930,14 @@ declare class CngxAsync<T> {
|
|
|
1863
1930
|
* </cngx-card>
|
|
1864
1931
|
* ```
|
|
1865
1932
|
*
|
|
1866
|
-
* @category common/data/metric
|
|
1867
|
-
* @docsKind primary
|
|
1868
1933
|
* @wcag AA
|
|
1869
1934
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/metric/metric.component.ts
|
|
1870
|
-
* @since 0.
|
|
1935
|
+
* @since 0.3.0
|
|
1871
1936
|
* @relatedTo CngxTrend, CngxCard
|
|
1872
1937
|
*
|
|
1873
|
-
* <example-url
|
|
1874
|
-
* <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
|
|
1875
1941
|
*/
|
|
1876
1942
|
declare class CngxMetric {
|
|
1877
1943
|
private readonly locale;
|
|
@@ -1927,15 +1993,14 @@ declare class CngxMetric {
|
|
|
1927
1993
|
* </cngx-card>
|
|
1928
1994
|
* ```
|
|
1929
1995
|
*
|
|
1930
|
-
* @category common/data/metric
|
|
1931
|
-
* @docsKind primary
|
|
1932
1996
|
* @wcag AA
|
|
1933
1997
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/trend/trend.component.ts
|
|
1934
|
-
* @since 0.
|
|
1998
|
+
* @since 0.3.0
|
|
1935
1999
|
* @relatedTo CngxMetric, CngxCard
|
|
1936
2000
|
*
|
|
1937
|
-
* <example-url
|
|
1938
|
-
* <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
|
|
1939
2004
|
*/
|
|
1940
2005
|
declare class CngxTrend {
|
|
1941
2006
|
private readonly locale;
|
|
@@ -1994,14 +2059,13 @@ type DeltaMode = 'percent' | 'absolute';
|
|
|
1994
2059
|
* <cngx-delta [value]="1240" mode="absolute" [format]="{ maximumFractionDigits: 0 }" />
|
|
1995
2060
|
* ```
|
|
1996
2061
|
*
|
|
1997
|
-
* @category common/data/metric
|
|
1998
|
-
* @docsKind primary
|
|
1999
2062
|
* @wcag AA
|
|
2000
2063
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/delta/delta.component.ts
|
|
2001
|
-
* @since 0.
|
|
2064
|
+
* @since 0.3.0
|
|
2002
2065
|
* @relatedTo CngxTrend, CngxMetric, CngxStat
|
|
2003
2066
|
*
|
|
2004
|
-
* <example-url
|
|
2067
|
+
* <example-url>/#/common/data/delta/sentiment-polarity</example-url>
|
|
2068
|
+
* @axis level atom
|
|
2005
2069
|
*/
|
|
2006
2070
|
declare class CngxDelta {
|
|
2007
2071
|
private readonly locale;
|
|
@@ -2048,8 +2112,7 @@ declare class CngxDelta {
|
|
|
2048
2112
|
* (`CNGX_LOCALE`); the per-instance `label` / `valueTextFormat` inputs still
|
|
2049
2113
|
* win over the bundle.
|
|
2050
2114
|
*
|
|
2051
|
-
* @
|
|
2052
|
-
* @since 0.1.0
|
|
2115
|
+
* @since 0.3.0
|
|
2053
2116
|
*/
|
|
2054
2117
|
interface CngxKpiI18n {
|
|
2055
2118
|
/** `CngxDelta` accessible name: formatted magnitude plus the sentiment word. */
|
|
@@ -2075,29 +2138,25 @@ interface CngxKpiI18n {
|
|
|
2075
2138
|
* app locale; the value is a `Signal`, shared by every reader under one
|
|
2076
2139
|
* injector.
|
|
2077
2140
|
*
|
|
2078
|
-
* @category common/data/i18n
|
|
2079
2141
|
* @wcag AA
|
|
2080
2142
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/shared/kpi-i18n.ts
|
|
2081
|
-
* @since 0.
|
|
2143
|
+
* @since 0.3.0
|
|
2082
2144
|
* @relatedTo CngxDelta, CngxTrend, CngxGoal
|
|
2083
2145
|
*/
|
|
2084
2146
|
declare const CNGX_KPI_I18N: InjectionToken<Signal<CngxKpiI18n>>;
|
|
2085
2147
|
/**
|
|
2086
|
-
*
|
|
2148
|
+
* A label override feature of `provideKpiI18n`.
|
|
2087
2149
|
*
|
|
2088
|
-
* @
|
|
2089
|
-
* @
|
|
2150
|
+
* @since 0.3.0
|
|
2151
|
+
* @relatedTo CNGX_KPI_I18N, withKpiI18nLabels
|
|
2090
2152
|
*/
|
|
2091
|
-
type CngxKpiI18nFeature = (
|
|
2092
|
-
readonly _target: 'i18n';
|
|
2093
|
-
};
|
|
2153
|
+
type CngxKpiI18nFeature = (bundle: Signal<CngxKpiI18n>) => Signal<CngxKpiI18n>;
|
|
2094
2154
|
/**
|
|
2095
2155
|
* Override KPI labels via a partial bundle - unset keys keep the language
|
|
2096
2156
|
* pack's copy, or the English default. Pass a `Signal` of a partial bundle to switch languages at
|
|
2097
2157
|
* runtime.
|
|
2098
2158
|
*
|
|
2099
|
-
* @
|
|
2100
|
-
* @since 0.1.0
|
|
2159
|
+
* @since 0.3.0
|
|
2101
2160
|
*/
|
|
2102
2161
|
declare function withKpiI18nLabels(overrides: Partial<CngxKpiI18n> | Signal<Partial<CngxKpiI18n>>): CngxKpiI18nFeature;
|
|
2103
2162
|
/**
|
|
@@ -2117,16 +2176,14 @@ declare function withKpiI18nLabels(overrides: Partial<CngxKpiI18n> | Signal<Part
|
|
|
2117
2176
|
* });
|
|
2118
2177
|
* ```
|
|
2119
2178
|
*
|
|
2120
|
-
* @
|
|
2121
|
-
* @since 0.1.0
|
|
2179
|
+
* @since 0.3.0
|
|
2122
2180
|
*/
|
|
2123
2181
|
declare function provideKpiI18n(...features: readonly CngxKpiI18nFeature[]): Provider;
|
|
2124
2182
|
/**
|
|
2125
2183
|
* Inject the resolved KPI i18n bundle signal. Read it inside a `computed()`
|
|
2126
2184
|
* or template so a runtime override flip re-derives.
|
|
2127
2185
|
*
|
|
2128
|
-
* @
|
|
2129
|
-
* @since 0.1.0
|
|
2186
|
+
* @since 0.3.0
|
|
2130
2187
|
*/
|
|
2131
2188
|
declare function injectKpiI18n(): Signal<CngxKpiI18n>;
|
|
2132
2189
|
|
|
@@ -2172,9 +2229,8 @@ declare const CNGX_STAT: InjectionToken<CngxStatRegistry>;
|
|
|
2172
2229
|
* Same shape as `CngxPaginate` behind `CNGX_PAGINATOR_HOST`, which
|
|
2173
2230
|
* `CngxPaginator` and `CngxIncrementalList` share the same way.
|
|
2174
2231
|
*
|
|
2175
|
-
* @category common/data/metric
|
|
2176
2232
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat-coordinator.directive.ts
|
|
2177
|
-
* @since 0.
|
|
2233
|
+
* @since 0.3.0
|
|
2178
2234
|
* @relatedTo CngxStat, CNGX_STAT
|
|
2179
2235
|
*/
|
|
2180
2236
|
declare class CngxStatCoordinator implements CngxStatRegistry {
|
|
@@ -2221,14 +2277,13 @@ declare class CngxStatCoordinator implements CngxStatRegistry {
|
|
|
2221
2277
|
* </cngx-stat>
|
|
2222
2278
|
* ```
|
|
2223
2279
|
*
|
|
2224
|
-
* @category common/data/metric
|
|
2225
|
-
* @docsKind primary
|
|
2226
2280
|
* @wcag AA
|
|
2227
2281
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat.component.ts
|
|
2228
|
-
* @since 0.
|
|
2282
|
+
* @since 0.3.0
|
|
2229
2283
|
* @relatedTo CngxMetric, CngxDelta, CngxTrend, CngxStatCoordinator
|
|
2230
2284
|
*
|
|
2231
|
-
* <example-url
|
|
2285
|
+
* <example-url>/#/common/data/stat/composed-kpi</example-url>
|
|
2286
|
+
* @axis level molecule
|
|
2232
2287
|
*/
|
|
2233
2288
|
declare class CngxStat {
|
|
2234
2289
|
/** @internal The shared slot-id brain, applied as a host directive. */
|
|
@@ -2246,8 +2301,7 @@ declare class CngxStat {
|
|
|
2246
2301
|
* Marks the label element of a {@link CngxStat}. Its generated id leads the
|
|
2247
2302
|
* molecule's `aria-labelledby`.
|
|
2248
2303
|
*
|
|
2249
|
-
* @
|
|
2250
|
-
* @since 0.1.0
|
|
2304
|
+
* @since 0.3.0
|
|
2251
2305
|
* @relatedTo CngxStat
|
|
2252
2306
|
*/
|
|
2253
2307
|
declare class CngxStatLabel {
|
|
@@ -2260,8 +2314,7 @@ declare class CngxStatLabel {
|
|
|
2260
2314
|
* Marks the primary value element of a {@link CngxStat} (typically a
|
|
2261
2315
|
* `<cngx-metric>`).
|
|
2262
2316
|
*
|
|
2263
|
-
* @
|
|
2264
|
-
* @since 0.1.0
|
|
2317
|
+
* @since 0.3.0
|
|
2265
2318
|
* @relatedTo CngxStat
|
|
2266
2319
|
*/
|
|
2267
2320
|
declare class CngxStatValue {
|
|
@@ -2274,8 +2327,7 @@ declare class CngxStatValue {
|
|
|
2274
2327
|
* Marks the delta element of a {@link CngxStat} (typically a `<cngx-delta>`
|
|
2275
2328
|
* or `<cngx-trend>`).
|
|
2276
2329
|
*
|
|
2277
|
-
* @
|
|
2278
|
-
* @since 0.1.0
|
|
2330
|
+
* @since 0.3.0
|
|
2279
2331
|
* @relatedTo CngxStat
|
|
2280
2332
|
*/
|
|
2281
2333
|
declare class CngxStatDelta {
|
|
@@ -2288,8 +2340,7 @@ declare class CngxStatDelta {
|
|
|
2288
2340
|
* Marks the caption element of a {@link CngxStat} - the trailing context
|
|
2289
2341
|
* line (e.g. "vs. last quarter").
|
|
2290
2342
|
*
|
|
2291
|
-
* @
|
|
2292
|
-
* @since 0.1.0
|
|
2343
|
+
* @since 0.3.0
|
|
2293
2344
|
* @relatedTo CngxStat
|
|
2294
2345
|
*/
|
|
2295
2346
|
declare class CngxStatCaption {
|
|
@@ -2316,14 +2367,13 @@ declare class CngxStatCaption {
|
|
|
2316
2367
|
* <cngx-goal [value]="q()" [max]="target()" [valueTextFormat]="quotaText" />
|
|
2317
2368
|
* ```
|
|
2318
2369
|
*
|
|
2319
|
-
* @category common/data/metric
|
|
2320
|
-
* @docsKind primary
|
|
2321
2370
|
* @wcag AA
|
|
2322
2371
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/goal/goal.component.ts
|
|
2323
|
-
* @since 0.
|
|
2372
|
+
* @since 0.3.0
|
|
2324
2373
|
* @relatedTo CngxSegmentedProgress, CngxMetric
|
|
2325
2374
|
*
|
|
2326
|
-
* <example-url
|
|
2375
|
+
* <example-url>/#/common/data/goal/quota-attainment</example-url>
|
|
2376
|
+
* @axis level atom
|
|
2327
2377
|
*/
|
|
2328
2378
|
declare class CngxGoal {
|
|
2329
2379
|
private readonly i18n;
|
|
@@ -2361,8 +2411,6 @@ declare class CngxGoal {
|
|
|
2361
2411
|
/**
|
|
2362
2412
|
* I18n interface for recycler SR announcements.
|
|
2363
2413
|
* All methods return the announcement text. No hardcoded strings.
|
|
2364
|
-
*
|
|
2365
|
-
* @category common/data/recycler
|
|
2366
2414
|
*/
|
|
2367
2415
|
interface RecyclerI18n {
|
|
2368
2416
|
/** Announced when new items are loaded (infinite scroll). */
|
|
@@ -2380,26 +2428,22 @@ interface RecyclerI18n {
|
|
|
2380
2428
|
* of the active language pack over English, counts formatted for the app
|
|
2381
2429
|
* locale. Override with `provideRecyclerI18n()`.
|
|
2382
2430
|
*
|
|
2383
|
-
* @category common/data/recycler
|
|
2384
2431
|
* @wcag AA
|
|
2385
2432
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler.ts
|
|
2386
|
-
* @since 0.
|
|
2433
|
+
* @since 0.3.0
|
|
2387
2434
|
*/
|
|
2388
2435
|
declare const CNGX_RECYCLER_I18N: InjectionToken<Signal<RecyclerI18n>>;
|
|
2389
2436
|
/**
|
|
2390
|
-
*
|
|
2437
|
+
* A label override feature of `provideRecyclerI18n`.
|
|
2391
2438
|
*
|
|
2392
|
-
* @
|
|
2439
|
+
* @since 0.3.0
|
|
2440
|
+
* @relatedTo CNGX_RECYCLER_I18N, withRecyclerI18nLabels
|
|
2393
2441
|
*/
|
|
2394
|
-
type CngxRecyclerI18nFeature = (
|
|
2395
|
-
readonly _target: 'i18n';
|
|
2396
|
-
};
|
|
2442
|
+
type CngxRecyclerI18nFeature = (bundle: Signal<RecyclerI18n>) => Signal<RecyclerI18n>;
|
|
2397
2443
|
/**
|
|
2398
2444
|
* Override recycler announcements via a partial bundle - keys you leave out
|
|
2399
2445
|
* keep the language pack's text, or the English default. Pass a `Signal` to
|
|
2400
2446
|
* switch the language at runtime.
|
|
2401
|
-
*
|
|
2402
|
-
* @category common/data/recycler
|
|
2403
2447
|
*/
|
|
2404
2448
|
declare function withRecyclerI18nLabels(overrides: Partial<RecyclerI18n> | Signal<Partial<RecyclerI18n>>): CngxRecyclerI18nFeature;
|
|
2405
2449
|
/**
|
|
@@ -2416,14 +2460,10 @@ declare function withRecyclerI18nLabels(overrides: Partial<RecyclerI18n> | Signa
|
|
|
2416
2460
|
* ),
|
|
2417
2461
|
* ]
|
|
2418
2462
|
* ```
|
|
2419
|
-
*
|
|
2420
|
-
* @category common/data/recycler
|
|
2421
2463
|
*/
|
|
2422
2464
|
declare function provideRecyclerI18n(...features: readonly CngxRecyclerI18nFeature[]): Provider;
|
|
2423
2465
|
/**
|
|
2424
2466
|
* Configuration for {@link injectRecycler}.
|
|
2425
|
-
*
|
|
2426
|
-
* @category common/data/recycler
|
|
2427
2467
|
*/
|
|
2428
2468
|
interface RecyclerConfig {
|
|
2429
2469
|
/** Scroll container. CSS selector, native element, or `ElementRef`. */
|
|
@@ -2454,11 +2494,17 @@ interface RecyclerConfig {
|
|
|
2454
2494
|
/** Debounce for scroll events in ms. Default: 16 (~1 frame). */
|
|
2455
2495
|
scrollDebounce?: number;
|
|
2456
2496
|
/**
|
|
2457
|
-
* Delay before skeletons are shown (ms).
|
|
2458
|
-
* E.g. 300 means `showSkeleton` only becomes `true`
|
|
2459
|
-
* 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.
|
|
2460
2500
|
*/
|
|
2461
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;
|
|
2462
2508
|
/**
|
|
2463
2509
|
* Async state source. When set, the recycler derives skeleton rendering,
|
|
2464
2510
|
* refresh state, and empty state from it - same convention as
|
|
@@ -2474,8 +2520,6 @@ interface RecyclerConfig {
|
|
|
2474
2520
|
/**
|
|
2475
2521
|
* Signal-based virtualizer returned by {@link injectRecycler}.
|
|
2476
2522
|
* All derived values are `computed()` - the system cannot become inconsistent.
|
|
2477
|
-
*
|
|
2478
|
-
* @category common/data/recycler
|
|
2479
2523
|
*/
|
|
2480
2524
|
interface CngxRecycler {
|
|
2481
2525
|
/** Start index (inclusive) of the rendered range, including overscan. */
|
|
@@ -2505,11 +2549,18 @@ interface CngxRecycler {
|
|
|
2505
2549
|
readonly isLoading: Signal<boolean>;
|
|
2506
2550
|
/** `true` during refresh (`state.isRefreshing()`). Data remains visible. */
|
|
2507
2551
|
readonly isRefreshing: Signal<boolean>;
|
|
2508
|
-
/**
|
|
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
|
+
*/
|
|
2509
2557
|
readonly isEmpty: Signal<boolean>;
|
|
2510
2558
|
/** How many skeleton items fit in the viewport: `ceil(clientHeight / estimateSize)`. */
|
|
2511
2559
|
readonly skeletonSlots: Signal<number>;
|
|
2512
|
-
/**
|
|
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
|
+
*/
|
|
2513
2564
|
readonly showSkeleton: Signal<boolean>;
|
|
2514
2565
|
/** First actually visible index (without overscan). For UI display. */
|
|
2515
2566
|
readonly firstVisible: Signal<number>;
|
|
@@ -2610,8 +2661,6 @@ interface CngxRecycler {
|
|
|
2610
2661
|
* state: this.state,
|
|
2611
2662
|
* });
|
|
2612
2663
|
* ```
|
|
2613
|
-
*
|
|
2614
|
-
* @category common/data/recycler
|
|
2615
2664
|
*/
|
|
2616
2665
|
declare function injectRecycler(config: RecyclerConfig): CngxRecycler;
|
|
2617
2666
|
|
|
@@ -2632,18 +2681,16 @@ declare function injectRecycler(config: RecyclerConfig): CngxRecycler;
|
|
|
2632
2681
|
* }
|
|
2633
2682
|
* ```
|
|
2634
2683
|
*
|
|
2635
|
-
* @category common/data/recycler
|
|
2636
|
-
* @docsKind primary
|
|
2637
2684
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/measure.directive.ts
|
|
2638
|
-
* @since 0.
|
|
2685
|
+
* @since 0.3.0
|
|
2639
2686
|
* @relatedTo CngxVirtualItem, CngxRecyclerAnnouncer, injectRecycler
|
|
2640
2687
|
*
|
|
2641
|
-
* <example-url
|
|
2642
|
-
* <example-url
|
|
2643
|
-
* <example-url
|
|
2644
|
-
* <example-url
|
|
2645
|
-
* <example-url
|
|
2646
|
-
* <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>
|
|
2647
2694
|
*/
|
|
2648
2695
|
declare class CngxMeasure {
|
|
2649
2696
|
/** The recycler instance to report measurements to. */
|
|
@@ -2676,19 +2723,17 @@ declare class CngxMeasure {
|
|
|
2676
2723
|
* }
|
|
2677
2724
|
* ```
|
|
2678
2725
|
*
|
|
2679
|
-
* @category common/data/recycler
|
|
2680
|
-
* @docsKind primary
|
|
2681
2726
|
* @wcag AA
|
|
2682
2727
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/virtual-item.directive.ts
|
|
2683
|
-
* @since 0.
|
|
2728
|
+
* @since 0.3.0
|
|
2684
2729
|
* @relatedTo CngxMeasure, CngxRecyclerAnnouncer, injectRecycler
|
|
2685
2730
|
*
|
|
2686
|
-
* <example-url
|
|
2687
|
-
* <example-url
|
|
2688
|
-
* <example-url
|
|
2689
|
-
* <example-url
|
|
2690
|
-
* <example-url
|
|
2691
|
-
* <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>
|
|
2692
2737
|
*/
|
|
2693
2738
|
declare class CngxVirtualItem {
|
|
2694
2739
|
/** The recycler instance providing `ariaSetSize`. */
|
|
@@ -2750,13 +2795,12 @@ declare class CngxVirtualItem {
|
|
|
2750
2795
|
* [style.height.px]="recycler.offsetBefore()"></div>
|
|
2751
2796
|
* ```
|
|
2752
2797
|
*
|
|
2753
|
-
* @category common/data/recycler
|
|
2754
|
-
* @docsKind primary
|
|
2755
2798
|
* @wcag AA
|
|
2756
2799
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-placeholder.directive.ts
|
|
2757
|
-
* @since 0.
|
|
2800
|
+
* @since 0.3.0
|
|
2758
2801
|
* @relatedTo injectRecycler, CngxRecyclerRow, CngxVirtualItem, CngxMeasure
|
|
2759
|
-
* <example-url
|
|
2802
|
+
* <example-url>/#/common/data/recycler/fast-fling-placeholders</example-url>
|
|
2803
|
+
* @axis level molecule
|
|
2760
2804
|
*/
|
|
2761
2805
|
declare class CngxRecyclerPlaceholder {
|
|
2762
2806
|
/**
|
|
@@ -2797,8 +2841,6 @@ declare class CngxRecyclerPlaceholder {
|
|
|
2797
2841
|
*
|
|
2798
2842
|
* The real-row branch (item defined) binds `$implicit` to the item value
|
|
2799
2843
|
* instead; that context is internal and narrowed by `ngTemplateContextGuard`.
|
|
2800
|
-
*
|
|
2801
|
-
* @category common/data/recycler
|
|
2802
2844
|
*/
|
|
2803
2845
|
interface CngxRecyclerRowContext {
|
|
2804
2846
|
/** The absolute dataset index of this slot. Alias of `index`. */
|
|
@@ -2820,15 +2862,11 @@ interface CngxRecyclerRowRealContext<T> {
|
|
|
2820
2862
|
* the cascade: microsyntax `placeholder:` template wins over this, and this wins
|
|
2821
2863
|
* over the built-in imperative `<li>` default. Defaults to `null` (imperative
|
|
2822
2864
|
* default applies).
|
|
2823
|
-
*
|
|
2824
|
-
* @category common/data/recycler
|
|
2825
2865
|
*/
|
|
2826
2866
|
declare const CNGX_RECYCLER_PLACEHOLDER_ROW: InjectionToken<TemplateRef<CngxRecyclerRowContext> | null>;
|
|
2827
2867
|
/**
|
|
2828
2868
|
* Provides an app-wide default placeholder template for every `*cngxRecyclerRow`
|
|
2829
2869
|
* that supplies no `placeholder:` template of its own.
|
|
2830
|
-
*
|
|
2831
|
-
* @category common/data/recycler
|
|
2832
2870
|
*/
|
|
2833
2871
|
declare function provideRecyclerPlaceholderRow(template: TemplateRef<CngxRecyclerRowContext>): Provider;
|
|
2834
2872
|
/**
|
|
@@ -2882,13 +2920,12 @@ declare function provideRecyclerPlaceholderRow(template: TemplateRef<CngxRecycle
|
|
|
2882
2920
|
* </ul>
|
|
2883
2921
|
* ```
|
|
2884
2922
|
*
|
|
2885
|
-
* @category common/data/recycler
|
|
2886
|
-
* @docsKind primary
|
|
2887
2923
|
* @wcag AA
|
|
2888
2924
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-row.directive.ts
|
|
2889
|
-
* @since 0.
|
|
2925
|
+
* @since 0.3.0
|
|
2890
2926
|
* @relatedTo injectRecycler, CngxRecyclerPlaceholder, CngxVirtualItem, CngxMeasure
|
|
2891
|
-
* <example-url
|
|
2927
|
+
* <example-url>/#/common/data/recycler/windowed-data-availability</example-url>
|
|
2928
|
+
* @axis level molecule
|
|
2892
2929
|
*/
|
|
2893
2930
|
declare class CngxRecyclerRow<T> {
|
|
2894
2931
|
private readonly vcr;
|
|
@@ -2935,19 +2972,17 @@ declare class CngxRecyclerRow<T> {
|
|
|
2935
2972
|
* <cngx-recycler-announcer [cngxRecyclerAnnouncer]="recycler" />
|
|
2936
2973
|
* ```
|
|
2937
2974
|
*
|
|
2938
|
-
* @category common/data/recycler
|
|
2939
|
-
* @docsKind primary
|
|
2940
2975
|
* @wcag AA
|
|
2941
2976
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-announcer.component.ts
|
|
2942
|
-
* @since 0.
|
|
2977
|
+
* @since 0.3.0
|
|
2943
2978
|
* @relatedTo CngxMeasure, CngxVirtualItem, injectRecycler, CNGX_RECYCLER_I18N
|
|
2944
2979
|
*
|
|
2945
|
-
* <example-url
|
|
2946
|
-
* <example-url
|
|
2947
|
-
* <example-url
|
|
2948
|
-
* <example-url
|
|
2949
|
-
* <example-url
|
|
2950
|
-
* <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>
|
|
2951
2986
|
*/
|
|
2952
2987
|
declare class CngxRecyclerAnnouncer {
|
|
2953
2988
|
/** The recycler instance providing `announcement()`. */
|
|
@@ -2984,8 +3019,6 @@ declare class CngxRecyclerAnnouncer {
|
|
|
2984
3019
|
* }
|
|
2985
3020
|
* }
|
|
2986
3021
|
* ```
|
|
2987
|
-
*
|
|
2988
|
-
* @category common/data/recycler
|
|
2989
3022
|
*/
|
|
2990
3023
|
declare function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRovingTabindex): void;
|
|
2991
3024
|
|
|
@@ -2996,11 +3029,10 @@ declare function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRov
|
|
|
2996
3029
|
* When the AD directive navigates to an item whose index is not in the
|
|
2997
3030
|
* recycler's rendered range, it sets `pendingHighlight` (via the
|
|
2998
3031
|
* `virtualCount` path). This helper watches that signal and scrolls
|
|
2999
|
-
* the recycler to the target index; AD
|
|
3000
|
-
*
|
|
3001
|
-
*
|
|
3002
|
-
*
|
|
3003
|
-
* 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.
|
|
3004
3036
|
*
|
|
3005
3037
|
* Unlike {@link /projects/common/data/src/recycler/connect-recycler-roving.ts
|
|
3006
3038
|
* connectRecyclerToRoving}, we don't re-focus a DOM element after the
|
|
@@ -3028,8 +3060,6 @@ declare function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRov
|
|
|
3028
3060
|
* }
|
|
3029
3061
|
* }
|
|
3030
3062
|
* ```
|
|
3031
|
-
*
|
|
3032
|
-
* @category common/data/recycler
|
|
3033
3063
|
*/
|
|
3034
3064
|
declare function connectRecyclerToActiveDescendant(recycler: CngxRecycler, ad: CngxActiveDescendant): void;
|
|
3035
3065
|
|
|
@@ -3039,15 +3069,13 @@ declare function connectRecyclerToActiveDescendant(recycler: CngxRecycler, ad: C
|
|
|
3039
3069
|
* when a newer commit supersedes it. Action runtimes (RxJS subscription
|
|
3040
3070
|
* teardown, AbortController abort, plain flag) implement the handle
|
|
3041
3071
|
* however they need.
|
|
3042
|
-
*
|
|
3043
|
-
* @category common/data/commit
|
|
3044
3072
|
*/
|
|
3045
3073
|
interface CngxCommitHandle {
|
|
3046
3074
|
readonly cancel: () => void;
|
|
3047
3075
|
}
|
|
3048
3076
|
/**
|
|
3049
|
-
* Action runner contract. Receives the controller's success/error
|
|
3050
|
-
* routes and returns a cancel handle. The runner is opaque to the
|
|
3077
|
+
* Action runner contract. Receives the controller's success / error /
|
|
3078
|
+
* refused routes and returns a cancel handle. The runner is opaque to the
|
|
3051
3079
|
* controller - it can wrap any async source (Observable, Promise,
|
|
3052
3080
|
* sync value) and any cancellation primitive.
|
|
3053
3081
|
*
|
|
@@ -3056,22 +3084,27 @@ interface CngxCommitHandle {
|
|
|
3056
3084
|
* runner adapts a `CngxStepperCommitAction`); the controller has no
|
|
3057
3085
|
* knowledge of the variant-specific action shape.
|
|
3058
3086
|
*
|
|
3059
|
-
*
|
|
3087
|
+
* `onRefused` is for an action that declined on purpose (a `false`
|
|
3088
|
+
* answer): nothing changed, so the controller stores no error. A runner
|
|
3089
|
+
* whose action shape has no refusal (the select family) never calls it.
|
|
3060
3090
|
*/
|
|
3061
3091
|
type CngxCommitRunner<T> = (handlers: {
|
|
3062
3092
|
readonly onSuccess: (committed: T | undefined) => void;
|
|
3063
3093
|
readonly onError: (err: unknown) => void;
|
|
3094
|
+
readonly onRefused: () => void;
|
|
3064
3095
|
}) => CngxCommitHandle;
|
|
3065
3096
|
/**
|
|
3066
3097
|
* Outcome handlers passed to `controller.begin(...)`. The controller
|
|
3067
|
-
* invokes exactly one of `onSuccess` / `onError`
|
|
3068
|
-
* (unless the commit is superseded, in which case
|
|
3069
|
-
*
|
|
3070
|
-
*
|
|
3098
|
+
* invokes exactly one of `onSuccess` / `onError` / `onRefused` per
|
|
3099
|
+
* commit lifecycle (unless the commit is superseded, in which case none
|
|
3100
|
+
* fires). `onRefused` is optional because only families whose action can
|
|
3101
|
+
* refuse (the stepper) route it; when it is omitted a refusal still
|
|
3102
|
+
* settles the state slot.
|
|
3071
3103
|
*/
|
|
3072
3104
|
interface CngxCommitBeginHandlers<T> {
|
|
3073
3105
|
readonly onSuccess: (committed: T | undefined) => void;
|
|
3074
3106
|
readonly onError: (err: unknown, previous: T | undefined) => void;
|
|
3107
|
+
readonly onRefused?: (previous: T | undefined) => void;
|
|
3075
3108
|
}
|
|
3076
3109
|
/**
|
|
3077
3110
|
* Encapsulated state machine for the async-commit lifecycle shared by
|
|
@@ -3085,11 +3118,18 @@ interface CngxCommitBeginHandlers<T> {
|
|
|
3085
3118
|
* - the "intended value" signal that drives the pending-spinner on
|
|
3086
3119
|
* the specific row / step the user just clicked.
|
|
3087
3120
|
*
|
|
3121
|
+
* Three outcomes settle a commit. Success stores the committed value.
|
|
3122
|
+
* Failure stores the error (`'error'`). A refusal - the action answered
|
|
3123
|
+
* `false` - goes back to `'idle'` through `setIdle()`: the error and the
|
|
3124
|
+
* intended value are cleared, while `data`, `lastUpdated` and
|
|
3125
|
+
* `isFirstLoad()` keep what the last success left, because a refusal
|
|
3126
|
+
* changed nothing. A custom controller (`CNGX_COMMIT_CONTROLLER_FACTORY`)
|
|
3127
|
+
* must hand the runner an `onRefused` route and forward it to
|
|
3128
|
+
* `handlers.onRefused`.
|
|
3129
|
+
*
|
|
3088
3130
|
* The controller is intentionally **not** an Angular service or
|
|
3089
3131
|
* provider. It's a plain factory so it works in any injection context
|
|
3090
3132
|
* (including outside Angular, for headless tests).
|
|
3091
|
-
*
|
|
3092
|
-
* @category common/data/commit
|
|
3093
3133
|
*/
|
|
3094
3134
|
interface CngxCommitController<T> {
|
|
3095
3135
|
/** Read-only async-state view of the commit lifecycle. */
|
|
@@ -3108,11 +3148,20 @@ interface CngxCommitController<T> {
|
|
|
3108
3148
|
* previous runner's cancel handle fires synchronously, and the
|
|
3109
3149
|
* previous outcome callbacks become no-ops if they fire late.
|
|
3110
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
|
+
*
|
|
3111
3160
|
* @param runner variant-specific action runner (closes over the
|
|
3112
3161
|
* action and the intended value)
|
|
3113
3162
|
* @param intended the value the user clicked
|
|
3114
|
-
* @param previous the value to roll back to on error
|
|
3115
|
-
* @param handlers success/error routes - the controller only
|
|
3163
|
+
* @param previous the value to roll back to on error or refusal
|
|
3164
|
+
* @param handlers success/error/refused routes - the controller only
|
|
3116
3165
|
* updates its own state and calls these; it does
|
|
3117
3166
|
* NOT touch external value signals, panel open
|
|
3118
3167
|
* state, or component outputs.
|
|
@@ -3126,8 +3175,10 @@ interface CngxCommitController<T> {
|
|
|
3126
3175
|
* By default the state slot keeps its current status (a destroyed
|
|
3127
3176
|
* host never reads it again). Pass `settle: true` when the surface
|
|
3128
3177
|
* lives on - an explicit back-navigation or reset that supersedes a
|
|
3129
|
-
* pending commit must
|
|
3130
|
-
*
|
|
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`.
|
|
3131
3182
|
*/
|
|
3132
3183
|
cancel(options?: {
|
|
3133
3184
|
readonly settle?: boolean;
|
|
@@ -3138,12 +3189,93 @@ interface CngxCommitController<T> {
|
|
|
3138
3189
|
*
|
|
3139
3190
|
* Plain function, not a class - matches the rest of the repo
|
|
3140
3191
|
* (`createManualState`, `createAsyncState`, `createTransitionTracker`).
|
|
3141
|
-
*
|
|
3142
|
-
*
|
|
3143
|
-
* @category common/data/commit
|
|
3192
|
+
* <example-url>/#/common/data/commit-controller/begin-supersede-cancel</example-url>
|
|
3144
3193
|
*/
|
|
3145
3194
|
declare function createCommitController<T>(): CngxCommitController<T>;
|
|
3146
3195
|
|
|
3196
|
+
/**
|
|
3197
|
+
* How a commit-gated transition (a step change, a tab switch) ended when
|
|
3198
|
+
* it did not land.
|
|
3199
|
+
*
|
|
3200
|
+
* Modelled on the router: a guard answering `false` cancels a navigation
|
|
3201
|
+
* (`NavigationCancel`), only a throw is a `NavigationError`. Here a
|
|
3202
|
+
* `commitAction` answering `false` is `'refused'` - the action decided to
|
|
3203
|
+
* keep the user where they are, nothing failed and no error is stored -
|
|
3204
|
+
* while a throw, a rejected promise or an erroring observable is
|
|
3205
|
+
* `'failed'`. Both roll the transition back; only `'failed'` leaves the
|
|
3206
|
+
* commit state at `'error'`.
|
|
3207
|
+
*
|
|
3208
|
+
* `index` is the target the transition was refused or failed for (the
|
|
3209
|
+
* position the user did not reach). `sequence` is a per-host counter bumped exactly
|
|
3210
|
+
* once per settled refusal or failure, so two identical outcomes in a row
|
|
3211
|
+
* are still two events; a host that only moves the index (a closed tab
|
|
3212
|
+
* before the origin) copies the sequence instead of bumping it, so
|
|
3213
|
+
* nothing downstream treats the shift as a new outcome.
|
|
3214
|
+
*/
|
|
3215
|
+
interface CngxTransitionOutcome {
|
|
3216
|
+
readonly kind: 'refused' | 'failed';
|
|
3217
|
+
readonly index: number;
|
|
3218
|
+
readonly sequence: number;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
/**
|
|
3222
|
+
* Options for {@link createRefusedPhrase}. Every field is a plain
|
|
3223
|
+
* reactive read, so the factory stays independent of any host type.
|
|
3224
|
+
*
|
|
3225
|
+
* @since 0.3.0
|
|
3226
|
+
*/
|
|
3227
|
+
interface CngxRefusedPhraseOptions {
|
|
3228
|
+
/** The host's last refused or failed outcome, `undefined` once cleared. */
|
|
3229
|
+
readonly outcome: () => CngxTransitionOutcome | undefined;
|
|
3230
|
+
/** Commit status of the host; any change spends an armed phrase. */
|
|
3231
|
+
readonly status: () => unknown;
|
|
3232
|
+
/** Active index of the host; any move spends an armed phrase. */
|
|
3233
|
+
readonly activeIndex: () => number | undefined;
|
|
3234
|
+
/**
|
|
3235
|
+
* Copy voiced for a new refusal. Read untracked at arm time only, so a
|
|
3236
|
+
* language switch never re-speaks a phrase that was already voiced.
|
|
3237
|
+
*/
|
|
3238
|
+
readonly copy: () => string;
|
|
3239
|
+
/**
|
|
3240
|
+
* Optional extra expiry trigger: a changed value (compared with
|
|
3241
|
+
* `!==`) spends an armed phrase, e.g. a newer close announcement that
|
|
3242
|
+
* must not be masked by a stale refusal.
|
|
3243
|
+
*/
|
|
3244
|
+
readonly extraSpend?: () => unknown;
|
|
3245
|
+
}
|
|
3246
|
+
/**
|
|
3247
|
+
* Live-region phrase for a refused commit-gated transition (a step
|
|
3248
|
+
* change or tab switch whose `commitAction` answered `false`).
|
|
3249
|
+
*
|
|
3250
|
+
* A refusal settles the commit status back to `'idle'`, so no status
|
|
3251
|
+
* edge can voice it. This phrase arms on each new refused outcome (a new
|
|
3252
|
+
* `sequence`) and is spent by the next commit status change, an
|
|
3253
|
+
* active-index move, a cleared outcome or, when given, a changed
|
|
3254
|
+
* `extraSpend` value. A failed outcome never arms it. Arm wins over
|
|
3255
|
+
* spend in the same flush, so an optimistic rollback that moves the
|
|
3256
|
+
* active index still voices the refusal.
|
|
3257
|
+
*
|
|
3258
|
+
* Built on {@link createAnnouncementPhrase}: fully derived, no `effect`.
|
|
3259
|
+
* The same eager-read caveat applies - read the phrase before branching
|
|
3260
|
+
* on another arm of the live announcement, otherwise a spend transition
|
|
3261
|
+
* can be skipped.
|
|
3262
|
+
*
|
|
3263
|
+
* ```ts
|
|
3264
|
+
* const refusedPhrase = createRefusedPhrase({
|
|
3265
|
+
* outcome: () => presenter.lastOutcome(),
|
|
3266
|
+
* status: () => presenter.commitTransition.current(),
|
|
3267
|
+
* activeIndex: () => presenter.activeIndex(),
|
|
3268
|
+
* copy: () => i18n().commitRefusedGeneric,
|
|
3269
|
+
* });
|
|
3270
|
+
* ```
|
|
3271
|
+
*
|
|
3272
|
+
* @wcag AA
|
|
3273
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/commit/refused-phrase.ts
|
|
3274
|
+
* @since 0.3.0
|
|
3275
|
+
* @relatedTo CngxTransitionOutcome, createAnnouncementPhrase
|
|
3276
|
+
*/
|
|
3277
|
+
declare function createRefusedPhrase(options: CngxRefusedPhraseOptions): Signal<string>;
|
|
3278
|
+
|
|
3147
3279
|
/**
|
|
3148
3280
|
* Factory signature for producing {@link CngxCommitController}
|
|
3149
3281
|
* instances. Consumers override the DI token
|
|
@@ -3151,8 +3283,6 @@ declare function createCommitController<T>(): CngxCommitController<T>;
|
|
|
3151
3283
|
* inject retry-with-backoff, offline queues, telemetry, or any
|
|
3152
3284
|
* other enterprise-specific commit lifecycle - without forking the
|
|
3153
3285
|
* features that consume it (select family, stepper, future wizards).
|
|
3154
|
-
*
|
|
3155
|
-
* @category common/data/commit
|
|
3156
3286
|
*/
|
|
3157
3287
|
type CngxCommitControllerFactory = <T>() => CngxCommitController<T>;
|
|
3158
3288
|
/**
|
|
@@ -3163,23 +3293,49 @@ type CngxCommitControllerFactory = <T>() => CngxCommitController<T>;
|
|
|
3163
3293
|
*
|
|
3164
3294
|
* Symmetrical to `CNGX_SELECT_COMMIT_CONTROLLER_FACTORY`
|
|
3165
3295
|
* (`@cngx/forms/select`); the select-side token's default factory
|
|
3166
|
-
* delegates to this one, so
|
|
3167
|
-
* 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):
|
|
3168
3305
|
*
|
|
3169
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
|
+
*
|
|
3170
3330
|
* bootstrapApplication(App, {
|
|
3171
3331
|
* providers: [
|
|
3172
|
-
* {
|
|
3173
|
-
* provide: CNGX_COMMIT_CONTROLLER_FACTORY,
|
|
3174
|
-
* useValue: <T>() => createRetryingCommitController<T>({ attempts: 3 }),
|
|
3175
|
-
* },
|
|
3332
|
+
* { provide: CNGX_COMMIT_CONTROLLER_FACTORY, useValue: createTimedCommitController },
|
|
3176
3333
|
* ],
|
|
3177
3334
|
* });
|
|
3178
3335
|
* ```
|
|
3179
3336
|
*
|
|
3180
|
-
* @category common/data/commit
|
|
3181
3337
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/commit/commit-controller.token.ts
|
|
3182
|
-
* @since 0.
|
|
3338
|
+
* @since 0.3.0
|
|
3183
3339
|
*/
|
|
3184
3340
|
declare const CNGX_COMMIT_CONTROLLER_FACTORY: InjectionToken<CngxCommitControllerFactory>;
|
|
3185
3341
|
|
|
@@ -3190,8 +3346,6 @@ declare const CNGX_COMMIT_CONTROLLER_FACTORY: InjectionToken<CngxCommitControlle
|
|
|
3190
3346
|
* own event/property shape to a host-agnostic `Signal<number>` /
|
|
3191
3347
|
* `Observable<number>` / getter / setter at the directive boundary. \
|
|
3192
3348
|
* That keeps `@cngx/common/data` independent of `@angular/material`.
|
|
3193
|
-
*
|
|
3194
|
-
* @category common/data/material-bridge
|
|
3195
3349
|
*/
|
|
3196
3350
|
interface CngxMaterialBidirectionalSyncOptions {
|
|
3197
3351
|
/**
|
|
@@ -3234,8 +3388,6 @@ interface CngxMaterialBidirectionalSyncOptions {
|
|
|
3234
3388
|
}
|
|
3235
3389
|
/**
|
|
3236
3390
|
* Handle returned by {@link createMaterialBidirectionalSync}.
|
|
3237
|
-
*
|
|
3238
|
-
* @category common/data/material-bridge
|
|
3239
3391
|
*/
|
|
3240
3392
|
interface CngxMaterialBidirectionalSyncHandle {
|
|
3241
3393
|
/**
|
|
@@ -3300,8 +3452,6 @@ interface CngxMaterialBidirectionalSyncHandle {
|
|
|
3300
3452
|
* and ping-pong against the in-flight navigation (the demo freezes).
|
|
3301
3453
|
* Matching the echo by the value we wrote drops it regardless of where
|
|
3302
3454
|
* the presenter has moved.
|
|
3303
|
-
*
|
|
3304
|
-
* @category common/data/material-bridge
|
|
3305
3455
|
*/
|
|
3306
3456
|
declare function createMaterialBidirectionalSync(opts: CngxMaterialBidirectionalSyncOptions): CngxMaterialBidirectionalSyncHandle;
|
|
3307
3457
|
|
|
@@ -3310,8 +3460,7 @@ declare function createMaterialBidirectionalSync(opts: CngxMaterialBidirectional
|
|
|
3310
3460
|
* `CngxMetric`, `CngxDelta`, `CngxTrend` and `CngxGoal`. Magnitudes reach the
|
|
3311
3461
|
* messages already formatted for the app locale.
|
|
3312
3462
|
*
|
|
3313
|
-
* @
|
|
3314
|
-
* @since 0.1.0
|
|
3463
|
+
* @since 0.3.0
|
|
3315
3464
|
* @relatedTo CNGX_KPI_I18N
|
|
3316
3465
|
*/
|
|
3317
3466
|
interface CngxKpiLanguageSection {
|
|
@@ -3338,8 +3487,7 @@ interface CngxKpiLanguageSection {
|
|
|
3338
3487
|
* The English kpi section: the single source of the KPI atoms' English copy.
|
|
3339
3488
|
* `CNGX_KPI_I18N` defaults to it.
|
|
3340
3489
|
*
|
|
3341
|
-
* @
|
|
3342
|
-
* @since 0.1.0
|
|
3490
|
+
* @since 0.3.0
|
|
3343
3491
|
* @relatedTo CNGX_KPI_I18N
|
|
3344
3492
|
*/
|
|
3345
3493
|
declare const CNGX_KPI_LANGUAGE_EN: CngxKpiLanguageSection;
|
|
@@ -3353,8 +3501,7 @@ declare module '@cngx/core/i18n' {
|
|
|
3353
3501
|
* The recycler section of a {@link CngxLanguagePack}: the screen-reader
|
|
3354
3502
|
* announcements of a virtualised list.
|
|
3355
3503
|
*
|
|
3356
|
-
* @
|
|
3357
|
-
* @since 0.1.0
|
|
3504
|
+
* @since 0.3.0
|
|
3358
3505
|
* @relatedTo CNGX_RECYCLER_I18N
|
|
3359
3506
|
*/
|
|
3360
3507
|
interface CngxRecyclerLanguageSection {
|
|
@@ -3371,8 +3518,7 @@ interface CngxRecyclerLanguageSection {
|
|
|
3371
3518
|
* The English recycler section: the single source of the recycler's English
|
|
3372
3519
|
* copy. `CNGX_RECYCLER_I18N` defaults to it.
|
|
3373
3520
|
*
|
|
3374
|
-
* @
|
|
3375
|
-
* @since 0.1.0
|
|
3521
|
+
* @since 0.3.0
|
|
3376
3522
|
* @relatedTo CNGX_RECYCLER_I18N
|
|
3377
3523
|
*/
|
|
3378
3524
|
declare const CNGX_RECYCLER_LANGUAGE_EN: CngxRecyclerLanguageSection;
|
|
@@ -3382,5 +3528,5 @@ declare module '@cngx/core/i18n' {
|
|
|
3382
3528
|
}
|
|
3383
3529
|
}
|
|
3384
3530
|
|
|
3385
|
-
export { CNGX_ASYNC_LABEL, CNGX_ASYNC_SKIP, CNGX_BUCKET_PAGINATE_HOST, CNGX_COMMIT_CONTROLLER_FACTORY, CNGX_KPI_I18N, CNGX_KPI_LANGUAGE_EN, CNGX_RECYCLER_I18N, CNGX_RECYCLER_LANGUAGE_EN, CNGX_RECYCLER_PLACEHOLDER_ROW, CNGX_STAT, CngxAsync, CngxAsyncBoundary, CngxAsyncRegistry, CngxBucketPaginate, CngxDataSource, CngxDelta, CngxFilter, CngxFilterChip, CngxFilterChips, CngxGoal, CngxMeasure, CngxMetric, CngxPaginate, CngxPaginateResetOn, CngxPaginateRouting, CngxRecyclerAnnouncer, CngxRecyclerPlaceholder, CngxRecyclerRow, CngxSmartDataSource, CngxSort, CngxSortHeader, CngxStat, CngxStatCaption, CngxStatCoordinator, CngxStatDelta, CngxStatLabel, CngxStatValue, CngxTrend, CngxVirtualItem, cngxAsyncInterceptor, connectPaginateEmit, connectPaginateResetOn, connectRecyclerToActiveDescendant, connectRecyclerToRoving, createAsyncState, createCommitController, createForwardedAsyncState, createManualState, createMaterialBidirectionalSync, createSortHeaderState, fromHttpResource, fromResource, injectAsyncRegistry, injectAsyncState, injectDataSource, injectKpiI18n, injectLatencyProbe, injectRecycler, injectSmartDataSource, provideAsyncHttpObservability, provideAsyncRegistry, provideKpiI18n, provideRecyclerI18n, provideRecyclerPlaceholderRow, resolveAsyncView, tapAsyncProgress, tapAsyncState, tapHttpAsyncState, withAsyncLabel, withAsyncSkip, withKpiI18nLabels, withRecyclerI18nLabels };
|
|
3386
|
-
export type { AggregateFailure, AggregateSource, AsyncView, CngxAsyncContext, CngxAsyncOperation, CngxBucket, CngxBucketPaginateHost, CngxBucketPaginateView, CngxCommitBeginHandlers, CngxCommitController, CngxCommitControllerFactory, CngxCommitHandle, CngxCommitRunner, CngxFilterChipContext, CngxKpiI18n, CngxKpiI18nFeature, CngxKpiLanguageSection, CngxMaterialBidirectionalSyncHandle, CngxMaterialBidirectionalSyncOptions, CngxPaginateEmitHandlers, CngxRecycler, CngxRecyclerI18nFeature, CngxRecyclerLanguageSection, CngxRecyclerRowContext, CngxSmartDataSourceOptions, CngxStatRegistry, CngxStatSlotKind, CreateAsyncStateOptions, DeltaDirection, DeltaMode, DeltaPolarity, DeltaSentiment, InjectAsyncStateOptions, ManualAsyncState, MutableAsyncState, ReactiveAsyncState, RecyclerConfig, RecyclerI18n, SortEntry, SortHeaderState };
|
|
3531
|
+
export { CNGX_ASYNC_LABEL, CNGX_ASYNC_SKIP, CNGX_BUCKET_PAGINATE_HOST, CNGX_COMMIT_CONTROLLER_FACTORY, CNGX_KPI_I18N, CNGX_KPI_LANGUAGE_EN, CNGX_RECYCLER_I18N, CNGX_RECYCLER_LANGUAGE_EN, CNGX_RECYCLER_PLACEHOLDER_ROW, CNGX_STAT, CngxAsync, CngxAsyncBoundary, CngxAsyncRegistry, CngxBucketPaginate, CngxDataSource, CngxDelta, CngxFilter, CngxFilterChip, CngxFilterChips, CngxGoal, CngxMeasure, CngxMetric, CngxPaginate, CngxPaginateResetOn, CngxPaginateRouting, CngxRecyclerAnnouncer, CngxRecyclerPlaceholder, CngxRecyclerRow, CngxSmartDataSource, CngxSort, CngxSortHeader, CngxStat, CngxStatCaption, CngxStatCoordinator, CngxStatDelta, CngxStatLabel, CngxStatValue, CngxTrend, CngxVirtualItem, cngxAsyncInterceptor, connectPaginateEmit, connectPaginateResetOn, connectRecyclerToActiveDescendant, connectRecyclerToRoving, createAsyncState, createCommitController, createForwardedAsyncState, createManualState, createMaterialBidirectionalSync, createRefusedPhrase, createSortHeaderState, fromHttpResource, fromResource, injectAsyncRegistry, injectAsyncState, injectDataSource, injectKpiI18n, injectLatencyProbe, injectRecycler, injectSmartDataSource, provideAsyncHttpObservability, provideAsyncRegistry, provideKpiI18n, provideRecyclerI18n, provideRecyclerPlaceholderRow, resolveAsyncView, tapAsyncProgress, tapAsyncState, tapHttpAsyncState, withAsyncLabel, withAsyncSkip, withKpiI18nLabels, withRecyclerI18nLabels };
|
|
3532
|
+
export type { AggregateFailure, AggregateSource, AsyncView, CngxAsyncContext, CngxAsyncOperation, CngxBucket, CngxBucketPaginateHost, CngxBucketPaginateView, CngxCommitBeginHandlers, CngxCommitController, CngxCommitControllerFactory, CngxCommitHandle, CngxCommitRunner, CngxFilterChipContext, CngxKpiI18n, CngxKpiI18nFeature, CngxKpiLanguageSection, CngxMaterialBidirectionalSyncHandle, CngxMaterialBidirectionalSyncOptions, CngxPaginateEmitHandlers, CngxRecycler, CngxRecyclerI18nFeature, CngxRecyclerLanguageSection, CngxRecyclerRowContext, CngxRefusedPhraseOptions, CngxSmartDataSourceOptions, CngxStatRegistry, CngxStatSlotKind, CngxTransitionOutcome, CreateAsyncStateOptions, DeltaDirection, DeltaMode, DeltaPolarity, DeltaSentiment, InjectAsyncStateOptions, ManualAsyncState, MutableAsyncState, ReactiveAsyncState, RecyclerConfig, RecyclerI18n, SortEntry, SortHeaderState };
|