mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
add event to capture state and reapply when necessary (#6246)
This commit is contained in:
@@ -33,6 +33,8 @@ export interface IPanelView {
|
|||||||
layout(dimension: DOM.Dimension): void;
|
layout(dimension: DOM.Dimension): void;
|
||||||
focus(): void;
|
focus(): void;
|
||||||
remove?(): void;
|
remove?(): void;
|
||||||
|
onShow?(): void;
|
||||||
|
onHide?(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPanelTab {
|
export interface IPanelTab {
|
||||||
@@ -190,6 +192,9 @@ export class TabbedPanel extends Disposable {
|
|||||||
shownTab.header.setAttribute('aria-selected', 'false');
|
shownTab.header.setAttribute('aria-selected', 'false');
|
||||||
if (shownTab.body) {
|
if (shownTab.body) {
|
||||||
shownTab.body.remove();
|
shownTab.body.remove();
|
||||||
|
if (shownTab.tab.view.onHide) {
|
||||||
|
shownTab.tab.view.onHide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,6 +220,9 @@ export class TabbedPanel extends Disposable {
|
|||||||
DOM.addClass(tab.header, 'active');
|
DOM.addClass(tab.header, 'active');
|
||||||
tab.header.setAttribute('aria-selected', 'true');
|
tab.header.setAttribute('aria-selected', 'true');
|
||||||
this._onTabChange.fire(id);
|
this._onTabChange.fire(id);
|
||||||
|
if (tab.tab.view.onShow) {
|
||||||
|
tab.tab.view.onShow();
|
||||||
|
}
|
||||||
if (this._currentDimensions) {
|
if (this._currentDimensions) {
|
||||||
this._layoutCurrentTab(new DOM.Dimension(this._currentDimensions.width, this._currentDimensions.height - this.headersize));
|
this._layoutCurrentTab(new DOM.Dimension(this._currentDimensions.width, this._currentDimensions.height - this.headersize));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ class MessagesView extends Disposable implements IPanelView {
|
|||||||
class ResultsView extends Disposable implements IPanelView {
|
class ResultsView extends Disposable implements IPanelView {
|
||||||
private gridPanel: GridPanel;
|
private gridPanel: GridPanel;
|
||||||
private container = document.createElement('div');
|
private container = document.createElement('div');
|
||||||
|
private _state: GridPanelState;
|
||||||
|
private _runner: QueryRunner;
|
||||||
|
|
||||||
constructor(private instantiationService: IInstantiationService) {
|
constructor(private instantiationService: IInstantiationService) {
|
||||||
super();
|
super();
|
||||||
@@ -94,7 +96,20 @@ class ResultsView extends Disposable implements IPanelView {
|
|||||||
this.container.remove();
|
this.container.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onHide(): void {
|
||||||
|
this._state = this.gridPanel.state;
|
||||||
|
this.gridPanel.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
onShow(): void {
|
||||||
|
if (this._state) {
|
||||||
|
this.state = this._state;
|
||||||
|
this.queryRunner = this._runner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public set queryRunner(runner: QueryRunner) {
|
public set queryRunner(runner: QueryRunner) {
|
||||||
|
this._runner = runner;
|
||||||
this.gridPanel.queryRunner = runner;
|
this.gridPanel.queryRunner = runner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user