import { Component, AfterViewInit } from '@angular/core'; import { RdComponent } from '../../base/rdComponent'; import { AppComponent } from '../../app.component'; @Component({ selector: "rd-quick-sidebar", template: `
` }) export class QuickSidebar extends RdComponent implements AfterViewInit { items = []; constructor() { super(); this.items = AppComponent.client.getQuickSidebarItems(); this.setTabProperties(); if (this.items.length > 0) this.activateContent(this.items[0]); } ngAfterViewInit() { if (this.activeContent) this.activeContent.prop.onOpen(); } hideQuickSidebar() { this.jQuery("#m_quick_sidebar").removeClass("m-quick-sidebar--on"); } activeContent; activateContent(content) { if (this.activeContent) this.activeContent.active = false; this.activeContent = content; this.activeContent.active = true; } contentClicked(content) { if (!content.active) { this.activateContent(content); content.prop.onOpen(); } } setTabProperties() { for (let item of this.items) { item.prop = item.prototype.tabProperties(); } } }