import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core'; import { ToolbarTitleDirective } from './toolbar-title.directive'; import { ToolbarContentDirective } from './toolbar-content.directive'; import './toolbar.scss'; @Component({ selector: 'swui-toolbar', template: `

{{title}} {{subtitle}}

`, host: { class: 'swui-toolbar' } }) export class ToolbarComponent { @Input() title: string; @Input() subtitle: string; @Input() menu; @Output() menuClick = new EventEmitter(); @ViewChild(ToolbarTitleDirective) toolbarTitle: ToolbarTitleDirective; @ViewChild(ToolbarContentDirective) toolbarContent: ToolbarContentDirective; get toolbarItems() { return this.menu.filter(m => { return !m.dropdown; }); } get dropdownItems() { return this.menu.filter(m => { return m.dropdown; }); } onMenuClicked(item, $event) { if(item.click) { item.click($event); } } }