import { Component , Injector , OnInit , ViewEncapsulation } from '@angular/core' ; import { AppComponentBase } from '@shared/component-base' ; import { MenuService } from '@shared/layout/menu.service' ; import { MenuItem } from '@shared/layout/menu-item' ; import { Abp } from '@abp' ; @ Component ( { templateUrl : './sidebar-nav.component.html' , selector : 'sidebar-nav' } ) export class SideBarNavComponent extends AppComponentBase implements OnInit { menuItems : MenuItem [ ] ; isCollapsed : boolean = false ; themeValue : string = 'light' ; constructor ( injector , private menuService ) { super ( injector ) ; this . menuItems = this . menuService . menus ; } ngOnInit ( ) { Abp . event . on ( 'abp.theme-setting.collapsed' , collapsed => { this . isCollapsed = collapsed ; } ) ; Abp . event . on ( 'abp.theme-setting.changed' , themeName => { switch ( themeName ) { case 'A' : case 'B' : case 'C' : case 'D' : case 'E' : this . themeValue = 'light' ; break ; default : this . themeValue = 'dark' ; break ; } } ) ; } showMenuItem ( menuItem ) { if ( menuItem . permissionName ) { return this . permission . isGranted ( menuItem . permissionName ) ; } return true ; } }