import { Component , ViewContainerRef , Inject } from "@angular/core" ; import { FilemenuItem } from "./FilemenuItem" ; import { Router , ActivatedRoute , NavigationStart } from "@angular/router" ; import { CommBroker } from "../../services/CommBroker" ; import { Consts } from "../../Conts" ; import { DOCUMENT } from "@angular/platform-browser" ; class @ Component ( { selector : 'Filemenu' , inputs : [ 'appPrefix' ] , template : `
        <div>
             <div class="m_fileMenuWrap">
                <ul class="nav navbar-nav" >
                <li id="commonFileMenu" class="hidden-lg" dropdown>
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Navigatior<b class="caret"></b></a>
                  <ul class="dropdown-menu">
                  <li class="divider"></li>
                    <li *ngFor="let item of m_renderedItems" (click)="listenMenuSelected($event)">
                       <a href="#">{{item.title}}</a>
                    </li>
                    <li class="divider"></li>
                  </ul>
                </li>
              </ul>
            </div>
        </div>
    ` } ) export class Filemenu { private m_items : FilemenuItem [ ] ; private m_renderedItems : any [ ] ; private m_fileMenuWrap : any ; private m_commBroker : CommBroker ; private el : any ; private viewContainer : ViewContainerRef ; constructor ( viewContainer , @ Inject ( DOCUMENT ) private dom , private router , private activatedRoute , commBroker ) { var self = this ; self . m_commBroker = commBroker ; self . m_items = [ ] ; self . m_renderedItems = [ ] ; self . viewContainer = viewContainer ; self . el = viewContainer . element . nativeElement ; self . m_fileMenuWrap = self . dom . getElementsByClassName ( self . el , 'm_fileMenuWrap' ) ; this . router . events . subscribe ( ( navigationStart ) => { return ; } ) ; jQuery ( '.navbar-nav' ) . css ( { display : 'block' } ) ; } private listenMenuSelected ( event ) { this . m_commBroker . fire ( { fromInstance : self , event : Consts . Events ( ) . MENU_SELECTION , context : null , message : event . target . text } ) ; event . preventDefault ( ) ; return false ; } public addFileMenuItem ( i_item ) { this . m_items . push ( i_item ) ; } }