Add typing for TabbedPanelLayout and set defaults (#9955)

* Add typing for TabbedPanelLayout on withLayout and set appropriate defaults

* Move enum def
This commit is contained in:
Charles Gagnon
2020-04-15 16:42:42 -07:00
committed by GitHub
parent 3566da328a
commit f44e78aef4
4 changed files with 22 additions and 15 deletions

View File

@@ -5,14 +5,13 @@
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, forwardRef, Inject, Input, OnDestroy, ViewChild } from '@angular/core';
import { NavigationBarLayout, PanelComponent } from 'sql/base/browser/ui/panel/panel.component';
import { TabType } from 'sql/base/browser/ui/panel/tab.component';
// eslint-disable-next-line code-import-patterns
import { TabOrientation, TabbedPanelLayout } from 'sql/workbench/api/common/sqlExtHostTypes';
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
import { ComponentEventType, IComponent, IComponentDescriptor, IModelStore } from 'sql/platform/dashboard/browser/interfaces';
import 'vs/css!./media/tabbedPanel';
import { IUserFriendlyIcon, createIconCssClass } from 'sql/workbench/browser/modelComponents/iconUtils';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { attachTabbedPanelStyler } from 'sql/workbench/common/styler';
import { TabbedPanelLayout } from 'azdata';
export interface TabConfig {
title: string;
@@ -29,6 +28,14 @@ interface Tab {
iconClass?: string;
}
/**
* Defines the tab orientation of TabbedPanelComponent
*/
export enum TabOrientation {
Vertical = 'vertical',
Horizontal = 'horizontal'
}
@Component({
templateUrl: decodeURI(require.toUrl('./tabbedPanel.component.html'))
})
@@ -62,9 +69,9 @@ export default class TabbedPanelComponent extends ContainerBase<TabConfig> imple
setLayout(layout: TabbedPanelLayout): void {
this._panel.options = {
alwaysShowTabs: layout.alwaysShowTabs,
layout: layout.orientation === TabOrientation.Horizontal ? NavigationBarLayout.horizontal : NavigationBarLayout.vertical,
showIcon: layout.showIcon
alwaysShowTabs: layout.alwaysShowTabs ?? false,
layout: (layout.orientation ?? TabOrientation.Horizontal) === TabOrientation.Horizontal ? NavigationBarLayout.horizontal : NavigationBarLayout.vertical,
showIcon: layout.showIcon ?? false
};
}