Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 2x 2x 2x 2x 2x 5x 5x 5x | import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { Router } from '@angular/router';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { FeatureToggleType } from 'ish-core/feature-toggle.module';
import { DeviceType } from 'ish-core/models/viewtype/viewtype.types';
import { navigationItems } from './account-navigation.items';
export interface NavigationItem {
id: string;
localizationKey: string;
routerLink?: string;
faIcon?: IconProp;
isCollapsed?: boolean;
feature?: FeatureToggleType;
serverSetting?: string;
permission?: string | string[];
notRole?: string | string[];
children?: NavigationItem[];
}
/**
* The account navigation component displays the items of the account navigation menu. The navigation items are defined in the account-navigation.items.<theme>.ts or account-navigation.items.ts, respectively.
*/
@Component({
selector: 'ish-account-navigation',
templateUrl: './account-navigation.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AccountNavigationComponent {
@Input() deviceType: DeviceType;
/**
* Manages the Account Navigation items.
*/
navItems: NavigationItem[] = navigationItems;
activeClass = 'active';
constructor(private router: Router) {}
activeChanged(active: boolean, activeItem: NavigationItem) {
Iif (active && activeItem) {
const parentItem = this.navItems.find(item => item.children?.find(subitem => subitem.id === activeItem?.id));
Iif (parentItem) {
parentItem.isCollapsed = false;
}
}
}
toggleCollapse(item: NavigationItem) {
item.isCollapsed = !item.isCollapsed;
}
isSelected(item: NavigationItem): string {
return item.routerLink === location.pathname ? 'selected' : undefined;
}
navigateTo(target: EventTarget) {
Iif (target) {
this.router.navigateByUrl((target as HTMLDataElement).value);
}
}
}
|