import { Component , Input , Output , EventEmitter } from '@angular/core' ; import { Router , ActivatedRoute } from '@angular/router' ; import { Session } from '../../../services/session' ; import { MindsUser } from '../../../interfaces/entities' ; export interface NestedMenuItem { label : string ; id : string ; route ? : string ; pathSegments ? : number ; shouldShow ? : ( ) => boolean ; } export interface NestedMenu { header : NestedMenuItem ; items : NestedMenuItem [ ] ; shouldShow ? : ( ) => boolean ; } /**
 * Menu list that can be used in multiple "nested" horizontal panes.
 * Each item in the list routes to the relative url of the item.id
 * (unless it has an item.route)
 */ @ Component ( { selector : 'm-nestedMenu' , templateUrl : './nested-menu.component.html' , } ) export class NestedMenuComponent { @ Input ( ) isNested : boolean = false ; @ Input ( ) menus : NestedMenu [ ] ; @ Input ( ) parentRoute : string ; @ Input ( ) disableActiveClass : boolean = false ; @ Output ( ) itemSelected : EventEmitter < any > = new EventEmitter ( ) ; @ Output ( ) clickedBack : EventEmitter < any > = new EventEmitter ( ) ; constructor ( ) { } itemClicked ( menuHeaderId , itemId ) { const item = { menuHeaderId : menuHeaderId , itemId : itemId } ; this . itemSelected . emit ( { item : item } ) ; } param itemId getRouterLink ( itemId ) { if ( ! this . parentRoute ) { return this . isNested ? itemId : `../${ itemId }` ; } return `${ this . parentRoute }/${ itemId }` ; } goBack ( ) { this . clickedBack . emit ( ) ; } }