mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-22 02:10:12 +01:00
fix(content top): #618, update tslint config
This commit is contained in:
parent
c70d866016
commit
e315b1a4df
2 changed files with 32 additions and 32 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import {Component, ViewEncapsulation, Input, Output, EventEmitter} from '@angular/core';
|
||||
import {Router, Routes, NavigationEnd} from '@angular/router';
|
||||
import {Subscription} from 'rxjs/Rx';
|
||||
import { Component, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Rx';
|
||||
|
||||
import { BaMenuService } from '../../services';
|
||||
import {GlobalState} from '../../../global.state';
|
||||
import { GlobalState } from '../../../global.state';
|
||||
|
||||
@Component({
|
||||
selector: 'ba-menu',
|
||||
|
|
@ -13,20 +13,35 @@ import {GlobalState} from '../../../global.state';
|
|||
})
|
||||
export class BaMenu {
|
||||
|
||||
@Input() sidebarCollapsed:boolean = false;
|
||||
@Input() menuHeight:number;
|
||||
@Input() sidebarCollapsed: boolean = false;
|
||||
@Input() menuHeight: number;
|
||||
|
||||
@Output() expandMenu = new EventEmitter<any>();
|
||||
|
||||
public menuItems: any[];
|
||||
protected _menuItemsSub: Subscription;
|
||||
public showHoverElem:boolean;
|
||||
public hoverElemHeight:number;
|
||||
public hoverElemTop:number;
|
||||
protected _onRouteChange:Subscription;
|
||||
public outOfArea:number = -200;
|
||||
public showHoverElem: boolean;
|
||||
public hoverElemHeight: number;
|
||||
public hoverElemTop: number;
|
||||
protected _onRouteChange: Subscription;
|
||||
public outOfArea: number = -200;
|
||||
|
||||
constructor(private _router:Router, private _service:BaMenuService, private _state:GlobalState) {
|
||||
constructor(private _router: Router, private _service: BaMenuService, private _state: GlobalState) {
|
||||
}
|
||||
|
||||
public updateMenu(newMenuItems) {
|
||||
this.menuItems = newMenuItems;
|
||||
this.selectMenuAndNotify();
|
||||
}
|
||||
|
||||
public selectMenuAndNotify(): void {
|
||||
if (this.menuItems) {
|
||||
this.menuItems = this._service.selectMenuItem(this.menuItems);
|
||||
this._state.notifyDataChanged('menu.activeLink', this._service.getCurrentItem());
|
||||
}
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this._onRouteChange = this._router.events.subscribe((event) => {
|
||||
|
||||
if (event instanceof NavigationEnd) {
|
||||
|
|
@ -42,35 +57,20 @@ export class BaMenu {
|
|||
this._menuItemsSub = this._service.menuItems.subscribe(this.updateMenu.bind(this));
|
||||
}
|
||||
|
||||
public updateMenu(newMenuItems) {
|
||||
this.menuItems = newMenuItems;
|
||||
this.selectMenuAndNotify();
|
||||
}
|
||||
|
||||
public selectMenuAndNotify():void {
|
||||
if (this.menuItems) {
|
||||
this.menuItems = this._service.selectMenuItem(this.menuItems);
|
||||
this._state.notifyDataChanged('menu.activeLink', this._service.getCurrentItem());
|
||||
}
|
||||
}
|
||||
|
||||
public ngOnInit():void {
|
||||
}
|
||||
|
||||
public ngOnDestroy():void {
|
||||
public ngOnDestroy(): void {
|
||||
this._onRouteChange.unsubscribe();
|
||||
this._menuItemsSub.unsubscribe();
|
||||
}
|
||||
|
||||
public hoverItem($event):void {
|
||||
public hoverItem($event): void {
|
||||
this.showHoverElem = true;
|
||||
this.hoverElemHeight = $event.currentTarget.clientHeight;
|
||||
// TODO: get rid of magic 66 constant
|
||||
this.hoverElemTop = $event.currentTarget.getBoundingClientRect().top - 66;
|
||||
}
|
||||
|
||||
public toggleSubMenu($event):boolean {
|
||||
var submenu = jQuery($event.currentTarget).next();
|
||||
public toggleSubMenu($event): boolean {
|
||||
let submenu = jQuery($event.currentTarget).next();
|
||||
|
||||
if (this.sidebarCollapsed) {
|
||||
this.expandMenu.emit(null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue