dockview-core 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/cjs/api/component.api.d.ts +145 -0
- package/dist/cjs/api/component.api.js +579 -0
- package/dist/cjs/api/component.api.js.map +1 -0
- package/dist/cjs/api/dockviewPanelApi.d.ts +34 -0
- package/dist/cjs/api/dockviewPanelApi.js +84 -0
- package/dist/cjs/api/dockviewPanelApi.js.map +1 -0
- package/dist/cjs/api/gridviewPanelApi.d.ts +37 -0
- package/dist/cjs/api/gridviewPanelApi.js +48 -0
- package/dist/cjs/api/gridviewPanelApi.js.map +1 -0
- package/dist/cjs/api/panelApi.d.ts +88 -0
- package/dist/cjs/api/panelApi.js +138 -0
- package/dist/cjs/api/panelApi.js.map +1 -0
- package/dist/cjs/api/paneviewPanelApi.d.ts +26 -0
- package/dist/cjs/api/paneviewPanelApi.js +58 -0
- package/dist/cjs/api/paneviewPanelApi.js.map +1 -0
- package/dist/cjs/api/splitviewPanelApi.d.ts +32 -0
- package/dist/cjs/api/splitviewPanelApi.js +48 -0
- package/dist/cjs/api/splitviewPanelApi.js.map +1 -0
- package/dist/cjs/array.d.ts +12 -0
- package/dist/cjs/array.js +59 -0
- package/dist/cjs/array.js.map +1 -0
- package/dist/cjs/dnd/abstractDragHandler.d.ts +11 -0
- package/dist/cjs/dnd/abstractDragHandler.js +126 -0
- package/dist/cjs/dnd/abstractDragHandler.js.map +1 -0
- package/dist/cjs/dnd/dataTransfer.d.ts +31 -0
- package/dist/cjs/dnd/dataTransfer.js +101 -0
- package/dist/cjs/dnd/dataTransfer.js.map +1 -0
- package/dist/cjs/dnd/dnd.d.ts +27 -0
- package/dist/cjs/dnd/dnd.js +60 -0
- package/dist/cjs/dnd/dnd.js.map +1 -0
- package/dist/cjs/dnd/droptarget.d.ts +42 -0
- package/dist/cjs/dnd/droptarget.js +281 -0
- package/dist/cjs/dnd/droptarget.js.map +1 -0
- package/dist/cjs/dnd/ghost.d.ts +1 -0
- package/dist/cjs/dnd/ghost.js +16 -0
- package/dist/cjs/dnd/ghost.js.map +1 -0
- package/dist/cjs/dnd/groupDragHandler.d.ts +11 -0
- package/dist/cjs/dnd/groupDragHandler.js +62 -0
- package/dist/cjs/dnd/groupDragHandler.js.map +1 -0
- package/dist/cjs/dockview/components/panel/content.d.ts +30 -0
- package/dist/cjs/dockview/components/panel/content.js +101 -0
- package/dist/cjs/dockview/components/panel/content.js.map +1 -0
- package/dist/cjs/dockview/components/tab/defaultTab.d.ts +21 -0
- package/dist/cjs/dockview/components/tab/defaultTab.js +106 -0
- package/dist/cjs/dockview/components/tab/defaultTab.js.map +1 -0
- package/dist/cjs/dockview/components/tab/tab.d.ts +31 -0
- package/dist/cjs/dockview/components/tab/tab.js +125 -0
- package/dist/cjs/dockview/components/tab/tab.js.map +1 -0
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +63 -0
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +248 -0
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js.map +1 -0
- package/dist/cjs/dockview/components/titlebar/voidContainer.d.ts +15 -0
- package/dist/cjs/dockview/components/titlebar/voidContainer.js +74 -0
- package/dist/cjs/dockview/components/titlebar/voidContainer.js.map +1 -0
- package/dist/cjs/dockview/components/watermark/watermark.d.ts +18 -0
- package/dist/cjs/dockview/components/watermark/watermark.js +87 -0
- package/dist/cjs/dockview/components/watermark/watermark.js.map +1 -0
- package/dist/cjs/dockview/deserializer.d.ts +12 -0
- package/dist/cjs/dockview/deserializer.js +46 -0
- package/dist/cjs/dockview/deserializer.js.map +1 -0
- package/dist/cjs/dockview/dockviewComponent.d.ts +126 -0
- package/dist/cjs/dockview/dockviewComponent.js +772 -0
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -0
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +31 -0
- package/dist/cjs/dockview/dockviewGroupPanel.js +97 -0
- package/dist/cjs/dockview/dockviewGroupPanel.js.map +1 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +176 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +579 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js.map +1 -0
- package/dist/cjs/dockview/dockviewPanel.d.ts +40 -0
- package/dist/cjs/dockview/dockviewPanel.js +150 -0
- package/dist/cjs/dockview/dockviewPanel.js.map +1 -0
- package/dist/cjs/dockview/dockviewPanelModel.d.ts +34 -0
- package/dist/cjs/dockview/dockviewPanelModel.js +93 -0
- package/dist/cjs/dockview/dockviewPanelModel.js.map +1 -0
- package/dist/cjs/dockview/options.d.ts +116 -0
- package/dist/cjs/dockview/options.js +32 -0
- package/dist/cjs/dockview/options.js.map +1 -0
- package/dist/cjs/dockview/types.d.ts +67 -0
- package/dist/cjs/dockview/types.js +11 -0
- package/dist/cjs/dockview/types.js.map +1 -0
- package/dist/cjs/dom.d.ts +14 -0
- package/dist/cjs/dom.js +183 -0
- package/dist/cjs/dom.js.map +1 -0
- package/dist/cjs/events.d.ts +30 -0
- package/dist/cjs/events.js +130 -0
- package/dist/cjs/events.js.map +1 -0
- package/dist/cjs/gridview/baseComponentGridview.d.ts +87 -0
- package/dist/cjs/gridview/baseComponentGridview.js +280 -0
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -0
- package/dist/cjs/gridview/basePanelView.d.ts +40 -0
- package/dist/cjs/gridview/basePanelView.js +124 -0
- package/dist/cjs/gridview/basePanelView.js.map +1 -0
- package/dist/cjs/gridview/branchNode.d.ts +49 -0
- package/dist/cjs/gridview/branchNode.js +343 -0
- package/dist/cjs/gridview/branchNode.js.map +1 -0
- package/dist/cjs/gridview/gridview.d.ts +133 -0
- package/dist/cjs/gridview/gridview.js +511 -0
- package/dist/cjs/gridview/gridview.js.map +1 -0
- package/dist/cjs/gridview/gridviewComponent.d.ts +80 -0
- package/dist/cjs/gridview/gridviewComponent.js +325 -0
- package/dist/cjs/gridview/gridviewComponent.js.map +1 -0
- package/dist/cjs/gridview/gridviewPanel.d.ts +65 -0
- package/dist/cjs/gridview/gridviewPanel.js +215 -0
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -0
- package/dist/cjs/gridview/leafNode.d.ts +34 -0
- package/dist/cjs/gridview/leafNode.js +171 -0
- package/dist/cjs/gridview/leafNode.js.map +1 -0
- package/dist/cjs/gridview/options.d.ts +18 -0
- package/dist/cjs/gridview/options.js +3 -0
- package/dist/cjs/gridview/options.js.map +1 -0
- package/dist/cjs/gridview/types.d.ts +3 -0
- package/dist/cjs/gridview/types.js +3 -0
- package/dist/cjs/gridview/types.js.map +1 -0
- package/dist/cjs/index.d.ts +41 -0
- package/dist/cjs/index.js +64 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lifecycle.d.ts +22 -0
- package/dist/cjs/lifecycle.js +89 -0
- package/dist/cjs/lifecycle.js.map +1 -0
- package/dist/cjs/math.d.ts +5 -0
- package/dist/cjs/math.js +35 -0
- package/dist/cjs/math.js.map +1 -0
- package/dist/cjs/panel/componentFactory.d.ts +10 -0
- package/dist/cjs/panel/componentFactory.js +31 -0
- package/dist/cjs/panel/componentFactory.js.map +1 -0
- package/dist/cjs/panel/types.d.ts +33 -0
- package/dist/cjs/panel/types.js +3 -0
- package/dist/cjs/panel/types.js.map +1 -0
- package/dist/cjs/paneview/defaultPaneviewHeader.d.ts +21 -0
- package/dist/cjs/paneview/defaultPaneviewHeader.js +91 -0
- package/dist/cjs/paneview/defaultPaneviewHeader.js.map +1 -0
- package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +21 -0
- package/dist/cjs/paneview/draggablePaneviewPanel.js +132 -0
- package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -0
- package/dist/cjs/paneview/options.d.ts +27 -0
- package/dist/cjs/paneview/options.js +3 -0
- package/dist/cjs/paneview/options.js.map +1 -0
- package/dist/cjs/paneview/paneview.d.ts +40 -0
- package/dist/cjs/paneview/paneview.js +202 -0
- package/dist/cjs/paneview/paneview.js.map +1 -0
- package/dist/cjs/paneview/paneviewComponent.d.ts +129 -0
- package/dist/cjs/paneview/paneviewComponent.js +395 -0
- package/dist/cjs/paneview/paneviewComponent.js.map +1 -0
- package/dist/cjs/paneview/paneviewPanel.d.ts +92 -0
- package/dist/cjs/paneview/paneviewPanel.js +276 -0
- package/dist/cjs/paneview/paneviewPanel.js.map +1 -0
- package/dist/cjs/splitview/options.d.ts +26 -0
- package/dist/cjs/splitview/options.js +3 -0
- package/dist/cjs/splitview/options.js.map +1 -0
- package/dist/cjs/splitview/splitview.d.ts +127 -0
- package/dist/cjs/splitview/splitview.js +909 -0
- package/dist/cjs/splitview/splitview.js.map +1 -0
- package/dist/cjs/splitview/splitviewComponent.d.ts +101 -0
- package/dist/cjs/splitview/splitviewComponent.js +374 -0
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -0
- package/dist/cjs/splitview/splitviewPanel.d.ts +45 -0
- package/dist/cjs/splitview/splitviewPanel.js +180 -0
- package/dist/cjs/splitview/splitviewPanel.js.map +1 -0
- package/dist/cjs/splitview/viewItem.d.ts +25 -0
- package/dist/cjs/splitview/viewItem.js +120 -0
- package/dist/cjs/splitview/viewItem.js.map +1 -0
- package/dist/cjs/svg.d.ts +3 -0
- package/dist/cjs/svg.js +44 -0
- package/dist/cjs/svg.js.map +1 -0
- package/dist/cjs/types.d.ts +2 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/dockview-core.amd.js +6492 -0
- package/dist/dockview-core.amd.min.js +7 -0
- package/dist/dockview-core.amd.min.noStyle.js +7 -0
- package/dist/dockview-core.amd.noStyle.js +6462 -0
- package/dist/dockview-core.cjs.js +6490 -0
- package/dist/dockview-core.esm.js +6441 -0
- package/dist/dockview-core.esm.min.js +7 -0
- package/dist/dockview-core.js +6496 -0
- package/dist/dockview-core.min.js +7 -0
- package/dist/dockview-core.min.noStyle.js +7 -0
- package/dist/dockview-core.noStyle.js +6466 -0
- package/dist/esm/api/component.api.d.ts +145 -0
- package/dist/esm/api/component.api.js +329 -0
- package/dist/esm/api/dockviewPanelApi.d.ts +34 -0
- package/dist/esm/api/dockviewPanelApi.js +48 -0
- package/dist/esm/api/gridviewPanelApi.d.ts +37 -0
- package/dist/esm/api/gridviewPanelApi.js +25 -0
- package/dist/esm/api/panelApi.d.ts +88 -0
- package/dist/esm/api/panelApi.js +95 -0
- package/dist/esm/api/paneviewPanelApi.d.ts +26 -0
- package/dist/esm/api/paneviewPanelApi.js +27 -0
- package/dist/esm/api/splitviewPanelApi.d.ts +32 -0
- package/dist/esm/api/splitviewPanelApi.js +25 -0
- package/dist/esm/array.d.ts +12 -0
- package/dist/esm/array.js +49 -0
- package/dist/esm/dnd/abstractDragHandler.d.ts +11 -0
- package/dist/esm/dnd/abstractDragHandler.js +47 -0
- package/dist/esm/dnd/dataTransfer.d.ts +31 -0
- package/dist/esm/dnd/dataTransfer.js +69 -0
- package/dist/esm/dnd/dnd.d.ts +27 -0
- package/dist/esm/dnd/dnd.js +36 -0
- package/dist/esm/dnd/droptarget.d.ts +42 -0
- package/dist/esm/dnd/droptarget.js +250 -0
- package/dist/esm/dnd/ghost.d.ts +1 -0
- package/dist/esm/dnd/ghost.js +11 -0
- package/dist/esm/dnd/groupDragHandler.d.ts +11 -0
- package/dist/esm/dnd/groupDragHandler.js +38 -0
- package/dist/esm/dockview/components/panel/content.d.ts +30 -0
- package/dist/esm/dockview/components/panel/content.js +73 -0
- package/dist/esm/dockview/components/tab/defaultTab.d.ts +21 -0
- package/dist/esm/dockview/components/tab/defaultTab.js +67 -0
- package/dist/esm/dockview/components/tab/tab.d.ts +31 -0
- package/dist/esm/dockview/components/tab/tab.js +94 -0
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +63 -0
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +179 -0
- package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +15 -0
- package/dist/esm/dockview/components/titlebar/voidContainer.js +47 -0
- package/dist/esm/dockview/components/watermark/watermark.d.ts +18 -0
- package/dist/esm/dockview/components/watermark/watermark.js +60 -0
- package/dist/esm/dockview/deserializer.d.ts +12 -0
- package/dist/esm/dockview/deserializer.js +40 -0
- package/dist/esm/dockview/dockviewComponent.d.ts +126 -0
- package/dist/esm/dockview/dockviewComponent.js +612 -0
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +31 -0
- package/dist/esm/dockview/dockviewGroupPanel.js +50 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +176 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +449 -0
- package/dist/esm/dockview/dockviewPanel.d.ts +40 -0
- package/dist/esm/dockview/dockviewPanel.js +104 -0
- package/dist/esm/dockview/dockviewPanelModel.d.ts +34 -0
- package/dist/esm/dockview/dockviewPanelModel.js +68 -0
- package/dist/esm/dockview/options.d.ts +116 -0
- package/dist/esm/dockview/options.js +24 -0
- package/dist/esm/dockview/types.d.ts +67 -0
- package/dist/esm/dockview/types.js +7 -0
- package/dist/esm/dom.d.ts +14 -0
- package/dist/esm/dom.js +113 -0
- package/dist/esm/events.d.ts +30 -0
- package/dist/esm/events.js +88 -0
- package/dist/esm/gridview/baseComponentGridview.d.ts +87 -0
- package/dist/esm/gridview/baseComponentGridview.js +189 -0
- package/dist/esm/gridview/basePanelView.d.ts +40 -0
- package/dist/esm/gridview/basePanelView.js +74 -0
- package/dist/esm/gridview/branchNode.d.ts +49 -0
- package/dist/esm/gridview/branchNode.js +218 -0
- package/dist/esm/gridview/gridview.d.ts +133 -0
- package/dist/esm/gridview/gridview.js +423 -0
- package/dist/esm/gridview/gridviewComponent.d.ts +80 -0
- package/dist/esm/gridview/gridviewComponent.js +237 -0
- package/dist/esm/gridview/gridviewPanel.d.ts +65 -0
- package/dist/esm/gridview/gridviewPanel.js +151 -0
- package/dist/esm/gridview/leafNode.d.ts +34 -0
- package/dist/esm/gridview/leafNode.js +103 -0
- package/dist/esm/gridview/options.d.ts +18 -0
- package/dist/esm/gridview/options.js +1 -0
- package/dist/esm/gridview/types.d.ts +3 -0
- package/dist/esm/gridview/types.js +1 -0
- package/dist/esm/index.d.ts +41 -0
- package/dist/esm/index.js +35 -0
- package/dist/esm/lifecycle.d.ts +22 -0
- package/dist/esm/lifecycle.js +39 -0
- package/dist/esm/math.d.ts +5 -0
- package/dist/esm/math.js +28 -0
- package/dist/esm/panel/componentFactory.d.ts +10 -0
- package/dist/esm/panel/componentFactory.js +24 -0
- package/dist/esm/panel/types.d.ts +33 -0
- package/dist/esm/panel/types.js +1 -0
- package/dist/esm/paneview/defaultPaneviewHeader.d.ts +21 -0
- package/dist/esm/paneview/defaultPaneviewHeader.js +63 -0
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +21 -0
- package/dist/esm/paneview/draggablePaneviewPanel.js +92 -0
- package/dist/esm/paneview/options.d.ts +27 -0
- package/dist/esm/paneview/options.js +1 -0
- package/dist/esm/paneview/paneview.d.ts +40 -0
- package/dist/esm/paneview/paneview.js +145 -0
- package/dist/esm/paneview/paneviewComponent.d.ts +129 -0
- package/dist/esm/paneview/paneviewComponent.js +270 -0
- package/dist/esm/paneview/paneviewPanel.d.ts +92 -0
- package/dist/esm/paneview/paneviewPanel.js +192 -0
- package/dist/esm/splitview/options.d.ts +26 -0
- package/dist/esm/splitview/options.js +1 -0
- package/dist/esm/splitview/splitview.d.ts +127 -0
- package/dist/esm/splitview/splitview.js +689 -0
- package/dist/esm/splitview/splitviewComponent.d.ts +101 -0
- package/dist/esm/splitview/splitviewComponent.js +249 -0
- package/dist/esm/splitview/splitviewPanel.d.ts +45 -0
- package/dist/esm/splitview/splitviewPanel.js +108 -0
- package/dist/esm/splitview/viewItem.d.ts +25 -0
- package/dist/esm/splitview/viewItem.js +74 -0
- package/dist/esm/svg.d.ts +3 -0
- package/dist/esm/svg.js +31 -0
- package/dist/esm/types.d.ts +2 -0
- package/dist/esm/types.js +1 -0
- package/dist/styles/dockview.css +615 -0
- package/package.json +68 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { getRelativeLocation, getGridLocation, } from './gridview';
|
|
2
|
+
import { tail, sequenceEquals } from '../array';
|
|
3
|
+
import { CompositeDisposable } from '../lifecycle';
|
|
4
|
+
import { BaseGrid, toTarget, } from './baseComponentGridview';
|
|
5
|
+
import { createComponent } from '../panel/componentFactory';
|
|
6
|
+
import { Emitter } from '../events';
|
|
7
|
+
export class GridviewComponent extends BaseGrid {
|
|
8
|
+
get orientation() {
|
|
9
|
+
return this.gridview.orientation;
|
|
10
|
+
}
|
|
11
|
+
set orientation(value) {
|
|
12
|
+
this.gridview.orientation = value;
|
|
13
|
+
}
|
|
14
|
+
get options() {
|
|
15
|
+
return this._options;
|
|
16
|
+
}
|
|
17
|
+
get deserializer() {
|
|
18
|
+
return this._deserializer;
|
|
19
|
+
}
|
|
20
|
+
set deserializer(value) {
|
|
21
|
+
this._deserializer = value;
|
|
22
|
+
}
|
|
23
|
+
constructor(element, options) {
|
|
24
|
+
super(element, {
|
|
25
|
+
proportionalLayout: options.proportionalLayout,
|
|
26
|
+
orientation: options.orientation,
|
|
27
|
+
styles: options.styles,
|
|
28
|
+
});
|
|
29
|
+
this._onDidLayoutfromJSON = new Emitter();
|
|
30
|
+
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
31
|
+
this._options = options;
|
|
32
|
+
if (!this.options.components) {
|
|
33
|
+
this.options.components = {};
|
|
34
|
+
}
|
|
35
|
+
if (!this.options.frameworkComponents) {
|
|
36
|
+
this.options.frameworkComponents = {};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
updateOptions(options) {
|
|
40
|
+
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
41
|
+
this.gridview.orientation !== options.orientation;
|
|
42
|
+
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
43
|
+
if (hasOrientationChanged) {
|
|
44
|
+
this.gridview.orientation = options.orientation;
|
|
45
|
+
}
|
|
46
|
+
this.layout(this.gridview.width, this.gridview.height, true);
|
|
47
|
+
}
|
|
48
|
+
removePanel(panel) {
|
|
49
|
+
this.removeGroup(panel);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Serialize the current state of the layout
|
|
53
|
+
*
|
|
54
|
+
* @returns A JSON respresentation of the layout
|
|
55
|
+
*/
|
|
56
|
+
toJSON() {
|
|
57
|
+
var _a;
|
|
58
|
+
const data = this.gridview.serialize();
|
|
59
|
+
return {
|
|
60
|
+
grid: data,
|
|
61
|
+
activePanel: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
setVisible(panel, visible) {
|
|
65
|
+
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
66
|
+
}
|
|
67
|
+
setActive(panel) {
|
|
68
|
+
this._groups.forEach((value, _key) => {
|
|
69
|
+
value.value.setActive(panel === value.value);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
focus() {
|
|
73
|
+
var _a;
|
|
74
|
+
(_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
|
|
75
|
+
}
|
|
76
|
+
fromJSON(serializedGridview) {
|
|
77
|
+
this.clear();
|
|
78
|
+
const { grid, activePanel } = serializedGridview;
|
|
79
|
+
const queue = [];
|
|
80
|
+
this.gridview.deserialize(grid, {
|
|
81
|
+
fromJSON: (node) => {
|
|
82
|
+
const { data } = node;
|
|
83
|
+
const view = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
|
|
84
|
+
? {
|
|
85
|
+
createComponent: this.options.frameworkComponentFactory
|
|
86
|
+
.createComponent,
|
|
87
|
+
}
|
|
88
|
+
: undefined);
|
|
89
|
+
queue.push(() => view.init({
|
|
90
|
+
params: data.params,
|
|
91
|
+
minimumWidth: data.minimumWidth,
|
|
92
|
+
maximumWidth: data.maximumWidth,
|
|
93
|
+
minimumHeight: data.minimumHeight,
|
|
94
|
+
maximumHeight: data.maximumHeight,
|
|
95
|
+
priority: data.priority,
|
|
96
|
+
snap: !!data.snap,
|
|
97
|
+
accessor: this,
|
|
98
|
+
isVisible: node.visible,
|
|
99
|
+
}));
|
|
100
|
+
this._onDidAddGroup.fire(view);
|
|
101
|
+
this.registerPanel(view);
|
|
102
|
+
return view;
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
this.layout(this.width, this.height, true);
|
|
106
|
+
queue.forEach((f) => f());
|
|
107
|
+
if (typeof activePanel === 'string') {
|
|
108
|
+
const panel = this.getPanel(activePanel);
|
|
109
|
+
if (panel) {
|
|
110
|
+
this.doSetGroupActive(panel);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
this._onDidLayoutfromJSON.fire();
|
|
114
|
+
}
|
|
115
|
+
clear() {
|
|
116
|
+
const hasActiveGroup = this.activeGroup;
|
|
117
|
+
const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
|
|
118
|
+
for (const group of groups) {
|
|
119
|
+
group.disposable.dispose();
|
|
120
|
+
this.doRemoveGroup(group.value, { skipActive: true });
|
|
121
|
+
}
|
|
122
|
+
if (hasActiveGroup) {
|
|
123
|
+
this.doSetGroupActive(undefined);
|
|
124
|
+
}
|
|
125
|
+
this.gridview.clear();
|
|
126
|
+
}
|
|
127
|
+
movePanel(panel, options) {
|
|
128
|
+
var _a;
|
|
129
|
+
let relativeLocation;
|
|
130
|
+
const removedPanel = this.gridview.remove(panel);
|
|
131
|
+
const referenceGroup = (_a = this._groups.get(options.reference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
132
|
+
if (!referenceGroup) {
|
|
133
|
+
throw new Error(`reference group ${options.reference} does not exist`);
|
|
134
|
+
}
|
|
135
|
+
const target = toTarget(options.direction);
|
|
136
|
+
if (target === 'center') {
|
|
137
|
+
throw new Error(`${target} not supported as an option`);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const location = getGridLocation(referenceGroup.element);
|
|
141
|
+
relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
142
|
+
}
|
|
143
|
+
this.doAddGroup(removedPanel, relativeLocation, options.size);
|
|
144
|
+
}
|
|
145
|
+
addPanel(options) {
|
|
146
|
+
var _a, _b;
|
|
147
|
+
let relativeLocation = options.location || [0];
|
|
148
|
+
if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
|
|
149
|
+
const referenceGroup = (_b = this._groups.get(options.position.referencePanel)) === null || _b === void 0 ? void 0 : _b.value;
|
|
150
|
+
if (!referenceGroup) {
|
|
151
|
+
throw new Error(`reference group ${options.position.referencePanel} does not exist`);
|
|
152
|
+
}
|
|
153
|
+
const target = toTarget(options.position.direction);
|
|
154
|
+
if (target === 'center') {
|
|
155
|
+
throw new Error(`${target} not supported as an option`);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const location = getGridLocation(referenceGroup.element);
|
|
159
|
+
relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
|
|
163
|
+
? {
|
|
164
|
+
createComponent: this.options.frameworkComponentFactory
|
|
165
|
+
.createComponent,
|
|
166
|
+
}
|
|
167
|
+
: undefined);
|
|
168
|
+
view.init({
|
|
169
|
+
params: options.params || {},
|
|
170
|
+
minimumWidth: options.minimumWidth,
|
|
171
|
+
maximumWidth: options.maximumWidth,
|
|
172
|
+
minimumHeight: options.minimumHeight,
|
|
173
|
+
maximumHeight: options.maximumHeight,
|
|
174
|
+
priority: options.priority,
|
|
175
|
+
snap: !!options.snap,
|
|
176
|
+
accessor: this,
|
|
177
|
+
isVisible: true,
|
|
178
|
+
});
|
|
179
|
+
this.registerPanel(view);
|
|
180
|
+
this.doAddGroup(view, relativeLocation, options.size);
|
|
181
|
+
return view;
|
|
182
|
+
}
|
|
183
|
+
registerPanel(panel) {
|
|
184
|
+
const disposable = new CompositeDisposable(panel.api.onDidFocusChange((event) => {
|
|
185
|
+
if (!event.isFocused) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
this._groups.forEach((groupItem) => {
|
|
189
|
+
const group = groupItem.value;
|
|
190
|
+
if (group !== panel) {
|
|
191
|
+
group.setActive(false);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
group.setActive(true);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}));
|
|
198
|
+
this._groups.set(panel.id, {
|
|
199
|
+
value: panel,
|
|
200
|
+
disposable,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
moveGroup(referenceGroup, groupId, target) {
|
|
204
|
+
const sourceGroup = this.getPanel(groupId);
|
|
205
|
+
if (!sourceGroup) {
|
|
206
|
+
throw new Error('invalid operation');
|
|
207
|
+
}
|
|
208
|
+
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
209
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
210
|
+
const [targetParentLocation, to] = tail(targetLocation);
|
|
211
|
+
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
212
|
+
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
213
|
+
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
214
|
+
// special case when 'swapping' two views within same grid location
|
|
215
|
+
// if a group has one tab - we are essentially moving the 'group'
|
|
216
|
+
// which is equivalent to swapping two views in this case
|
|
217
|
+
this.gridview.moveView(sourceParentLocation, from, to);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
// source group will become empty so delete the group
|
|
221
|
+
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
222
|
+
skipActive: true,
|
|
223
|
+
skipDispose: true,
|
|
224
|
+
});
|
|
225
|
+
// after deleting the group we need to re-evaulate the ref location
|
|
226
|
+
const updatedReferenceLocation = getGridLocation(referenceGroup.element);
|
|
227
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);
|
|
228
|
+
this.doAddGroup(targetGroup, location);
|
|
229
|
+
}
|
|
230
|
+
removeGroup(group) {
|
|
231
|
+
super.removeGroup(group);
|
|
232
|
+
}
|
|
233
|
+
dispose() {
|
|
234
|
+
super.dispose();
|
|
235
|
+
this._onDidLayoutfromJSON.dispose();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { PanelInitParameters } from '../panel/types';
|
|
2
|
+
import { GridviewComponent, IGridPanelComponentView } from './gridviewComponent';
|
|
3
|
+
import { BasePanelView, BasePanelViewExported, BasePanelViewState } from './basePanelView';
|
|
4
|
+
import { GridviewPanelApi, GridviewPanelApiImpl } from '../api/gridviewPanelApi';
|
|
5
|
+
import { LayoutPriority } from '../splitview/splitview';
|
|
6
|
+
import { Event } from '../events';
|
|
7
|
+
import { IViewSize } from './gridview';
|
|
8
|
+
export interface GridviewInitParameters extends PanelInitParameters {
|
|
9
|
+
minimumWidth?: number;
|
|
10
|
+
maximumWidth?: number;
|
|
11
|
+
minimumHeight?: number;
|
|
12
|
+
maximumHeight?: number;
|
|
13
|
+
priority?: LayoutPriority;
|
|
14
|
+
snap?: boolean;
|
|
15
|
+
accessor: GridviewComponent;
|
|
16
|
+
isVisible?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IGridviewPanel extends BasePanelViewExported<GridviewPanelApi> {
|
|
19
|
+
readonly minimumWidth: number;
|
|
20
|
+
readonly maximumWidth: number;
|
|
21
|
+
readonly minimumHeight: number;
|
|
22
|
+
readonly maximumHeight: number;
|
|
23
|
+
readonly priority: LayoutPriority | undefined;
|
|
24
|
+
readonly snap: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare abstract class GridviewPanel extends BasePanelView<GridviewPanelApiImpl> implements IGridPanelComponentView, IGridviewPanel {
|
|
27
|
+
private _evaluatedMinimumWidth;
|
|
28
|
+
private _evaluatedMaximumWidth;
|
|
29
|
+
private _evaluatedMinimumHeight;
|
|
30
|
+
private _evaluatedMaximumHeight;
|
|
31
|
+
private _minimumWidth;
|
|
32
|
+
private _minimumHeight;
|
|
33
|
+
private _maximumWidth;
|
|
34
|
+
private _maximumHeight;
|
|
35
|
+
private _priority?;
|
|
36
|
+
private _snap;
|
|
37
|
+
private readonly _onDidChange;
|
|
38
|
+
readonly onDidChange: Event<IViewSize | undefined>;
|
|
39
|
+
get priority(): LayoutPriority | undefined;
|
|
40
|
+
get snap(): boolean;
|
|
41
|
+
get minimumWidth(): number;
|
|
42
|
+
get minimumHeight(): number;
|
|
43
|
+
get maximumHeight(): number;
|
|
44
|
+
get maximumWidth(): number;
|
|
45
|
+
get isActive(): boolean;
|
|
46
|
+
constructor(id: string, component: string, options?: {
|
|
47
|
+
minimumWidth?: number;
|
|
48
|
+
maximumWidth?: number;
|
|
49
|
+
minimumHeight?: number;
|
|
50
|
+
maximumHeight?: number;
|
|
51
|
+
});
|
|
52
|
+
setVisible(isVisible: boolean): void;
|
|
53
|
+
setActive(isActive: boolean): void;
|
|
54
|
+
init(parameters: GridviewInitParameters): void;
|
|
55
|
+
private updateConstraints;
|
|
56
|
+
toJSON(): GridPanelViewState;
|
|
57
|
+
}
|
|
58
|
+
export interface GridPanelViewState extends BasePanelViewState {
|
|
59
|
+
minimumHeight?: number;
|
|
60
|
+
maximumHeight?: number;
|
|
61
|
+
minimumWidth?: number;
|
|
62
|
+
maximumWidth?: number;
|
|
63
|
+
snap?: boolean;
|
|
64
|
+
priority?: LayoutPriority;
|
|
65
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { BasePanelView, } from './basePanelView';
|
|
2
|
+
import { GridviewPanelApiImpl, } from '../api/gridviewPanelApi';
|
|
3
|
+
import { Emitter } from '../events';
|
|
4
|
+
export class GridviewPanel extends BasePanelView {
|
|
5
|
+
get priority() {
|
|
6
|
+
return this._priority;
|
|
7
|
+
}
|
|
8
|
+
get snap() {
|
|
9
|
+
return this._snap;
|
|
10
|
+
}
|
|
11
|
+
get minimumWidth() {
|
|
12
|
+
const width = typeof this._minimumWidth === 'function'
|
|
13
|
+
? this._minimumWidth()
|
|
14
|
+
: this._minimumWidth;
|
|
15
|
+
if (width !== this._evaluatedMinimumWidth) {
|
|
16
|
+
this._evaluatedMinimumWidth = width;
|
|
17
|
+
this.updateConstraints();
|
|
18
|
+
}
|
|
19
|
+
return width;
|
|
20
|
+
}
|
|
21
|
+
get minimumHeight() {
|
|
22
|
+
const height = typeof this._minimumHeight === 'function'
|
|
23
|
+
? this._minimumHeight()
|
|
24
|
+
: this._minimumHeight;
|
|
25
|
+
if (height !== this._evaluatedMinimumHeight) {
|
|
26
|
+
this._evaluatedMinimumHeight = height;
|
|
27
|
+
this.updateConstraints();
|
|
28
|
+
}
|
|
29
|
+
return height;
|
|
30
|
+
}
|
|
31
|
+
get maximumHeight() {
|
|
32
|
+
const height = typeof this._maximumHeight === 'function'
|
|
33
|
+
? this._maximumHeight()
|
|
34
|
+
: this._maximumHeight;
|
|
35
|
+
if (height !== this._evaluatedMaximumHeight) {
|
|
36
|
+
this._evaluatedMaximumHeight = height;
|
|
37
|
+
this.updateConstraints();
|
|
38
|
+
}
|
|
39
|
+
return height;
|
|
40
|
+
}
|
|
41
|
+
get maximumWidth() {
|
|
42
|
+
const width = typeof this._maximumWidth === 'function'
|
|
43
|
+
? this._maximumWidth()
|
|
44
|
+
: this._maximumWidth;
|
|
45
|
+
if (width !== this._evaluatedMaximumWidth) {
|
|
46
|
+
this._evaluatedMaximumWidth = width;
|
|
47
|
+
this.updateConstraints();
|
|
48
|
+
}
|
|
49
|
+
return width;
|
|
50
|
+
}
|
|
51
|
+
get isActive() {
|
|
52
|
+
return this.api.isActive;
|
|
53
|
+
}
|
|
54
|
+
constructor(id, component, options) {
|
|
55
|
+
super(id, component, new GridviewPanelApiImpl(id));
|
|
56
|
+
this._evaluatedMinimumWidth = 0;
|
|
57
|
+
this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
|
|
58
|
+
this._evaluatedMinimumHeight = 0;
|
|
59
|
+
this._evaluatedMaximumHeight = Number.MAX_SAFE_INTEGER;
|
|
60
|
+
this._minimumWidth = 0;
|
|
61
|
+
this._minimumHeight = 0;
|
|
62
|
+
this._maximumWidth = Number.MAX_SAFE_INTEGER;
|
|
63
|
+
this._maximumHeight = Number.MAX_SAFE_INTEGER;
|
|
64
|
+
this._snap = false;
|
|
65
|
+
this._onDidChange = new Emitter();
|
|
66
|
+
this.onDidChange = this._onDidChange.event;
|
|
67
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.minimumWidth) === 'number') {
|
|
68
|
+
this._minimumWidth = options.minimumWidth;
|
|
69
|
+
}
|
|
70
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.maximumWidth) === 'number') {
|
|
71
|
+
this._maximumWidth = options.maximumWidth;
|
|
72
|
+
}
|
|
73
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.minimumHeight) === 'number') {
|
|
74
|
+
this._minimumHeight = options.minimumHeight;
|
|
75
|
+
}
|
|
76
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.maximumHeight) === 'number') {
|
|
77
|
+
this._maximumHeight = options.maximumHeight;
|
|
78
|
+
}
|
|
79
|
+
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
80
|
+
this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
|
|
81
|
+
const { isVisible } = event;
|
|
82
|
+
const { accessor } = this._params;
|
|
83
|
+
accessor.setVisible(this, isVisible);
|
|
84
|
+
}), this.api.onActiveChange(() => {
|
|
85
|
+
const { accessor } = this._params;
|
|
86
|
+
accessor.setActive(this);
|
|
87
|
+
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
88
|
+
if (typeof event.minimumWidth === 'number' ||
|
|
89
|
+
typeof event.minimumWidth === 'function') {
|
|
90
|
+
this._minimumWidth = event.minimumWidth;
|
|
91
|
+
}
|
|
92
|
+
if (typeof event.minimumHeight === 'number' ||
|
|
93
|
+
typeof event.minimumHeight === 'function') {
|
|
94
|
+
this._minimumHeight = event.minimumHeight;
|
|
95
|
+
}
|
|
96
|
+
if (typeof event.maximumWidth === 'number' ||
|
|
97
|
+
typeof event.maximumWidth === 'function') {
|
|
98
|
+
this._maximumWidth = event.maximumWidth;
|
|
99
|
+
}
|
|
100
|
+
if (typeof event.maximumHeight === 'number' ||
|
|
101
|
+
typeof event.maximumHeight === 'function') {
|
|
102
|
+
this._maximumHeight = event.maximumHeight;
|
|
103
|
+
}
|
|
104
|
+
}), this.api.onDidSizeChange((event) => {
|
|
105
|
+
this._onDidChange.fire({
|
|
106
|
+
height: event.height,
|
|
107
|
+
width: event.width,
|
|
108
|
+
});
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
setVisible(isVisible) {
|
|
112
|
+
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
113
|
+
}
|
|
114
|
+
setActive(isActive) {
|
|
115
|
+
this.api._onDidActiveChange.fire({ isActive });
|
|
116
|
+
}
|
|
117
|
+
init(parameters) {
|
|
118
|
+
if (parameters.maximumHeight) {
|
|
119
|
+
this._maximumHeight = parameters.maximumHeight;
|
|
120
|
+
}
|
|
121
|
+
if (parameters.minimumHeight) {
|
|
122
|
+
this._minimumHeight = parameters.minimumHeight;
|
|
123
|
+
}
|
|
124
|
+
if (parameters.maximumWidth) {
|
|
125
|
+
this._maximumWidth = parameters.maximumWidth;
|
|
126
|
+
}
|
|
127
|
+
if (parameters.minimumWidth) {
|
|
128
|
+
this._minimumWidth = parameters.minimumWidth;
|
|
129
|
+
}
|
|
130
|
+
this._priority = parameters.priority;
|
|
131
|
+
this._snap = !!parameters.snap;
|
|
132
|
+
super.init(parameters);
|
|
133
|
+
if (typeof parameters.isVisible === 'boolean') {
|
|
134
|
+
this.setVisible(parameters.isVisible);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
updateConstraints() {
|
|
138
|
+
this.api._onDidConstraintsChange.fire({
|
|
139
|
+
minimumWidth: this._evaluatedMinimumWidth,
|
|
140
|
+
maximumWidth: this._evaluatedMaximumWidth,
|
|
141
|
+
minimumHeight: this._evaluatedMinimumHeight,
|
|
142
|
+
maximumHeight: this._evaluatedMaximumHeight,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
toJSON() {
|
|
146
|
+
const state = super.toJSON();
|
|
147
|
+
const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? undefined : value;
|
|
148
|
+
const minimum = (value) => (value <= 0 ? undefined : value);
|
|
149
|
+
return Object.assign(Object.assign({}, state), { minimumHeight: minimum(this.minimumHeight), maximumHeight: maximum(this.maximumHeight), minimumWidth: minimum(this.minimumWidth), maximumWidth: maximum(this.maximumWidth), snap: this.snap, priority: this.priority });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IView, LayoutPriority, Orientation } from '../splitview/splitview';
|
|
2
|
+
import { Event } from '../events';
|
|
3
|
+
import { IGridView } from './gridview';
|
|
4
|
+
export declare class LeafNode implements IView {
|
|
5
|
+
readonly view: IGridView;
|
|
6
|
+
readonly orientation: Orientation;
|
|
7
|
+
private readonly _onDidChange;
|
|
8
|
+
readonly onDidChange: Event<{
|
|
9
|
+
size?: number;
|
|
10
|
+
orthogonalSize?: number;
|
|
11
|
+
}>;
|
|
12
|
+
private _size;
|
|
13
|
+
private _orthogonalSize;
|
|
14
|
+
private _disposable;
|
|
15
|
+
private get minimumWidth();
|
|
16
|
+
private get maximumWidth();
|
|
17
|
+
private get minimumHeight();
|
|
18
|
+
private get maximumHeight();
|
|
19
|
+
get priority(): LayoutPriority | undefined;
|
|
20
|
+
get snap(): boolean | undefined;
|
|
21
|
+
get minimumSize(): number;
|
|
22
|
+
get maximumSize(): number;
|
|
23
|
+
get minimumOrthogonalSize(): number;
|
|
24
|
+
get maximumOrthogonalSize(): number;
|
|
25
|
+
get orthogonalSize(): number;
|
|
26
|
+
get size(): number;
|
|
27
|
+
get element(): HTMLElement;
|
|
28
|
+
get width(): number;
|
|
29
|
+
get height(): number;
|
|
30
|
+
constructor(view: IGridView, orientation: Orientation, orthogonalSize: number, size?: number);
|
|
31
|
+
setVisible(visible: boolean): void;
|
|
32
|
+
layout(size: number, orthogonalSize: number): void;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
|
|
3
|
+
* https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Orientation } from '../splitview/splitview';
|
|
6
|
+
import { Emitter } from '../events';
|
|
7
|
+
export class LeafNode {
|
|
8
|
+
get minimumWidth() {
|
|
9
|
+
return this.view.minimumWidth;
|
|
10
|
+
}
|
|
11
|
+
get maximumWidth() {
|
|
12
|
+
return this.view.maximumWidth;
|
|
13
|
+
}
|
|
14
|
+
get minimumHeight() {
|
|
15
|
+
return this.view.minimumHeight;
|
|
16
|
+
}
|
|
17
|
+
get maximumHeight() {
|
|
18
|
+
return this.view.maximumHeight;
|
|
19
|
+
}
|
|
20
|
+
get priority() {
|
|
21
|
+
return this.view.priority;
|
|
22
|
+
}
|
|
23
|
+
get snap() {
|
|
24
|
+
return this.view.snap;
|
|
25
|
+
}
|
|
26
|
+
get minimumSize() {
|
|
27
|
+
return this.orientation === Orientation.HORIZONTAL
|
|
28
|
+
? this.minimumHeight
|
|
29
|
+
: this.minimumWidth;
|
|
30
|
+
}
|
|
31
|
+
get maximumSize() {
|
|
32
|
+
return this.orientation === Orientation.HORIZONTAL
|
|
33
|
+
? this.maximumHeight
|
|
34
|
+
: this.maximumWidth;
|
|
35
|
+
}
|
|
36
|
+
get minimumOrthogonalSize() {
|
|
37
|
+
return this.orientation === Orientation.HORIZONTAL
|
|
38
|
+
? this.minimumWidth
|
|
39
|
+
: this.minimumHeight;
|
|
40
|
+
}
|
|
41
|
+
get maximumOrthogonalSize() {
|
|
42
|
+
return this.orientation === Orientation.HORIZONTAL
|
|
43
|
+
? this.maximumWidth
|
|
44
|
+
: this.maximumHeight;
|
|
45
|
+
}
|
|
46
|
+
get orthogonalSize() {
|
|
47
|
+
return this._orthogonalSize;
|
|
48
|
+
}
|
|
49
|
+
get size() {
|
|
50
|
+
return this._size;
|
|
51
|
+
}
|
|
52
|
+
get element() {
|
|
53
|
+
return this.view.element;
|
|
54
|
+
}
|
|
55
|
+
get width() {
|
|
56
|
+
return this.orientation === Orientation.HORIZONTAL
|
|
57
|
+
? this.orthogonalSize
|
|
58
|
+
: this.size;
|
|
59
|
+
}
|
|
60
|
+
get height() {
|
|
61
|
+
return this.orientation === Orientation.HORIZONTAL
|
|
62
|
+
? this.size
|
|
63
|
+
: this.orthogonalSize;
|
|
64
|
+
}
|
|
65
|
+
constructor(view, orientation, orthogonalSize, size = 0) {
|
|
66
|
+
this.view = view;
|
|
67
|
+
this.orientation = orientation;
|
|
68
|
+
this._onDidChange = new Emitter();
|
|
69
|
+
this.onDidChange = this._onDidChange.event;
|
|
70
|
+
this._orthogonalSize = orthogonalSize;
|
|
71
|
+
this._size = size;
|
|
72
|
+
this._disposable = this.view.onDidChange((event) => {
|
|
73
|
+
if (event) {
|
|
74
|
+
this._onDidChange.fire({
|
|
75
|
+
size: this.orientation === Orientation.VERTICAL
|
|
76
|
+
? event.width
|
|
77
|
+
: event.height,
|
|
78
|
+
orthogonalSize: this.orientation === Orientation.VERTICAL
|
|
79
|
+
? event.height
|
|
80
|
+
: event.width,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this._onDidChange.fire({});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
setVisible(visible) {
|
|
89
|
+
if (this.view.setVisible) {
|
|
90
|
+
this.view.setVisible(visible);
|
|
91
|
+
this._onDidChange.fire({});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
layout(size, orthogonalSize) {
|
|
95
|
+
this._size = size;
|
|
96
|
+
this._orthogonalSize = orthogonalSize;
|
|
97
|
+
this.view.layout(this.width, this.height);
|
|
98
|
+
}
|
|
99
|
+
dispose() {
|
|
100
|
+
this._onDidChange.dispose();
|
|
101
|
+
this._disposable.dispose();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GridviewPanel } from './gridviewPanel';
|
|
2
|
+
import { ISplitviewStyles, Orientation } from '../splitview/splitview';
|
|
3
|
+
import { FrameworkFactory } from '../panel/componentFactory';
|
|
4
|
+
export interface GridviewComponentOptions {
|
|
5
|
+
proportionalLayout: boolean;
|
|
6
|
+
orientation: Orientation;
|
|
7
|
+
components?: {
|
|
8
|
+
[componentName: string]: {
|
|
9
|
+
new (id: string, componentName: string): GridviewPanel;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
frameworkComponents?: {
|
|
13
|
+
[componentName: string]: any;
|
|
14
|
+
};
|
|
15
|
+
frameworkComponentFactory?: FrameworkFactory<GridviewPanel>;
|
|
16
|
+
tabHeight?: number;
|
|
17
|
+
styles?: ISplitviewStyles;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export * from './dnd/dataTransfer';
|
|
2
|
+
export { watchElementResize } from './dom';
|
|
3
|
+
/**
|
|
4
|
+
* Events, Emitters and Disposables are very common concepts that most codebases will contain.
|
|
5
|
+
* We export them with a 'Dockview' prefix here to prevent accidental use by others.
|
|
6
|
+
*/
|
|
7
|
+
export { Emitter as DockviewEmitter, Event as DockviewEvent } from './events';
|
|
8
|
+
export { IDisposable as IDockviewDisposable, MutableDisposable as DockviewMutableDisposable, CompositeDisposable as DockviewCompositeDisposable, } from './lifecycle';
|
|
9
|
+
export * from './panel/types';
|
|
10
|
+
export * from './panel/componentFactory';
|
|
11
|
+
export * from './splitview/splitview';
|
|
12
|
+
export * from './splitview/options';
|
|
13
|
+
export * from './paneview/paneview';
|
|
14
|
+
export * from './gridview/gridview';
|
|
15
|
+
export * from './dockview/dockviewGroupPanelModel';
|
|
16
|
+
export * from './gridview/baseComponentGridview';
|
|
17
|
+
export * from './paneview/draggablePaneviewPanel';
|
|
18
|
+
export * from './dockview/components/panel/content';
|
|
19
|
+
export * from './dockview/components/tab/tab';
|
|
20
|
+
export * from './dockview/types';
|
|
21
|
+
export * from './dockview/dockviewGroupPanel';
|
|
22
|
+
export * from './dockview/options';
|
|
23
|
+
export * from './dockview/dockviewPanel';
|
|
24
|
+
export * from './dockview/components/tab/defaultTab';
|
|
25
|
+
export * from './dockview/deserializer';
|
|
26
|
+
export * from './dockview/dockviewComponent';
|
|
27
|
+
export * from './gridview/gridviewComponent';
|
|
28
|
+
export * from './splitview/splitviewComponent';
|
|
29
|
+
export * from './paneview/paneviewComponent';
|
|
30
|
+
export { PaneviewComponentOptions } from './paneview/options';
|
|
31
|
+
export * from './gridview/gridviewPanel';
|
|
32
|
+
export * from './splitview/splitviewPanel';
|
|
33
|
+
export * from './paneview/paneviewPanel';
|
|
34
|
+
export * from './dockview/types';
|
|
35
|
+
export { Position, positionToDirection, directionToPosition, } from './dnd/droptarget';
|
|
36
|
+
export { FocusEvent, PanelDimensionChangeEvent, VisibilityEvent, ActiveEvent, PanelApi, } from './api/panelApi';
|
|
37
|
+
export { SizeEvent, GridviewPanelApi, GridConstraintChangeEvent, } from './api/gridviewPanelApi';
|
|
38
|
+
export { TitleEvent, DockviewPanelApi } from './api/dockviewPanelApi';
|
|
39
|
+
export { PanelSizeEvent, PanelConstraintChangeEvent, SplitviewPanelApi, } from './api/splitviewPanelApi';
|
|
40
|
+
export { ExpansionEvent, PaneviewPanelApi } from './api/paneviewPanelApi';
|
|
41
|
+
export { CommonApi, SplitviewApi, PaneviewApi, GridviewApi, DockviewApi, } from './api/component.api';
|