/*-------------------------------------------------------------------------------------------------------------- * Copyright (c) insite-gmbh. All rights reserved. * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------------------------*/ import { Component, OnInit, OnDestroy, Input, Output, EventEmitter } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { InaxTranslateService } from '../../../../@inax/translate'; import { Subscription } from 'rxjs/Rx'; import { IMenuItem } from '../../../menu/src/interfaces/menuItem'; @Component({ selector: 'button-menu-line', templateUrl: './@inax/buttonMenuUi/src/buttonMenuLine/buttonMenuLine.component.html', styleUrls: ['./@inax/buttonMenuUi/src/buttonMenuLine/buttonMenuLine.component.css'] }) /** * Component for a button menu line * @class ButtonMenuLineComponent * @classdesc Component for a button menu line * @author insite-gmbh */ export class ButtonMenuLineComponent{ @Input() /** * The buttons for the current line */ public buttons: Array; @Output() /** * The event emitter to inform the menu when a main menue item selection changed */ public select = new EventEmitter(); /** * This method will be called by the menuButton component when the item action was successfully applied. * @method onSelected * @param {IMenuItem} entry This is a menu entry. */ public onSelected(entry:IMenuItem):void { if(entry == null) return; //If entry is a parent, call select on the menu, to update the submenu. if(entry.parent == null){ this.select.emit(entry); } //Update selections in the current line this.buttons.forEach(b => b.isSelected = b == entry); } }