diff --git a/libs/components/src/navigation/nav-base.component.ts b/libs/components/src/navigation/nav-base.component.ts index 301f94daf41..cffc41d6b36 100644 --- a/libs/components/src/navigation/nav-base.component.ts +++ b/libs/components/src/navigation/nav-base.component.ts @@ -1,6 +1,6 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore -import { Directive, EventEmitter, Input, Output, input } from "@angular/core"; +import { Directive, EventEmitter, Output, input, model } from "@angular/core"; import { RouterLink, RouterLinkActive } from "@angular/router"; /** @@ -21,10 +21,7 @@ export abstract class NavBaseComponent { /** * Optional icon, e.g. `"bwi-collection-shared"` */ - // TODO: Skipped for migration because: - // This input is used in a control flow expression (e.g. `@if` or `*ngIf`) - // and migrating would break narrowing currently. - @Input() icon: string; + readonly icon = input(); /** * Optional route to be passed to internal `routerLink`. If not provided, the nav component will render as a button. @@ -66,9 +63,7 @@ export abstract class NavBaseComponent { /** * Depth level when nested inside of a `'tree'` variant */ - // TODO: Skipped for migration because: - // Your application code writes to the input. This prevents migration. - @Input() treeDepth = 0; + treeDepth = model(0); /** * If `true`, do not change styles when nav item is active. diff --git a/libs/components/src/navigation/nav-group.component.html b/libs/components/src/navigation/nav-group.component.html index 9b2cfabbf7e..472c2941b18 100644 --- a/libs/components/src/navigation/nav-group.component.html +++ b/libs/components/src/navigation/nav-group.component.html @@ -2,7 +2,7 @@ @if (!hideIfEmpty() || nestedNavComponents.length > 0) { @@ -44,7 +44,7 @@ @if (sideNavService.open$ | async) { - @if (open) { + @if (open()) {
{ - navGroupOrItem.treeDepth += 1; + navGroupOrItem.treeDepth.update((depth) => depth + 1); }); } @@ -99,7 +96,7 @@ export class NavGroupComponent extends NavBaseComponent implements AfterContentI if (!this.route()) { this.sideNavService.setOpen(); } - this.open = true; + this.open.set(true); } else { this.toggle(); } diff --git a/libs/components/src/navigation/nav-item.component.html b/libs/components/src/navigation/nav-item.component.html index cba00c5efab..96d2f32ecc7 100644 --- a/libs/components/src/navigation/nav-item.component.html +++ b/libs/components/src/navigation/nav-item.component.html @@ -3,113 +3,114 @@ open: sideNavService.open$ | async, } as data" > -
+ @if (data.open || icon()) {
-
-
- +
+
+
+ +
+ +
+ +
- -
+ + + + + +
+ {{ text() }} +
+
+ + + + + + + + + + + + + -
-
- - - - - -
- {{ text() }} + + + + +
+
- - - - - - - - - - - - - - - - - -
-
-
+ }