Skip to content

Commit 216a998

Browse files
Dev/ianhu/var exp div3 (#5763)
1 parent d79ffd5 commit 216a998

File tree

13 files changed

+112
-118
lines changed

13 files changed

+112
-118
lines changed

news/1 Enhancements/5389.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add visual separation between the variable explorer and the rest of the Interactive Window content

news/2 Fixes/5734.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix horizontal scrolling in the Interactive Window

src/datascience-ui/history-react/MainPanel.tsx

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ import { getSettings, updateSettings } from '../react-common/settingsReactSide';
1919
import { StyleInjector } from '../react-common/styleInjector';
2020
import { Cell, ICellViewModel } from './cell';
2121
import { ContentPanel, IContentPanelProps } from './contentPanel';
22-
import { HeaderPanel, IHeaderPanelProps } from './headerPanel';
2322
import { InputHistory } from './inputHistory';
2423
import { IntellisenseProvider } from './intellisenseProvider';
2524
import { createCellVM, createEditableCellVM, extractInputText, generateTestState, IMainPanelState } from './mainPanelState';
2625
import { initializeTokenizer, registerMonacoLanguage } from './tokenizer';
26+
import { IToolbarPanelProps, ToolbarPanel } from './toolbarPanel';
2727
import { VariableExplorer } from './variableExplorer';
28+
import { IVariablePanelProps, VariablePanel } from './variablePanel';
2829

2930
import './mainPanel.css';
3031

@@ -62,7 +63,6 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
6263
redoStack : [],
6364
submittedText: false,
6465
history: new InputHistory(),
65-
contentTop: 24,
6666
editCellVM: getSettings && getSettings().allowInput ? createEditableCellVM(1) : undefined,
6767
editorOptions: this.computeEditorOptions()
6868
};
@@ -138,22 +138,17 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
138138
darkChanged={this.darkChanged}
139139
monacoThemeChanged={this.monacoThemeChanged}
140140
ref={this.styleInjectorRef} />
141-
<div className='main-panel-header'>
142-
<div className='main-panel-inner'>
143-
{this.renderHeaderPanel(baseTheme)}
144-
</div>
141+
<div id='main-panel-toolbar'>
142+
{this.renderToolbarPanel(baseTheme)}
145143
</div>
146-
<div className='main-panel-content'>
147-
<div className='main-panel-inner'>
148-
<div className='main-panel-scrollable'>
149-
{this.renderContentPanel(baseTheme)}
150-
</div>
151-
</div>
144+
<div id='main-panel-variable'>
145+
{this.renderVariablePanel(baseTheme)}
152146
</div>
153-
<div className='main-panel-footer'>
154-
<div className='main-panel-inner'>
155-
{this.renderFooterPanel(baseTheme)}
156-
</div>
147+
<div id='main-panel-content'>
148+
{this.renderContentPanel(baseTheme)}
149+
</div>
150+
<div id='main-panel-footer'>
151+
{this.renderFooterPanel(baseTheme)}
157152
</div>
158153
</div>
159154
);
@@ -262,9 +257,14 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
262257
// this.addCell(cell);
263258
// }
264259

