mirror of
https://github.com/mathuo/dockview
synced 2025-02-03 06:55:46 +00:00
refactor: move and delete code
This commit is contained in:
parent
09a6f265d5
commit
3a458461a1
@ -8,7 +8,7 @@ import {
|
|||||||
IGroupPanelInitParameters,
|
IGroupPanelInitParameters,
|
||||||
} from '../../dockview/types';
|
} from '../../dockview/types';
|
||||||
import { PanelUpdateEvent } from '../../panel/types';
|
import { PanelUpdateEvent } from '../../panel/types';
|
||||||
import { Orientation } from '../../splitview/core/splitview';
|
import { Orientation } from '../../splitview/splitview';
|
||||||
import { CompositeDisposable } from '../../lifecycle';
|
import { CompositeDisposable } from '../../lifecycle';
|
||||||
import { Emitter } from '../../events';
|
import { Emitter } from '../../events';
|
||||||
import { IDockviewPanel } from '../../dockview/dockviewPanel';
|
import { IDockviewPanel } from '../../dockview/dockviewPanel';
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
PanelUpdateEvent,
|
PanelUpdateEvent,
|
||||||
Parameters,
|
Parameters,
|
||||||
} from '../../panel/types';
|
} from '../../panel/types';
|
||||||
import { LayoutPriority, Orientation } from '../../splitview/core/splitview';
|
import { LayoutPriority, Orientation } from '../../splitview/splitview';
|
||||||
|
|
||||||
class TestPanel implements IGridPanelView {
|
class TestPanel implements IGridPanelView {
|
||||||
_onDidChange = new Emitter<IViewSize | undefined>();
|
_onDidChange = new Emitter<IViewSize | undefined>();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Gridview } from '../../gridview/gridview';
|
import { Gridview } from '../../gridview/gridview';
|
||||||
import { Orientation } from '../../splitview/core/splitview';
|
import { Orientation } from '../../splitview/splitview';
|
||||||
|
|
||||||
describe('gridview', () => {
|
describe('gridview', () => {
|
||||||
let container: HTMLElement;
|
let container: HTMLElement;
|
||||||
|
@ -2,7 +2,7 @@ import { GridviewComponent } from '../../gridview/gridviewComponent';
|
|||||||
import { GridviewPanel } from '../../gridview/gridviewPanel';
|
import { GridviewPanel } from '../../gridview/gridviewPanel';
|
||||||
import { CompositeDisposable } from '../../lifecycle';
|
import { CompositeDisposable } from '../../lifecycle';
|
||||||
import { IFrameworkPart } from '../../panel/types';
|
import { IFrameworkPart } from '../../panel/types';
|
||||||
import { Orientation } from '../../splitview/core/splitview';
|
import { Orientation } from '../../splitview/splitview';
|
||||||
|
|
||||||
class TestGridview extends GridviewPanel {
|
class TestGridview extends GridviewPanel {
|
||||||
constructor(id: string, componentName: string) {
|
constructor(id: string, componentName: string) {
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
IPaneHeaderPart,
|
IPaneHeaderPart,
|
||||||
PaneviewPanel,
|
PaneviewPanel,
|
||||||
} from '../../paneview/paneviewPanel';
|
} from '../../paneview/paneviewPanel';
|
||||||
import { Orientation } from '../../splitview/core/splitview';
|
import { Orientation } from '../../splitview/splitview';
|
||||||
|
|
||||||
class TestPanel extends PaneviewPanel {
|
class TestPanel extends PaneviewPanel {
|
||||||
protected getBodyComponent(): IPaneBodyPart {
|
protected getBodyComponent(): IPaneBodyPart {
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
IPaneHeaderPart,
|
IPaneHeaderPart,
|
||||||
PanePanelComponentInitParameter,
|
PanePanelComponentInitParameter,
|
||||||
} from '../../paneview/paneviewPanel';
|
} from '../../paneview/paneviewPanel';
|
||||||
import { Orientation } from '../../splitview/core/splitview';
|
import { Orientation } from '../../splitview/splitview';
|
||||||
|
|
||||||
class TestPanel extends PaneviewPanel {
|
class TestPanel extends PaneviewPanel {
|
||||||
constructor(id: string, component: string) {
|
constructor(id: string, component: string) {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { Emitter } from '../../../events';
|
import { Emitter } from '../../events';
|
||||||
import { CompositeDisposable } from '../../../lifecycle';
|
import { CompositeDisposable } from '../../lifecycle';
|
||||||
import {
|
import {
|
||||||
IView,
|
IView,
|
||||||
LayoutPriority,
|
LayoutPriority,
|
||||||
Orientation,
|
Orientation,
|
||||||
Sizing,
|
Sizing,
|
||||||
Splitview,
|
Splitview,
|
||||||
} from '../../../splitview/core/splitview';
|
} from '../../splitview/splitview';
|
||||||
|
|
||||||
class Testview implements IView {
|
class Testview implements IView {
|
||||||
private _element: HTMLElement = document.createElement('div');
|
private _element: HTMLElement = document.createElement('div');
|
@ -1,6 +1,6 @@
|
|||||||
import { PanelDimensionChangeEvent } from '../../api/panelApi';
|
import { PanelDimensionChangeEvent } from '../../api/panelApi';
|
||||||
import { CompositeDisposable } from '../../lifecycle';
|
import { CompositeDisposable } from '../../lifecycle';
|
||||||
import { Orientation } from '../../splitview/core/splitview';
|
import { Orientation } from '../../splitview/splitview';
|
||||||
import { SplitviewComponent } from '../../splitview/splitviewComponent';
|
import { SplitviewComponent } from '../../splitview/splitviewComponent';
|
||||||
import { SplitviewPanel } from '../../splitview/splitviewPanel';
|
import { SplitviewPanel } from '../../splitview/splitviewPanel';
|
||||||
|
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
.actions-bar {
|
|
||||||
text-align: right;
|
|
||||||
width: 28px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-shrink: 0;
|
|
||||||
|
|
||||||
.actions-container {
|
|
||||||
display: flex;
|
|
||||||
padding: 0px;
|
|
||||||
margin: 0px;
|
|
||||||
justify-content: flex-end;
|
|
||||||
|
|
||||||
.close-action {
|
|
||||||
padding: 4px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
box-sizing: border-box;
|
|
||||||
cursor: pointer;
|
|
||||||
color: var(--dv-activegroup-hiddenpanel-tab-color);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-radius: 2px;
|
|
||||||
background-color: var(--dv-icon-hover-background-color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
export class ActionContainer {
|
|
||||||
private _element: HTMLElement;
|
|
||||||
private _list: HTMLElement;
|
|
||||||
|
|
||||||
get element(): HTMLElement {
|
|
||||||
return this._element;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this._element = document.createElement('div');
|
|
||||||
this._element.className = 'actions-bar';
|
|
||||||
|
|
||||||
this._list = document.createElement('ul');
|
|
||||||
this._list.className = 'actions-container';
|
|
||||||
|
|
||||||
this._element.appendChild(this._list);
|
|
||||||
}
|
|
||||||
|
|
||||||
public add(element: HTMLElement): void {
|
|
||||||
const listItem = document.createElement('li');
|
|
||||||
listItem.className = 'action-item';
|
|
||||||
this._list.appendChild(element);
|
|
||||||
}
|
|
||||||
}
|
|
@ -28,7 +28,7 @@ import {
|
|||||||
SerializedSplitview,
|
SerializedSplitview,
|
||||||
SplitviewComponentUpdateOptions,
|
SplitviewComponentUpdateOptions,
|
||||||
} from '../splitview/splitviewComponent';
|
} from '../splitview/splitviewComponent';
|
||||||
import { IView, Orientation, Sizing } from '../splitview/core/splitview';
|
import { IView, Orientation, Sizing } from '../splitview/splitview';
|
||||||
import { ISplitviewPanel } from '../splitview/splitviewPanel';
|
import { ISplitviewPanel } from '../splitview/splitviewPanel';
|
||||||
import {
|
import {
|
||||||
DockviewGroupPanel,
|
DockviewGroupPanel,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
&.has-actions {
|
&.has-actions {
|
||||||
.watermark-title {
|
.watermark-title {
|
||||||
.actions-bar {
|
.actions-container {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18,4 +18,28 @@
|
|||||||
.watermark-content {
|
.watermark-content {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.actions-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0px 8px;
|
||||||
|
// padding: 0px;
|
||||||
|
// margin: 0px;
|
||||||
|
// justify-content: flex-end;
|
||||||
|
|
||||||
|
.close-action {
|
||||||
|
padding: 4px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--dv-activegroup-hiddenpanel-tab-color);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-radius: 2px;
|
||||||
|
background-color: var(--dv-icon-hover-background-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { GroupPanelPartInitParameters, IWatermarkRenderer } from '../../types';
|
import { GroupPanelPartInitParameters, IWatermarkRenderer } from '../../types';
|
||||||
import { ActionContainer } from '../../../actionbar/actionsContainer';
|
|
||||||
import { addDisposableListener } from '../../../events';
|
import { addDisposableListener } from '../../../events';
|
||||||
import { toggleClass } from '../../../dom';
|
import { toggleClass } from '../../../dom';
|
||||||
import { CompositeDisposable } from '../../../lifecycle';
|
import { CompositeDisposable } from '../../../lifecycle';
|
||||||
@ -36,15 +35,17 @@ export class Watermark
|
|||||||
this._element.appendChild(title);
|
this._element.appendChild(title);
|
||||||
this._element.appendChild(content);
|
this._element.appendChild(content);
|
||||||
|
|
||||||
const actions = new ActionContainer();
|
const actionsContainer = document.createElement('div');
|
||||||
title.appendChild(emptySpace);
|
actionsContainer.className = 'actions-container';
|
||||||
title.appendChild(actions.element);
|
|
||||||
|
|
||||||
const closeAnchor = document.createElement('div');
|
const closeAnchor = document.createElement('div');
|
||||||
closeAnchor.className = 'close-action';
|
closeAnchor.className = 'close-action';
|
||||||
closeAnchor.appendChild(createCloseButton());
|
closeAnchor.appendChild(createCloseButton());
|
||||||
|
|
||||||
actions.add(closeAnchor);
|
actionsContainer.appendChild(closeAnchor);
|
||||||
|
|
||||||
|
title.appendChild(emptySpace);
|
||||||
|
title.appendChild(actionsContainer);
|
||||||
|
|
||||||
this.addDisposables(
|
this.addDisposables(
|
||||||
addDisposableListener(closeAnchor, 'click', (ev) => {
|
addDisposableListener(closeAnchor, 'click', (ev) => {
|
||||||
|
@ -35,7 +35,7 @@ import {
|
|||||||
toTarget,
|
toTarget,
|
||||||
} from '../gridview/baseComponentGridview';
|
} from '../gridview/baseComponentGridview';
|
||||||
import { DockviewApi } from '../api/component.api';
|
import { DockviewApi } from '../api/component.api';
|
||||||
import { Orientation, Sizing } from '../splitview/core/splitview';
|
import { Orientation, Sizing } from '../splitview/splitview';
|
||||||
import {
|
import {
|
||||||
GroupOptions,
|
GroupOptions,
|
||||||
GroupPanelViewState,
|
GroupPanelViewState,
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
DockviewGroupPanel,
|
DockviewGroupPanel,
|
||||||
DockviewGroupPanelApi,
|
DockviewGroupPanelApi,
|
||||||
} from './dockviewGroupPanel';
|
} from './dockviewGroupPanel';
|
||||||
import { ISplitviewStyles, Orientation } from '../splitview/core/splitview';
|
import { ISplitviewStyles, Orientation } from '../splitview/splitview';
|
||||||
import { FrameworkFactory } from '../types';
|
import { FrameworkFactory } from '../types';
|
||||||
import { PanelTransfer } from '../dnd/dataTransfer';
|
import { PanelTransfer } from '../dnd/dataTransfer';
|
||||||
import { IDisposable } from '../lifecycle';
|
import { IDisposable } from '../lifecycle';
|
||||||
|
@ -3,11 +3,7 @@ import { getGridLocation, Gridview, IGridView } from './gridview';
|
|||||||
import { Position } from '../dnd/droptarget';
|
import { Position } from '../dnd/droptarget';
|
||||||
import { CompositeDisposable, IValueDisposable } from '../lifecycle';
|
import { CompositeDisposable, IValueDisposable } from '../lifecycle';
|
||||||
import { sequentialNumberGenerator } from '../math';
|
import { sequentialNumberGenerator } from '../math';
|
||||||
import {
|
import { ISplitviewStyles, Orientation, Sizing } from '../splitview/splitview';
|
||||||
ISplitviewStyles,
|
|
||||||
Orientation,
|
|
||||||
Sizing,
|
|
||||||
} from '../splitview/core/splitview';
|
|
||||||
import { IPanel } from '../panel/types';
|
import { IPanel } from '../panel/types';
|
||||||
import { MovementOptions2 } from '../dockview/options';
|
import { MovementOptions2 } from '../dockview/options';
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
Sizing,
|
Sizing,
|
||||||
LayoutPriority,
|
LayoutPriority,
|
||||||
ISplitviewStyles,
|
ISplitviewStyles,
|
||||||
} from '../splitview/core/splitview';
|
} from '../splitview/splitview';
|
||||||
import { Emitter, Event } from '../events';
|
import { Emitter, Event } from '../events';
|
||||||
import { INodeDescriptor } from './gridview';
|
import { INodeDescriptor } from './gridview';
|
||||||
import { LeafNode } from './leafNode';
|
import { LeafNode } from './leafNode';
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
LayoutPriority,
|
LayoutPriority,
|
||||||
Orientation,
|
Orientation,
|
||||||
Sizing,
|
Sizing,
|
||||||
} from '../splitview/core/splitview';
|
} from '../splitview/splitview';
|
||||||
import { tail } from '../array';
|
import { tail } from '../array';
|
||||||
import { LeafNode } from './leafNode';
|
import { LeafNode } from './leafNode';
|
||||||
import { BranchNode } from './branchNode';
|
import { BranchNode } from './branchNode';
|
||||||
|
@ -22,7 +22,7 @@ import {
|
|||||||
IGridviewPanel,
|
IGridviewPanel,
|
||||||
} from './gridviewPanel';
|
} from './gridviewPanel';
|
||||||
import { BaseComponentOptions } from '../panel/types';
|
import { BaseComponentOptions } from '../panel/types';
|
||||||
import { Orientation, Sizing } from '../splitview/core/splitview';
|
import { Orientation, Sizing } from '../splitview/splitview';
|
||||||
import { createComponent } from '../panel/componentFactory';
|
import { createComponent } from '../panel/componentFactory';
|
||||||
import { Emitter, Event } from '../events';
|
import { Emitter, Event } from '../events';
|
||||||
import { Position } from '../dnd/droptarget';
|
import { Position } from '../dnd/droptarget';
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
GridviewPanelApi,
|
GridviewPanelApi,
|
||||||
GridviewPanelApiImpl,
|
GridviewPanelApiImpl,
|
||||||
} from '../api/gridviewPanelApi';
|
} from '../api/gridviewPanelApi';
|
||||||
import { LayoutPriority } from '../splitview/core/splitview';
|
import { LayoutPriority } from '../splitview/splitview';
|
||||||
import { Emitter, Event } from '../events';
|
import { Emitter, Event } from '../events';
|
||||||
import { IViewSize } from './gridview';
|
import { IViewSize } from './gridview';
|
||||||
|
|
||||||
|
@ -3,11 +3,7 @@
|
|||||||
* https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
|
* https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import {
|
import { IView, LayoutPriority, Orientation } from '../splitview/splitview';
|
||||||
IView,
|
|
||||||
LayoutPriority,
|
|
||||||
Orientation,
|
|
||||||
} from '../splitview/core/splitview';
|
|
||||||
import { Emitter, Event } from '../events';
|
import { Emitter, Event } from '../events';
|
||||||
import { IGridView } from './gridview';
|
import { IGridView } from './gridview';
|
||||||
import { IDisposable } from '../lifecycle';
|
import { IDisposable } from '../lifecycle';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { GridviewPanel } from './gridviewPanel';
|
import { GridviewPanel } from './gridviewPanel';
|
||||||
import { ISplitviewStyles, Orientation } from '../splitview/core/splitview';
|
import { ISplitviewStyles, Orientation } from '../splitview/splitview';
|
||||||
import { FrameworkFactory } from '../types';
|
import { FrameworkFactory } from '../types';
|
||||||
|
|
||||||
export interface GridviewComponentOptions {
|
export interface GridviewComponentOptions {
|
||||||
|
@ -18,8 +18,8 @@ export {
|
|||||||
export * from './panel/types';
|
export * from './panel/types';
|
||||||
export * from './panel/componentFactory';
|
export * from './panel/componentFactory';
|
||||||
|
|
||||||
export * from './splitview/core/splitview';
|
export * from './splitview/splitview';
|
||||||
export * from './splitview/core/options';
|
export * from './splitview/options';
|
||||||
|
|
||||||
export * from './paneview/paneview';
|
export * from './paneview/paneview';
|
||||||
export * from './gridview/gridview';
|
export * from './gridview/gridview';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { IDisposable } from '../lifecycle';
|
import { IDisposable } from '../lifecycle';
|
||||||
import { LayoutPriority } from '../splitview/core/splitview';
|
import { LayoutPriority } from '../splitview/splitview';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A key-value object of anything that is a valid JavaScript Object.
|
* A key-value object of anything that is a valid JavaScript Object.
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
import { Droptarget, DroptargetEvent } from '../dnd/droptarget';
|
import { Droptarget, DroptargetEvent } from '../dnd/droptarget';
|
||||||
import { Emitter } from '../events';
|
import { Emitter } from '../events';
|
||||||
import { IDisposable } from '../lifecycle';
|
import { IDisposable } from '../lifecycle';
|
||||||
import { Orientation } from '../splitview/core/splitview';
|
import { Orientation } from '../splitview/splitview';
|
||||||
import { IPaneviewComponent } from './paneviewComponent';
|
import { IPaneviewComponent } from './paneviewComponent';
|
||||||
import {
|
import {
|
||||||
IPaneviewPanel,
|
IPaneviewPanel,
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
Orientation,
|
Orientation,
|
||||||
ISplitViewDescriptor,
|
ISplitViewDescriptor,
|
||||||
Sizing,
|
Sizing,
|
||||||
} from '../splitview/core/splitview';
|
} from '../splitview/splitview';
|
||||||
import { CompositeDisposable, IDisposable } from '../lifecycle';
|
import { CompositeDisposable, IDisposable } from '../lifecycle';
|
||||||
import { Emitter, Event } from '../events';
|
import { Emitter, Event } from '../events';
|
||||||
import { addClasses, removeClasses } from '../dom';
|
import { addClasses, removeClasses } from '../dom';
|
||||||
|
@ -6,11 +6,7 @@ import {
|
|||||||
IDisposable,
|
IDisposable,
|
||||||
MutableDisposable,
|
MutableDisposable,
|
||||||
} from '../lifecycle';
|
} from '../lifecycle';
|
||||||
import {
|
import { LayoutPriority, Orientation, Sizing } from '../splitview/splitview';
|
||||||
LayoutPriority,
|
|
||||||
Orientation,
|
|
||||||
Sizing,
|
|
||||||
} from '../splitview/core/splitview';
|
|
||||||
import { PaneviewComponentOptions } from './options';
|
import { PaneviewComponentOptions } from './options';
|
||||||
import { Paneview } from './paneview';
|
import { Paneview } from './paneview';
|
||||||
import {
|
import {
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
PanelUpdateEvent,
|
PanelUpdateEvent,
|
||||||
Parameters,
|
Parameters,
|
||||||
} from '../panel/types';
|
} from '../panel/types';
|
||||||
import { IView, Orientation } from '../splitview/core/splitview';
|
import { IView, Orientation } from '../splitview/splitview';
|
||||||
|
|
||||||
export interface PanePanelViewState extends BasePanelViewState {
|
export interface PanePanelViewState extends BasePanelViewState {
|
||||||
headerComponent?: string;
|
headerComponent?: string;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { IPanel, PanelInitParameters } from '../../panel/types';
|
import { IPanel, PanelInitParameters } from '../panel/types';
|
||||||
import { IView, SplitViewOptions, LayoutPriority } from './splitview';
|
import { IView, SplitViewOptions, LayoutPriority } from './splitview';
|
||||||
import { FrameworkFactory } from '../../types';
|
import { FrameworkFactory } from '../types';
|
||||||
import { SplitviewPanel } from '../splitviewPanel';
|
import { SplitviewPanel } from './splitviewPanel';
|
||||||
import { SplitviewComponent } from '../splitviewComponent';
|
import { SplitviewComponent } from './splitviewComponent';
|
||||||
|
|
||||||
export interface PanelViewInitParameters extends PanelInitParameters {
|
export interface PanelViewInitParameters extends PanelInitParameters {
|
||||||
minimumSize?: number;
|
minimumSize?: number;
|
@ -8,10 +8,10 @@ import {
|
|||||||
addClasses,
|
addClasses,
|
||||||
toggleClass,
|
toggleClass,
|
||||||
getElementsByTagName,
|
getElementsByTagName,
|
||||||
} from '../../dom';
|
} from '../dom';
|
||||||
import { clamp } from '../../math';
|
import { clamp } from '../math';
|
||||||
import { Event, Emitter } from '../../events';
|
import { Event, Emitter } from '../events';
|
||||||
import { pushToStart, pushToEnd, range, firstIndex } from '../../array';
|
import { pushToStart, pushToEnd, range, firstIndex } from '../array';
|
||||||
import { ViewItem } from './viewItem';
|
import { ViewItem } from './viewItem';
|
||||||
|
|
||||||
export enum Orientation {
|
export enum Orientation {
|
@ -10,8 +10,8 @@ import {
|
|||||||
Orientation,
|
Orientation,
|
||||||
Sizing,
|
Sizing,
|
||||||
Splitview,
|
Splitview,
|
||||||
} from './core/splitview';
|
} from './splitview';
|
||||||
import { SplitviewComponentOptions } from './core/options';
|
import { SplitviewComponentOptions } from './options';
|
||||||
import { BaseComponentOptions } from '../panel/types';
|
import { BaseComponentOptions } from '../panel/types';
|
||||||
import { Emitter, Event } from '../events';
|
import { Emitter, Event } from '../events';
|
||||||
import { SplitviewPanel, ISplitviewPanel } from './splitviewPanel';
|
import { SplitviewPanel, ISplitviewPanel } from './splitviewPanel';
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { ISerializableView, PanelViewInitParameters } from './core/options';
|
import { ISerializableView, PanelViewInitParameters } from './options';
|
||||||
import {
|
import {
|
||||||
BasePanelView,
|
BasePanelView,
|
||||||
BasePanelViewExported,
|
BasePanelViewExported,
|
||||||
} from '../gridview/basePanelView';
|
} from '../gridview/basePanelView';
|
||||||
import { SplitviewPanelApiImpl } from '../api/splitviewPanelApi';
|
import { SplitviewPanelApiImpl } from '../api/splitviewPanelApi';
|
||||||
import { LayoutPriority, Orientation } from './core/splitview';
|
import { LayoutPriority, Orientation } from './splitview';
|
||||||
import { FunctionOrValue } from '../types';
|
import { FunctionOrValue } from '../types';
|
||||||
import { Emitter, Event } from '../events';
|
import { Emitter, Event } from '../events';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { IDisposable } from '../../lifecycle';
|
import { IDisposable } from '../lifecycle';
|
||||||
import { clamp } from '../../math';
|
import { clamp } from '../math';
|
||||||
import { IView, LayoutPriority } from './splitview';
|
import { IView, LayoutPriority } from './splitview';
|
||||||
|
|
||||||
export class ViewItem {
|
export class ViewItem {
|
@ -4,7 +4,6 @@ import { IDockviewPanelProps } from '../dockview/dockview';
|
|||||||
import {
|
import {
|
||||||
DockviewEmitter,
|
DockviewEmitter,
|
||||||
DockviewEvent,
|
DockviewEvent,
|
||||||
DockviewGroupPanel,
|
|
||||||
PanelUpdateEvent,
|
PanelUpdateEvent,
|
||||||
IContentRenderer,
|
IContentRenderer,
|
||||||
GroupPanelContentPartInitParameters,
|
GroupPanelContentPartInitParameters,
|
||||||
|
@ -3,7 +3,6 @@ import { ReactPart, ReactPortalStore } from '../react';
|
|||||||
import { IGroupPanelBaseProps } from './dockview';
|
import { IGroupPanelBaseProps } from './dockview';
|
||||||
import {
|
import {
|
||||||
PanelUpdateEvent,
|
PanelUpdateEvent,
|
||||||
DockviewGroupPanel,
|
|
||||||
ITabRenderer,
|
ITabRenderer,
|
||||||
GroupPanelPartInitParameters,
|
GroupPanelPartInitParameters,
|
||||||
} from 'dockview-core';
|
} from 'dockview-core';
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
import {
|
|
||||||
GroupPanelPartInitParameters,
|
|
||||||
IContentRenderer,
|
|
||||||
DockviewGroupPanel,
|
|
||||||
HostedContainer,
|
|
||||||
PanelUpdateEvent,
|
|
||||||
DockviewEvent,
|
|
||||||
} from 'dockview-core';
|
|
||||||
import { ReactPart, ReactPortalStore } from '../../react';
|
|
||||||
import { IDockviewPanelProps } from '../dockview';
|
|
||||||
|
|
||||||
export class ReactContentRenderer implements IContentRenderer {
|
|
||||||
private _hostedContainer: HostedContainer;
|
|
||||||
private _element: HTMLElement;
|
|
||||||
private part?: ReactPart<IDockviewPanelProps>;
|
|
||||||
private parameters: GroupPanelPartInitParameters | undefined;
|
|
||||||
|
|
||||||
get element(): HTMLElement {
|
|
||||||
return this._element;
|
|
||||||
}
|
|
||||||
|
|
||||||
get onDidBlur(): DockviewEvent<void> {
|
|
||||||
return this._hostedContainer.onDidBlur;
|
|
||||||
}
|
|
||||||
|
|
||||||
get onDidFocus(): DockviewEvent<void> {
|
|
||||||
return this._hostedContainer.onDidFocus;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public readonly id: string,
|
|
||||||
private readonly component: React.FunctionComponent<IDockviewPanelProps>,
|
|
||||||
private readonly reactPortalStore: ReactPortalStore
|
|
||||||
) {
|
|
||||||
this._hostedContainer = new HostedContainer({
|
|
||||||
id,
|
|
||||||
parent: document
|
|
||||||
.getElementsByClassName('dockview')
|
|
||||||
.item(0) as HTMLElement,
|
|
||||||
});
|
|
||||||
|
|
||||||
this._element = document.createElement('div');
|
|
||||||
this._element.style.height = '100%';
|
|
||||||
this._element.style.width = '100%';
|
|
||||||
}
|
|
||||||
|
|
||||||
focus(): void {
|
|
||||||
// noop
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(parameters: GroupPanelPartInitParameters): void {
|
|
||||||
this.parameters = parameters;
|
|
||||||
|
|
||||||
parameters.api.onDidVisibilityChange((event) => {
|
|
||||||
if (event.isVisible) {
|
|
||||||
this._hostedContainer.show();
|
|
||||||
this._hostedContainer.layout(this.element);
|
|
||||||
} else {
|
|
||||||
this._hostedContainer.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.part = new ReactPart(
|
|
||||||
this._hostedContainer.element,
|
|
||||||
this.reactPortalStore,
|
|
||||||
this.component,
|
|
||||||
{
|
|
||||||
params: parameters.params,
|
|
||||||
api: parameters.api,
|
|
||||||
containerApi: parameters.containerApi,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public update(params: PanelUpdateEvent): void {
|
|
||||||
if (this.parameters) {
|
|
||||||
this.parameters.params = params.params;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.part?.update(params.params);
|
|
||||||
}
|
|
||||||
|
|
||||||
public layout(_width: number, _height: number): void {
|
|
||||||
this._hostedContainer.layout(this.element);
|
|
||||||
}
|
|
||||||
|
|
||||||
public dispose(): void {
|
|
||||||
this.part?.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
import {
|
|
||||||
GroupPanelPartInitParameters,
|
|
||||||
IContentRenderer,
|
|
||||||
DockviewGroupPanel,
|
|
||||||
HostedContainer,
|
|
||||||
PanelUpdateEvent,
|
|
||||||
} from 'dockview-core';
|
|
||||||
|
|
||||||
export class WebviewContentRenderer implements IContentRenderer {
|
|
||||||
private _hostedContainer: HostedContainer;
|
|
||||||
private _element: HTMLElement;
|
|
||||||
private parameters: GroupPanelPartInitParameters | undefined;
|
|
||||||
|
|
||||||
get element(): HTMLElement {
|
|
||||||
return this._element;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(public readonly id: string) {
|
|
||||||
this._hostedContainer = new HostedContainer({ id });
|
|
||||||
|
|
||||||
this._element = document.createElement('div');
|
|
||||||
this._element.style.height = '100%';
|
|
||||||
this._element.style.width = '100%';
|
|
||||||
}
|
|
||||||
|
|
||||||
focus(): void {
|
|
||||||
// noop
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(parameters: GroupPanelPartInitParameters): void {
|
|
||||||
this.parameters = parameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public update(params: PanelUpdateEvent): void {
|
|
||||||
if (this.parameters) {
|
|
||||||
this.parameters.params = params.params;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public layout(_width: number, _height: number): void {
|
|
||||||
this._hostedContainer.layout(this._element);
|
|
||||||
}
|
|
||||||
|
|
||||||
public dispose(): void {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user