@cngx/ui 0.1.0-rc.7 → 0.1.0-rc.8
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/README.md +0 -1
- package/a11y/README.md +11 -5
- package/accordion/README.md +4 -2
- package/breadcrumb/README.md +262 -0
- package/collection/README.md +6 -0
- package/command-palette/README.md +224 -0
- package/data-grid-accordion/README.md +76 -2
- package/feedback/README.md +40 -0
- package/fesm2022/cngx-ui-a11y.mjs +189 -57
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -1
- package/fesm2022/cngx-ui-accordion.mjs +102 -35
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +112 -50
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +176 -96
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +180 -23
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -1
- package/fesm2022/cngx-ui-collection.mjs +194 -62
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +395 -119
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
- package/fesm2022/cngx-ui-context-menu.mjs +149 -34
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +415 -98
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +16 -6
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +1022 -439
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +75 -7
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
- package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +314 -141
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +69 -13
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +487 -178
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +327 -106
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +4 -16
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +107 -8
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +146 -46
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +191 -68
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +10 -6
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +74 -21
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
- package/fesm2022/cngx-ui-toc.mjs +70 -26
- package/fesm2022/cngx-ui-toc.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +15 -20
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-paginator/README.md +9 -2
- package/mat-tabs/styles/mat-tabs.css +9 -10
- package/overlay/README.md +9 -4
- package/package.json +4 -4
- package/paginator/README.md +8 -4
- package/sidenav/README.md +33 -11
- package/speak/README.md +3 -2
- package/stepper/README.md +13 -1
- package/timeline/README.md +1 -1
- package/toc/README.md +4 -1
- package/types/cngx-ui-a11y.d.ts +121 -30
- package/types/cngx-ui-accordion.d.ts +91 -26
- package/types/cngx-ui-action-button.d.ts +44 -3
- package/types/cngx-ui-breadcrumb.d.ts +154 -58
- package/types/cngx-ui-chart-panel.d.ts +122 -18
- package/types/cngx-ui-collection.d.ts +147 -55
- package/types/cngx-ui-command-palette.d.ts +297 -183
- package/types/cngx-ui-context-menu.d.ts +98 -6
- package/types/cngx-ui-data-grid-accordion.d.ts +274 -38
- package/types/cngx-ui-empty-state.d.ts +9 -2
- package/types/cngx-ui-feedback.d.ts +594 -56
- package/types/cngx-ui-mat-accordion.d.ts +29 -1
- package/types/cngx-ui-mat-paginator.d.ts +37 -8
- package/types/cngx-ui-mat-stepper.d.ts +23 -11
- package/types/cngx-ui-mat-tabs.d.ts +207 -14
- package/types/cngx-ui-overlay.d.ts +56 -10
- package/types/cngx-ui-paginator.d.ts +403 -129
- package/types/cngx-ui-sidenav.d.ts +248 -74
- package/types/cngx-ui-skeleton.d.ts +6 -7
- package/types/cngx-ui-speak.d.ts +118 -5
- package/types/cngx-ui-stat-card.d.ts +117 -33
- package/types/cngx-ui-stepper.d.ts +66 -27
- package/types/cngx-ui-tabs.d.ts +2 -2
- package/types/cngx-ui-timeline.d.ts +23 -7
- package/types/cngx-ui-toc.d.ts +80 -13
- package/types/cngx-ui.d.ts +7 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
+
import { MatExpansionPanel } from '@angular/material/expansion';
|
|
2
3
|
import * as i1 from '@cngx/common/interactive';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -34,6 +35,20 @@ import * as i1 from '@cngx/common/interactive';
|
|
|
34
35
|
* that re-asserts on every `multi` change) so Material never runs its own
|
|
35
36
|
* single-open close while the cngx `effectiveOpenIds` clamp arbitrates.
|
|
36
37
|
*
|
|
38
|
+
* Panels authored `[expanded]="true"` seed the open-set at first
|
|
39
|
+
* registration (Material→brain), so an initially-open Material panel
|
|
40
|
+
* is not closed by the initially-empty membership model. To make a
|
|
41
|
+
* pre-populated `[(openIds)]` addressable, bind `[panelIdFn]` - the
|
|
42
|
+
* hook replaces the generated per-panel ids with consumer-known keys:
|
|
43
|
+
*
|
|
44
|
+
* ```html
|
|
45
|
+
* <mat-accordion
|
|
46
|
+
* cngxMatAccordion
|
|
47
|
+
* [(openIds)]="openIds"
|
|
48
|
+
* [panelIdFn]="idFromPanel"
|
|
49
|
+
* >
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
37
52
|
* @playground Controlled open-set ./examples/bridge/bridge-example.component.ts
|
|
38
53
|
* @category ui/mat-accordion
|
|
39
54
|
* @docsKind primary
|
|
@@ -53,11 +68,24 @@ declare class CngxMatAccordion {
|
|
|
53
68
|
private readonly injector;
|
|
54
69
|
private readonly destroyRef;
|
|
55
70
|
private readonly panels;
|
|
71
|
+
private readonly ownPanels;
|
|
72
|
+
/**
|
|
73
|
+
* Per-panel id hook. When bound, the returned key is what the
|
|
74
|
+
* open-set stores for that panel - making a pre-populated
|
|
75
|
+
* `[(openIds)]` model addressable (the generated
|
|
76
|
+
* `cngx-mat-panel-N` ids are unknowable to consumers). The
|
|
77
|
+
* function must return a stable, unique id per panel instance;
|
|
78
|
+
* `MatExpansionPanel.id` (consumer-assignable) is a natural key.
|
|
79
|
+
* Unbound, ids fall back to generated `nextUid` values. Swapping
|
|
80
|
+
* the bound function at runtime re-keys future events but does not
|
|
81
|
+
* migrate ids already stored in `openIds` - bind it once.
|
|
82
|
+
*/
|
|
83
|
+
readonly panelIdFn: i0.InputSignal<((panel: MatExpansionPanel) => string) | undefined>;
|
|
56
84
|
private readonly idByPanel;
|
|
57
85
|
constructor();
|
|
58
86
|
private panelId;
|
|
59
87
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxMatAccordion, never>;
|
|
60
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxMatAccordion, "[cngxMatAccordion]", ["cngxMatAccordion"], {}, {}, ["panels"], never, true, [{ directive: typeof i1.CngxAccordion; inputs: { "multi": "multi"; "openIds": "openIds"; }; outputs: { "openIdsChange": "openIdsChange"; }; }]>;
|
|
88
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxMatAccordion, "[cngxMatAccordion]", ["cngxMatAccordion"], { "panelIdFn": { "alias": "panelIdFn"; "required": false; "isSignal": true; }; }, {}, ["panels"], never, true, [{ directive: typeof i1.CngxAccordion; inputs: { "multi": "multi"; "openIds": "openIds"; }; outputs: { "openIdsChange": "openIdsChange"; }; }]>;
|
|
61
89
|
}
|
|
62
90
|
|
|
63
91
|
export { CngxMatAccordion };
|
|
@@ -38,9 +38,12 @@ interface CngxMatPaginatorAnnounceContext {
|
|
|
38
38
|
* search value) changes, so a filtered result set never strands the user on a
|
|
39
39
|
* now-empty page. Pass a primitive (or a `computed` string key); an inline
|
|
40
40
|
* array literal recomputes every change-detection pass and would reset on each.
|
|
41
|
-
* - `[announce]` - mount a visually-hidden `aria-live` region that speaks the
|
|
42
|
-
* page
|
|
43
|
-
*
|
|
41
|
+
* - `[announce]` - mount a visually-hidden `aria-live` region that speaks the
|
|
42
|
+
* page after every change; `<mat-paginator>` only relabels its own range
|
|
43
|
+
* text, which AT does not announce. Phrasing resolves from the shared
|
|
44
|
+
* `CNGX_PAGINATOR_CONFIG` cascade (`announcements.pageChange`), so app-wide
|
|
45
|
+
* localisation covers the bridge and the organism together; bind
|
|
46
|
+
* `[announceLabel]` for a richer per-instance message with the visible range.
|
|
44
47
|
* - `[cngxPaginateRouting]` (generic companion directive from `@cngx/common/data`)
|
|
45
48
|
* - persist the page / size in the URL query string for deep-linkable,
|
|
46
49
|
* back-button-safe pagination.
|
|
@@ -87,10 +90,36 @@ declare class CngxMatPaginator {
|
|
|
87
90
|
* literal recomputes every change-detection pass and would reset every time.
|
|
88
91
|
*/
|
|
89
92
|
readonly resetOn: _angular_core.InputSignal<unknown>;
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Emits the effective page index on every change - navigation or a
|
|
95
|
+
* `total`-shrink clamp - exactly once per change, through the shared
|
|
96
|
+
* `connectPaginateEmit` guard. Clamp emits are held back while the brain is
|
|
97
|
+
* busy or `total` is 0, matching the `CngxPaginator` shell.
|
|
98
|
+
*/
|
|
99
|
+
readonly pageChange: _angular_core.OutputEmitterRef<number>;
|
|
100
|
+
/** Emits the effective page size exactly once per change. */
|
|
101
|
+
readonly pageSizeChange: _angular_core.OutputEmitterRef<number>;
|
|
102
|
+
/**
|
|
103
|
+
* Speak page changes through a visually-hidden `aria-live` region when set.
|
|
104
|
+
* `booleanAttribute` transform, so static `announce` markup enables it.
|
|
105
|
+
*/
|
|
106
|
+
readonly announce: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
107
|
+
/**
|
|
108
|
+
* Builds the announcement string from the page/range context. When unbound,
|
|
109
|
+
* the message resolves from the `CNGX_PAGINATOR_CONFIG` cascade
|
|
110
|
+
* (`announcements.pageChange`, "Page N of M" in the EN defaults), so
|
|
111
|
+
* `withPaginatorAnnouncements(...)` localises the bridge together with the
|
|
112
|
+
* `CngxPaginator` organism. Bind this for a richer per-instance message
|
|
113
|
+
* (the context also carries the visible item range).
|
|
114
|
+
*/
|
|
115
|
+
readonly announceLabel: _angular_core.InputSignal<((context: CngxMatPaginatorAnnounceContext) => string) | undefined>;
|
|
116
|
+
/**
|
|
117
|
+
* Paginator config cascade - shared with the `CngxPaginator` organism, so
|
|
118
|
+
* one `provideCngxPaginatorConfig(...)` localises both surfaces. Busy /
|
|
119
|
+
* settle phrases stay unspoken here: the bridge communicates the updating
|
|
120
|
+
* state via `aria-busy` on the host instead of a spoken transition.
|
|
121
|
+
*/
|
|
122
|
+
private readonly announcements;
|
|
94
123
|
private readonly elementRef;
|
|
95
124
|
private readonly renderer;
|
|
96
125
|
private readonly destroyRef;
|
|
@@ -101,7 +130,7 @@ declare class CngxMatPaginator {
|
|
|
101
130
|
/** A visually-hidden polite live region appended to the host paginator. */
|
|
102
131
|
private createLiveRegion;
|
|
103
132
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxMatPaginator, never>;
|
|
104
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxMatPaginator, "[cngxMatPaginator]", ["cngxMatPaginator"], { "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; "isSignal": true; }; "resetOn": { "alias": "resetOn"; "required": false; "isSignal": true; }; "announce": { "alias": "announce"; "required": false; "isSignal": true; }; "announceLabel": { "alias": "announceLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.CngxPaginate; inputs: { "cngxPageIndex": "cngxPageIndex"; "cngxPageSize": "cngxPageSize"; "total": "total"; "state": "state"; }; outputs: {
|
|
133
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxMatPaginator, "[cngxMatPaginator]", ["cngxMatPaginator"], { "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; "isSignal": true; }; "resetOn": { "alias": "resetOn"; "required": false; "isSignal": true; }; "announce": { "alias": "announce"; "required": false; "isSignal": true; }; "announceLabel": { "alias": "announceLabel"; "required": false; "isSignal": true; }; }, { "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; }, never, never, true, [{ directive: typeof i1.CngxPaginate; inputs: { "cngxPageIndex": "cngxPageIndex"; "cngxPageSize": "cngxPageSize"; "total": "total"; "state": "state"; }; outputs: {}; }]>;
|
|
105
134
|
}
|
|
106
135
|
|
|
107
136
|
export { CngxMatPaginator };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _cngx_common_stepper from '@cngx/common/stepper';
|
|
2
|
-
import { CngxStepRegistration } from '@cngx/common/stepper';
|
|
2
|
+
import { CngxStepperI18n, CngxStepRegistration } from '@cngx/common/stepper';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken } from '@angular/core';
|
|
4
|
+
import { InjectionToken, Signal } from '@angular/core';
|
|
5
5
|
import { MatStep } from '@angular/material/stepper';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -20,6 +20,11 @@ import { MatStep } from '@angular/material/stepper';
|
|
|
20
20
|
* the consumer authors native `<mat-step>` markup; CNGX is the
|
|
21
21
|
* behaviour layer. Topology mirrors `[cngxMatTabs]`.
|
|
22
22
|
*
|
|
23
|
+
* Commit-lifecycle transitions speak: the shared announcement builder
|
|
24
|
+
* feeds the root live announcer (pending / landed / rolled-back
|
|
25
|
+
* phrases, identical to `<cngx-stepper>`), and the host carries
|
|
26
|
+
* `aria-busy="true"` while a commit is in flight.
|
|
27
|
+
*
|
|
23
28
|
* Inputs/outputs are forwarded from {@link CngxStepperPresenter}:
|
|
24
29
|
* - `activeStepIndex` (two-way, with `activeStepIndexChange`),
|
|
25
30
|
* - `linear`,
|
|
@@ -76,10 +81,10 @@ declare class CngxMatStepper {
|
|
|
76
81
|
private readonly destroyRef;
|
|
77
82
|
private readonly injector;
|
|
78
83
|
private readonly matSteps;
|
|
79
|
-
private readonly setupsByStep;
|
|
80
84
|
private readonly createHandle;
|
|
85
|
+
private readonly i18n;
|
|
86
|
+
private readonly seam;
|
|
81
87
|
constructor();
|
|
82
|
-
private syncHandles;
|
|
83
88
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxMatStepper, never>;
|
|
84
89
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxMatStepper, "[cngxMatStepper]", ["cngxMatStepper"], {}, {}, ["matSteps"], never, true, [{ directive: typeof _cngx_common_stepper.CngxStepperPresenter; inputs: { "activeStepIndex": "activeStepIndex"; "linear": "linear"; "orientation": "orientation"; "commitAction": "commitAction"; "commitMode": "commitMode"; }; outputs: { "activeStepIndexChange": "activeStepIndexChange"; }; }]>;
|
|
85
90
|
}
|
|
@@ -117,9 +122,12 @@ interface CngxMatStepHandleSetup {
|
|
|
117
122
|
* throwaway detached `EmbeddedViewRef` ({@link readMatStepLabelTemplateText}).
|
|
118
123
|
* Captures literal `matStepLabel` markup; dynamic interpolation
|
|
119
124
|
* bails through to (4).
|
|
120
|
-
* 4. `
|
|
121
|
-
* id
|
|
122
|
-
*
|
|
125
|
+
* 4. `CNGX_STEPPER_I18N.stepFallbackLabel(id)` (English default
|
|
126
|
+
* `Step <id>`) - deterministic, derived from the cngx handle id.
|
|
127
|
+
* Always non-empty. The `[cngxMatStepper]` directive passes its
|
|
128
|
+
* injected bundle Signal as `i18n`. This tier follows a runtime
|
|
129
|
+
* language switch.
|
|
130
|
+
* Documented limitation: runtime changes of tiers 1-3 do not propagate.
|
|
123
131
|
* CDK's `CdkStep` does not expose a `_stateChanges` Subject
|
|
124
132
|
* analogous to `MatTab._stateChanges`, so cngx cannot re-trigger
|
|
125
133
|
* the snapshot when Material flips the input later. Surface the
|
|
@@ -147,12 +155,16 @@ interface CngxMatStepHandleSetup {
|
|
|
147
155
|
*
|
|
148
156
|
* @category ui/mat-stepper
|
|
149
157
|
*/
|
|
150
|
-
declare function createMatStepHandle(matStep: MatStep, idSeed: () => string): CngxMatStepHandleSetup;
|
|
158
|
+
declare function createMatStepHandle(matStep: MatStep, idSeed: () => string, i18n: Signal<CngxStepperI18n>): CngxMatStepHandleSetup;
|
|
151
159
|
/**
|
|
152
160
|
* Factory signature for {@link createMatStepHandle}. The DI token
|
|
153
161
|
* {@link CNGX_MAT_STEP_HANDLE_FACTORY} resolves to a function with
|
|
154
162
|
* this exact shape - overrides match it identically.
|
|
155
163
|
*
|
|
164
|
+
* The third argument is the stepper i18n Signal the directive injected;
|
|
165
|
+
* it carries the last-resort label (`stepFallbackLabel`). Forward it when
|
|
166
|
+
* delegating to {@link createMatStepHandle}.
|
|
167
|
+
*
|
|
156
168
|
* @category ui/mat-stepper
|
|
157
169
|
*/
|
|
158
170
|
type CngxMatStepHandleFactory = typeof createMatStepHandle;
|
|
@@ -180,8 +192,8 @@ type CngxMatStepHandleFactory = typeof createMatStepHandle;
|
|
|
180
192
|
* providers: [
|
|
181
193
|
* {
|
|
182
194
|
* provide: CNGX_MAT_STEP_HANDLE_FACTORY,
|
|
183
|
-
* useValue: ((step, idSeed) => {
|
|
184
|
-
* const setup = createMatStepHandle(step, idSeed);
|
|
195
|
+
* useValue: ((step, idSeed, i18n) => {
|
|
196
|
+
* const setup = createMatStepHandle(step, idSeed, i18n);
|
|
185
197
|
* reportStepRegistered(setup.handle.id);
|
|
186
198
|
* return setup;
|
|
187
199
|
* }) satisfies CngxMatStepHandleFactory,
|
|
@@ -197,4 +209,4 @@ type CngxMatStepHandleFactory = typeof createMatStepHandle;
|
|
|
197
209
|
declare const CNGX_MAT_STEP_HANDLE_FACTORY: InjectionToken<typeof createMatStepHandle>;
|
|
198
210
|
|
|
199
211
|
export { CNGX_MAT_STEP_HANDLE_FACTORY, CngxMatStepper, createMatStepHandle };
|
|
200
|
-
export type { CngxMatStepHandleFactory };
|
|
212
|
+
export type { CngxMatStepHandleFactory, CngxMatStepHandleSetup };
|
|
@@ -132,11 +132,20 @@ declare const CNGX_MAT_TABS_REGISTRY_HOST: InjectionToken<CngxMatTabsRegistryHos
|
|
|
132
132
|
* LOC guard and lets per-tab decoration directives reach the
|
|
133
133
|
* registry through a typed token.
|
|
134
134
|
*
|
|
135
|
-
* Owns: `contentChildren(MatTab)` query, the
|
|
136
|
-
* (per-tab cngx setup paired with a child
|
|
137
|
-
* scoping the `_stateChanges` bridge), an
|
|
138
|
-
*
|
|
139
|
-
*
|
|
135
|
+
* Owns: `contentChildren(MatTab)` query, the order-aware
|
|
136
|
+
* registration seam (per-tab cngx setup paired with a child
|
|
137
|
+
* `EnvironmentInjector` scoping the `_stateChanges` bridge), an
|
|
138
|
+
* `effect()` that mirrors the MatTab query order into
|
|
139
|
+
* `CNGX_TAB_GROUP_HOST` on every emission, and a `DestroyRef`
|
|
140
|
+
* cleanup that unregisters and destroys every entry.
|
|
141
|
+
*
|
|
142
|
+
* Order matters: the presenter registry appends new registrations,
|
|
143
|
+
* but Material renders tabs at their DOM position - a mid-list
|
|
144
|
+
* `<mat-tab>` insert must land at its query index, not at the tail,
|
|
145
|
+
* or index-based selection, announcements and decorations target the
|
|
146
|
+
* wrong tab. The shared seam re-registers the diverging suffix in
|
|
147
|
+
* query order while keeping surviving handle instances (and their
|
|
148
|
+
* child injectors) alive.
|
|
140
149
|
*
|
|
141
150
|
* Composition: `[cngxMatTabs]` declares this in `hostDirectives`;
|
|
142
151
|
* both share the parent's `CngxTabGroupPresenter` and the same
|
|
@@ -154,11 +163,11 @@ declare class CngxMatTabsRegistry implements CngxMatTabsRegistryHost {
|
|
|
154
163
|
private readonly destroyRef;
|
|
155
164
|
private readonly envInjector;
|
|
156
165
|
private readonly createHandle;
|
|
166
|
+
private readonly matTabGroup;
|
|
157
167
|
private readonly matTabs;
|
|
158
|
-
private readonly
|
|
168
|
+
private readonly seam;
|
|
159
169
|
constructor();
|
|
160
170
|
getHandleSetup(matTab: MatTab): Pick<CngxMatTabHandleSetup, 'errorAggregator' | 'directError'> | undefined;
|
|
161
|
-
private syncHandles;
|
|
162
171
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxMatTabsRegistry, never>;
|
|
163
172
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxMatTabsRegistry, "[cngxMatTabsRegistry]", ["cngxMatTabsRegistry"], {}, {}, ["matTabs"], never, true, never>;
|
|
164
173
|
}
|
|
@@ -180,6 +189,18 @@ declare class CngxMatTabsRegistry implements CngxMatTabsRegistryHost {
|
|
|
180
189
|
* `./decorations/`; this directive supplies their reactive triggers
|
|
181
190
|
* and the delegators consumer templates call.
|
|
182
191
|
*
|
|
192
|
+
* **Inert on this bridge: `loop` and `orientation`.** Both are
|
|
193
|
+
* forwarded so templates stay portable between `<cngx-tab-group>` and
|
|
194
|
+
* the instrumented `<mat-tab-group>`, but Material owns the keyboard
|
|
195
|
+
* interaction and the strip layout here - `loop` never changes
|
|
196
|
+
* Material's Home/End/arrow behaviour, and `orientation` never
|
|
197
|
+
* rotates the Material strip (use `<mat-tab-group headerPosition>` /
|
|
198
|
+
* Material's own APIs for that). `orientation` still reaches the
|
|
199
|
+
* cngx side through the overflow panel-host adapter; `loop` feeds
|
|
200
|
+
* nothing Material does not already own. Deliberately kept in the
|
|
201
|
+
* forwarded input set for template portability - removing them would
|
|
202
|
+
* break `<cngx-tab-group>`-authored templates on paste.
|
|
203
|
+
*
|
|
183
204
|
* @playground Form error aggregation ./examples/form-errors/form-errors.component.ts
|
|
184
205
|
*
|
|
185
206
|
* @category ui/mat-tabs
|
|
@@ -202,10 +223,10 @@ declare class CngxMatTabs {
|
|
|
202
223
|
private readonly overflowRef;
|
|
203
224
|
private readonly aggregatorContentSlot;
|
|
204
225
|
private readonly aggregatorContentTemplate;
|
|
226
|
+
private readonly matTabsConfig;
|
|
205
227
|
private readonly rejectionContentSlot;
|
|
206
228
|
private readonly rejectionContentTemplate;
|
|
207
229
|
private readonly i18n;
|
|
208
|
-
private readonly failedHandleId;
|
|
209
230
|
private readonly rejectionState;
|
|
210
231
|
private readonly aggregatedErrorTabs;
|
|
211
232
|
constructor();
|
|
@@ -237,7 +258,15 @@ declare class CngxMatTabs {
|
|
|
237
258
|
* reflects `NavigationEnd` onto `activeIndex` (its commit-action stays
|
|
238
259
|
* dormant because link clicks navigate natively, never through
|
|
239
260
|
* `presenter.select`). Ableitung statt Verwaltung - the route-active
|
|
240
|
-
* link is the single source of the active index.
|
|
261
|
+
* link is the single source of the active index. `activeIndex` /
|
|
262
|
+
* `activeIndexChange` are forwarded from the presenter hostDirective,
|
|
263
|
+
* so a consumer without route-sync can two-way bind the active link
|
|
264
|
+
* the same way `[cngxMatTabs]` consumers do.
|
|
265
|
+
*
|
|
266
|
+
* Active-link changes speak: the shared nav announcement bundle
|
|
267
|
+
* ({@link createTabNavAnnouncement}) feeds the landing link's label to
|
|
268
|
+
* the shared live announcer - silent through the mount window, so a
|
|
269
|
+
* deep link's initial active state is not announced as a change.
|
|
241
270
|
*
|
|
242
271
|
* Composes {@link CngxTabGroupPresenter} via `hostDirectives` so the
|
|
243
272
|
* `CNGX_STATEFUL` producer, the `lastFailedIndex` rejection slot, and
|
|
@@ -265,7 +294,6 @@ declare class CngxMatTabNav {
|
|
|
265
294
|
private readonly renderer;
|
|
266
295
|
private readonly hostEl;
|
|
267
296
|
private readonly i18n;
|
|
268
|
-
private readonly failedHandleId;
|
|
269
297
|
private readonly rejectionState;
|
|
270
298
|
private readonly aggregatedErrorTabs;
|
|
271
299
|
constructor();
|
|
@@ -276,7 +304,7 @@ declare class CngxMatTabNav {
|
|
|
276
304
|
*/
|
|
277
305
|
clearLastFailed(): void;
|
|
278
306
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxMatTabNav, never>;
|
|
279
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxMatTabNav, "[cngxMatTabNav]", ["cngxMatTabNav"], {}, {}, never, never, true, [{ directive: typeof i1.CngxTabGroupPresenter; inputs: {}; outputs: {}; }]>;
|
|
307
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxMatTabNav, "[cngxMatTabNav]", ["cngxMatTabNav"], {}, {}, never, never, true, [{ directive: typeof i1.CngxTabGroupPresenter; inputs: { "activeIndex": "activeIndex"; }; outputs: { "activeIndexChange": "activeIndexChange"; }; }]>;
|
|
280
308
|
}
|
|
281
309
|
|
|
282
310
|
/**
|
|
@@ -556,7 +584,9 @@ interface CngxMatTabRejectionContentContext {
|
|
|
556
584
|
* Cascade resolution:
|
|
557
585
|
* 1. Per-instance `*cngxMatTabRejectionContent` template wins
|
|
558
586
|
* via `contentChild(CngxMatTabRejectionContent)`.
|
|
559
|
-
* 2.
|
|
587
|
+
* 2. `CNGX_MAT_TABS_CONFIG.templates.rejection` (app-wide middle
|
|
588
|
+
* tier, set via `withMatTabRejectionTemplate`).
|
|
589
|
+
* 3. Library default - imperative `Renderer2.createElement('span')`
|
|
560
590
|
* with `textContent = fallbackText` (the resolved
|
|
561
591
|
* `commitRolledBackTo(originLabel)` / `commitFailedRetry`
|
|
562
592
|
* phrase from `injectTabsI18n()`).
|
|
@@ -611,6 +641,23 @@ declare class CngxMatTabRejectionContent {
|
|
|
611
641
|
*/
|
|
612
642
|
type CngxMatTabHalfWiredSlotSink = (missing: 'contentTemplate' | 'viewContainerRef') => void;
|
|
613
643
|
|
|
644
|
+
/**
|
|
645
|
+
* App-wide template defaults for the `[cngxMatTabs]` decorations -
|
|
646
|
+
* the middle cascade tier between a per-instance structural slot and
|
|
647
|
+
* the built-in fallback. Sibling of `CngxTabsTemplates` /
|
|
648
|
+
* `CngxStepperTemplates` so consumer templates port across families.
|
|
649
|
+
*
|
|
650
|
+
* @category ui/mat-tabs
|
|
651
|
+
*/
|
|
652
|
+
interface CngxMatTabsTemplates {
|
|
653
|
+
/**
|
|
654
|
+
* Default for the rejection SR-descriptor content
|
|
655
|
+
* (`*cngxMatTabRejectionContent`). Per-instance slot still wins;
|
|
656
|
+
* without either tier the imperative fallback writes the resolved
|
|
657
|
+
* i18n phrase verbatim.
|
|
658
|
+
*/
|
|
659
|
+
readonly rejection?: TemplateRef<CngxMatTabRejectionContentContext>;
|
|
660
|
+
}
|
|
614
661
|
/**
|
|
615
662
|
* Behaviour knobs for `[cngxMatTabs]`. Single canonical surface
|
|
616
663
|
* symmetric to `provideSelectConfig` in the select family - every
|
|
@@ -655,7 +702,25 @@ interface CngxMatTabsConfig {
|
|
|
655
702
|
* (Sentry breadcrumbs, custom logger, CI fail-fast).
|
|
656
703
|
*/
|
|
657
704
|
readonly halfWiredSlotSink?: CngxMatTabHalfWiredSlotSink;
|
|
705
|
+
/**
|
|
706
|
+
* App-wide decoration template defaults - the middle cascade tier.
|
|
707
|
+
* Per-instance structural slots still win; see
|
|
708
|
+
* {@link CngxMatTabsTemplates}.
|
|
709
|
+
*/
|
|
710
|
+
readonly templates?: CngxMatTabsTemplates;
|
|
658
711
|
}
|
|
712
|
+
/**
|
|
713
|
+
* Library defaults for `[cngxMatTabs]`. Source of truth for every
|
|
714
|
+
* key on {@link CngxMatTabsConfig}. Consumed by
|
|
715
|
+
* {@link injectMatTabsConfig} as the final fallback.
|
|
716
|
+
*
|
|
717
|
+
* @internal
|
|
718
|
+
*/
|
|
719
|
+
declare const CNGX_MAT_TABS_CONFIG_DEFAULTS: {
|
|
720
|
+
readonly anchorMaxAttempts: 5;
|
|
721
|
+
readonly halfWiredSlotSink: CngxMatTabHalfWiredSlotSink;
|
|
722
|
+
readonly templates: {};
|
|
723
|
+
};
|
|
659
724
|
/**
|
|
660
725
|
* DI token holding a partial {@link CngxMatTabsConfig}. Set via
|
|
661
726
|
* {@link provideMatTabsConfig} (app-wide) or
|
|
@@ -697,6 +762,15 @@ declare function withAnchorRetryAttempts(n: number): CngxMatTabsConfigFeature;
|
|
|
697
762
|
* @category ui/mat-tabs
|
|
698
763
|
*/
|
|
699
764
|
declare function withHalfWiredSlotSink(sink: CngxMatTabHalfWiredSlotSink): CngxMatTabsConfigFeature;
|
|
765
|
+
/**
|
|
766
|
+
* App-wide override for the rejection SR-descriptor content. Middle
|
|
767
|
+
* tier; per-instance `*cngxMatTabRejectionContent` still wins.
|
|
768
|
+
* Sibling of {@link withTabRejectionIconTemplate} in the cngx-native
|
|
769
|
+
* family.
|
|
770
|
+
*
|
|
771
|
+
* @category ui/mat-tabs
|
|
772
|
+
*/
|
|
773
|
+
declare function withMatTabRejectionTemplate(template: TemplateRef<CngxMatTabRejectionContentContext>): CngxMatTabsConfigFeature;
|
|
700
774
|
/**
|
|
701
775
|
* App-wide `[cngxMatTabs]` configuration. Returns
|
|
702
776
|
* `EnvironmentProviders` for use inside `bootstrapApplication`'s
|
|
@@ -722,6 +796,11 @@ declare function provideMatTabsConfig(...features: CngxMatTabsConfigFeature[]):
|
|
|
722
796
|
* `providers` or `viewProviders` (which cannot accept opaque
|
|
723
797
|
* environment providers).
|
|
724
798
|
*
|
|
799
|
+
* Merges over the outer config (via `skipSelf`), so a component-scope
|
|
800
|
+
* call refines the root {@link provideMatTabsConfig} instead of
|
|
801
|
+
* reverting its untouched keys to library defaults - only the keys
|
|
802
|
+
* the local features set are overridden for the subtree.
|
|
803
|
+
*
|
|
725
804
|
* ```ts
|
|
726
805
|
* @Component({
|
|
727
806
|
* selector: 'app-tabs-page',
|
|
@@ -789,6 +868,18 @@ declare namespace MaterialPrivateSurfaces {
|
|
|
789
868
|
interface StateChangeSource {
|
|
790
869
|
readonly _stateChanges: Subject<void>;
|
|
791
870
|
}
|
|
871
|
+
/**
|
|
872
|
+
* Subset of Material's `MatTab` carrying the `_closestTabGroup`
|
|
873
|
+
* back-reference (the owning `MatTabGroup`, resolved via DI at
|
|
874
|
+
* construction). Material's own `_allTabs` filter compares against
|
|
875
|
+
* it for exactly the reason cngx does: a `descendants: true` query
|
|
876
|
+
* also surfaces tabs of a nested `<mat-tab-group>`, and only the
|
|
877
|
+
* ownership comparison separates them. Typed `unknown` because the
|
|
878
|
+
* upstream declaration is `any` - cngx only ever identity-compares.
|
|
879
|
+
*/
|
|
880
|
+
interface ClosestTabGroupSource {
|
|
881
|
+
readonly _closestTabGroup: unknown;
|
|
882
|
+
}
|
|
792
883
|
/**
|
|
793
884
|
* Subset of Material's `MatStepper` carrying the `_iconOverrides`
|
|
794
885
|
* map. `<cngx-mat-stepper>` patches this map inside
|
|
@@ -845,6 +936,108 @@ declare namespace MaterialPrivateSurfaces {
|
|
|
845
936
|
const MAT_MDC_TAB_LABEL_CONTAINER_SELECTOR = ".mat-mdc-tab-label-container";
|
|
846
937
|
}
|
|
847
938
|
|
|
939
|
+
/**
|
|
940
|
+
* Shared order-aware registration seam for the Material
|
|
941
|
+
* instrumentation directives (`[cngxMatTabs]`, `[cngxMatStepper]`).
|
|
942
|
+
*
|
|
943
|
+
* Both bridges diff a `contentChildren(Mat*)` query into a presenter
|
|
944
|
+
* registry via `register`/`unregister`. The presenters keep pure
|
|
945
|
+
* insertion order and append every new registration at the end, so a
|
|
946
|
+
* mid-list `<mat-tab>` / `<mat-step>` insert would register at the
|
|
947
|
+
* tail while Material renders it at its DOM position - index-based
|
|
948
|
+
* selection, announcements and decorations would then target the
|
|
949
|
+
* wrong item. This seam mirrors the query order into the presenter on
|
|
950
|
+
* every emission: surviving prefix entries stay untouched, the
|
|
951
|
+
* diverging suffix is unregistered and re-registered in query order
|
|
952
|
+
* with the SAME handle instances (per-entry resources such as child
|
|
953
|
+
* injectors are never re-created for surviving items).
|
|
954
|
+
*
|
|
955
|
+
* Pure TypeScript, no Angular imports. Lives in the mat-tabs entry
|
|
956
|
+
* and is exported `@internal` from its barrel for cross-entry
|
|
957
|
+
* consumption by `@cngx/ui/mat-stepper` - ng-packagr rejects source
|
|
958
|
+
* files shared between entry points by relative import, so the
|
|
959
|
+
* export-plus-internal-tag route (the `MaterialPrivateSurfaces`
|
|
960
|
+
* pattern) is the supported sharing path.
|
|
961
|
+
*
|
|
962
|
+
* @internal
|
|
963
|
+
*/
|
|
964
|
+
interface CngxOrderedRegistrationSeamOptions<TItem, TEntry> {
|
|
965
|
+
/** Build the per-item entry (handle setup + resources). Called once per item lifetime. */
|
|
966
|
+
create(item: TItem): TEntry;
|
|
967
|
+
/** Register the entry's handle with the presenter. */
|
|
968
|
+
register(entry: TEntry): void;
|
|
969
|
+
/** Remove the entry's handle from the presenter (resources stay alive). */
|
|
970
|
+
unregister(entry: TEntry): void;
|
|
971
|
+
/** Release per-entry resources (child injector etc.). Called once, after the final unregister. */
|
|
972
|
+
dispose(entry: TEntry): void;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Stateful diff surface returned by {@link createOrderedRegistrationSeam}.
|
|
976
|
+
*
|
|
977
|
+
* @internal
|
|
978
|
+
*/
|
|
979
|
+
interface CngxOrderedRegistrationSeam<TItem, TEntry> {
|
|
980
|
+
/**
|
|
981
|
+
* Mirror `items` (the current `contentChildren` emission, in query
|
|
982
|
+
* order) into the presenter registry. Removed items are
|
|
983
|
+
* unregistered and disposed; new items are created and registered;
|
|
984
|
+
* surviving items keep their entry, and any item whose position
|
|
985
|
+
* diverged from the registered order is re-registered so the
|
|
986
|
+
* presenter's order matches `items` exactly.
|
|
987
|
+
*/
|
|
988
|
+
sync(items: readonly TItem[]): void;
|
|
989
|
+
/** Entry lookup for per-item decoration hooks. */
|
|
990
|
+
get(item: TItem): TEntry | undefined;
|
|
991
|
+
/** Unregister and dispose every entry (directive destroy). */
|
|
992
|
+
clear(): void;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Create the order-aware registration seam. See the module JSDoc for
|
|
996
|
+
* the contract.
|
|
997
|
+
*
|
|
998
|
+
* @internal
|
|
999
|
+
*/
|
|
1000
|
+
declare function createOrderedRegistrationSeam<TItem, TEntry>(options: CngxOrderedRegistrationSeamOptions<TItem, TEntry>): CngxOrderedRegistrationSeam<TItem, TEntry>;
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Options for {@link mountLiveRegionAnnouncer}.
|
|
1004
|
+
*
|
|
1005
|
+
* @internal
|
|
1006
|
+
*/
|
|
1007
|
+
interface CngxMatBridgeLiveRegionOptions {
|
|
1008
|
+
/** Reactive announcement text. Empty string keeps the region quiet. */
|
|
1009
|
+
readonly announcement: Signal<string>;
|
|
1010
|
+
readonly injector: Injector;
|
|
1011
|
+
/** Default: `'polite'`. */
|
|
1012
|
+
readonly politeness?: 'polite' | 'assertive';
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Keep the shared {@link CngxLiveAnnouncer} in sync with the supplied
|
|
1016
|
+
* `announcement` signal: an `effect` reads the reactive text and
|
|
1017
|
+
* forwards every non-empty value to the root announcer at the
|
|
1018
|
+
* configured politeness (default `'polite'`). An empty string between
|
|
1019
|
+
* transitions keeps the region quiet on no-op CD ticks.
|
|
1020
|
+
*
|
|
1021
|
+
* Delegates to {@link CngxLiveAnnouncer} instead of mounting its own
|
|
1022
|
+
* body span, so the announcer owns the persistent polite/assertive
|
|
1023
|
+
* region pair, the clear-then-set re-announce, and teardown. The
|
|
1024
|
+
* delegated region carries `aria-live` + `aria-atomic="true"` and no
|
|
1025
|
+
* explicit `role`; `aria-atomic` re-reads full content and `aria-live`
|
|
1026
|
+
* carries the politeness, so a tab-change status utterance still reads.
|
|
1027
|
+
*
|
|
1028
|
+
* The `effect` is created in `opts.injector`'s context, so it is torn
|
|
1029
|
+
* down with the host directive; the service call is wrapped in
|
|
1030
|
+
* `untracked` - the announcer owns its own clear-then-set timer, so it
|
|
1031
|
+
* stays out of the effect's dependency graph.
|
|
1032
|
+
*
|
|
1033
|
+
* @internal - helper shared by the Material bridge directives
|
|
1034
|
+
* (`[cngxMatTabs]`, `[cngxMatTabNav]`, `[cngxMatStepper]`). Exported
|
|
1035
|
+
* `@internal` from the mat-tabs barrel for cross-entry consumption
|
|
1036
|
+
* (the `MaterialPrivateSurfaces` pattern) - ng-packagr rejects
|
|
1037
|
+
* relative-import file sharing between entry points.
|
|
1038
|
+
*/
|
|
1039
|
+
declare function mountLiveRegionAnnouncer(opts: CngxMatBridgeLiveRegionOptions): void;
|
|
1040
|
+
|
|
848
1041
|
/**
|
|
849
1042
|
* Material variant of {@link CngxTabOverflowDomAdapter}.
|
|
850
1043
|
*
|
|
@@ -874,5 +1067,5 @@ declare namespace MaterialPrivateSurfaces {
|
|
|
874
1067
|
*/
|
|
875
1068
|
declare function createCngxMatTabOverflowDomAdapter(): CngxTabOverflowDomAdapter;
|
|
876
1069
|
|
|
877
|
-
export { CNGX_MAT_TABS_CONFIG, CNGX_MAT_TABS_REGISTRY_HOST, CNGX_MAT_TAB_HANDLE_FACTORY, CngxMatTabAggregatorContent, CngxMatTabError, CngxMatTabErrorFlag, CngxMatTabLink, CngxMatTabNav, CngxMatTabRejectionContent, CngxMatTabs, CngxMatTabsRegistry, MaterialPrivateSurfaces, createCngxMatTabOverflowDomAdapter, createMatTabHandle, injectMatTabsConfig, provideMatTabsConfig, provideMatTabsConfigAt, withAnchorRetryAttempts, withHalfWiredSlotSink };
|
|
878
|
-
export type { CngxMatTabAggregatorContentContext, CngxMatTabHalfWiredSlotSink, CngxMatTabHandleFactory, CngxMatTabRejectionContentContext, CngxMatTabsConfig, CngxMatTabsConfigFeature, CngxMatTabsRegistryHost };
|
|
1070
|
+
export { CNGX_MAT_TABS_CONFIG, CNGX_MAT_TABS_CONFIG_DEFAULTS, CNGX_MAT_TABS_REGISTRY_HOST, CNGX_MAT_TAB_HANDLE_FACTORY, CngxMatTabAggregatorContent, CngxMatTabError, CngxMatTabErrorFlag, CngxMatTabLink, CngxMatTabNav, CngxMatTabRejectionContent, CngxMatTabs, CngxMatTabsRegistry, MaterialPrivateSurfaces, createCngxMatTabOverflowDomAdapter, createMatTabHandle, createOrderedRegistrationSeam, injectMatTabsConfig, mountLiveRegionAnnouncer, provideMatTabsConfig, provideMatTabsConfigAt, withAnchorRetryAttempts, withHalfWiredSlotSink, withMatTabRejectionTemplate };
|
|
1071
|
+
export type { CngxMatBridgeLiveRegionOptions, CngxMatTabAggregatorContentContext, CngxMatTabHalfWiredSlotSink, CngxMatTabHandleFactory, CngxMatTabHandleSetup, CngxMatTabRejectionContentContext, CngxMatTabsConfig, CngxMatTabsConfigFeature, CngxMatTabsRegistryHost, CngxMatTabsTemplates, CngxOrderedRegistrationSeam, CngxOrderedRegistrationSeamOptions };
|
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Type, EnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { Signal, Type, EnvironmentProviders } from '@angular/core';
|
|
3
3
|
import { OverlayRef, OverlayConfig } from '@angular/cdk/overlay';
|
|
4
4
|
import * as rxjs from 'rxjs';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Construction-time options for a {@link CngxOverlayRef}. Set by
|
|
8
|
+
* {@link CngxOverlay.open}, not by consumers.
|
|
9
|
+
*
|
|
10
|
+
* @category ui/overlay
|
|
11
|
+
*/
|
|
12
|
+
interface CngxOverlayRefConfig {
|
|
13
|
+
/**
|
|
14
|
+
* When `true`, neither Escape nor a backdrop click closes the overlay - the
|
|
15
|
+
* only way out is a programmatic `close()`. Default `false`.
|
|
16
|
+
*/
|
|
17
|
+
readonly disableClose?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Element focus returns to when the overlay closes - captured at open time,
|
|
20
|
+
* before the overlay steals focus. `null` skips restoration.
|
|
21
|
+
*/
|
|
22
|
+
readonly restoreFocusTo?: HTMLElement | null;
|
|
23
|
+
}
|
|
6
24
|
/**
|
|
7
25
|
* Typed wrapper around a CDK OverlayRef that exposes a close result stream.
|
|
8
26
|
*
|
|
27
|
+
* Closes on Escape and on a backdrop click (unless `disableClose`), restores
|
|
28
|
+
* focus to the element that opened it, and surfaces its open state as a signal
|
|
29
|
+
* beside the RxJS `afterClosed$`.
|
|
30
|
+
*
|
|
9
31
|
* @category ui/overlay
|
|
10
32
|
* @docsKind primary
|
|
11
33
|
* @wcag AA
|
|
@@ -18,19 +40,38 @@ declare class CngxOverlayRef<R = unknown> {
|
|
|
18
40
|
private readonly _afterClosed;
|
|
19
41
|
/** Emits once with the close result when the overlay is dismissed, then completes. */
|
|
20
42
|
readonly afterClosed$: rxjs.Observable<R | undefined>;
|
|
21
|
-
|
|
22
|
-
/**
|
|
43
|
+
private readonly openState;
|
|
44
|
+
/**
|
|
45
|
+
* `true` while the overlay is open, `false` once closed. The signal view of
|
|
46
|
+
* the lifecycle beside {@link afterClosed$} - bind it in a template without
|
|
47
|
+
* an `async` pipe.
|
|
48
|
+
*/
|
|
49
|
+
readonly isOpen: Signal<boolean>;
|
|
50
|
+
private readonly restoreFocusTo;
|
|
51
|
+
constructor(cdkRef: OverlayRef, config?: CngxOverlayRefConfig);
|
|
52
|
+
/**
|
|
53
|
+
* Closes the overlay, emitting `result` on `afterClosed$`, disposing the CDK
|
|
54
|
+
* ref, and restoring focus. Idempotent - a second call (e.g. Escape after a
|
|
55
|
+
* scope teardown already closed it) is a no-op.
|
|
56
|
+
*/
|
|
23
57
|
close(result?: R): void;
|
|
24
58
|
}
|
|
25
59
|
|
|
26
60
|
/**
|
|
27
|
-
* Config accepted by {@link CngxOverlay.open}.
|
|
28
|
-
* {@link OverlayConfig} - every field is optional and falls back to
|
|
29
|
-
*
|
|
61
|
+
* Config accepted by {@link CngxOverlay.open}. A partial of CDK's
|
|
62
|
+
* {@link OverlayConfig} - every field is optional and falls back to the CDK
|
|
63
|
+
* overlay default - plus `disableClose`, a cngx addition that turns off the
|
|
64
|
+
* Escape / backdrop dismiss affordances.
|
|
30
65
|
*
|
|
31
66
|
* @category ui/overlay
|
|
32
67
|
*/
|
|
33
|
-
type CngxOverlayConfig = Partial<OverlayConfig
|
|
68
|
+
type CngxOverlayConfig = Partial<OverlayConfig> & {
|
|
69
|
+
/**
|
|
70
|
+
* When `true`, Escape and backdrop clicks do not close the overlay; only a
|
|
71
|
+
* programmatic `close()` does. Default `false`.
|
|
72
|
+
*/
|
|
73
|
+
readonly disableClose?: boolean;
|
|
74
|
+
};
|
|
34
75
|
/**
|
|
35
76
|
* Thin service over CDK Overlay that returns a typed CngxOverlayRef.
|
|
36
77
|
*
|
|
@@ -54,14 +95,19 @@ type CngxOverlayConfig = Partial<OverlayConfig>;
|
|
|
54
95
|
declare class CngxOverlay {
|
|
55
96
|
private readonly overlay;
|
|
56
97
|
private readonly injector;
|
|
98
|
+
private readonly document;
|
|
99
|
+
private readonly openRefs;
|
|
100
|
+
constructor();
|
|
57
101
|
/**
|
|
58
102
|
* Opens `component` in a CDK overlay panel and returns a typed ref.
|
|
59
103
|
*
|
|
60
|
-
* Defaults to a centered, backdropped panel
|
|
61
|
-
*
|
|
104
|
+
* Defaults to a centered, backdropped panel that closes on Escape or a
|
|
105
|
+
* backdrop click; pass `disableClose` to opt out. Focus returns to the
|
|
106
|
+
* element that was focused at open time. Merge `config` to override position
|
|
107
|
+
* strategy, scroll strategy, or any other CDK `OverlayConfig` option.
|
|
62
108
|
*
|
|
63
109
|
* @param component Component class to attach as a portal.
|
|
64
|
-
* @param config CDK
|
|
110
|
+
* @param config Overlay configuration overrides (CDK options + `disableClose`).
|
|
65
111
|
*/
|
|
66
112
|
open<C, R = unknown>(component: Type<C>, config?: CngxOverlayConfig): CngxOverlayRef<R>;
|
|
67
113
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxOverlay, never>;
|