265-
private renderHeaderPanel(baseTheme: string) {
266-
const headerProps = this.getHeaderProps(baseTheme);
267-
return <HeaderPanel {...headerProps} />;
260+
private renderToolbarPanel(baseTheme: string) {
261+
const toolbarProps = this.getToolbarProps(baseTheme);
262+
return <ToolbarPanel {...toolbarProps} />;
263+
}
264+
265+
private renderVariablePanel(baseTheme: string) {
266+
const variableProps = this.getVariableProps(baseTheme);
267+
return <VariablePanel {...variableProps} />;
268268
}
269269

270270
private renderContentPanel(baseTheme: string) {
@@ -347,11 +347,6 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
347347
return {};
348348
}
349349

350-
// Called by the header control when size changes (such as expanding variables)
351-
private onHeaderHeightChange = (newHeight: number) => {
352-
this.setState({contentTop: newHeight});
353-
}
354-
355350
private darkChanged = (newDark: boolean) => {
356351
// update our base theme if allowed. Don't do this
357352
// during testing as it will mess up the expected render count.
@@ -395,7 +390,6 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
395390
return {
396391
editorOptions: this.state.editorOptions,
397392
baseTheme: baseTheme,
398-
contentTop: this.state.contentTop,
399393
cellVMs: this.state.cellVMs,
400394
history: this.state.history,
401395
testMode: this.props.testMode,
@@ -409,10 +403,9 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
409403
onCodeChange: this.codeChange
410404
};
411405
}
412-
private getHeaderProps = (baseTheme: string): IHeaderPanelProps => {
406+
private getToolbarProps = (baseTheme: string): IToolbarPanelProps => {
413407
return {
414408
addMarkdown: this.addMarkdown,
415-
busy: this.state.busy,
416409
collapseAll: this.collapseAll,
417410
expandAll: this.expandAll,
418411
export: this.export,
@@ -422,17 +415,23 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
422415
redo: this.redo,
423416
clearAll: this.clearAll,
424417
skipDefault: this.props.skipDefault,
425-
showDataExplorer: this.showDataViewer,
426-
testMode: this.props.testMode,
427-
variableExplorerRef: this.variableExplorerRef,
428418
canCollapseAll: this.canCollapseAll(),
429419
canExpandAll: this.canExpandAll(),
430420
canExport: this.canExport(),
431421
canUndo: this.canUndo(),
432422
canRedo: this.canRedo(),
423+
baseTheme: baseTheme
424+
};
425+
}
426+
427+
private getVariableProps = (baseTheme: string): IVariablePanelProps => {
428+
return {
429+
busy: this.state.busy,
430+
showDataExplorer: this.showDataViewer,
431+
testMode: this.props.testMode,
432+
variableExplorerRef: this.variableExplorerRef,
433433
refreshVariables: this.refreshVariables,
434434
variableExplorerToggled: this.variableExplorerToggled,
435-
onHeightChange: this.onHeaderHeightChange,
436435
baseTheme: baseTheme
437436
};
438437
}

src/datascience-ui/history-react/contentPanel.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
#content-panel-div {
2-
height: 100%;
3-
overflow: auto;
4-
}
5-
61
#cell-table {
72
display: table;
83
width: 100%;

src/datascience-ui/history-react/contentPanel.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { InputHistory } from './inputHistory';
1414

1515
export interface IContentPanelProps {
1616
baseTheme: string;
17-
contentTop: number;
1817
cellVMs: ICellViewModel[];
1918
history: InputHistory;
2019
testMode?: boolean;

src/datascience-ui/history-react/headerPanel.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/datascience-ui/history-react/mainPanel.css

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,38 @@ body, html {
1111
#main-panel {
1212
background: var(--override-background, var(--vscode-editor-background));
1313
color: var(--override-foreground, var(--vscode-editor-foreground));
14+
display: grid;
15+
grid-template-rows: auto auto 1fr auto;
16+
grid-template-columns: 1fr;
17+
grid-template-areas:
18+
"toolbar"
19+
"variable"
20+
"content"
21+
"footer";
1422
height: 100%;
1523
width: 100%;
24+
position: absolute;
25+
overflow: hidden;
26+
}
27+
28+
#main-panel-toolbar {
29+
grid-area: toolbar;
30+
justify-self: end;
31+
overflow: hidden;
32+
}
33+
34+
#main-panel-variable {
35+
grid-area: variable;
36+
overflow: auto;
37+
}
38+
#main-panel-content {
39+
grid-area: content;
40+
max-height: 100%;
41+
overflow: auto;
42+
}
43+
#main-panel-footer {
44+
grid-area: footer;
1645
overflow: hidden;
17-
display: table;
1846
}
1947

