@cngx/ui 0.1.0-rc.1 → 0.1.0-rc.2

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.
@@ -1117,6 +1117,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1117
1117
  * ```
1118
1118
  *
1119
1119
  * @category ui/mat-tabs
1120
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/overflow/mat-tab-overflow-dom-adapter.ts
1121
+ * @since 0.1.0
1122
+ * @relatedTo CngxTabOverflow, CngxMatTabs, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY
1120
1123
  */
1121
1124
  function createCngxMatTabOverflowDomAdapter() {
1122
1125
  return {
@@ -1313,7 +1316,7 @@ class CngxMatTabs {
1313
1316
  });
1314
1317
  afterNextRender(() => anchorRetry.start());
1315
1318
  this.destroyRef.onDestroy(() => anchorRetry.cancel());
1316
- createMaterialBidirectionalSync({
1319
+ const sync = createMaterialBidirectionalSync({
1317
1320
  presenterIndex: this.presenter.activeIndex,
1318
1321
  readSelectedIndex: () => this.matTabGroup.selectedIndex ?? 0,
1319
1322
  writeSelectedIndex: (i) => {
@@ -1324,6 +1327,20 @@ class CngxMatTabs {
1324
1327
  injector: this.injector,
1325
1328
  destroyRef: this.destroyRef,
1326
1329
  });
1330
+ // Routed (pessimistic) gate: a rejected switch holds `activeIndex` at
1331
+ // origin, so the presenter to Material mirror never fires and Material
1332
+ // stays eager-advanced on the refused tab. Snap it back when the
1333
+ // commit settles into an error. `status()` always transitions through
1334
+ // `pending` first, so the `error` edge is observed even when the
1335
+ // router cancels a microtask after `navigate()`.
1336
+ effect(() => {
1337
+ const status = this.presenter.commitState.status();
1338
+ untracked(() => {
1339
+ if (status === 'error') {
1340
+ sync.reconcile();
1341
+ }
1342
+ });
1343
+ });
1327
1344
  }
1328
1345
  /**
1329
1346
  * Clears `presenter.lastFailedIndex`, dismissing the rejection
@@ -1425,6 +1442,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1425
1442
  * the projectors render their built-in `cngx-sr-only` spans. The slot
1426
1443
  * inputs that `[cngxMatTabs]` exposes are a deferred follow-up.
1427
1444
  *
1445
+ * @playground Native router tabs with a CanDeactivate guard ./examples/router-nav/router-nav.component.ts
1446
+ *
1428
1447
  * @category ui/mat-tabs
1429
1448
  * @docsKind primary
1430
1449
  * @wcag AA