@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,14 +1,35 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { isDevMode, afterNextRender, runInInjectionContext, effect, untracked, computed, InjectionToken, makeEnvironmentProviders, inject, TemplateRef, Directive, signal, DestroyRef, EnvironmentInjector, contentChildren, createEnvironmentInjector, Injectable, Injector, Renderer2, ElementRef, ViewContainerRef, contentChild, input } from '@angular/core';
|
|
3
|
+
import { MatTabGroup, MatTab, MatTabLink } from '@angular/material/tabs';
|
|
4
4
|
import { createMaterialBidirectionalSync } from '@cngx/common/data';
|
|
5
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, CNGX_TAB_NAV_HOST } 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, createTabNavAnnouncement, CNGX_TAB_NAV_HOST } from '@cngx/common/tabs';
|
|
7
7
|
import { CngxTabOverflow } from '@cngx/ui/tabs';
|
|
8
8
|
import { CngxLiveAnnouncer } from '@cngx/common/a11y';
|
|
9
9
|
import { nextUid } from '@cngx/core/utils';
|
|
10
10
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Default sink - gated on dev-mode. Production callers see no
|
|
14
|
+
* output; production telemetry lands only when a consumer overrides
|
|
15
|
+
* via `withHalfWiredSlotSink(fn)`.
|
|
16
|
+
*
|
|
17
|
+
* @internal - exported only for {@link CngxMatTabsConfig.halfWiredSlotSink}'s
|
|
18
|
+
* library default. Consumers should override via the config feature
|
|
19
|
+
* rather than reach for this reference directly.
|
|
20
|
+
*/
|
|
21
|
+
const CNGX_DEFAULT_HALF_WIRED_SLOT_SINK = (missing) => {
|
|
22
|
+
if (!isDevMode()) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
console.warn('[cngxMatTabs] aggregator-content slot half-wired - ' +
|
|
26
|
+
`\`${missing}\` is missing while the other half is supplied. ` +
|
|
27
|
+
'The decoration projector will silently fall back to the ' +
|
|
28
|
+
'imperative `textContent` path, and the consumer-projected ' +
|
|
29
|
+
'`*cngxMatTabAggregatorContent` template will never render. ' +
|
|
30
|
+
'Wire both halves on the [cngxMatTabs] directive (or neither).');
|
|
31
|
+
};
|
|
32
|
+
|
|
12
33
|
/**
|
|
13
34
|
* Centralised type façade and selector constants for every Angular
|
|
14
35
|
* Material internal surface cngx Material-bridge code couples to.
|
|
@@ -127,6 +148,13 @@ function restoreAriaDescribedbyExceptToken(el, tokenToRemove, renderer, priorAri
|
|
|
127
148
|
* resolution O(1) - no DOM rebuild when the origin label arrives
|
|
128
149
|
* via a downstream `tabs()` re-emission.
|
|
129
150
|
*
|
|
151
|
+
* Race recovery - when the effect fires before MatTabHeader has
|
|
152
|
+
* rendered the matching button (initial-render race), the failed id
|
|
153
|
+
* is NOT latched (a latched id would suppress every later attempt
|
|
154
|
+
* for the same failure) and a single `afterNextRender` retry is
|
|
155
|
+
* scheduled, bounded by `maxRetryAttempts` - same recovery shape as
|
|
156
|
+
* the aggregator projector.
|
|
157
|
+
*
|
|
130
158
|
* @internal
|
|
131
159
|
*/
|
|
132
160
|
function createMatTabRejectionDecoration(opts) {
|
|
@@ -134,6 +162,9 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
134
162
|
const className = opts.className ?? 'cngx-mat-tab--error';
|
|
135
163
|
const srOnlyClassName = opts.srOnlyClassName ?? 'cngx-sr-only';
|
|
136
164
|
const descriptorIdSuffix = opts.descriptorIdSuffix ?? 'rejected';
|
|
165
|
+
const maxRetryAttempts = opts.maxRetryAttempts ?? 5;
|
|
166
|
+
let pendingRetry = false;
|
|
167
|
+
let retryAttempts = 0;
|
|
137
168
|
// Slot path needs both halves; either alone degrades to imperative
|
|
138
169
|
// textContent. No diagnostic - single in-package consumer always
|
|
139
170
|
// passes both.
|
|
@@ -207,7 +238,7 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
207
238
|
const buttons = opts.hostEl.querySelectorAll(buttonSelector);
|
|
208
239
|
const targetEl = buttons.item(failedIdx);
|
|
209
240
|
if (!targetEl) {
|
|
210
|
-
return;
|
|
241
|
+
return false;
|
|
211
242
|
}
|
|
212
243
|
opts.renderer.addClass(targetEl, className);
|
|
213
244
|
const spanId = `${handleId}-${descriptorIdSuffix}`;
|
|
@@ -233,6 +264,44 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
233
264
|
opts.renderer.setAttribute(targetEl, 'aria-describedby', tokens.join(' '));
|
|
234
265
|
decoratedEl = targetEl;
|
|
235
266
|
priorAriaDescribedby = prior;
|
|
267
|
+
return true;
|
|
268
|
+
};
|
|
269
|
+
const applyOrScheduleRetry = (id) => {
|
|
270
|
+
const idx = opts.failedIndex();
|
|
271
|
+
if (idx === undefined) {
|
|
272
|
+
clearDecoration();
|
|
273
|
+
lastAppliedId = null;
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (applyDecorationAt(idx, id)) {
|
|
277
|
+
lastAppliedId = id;
|
|
278
|
+
retryAttempts = 0;
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
// Initial-render race - the matching button is not stamped yet.
|
|
282
|
+
// The id is deliberately NOT latched (a latched id would
|
|
283
|
+
// short-circuit every later run for the same failure); retry
|
|
284
|
+
// once per render, bounded like the aggregator projector.
|
|
285
|
+
if (pendingRetry) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (retryAttempts >= maxRetryAttempts) {
|
|
289
|
+
retryAttempts = 0;
|
|
290
|
+
const sink = opts.onMaxRetriesReached ??
|
|
291
|
+
defaultRetryCeilingWarn(maxRetryAttempts, 'rejection');
|
|
292
|
+
sink();
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
pendingRetry = true;
|
|
296
|
+
retryAttempts++;
|
|
297
|
+
afterNextRender(() => {
|
|
298
|
+
pendingRetry = false;
|
|
299
|
+
const current = opts.failedHandleId();
|
|
300
|
+
if (current === null || current === lastAppliedId) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
applyOrScheduleRetry(current);
|
|
304
|
+
}, { injector: opts.injector });
|
|
236
305
|
};
|
|
237
306
|
runInInjectionContext(opts.injector, () => {
|
|
238
307
|
effect(() => {
|
|
@@ -246,14 +315,7 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
246
315
|
lastAppliedId = null;
|
|
247
316
|
return;
|
|
248
317
|
}
|
|
249
|
-
|
|
250
|
-
if (idx === undefined) {
|
|
251
|
-
clearDecoration();
|
|
252
|
-
lastAppliedId = null;
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
applyDecorationAt(idx, id);
|
|
256
|
-
lastAppliedId = id;
|
|
318
|
+
applyOrScheduleRetry(id);
|
|
257
319
|
});
|
|
258
320
|
});
|
|
259
321
|
// Live-text effect - tracks `descriptorText` plus the slot
|
|
@@ -303,7 +365,7 @@ function createMatTabAggregatorDecoration(opts) {
|
|
|
303
365
|
// at runtime, so the signal has to come from a deliberate sink.
|
|
304
366
|
if (!isFullyWired() && (opts.contentTemplate || opts.viewContainerRef)) {
|
|
305
367
|
const missing = opts.contentTemplate ? 'viewContainerRef' : 'contentTemplate';
|
|
306
|
-
const sink = opts.onHalfWiredSlot ??
|
|
368
|
+
const sink = opts.onHalfWiredSlot ?? CNGX_DEFAULT_HALF_WIRED_SLOT_SINK;
|
|
307
369
|
sink(missing);
|
|
308
370
|
}
|
|
309
371
|
const decorated = new Map();
|
|
@@ -427,7 +489,7 @@ function createMatTabAggregatorDecoration(opts) {
|
|
|
427
489
|
}
|
|
428
490
|
if (retryAttempts >= maxRetryAttempts) {
|
|
429
491
|
retryAttempts = 0;
|
|
430
|
-
const sink = opts.onMaxRetriesReached ?? defaultRetryCeilingWarn(maxRetryAttempts);
|
|
492
|
+
const sink = opts.onMaxRetriesReached ?? defaultRetryCeilingWarn(maxRetryAttempts, 'aggregator');
|
|
431
493
|
sink();
|
|
432
494
|
return;
|
|
433
495
|
}
|
|
@@ -456,28 +518,17 @@ function createMatTabAggregatorDecoration(opts) {
|
|
|
456
518
|
}
|
|
457
519
|
});
|
|
458
520
|
}
|
|
459
|
-
function
|
|
460
|
-
if (!isDevMode()) {
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
console.warn('[cngxMatTabs] aggregator-content slot half-wired - ' +
|
|
464
|
-
`\`${missing}\` is missing while the other half is supplied. ` +
|
|
465
|
-
'The decoration projector will silently fall back to the ' +
|
|
466
|
-
'imperative `textContent` path, and the consumer-projected ' +
|
|
467
|
-
'`*cngxMatTabAggregatorContent` template will never render. ' +
|
|
468
|
-
'Wire both halves on the [cngxMatTabs] directive (or neither).');
|
|
469
|
-
}
|
|
470
|
-
function defaultRetryCeilingWarn(max) {
|
|
521
|
+
function defaultRetryCeilingWarn(max, decoration) {
|
|
471
522
|
return () => {
|
|
472
523
|
if (!isDevMode()) {
|
|
473
524
|
return;
|
|
474
525
|
}
|
|
475
|
-
console.warn(
|
|
526
|
+
console.warn(`[cngxMatTabs] ${decoration} decoration retry ceiling reached ` +
|
|
476
527
|
`(${max} attempts) - MatTabHeader did not render ` +
|
|
477
528
|
'`.mat-mdc-tab` buttons within the expected window. Likely ' +
|
|
478
529
|
'cause: Material upgrade broke the `.mat-mdc-tab` selector ' +
|
|
479
530
|
'contract or a consumer-side render stall. ' +
|
|
480
|
-
'
|
|
531
|
+
'The decoration may remain visually missing ' +
|
|
481
532
|
'until the next state change.');
|
|
482
533
|
};
|
|
483
534
|
}
|
|
@@ -531,27 +582,6 @@ function createAggregatedErrorTabs(presenter) {
|
|
|
531
582
|
});
|
|
532
583
|
}
|
|
533
584
|
|
|
534
|
-
/**
|
|
535
|
-
* Default sink - gated on dev-mode. Production callers see no
|
|
536
|
-
* output; production telemetry lands only when a consumer overrides
|
|
537
|
-
* via `withHalfWiredSlotSink(fn)`.
|
|
538
|
-
*
|
|
539
|
-
* @internal - exported only for {@link CngxMatTabsConfig.halfWiredSlotSink}'s
|
|
540
|
-
* library default. Consumers should override via the config feature
|
|
541
|
-
* rather than reach for this reference directly.
|
|
542
|
-
*/
|
|
543
|
-
const CNGX_DEFAULT_HALF_WIRED_SLOT_SINK = (missing) => {
|
|
544
|
-
if (!isDevMode()) {
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
console.warn('[cngxMatTabs] aggregator-content slot half-wired - ' +
|
|
548
|
-
`\`${missing}\` is missing while the other half is supplied. ` +
|
|
549
|
-
'The decoration projector will silently fall back to the ' +
|
|
550
|
-
'imperative `textContent` path, and the consumer-projected ' +
|
|
551
|
-
'`*cngxMatTabAggregatorContent` template will never render. ' +
|
|
552
|
-
'Wire both halves on the [cngxMatTabs] directive (or neither).');
|
|
553
|
-
};
|
|
554
|
-
|
|
555
585
|
/**
|
|
556
586
|
* Library defaults for `[cngxMatTabs]`. Source of truth for every
|
|
557
587
|
* key on {@link CngxMatTabsConfig}. Consumed by
|
|
@@ -562,6 +592,7 @@ const CNGX_DEFAULT_HALF_WIRED_SLOT_SINK = (missing) => {
|
|
|
562
592
|
const CNGX_MAT_TABS_CONFIG_DEFAULTS = {
|
|
563
593
|
anchorMaxAttempts: 5,
|
|
564
594
|
halfWiredSlotSink: CNGX_DEFAULT_HALF_WIRED_SLOT_SINK,
|
|
595
|
+
templates: {},
|
|
565
596
|
};
|
|
566
597
|
/**
|
|
567
598
|
* DI token holding a partial {@link CngxMatTabsConfig}. Set via
|
|
@@ -596,10 +627,27 @@ function withAnchorRetryAttempts(n) {
|
|
|
596
627
|
function withHalfWiredSlotSink(sink) {
|
|
597
628
|
return feature({ halfWiredSlotSink: sink });
|
|
598
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* App-wide override for the rejection SR-descriptor content. Middle
|
|
632
|
+
* tier; per-instance `*cngxMatTabRejectionContent` still wins.
|
|
633
|
+
* Sibling of {@link withTabRejectionIconTemplate} in the cngx-native
|
|
634
|
+
* family.
|
|
635
|
+
*
|
|
636
|
+
* @category ui/mat-tabs
|
|
637
|
+
*/
|
|
638
|
+
function withMatTabRejectionTemplate(template) {
|
|
639
|
+
return feature({ templates: { rejection: template } });
|
|
640
|
+
}
|
|
599
641
|
function mergeFeatures(features) {
|
|
600
642
|
const merged = {};
|
|
601
643
|
for (const f of features) {
|
|
602
|
-
|
|
644
|
+
const { templates, ...rest } = f.config;
|
|
645
|
+
Object.assign(merged, rest);
|
|
646
|
+
if (templates) {
|
|
647
|
+
// Nested-merge so several template features compose instead of the
|
|
648
|
+
// last one overwriting the whole templates object.
|
|
649
|
+
merged.templates = { ...merged.templates, ...templates };
|
|
650
|
+
}
|
|
603
651
|
}
|
|
604
652
|
return merged;
|
|
605
653
|
}
|
|
@@ -632,6 +680,11 @@ function provideMatTabsConfig(...features) {
|
|
|
632
680
|
* `providers` or `viewProviders` (which cannot accept opaque
|
|
633
681
|
* environment providers).
|
|
634
682
|
*
|
|
683
|
+
* Merges over the outer config (via `skipSelf`), so a component-scope
|
|
684
|
+
* call refines the root {@link provideMatTabsConfig} instead of
|
|
685
|
+
* reverting its untouched keys to library defaults - only the keys
|
|
686
|
+
* the local features set are overridden for the subtree.
|
|
687
|
+
*
|
|
635
688
|
* ```ts
|
|
636
689
|
* @Component({
|
|
637
690
|
* selector: 'app-tabs-page',
|
|
@@ -645,7 +698,22 @@ function provideMatTabsConfig(...features) {
|
|
|
645
698
|
* @category ui/mat-tabs
|
|
646
699
|
*/
|
|
647
700
|
function provideMatTabsConfigAt(...features) {
|
|
648
|
-
return [
|
|
701
|
+
return [
|
|
702
|
+
{
|
|
703
|
+
provide: CNGX_MAT_TABS_CONFIG,
|
|
704
|
+
useFactory: () => {
|
|
705
|
+
const outer = inject(CNGX_MAT_TABS_CONFIG, { optional: true, skipSelf: true }) ?? {};
|
|
706
|
+
const local = mergeFeatures(features);
|
|
707
|
+
return {
|
|
708
|
+
...outer,
|
|
709
|
+
...local,
|
|
710
|
+
// Nested-merge so a local template feature refines the outer
|
|
711
|
+
// template set instead of replacing it wholesale.
|
|
712
|
+
templates: { ...outer.templates, ...local.templates },
|
|
713
|
+
};
|
|
714
|
+
},
|
|
715
|
+
},
|
|
716
|
+
];
|
|
649
717
|
}
|
|
650
718
|
/**
|
|
651
719
|
* Resolve the effective `[cngxMatTabs]` configuration for the current
|
|
@@ -664,6 +732,7 @@ function injectMatTabsConfig() {
|
|
|
664
732
|
return {
|
|
665
733
|
anchorMaxAttempts: user.anchorMaxAttempts ?? CNGX_MAT_TABS_CONFIG_DEFAULTS.anchorMaxAttempts,
|
|
666
734
|
halfWiredSlotSink: user.halfWiredSlotSink ?? CNGX_MAT_TABS_CONFIG_DEFAULTS.halfWiredSlotSink,
|
|
735
|
+
templates: { ...CNGX_MAT_TABS_CONFIG_DEFAULTS.templates, ...user.templates },
|
|
667
736
|
};
|
|
668
737
|
}
|
|
669
738
|
|
|
@@ -731,7 +800,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
731
800
|
* Cascade resolution:
|
|
732
801
|
* 1. Per-instance `*cngxMatTabRejectionContent` template wins
|
|
733
802
|
* via `contentChild(CngxMatTabRejectionContent)`.
|
|
734
|
-
* 2.
|
|
803
|
+
* 2. `CNGX_MAT_TABS_CONFIG.templates.rejection` (app-wide middle
|
|
804
|
+
* tier, set via `withMatTabRejectionTemplate`).
|
|
805
|
+
* 3. Library default - imperative `Renderer2.createElement('span')`
|
|
735
806
|
* with `textContent = fallbackText` (the resolved
|
|
736
807
|
* `commitRolledBackTo(originLabel)` / `commitFailedRetry`
|
|
737
808
|
* phrase from `injectTabsI18n()`).
|
|
@@ -793,8 +864,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
793
864
|
* `untracked` - the announcer owns its own clear-then-set timer, so it
|
|
794
865
|
* stays out of the effect's dependency graph.
|
|
795
866
|
*
|
|
796
|
-
* @internal -
|
|
797
|
-
*
|
|
867
|
+
* @internal - helper shared by the Material bridge directives
|
|
868
|
+
* (`[cngxMatTabs]`, `[cngxMatTabNav]`, `[cngxMatStepper]`). Exported
|
|
869
|
+
* `@internal` from the mat-tabs barrel for cross-entry consumption
|
|
870
|
+
* (the `MaterialPrivateSurfaces` pattern) - ng-packagr rejects
|
|
871
|
+
* relative-import file sharing between entry points.
|
|
798
872
|
*/
|
|
799
873
|
function mountLiveRegionAnnouncer(opts) {
|
|
800
874
|
const politeness = opts.politeness ?? 'polite';
|
|
@@ -812,15 +886,22 @@ function mountLiveRegionAnnouncer(opts) {
|
|
|
812
886
|
|
|
813
887
|
/**
|
|
814
888
|
* Build the {@link CngxMatTabRejectionState} bundle for a given
|
|
815
|
-
* presenter + i18n pair.
|
|
816
|
-
* (`lastFailedIndex` → `originIndexDuringCommit` →
|
|
817
|
-
*
|
|
818
|
-
*
|
|
819
|
-
*
|
|
889
|
+
* presenter + i18n pair. `descriptorText` re-uses the cached
|
|
890
|
+
* `originLabel` walk (`lastFailedIndex` → `originIndexDuringCommit` →
|
|
891
|
+
* `tabs[idx].label()`). The live announcement walks the indices itself so
|
|
892
|
+
* they stay tracked while the label, which a consumer may translate, is
|
|
893
|
+
* read untracked.
|
|
820
894
|
*
|
|
821
895
|
* @internal
|
|
822
896
|
*/
|
|
823
897
|
function createRejectionState(presenter, i18n) {
|
|
898
|
+
const failedHandleId = computed(() => {
|
|
899
|
+
const idx = presenter.lastFailedIndex();
|
|
900
|
+
if (idx === undefined) {
|
|
901
|
+
return null;
|
|
902
|
+
}
|
|
903
|
+
return presenter.tabs()[idx]?.id ?? null;
|
|
904
|
+
}, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
|
|
824
905
|
const originLabel = computed(() => {
|
|
825
906
|
const failedIdx = presenter.lastFailedIndex();
|
|
826
907
|
if (failedIdx === undefined) {
|
|
@@ -837,20 +918,97 @@ function createRejectionState(presenter, i18n) {
|
|
|
837
918
|
return '';
|
|
838
919
|
}
|
|
839
920
|
const label = originLabel();
|
|
840
|
-
|
|
921
|
+
const copy = i18n();
|
|
922
|
+
return label ? copy.commitRolledBackTo(label) : copy.commitFailedRetry;
|
|
841
923
|
}, ...(ngDevMode ? [{ debugName: "descriptorText" }] : /* istanbul ignore next */ []));
|
|
924
|
+
// Feeds the live announcer: copy and the origin tab label (which a
|
|
925
|
+
// consumer may translate) are read untracked so a language switch does
|
|
926
|
+
// not re-announce; the next transition speaks the new language.
|
|
842
927
|
const liveAnnouncement = computed(() => {
|
|
843
928
|
const current = presenter.commitTransition.current();
|
|
844
929
|
if (current === 'pending') {
|
|
845
|
-
return i18n.commitInFlight;
|
|
930
|
+
return untracked(() => i18n().commitInFlight);
|
|
846
931
|
}
|
|
847
932
|
if (current === 'error') {
|
|
848
|
-
const
|
|
849
|
-
|
|
933
|
+
const failedIdx = presenter.lastFailedIndex();
|
|
934
|
+
const originIdx = presenter.originIndexDuringCommit();
|
|
935
|
+
const hasOrigin = failedIdx !== undefined && originIdx !== undefined;
|
|
936
|
+
const origin = hasOrigin ? presenter.tabs()[originIdx] : undefined;
|
|
937
|
+
return untracked(() => {
|
|
938
|
+
const label = origin?.label();
|
|
939
|
+
return label ? i18n().commitRolledBackTo(label) : i18n().commitFailedRetry;
|
|
940
|
+
});
|
|
850
941
|
}
|
|
851
942
|
return '';
|
|
852
943
|
}, ...(ngDevMode ? [{ debugName: "liveAnnouncement" }] : /* istanbul ignore next */ []));
|
|
853
|
-
return { originLabel, descriptorText, liveAnnouncement };
|
|
944
|
+
return { failedHandleId, originLabel, descriptorText, liveAnnouncement };
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Create the order-aware registration seam. See the module JSDoc for
|
|
949
|
+
* the contract.
|
|
950
|
+
*
|
|
951
|
+
* @internal
|
|
952
|
+
*/
|
|
953
|
+
function createOrderedRegistrationSeam(options) {
|
|
954
|
+
const entries = new Map();
|
|
955
|
+
// Presenter-side registration order - the seam issued every
|
|
956
|
+
// register() call, so this array IS the presenter's order.
|
|
957
|
+
let registeredOrder = [];
|
|
958
|
+
const sync = (items) => {
|
|
959
|
+
const live = new Set(items);
|
|
960
|
+
// Drop stale entries first so the order diff below only compares
|
|
961
|
+
// survivors. Snapshot before iterating - deletes inside the body
|
|
962
|
+
// must not collide with iterator state.
|
|
963
|
+
for (const [item, entry] of Array.from(entries.entries())) {
|
|
964
|
+
if (live.has(item)) {
|
|
965
|
+
continue;
|
|
966
|
+
}
|
|
967
|
+
options.unregister(entry);
|
|
968
|
+
options.dispose(entry);
|
|
969
|
+
entries.delete(item);
|
|
970
|
+
}
|
|
971
|
+
registeredOrder = registeredOrder.filter((item) => entries.has(item));
|
|
972
|
+
// Longest shared prefix stays registered as-is; everything after
|
|
973
|
+
// it re-registers in query order. Append-only emissions keep
|
|
974
|
+
// prefix === registeredOrder.length and cause zero churn.
|
|
975
|
+
let prefix = 0;
|
|
976
|
+
while (prefix < registeredOrder.length &&
|
|
977
|
+
prefix < items.length &&
|
|
978
|
+
registeredOrder[prefix] === items[prefix]) {
|
|
979
|
+
prefix += 1;
|
|
980
|
+
}
|
|
981
|
+
for (let i = registeredOrder.length - 1; i >= prefix; i -= 1) {
|
|
982
|
+
const entry = entries.get(registeredOrder[i]);
|
|
983
|
+
if (entry !== undefined) {
|
|
984
|
+
options.unregister(entry);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
registeredOrder.length = prefix;
|
|
988
|
+
for (let i = prefix; i < items.length; i += 1) {
|
|
989
|
+
const item = items[i];
|
|
990
|
+
let entry = entries.get(item);
|
|
991
|
+
if (entry === undefined) {
|
|
992
|
+
entry = options.create(item);
|
|
993
|
+
entries.set(item, entry);
|
|
994
|
+
}
|
|
995
|
+
options.register(entry);
|
|
996
|
+
registeredOrder.push(item);
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
const clear = () => {
|
|
1000
|
+
for (const entry of entries.values()) {
|
|
1001
|
+
options.unregister(entry);
|
|
1002
|
+
options.dispose(entry);
|
|
1003
|
+
}
|
|
1004
|
+
entries.clear();
|
|
1005
|
+
registeredOrder = [];
|
|
1006
|
+
};
|
|
1007
|
+
return {
|
|
1008
|
+
sync,
|
|
1009
|
+
get: (item) => entries.get(item),
|
|
1010
|
+
clear,
|
|
1011
|
+
};
|
|
854
1012
|
}
|
|
855
1013
|
|
|
856
1014
|
/**
|
|
@@ -994,11 +1152,20 @@ const CNGX_MAT_TABS_REGISTRY_HOST = new InjectionToken('CngxMatTabsRegistryHost'
|
|
|
994
1152
|
* LOC guard and lets per-tab decoration directives reach the
|
|
995
1153
|
* registry through a typed token.
|
|
996
1154
|
*
|
|
997
|
-
* Owns: `contentChildren(MatTab)` query, the
|
|
998
|
-
* (per-tab cngx setup paired with a child
|
|
999
|
-
* scoping the `_stateChanges` bridge), an
|
|
1000
|
-
*
|
|
1001
|
-
*
|
|
1155
|
+
* Owns: `contentChildren(MatTab)` query, the order-aware
|
|
1156
|
+
* registration seam (per-tab cngx setup paired with a child
|
|
1157
|
+
* `EnvironmentInjector` scoping the `_stateChanges` bridge), an
|
|
1158
|
+
* `effect()` that mirrors the MatTab query order into
|
|
1159
|
+
* `CNGX_TAB_GROUP_HOST` on every emission, and a `DestroyRef`
|
|
1160
|
+
* cleanup that unregisters and destroys every entry.
|
|
1161
|
+
*
|
|
1162
|
+
* Order matters: the presenter registry appends new registrations,
|
|
1163
|
+
* but Material renders tabs at their DOM position - a mid-list
|
|
1164
|
+
* `<mat-tab>` insert must land at its query index, not at the tail,
|
|
1165
|
+
* or index-based selection, announcements and decorations target the
|
|
1166
|
+
* wrong tab. The shared seam re-registers the diverging suffix in
|
|
1167
|
+
* query order while keeping surviving handle instances (and their
|
|
1168
|
+
* child injectors) alive.
|
|
1002
1169
|
*
|
|
1003
1170
|
* Composition: `[cngxMatTabs]` declares this in `hostDirectives`;
|
|
1004
1171
|
* both share the parent's `CngxTabGroupPresenter` and the same
|
|
@@ -1016,53 +1183,38 @@ class CngxMatTabsRegistry {
|
|
|
1016
1183
|
destroyRef = inject(DestroyRef);
|
|
1017
1184
|
envInjector = inject(EnvironmentInjector);
|
|
1018
1185
|
createHandle = inject(CNGX_MAT_TAB_HANDLE_FACTORY);
|
|
1186
|
+
matTabGroup = inject(MatTabGroup, { self: true });
|
|
1019
1187
|
matTabs = contentChildren(MatTab, { ...(ngDevMode ? { debugName: "matTabs" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
// are explicitly deleted when the matching MatTab leaves the
|
|
1023
|
-
// children set, AND the map goes away on directive destroy.
|
|
1024
|
-
setupsByTab = new Map();
|
|
1025
|
-
constructor() {
|
|
1026
|
-
effect(() => {
|
|
1027
|
-
const tabs = this.matTabs();
|
|
1028
|
-
untracked(() => this.syncHandles(tabs));
|
|
1029
|
-
});
|
|
1030
|
-
this.destroyRef.onDestroy(() => {
|
|
1031
|
-
for (const entry of this.setupsByTab.values()) {
|
|
1032
|
-
// Disposes the per-tab `toSignal(_stateChanges)` bridge.
|
|
1033
|
-
entry.childInjector.destroy();
|
|
1034
|
-
}
|
|
1035
|
-
this.setupsByTab.clear();
|
|
1036
|
-
});
|
|
1037
|
-
}
|
|
1038
|
-
getHandleSetup(matTab) {
|
|
1039
|
-
return this.setupsByTab.get(matTab)?.setup;
|
|
1040
|
-
}
|
|
1041
|
-
syncHandles(tabs) {
|
|
1042
|
-
const liveTabs = new Set(tabs);
|
|
1043
|
-
for (const tab of tabs) {
|
|
1044
|
-
if (this.setupsByTab.has(tab)) {
|
|
1045
|
-
continue;
|
|
1046
|
-
}
|
|
1188
|
+
seam = createOrderedRegistrationSeam({
|
|
1189
|
+
create: (tab) => {
|
|
1047
1190
|
// Per-tab child injector scopes the `toSignal(_stateChanges)`
|
|
1048
1191
|
// bridge inside createMatTabHandle - destroying it on tab
|
|
1049
1192
|
// removal fires `takeUntilDestroyed`.
|
|
1050
1193
|
const childInjector = createEnvironmentInjector([], this.envInjector);
|
|
1051
1194
|
const idSeed = () => nextUid('cngx-mat-tab-');
|
|
1052
1195
|
const setup = this.createHandle(tab, idSeed, childInjector);
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1196
|
+
return { setup, childInjector };
|
|
1197
|
+
},
|
|
1198
|
+
register: (entry) => this.presenter.register(entry.setup.handle),
|
|
1199
|
+
unregister: (entry) => this.presenter.unregister(entry.setup.handle.id, entry.setup.handle),
|
|
1200
|
+
dispose: (entry) => entry.childInjector.destroy(),
|
|
1201
|
+
});
|
|
1202
|
+
constructor() {
|
|
1203
|
+
effect(() => {
|
|
1204
|
+
// Ownership filter: `descendants: true` also surfaces MatTabs of
|
|
1205
|
+
// a tab-group nested inside one of OUR tabs' content. Each MatTab
|
|
1206
|
+
// carries its owning `_closestTabGroup` (see
|
|
1207
|
+
// MaterialPrivateSurfaces.ClosestTabGroupSource), so foreign tabs
|
|
1208
|
+
// are dropped before they can register with this presenter -
|
|
1209
|
+
// mirrors the mat-stepper/mat-accordion sibling filters.
|
|
1210
|
+
const tabs = this.matTabs().filter((tab) => tab._closestTabGroup ===
|
|
1211
|
+
this.matTabGroup);
|
|
1212
|
+
untracked(() => this.seam.sync(tabs));
|
|
1213
|
+
});
|
|
1214
|
+
this.destroyRef.onDestroy(() => this.seam.clear());
|
|
1215
|
+
}
|
|
1216
|
+
getHandleSetup(matTab) {
|
|
1217
|
+
return this.seam.get(matTab)?.setup;
|
|
1066
1218
|
}
|
|
1067
1219
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabsRegistry, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1068
1220
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.4", type: CngxMatTabsRegistry, isStandalone: true, selector: "[cngxMatTabsRegistry]", providers: [
|
|
@@ -1182,6 +1334,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1182
1334
|
* `./decorations/`; this directive supplies their reactive triggers
|
|
1183
1335
|
* and the delegators consumer templates call.
|
|
1184
1336
|
*
|
|
1337
|
+
* **Inert on this bridge: `loop` and `orientation`.** Both are
|
|
1338
|
+
* forwarded so templates stay portable between `<cngx-tab-group>` and
|
|
1339
|
+
* the instrumented `<mat-tab-group>`, but Material owns the keyboard
|
|
1340
|
+
* interaction and the strip layout here - `loop` never changes
|
|
1341
|
+
* Material's Home/End/arrow behaviour, and `orientation` never
|
|
1342
|
+
* rotates the Material strip (use `<mat-tab-group headerPosition>` /
|
|
1343
|
+
* Material's own APIs for that). `orientation` still reaches the
|
|
1344
|
+
* cngx side through the overflow panel-host adapter; `loop` feeds
|
|
1345
|
+
* nothing Material does not already own. Deliberately kept in the
|
|
1346
|
+
* forwarded input set for template portability - removing them would
|
|
1347
|
+
* break `<cngx-tab-group>`-authored templates on paste.
|
|
1348
|
+
*
|
|
1185
1349
|
* @playground Form error aggregation ./examples/form-errors/form-errors.component.ts
|
|
1186
1350
|
*
|
|
1187
1351
|
* @category ui/mat-tabs
|
|
@@ -1218,31 +1382,25 @@ class CngxMatTabs {
|
|
|
1218
1382
|
});
|
|
1219
1383
|
aggregatorContentSlot = contentChild(CngxMatTabAggregatorContent, ...(ngDevMode ? [{ debugName: "aggregatorContentSlot" }] : /* istanbul ignore next */ []));
|
|
1220
1384
|
aggregatorContentTemplate = computed(() => this.aggregatorContentSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "aggregatorContentTemplate" }] : /* istanbul ignore next */ []));
|
|
1385
|
+
matTabsConfig = injectMatTabsConfig();
|
|
1221
1386
|
rejectionContentSlot = contentChild(CngxMatTabRejectionContent, ...(ngDevMode ? [{ debugName: "rejectionContentSlot" }] : /* istanbul ignore next */ []));
|
|
1222
|
-
rejectionContentTemplate = computed(() => this.rejectionContentSlot()?.templateRef ??
|
|
1387
|
+
rejectionContentTemplate = computed(() => this.rejectionContentSlot()?.templateRef ??
|
|
1388
|
+
this.matTabsConfig.templates.rejection ??
|
|
1389
|
+
null, ...(ngDevMode ? [{ debugName: "rejectionContentTemplate" }] : /* istanbul ignore next */ []));
|
|
1223
1390
|
i18n = injectTabsI18n();
|
|
1224
|
-
//
|
|
1225
|
-
//
|
|
1226
|
-
|
|
1227
|
-
const idx = this.presenter.lastFailedIndex();
|
|
1228
|
-
if (idx === undefined) {
|
|
1229
|
-
return null;
|
|
1230
|
-
}
|
|
1231
|
-
return this.presenter.tabs()[idx]?.id ?? null;
|
|
1232
|
-
}, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
|
|
1233
|
-
// Bundle shares one source-walk across descriptorText / originLabel
|
|
1234
|
-
// / liveAnnouncement - pillar-2 phrasing parity with cngx-native.
|
|
1391
|
+
// Bundle shares one source-walk across failedHandleId /
|
|
1392
|
+
// descriptorText / originLabel / liveAnnouncement - pillar-2
|
|
1393
|
+
// phrasing parity with cngx-native.
|
|
1235
1394
|
rejectionState = createRejectionState(this.presenter, this.i18n);
|
|
1236
1395
|
// Shared with `[cngxMatTabNav]` - one body, two hosts (Pillar 3).
|
|
1237
1396
|
// Structural equal lives in the factory so the projector doesn't
|
|
1238
1397
|
// churn on no-op aggregator re-emissions.
|
|
1239
1398
|
aggregatedErrorTabs = createAggregatedErrorTabs(this.presenter);
|
|
1240
1399
|
constructor() {
|
|
1241
|
-
const matTabsConfig =
|
|
1400
|
+
const matTabsConfig = this.matTabsConfig;
|
|
1242
1401
|
// Polite live region - attribute directive owns no template, so
|
|
1243
|
-
// the helper
|
|
1244
|
-
//
|
|
1245
|
-
// bindings imperatively.
|
|
1402
|
+
// the helper forwards every non-empty announcement to the shared
|
|
1403
|
+
// root CngxLiveAnnouncer, which owns the persistent region pair.
|
|
1246
1404
|
mountLiveRegionAnnouncer({
|
|
1247
1405
|
announcement: this.rejectionState.liveAnnouncement,
|
|
1248
1406
|
injector: this.injector,
|
|
@@ -1251,7 +1409,7 @@ class CngxMatTabs {
|
|
|
1251
1409
|
// registration; the directive only supplies reactive triggers.
|
|
1252
1410
|
createMatTabRejectionDecoration({
|
|
1253
1411
|
hostEl: this.hostEl,
|
|
1254
|
-
failedHandleId: this.failedHandleId,
|
|
1412
|
+
failedHandleId: this.rejectionState.failedHandleId,
|
|
1255
1413
|
failedIndex: this.presenter.lastFailedIndex,
|
|
1256
1414
|
descriptorText: this.rejectionState.descriptorText,
|
|
1257
1415
|
renderer: this.renderer,
|
|
@@ -1423,7 +1581,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1423
1581
|
* reflects `NavigationEnd` onto `activeIndex` (its commit-action stays
|
|
1424
1582
|
* dormant because link clicks navigate natively, never through
|
|
1425
1583
|
* `presenter.select`). Ableitung statt Verwaltung - the route-active
|
|
1426
|
-
* link is the single source of the active index.
|
|
1584
|
+
* link is the single source of the active index. `activeIndex` /
|
|
1585
|
+
* `activeIndexChange` are forwarded from the presenter hostDirective,
|
|
1586
|
+
* so a consumer without route-sync can two-way bind the active link
|
|
1587
|
+
* the same way `[cngxMatTabs]` consumers do.
|
|
1588
|
+
*
|
|
1589
|
+
* Active-link changes speak: the shared nav announcement bundle
|
|
1590
|
+
* ({@link createTabNavAnnouncement}) feeds the landing link's label to
|
|
1591
|
+
* the shared live announcer - silent through the mount window, so a
|
|
1592
|
+
* deep link's initial active state is not announced as a change.
|
|
1427
1593
|
*
|
|
1428
1594
|
* Composes {@link CngxTabGroupPresenter} via `hostDirectives` so the
|
|
1429
1595
|
* `CNGX_STATEFUL` producer, the `lastFailedIndex` rejection slot, and
|
|
@@ -1451,15 +1617,6 @@ class CngxMatTabNav {
|
|
|
1451
1617
|
renderer = inject(Renderer2);
|
|
1452
1618
|
hostEl = inject(ElementRef).nativeElement;
|
|
1453
1619
|
i18n = injectTabsI18n();
|
|
1454
|
-
// Stable id of the rejected link, or null. Identity equal collapses
|
|
1455
|
-
// tabs() re-emits that don't change the failed-target id.
|
|
1456
|
-
failedHandleId = computed(() => {
|
|
1457
|
-
const idx = this.presenter.lastFailedIndex();
|
|
1458
|
-
if (idx === undefined) {
|
|
1459
|
-
return null;
|
|
1460
|
-
}
|
|
1461
|
-
return this.presenter.tabs()[idx]?.id ?? null;
|
|
1462
|
-
}, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
|
|
1463
1620
|
rejectionState = createRejectionState(this.presenter, this.i18n);
|
|
1464
1621
|
aggregatedErrorTabs = createAggregatedErrorTabs(this.presenter);
|
|
1465
1622
|
constructor() {
|
|
@@ -1467,11 +1624,21 @@ class CngxMatTabNav {
|
|
|
1467
1624
|
announcement: this.rejectionState.liveAnnouncement,
|
|
1468
1625
|
injector: this.injector,
|
|
1469
1626
|
});
|
|
1627
|
+
// Active-link landing announcement - same bundle as the cngx-native
|
|
1628
|
+
// <cngx-tab-nav>; the shared announcer coalesces both feeds into
|
|
1629
|
+
// one polite region.
|
|
1630
|
+
mountLiveRegionAnnouncer({
|
|
1631
|
+
announcement: createTabNavAnnouncement({
|
|
1632
|
+
presenter: this.presenter,
|
|
1633
|
+
injector: this.injector,
|
|
1634
|
+
}).liveAnnouncement,
|
|
1635
|
+
injector: this.injector,
|
|
1636
|
+
});
|
|
1470
1637
|
// Same projector bodies as `[cngxMatTabs]`; only the per-tab element
|
|
1471
1638
|
// selector differs (`.mat-mdc-tab-link` vs `.mat-mdc-tab`).
|
|
1472
1639
|
createMatTabRejectionDecoration({
|
|
1473
1640
|
hostEl: this.hostEl,
|
|
1474
|
-
failedHandleId: this.failedHandleId,
|
|
1641
|
+
failedHandleId: this.rejectionState.failedHandleId,
|
|
1475
1642
|
failedIndex: this.presenter.lastFailedIndex,
|
|
1476
1643
|
descriptorText: this.rejectionState.descriptorText,
|
|
1477
1644
|
renderer: this.renderer,
|
|
@@ -1498,7 +1665,7 @@ class CngxMatTabNav {
|
|
|
1498
1665
|
this.presenter.clearLastFailed();
|
|
1499
1666
|
}
|
|
1500
1667
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabNav, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1501
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxMatTabNav, isStandalone: true, selector: "[cngxMatTabNav]", providers: [{ provide: CNGX_TAB_NAV_HOST, useValue: true }], exportAs: ["cngxMatTabNav"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter }], ngImport: i0 });
|
|
1668
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxMatTabNav, isStandalone: true, selector: "[cngxMatTabNav]", providers: [{ provide: CNGX_TAB_NAV_HOST, useValue: true }], exportAs: ["cngxMatTabNav"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter, inputs: ["activeIndex", "activeIndex"], outputs: ["activeIndexChange", "activeIndexChange"] }], ngImport: i0 });
|
|
1502
1669
|
}
|
|
1503
1670
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabNav, decorators: [{
|
|
1504
1671
|
type: Directive,
|
|
@@ -1509,7 +1676,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1509
1676
|
// Presence-only marker: it tells a stacked [cngxTabsRouteSync] that its
|
|
1510
1677
|
// links own subtrees, so the URL match is prefix rather than suffix.
|
|
1511
1678
|
providers: [{ provide: CNGX_TAB_NAV_HOST, useValue: true }],
|
|
1512
|
-
hostDirectives: [
|
|
1679
|
+
hostDirectives: [
|
|
1680
|
+
{
|
|
1681
|
+
directive: CngxTabGroupPresenter,
|
|
1682
|
+
inputs: ['activeIndex'],
|
|
1683
|
+
outputs: ['activeIndexChange'],
|
|
1684
|
+
},
|
|
1685
|
+
],
|
|
1513
1686
|
}]
|
|
1514
1687
|
}], ctorParameters: () => [] });
|
|
1515
1688
|
|
|
@@ -1587,7 +1760,7 @@ class CngxMatTabLink {
|
|
|
1587
1760
|
closable: signal(undefined),
|
|
1588
1761
|
};
|
|
1589
1762
|
this.host.register(handle);
|
|
1590
|
-
this.destroyRef.onDestroy(() => this.host.unregister(handle.id));
|
|
1763
|
+
this.destroyRef.onDestroy(() => this.host.unregister(handle.id, handle));
|
|
1591
1764
|
}
|
|
1592
1765
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabLink, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1593
1766
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxMatTabLink, isStandalone: true, selector: "[cngxMatTabLink]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, errorAggregator: { classPropertyName: "errorAggregator", publicName: "errorAggregator", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxMatTabLink"], ngImport: i0 });
|
|
@@ -1749,5 +1922,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1749
1922
|
* Generated bundle index. Do not edit.
|
|
1750
1923
|
*/
|
|
1751
1924
|
|
|
1752
|
-
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 };
|
|
1925
|
+
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 };
|
|
1753
1926
|
//# sourceMappingURL=cngx-ui-mat-tabs.mjs.map
|