@cngx/ui 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 +550 -0
- package/action-button/README.md +98 -0
- package/empty-state/README.md +103 -0
- package/feedback/README.md +33 -0
- package/fesm2022/cngx-ui-action-button.mjs +319 -0
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -0
- package/fesm2022/cngx-ui-empty-state.mjs +138 -0
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -0
- package/fesm2022/cngx-ui-feedback.mjs +2962 -0
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -0
- package/fesm2022/cngx-ui-layout.mjs +89 -0
- package/fesm2022/cngx-ui-layout.mjs.map +1 -0
- package/fesm2022/cngx-ui-mat-stepper.mjs +567 -0
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -0
- package/fesm2022/cngx-ui-mat-tabs.mjs +1405 -0
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -0
- package/fesm2022/cngx-ui-material.mjs +79 -0
- package/fesm2022/cngx-ui-material.mjs.map +1 -0
- package/fesm2022/cngx-ui-overlay.mjs +91 -0
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -0
- package/fesm2022/cngx-ui-sidenav.mjs +521 -0
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -0
- package/fesm2022/cngx-ui-skeleton.mjs +158 -0
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -0
- package/fesm2022/cngx-ui-speak.mjs +112 -0
- package/fesm2022/cngx-ui-speak.mjs.map +1 -0
- package/fesm2022/cngx-ui-stepper.mjs +312 -0
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -0
- package/fesm2022/cngx-ui-tabs.mjs +507 -0
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -0
- package/fesm2022/cngx-ui.mjs +45 -0
- package/fesm2022/cngx-ui.mjs.map +1 -0
- package/layout/README.md +133 -0
- package/mat-stepper/README.md +34 -0
- package/mat-tabs/README.md +163 -0
- package/mat-tabs/styles/mat-tabs.css +233 -0
- package/material/README.md +90 -0
- package/overlay/README.md +99 -0
- package/package.json +98 -0
- package/sidenav/README.md +127 -0
- package/skeleton/README.md +98 -0
- package/speak/README.md +93 -0
- package/speak/speak-button-theme.scss +78 -0
- package/stepper/README.md +40 -0
- package/tabs/README.md +28 -0
- package/types/cngx-ui-action-button.d.ts +126 -0
- package/types/cngx-ui-empty-state.d.ts +41 -0
- package/types/cngx-ui-feedback.d.ts +1174 -0
- package/types/cngx-ui-layout.d.ts +56 -0
- package/types/cngx-ui-mat-stepper.d.ts +234 -0
- package/types/cngx-ui-mat-tabs.d.ts +664 -0
- package/types/cngx-ui-material.d.ts +36 -0
- package/types/cngx-ui-overlay.d.ts +57 -0
- package/types/cngx-ui-sidenav.d.ts +209 -0
- package/types/cngx-ui-skeleton.d.ts +97 -0
- package/types/cngx-ui-speak.d.ts +31 -0
- package/types/cngx-ui-stepper.d.ts +129 -0
- package/types/cngx-ui-tabs.d.ts +165 -0
- package/types/cngx-ui.d.ts +18 -0
|
@@ -0,0 +1,1405 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { runInInjectionContext, effect, untracked, afterNextRender, isDevMode, InjectionToken, makeEnvironmentProviders, inject, TemplateRef, Directive, computed, signal, DestroyRef, EnvironmentInjector, contentChildren, createEnvironmentInjector, Injectable, Injector, Renderer2, ElementRef, ViewContainerRef, contentChild, input } from '@angular/core';
|
|
3
|
+
import { MatTab, MatTabGroup } from '@angular/material/tabs';
|
|
4
|
+
import { createMaterialBidirectionalSync } from '@cngx/common/data';
|
|
5
|
+
import * as i1 from '@cngx/common/tabs';
|
|
6
|
+
import { CNGX_TAB_GROUP_HOST, injectTabsI18n, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTabGroupPresenter } from '@cngx/common/tabs';
|
|
7
|
+
import { CngxTabOverflow } from '@cngx/ui/tabs';
|
|
8
|
+
import { DOCUMENT } from '@angular/common';
|
|
9
|
+
import { nextUid } from '@cngx/core/utils';
|
|
10
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Centralised type façade and selector constants for every Angular
|
|
14
|
+
* Material internal surface cngx Material-bridge code couples to.
|
|
15
|
+
* Replaces the per-call-site `as unknown as { _foo? }` casts and
|
|
16
|
+
* the scattered `'.mat-mdc-tab*'` string literals with a single
|
|
17
|
+
* grep target.
|
|
18
|
+
*
|
|
19
|
+
* Every leading-underscore field cngx reaches into and every
|
|
20
|
+
* Material-internal CSS selector cngx queries against has its
|
|
21
|
+
* declaration here. A Material-version upgrade audit only needs to
|
|
22
|
+
* grep this file plus the matching tracked-debt entries — that grep
|
|
23
|
+
* value is the consumer-facing benefit, so this namespace is part
|
|
24
|
+
* of the published surface of `@cngx/ui/mat-tabs` (re-exported from
|
|
25
|
+
* the package barrel) rather than a private implementation detail.
|
|
26
|
+
*
|
|
27
|
+
* Tracked-debt cross-links:
|
|
28
|
+
* - tabs-accepted-debt §5 — `MatTab._stateChanges` plus the three
|
|
29
|
+
* `.mat-mdc-tab*` selectors used by `[cngxMatTabs]` and the
|
|
30
|
+
* Material-twin overflow adapter. The closing paragraph of §5
|
|
31
|
+
* explicitly names this namespace as the family-shared
|
|
32
|
+
* upgrade-watch surface.
|
|
33
|
+
* - stepper-accepted-debt §4 — `MatStepper._iconOverrides` reach
|
|
34
|
+
* from `<cngx-mat-stepper>`.
|
|
35
|
+
* - stepper-accepted-debt §1, handle.ts JSDoc — `CdkStep._completedOverride`
|
|
36
|
+
* read from `createMatStepHandle`'s `state` computed.
|
|
37
|
+
*
|
|
38
|
+
* The grouping uses a TypeScript `namespace` so a single
|
|
39
|
+
* `MaterialPrivateSurfaces.<member>` access path covers both the
|
|
40
|
+
* type façades and the selector constants. The TS namespace also
|
|
41
|
+
* lets cross-package consumers (`@cngx/ui/mat-stepper`) read the
|
|
42
|
+
* grouped name through ESLint's `@typescript-eslint` type resolver
|
|
43
|
+
* — a flat `export * as` re-export from `public-api.ts` does not
|
|
44
|
+
* resolve nested members through the path-alias.
|
|
45
|
+
*/
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
47
|
+
var MaterialPrivateSurfaces;
|
|
48
|
+
(function (MaterialPrivateSurfaces) {
|
|
49
|
+
/**
|
|
50
|
+
* `.mat-mdc-tab` — the class Material applies to the rendered
|
|
51
|
+
* tab `<button>` elements inside `MatTabHeader`. cngx
|
|
52
|
+
* index-correlates `presenter.tabs()` registration order against
|
|
53
|
+
* `host.querySelectorAll('.mat-mdc-tab')` because `MatTab` is a
|
|
54
|
+
* portal — the rendered buttons live inside `MatTabHeader`'s
|
|
55
|
+
* template, not on the `<mat-tab>` declaration site, and Material
|
|
56
|
+
* exposes no public per-tab element accessor.
|
|
57
|
+
*/
|
|
58
|
+
MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR = '.mat-mdc-tab';
|
|
59
|
+
/**
|
|
60
|
+
* `.mat-mdc-tab-header` — the strip element rendered by
|
|
61
|
+
* `MatTabHeader`. `[cngxMatTabs]` walks
|
|
62
|
+
* `host.querySelector('.mat-mdc-tab-header')` to locate the mount
|
|
63
|
+
* anchor for the cngx overflow molecule (so the More button pins
|
|
64
|
+
* inside Material's strip rather than as a sibling of
|
|
65
|
+
* `<mat-tab-group>`).
|
|
66
|
+
*/
|
|
67
|
+
MaterialPrivateSurfaces.MAT_MDC_TAB_HEADER_SELECTOR = '.mat-mdc-tab-header';
|
|
68
|
+
/**
|
|
69
|
+
* `.mat-mdc-tab-label-container` — Material's IO-friendly scroll
|
|
70
|
+
* viewport ancestor of the rendered tab buttons. The Material-
|
|
71
|
+
* twin overflow adapter walks `host → header → any tab → closest
|
|
72
|
+
* label-container` to attach the molecule's
|
|
73
|
+
* `IntersectionObserver` against the same element Material
|
|
74
|
+
* itself scrolls.
|
|
75
|
+
*/
|
|
76
|
+
MaterialPrivateSurfaces.MAT_MDC_TAB_LABEL_CONTAINER_SELECTOR = '.mat-mdc-tab-label-container';
|
|
77
|
+
})(MaterialPrivateSurfaces || (MaterialPrivateSurfaces = {}));
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Package-private DOM-mutation projectors for `[cngxMatTabs]`.
|
|
81
|
+
*
|
|
82
|
+
* - {@link createMatTabRejectionDecoration} — mirrors
|
|
83
|
+
* `presenter.lastFailedIndex` onto the matching `.mat-mdc-tab` as a
|
|
84
|
+
* class flag plus a hidden `cngx-sr-only` descriptor span linked via
|
|
85
|
+
* `aria-describedby`. `aria-invalid` is intentionally absent: ARIA
|
|
86
|
+
* 1.2 scopes it to form-field vocabulary, not `role="tab"`.
|
|
87
|
+
* - {@link createMatTabAggregatorDecoration} — projects each handle's
|
|
88
|
+
* `shouldShow()` flag onto the matching button as a class +
|
|
89
|
+
* descriptor span pair, same `aria-describedby` token-append pattern.
|
|
90
|
+
*
|
|
91
|
+
* Distinct descriptor-id suffixes (`-rejected` vs `-errors`) let both
|
|
92
|
+
* projectors stack on the same target without collision; the shared
|
|
93
|
+
* token-list append preserves consumer-supplied tokens.
|
|
94
|
+
*
|
|
95
|
+
* Index-based DOM lookup tracks `tabs-accepted-debt §5`.
|
|
96
|
+
*
|
|
97
|
+
* @internal package-private — consumers bind `[cngxMatTabError]` on
|
|
98
|
+
* each `<mat-tab>`; the directive owns the projection mechanics.
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* Diff-restore the `aria-describedby` token list after a decoration's
|
|
102
|
+
* descriptor span detaches — drops the decoration's own id token from
|
|
103
|
+
* the live attribute, leaving any third-party tokens written between
|
|
104
|
+
* apply and clear (tooltip refs, Material's own runtime additions)
|
|
105
|
+
* intact. Treats the attribute as a token-set per the cngx ARIA-by-value
|
|
106
|
+
* rule, not as a single-owner string.
|
|
107
|
+
*
|
|
108
|
+
* Empty-result + originally-absent attribute removes the attribute
|
|
109
|
+
* entirely — a dangling `aria-describedby=""` would be a malformed
|
|
110
|
+
* reference in some AT readers.
|
|
111
|
+
*
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
function restoreAriaDescribedbyExceptToken(el, tokenToRemove, renderer, priorAriaDescribedby) {
|
|
115
|
+
const current = el.getAttribute('aria-describedby');
|
|
116
|
+
const tokens = current ? current.split(/\s+/).filter(Boolean) : [];
|
|
117
|
+
const remaining = tokens.filter((t) => t !== tokenToRemove);
|
|
118
|
+
if (remaining.length === 0) {
|
|
119
|
+
if (priorAriaDescribedby === null) {
|
|
120
|
+
renderer.removeAttribute(el, 'aria-describedby');
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
renderer.setAttribute(el, 'aria-describedby', priorAriaDescribedby);
|
|
124
|
+
}
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
renderer.setAttribute(el, 'aria-describedby', remaining.join(' '));
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Mounts the sticky-rejection decoration projector. Class +
|
|
131
|
+
* descriptor span follow `failedHandleId` reactively; cleared on
|
|
132
|
+
* directive destroy. Single-target by contract (matches the
|
|
133
|
+
* presenter's single-slot `lastFailedIndex`).
|
|
134
|
+
*
|
|
135
|
+
* Two effects split the work: one tracks `failedHandleId` and
|
|
136
|
+
* mounts/unmounts the span; the other tracks `descriptorText` and
|
|
137
|
+
* mutates `textContent` in place. The split keeps late label
|
|
138
|
+
* resolution O(1) — no DOM rebuild when the origin label arrives
|
|
139
|
+
* via a downstream `tabs()` re-emission.
|
|
140
|
+
*
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
function createMatTabRejectionDecoration(opts) {
|
|
144
|
+
const buttonSelector = opts.buttonSelector ?? MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR;
|
|
145
|
+
const className = opts.className ?? 'cngx-mat-tab--error';
|
|
146
|
+
const srOnlyClassName = opts.srOnlyClassName ?? 'cngx-sr-only';
|
|
147
|
+
const descriptorIdSuffix = opts.descriptorIdSuffix ?? 'rejected';
|
|
148
|
+
// Slot path needs both halves; either alone degrades to imperative
|
|
149
|
+
// textContent. No diagnostic — single in-package consumer always
|
|
150
|
+
// passes both.
|
|
151
|
+
const slotEnabled = !!opts.contentTemplate && !!opts.viewContainerRef;
|
|
152
|
+
let decoratedEl = null;
|
|
153
|
+
// Cached across the projector's lifetime — reusing the same node
|
|
154
|
+
// keeps AT-reader / observer references live across A→B→A flips.
|
|
155
|
+
let cachedSpan = null;
|
|
156
|
+
let priorAriaDescribedby = null;
|
|
157
|
+
// Pillar 1 — short-circuits structurally-identical re-emissions of
|
|
158
|
+
// `failedHandleId` so a `tabs()` re-eval doesn't clobber the AT
|
|
159
|
+
// descriptor mid-flight.
|
|
160
|
+
let lastAppliedId = null;
|
|
161
|
+
let embeddedView;
|
|
162
|
+
const destroyEmbeddedView = () => {
|
|
163
|
+
if (!embeddedView) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
embeddedView.destroy();
|
|
167
|
+
embeddedView = undefined;
|
|
168
|
+
if (cachedSpan) {
|
|
169
|
+
while (cachedSpan.firstChild) {
|
|
170
|
+
opts.renderer.removeChild(cachedSpan, cachedSpan.firstChild);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const writeDescriptorContent = (span, handleId, text) => {
|
|
175
|
+
const tplSignal = opts.contentTemplate;
|
|
176
|
+
const vcr = opts.viewContainerRef;
|
|
177
|
+
const tpl = tplSignal && vcr ? tplSignal() : null;
|
|
178
|
+
if (tpl && vcr) {
|
|
179
|
+
destroyEmbeddedView();
|
|
180
|
+
const context = {
|
|
181
|
+
failedHandleId: handleId,
|
|
182
|
+
originLabel: opts.originLabel?.(),
|
|
183
|
+
fallbackText: text,
|
|
184
|
+
};
|
|
185
|
+
const view = vcr.createEmbeddedView(tpl, context, {
|
|
186
|
+
injector: opts.injector,
|
|
187
|
+
});
|
|
188
|
+
// Force CD before moving rootNodes out of the embedded view's
|
|
189
|
+
// logical parent — zoneless + OnPush would otherwise leave the
|
|
190
|
+
// first SR read stale.
|
|
191
|
+
view.detectChanges();
|
|
192
|
+
for (const node of view.rootNodes) {
|
|
193
|
+
opts.renderer.appendChild(span, node);
|
|
194
|
+
}
|
|
195
|
+
embeddedView = view;
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
// Imperative fallback — also covers the path where a slot was
|
|
199
|
+
// previously bound and is now removed (destroy any prior view).
|
|
200
|
+
destroyEmbeddedView();
|
|
201
|
+
opts.renderer.setProperty(span, 'textContent', text);
|
|
202
|
+
};
|
|
203
|
+
const clearDecoration = () => {
|
|
204
|
+
if (!decoratedEl || !cachedSpan) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const ownTokenId = cachedSpan.id;
|
|
208
|
+
destroyEmbeddedView();
|
|
209
|
+
opts.renderer.removeClass(decoratedEl, className);
|
|
210
|
+
opts.renderer.removeChild(decoratedEl, cachedSpan);
|
|
211
|
+
// `cachedSpan` deliberately retained — reused on the next apply.
|
|
212
|
+
restoreAriaDescribedbyExceptToken(decoratedEl, ownTokenId, opts.renderer, priorAriaDescribedby);
|
|
213
|
+
decoratedEl = null;
|
|
214
|
+
priorAriaDescribedby = null;
|
|
215
|
+
};
|
|
216
|
+
const applyDecorationAt = (failedIdx, handleId) => {
|
|
217
|
+
clearDecoration();
|
|
218
|
+
const buttons = opts.hostEl.querySelectorAll(buttonSelector);
|
|
219
|
+
const targetEl = buttons.item(failedIdx);
|
|
220
|
+
if (!targetEl) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
opts.renderer.addClass(targetEl, className);
|
|
224
|
+
const spanId = `${handleId}-${descriptorIdSuffix}`;
|
|
225
|
+
let span = cachedSpan;
|
|
226
|
+
if (!span) {
|
|
227
|
+
span = opts.renderer.createElement('span');
|
|
228
|
+
opts.renderer.addClass(span, srOnlyClassName);
|
|
229
|
+
cachedSpan = span;
|
|
230
|
+
}
|
|
231
|
+
// Always rewrite id + textContent — the cached span carries stale
|
|
232
|
+
// values from the prior mount. The live-text effect below picks
|
|
233
|
+
// up subsequent `descriptorText` changes in place.
|
|
234
|
+
opts.renderer.setAttribute(span, 'id', spanId);
|
|
235
|
+
opts.renderer.appendChild(targetEl, span);
|
|
236
|
+
writeDescriptorContent(span, handleId, opts.descriptorText());
|
|
237
|
+
// Renderer2 has no `getAttribute` counterpart — read off the
|
|
238
|
+
// native element. Browser-only; SSR would need a platform adapter.
|
|
239
|
+
const prior = targetEl.getAttribute('aria-describedby');
|
|
240
|
+
const tokens = prior ? prior.split(/\s+/).filter(Boolean) : [];
|
|
241
|
+
if (!tokens.includes(spanId)) {
|
|
242
|
+
tokens.push(spanId);
|
|
243
|
+
}
|
|
244
|
+
opts.renderer.setAttribute(targetEl, 'aria-describedby', tokens.join(' '));
|
|
245
|
+
decoratedEl = targetEl;
|
|
246
|
+
priorAriaDescribedby = prior;
|
|
247
|
+
};
|
|
248
|
+
runInInjectionContext(opts.injector, () => {
|
|
249
|
+
effect(() => {
|
|
250
|
+
const id = opts.failedHandleId();
|
|
251
|
+
untracked(() => {
|
|
252
|
+
if (id === lastAppliedId) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (id === null) {
|
|
256
|
+
clearDecoration();
|
|
257
|
+
lastAppliedId = null;
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const idx = opts.failedIndex();
|
|
261
|
+
if (idx === undefined) {
|
|
262
|
+
clearDecoration();
|
|
263
|
+
lastAppliedId = null;
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
applyDecorationAt(idx, id);
|
|
267
|
+
lastAppliedId = id;
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
// Live-text effect — tracks `descriptorText` plus the slot
|
|
271
|
+
// template (when wired) so a late-mounted template re-renders
|
|
272
|
+
// into the existing span. Mount-state checks live in untracked.
|
|
273
|
+
effect(() => {
|
|
274
|
+
const text = opts.descriptorText();
|
|
275
|
+
const tplSignal = opts.contentTemplate;
|
|
276
|
+
if (slotEnabled && tplSignal) {
|
|
277
|
+
tplSignal();
|
|
278
|
+
}
|
|
279
|
+
untracked(() => {
|
|
280
|
+
if (decoratedEl === null || cachedSpan === null) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const id = opts.failedHandleId();
|
|
284
|
+
if (id === null) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
writeDescriptorContent(cachedSpan, id, text);
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
opts.destroyRef.onDestroy(clearDecoration);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Mounts the per-tab aggregator decoration projector. Class +
|
|
295
|
+
* descriptor span + `aria-describedby` token follow `errorTabs`
|
|
296
|
+
* reactively; pruned on entry drop and on directive destroy.
|
|
297
|
+
*
|
|
298
|
+
* Race recovery — when the effect fires before MatTabHeader has
|
|
299
|
+
* rendered the matching buttons (initial-render race), schedules a
|
|
300
|
+
* single `afterNextRender` retry, bounded by `maxRetryAttempts`.
|
|
301
|
+
*
|
|
302
|
+
* @internal
|
|
303
|
+
*/
|
|
304
|
+
function createMatTabAggregatorDecoration(opts) {
|
|
305
|
+
const buttonSelector = opts.buttonSelector ?? MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR;
|
|
306
|
+
const className = opts.className ?? 'cngx-mat-tab--has-errors';
|
|
307
|
+
const srOnlyClassName = opts.srOnlyClassName ?? 'cngx-sr-only';
|
|
308
|
+
const maxRetryAttempts = opts.maxRetryAttempts ?? 5;
|
|
309
|
+
// Slot path needs both halves; either alone degrades to imperative
|
|
310
|
+
// textContent. Re-evaluated per fire so a lazy-mounted template
|
|
311
|
+
// (`*ngIf` / `@defer`) picks up on first materialisation.
|
|
312
|
+
const isFullyWired = () => !!opts.contentTemplate && !!opts.viewContainerRef;
|
|
313
|
+
// Half-wired diagnostic — graceful degradation hides the mistake
|
|
314
|
+
// at runtime, so the signal has to come from a deliberate sink.
|
|
315
|
+
if (!isFullyWired() && (opts.contentTemplate || opts.viewContainerRef)) {
|
|
316
|
+
const missing = opts.contentTemplate ? 'viewContainerRef' : 'contentTemplate';
|
|
317
|
+
const sink = opts.onHalfWiredSlot ?? defaultHalfWiredSlotWarn;
|
|
318
|
+
sink(missing);
|
|
319
|
+
}
|
|
320
|
+
const decorated = new Map();
|
|
321
|
+
let pendingRetry = false;
|
|
322
|
+
let retryAttempts = 0;
|
|
323
|
+
const destroyEmbeddedView = (entry) => {
|
|
324
|
+
if (!entry.embeddedView) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
entry.embeddedView.destroy();
|
|
328
|
+
entry.embeddedView = undefined;
|
|
329
|
+
// The rendered nodes live under the descriptor span via appendChild;
|
|
330
|
+
// EmbeddedViewRef.destroy() does not detach them, so clear manually.
|
|
331
|
+
while (entry.descriptorSpan.firstChild) {
|
|
332
|
+
opts.renderer.removeChild(entry.descriptorSpan, entry.descriptorSpan.firstChild);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
const writeDescriptorContent = (entry, announcement, context) => {
|
|
336
|
+
const tplSignal = opts.contentTemplate;
|
|
337
|
+
const vcr = opts.viewContainerRef;
|
|
338
|
+
const tpl = tplSignal && vcr ? tplSignal() : null;
|
|
339
|
+
if (tpl && vcr) {
|
|
340
|
+
destroyEmbeddedView(entry);
|
|
341
|
+
const view = vcr.createEmbeddedView(tpl, context, {
|
|
342
|
+
injector: opts.injector,
|
|
343
|
+
});
|
|
344
|
+
// See the rejection projector's identical call site for the
|
|
345
|
+
// detached-view CD rationale (rootNodes move out of the
|
|
346
|
+
// embedded view's logical parent into an SR-only span).
|
|
347
|
+
view.detectChanges();
|
|
348
|
+
for (const node of view.rootNodes) {
|
|
349
|
+
opts.renderer.appendChild(entry.descriptorSpan, node);
|
|
350
|
+
}
|
|
351
|
+
entry.embeddedView = view;
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
// Imperative fallback — also covers the path where a slot was
|
|
355
|
+
// previously bound and is now removed (destroy any prior view).
|
|
356
|
+
destroyEmbeddedView(entry);
|
|
357
|
+
opts.renderer.setProperty(entry.descriptorSpan, 'textContent', announcement);
|
|
358
|
+
};
|
|
359
|
+
const removeDecoration = (id) => {
|
|
360
|
+
const entry = decorated.get(id);
|
|
361
|
+
if (!entry) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const ownTokenId = entry.descriptorSpan.id;
|
|
365
|
+
destroyEmbeddedView(entry);
|
|
366
|
+
opts.renderer.removeClass(entry.el, className);
|
|
367
|
+
opts.renderer.removeChild(entry.el, entry.descriptorSpan);
|
|
368
|
+
restoreAriaDescribedbyExceptToken(entry.el, ownTokenId, opts.renderer, entry.priorAriaDescribedby);
|
|
369
|
+
decorated.delete(id);
|
|
370
|
+
};
|
|
371
|
+
const applyDecoration = (targetEl, entry) => {
|
|
372
|
+
opts.renderer.addClass(targetEl, className);
|
|
373
|
+
const spanId = `${entry.id}-errors`;
|
|
374
|
+
const descriptorSpan = opts.renderer.createElement('span');
|
|
375
|
+
opts.renderer.addClass(descriptorSpan, srOnlyClassName);
|
|
376
|
+
opts.renderer.setAttribute(descriptorSpan, 'id', spanId);
|
|
377
|
+
opts.renderer.appendChild(targetEl, descriptorSpan);
|
|
378
|
+
// See the read-via-nativeElement note in `applyDecorationAt` above —
|
|
379
|
+
// Renderer2 has no `getAttribute` counterpart, so attribute reads
|
|
380
|
+
// go through the native element directly.
|
|
381
|
+
const priorAriaDescribedby = targetEl.getAttribute('aria-describedby');
|
|
382
|
+
const tokens = priorAriaDescribedby
|
|
383
|
+
? priorAriaDescribedby.split(/\s+/).filter(Boolean)
|
|
384
|
+
: [];
|
|
385
|
+
if (!tokens.includes(spanId)) {
|
|
386
|
+
tokens.push(spanId);
|
|
387
|
+
}
|
|
388
|
+
opts.renderer.setAttribute(targetEl, 'aria-describedby', tokens.join(' '));
|
|
389
|
+
const decoratedEntry = { el: targetEl, descriptorSpan, priorAriaDescribedby };
|
|
390
|
+
writeDescriptorContent(decoratedEntry, entry.announcement, {
|
|
391
|
+
count: entry.count,
|
|
392
|
+
label: entry.label,
|
|
393
|
+
announcement: entry.announcement,
|
|
394
|
+
});
|
|
395
|
+
decorated.set(entry.id, decoratedEntry);
|
|
396
|
+
};
|
|
397
|
+
const sync = (errorTabs) => {
|
|
398
|
+
const liveIds = new Set();
|
|
399
|
+
for (const t of errorTabs) {
|
|
400
|
+
liveIds.add(t.id);
|
|
401
|
+
}
|
|
402
|
+
for (const id of Array.from(decorated.keys())) {
|
|
403
|
+
if (!liveIds.has(id)) {
|
|
404
|
+
removeDecoration(id);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const buttons = opts.hostEl.querySelectorAll(buttonSelector);
|
|
408
|
+
let needsRetry = false;
|
|
409
|
+
for (const entry of errorTabs) {
|
|
410
|
+
const targetEl = buttons.item(entry.idx);
|
|
411
|
+
if (!targetEl) {
|
|
412
|
+
needsRetry = true;
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
const existing = decorated.get(entry.id);
|
|
416
|
+
if (existing?.el === targetEl) {
|
|
417
|
+
// Same target element: refresh content (slot path destroys +
|
|
418
|
+
// remounts the embedded view; imperative path overwrites the
|
|
419
|
+
// textContent property idempotently).
|
|
420
|
+
writeDescriptorContent(existing, entry.announcement, {
|
|
421
|
+
count: entry.count,
|
|
422
|
+
label: entry.label,
|
|
423
|
+
announcement: entry.announcement,
|
|
424
|
+
});
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
if (existing) {
|
|
428
|
+
removeDecoration(entry.id);
|
|
429
|
+
}
|
|
430
|
+
applyDecoration(targetEl, entry);
|
|
431
|
+
}
|
|
432
|
+
if (!needsRetry) {
|
|
433
|
+
retryAttempts = 0;
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (pendingRetry) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (retryAttempts >= maxRetryAttempts) {
|
|
440
|
+
retryAttempts = 0;
|
|
441
|
+
const sink = opts.onMaxRetriesReached ?? defaultRetryCeilingWarn(maxRetryAttempts);
|
|
442
|
+
sink();
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
pendingRetry = true;
|
|
446
|
+
retryAttempts++;
|
|
447
|
+
afterNextRender(() => {
|
|
448
|
+
pendingRetry = false;
|
|
449
|
+
sync(opts.errorTabs());
|
|
450
|
+
}, { injector: opts.injector });
|
|
451
|
+
};
|
|
452
|
+
runInInjectionContext(opts.injector, () => {
|
|
453
|
+
effect(() => {
|
|
454
|
+
// Track the slot template alongside `errorTabs` so a runtime
|
|
455
|
+
// project/remove of `*cngxMatTabAggregatorContent` switches
|
|
456
|
+
// every decorated entry between render paths.
|
|
457
|
+
const errorTabs = opts.errorTabs();
|
|
458
|
+
if (isFullyWired() && opts.contentTemplate) {
|
|
459
|
+
opts.contentTemplate();
|
|
460
|
+
}
|
|
461
|
+
untracked(() => sync(errorTabs));
|
|
462
|
+
});
|
|
463
|
+
});
|
|
464
|
+
opts.destroyRef.onDestroy(() => {
|
|
465
|
+
for (const id of Array.from(decorated.keys())) {
|
|
466
|
+
removeDecoration(id);
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
function defaultHalfWiredSlotWarn(missing) {
|
|
471
|
+
if (!isDevMode()) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
console.warn('[cngxMatTabs] aggregator-content slot half-wired — ' +
|
|
475
|
+
`\`${missing}\` is missing while the other half is supplied. ` +
|
|
476
|
+
'The decoration projector will silently fall back to the ' +
|
|
477
|
+
'imperative `textContent` path, and the consumer-projected ' +
|
|
478
|
+
'`*cngxMatTabAggregatorContent` template will never render. ' +
|
|
479
|
+
'Wire both halves on the [cngxMatTabs] directive (or neither).');
|
|
480
|
+
}
|
|
481
|
+
function defaultRetryCeilingWarn(max) {
|
|
482
|
+
return () => {
|
|
483
|
+
if (!isDevMode()) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
console.warn('[cngxMatTabs] aggregator decoration retry ceiling reached ' +
|
|
487
|
+
`(${max} attempts) — MatTabHeader did not render ` +
|
|
488
|
+
'`.mat-mdc-tab` buttons within the expected window. Likely ' +
|
|
489
|
+
'cause: Material upgrade broke the `.mat-mdc-tab` selector ' +
|
|
490
|
+
'contract or a consumer-side render stall. ' +
|
|
491
|
+
'Bound aggregators may remain visually undecorated ' +
|
|
492
|
+
'until the next state change.');
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Default sink — gated on dev-mode. Production callers see no
|
|
498
|
+
* output; production telemetry lands only when a consumer overrides
|
|
499
|
+
* via `withHalfWiredSlotSink(fn)`.
|
|
500
|
+
*
|
|
501
|
+
* @internal — exported only for {@link CngxMatTabsConfig.halfWiredSlotSink}'s
|
|
502
|
+
* library default. Consumers should override via the config feature
|
|
503
|
+
* rather than reach for this reference directly.
|
|
504
|
+
*/
|
|
505
|
+
const CNGX_DEFAULT_HALF_WIRED_SLOT_SINK = (missing) => {
|
|
506
|
+
if (!isDevMode()) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
console.warn('[cngxMatTabs] aggregator-content slot half-wired — ' +
|
|
510
|
+
`\`${missing}\` is missing while the other half is supplied. ` +
|
|
511
|
+
'The decoration projector will silently fall back to the ' +
|
|
512
|
+
'imperative `textContent` path, and the consumer-projected ' +
|
|
513
|
+
'`*cngxMatTabAggregatorContent` template will never render. ' +
|
|
514
|
+
'Wire both halves on the [cngxMatTabs] directive (or neither).');
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Library defaults for `[cngxMatTabs]`. Source of truth for every
|
|
519
|
+
* key on {@link CngxMatTabsConfig}. Consumed by
|
|
520
|
+
* {@link injectMatTabsConfig} as the final fallback.
|
|
521
|
+
*
|
|
522
|
+
* @internal
|
|
523
|
+
*/
|
|
524
|
+
const CNGX_MAT_TABS_CONFIG_DEFAULTS = {
|
|
525
|
+
anchorMaxAttempts: 5,
|
|
526
|
+
halfWiredSlotSink: CNGX_DEFAULT_HALF_WIRED_SLOT_SINK,
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* DI token holding a partial {@link CngxMatTabsConfig}. Set via
|
|
530
|
+
* {@link provideMatTabsConfig} (app-wide) or
|
|
531
|
+
* {@link provideMatTabsConfigAt} (component scope). Read via
|
|
532
|
+
* {@link injectMatTabsConfig}, which merges with the library
|
|
533
|
+
* defaults so callers never see `undefined`.
|
|
534
|
+
*/
|
|
535
|
+
const CNGX_MAT_TABS_CONFIG = new InjectionToken('CngxMatTabsConfig');
|
|
536
|
+
function feature(config) {
|
|
537
|
+
return { config, _target: 'mat-tabs' };
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Cap on the `[cngxMatTabs]` overflow-anchor retry loop.
|
|
541
|
+
* See {@link CngxMatTabsConfig.anchorMaxAttempts} for default + rationale.
|
|
542
|
+
*/
|
|
543
|
+
function withAnchorRetryAttempts(n) {
|
|
544
|
+
return feature({ anchorMaxAttempts: n });
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Override the half-wired-slot diagnostic sink.
|
|
548
|
+
* See {@link CngxMatTabsConfig.halfWiredSlotSink}.
|
|
549
|
+
*/
|
|
550
|
+
function withHalfWiredSlotSink(sink) {
|
|
551
|
+
return feature({ halfWiredSlotSink: sink });
|
|
552
|
+
}
|
|
553
|
+
function mergeFeatures(features) {
|
|
554
|
+
const merged = {};
|
|
555
|
+
for (const f of features) {
|
|
556
|
+
Object.assign(merged, f.config);
|
|
557
|
+
}
|
|
558
|
+
return merged;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* App-wide `[cngxMatTabs]` configuration. Returns
|
|
562
|
+
* `EnvironmentProviders` for use inside `bootstrapApplication`'s
|
|
563
|
+
* `providers` array.
|
|
564
|
+
*
|
|
565
|
+
* ```ts
|
|
566
|
+
* bootstrapApplication(App, {
|
|
567
|
+
* providers: [
|
|
568
|
+
* provideMatTabsConfig(
|
|
569
|
+
* withAnchorRetryAttempts(10),
|
|
570
|
+
* withHalfWiredSlotSink((missing) => Sentry.captureMessage(`half-wired ${missing}`)),
|
|
571
|
+
* ),
|
|
572
|
+
* ],
|
|
573
|
+
* });
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
576
|
+
function provideMatTabsConfig(...features) {
|
|
577
|
+
return makeEnvironmentProviders([
|
|
578
|
+
{ provide: CNGX_MAT_TABS_CONFIG, useValue: mergeFeatures(features) },
|
|
579
|
+
]);
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Component-scope `[cngxMatTabs]` configuration. Returns a
|
|
583
|
+
* `Provider[]` so the result can be spread into a component's
|
|
584
|
+
* `providers` or `viewProviders` (which cannot accept opaque
|
|
585
|
+
* environment providers).
|
|
586
|
+
*
|
|
587
|
+
* ```ts
|
|
588
|
+
* @Component({
|
|
589
|
+
* selector: 'app-tabs-page',
|
|
590
|
+
* viewProviders: [
|
|
591
|
+
* ...provideMatTabsConfigAt(withAnchorRetryAttempts(20)),
|
|
592
|
+
* ],
|
|
593
|
+
* ...
|
|
594
|
+
* })
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
|
+
function provideMatTabsConfigAt(...features) {
|
|
598
|
+
return [{ provide: CNGX_MAT_TABS_CONFIG, useValue: mergeFeatures(features) }];
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Resolve the effective `[cngxMatTabs]` configuration for the current
|
|
602
|
+
* injector. Always returns a fully populated, non-`undefined` object
|
|
603
|
+
* so call sites do not need null-coalescing.
|
|
604
|
+
*
|
|
605
|
+
* Resolution order per key:
|
|
606
|
+
* 1. `CNGX_MAT_TABS_CONFIG` value (set via
|
|
607
|
+
* {@link provideMatTabsConfig} / {@link provideMatTabsConfigAt}).
|
|
608
|
+
* 2. {@link CNGX_MAT_TABS_CONFIG_DEFAULTS} (library default).
|
|
609
|
+
*/
|
|
610
|
+
function injectMatTabsConfig() {
|
|
611
|
+
const user = inject(CNGX_MAT_TABS_CONFIG, { optional: true }) ?? {};
|
|
612
|
+
return {
|
|
613
|
+
anchorMaxAttempts: user.anchorMaxAttempts ?? CNGX_MAT_TABS_CONFIG_DEFAULTS.anchorMaxAttempts,
|
|
614
|
+
halfWiredSlotSink: user.halfWiredSlotSink ?? CNGX_MAT_TABS_CONFIG_DEFAULTS.halfWiredSlotSink,
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Structural slot directive marking the aggregator-descriptor
|
|
620
|
+
* template for `[cngxMatTabs]`. Discovered via `contentChild` on the
|
|
621
|
+
* directive; when bound, the projector renders an embedded view of
|
|
622
|
+
* this template into the SR-only descriptor span instead of writing
|
|
623
|
+
* the aggregator's `announcement()` string verbatim.
|
|
624
|
+
*
|
|
625
|
+
* Pure marker — zero logic. Holds only a typed
|
|
626
|
+
* {@link TemplateRef} reference. Mirrors the family-standard slot
|
|
627
|
+
* pattern (`CngxStepBadge`, `CngxTabErrorBadge`, `CngxTabOverflowItem`).
|
|
628
|
+
*
|
|
629
|
+
* Single-consumer note: tracked as `tabs-accepted-debt §9`
|
|
630
|
+
* (sibling to `stepper-accepted-debt §4` for the mat-stepper
|
|
631
|
+
* twin's similar Material-binding asymmetry). Material owns the
|
|
632
|
+
* tab-button chrome; the cngx descriptor span is the only
|
|
633
|
+
* consumer-visible decoration seam, so this slot directive lands
|
|
634
|
+
* with one consumer (the package-private aggregator-decoration
|
|
635
|
+
* projector). The shape is uniform with the rest of the family
|
|
636
|
+
* pattern; the staging is acknowledged debt.
|
|
637
|
+
*
|
|
638
|
+
* ```html
|
|
639
|
+
* <mat-tab-group cngxMatTabs>
|
|
640
|
+
* <ng-template
|
|
641
|
+
* cngxMatTabAggregatorContent
|
|
642
|
+
* let-count="count"
|
|
643
|
+
* let-label="label"
|
|
644
|
+
* >
|
|
645
|
+
* {{ label }}: {{ count }} validation issue(s)
|
|
646
|
+
* </ng-template>
|
|
647
|
+
* <mat-tab label="Profile" cngxMatTabError="profile">…</mat-tab>
|
|
648
|
+
* </mat-tab-group>
|
|
649
|
+
* ```
|
|
650
|
+
*/
|
|
651
|
+
class CngxMatTabAggregatorContent {
|
|
652
|
+
templateRef = inject(TemplateRef);
|
|
653
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabAggregatorContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
654
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxMatTabAggregatorContent, isStandalone: true, selector: "ng-template[cngxMatTabAggregatorContent]", exportAs: ["cngxMatTabAggregatorContent"], ngImport: i0 });
|
|
655
|
+
}
|
|
656
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabAggregatorContent, decorators: [{
|
|
657
|
+
type: Directive,
|
|
658
|
+
args: [{
|
|
659
|
+
selector: 'ng-template[cngxMatTabAggregatorContent]',
|
|
660
|
+
exportAs: 'cngxMatTabAggregatorContent',
|
|
661
|
+
standalone: true,
|
|
662
|
+
}]
|
|
663
|
+
}] });
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Structural slot directive marking the rejection-descriptor
|
|
667
|
+
* template for `[cngxMatTabs]`. Discovered via `contentChild` on the
|
|
668
|
+
* directive; when bound, the projector renders an embedded view of
|
|
669
|
+
* this template into the SR-only descriptor span instead of writing
|
|
670
|
+
* the resolved fallback string verbatim.
|
|
671
|
+
*
|
|
672
|
+
* Pure marker — zero logic. Holds only a typed
|
|
673
|
+
* {@link TemplateRef} reference. Mirrors the family-standard slot
|
|
674
|
+
* pattern (`CngxMatTabAggregatorContent`, `CngxStepBadge`,
|
|
675
|
+
* `CngxTabErrorBadge`).
|
|
676
|
+
*
|
|
677
|
+
* Cascade resolution (per
|
|
678
|
+
* `architecture-summary.md` slot-cascade rule):
|
|
679
|
+
* 1. Per-instance `*cngxMatTabRejectionContent` template wins
|
|
680
|
+
* via `contentChild(CngxMatTabRejectionContent)`.
|
|
681
|
+
* 2. When Phase 2's `CNGX_MAT_TABS_CONFIG` infrastructure
|
|
682
|
+
* lands on main, the config-tier
|
|
683
|
+
* `CNGX_MAT_TABS_CONFIG.templates.rejection` slot fills the
|
|
684
|
+
* middle tier (planned follow-up — gated by Phase 2 merge;
|
|
685
|
+
* `tabs-accepted-debt §12` binds the staging with
|
|
686
|
+
* Re-Eval Triggers).
|
|
687
|
+
* 3. Library default — imperative `Renderer2.createElement('span')`
|
|
688
|
+
* with `textContent = fallbackText` (the resolved
|
|
689
|
+
* `commitRolledBackTo(originLabel)` / `commitFailedRetry`
|
|
690
|
+
* phrase from `injectTabsI18n()`).
|
|
691
|
+
*
|
|
692
|
+
* ```html
|
|
693
|
+
* <mat-tab-group cngxMatTabs [commitAction]="save">
|
|
694
|
+
* <ng-template
|
|
695
|
+
* cngxMatTabRejectionContent
|
|
696
|
+
* let-failedHandleId="failedHandleId"
|
|
697
|
+
* let-originLabel="originLabel"
|
|
698
|
+
* let-fallbackText="fallbackText"
|
|
699
|
+
* >
|
|
700
|
+
* <span class="brand-icon" aria-hidden="true"></span>
|
|
701
|
+
* {{ fallbackText }}
|
|
702
|
+
* @if (originLabel) {
|
|
703
|
+
* <button (click)="retry(failedHandleId)">Retry</button>
|
|
704
|
+
* }
|
|
705
|
+
* </ng-template>
|
|
706
|
+
* <mat-tab label="Profile">…</mat-tab>
|
|
707
|
+
* </mat-tab-group>
|
|
708
|
+
* ```
|
|
709
|
+
*/
|
|
710
|
+
class CngxMatTabRejectionContent {
|
|
711
|
+
templateRef = inject(TemplateRef);
|
|
712
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabRejectionContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
713
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxMatTabRejectionContent, isStandalone: true, selector: "ng-template[cngxMatTabRejectionContent]", exportAs: ["cngxMatTabRejectionContent"], ngImport: i0 });
|
|
714
|
+
}
|
|
715
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabRejectionContent, decorators: [{
|
|
716
|
+
type: Directive,
|
|
717
|
+
args: [{
|
|
718
|
+
selector: 'ng-template[cngxMatTabRejectionContent]',
|
|
719
|
+
exportAs: 'cngxMatTabRejectionContent',
|
|
720
|
+
standalone: true,
|
|
721
|
+
}]
|
|
722
|
+
}] });
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Mount a polite ARIA live region under `document.body` and keep
|
|
726
|
+
* its `textContent` in sync with the supplied `announcement`
|
|
727
|
+
* signal. Empty string between transitions so AT readers stay quiet
|
|
728
|
+
* on no-op CD ticks.
|
|
729
|
+
*
|
|
730
|
+
* The span lives at body scope (matching the CDK `LiveAnnouncer`
|
|
731
|
+
* placement convention) so Material's MDC tolerance for unexpected
|
|
732
|
+
* children at the `<mat-tab-group>` host root is irrelevant — the
|
|
733
|
+
* live-region never lands inside Material's component DOM. The
|
|
734
|
+
* element's host bindings replicate {@link CngxLiveRegion}
|
|
735
|
+
* imperatively (this attribute directive owns no template, so the
|
|
736
|
+
* declarative `cngxLiveRegion` selector is unreachable). The
|
|
737
|
+
* duplication of `CngxLiveRegion`'s host-binding shape is
|
|
738
|
+
* acknowledged debt — `tabs-accepted-debt §12` covers the
|
|
739
|
+
* single-consumer family-uniformity staging and the Re-Eval
|
|
740
|
+
* Triggers that would graduate this helper to a
|
|
741
|
+
* `CNGX_MAT_TAB_LIVE_ANNOUNCER_FACTORY` swap surface.
|
|
742
|
+
* Cleaned up via the supplied `DestroyRef`.
|
|
743
|
+
*
|
|
744
|
+
* @internal — package-private helper for `[cngxMatTabs]`. Not
|
|
745
|
+
* exported from `public-api.ts`.
|
|
746
|
+
*/
|
|
747
|
+
function mountLiveRegionAnnouncer(opts) {
|
|
748
|
+
const srOnlyClassName = opts.srOnlyClassName ?? 'cngx-sr-only';
|
|
749
|
+
const politeness = opts.politeness ?? 'polite';
|
|
750
|
+
const role = politeness === 'assertive' ? 'alert' : 'status';
|
|
751
|
+
const doc = runInInjectionContext(opts.injector, () => inject(DOCUMENT));
|
|
752
|
+
const liveRegionEl = opts.renderer.createElement('span');
|
|
753
|
+
opts.renderer.addClass(liveRegionEl, srOnlyClassName);
|
|
754
|
+
opts.renderer.setAttribute(liveRegionEl, 'aria-live', politeness);
|
|
755
|
+
opts.renderer.setAttribute(liveRegionEl, 'aria-atomic', 'true');
|
|
756
|
+
opts.renderer.setAttribute(liveRegionEl, 'aria-relevant', 'additions text');
|
|
757
|
+
opts.renderer.setAttribute(liveRegionEl, 'role', role);
|
|
758
|
+
opts.renderer.appendChild(doc.body, liveRegionEl);
|
|
759
|
+
runInInjectionContext(opts.injector, () => {
|
|
760
|
+
effect(() => {
|
|
761
|
+
const text = opts.announcement();
|
|
762
|
+
untracked(() => {
|
|
763
|
+
opts.renderer.setProperty(liveRegionEl, 'textContent', text);
|
|
764
|
+
});
|
|
765
|
+
});
|
|
766
|
+
});
|
|
767
|
+
opts.destroyRef.onDestroy(() => {
|
|
768
|
+
opts.renderer.removeChild(doc.body, liveRegionEl);
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Build the {@link CngxMatTabRejectionState} bundle for a given
|
|
774
|
+
* presenter + i18n pair. Two computeds share one source-walk
|
|
775
|
+
* (`lastFailedIndex` → `originIndexDuringCommit` → `tabs[idx].label()`)
|
|
776
|
+
* via Angular's signal memoisation — the second computed re-uses
|
|
777
|
+
* the first's cached `originLabel` value, so the `tabs()` traversal
|
|
778
|
+
* happens at most once per state change.
|
|
779
|
+
*
|
|
780
|
+
* @internal
|
|
781
|
+
*/
|
|
782
|
+
function createRejectionState(presenter, i18n) {
|
|
783
|
+
const originLabel = computed(() => {
|
|
784
|
+
const failedIdx = presenter.lastFailedIndex();
|
|
785
|
+
if (failedIdx === undefined) {
|
|
786
|
+
return undefined;
|
|
787
|
+
}
|
|
788
|
+
const originIdx = presenter.originIndexDuringCommit();
|
|
789
|
+
if (originIdx === undefined) {
|
|
790
|
+
return undefined;
|
|
791
|
+
}
|
|
792
|
+
return presenter.tabs()[originIdx]?.label() ?? undefined;
|
|
793
|
+
}, ...(ngDevMode ? [{ debugName: "originLabel" }] : /* istanbul ignore next */ []));
|
|
794
|
+
const descriptorText = computed(() => {
|
|
795
|
+
if (presenter.lastFailedIndex() === undefined) {
|
|
796
|
+
return '';
|
|
797
|
+
}
|
|
798
|
+
const label = originLabel();
|
|
799
|
+
return label ? i18n.commitRolledBackTo(label) : i18n.commitFailedRetry;
|
|
800
|
+
}, ...(ngDevMode ? [{ debugName: "descriptorText" }] : /* istanbul ignore next */ []));
|
|
801
|
+
const liveAnnouncement = computed(() => {
|
|
802
|
+
const current = presenter.commitTransition.current();
|
|
803
|
+
if (current === 'pending') {
|
|
804
|
+
return i18n.commitInFlight;
|
|
805
|
+
}
|
|
806
|
+
if (current === 'error') {
|
|
807
|
+
const label = originLabel();
|
|
808
|
+
return label ? i18n.commitRolledBackTo(label) : i18n.commitFailedRetry;
|
|
809
|
+
}
|
|
810
|
+
return '';
|
|
811
|
+
}, ...(ngDevMode ? [{ debugName: "liveAnnouncement" }] : /* istanbul ignore next */ []));
|
|
812
|
+
return { originLabel, descriptorText, liveAnnouncement };
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Translates a Material `MatTab` into a cngx {@link CngxTabHandle}
|
|
817
|
+
* plus a writable `errorAggregator` slot the `[cngxMatTabError]`
|
|
818
|
+
* directive binds.
|
|
819
|
+
*
|
|
820
|
+
* - `id` — fresh `idSeed()` value; a label-keyed id would collide
|
|
821
|
+
* when two tabs share a label.
|
|
822
|
+
* - `label` / `disabled` — `computed` signals retriggered by
|
|
823
|
+
* `toSignal(matTab._stateChanges)`. Bridge lifetime is tied to
|
|
824
|
+
* the supplied `injector` (typically a per-tab child
|
|
825
|
+
* `EnvironmentInjector`). `_stateChanges` is a Material-internal
|
|
826
|
+
* surface — see `tabs-accepted-debt §5`.
|
|
827
|
+
* - `errorAggregator` — writable seeded at `undefined`;
|
|
828
|
+
* `[cngxMatTabError]` writes its bound aggregator in and resets
|
|
829
|
+
* on teardown. The handle exposes `.asReadonly()` to preserve the
|
|
830
|
+
* `CngxTabHandle` contract.
|
|
831
|
+
*/
|
|
832
|
+
function createMatTabHandle(matTab, idSeed, injector) {
|
|
833
|
+
// Typed local — anchors `MaterialPrivateSurfaces.StateChangeSource`
|
|
834
|
+
// at the consumer site so an upgrade-watch grep lands here too.
|
|
835
|
+
// Documentation-only at runtime; MatTab's public typing already
|
|
836
|
+
// exposes `_stateChanges`. tabs-accepted-debt §5.
|
|
837
|
+
const stateChangeSource = matTab;
|
|
838
|
+
// `equal: () => false` is load-bearing — `_stateChanges` is a
|
|
839
|
+
// `Subject<void>`, so `Object.is(undefined, undefined)` would dedup
|
|
840
|
+
// every emission and the dependent computeds would never recompute.
|
|
841
|
+
const stateChangeTrigger = toSignal(stateChangeSource._stateChanges, {
|
|
842
|
+
injector,
|
|
843
|
+
initialValue: undefined,
|
|
844
|
+
equal: () => false,
|
|
845
|
+
});
|
|
846
|
+
const label = computed(() => {
|
|
847
|
+
stateChangeTrigger();
|
|
848
|
+
return matTab.textLabel;
|
|
849
|
+
}, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
850
|
+
const disabled = computed(() => {
|
|
851
|
+
stateChangeTrigger();
|
|
852
|
+
return matTab.disabled;
|
|
853
|
+
}, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
854
|
+
const errorAggregator = signal(undefined, ...(ngDevMode ? [{ debugName: "errorAggregator" }] : /* istanbul ignore next */ []));
|
|
855
|
+
// `nextUid` is process-wide monotonic, so `${id}-errors` descriptor
|
|
856
|
+
// ids stay unique across coexisting `[cngxMatTabs]` instances.
|
|
857
|
+
const id = idSeed();
|
|
858
|
+
return {
|
|
859
|
+
handle: {
|
|
860
|
+
id,
|
|
861
|
+
label,
|
|
862
|
+
disabled,
|
|
863
|
+
errorAggregator: errorAggregator.asReadonly(),
|
|
864
|
+
},
|
|
865
|
+
label,
|
|
866
|
+
disabled,
|
|
867
|
+
errorAggregator,
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* DI token fronting the per-tab handle factory used by
|
|
872
|
+
* `[cngxMatTabs]`. Default is {@link createMatTabHandle}. Symmetric
|
|
873
|
+
* with `CNGX_MAT_STEP_HANDLE_FACTORY` and
|
|
874
|
+
* `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY`.
|
|
875
|
+
*
|
|
876
|
+
* The seam separates handle shape (factory body) from id keying
|
|
877
|
+
* (the supplied `idSeed` closure). Overrides may call, ignore, or
|
|
878
|
+
* replace `idSeed` — server-synced ids, deterministic test ids,
|
|
879
|
+
* consumer-domain ids — without touching the factory body.
|
|
880
|
+
*
|
|
881
|
+
* Tracked-debt: family-uniformity staging, single in-package
|
|
882
|
+
* consumer today. See `tabs-accepted-debt §10`.
|
|
883
|
+
*
|
|
884
|
+
* ```ts
|
|
885
|
+
* providers: [
|
|
886
|
+
* {
|
|
887
|
+
* provide: CNGX_MAT_TAB_HANDLE_FACTORY,
|
|
888
|
+
* useValue: ((tab, idSeed, injector) => {
|
|
889
|
+
* const setup = createMatTabHandle(tab, idSeed, injector);
|
|
890
|
+
* reportTabRegistered(setup.handle.id);
|
|
891
|
+
* return setup;
|
|
892
|
+
* }) satisfies CngxMatTabHandleFactory,
|
|
893
|
+
* },
|
|
894
|
+
* ]
|
|
895
|
+
* ```
|
|
896
|
+
*/
|
|
897
|
+
const CNGX_MAT_TAB_HANDLE_FACTORY = new InjectionToken('CNGX_MAT_TAB_HANDLE_FACTORY', {
|
|
898
|
+
providedIn: 'root',
|
|
899
|
+
factory: () => createMatTabHandle,
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* DI token the {@link CngxMatTabsRegistry} directive provides via
|
|
904
|
+
* `useExisting`. Sibling per-tab directives inject this with
|
|
905
|
+
* `{ host: true }` to reach per-handle slots without walking the
|
|
906
|
+
* concrete registry class.
|
|
907
|
+
*/
|
|
908
|
+
const CNGX_MAT_TABS_REGISTRY_HOST = new InjectionToken('CngxMatTabsRegistryHost');
|
|
909
|
+
/**
|
|
910
|
+
* Sibling host-directive that owns the per-MatTab handle registry
|
|
911
|
+
* for `[cngxMatTabs]`. Extracted in Phase 7.1 so the parent stays
|
|
912
|
+
* under the level-4 organism LOC guard and per-tab decoration
|
|
913
|
+
* directives reach the registry through a typed token.
|
|
914
|
+
*
|
|
915
|
+
* Owns: `contentChildren(MatTab)` query, the `setupsByTab` map
|
|
916
|
+
* (per-tab cngx setup paired with a child `EnvironmentInjector`
|
|
917
|
+
* scoping the `_stateChanges` bridge), an `effect()` that diffs the
|
|
918
|
+
* MatTab list and (un)registers handles with `CNGX_TAB_GROUP_HOST`,
|
|
919
|
+
* and a `DestroyRef` cleanup that destroys every child injector.
|
|
920
|
+
*
|
|
921
|
+
* Composition: `[cngxMatTabs]` declares this in `hostDirectives`;
|
|
922
|
+
* both share the parent's `CngxTabGroupPresenter` and the same
|
|
923
|
+
* `<mat-tab-group>` content-children scope. Standalone use is
|
|
924
|
+
* exported but staged — see `tabs-accepted-debt §11`.
|
|
925
|
+
*/
|
|
926
|
+
class CngxMatTabsRegistry {
|
|
927
|
+
presenter = inject(CNGX_TAB_GROUP_HOST);
|
|
928
|
+
destroyRef = inject(DestroyRef);
|
|
929
|
+
envInjector = inject(EnvironmentInjector);
|
|
930
|
+
createHandle = inject(CNGX_MAT_TAB_HANDLE_FACTORY);
|
|
931
|
+
matTabs = contentChildren(MatTab, { ...(ngDevMode ? { debugName: "matTabs" } : /* istanbul ignore next */ {}), descendants: true });
|
|
932
|
+
// Map (not WeakMap) so the diff loop in `syncHandles` can iterate
|
|
933
|
+
// to find removed tabs without a parallel `Set<MatTab>`. Entries
|
|
934
|
+
// are explicitly deleted when the matching MatTab leaves the
|
|
935
|
+
// children set, AND the map goes away on directive destroy.
|
|
936
|
+
setupsByTab = new Map();
|
|
937
|
+
constructor() {
|
|
938
|
+
effect(() => {
|
|
939
|
+
const tabs = this.matTabs();
|
|
940
|
+
untracked(() => this.syncHandles(tabs));
|
|
941
|
+
});
|
|
942
|
+
this.destroyRef.onDestroy(() => {
|
|
943
|
+
for (const entry of this.setupsByTab.values()) {
|
|
944
|
+
// Disposes the per-tab `toSignal(_stateChanges)` bridge.
|
|
945
|
+
entry.childInjector.destroy();
|
|
946
|
+
}
|
|
947
|
+
this.setupsByTab.clear();
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
getHandleSetup(matTab) {
|
|
951
|
+
return this.setupsByTab.get(matTab)?.setup;
|
|
952
|
+
}
|
|
953
|
+
syncHandles(tabs) {
|
|
954
|
+
const liveTabs = new Set(tabs);
|
|
955
|
+
for (const tab of tabs) {
|
|
956
|
+
if (this.setupsByTab.has(tab)) {
|
|
957
|
+
continue;
|
|
958
|
+
}
|
|
959
|
+
// Per-tab child injector scopes the `toSignal(_stateChanges)`
|
|
960
|
+
// bridge inside createMatTabHandle — destroying it on tab
|
|
961
|
+
// removal fires `takeUntilDestroyed`. tabs-accepted-debt §5.
|
|
962
|
+
const childInjector = createEnvironmentInjector([], this.envInjector);
|
|
963
|
+
const idSeed = () => nextUid('cngx-mat-tab-');
|
|
964
|
+
const setup = this.createHandle(tab, idSeed, childInjector);
|
|
965
|
+
this.setupsByTab.set(tab, { setup, childInjector });
|
|
966
|
+
this.presenter.register(setup.handle);
|
|
967
|
+
}
|
|
968
|
+
// Snapshot entries before the loop so multi-key deletes inside
|
|
969
|
+
// the body never collide with iterator state.
|
|
970
|
+
for (const [tab, entry] of Array.from(this.setupsByTab.entries())) {
|
|
971
|
+
if (liveTabs.has(tab)) {
|
|
972
|
+
continue;
|
|
973
|
+
}
|
|
974
|
+
entry.childInjector.destroy();
|
|
975
|
+
this.setupsByTab.delete(tab);
|
|
976
|
+
this.presenter.unregister(entry.setup.handle.id);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabsRegistry, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
980
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.4", type: CngxMatTabsRegistry, isStandalone: true, selector: "[cngxMatTabsRegistry]", providers: [
|
|
981
|
+
{
|
|
982
|
+
provide: CNGX_MAT_TABS_REGISTRY_HOST,
|
|
983
|
+
useExisting: CngxMatTabsRegistry,
|
|
984
|
+
},
|
|
985
|
+
], queries: [{ propertyName: "matTabs", predicate: MatTab, descendants: true, isSignal: true }], exportAs: ["cngxMatTabsRegistry"], ngImport: i0 });
|
|
986
|
+
}
|
|
987
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabsRegistry, decorators: [{
|
|
988
|
+
type: Directive,
|
|
989
|
+
args: [{
|
|
990
|
+
selector: '[cngxMatTabsRegistry]',
|
|
991
|
+
exportAs: 'cngxMatTabsRegistry',
|
|
992
|
+
standalone: true,
|
|
993
|
+
providers: [
|
|
994
|
+
{
|
|
995
|
+
provide: CNGX_MAT_TABS_REGISTRY_HOST,
|
|
996
|
+
useExisting: CngxMatTabsRegistry,
|
|
997
|
+
},
|
|
998
|
+
],
|
|
999
|
+
}]
|
|
1000
|
+
}], ctorParameters: () => [], propDecorators: { matTabs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MatTab), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Material variant of {@link CngxTabOverflowDomAdapter}.
|
|
1004
|
+
*
|
|
1005
|
+
* `resolveStripRoot` walks from host up to `<mat-tab-header>` and
|
|
1006
|
+
* locates `.mat-mdc-tab-label-container` via any rendered
|
|
1007
|
+
* `.mat-mdc-tab` descendant — Material's IO-friendly scroll
|
|
1008
|
+
* container (`tabs-accepted-debt §5`).
|
|
1009
|
+
*
|
|
1010
|
+
* `resolveTabButton` indexes positionally; Material owns the DOM
|
|
1011
|
+
* and cngx handle ids never reach the button elements. Index
|
|
1012
|
+
* correlates against `presenter.tabs()` registration order.
|
|
1013
|
+
*
|
|
1014
|
+
* Wire it via the directive's
|
|
1015
|
+
* `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY` provider:
|
|
1016
|
+
*
|
|
1017
|
+
* ```ts
|
|
1018
|
+
* providers: [
|
|
1019
|
+
* { provide: CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY,
|
|
1020
|
+
* useValue: createCngxMatTabOverflowDomAdapter }
|
|
1021
|
+
* ]
|
|
1022
|
+
* ```
|
|
1023
|
+
*/
|
|
1024
|
+
function createCngxMatTabOverflowDomAdapter() {
|
|
1025
|
+
return {
|
|
1026
|
+
resolveStripRoot(_panelHost, host) {
|
|
1027
|
+
// Returning null is a retry signal — the rAF loop polls again
|
|
1028
|
+
// on the next frame, succeeds once MatTabHeader has committed.
|
|
1029
|
+
const header = host.closest(MaterialPrivateSurfaces.MAT_MDC_TAB_HEADER_SELECTOR);
|
|
1030
|
+
const anyTab = header?.querySelector(MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR);
|
|
1031
|
+
return (anyTab?.closest(MaterialPrivateSurfaces.MAT_MDC_TAB_LABEL_CONTAINER_SELECTOR) ?? null);
|
|
1032
|
+
},
|
|
1033
|
+
resolveTabButton(_handle, root, idx) {
|
|
1034
|
+
return (root
|
|
1035
|
+
.querySelectorAll(MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR)
|
|
1036
|
+
.item(idx) ?? null);
|
|
1037
|
+
},
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Implements {@link CngxTabPanelHost} for the programmatically
|
|
1043
|
+
* mounted overflow popover. Delegates to the directive's
|
|
1044
|
+
* `CNGX_TAB_GROUP_HOST` presenter; both template lookups return
|
|
1045
|
+
* `null` because Material renders labels through `<mat-tab>` and
|
|
1046
|
+
* projected `<mat-tab-content>`.
|
|
1047
|
+
*
|
|
1048
|
+
* Class instead of factory-returned literal so a telemetry or
|
|
1049
|
+
* branded variant can subclass + swap via `useClass`. The directive
|
|
1050
|
+
* registers it once and binds `CNGX_TAB_PANEL_HOST` with
|
|
1051
|
+
* `useExisting`.
|
|
1052
|
+
*
|
|
1053
|
+
* @internal
|
|
1054
|
+
*/
|
|
1055
|
+
class CngxMatTabsPanelHostAdapter {
|
|
1056
|
+
presenter = inject(CNGX_TAB_GROUP_HOST);
|
|
1057
|
+
tabs = this.presenter.tabs;
|
|
1058
|
+
activeId = this.presenter.activeId;
|
|
1059
|
+
orientation = this.presenter.orientation;
|
|
1060
|
+
selectById(id) {
|
|
1061
|
+
this.presenter.selectById(id);
|
|
1062
|
+
}
|
|
1063
|
+
labelTemplateFor(_id) {
|
|
1064
|
+
return null;
|
|
1065
|
+
}
|
|
1066
|
+
contentTemplateFor(_id) {
|
|
1067
|
+
return null;
|
|
1068
|
+
}
|
|
1069
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabsPanelHostAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1070
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabsPanelHostAdapter });
|
|
1071
|
+
}
|
|
1072
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabsPanelHostAdapter, decorators: [{
|
|
1073
|
+
type: Injectable
|
|
1074
|
+
}] });
|
|
1075
|
+
/**
|
|
1076
|
+
* Attaches to an existing `<mat-tab-group>` and wires it to a
|
|
1077
|
+
* {@link CngxTabGroupPresenter} — consumers get the commit-action
|
|
1078
|
+
* lifecycle, `CNGX_STATEFUL` (so `<cngx-toast-on />` and
|
|
1079
|
+
* `<cngx-banner-on />` compose as children), and the tab-handle
|
|
1080
|
+
* registry from one attribute.
|
|
1081
|
+
*
|
|
1082
|
+
* Topology inverts `<cngx-mat-stepper>`: Material is the host, cngx
|
|
1083
|
+
* is the instrumentation layer. `inject(MatTabGroup, { self: true })`
|
|
1084
|
+
* resolves on the consumer's own element — no content projection
|
|
1085
|
+
* blocker (`stepper-accepted-debt §1` does not apply here).
|
|
1086
|
+
*
|
|
1087
|
+
* Rejection (`--error`) and aggregator (`--has-errors`) visuals
|
|
1088
|
+
* live in the package-private projector factories under
|
|
1089
|
+
* `./decorations/`; this directive supplies their reactive triggers
|
|
1090
|
+
* and the delegators consumer templates call.
|
|
1091
|
+
*/
|
|
1092
|
+
class CngxMatTabs {
|
|
1093
|
+
matTabGroup = inject(MatTabGroup, { self: true });
|
|
1094
|
+
presenter = inject(CNGX_TAB_GROUP_HOST);
|
|
1095
|
+
destroyRef = inject(DestroyRef);
|
|
1096
|
+
injector = inject(Injector);
|
|
1097
|
+
renderer = inject(Renderer2);
|
|
1098
|
+
hostEl = inject(ElementRef).nativeElement;
|
|
1099
|
+
// Field order matters — `overflowRef` reads `viewContainerRef` at
|
|
1100
|
+
// class-init time. The VCR also feeds the aggregator-decoration
|
|
1101
|
+
// slot path further down.
|
|
1102
|
+
viewContainerRef = inject(ViewContainerRef);
|
|
1103
|
+
// Programmatic mount of the cngx overflow molecule.
|
|
1104
|
+
// `injector: this.injector` is load-bearing — without it,
|
|
1105
|
+
// `vcr.createComponent` walks the host-template's parent VCR for
|
|
1106
|
+
// DI resolution, missing this directive's `CNGX_TAB_PANEL_HOST`
|
|
1107
|
+
// and `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY` providers, and the
|
|
1108
|
+
// molecule NG0201s on `inject(CNGX_TAB_PANEL_HOST)`. The molecule
|
|
1109
|
+
// initially lands as a sibling of `<mat-tab-group>`; the
|
|
1110
|
+
// `afterNextRender` block below moves it into
|
|
1111
|
+
// `.mat-mdc-tab-header`.
|
|
1112
|
+
overflowRef = this.viewContainerRef.createComponent(CngxTabOverflow, {
|
|
1113
|
+
injector: this.injector,
|
|
1114
|
+
});
|
|
1115
|
+
aggregatorContentSlot = contentChild(CngxMatTabAggregatorContent, ...(ngDevMode ? [{ debugName: "aggregatorContentSlot" }] : /* istanbul ignore next */ []));
|
|
1116
|
+
aggregatorContentTemplate = computed(() => this.aggregatorContentSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "aggregatorContentTemplate" }] : /* istanbul ignore next */ []));
|
|
1117
|
+
rejectionContentSlot = contentChild(CngxMatTabRejectionContent, ...(ngDevMode ? [{ debugName: "rejectionContentSlot" }] : /* istanbul ignore next */ []));
|
|
1118
|
+
rejectionContentTemplate = computed(() => this.rejectionContentSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "rejectionContentTemplate" }] : /* istanbul ignore next */ []));
|
|
1119
|
+
// Per-tab registry lives on the `[cngxMatTabsRegistry]` host-
|
|
1120
|
+
// directive — sibling per-tab directives reach the per-handle
|
|
1121
|
+
// slots via `CNGX_MAT_TABS_REGISTRY_HOST`.
|
|
1122
|
+
i18n = injectTabsI18n();
|
|
1123
|
+
// Identity equal on `string | null` — collapses `tabs()` re-emits
|
|
1124
|
+
// that don't change the failed-target id.
|
|
1125
|
+
failedHandleId = computed(() => {
|
|
1126
|
+
const idx = this.presenter.lastFailedIndex();
|
|
1127
|
+
if (idx === undefined) {
|
|
1128
|
+
return null;
|
|
1129
|
+
}
|
|
1130
|
+
return this.presenter.tabs()[idx]?.id ?? null;
|
|
1131
|
+
}, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
|
|
1132
|
+
// Bundle shares one source-walk across descriptorText / originLabel
|
|
1133
|
+
// / liveAnnouncement — pillar-2 phrasing parity with cngx-native.
|
|
1134
|
+
rejectionState = createRejectionState(this.presenter, this.i18n);
|
|
1135
|
+
// Structural equal — drops re-runs whose entry list is shape-
|
|
1136
|
+
// identical so the projector doesn't churn on no-op aggregator
|
|
1137
|
+
// re-emissions.
|
|
1138
|
+
aggregatedErrorTabs = computed(() => {
|
|
1139
|
+
const tabs = this.presenter.tabs();
|
|
1140
|
+
const acc = [];
|
|
1141
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
1142
|
+
const handle = tabs[i];
|
|
1143
|
+
const aggregator = handle.errorAggregator();
|
|
1144
|
+
if (aggregator?.shouldShow()) {
|
|
1145
|
+
acc.push({
|
|
1146
|
+
idx: i,
|
|
1147
|
+
id: handle.id,
|
|
1148
|
+
announcement: aggregator.announcement(),
|
|
1149
|
+
count: aggregator.errorCount(),
|
|
1150
|
+
label: handle.label() ?? '',
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
return acc;
|
|
1155
|
+
}, { ...(ngDevMode ? { debugName: "aggregatedErrorTabs" } : /* istanbul ignore next */ {}), equal: (a, b) => {
|
|
1156
|
+
if (a.length !== b.length) {
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
for (let i = 0; i < a.length; i++) {
|
|
1160
|
+
if (a[i].idx !== b[i].idx ||
|
|
1161
|
+
a[i].id !== b[i].id ||
|
|
1162
|
+
a[i].announcement !== b[i].announcement ||
|
|
1163
|
+
a[i].count !== b[i].count ||
|
|
1164
|
+
a[i].label !== b[i].label) {
|
|
1165
|
+
return false;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
return true;
|
|
1169
|
+
} });
|
|
1170
|
+
constructor() {
|
|
1171
|
+
const matTabsConfig = injectMatTabsConfig();
|
|
1172
|
+
// Polite live region — attribute directive owns no template, so
|
|
1173
|
+
// the helper attaches the span at document.body (CDK
|
|
1174
|
+
// LiveAnnouncer convention) and mirrors `CngxLiveRegion`'s host
|
|
1175
|
+
// bindings imperatively.
|
|
1176
|
+
mountLiveRegionAnnouncer({
|
|
1177
|
+
announcement: this.rejectionState.liveAnnouncement,
|
|
1178
|
+
renderer: this.renderer,
|
|
1179
|
+
injector: this.injector,
|
|
1180
|
+
destroyRef: this.destroyRef,
|
|
1181
|
+
});
|
|
1182
|
+
// Decoration projectors own DOM-mutation state plus `effect()`
|
|
1183
|
+
// registration; the directive only supplies reactive triggers.
|
|
1184
|
+
createMatTabRejectionDecoration({
|
|
1185
|
+
hostEl: this.hostEl,
|
|
1186
|
+
failedHandleId: this.failedHandleId,
|
|
1187
|
+
failedIndex: this.presenter.lastFailedIndex,
|
|
1188
|
+
descriptorText: this.rejectionState.descriptorText,
|
|
1189
|
+
renderer: this.renderer,
|
|
1190
|
+
injector: this.injector,
|
|
1191
|
+
destroyRef: this.destroyRef,
|
|
1192
|
+
contentTemplate: this.rejectionContentTemplate,
|
|
1193
|
+
viewContainerRef: this.viewContainerRef,
|
|
1194
|
+
originLabel: this.rejectionState.originLabel,
|
|
1195
|
+
});
|
|
1196
|
+
createMatTabAggregatorDecoration({
|
|
1197
|
+
hostEl: this.hostEl,
|
|
1198
|
+
errorTabs: this.aggregatedErrorTabs,
|
|
1199
|
+
renderer: this.renderer,
|
|
1200
|
+
injector: this.injector,
|
|
1201
|
+
destroyRef: this.destroyRef,
|
|
1202
|
+
contentTemplate: this.aggregatorContentTemplate,
|
|
1203
|
+
viewContainerRef: this.viewContainerRef,
|
|
1204
|
+
onHalfWiredSlot: matTabsConfig.halfWiredSlotSink,
|
|
1205
|
+
});
|
|
1206
|
+
this.destroyRef.onDestroy(() => this.overflowRef.destroy());
|
|
1207
|
+
// Anchor the overflow molecule inside `.mat-mdc-tab-header` so
|
|
1208
|
+
// the More button pins to the strip's trailing edge. Bounded
|
|
1209
|
+
// `createDomAnchorRetry` covers the deferred-host case
|
|
1210
|
+
// (`<mat-tab-group>` gated behind `*ngIf` / `@defer`); the cap
|
|
1211
|
+
// dev-warns when consumer DOM never materialises. The
|
|
1212
|
+
// flex-layout skin in `mat-tabs.css` handles positioning — no
|
|
1213
|
+
// imperative layout work needed.
|
|
1214
|
+
const anchorMaxAttempts = matTabsConfig.anchorMaxAttempts;
|
|
1215
|
+
const anchorRetry = inject(CNGX_DOM_ANCHOR_RETRY_FACTORY)({
|
|
1216
|
+
attempt: () => {
|
|
1217
|
+
const headerEl = this.hostEl.querySelector(MaterialPrivateSurfaces.MAT_MDC_TAB_HEADER_SELECTOR);
|
|
1218
|
+
if (!headerEl) {
|
|
1219
|
+
return null;
|
|
1220
|
+
}
|
|
1221
|
+
const overflowEl = this.overflowRef.location.nativeElement;
|
|
1222
|
+
this.renderer.addClass(overflowEl, 'cngx-mat-tabs-more');
|
|
1223
|
+
this.renderer.appendChild(headerEl, overflowEl);
|
|
1224
|
+
return true;
|
|
1225
|
+
},
|
|
1226
|
+
maxAttempts: anchorMaxAttempts,
|
|
1227
|
+
schedule: (cb) => {
|
|
1228
|
+
afterNextRender(cb, { injector: this.injector });
|
|
1229
|
+
return () => undefined;
|
|
1230
|
+
},
|
|
1231
|
+
onGiveUp: () => {
|
|
1232
|
+
if (isDevMode()) {
|
|
1233
|
+
console.warn(`[CngxMatTabs] Could not anchor <cngx-tab-overflow> after ${anchorMaxAttempts} ` +
|
|
1234
|
+
'attempts — .mat-mdc-tab-header was not found inside the ' +
|
|
1235
|
+
'host. The More popover will fall back to a sibling-of-' +
|
|
1236
|
+
'<mat-tab-group> position; verify Material rendered the ' +
|
|
1237
|
+
'strip (e.g. consumer is not gating <mat-tab-group> behind ' +
|
|
1238
|
+
'a never-true *ngIf / @defer).');
|
|
1239
|
+
}
|
|
1240
|
+
},
|
|
1241
|
+
});
|
|
1242
|
+
afterNextRender(() => anchorRetry.start());
|
|
1243
|
+
this.destroyRef.onDestroy(() => anchorRetry.cancel());
|
|
1244
|
+
createMaterialBidirectionalSync({
|
|
1245
|
+
presenterIndex: this.presenter.activeIndex,
|
|
1246
|
+
readSelectedIndex: () => this.matTabGroup.selectedIndex ?? 0,
|
|
1247
|
+
writeSelectedIndex: (i) => {
|
|
1248
|
+
this.matTabGroup.selectedIndex = i;
|
|
1249
|
+
},
|
|
1250
|
+
selectionChange$: this.matTabGroup.selectedIndexChange.asObservable(),
|
|
1251
|
+
onMaterialSelection: (i) => this.presenter.select(i),
|
|
1252
|
+
injector: this.injector,
|
|
1253
|
+
destroyRef: this.destroyRef,
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Clears `presenter.lastFailedIndex`, dismissing the rejection
|
|
1258
|
+
* decoration. Mirrors `CngxTabGroup.clearLastFailed()` so a
|
|
1259
|
+
* template ref (`#mt="cngxMatTabs"`) is enough — no host-token
|
|
1260
|
+
* injection needed.
|
|
1261
|
+
*/
|
|
1262
|
+
clearLastFailed() {
|
|
1263
|
+
this.presenter.clearLastFailed();
|
|
1264
|
+
}
|
|
1265
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1266
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.4", type: CngxMatTabs, isStandalone: true, selector: "[cngxMatTabs]", providers: [
|
|
1267
|
+
// Material variant of the overflow molecule's DOM-resolution
|
|
1268
|
+
// strategy. Swaps `.cngx-tabs__strip-wrapper` walks for the Material
|
|
1269
|
+
// `.mat-mdc-tab-header` → `.mat-mdc-tab-label-container` walk and
|
|
1270
|
+
// index-based `.mat-mdc-tab` resolution.
|
|
1271
|
+
{
|
|
1272
|
+
provide: CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY,
|
|
1273
|
+
useValue: createCngxMatTabOverflowDomAdapter,
|
|
1274
|
+
},
|
|
1275
|
+
// Panel-host adapter for the programmatically mounted overflow
|
|
1276
|
+
// molecule. `useExisting` binding below ensures every injection
|
|
1277
|
+
// resolves to the single per-host instance. The cngx-native
|
|
1278
|
+
// `<cngx-tab-group>` path keeps its own `useExisting:
|
|
1279
|
+
// CngxTabGroup` provider — sits one injector layer closer.
|
|
1280
|
+
CngxMatTabsPanelHostAdapter,
|
|
1281
|
+
{
|
|
1282
|
+
provide: CNGX_TAB_PANEL_HOST,
|
|
1283
|
+
useExisting: CngxMatTabsPanelHostAdapter,
|
|
1284
|
+
},
|
|
1285
|
+
], queries: [{ propertyName: "aggregatorContentSlot", first: true, predicate: CngxMatTabAggregatorContent, descendants: true, isSignal: true }, { propertyName: "rejectionContentSlot", first: true, predicate: CngxMatTabRejectionContent, descendants: true, isSignal: true }], exportAs: ["cngxMatTabs"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter, inputs: ["activeIndex", "activeIndex", "orientation", "orientation", "loop", "loop", "commitAction", "commitAction", "commitMode", "commitMode"], outputs: ["activeIndexChange", "activeIndexChange"] }, { directive: CngxMatTabsRegistry }], ngImport: i0 });
|
|
1286
|
+
}
|
|
1287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabs, decorators: [{
|
|
1288
|
+
type: Directive,
|
|
1289
|
+
args: [{
|
|
1290
|
+
selector: '[cngxMatTabs]',
|
|
1291
|
+
exportAs: 'cngxMatTabs',
|
|
1292
|
+
standalone: true,
|
|
1293
|
+
hostDirectives: [
|
|
1294
|
+
{
|
|
1295
|
+
directive: CngxTabGroupPresenter,
|
|
1296
|
+
inputs: ['activeIndex', 'orientation', 'loop', 'commitAction', 'commitMode'],
|
|
1297
|
+
outputs: ['activeIndexChange'],
|
|
1298
|
+
},
|
|
1299
|
+
// Provides `CNGX_MAT_TABS_REGISTRY_HOST` so per-tab decoration
|
|
1300
|
+
// directives reach the registry through a typed token rather
|
|
1301
|
+
// than injecting this concrete class.
|
|
1302
|
+
CngxMatTabsRegistry,
|
|
1303
|
+
],
|
|
1304
|
+
providers: [
|
|
1305
|
+
// Material variant of the overflow molecule's DOM-resolution
|
|
1306
|
+
// strategy. Swaps `.cngx-tabs__strip-wrapper` walks for the Material
|
|
1307
|
+
// `.mat-mdc-tab-header` → `.mat-mdc-tab-label-container` walk and
|
|
1308
|
+
// index-based `.mat-mdc-tab` resolution.
|
|
1309
|
+
{
|
|
1310
|
+
provide: CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY,
|
|
1311
|
+
useValue: createCngxMatTabOverflowDomAdapter,
|
|
1312
|
+
},
|
|
1313
|
+
// Panel-host adapter for the programmatically mounted overflow
|
|
1314
|
+
// molecule. `useExisting` binding below ensures every injection
|
|
1315
|
+
// resolves to the single per-host instance. The cngx-native
|
|
1316
|
+
// `<cngx-tab-group>` path keeps its own `useExisting:
|
|
1317
|
+
// CngxTabGroup` provider — sits one injector layer closer.
|
|
1318
|
+
CngxMatTabsPanelHostAdapter,
|
|
1319
|
+
{
|
|
1320
|
+
provide: CNGX_TAB_PANEL_HOST,
|
|
1321
|
+
useExisting: CngxMatTabsPanelHostAdapter,
|
|
1322
|
+
},
|
|
1323
|
+
],
|
|
1324
|
+
}]
|
|
1325
|
+
}], ctorParameters: () => [], propDecorators: { aggregatorContentSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxMatTabAggregatorContent), { isSignal: true }] }], rejectionContentSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxMatTabRejectionContent), { isSignal: true }] }] } });
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* Per-tab error-aggregator binding for `[cngxMatTabs]`. Attach to a
|
|
1329
|
+
* `<mat-tab>`; the bound aggregator's `shouldShow()` projects onto
|
|
1330
|
+
* the matching Material tab button (badge + descriptor span) via
|
|
1331
|
+
* the Renderer2 effect inside {@link CngxMatTabs}.
|
|
1332
|
+
*
|
|
1333
|
+
* Material owns `<mat-tab>` declarations — `[cngxTab]` cannot host
|
|
1334
|
+
* here — so a sibling attribute directive carries the input.
|
|
1335
|
+
* Empty-string transform handles the bare-attribute case per
|
|
1336
|
+
* `feedback_bridge_input_not_required` (a developer typing
|
|
1337
|
+
* `cngxMatTabError` without `[]` brackets must not poison the
|
|
1338
|
+
* slot).
|
|
1339
|
+
*
|
|
1340
|
+
* Locates its target via {@link CNGX_MAT_TABS_REGISTRY_HOST} —
|
|
1341
|
+
* the registry provides the token with `useExisting`, so sibling
|
|
1342
|
+
* directives reach per-handle slots through a typed contract
|
|
1343
|
+
* instead of the concrete class. Tracks `presenter.tabs()` to
|
|
1344
|
+
* recover from a same-microtask race where the directive injects
|
|
1345
|
+
* before the registry's sync runs. `destroyRef.onDestroy` clears
|
|
1346
|
+
* the slot so an `*ngIf`-toggled binding returns to the
|
|
1347
|
+
* no-aggregator default.
|
|
1348
|
+
*/
|
|
1349
|
+
class CngxMatTabError {
|
|
1350
|
+
matTab = inject(MatTab, { self: true });
|
|
1351
|
+
registry = inject(CNGX_MAT_TABS_REGISTRY_HOST, {
|
|
1352
|
+
host: true,
|
|
1353
|
+
});
|
|
1354
|
+
presenter = inject(CNGX_TAB_GROUP_HOST);
|
|
1355
|
+
destroyRef = inject(DestroyRef);
|
|
1356
|
+
aggregator = input(undefined, { ...(ngDevMode ? { debugName: "aggregator" } : /* istanbul ignore next */ {}), alias: 'cngxMatTabError',
|
|
1357
|
+
transform: (value) => (typeof value === 'string' ? undefined : value) });
|
|
1358
|
+
constructor() {
|
|
1359
|
+
effect(() => {
|
|
1360
|
+
// Race window - registry's `contentChildren(MatTab)` query and
|
|
1361
|
+
// our injection land in the same microtask, so the first lookup
|
|
1362
|
+
// can miss our handle. Tracking `presenter.tabs()` re-fires the
|
|
1363
|
+
// effect on the next sync tick. `untracked` around the write
|
|
1364
|
+
// pre-empts a future regression where `getHandleSetup` reads a
|
|
1365
|
+
// signal and self-triggers the aggregator pump.
|
|
1366
|
+
const aggregator = this.aggregator();
|
|
1367
|
+
// Race-recovery dependency — tracks `setupsByTab` population so
|
|
1368
|
+
// the effect re-fires once our `MatTab` is registered. The bare
|
|
1369
|
+
// read is intentional; full rationale lives in the effect's
|
|
1370
|
+
// opening comment above. Do NOT tag as dead code.
|
|
1371
|
+
this.presenter.tabs();
|
|
1372
|
+
untracked(() => {
|
|
1373
|
+
const setup = this.registry.getHandleSetup(this.matTab);
|
|
1374
|
+
setup?.errorAggregator.set(aggregator);
|
|
1375
|
+
});
|
|
1376
|
+
});
|
|
1377
|
+
this.destroyRef.onDestroy(() => {
|
|
1378
|
+
const setup = this.registry.getHandleSetup(this.matTab);
|
|
1379
|
+
setup?.errorAggregator.set(undefined);
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabError, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1383
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxMatTabError, isStandalone: true, selector: "[cngxMatTabError]", inputs: { aggregator: { classPropertyName: "aggregator", publicName: "cngxMatTabError", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxMatTabError"], ngImport: i0 });
|
|
1384
|
+
}
|
|
1385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabError, decorators: [{
|
|
1386
|
+
type: Directive,
|
|
1387
|
+
args: [{
|
|
1388
|
+
selector: '[cngxMatTabError]',
|
|
1389
|
+
exportAs: 'cngxMatTabError',
|
|
1390
|
+
standalone: true,
|
|
1391
|
+
}]
|
|
1392
|
+
}], ctorParameters: () => [], propDecorators: { aggregator: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxMatTabError", required: false }] }] } });
|
|
1393
|
+
|
|
1394
|
+
/**
|
|
1395
|
+
* @module @cngx/ui/mat-tabs
|
|
1396
|
+
*
|
|
1397
|
+
* Material instrumentation directive for `<mat-tab-group>`.
|
|
1398
|
+
*/
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* Generated bundle index. Do not edit.
|
|
1402
|
+
*/
|
|
1403
|
+
|
|
1404
|
+
export { CNGX_MAT_TABS_CONFIG, CNGX_MAT_TABS_REGISTRY_HOST, CNGX_MAT_TAB_HANDLE_FACTORY, CngxMatTabAggregatorContent, CngxMatTabError, CngxMatTabRejectionContent, CngxMatTabs, CngxMatTabsRegistry, MaterialPrivateSurfaces, createCngxMatTabOverflowDomAdapter, createMatTabHandle, injectMatTabsConfig, provideMatTabsConfig, provideMatTabsConfigAt, withAnchorRetryAttempts, withHalfWiredSlotSink };
|
|
1405
|
+
//# sourceMappingURL=cngx-ui-mat-tabs.mjs.map
|