fix(content top): #618, update tslint config

This commit is contained in:
Alexander Zhukov 2017-01-19 12:24:48 +03:00
parent c70d866016
commit e315b1a4df
2 changed files with 32 additions and 32 deletions

View file

@ -1,9 +1,9 @@
import {Component, ViewEncapsulation, Input, Output, EventEmitter} from '@angular/core'; import { Component, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core';
import {Router, Routes, NavigationEnd} from '@angular/router'; import { Router, NavigationEnd } from '@angular/router';
import {Subscription} from 'rxjs/Rx'; import { Subscription } from 'rxjs/Rx';
import { BaMenuService } from '../../services'; import { BaMenuService } from '../../services';
import {GlobalState} from '../../../global.state'; import { GlobalState } from '../../../global.state';
@Component({ @Component({
selector: 'ba-menu', selector: 'ba-menu',
@ -13,20 +13,35 @@ import {GlobalState} from '../../../global.state';
}) })
export class BaMenu { export class BaMenu {
@Input() sidebarCollapsed:boolean = false; @Input() sidebarCollapsed: boolean = false;
@Input() menuHeight:number; @Input() menuHeight: number;
@Output() expandMenu = new EventEmitter<any>(); @Output() expandMenu = new EventEmitter<any>();
public menuItems: any[]; public menuItems: any[];
protected _menuItemsSub: Subscription; protected _menuItemsSub: Subscription;
public showHoverElem:boolean; public showHoverElem: boolean;
public hoverElemHeight:number; public hoverElemHeight: number;
public hoverElemTop:number; public hoverElemTop: number;
protected _onRouteChange:Subscription; protected _onRouteChange: Subscription;
public outOfArea:number = -200; 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) => { this._onRouteChange = this._router.events.subscribe((event) => {
if (event instanceof NavigationEnd) { if (event instanceof NavigationEnd) {
@ -42,35 +57,20 @@ export class BaMenu {
this._menuItemsSub = this._service.menuItems.subscribe(this.updateMenu.bind(this)); this._menuItemsSub = this._service.menuItems.subscribe(this.updateMenu.bind(this));
} }
public updateMenu(newMenuItems) { public ngOnDestroy(): void {
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 {
this._onRouteChange.unsubscribe(); this._onRouteChange.unsubscribe();
this._menuItemsSub.unsubscribe(); this._menuItemsSub.unsubscribe();
} }
public hoverItem($event):void { public hoverItem($event): void {
this.showHoverElem = true; this.showHoverElem = true;
this.hoverElemHeight = $event.currentTarget.clientHeight; this.hoverElemHeight = $event.currentTarget.clientHeight;
// TODO: get rid of magic 66 constant // TODO: get rid of magic 66 constant
this.hoverElemTop = $event.currentTarget.getBoundingClientRect().top - 66; this.hoverElemTop = $event.currentTarget.getBoundingClientRect().top - 66;
} }
public toggleSubMenu($event):boolean { public toggleSubMenu($event): boolean {
var submenu = jQuery($event.currentTarget).next(); let submenu = jQuery($event.currentTarget).next();
if (this.sidebarCollapsed) { if (this.sidebarCollapsed) {
this.expandMenu.emit(null); this.expandMenu.emit(null);

View file

@ -76,7 +76,7 @@
], ],
"max-line-length": [ "max-line-length": [
true, true,
100 120
], ],
"no-require-imports": false, "no-require-imports": false,
"no-trailing-whitespace": true, "no-trailing-whitespace": true,