mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-04-16 21:35:13 +00:00
+ Added hidden property to the nav items + Updated fuse-navigation component docs + Updated other components that uses fuse-navigation service + Updated various packages including Angular and Angular Material
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import { Component, Input, OnDestroy, ViewChild, ViewEncapsulation } from '@angular/core';
|
|
import { Subscription } from 'rxjs/Subscription';
|
|
|
|
import { FusePerfectScrollbarDirective } from '@fuse/directives/fuse-perfect-scrollbar/fuse-perfect-scrollbar.directive';
|
|
import { FuseSidebarService } from '@fuse/components/sidebar/sidebar.service';
|
|
|
|
import { navigation } from 'app/navigation/navigation';
|
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
|
|
|
@Component({
|
|
selector : 'fuse-navbar',
|
|
templateUrl : './navbar.component.html',
|
|
styleUrls : ['./navbar.component.scss'],
|
|
encapsulation: ViewEncapsulation.None
|
|
})
|
|
export class FuseNavbarComponent implements OnDestroy
|
|
{
|
|
@ViewChild(FusePerfectScrollbarDirective) fusePerfectScrollbarDirective;
|
|
@Input() layout;
|
|
navigation: any;
|
|
navigationServiceWatcher: Subscription;
|
|
fusePerfectScrollbarUpdateTimeout;
|
|
|
|
constructor(
|
|
private sidebarService: FuseSidebarService,
|
|
private navigationService: FuseNavigationService
|
|
)
|
|
{
|
|
// Navigation data
|
|
this.navigation = navigation;
|
|
|
|
// Default layout
|
|
this.layout = 'vertical';
|
|
|
|
this.navigationServiceWatcher =
|
|
this.navigationService.onItemCollapseToggled.subscribe(() => {
|
|
this.fusePerfectScrollbarUpdateTimeout = setTimeout(() => {
|
|
this.fusePerfectScrollbarDirective.update();
|
|
}, 310);
|
|
});
|
|
}
|
|
|
|
ngOnDestroy()
|
|
{
|
|
clearTimeout(this.fusePerfectScrollbarUpdateTimeout);
|
|
this.navigationServiceWatcher.unsubscribe();
|
|
}
|
|
|
|
toggleSidebarOpened(key)
|
|
{
|
|
this.sidebarService.getSidebar(key).toggleOpen();
|
|
}
|
|
|
|
toggleSidebarFolded(key)
|
|
{
|
|
this.sidebarService.getSidebar(key).toggleFold();
|
|
}
|
|
}
|