From d66365fd530968cf828ca9aa183a8e35d33a86ea Mon Sep 17 00:00:00 2001 From: Will Martin Date: Mon, 11 Mar 2024 11:22:04 -0400 Subject: [PATCH] [CL-206] update bit-nav components to active match query params (#8242) * remove exactMatch input in favor of routerLinkActiveOptions --- .../org-switcher/org-switcher.component.html | 4 +-- .../src/navigation/nav-base.component.ts | 32 ++++++++++++++++--- .../src/navigation/nav-group.component.html | 2 +- .../src/navigation/nav-group.component.ts | 5 --- .../src/navigation/nav-item.component.html | 2 +- .../src/navigation/nav-item.component.ts | 16 +--------- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/apps/web/src/app/layouts/org-switcher/org-switcher.component.html b/apps/web/src/app/layouts/org-switcher/org-switcher.component.html index bf94bdaea4..1dd03d0323 100644 --- a/apps/web/src/app/layouts/org-switcher/org-switcher.component.html +++ b/apps/web/src/app/layouts/org-switcher/org-switcher.component.html @@ -4,8 +4,8 @@ [ariaLabel]="['organization' | i18n, activeOrganization.name].join(' ')" icon="bwi-business" [route]="['../', activeOrganization.id]" + [routerLinkActiveOptions]="{ exact: true }" [(open)]="open" - [exactMatch]="true" > diff --git a/libs/components/src/navigation/nav-group.component.ts b/libs/components/src/navigation/nav-group.component.ts index 3e62823e21..757e0e98db 100644 --- a/libs/components/src/navigation/nav-group.component.ts +++ b/libs/components/src/navigation/nav-group.component.ts @@ -39,11 +39,6 @@ export class NavGroupComponent extends NavBaseComponent implements AfterContentI @Input() open = false; - /** - * if `true`, use `exact` match for path instead of `subset`. - */ - @Input() exactMatch: boolean; - @Output() openChange = new EventEmitter(); diff --git a/libs/components/src/navigation/nav-item.component.html b/libs/components/src/navigation/nav-item.component.html index 4f4c165a43..7655043165 100644 --- a/libs/components/src/navigation/nav-item.component.html +++ b/libs/components/src/navigation/nav-item.component.html @@ -54,7 +54,7 @@ [relativeTo]="relativeTo" [attr.aria-label]="ariaLabel || text" routerLinkActive - [routerLinkActiveOptions]="rlaOptions" + [routerLinkActiveOptions]="routerLinkActiveOptions" [ariaCurrentWhenActive]="'page'" (isActiveChange)="setIsActive($event)" (click)="mainContentClicked.emit()" diff --git a/libs/components/src/navigation/nav-item.component.ts b/libs/components/src/navigation/nav-item.component.ts index 83ef1a7b3b..e5a4892143 100644 --- a/libs/components/src/navigation/nav-item.component.ts +++ b/libs/components/src/navigation/nav-item.component.ts @@ -1,5 +1,4 @@ -import { Component, HostListener, Input, Optional } from "@angular/core"; -import { IsActiveMatchOptions } from "@angular/router"; +import { Component, HostListener, Optional } from "@angular/core"; import { BehaviorSubject, map } from "rxjs"; import { NavBaseComponent } from "./nav-base.component"; @@ -24,19 +23,6 @@ export class NavItemComponent extends NavBaseComponent { protected get showActiveStyles() { return this._isActive && !this.hideActiveStyles; } - protected rlaOptions: IsActiveMatchOptions = { - paths: "subset", - queryParams: "exact", - fragment: "ignored", - matrixParams: "ignored", - }; - - /** - * if `true`, use `exact` match for path instead of `subset`. - */ - @Input() set exactMatch(val: boolean) { - this.rlaOptions.paths = val ? "exact" : "subset"; - } /** * The design spec calls for the an outline to wrap the entire element when the template's anchor/button has :focus-visible.