dockview 1.9.2 → 1.10.1
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/dist/cjs/dockview/defaultTab.d.ts +0 -1
- package/dist/cjs/dockview/defaultTab.js +0 -1
- package/dist/cjs/dockview/dockview.d.ts +5 -3
- package/dist/cjs/dockview/dockview.js +31 -1
- package/dist/cjs/dockview/headerActionsRenderer.d.ts +0 -1
- package/dist/cjs/dockview/headerActionsRenderer.js +0 -1
- package/dist/cjs/dockview/reactContentPart.d.ts +0 -1
- package/dist/cjs/dockview/reactContentPart.js +0 -1
- package/dist/cjs/dockview/reactHeaderPart.d.ts +0 -1
- package/dist/cjs/dockview/reactHeaderPart.js +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.d.ts +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.js +0 -1
- package/dist/cjs/gridview/gridview.d.ts +0 -1
- package/dist/cjs/gridview/gridview.js +0 -1
- package/dist/cjs/gridview/view.d.ts +0 -1
- package/dist/cjs/gridview/view.js +3 -2
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/paneview/paneview.d.ts +0 -1
- package/dist/cjs/paneview/paneview.js +0 -1
- package/dist/cjs/paneview/view.d.ts +0 -1
- package/dist/cjs/paneview/view.js +0 -1
- package/dist/cjs/react.d.ts +1 -2
- package/dist/cjs/react.js +13 -10
- package/dist/cjs/splitview/splitview.d.ts +0 -1
- package/dist/cjs/splitview/splitview.js +0 -1
- package/dist/cjs/splitview/view.d.ts +0 -1
- package/dist/cjs/splitview/view.js +0 -1
- package/dist/cjs/svg.d.ts +0 -1
- package/dist/cjs/svg.js +0 -1
- package/dist/cjs/types.d.ts +0 -1
- package/dist/cjs/types.js +0 -1
- package/dist/dockview.amd.js +1325 -544
- package/dist/dockview.amd.js.map +1 -1
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.js.map +1 -1
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.min.noStyle.js.map +1 -1
- package/dist/dockview.amd.noStyle.js +1325 -544
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +1325 -544
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +1322 -544
- package/dist/dockview.esm.js.map +1 -1
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.esm.min.js.map +1 -1
- package/dist/dockview.js +1325 -544
- package/dist/dockview.js.map +1 -1
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.min.noStyle.js.map +1 -1
- package/dist/dockview.noStyle.js +1325 -544
- package/dist/dockview.noStyle.js.map +1 -1
- package/dist/esm/dockview/defaultTab.d.ts +0 -1
- package/dist/esm/dockview/defaultTab.js +0 -1
- package/dist/esm/dockview/dockview.d.ts +5 -3
- package/dist/esm/dockview/dockview.js +31 -1
- package/dist/esm/dockview/headerActionsRenderer.d.ts +0 -1
- package/dist/esm/dockview/headerActionsRenderer.js +0 -1
- package/dist/esm/dockview/reactContentPart.d.ts +0 -1
- package/dist/esm/dockview/reactContentPart.js +0 -1
- package/dist/esm/dockview/reactHeaderPart.d.ts +0 -1
- package/dist/esm/dockview/reactHeaderPart.js +0 -1
- package/dist/esm/dockview/reactWatermarkPart.d.ts +0 -1
- package/dist/esm/dockview/reactWatermarkPart.js +0 -1
- package/dist/esm/gridview/gridview.d.ts +0 -1
- package/dist/esm/gridview/gridview.js +0 -1
- package/dist/esm/gridview/view.d.ts +0 -1
- package/dist/esm/gridview/view.js +3 -2
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/paneview/paneview.d.ts +0 -1
- package/dist/esm/paneview/paneview.js +0 -1
- package/dist/esm/paneview/view.d.ts +0 -1
- package/dist/esm/paneview/view.js +0 -1
- package/dist/esm/react.d.ts +1 -2
- package/dist/esm/react.js +11 -8
- package/dist/esm/splitview/splitview.d.ts +0 -1
- package/dist/esm/splitview/splitview.js +0 -1
- package/dist/esm/splitview/view.d.ts +0 -1
- package/dist/esm/splitview/view.js +0 -1
- package/dist/esm/svg.d.ts +0 -1
- package/dist/esm/svg.js +0 -1
- package/dist/esm/types.d.ts +0 -1
- package/dist/esm/types.js +0 -1
- package/package.json +4 -4
- package/dist/cjs/dockview/defaultTab.d.ts.map +0 -1
- package/dist/cjs/dockview/defaultTab.js.map +0 -1
- package/dist/cjs/dockview/dockview.d.ts.map +0 -1
- package/dist/cjs/dockview/dockview.js.map +0 -1
- package/dist/cjs/dockview/headerActionsRenderer.d.ts.map +0 -1
- package/dist/cjs/dockview/headerActionsRenderer.js.map +0 -1
- package/dist/cjs/dockview/reactContentPart.d.ts.map +0 -1
- package/dist/cjs/dockview/reactContentPart.js.map +0 -1
- package/dist/cjs/dockview/reactHeaderPart.d.ts.map +0 -1
- package/dist/cjs/dockview/reactHeaderPart.js.map +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.d.ts.map +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.js.map +0 -1
- package/dist/cjs/gridview/gridview.d.ts.map +0 -1
- package/dist/cjs/gridview/gridview.js.map +0 -1
- package/dist/cjs/gridview/view.d.ts.map +0 -1
- package/dist/cjs/gridview/view.js.map +0 -1
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/paneview/paneview.d.ts.map +0 -1
- package/dist/cjs/paneview/paneview.js.map +0 -1
- package/dist/cjs/paneview/view.d.ts.map +0 -1
- package/dist/cjs/paneview/view.js.map +0 -1
- package/dist/cjs/react.d.ts.map +0 -1
- package/dist/cjs/react.js.map +0 -1
- package/dist/cjs/splitview/splitview.d.ts.map +0 -1
- package/dist/cjs/splitview/splitview.js.map +0 -1
- package/dist/cjs/splitview/view.d.ts.map +0 -1
- package/dist/cjs/splitview/view.js.map +0 -1
- package/dist/cjs/svg.d.ts.map +0 -1
- package/dist/cjs/svg.js.map +0 -1
- package/dist/cjs/types.d.ts.map +0 -1
- package/dist/cjs/types.js.map +0 -1
- package/dist/esm/dockview/defaultTab.d.ts.map +0 -1
- package/dist/esm/dockview/defaultTab.js.map +0 -1
- package/dist/esm/dockview/dockview.d.ts.map +0 -1
- package/dist/esm/dockview/dockview.js.map +0 -1
- package/dist/esm/dockview/headerActionsRenderer.d.ts.map +0 -1
- package/dist/esm/dockview/headerActionsRenderer.js.map +0 -1
- package/dist/esm/dockview/reactContentPart.d.ts.map +0 -1
- package/dist/esm/dockview/reactContentPart.js.map +0 -1
- package/dist/esm/dockview/reactHeaderPart.d.ts.map +0 -1
- package/dist/esm/dockview/reactHeaderPart.js.map +0 -1
- package/dist/esm/dockview/reactWatermarkPart.d.ts.map +0 -1
- package/dist/esm/dockview/reactWatermarkPart.js.map +0 -1
- package/dist/esm/gridview/gridview.d.ts.map +0 -1
- package/dist/esm/gridview/gridview.js.map +0 -1
- package/dist/esm/gridview/view.d.ts.map +0 -1
- package/dist/esm/gridview/view.js.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/paneview/paneview.d.ts.map +0 -1
- package/dist/esm/paneview/paneview.js.map +0 -1
- package/dist/esm/paneview/view.d.ts.map +0 -1
- package/dist/esm/paneview/view.js.map +0 -1
- package/dist/esm/react.d.ts.map +0 -1
- package/dist/esm/react.js.map +0 -1
- package/dist/esm/splitview/splitview.d.ts.map +0 -1
- package/dist/esm/splitview/splitview.js.map +0 -1
- package/dist/esm/splitview/view.d.ts.map +0 -1
- package/dist/esm/splitview/view.js.map +0 -1
- package/dist/esm/svg.d.ts.map +0 -1
- package/dist/esm/svg.js.map +0 -1
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js.map +0 -1
package/dist/dockview.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.10.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -141,6 +141,17 @@ exports.DockviewEvent = void 0;
|
|
|
141
141
|
};
|
|
142
142
|
};
|
|
143
143
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
144
|
+
class DockviewEvent {
|
|
145
|
+
constructor() {
|
|
146
|
+
this._defaultPrevented = false;
|
|
147
|
+
}
|
|
148
|
+
get defaultPrevented() {
|
|
149
|
+
return this._defaultPrevented;
|
|
150
|
+
}
|
|
151
|
+
preventDefault() {
|
|
152
|
+
this._defaultPrevented = true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
144
155
|
class LeakageMonitor {
|
|
145
156
|
constructor() {
|
|
146
157
|
this.events = new Map();
|
|
@@ -184,6 +195,9 @@ class Emitter {
|
|
|
184
195
|
}
|
|
185
196
|
Emitter.ENABLE_TRACKING = isEnabled;
|
|
186
197
|
}
|
|
198
|
+
get value() {
|
|
199
|
+
return this._last;
|
|
200
|
+
}
|
|
187
201
|
constructor(options) {
|
|
188
202
|
this.options = options;
|
|
189
203
|
this._listeners = [];
|
|
@@ -306,8 +320,12 @@ class CompositeDisposable {
|
|
|
306
320
|
args.forEach((arg) => this._disposables.push(arg));
|
|
307
321
|
}
|
|
308
322
|
dispose() {
|
|
309
|
-
this.
|
|
323
|
+
if (this._isDisposed) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
310
326
|
this._isDisposed = true;
|
|
327
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
328
|
+
this._disposables = [];
|
|
311
329
|
}
|
|
312
330
|
}
|
|
313
331
|
class MutableDisposable {
|
|
@@ -791,6 +809,13 @@ class Splitview {
|
|
|
791
809
|
this._endSnappingEnabled = endSnappingEnabled;
|
|
792
810
|
this.updateSashEnablement();
|
|
793
811
|
}
|
|
812
|
+
get disabled() {
|
|
813
|
+
return this._disabled;
|
|
814
|
+
}
|
|
815
|
+
set disabled(value) {
|
|
816
|
+
this._disabled = value;
|
|
817
|
+
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
818
|
+
}
|
|
794
819
|
constructor(container, options) {
|
|
795
820
|
this.container = container;
|
|
796
821
|
this.viewItems = [];
|
|
@@ -801,6 +826,7 @@ class Splitview {
|
|
|
801
826
|
this._proportions = undefined;
|
|
802
827
|
this._startSnappingEnabled = true;
|
|
803
828
|
this._endSnappingEnabled = true;
|
|
829
|
+
this._disabled = false;
|
|
804
830
|
this._onDidSashEnd = new Emitter();
|
|
805
831
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
806
832
|
this._onDidAddView = new Emitter();
|
|
@@ -1475,6 +1501,9 @@ class Paneview extends CompositeDisposable {
|
|
|
1475
1501
|
this._onDidChange.fire();
|
|
1476
1502
|
}));
|
|
1477
1503
|
}
|
|
1504
|
+
setViewVisible(index, visible) {
|
|
1505
|
+
this.splitview.setViewVisible(index, visible);
|
|
1506
|
+
}
|
|
1478
1507
|
addPane(pane, size, index = this.splitview.length, skipLayout = false) {
|
|
1479
1508
|
const disposable = pane.onDidChangeExpansionState(() => {
|
|
1480
1509
|
this.setupAnimation();
|
|
@@ -1728,7 +1757,13 @@ class BranchNode extends CompositeDisposable {
|
|
|
1728
1757
|
}
|
|
1729
1758
|
return exports.LayoutPriority.Normal;
|
|
1730
1759
|
}
|
|
1731
|
-
|
|
1760
|
+
get disabled() {
|
|
1761
|
+
return this.splitview.disabled;
|
|
1762
|
+
}
|
|
1763
|
+
set disabled(value) {
|
|
1764
|
+
this.splitview.disabled = value;
|
|
1765
|
+
}
|
|
1766
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, childDescriptors) {
|
|
1732
1767
|
super();
|
|
1733
1768
|
this.orientation = orientation;
|
|
1734
1769
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1773,6 +1808,7 @@ class BranchNode extends CompositeDisposable {
|
|
|
1773
1808
|
styles,
|
|
1774
1809
|
});
|
|
1775
1810
|
}
|
|
1811
|
+
this.disabled = disabled;
|
|
1776
1812
|
this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
|
|
1777
1813
|
this._onDidChange.fire({});
|
|
1778
1814
|
}));
|
|
@@ -1906,7 +1942,7 @@ function findLeaf(candiateNode, last) {
|
|
|
1906
1942
|
}
|
|
1907
1943
|
function flipNode(node, size, orthogonalSize) {
|
|
1908
1944
|
if (node instanceof BranchNode) {
|
|
1909
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
1945
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1910
1946
|
let totalSize = 0;
|
|
1911
1947
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1912
1948
|
const child = node.children[i];
|
|
@@ -2042,31 +2078,57 @@ class Gridview {
|
|
|
2042
2078
|
get maximumHeight() {
|
|
2043
2079
|
return this.root.maximumHeight;
|
|
2044
2080
|
}
|
|
2081
|
+
get locked() {
|
|
2082
|
+
return this._locked;
|
|
2083
|
+
}
|
|
2084
|
+
set locked(value) {
|
|
2085
|
+
this._locked = value;
|
|
2086
|
+
const branch = [this.root];
|
|
2087
|
+
/**
|
|
2088
|
+
* simple depth-first-search to cover all nodes
|
|
2089
|
+
*
|
|
2090
|
+
* @see https://en.wikipedia.org/wiki/Depth-first_search
|
|
2091
|
+
*/
|
|
2092
|
+
while (branch.length > 0) {
|
|
2093
|
+
const node = branch.pop();
|
|
2094
|
+
if (node instanceof BranchNode) {
|
|
2095
|
+
node.disabled = value;
|
|
2096
|
+
branch.push(...node.children);
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2045
2100
|
maximizedView() {
|
|
2046
2101
|
var _a;
|
|
2047
|
-
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.view;
|
|
2102
|
+
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
2048
2103
|
}
|
|
2049
2104
|
hasMaximizedView() {
|
|
2050
2105
|
return this._maximizedNode !== undefined;
|
|
2051
2106
|
}
|
|
2052
2107
|
maximizeView(view) {
|
|
2108
|
+
var _a;
|
|
2053
2109
|
const location = getGridLocation(view.element);
|
|
2054
2110
|
const [_, node] = this.getNode(location);
|
|
2055
2111
|
if (!(node instanceof LeafNode)) {
|
|
2056
2112
|
return;
|
|
2057
2113
|
}
|
|
2058
|
-
if (this._maximizedNode === node) {
|
|
2114
|
+
if (((_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf) === node) {
|
|
2059
2115
|
return;
|
|
2060
2116
|
}
|
|
2061
2117
|
if (this.hasMaximizedView()) {
|
|
2062
2118
|
this.exitMaximizedView();
|
|
2063
2119
|
}
|
|
2120
|
+
const hiddenOnMaximize = [];
|
|
2064
2121
|
function hideAllViewsBut(parent, exclude) {
|
|
2065
2122
|
for (let i = 0; i < parent.children.length; i++) {
|
|
2066
2123
|
const child = parent.children[i];
|
|
2067
2124
|
if (child instanceof LeafNode) {
|
|
2068
2125
|
if (child !== exclude) {
|
|
2069
|
-
parent.
|
|
2126
|
+
if (parent.isChildVisible(i)) {
|
|
2127
|
+
parent.setChildVisible(i, false);
|
|
2128
|
+
}
|
|
2129
|
+
else {
|
|
2130
|
+
hiddenOnMaximize.push(child);
|
|
2131
|
+
}
|
|
2070
2132
|
}
|
|
2071
2133
|
}
|
|
2072
2134
|
else {
|
|
@@ -2075,18 +2137,21 @@ class Gridview {
|
|
|
2075
2137
|
}
|
|
2076
2138
|
}
|
|
2077
2139
|
hideAllViewsBut(this.root, node);
|
|
2078
|
-
this._maximizedNode = node;
|
|
2079
|
-
this.
|
|
2140
|
+
this._maximizedNode = { leaf: node, hiddenOnMaximize };
|
|
2141
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2080
2142
|
}
|
|
2081
2143
|
exitMaximizedView() {
|
|
2082
2144
|
if (!this._maximizedNode) {
|
|
2083
2145
|
return;
|
|
2084
2146
|
}
|
|
2147
|
+
const hiddenOnMaximize = this._maximizedNode.hiddenOnMaximize;
|
|
2085
2148
|
function showViewsInReverseOrder(parent) {
|
|
2086
2149
|
for (let index = parent.children.length - 1; index >= 0; index--) {
|
|
2087
2150
|
const child = parent.children[index];
|
|
2088
2151
|
if (child instanceof LeafNode) {
|
|
2089
|
-
|
|
2152
|
+
if (!hiddenOnMaximize.includes(child)) {
|
|
2153
|
+
parent.setChildVisible(index, true);
|
|
2154
|
+
}
|
|
2090
2155
|
}
|
|
2091
2156
|
else {
|
|
2092
2157
|
showViewsInReverseOrder(child);
|
|
@@ -2095,13 +2160,13 @@ class Gridview {
|
|
|
2095
2160
|
}
|
|
2096
2161
|
showViewsInReverseOrder(this.root);
|
|
2097
2162
|
this._maximizedNode = undefined;
|
|
2098
|
-
this.
|
|
2163
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2099
2164
|
}
|
|
2100
2165
|
serialize() {
|
|
2101
2166
|
if (this.hasMaximizedView()) {
|
|
2102
2167
|
/**
|
|
2103
|
-
* do not persist maximized view state
|
|
2104
|
-
*
|
|
2168
|
+
* do not persist maximized view state
|
|
2169
|
+
* firstly exit any maximized views to ensure the correct dimensions are persisted
|
|
2105
2170
|
*/
|
|
2106
2171
|
this.exitMaximizedView();
|
|
2107
2172
|
}
|
|
@@ -2116,14 +2181,14 @@ class Gridview {
|
|
|
2116
2181
|
dispose() {
|
|
2117
2182
|
this.disposable.dispose();
|
|
2118
2183
|
this._onDidChange.dispose();
|
|
2119
|
-
this.
|
|
2184
|
+
this._onDidMaximizedNodeChange.dispose();
|
|
2120
2185
|
this.root.dispose();
|
|
2121
2186
|
this._maximizedNode = undefined;
|
|
2122
2187
|
this.element.remove();
|
|
2123
2188
|
}
|
|
2124
2189
|
clear() {
|
|
2125
2190
|
const orientation = this.root.orientation;
|
|
2126
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize);
|
|
2191
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this._locked);
|
|
2127
2192
|
}
|
|
2128
2193
|
deserialize(json, deserializer) {
|
|
2129
2194
|
const orientation = json.orientation;
|
|
@@ -2144,8 +2209,8 @@ class Gridview {
|
|
|
2144
2209
|
};
|
|
2145
2210
|
});
|
|
2146
2211
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2147
|
-
orthogonalSize, // <- size - flips at each depth
|
|
2148
|
-
children);
|
|
2212
|
+
orthogonalSize, // <- size - flips at each depth,
|
|
2213
|
+
this._locked, children);
|
|
2149
2214
|
}
|
|
2150
2215
|
else {
|
|
2151
2216
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2178,7 +2243,7 @@ class Gridview {
|
|
|
2178
2243
|
}
|
|
2179
2244
|
const oldRoot = this.root;
|
|
2180
2245
|
oldRoot.element.remove();
|
|
2181
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
|
|
2246
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this._locked);
|
|
2182
2247
|
if (oldRoot.children.length === 0) ;
|
|
2183
2248
|
else if (oldRoot.children.length === 1) {
|
|
2184
2249
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2246,15 +2311,16 @@ class Gridview {
|
|
|
2246
2311
|
constructor(proportionalLayout, styles, orientation) {
|
|
2247
2312
|
this.proportionalLayout = proportionalLayout;
|
|
2248
2313
|
this.styles = styles;
|
|
2314
|
+
this._locked = false;
|
|
2249
2315
|
this._maximizedNode = undefined;
|
|
2250
2316
|
this.disposable = new MutableDisposable();
|
|
2251
2317
|
this._onDidChange = new Emitter();
|
|
2252
2318
|
this.onDidChange = this._onDidChange.event;
|
|
2253
|
-
this.
|
|
2254
|
-
this.
|
|
2319
|
+
this._onDidMaximizedNodeChange = new Emitter();
|
|
2320
|
+
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2255
2321
|
this.element = document.createElement('div');
|
|
2256
2322
|
this.element.className = 'grid-view';
|
|
2257
|
-
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
2323
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this._locked);
|
|
2258
2324
|
}
|
|
2259
2325
|
isViewVisible(location) {
|
|
2260
2326
|
const [rest, index] = tail(location);
|
|
@@ -2305,7 +2371,7 @@ class Gridview {
|
|
|
2305
2371
|
}
|
|
2306
2372
|
const child = grandParent.removeChild(parentIndex);
|
|
2307
2373
|
child.dispose();
|
|
2308
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2374
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this._locked);
|
|
2309
2375
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2310
2376
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2311
2377
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2933,13 +2999,36 @@ class DockviewApi {
|
|
|
2933
2999
|
return this.component.onDidDrop;
|
|
2934
3000
|
}
|
|
2935
3001
|
/**
|
|
2936
|
-
* Invoked
|
|
3002
|
+
* Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and
|
|
3003
|
+
* prevent the event from occuring using the standard `preventDefault()` syntax.
|
|
3004
|
+
*
|
|
3005
|
+
* Preventing certain events may causes unexpected behaviours, use carefully.
|
|
3006
|
+
*/
|
|
3007
|
+
get onWillDrop() {
|
|
3008
|
+
return this.component.onWillDrop;
|
|
3009
|
+
}
|
|
3010
|
+
/**
|
|
3011
|
+
* Invoked before an overlay is shown indicating a drop target.
|
|
3012
|
+
*
|
|
3013
|
+
* Calling `event.preventDefault()` will prevent the overlay being shown and prevent
|
|
3014
|
+
* the any subsequent drop event.
|
|
3015
|
+
*/
|
|
3016
|
+
get onWillShowOverlay() {
|
|
3017
|
+
return this.component.onWillShowOverlay;
|
|
3018
|
+
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Invoked before a group is dragged.
|
|
3021
|
+
*
|
|
3022
|
+
* Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting.
|
|
3023
|
+
*
|
|
2937
3024
|
*/
|
|
2938
3025
|
get onWillDragGroup() {
|
|
2939
3026
|
return this.component.onWillDragGroup;
|
|
2940
3027
|
}
|
|
2941
3028
|
/**
|
|
2942
|
-
* Invoked before a panel is dragged.
|
|
3029
|
+
* Invoked before a panel is dragged.
|
|
3030
|
+
*
|
|
3031
|
+
* Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
|
|
2943
3032
|
*/
|
|
2944
3033
|
get onWillDragPanel() {
|
|
2945
3034
|
return this.component.onWillDragPanel;
|
|
@@ -3067,17 +3156,17 @@ class DockviewApi {
|
|
|
3067
3156
|
hasMaximizedGroup() {
|
|
3068
3157
|
return this.component.hasMaximizedGroup();
|
|
3069
3158
|
}
|
|
3070
|
-
|
|
3159
|
+
exitMaximizedGroup() {
|
|
3071
3160
|
this.component.exitMaximizedGroup();
|
|
3072
3161
|
}
|
|
3073
|
-
get
|
|
3074
|
-
return this.component.
|
|
3162
|
+
get onDidMaximizedGroupChange() {
|
|
3163
|
+
return this.component.onDidMaximizedGroupChange;
|
|
3075
3164
|
}
|
|
3076
3165
|
/**
|
|
3077
3166
|
* Add a popout group in a new Window
|
|
3078
3167
|
*/
|
|
3079
3168
|
addPopoutGroup(item, options) {
|
|
3080
|
-
this.component.addPopoutGroup(item, options);
|
|
3169
|
+
return this.component.addPopoutGroup(item, options);
|
|
3081
3170
|
}
|
|
3082
3171
|
}
|
|
3083
3172
|
|
|
@@ -3131,6 +3220,18 @@ class DragAndDropObserver extends CompositeDisposable {
|
|
|
3131
3220
|
}
|
|
3132
3221
|
}
|
|
3133
3222
|
|
|
3223
|
+
class WillShowOverlayEvent extends DockviewEvent {
|
|
3224
|
+
get nativeEvent() {
|
|
3225
|
+
return this.options.nativeEvent;
|
|
3226
|
+
}
|
|
3227
|
+
get position() {
|
|
3228
|
+
return this.options.position;
|
|
3229
|
+
}
|
|
3230
|
+
constructor(options) {
|
|
3231
|
+
super();
|
|
3232
|
+
this.options = options;
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3134
3235
|
function directionToPosition(direction) {
|
|
3135
3236
|
switch (direction) {
|
|
3136
3237
|
case 'above':
|
|
@@ -3183,6 +3284,8 @@ class Droptarget extends CompositeDisposable {
|
|
|
3183
3284
|
this.options = options;
|
|
3184
3285
|
this._onDrop = new Emitter();
|
|
3185
3286
|
this.onDrop = this._onDrop.event;
|
|
3287
|
+
this._onWillShowOverlay = new Emitter();
|
|
3288
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3186
3289
|
// use a set to take advantage of #<set>.has
|
|
3187
3290
|
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
3188
3291
|
this.dnd = new DragAndDropObserver(this.element, {
|
|
@@ -3211,6 +3314,19 @@ class Droptarget extends CompositeDisposable {
|
|
|
3211
3314
|
this.removeDropTarget();
|
|
3212
3315
|
return;
|
|
3213
3316
|
}
|
|
3317
|
+
const willShowOverlayEvent = new WillShowOverlayEvent({
|
|
3318
|
+
nativeEvent: e,
|
|
3319
|
+
position: quadrant,
|
|
3320
|
+
});
|
|
3321
|
+
/**
|
|
3322
|
+
* Provide an opportunity to prevent the overlay appearing and in turn
|
|
3323
|
+
* any dnd behaviours
|
|
3324
|
+
*/
|
|
3325
|
+
this._onWillShowOverlay.fire(willShowOverlayEvent);
|
|
3326
|
+
if (willShowOverlayEvent.defaultPrevented) {
|
|
3327
|
+
this.removeDropTarget();
|
|
3328
|
+
return;
|
|
3329
|
+
}
|
|
3214
3330
|
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
3215
3331
|
if (!this.options.canDisplayOverlay) {
|
|
3216
3332
|
this.removeDropTarget();
|
|
@@ -3253,7 +3369,7 @@ class Droptarget extends CompositeDisposable {
|
|
|
3253
3369
|
}
|
|
3254
3370
|
},
|
|
3255
3371
|
});
|
|
3256
|
-
this.addDisposables(this._onDrop, this.dnd);
|
|
3372
|
+
this.addDisposables(this._onDrop, this._onWillShowOverlay, this.dnd);
|
|
3257
3373
|
}
|
|
3258
3374
|
setTargetZones(acceptedTargetZones) {
|
|
3259
3375
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
@@ -3306,25 +3422,44 @@ class Droptarget extends CompositeDisposable {
|
|
|
3306
3422
|
size = clamp(0, sizeOptions.value, height) / height;
|
|
3307
3423
|
}
|
|
3308
3424
|
}
|
|
3309
|
-
const
|
|
3310
|
-
|
|
3311
|
-
|
|
3425
|
+
const box = { top: '0px', left: '0px', width: '100%', height: '100%' };
|
|
3426
|
+
/**
|
|
3427
|
+
* You can also achieve the overlay placement using the transform CSS property
|
|
3428
|
+
* to translate and scale the element however this has the undesired effect of
|
|
3429
|
+
* 'skewing' the element. Comment left here for anybody that ever revisits this.
|
|
3430
|
+
*
|
|
3431
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
|
3432
|
+
*
|
|
3433
|
+
* right
|
|
3434
|
+
* translateX(${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3435
|
+
*
|
|
3436
|
+
* left
|
|
3437
|
+
* translateX(-${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3438
|
+
*
|
|
3439
|
+
* top
|
|
3440
|
+
* translateY(-${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3441
|
+
*
|
|
3442
|
+
* bottom
|
|
3443
|
+
* translateY(${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3444
|
+
*/
|
|
3312
3445
|
if (rightClass) {
|
|
3313
|
-
|
|
3446
|
+
box.left = `${100 * (1 - size)}%`;
|
|
3447
|
+
box.width = `${100 * size}%`;
|
|
3314
3448
|
}
|
|
3315
3449
|
else if (leftClass) {
|
|
3316
|
-
|
|
3450
|
+
box.width = `${100 * size}%`;
|
|
3317
3451
|
}
|
|
3318
3452
|
else if (topClass) {
|
|
3319
|
-
|
|
3453
|
+
box.height = `${100 * size}%`;
|
|
3320
3454
|
}
|
|
3321
3455
|
else if (bottomClass) {
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
else {
|
|
3325
|
-
transform = '';
|
|
3456
|
+
box.top = `${100 * (1 - size)}%`;
|
|
3457
|
+
box.height = `${100 * size}%`;
|
|
3326
3458
|
}
|
|
3327
|
-
this.overlayElement.style.
|
|
3459
|
+
this.overlayElement.style.top = box.top;
|
|
3460
|
+
this.overlayElement.style.left = box.left;
|
|
3461
|
+
this.overlayElement.style.width = box.width;
|
|
3462
|
+
this.overlayElement.style.height = box.height;
|
|
3328
3463
|
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3329
3464
|
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3330
3465
|
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
@@ -3392,14 +3527,6 @@ function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold)
|
|
|
3392
3527
|
return 'center';
|
|
3393
3528
|
}
|
|
3394
3529
|
|
|
3395
|
-
exports.DockviewDropTargets = void 0;
|
|
3396
|
-
(function (DockviewDropTargets) {
|
|
3397
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3398
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3399
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3400
|
-
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3401
|
-
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3402
|
-
|
|
3403
3530
|
class ContentContainer extends CompositeDisposable {
|
|
3404
3531
|
get element() {
|
|
3405
3532
|
return this._element;
|
|
@@ -3427,7 +3554,7 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3427
3554
|
const data = getPanelData();
|
|
3428
3555
|
if (!data &&
|
|
3429
3556
|
event.shiftKey &&
|
|
3430
|
-
this.group.location !== 'floating') {
|
|
3557
|
+
this.group.location.type !== 'floating') {
|
|
3431
3558
|
return false;
|
|
3432
3559
|
}
|
|
3433
3560
|
if (data && data.viewId === this.accessor.id) {
|
|
@@ -3445,7 +3572,7 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3445
3572
|
data.groupId === this.group.id;
|
|
3446
3573
|
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3447
3574
|
}
|
|
3448
|
-
return this.group.canDisplayOverlay(event, position,
|
|
3575
|
+
return this.group.canDisplayOverlay(event, position, 'content');
|
|
3449
3576
|
},
|
|
3450
3577
|
});
|
|
3451
3578
|
this.addDisposables(this.dropTarget);
|
|
@@ -3470,7 +3597,7 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3470
3597
|
let container;
|
|
3471
3598
|
switch (panel.api.renderer) {
|
|
3472
3599
|
case 'onlyWhenVisibile':
|
|
3473
|
-
this.
|
|
3600
|
+
this.group.renderContainer.detatch(panel);
|
|
3474
3601
|
if (this.panel) {
|
|
3475
3602
|
if (doRender) {
|
|
3476
3603
|
this._element.appendChild(this.panel.view.content.element);
|
|
@@ -3482,7 +3609,7 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3482
3609
|
if (panel.view.content.element.parentElement === this._element) {
|
|
3483
3610
|
this._element.removeChild(panel.view.content.element);
|
|
3484
3611
|
}
|
|
3485
|
-
container = this.
|
|
3612
|
+
container = this.group.renderContainer.attach({
|
|
3486
3613
|
panel,
|
|
3487
3614
|
referenceContainer: this,
|
|
3488
3615
|
});
|
|
@@ -3513,9 +3640,10 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3513
3640
|
// noop
|
|
3514
3641
|
}
|
|
3515
3642
|
closePanel() {
|
|
3643
|
+
var _a;
|
|
3516
3644
|
if (this.panel) {
|
|
3517
3645
|
if (this.panel.api.renderer === 'onlyWhenVisibile') {
|
|
3518
|
-
this.
|
|
3646
|
+
(_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
|
|
3519
3647
|
}
|
|
3520
3648
|
}
|
|
3521
3649
|
this.panel = undefined;
|
|
@@ -3626,7 +3754,7 @@ class Tab extends CompositeDisposable {
|
|
|
3626
3754
|
this._element.draggable = true;
|
|
3627
3755
|
toggleClass(this.element, 'inactive-tab', true);
|
|
3628
3756
|
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
3629
|
-
this.
|
|
3757
|
+
this.dropTarget = new Droptarget(this._element, {
|
|
3630
3758
|
acceptedTargetZones: ['center'],
|
|
3631
3759
|
canDisplayOverlay: (event, position) => {
|
|
3632
3760
|
if (this.group.locked) {
|
|
@@ -3641,9 +3769,10 @@ class Tab extends CompositeDisposable {
|
|
|
3641
3769
|
}
|
|
3642
3770
|
return this.panel.id !== data.panelId;
|
|
3643
3771
|
}
|
|
3644
|
-
return this.group.model.canDisplayOverlay(event, position,
|
|
3772
|
+
return this.group.model.canDisplayOverlay(event, position, 'tab');
|
|
3645
3773
|
},
|
|
3646
3774
|
});
|
|
3775
|
+
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
3647
3776
|
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
3648
3777
|
this._onDragStart.fire(event);
|
|
3649
3778
|
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
@@ -3651,9 +3780,9 @@ class Tab extends CompositeDisposable {
|
|
|
3651
3780
|
return;
|
|
3652
3781
|
}
|
|
3653
3782
|
this._onChanged.fire(event);
|
|
3654
|
-
}), this.
|
|
3783
|
+
}), this.dropTarget.onDrop((event) => {
|
|
3655
3784
|
this._onDropped.fire(event);
|
|
3656
|
-
}), this.
|
|
3785
|
+
}), this.dropTarget);
|
|
3657
3786
|
}
|
|
3658
3787
|
setActive(isActive) {
|
|
3659
3788
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -3700,7 +3829,7 @@ class GroupDragHandler extends DragHandler {
|
|
|
3700
3829
|
}, true));
|
|
3701
3830
|
}
|
|
3702
3831
|
isCancelled(_event) {
|
|
3703
|
-
if (this.group.api.location === 'floating' && !_event.shiftKey) {
|
|
3832
|
+
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
3704
3833
|
return true;
|
|
3705
3834
|
}
|
|
3706
3835
|
return false;
|
|
@@ -3752,7 +3881,7 @@ class VoidContainer extends CompositeDisposable {
|
|
|
3752
3881
|
this.accessor.doSetGroupActive(this.group);
|
|
3753
3882
|
}));
|
|
3754
3883
|
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3755
|
-
this.
|
|
3884
|
+
this.dropTraget = new Droptarget(this._element, {
|
|
3756
3885
|
acceptedTargetZones: ['center'],
|
|
3757
3886
|
canDisplayOverlay: (event, position) => {
|
|
3758
3887
|
var _a;
|
|
@@ -3766,14 +3895,15 @@ class VoidContainer extends CompositeDisposable {
|
|
|
3766
3895
|
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
3767
3896
|
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
3768
3897
|
}
|
|
3769
|
-
return group.model.canDisplayOverlay(event, position,
|
|
3898
|
+
return group.model.canDisplayOverlay(event, position, 'header_space');
|
|
3770
3899
|
},
|
|
3771
3900
|
});
|
|
3901
|
+
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
3772
3902
|
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3773
3903
|
this._onDragStart.fire(event);
|
|
3774
|
-
}), this.
|
|
3904
|
+
}), this.dropTraget.onDrop((event) => {
|
|
3775
3905
|
this._onDrop.fire(event);
|
|
3776
|
-
}), this.
|
|
3906
|
+
}), this.dropTraget);
|
|
3777
3907
|
}
|
|
3778
3908
|
}
|
|
3779
3909
|
|
|
@@ -3861,19 +3991,11 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3861
3991
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
3862
3992
|
this._onGroupDragStart = new Emitter();
|
|
3863
3993
|
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3864
|
-
this.
|
|
3994
|
+
this._onWillShowOverlay = new Emitter();
|
|
3995
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3865
3996
|
this._element = document.createElement('div');
|
|
3866
3997
|
this._element.className = 'tabs-and-actions-container';
|
|
3867
3998
|
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
3868
|
-
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3869
|
-
if (e.api.group === this.group) {
|
|
3870
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3871
|
-
}
|
|
3872
|
-
}), this.accessor.onDidRemovePanel((e) => {
|
|
3873
|
-
if (e.api.group === this.group) {
|
|
3874
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3875
|
-
}
|
|
3876
|
-
}));
|
|
3877
3999
|
this.rightActionsContainer = document.createElement('div');
|
|
3878
4000
|
this.rightActionsContainer.className = 'right-actions-container';
|
|
3879
4001
|
this.leftActionsContainer = document.createElement('div');
|
|
@@ -3888,7 +4010,15 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3888
4010
|
this._element.appendChild(this.leftActionsContainer);
|
|
3889
4011
|
this._element.appendChild(this.voidContainer.element);
|
|
3890
4012
|
this._element.appendChild(this.rightActionsContainer);
|
|
3891
|
-
this.addDisposables(this.
|
|
4013
|
+
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
4014
|
+
if (e.api.group === this.group) {
|
|
4015
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4016
|
+
}
|
|
4017
|
+
}), this.accessor.onDidRemovePanel((e) => {
|
|
4018
|
+
if (e.api.group === this.group) {
|
|
4019
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4020
|
+
}
|
|
4021
|
+
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3892
4022
|
this._onGroupDragStart.fire({
|
|
3893
4023
|
nativeEvent: event,
|
|
3894
4024
|
group: this.group,
|
|
@@ -3898,11 +4028,15 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3898
4028
|
event: event.nativeEvent,
|
|
3899
4029
|
index: this.tabs.length,
|
|
3900
4030
|
});
|
|
4031
|
+
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
4032
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4033
|
+
kind: 'header_space',
|
|
4034
|
+
}));
|
|
3901
4035
|
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
3902
4036
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3903
4037
|
if (isFloatingGroupsEnabled &&
|
|
3904
4038
|
event.shiftKey &&
|
|
3905
|
-
this.group.api.location !== 'floating') {
|
|
4039
|
+
this.group.api.location.type !== 'floating') {
|
|
3906
4040
|
event.preventDefault();
|
|
3907
4041
|
const { top, left } = this.element.getBoundingClientRect();
|
|
3908
4042
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
@@ -3965,9 +4099,9 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3965
4099
|
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
3966
4100
|
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
3967
4101
|
}), tab.onChanged((event) => {
|
|
3968
|
-
var _a;
|
|
3969
4102
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3970
|
-
const isFloatingWithOnePanel = this.group.api.location === 'floating' &&
|
|
4103
|
+
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
4104
|
+
this.size === 1;
|
|
3971
4105
|
if (isFloatingGroupsEnabled &&
|
|
3972
4106
|
!isFloatingWithOnePanel &&
|
|
3973
4107
|
event.shiftKey) {
|
|
@@ -3981,20 +4115,20 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3981
4115
|
}, { inDragMode: true });
|
|
3982
4116
|
return;
|
|
3983
4117
|
}
|
|
3984
|
-
const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
3985
|
-
this.group.model.isContentFocused;
|
|
3986
4118
|
const isLeftClick = event.button === 0;
|
|
3987
4119
|
if (!isLeftClick || event.defaultPrevented) {
|
|
3988
4120
|
return;
|
|
3989
4121
|
}
|
|
3990
|
-
this.group.
|
|
3991
|
-
|
|
3992
|
-
}
|
|
4122
|
+
if (this.group.activePanel !== panel) {
|
|
4123
|
+
this.group.model.openPanel(panel);
|
|
4124
|
+
}
|
|
3993
4125
|
}), tab.onDrop((event) => {
|
|
3994
4126
|
this._onDrop.fire({
|
|
3995
4127
|
event: event.nativeEvent,
|
|
3996
4128
|
index: this.tabs.findIndex((x) => x.value === tab),
|
|
3997
4129
|
});
|
|
4130
|
+
}), tab.onWillShowOverlay((event) => {
|
|
4131
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, { kind: 'tab' }));
|
|
3998
4132
|
}));
|
|
3999
4133
|
const value = { value: tab, disposable };
|
|
4000
4134
|
this.addTab(value, index);
|
|
@@ -4012,6 +4146,60 @@ class TabsContainer extends CompositeDisposable {
|
|
|
4012
4146
|
}
|
|
4013
4147
|
}
|
|
4014
4148
|
|
|
4149
|
+
class DockviewDidDropEvent extends DockviewEvent {
|
|
4150
|
+
get nativeEvent() {
|
|
4151
|
+
return this.options.nativeEvent;
|
|
4152
|
+
}
|
|
4153
|
+
get position() {
|
|
4154
|
+
return this.options.position;
|
|
4155
|
+
}
|
|
4156
|
+
get panel() {
|
|
4157
|
+
return this.options.panel;
|
|
4158
|
+
}
|
|
4159
|
+
get group() {
|
|
4160
|
+
return this.options.group;
|
|
4161
|
+
}
|
|
4162
|
+
get api() {
|
|
4163
|
+
return this.options.api;
|
|
4164
|
+
}
|
|
4165
|
+
constructor(options) {
|
|
4166
|
+
super();
|
|
4167
|
+
this.options = options;
|
|
4168
|
+
}
|
|
4169
|
+
getData() {
|
|
4170
|
+
return this.options.getData();
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4174
|
+
get kind() {
|
|
4175
|
+
return this._kind;
|
|
4176
|
+
}
|
|
4177
|
+
constructor(options) {
|
|
4178
|
+
super(options);
|
|
4179
|
+
this._kind = options.kind;
|
|
4180
|
+
}
|
|
4181
|
+
}
|
|
4182
|
+
class WillShowOverlayLocationEvent {
|
|
4183
|
+
get kind() {
|
|
4184
|
+
return this._kind;
|
|
4185
|
+
}
|
|
4186
|
+
get nativeEvent() {
|
|
4187
|
+
return this.event.nativeEvent;
|
|
4188
|
+
}
|
|
4189
|
+
get position() {
|
|
4190
|
+
return this.event.position;
|
|
4191
|
+
}
|
|
4192
|
+
get defaultPrevented() {
|
|
4193
|
+
return this.event.defaultPrevented;
|
|
4194
|
+
}
|
|
4195
|
+
preventDefault() {
|
|
4196
|
+
this.event.preventDefault();
|
|
4197
|
+
}
|
|
4198
|
+
constructor(event, options) {
|
|
4199
|
+
this.event = event;
|
|
4200
|
+
this._kind = options.kind;
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4015
4203
|
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
4016
4204
|
get element() {
|
|
4017
4205
|
throw new Error('not supported');
|
|
@@ -4057,7 +4245,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4057
4245
|
this._location = value;
|
|
4058
4246
|
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4059
4247
|
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4060
|
-
switch (value) {
|
|
4248
|
+
switch (value.type) {
|
|
4061
4249
|
case 'grid':
|
|
4062
4250
|
this.contentContainer.dropTarget.setTargetZones([
|
|
4063
4251
|
'top',
|
|
@@ -4093,7 +4281,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4093
4281
|
this.groupPanel = groupPanel;
|
|
4094
4282
|
this._isGroupActive = false;
|
|
4095
4283
|
this._locked = false;
|
|
4096
|
-
this._location = 'grid';
|
|
4284
|
+
this._location = { type: 'grid' };
|
|
4097
4285
|
this.mostRecentlyUsed = [];
|
|
4098
4286
|
this._onDidChange = new Emitter();
|
|
4099
4287
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -4104,6 +4292,10 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4104
4292
|
this.onMove = this._onMove.event;
|
|
4105
4293
|
this._onDidDrop = new Emitter();
|
|
4106
4294
|
this.onDidDrop = this._onDidDrop.event;
|
|
4295
|
+
this._onWillDrop = new Emitter();
|
|
4296
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
4297
|
+
this._onWillShowOverlay = new Emitter();
|
|
4298
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4107
4299
|
this._onTabDragStart = new Emitter();
|
|
4108
4300
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
4109
4301
|
this._onGroupDragStart = new Emitter();
|
|
@@ -4114,46 +4306,69 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4114
4306
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4115
4307
|
this._onDidActivePanelChange = new Emitter();
|
|
4116
4308
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4309
|
+
this._overwriteRenderContainer = null;
|
|
4117
4310
|
toggleClass(this.container, 'groupview', true);
|
|
4311
|
+
this._api = new DockviewApi(this.accessor);
|
|
4118
4312
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
4119
4313
|
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
4120
4314
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
4121
4315
|
this.header.hidden = !!options.hideHeader;
|
|
4122
4316
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
4123
|
-
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this.tabsContainer.onTabDragStart((event) => {
|
|
4317
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
4124
4318
|
this._onTabDragStart.fire(event);
|
|
4125
4319
|
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
4126
4320
|
this._onGroupDragStart.fire(event);
|
|
4127
4321
|
}), this.tabsContainer.onDrop((event) => {
|
|
4128
|
-
this.handleDropEvent(event.event, 'center', event.index);
|
|
4322
|
+
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
4129
4323
|
}), this.contentContainer.onDidFocus(() => {
|
|
4130
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4324
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4131
4325
|
}), this.contentContainer.onDidBlur(() => {
|
|
4132
4326
|
// noop
|
|
4133
4327
|
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
4134
|
-
this.handleDropEvent(event.nativeEvent, event.position);
|
|
4135
|
-
}), this.
|
|
4328
|
+
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
4329
|
+
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
4330
|
+
this._onWillShowOverlay.fire(event);
|
|
4331
|
+
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
4332
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4333
|
+
kind: 'content',
|
|
4334
|
+
}));
|
|
4335
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
4336
|
+
}
|
|
4337
|
+
focusContent() {
|
|
4338
|
+
this.contentContainer.element.focus();
|
|
4339
|
+
}
|
|
4340
|
+
set renderContainer(value) {
|
|
4341
|
+
this.panels.forEach((panel) => {
|
|
4342
|
+
this.renderContainer.detatch(panel);
|
|
4343
|
+
});
|
|
4344
|
+
this._overwriteRenderContainer = value;
|
|
4345
|
+
this.panels.forEach((panel) => {
|
|
4346
|
+
this.rerender(panel);
|
|
4347
|
+
});
|
|
4348
|
+
}
|
|
4349
|
+
get renderContainer() {
|
|
4350
|
+
var _a;
|
|
4351
|
+
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
4136
4352
|
}
|
|
4137
4353
|
initialize() {
|
|
4138
|
-
|
|
4139
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
|
|
4354
|
+
if (this.options.panels) {
|
|
4140
4355
|
this.options.panels.forEach((panel) => {
|
|
4141
4356
|
this.doAddPanel(panel);
|
|
4142
4357
|
});
|
|
4143
4358
|
}
|
|
4144
|
-
if (
|
|
4359
|
+
if (this.options.activePanel) {
|
|
4145
4360
|
this.openPanel(this.options.activePanel);
|
|
4146
4361
|
}
|
|
4147
4362
|
// must be run after the constructor otherwise this.parent may not be
|
|
4148
4363
|
// correctly initialized
|
|
4149
|
-
this.setActive(this.isActive, true
|
|
4364
|
+
this.setActive(this.isActive, true);
|
|
4150
4365
|
this.updateContainer();
|
|
4151
4366
|
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
4152
4367
|
this._rightHeaderActions =
|
|
4153
4368
|
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
4154
4369
|
this.addDisposables(this._rightHeaderActions);
|
|
4155
4370
|
this._rightHeaderActions.init({
|
|
4156
|
-
containerApi:
|
|
4371
|
+
containerApi: this._api,
|
|
4157
4372
|
api: this.groupPanel.api,
|
|
4158
4373
|
});
|
|
4159
4374
|
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
@@ -4163,7 +4378,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4163
4378
|
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
4164
4379
|
this.addDisposables(this._leftHeaderActions);
|
|
4165
4380
|
this._leftHeaderActions.init({
|
|
4166
|
-
containerApi:
|
|
4381
|
+
containerApi: this._api,
|
|
4167
4382
|
api: this.groupPanel.api,
|
|
4168
4383
|
});
|
|
4169
4384
|
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
@@ -4173,7 +4388,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4173
4388
|
this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
|
|
4174
4389
|
this.addDisposables(this._prefixHeaderActions);
|
|
4175
4390
|
this._prefixHeaderActions.init({
|
|
4176
|
-
containerApi:
|
|
4391
|
+
containerApi: this._api,
|
|
4177
4392
|
api: this.groupPanel.api,
|
|
4178
4393
|
});
|
|
4179
4394
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
@@ -4253,35 +4468,45 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4253
4468
|
//noop
|
|
4254
4469
|
}
|
|
4255
4470
|
focus() {
|
|
4256
|
-
var _a
|
|
4257
|
-
(
|
|
4471
|
+
var _a;
|
|
4472
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4258
4473
|
}
|
|
4259
4474
|
openPanel(panel, options = {}) {
|
|
4475
|
+
/**
|
|
4476
|
+
* set the panel group
|
|
4477
|
+
* add the panel
|
|
4478
|
+
* check if group active
|
|
4479
|
+
* check if panel active
|
|
4480
|
+
*/
|
|
4260
4481
|
if (typeof options.index !== 'number' ||
|
|
4261
4482
|
options.index > this.panels.length) {
|
|
4262
4483
|
options.index = this.panels.length;
|
|
4263
4484
|
}
|
|
4264
|
-
const
|
|
4265
|
-
const skipSetGroupActive = !!options.skipSetGroupActive;
|
|
4485
|
+
const skipSetActive = !!options.skipSetActive;
|
|
4266
4486
|
// ensure the group is updated before we fire any events
|
|
4267
|
-
panel.updateParentGroup(this.groupPanel,
|
|
4487
|
+
panel.updateParentGroup(this.groupPanel, {
|
|
4488
|
+
skipSetActive: options.skipSetActive,
|
|
4489
|
+
});
|
|
4490
|
+
this.doAddPanel(panel, options.index, {
|
|
4491
|
+
skipSetActive: skipSetActive,
|
|
4492
|
+
});
|
|
4268
4493
|
if (this._activePanel === panel) {
|
|
4269
|
-
if (!skipSetGroupActive) {
|
|
4270
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4271
|
-
}
|
|
4272
4494
|
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
4273
4495
|
return;
|
|
4274
4496
|
}
|
|
4275
|
-
|
|
4276
|
-
if (!skipSetPanelActive) {
|
|
4497
|
+
if (!skipSetActive) {
|
|
4277
4498
|
this.doSetActivePanel(panel);
|
|
4278
4499
|
}
|
|
4279
|
-
if (!skipSetGroupActive) {
|
|
4280
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4500
|
+
if (!options.skipSetGroupActive) {
|
|
4501
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4502
|
+
}
|
|
4503
|
+
if (!options.skipSetActive) {
|
|
4504
|
+
this.updateContainer();
|
|
4281
4505
|
}
|
|
4282
|
-
this.updateContainer();
|
|
4283
4506
|
}
|
|
4284
|
-
removePanel(groupItemOrId
|
|
4507
|
+
removePanel(groupItemOrId, options = {
|
|
4508
|
+
skipSetActive: false,
|
|
4509
|
+
}) {
|
|
4285
4510
|
const id = typeof groupItemOrId === 'string'
|
|
4286
4511
|
? groupItemOrId
|
|
4287
4512
|
: groupItemOrId.id;
|
|
@@ -4289,7 +4514,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4289
4514
|
if (!panelToRemove) {
|
|
4290
4515
|
throw new Error('invalid operation');
|
|
4291
4516
|
}
|
|
4292
|
-
return this._removePanel(panelToRemove);
|
|
4517
|
+
return this._removePanel(panelToRemove, options);
|
|
4293
4518
|
}
|
|
4294
4519
|
closeAllPanels() {
|
|
4295
4520
|
if (this.panels.length > 0) {
|
|
@@ -4315,12 +4540,8 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4315
4540
|
updateActions(element) {
|
|
4316
4541
|
this.tabsContainer.setRightActionsElement(element);
|
|
4317
4542
|
}
|
|
4318
|
-
setActive(isGroupActive,
|
|
4319
|
-
var _a, _b, _c, _d;
|
|
4543
|
+
setActive(isGroupActive, force = false) {
|
|
4320
4544
|
if (!force && this.isActive === isGroupActive) {
|
|
4321
|
-
if (!skipFocus) {
|
|
4322
|
-
(_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4323
|
-
}
|
|
4324
4545
|
return;
|
|
4325
4546
|
}
|
|
4326
4547
|
this._isGroupActive = isGroupActive;
|
|
@@ -4331,11 +4552,6 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4331
4552
|
this.doSetActivePanel(this.panels[0]);
|
|
4332
4553
|
}
|
|
4333
4554
|
this.updateContainer();
|
|
4334
|
-
if (isGroupActive) {
|
|
4335
|
-
if (!skipFocus) {
|
|
4336
|
-
(_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
4337
|
-
}
|
|
4338
|
-
}
|
|
4339
4555
|
}
|
|
4340
4556
|
layout(width, height) {
|
|
4341
4557
|
var _a;
|
|
@@ -4346,17 +4562,22 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4346
4562
|
this._activePanel.layout(this._width, this._height);
|
|
4347
4563
|
}
|
|
4348
4564
|
}
|
|
4349
|
-
_removePanel(panel) {
|
|
4565
|
+
_removePanel(panel, options) {
|
|
4350
4566
|
const isActivePanel = this._activePanel === panel;
|
|
4351
4567
|
this.doRemovePanel(panel);
|
|
4352
4568
|
if (isActivePanel && this.panels.length > 0) {
|
|
4353
4569
|
const nextPanel = this.mostRecentlyUsed[0];
|
|
4354
|
-
this.openPanel(nextPanel
|
|
4570
|
+
this.openPanel(nextPanel, {
|
|
4571
|
+
skipSetActive: options.skipSetActive,
|
|
4572
|
+
skipSetGroupActive: options.skipSetActiveGroup,
|
|
4573
|
+
});
|
|
4355
4574
|
}
|
|
4356
4575
|
if (this._activePanel && this.panels.length === 0) {
|
|
4357
4576
|
this.doSetActivePanel(undefined);
|
|
4358
4577
|
}
|
|
4359
|
-
|
|
4578
|
+
if (!options.skipSetActive) {
|
|
4579
|
+
this.updateContainer();
|
|
4580
|
+
}
|
|
4360
4581
|
return panel;
|
|
4361
4582
|
}
|
|
4362
4583
|
doRemovePanel(panel) {
|
|
@@ -4371,13 +4592,13 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4371
4592
|
}
|
|
4372
4593
|
this._onDidRemovePanel.fire({ panel });
|
|
4373
4594
|
}
|
|
4374
|
-
doAddPanel(panel, index = this.panels.length,
|
|
4595
|
+
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
4375
4596
|
const existingPanel = this._panels.indexOf(panel);
|
|
4376
4597
|
const hasExistingPanel = existingPanel > -1;
|
|
4377
4598
|
this.tabsContainer.show();
|
|
4378
4599
|
this.contentContainer.show();
|
|
4379
4600
|
this.tabsContainer.openPanel(panel, index);
|
|
4380
|
-
if (!skipSetActive) {
|
|
4601
|
+
if (!options.skipSetActive) {
|
|
4381
4602
|
this.contentContainer.openPanel(panel);
|
|
4382
4603
|
}
|
|
4383
4604
|
if (hasExistingPanel) {
|
|
@@ -4389,12 +4610,17 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4389
4610
|
this._onDidAddPanel.fire({ panel });
|
|
4390
4611
|
}
|
|
4391
4612
|
doSetActivePanel(panel) {
|
|
4613
|
+
if (this._activePanel === panel) {
|
|
4614
|
+
return;
|
|
4615
|
+
}
|
|
4392
4616
|
this._activePanel = panel;
|
|
4393
4617
|
if (panel) {
|
|
4394
4618
|
this.tabsContainer.setActivePanel(panel);
|
|
4395
4619
|
panel.layout(this._width, this._height);
|
|
4396
4620
|
this.updateMru(panel);
|
|
4397
|
-
this._onDidActivePanelChange.fire({
|
|
4621
|
+
this._onDidActivePanelChange.fire({
|
|
4622
|
+
panel,
|
|
4623
|
+
});
|
|
4398
4624
|
}
|
|
4399
4625
|
}
|
|
4400
4626
|
updateMru(panel) {
|
|
@@ -4406,11 +4632,11 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4406
4632
|
updateContainer() {
|
|
4407
4633
|
var _a, _b;
|
|
4408
4634
|
toggleClass(this.container, 'empty', this.isEmpty);
|
|
4409
|
-
this.panels.forEach((panel) => panel.
|
|
4635
|
+
this.panels.forEach((panel) => panel.runEvents());
|
|
4410
4636
|
if (this.isEmpty && !this.watermark) {
|
|
4411
4637
|
const watermark = this.accessor.createWatermarkComponent();
|
|
4412
4638
|
watermark.init({
|
|
4413
|
-
containerApi:
|
|
4639
|
+
containerApi: this._api,
|
|
4414
4640
|
group: this.groupPanel,
|
|
4415
4641
|
});
|
|
4416
4642
|
this.watermark = watermark;
|
|
@@ -4443,10 +4669,32 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4443
4669
|
}
|
|
4444
4670
|
return false;
|
|
4445
4671
|
}
|
|
4446
|
-
handleDropEvent(event, position, index) {
|
|
4672
|
+
handleDropEvent(type, event, position, index) {
|
|
4447
4673
|
if (this.locked === 'no-drop-target') {
|
|
4448
4674
|
return;
|
|
4449
4675
|
}
|
|
4676
|
+
function getKind() {
|
|
4677
|
+
switch (type) {
|
|
4678
|
+
case 'header':
|
|
4679
|
+
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
4680
|
+
case 'content':
|
|
4681
|
+
return 'content';
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
4685
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
4686
|
+
nativeEvent: event,
|
|
4687
|
+
position,
|
|
4688
|
+
panel,
|
|
4689
|
+
getData: () => getPanelData(),
|
|
4690
|
+
kind: getKind(),
|
|
4691
|
+
group: this.groupPanel,
|
|
4692
|
+
api: this._api,
|
|
4693
|
+
});
|
|
4694
|
+
this._onWillDrop.fire(willDropEvent);
|
|
4695
|
+
if (willDropEvent.defaultPrevented) {
|
|
4696
|
+
return;
|
|
4697
|
+
}
|
|
4450
4698
|
const data = getPanelData();
|
|
4451
4699
|
if (data && data.viewId === this.accessor.id) {
|
|
4452
4700
|
if (data.panelId === null) {
|
|
@@ -4479,12 +4727,14 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4479
4727
|
});
|
|
4480
4728
|
}
|
|
4481
4729
|
else {
|
|
4482
|
-
this._onDidDrop.fire({
|
|
4730
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
4483
4731
|
nativeEvent: event,
|
|
4484
4732
|
position,
|
|
4485
|
-
|
|
4733
|
+
panel,
|
|
4486
4734
|
getData: () => getPanelData(),
|
|
4487
|
-
|
|
4735
|
+
group: this.groupPanel,
|
|
4736
|
+
api: this._api,
|
|
4737
|
+
}));
|
|
4488
4738
|
}
|
|
4489
4739
|
}
|
|
4490
4740
|
dispose() {
|
|
@@ -4492,6 +4742,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4492
4742
|
super.dispose();
|
|
4493
4743
|
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
4494
4744
|
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4745
|
+
this.watermark = undefined;
|
|
4495
4746
|
for (const panel of this.panels) {
|
|
4496
4747
|
panel.dispose();
|
|
4497
4748
|
}
|
|
@@ -4513,15 +4764,7 @@ class Resizable extends CompositeDisposable {
|
|
|
4513
4764
|
constructor(parentElement, disableResizing = false) {
|
|
4514
4765
|
super();
|
|
4515
4766
|
this._disableResizing = disableResizing;
|
|
4516
|
-
|
|
4517
|
-
this._element = parentElement;
|
|
4518
|
-
}
|
|
4519
|
-
else {
|
|
4520
|
-
this._element = document.createElement('div');
|
|
4521
|
-
this._element.style.height = '100%';
|
|
4522
|
-
this._element.style.width = '100%';
|
|
4523
|
-
this._element.className = 'dv-resizable-container';
|
|
4524
|
-
}
|
|
4767
|
+
this._element = parentElement;
|
|
4525
4768
|
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
4526
4769
|
if (this.isDisposed) {
|
|
4527
4770
|
/**
|
|
@@ -4609,25 +4852,38 @@ class BaseGrid extends Resizable {
|
|
|
4609
4852
|
get activeGroup() {
|
|
4610
4853
|
return this._activeGroup;
|
|
4611
4854
|
}
|
|
4855
|
+
get locked() {
|
|
4856
|
+
return this.gridview.locked;
|
|
4857
|
+
}
|
|
4858
|
+
set locked(value) {
|
|
4859
|
+
this.gridview.locked = value;
|
|
4860
|
+
}
|
|
4612
4861
|
constructor(options) {
|
|
4613
|
-
super(
|
|
4862
|
+
super(document.createElement('div'), options.disableAutoResizing);
|
|
4614
4863
|
this._id = nextLayoutId$1.next();
|
|
4615
4864
|
this._groups = new Map();
|
|
4616
4865
|
this._onDidLayoutChange = new Emitter();
|
|
4617
4866
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
4618
|
-
this.
|
|
4619
|
-
this.
|
|
4620
|
-
this.
|
|
4621
|
-
this.
|
|
4622
|
-
this.
|
|
4623
|
-
this.
|
|
4867
|
+
this._onDidRemove = new Emitter();
|
|
4868
|
+
this.onDidRemove = this._onDidRemove.event;
|
|
4869
|
+
this._onDidAdd = new Emitter();
|
|
4870
|
+
this.onDidAdd = this._onDidAdd.event;
|
|
4871
|
+
this._onDidActiveChange = new Emitter();
|
|
4872
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4624
4873
|
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
4874
|
+
this.element.style.height = '100%';
|
|
4875
|
+
this.element.style.width = '100%';
|
|
4876
|
+
options.parentElement.appendChild(this.element);
|
|
4625
4877
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
4878
|
+
this.gridview.locked = !!options.locked;
|
|
4626
4879
|
this.element.appendChild(this.gridview.element);
|
|
4627
4880
|
this.layout(0, 0, true); // set some elements height/widths
|
|
4628
|
-
this.addDisposables(
|
|
4881
|
+
this.addDisposables(Disposable.from(() => {
|
|
4882
|
+
var _a;
|
|
4883
|
+
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
4884
|
+
}), this.gridview.onDidChange(() => {
|
|
4629
4885
|
this._bufferOnDidLayoutChange.fire();
|
|
4630
|
-
}), exports.DockviewEvent.any(this.
|
|
4886
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
4631
4887
|
this._bufferOnDidLayoutChange.fire();
|
|
4632
4888
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
4633
4889
|
this._onDidLayoutChange.fire();
|
|
@@ -4642,6 +4898,7 @@ class BaseGrid extends Resizable {
|
|
|
4642
4898
|
}
|
|
4643
4899
|
maximizeGroup(panel) {
|
|
4644
4900
|
this.gridview.maximizeView(panel);
|
|
4901
|
+
this.doSetGroupActive(panel);
|
|
4645
4902
|
}
|
|
4646
4903
|
isMaximizedGroup(panel) {
|
|
4647
4904
|
return this.gridview.maximizedView() === panel;
|
|
@@ -4652,13 +4909,12 @@ class BaseGrid extends Resizable {
|
|
|
4652
4909
|
hasMaximizedGroup() {
|
|
4653
4910
|
return this.gridview.hasMaximizedView();
|
|
4654
4911
|
}
|
|
4655
|
-
get
|
|
4656
|
-
return this.gridview.
|
|
4912
|
+
get onDidMaximizedGroupChange() {
|
|
4913
|
+
return this.gridview.onDidMaximizedNodeChange;
|
|
4657
4914
|
}
|
|
4658
4915
|
doAddGroup(group, location = [0], size) {
|
|
4659
4916
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
4660
|
-
this.
|
|
4661
|
-
this.doSetGroupActive(group);
|
|
4917
|
+
this._onDidAdd.fire(group);
|
|
4662
4918
|
}
|
|
4663
4919
|
doRemoveGroup(group, options) {
|
|
4664
4920
|
if (!this._groups.has(group.id)) {
|
|
@@ -4670,8 +4926,8 @@ class BaseGrid extends Resizable {
|
|
|
4670
4926
|
item.disposable.dispose();
|
|
4671
4927
|
item.value.dispose();
|
|
4672
4928
|
this._groups.delete(group.id);
|
|
4929
|
+
this._onDidRemove.fire(group);
|
|
4673
4930
|
}
|
|
4674
|
-
this._onDidRemoveGroup.fire(group);
|
|
4675
4931
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
4676
4932
|
const groups = Array.from(this._groups.values());
|
|
4677
4933
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -4682,25 +4938,18 @@ class BaseGrid extends Resizable {
|
|
|
4682
4938
|
var _a;
|
|
4683
4939
|
return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4684
4940
|
}
|
|
4685
|
-
doSetGroupActive(group
|
|
4686
|
-
var _a, _b, _c;
|
|
4941
|
+
doSetGroupActive(group) {
|
|
4687
4942
|
if (this._activeGroup === group) {
|
|
4688
4943
|
return;
|
|
4689
4944
|
}
|
|
4690
4945
|
if (this._activeGroup) {
|
|
4691
4946
|
this._activeGroup.setActive(false);
|
|
4692
|
-
if (!skipFocus) {
|
|
4693
|
-
(_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4694
|
-
}
|
|
4695
4947
|
}
|
|
4696
4948
|
if (group) {
|
|
4697
4949
|
group.setActive(true);
|
|
4698
|
-
if (!skipFocus) {
|
|
4699
|
-
(_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
|
|
4700
|
-
}
|
|
4701
4950
|
}
|
|
4702
4951
|
this._activeGroup = group;
|
|
4703
|
-
this.
|
|
4952
|
+
this._onDidActiveChange.fire(group);
|
|
4704
4953
|
}
|
|
4705
4954
|
removeGroup(group) {
|
|
4706
4955
|
this.doRemoveGroup(group);
|
|
@@ -4745,9 +4994,9 @@ class BaseGrid extends Resizable {
|
|
|
4745
4994
|
this.gridview.layout(width, height);
|
|
4746
4995
|
}
|
|
4747
4996
|
dispose() {
|
|
4748
|
-
this.
|
|
4749
|
-
this.
|
|
4750
|
-
this.
|
|
4997
|
+
this._onDidActiveChange.dispose();
|
|
4998
|
+
this._onDidAdd.dispose();
|
|
4999
|
+
this._onDidRemove.dispose();
|
|
4751
5000
|
this._onDidLayoutChange.dispose();
|
|
4752
5001
|
for (const group of this.groups) {
|
|
4753
5002
|
group.dispose();
|
|
@@ -4757,11 +5006,15 @@ class BaseGrid extends Resizable {
|
|
|
4757
5006
|
}
|
|
4758
5007
|
}
|
|
4759
5008
|
|
|
5009
|
+
class WillFocusEvent extends DockviewEvent {
|
|
5010
|
+
constructor() {
|
|
5011
|
+
super();
|
|
5012
|
+
}
|
|
5013
|
+
}
|
|
4760
5014
|
/**
|
|
4761
5015
|
* A core api implementation that should be used across all panel-like objects
|
|
4762
5016
|
*/
|
|
4763
5017
|
class PanelApiImpl extends CompositeDisposable {
|
|
4764
|
-
//
|
|
4765
5018
|
get isFocused() {
|
|
4766
5019
|
return this._isFocused;
|
|
4767
5020
|
}
|
|
@@ -4786,35 +5039,22 @@ class PanelApiImpl extends CompositeDisposable {
|
|
|
4786
5039
|
this._width = 0;
|
|
4787
5040
|
this._height = 0;
|
|
4788
5041
|
this.panelUpdatesDisposable = new MutableDisposable();
|
|
4789
|
-
this._onDidDimensionChange = new Emitter(
|
|
4790
|
-
replay: true,
|
|
4791
|
-
});
|
|
5042
|
+
this._onDidDimensionChange = new Emitter();
|
|
4792
5043
|
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
4793
|
-
|
|
4794
|
-
this._onDidChangeFocus = new Emitter({
|
|
4795
|
-
replay: true,
|
|
4796
|
-
});
|
|
5044
|
+
this._onDidChangeFocus = new Emitter();
|
|
4797
5045
|
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
4798
5046
|
//
|
|
4799
|
-
this.
|
|
4800
|
-
this.
|
|
5047
|
+
this._onWillFocus = new Emitter();
|
|
5048
|
+
this.onWillFocus = this._onWillFocus.event;
|
|
4801
5049
|
//
|
|
4802
|
-
this._onDidVisibilityChange = new Emitter(
|
|
4803
|
-
replay: true,
|
|
4804
|
-
});
|
|
5050
|
+
this._onDidVisibilityChange = new Emitter();
|
|
4805
5051
|
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
4806
|
-
|
|
4807
|
-
this.
|
|
4808
|
-
this.
|
|
4809
|
-
//
|
|
4810
|
-
this._onDidActiveChange = new Emitter({
|
|
4811
|
-
replay: true,
|
|
4812
|
-
});
|
|
5052
|
+
this._onWillVisibilityChange = new Emitter();
|
|
5053
|
+
this.onWillVisibilityChange = this._onWillVisibilityChange.event;
|
|
5054
|
+
this._onDidActiveChange = new Emitter();
|
|
4813
5055
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4814
|
-
//
|
|
4815
5056
|
this._onActiveChange = new Emitter();
|
|
4816
5057
|
this.onActiveChange = this._onActiveChange.event;
|
|
4817
|
-
//
|
|
4818
5058
|
this._onUpdateParameters = new Emitter();
|
|
4819
5059
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
4820
5060
|
this.addDisposables(this.onDidFocusChange((event) => {
|
|
@@ -4826,7 +5066,7 @@ class PanelApiImpl extends CompositeDisposable {
|
|
|
4826
5066
|
}), this.onDidDimensionsChange((event) => {
|
|
4827
5067
|
this._width = event.width;
|
|
4828
5068
|
this._height = event.height;
|
|
4829
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this.
|
|
5069
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
|
|
4830
5070
|
}
|
|
4831
5071
|
initialize(panel) {
|
|
4832
5072
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
@@ -4836,7 +5076,7 @@ class PanelApiImpl extends CompositeDisposable {
|
|
|
4836
5076
|
});
|
|
4837
5077
|
}
|
|
4838
5078
|
setVisible(isVisible) {
|
|
4839
|
-
this.
|
|
5079
|
+
this._onWillVisibilityChange.fire({ isVisible });
|
|
4840
5080
|
}
|
|
4841
5081
|
setActive() {
|
|
4842
5082
|
this._onActiveChange.fire();
|
|
@@ -4844,9 +5084,6 @@ class PanelApiImpl extends CompositeDisposable {
|
|
|
4844
5084
|
updateParameters(parameters) {
|
|
4845
5085
|
this._onUpdateParameters.fire(parameters);
|
|
4846
5086
|
}
|
|
4847
|
-
dispose() {
|
|
4848
|
-
super.dispose();
|
|
4849
|
-
}
|
|
4850
5087
|
}
|
|
4851
5088
|
|
|
4852
5089
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
@@ -4934,7 +5171,12 @@ class BasePanelView extends CompositeDisposable {
|
|
|
4934
5171
|
}), focusTracker);
|
|
4935
5172
|
}
|
|
4936
5173
|
focus() {
|
|
4937
|
-
|
|
5174
|
+
const event = new WillFocusEvent();
|
|
5175
|
+
this.api._onWillFocus.fire(event);
|
|
5176
|
+
if (event.defaultPrevented) {
|
|
5177
|
+
return;
|
|
5178
|
+
}
|
|
5179
|
+
this._element.focus();
|
|
4938
5180
|
}
|
|
4939
5181
|
layout(width, height) {
|
|
4940
5182
|
this._width = width;
|
|
@@ -5052,7 +5294,11 @@ class PaneviewPanel extends BasePanelView {
|
|
|
5052
5294
|
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
5053
5295
|
this._orientation = orientation;
|
|
5054
5296
|
this.element.classList.add('pane');
|
|
5055
|
-
this.addDisposables(this.api.
|
|
5297
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
5298
|
+
const { isVisible } = event;
|
|
5299
|
+
const { accessor } = this._params;
|
|
5300
|
+
accessor.setVisible(this, isVisible);
|
|
5301
|
+
}), this.api.onDidSizeChange((event) => {
|
|
5056
5302
|
this._onDidChange.fire({ size: event.size });
|
|
5057
5303
|
}), addDisposableListener(this.element, 'mouseenter', (ev) => {
|
|
5058
5304
|
this.api._onMouseEnter.fire(ev);
|
|
@@ -5263,9 +5509,7 @@ class GridviewPanelApiImpl extends PanelApiImpl {
|
|
|
5263
5509
|
super(id);
|
|
5264
5510
|
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5265
5511
|
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5266
|
-
this._onDidConstraintsChange = new Emitter(
|
|
5267
|
-
replay: true,
|
|
5268
|
-
});
|
|
5512
|
+
this._onDidConstraintsChange = new Emitter();
|
|
5269
5513
|
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
5270
5514
|
this._onDidSizeChange = new Emitter();
|
|
5271
5515
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
@@ -5358,13 +5602,13 @@ class GridviewPanel extends BasePanelView {
|
|
|
5358
5602
|
this._maximumHeight = options.maximumHeight;
|
|
5359
5603
|
}
|
|
5360
5604
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
5361
|
-
this.addDisposables(this.api.
|
|
5605
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
5362
5606
|
const { isVisible } = event;
|
|
5363
5607
|
const { accessor } = this._params;
|
|
5364
5608
|
accessor.setVisible(this, isVisible);
|
|
5365
5609
|
}), this.api.onActiveChange(() => {
|
|
5366
5610
|
const { accessor } = this._params;
|
|
5367
|
-
accessor.
|
|
5611
|
+
accessor.doSetGroupActive(this);
|
|
5368
5612
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
5369
5613
|
if (typeof event.minimumWidth === 'number' ||
|
|
5370
5614
|
typeof event.minimumWidth === 'function') {
|
|
@@ -5447,6 +5691,17 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5447
5691
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5448
5692
|
this.addDisposables(this._onDidLocationChange);
|
|
5449
5693
|
}
|
|
5694
|
+
close() {
|
|
5695
|
+
if (!this._group) {
|
|
5696
|
+
return;
|
|
5697
|
+
}
|
|
5698
|
+
return this.accessor.removeGroup(this._group);
|
|
5699
|
+
}
|
|
5700
|
+
getWindow() {
|
|
5701
|
+
return this.location.type === 'popout'
|
|
5702
|
+
? this.location.getWindow()
|
|
5703
|
+
: window;
|
|
5704
|
+
}
|
|
5450
5705
|
moveTo(options) {
|
|
5451
5706
|
var _a, _b, _c;
|
|
5452
5707
|
if (!this._group) {
|
|
@@ -5454,14 +5709,23 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5454
5709
|
}
|
|
5455
5710
|
const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
|
|
5456
5711
|
direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
|
|
5712
|
+
skipSetActive: true,
|
|
5713
|
+
});
|
|
5714
|
+
this.accessor.moveGroupOrPanel({
|
|
5715
|
+
from: { groupId: this._group.id },
|
|
5716
|
+
to: {
|
|
5717
|
+
group,
|
|
5718
|
+
position: options.group
|
|
5719
|
+
? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
|
|
5720
|
+
: 'center',
|
|
5721
|
+
},
|
|
5457
5722
|
});
|
|
5458
|
-
this.accessor.moveGroupOrPanel(group, this._group.id, undefined, options.group ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center' : 'center');
|
|
5459
5723
|
}
|
|
5460
5724
|
maximize() {
|
|
5461
5725
|
if (!this._group) {
|
|
5462
5726
|
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5463
5727
|
}
|
|
5464
|
-
if (this.location !== 'grid') {
|
|
5728
|
+
if (this.location.type !== 'grid') {
|
|
5465
5729
|
// only grid groups can be maximized
|
|
5466
5730
|
return;
|
|
5467
5731
|
}
|
|
@@ -5518,6 +5782,12 @@ class DockviewGroupPanel extends GridviewPanel {
|
|
|
5518
5782
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
5519
5783
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
5520
5784
|
}
|
|
5785
|
+
focus() {
|
|
5786
|
+
if (!this.api.isActive) {
|
|
5787
|
+
this.api.setActive();
|
|
5788
|
+
}
|
|
5789
|
+
super.focus();
|
|
5790
|
+
}
|
|
5521
5791
|
initialize() {
|
|
5522
5792
|
this._model.initialize();
|
|
5523
5793
|
}
|
|
@@ -5563,6 +5833,9 @@ function isGroupOptionsWithGroup(data) {
|
|
|
5563
5833
|
}
|
|
5564
5834
|
|
|
5565
5835
|
class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
5836
|
+
get location() {
|
|
5837
|
+
return this.group.api.location;
|
|
5838
|
+
}
|
|
5566
5839
|
get title() {
|
|
5567
5840
|
return this.panel.title;
|
|
5568
5841
|
}
|
|
@@ -5573,16 +5846,14 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5573
5846
|
return this.panel.renderer;
|
|
5574
5847
|
}
|
|
5575
5848
|
set group(value) {
|
|
5576
|
-
const
|
|
5577
|
-
this._group
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
this.
|
|
5581
|
-
|
|
5849
|
+
const oldGroup = this._group;
|
|
5850
|
+
if (this._group !== value) {
|
|
5851
|
+
this._group = value;
|
|
5852
|
+
this._onDidGroupChange.fire({});
|
|
5853
|
+
this.setupGroupEventListeners(oldGroup);
|
|
5854
|
+
this._onDidLocationChange.fire({
|
|
5855
|
+
location: this.group.api.location,
|
|
5582
5856
|
});
|
|
5583
|
-
if (this.isGroupActive !== isOldGroupActive) {
|
|
5584
|
-
this._onDidActiveGroupChange.fire();
|
|
5585
|
-
}
|
|
5586
5857
|
}
|
|
5587
5858
|
}
|
|
5588
5859
|
get group() {
|
|
@@ -5600,14 +5871,27 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5600
5871
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
5601
5872
|
this._onDidRendererChange = new Emitter();
|
|
5602
5873
|
this.onDidRendererChange = this._onDidRendererChange.event;
|
|
5603
|
-
this.
|
|
5874
|
+
this._onDidLocationChange = new Emitter();
|
|
5875
|
+
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5876
|
+
this.groupEventsDisposable = new MutableDisposable();
|
|
5604
5877
|
this.initialize(panel);
|
|
5605
5878
|
this._group = group;
|
|
5606
|
-
this.
|
|
5879
|
+
this.setupGroupEventListeners();
|
|
5880
|
+
this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
|
|
5881
|
+
}
|
|
5882
|
+
getWindow() {
|
|
5883
|
+
return this.group.api.getWindow();
|
|
5607
5884
|
}
|
|
5608
5885
|
moveTo(options) {
|
|
5609
5886
|
var _a;
|
|
5610
|
-
this.accessor.moveGroupOrPanel(
|
|
5887
|
+
this.accessor.moveGroupOrPanel({
|
|
5888
|
+
from: { groupId: this._group.id, panelId: this.panel.id },
|
|
5889
|
+
to: {
|
|
5890
|
+
group: options.group,
|
|
5891
|
+
position: (_a = options.position) !== null && _a !== void 0 ? _a : 'center',
|
|
5892
|
+
index: options.index,
|
|
5893
|
+
},
|
|
5894
|
+
});
|
|
5611
5895
|
}
|
|
5612
5896
|
setTitle(title) {
|
|
5613
5897
|
this.panel.setTitle(title);
|
|
@@ -5627,6 +5911,35 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5627
5911
|
exitMaximized() {
|
|
5628
5912
|
this.group.api.exitMaximized();
|
|
5629
5913
|
}
|
|
5914
|
+
setupGroupEventListeners(previousGroup) {
|
|
5915
|
+
var _a;
|
|
5916
|
+
let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
|
|
5917
|
+
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
|
|
5918
|
+
if (!event.isVisible && this.isVisible) {
|
|
5919
|
+
this._onDidVisibilityChange.fire(event);
|
|
5920
|
+
}
|
|
5921
|
+
else if (event.isVisible &&
|
|
5922
|
+
!this.isVisible &&
|
|
5923
|
+
this.group.model.isPanelActive(this.panel)) {
|
|
5924
|
+
this._onDidVisibilityChange.fire(event);
|
|
5925
|
+
}
|
|
5926
|
+
}), this.group.api.onDidLocationChange((event) => {
|
|
5927
|
+
if (this.group !== this.panel.group) {
|
|
5928
|
+
return;
|
|
5929
|
+
}
|
|
5930
|
+
this._onDidLocationChange.fire(event);
|
|
5931
|
+
}), this.group.api.onDidActiveChange(() => {
|
|
5932
|
+
if (this.group !== this.panel.group) {
|
|
5933
|
+
return;
|
|
5934
|
+
}
|
|
5935
|
+
if (_trackGroupActive !== this.isGroupActive) {
|
|
5936
|
+
_trackGroupActive = this.isGroupActive;
|
|
5937
|
+
this._onDidActiveGroupChange.fire({
|
|
5938
|
+
isActive: this.isGroupActive,
|
|
5939
|
+
});
|
|
5940
|
+
}
|
|
5941
|
+
}));
|
|
5942
|
+
}
|
|
5630
5943
|
}
|
|
5631
5944
|
|
|
5632
5945
|
class DockviewPanel extends CompositeDisposable {
|
|
@@ -5668,7 +5981,14 @@ class DockviewPanel extends CompositeDisposable {
|
|
|
5668
5981
|
this.setTitle(params.title);
|
|
5669
5982
|
}
|
|
5670
5983
|
focus() {
|
|
5671
|
-
|
|
5984
|
+
const event = new WillFocusEvent();
|
|
5985
|
+
this.api._onWillFocus.fire(event);
|
|
5986
|
+
if (event.defaultPrevented) {
|
|
5987
|
+
return;
|
|
5988
|
+
}
|
|
5989
|
+
if (!this.api.isActive) {
|
|
5990
|
+
this.api.setActive();
|
|
5991
|
+
}
|
|
5672
5992
|
}
|
|
5673
5993
|
toJSON() {
|
|
5674
5994
|
return {
|
|
@@ -5725,24 +6045,44 @@ class DockviewPanel extends CompositeDisposable {
|
|
|
5725
6045
|
},
|
|
5726
6046
|
});
|
|
5727
6047
|
}
|
|
5728
|
-
updateParentGroup(group,
|
|
6048
|
+
updateParentGroup(group, options) {
|
|
5729
6049
|
this._group = group;
|
|
5730
|
-
this.api.group =
|
|
6050
|
+
this.api.group = this._group;
|
|
5731
6051
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
5732
|
-
this.api.
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
6052
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6053
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetActive)) {
|
|
6054
|
+
if (this.api.isActive !== isActive) {
|
|
6055
|
+
this.api._onDidActiveChange.fire({
|
|
6056
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6057
|
+
});
|
|
6058
|
+
}
|
|
6059
|
+
}
|
|
6060
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6061
|
+
this.api._onDidVisibilityChange.fire({
|
|
6062
|
+
isVisible: isPanelVisible,
|
|
6063
|
+
});
|
|
6064
|
+
}
|
|
5739
6065
|
}
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
this.api.
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
6066
|
+
runEvents() {
|
|
6067
|
+
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
6068
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6069
|
+
if (this.api.isActive !== isActive) {
|
|
6070
|
+
this.api._onDidActiveChange.fire({
|
|
6071
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6072
|
+
});
|
|
6073
|
+
}
|
|
6074
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6075
|
+
this.api._onDidVisibilityChange.fire({
|
|
6076
|
+
isVisible: isPanelVisible,
|
|
6077
|
+
});
|
|
6078
|
+
}
|
|
6079
|
+
}
|
|
6080
|
+
layout(width, height) {
|
|
6081
|
+
// TODO: Can we somehow do height without header height or indicate what the header height is?
|
|
6082
|
+
this.api._onDidDimensionChange.fire({
|
|
6083
|
+
width,
|
|
6084
|
+
height: height,
|
|
6085
|
+
});
|
|
5746
6086
|
this.view.layout(width, height);
|
|
5747
6087
|
}
|
|
5748
6088
|
dispose() {
|
|
@@ -5860,8 +6200,6 @@ class DockviewPanelModel {
|
|
|
5860
6200
|
this.id = id;
|
|
5861
6201
|
this.contentComponent = contentComponent;
|
|
5862
6202
|
this.tabComponent = tabComponent;
|
|
5863
|
-
this._group = null;
|
|
5864
|
-
this._isPanelVisible = null;
|
|
5865
6203
|
this._content = this.createContentComponent(this.id, contentComponent);
|
|
5866
6204
|
this._tab = this.createTabComponent(this.id, tabComponent);
|
|
5867
6205
|
}
|
|
@@ -5869,25 +6207,8 @@ class DockviewPanelModel {
|
|
|
5869
6207
|
this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
|
|
5870
6208
|
this.tab.init(params);
|
|
5871
6209
|
}
|
|
5872
|
-
updateParentGroup(
|
|
5873
|
-
|
|
5874
|
-
this._group = group;
|
|
5875
|
-
if (this._content.onGroupChange) {
|
|
5876
|
-
this._content.onGroupChange(group);
|
|
5877
|
-
}
|
|
5878
|
-
if (this._tab.onGroupChange) {
|
|
5879
|
-
this._tab.onGroupChange(group);
|
|
5880
|
-
}
|
|
5881
|
-
}
|
|
5882
|
-
if (isPanelVisible !== this._isPanelVisible) {
|
|
5883
|
-
this._isPanelVisible = isPanelVisible;
|
|
5884
|
-
if (this._content.onPanelVisibleChange) {
|
|
5885
|
-
this._content.onPanelVisibleChange(isPanelVisible);
|
|
5886
|
-
}
|
|
5887
|
-
if (this._tab.onPanelVisibleChange) {
|
|
5888
|
-
this._tab.onPanelVisibleChange(isPanelVisible);
|
|
5889
|
-
}
|
|
5890
|
-
}
|
|
6210
|
+
updateParentGroup(_group, _isPanelVisible) {
|
|
6211
|
+
// noop
|
|
5891
6212
|
}
|
|
5892
6213
|
layout(width, height) {
|
|
5893
6214
|
var _a, _b;
|
|
@@ -6320,117 +6641,6 @@ class DockviewFloatingGroupPanel extends CompositeDisposable {
|
|
|
6320
6641
|
}
|
|
6321
6642
|
}
|
|
6322
6643
|
|
|
6323
|
-
class PopoutWindow extends CompositeDisposable {
|
|
6324
|
-
constructor(id, className, options) {
|
|
6325
|
-
super();
|
|
6326
|
-
this.id = id;
|
|
6327
|
-
this.className = className;
|
|
6328
|
-
this.options = options;
|
|
6329
|
-
this._onDidClose = new Emitter();
|
|
6330
|
-
this.onDidClose = this._onDidClose.event;
|
|
6331
|
-
this._window = null;
|
|
6332
|
-
this.addDisposables(this._onDidClose, {
|
|
6333
|
-
dispose: () => {
|
|
6334
|
-
this.close();
|
|
6335
|
-
},
|
|
6336
|
-
});
|
|
6337
|
-
}
|
|
6338
|
-
dimensions() {
|
|
6339
|
-
if (!this._window) {
|
|
6340
|
-
return null;
|
|
6341
|
-
}
|
|
6342
|
-
const left = this._window.value.screenX;
|
|
6343
|
-
const top = this._window.value.screenY;
|
|
6344
|
-
const width = this._window.value.innerWidth;
|
|
6345
|
-
const height = this._window.value.innerHeight;
|
|
6346
|
-
return { top, left, width, height };
|
|
6347
|
-
}
|
|
6348
|
-
close() {
|
|
6349
|
-
if (this._window) {
|
|
6350
|
-
this._window.disposable.dispose();
|
|
6351
|
-
this._window.value.close();
|
|
6352
|
-
this._window = null;
|
|
6353
|
-
}
|
|
6354
|
-
}
|
|
6355
|
-
open(content) {
|
|
6356
|
-
if (this._window) {
|
|
6357
|
-
throw new Error('instance of popout window is already open');
|
|
6358
|
-
}
|
|
6359
|
-
const url = `${this.options.url}`;
|
|
6360
|
-
const features = Object.entries({
|
|
6361
|
-
top: this.options.top,
|
|
6362
|
-
left: this.options.left,
|
|
6363
|
-
width: this.options.width,
|
|
6364
|
-
height: this.options.height,
|
|
6365
|
-
})
|
|
6366
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
6367
|
-
.join(',');
|
|
6368
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6369
|
-
const externalWindow = window.open(url, this.id, features);
|
|
6370
|
-
if (!externalWindow) {
|
|
6371
|
-
return;
|
|
6372
|
-
}
|
|
6373
|
-
const disposable = new CompositeDisposable();
|
|
6374
|
-
this._window = { value: externalWindow, disposable };
|
|
6375
|
-
const cleanUp = () => {
|
|
6376
|
-
this._onDidClose.fire();
|
|
6377
|
-
this._window = null;
|
|
6378
|
-
};
|
|
6379
|
-
// prevent any default content from loading
|
|
6380
|
-
// externalWindow.document.body.replaceWith(document.createElement('div'));
|
|
6381
|
-
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6382
|
-
cleanUp();
|
|
6383
|
-
this.close();
|
|
6384
|
-
}));
|
|
6385
|
-
externalWindow.addEventListener('load', () => {
|
|
6386
|
-
const externalDocument = externalWindow.document;
|
|
6387
|
-
externalDocument.title = document.title;
|
|
6388
|
-
const div = document.createElement('div');
|
|
6389
|
-
div.classList.add('dv-popout-window');
|
|
6390
|
-
div.style.position = 'absolute';
|
|
6391
|
-
div.style.width = '100%';
|
|
6392
|
-
div.style.height = '100%';
|
|
6393
|
-
div.style.top = '0px';
|
|
6394
|
-
div.style.left = '0px';
|
|
6395
|
-
div.classList.add(this.className);
|
|
6396
|
-
div.appendChild(content);
|
|
6397
|
-
externalDocument.body.replaceChildren(div);
|
|
6398
|
-
externalDocument.body.classList.add(this.className);
|
|
6399
|
-
addStyles(externalDocument, window.document.styleSheets);
|
|
6400
|
-
externalWindow.addEventListener('beforeunload', () => {
|
|
6401
|
-
// TODO: indicate external window is closing
|
|
6402
|
-
cleanUp();
|
|
6403
|
-
});
|
|
6404
|
-
});
|
|
6405
|
-
}
|
|
6406
|
-
}
|
|
6407
|
-
|
|
6408
|
-
class DockviewPopoutGroupPanel extends CompositeDisposable {
|
|
6409
|
-
constructor(id, group, options) {
|
|
6410
|
-
var _a;
|
|
6411
|
-
super();
|
|
6412
|
-
this.id = id;
|
|
6413
|
-
this.group = group;
|
|
6414
|
-
this.options = options;
|
|
6415
|
-
this.window = new PopoutWindow(id, (_a = options.className) !== null && _a !== void 0 ? _a : '', {
|
|
6416
|
-
url: this.options.popoutUrl,
|
|
6417
|
-
left: this.options.box.left,
|
|
6418
|
-
top: this.options.box.top,
|
|
6419
|
-
width: this.options.box.width,
|
|
6420
|
-
height: this.options.box.height,
|
|
6421
|
-
});
|
|
6422
|
-
group.model.location = 'popout';
|
|
6423
|
-
this.addDisposables(this.window, {
|
|
6424
|
-
dispose: () => {
|
|
6425
|
-
group.model.location = 'grid';
|
|
6426
|
-
},
|
|
6427
|
-
}, this.window.onDidClose(() => {
|
|
6428
|
-
this.dispose();
|
|
6429
|
-
}));
|
|
6430
|
-
this.window.open(group.element);
|
|
6431
|
-
}
|
|
6432
|
-
}
|
|
6433
|
-
|
|
6434
6644
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6435
6645
|
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6436
6646
|
|
|
@@ -6444,11 +6654,13 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
6444
6654
|
super();
|
|
6445
6655
|
this.element = element;
|
|
6446
6656
|
this.map = {};
|
|
6657
|
+
this._disposed = false;
|
|
6447
6658
|
this.addDisposables(Disposable.from(() => {
|
|
6448
6659
|
for (const value of Object.values(this.map)) {
|
|
6449
6660
|
value.disposable.dispose();
|
|
6450
6661
|
value.destroy.dispose();
|
|
6451
6662
|
}
|
|
6663
|
+
this._disposed = true;
|
|
6452
6664
|
}));
|
|
6453
6665
|
}
|
|
6454
6666
|
detatch(panel) {
|
|
@@ -6488,7 +6700,7 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
6488
6700
|
focusContainer.style.top = `${box.top - box2.top}px`;
|
|
6489
6701
|
focusContainer.style.width = `${box.width}px`;
|
|
6490
6702
|
focusContainer.style.height = `${box.height}px`;
|
|
6491
|
-
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location === 'floating');
|
|
6703
|
+
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
|
|
6492
6704
|
};
|
|
6493
6705
|
const visibilityChanged = () => {
|
|
6494
6706
|
if (panel.api.isVisible) {
|
|
@@ -6534,8 +6746,11 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
6534
6746
|
resize();
|
|
6535
6747
|
}));
|
|
6536
6748
|
this.map[panel.api.id].destroy = Disposable.from(() => {
|
|
6537
|
-
|
|
6538
|
-
|
|
6749
|
+
var _a;
|
|
6750
|
+
if (panel.view.content.element.parentElement === focusContainer) {
|
|
6751
|
+
focusContainer.removeChild(panel.view.content.element);
|
|
6752
|
+
}
|
|
6753
|
+
(_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
|
|
6539
6754
|
});
|
|
6540
6755
|
queueMicrotask(() => {
|
|
6541
6756
|
if (this.isDisposed) {
|
|
@@ -6556,11 +6771,164 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
6556
6771
|
}
|
|
6557
6772
|
}
|
|
6558
6773
|
|
|
6774
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6775
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6776
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6777
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6778
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6779
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6780
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6781
|
+
});
|
|
6782
|
+
};
|
|
6783
|
+
class PopoutWindow extends CompositeDisposable {
|
|
6784
|
+
get window() {
|
|
6785
|
+
var _a, _b;
|
|
6786
|
+
return (_b = (_a = this._window) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;
|
|
6787
|
+
}
|
|
6788
|
+
constructor(target, className, options) {
|
|
6789
|
+
super();
|
|
6790
|
+
this.target = target;
|
|
6791
|
+
this.className = className;
|
|
6792
|
+
this.options = options;
|
|
6793
|
+
this._onWillClose = new Emitter();
|
|
6794
|
+
this.onWillClose = this._onWillClose.event;
|
|
6795
|
+
this._onDidClose = new Emitter();
|
|
6796
|
+
this.onDidClose = this._onDidClose.event;
|
|
6797
|
+
this._window = null;
|
|
6798
|
+
this.addDisposables(this._onWillClose, this._onDidClose, {
|
|
6799
|
+
dispose: () => {
|
|
6800
|
+
this.close();
|
|
6801
|
+
},
|
|
6802
|
+
});
|
|
6803
|
+
}
|
|
6804
|
+
dimensions() {
|
|
6805
|
+
if (!this._window) {
|
|
6806
|
+
return null;
|
|
6807
|
+
}
|
|
6808
|
+
const left = this._window.value.screenX;
|
|
6809
|
+
const top = this._window.value.screenY;
|
|
6810
|
+
const width = this._window.value.innerWidth;
|
|
6811
|
+
const height = this._window.value.innerHeight;
|
|
6812
|
+
return { top, left, width, height };
|
|
6813
|
+
}
|
|
6814
|
+
close() {
|
|
6815
|
+
var _a, _b;
|
|
6816
|
+
if (this._window) {
|
|
6817
|
+
this._onWillClose.fire();
|
|
6818
|
+
(_b = (_a = this.options).onWillClose) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6819
|
+
id: this.target,
|
|
6820
|
+
window: this._window.value,
|
|
6821
|
+
});
|
|
6822
|
+
this._window.disposable.dispose();
|
|
6823
|
+
this._window.value.close();
|
|
6824
|
+
this._window = null;
|
|
6825
|
+
this._onDidClose.fire();
|
|
6826
|
+
}
|
|
6827
|
+
}
|
|
6828
|
+
open() {
|
|
6829
|
+
var _a, _b;
|
|
6830
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6831
|
+
if (this._window) {
|
|
6832
|
+
throw new Error('instance of popout window is already open');
|
|
6833
|
+
}
|
|
6834
|
+
const url = `${this.options.url}`;
|
|
6835
|
+
const features = Object.entries({
|
|
6836
|
+
top: this.options.top,
|
|
6837
|
+
left: this.options.left,
|
|
6838
|
+
width: this.options.width,
|
|
6839
|
+
height: this.options.height,
|
|
6840
|
+
})
|
|
6841
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
6842
|
+
.join(',');
|
|
6843
|
+
/**
|
|
6844
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6845
|
+
*/
|
|
6846
|
+
const externalWindow = window.open(url, this.target, features);
|
|
6847
|
+
if (!externalWindow) {
|
|
6848
|
+
/**
|
|
6849
|
+
* Popup blocked
|
|
6850
|
+
*/
|
|
6851
|
+
return null;
|
|
6852
|
+
}
|
|
6853
|
+
const disposable = new CompositeDisposable();
|
|
6854
|
+
this._window = { value: externalWindow, disposable };
|
|
6855
|
+
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6856
|
+
/**
|
|
6857
|
+
* before the main window closes we should close this popup too
|
|
6858
|
+
* to be good citizens
|
|
6859
|
+
*
|
|
6860
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6861
|
+
*/
|
|
6862
|
+
this.close();
|
|
6863
|
+
}));
|
|
6864
|
+
const container = this.createPopoutWindowContainer();
|
|
6865
|
+
if (this.className) {
|
|
6866
|
+
container.classList.add(this.className);
|
|
6867
|
+
}
|
|
6868
|
+
(_b = (_a = this.options).onDidOpen) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6869
|
+
id: this.target,
|
|
6870
|
+
window: externalWindow,
|
|
6871
|
+
});
|
|
6872
|
+
return new Promise((resolve) => {
|
|
6873
|
+
externalWindow.addEventListener('unload', (e) => {
|
|
6874
|
+
// if page fails to load before unloading
|
|
6875
|
+
// this.close();
|
|
6876
|
+
});
|
|
6877
|
+
externalWindow.addEventListener('load', () => {
|
|
6878
|
+
/**
|
|
6879
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
|
|
6880
|
+
*/
|
|
6881
|
+
const externalDocument = externalWindow.document;
|
|
6882
|
+
externalDocument.title = document.title;
|
|
6883
|
+
externalDocument.body.appendChild(container);
|
|
6884
|
+
addStyles(externalDocument, window.document.styleSheets);
|
|
6885
|
+
/**
|
|
6886
|
+
* beforeunload must be registered after load for reasons I could not determine
|
|
6887
|
+
* otherwise the beforeunload event will not fire when the window is closed
|
|
6888
|
+
*/
|
|
6889
|
+
addDisposableWindowListener(externalWindow, 'beforeunload', () => {
|
|
6890
|
+
/**
|
|
6891
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6892
|
+
*/
|
|
6893
|
+
this.close();
|
|
6894
|
+
});
|
|
6895
|
+
resolve(container);
|
|
6896
|
+
});
|
|
6897
|
+
});
|
|
6898
|
+
});
|
|
6899
|
+
}
|
|
6900
|
+
createPopoutWindowContainer() {
|
|
6901
|
+
const el = document.createElement('div');
|
|
6902
|
+
el.classList.add('dv-popout-window');
|
|
6903
|
+
el.id = 'dv-popout-window';
|
|
6904
|
+
el.style.position = 'absolute';
|
|
6905
|
+
el.style.width = '100%';
|
|
6906
|
+
el.style.height = '100%';
|
|
6907
|
+
el.style.top = '0px';
|
|
6908
|
+
el.style.left = '0px';
|
|
6909
|
+
return el;
|
|
6910
|
+
}
|
|
6911
|
+
}
|
|
6912
|
+
|
|
6559
6913
|
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6560
6914
|
activationSize: { type: 'pixels', value: 10 },
|
|
6561
6915
|
size: { type: 'pixels', value: 20 },
|
|
6562
6916
|
};
|
|
6563
|
-
function
|
|
6917
|
+
function moveGroupWithoutDestroying(options) {
|
|
6918
|
+
const activePanel = options.from.activePanel;
|
|
6919
|
+
const panels = [...options.from.panels].map((panel) => {
|
|
6920
|
+
const removedPanel = options.from.model.removePanel(panel);
|
|
6921
|
+
options.from.model.renderContainer.detatch(panel);
|
|
6922
|
+
return removedPanel;
|
|
6923
|
+
});
|
|
6924
|
+
panels.forEach((panel) => {
|
|
6925
|
+
options.to.model.openPanel(panel, {
|
|
6926
|
+
skipSetActive: activePanel !== panel,
|
|
6927
|
+
skipSetGroupActive: true,
|
|
6928
|
+
});
|
|
6929
|
+
});
|
|
6930
|
+
}
|
|
6931
|
+
function getDockviewTheme(element) {
|
|
6564
6932
|
function toClassList(element) {
|
|
6565
6933
|
const list = [];
|
|
6566
6934
|
for (let i = 0; i < element.classList.length; i++) {
|
|
@@ -6611,6 +6979,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
6611
6979
|
styles: options.styles,
|
|
6612
6980
|
parentElement: options.parentElement,
|
|
6613
6981
|
disableAutoResizing: options.disableAutoResizing,
|
|
6982
|
+
locked: options.locked,
|
|
6614
6983
|
});
|
|
6615
6984
|
this.nextGroupId = sequentialNumberGenerator();
|
|
6616
6985
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -6621,6 +6990,10 @@ class DockviewComponent extends BaseGrid {
|
|
|
6621
6990
|
this.onWillDragGroup = this._onWillDragGroup.event;
|
|
6622
6991
|
this._onDidDrop = new Emitter();
|
|
6623
6992
|
this.onDidDrop = this._onDidDrop.event;
|
|
6993
|
+
this._onWillDrop = new Emitter();
|
|
6994
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
6995
|
+
this._onWillShowOverlay = new Emitter();
|
|
6996
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
6624
6997
|
this._onDidRemovePanel = new Emitter();
|
|
6625
6998
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
6626
6999
|
this._onDidAddPanel = new Emitter();
|
|
@@ -6629,15 +7002,36 @@ class DockviewComponent extends BaseGrid {
|
|
|
6629
7002
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
6630
7003
|
this._onDidActivePanelChange = new Emitter();
|
|
6631
7004
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
7005
|
+
this._onDidMovePanel = new Emitter();
|
|
6632
7006
|
this._floatingGroups = [];
|
|
6633
7007
|
this._popoutGroups = [];
|
|
7008
|
+
this._ignoreEvents = 0;
|
|
7009
|
+
this._onDidRemoveGroup = new Emitter();
|
|
7010
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
7011
|
+
this._onDidAddGroup = new Emitter();
|
|
7012
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
7013
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
7014
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
7015
|
+
this._moving = false;
|
|
6634
7016
|
const gready = document.createElement('div');
|
|
6635
7017
|
gready.className = 'dv-overlay-render-container';
|
|
6636
7018
|
this.gridview.element.appendChild(gready);
|
|
6637
7019
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
6638
7020
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
6639
7021
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
6640
|
-
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop,
|
|
7022
|
+
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
|
|
7023
|
+
if (!this._moving) {
|
|
7024
|
+
this._onDidAddGroup.fire(event);
|
|
7025
|
+
}
|
|
7026
|
+
}), this.onDidRemove((event) => {
|
|
7027
|
+
if (!this._moving) {
|
|
7028
|
+
this._onDidRemoveGroup.fire(event);
|
|
7029
|
+
}
|
|
7030
|
+
}), this.onDidActiveChange((event) => {
|
|
7031
|
+
if (!this._moving) {
|
|
7032
|
+
this._onDidActiveGroupChange.fire(event);
|
|
7033
|
+
}
|
|
7034
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
6641
7035
|
this.updateWatermark();
|
|
6642
7036
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
6643
7037
|
this._bufferOnDidLayoutChange.fire();
|
|
@@ -6648,7 +7042,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
6648
7042
|
}
|
|
6649
7043
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6650
7044
|
for (const group of [...this._popoutGroups]) {
|
|
6651
|
-
group.dispose();
|
|
7045
|
+
group.disposable.dispose();
|
|
6652
7046
|
}
|
|
6653
7047
|
}));
|
|
6654
7048
|
this._options = options;
|
|
@@ -6694,7 +7088,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
6694
7088
|
return this.options.showDndOverlay({
|
|
6695
7089
|
nativeEvent: event,
|
|
6696
7090
|
position: position,
|
|
6697
|
-
target:
|
|
7091
|
+
target: 'edge',
|
|
6698
7092
|
getData: getPanelData,
|
|
6699
7093
|
});
|
|
6700
7094
|
}
|
|
@@ -6703,88 +7097,259 @@ class DockviewComponent extends BaseGrid {
|
|
|
6703
7097
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
6704
7098
|
overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
6705
7099
|
});
|
|
6706
|
-
this.addDisposables(this._rootDropTarget.
|
|
7100
|
+
this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
|
|
7101
|
+
if (this.gridview.length > 0 && event.position === 'center') {
|
|
7102
|
+
// option only available when no panels in primary grid
|
|
7103
|
+
return;
|
|
7104
|
+
}
|
|
7105
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
7106
|
+
kind: 'edge',
|
|
7107
|
+
}));
|
|
7108
|
+
}), this._rootDropTarget.onDrop((event) => {
|
|
6707
7109
|
var _a;
|
|
7110
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
7111
|
+
nativeEvent: event.nativeEvent,
|
|
7112
|
+
position: event.position,
|
|
7113
|
+
panel: undefined,
|
|
7114
|
+
api: this._api,
|
|
7115
|
+
group: undefined,
|
|
7116
|
+
getData: getPanelData,
|
|
7117
|
+
kind: 'edge',
|
|
7118
|
+
});
|
|
7119
|
+
this._onWillDrop.fire(willDropEvent);
|
|
7120
|
+
if (willDropEvent.defaultPrevented) {
|
|
7121
|
+
return;
|
|
7122
|
+
}
|
|
6708
7123
|
const data = getPanelData();
|
|
6709
7124
|
if (data) {
|
|
6710
|
-
this.moveGroupOrPanel(
|
|
7125
|
+
this.moveGroupOrPanel({
|
|
7126
|
+
from: {
|
|
7127
|
+
groupId: data.groupId,
|
|
7128
|
+
panelId: (_a = data.panelId) !== null && _a !== void 0 ? _a : undefined,
|
|
7129
|
+
},
|
|
7130
|
+
to: {
|
|
7131
|
+
group: this.orthogonalize(event.position),
|
|
7132
|
+
position: 'center',
|
|
7133
|
+
},
|
|
7134
|
+
});
|
|
6711
7135
|
}
|
|
6712
7136
|
else {
|
|
6713
|
-
this._onDidDrop.fire(
|
|
7137
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
7138
|
+
nativeEvent: event.nativeEvent,
|
|
7139
|
+
position: event.position,
|
|
7140
|
+
panel: undefined,
|
|
7141
|
+
api: this._api,
|
|
7142
|
+
group: undefined,
|
|
7143
|
+
getData: getPanelData,
|
|
7144
|
+
}));
|
|
6714
7145
|
}
|
|
6715
7146
|
}), this._rootDropTarget);
|
|
6716
7147
|
this._api = new DockviewApi(this);
|
|
6717
7148
|
this.updateWatermark();
|
|
6718
7149
|
}
|
|
6719
|
-
addPopoutGroup(
|
|
6720
|
-
var _a;
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
7150
|
+
addPopoutGroup(itemToPopout, options) {
|
|
7151
|
+
var _a, _b, _c;
|
|
7152
|
+
if (itemToPopout instanceof DockviewPanel &&
|
|
7153
|
+
itemToPopout.group.size === 1) {
|
|
7154
|
+
return this.addPopoutGroup(itemToPopout.group);
|
|
7155
|
+
}
|
|
7156
|
+
const theme = getDockviewTheme(this.gridview.element);
|
|
7157
|
+
const element = this.element;
|
|
7158
|
+
function getBox() {
|
|
7159
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7160
|
+
return options.position;
|
|
7161
|
+
}
|
|
7162
|
+
if (itemToPopout instanceof DockviewGroupPanel) {
|
|
7163
|
+
return itemToPopout.element.getBoundingClientRect();
|
|
7164
|
+
}
|
|
7165
|
+
if (itemToPopout.group) {
|
|
7166
|
+
return itemToPopout.group.element.getBoundingClientRect();
|
|
7167
|
+
}
|
|
7168
|
+
return element.getBoundingClientRect();
|
|
7169
|
+
}
|
|
7170
|
+
const box = getBox();
|
|
7171
|
+
const groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId(); //item.id;
|
|
7172
|
+
if (itemToPopout.api.location.type === 'grid') {
|
|
7173
|
+
itemToPopout.api.setVisible(false);
|
|
7174
|
+
}
|
|
7175
|
+
const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
|
|
7176
|
+
theme !== null && theme !== void 0 ? theme : '', {
|
|
7177
|
+
url: (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : '/popout.html',
|
|
7178
|
+
left: window.screenX + box.left,
|
|
7179
|
+
top: window.screenY + box.top,
|
|
7180
|
+
width: box.width,
|
|
7181
|
+
height: box.height,
|
|
7182
|
+
onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
|
|
7183
|
+
onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
|
|
7184
|
+
});
|
|
7185
|
+
const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
|
|
7186
|
+
popoutWindowDisposable.dispose();
|
|
7187
|
+
}));
|
|
7188
|
+
return _window
|
|
7189
|
+
.open()
|
|
7190
|
+
.then((popoutContainer) => {
|
|
7191
|
+
var _a;
|
|
7192
|
+
if (_window.isDisposed) {
|
|
7193
|
+
return;
|
|
6732
7194
|
}
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
if (!box) {
|
|
6737
|
-
box = group.element.getBoundingClientRect();
|
|
7195
|
+
if (popoutContainer === null) {
|
|
7196
|
+
popoutWindowDisposable.dispose();
|
|
7197
|
+
return;
|
|
6738
7198
|
}
|
|
6739
|
-
const
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
7199
|
+
const gready = document.createElement('div');
|
|
7200
|
+
gready.className = 'dv-overlay-render-container';
|
|
7201
|
+
const overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7202
|
+
const referenceGroup = itemToPopout instanceof DockviewPanel
|
|
7203
|
+
? itemToPopout.group
|
|
7204
|
+
: itemToPopout;
|
|
7205
|
+
const referenceLocation = itemToPopout.api.location.type;
|
|
7206
|
+
const group = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) !== null && _a !== void 0 ? _a : this.createGroup({ id: groupId });
|
|
7207
|
+
group.model.renderContainer = overlayRenderContainer;
|
|
7208
|
+
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup)) {
|
|
7209
|
+
this._onDidAddGroup.fire(group);
|
|
7210
|
+
}
|
|
7211
|
+
if (itemToPopout instanceof DockviewPanel) {
|
|
7212
|
+
this.movingLock(() => {
|
|
7213
|
+
const panel = referenceGroup.model.removePanel(itemToPopout);
|
|
7214
|
+
group.model.openPanel(panel);
|
|
7215
|
+
});
|
|
7216
|
+
}
|
|
7217
|
+
else {
|
|
7218
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7219
|
+
from: referenceGroup,
|
|
7220
|
+
to: group,
|
|
7221
|
+
}));
|
|
7222
|
+
switch (referenceLocation) {
|
|
7223
|
+
case 'grid':
|
|
7224
|
+
referenceGroup.api.setVisible(false);
|
|
7225
|
+
break;
|
|
7226
|
+
case 'floating':
|
|
7227
|
+
case 'popout':
|
|
7228
|
+
this.removeGroup(referenceGroup);
|
|
7229
|
+
break;
|
|
7230
|
+
}
|
|
7231
|
+
}
|
|
7232
|
+
popoutContainer.classList.add('dv-dockview');
|
|
7233
|
+
popoutContainer.style.overflow = 'hidden';
|
|
7234
|
+
popoutContainer.appendChild(gready);
|
|
7235
|
+
popoutContainer.appendChild(group.element);
|
|
7236
|
+
group.model.location = {
|
|
7237
|
+
type: 'popout',
|
|
7238
|
+
getWindow: () => _window.window,
|
|
7239
|
+
};
|
|
7240
|
+
this.doSetGroupAndPanelActive(group);
|
|
7241
|
+
popoutWindowDisposable.addDisposables(group.api.onDidActiveChange((event) => {
|
|
7242
|
+
var _a;
|
|
7243
|
+
if (event.isActive) {
|
|
7244
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7245
|
+
}
|
|
7246
|
+
}), group.api.onWillFocus(() => {
|
|
7247
|
+
var _a;
|
|
7248
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7249
|
+
}));
|
|
7250
|
+
let returnedGroup;
|
|
7251
|
+
const value = {
|
|
7252
|
+
window: _window,
|
|
7253
|
+
popoutGroup: group,
|
|
7254
|
+
referenceGroup: this.getPanel(referenceGroup.id)
|
|
7255
|
+
? referenceGroup.id
|
|
7256
|
+
: undefined,
|
|
7257
|
+
disposable: {
|
|
7258
|
+
dispose: () => {
|
|
7259
|
+
popoutWindowDisposable.dispose();
|
|
7260
|
+
return returnedGroup;
|
|
7261
|
+
},
|
|
7262
|
+
},
|
|
7263
|
+
};
|
|
7264
|
+
popoutWindowDisposable.addDisposables(
|
|
7265
|
+
/**
|
|
7266
|
+
* ResizeObserver seems slow here, I do not know why but we don't need it
|
|
7267
|
+
* since we can reply on the window resize event as we will occupy the full
|
|
7268
|
+
* window dimensions
|
|
7269
|
+
*/
|
|
7270
|
+
addDisposableWindowListener(_window.window, 'resize', () => {
|
|
7271
|
+
group.layout(window.innerWidth, window.innerHeight);
|
|
7272
|
+
}), overlayRenderContainer, Disposable.from(() => {
|
|
7273
|
+
if (this.getPanel(referenceGroup.id)) {
|
|
7274
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7275
|
+
from: group,
|
|
7276
|
+
to: referenceGroup,
|
|
7277
|
+
}));
|
|
7278
|
+
if (!referenceGroup.api.isVisible) {
|
|
7279
|
+
referenceGroup.api.setVisible(true);
|
|
7280
|
+
}
|
|
7281
|
+
if (this.getPanel(group.id)) {
|
|
7282
|
+
this.doRemoveGroup(group, {
|
|
7283
|
+
skipPopoutAssociated: true,
|
|
7284
|
+
});
|
|
7285
|
+
}
|
|
7286
|
+
}
|
|
7287
|
+
else {
|
|
7288
|
+
if (this.getPanel(group.id)) {
|
|
7289
|
+
const removedGroup = this.doRemoveGroup(group, {
|
|
7290
|
+
skipDispose: true,
|
|
7291
|
+
skipActive: true,
|
|
7292
|
+
});
|
|
7293
|
+
removedGroup.model.renderContainer =
|
|
7294
|
+
this.overlayRenderContainer;
|
|
7295
|
+
removedGroup.model.location = { type: 'grid' };
|
|
7296
|
+
returnedGroup = removedGroup;
|
|
7297
|
+
}
|
|
7298
|
+
}
|
|
7299
|
+
}));
|
|
7300
|
+
this._popoutGroups.push(value);
|
|
7301
|
+
this.updateWatermark();
|
|
7302
|
+
})
|
|
7303
|
+
.catch((err) => {
|
|
7304
|
+
console.error(err);
|
|
6756
7305
|
});
|
|
6757
|
-
popoutWindow.addDisposables({
|
|
6758
|
-
dispose: () => {
|
|
6759
|
-
remove(this._popoutGroups, popoutWindow);
|
|
6760
|
-
this.updateWatermark();
|
|
6761
|
-
},
|
|
6762
|
-
}, popoutWindow.window.onDidClose(() => {
|
|
6763
|
-
this.doAddGroup(group, [0]);
|
|
6764
|
-
}));
|
|
6765
|
-
this._popoutGroups.push(popoutWindow);
|
|
6766
|
-
this.updateWatermark();
|
|
6767
7306
|
}
|
|
6768
7307
|
addFloatingGroup(item, coord, options) {
|
|
6769
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7308
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6770
7309
|
let group;
|
|
6771
7310
|
if (item instanceof DockviewPanel) {
|
|
6772
7311
|
group = this.createGroup();
|
|
6773
|
-
this.
|
|
7312
|
+
this._onDidAddGroup.fire(group);
|
|
7313
|
+
this.movingLock(() => this.removePanel(item, {
|
|
6774
7314
|
removeEmptyGroup: true,
|
|
6775
7315
|
skipDispose: true,
|
|
6776
|
-
|
|
6777
|
-
|
|
7316
|
+
skipSetActiveGroup: true,
|
|
7317
|
+
}));
|
|
7318
|
+
group.model.openPanel(item, { skipSetGroupActive: true });
|
|
6778
7319
|
}
|
|
6779
7320
|
else {
|
|
6780
7321
|
group = item;
|
|
7322
|
+
const popoutReferenceGroupId = (_a = this._popoutGroups.find((_) => _.popoutGroup === group)) === null || _a === void 0 ? void 0 : _a.referenceGroup;
|
|
7323
|
+
const popoutReferenceGroup = popoutReferenceGroupId
|
|
7324
|
+
? this.getPanel(popoutReferenceGroupId)
|
|
7325
|
+
: undefined;
|
|
6781
7326
|
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
6782
7327
|
options.skipRemoveGroup;
|
|
6783
7328
|
if (!skip) {
|
|
6784
|
-
|
|
7329
|
+
if (popoutReferenceGroup) {
|
|
7330
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7331
|
+
from: item,
|
|
7332
|
+
to: popoutReferenceGroup,
|
|
7333
|
+
}));
|
|
7334
|
+
this.doRemoveGroup(item, {
|
|
7335
|
+
skipPopoutReturn: true,
|
|
7336
|
+
skipPopoutAssociated: true,
|
|
7337
|
+
});
|
|
7338
|
+
this.doRemoveGroup(popoutReferenceGroup, {
|
|
7339
|
+
skipDispose: true,
|
|
7340
|
+
});
|
|
7341
|
+
group = popoutReferenceGroup;
|
|
7342
|
+
}
|
|
7343
|
+
else {
|
|
7344
|
+
this.doRemoveGroup(item, {
|
|
7345
|
+
skipDispose: true,
|
|
7346
|
+
skipPopoutReturn: true,
|
|
7347
|
+
skipPopoutAssociated: !!popoutReferenceGroup,
|
|
7348
|
+
});
|
|
7349
|
+
}
|
|
6785
7350
|
}
|
|
6786
7351
|
}
|
|
6787
|
-
group.model.location = 'floating';
|
|
7352
|
+
group.model.location = { type: 'floating' };
|
|
6788
7353
|
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6789
7354
|
? Math.max(coord.x, 0)
|
|
6790
7355
|
: DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
@@ -6794,16 +7359,16 @@ class DockviewComponent extends BaseGrid {
|
|
|
6794
7359
|
const overlay = new Overlay({
|
|
6795
7360
|
container: this.gridview.element,
|
|
6796
7361
|
content: group.element,
|
|
6797
|
-
height: (
|
|
6798
|
-
width: (
|
|
7362
|
+
height: (_b = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _b !== void 0 ? _b : 300,
|
|
7363
|
+
width: (_c = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _c !== void 0 ? _c : 300,
|
|
6799
7364
|
left: overlayLeft,
|
|
6800
7365
|
top: overlayTop,
|
|
6801
7366
|
minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6802
7367
|
? undefined
|
|
6803
|
-
: (
|
|
7368
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumWidthWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6804
7369
|
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6805
7370
|
? undefined
|
|
6806
|
-
: (
|
|
7371
|
+
: (_g = (_f = this.options.floatingGroupBounds) === null || _f === void 0 ? void 0 : _f.minimumHeightWithinViewport) !== null && _g !== void 0 ? _g : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6807
7372
|
});
|
|
6808
7373
|
const el = group.element.querySelector('.void-container');
|
|
6809
7374
|
if (!el) {
|
|
@@ -6834,12 +7399,15 @@ class DockviewComponent extends BaseGrid {
|
|
|
6834
7399
|
}), {
|
|
6835
7400
|
dispose: () => {
|
|
6836
7401
|
disposable.dispose();
|
|
6837
|
-
group.model.location = 'grid';
|
|
7402
|
+
group.model.location = { type: 'grid' };
|
|
6838
7403
|
remove(this._floatingGroups, floatingGroupPanel);
|
|
6839
7404
|
this.updateWatermark();
|
|
6840
7405
|
},
|
|
6841
7406
|
});
|
|
6842
7407
|
this._floatingGroups.push(floatingGroupPanel);
|
|
7408
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
|
|
7409
|
+
this.doSetGroupAndPanelActive(group);
|
|
7410
|
+
}
|
|
6843
7411
|
this.updateWatermark();
|
|
6844
7412
|
}
|
|
6845
7413
|
orthogonalize(position) {
|
|
@@ -6929,8 +7497,8 @@ class DockviewComponent extends BaseGrid {
|
|
|
6929
7497
|
return this.panels.find((panel) => panel.id === id);
|
|
6930
7498
|
}
|
|
6931
7499
|
setActivePanel(panel) {
|
|
6932
|
-
this.doSetGroupActive(panel.group);
|
|
6933
7500
|
panel.group.model.openPanel(panel);
|
|
7501
|
+
this.doSetGroupAndPanelActive(panel.group);
|
|
6934
7502
|
}
|
|
6935
7503
|
moveToNext(options = {}) {
|
|
6936
7504
|
var _a;
|
|
@@ -6991,7 +7559,8 @@ class DockviewComponent extends BaseGrid {
|
|
|
6991
7559
|
});
|
|
6992
7560
|
const popoutGroups = this._popoutGroups.map((group) => {
|
|
6993
7561
|
return {
|
|
6994
|
-
data: group.
|
|
7562
|
+
data: group.popoutGroup.toJSON(),
|
|
7563
|
+
gridReferenceGroup: group.referenceGroup,
|
|
6995
7564
|
position: group.window.dimensions(),
|
|
6996
7565
|
};
|
|
6997
7566
|
});
|
|
@@ -7009,7 +7578,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7009
7578
|
return result;
|
|
7010
7579
|
}
|
|
7011
7580
|
fromJSON(data) {
|
|
7012
|
-
var _a, _b;
|
|
7581
|
+
var _a, _b, _c;
|
|
7013
7582
|
this.clear();
|
|
7014
7583
|
if (typeof data !== 'object' || data === null) {
|
|
7015
7584
|
throw new Error('serialized layout must be a non-null object');
|
|
@@ -7048,7 +7617,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7048
7617
|
const isActive = typeof activeView === 'string' &&
|
|
7049
7618
|
activeView === panel.id;
|
|
7050
7619
|
group.model.openPanel(panel, {
|
|
7051
|
-
|
|
7620
|
+
skipSetActive: !isActive,
|
|
7052
7621
|
skipSetGroupActive: true,
|
|
7053
7622
|
});
|
|
7054
7623
|
}
|
|
@@ -7078,11 +7647,16 @@ class DockviewComponent extends BaseGrid {
|
|
|
7078
7647
|
}
|
|
7079
7648
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7080
7649
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
7081
|
-
const { data, position } = serializedPopoutGroup;
|
|
7650
|
+
const { data, position, gridReferenceGroup } = serializedPopoutGroup;
|
|
7082
7651
|
const group = createGroupFromSerializedState(data);
|
|
7083
|
-
this.addPopoutGroup(
|
|
7652
|
+
this.addPopoutGroup((_c = (gridReferenceGroup
|
|
7653
|
+
? this.getPanel(gridReferenceGroup)
|
|
7654
|
+
: undefined)) !== null && _c !== void 0 ? _c : group, {
|
|
7084
7655
|
skipRemoveGroup: true,
|
|
7085
7656
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
7657
|
+
overridePopoutGroup: gridReferenceGroup
|
|
7658
|
+
? group
|
|
7659
|
+
: undefined,
|
|
7086
7660
|
});
|
|
7087
7661
|
}
|
|
7088
7662
|
for (const floatingGroup of this._floatingGroups) {
|
|
@@ -7129,12 +7703,13 @@ class DockviewComponent extends BaseGrid {
|
|
|
7129
7703
|
*/
|
|
7130
7704
|
throw err;
|
|
7131
7705
|
}
|
|
7706
|
+
this.updateWatermark();
|
|
7132
7707
|
this._onDidLayoutFromJSON.fire();
|
|
7133
7708
|
}
|
|
7134
7709
|
clear() {
|
|
7135
7710
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7136
7711
|
const hasActiveGroup = !!this.activeGroup;
|
|
7137
|
-
|
|
7712
|
+
!!this.activePanel;
|
|
7138
7713
|
for (const group of groups) {
|
|
7139
7714
|
// remove the group will automatically remove the panels
|
|
7140
7715
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7142,9 +7717,6 @@ class DockviewComponent extends BaseGrid {
|
|
|
7142
7717
|
if (hasActiveGroup) {
|
|
7143
7718
|
this.doSetGroupAndPanelActive(undefined);
|
|
7144
7719
|
}
|
|
7145
|
-
if (hasActivePanel) {
|
|
7146
|
-
this._onDidActivePanelChange.fire(undefined);
|
|
7147
|
-
}
|
|
7148
7720
|
this.gridview.clear();
|
|
7149
7721
|
}
|
|
7150
7722
|
closeAllGroups() {
|
|
@@ -7185,6 +7757,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7185
7757
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
7186
7758
|
const panel = this.createPanel(options, group);
|
|
7187
7759
|
group.model.openPanel(panel);
|
|
7760
|
+
this.doSetGroupAndPanelActive(group);
|
|
7188
7761
|
return panel;
|
|
7189
7762
|
}
|
|
7190
7763
|
}
|
|
@@ -7196,6 +7769,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7196
7769
|
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
7197
7770
|
if (options.floating) {
|
|
7198
7771
|
const group = this.createGroup();
|
|
7772
|
+
this._onDidAddGroup.fire(group);
|
|
7199
7773
|
const o = typeof options.floating === 'object' &&
|
|
7200
7774
|
options.floating !== null
|
|
7201
7775
|
? options.floating
|
|
@@ -7203,16 +7777,16 @@ class DockviewComponent extends BaseGrid {
|
|
|
7203
7777
|
this.addFloatingGroup(group, o, {
|
|
7204
7778
|
inDragMode: false,
|
|
7205
7779
|
skipRemoveGroup: true,
|
|
7780
|
+
skipActiveGroup: true,
|
|
7206
7781
|
});
|
|
7207
|
-
this._onDidAddGroup.fire(group);
|
|
7208
7782
|
panel = this.createPanel(options, group);
|
|
7209
7783
|
group.model.openPanel(panel);
|
|
7210
|
-
this.doSetGroupAndPanelActive(group);
|
|
7211
7784
|
}
|
|
7212
|
-
else if (referenceGroup.api.location === 'floating' ||
|
|
7785
|
+
else if (referenceGroup.api.location.type === 'floating' ||
|
|
7213
7786
|
target === 'center') {
|
|
7214
7787
|
panel = this.createPanel(options, referenceGroup);
|
|
7215
7788
|
referenceGroup.model.openPanel(panel);
|
|
7789
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
7216
7790
|
}
|
|
7217
7791
|
else {
|
|
7218
7792
|
const location = getGridLocation(referenceGroup.element);
|
|
@@ -7220,10 +7794,12 @@ class DockviewComponent extends BaseGrid {
|
|
|
7220
7794
|
const group = this.createGroupAtLocation(relativeLocation);
|
|
7221
7795
|
panel = this.createPanel(options, group);
|
|
7222
7796
|
group.model.openPanel(panel);
|
|
7797
|
+
this.doSetGroupAndPanelActive(group);
|
|
7223
7798
|
}
|
|
7224
7799
|
}
|
|
7225
7800
|
else if (options.floating) {
|
|
7226
7801
|
const group = this.createGroup();
|
|
7802
|
+
this._onDidAddGroup.fire(group);
|
|
7227
7803
|
const o = typeof options.floating === 'object' &&
|
|
7228
7804
|
options.floating !== null
|
|
7229
7805
|
? options.floating
|
|
@@ -7231,16 +7807,16 @@ class DockviewComponent extends BaseGrid {
|
|
|
7231
7807
|
this.addFloatingGroup(group, o, {
|
|
7232
7808
|
inDragMode: false,
|
|
7233
7809
|
skipRemoveGroup: true,
|
|
7810
|
+
skipActiveGroup: true,
|
|
7234
7811
|
});
|
|
7235
|
-
this._onDidAddGroup.fire(group);
|
|
7236
7812
|
panel = this.createPanel(options, group);
|
|
7237
7813
|
group.model.openPanel(panel);
|
|
7238
|
-
this.doSetGroupAndPanelActive(group);
|
|
7239
7814
|
}
|
|
7240
7815
|
else {
|
|
7241
7816
|
const group = this.createGroupAtLocation();
|
|
7242
7817
|
panel = this.createPanel(options, group);
|
|
7243
7818
|
group.model.openPanel(panel);
|
|
7819
|
+
this.doSetGroupAndPanelActive(group);
|
|
7244
7820
|
}
|
|
7245
7821
|
return panel;
|
|
7246
7822
|
}
|
|
@@ -7252,13 +7828,15 @@ class DockviewComponent extends BaseGrid {
|
|
|
7252
7828
|
if (!group) {
|
|
7253
7829
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
7254
7830
|
}
|
|
7255
|
-
group.model.removePanel(panel
|
|
7831
|
+
group.model.removePanel(panel, {
|
|
7832
|
+
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
7833
|
+
});
|
|
7256
7834
|
if (!options.skipDispose) {
|
|
7257
|
-
|
|
7835
|
+
panel.group.model.renderContainer.detatch(panel);
|
|
7258
7836
|
panel.dispose();
|
|
7259
7837
|
}
|
|
7260
7838
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
7261
|
-
this.removeGroup(group);
|
|
7839
|
+
this.removeGroup(group, { skipActive: options.skipSetActiveGroup });
|
|
7262
7840
|
}
|
|
7263
7841
|
}
|
|
7264
7842
|
createWatermarkComponent() {
|
|
@@ -7271,7 +7849,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7271
7849
|
}
|
|
7272
7850
|
updateWatermark() {
|
|
7273
7851
|
var _a, _b;
|
|
7274
|
-
if (this.groups.filter((x) => x.api.location === 'grid').length === 0) {
|
|
7852
|
+
if (this.groups.filter((x) => x.api.location.type === 'grid' && x.api.isVisible).length === 0) {
|
|
7275
7853
|
if (!this.watermark) {
|
|
7276
7854
|
this.watermark = this.createWatermarkComponent();
|
|
7277
7855
|
this.watermark.init({
|
|
@@ -7317,36 +7895,42 @@ class DockviewComponent extends BaseGrid {
|
|
|
7317
7895
|
}
|
|
7318
7896
|
else {
|
|
7319
7897
|
const group = this.orthogonalize(directionToPosition(options.direction));
|
|
7898
|
+
if (!options.skipSetActive) {
|
|
7899
|
+
this.doSetGroupAndPanelActive(group);
|
|
7900
|
+
}
|
|
7320
7901
|
return group;
|
|
7321
7902
|
}
|
|
7322
7903
|
const target = toTarget(options.direction || 'within');
|
|
7323
7904
|
const location = getGridLocation(referenceGroup.element);
|
|
7324
7905
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7325
7906
|
this.doAddGroup(group, relativeLocation);
|
|
7907
|
+
if (!options.skipSetActive) {
|
|
7908
|
+
this.doSetGroupAndPanelActive(group);
|
|
7909
|
+
}
|
|
7326
7910
|
return group;
|
|
7327
7911
|
}
|
|
7328
7912
|
else {
|
|
7329
7913
|
this.doAddGroup(group);
|
|
7914
|
+
this.doSetGroupAndPanelActive(group);
|
|
7330
7915
|
return group;
|
|
7331
7916
|
}
|
|
7332
7917
|
}
|
|
7333
7918
|
removeGroup(group, options) {
|
|
7919
|
+
this.doRemoveGroup(group, options);
|
|
7920
|
+
}
|
|
7921
|
+
doRemoveGroup(group, options) {
|
|
7334
7922
|
var _a;
|
|
7335
7923
|
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7924
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7925
|
+
for (const panel of panels) {
|
|
7926
|
+
this.removePanel(panel, {
|
|
7927
|
+
removeEmptyGroup: false,
|
|
7928
|
+
skipDispose: (_a = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _a !== void 0 ? _a : false,
|
|
7929
|
+
});
|
|
7930
|
+
}
|
|
7341
7931
|
}
|
|
7342
7932
|
const activePanel = this.activePanel;
|
|
7343
|
-
|
|
7344
|
-
if (this.activePanel !== activePanel) {
|
|
7345
|
-
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7346
|
-
}
|
|
7347
|
-
}
|
|
7348
|
-
doRemoveGroup(group, options) {
|
|
7349
|
-
if (group.api.location === 'floating') {
|
|
7933
|
+
if (group.api.location.type === 'floating') {
|
|
7350
7934
|
const floatingGroup = this._floatingGroups.find((_) => _.group === group);
|
|
7351
7935
|
if (floatingGroup) {
|
|
7352
7936
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
@@ -7358,60 +7942,124 @@ class DockviewComponent extends BaseGrid {
|
|
|
7358
7942
|
floatingGroup.dispose();
|
|
7359
7943
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7360
7944
|
const groups = Array.from(this._groups.values());
|
|
7361
|
-
this.
|
|
7945
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7362
7946
|
}
|
|
7363
7947
|
return floatingGroup.group;
|
|
7364
7948
|
}
|
|
7365
7949
|
throw new Error('failed to find floating group');
|
|
7366
7950
|
}
|
|
7367
|
-
if (group.api.location === 'popout') {
|
|
7368
|
-
const selectedGroup = this._popoutGroups.find((_) => _.
|
|
7951
|
+
if (group.api.location.type === 'popout') {
|
|
7952
|
+
const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
|
|
7369
7953
|
if (selectedGroup) {
|
|
7370
7954
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7371
|
-
|
|
7955
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutAssociated)) {
|
|
7956
|
+
const refGroup = selectedGroup.referenceGroup
|
|
7957
|
+
? this.getPanel(selectedGroup.referenceGroup)
|
|
7958
|
+
: undefined;
|
|
7959
|
+
if (refGroup) {
|
|
7960
|
+
this.removeGroup(refGroup);
|
|
7961
|
+
}
|
|
7962
|
+
}
|
|
7963
|
+
selectedGroup.popoutGroup.dispose();
|
|
7372
7964
|
this._groups.delete(group.id);
|
|
7373
7965
|
this._onDidRemoveGroup.fire(group);
|
|
7374
7966
|
}
|
|
7375
|
-
selectedGroup.dispose();
|
|
7967
|
+
const removedGroup = selectedGroup.disposable.dispose();
|
|
7968
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
|
|
7969
|
+
this.doAddGroup(removedGroup, [0]);
|
|
7970
|
+
this.doSetGroupAndPanelActive(removedGroup);
|
|
7971
|
+
}
|
|
7376
7972
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7377
7973
|
const groups = Array.from(this._groups.values());
|
|
7378
|
-
this.
|
|
7974
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7379
7975
|
}
|
|
7380
|
-
|
|
7976
|
+
this.updateWatermark();
|
|
7977
|
+
return selectedGroup.popoutGroup;
|
|
7381
7978
|
}
|
|
7382
7979
|
throw new Error('failed to find popout group');
|
|
7383
7980
|
}
|
|
7384
|
-
|
|
7981
|
+
const re = super.doRemoveGroup(group, options);
|
|
7982
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
7983
|
+
if (this.activePanel !== activePanel) {
|
|
7984
|
+
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7985
|
+
}
|
|
7986
|
+
}
|
|
7987
|
+
return re;
|
|
7385
7988
|
}
|
|
7386
|
-
|
|
7387
|
-
|
|
7989
|
+
movingLock(func) {
|
|
7990
|
+
const isMoving = this._moving;
|
|
7991
|
+
try {
|
|
7992
|
+
this._moving = true;
|
|
7993
|
+
return func();
|
|
7994
|
+
}
|
|
7995
|
+
finally {
|
|
7996
|
+
this._moving = isMoving;
|
|
7997
|
+
}
|
|
7998
|
+
}
|
|
7999
|
+
moveGroupOrPanel(options) {
|
|
8000
|
+
var _a;
|
|
8001
|
+
const destinationGroup = options.to.group;
|
|
8002
|
+
const sourceGroupId = options.from.groupId;
|
|
8003
|
+
const sourceItemId = options.from.panelId;
|
|
8004
|
+
const destinationTarget = options.to.position;
|
|
8005
|
+
const destinationIndex = options.to.index;
|
|
7388
8006
|
const sourceGroup = sourceGroupId
|
|
7389
8007
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
7390
8008
|
: undefined;
|
|
8009
|
+
if (!sourceGroup) {
|
|
8010
|
+
throw new Error(`Failed to find group id ${sourceGroupId}`);
|
|
8011
|
+
}
|
|
7391
8012
|
if (sourceItemId === undefined) {
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
8013
|
+
/**
|
|
8014
|
+
* Moving an entire group into another group
|
|
8015
|
+
*/
|
|
8016
|
+
this.moveGroup({
|
|
8017
|
+
from: { group: sourceGroup },
|
|
8018
|
+
to: {
|
|
8019
|
+
group: destinationGroup,
|
|
8020
|
+
position: destinationTarget,
|
|
8021
|
+
},
|
|
8022
|
+
});
|
|
7395
8023
|
return;
|
|
7396
8024
|
}
|
|
7397
8025
|
if (!destinationTarget || destinationTarget === 'center') {
|
|
7398
|
-
|
|
7399
|
-
|
|
8026
|
+
/**
|
|
8027
|
+
* Dropping a panel within another group
|
|
8028
|
+
*/
|
|
8029
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8030
|
+
skipSetActive: false,
|
|
8031
|
+
skipSetActiveGroup: true,
|
|
8032
|
+
}));
|
|
8033
|
+
if (!removedPanel) {
|
|
7400
8034
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7401
8035
|
}
|
|
7402
|
-
if (
|
|
7403
|
-
|
|
8036
|
+
if (sourceGroup.model.size === 0) {
|
|
8037
|
+
// remove the group and do not set a new group as active
|
|
8038
|
+
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
7404
8039
|
}
|
|
7405
|
-
destinationGroup.model.openPanel(
|
|
8040
|
+
this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
|
|
7406
8041
|
index: destinationIndex,
|
|
8042
|
+
skipSetGroupActive: true,
|
|
8043
|
+
}));
|
|
8044
|
+
this.doSetGroupAndPanelActive(destinationGroup);
|
|
8045
|
+
this._onDidMovePanel.fire({
|
|
8046
|
+
panel: removedPanel,
|
|
7407
8047
|
});
|
|
7408
8048
|
}
|
|
7409
8049
|
else {
|
|
8050
|
+
/**
|
|
8051
|
+
* Dropping a panel to the extremities of a group which will place that panel
|
|
8052
|
+
* into an adjacent group
|
|
8053
|
+
*/
|
|
7410
8054
|
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
7411
8055
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7412
|
-
if (sourceGroup
|
|
8056
|
+
if (sourceGroup.size < 2) {
|
|
8057
|
+
/**
|
|
8058
|
+
* If we are moving from a group which only has one panel left we will consider
|
|
8059
|
+
* moving the group itself rather than moving the panel into a newly created group
|
|
8060
|
+
*/
|
|
7413
8061
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
7414
|
-
if (sourceGroup.api.location === 'grid') {
|
|
8062
|
+
if (sourceGroup.api.location.type === 'grid') {
|
|
7415
8063
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
7416
8064
|
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
7417
8065
|
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
@@ -7419,77 +8067,122 @@ class DockviewComponent extends BaseGrid {
|
|
|
7419
8067
|
// if a group has one tab - we are essentially moving the 'group'
|
|
7420
8068
|
// which is equivalent to swapping two views in this case
|
|
7421
8069
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8070
|
+
return;
|
|
7422
8071
|
}
|
|
7423
8072
|
}
|
|
7424
8073
|
// source group will become empty so delete the group
|
|
7425
|
-
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
8074
|
+
const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
|
|
7426
8075
|
skipActive: true,
|
|
7427
8076
|
skipDispose: true,
|
|
7428
|
-
});
|
|
8077
|
+
}));
|
|
7429
8078
|
// after deleting the group we need to re-evaulate the ref location
|
|
7430
8079
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
7431
8080
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
7432
|
-
this.doAddGroup(targetGroup, location);
|
|
8081
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8082
|
+
this.doSetGroupAndPanelActive(targetGroup);
|
|
7433
8083
|
}
|
|
7434
8084
|
else {
|
|
7435
|
-
|
|
7436
|
-
|
|
8085
|
+
/**
|
|
8086
|
+
* The group we are removing from has many panels, we need to remove the panels we are moving,
|
|
8087
|
+
* create a new group, add the panels to that new group and add the new group in an appropiate position
|
|
8088
|
+
*/
|
|
8089
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8090
|
+
skipSetActive: false,
|
|
8091
|
+
skipSetActiveGroup: true,
|
|
8092
|
+
}));
|
|
8093
|
+
if (!removedPanel) {
|
|
7437
8094
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7438
8095
|
}
|
|
7439
8096
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7440
8097
|
const group = this.createGroupAtLocation(dropLocation);
|
|
7441
|
-
group.model.openPanel(
|
|
8098
|
+
this.movingLock(() => group.model.openPanel(removedPanel, {
|
|
8099
|
+
skipSetGroupActive: true,
|
|
8100
|
+
}));
|
|
8101
|
+
this.doSetGroupAndPanelActive(group);
|
|
7442
8102
|
}
|
|
7443
8103
|
}
|
|
7444
8104
|
}
|
|
7445
|
-
moveGroup(
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
8105
|
+
moveGroup(options) {
|
|
8106
|
+
const from = options.from.group;
|
|
8107
|
+
const to = options.to.group;
|
|
8108
|
+
const target = options.to.position;
|
|
8109
|
+
if (target === 'center') {
|
|
8110
|
+
const activePanel = from.activePanel;
|
|
8111
|
+
const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
|
|
8112
|
+
skipSetActive: true,
|
|
8113
|
+
})));
|
|
8114
|
+
if ((from === null || from === void 0 ? void 0 : from.model.size) === 0) {
|
|
8115
|
+
this.doRemoveGroup(from, { skipActive: true });
|
|
8116
|
+
}
|
|
8117
|
+
this.movingLock(() => {
|
|
7453
8118
|
for (const panel of panels) {
|
|
7454
|
-
|
|
7455
|
-
|
|
8119
|
+
to.model.openPanel(panel, {
|
|
8120
|
+
skipSetActive: panel !== activePanel,
|
|
8121
|
+
skipSetGroupActive: true,
|
|
7456
8122
|
});
|
|
7457
8123
|
}
|
|
7458
|
-
}
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
8124
|
+
});
|
|
8125
|
+
this.doSetGroupAndPanelActive(to);
|
|
8126
|
+
panels.forEach((panel) => {
|
|
8127
|
+
this._onDidMovePanel.fire({ panel });
|
|
8128
|
+
});
|
|
8129
|
+
}
|
|
8130
|
+
else {
|
|
8131
|
+
switch (from.api.location.type) {
|
|
8132
|
+
case 'grid':
|
|
8133
|
+
this.gridview.removeView(getGridLocation(from.element));
|
|
8134
|
+
break;
|
|
8135
|
+
case 'floating': {
|
|
8136
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
8137
|
+
if (!selectedFloatingGroup) {
|
|
8138
|
+
throw new Error('failed to find floating group');
|
|
7471
8139
|
}
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
8140
|
+
selectedFloatingGroup.dispose();
|
|
8141
|
+
break;
|
|
8142
|
+
}
|
|
8143
|
+
case 'popout': {
|
|
8144
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
8145
|
+
if (!selectedPopoutGroup) {
|
|
8146
|
+
throw new Error('failed to find popout group');
|
|
7478
8147
|
}
|
|
8148
|
+
selectedPopoutGroup.disposable.dispose();
|
|
7479
8149
|
}
|
|
7480
|
-
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
7481
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
7482
|
-
this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
|
|
7483
8150
|
}
|
|
8151
|
+
const referenceLocation = getGridLocation(to.element);
|
|
8152
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8153
|
+
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8154
|
+
from.panels.forEach((panel) => {
|
|
8155
|
+
this._onDidMovePanel.fire({ panel });
|
|
8156
|
+
});
|
|
7484
8157
|
}
|
|
7485
8158
|
}
|
|
7486
|
-
|
|
7487
|
-
|
|
8159
|
+
doSetGroupActive(group) {
|
|
8160
|
+
super.doSetGroupActive(group);
|
|
8161
|
+
const activePanel = this.activePanel;
|
|
8162
|
+
if (!this._moving &&
|
|
8163
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8164
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8165
|
+
}
|
|
8166
|
+
}
|
|
8167
|
+
doSetGroupAndPanelActive(group) {
|
|
8168
|
+
super.doSetGroupActive(group);
|
|
7488
8169
|
const activePanel = this.activePanel;
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
this.
|
|
8170
|
+
if (group &&
|
|
8171
|
+
this.hasMaximizedGroup() &&
|
|
8172
|
+
!this.isMaximizedGroup(group)) {
|
|
8173
|
+
this.exitMaximizedGroup();
|
|
8174
|
+
}
|
|
8175
|
+
if (!this._moving &&
|
|
8176
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8177
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8178
|
+
}
|
|
8179
|
+
}
|
|
8180
|
+
getNextGroupId() {
|
|
8181
|
+
let id = this.nextGroupId.next();
|
|
8182
|
+
while (this._groups.has(id)) {
|
|
8183
|
+
id = this.nextGroupId.next();
|
|
7492
8184
|
}
|
|
8185
|
+
return id;
|
|
7493
8186
|
}
|
|
7494
8187
|
createGroup(options) {
|
|
7495
8188
|
if (!options) {
|
|
@@ -7507,7 +8200,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7507
8200
|
}
|
|
7508
8201
|
}
|
|
7509
8202
|
const view = new DockviewGroupPanel(this, id, options);
|
|
7510
|
-
view.init({ params: {}, accessor:
|
|
8203
|
+
view.init({ params: {}, accessor: this });
|
|
7511
8204
|
if (!this._groups.has(view.id)) {
|
|
7512
8205
|
const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {
|
|
7513
8206
|
this._onWillDragPanel.fire(event);
|
|
@@ -7515,20 +8208,48 @@ class DockviewComponent extends BaseGrid {
|
|
|
7515
8208
|
this._onWillDragGroup.fire(event);
|
|
7516
8209
|
}), view.model.onMove((event) => {
|
|
7517
8210
|
const { groupId, itemId, target, index } = event;
|
|
7518
|
-
this.moveGroupOrPanel(
|
|
8211
|
+
this.moveGroupOrPanel({
|
|
8212
|
+
from: { groupId: groupId, panelId: itemId },
|
|
8213
|
+
to: {
|
|
8214
|
+
group: view,
|
|
8215
|
+
position: target,
|
|
8216
|
+
index,
|
|
8217
|
+
},
|
|
8218
|
+
});
|
|
7519
8219
|
}), view.model.onDidDrop((event) => {
|
|
7520
|
-
this._onDidDrop.fire(
|
|
8220
|
+
this._onDidDrop.fire(event);
|
|
8221
|
+
}), view.model.onWillDrop((event) => {
|
|
8222
|
+
this._onWillDrop.fire(event);
|
|
8223
|
+
}), view.model.onWillShowOverlay((event) => {
|
|
8224
|
+
if (this.options.disableDnd) {
|
|
8225
|
+
event.preventDefault();
|
|
8226
|
+
return;
|
|
8227
|
+
}
|
|
8228
|
+
this._onWillShowOverlay.fire(event);
|
|
7521
8229
|
}), view.model.onDidAddPanel((event) => {
|
|
8230
|
+
if (this._moving) {
|
|
8231
|
+
return;
|
|
8232
|
+
}
|
|
7522
8233
|
this._onDidAddPanel.fire(event.panel);
|
|
7523
8234
|
}), view.model.onDidRemovePanel((event) => {
|
|
8235
|
+
if (this._moving) {
|
|
8236
|
+
return;
|
|
8237
|
+
}
|
|
7524
8238
|
this._onDidRemovePanel.fire(event.panel);
|
|
7525
8239
|
}), view.model.onDidActivePanelChange((event) => {
|
|
7526
|
-
this.
|
|
8240
|
+
if (this._moving) {
|
|
8241
|
+
return;
|
|
8242
|
+
}
|
|
8243
|
+
if (event.panel !== this.activePanel) {
|
|
8244
|
+
return;
|
|
8245
|
+
}
|
|
8246
|
+
if (this._onDidActivePanelChange.value !== event.panel) {
|
|
8247
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
8248
|
+
}
|
|
7527
8249
|
}));
|
|
7528
8250
|
this._groups.set(view.id, { value: view, disposable });
|
|
7529
8251
|
}
|
|
7530
|
-
// TODO: must be called after the above listeners have been setup,
|
|
7531
|
-
// not an ideal pattern
|
|
8252
|
+
// TODO: must be called after the above listeners have been setup, not an ideal pattern
|
|
7532
8253
|
view.initialize();
|
|
7533
8254
|
return view;
|
|
7534
8255
|
}
|
|
@@ -7581,7 +8302,20 @@ class GridviewComponent extends BaseGrid {
|
|
|
7581
8302
|
});
|
|
7582
8303
|
this._onDidLayoutfromJSON = new Emitter();
|
|
7583
8304
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
8305
|
+
this._onDidRemoveGroup = new Emitter();
|
|
8306
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
8307
|
+
this._onDidAddGroup = new Emitter();
|
|
8308
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
8309
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
8310
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
7584
8311
|
this._options = options;
|
|
8312
|
+
this.addDisposables(this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
|
|
8313
|
+
this._onDidAddGroup.fire(event);
|
|
8314
|
+
}), this.onDidRemove((event) => {
|
|
8315
|
+
this._onDidRemoveGroup.fire(event);
|
|
8316
|
+
}), this.onDidActiveChange((event) => {
|
|
8317
|
+
this._onDidActiveGroupChange.fire(event);
|
|
8318
|
+
}));
|
|
7585
8319
|
if (!this.options.components) {
|
|
7586
8320
|
this.options.components = {};
|
|
7587
8321
|
}
|
|
@@ -7756,6 +8490,7 @@ class GridviewComponent extends BaseGrid {
|
|
|
7756
8490
|
});
|
|
7757
8491
|
this.registerPanel(view);
|
|
7758
8492
|
this.doAddGroup(view, relativeLocation, options.size);
|
|
8493
|
+
this.doSetGroupActive(view);
|
|
7759
8494
|
return view;
|
|
7760
8495
|
}
|
|
7761
8496
|
registerPanel(panel) {
|
|
@@ -7897,19 +8632,19 @@ class SplitviewComponent extends Resizable {
|
|
|
7897
8632
|
const index = this.panels.indexOf(panel);
|
|
7898
8633
|
this.splitview.setViewVisible(index, visible);
|
|
7899
8634
|
}
|
|
7900
|
-
setActive(
|
|
7901
|
-
this._activePanel =
|
|
8635
|
+
setActive(panel, skipFocus) {
|
|
8636
|
+
this._activePanel = panel;
|
|
7902
8637
|
this.panels
|
|
7903
|
-
.filter((v) => v !==
|
|
8638
|
+
.filter((v) => v !== panel)
|
|
7904
8639
|
.forEach((v) => {
|
|
7905
8640
|
v.api._onDidActiveChange.fire({ isActive: false });
|
|
7906
8641
|
if (!skipFocus) {
|
|
7907
8642
|
v.focus();
|
|
7908
8643
|
}
|
|
7909
8644
|
});
|
|
7910
|
-
|
|
8645
|
+
panel.api._onDidActiveChange.fire({ isActive: true });
|
|
7911
8646
|
if (!skipFocus) {
|
|
7912
|
-
|
|
8647
|
+
panel.focus();
|
|
7913
8648
|
}
|
|
7914
8649
|
}
|
|
7915
8650
|
removePanel(panel, sizing) {
|
|
@@ -8208,6 +8943,10 @@ class PaneviewComponent extends Resizable {
|
|
|
8208
8943
|
});
|
|
8209
8944
|
this.addDisposables(this._disposable);
|
|
8210
8945
|
}
|
|
8946
|
+
setVisible(panel, visible) {
|
|
8947
|
+
const index = this.panels.indexOf(panel);
|
|
8948
|
+
this.paneview.setViewVisible(index, visible);
|
|
8949
|
+
}
|
|
8211
8950
|
focus() {
|
|
8212
8951
|
//noop
|
|
8213
8952
|
}
|
|
@@ -8254,6 +8993,7 @@ class PaneviewComponent extends Resizable {
|
|
|
8254
8993
|
isExpanded: options.isExpanded,
|
|
8255
8994
|
title: options.title,
|
|
8256
8995
|
containerApi: new PaneviewApi(this),
|
|
8996
|
+
accessor: this,
|
|
8257
8997
|
});
|
|
8258
8998
|
this.paneview.addPane(view, size, index);
|
|
8259
8999
|
view.orientation = this.paneview.orientation;
|
|
@@ -8353,6 +9093,7 @@ class PaneviewComponent extends Resizable {
|
|
|
8353
9093
|
title: data.title,
|
|
8354
9094
|
isExpanded: !!view.expanded,
|
|
8355
9095
|
containerApi: new PaneviewApi(this),
|
|
9096
|
+
accessor: this,
|
|
8356
9097
|
});
|
|
8357
9098
|
panel.orientation = this.paneview.orientation;
|
|
8358
9099
|
});
|
|
@@ -8441,7 +9182,7 @@ class SplitviewPanel extends BasePanelView {
|
|
|
8441
9182
|
this._onDidChange = new Emitter();
|
|
8442
9183
|
this.onDidChange = this._onDidChange.event;
|
|
8443
9184
|
this.api.initialize(this);
|
|
8444
|
-
this.addDisposables(this._onDidChange, this.api.
|
|
9185
|
+
this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => {
|
|
8445
9186
|
const { isVisible } = event;
|
|
8446
9187
|
const { accessor } = this._params;
|
|
8447
9188
|
accessor.setVisible(this, isVisible);
|
|
@@ -8566,13 +9307,13 @@ class ReactPart {
|
|
|
8566
9307
|
if (this.disposed) {
|
|
8567
9308
|
throw new Error('invalid operation: resource is already disposed');
|
|
8568
9309
|
}
|
|
8569
|
-
if (
|
|
9310
|
+
if (!isReactComponent(this.component)) {
|
|
8570
9311
|
/**
|
|
8571
9312
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
8572
|
-
* if we do not intercept
|
|
8573
|
-
* for the same reason
|
|
9313
|
+
* if we do not intercept then React library will throw a very obsure error
|
|
9314
|
+
* for the same reason... at least at this point we will emit a sensible stacktrace.
|
|
8574
9315
|
*/
|
|
8575
|
-
throw new Error('
|
|
9316
|
+
throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');
|
|
8576
9317
|
}
|
|
8577
9318
|
const bridgeComponent = React__namespace.createElement(React__namespace.forwardRef(ReactComponentBridge), {
|
|
8578
9319
|
component: this
|
|
@@ -8624,9 +9365,13 @@ const usePortalsLifecycle = () => {
|
|
|
8624
9365
|
}, []);
|
|
8625
9366
|
return [portals, addPortal];
|
|
8626
9367
|
};
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
9368
|
+
function isReactComponent(component) {
|
|
9369
|
+
/**
|
|
9370
|
+
* Yes, we could use "react-is" but that would introduce an unwanted peer dependency
|
|
9371
|
+
* so for now we will check in a rather crude fashion...
|
|
9372
|
+
*/
|
|
9373
|
+
return (typeof component === 'function' /** Functional Componnts */ ||
|
|
9374
|
+
!!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
|
|
8630
9375
|
}
|
|
8631
9376
|
|
|
8632
9377
|
class ReactPanelContentPart {
|
|
@@ -8886,6 +9631,8 @@ const DockviewReact = React__namespace.forwardRef((props, ref) => {
|
|
|
8886
9631
|
defaultRenderer: props.defaultRenderer,
|
|
8887
9632
|
debug: props.debug,
|
|
8888
9633
|
rootOverlayModel: props.rootOverlayModel,
|
|
9634
|
+
locked: props.locked,
|
|
9635
|
+
disableDnd: props.disableDnd,
|
|
8889
9636
|
});
|
|
8890
9637
|
const { clientWidth, clientHeight } = domRef.current;
|
|
8891
9638
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -8897,6 +9644,20 @@ const DockviewReact = React__namespace.forwardRef((props, ref) => {
|
|
|
8897
9644
|
dockview.dispose();
|
|
8898
9645
|
};
|
|
8899
9646
|
}, []);
|
|
9647
|
+
React__namespace.useEffect(() => {
|
|
9648
|
+
if (!dockviewRef.current) {
|
|
9649
|
+
return;
|
|
9650
|
+
}
|
|
9651
|
+
dockviewRef.current.locked = !!props.locked;
|
|
9652
|
+
}, [props.locked]);
|
|
9653
|
+
React__namespace.useEffect(() => {
|
|
9654
|
+
if (!dockviewRef.current) {
|
|
9655
|
+
return;
|
|
9656
|
+
}
|
|
9657
|
+
dockviewRef.current.updateOptions({
|
|
9658
|
+
disableDnd: props.disableDnd,
|
|
9659
|
+
});
|
|
9660
|
+
}, [props.disableDnd]);
|
|
8900
9661
|
React__namespace.useEffect(() => {
|
|
8901
9662
|
if (!dockviewRef.current) {
|
|
8902
9663
|
return () => {
|
|
@@ -8912,6 +9673,21 @@ const DockviewReact = React__namespace.forwardRef((props, ref) => {
|
|
|
8912
9673
|
disposable.dispose();
|
|
8913
9674
|
};
|
|
8914
9675
|
}, [props.onDidDrop]);
|
|
9676
|
+
React__namespace.useEffect(() => {
|
|
9677
|
+
if (!dockviewRef.current) {
|
|
9678
|
+
return () => {
|
|
9679
|
+
// noop
|
|
9680
|
+
};
|
|
9681
|
+
}
|
|
9682
|
+
const disposable = dockviewRef.current.onWillDrop((event) => {
|
|
9683
|
+
if (props.onWillDrop) {
|
|
9684
|
+
props.onWillDrop(event);
|
|
9685
|
+
}
|
|
9686
|
+
});
|
|
9687
|
+
return () => {
|
|
9688
|
+
disposable.dispose();
|
|
9689
|
+
};
|
|
9690
|
+
}, [props.onWillDrop]);
|
|
8915
9691
|
React__namespace.useEffect(() => {
|
|
8916
9692
|
if (!dockviewRef.current) {
|
|
8917
9693
|
return;
|
|
@@ -9154,7 +9930,9 @@ class ReactGridPanelView extends GridviewPanel {
|
|
|
9154
9930
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
9155
9931
|
params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
|
|
9156
9932
|
api: this.api,
|
|
9157
|
-
|
|
9933
|
+
// TODO: fix casting hack
|
|
9934
|
+
containerApi: new GridviewApi(this._params
|
|
9935
|
+
.accessor),
|
|
9158
9936
|
});
|
|
9159
9937
|
}
|
|
9160
9938
|
}
|
|
@@ -9337,12 +10115,14 @@ exports.DockviewApi = DockviewApi;
|
|
|
9337
10115
|
exports.DockviewComponent = DockviewComponent;
|
|
9338
10116
|
exports.DockviewCompositeDisposable = CompositeDisposable;
|
|
9339
10117
|
exports.DockviewDefaultTab = DockviewDefaultTab;
|
|
10118
|
+
exports.DockviewDidDropEvent = DockviewDidDropEvent;
|
|
9340
10119
|
exports.DockviewEmitter = Emitter;
|
|
9341
10120
|
exports.DockviewGroupPanel = DockviewGroupPanel;
|
|
9342
10121
|
exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
|
|
9343
10122
|
exports.DockviewMutableDisposable = MutableDisposable;
|
|
9344
10123
|
exports.DockviewPanel = DockviewPanel;
|
|
9345
10124
|
exports.DockviewReact = DockviewReact;
|
|
10125
|
+
exports.DockviewWillDropEvent = DockviewWillDropEvent;
|
|
9346
10126
|
exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
|
|
9347
10127
|
exports.Gridview = Gridview;
|
|
9348
10128
|
exports.GridviewApi = GridviewApi;
|
|
@@ -9366,6 +10146,7 @@ exports.SplitviewComponent = SplitviewComponent;
|
|
|
9366
10146
|
exports.SplitviewPanel = SplitviewPanel;
|
|
9367
10147
|
exports.SplitviewReact = SplitviewReact;
|
|
9368
10148
|
exports.Tab = Tab;
|
|
10149
|
+
exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
|
|
9369
10150
|
exports.createComponent = createComponent;
|
|
9370
10151
|
exports.directionToPosition = directionToPosition;
|
|
9371
10152
|
exports.getDirectionOrientation = getDirectionOrientation;
|
|
@@ -9380,7 +10161,7 @@ exports.isGroupOptionsWithGroup = isGroupOptionsWithGroup;
|
|
|
9380
10161
|
exports.isGroupOptionsWithPanel = isGroupOptionsWithPanel;
|
|
9381
10162
|
exports.isPanelOptionsWithGroup = isPanelOptionsWithGroup;
|
|
9382
10163
|
exports.isPanelOptionsWithPanel = isPanelOptionsWithPanel;
|
|
9383
|
-
exports.
|
|
10164
|
+
exports.isReactComponent = isReactComponent;
|
|
9384
10165
|
exports.orthogonal = orthogonal;
|
|
9385
10166
|
exports.positionToDirection = positionToDirection;
|
|
9386
10167
|
exports.toTarget = toTarget;
|