@cngx/common 0.0.1-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/LICENSE +21 -0
- package/README.md +18 -0
- package/a11y/README.md +77 -0
- package/card/README.md +79 -0
- package/chart/README.md +31 -0
- package/data/README.md +883 -0
- package/dialog/README.md +84 -0
- package/display/README.md +30 -0
- package/fesm2022/cngx-common-a11y.mjs +1260 -0
- package/fesm2022/cngx-common-a11y.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +765 -0
- package/fesm2022/cngx-common-card.mjs.map +1 -0
- package/fesm2022/cngx-common-chart.mjs +2943 -0
- package/fesm2022/cngx-common-chart.mjs.map +1 -0
- package/fesm2022/cngx-common-data.mjs +2886 -0
- package/fesm2022/cngx-common-data.mjs.map +1 -0
- package/fesm2022/cngx-common-dialog.mjs +1366 -0
- package/fesm2022/cngx-common-dialog.mjs.map +1 -0
- package/fesm2022/cngx-common-display.mjs +1603 -0
- package/fesm2022/cngx-common-display.mjs.map +1 -0
- package/fesm2022/cngx-common-interactive.mjs +8185 -0
- package/fesm2022/cngx-common-interactive.mjs.map +1 -0
- package/fesm2022/cngx-common-layout.mjs +1335 -0
- package/fesm2022/cngx-common-layout.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1200 -0
- package/fesm2022/cngx-common-popover.mjs.map +1 -0
- package/fesm2022/cngx-common-stepper.mjs +1350 -0
- package/fesm2022/cngx-common-stepper.mjs.map +1 -0
- package/fesm2022/cngx-common-tabs.mjs +1551 -0
- package/fesm2022/cngx-common-tabs.mjs.map +1 -0
- package/fesm2022/cngx-common.mjs +34 -0
- package/fesm2022/cngx-common.mjs.map +1 -0
- package/interactive/README.md +211 -0
- package/layout/README.md +117 -0
- package/package.json +100 -0
- package/popover/README.md +218 -0
- package/stepper/README.md +102 -0
- package/tabs/README.md +32 -0
- package/types/cngx-common-a11y.d.ts +616 -0
- package/types/cngx-common-card.d.ts +413 -0
- package/types/cngx-common-chart.d.ts +1081 -0
- package/types/cngx-common-data.d.ts +1460 -0
- package/types/cngx-common-dialog.d.ts +772 -0
- package/types/cngx-common-display.d.ts +1136 -0
- package/types/cngx-common-interactive.d.ts +5013 -0
- package/types/cngx-common-layout.d.ts +737 -0
- package/types/cngx-common-popover.d.ts +520 -0
- package/types/cngx-common-stepper.d.ts +982 -0
- package/types/cngx-common-tabs.d.ts +1237 -0
- package/types/cngx-common.d.ts +13 -0
|
@@ -0,0 +1,982 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Signal, InjectionToken, TemplateRef, EnvironmentProviders, Provider } from '@angular/core';
|
|
3
|
+
import { CngxAsyncState, StatusTransition } from '@cngx/core/utils';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { CngxErrorAggregatorContract } from '@cngx/common/interactive';
|
|
6
|
+
import { CngxCommitController } from '@cngx/common/data';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Status enum for a single step. Driven by the presenter's commit-controller
|
|
10
|
+
* lifecycle plus the optional `errorAggregator`.
|
|
11
|
+
*/
|
|
12
|
+
type CngxStepStatus = 'idle' | 'pending' | 'success' | 'error' | 'disabled' | 'busy';
|
|
13
|
+
/**
|
|
14
|
+
* Step-tree node. Either a terminal `step` (has its own panel) or a
|
|
15
|
+
* `group` carrying nested children. Discriminated by `kind`.
|
|
16
|
+
*/
|
|
17
|
+
interface CngxStepNode {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly kind: 'step' | 'group';
|
|
20
|
+
readonly label: Signal<string>;
|
|
21
|
+
readonly disabled: Signal<boolean>;
|
|
22
|
+
/** Live step status. Reactive to commit-controller + aggregator. */
|
|
23
|
+
readonly state: Signal<CngxStepStatus>;
|
|
24
|
+
/** Optional error aggregator signal for badge / SR phrasing. */
|
|
25
|
+
readonly errorAggregator?: Signal<CngxErrorAggregatorContract | undefined>;
|
|
26
|
+
/** Direct children for group nodes; empty for step nodes. */
|
|
27
|
+
readonly children: readonly CngxStepNode[];
|
|
28
|
+
/** DFS depth (root = 0). */
|
|
29
|
+
readonly depth: number;
|
|
30
|
+
/** Parent group id, or `null` for root. */
|
|
31
|
+
readonly parentId: string | null;
|
|
32
|
+
/** Flat-projection index inside `flatSteps()`. -1 for groups. */
|
|
33
|
+
readonly flatIndex: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Handle a `CngxStep` / `CngxStepGroup` passes to its host. The host owns
|
|
37
|
+
* the registry; the atom owns its own state slot.
|
|
38
|
+
*
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
interface CngxStepRegistration {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly kind: 'step' | 'group';
|
|
44
|
+
readonly label: Signal<string>;
|
|
45
|
+
readonly disabled: Signal<boolean>;
|
|
46
|
+
readonly state: Signal<CngxStepStatus>;
|
|
47
|
+
readonly errorAggregator?: Signal<CngxErrorAggregatorContract | undefined>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Contract atoms see via {@link CNGX_STEPPER_HOST}. Mirrors the
|
|
51
|
+
* directive's surface 1:1 — atoms never reach the concrete class.
|
|
52
|
+
*/
|
|
53
|
+
interface CngxStepperHost {
|
|
54
|
+
readonly stepTree: Signal<readonly CngxStepNode[]>;
|
|
55
|
+
readonly flatSteps: Signal<readonly CngxStepNode[]>;
|
|
56
|
+
readonly activeStepIndex: Signal<number>;
|
|
57
|
+
readonly activeStepId: Signal<string | null>;
|
|
58
|
+
readonly linear: Signal<boolean>;
|
|
59
|
+
readonly orientation: Signal<'horizontal' | 'vertical'>;
|
|
60
|
+
readonly commitState: CngxAsyncState<number | undefined>;
|
|
61
|
+
readonly intendedStepIndex: Signal<number | undefined>;
|
|
62
|
+
/**
|
|
63
|
+
* Reactive current/previous pair for the commit-state status. The
|
|
64
|
+
* organism's `<span cngxLiveRegion>` reads this tracker on every
|
|
65
|
+
* `pending → success / error` transition. Allocated once per
|
|
66
|
+
* presenter — consumers MUST read this rather than calling
|
|
67
|
+
* `createTransitionTracker` locally so the `linkedSignal` is shared.
|
|
68
|
+
*/
|
|
69
|
+
readonly commitTransition: StatusTransition;
|
|
70
|
+
/**
|
|
71
|
+
* Index of the most recently refused commit target, or `undefined`
|
|
72
|
+
* when no rejection is pending. Set by the rejection arm of
|
|
73
|
+
* `select()`; cleared by a successful re-pick of the same target
|
|
74
|
+
* or via {@link clearLastFailed}. Drives strip rejection decoration
|
|
75
|
+
* and the `commitRolledBackTo` chain in `liveAnnouncement`.
|
|
76
|
+
*/
|
|
77
|
+
readonly lastFailedIndex: Signal<number | undefined>;
|
|
78
|
+
/**
|
|
79
|
+
* Origin captured at commit-window open — the safe-harbour the user
|
|
80
|
+
* is returned to on optimistic rollback. Resolves the origin label
|
|
81
|
+
* for the `commitRolledBackTo(originLabel)` phrase. Cleared on
|
|
82
|
+
* success; retained on rejection through the persistence window.
|
|
83
|
+
*/
|
|
84
|
+
readonly originIndexDuringCommit: Signal<number | undefined>;
|
|
85
|
+
select(index: number): void;
|
|
86
|
+
selectNext(): void;
|
|
87
|
+
selectPrevious(): void;
|
|
88
|
+
selectById(id: string): void;
|
|
89
|
+
reset(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Drop the persisted {@link lastFailedIndex} flag. Idempotent;
|
|
92
|
+
* safe to wire to a Dismiss button or aggregator-cleared.
|
|
93
|
+
*/
|
|
94
|
+
clearLastFailed(): void;
|
|
95
|
+
register(handle: CngxStepRegistration, parentId?: string | null): void;
|
|
96
|
+
unregister(id: string): void;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* DI token carrying the presenter's contract to atoms + organism shells.
|
|
100
|
+
* Atoms inject `optional: true` and either register here or fall through
|
|
101
|
+
* {@link CNGX_STEP_GROUP_HOST} when nested in a group.
|
|
102
|
+
*/
|
|
103
|
+
declare const CNGX_STEPPER_HOST: InjectionToken<CngxStepperHost>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Async-commit action for stepper transitions. Receives the origin
|
|
107
|
+
* and target indices; resolves `true` to advance, `false` to refuse.
|
|
108
|
+
* The `Observable | Promise | sync` union matches every cngx
|
|
109
|
+
* commit-action signature.
|
|
110
|
+
*/
|
|
111
|
+
type CngxStepperCommitAction = (fromIndex: number, toIndex: number) => boolean | Promise<boolean> | Observable<boolean>;
|
|
112
|
+
/**
|
|
113
|
+
* Stepper presenter — the brain of every stepper / wizard flow.
|
|
114
|
+
* Holds the active-step model, registry, linear policy, orientation,
|
|
115
|
+
* and commit-controller lifecycle. Provides {@link CNGX_STEPPER_HOST}
|
|
116
|
+
* for atom registration and {@link CNGX_STATEFUL} so transition
|
|
117
|
+
* bridges (`<cngx-toast-on />`, `<cngx-banner-on />`) compose without
|
|
118
|
+
* explicit `[state]` wiring.
|
|
119
|
+
*
|
|
120
|
+
* Sheriff: common Level 2. Pure directive — zero template, zero CSS.
|
|
121
|
+
* Level-4 organisms compose this via `hostDirectives`.
|
|
122
|
+
*/
|
|
123
|
+
declare class CngxStepperPresenter implements CngxStepperHost {
|
|
124
|
+
private readonly config;
|
|
125
|
+
readonly activeStepIndex: i0.ModelSignal<number>;
|
|
126
|
+
readonly linearInput: i0.InputSignal<boolean | undefined>;
|
|
127
|
+
readonly linear: Signal<boolean>;
|
|
128
|
+
readonly orientationInput: i0.InputSignal<"horizontal" | "vertical" | undefined>;
|
|
129
|
+
readonly orientation: Signal<"horizontal" | "vertical">;
|
|
130
|
+
readonly commitAction: i0.InputSignal<CngxStepperCommitAction | null>;
|
|
131
|
+
readonly commitModeInput: i0.InputSignal<"optimistic" | "pessimistic" | undefined>;
|
|
132
|
+
readonly commitMode: Signal<"optimistic" | "pessimistic">;
|
|
133
|
+
private readonly genericFactory;
|
|
134
|
+
private readonly commitController;
|
|
135
|
+
private readonly commitHandler;
|
|
136
|
+
/** Producer surface for the `CNGX_STATEFUL` bridge contract. */
|
|
137
|
+
readonly state: CngxAsyncState<number | undefined>;
|
|
138
|
+
/**
|
|
139
|
+
* Step index the user is committing to. Tracked separately from
|
|
140
|
+
* `state.data()` because the AsyncState data slot only updates on
|
|
141
|
+
* success. Drives per-step `aria-busy` in the organism.
|
|
142
|
+
*/
|
|
143
|
+
readonly intendedStepIndex: Signal<number | undefined>;
|
|
144
|
+
/**
|
|
145
|
+
* Reactive current/previous pair for the commit-state status. Skin
|
|
146
|
+
* sub-components mount a `<span cngxLiveRegion>` reading this
|
|
147
|
+
* tracker. Allocated once per presenter — the underlying
|
|
148
|
+
* `linkedSignal` is shared across all consumers.
|
|
149
|
+
*/
|
|
150
|
+
readonly commitTransition: StatusTransition;
|
|
151
|
+
private readonly lastFailedIndexState;
|
|
152
|
+
private readonly originIndexDuringCommitState;
|
|
153
|
+
/** {@inheritDoc CngxStepperHost.lastFailedIndex} */
|
|
154
|
+
readonly lastFailedIndex: Signal<number | undefined>;
|
|
155
|
+
/** {@inheritDoc CngxStepperHost.originIndexDuringCommit} */
|
|
156
|
+
readonly originIndexDuringCommit: Signal<number | undefined>;
|
|
157
|
+
private readonly treeState;
|
|
158
|
+
readonly stepTree: Signal<readonly CngxStepNode[]>;
|
|
159
|
+
readonly flatSteps: Signal<readonly CngxStepNode[]>;
|
|
160
|
+
/**
|
|
161
|
+
* Step-only flat projection — terminal nodes in DFS order.
|
|
162
|
+
* Structural-equal via `flatStepsEqual` so downstream computeds
|
|
163
|
+
* don't cascade on shape-stable re-emits. Single source for every
|
|
164
|
+
* `select*` / `clamp` / `activeStepId` lookup — never re-filter
|
|
165
|
+
* `flatSteps()`.
|
|
166
|
+
*/
|
|
167
|
+
private readonly stepsOnly;
|
|
168
|
+
private readonly clampedIndex;
|
|
169
|
+
readonly activeStepId: Signal<string | null>;
|
|
170
|
+
readonly commitState: CngxAsyncState<number | undefined>;
|
|
171
|
+
private readonly registry;
|
|
172
|
+
private readonly insertionOrder;
|
|
173
|
+
register(handle: CngxStepRegistration, parentId?: string | null): void;
|
|
174
|
+
unregister(id: string): void;
|
|
175
|
+
private rebuildTree;
|
|
176
|
+
/** {@inheritDoc CngxStepperHost.clearLastFailed} */
|
|
177
|
+
clearLastFailed(): void;
|
|
178
|
+
select(index: number): void;
|
|
179
|
+
selectNext(): void;
|
|
180
|
+
selectPrevious(): void;
|
|
181
|
+
selectById(id: string): void;
|
|
182
|
+
reset(): void;
|
|
183
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepperPresenter, never>;
|
|
184
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepperPresenter, "[cngxStepper]", ["cngxStepper"], { "activeStepIndex": { "alias": "activeStepIndex"; "required": false; "isSignal": true; }; "linearInput": { "alias": "linear"; "required": false; "isSignal": true; }; "orientationInput": { "alias": "orientation"; "required": false; "isSignal": true; }; "commitAction": { "alias": "commitAction"; "required": false; "isSignal": true; }; "commitModeInput": { "alias": "commitMode"; "required": false; "isSignal": true; }; }, { "activeStepIndex": "activeStepIndexChange"; }, never, never, true, never>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Contract a `CngxStep` sees when it injects a parent group via
|
|
189
|
+
* {@link CNGX_STEP_GROUP_HOST}. Mirrors the presenter's `register` /
|
|
190
|
+
* `unregister` so atoms stay agnostic of root vs. nested host.
|
|
191
|
+
*
|
|
192
|
+
* Surface is registration-only — `id` and `aggregatedStatus` are
|
|
193
|
+
* concrete-class details, not part of the token contract.
|
|
194
|
+
*/
|
|
195
|
+
interface CngxStepGroupHost {
|
|
196
|
+
register(handle: CngxStepRegistration): void;
|
|
197
|
+
unregister(id: string): void;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* DI token providing a `CngxStepGroup`'s contract to nested `CngxStep` atoms.
|
|
201
|
+
* Steps inject this `optional: true` and fall back to {@link CNGX_STEPPER_HOST}.
|
|
202
|
+
*/
|
|
203
|
+
declare const CNGX_STEP_GROUP_HOST: InjectionToken<CngxStepGroupHost>;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Context delivered to `*cngxStepLabel` templates. Gives typed access
|
|
207
|
+
* to live step state without reaching into the host token.
|
|
208
|
+
*
|
|
209
|
+
* `index` is 1-based in the step-only flat projection (groups excluded).
|
|
210
|
+
* `active` reflects `presenter.activeStepId`; `busy` mirrors
|
|
211
|
+
* `presenter.intendedStepIndex` matching this step; `disabled` reads
|
|
212
|
+
* `node.disabled()`.
|
|
213
|
+
*/
|
|
214
|
+
interface CngxStepLabelContext {
|
|
215
|
+
readonly node: CngxStepNode;
|
|
216
|
+
readonly index: number;
|
|
217
|
+
readonly active: boolean;
|
|
218
|
+
readonly busy: boolean;
|
|
219
|
+
readonly disabled: boolean;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Context delivered to `*cngxStepContent` templates. Mirrors
|
|
223
|
+
* {@link CngxStepLabelContext} — content templates need the same
|
|
224
|
+
* derivations to gate inner controls on `disabled` / `busy`.
|
|
225
|
+
*/
|
|
226
|
+
interface CngxStepContentContext {
|
|
227
|
+
readonly node: CngxStepNode;
|
|
228
|
+
readonly index: number;
|
|
229
|
+
readonly active: boolean;
|
|
230
|
+
readonly busy: boolean;
|
|
231
|
+
readonly disabled: boolean;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Contract Level-4 organisms (and consumer-authored stepper skins)
|
|
235
|
+
* consume to render the panel body. Narrower than the presenter's
|
|
236
|
+
* full interface — just enough to project label / content templates
|
|
237
|
+
* and react to active-step changes.
|
|
238
|
+
*/
|
|
239
|
+
interface CngxStepPanelHost {
|
|
240
|
+
readonly flatSteps: Signal<readonly CngxStepNode[]>;
|
|
241
|
+
readonly activeStepIndex: Signal<number>;
|
|
242
|
+
readonly activeStepId: Signal<string | null>;
|
|
243
|
+
/** Resolves a step id to its `*cngxStepLabel` template (consumer-supplied). */
|
|
244
|
+
labelTemplateFor(id: string): TemplateRef<CngxStepLabelContext> | null;
|
|
245
|
+
/** Resolves a step id to its `*cngxStepContent` template (consumer-supplied). */
|
|
246
|
+
contentTemplateFor(id: string): TemplateRef<CngxStepContentContext> | null;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* DI token providing the rendering-surface contract to organism shells
|
|
250
|
+
* (`<cngx-stepper>`, `<cngx-mat-stepper>`) and consumer-authored skins.
|
|
251
|
+
*/
|
|
252
|
+
declare const CNGX_STEP_PANEL_HOST: InjectionToken<CngxStepPanelHost>;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Structural equality for `flatSteps`. Adds `flatIndex` (shifts when
|
|
256
|
+
* a sibling is inserted) on top of the {@link stepTreeEqual} fields.
|
|
257
|
+
*
|
|
258
|
+
* Use only on projections where every step carries a real
|
|
259
|
+
* DFS-assigned `flatIndex` and `depth` — for `-1` placeholders, use
|
|
260
|
+
* {@link stepNodesEqual}.
|
|
261
|
+
*
|
|
262
|
+
* @internal Exported from `public-api.ts` so the cngx-stepper and
|
|
263
|
+
* cngx-mat-stepper organisms share the comparator across the
|
|
264
|
+
* secondary-entry boundary (Sheriff forbids deep-relative imports).
|
|
265
|
+
*/
|
|
266
|
+
declare function flatStepsEqual(a: readonly CngxStepNode[], b: readonly CngxStepNode[]): boolean;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Marker directive carrying a `CngxStep`'s content template.
|
|
270
|
+
* Discovered via `contentChild(CngxStepContent)`. Typed with
|
|
271
|
+
* {@link CngxStepContentContext} so `let-busy="busy"` etc. gives
|
|
272
|
+
* typed access to live step state.
|
|
273
|
+
*
|
|
274
|
+
* ```html
|
|
275
|
+
* <ng-template cngxStepContent let-busy="busy">
|
|
276
|
+
* <input [disabled]="busy">
|
|
277
|
+
* </ng-template>
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
declare class CngxStepContent {
|
|
281
|
+
readonly templateRef: TemplateRef<CngxStepContentContext>;
|
|
282
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepContent, never>;
|
|
283
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepContent, "ng-template[cngxStepContent]", never, {}, {}, never, never, true, never>;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Marker directive carrying a `CngxStep`'s label template.
|
|
288
|
+
* Discovered via `contentChild(CngxStepLabel)`. Typed with
|
|
289
|
+
* {@link CngxStepLabelContext} for typed `let-node="node"` /
|
|
290
|
+
* `let-active="active"` access.
|
|
291
|
+
*
|
|
292
|
+
* ```html
|
|
293
|
+
* <ng-template cngxStepLabel let-node="node">
|
|
294
|
+
* {{ node.label() }}
|
|
295
|
+
* </ng-template>
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
declare class CngxStepLabel {
|
|
299
|
+
readonly templateRef: TemplateRef<CngxStepLabelContext>;
|
|
300
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepLabel, never>;
|
|
301
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepLabel, "ng-template[cngxStepLabel]", never, {}, {}, never, never, true, never>;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Single-step atom. Registers with the nearest host — either a
|
|
306
|
+
* `CngxStepGroup` ({@link CNGX_STEP_GROUP_HOST}) or the root
|
|
307
|
+
* `CngxStepperPresenter` ({@link CNGX_STEPPER_HOST}).
|
|
308
|
+
*
|
|
309
|
+
* `state` is a `linkedSignal` over `[disabled]`, `[completed]`, and
|
|
310
|
+
* the optional `[errorAggregator]`'s `hasError()`.
|
|
311
|
+
*/
|
|
312
|
+
declare class CngxStep {
|
|
313
|
+
readonly id: i0.InputSignal<string>;
|
|
314
|
+
readonly disabled: i0.InputSignal<boolean>;
|
|
315
|
+
readonly completed: i0.InputSignal<boolean>;
|
|
316
|
+
readonly label: i0.InputSignal<string>;
|
|
317
|
+
readonly errorAggregator: i0.InputSignal<CngxErrorAggregatorContract | undefined>;
|
|
318
|
+
protected readonly labelSlot: Signal<CngxStepLabel | undefined>;
|
|
319
|
+
protected readonly contentSlot: Signal<CngxStepContent | undefined>;
|
|
320
|
+
readonly labelTemplate: Signal<CngxStepLabel | undefined>;
|
|
321
|
+
readonly contentTemplate: Signal<CngxStepContent | undefined>;
|
|
322
|
+
/**
|
|
323
|
+
* Per-step status derived from inputs + aggregator. `linkedSignal`
|
|
324
|
+
* with structural equal — never written via `effect`.
|
|
325
|
+
*/
|
|
326
|
+
readonly state: Signal<CngxStepStatus>;
|
|
327
|
+
constructor();
|
|
328
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStep, never>;
|
|
329
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStep, "[cngxStep]", ["cngxStep"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "completed": { "alias": "completed"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "errorAggregator": { "alias": "errorAggregator"; "required": false; "isSignal": true; }; }, {}, ["labelSlot", "contentSlot"], never, true, never>;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Step-group atom. Registers with the root presenter as a `kind: 'group'`
|
|
334
|
+
* node and provides {@link CNGX_STEP_GROUP_HOST} so nested `CngxStep`
|
|
335
|
+
* atoms register with the group, not the root.
|
|
336
|
+
*
|
|
337
|
+
* `aggregatedStatus` rolls up child states: `error` if any errored,
|
|
338
|
+
* `success` if all are success, `pending` if any is pending or busy,
|
|
339
|
+
* otherwise `idle`.
|
|
340
|
+
*/
|
|
341
|
+
declare class CngxStepGroup implements CngxStepGroupHost {
|
|
342
|
+
readonly id: i0.InputSignal<string>;
|
|
343
|
+
readonly disabled: i0.InputSignal<boolean>;
|
|
344
|
+
readonly label: i0.InputSignal<string>;
|
|
345
|
+
private readonly childRegistry;
|
|
346
|
+
readonly aggregatedStatus: Signal<CngxStepStatus>;
|
|
347
|
+
private readonly stepperHost;
|
|
348
|
+
constructor();
|
|
349
|
+
register(handle: CngxStepRegistration): void;
|
|
350
|
+
unregister(id: string): void;
|
|
351
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepGroup, never>;
|
|
352
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepGroup, "[cngxStepGroup]", ["cngxStepGroup"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Context passed to the `*cngxStepIndicator` template. Drives the
|
|
357
|
+
* numbered / checkmark / error glyph inside each step button. The
|
|
358
|
+
* `<button>` shell — `aria-current`, `aria-controls`, click handler —
|
|
359
|
+
* stays library-owned.
|
|
360
|
+
*
|
|
361
|
+
* `status` mirrors `node.state()`. `busy` is the presenter-derived
|
|
362
|
+
* "this step is the in-flight commit target" flag — independent of
|
|
363
|
+
* `status === 'pending'` (which is the aggregate landmark state).
|
|
364
|
+
*/
|
|
365
|
+
interface CngxStepIndicatorContext {
|
|
366
|
+
/** Convenience alias for `position` — usable as `let-position` shorthand. */
|
|
367
|
+
readonly $implicit: number;
|
|
368
|
+
/** 1-based position of this step in the flat step-only projection. */
|
|
369
|
+
readonly position: number;
|
|
370
|
+
/** The step node carrying id / label / disabled / state signals. */
|
|
371
|
+
readonly node: CngxStepNode;
|
|
372
|
+
/** `true` when this step is the current `activeStepId`. */
|
|
373
|
+
readonly active: boolean;
|
|
374
|
+
/** Live step status — drives the visual variant (idle / success / error / busy). */
|
|
375
|
+
readonly status: CngxStepStatus;
|
|
376
|
+
/** `true` when this step is the in-flight commit target. */
|
|
377
|
+
readonly busy: boolean;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Slot directive for the indicator-glyph template on `<cngx-stepper>`.
|
|
381
|
+
* Discovered via `contentChild`; cascades through
|
|
382
|
+
* `CNGX_STEPPER_CONFIG.templates.indicator` before falling back to
|
|
383
|
+
* the built-in numeric span (`{{ position }}`).
|
|
384
|
+
*
|
|
385
|
+
* ```html
|
|
386
|
+
* <cngx-stepper>
|
|
387
|
+
* <ng-template cngxStepIndicator let-position let-node="node" let-status="status">
|
|
388
|
+
* @if (status === 'success') {
|
|
389
|
+
* <my-icon name="check" />
|
|
390
|
+
* } @else if (status === 'error') {
|
|
391
|
+
* <my-icon name="alert" />
|
|
392
|
+
* } @else {
|
|
393
|
+
* <span class="my-step-num">{{ position }}</span>
|
|
394
|
+
* }
|
|
395
|
+
* </ng-template>
|
|
396
|
+
* </cngx-stepper>
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
declare class CngxStepIndicator {
|
|
400
|
+
readonly templateRef: TemplateRef<CngxStepIndicatorContext>;
|
|
401
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepIndicator, never>;
|
|
402
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepIndicator, "ng-template[cngxStepIndicator]", ["cngxStepIndicator"], {}, {}, never, never, true, never>;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Context passed to the `*cngxStepBadge` template. Drives the error
|
|
407
|
+
* badge inside a step button when `errorAggregator?.shouldShow()` is
|
|
408
|
+
* truthy. Consumers swap the built-in `'!'` glyph for a counter pill
|
|
409
|
+
* or branded marker; the visibility gate stays library-owned.
|
|
410
|
+
*/
|
|
411
|
+
interface CngxStepBadgeContext {
|
|
412
|
+
/** Aggregated error count for this step (≥ 1 when shown). */
|
|
413
|
+
readonly count: number;
|
|
414
|
+
/** The step node carrying id / label / state signals. */
|
|
415
|
+
readonly node: CngxStepNode;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Slot directive for the error-badge template on `<cngx-stepper>`.
|
|
419
|
+
* Discovered via `contentChild`; cascades through
|
|
420
|
+
* `CNGX_STEPPER_CONFIG.templates.badge` before falling back to
|
|
421
|
+
* `CNGX_STEPPER_GLYPHS.errorBadge`.
|
|
422
|
+
*
|
|
423
|
+
* ```html
|
|
424
|
+
* <cngx-stepper>
|
|
425
|
+
* <ng-template cngxStepBadge let-count="count">
|
|
426
|
+
* <span class="my-badge-pill">{{ count }}</span>
|
|
427
|
+
* </ng-template>
|
|
428
|
+
* </cngx-stepper>
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
declare class CngxStepBadge {
|
|
432
|
+
readonly templateRef: TemplateRef<CngxStepBadgeContext>;
|
|
433
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepBadge, never>;
|
|
434
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepBadge, "ng-template[cngxStepBadge]", ["cngxStepBadge"], {}, {}, never, never, true, never>;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Context passed to the `*cngxStepBusySpinner` template. Drives the
|
|
439
|
+
* pending-commit overlay on the in-flight target step. Renders only
|
|
440
|
+
* when the step matches `presenter.intendedStepIndex()` with
|
|
441
|
+
* `commitState.status() === 'pending'`.
|
|
442
|
+
*/
|
|
443
|
+
interface CngxStepBusySpinnerContext {
|
|
444
|
+
/** The step node carrying id / label / state signals. */
|
|
445
|
+
readonly node: CngxStepNode;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Slot directive for the busy-spinner template on `<cngx-stepper>`.
|
|
449
|
+
* Discovered via `contentChild`; cascades through
|
|
450
|
+
* `CNGX_STEPPER_CONFIG.templates.busySpinner` before falling back to
|
|
451
|
+
* the built-in pulse-animation span.
|
|
452
|
+
*
|
|
453
|
+
* ```html
|
|
454
|
+
* <cngx-stepper>
|
|
455
|
+
* <ng-template cngxStepBusySpinner>
|
|
456
|
+
* <my-spinner size="sm" />
|
|
457
|
+
* </ng-template>
|
|
458
|
+
* </cngx-stepper>
|
|
459
|
+
* ```
|
|
460
|
+
*/
|
|
461
|
+
declare class CngxStepBusySpinner {
|
|
462
|
+
readonly templateRef: TemplateRef<CngxStepBusySpinnerContext>;
|
|
463
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepBusySpinner, never>;
|
|
464
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepBusySpinner, "ng-template[cngxStepBusySpinner]", ["cngxStepBusySpinner"], {}, {}, never, never, true, never>;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Context passed to the `*cngxStepRejection` template. Renders on the
|
|
469
|
+
* strip step the most recent commit was rolled back FROM — sibling of
|
|
470
|
+
* the tabs `cngxTabRejectionIcon` slot. Renders only when
|
|
471
|
+
* `presenter.lastFailedIndex()` matches the step's flat-index.
|
|
472
|
+
*
|
|
473
|
+
* `originLabel` is the safe-harbour step's label, derived from
|
|
474
|
+
* `presenter.originIndexDuringCommit()`. May be `undefined` when the
|
|
475
|
+
* origin index is out of range (synchronous-rejection edge case);
|
|
476
|
+
* gate richer UI on its presence.
|
|
477
|
+
*/
|
|
478
|
+
interface CngxStepRejectionContext {
|
|
479
|
+
/** Flat-index of the rejected step (`presenter.lastFailedIndex()`). */
|
|
480
|
+
readonly failedIndex: number;
|
|
481
|
+
/** Resolved label of the safe-harbour step, when derivable. */
|
|
482
|
+
readonly originLabel: string | undefined;
|
|
483
|
+
/** The rejected step node carrying id / label / state signals. */
|
|
484
|
+
readonly node: CngxStepNode;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Slot directive for the rejection-decoration template on
|
|
488
|
+
* `<cngx-stepper>`. Discovered via `contentChild`; cascades through
|
|
489
|
+
* `CNGX_STEPPER_CONFIG.templates.rejection` before falling back to
|
|
490
|
+
* `CNGX_STEPPER_GLYPHS.rejectionIcon`.
|
|
491
|
+
*
|
|
492
|
+
* Symmetric context shape with the upcoming tabs `cngxTabRejectionIcon`
|
|
493
|
+
* slot so consumer templates port directly between the two families.
|
|
494
|
+
*
|
|
495
|
+
* ```html
|
|
496
|
+
* <cngx-stepper>
|
|
497
|
+
* <ng-template cngxStepRejection let-failedIndex="failedIndex" let-originLabel="originLabel">
|
|
498
|
+
* <my-icon name="rollback" />
|
|
499
|
+
* @if (originLabel) {
|
|
500
|
+
* <span class="cngx-sr-only">Rolled back to {{ originLabel }}</span>
|
|
501
|
+
* }
|
|
502
|
+
* </ng-template>
|
|
503
|
+
* </cngx-stepper>
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
declare class CngxStepRejection {
|
|
507
|
+
readonly templateRef: TemplateRef<CngxStepRejectionContext>;
|
|
508
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepRejection, never>;
|
|
509
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepRejection, "ng-template[cngxStepRejection]", ["cngxStepRejection"], {}, {}, never, never, true, never>;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Context passed to the `*cngxStepGroupHeader` template. Drives the
|
|
514
|
+
* group-row landmark for `kind === 'group'` nodes. The `role="group"`
|
|
515
|
+
* + `aria-roledescription` shell stays library-owned.
|
|
516
|
+
*
|
|
517
|
+
* `group` carries a `CngxStepNode` with the runtime guarantee
|
|
518
|
+
* `kind === 'group'` (the slot only fires for group nodes).
|
|
519
|
+
* `expanded` is reserved for future collapsible groups — passed `true`
|
|
520
|
+
* today; declaring it now avoids a breaking change later.
|
|
521
|
+
*/
|
|
522
|
+
interface CngxStepGroupHeaderContext {
|
|
523
|
+
/** The group node carrying id / label / state / children signals. */
|
|
524
|
+
readonly group: CngxStepNode;
|
|
525
|
+
/** Reserved — `true` while the group's children are visible. */
|
|
526
|
+
readonly expanded: boolean;
|
|
527
|
+
/** Aggregated group status (rolls up children — drives heading variant). */
|
|
528
|
+
readonly status: CngxStepStatus;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Slot directive for the group-header template on `<cngx-stepper>`.
|
|
532
|
+
* Discovered via `contentChild`; cascades through
|
|
533
|
+
* `CNGX_STEPPER_CONFIG.templates.groupHeader` before falling back to
|
|
534
|
+
* the built-in `<span class="cngx-stepper__group-label">`.
|
|
535
|
+
*
|
|
536
|
+
* ```html
|
|
537
|
+
* <cngx-stepper>
|
|
538
|
+
* <ng-template cngxStepGroupHeader let-group="group" let-status="status">
|
|
539
|
+
* <h4 [class.is-error]="status === 'error'">{{ group.label() }}</h4>
|
|
540
|
+
* </ng-template>
|
|
541
|
+
* </cngx-stepper>
|
|
542
|
+
* ```
|
|
543
|
+
*/
|
|
544
|
+
declare class CngxStepGroupHeader {
|
|
545
|
+
readonly templateRef: TemplateRef<CngxStepGroupHeaderContext>;
|
|
546
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepGroupHeader, never>;
|
|
547
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepGroupHeader, "ng-template[cngxStepGroupHeader]", ["cngxStepGroupHeader"], {}, {}, never, never, true, never>;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Slot directive for the empty-state placeholder on `<cngx-stepper>`.
|
|
552
|
+
* Rendered when `flatSteps()` is empty — async-loading or
|
|
553
|
+
* server-driven step lists get a "no steps yet" landmark rather than
|
|
554
|
+
* a collapsed strip.
|
|
555
|
+
*
|
|
556
|
+
* Discovered via `contentChild`; cascades through
|
|
557
|
+
* `CNGX_STEPPER_CONFIG.templates.empty` before falling back to no
|
|
558
|
+
* markup (Honest-Absence default).
|
|
559
|
+
*
|
|
560
|
+
* ```html
|
|
561
|
+
* <cngx-stepper>
|
|
562
|
+
* <ng-template cngxStepperEmpty>
|
|
563
|
+
* <cngx-empty-state heading="No steps configured yet" />
|
|
564
|
+
* </ng-template>
|
|
565
|
+
* </cngx-stepper>
|
|
566
|
+
* ```
|
|
567
|
+
*/
|
|
568
|
+
declare class CngxStepperEmpty {
|
|
569
|
+
readonly templateRef: TemplateRef<void>;
|
|
570
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepperEmpty, never>;
|
|
571
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepperEmpty, "ng-template[cngxStepperEmpty]", ["cngxStepperEmpty"], {}, {}, never, never, true, never>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Aria-label overrides for the stepper landmark region. Library
|
|
576
|
+
* defaults are English; locales come from consumer overrides.
|
|
577
|
+
*
|
|
578
|
+
* Per-step navigation labels (`previousStep`, `nextStep`) live in
|
|
579
|
+
* {@link CngxStepperI18n} — SR phrasing, not landmark naming.
|
|
580
|
+
* Splitting the surfaces avoids a dual-override path for the same string.
|
|
581
|
+
*/
|
|
582
|
+
interface CngxStepperAriaLabels {
|
|
583
|
+
readonly stepperRegion?: string;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Fallback labels for derived strings (group descriptors, badge SR
|
|
587
|
+
* announcements). English defaults; consumer overrides per locale.
|
|
588
|
+
*/
|
|
589
|
+
interface CngxStepperFallbackLabels {
|
|
590
|
+
readonly groupRoleDescription?: string;
|
|
591
|
+
readonly stepRoleDescription?: string;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Per-slot template overrides for `<cngx-stepper>`. Middle tier of
|
|
595
|
+
* the 3-stage cascade: per-instance directive > this field > built-in
|
|
596
|
+
* markup. Apply via the `with*Template` feature builders below.
|
|
597
|
+
*/
|
|
598
|
+
interface CngxStepperTemplates {
|
|
599
|
+
readonly indicator?: TemplateRef<CngxStepIndicatorContext>;
|
|
600
|
+
readonly badge?: TemplateRef<CngxStepBadgeContext>;
|
|
601
|
+
readonly busySpinner?: TemplateRef<CngxStepBusySpinnerContext>;
|
|
602
|
+
readonly rejection?: TemplateRef<CngxStepRejectionContext>;
|
|
603
|
+
readonly groupHeader?: TemplateRef<CngxStepGroupHeaderContext>;
|
|
604
|
+
readonly empty?: TemplateRef<void>;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Stepper config surface. Resolution priority: per-instance Input
|
|
608
|
+
* > `provideStepperConfigAt` (viewProviders) > `provideStepperConfig`
|
|
609
|
+
* (root) > library default. Canonical cngx config shape.
|
|
610
|
+
*/
|
|
611
|
+
interface CngxStepperConfig {
|
|
612
|
+
readonly defaultOrientation?: 'horizontal' | 'vertical';
|
|
613
|
+
readonly defaultLinear?: boolean;
|
|
614
|
+
readonly defaultCommitMode?: 'optimistic' | 'pessimistic';
|
|
615
|
+
readonly routerSyncMode?: 'fragment' | 'queryParam';
|
|
616
|
+
readonly routerSyncParam?: string;
|
|
617
|
+
readonly ariaLabels?: CngxStepperAriaLabels;
|
|
618
|
+
readonly fallbackLabels?: CngxStepperFallbackLabels;
|
|
619
|
+
readonly templates?: CngxStepperTemplates;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* DI token for the resolved stepper config. `providedIn: 'root'` with
|
|
623
|
+
* library defaults; override via {@link provideStepperConfig} (root)
|
|
624
|
+
* or {@link provideStepperConfigAt} (component scope).
|
|
625
|
+
*/
|
|
626
|
+
declare const CNGX_STEPPER_CONFIG: InjectionToken<CngxStepperConfig>;
|
|
627
|
+
/**
|
|
628
|
+
* Feature signature — each `with*` builder reduces over the config.
|
|
629
|
+
* Hidden `_target: 'config'` discriminator routes through the family
|
|
630
|
+
* aggregator {@link provideCngxStepper}.
|
|
631
|
+
*/
|
|
632
|
+
type CngxStepperConfigFeature = ((config: CngxStepperConfig) => CngxStepperConfig) & {
|
|
633
|
+
readonly _target: 'config';
|
|
634
|
+
};
|
|
635
|
+
/**
|
|
636
|
+
* Override the default orientation. Per-instance `[orientation]`
|
|
637
|
+
* Input still wins; this only moves the cascade default.
|
|
638
|
+
*/
|
|
639
|
+
declare function withStepperDefaultOrientation(orientation: 'horizontal' | 'vertical'): CngxStepperConfigFeature;
|
|
640
|
+
/**
|
|
641
|
+
* Override the default linear-progression setting. Per-instance
|
|
642
|
+
* `[linear]` Input still wins.
|
|
643
|
+
*/
|
|
644
|
+
declare function withStepperLinear(linear: boolean): CngxStepperConfigFeature;
|
|
645
|
+
/**
|
|
646
|
+
* Override the default commit mode for async step transitions.
|
|
647
|
+
* `'optimistic'` advances on action dispatch and rolls back on error;
|
|
648
|
+
* `'pessimistic'` waits for success. Per-instance `[commitMode]`
|
|
649
|
+
* Input still wins.
|
|
650
|
+
*/
|
|
651
|
+
declare function withStepperCommitMode(mode: 'optimistic' | 'pessimistic'): CngxStepperConfigFeature;
|
|
652
|
+
/**
|
|
653
|
+
* Configure router synchronisation for the active step. `mode` chooses
|
|
654
|
+
* the URL surface (URL fragment or query parameter); `param` names the
|
|
655
|
+
* key (default `'step'`).
|
|
656
|
+
*/
|
|
657
|
+
declare function withStepperRouterSync(mode: 'fragment' | 'queryParam', param?: string): CngxStepperConfigFeature;
|
|
658
|
+
/**
|
|
659
|
+
* Merge ARIA labels into the cascade. Keys not provided keep their
|
|
660
|
+
* library defaults; per-instance overrides on the stepper still win.
|
|
661
|
+
*/
|
|
662
|
+
declare function withStepperAriaLabels(labels: CngxStepperAriaLabels): CngxStepperConfigFeature;
|
|
663
|
+
/**
|
|
664
|
+
* Merge text fallback labels (button captions, error strings) into the
|
|
665
|
+
* cascade. Used when a slot directive is not present.
|
|
666
|
+
*/
|
|
667
|
+
declare function withStepperFallbackLabels(labels: CngxStepperFallbackLabels): CngxStepperConfigFeature;
|
|
668
|
+
/**
|
|
669
|
+
* Override the default `*cngxStepIndicator` template app-wide.
|
|
670
|
+
* Per-instance directive still wins; this only moves the cascade
|
|
671
|
+
* middle tier.
|
|
672
|
+
*/
|
|
673
|
+
declare function withStepIndicatorTemplate(template: TemplateRef<CngxStepIndicatorContext>): CngxStepperConfigFeature;
|
|
674
|
+
/**
|
|
675
|
+
* Override the default `*cngxStepBadge` template app-wide.
|
|
676
|
+
*/
|
|
677
|
+
declare function withStepBadgeTemplate(template: TemplateRef<CngxStepBadgeContext>): CngxStepperConfigFeature;
|
|
678
|
+
/**
|
|
679
|
+
* Override the default `*cngxStepBusySpinner` template app-wide.
|
|
680
|
+
*/
|
|
681
|
+
declare function withStepBusySpinnerTemplate(template: TemplateRef<CngxStepBusySpinnerContext>): CngxStepperConfigFeature;
|
|
682
|
+
/**
|
|
683
|
+
* Override the default `*cngxStepRejection` template app-wide.
|
|
684
|
+
* Symmetric with the upcoming tabs `cngxTabRejectionIcon` (Phase 4).
|
|
685
|
+
*/
|
|
686
|
+
declare function withStepRejectionTemplate(template: TemplateRef<CngxStepRejectionContext>): CngxStepperConfigFeature;
|
|
687
|
+
/**
|
|
688
|
+
* Override the default `*cngxStepGroupHeader` template app-wide.
|
|
689
|
+
*/
|
|
690
|
+
declare function withStepGroupHeaderTemplate(template: TemplateRef<CngxStepGroupHeaderContext>): CngxStepperConfigFeature;
|
|
691
|
+
/**
|
|
692
|
+
* Override the default `*cngxStepperEmpty` template app-wide.
|
|
693
|
+
*/
|
|
694
|
+
declare function withStepperEmptyTemplate(template: TemplateRef<void>): CngxStepperConfigFeature;
|
|
695
|
+
/**
|
|
696
|
+
* Root-level provider for the stepper config. Apply once in the
|
|
697
|
+
* application providers array. Sibling of `provideTabsConfig` /
|
|
698
|
+
* `provideSelectConfig`.
|
|
699
|
+
*/
|
|
700
|
+
declare function provideStepperConfig(...features: readonly CngxStepperConfigFeature[]): EnvironmentProviders;
|
|
701
|
+
/**
|
|
702
|
+
* Component-scoped config override. Spread the returned `Provider[]`
|
|
703
|
+
* into `providers` or `viewProviders` — `viewProviders` cannot accept
|
|
704
|
+
* opaque {@link EnvironmentProviders}, so the twin returns a list.
|
|
705
|
+
* Sibling of `provideTabsConfigAt`.
|
|
706
|
+
*
|
|
707
|
+
* Resolution priority: per-instance Input > viewProviders (`At`) >
|
|
708
|
+
* root provider > library default.
|
|
709
|
+
*
|
|
710
|
+
* ```ts
|
|
711
|
+
* @Component({
|
|
712
|
+
* viewProviders: [...provideStepperConfigAt(withStepperLinear(true))],
|
|
713
|
+
* })
|
|
714
|
+
* ```
|
|
715
|
+
*/
|
|
716
|
+
declare function provideStepperConfigAt(...features: readonly CngxStepperConfigFeature[]): Provider[];
|
|
717
|
+
/**
|
|
718
|
+
* Inject the resolved stepper config in an injection context.
|
|
719
|
+
*/
|
|
720
|
+
declare function injectStepperConfig(): CngxStepperConfig;
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Inputs to {@link createStepperTemplateBindings}. The organism owns
|
|
724
|
+
* the `contentChild()` queries (NG8110 — must run in component
|
|
725
|
+
* injection context) and the resolved {@link CngxStepperConfig}; this
|
|
726
|
+
* factory absorbs the 3-stage cascade per slot key.
|
|
727
|
+
*/
|
|
728
|
+
interface CngxStepperTemplateBindingsOptions {
|
|
729
|
+
readonly indicatorSlot: Signal<CngxStepIndicator | undefined>;
|
|
730
|
+
readonly badgeSlot: Signal<CngxStepBadge | undefined>;
|
|
731
|
+
readonly busySpinnerSlot: Signal<CngxStepBusySpinner | undefined>;
|
|
732
|
+
readonly rejectionSlot: Signal<CngxStepRejection | undefined>;
|
|
733
|
+
readonly groupHeaderSlot: Signal<CngxStepGroupHeader | undefined>;
|
|
734
|
+
readonly emptySlot: Signal<CngxStepperEmpty | undefined>;
|
|
735
|
+
readonly config: CngxStepperConfig;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Output of {@link createStepperTemplateBindings}. One resolved
|
|
739
|
+
* `Signal<TemplateRef | null>` per slot — `null` falls through to the
|
|
740
|
+
* organism's built-in default markup.
|
|
741
|
+
*/
|
|
742
|
+
interface CngxStepperTemplateBindings {
|
|
743
|
+
readonly indicator: Signal<TemplateRef<CngxStepIndicatorContext> | null>;
|
|
744
|
+
readonly badge: Signal<TemplateRef<CngxStepBadgeContext> | null>;
|
|
745
|
+
readonly busySpinner: Signal<TemplateRef<CngxStepBusySpinnerContext> | null>;
|
|
746
|
+
readonly rejection: Signal<TemplateRef<CngxStepRejectionContext> | null>;
|
|
747
|
+
readonly groupHeader: Signal<TemplateRef<CngxStepGroupHeaderContext> | null>;
|
|
748
|
+
readonly empty: Signal<TemplateRef<void> | null>;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Wires the 3-stage template cascade for the six `<cngx-stepper>`
|
|
752
|
+
* skin slots: per-instance directive > `CNGX_STEPPER_CONFIG.templates.<key>`
|
|
753
|
+
* > `null` (built-in default).
|
|
754
|
+
*
|
|
755
|
+
* Pure — no DI, no side effects. Safe to call from a field-init
|
|
756
|
+
* block. Sibling of `createTabOverflowTemplateBindings` and the
|
|
757
|
+
* family-wide `createTemplateRegistry`.
|
|
758
|
+
*
|
|
759
|
+
* Tabs has no parallel slot surface yet — see
|
|
760
|
+
* `stepper-accepted-debt §3` for the planned Phase-4 closure.
|
|
761
|
+
*/
|
|
762
|
+
declare function createStepperTemplateBindings(opts: CngxStepperTemplateBindingsOptions): CngxStepperTemplateBindings;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Default glyphs for `<cngx-stepper>` skin slots. Used when neither a
|
|
766
|
+
* per-instance slot directive nor `CNGX_STEPPER_CONFIG.templates.<key>`
|
|
767
|
+
* overrides the built-in span. Sibling of `CNGX_SELECT_GLYPHS` /
|
|
768
|
+
* `CNGX_TABS_GLYPHS`.
|
|
769
|
+
*
|
|
770
|
+
* Exported with `@internal` so the organism (and mat-twin) can share
|
|
771
|
+
* the literals across the secondary-entry boundary that Sheriff
|
|
772
|
+
* forbids deep-relative imports across. Consumers customise via
|
|
773
|
+
* `*cngxStep*` slots or `withStep*Template` features.
|
|
774
|
+
*
|
|
775
|
+
* @internal
|
|
776
|
+
*/
|
|
777
|
+
declare const CNGX_STEPPER_GLYPHS: {
|
|
778
|
+
/** Default visual for `*cngxStepBadge` when no override is bound. */
|
|
779
|
+
readonly errorBadge: "!";
|
|
780
|
+
/** Default visual for `*cngxStepRejection` when no override is bound. */
|
|
781
|
+
readonly rejectionIcon: "!";
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* URL deep-linking for the stepper. Bidirectional sync between
|
|
786
|
+
* `activeStepId` and a URL fragment / query-param. Opt-in via
|
|
787
|
+
* `[cngxStepperRouterSync]` on the presenter element.
|
|
788
|
+
*
|
|
789
|
+
* - `mode = 'fragment'` (default) → `#step=customer`
|
|
790
|
+
* - `mode = 'queryParam'` with `paramName = 'step'` → `?step=customer`
|
|
791
|
+
*
|
|
792
|
+
* `Router` is optional — without `@angular/router` the directive
|
|
793
|
+
* dev-warns once and becomes a no-op.
|
|
794
|
+
*/
|
|
795
|
+
declare class CngxStepperRouterSync {
|
|
796
|
+
readonly modeInput: i0.InputSignal<"fragment" | "queryParam" | undefined>;
|
|
797
|
+
readonly paramNameInput: i0.InputSignal<string | undefined>;
|
|
798
|
+
private readonly config;
|
|
799
|
+
readonly mode: i0.Signal<"fragment" | "queryParam">;
|
|
800
|
+
readonly paramName: i0.Signal<string>;
|
|
801
|
+
/** Emits when a `router.navigate` rejection is observed. */
|
|
802
|
+
readonly syncError: i0.OutputEmitterRef<unknown>;
|
|
803
|
+
private readonly host;
|
|
804
|
+
private readonly router;
|
|
805
|
+
constructor();
|
|
806
|
+
private parseFragment;
|
|
807
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepperRouterSync, never>;
|
|
808
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepperRouterSync, "[cngxStepperRouterSync]", ["cngxStepperRouterSync"], { "modeInput": { "alias": "mode"; "required": false; "isSignal": true; }; "paramNameInput": { "alias": "paramName"; "required": false; "isSignal": true; }; }, { "syncError": "syncError"; }, never, never, true, never>;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Stepper i18n surface. Library defaults are English; locales come from
|
|
813
|
+
* consumer overrides via {@link provideStepperI18n}. Sibling of
|
|
814
|
+
* `CNGX_TABS_I18N` / `CNGX_CHART_I18N`.
|
|
815
|
+
*/
|
|
816
|
+
interface CngxStepperI18n {
|
|
817
|
+
readonly stepperLabel: string;
|
|
818
|
+
readonly selectedStep: (label: string, position: number, count: number) => string;
|
|
819
|
+
readonly stepCompleted: string;
|
|
820
|
+
readonly stepErrored: string;
|
|
821
|
+
readonly stepHasErrors: (count: number) => string;
|
|
822
|
+
readonly previousStep: string;
|
|
823
|
+
readonly nextStep: string;
|
|
824
|
+
/**
|
|
825
|
+
* @deprecated Superseded by {@link commitRolledBackTo}. Retained as
|
|
826
|
+
* defensive fallback in `liveAnnouncement` when the origin label is
|
|
827
|
+
* unresolvable (unlabeled step, or `commitState` driven outside `select()`).
|
|
828
|
+
*/
|
|
829
|
+
readonly commitFailedRetry: string;
|
|
830
|
+
/**
|
|
831
|
+
* Polite SR announcement on `idle → pending`. Pillar 2.
|
|
832
|
+
*/
|
|
833
|
+
readonly commitInFlight: string;
|
|
834
|
+
/**
|
|
835
|
+
* Origin-aware rollback phrase. Read on `pending → error` when both
|
|
836
|
+
* `lastFailedIndex` and `originIndexDuringCommit` resolve. Receives
|
|
837
|
+
* the safe-harbour label, yields e.g. `Reverted to step "Customer".`.
|
|
838
|
+
*/
|
|
839
|
+
readonly commitRolledBackTo: (originLabel: string) => string;
|
|
840
|
+
/**
|
|
841
|
+
* Persistent suffix on the per-step `aria-describedby` while
|
|
842
|
+
* `presenter.lastFailedIndex()` matches the step. Distinct from
|
|
843
|
+
* {@link commitRolledBackTo} (transient live-region phrase) — this
|
|
844
|
+
* suffix is reachable when AT users navigate back to the rejected
|
|
845
|
+
* step after the announcement has faded. Pillar 2.
|
|
846
|
+
*/
|
|
847
|
+
readonly stepRolledBackSuffix: string;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* DI token for the resolved stepper i18n bundle. `providedIn: 'root'`
|
|
851
|
+
* with English defaults.
|
|
852
|
+
*/
|
|
853
|
+
declare const CNGX_STEPPER_I18N: InjectionToken<CngxStepperI18n>;
|
|
854
|
+
/**
|
|
855
|
+
* Feature shape consumed by {@link provideStepperI18n} and {@link provideCngxStepper}.
|
|
856
|
+
* Hidden `_target: 'i18n'` discriminator routes through the family aggregator.
|
|
857
|
+
* Sibling of `CngxTabsI18nFeature`.
|
|
858
|
+
*/
|
|
859
|
+
type CngxStepperI18nFeature = ((bundle: CngxStepperI18n) => CngxStepperI18n) & {
|
|
860
|
+
readonly _target: 'i18n';
|
|
861
|
+
};
|
|
862
|
+
/**
|
|
863
|
+
* Override stepper i18n labels. Partial override — unset keys keep
|
|
864
|
+
* the English default. Sibling of `withStepperAriaLabels` /
|
|
865
|
+
* `withStepperFallbackLabels`.
|
|
866
|
+
*/
|
|
867
|
+
declare function withStepperI18nLabels(overrides: Partial<CngxStepperI18n>): CngxStepperI18nFeature;
|
|
868
|
+
/**
|
|
869
|
+
* Provider for the stepper i18n bundle. Compose `withStepperI18nLabels(...)`
|
|
870
|
+
* (plus any future i18n `with*`) — unset keys fall back to English.
|
|
871
|
+
*
|
|
872
|
+
* ```ts
|
|
873
|
+
* bootstrapApplication(AppComponent, {
|
|
874
|
+
* providers: [
|
|
875
|
+
* provideStepperI18n(
|
|
876
|
+
* withStepperI18nLabels({ stepperLabel: 'Schrittfolge', previousStep: 'Vorheriger' }),
|
|
877
|
+
* ),
|
|
878
|
+
* ],
|
|
879
|
+
* });
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
882
|
+
declare function provideStepperI18n(...features: readonly CngxStepperI18nFeature[]): Provider;
|
|
883
|
+
/**
|
|
884
|
+
* Inject the resolved stepper i18n bundle in an injection context.
|
|
885
|
+
*/
|
|
886
|
+
declare function injectStepperI18n(): CngxStepperI18n;
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Adapter between the lifted commit-controller and the stepper's
|
|
890
|
+
* action shape. The presenter delegates to `beginTransition` on
|
|
891
|
+
* every step change driven by `commitAction`.
|
|
892
|
+
*/
|
|
893
|
+
interface CngxStepperCommitHandler {
|
|
894
|
+
/**
|
|
895
|
+
* Start a transition commit. Returns synchronously; the controller's
|
|
896
|
+
* `state` signal reports the in-flight status.
|
|
897
|
+
*
|
|
898
|
+
* @param onResolve fires `true` on accept, `false` on rejection;
|
|
899
|
+
* skipped on supersede.
|
|
900
|
+
*/
|
|
901
|
+
beginTransition(fromIndex: number, toIndex: number, action: CngxStepperCommitAction, onResolve: (accept: boolean) => void): void;
|
|
902
|
+
/** Cancel the in-flight transition without firing callbacks. */
|
|
903
|
+
cancel(): void;
|
|
904
|
+
/** Live `pending` flag from the controller. */
|
|
905
|
+
readonly isCommitting: Signal<boolean>;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Options for {@link createStepperCommitHandler}.
|
|
909
|
+
*/
|
|
910
|
+
interface CngxStepperCommitHandlerOptions {
|
|
911
|
+
readonly controller: CngxCommitController<number>;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Build a stepper commit handler over an existing {@link CngxCommitController}.
|
|
915
|
+
* Resolves `Observable<boolean>` / `Promise<boolean>` / `boolean` returns into
|
|
916
|
+
* a unified `accept: boolean` outcome.
|
|
917
|
+
*/
|
|
918
|
+
declare function createStepperCommitHandler(opts: CngxStepperCommitHandlerOptions): CngxStepperCommitHandler;
|
|
919
|
+
/**
|
|
920
|
+
* Factory signature for {@link CngxStepperCommitHandler}. Override
|
|
921
|
+
* {@link CNGX_STEPPER_COMMIT_HANDLER_FACTORY} for retry-with-backoff,
|
|
922
|
+
* telemetry, or offline queues.
|
|
923
|
+
*/
|
|
924
|
+
type CngxStepperCommitHandlerFactory = (opts: CngxStepperCommitHandlerOptions) => CngxStepperCommitHandler;
|
|
925
|
+
/**
|
|
926
|
+
* DI token carrying the factory the presenter uses to allocate its commit
|
|
927
|
+
* handler. Symmetric to the select family's `CNGX_ARRAY_COMMIT_HANDLER_FACTORY`.
|
|
928
|
+
*/
|
|
929
|
+
declare const CNGX_STEPPER_COMMIT_HANDLER_FACTORY: InjectionToken<CngxStepperCommitHandlerFactory>;
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* Union of every feature kind {@link provideCngxStepper} accepts. Today:
|
|
933
|
+
* config (`CNGX_STEPPER_CONFIG`) and i18n (`CNGX_STEPPER_I18N`). Future
|
|
934
|
+
* surfaces widen this union and dispatch via the hidden `_target`
|
|
935
|
+
* discriminator.
|
|
936
|
+
*/
|
|
937
|
+
type CngxStepperFeature = CngxStepperConfigFeature | CngxStepperI18nFeature;
|
|
938
|
+
/**
|
|
939
|
+
* Unified aggregator for the stepper family. Filters by `_target` and
|
|
940
|
+
* forwards: config features to {@link provideStepperConfig}, i18n
|
|
941
|
+
* features to {@link provideStepperI18n}. Mirrors `provideCngxTabs` /
|
|
942
|
+
* `provideCngxSelect`.
|
|
943
|
+
*
|
|
944
|
+
* Returns {@link EnvironmentProviders} for app-root use; the
|
|
945
|
+
* component-scoped twin {@link provideCngxStepperAt} returns
|
|
946
|
+
* `Provider[]` because `viewProviders` cannot accept opaque
|
|
947
|
+
* `EnvironmentProviders`.
|
|
948
|
+
*
|
|
949
|
+
* ```ts
|
|
950
|
+
* bootstrapApplication(AppComponent, {
|
|
951
|
+
* providers: [
|
|
952
|
+
* provideCngxStepper(
|
|
953
|
+
* withStepperDefaultOrientation('vertical'),
|
|
954
|
+
* withStepperLinear(true),
|
|
955
|
+
* withStepperAriaLabels({ stepperRegion: 'Schrittfolge' }),
|
|
956
|
+
* withStepperI18nLabels({ stepperLabel: 'Schrittfolge', previousStep: 'Vorheriger' }),
|
|
957
|
+
* ),
|
|
958
|
+
* ],
|
|
959
|
+
* });
|
|
960
|
+
* ```
|
|
961
|
+
*/
|
|
962
|
+
declare function provideCngxStepper(...features: readonly CngxStepperFeature[]): EnvironmentProviders;
|
|
963
|
+
/**
|
|
964
|
+
* Component-scoped twin of {@link provideCngxStepper}. Spread into
|
|
965
|
+
* `viewProviders` or `providers`. Same dispatch semantics — only the
|
|
966
|
+
* provider scope differs.
|
|
967
|
+
*
|
|
968
|
+
* ```ts
|
|
969
|
+
* @Component({
|
|
970
|
+
* viewProviders: [
|
|
971
|
+
* ...provideCngxStepperAt(
|
|
972
|
+
* withStepperDefaultOrientation('vertical'),
|
|
973
|
+
* withStepperI18nLabels({ stepperLabel: 'Schrittfolge' }),
|
|
974
|
+
* ),
|
|
975
|
+
* ],
|
|
976
|
+
* })
|
|
977
|
+
* ```
|
|
978
|
+
*/
|
|
979
|
+
declare function provideCngxStepperAt(...features: readonly CngxStepperFeature[]): Provider[];
|
|
980
|
+
|
|
981
|
+
export { CNGX_STEPPER_COMMIT_HANDLER_FACTORY, CNGX_STEPPER_CONFIG, CNGX_STEPPER_GLYPHS, CNGX_STEPPER_HOST, CNGX_STEPPER_I18N, CNGX_STEP_GROUP_HOST, CNGX_STEP_PANEL_HOST, CngxStep, CngxStepBadge, CngxStepBusySpinner, CngxStepContent, CngxStepGroup, CngxStepGroupHeader, CngxStepIndicator, CngxStepLabel, CngxStepRejection, CngxStepperEmpty, CngxStepperPresenter, CngxStepperRouterSync, createStepperCommitHandler, createStepperTemplateBindings, flatStepsEqual, injectStepperConfig, injectStepperI18n, provideCngxStepper, provideCngxStepperAt, provideStepperConfig, provideStepperConfigAt, provideStepperI18n, withStepBadgeTemplate, withStepBusySpinnerTemplate, withStepGroupHeaderTemplate, withStepIndicatorTemplate, withStepRejectionTemplate, withStepperAriaLabels, withStepperCommitMode, withStepperDefaultOrientation, withStepperEmptyTemplate, withStepperFallbackLabels, withStepperI18nLabels, withStepperLinear, withStepperRouterSync };
|
|
982
|
+
export type { CngxStepBadgeContext, CngxStepBusySpinnerContext, CngxStepContentContext, CngxStepGroupHeaderContext, CngxStepGroupHost, CngxStepIndicatorContext, CngxStepLabelContext, CngxStepNode, CngxStepPanelHost, CngxStepRegistration, CngxStepRejectionContext, CngxStepStatus, CngxStepperAriaLabels, CngxStepperCommitAction, CngxStepperCommitHandler, CngxStepperCommitHandlerFactory, CngxStepperCommitHandlerOptions, CngxStepperConfig, CngxStepperConfigFeature, CngxStepperFallbackLabels, CngxStepperFeature, CngxStepperHost, CngxStepperI18n, CngxStepperI18nFeature, CngxStepperTemplateBindings, CngxStepperTemplateBindingsOptions, CngxStepperTemplates };
|