mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
expand the detail section by selecting the headers (#6130)
* expand the detail section by selecting the headers * use methods * address comments
This commit is contained in:
@@ -39,6 +39,7 @@ export interface IPanelTab {
|
|||||||
title: string;
|
title: string;
|
||||||
identifier: string;
|
identifier: string;
|
||||||
view: IPanelView;
|
view: IPanelView;
|
||||||
|
tabSelectedHandler?(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IInternalPanelTab {
|
interface IInternalPanelTab {
|
||||||
@@ -148,11 +149,21 @@ export class TabbedPanel extends Disposable {
|
|||||||
let tabLabel = DOM.$('a.tabLabel');
|
let tabLabel = DOM.$('a.tabLabel');
|
||||||
tabLabel.innerText = tab.tab.title;
|
tabLabel.innerText = tab.tab.title;
|
||||||
tabElement.appendChild(tabLabel);
|
tabElement.appendChild(tabLabel);
|
||||||
tab.disposables.push(DOM.addDisposableListener(tabHeaderElement, DOM.EventType.CLICK, e => this.showTab(tab.tab.identifier)));
|
const invokeTabSelectedHandler = () => {
|
||||||
|
if (tab.tab.tabSelectedHandler) {
|
||||||
|
tab.tab.tabSelectedHandler();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
tab.disposables.push(DOM.addDisposableListener(tabHeaderElement, DOM.EventType.CLICK, e => {
|
||||||
|
this.showTab(tab.tab.identifier);
|
||||||
|
invokeTabSelectedHandler();
|
||||||
|
}));
|
||||||
|
|
||||||
tab.disposables.push(DOM.addDisposableListener(tabHeaderElement, DOM.EventType.KEY_UP, (e: KeyboardEvent) => {
|
tab.disposables.push(DOM.addDisposableListener(tabHeaderElement, DOM.EventType.KEY_UP, (e: KeyboardEvent) => {
|
||||||
let event = new StandardKeyboardEvent(e);
|
let event = new StandardKeyboardEvent(e);
|
||||||
if (event.equals(KeyCode.Enter)) {
|
if (event.equals(KeyCode.Enter)) {
|
||||||
this.showTab(tab.tab.identifier);
|
this.showTab(tab.tab.identifier);
|
||||||
|
invokeTabSelectedHandler();
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -206,6 +206,10 @@ export class ProfilerCollapsablePanelAction extends Action {
|
|||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get collapsed(): boolean {
|
||||||
|
return this._collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
set collapsed(val: boolean) {
|
set collapsed(val: boolean) {
|
||||||
this._collapsed = val === false ? false : true;
|
this._collapsed = val === false ? false : true;
|
||||||
this._setClass(this._collapsed ? 'maximize-panel-action' : 'minimize-panel-action');
|
this._setClass(this._collapsed ? 'maximize-panel-action' : 'minimize-panel-action');
|
||||||
|
|||||||
@@ -336,6 +336,13 @@ export class ProfilerEditor extends BaseEditor {
|
|||||||
tabbedPanelContainer.className = 'profiler-tabbedPane';
|
tabbedPanelContainer.className = 'profiler-tabbedPane';
|
||||||
this._tabbedPanel = new TabbedPanel(tabbedPanelContainer);
|
this._tabbedPanel = new TabbedPanel(tabbedPanelContainer);
|
||||||
attachTabbedPanelStyler(this._tabbedPanel, this.themeService);
|
attachTabbedPanelStyler(this._tabbedPanel, this.themeService);
|
||||||
|
|
||||||
|
const expandPanel = () => {
|
||||||
|
if (this._collapsedPanelAction.collapsed) {
|
||||||
|
this._collapsedPanelAction.run(this.input);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this._tabbedPanel.pushTab({
|
this._tabbedPanel.pushTab({
|
||||||
identifier: 'editor',
|
identifier: 'editor',
|
||||||
title: nls.localize('text', "Text"),
|
title: nls.localize('text', "Text"),
|
||||||
@@ -343,7 +350,8 @@ export class ProfilerEditor extends BaseEditor {
|
|||||||
layout: dim => this._editor.layout(dim),
|
layout: dim => this._editor.layout(dim),
|
||||||
render: parent => parent.appendChild(editorContainer),
|
render: parent => parent.appendChild(editorContainer),
|
||||||
focus: () => this._editor.focus()
|
focus: () => this._editor.focus()
|
||||||
}
|
},
|
||||||
|
tabSelectedHandler: expandPanel
|
||||||
});
|
});
|
||||||
|
|
||||||
let detailTableContainer = document.createElement('div');
|
let detailTableContainer = document.createElement('div');
|
||||||
@@ -382,7 +390,8 @@ export class ProfilerEditor extends BaseEditor {
|
|||||||
layout: dim => this._detailTable.layout(dim),
|
layout: dim => this._detailTable.layout(dim),
|
||||||
render: parent => parent.appendChild(detailTableContainer),
|
render: parent => parent.appendChild(detailTableContainer),
|
||||||
focus: () => this._detailTable.focus()
|
focus: () => this._detailTable.focus()
|
||||||
}
|
},
|
||||||
|
tabSelectedHandler: expandPanel
|
||||||
});
|
});
|
||||||
|
|
||||||
this._collapsedPanelAction = this._instantiationService.createInstance(Actions.ProfilerCollapsablePanelAction, Actions.ProfilerCollapsablePanelAction.ID, Actions.ProfilerCollapsablePanelAction.LABEL);
|
this._collapsedPanelAction = this._instantiationService.createInstance(Actions.ProfilerCollapsablePanelAction, Actions.ProfilerCollapsablePanelAction.ID, Actions.ProfilerCollapsablePanelAction.LABEL);
|
||||||
|
|||||||
Reference in New Issue
Block a user