@cngx/common 0.0.1-rc.0 → 0.1.0-rc.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 +13 -16
- package/card/README.md +2 -21
- package/chart/README.md +5 -8
- package/data/README.md +45 -47
- package/dialog/README.md +12 -15
- package/display/README.md +5 -9
- package/fesm2022/cngx-common-a11y.mjs +140 -40
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +157 -69
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +389 -92
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +311 -151
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +167 -29
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +445 -110
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2025 -435
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +188 -31
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +711 -90
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +1258 -60
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +247 -41
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +5 -5
- package/layout/README.md +2 -2
- package/package.json +5 -4
- package/popover/README.md +8 -34
- package/stepper/README.md +49 -8
- package/tabs/README.md +6 -6
- package/theming/components/cngx-async.css +74 -0
- package/theming/components/cngx-backdrop.css +73 -0
- package/theming/components/cngx-badge.css +340 -0
- package/theming/components/cngx-bottom-sheet.css +201 -0
- package/theming/components/cngx-button-toggle.css +99 -0
- package/theming/components/cngx-dialog.css +358 -0
- package/theming/components/cngx-divider.css +145 -0
- package/theming/components/cngx-listbox.css +220 -0
- package/theming/components/cngx-menu.css +371 -0
- package/theming/components/cngx-ripple.css +116 -0
- package/theming/components/cngx-tooltip.css +265 -0
- package/theming/system-tokens.css +24 -0
- package/types/cngx-common-a11y.d.ts +136 -36
- package/types/cngx-common-card.d.ts +137 -22
- package/types/cngx-common-chart.d.ts +337 -40
- package/types/cngx-common-data.d.ts +277 -45
- package/types/cngx-common-dialog.d.ts +162 -22
- package/types/cngx-common-display.d.ts +422 -78
- package/types/cngx-common-interactive.d.ts +1862 -305
- package/types/cngx-common-layout.d.ts +191 -28
- package/types/cngx-common-popover.d.ts +632 -87
- package/types/cngx-common-stepper.d.ts +1110 -38
- package/types/cngx-common-tabs.d.ts +306 -32
- package/types/cngx-common.d.ts +1 -1
- package/README.md +0 -18
|
@@ -7,6 +7,8 @@ import { CngxRovingTabindex, CngxActiveDescendant } from '@cngx/common/a11y';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A single sort entry: the active field key and its direction.
|
|
10
|
+
*
|
|
11
|
+
* @category common/data/sort
|
|
10
12
|
*/
|
|
11
13
|
interface SortEntry {
|
|
12
14
|
active: string;
|
|
@@ -17,7 +19,7 @@ interface SortEntry {
|
|
|
17
19
|
*
|
|
18
20
|
* Supports both **uncontrolled** (internal state) and **controlled** modes.
|
|
19
21
|
* In controlled mode the `cngxSortActive` / `cngxSortDirection` inputs take
|
|
20
|
-
* precedence over the internal state
|
|
22
|
+
* precedence over the internal state - pair with `sortChange` to keep them
|
|
21
23
|
* in sync.
|
|
22
24
|
*
|
|
23
25
|
* When `multiSort` is `true`, holding **Shift** while clicking a sort header
|
|
@@ -25,8 +27,22 @@ interface SortEntry {
|
|
|
25
27
|
* primary one. Shift-clicking an active column cycles it asc → desc → removed.
|
|
26
28
|
* Multi-sort state is always uncontrolled; use `sortsChange` to read it.
|
|
27
29
|
*
|
|
28
|
-
* Consumer connects this to a table or list via a `computed()`
|
|
30
|
+
* Consumer connects this to a table or list via a `computed()` - nothing is
|
|
29
31
|
* injected automatically.
|
|
32
|
+
*
|
|
33
|
+
* @category common/data/sort
|
|
34
|
+
* @docsKind primary
|
|
35
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/sort/sort.directive.ts
|
|
36
|
+
* @since 0.1.0
|
|
37
|
+
* @relatedTo CngxSortHeader, CngxFilter, CngxPaginate, CngxSmartDataSource
|
|
38
|
+
*
|
|
39
|
+
* <example-url>http://localhost:4200/#/common/data/sort/basic</example-url>
|
|
40
|
+
* <example-url>http://localhost:4200/#/common/data/sort/multi-sort</example-url>
|
|
41
|
+
* <example-url>http://localhost:4200/#/common/data/sort/controlled</example-url>
|
|
42
|
+
* <example-url>http://localhost:4200/#/common/data/sort/aria-and-keyboard</example-url>
|
|
43
|
+
// * <example-url>http://localhost:4200/#/common/data/smart-data-source/auto-wired</example-url>
|
|
44
|
+
// * <example-url>http://localhost:4200/#/common/data/smart-data-source/how-it-works-hostdirectives-inject</example-url>
|
|
45
|
+
// * <example-url>http://localhost:4200/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>
|
|
30
46
|
*/
|
|
31
47
|
declare class CngxSort {
|
|
32
48
|
/** Controlled active column. When bound, takes precedence over internal state (single-sort only). */
|
|
@@ -88,7 +104,7 @@ declare class CngxSort {
|
|
|
88
104
|
* Molecule directive for sort-header elements.
|
|
89
105
|
*
|
|
90
106
|
* Apply to any clickable header element. Consumer provides an explicit
|
|
91
|
-
* `[cngxSortRef]` binding
|
|
107
|
+
* `[cngxSortRef]` binding - no ancestor injection, no hidden wiring.
|
|
92
108
|
*
|
|
93
109
|
* In multi-sort mode, Shift+click adds this column to the sort stack.
|
|
94
110
|
* The `priority()` signal returns the 1-based position in the stack
|
|
@@ -105,6 +121,18 @@ declare class CngxSort {
|
|
|
105
121
|
* </button>
|
|
106
122
|
* </div>
|
|
107
123
|
* ```
|
|
124
|
+
*
|
|
125
|
+
* @category common/data/sort
|
|
126
|
+
* @docsKind primary
|
|
127
|
+
* @wcag AA
|
|
128
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/sort/sort-header.directive.ts
|
|
129
|
+
* @since 0.1.0
|
|
130
|
+
* @relatedTo CngxSort, CngxFilter, CngxPaginate
|
|
131
|
+
*
|
|
132
|
+
* <example-url>http://localhost:4200/#/common/data/sort/basic</example-url>
|
|
133
|
+
* <example-url>http://localhost:4200/#/common/data/sort/multi-sort</example-url>
|
|
134
|
+
* <example-url>http://localhost:4200/#/common/data/sort/controlled</example-url>
|
|
135
|
+
* <example-url>http://localhost:4200/#/common/data/sort/aria-and-keyboard</example-url>
|
|
108
136
|
*/
|
|
109
137
|
declare class CngxSortHeader {
|
|
110
138
|
/** The field key this header cell represents. */
|
|
@@ -136,13 +164,13 @@ declare class CngxSortHeader {
|
|
|
136
164
|
*
|
|
137
165
|
* Supports both **uncontrolled** (internal state) and **controlled** modes.
|
|
138
166
|
* In controlled mode the `cngxFilter` input takes precedence over the internal
|
|
139
|
-
* `'default'` predicate
|
|
167
|
+
* `'default'` predicate - pair with `filterChange` to keep it in sync.
|
|
140
168
|
*
|
|
141
|
-
* **Multi-filter**
|
|
169
|
+
* **Multi-filter** - use `addPredicate(key, fn)` / `removePredicate(key)` to
|
|
142
170
|
* maintain a named stack of predicates. All active predicates are **AND-combined**
|
|
143
171
|
* across keys: an item must pass every registered predicate to appear in results.
|
|
144
172
|
*
|
|
145
|
-
* AND vs OR
|
|
173
|
+
* AND vs OR - the directive enforces AND across dimensions (keys). OR logic
|
|
146
174
|
* within a single dimension stays inside the predicate function itself:
|
|
147
175
|
*
|
|
148
176
|
* ```typescript
|
|
@@ -150,17 +178,29 @@ declare class CngxSortHeader {
|
|
|
150
178
|
* filter.addPredicate('location', p => selectedLocations.has(p.location));
|
|
151
179
|
* filter.addPredicate('role', p => selectedRoles.has(p.role));
|
|
152
180
|
*
|
|
153
|
-
* // OR within a dimension: London OR Rome
|
|
181
|
+
* // OR within a dimension: London OR Rome - just put a Set inside one predicate
|
|
154
182
|
* filter.addPredicate('location', p => selectedLocations.has(p.location));
|
|
155
183
|
* ```
|
|
156
184
|
*
|
|
157
185
|
* `setPredicate` / `clear` operate on the `'default'` key and remain fully
|
|
158
186
|
* backward-compatible with single-predicate usage.
|
|
159
187
|
*
|
|
160
|
-
* Consumer connects this to a list via a `computed()`
|
|
188
|
+
* Consumer connects this to a list via a `computed()` - nothing is injected
|
|
161
189
|
* automatically.
|
|
162
190
|
*
|
|
163
191
|
* @typeParam T - The item type the predicate operates on.
|
|
192
|
+
*
|
|
193
|
+
* @category common/data/filter
|
|
194
|
+
* @docsKind primary
|
|
195
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter/filter.directive.ts
|
|
196
|
+
* @since 0.1.0
|
|
197
|
+
* @relatedTo CngxFilterChips, CngxSort, CngxPaginate, CngxSmartDataSource
|
|
198
|
+
*
|
|
199
|
+
* <example-url>http://localhost:4200/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>
|
|
200
|
+
* <example-url>http://localhost:4200/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>
|
|
201
|
+
* <example-url>http://localhost:4200/#/common/data/smart-data-source/auto-wired</example-url>
|
|
202
|
+
* <example-url>http://localhost:4200/#/common/data/smart-data-source/how-it-works-hostdirectives-inject</example-url>
|
|
203
|
+
* <example-url>http://localhost:4200/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>
|
|
164
204
|
*/
|
|
165
205
|
declare class CngxFilter<T = unknown> {
|
|
166
206
|
/** Controlled predicate. When bound, takes precedence over the `'default'` internal predicate. */
|
|
@@ -174,7 +214,7 @@ declare class CngxFilter<T = unknown> {
|
|
|
174
214
|
/** Number of active named predicates (controlled input not counted). */
|
|
175
215
|
readonly activeCount: _angular_core.Signal<number>;
|
|
176
216
|
/**
|
|
177
|
-
* The combined predicate
|
|
217
|
+
* The combined predicate - AND of all active named predicates plus the
|
|
178
218
|
* controlled input (when bound). Returns `null` when nothing is active.
|
|
179
219
|
*/
|
|
180
220
|
readonly predicate: _angular_core.Signal<((value: T) => boolean) | null>;
|
|
@@ -208,18 +248,20 @@ declare class CngxFilter<T = unknown> {
|
|
|
208
248
|
/**
|
|
209
249
|
* Per-chip override slot context. Consumers project an
|
|
210
250
|
* `<ng-template cngxFilterChip let-option let-value="value" let-label="label">`
|
|
211
|
-
* to customize chip body decoration
|
|
251
|
+
* to customize chip body decoration - icons, count badges, colour
|
|
212
252
|
* swatches, anything beyond the default text label.
|
|
213
253
|
*
|
|
214
254
|
* **Decoration-only semantics.** The bridge ALWAYS wraps each option
|
|
215
255
|
* in `<cngx-chip cngxChipInGroup [value]>` itself; the slot only
|
|
216
256
|
* customizes what renders INSIDE that wrapper. Consumers do NOT
|
|
217
|
-
* redeclare selection wiring
|
|
257
|
+
* redeclare selection wiring - it is handled by the bridge so the
|
|
218
258
|
* projected content survives Angular's `*ngTemplateOutlet`
|
|
219
259
|
* lexical-injector semantics (the projected template injects against
|
|
220
260
|
* the consumer's component, NOT the bridge's inner
|
|
221
261
|
* `<cngx-multi-chip-group>`, so a consumer-supplied
|
|
222
262
|
* `cngxChipInGroup` would fail to resolve `CNGX_CHIP_GROUP_HOST`).
|
|
263
|
+
*
|
|
264
|
+
* @category common/data/filter
|
|
223
265
|
*/
|
|
224
266
|
interface CngxFilterChipContext<TItem = unknown, TValue = unknown> {
|
|
225
267
|
readonly $implicit: TItem;
|
|
@@ -233,6 +275,14 @@ interface CngxFilterChipContext<TItem = unknown, TValue = unknown> {
|
|
|
233
275
|
* `<ng-template cngxFilterChip>` to project decoration; the bridge
|
|
234
276
|
* wraps that decoration in `cngxChipInGroup`-bound chip wrappers
|
|
235
277
|
* automatically. Absence falls back to the default text-only label.
|
|
278
|
+
*
|
|
279
|
+
* @category common/data/filter
|
|
280
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter-chips/filter-chips.component.ts
|
|
281
|
+
* @since 0.1.0
|
|
282
|
+
* @relatedTo CngxFilterChips, CngxFilter
|
|
283
|
+
*
|
|
284
|
+
* <example-url>http://localhost:4200/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>
|
|
285
|
+
* <example-url>http://localhost:4200/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>
|
|
236
286
|
*/
|
|
237
287
|
declare class CngxFilterChip<TItem = unknown, TValue = unknown> {
|
|
238
288
|
readonly template: TemplateRef<CngxFilterChipContext<TItem, TValue>>;
|
|
@@ -242,7 +292,7 @@ declare class CngxFilterChip<TItem = unknown, TValue = unknown> {
|
|
|
242
292
|
}
|
|
243
293
|
/**
|
|
244
294
|
* Bridge that connects a multi-select chip strip to a `CngxFilter`
|
|
245
|
-
* predicate via Pillar-1 derivation
|
|
295
|
+
* predicate via Pillar-1 derivation - no `effect()` write-back, no
|
|
246
296
|
* manual sync. The bridge composes `<cngx-multi-chip-group>` for
|
|
247
297
|
* the visible chip strip and registers a single closure-style
|
|
248
298
|
* predicate on the parent `[filterRef]`. Chip toggles update
|
|
@@ -255,7 +305,7 @@ declare class CngxFilterChip<TItem = unknown, TValue = unknown> {
|
|
|
255
305
|
* is intentionally out of scope. Consumers needing a single-select
|
|
256
306
|
* filter wire `<cngx-chip-group>` to a custom predicate themselves.
|
|
257
307
|
*
|
|
258
|
-
* **Sync contract
|
|
308
|
+
* **Sync contract - derivation, not effect.** The bridge calls
|
|
259
309
|
* `filterRef.addPredicate(filterKey, predicateFn)` EXACTLY ONCE
|
|
260
310
|
* during mount (in `afterNextRender`, because `input.required()`
|
|
261
311
|
* cannot be read from the constructor body). `predicateFn` is a
|
|
@@ -263,12 +313,12 @@ declare class CngxFilterChip<TItem = unknown, TValue = unknown> {
|
|
|
263
313
|
* `this.optionValueFn()` on every invocation. Because
|
|
264
314
|
* `CngxFilter.predicate` is itself a `computed()` consumed by
|
|
265
315
|
* downstream filtered lists, each item-evaluation flows through
|
|
266
|
-
* `selectedValues()` in the consumer's reactive context
|
|
316
|
+
* `selectedValues()` in the consumer's reactive context - chip
|
|
267
317
|
* toggles propagate without any `effect()` writing back into the
|
|
268
318
|
* filter.
|
|
269
319
|
*
|
|
270
320
|
* **Empty-selection semantics.** When `selectedValues()` is `[]`,
|
|
271
|
-
* the closure returns `true` for every item
|
|
321
|
+
* the closure returns `true` for every item - equivalent to "no
|
|
272
322
|
* filter applied". The bridge deliberately does NOT call
|
|
273
323
|
* `removePredicate` on empty selection: leaving the predicate
|
|
274
324
|
* registered with a constant-`true` short-circuit is cheaper than
|
|
@@ -276,7 +326,7 @@ declare class CngxFilterChip<TItem = unknown, TValue = unknown> {
|
|
|
276
326
|
* predicate-stack stable (no `predicatesChange` emission churn).
|
|
277
327
|
*
|
|
278
328
|
* **Teardown.** `DestroyRef.onDestroy` calls `removePredicate` only
|
|
279
|
-
* when registration actually happened (`registered` flag)
|
|
329
|
+
* when registration actually happened (`registered` flag) - guards
|
|
280
330
|
* against the case where the component is destroyed before
|
|
281
331
|
* `afterNextRender` fires. The destroy callback reads `filterRef`
|
|
282
332
|
* and `filterKey` lazily so a consumer that re-binds these between
|
|
@@ -299,6 +349,16 @@ declare class CngxFilterChip<TItem = unknown, TValue = unknown> {
|
|
|
299
349
|
* }
|
|
300
350
|
* </ng-container>
|
|
301
351
|
* ```
|
|
352
|
+
*
|
|
353
|
+
* @category common/data/filter
|
|
354
|
+
* @docsKind primary
|
|
355
|
+
* @wcag AA
|
|
356
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter-chips/filter-chips.component.ts
|
|
357
|
+
* @since 0.1.0
|
|
358
|
+
* @relatedTo CngxFilter, CngxFilterChip, CngxMultiChipGroup
|
|
359
|
+
*
|
|
360
|
+
* <example-url>http://localhost:4200/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>
|
|
361
|
+
* <example-url>http://localhost:4200/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>
|
|
302
362
|
*/
|
|
303
363
|
declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
304
364
|
readonly label: _angular_core.InputSignal<string>;
|
|
@@ -326,7 +386,7 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
326
386
|
* primitive id), this fn extracts a stable identity key so chip
|
|
327
387
|
* membership survives re-emissions with fresh references. Forwarded
|
|
328
388
|
* to the inner `<cngx-multi-chip-group>` AND used inside the
|
|
329
|
-
* predicate's `Object.is` comparison. Defaults to identity
|
|
389
|
+
* predicate's `Object.is` comparison. Defaults to identity - works
|
|
330
390
|
* for primitive values.
|
|
331
391
|
*/
|
|
332
392
|
readonly keyFn: _angular_core.InputSignal<(value: TValue) => unknown>;
|
|
@@ -345,7 +405,7 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
345
405
|
* closure invokes it again per LIST item for membership filtering.
|
|
346
406
|
* Both invocations are necessary because option items (the chip
|
|
347
407
|
* pool) and filtered list items (the consumer's filtered data) are
|
|
348
|
-
* separate data paths
|
|
408
|
+
* separate data paths - they happen to share a shape under the
|
|
349
409
|
* Phase-5 single-shape limitation, but the bridge cannot memoise
|
|
350
410
|
* across the two paths without conflating them. Consumers should
|
|
351
411
|
* keep `optionValue` cheap (typically a property lookup); a future
|
|
@@ -371,10 +431,10 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
371
431
|
*
|
|
372
432
|
* Supports both **uncontrolled** (internal state) and **controlled** modes.
|
|
373
433
|
* In controlled mode the `cngxPageIndex` / `cngxPageSize` inputs take precedence
|
|
374
|
-
* over internal state
|
|
434
|
+
* over internal state - pair with `pageChange` / `pageSizeChange` to keep them
|
|
375
435
|
* in sync.
|
|
376
436
|
*
|
|
377
|
-
* Consumer connects this to a list or table via `range()`
|
|
437
|
+
* Consumer connects this to a list or table via `range()` - nothing is injected
|
|
378
438
|
* automatically.
|
|
379
439
|
*
|
|
380
440
|
* // Headless: read range() from a template ref
|
|
@@ -384,6 +444,21 @@ declare class CngxFilterChips<TItem = unknown, TValue = unknown> {
|
|
|
384
444
|
*
|
|
385
445
|
* // With CngxMatPaginator:
|
|
386
446
|
* <cngx-mat-paginator [cngxPaginateRef]="pg" />
|
|
447
|
+
*
|
|
448
|
+
* @category common/data/paginate
|
|
449
|
+
* @docsKind primary
|
|
450
|
+
* @wcag AA
|
|
451
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate.directive.ts
|
|
452
|
+
* @since 0.1.0
|
|
453
|
+
* @relatedTo CngxSort, CngxFilter, CngxSmartDataSource
|
|
454
|
+
*
|
|
455
|
+
* <example-url>http://localhost:4200/#/common/data/data-source/datasource-cngxpaginate-manual-pipeline</example-url>
|
|
456
|
+
* <example-url>http://localhost:4200/#/common/data/data-source/signal-observable-bridge</example-url>
|
|
457
|
+
* <example-url>http://localhost:4200/#/common/data/paginate-list/paginated-list-cngxpaginate-cngxmatpaginator</example-url>
|
|
458
|
+
* <example-url>http://localhost:4200/#/common/data/paginate-list/uncontrolled-mode-zero-class-boilerplate</example-url>
|
|
459
|
+
* <example-url>http://localhost:4200/#/common/data/smart-data-source/auto-wired</example-url>
|
|
460
|
+
* <example-url>http://localhost:4200/#/common/data/smart-data-source/how-it-works-hostdirectives-inject</example-url>
|
|
461
|
+
* <example-url>http://localhost:4200/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>
|
|
387
462
|
*/
|
|
388
463
|
declare class CngxPaginate {
|
|
389
464
|
/** Controlled page index. When bound, takes precedence over internal state. */
|
|
@@ -396,7 +471,7 @@ declare class CngxPaginate {
|
|
|
396
471
|
*/
|
|
397
472
|
readonly total: _angular_core.InputSignal<number>;
|
|
398
473
|
/**
|
|
399
|
-
* Bind an async state
|
|
474
|
+
* Bind an async state - disables navigation while the data source is busy.
|
|
400
475
|
* When set, `isBusy` derives from `state.isBusy()`. Navigation methods
|
|
401
476
|
* (`setPage`, `next`, `previous`, etc.) are no-ops while busy.
|
|
402
477
|
*/
|
|
@@ -416,7 +491,7 @@ declare class CngxPaginate {
|
|
|
416
491
|
/** `true` when on the last page. */
|
|
417
492
|
readonly isLast: _angular_core.Signal<boolean>;
|
|
418
493
|
/**
|
|
419
|
-
* `[start, end]` indices for `Array.slice()`
|
|
494
|
+
* `[start, end]` indices for `Array.slice()` - always in-bounds.
|
|
420
495
|
* Consumer: `items.slice(range()[0], range()[1])`.
|
|
421
496
|
*/
|
|
422
497
|
readonly range: _angular_core.Signal<[number, number]>;
|
|
@@ -450,7 +525,7 @@ declare class CngxPaginate {
|
|
|
450
525
|
* Minimal CDK `DataSource` that bridges a Signal to the CDK table's
|
|
451
526
|
* Observable-based data contract.
|
|
452
527
|
*
|
|
453
|
-
* No sort, filter, or search logic is included
|
|
528
|
+
* No sort, filter, or search logic is included - the consumer builds a
|
|
454
529
|
* `computed()` with any transformations and passes the result here.
|
|
455
530
|
*
|
|
456
531
|
* ```typescript
|
|
@@ -463,6 +538,12 @@ declare class CngxPaginate {
|
|
|
463
538
|
* ```
|
|
464
539
|
*
|
|
465
540
|
* @typeParam T - The row item type.
|
|
541
|
+
*
|
|
542
|
+
* @category common/data/data-source
|
|
543
|
+
* @docsKind primary
|
|
544
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/data-source.ts
|
|
545
|
+
* @since 0.1.0
|
|
546
|
+
* @relatedTo CngxSmartDataSource, CngxSort, CngxFilter, CngxPaginate
|
|
466
547
|
*/
|
|
467
548
|
declare class CngxDataSource<T> extends DataSource<T> {
|
|
468
549
|
private readonly data;
|
|
@@ -479,11 +560,15 @@ declare class CngxDataSource<T> extends DataSource<T> {
|
|
|
479
560
|
* ```typescript
|
|
480
561
|
* readonly dataSource = injectDataSource(this.items);
|
|
481
562
|
* ```
|
|
563
|
+
*
|
|
564
|
+
* @category common/data/data-source
|
|
482
565
|
*/
|
|
483
566
|
declare function injectDataSource<T>(data: Signal<T[]>): CngxDataSource<T>;
|
|
484
567
|
|
|
485
568
|
/**
|
|
486
569
|
* Optional customization for {@link CngxSmartDataSource}.
|
|
570
|
+
*
|
|
571
|
+
* @category common/data/data-source
|
|
487
572
|
*/
|
|
488
573
|
interface CngxSmartDataSourceOptions<T> {
|
|
489
574
|
/**
|
|
@@ -501,7 +586,7 @@ interface CngxSmartDataSourceOptions<T> {
|
|
|
501
586
|
/**
|
|
502
587
|
* A CDK `DataSource` that optionally integrates with `CngxSort`,
|
|
503
588
|
* `CngxFilter`, `CngxSearch`, and `CngxPaginate` present in the injection
|
|
504
|
-
* tree. Each directive is injected optionally
|
|
589
|
+
* tree. Each directive is injected optionally - if absent, that processing
|
|
505
590
|
* step is skipped.
|
|
506
591
|
*
|
|
507
592
|
* Accepts either a plain `Signal<T[]>` or a `CngxAsyncState<T[]>`.
|
|
@@ -513,13 +598,19 @@ interface CngxSmartDataSourceOptions<T> {
|
|
|
513
598
|
* // Plain signal
|
|
514
599
|
* readonly dataSource = injectSmartDataSource(this.items);
|
|
515
600
|
*
|
|
516
|
-
* // With async state
|
|
601
|
+
* // With async state - full UX lifecycle
|
|
517
602
|
* readonly residents = injectAsyncState(() => this.api.getAll(this.filter()));
|
|
518
603
|
* readonly dataSource = injectSmartDataSource(this.residents);
|
|
519
604
|
* // dataSource.isLoading(), dataSource.error(), dataSource.isRefreshing()
|
|
520
605
|
* ```
|
|
521
606
|
*
|
|
522
607
|
* @typeParam T - The row item type.
|
|
608
|
+
*
|
|
609
|
+
* @category common/data/data-source
|
|
610
|
+
* @docsKind primary
|
|
611
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/smart-data-source.ts
|
|
612
|
+
* @since 0.1.0
|
|
613
|
+
* @relatedTo CngxDataSource, CngxSort, CngxFilter, CngxPaginate
|
|
523
614
|
*/
|
|
524
615
|
declare class CngxSmartDataSource<T> extends DataSource<T> {
|
|
525
616
|
private readonly options?;
|
|
@@ -536,8 +627,13 @@ declare class CngxSmartDataSource<T> extends DataSource<T> {
|
|
|
536
627
|
/** Number of items after filtering/searching, before pagination. */
|
|
537
628
|
readonly filteredCount: Signal<number>;
|
|
538
629
|
private readonly processed;
|
|
539
|
-
/**
|
|
540
|
-
|
|
630
|
+
/**
|
|
631
|
+
* The async state source, or `undefined` if constructed from a plain
|
|
632
|
+
* signal. Internal-only - consumers read the derived projections
|
|
633
|
+
* (`isLoading`, `isRefreshing`, `isBusy`, `isFirstLoad`, `error`,
|
|
634
|
+
* `isEmpty`, `filteredCount`) instead of the raw source identity.
|
|
635
|
+
*/
|
|
636
|
+
private readonly asyncState;
|
|
541
637
|
/** `true` during initial data load (skeleton phase). */
|
|
542
638
|
readonly isLoading: Signal<boolean>;
|
|
543
639
|
/** `true` during refresh (data stays visible, loading bar). */
|
|
@@ -565,10 +661,12 @@ declare class CngxSmartDataSource<T> extends DataSource<T> {
|
|
|
565
661
|
* // Plain signal
|
|
566
662
|
* readonly dataSource = injectSmartDataSource(this.items);
|
|
567
663
|
*
|
|
568
|
-
* // With async state
|
|
664
|
+
* // With async state - table shows skeleton, error, loading bar
|
|
569
665
|
* readonly residents = injectAsyncState(() => this.api.getAll());
|
|
570
666
|
* readonly dataSource = injectSmartDataSource(this.residents);
|
|
571
667
|
* ```
|
|
668
|
+
*
|
|
669
|
+
* @category common/data/data-source
|
|
572
670
|
*/
|
|
573
671
|
declare function injectSmartDataSource<T>(source: Signal<T[]> | CngxAsyncState<T[]>, options?: CngxSmartDataSourceOptions<T>): CngxSmartDataSource<T>;
|
|
574
672
|
|
|
@@ -577,6 +675,8 @@ declare function injectSmartDataSource<T>(source: Signal<T[]> | CngxAsyncState<T
|
|
|
577
675
|
*
|
|
578
676
|
* Returned by `createManualState()` — provides imperative setters
|
|
579
677
|
* while the read-side stays the standard `CngxAsyncState` interface.
|
|
678
|
+
*
|
|
679
|
+
* @category common/data/async-state
|
|
580
680
|
*/
|
|
581
681
|
interface ManualAsyncState<T> extends CngxAsyncState<T> {
|
|
582
682
|
/** Set the status directly. */
|
|
@@ -606,6 +706,8 @@ interface ManualAsyncState<T> extends CngxAsyncState<T> {
|
|
|
606
706
|
* this.processState.setSuccess(result);
|
|
607
707
|
* }
|
|
608
708
|
* ```
|
|
709
|
+
*
|
|
710
|
+
* @category common/data/async-state
|
|
609
711
|
*/
|
|
610
712
|
declare function createManualState<T>(): ManualAsyncState<T>;
|
|
611
713
|
|
|
@@ -614,6 +716,8 @@ declare function createManualState<T>(): ManualAsyncState<T>;
|
|
|
614
716
|
*
|
|
615
717
|
* Extends the read-only `CngxAsyncState` with an `execute()` method
|
|
616
718
|
* that runs an async action and manages the full lifecycle.
|
|
719
|
+
*
|
|
720
|
+
* @category common/data/async-state
|
|
617
721
|
*/
|
|
618
722
|
interface MutableAsyncState<T> extends CngxAsyncState<T> {
|
|
619
723
|
/**
|
|
@@ -644,11 +748,15 @@ interface MutableAsyncState<T> extends CngxAsyncState<T> {
|
|
|
644
748
|
* );
|
|
645
749
|
* }
|
|
646
750
|
* ```
|
|
751
|
+
*
|
|
752
|
+
* @category common/data/async-state
|
|
647
753
|
*/
|
|
648
754
|
declare function createAsyncState<T>(): MutableAsyncState<T>;
|
|
649
755
|
|
|
650
756
|
/**
|
|
651
757
|
* Configuration options for `injectAsyncState`.
|
|
758
|
+
*
|
|
759
|
+
* @category common/data/async-state
|
|
652
760
|
*/
|
|
653
761
|
interface InjectAsyncStateOptions {
|
|
654
762
|
/**
|
|
@@ -663,6 +771,8 @@ interface InjectAsyncStateOptions {
|
|
|
663
771
|
*
|
|
664
772
|
* Extends the read-only `CngxAsyncState` with a `refresh()` method
|
|
665
773
|
* to explicitly re-trigger the query.
|
|
774
|
+
*
|
|
775
|
+
* @category common/data/async-state
|
|
666
776
|
*/
|
|
667
777
|
interface ReactiveAsyncState<T> extends CngxAsyncState<T> {
|
|
668
778
|
/** Explicitly re-trigger the query. */
|
|
@@ -683,11 +793,15 @@ interface ReactiveAsyncState<T> extends CngxAsyncState<T> {
|
|
|
683
793
|
* // Caches last result during refresh (refreshing state).
|
|
684
794
|
* // Deduplicates parallel requests.
|
|
685
795
|
* ```
|
|
796
|
+
*
|
|
797
|
+
* @category common/data/async-state
|
|
686
798
|
*/
|
|
687
799
|
declare function injectAsyncState<T>(fn: () => Promise<T> | Observable<T>, options?: InjectAsyncStateOptions): ReactiveAsyncState<T>;
|
|
688
800
|
|
|
689
801
|
/**
|
|
690
802
|
* Possible view states for async content rendering.
|
|
803
|
+
*
|
|
804
|
+
* @category common/data/async-state
|
|
691
805
|
*/
|
|
692
806
|
type AsyncView = 'none' | 'skeleton' | 'content' | 'empty' | 'error' | 'content+error';
|
|
693
807
|
/**
|
|
@@ -705,15 +819,19 @@ type AsyncView = 'none' | 'skeleton' | 'content' | 'empty' | 'error' | 'content+
|
|
|
705
819
|
* | success | * | true | empty |
|
|
706
820
|
* | error | false | * | content+error |
|
|
707
821
|
* | (all other) | * | * | content |
|
|
822
|
+
*
|
|
823
|
+
* @category common/data/async-state
|
|
708
824
|
*/
|
|
709
825
|
declare function resolveAsyncView(status: AsyncStatus, firstLoad: boolean, empty: boolean): AsyncView;
|
|
710
826
|
|
|
711
827
|
/**
|
|
712
828
|
* Template context for the `*cngxAsync` content template.
|
|
713
829
|
* `$implicit` provides the data value, typed via `ngTemplateContextGuard`.
|
|
830
|
+
*
|
|
831
|
+
* @category common/data/async-state
|
|
714
832
|
*/
|
|
715
833
|
interface CngxAsyncContext<T> {
|
|
716
|
-
/** The data value
|
|
834
|
+
/** The data value - bound via `let data` in microsyntax. */
|
|
717
835
|
$implicit: T;
|
|
718
836
|
/** Alias for `$implicit`. */
|
|
719
837
|
cngxAsync: T;
|
|
@@ -729,7 +847,7 @@ interface CngxAsyncContext<T> {
|
|
|
729
847
|
* - **refreshing / loading (with data)** → content template (old data stays visible)
|
|
730
848
|
* - **error (with data)** → content template (old data stays visible)
|
|
731
849
|
*
|
|
732
|
-
* ### Minimal
|
|
850
|
+
* ### Minimal - just content
|
|
733
851
|
* ```html
|
|
734
852
|
* <ul *cngxAsync="residents; let data">
|
|
735
853
|
* @for (r of data; track r.id) { <li>{{ r.name }}</li> }
|
|
@@ -754,6 +872,20 @@ interface CngxAsyncContext<T> {
|
|
|
754
872
|
* <li>Error: {{ err }}</li>
|
|
755
873
|
* </ng-template>
|
|
756
874
|
* ```
|
|
875
|
+
*
|
|
876
|
+
* @category common/data/async-state
|
|
877
|
+
* @docsKind primary
|
|
878
|
+
* @wcag AA
|
|
879
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async/async.directive.ts
|
|
880
|
+
* @since 0.1.0
|
|
881
|
+
* @relatedTo injectAsyncState, createAsyncState, createManualState
|
|
882
|
+
*
|
|
883
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/cngx-async-container-full-control-toast</example-url>
|
|
884
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/cngxasync-one-line</example-url>
|
|
885
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/cngxasync-with-custom-templates</example-url>
|
|
886
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/composition-overlay-container-toast</example-url>
|
|
887
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/createasyncstate-mutation</example-url>
|
|
888
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/injectasyncstate-reactive-query</example-url>
|
|
757
889
|
*/
|
|
758
890
|
declare class CngxAsync<T> {
|
|
759
891
|
private readonly vcr;
|
|
@@ -787,7 +919,7 @@ declare class CngxAsync<T> {
|
|
|
787
919
|
* Uses `Intl.NumberFormat` with the injected `LOCALE_ID` for locale-aware
|
|
788
920
|
* formatting. Null values render as an em-dash.
|
|
789
921
|
*
|
|
790
|
-
* Composable
|
|
922
|
+
* Composable - works inside any card variant, header, body, or standalone.
|
|
791
923
|
*
|
|
792
924
|
* ### Basic
|
|
793
925
|
* ```html
|
|
@@ -806,10 +938,20 @@ declare class CngxAsync<T> {
|
|
|
806
938
|
* <cngx-metric cngxCardBody [value]="75" unit="bpm" />
|
|
807
939
|
* </cngx-card>
|
|
808
940
|
* ```
|
|
941
|
+
*
|
|
942
|
+
* @category common/data/metric
|
|
943
|
+
* @docsKind primary
|
|
944
|
+
* @wcag AA
|
|
945
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/metric/metric.component.ts
|
|
946
|
+
* @since 0.1.0
|
|
947
|
+
* @relatedTo CngxTrend, CngxCard
|
|
948
|
+
*
|
|
949
|
+
* <example-url>http://localhost:4200/#/common/data/metric/inside-a-card</example-url>
|
|
950
|
+
* <example-url>http://localhost:4200/#/common/data/metric/standalone-metrics</example-url>
|
|
809
951
|
*/
|
|
810
952
|
declare class CngxMetric {
|
|
811
953
|
private readonly locale;
|
|
812
|
-
/** Numeric or string value. `null` renders as
|
|
954
|
+
/** Numeric or string value. `null` renders as a placeholder hyphen. */
|
|
813
955
|
readonly value: _angular_core.InputSignal<string | number | null>;
|
|
814
956
|
/** Unit suffix (e.g. "bpm", "h", "%", "kg"). */
|
|
815
957
|
readonly unit: _angular_core.InputSignal<string | undefined>;
|
|
@@ -849,6 +991,16 @@ declare class CngxMetric {
|
|
|
849
991
|
* </header>
|
|
850
992
|
* </cngx-card>
|
|
851
993
|
* ```
|
|
994
|
+
*
|
|
995
|
+
* @category common/data/metric
|
|
996
|
+
* @docsKind primary
|
|
997
|
+
* @wcag AA
|
|
998
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/trend/trend.component.ts
|
|
999
|
+
* @since 0.1.0
|
|
1000
|
+
* @relatedTo CngxMetric, CngxCard
|
|
1001
|
+
*
|
|
1002
|
+
* <example-url>http://localhost:4200/#/common/data/trend/composed-with-metric-in-a-card</example-url>
|
|
1003
|
+
* <example-url>http://localhost:4200/#/common/data/trend/trend-directions</example-url>
|
|
852
1004
|
*/
|
|
853
1005
|
declare class CngxTrend {
|
|
854
1006
|
/** Trend percentage. Positive = up, negative = down, zero = flat. */
|
|
@@ -868,6 +1020,8 @@ declare class CngxTrend {
|
|
|
868
1020
|
/**
|
|
869
1021
|
* I18n interface for recycler SR announcements.
|
|
870
1022
|
* All methods return the announcement text. No hardcoded strings.
|
|
1023
|
+
*
|
|
1024
|
+
* @category common/data/recycler
|
|
871
1025
|
*/
|
|
872
1026
|
interface RecyclerI18n {
|
|
873
1027
|
/** Announced when new items are loaded (infinite scroll). */
|
|
@@ -882,6 +1036,11 @@ interface RecyclerI18n {
|
|
|
882
1036
|
/**
|
|
883
1037
|
* Injection token for recycler SR announcement texts.
|
|
884
1038
|
* Provides English defaults via factory. Override with `provideRecyclerI18n()`.
|
|
1039
|
+
*
|
|
1040
|
+
* @category common/data/recycler
|
|
1041
|
+
* @wcag AA
|
|
1042
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler.ts
|
|
1043
|
+
* @since 0.1.0
|
|
885
1044
|
*/
|
|
886
1045
|
declare const CNGX_RECYCLER_I18N: InjectionToken<RecyclerI18n>;
|
|
887
1046
|
/**
|
|
@@ -895,6 +1054,8 @@ declare const CNGX_RECYCLER_I18N: InjectionToken<RecyclerI18n>;
|
|
|
895
1054
|
* error: () => 'Fehler beim Laden.',
|
|
896
1055
|
* })]
|
|
897
1056
|
* ```
|
|
1057
|
+
*
|
|
1058
|
+
* @category common/data/recycler
|
|
898
1059
|
*/
|
|
899
1060
|
declare function provideRecyclerI18n(i18n: RecyclerI18n): {
|
|
900
1061
|
provide: InjectionToken<RecyclerI18n>;
|
|
@@ -902,12 +1063,14 @@ declare function provideRecyclerI18n(i18n: RecyclerI18n): {
|
|
|
902
1063
|
};
|
|
903
1064
|
/**
|
|
904
1065
|
* Configuration for {@link injectRecycler}.
|
|
1066
|
+
*
|
|
1067
|
+
* @category common/data/recycler
|
|
905
1068
|
*/
|
|
906
1069
|
interface RecyclerConfig {
|
|
907
1070
|
/** Scroll container. CSS selector, native element, or `ElementRef`. */
|
|
908
1071
|
scrollElement: ElementRef | HTMLElement | string;
|
|
909
1072
|
/**
|
|
910
|
-
* Total number of items. Reactive
|
|
1073
|
+
* Total number of items. Reactive - changes on infinite scroll.
|
|
911
1074
|
*
|
|
912
1075
|
* **Important:** For infinite scroll, this is the number of *loaded* items,
|
|
913
1076
|
* not the server-side total. Otherwise the sentinel becomes unreachable.
|
|
@@ -919,22 +1082,22 @@ interface RecyclerConfig {
|
|
|
919
1082
|
overscan?: number;
|
|
920
1083
|
/**
|
|
921
1084
|
* Layout mode. `'list'` (default) uses padding spacers.
|
|
922
|
-
* `'grid'` is Phase 3
|
|
1085
|
+
* `'grid'` is Phase 3 - passing it logs a dev-mode warning and falls back to `'list'`.
|
|
923
1086
|
*/
|
|
924
1087
|
layout?: 'list' | 'grid';
|
|
925
|
-
/** Column count for grid mode. Phase 3
|
|
1088
|
+
/** Column count for grid mode. Phase 3 - ignored in Phase 1. */
|
|
926
1089
|
columns?: number | (() => number);
|
|
927
1090
|
/** Debounce for scroll events in ms. Default: 16 (~1 frame). */
|
|
928
1091
|
scrollDebounce?: number;
|
|
929
1092
|
/**
|
|
930
1093
|
* Delay before skeletons are shown (ms). Default: 0.
|
|
931
|
-
* E.g. 300 means `showSkeleton` only becomes `true` after 300ms
|
|
1094
|
+
* E.g. 300 means `showSkeleton` only becomes `true` after 300ms -
|
|
932
1095
|
* fast loads (< 300ms) never show a skeleton.
|
|
933
1096
|
*/
|
|
934
1097
|
skeletonDelay?: number;
|
|
935
1098
|
/**
|
|
936
1099
|
* Async state source. When set, the recycler derives skeleton rendering,
|
|
937
|
-
* refresh state, and empty state from it
|
|
1100
|
+
* refresh state, and empty state from it - same convention as
|
|
938
1101
|
* `CngxCardGrid`, `CngxTreetable`, `CngxPopoverPanel`, and `CngxDialog`.
|
|
939
1102
|
*/
|
|
940
1103
|
state?: CngxAsyncState<unknown>;
|
|
@@ -946,7 +1109,9 @@ interface RecyclerConfig {
|
|
|
946
1109
|
}
|
|
947
1110
|
/**
|
|
948
1111
|
* Signal-based virtualizer returned by {@link injectRecycler}.
|
|
949
|
-
* All derived values are `computed()`
|
|
1112
|
+
* All derived values are `computed()` - the system cannot become inconsistent.
|
|
1113
|
+
*
|
|
1114
|
+
* @category common/data/recycler
|
|
950
1115
|
*/
|
|
951
1116
|
interface CngxRecycler {
|
|
952
1117
|
/** Start index (inclusive) of the rendered range, including overscan. */
|
|
@@ -1002,7 +1167,7 @@ interface CngxRecycler {
|
|
|
1002
1167
|
* Use in an effect to trigger page loads for windowed/sparse data sources.
|
|
1003
1168
|
*
|
|
1004
1169
|
* Unlike `firstVisible`/`lastVisible` (which exclude overscan), this includes
|
|
1005
|
-
* overscan items
|
|
1170
|
+
* overscan items - all indices in this range may be rendered.
|
|
1006
1171
|
*
|
|
1007
1172
|
* ```typescript
|
|
1008
1173
|
* effect(() => {
|
|
@@ -1021,14 +1186,14 @@ interface CngxRecycler {
|
|
|
1021
1186
|
}>;
|
|
1022
1187
|
/**
|
|
1023
1188
|
* Target index that `scrollToIndex()` is waiting for.
|
|
1024
|
-
* Non-null when the target index exceeds `totalCount`
|
|
1189
|
+
* Non-null when the target index exceeds `totalCount` - consumer
|
|
1025
1190
|
* can show a "Scrolling to item..." indicator or trigger page loads.
|
|
1026
1191
|
* Clears automatically when `totalCount` grows past the target.
|
|
1027
1192
|
*/
|
|
1028
1193
|
readonly pendingTarget: Signal<number | null>;
|
|
1029
1194
|
/**
|
|
1030
1195
|
* Creates a `computed()` slicing items to the visible range.
|
|
1031
|
-
* **Call once in a field initializer**
|
|
1196
|
+
* **Call once in a field initializer** - each call creates a new computed node.
|
|
1032
1197
|
* Do NOT call in templates or methods.
|
|
1033
1198
|
*/
|
|
1034
1199
|
sliced<T>(items: Signal<T[]>): Signal<T[]>;
|
|
@@ -1072,6 +1237,8 @@ interface CngxRecycler {
|
|
|
1072
1237
|
* state: this.state,
|
|
1073
1238
|
* });
|
|
1074
1239
|
* ```
|
|
1240
|
+
*
|
|
1241
|
+
* @category common/data/recycler
|
|
1075
1242
|
*/
|
|
1076
1243
|
declare function injectRecycler(config: RecyclerConfig): CngxRecycler;
|
|
1077
1244
|
|
|
@@ -1091,6 +1258,19 @@ declare function injectRecycler(config: RecyclerConfig): CngxRecycler;
|
|
|
1091
1258
|
* </div>
|
|
1092
1259
|
* }
|
|
1093
1260
|
* ```
|
|
1261
|
+
*
|
|
1262
|
+
* @category common/data/recycler
|
|
1263
|
+
* @docsKind primary
|
|
1264
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/measure.directive.ts
|
|
1265
|
+
* @since 0.1.0
|
|
1266
|
+
* @relatedTo CngxVirtualItem, CngxRecyclerAnnouncer, injectRecycler
|
|
1267
|
+
*
|
|
1268
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/basic-list-fixed-item-height</example-url>
|
|
1269
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/content-visibility-css-only</example-url>
|
|
1270
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/infinite-scroll-recycler</example-url>
|
|
1271
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/scrolltoindex-deep-link</example-url>
|
|
1272
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/variable-heights-cngxmeasure</example-url>
|
|
1273
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>
|
|
1094
1274
|
*/
|
|
1095
1275
|
declare class CngxMeasure {
|
|
1096
1276
|
/** The recycler instance to report measurements to. */
|
|
@@ -1107,10 +1287,10 @@ declare class CngxMeasure {
|
|
|
1107
1287
|
* A11y atom that sets `aria-setsize`, `aria-posinset`, and `data-cngx-recycle-index`
|
|
1108
1288
|
* on each rendered virtual item. Replaces manual ARIA boilerplate.
|
|
1109
1289
|
*
|
|
1110
|
-
* Also provides `data-cngx-recycle-index` for focus tracking
|
|
1290
|
+
* Also provides `data-cngx-recycle-index` for focus tracking - consumers who
|
|
1111
1291
|
* don't use `CngxMeasure` (grid mode, uniform heights) get focus tracking for free.
|
|
1112
1292
|
*
|
|
1113
|
-
* Does NOT set `role`
|
|
1293
|
+
* Does NOT set `role` - the consumer decides (`listitem`, `option`, `treeitem`, `tab`).
|
|
1114
1294
|
*
|
|
1115
1295
|
* ```html
|
|
1116
1296
|
* @for (item of visibleItems(); track item.id; let i = $index) {
|
|
@@ -1121,6 +1301,20 @@ declare class CngxMeasure {
|
|
|
1121
1301
|
* </div>
|
|
1122
1302
|
* }
|
|
1123
1303
|
* ```
|
|
1304
|
+
*
|
|
1305
|
+
* @category common/data/recycler
|
|
1306
|
+
* @docsKind primary
|
|
1307
|
+
* @wcag AA
|
|
1308
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/virtual-item.directive.ts
|
|
1309
|
+
* @since 0.1.0
|
|
1310
|
+
* @relatedTo CngxMeasure, CngxRecyclerAnnouncer, injectRecycler
|
|
1311
|
+
*
|
|
1312
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/basic-list-fixed-item-height</example-url>
|
|
1313
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/content-visibility-css-only</example-url>
|
|
1314
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/infinite-scroll-recycler</example-url>
|
|
1315
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/scrolltoindex-deep-link</example-url>
|
|
1316
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/variable-heights-cngxmeasure</example-url>
|
|
1317
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>
|
|
1124
1318
|
*/
|
|
1125
1319
|
declare class CngxVirtualItem {
|
|
1126
1320
|
/** The recycler instance providing `ariaSetSize`. */
|
|
@@ -1139,11 +1333,25 @@ declare class CngxVirtualItem {
|
|
|
1139
1333
|
* Convenience component that renders the `aria-live="polite"` region
|
|
1140
1334
|
* for recycler SR announcements. Eliminates manual boilerplate.
|
|
1141
1335
|
*
|
|
1142
|
-
* Uses `display: contents`
|
|
1336
|
+
* Uses `display: contents` - no layout impact.
|
|
1143
1337
|
*
|
|
1144
1338
|
* ```html
|
|
1145
1339
|
* <cngx-recycler-announcer [cngxRecyclerAnnouncer]="recycler" />
|
|
1146
1340
|
* ```
|
|
1341
|
+
*
|
|
1342
|
+
* @category common/data/recycler
|
|
1343
|
+
* @docsKind primary
|
|
1344
|
+
* @wcag AA
|
|
1345
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-announcer.component.ts
|
|
1346
|
+
* @since 0.1.0
|
|
1347
|
+
* @relatedTo CngxMeasure, CngxVirtualItem, injectRecycler, CNGX_RECYCLER_I18N
|
|
1348
|
+
*
|
|
1349
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/basic-list-fixed-item-height</example-url>
|
|
1350
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/content-visibility-css-only</example-url>
|
|
1351
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/infinite-scroll-recycler</example-url>
|
|
1352
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/scrolltoindex-deep-link</example-url>
|
|
1353
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/variable-heights-cngxmeasure</example-url>
|
|
1354
|
+
* <example-url>http://localhost:4200/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>
|
|
1147
1355
|
*/
|
|
1148
1356
|
declare class CngxRecyclerAnnouncer {
|
|
1149
1357
|
/** The recycler instance providing `announcement()`. */
|
|
@@ -1180,6 +1388,8 @@ declare class CngxRecyclerAnnouncer {
|
|
|
1180
1388
|
* }
|
|
1181
1389
|
* }
|
|
1182
1390
|
* ```
|
|
1391
|
+
*
|
|
1392
|
+
* @category common/data/recycler
|
|
1183
1393
|
*/
|
|
1184
1394
|
declare function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRovingTabindex): void;
|
|
1185
1395
|
|
|
@@ -1222,6 +1432,8 @@ declare function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRov
|
|
|
1222
1432
|
* }
|
|
1223
1433
|
* }
|
|
1224
1434
|
* ```
|
|
1435
|
+
*
|
|
1436
|
+
* @category common/data/recycler
|
|
1225
1437
|
*/
|
|
1226
1438
|
declare function connectRecyclerToActiveDescendant(recycler: CngxRecycler, ad: CngxActiveDescendant): void;
|
|
1227
1439
|
|
|
@@ -1231,6 +1443,8 @@ declare function connectRecyclerToActiveDescendant(recycler: CngxRecycler, ad: C
|
|
|
1231
1443
|
* when a newer commit supersedes it. Action runtimes (RxJS subscription
|
|
1232
1444
|
* teardown, AbortController abort, plain flag) implement the handle
|
|
1233
1445
|
* however they need.
|
|
1446
|
+
*
|
|
1447
|
+
* @category common/data/commit
|
|
1234
1448
|
*/
|
|
1235
1449
|
interface CngxCommitHandle {
|
|
1236
1450
|
readonly cancel: () => void;
|
|
@@ -1245,6 +1459,8 @@ interface CngxCommitHandle {
|
|
|
1245
1459
|
* `runCommitAction` invokes a `CngxSelectCommitAction<T>`; stepper's
|
|
1246
1460
|
* runner adapts a `CngxStepperCommitAction`); the controller has no
|
|
1247
1461
|
* knowledge of the variant-specific action shape.
|
|
1462
|
+
*
|
|
1463
|
+
* @category common/data/commit
|
|
1248
1464
|
*/
|
|
1249
1465
|
type CngxCommitRunner<T> = (handlers: {
|
|
1250
1466
|
readonly onSuccess: (committed: T | undefined) => void;
|
|
@@ -1254,6 +1470,8 @@ type CngxCommitRunner<T> = (handlers: {
|
|
|
1254
1470
|
* Outcome handlers passed to `controller.begin(...)`. The controller
|
|
1255
1471
|
* invokes exactly one of `onSuccess` / `onError` per commit lifecycle
|
|
1256
1472
|
* (unless the commit is superseded, in which case neither fires).
|
|
1473
|
+
*
|
|
1474
|
+
* @category common/data/commit
|
|
1257
1475
|
*/
|
|
1258
1476
|
interface CngxCommitBeginHandlers<T> {
|
|
1259
1477
|
readonly onSuccess: (committed: T | undefined) => void;
|
|
@@ -1274,6 +1492,8 @@ interface CngxCommitBeginHandlers<T> {
|
|
|
1274
1492
|
* The controller is intentionally **not** an Angular service or
|
|
1275
1493
|
* provider. It's a plain factory so it works in any injection context
|
|
1276
1494
|
* (including outside Angular, for headless tests).
|
|
1495
|
+
*
|
|
1496
|
+
* @category common/data/commit
|
|
1277
1497
|
*/
|
|
1278
1498
|
interface CngxCommitController<T> {
|
|
1279
1499
|
/** Read-only async-state view of the commit lifecycle. */
|
|
@@ -1315,6 +1535,8 @@ interface CngxCommitController<T> {
|
|
|
1315
1535
|
* Plain function, not a class — matches the rest of the repo
|
|
1316
1536
|
* (`createManualState`, `createAsyncState`, `createTransitionTracker`).
|
|
1317
1537
|
* See `reference_api_prefix_convention.md`.
|
|
1538
|
+
*
|
|
1539
|
+
* @category common/data/commit
|
|
1318
1540
|
*/
|
|
1319
1541
|
declare function createCommitController<T>(): CngxCommitController<T>;
|
|
1320
1542
|
|
|
@@ -1323,8 +1545,10 @@ declare function createCommitController<T>(): CngxCommitController<T>;
|
|
|
1323
1545
|
* instances. Consumers override the DI token
|
|
1324
1546
|
* {@link CNGX_COMMIT_CONTROLLER_FACTORY} with a custom factory to
|
|
1325
1547
|
* inject retry-with-backoff, offline queues, telemetry, or any
|
|
1326
|
-
* other enterprise-specific commit lifecycle
|
|
1548
|
+
* other enterprise-specific commit lifecycle - without forking the
|
|
1327
1549
|
* features that consume it (select family, stepper, future wizards).
|
|
1550
|
+
*
|
|
1551
|
+
* @category common/data/commit
|
|
1328
1552
|
*/
|
|
1329
1553
|
type CngxCommitControllerFactory = <T>() => CngxCommitController<T>;
|
|
1330
1554
|
/**
|
|
@@ -1348,6 +1572,10 @@ type CngxCommitControllerFactory = <T>() => CngxCommitController<T>;
|
|
|
1348
1572
|
* ],
|
|
1349
1573
|
* });
|
|
1350
1574
|
* ```
|
|
1575
|
+
*
|
|
1576
|
+
* @category common/data/commit
|
|
1577
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/commit/commit-controller.token.ts
|
|
1578
|
+
* @since 0.1.0
|
|
1351
1579
|
*/
|
|
1352
1580
|
declare const CNGX_COMMIT_CONTROLLER_FACTORY: InjectionToken<CngxCommitControllerFactory>;
|
|
1353
1581
|
|
|
@@ -1359,6 +1587,8 @@ declare const CNGX_COMMIT_CONTROLLER_FACTORY: InjectionToken<CngxCommitControlle
|
|
|
1359
1587
|
* `Observable<number>` / getter / setter at the directive boundary.
|
|
1360
1588
|
* That keeps `@cngx/common/data` independent of `@angular/material`
|
|
1361
1589
|
* (Sheriff Level-2 invariant).
|
|
1590
|
+
*
|
|
1591
|
+
* @category common/data/material-bridge
|
|
1362
1592
|
*/
|
|
1363
1593
|
interface CngxMaterialBidirectionalSyncOptions {
|
|
1364
1594
|
/**
|
|
@@ -1453,6 +1683,8 @@ interface CngxMaterialBidirectionalSyncOptions {
|
|
|
1453
1683
|
* with the regular presenter→Material effect (the read-equality guard
|
|
1454
1684
|
* at the effect site suppresses a duplicate write when the presenter
|
|
1455
1685
|
* later changes to the same value).
|
|
1686
|
+
*
|
|
1687
|
+
* @category common/data/material-bridge
|
|
1456
1688
|
*/
|
|
1457
1689
|
declare function createMaterialBidirectionalSync(opts: CngxMaterialBidirectionalSyncOptions): void;
|
|
1458
1690
|
|