2048
.hide {
@@ -32,25 +60,4 @@ body, html {
3260
border-top-color: var(--override-widget-background, var(--vscode-editorGroupHeader-tabsBackground));
3361
border-top-style: solid;
3462
border-top-width: 1px;
35-
}
36-
37-
.main-panel-header, .main-panel-content, .main-panel-footer {
38-
display: table-row;
39-
}
40-
41-
.main-panel-inner {
42-
display: table-cell;
43-
}
44-
45-
.main-panel-content .main-panel-inner {
46-
height: 100%;
47-
position: relative;
48-
}
49-
50-
.main-panel-scrollable {
51-
position: absolute;
52-
left: 0; right: 0;
53-
top: 0; bottom: 0;
54-
overflow-y: auto;
55-
overflow-x: none;
5663
}

src/datascience-ui/history-react/mainPanelState.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export interface IMainPanelState {
2323
redoStack : ICellViewModel[][];
2424
submittedText: boolean;
2525
history: InputHistory;
26-
contentTop: number;
2726
rootStyle?: string;
2827
theme?: string;
2928
forceDark?: boolean;
@@ -56,7 +55,6 @@ export function generateTestState(inputBlockToggled : (id: string) => void, file
5655
redoStack : [],
5756
submittedText: false,
5857
history: new InputHistory(),
59-
contentTop: 24,
6058
rootStyle: darkStyle,
6159
tokenizerLoaded: true,
6260
editorOptions: {}

src/datascience-ui/history-react/toolbarPanel.css

Whitespace-only changes.

src/datascience-ui/history-react/headerPanel.tsx renamed to src/datascience-ui/history-react/toolbarPanel.tsx

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33
'use strict';
4-
import './headerPanel.css';
4+
import './toolbarPanel.css';
55

66
import * as React from 'react';
7-
import * as ReactDOM from 'react-dom';
87

98
import { getLocString } from '../react-common/locReactSide';
10-
import { Progress } from '../react-common/progress';
119
import { getSettings } from '../react-common/settingsReactSide';
1210
import { CellButton } from './cellButton';
1311
import { Image, ImageName } from './image';
1412
import { MenuBar } from './menuBar';
15-
import { VariableExplorer } from './variableExplorer';
1613

17-
export interface IHeaderPanelProps {
14+
export interface IToolbarPanelProps {
1815
baseTheme: string;
19-
busy: boolean;
2016
canCollapseAll: boolean;
2117
canExpandAll: boolean;
2218
canExport: boolean;
2319
canUndo: boolean;
2420
canRedo: boolean;
2521
skipDefault?: boolean;
26-
testMode?: boolean;
27-
variableExplorerRef: React.RefObject<VariableExplorer>;
2822
addMarkdown(): void;
2923
collapseAll(): void;
3024
expandAll(): void;
@@ -34,21 +28,16 @@ export interface IHeaderPanelProps {
3428
undo(): void;
3529
redo(): void;
3630
clearAll(): void;
37-
showDataExplorer(targetVariable: string): void;
38-
refreshVariables(): void;
39-
variableExplorerToggled(open: boolean): void;
40-
onHeightChange(newHeight: number): void;
4131
}
4232

43-
export class HeaderPanel extends React.Component<IHeaderPanelProps> {
44-
constructor(prop: IHeaderPanelProps) {
33+
export class ToolbarPanel extends React.Component<IToolbarPanelProps> {
34+
constructor(prop: IToolbarPanelProps) {
4535
super(prop);
4636
}
4737

4838
public render() {
49-
const progressBar = this.props.busy && !this.props.testMode ? <Progress /> : undefined;
5039
return(
51-
<div id='header-panel-div'>
40+
<div id='toolbar-panel'>
5241
<MenuBar baseTheme={this.props.baseTheme}>
5342
{this.renderExtraButtons()}
5443
<CellButton baseTheme={this.props.baseTheme} onClick={this.props.collapseAll} disabled={!this.props.canCollapseAll} tooltip={getLocString('DataScience.collapseAll', 'Collapse all cell inputs')}>
@@ -76,26 +65,10 @@ export class HeaderPanel extends React.Component<IHeaderPanelProps> {
7665
<Image baseTheme={this.props.baseTheme} class='cell-button-image' image={ImageName.Cancel}/>
7766
</CellButton>
7867
</MenuBar>
79-
{progressBar}
80-
<VariableExplorer baseTheme={this.props.baseTheme}
81-
showDataExplorer={this.props.showDataExplorer}
82-
refreshVariables={this.props.refreshVariables}
83-
onHeightChange={this.onVariableHeightChange}
84-
variableExplorerToggled={this.props.variableExplorerToggled}
85-
ref={this.props.variableExplorerRef} />
8668
</div>
8769
);
8870
}
8971

90-
private onVariableHeightChange = () => {
91-
const divElement = ReactDOM.findDOMNode(this) as HTMLDivElement;
92-
93-
if (divElement) {
94-
const computeHeight = divElement.offsetHeight;
95-
this.props.onHeightChange(computeHeight);
96-
}
97-
}
98-
9972
private renderExtraButtons = () => {
10073
if (!this.props.skipDefault) {
10174
const baseTheme = getSettings().ignoreVscodeTheme ? 'vscode-light' : this.props.baseTheme;

0 commit comments

Comments
 (0)