diff --git a/src/sql/base/browser/ui/panel/panel.component.ts b/src/sql/base/browser/ui/panel/panel.component.ts index e4eebd8bd5..2d8baac45b 100644 --- a/src/sql/base/browser/ui/panel/panel.component.ts +++ b/src/sql/base/browser/ui/panel/panel.component.ts @@ -4,15 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import { - Component, ContentChildren, QueryList, AfterContentInit, Inject, forwardRef, NgZone, - OnInit, Input, EventEmitter, Output, ViewChild, ElementRef, OnChanges, OnDestroy, ViewChildren, - AfterViewInit + Component, ContentChildren, QueryList, Inject, forwardRef, NgZone, + Input, EventEmitter, Output, ViewChild, ElementRef } from '@angular/core'; import './panelStyles'; import { TabComponent } from './tab.component'; -import { TabHeaderComponent } from './tabHeader.component'; import { ScrollableDirective } from 'sql/base/browser/ui/scrollable/scrollable.directive'; import { subscriptionToDisposable } from 'sql/base/common/lifecycle'; @@ -21,7 +19,6 @@ import { Action } from 'vs/base/common/actions'; import * as types from 'vs/base/common/types'; import { mixin } from 'vs/base/common/objects'; import { ScrollbarVisibility } from 'vs/base/common/scrollable'; -import { addDisposableListener, EventType } from 'vs/base/browser/dom'; import { Disposable } from 'vs/base/common/lifecycle'; export interface IPanelOptions { @@ -44,9 +41,6 @@ const defaultOptions: IPanelOptions = { showIcon: false }; -const verticalLayout = 'vertical'; -const horizontalLayout = 'horizontal'; - let idPool = 0; @Component({ @@ -78,7 +72,6 @@ export class PanelComponent extends Disposable { @Input() public options: IPanelOptions; @Input() public actions: Array; @ContentChildren(TabComponent) private _tabs: QueryList; - @ViewChildren(TabHeaderComponent) private _headerTabs: QueryList; @ViewChild(ScrollableDirective) private scrollable: ScrollableDirective; @Output() public onTabChange = new EventEmitter(); @@ -88,8 +81,8 @@ export class PanelComponent extends Disposable { private _actionbar: ActionBar; private _mru: TabComponent[]; - private ScrollbarVisibility = ScrollbarVisibility; - private NavigationBarLayout = NavigationBarLayout; + protected ScrollbarVisibility = ScrollbarVisibility; + protected NavigationBarLayout = NavigationBarLayout; @ViewChild('panelActionbar', { read: ElementRef }) private _actionbarRef: ElementRef; constructor( @Inject(forwardRef(() => NgZone)) private _zone: NgZone) { @@ -102,6 +95,10 @@ export class PanelComponent extends Disposable { } ngAfterContentInit(): void { + if (this._tabs && this._tabs.length > 0) { + this.selectTab(this._tabs.first); + } + this._register(subscriptionToDisposable(this._tabs.changes.subscribe(() => { if (this._tabs && this._tabs.length > 0) { this.selectTab(this._tabs.first);