diff --git a/news/1 Enhancements/5389.md b/news/1 Enhancements/5389.md new file mode 100644 index 000000000000..347df9673703 --- /dev/null +++ b/news/1 Enhancements/5389.md @@ -0,0 +1 @@ +Add visual separation between the variable explorer and the rest of the Interactive Window content \ No newline at end of file diff --git a/news/2 Fixes/5734.md b/news/2 Fixes/5734.md new file mode 100644 index 000000000000..c031a1c02fee --- /dev/null +++ b/news/2 Fixes/5734.md @@ -0,0 +1 @@ +Fix horizontal scrolling in the Interactive Window \ No newline at end of file diff --git a/src/datascience-ui/history-react/MainPanel.tsx b/src/datascience-ui/history-react/MainPanel.tsx index f2c507118796..3e293a81871b 100644 --- a/src/datascience-ui/history-react/MainPanel.tsx +++ b/src/datascience-ui/history-react/MainPanel.tsx @@ -19,12 +19,13 @@ import { getSettings, updateSettings } from '../react-common/settingsReactSide'; import { StyleInjector } from '../react-common/styleInjector'; import { Cell, ICellViewModel } from './cell'; import { ContentPanel, IContentPanelProps } from './contentPanel'; -import { HeaderPanel, IHeaderPanelProps } from './headerPanel'; import { InputHistory } from './inputHistory'; import { IntellisenseProvider } from './intellisenseProvider'; import { createCellVM, createEditableCellVM, extractInputText, generateTestState, IMainPanelState } from './mainPanelState'; import { initializeTokenizer, registerMonacoLanguage } from './tokenizer'; +import { IToolbarPanelProps, ToolbarPanel } from './toolbarPanel'; import { VariableExplorer } from './variableExplorer'; +import { IVariablePanelProps, VariablePanel } from './variablePanel'; import './mainPanel.css'; @@ -62,7 +63,6 @@ export class MainPanel extends React.Component redoStack : [], submittedText: false, history: new InputHistory(), - contentTop: 24, editCellVM: getSettings && getSettings().allowInput ? createEditableCellVM(1) : undefined, editorOptions: this.computeEditorOptions() }; @@ -138,22 +138,17 @@ export class MainPanel extends React.Component darkChanged={this.darkChanged} monacoThemeChanged={this.monacoThemeChanged} ref={this.styleInjectorRef} /> -
-
- {this.renderHeaderPanel(baseTheme)} -
+
+ {this.renderToolbarPanel(baseTheme)}
-
-
-
- {this.renderContentPanel(baseTheme)} -
-
+
+ {this.renderVariablePanel(baseTheme)}
-
-
- {this.renderFooterPanel(baseTheme)} -
+
+ {this.renderContentPanel(baseTheme)} +
+
); @@ -262,9 +257,14 @@ export class MainPanel extends React.Component // this.addCell(cell); // } - private renderHeaderPanel(baseTheme: string) { - const headerProps = this.getHeaderProps(baseTheme); - return ; + private renderToolbarPanel(baseTheme: string) { + const toolbarProps = this.getToolbarProps(baseTheme); + return ; + } + + private renderVariablePanel(baseTheme: string) { + const variableProps = this.getVariableProps(baseTheme); + return ; } private renderContentPanel(baseTheme: string) { @@ -345,11 +345,6 @@ export class MainPanel extends React.Component return {}; } - // Called by the header control when size changes (such as expanding variables) - private onHeaderHeightChange = (newHeight: number) => { - this.setState({contentTop: newHeight}); - } - private darkChanged = (newDark: boolean) => { // update our base theme if allowed. Don't do this // during testing as it will mess up the expected render count. @@ -393,7 +388,6 @@ export class MainPanel extends React.Component return { editorOptions: this.state.editorOptions, baseTheme: baseTheme, - contentTop: this.state.contentTop, cellVMs: this.state.cellVMs, history: this.state.history, testMode: this.props.testMode, @@ -407,10 +401,9 @@ export class MainPanel extends React.Component onCodeChange: this.codeChange }; } - private getHeaderProps = (baseTheme: string): IHeaderPanelProps => { + private getToolbarProps = (baseTheme: string): IToolbarPanelProps => { return { addMarkdown: this.addMarkdown, - busy: this.state.busy, collapseAll: this.collapseAll, expandAll: this.expandAll, export: this.export, @@ -420,17 +413,23 @@ export class MainPanel extends React.Component redo: this.redo, clearAll: this.clearAll, skipDefault: this.props.skipDefault, - showDataExplorer: this.showDataViewer, - testMode: this.props.testMode, - variableExplorerRef: this.variableExplorerRef, canCollapseAll: this.canCollapseAll(), canExpandAll: this.canExpandAll(), canExport: this.canExport(), canUndo: this.canUndo(), canRedo: this.canRedo(), + baseTheme: baseTheme + }; + } + + private getVariableProps = (baseTheme: string): IVariablePanelProps => { + return { + busy: this.state.busy, + showDataExplorer: this.showDataViewer, + testMode: this.props.testMode, + variableExplorerRef: this.variableExplorerRef, refreshVariables: this.refreshVariables, variableExplorerToggled: this.variableExplorerToggled, - onHeightChange: this.onHeaderHeightChange, baseTheme: baseTheme }; } diff --git a/src/datascience-ui/history-react/contentPanel.css b/src/datascience-ui/history-react/contentPanel.css index 5addb281e286..1b93b248a7ca 100644 --- a/src/datascience-ui/history-react/contentPanel.css +++ b/src/datascience-ui/history-react/contentPanel.css @@ -1,8 +1,3 @@ -#content-panel-div { - height: 100%; - overflow: auto; -} - #cell-table { display: table; width: 100%; diff --git a/src/datascience-ui/history-react/contentPanel.tsx b/src/datascience-ui/history-react/contentPanel.tsx index 80ae1a05bbe5..39aeb497d179 100644 --- a/src/datascience-ui/history-react/contentPanel.tsx +++ b/src/datascience-ui/history-react/contentPanel.tsx @@ -14,7 +14,6 @@ import { InputHistory } from './inputHistory'; export interface IContentPanelProps { baseTheme: string; - contentTop: number; cellVMs: ICellViewModel[]; history: InputHistory; testMode?: boolean; diff --git a/src/datascience-ui/history-react/headerPanel.css b/src/datascience-ui/history-react/headerPanel.css deleted file mode 100644 index 7d8bf7626afd..000000000000 --- a/src/datascience-ui/history-react/headerPanel.css +++ /dev/null @@ -1,3 +0,0 @@ -#header-panel-div { - height: auto; -} \ No newline at end of file diff --git a/src/datascience-ui/history-react/mainPanel.css b/src/datascience-ui/history-react/mainPanel.css index 77df56cf114c..6657611f76dc 100644 --- a/src/datascience-ui/history-react/mainPanel.css +++ b/src/datascience-ui/history-react/mainPanel.css @@ -11,10 +11,38 @@ body, html { #main-panel { background: var(--override-background, var(--vscode-editor-background)); color: var(--override-foreground, var(--vscode-editor-foreground)); + display: grid; + grid-template-rows: auto auto 1fr auto; + grid-template-columns: 1fr; + grid-template-areas: + "toolbar" + "variable" + "content" + "footer"; height: 100%; width: 100%; + position: absolute; + overflow: hidden; +} + +#main-panel-toolbar { + grid-area: toolbar; + justify-self: end; + overflow: hidden; +} + +#main-panel-variable { + grid-area: variable; + overflow: auto; +} +#main-panel-content { + grid-area: content; + max-height: 100%; + overflow: auto; +} +#main-panel-footer { + grid-area: footer; overflow: hidden; - display: table; } .hide { @@ -32,25 +60,4 @@ body, html { border-top-color: var(--override-widget-background, var(--vscode-editorGroupHeader-tabsBackground)); border-top-style: solid; border-top-width: 1px; -} - -.main-panel-header, .main-panel-content, .main-panel-footer { - display: table-row; -} - -.main-panel-inner { - display: table-cell; -} - -.main-panel-content .main-panel-inner { - height: 100%; - position: relative; -} - -.main-panel-scrollable { - position: absolute; - left: 0; right: 0; - top: 0; bottom: 0; - overflow-y: auto; - overflow-x: none; } \ No newline at end of file diff --git a/src/datascience-ui/history-react/mainPanelState.ts b/src/datascience-ui/history-react/mainPanelState.ts index be0913cb5429..430def1f65a8 100644 --- a/src/datascience-ui/history-react/mainPanelState.ts +++ b/src/datascience-ui/history-react/mainPanelState.ts @@ -23,7 +23,6 @@ export interface IMainPanelState { redoStack : ICellViewModel[][]; submittedText: boolean; history: InputHistory; - contentTop: number; rootStyle?: string; theme?: string; forceDark?: boolean; @@ -56,7 +55,6 @@ export function generateTestState(inputBlockToggled : (id: string) => void, file redoStack : [], submittedText: false, history: new InputHistory(), - contentTop: 24, rootStyle: darkStyle, tokenizerLoaded: true, editorOptions: {} diff --git a/src/datascience-ui/history-react/toolbarPanel.css b/src/datascience-ui/history-react/toolbarPanel.css new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/src/datascience-ui/history-react/headerPanel.tsx b/src/datascience-ui/history-react/toolbarPanel.tsx similarity index 73% rename from src/datascience-ui/history-react/headerPanel.tsx rename to src/datascience-ui/history-react/toolbarPanel.tsx index 0075cd5ada8e..d5f2f46d5d42 100644 --- a/src/datascience-ui/history-react/headerPanel.tsx +++ b/src/datascience-ui/history-react/toolbarPanel.tsx @@ -1,30 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. 'use strict'; -import './headerPanel.css'; +import './toolbarPanel.css'; import * as React from 'react'; -import * as ReactDOM from 'react-dom'; import { getLocString } from '../react-common/locReactSide'; -import { Progress } from '../react-common/progress'; import { getSettings } from '../react-common/settingsReactSide'; import { CellButton } from './cellButton'; import { Image, ImageName } from './image'; import { MenuBar } from './menuBar'; -import { VariableExplorer } from './variableExplorer'; -export interface IHeaderPanelProps { +export interface IToolbarPanelProps { baseTheme: string; - busy: boolean; canCollapseAll: boolean; canExpandAll: boolean; canExport: boolean; canUndo: boolean; canRedo: boolean; skipDefault?: boolean; - testMode?: boolean; - variableExplorerRef: React.RefObject; addMarkdown(): void; collapseAll(): void; expandAll(): void; @@ -34,21 +28,16 @@ export interface IHeaderPanelProps { undo(): void; redo(): void; clearAll(): void; - showDataExplorer(targetVariable: string): void; - refreshVariables(): void; - variableExplorerToggled(open: boolean): void; - onHeightChange(newHeight: number): void; } -export class HeaderPanel extends React.Component { - constructor(prop: IHeaderPanelProps) { +export class ToolbarPanel extends React.Component { + constructor(prop: IToolbarPanelProps) { super(prop); } public render() { - const progressBar = this.props.busy && !this.props.testMode ? : undefined; return( -
+
{this.renderExtraButtons()} @@ -76,26 +65,10 @@ export class HeaderPanel extends React.Component { - {progressBar} -
); } - private onVariableHeightChange = () => { - const divElement = ReactDOM.findDOMNode(this) as HTMLDivElement; - - if (divElement) { - const computeHeight = divElement.offsetHeight; - this.props.onHeightChange(computeHeight); - } - } - private renderExtraButtons = () => { if (!this.props.skipDefault) { const baseTheme = getSettings().ignoreVscodeTheme ? 'vscode-light' : this.props.baseTheme; diff --git a/src/datascience-ui/history-react/variableExplorer.tsx b/src/datascience-ui/history-react/variableExplorer.tsx index d5c2ba101791..414f8d48cdb1 100644 --- a/src/datascience-ui/history-react/variableExplorer.tsx +++ b/src/datascience-ui/history-react/variableExplorer.tsx @@ -4,7 +4,6 @@ import './variableExplorer.css'; import * as React from 'react'; -import * as ReactDOM from 'react-dom'; import { IJupyterVariable } from '../../client/datascience/types'; import { getLocString } from '../react-common/locReactSide'; @@ -21,7 +20,6 @@ import './variableExplorerGrid.less'; interface IVariableExplorerProps { baseTheme: string; refreshVariables(): void; - onHeightChange(): void; showDataExplorer(targetVariable: string): void; variableExplorerToggled(open: boolean): void; } @@ -126,12 +124,6 @@ export class VariableExplorer extends React.Component { - this.updateHeight(); } // New variable data passed in via a ref @@ -291,20 +283,6 @@ export class VariableExplorer extends React.Component { - // Make sure we check for a new height so we don't get into an update loop - const divElement = ReactDOM.findDOMNode(this) as HTMLDivElement; - - if (divElement) { - const newHeight = divElement.offsetHeight; - - if (this.state.height !== newHeight) { - this.setState({height: newHeight}); - this.props.onHeightChange(); - } - } - } - private getRow = (index: number) => { if (index >= 0 && index < this.state.gridRows.length) { return this.state.gridRows[index]; diff --git a/src/datascience-ui/history-react/variablePanel.css b/src/datascience-ui/history-react/variablePanel.css new file mode 100644 index 000000000000..4ccb8f2e72af --- /dev/null +++ b/src/datascience-ui/history-react/variablePanel.css @@ -0,0 +1,6 @@ +#variable-divider { + width: 100%; + border-top-color: var(--override-badge-background, var(--vscode-badge-background)); + border-top-style: solid; + border-top-width: 2px; +} \ No newline at end of file diff --git a/src/datascience-ui/history-react/variablePanel.tsx b/src/datascience-ui/history-react/variablePanel.tsx new file mode 100644 index 000000000000..7e3bcb7d456e --- /dev/null +++ b/src/datascience-ui/history-react/variablePanel.tsx @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +'use strict'; +import './variablePanel.css'; + +import * as React from 'react'; + +import { Progress } from '../react-common/progress'; +import { VariableExplorer } from './variableExplorer'; + +export interface IVariablePanelProps { + baseTheme: string; + busy: boolean; + testMode?: boolean; + variableExplorerRef: React.RefObject; + showDataExplorer(targetVariable: string): void; + refreshVariables(): void; + variableExplorerToggled(open: boolean): void; +} + +export class VariablePanel extends React.Component { + constructor(prop: IVariablePanelProps) { + super(prop); + } + + public render() { + const progressBar = this.props.busy && !this.props.testMode ? : undefined; + return( +
+ {progressBar} + +
+
+ ); + } +}