dockview 1.9.2 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +1283 -534
- 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 +1283 -534
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +1283 -534
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +1280 -534
- 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 +1283 -534
- 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 +1283 -534
- 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.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.10.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -142,6 +142,17 @@
|
|
|
142
142
|
};
|
|
143
143
|
};
|
|
144
144
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
145
|
+
class DockviewEvent {
|
|
146
|
+
constructor() {
|
|
147
|
+
this._defaultPrevented = false;
|
|
148
|
+
}
|
|
149
|
+
get defaultPrevented() {
|
|
150
|
+
return this._defaultPrevented;
|
|
151
|
+
}
|
|
152
|
+
preventDefault() {
|
|
153
|
+
this._defaultPrevented = true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
145
156
|
class LeakageMonitor {
|
|
146
157
|
constructor() {
|
|
147
158
|
this.events = new Map();
|
|
@@ -185,6 +196,9 @@
|
|
|
185
196
|
}
|
|
186
197
|
Emitter.ENABLE_TRACKING = isEnabled;
|
|
187
198
|
}
|
|
199
|
+
get value() {
|
|
200
|
+
return this._last;
|
|
201
|
+
}
|
|
188
202
|
constructor(options) {
|
|
189
203
|
this.options = options;
|
|
190
204
|
this._listeners = [];
|
|
@@ -307,8 +321,12 @@
|
|
|
307
321
|
args.forEach((arg) => this._disposables.push(arg));
|
|
308
322
|
}
|
|
309
323
|
dispose() {
|
|
310
|
-
this.
|
|
324
|
+
if (this._isDisposed) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
311
327
|
this._isDisposed = true;
|
|
328
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
329
|
+
this._disposables = [];
|
|
312
330
|
}
|
|
313
331
|
}
|
|
314
332
|
class MutableDisposable {
|
|
@@ -792,6 +810,13 @@
|
|
|
792
810
|
this._endSnappingEnabled = endSnappingEnabled;
|
|
793
811
|
this.updateSashEnablement();
|
|
794
812
|
}
|
|
813
|
+
get disabled() {
|
|
814
|
+
return this._disabled;
|
|
815
|
+
}
|
|
816
|
+
set disabled(value) {
|
|
817
|
+
this._disabled = value;
|
|
818
|
+
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
819
|
+
}
|
|
795
820
|
constructor(container, options) {
|
|
796
821
|
this.container = container;
|
|
797
822
|
this.viewItems = [];
|
|
@@ -802,6 +827,7 @@
|
|
|
802
827
|
this._proportions = undefined;
|
|
803
828
|
this._startSnappingEnabled = true;
|
|
804
829
|
this._endSnappingEnabled = true;
|
|
830
|
+
this._disabled = false;
|
|
805
831
|
this._onDidSashEnd = new Emitter();
|
|
806
832
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
807
833
|
this._onDidAddView = new Emitter();
|
|
@@ -1729,7 +1755,13 @@
|
|
|
1729
1755
|
}
|
|
1730
1756
|
return exports.LayoutPriority.Normal;
|
|
1731
1757
|
}
|
|
1732
|
-
|
|
1758
|
+
get disabled() {
|
|
1759
|
+
return this.splitview.disabled;
|
|
1760
|
+
}
|
|
1761
|
+
set disabled(value) {
|
|
1762
|
+
this.splitview.disabled = value;
|
|
1763
|
+
}
|
|
1764
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, childDescriptors) {
|
|
1733
1765
|
super();
|
|
1734
1766
|
this.orientation = orientation;
|
|
1735
1767
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1774,6 +1806,7 @@
|
|
|
1774
1806
|
styles,
|
|
1775
1807
|
});
|
|
1776
1808
|
}
|
|
1809
|
+
this.disabled = disabled;
|
|
1777
1810
|
this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
|
|
1778
1811
|
this._onDidChange.fire({});
|
|
1779
1812
|
}));
|
|
@@ -1907,7 +1940,7 @@
|
|
|
1907
1940
|
}
|
|
1908
1941
|
function flipNode(node, size, orthogonalSize) {
|
|
1909
1942
|
if (node instanceof BranchNode) {
|
|
1910
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
1943
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1911
1944
|
let totalSize = 0;
|
|
1912
1945
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1913
1946
|
const child = node.children[i];
|
|
@@ -2043,31 +2076,57 @@
|
|
|
2043
2076
|
get maximumHeight() {
|
|
2044
2077
|
return this.root.maximumHeight;
|
|
2045
2078
|
}
|
|
2079
|
+
get locked() {
|
|
2080
|
+
return this._locked;
|
|
2081
|
+
}
|
|
2082
|
+
set locked(value) {
|
|
2083
|
+
this._locked = value;
|
|
2084
|
+
const branch = [this.root];
|
|
2085
|
+
/**
|
|
2086
|
+
* simple depth-first-search to cover all nodes
|
|
2087
|
+
*
|
|
2088
|
+
* @see https://en.wikipedia.org/wiki/Depth-first_search
|
|
2089
|
+
*/
|
|
2090
|
+
while (branch.length > 0) {
|
|
2091
|
+
const node = branch.pop();
|
|
2092
|
+
if (node instanceof BranchNode) {
|
|
2093
|
+
node.disabled = value;
|
|
2094
|
+
branch.push(...node.children);
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2046
2098
|
maximizedView() {
|
|
2047
2099
|
var _a;
|
|
2048
|
-
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.view;
|
|
2100
|
+
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
2049
2101
|
}
|
|
2050
2102
|
hasMaximizedView() {
|
|
2051
2103
|
return this._maximizedNode !== undefined;
|
|
2052
2104
|
}
|
|
2053
2105
|
maximizeView(view) {
|
|
2106
|
+
var _a;
|
|
2054
2107
|
const location = getGridLocation(view.element);
|
|
2055
2108
|
const [_, node] = this.getNode(location);
|
|
2056
2109
|
if (!(node instanceof LeafNode)) {
|
|
2057
2110
|
return;
|
|
2058
2111
|
}
|
|
2059
|
-
if (this._maximizedNode === node) {
|
|
2112
|
+
if (((_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf) === node) {
|
|
2060
2113
|
return;
|
|
2061
2114
|
}
|
|
2062
2115
|
if (this.hasMaximizedView()) {
|
|
2063
2116
|
this.exitMaximizedView();
|
|
2064
2117
|
}
|
|
2118
|
+
const hiddenOnMaximize = [];
|
|
2065
2119
|
function hideAllViewsBut(parent, exclude) {
|
|
2066
2120
|
for (let i = 0; i < parent.children.length; i++) {
|
|
2067
2121
|
const child = parent.children[i];
|
|
2068
2122
|
if (child instanceof LeafNode) {
|
|
2069
2123
|
if (child !== exclude) {
|
|
2070
|
-
parent.
|
|
2124
|
+
if (parent.isChildVisible(i)) {
|
|
2125
|
+
parent.setChildVisible(i, false);
|
|
2126
|
+
}
|
|
2127
|
+
else {
|
|
2128
|
+
hiddenOnMaximize.push(child);
|
|
2129
|
+
}
|
|
2071
2130
|
}
|
|
2072
2131
|
}
|
|
2073
2132
|
else {
|
|
@@ -2076,18 +2135,21 @@
|
|
|
2076
2135
|
}
|
|
2077
2136
|
}
|
|
2078
2137
|
hideAllViewsBut(this.root, node);
|
|
2079
|
-
this._maximizedNode = node;
|
|
2080
|
-
this.
|
|
2138
|
+
this._maximizedNode = { leaf: node, hiddenOnMaximize };
|
|
2139
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2081
2140
|
}
|
|
2082
2141
|
exitMaximizedView() {
|
|
2083
2142
|
if (!this._maximizedNode) {
|
|
2084
2143
|
return;
|
|
2085
2144
|
}
|
|
2145
|
+
const hiddenOnMaximize = this._maximizedNode.hiddenOnMaximize;
|
|
2086
2146
|
function showViewsInReverseOrder(parent) {
|
|
2087
2147
|
for (let index = parent.children.length - 1; index >= 0; index--) {
|
|
2088
2148
|
const child = parent.children[index];
|
|
2089
2149
|
if (child instanceof LeafNode) {
|
|
2090
|
-
|
|
2150
|
+
if (!hiddenOnMaximize.includes(child)) {
|
|
2151
|
+
parent.setChildVisible(index, true);
|
|
2152
|
+
}
|
|
2091
2153
|
}
|
|
2092
2154
|
else {
|
|
2093
2155
|
showViewsInReverseOrder(child);
|
|
@@ -2096,13 +2158,13 @@
|
|
|
2096
2158
|
}
|
|
2097
2159
|
showViewsInReverseOrder(this.root);
|
|
2098
2160
|
this._maximizedNode = undefined;
|
|
2099
|
-
this.
|
|
2161
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2100
2162
|
}
|
|
2101
2163
|
serialize() {
|
|
2102
2164
|
if (this.hasMaximizedView()) {
|
|
2103
2165
|
/**
|
|
2104
|
-
* do not persist maximized view state
|
|
2105
|
-
*
|
|
2166
|
+
* do not persist maximized view state
|
|
2167
|
+
* firstly exit any maximized views to ensure the correct dimensions are persisted
|
|
2106
2168
|
*/
|
|
2107
2169
|
this.exitMaximizedView();
|
|
2108
2170
|
}
|
|
@@ -2117,14 +2179,14 @@
|
|
|
2117
2179
|
dispose() {
|
|
2118
2180
|
this.disposable.dispose();
|
|
2119
2181
|
this._onDidChange.dispose();
|
|
2120
|
-
this.
|
|
2182
|
+
this._onDidMaximizedNodeChange.dispose();
|
|
2121
2183
|
this.root.dispose();
|
|
2122
2184
|
this._maximizedNode = undefined;
|
|
2123
2185
|
this.element.remove();
|
|
2124
2186
|
}
|
|
2125
2187
|
clear() {
|
|
2126
2188
|
const orientation = this.root.orientation;
|
|
2127
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize);
|
|
2189
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this._locked);
|
|
2128
2190
|
}
|
|
2129
2191
|
deserialize(json, deserializer) {
|
|
2130
2192
|
const orientation = json.orientation;
|
|
@@ -2145,8 +2207,8 @@
|
|
|
2145
2207
|
};
|
|
2146
2208
|
});
|
|
2147
2209
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2148
|
-
orthogonalSize, // <- size - flips at each depth
|
|
2149
|
-
children);
|
|
2210
|
+
orthogonalSize, // <- size - flips at each depth,
|
|
2211
|
+
this._locked, children);
|
|
2150
2212
|
}
|
|
2151
2213
|
else {
|
|
2152
2214
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2179,7 +2241,7 @@
|
|
|
2179
2241
|
}
|
|
2180
2242
|
const oldRoot = this.root;
|
|
2181
2243
|
oldRoot.element.remove();
|
|
2182
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
|
|
2244
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this._locked);
|
|
2183
2245
|
if (oldRoot.children.length === 0) ;
|
|
2184
2246
|
else if (oldRoot.children.length === 1) {
|
|
2185
2247
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2247,15 +2309,16 @@
|
|
|
2247
2309
|
constructor(proportionalLayout, styles, orientation) {
|
|
2248
2310
|
this.proportionalLayout = proportionalLayout;
|
|
2249
2311
|
this.styles = styles;
|
|
2312
|
+
this._locked = false;
|
|
2250
2313
|
this._maximizedNode = undefined;
|
|
2251
2314
|
this.disposable = new MutableDisposable();
|
|
2252
2315
|
this._onDidChange = new Emitter();
|
|
2253
2316
|
this.onDidChange = this._onDidChange.event;
|
|
2254
|
-
this.
|
|
2255
|
-
this.
|
|
2317
|
+
this._onDidMaximizedNodeChange = new Emitter();
|
|
2318
|
+
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2256
2319
|
this.element = document.createElement('div');
|
|
2257
2320
|
this.element.className = 'grid-view';
|
|
2258
|
-
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
2321
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this._locked);
|
|
2259
2322
|
}
|
|
2260
2323
|
isViewVisible(location) {
|
|
2261
2324
|
const [rest, index] = tail(location);
|
|
@@ -2306,7 +2369,7 @@
|
|
|
2306
2369
|
}
|
|
2307
2370
|
const child = grandParent.removeChild(parentIndex);
|
|
2308
2371
|
child.dispose();
|
|
2309
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2372
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this._locked);
|
|
2310
2373
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2311
2374
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2312
2375
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2933,6 +2996,21 @@
|
|
|
2933
2996
|
get onDidDrop() {
|
|
2934
2997
|
return this.component.onDidDrop;
|
|
2935
2998
|
}
|
|
2999
|
+
/**
|
|
3000
|
+
* Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and
|
|
3001
|
+
* prevent the event from occuring using the standard `preventDefault()` syntax.
|
|
3002
|
+
*
|
|
3003
|
+
* Preventing certain events may causes unexpected behaviours, use carefully.
|
|
3004
|
+
*/
|
|
3005
|
+
get onWillDrop() {
|
|
3006
|
+
return this.component.onWillDrop;
|
|
3007
|
+
}
|
|
3008
|
+
/**
|
|
3009
|
+
*
|
|
3010
|
+
*/
|
|
3011
|
+
get onWillShowOverlay() {
|
|
3012
|
+
return this.component.onWillShowOverlay;
|
|
3013
|
+
}
|
|
2936
3014
|
/**
|
|
2937
3015
|
* Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality.
|
|
2938
3016
|
*/
|
|
@@ -3068,17 +3146,17 @@
|
|
|
3068
3146
|
hasMaximizedGroup() {
|
|
3069
3147
|
return this.component.hasMaximizedGroup();
|
|
3070
3148
|
}
|
|
3071
|
-
|
|
3149
|
+
exitMaximizedGroup() {
|
|
3072
3150
|
this.component.exitMaximizedGroup();
|
|
3073
3151
|
}
|
|
3074
|
-
get
|
|
3075
|
-
return this.component.
|
|
3152
|
+
get onDidMaximizedGroupChange() {
|
|
3153
|
+
return this.component.onDidMaximizedGroupChange;
|
|
3076
3154
|
}
|
|
3077
3155
|
/**
|
|
3078
3156
|
* Add a popout group in a new Window
|
|
3079
3157
|
*/
|
|
3080
3158
|
addPopoutGroup(item, options) {
|
|
3081
|
-
this.component.addPopoutGroup(item, options);
|
|
3159
|
+
return this.component.addPopoutGroup(item, options);
|
|
3082
3160
|
}
|
|
3083
3161
|
}
|
|
3084
3162
|
|
|
@@ -3132,6 +3210,18 @@
|
|
|
3132
3210
|
}
|
|
3133
3211
|
}
|
|
3134
3212
|
|
|
3213
|
+
class WillShowOverlayEvent extends DockviewEvent {
|
|
3214
|
+
get nativeEvent() {
|
|
3215
|
+
return this.options.nativeEvent;
|
|
3216
|
+
}
|
|
3217
|
+
get position() {
|
|
3218
|
+
return this.options.position;
|
|
3219
|
+
}
|
|
3220
|
+
constructor(options) {
|
|
3221
|
+
super();
|
|
3222
|
+
this.options = options;
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3135
3225
|
function directionToPosition(direction) {
|
|
3136
3226
|
switch (direction) {
|
|
3137
3227
|
case 'above':
|
|
@@ -3184,6 +3274,8 @@
|
|
|
3184
3274
|
this.options = options;
|
|
3185
3275
|
this._onDrop = new Emitter();
|
|
3186
3276
|
this.onDrop = this._onDrop.event;
|
|
3277
|
+
this._onWillShowOverlay = new Emitter();
|
|
3278
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3187
3279
|
// use a set to take advantage of #<set>.has
|
|
3188
3280
|
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
3189
3281
|
this.dnd = new DragAndDropObserver(this.element, {
|
|
@@ -3212,6 +3304,19 @@
|
|
|
3212
3304
|
this.removeDropTarget();
|
|
3213
3305
|
return;
|
|
3214
3306
|
}
|
|
3307
|
+
const willShowOverlayEvent = new WillShowOverlayEvent({
|
|
3308
|
+
nativeEvent: e,
|
|
3309
|
+
position: quadrant,
|
|
3310
|
+
});
|
|
3311
|
+
/**
|
|
3312
|
+
* Provide an opportunity to prevent the overlay appearing and in turn
|
|
3313
|
+
* any dnd behaviours
|
|
3314
|
+
*/
|
|
3315
|
+
this._onWillShowOverlay.fire(willShowOverlayEvent);
|
|
3316
|
+
if (willShowOverlayEvent.defaultPrevented) {
|
|
3317
|
+
this.removeDropTarget();
|
|
3318
|
+
return;
|
|
3319
|
+
}
|
|
3215
3320
|
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
3216
3321
|
if (!this.options.canDisplayOverlay) {
|
|
3217
3322
|
this.removeDropTarget();
|
|
@@ -3254,7 +3359,7 @@
|
|
|
3254
3359
|
}
|
|
3255
3360
|
},
|
|
3256
3361
|
});
|
|
3257
|
-
this.addDisposables(this._onDrop, this.dnd);
|
|
3362
|
+
this.addDisposables(this._onDrop, this._onWillShowOverlay, this.dnd);
|
|
3258
3363
|
}
|
|
3259
3364
|
setTargetZones(acceptedTargetZones) {
|
|
3260
3365
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
@@ -3307,25 +3412,44 @@
|
|
|
3307
3412
|
size = clamp(0, sizeOptions.value, height) / height;
|
|
3308
3413
|
}
|
|
3309
3414
|
}
|
|
3310
|
-
const
|
|
3311
|
-
|
|
3312
|
-
|
|
3415
|
+
const box = { top: '0px', left: '0px', width: '100%', height: '100%' };
|
|
3416
|
+
/**
|
|
3417
|
+
* You can also achieve the overlay placement using the transform CSS property
|
|
3418
|
+
* to translate and scale the element however this has the undesired effect of
|
|
3419
|
+
* 'skewing' the element. Comment left here for anybody that ever revisits this.
|
|
3420
|
+
*
|
|
3421
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
|
3422
|
+
*
|
|
3423
|
+
* right
|
|
3424
|
+
* translateX(${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3425
|
+
*
|
|
3426
|
+
* left
|
|
3427
|
+
* translateX(-${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3428
|
+
*
|
|
3429
|
+
* top
|
|
3430
|
+
* translateY(-${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3431
|
+
*
|
|
3432
|
+
* bottom
|
|
3433
|
+
* translateY(${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3434
|
+
*/
|
|
3313
3435
|
if (rightClass) {
|
|
3314
|
-
|
|
3436
|
+
box.left = `${100 * (1 - size)}%`;
|
|
3437
|
+
box.width = `${100 * size}%`;
|
|
3315
3438
|
}
|
|
3316
3439
|
else if (leftClass) {
|
|
3317
|
-
|
|
3440
|
+
box.width = `${100 * size}%`;
|
|
3318
3441
|
}
|
|
3319
3442
|
else if (topClass) {
|
|
3320
|
-
|
|
3443
|
+
box.height = `${100 * size}%`;
|
|
3321
3444
|
}
|
|
3322
3445
|
else if (bottomClass) {
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
else {
|
|
3326
|
-
transform = '';
|
|
3446
|
+
box.top = `${100 * (1 - size)}%`;
|
|
3447
|
+
box.height = `${100 * size}%`;
|
|
3327
3448
|
}
|
|
3328
|
-
this.overlayElement.style.
|
|
3449
|
+
this.overlayElement.style.top = box.top;
|
|
3450
|
+
this.overlayElement.style.left = box.left;
|
|
3451
|
+
this.overlayElement.style.width = box.width;
|
|
3452
|
+
this.overlayElement.style.height = box.height;
|
|
3329
3453
|
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3330
3454
|
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3331
3455
|
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
@@ -3393,14 +3517,6 @@
|
|
|
3393
3517
|
return 'center';
|
|
3394
3518
|
}
|
|
3395
3519
|
|
|
3396
|
-
exports.DockviewDropTargets = void 0;
|
|
3397
|
-
(function (DockviewDropTargets) {
|
|
3398
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3399
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3400
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3401
|
-
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3402
|
-
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3403
|
-
|
|
3404
3520
|
class ContentContainer extends CompositeDisposable {
|
|
3405
3521
|
get element() {
|
|
3406
3522
|
return this._element;
|
|
@@ -3428,7 +3544,7 @@
|
|
|
3428
3544
|
const data = getPanelData();
|
|
3429
3545
|
if (!data &&
|
|
3430
3546
|
event.shiftKey &&
|
|
3431
|
-
this.group.location !== 'floating') {
|
|
3547
|
+
this.group.location.type !== 'floating') {
|
|
3432
3548
|
return false;
|
|
3433
3549
|
}
|
|
3434
3550
|
if (data && data.viewId === this.accessor.id) {
|
|
@@ -3446,7 +3562,7 @@
|
|
|
3446
3562
|
data.groupId === this.group.id;
|
|
3447
3563
|
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3448
3564
|
}
|
|
3449
|
-
return this.group.canDisplayOverlay(event, position,
|
|
3565
|
+
return this.group.canDisplayOverlay(event, position, 'panel');
|
|
3450
3566
|
},
|
|
3451
3567
|
});
|
|
3452
3568
|
this.addDisposables(this.dropTarget);
|
|
@@ -3471,7 +3587,7 @@
|
|
|
3471
3587
|
let container;
|
|
3472
3588
|
switch (panel.api.renderer) {
|
|
3473
3589
|
case 'onlyWhenVisibile':
|
|
3474
|
-
this.
|
|
3590
|
+
this.group.renderContainer.detatch(panel);
|
|
3475
3591
|
if (this.panel) {
|
|
3476
3592
|
if (doRender) {
|
|
3477
3593
|
this._element.appendChild(this.panel.view.content.element);
|
|
@@ -3483,7 +3599,7 @@
|
|
|
3483
3599
|
if (panel.view.content.element.parentElement === this._element) {
|
|
3484
3600
|
this._element.removeChild(panel.view.content.element);
|
|
3485
3601
|
}
|
|
3486
|
-
container = this.
|
|
3602
|
+
container = this.group.renderContainer.attach({
|
|
3487
3603
|
panel,
|
|
3488
3604
|
referenceContainer: this,
|
|
3489
3605
|
});
|
|
@@ -3514,9 +3630,10 @@
|
|
|
3514
3630
|
// noop
|
|
3515
3631
|
}
|
|
3516
3632
|
closePanel() {
|
|
3633
|
+
var _a;
|
|
3517
3634
|
if (this.panel) {
|
|
3518
3635
|
if (this.panel.api.renderer === 'onlyWhenVisibile') {
|
|
3519
|
-
this.
|
|
3636
|
+
(_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
|
|
3520
3637
|
}
|
|
3521
3638
|
}
|
|
3522
3639
|
this.panel = undefined;
|
|
@@ -3627,7 +3744,7 @@
|
|
|
3627
3744
|
this._element.draggable = true;
|
|
3628
3745
|
toggleClass(this.element, 'inactive-tab', true);
|
|
3629
3746
|
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
3630
|
-
this.
|
|
3747
|
+
this.dropTarget = new Droptarget(this._element, {
|
|
3631
3748
|
acceptedTargetZones: ['center'],
|
|
3632
3749
|
canDisplayOverlay: (event, position) => {
|
|
3633
3750
|
if (this.group.locked) {
|
|
@@ -3642,9 +3759,10 @@
|
|
|
3642
3759
|
}
|
|
3643
3760
|
return this.panel.id !== data.panelId;
|
|
3644
3761
|
}
|
|
3645
|
-
return this.group.model.canDisplayOverlay(event, position,
|
|
3762
|
+
return this.group.model.canDisplayOverlay(event, position, 'tab');
|
|
3646
3763
|
},
|
|
3647
3764
|
});
|
|
3765
|
+
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
3648
3766
|
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
3649
3767
|
this._onDragStart.fire(event);
|
|
3650
3768
|
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
@@ -3652,9 +3770,9 @@
|
|
|
3652
3770
|
return;
|
|
3653
3771
|
}
|
|
3654
3772
|
this._onChanged.fire(event);
|
|
3655
|
-
}), this.
|
|
3773
|
+
}), this.dropTarget.onDrop((event) => {
|
|
3656
3774
|
this._onDropped.fire(event);
|
|
3657
|
-
}), this.
|
|
3775
|
+
}), this.dropTarget);
|
|
3658
3776
|
}
|
|
3659
3777
|
setActive(isActive) {
|
|
3660
3778
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -3701,7 +3819,7 @@
|
|
|
3701
3819
|
}, true));
|
|
3702
3820
|
}
|
|
3703
3821
|
isCancelled(_event) {
|
|
3704
|
-
if (this.group.api.location === 'floating' && !_event.shiftKey) {
|
|
3822
|
+
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
3705
3823
|
return true;
|
|
3706
3824
|
}
|
|
3707
3825
|
return false;
|
|
@@ -3753,7 +3871,7 @@
|
|
|
3753
3871
|
this.accessor.doSetGroupActive(this.group);
|
|
3754
3872
|
}));
|
|
3755
3873
|
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3756
|
-
this.
|
|
3874
|
+
this.dropTraget = new Droptarget(this._element, {
|
|
3757
3875
|
acceptedTargetZones: ['center'],
|
|
3758
3876
|
canDisplayOverlay: (event, position) => {
|
|
3759
3877
|
var _a;
|
|
@@ -3767,14 +3885,15 @@
|
|
|
3767
3885
|
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
3768
3886
|
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
3769
3887
|
}
|
|
3770
|
-
return group.model.canDisplayOverlay(event, position,
|
|
3888
|
+
return group.model.canDisplayOverlay(event, position, 'panel');
|
|
3771
3889
|
},
|
|
3772
3890
|
});
|
|
3891
|
+
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
3773
3892
|
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3774
3893
|
this._onDragStart.fire(event);
|
|
3775
|
-
}), this.
|
|
3894
|
+
}), this.dropTraget.onDrop((event) => {
|
|
3776
3895
|
this._onDrop.fire(event);
|
|
3777
|
-
}), this.
|
|
3896
|
+
}), this.dropTraget);
|
|
3778
3897
|
}
|
|
3779
3898
|
}
|
|
3780
3899
|
|
|
@@ -3862,19 +3981,11 @@
|
|
|
3862
3981
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
3863
3982
|
this._onGroupDragStart = new Emitter();
|
|
3864
3983
|
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3865
|
-
this.
|
|
3984
|
+
this._onWillShowOverlay = new Emitter();
|
|
3985
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3866
3986
|
this._element = document.createElement('div');
|
|
3867
3987
|
this._element.className = 'tabs-and-actions-container';
|
|
3868
3988
|
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
3869
|
-
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3870
|
-
if (e.api.group === this.group) {
|
|
3871
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3872
|
-
}
|
|
3873
|
-
}), this.accessor.onDidRemovePanel((e) => {
|
|
3874
|
-
if (e.api.group === this.group) {
|
|
3875
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3876
|
-
}
|
|
3877
|
-
}));
|
|
3878
3989
|
this.rightActionsContainer = document.createElement('div');
|
|
3879
3990
|
this.rightActionsContainer.className = 'right-actions-container';
|
|
3880
3991
|
this.leftActionsContainer = document.createElement('div');
|
|
@@ -3889,7 +4000,15 @@
|
|
|
3889
4000
|
this._element.appendChild(this.leftActionsContainer);
|
|
3890
4001
|
this._element.appendChild(this.voidContainer.element);
|
|
3891
4002
|
this._element.appendChild(this.rightActionsContainer);
|
|
3892
|
-
this.addDisposables(this.
|
|
4003
|
+
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
4004
|
+
if (e.api.group === this.group) {
|
|
4005
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4006
|
+
}
|
|
4007
|
+
}), this.accessor.onDidRemovePanel((e) => {
|
|
4008
|
+
if (e.api.group === this.group) {
|
|
4009
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4010
|
+
}
|
|
4011
|
+
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3893
4012
|
this._onGroupDragStart.fire({
|
|
3894
4013
|
nativeEvent: event,
|
|
3895
4014
|
group: this.group,
|
|
@@ -3899,11 +4018,15 @@
|
|
|
3899
4018
|
event: event.nativeEvent,
|
|
3900
4019
|
index: this.tabs.length,
|
|
3901
4020
|
});
|
|
4021
|
+
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
4022
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4023
|
+
kind: 'header_space',
|
|
4024
|
+
}));
|
|
3902
4025
|
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
3903
4026
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3904
4027
|
if (isFloatingGroupsEnabled &&
|
|
3905
4028
|
event.shiftKey &&
|
|
3906
|
-
this.group.api.location !== 'floating') {
|
|
4029
|
+
this.group.api.location.type !== 'floating') {
|
|
3907
4030
|
event.preventDefault();
|
|
3908
4031
|
const { top, left } = this.element.getBoundingClientRect();
|
|
3909
4032
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
@@ -3966,9 +4089,9 @@
|
|
|
3966
4089
|
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
3967
4090
|
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
3968
4091
|
}), tab.onChanged((event) => {
|
|
3969
|
-
var _a;
|
|
3970
4092
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3971
|
-
const isFloatingWithOnePanel = this.group.api.location === 'floating' &&
|
|
4093
|
+
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
4094
|
+
this.size === 1;
|
|
3972
4095
|
if (isFloatingGroupsEnabled &&
|
|
3973
4096
|
!isFloatingWithOnePanel &&
|
|
3974
4097
|
event.shiftKey) {
|
|
@@ -3982,20 +4105,20 @@
|
|
|
3982
4105
|
}, { inDragMode: true });
|
|
3983
4106
|
return;
|
|
3984
4107
|
}
|
|
3985
|
-
const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
3986
|
-
this.group.model.isContentFocused;
|
|
3987
4108
|
const isLeftClick = event.button === 0;
|
|
3988
4109
|
if (!isLeftClick || event.defaultPrevented) {
|
|
3989
4110
|
return;
|
|
3990
4111
|
}
|
|
3991
|
-
this.group.
|
|
3992
|
-
|
|
3993
|
-
}
|
|
4112
|
+
if (this.group.activePanel !== panel) {
|
|
4113
|
+
this.group.model.openPanel(panel);
|
|
4114
|
+
}
|
|
3994
4115
|
}), tab.onDrop((event) => {
|
|
3995
4116
|
this._onDrop.fire({
|
|
3996
4117
|
event: event.nativeEvent,
|
|
3997
4118
|
index: this.tabs.findIndex((x) => x.value === tab),
|
|
3998
4119
|
});
|
|
4120
|
+
}), tab.onWillShowOverlay((event) => {
|
|
4121
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, { kind: 'tab' }));
|
|
3999
4122
|
}));
|
|
4000
4123
|
const value = { value: tab, disposable };
|
|
4001
4124
|
this.addTab(value, index);
|
|
@@ -4013,6 +4136,60 @@
|
|
|
4013
4136
|
}
|
|
4014
4137
|
}
|
|
4015
4138
|
|
|
4139
|
+
class DockviewDidDropEvent extends DockviewEvent {
|
|
4140
|
+
get nativeEvent() {
|
|
4141
|
+
return this.options.nativeEvent;
|
|
4142
|
+
}
|
|
4143
|
+
get position() {
|
|
4144
|
+
return this.options.position;
|
|
4145
|
+
}
|
|
4146
|
+
get panel() {
|
|
4147
|
+
return this.options.panel;
|
|
4148
|
+
}
|
|
4149
|
+
get group() {
|
|
4150
|
+
return this.options.group;
|
|
4151
|
+
}
|
|
4152
|
+
get api() {
|
|
4153
|
+
return this.options.api;
|
|
4154
|
+
}
|
|
4155
|
+
constructor(options) {
|
|
4156
|
+
super();
|
|
4157
|
+
this.options = options;
|
|
4158
|
+
}
|
|
4159
|
+
getData() {
|
|
4160
|
+
return this.options.getData();
|
|
4161
|
+
}
|
|
4162
|
+
}
|
|
4163
|
+
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4164
|
+
get kind() {
|
|
4165
|
+
return this._kind;
|
|
4166
|
+
}
|
|
4167
|
+
constructor(options) {
|
|
4168
|
+
super(options);
|
|
4169
|
+
this._kind = options.kind;
|
|
4170
|
+
}
|
|
4171
|
+
}
|
|
4172
|
+
class WillShowOverlayLocationEvent {
|
|
4173
|
+
get kind() {
|
|
4174
|
+
return this._kind;
|
|
4175
|
+
}
|
|
4176
|
+
get nativeEvent() {
|
|
4177
|
+
return this.event.nativeEvent;
|
|
4178
|
+
}
|
|
4179
|
+
get position() {
|
|
4180
|
+
return this.event.position;
|
|
4181
|
+
}
|
|
4182
|
+
get defaultPrevented() {
|
|
4183
|
+
return this.event.defaultPrevented;
|
|
4184
|
+
}
|
|
4185
|
+
preventDefault() {
|
|
4186
|
+
this.event.preventDefault();
|
|
4187
|
+
}
|
|
4188
|
+
constructor(event, options) {
|
|
4189
|
+
this.event = event;
|
|
4190
|
+
this._kind = options.kind;
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4016
4193
|
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
4017
4194
|
get element() {
|
|
4018
4195
|
throw new Error('not supported');
|
|
@@ -4058,7 +4235,7 @@
|
|
|
4058
4235
|
this._location = value;
|
|
4059
4236
|
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4060
4237
|
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4061
|
-
switch (value) {
|
|
4238
|
+
switch (value.type) {
|
|
4062
4239
|
case 'grid':
|
|
4063
4240
|
this.contentContainer.dropTarget.setTargetZones([
|
|
4064
4241
|
'top',
|
|
@@ -4094,7 +4271,7 @@
|
|
|
4094
4271
|
this.groupPanel = groupPanel;
|
|
4095
4272
|
this._isGroupActive = false;
|
|
4096
4273
|
this._locked = false;
|
|
4097
|
-
this._location = 'grid';
|
|
4274
|
+
this._location = { type: 'grid' };
|
|
4098
4275
|
this.mostRecentlyUsed = [];
|
|
4099
4276
|
this._onDidChange = new Emitter();
|
|
4100
4277
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -4105,6 +4282,10 @@
|
|
|
4105
4282
|
this.onMove = this._onMove.event;
|
|
4106
4283
|
this._onDidDrop = new Emitter();
|
|
4107
4284
|
this.onDidDrop = this._onDidDrop.event;
|
|
4285
|
+
this._onWillDrop = new Emitter();
|
|
4286
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
4287
|
+
this._onWillShowOverlay = new Emitter();
|
|
4288
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4108
4289
|
this._onTabDragStart = new Emitter();
|
|
4109
4290
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
4110
4291
|
this._onGroupDragStart = new Emitter();
|
|
@@ -4115,46 +4296,69 @@
|
|
|
4115
4296
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4116
4297
|
this._onDidActivePanelChange = new Emitter();
|
|
4117
4298
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4299
|
+
this._overwriteRenderContainer = null;
|
|
4118
4300
|
toggleClass(this.container, 'groupview', true);
|
|
4301
|
+
this._api = new DockviewApi(this.accessor);
|
|
4119
4302
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
4120
4303
|
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
4121
4304
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
4122
4305
|
this.header.hidden = !!options.hideHeader;
|
|
4123
4306
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
4124
|
-
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this.tabsContainer.onTabDragStart((event) => {
|
|
4307
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
4125
4308
|
this._onTabDragStart.fire(event);
|
|
4126
4309
|
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
4127
4310
|
this._onGroupDragStart.fire(event);
|
|
4128
4311
|
}), this.tabsContainer.onDrop((event) => {
|
|
4129
|
-
this.handleDropEvent(event.event, 'center', event.index);
|
|
4312
|
+
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
4130
4313
|
}), this.contentContainer.onDidFocus(() => {
|
|
4131
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4314
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4132
4315
|
}), this.contentContainer.onDidBlur(() => {
|
|
4133
4316
|
// noop
|
|
4134
4317
|
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
4135
|
-
this.handleDropEvent(event.nativeEvent, event.position);
|
|
4136
|
-
}), this.
|
|
4318
|
+
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
4319
|
+
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
4320
|
+
this._onWillShowOverlay.fire(event);
|
|
4321
|
+
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
4322
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4323
|
+
kind: 'content',
|
|
4324
|
+
}));
|
|
4325
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
4326
|
+
}
|
|
4327
|
+
focusContent() {
|
|
4328
|
+
this.contentContainer.element.focus();
|
|
4329
|
+
}
|
|
4330
|
+
set renderContainer(value) {
|
|
4331
|
+
this.panels.forEach((panel) => {
|
|
4332
|
+
this.renderContainer.detatch(panel);
|
|
4333
|
+
});
|
|
4334
|
+
this._overwriteRenderContainer = value;
|
|
4335
|
+
this.panels.forEach((panel) => {
|
|
4336
|
+
this.rerender(panel);
|
|
4337
|
+
});
|
|
4338
|
+
}
|
|
4339
|
+
get renderContainer() {
|
|
4340
|
+
var _a;
|
|
4341
|
+
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
4137
4342
|
}
|
|
4138
4343
|
initialize() {
|
|
4139
|
-
|
|
4140
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
|
|
4344
|
+
if (this.options.panels) {
|
|
4141
4345
|
this.options.panels.forEach((panel) => {
|
|
4142
4346
|
this.doAddPanel(panel);
|
|
4143
4347
|
});
|
|
4144
4348
|
}
|
|
4145
|
-
if (
|
|
4349
|
+
if (this.options.activePanel) {
|
|
4146
4350
|
this.openPanel(this.options.activePanel);
|
|
4147
4351
|
}
|
|
4148
4352
|
// must be run after the constructor otherwise this.parent may not be
|
|
4149
4353
|
// correctly initialized
|
|
4150
|
-
this.setActive(this.isActive, true
|
|
4354
|
+
this.setActive(this.isActive, true);
|
|
4151
4355
|
this.updateContainer();
|
|
4152
4356
|
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
4153
4357
|
this._rightHeaderActions =
|
|
4154
4358
|
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
4155
4359
|
this.addDisposables(this._rightHeaderActions);
|
|
4156
4360
|
this._rightHeaderActions.init({
|
|
4157
|
-
containerApi:
|
|
4361
|
+
containerApi: this._api,
|
|
4158
4362
|
api: this.groupPanel.api,
|
|
4159
4363
|
});
|
|
4160
4364
|
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
@@ -4164,7 +4368,7 @@
|
|
|
4164
4368
|
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
4165
4369
|
this.addDisposables(this._leftHeaderActions);
|
|
4166
4370
|
this._leftHeaderActions.init({
|
|
4167
|
-
containerApi:
|
|
4371
|
+
containerApi: this._api,
|
|
4168
4372
|
api: this.groupPanel.api,
|
|
4169
4373
|
});
|
|
4170
4374
|
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
@@ -4174,7 +4378,7 @@
|
|
|
4174
4378
|
this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
|
|
4175
4379
|
this.addDisposables(this._prefixHeaderActions);
|
|
4176
4380
|
this._prefixHeaderActions.init({
|
|
4177
|
-
containerApi:
|
|
4381
|
+
containerApi: this._api,
|
|
4178
4382
|
api: this.groupPanel.api,
|
|
4179
4383
|
});
|
|
4180
4384
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
@@ -4254,35 +4458,45 @@
|
|
|
4254
4458
|
//noop
|
|
4255
4459
|
}
|
|
4256
4460
|
focus() {
|
|
4257
|
-
var _a
|
|
4258
|
-
(
|
|
4461
|
+
var _a;
|
|
4462
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4259
4463
|
}
|
|
4260
4464
|
openPanel(panel, options = {}) {
|
|
4465
|
+
/**
|
|
4466
|
+
* set the panel group
|
|
4467
|
+
* add the panel
|
|
4468
|
+
* check if group active
|
|
4469
|
+
* check if panel active
|
|
4470
|
+
*/
|
|
4261
4471
|
if (typeof options.index !== 'number' ||
|
|
4262
4472
|
options.index > this.panels.length) {
|
|
4263
4473
|
options.index = this.panels.length;
|
|
4264
4474
|
}
|
|
4265
|
-
const
|
|
4266
|
-
const skipSetGroupActive = !!options.skipSetGroupActive;
|
|
4475
|
+
const skipSetActive = !!options.skipSetActive;
|
|
4267
4476
|
// ensure the group is updated before we fire any events
|
|
4268
|
-
panel.updateParentGroup(this.groupPanel,
|
|
4477
|
+
panel.updateParentGroup(this.groupPanel, {
|
|
4478
|
+
skipSetActive: options.skipSetActive,
|
|
4479
|
+
});
|
|
4480
|
+
this.doAddPanel(panel, options.index, {
|
|
4481
|
+
skipSetActive: skipSetActive,
|
|
4482
|
+
});
|
|
4269
4483
|
if (this._activePanel === panel) {
|
|
4270
|
-
if (!skipSetGroupActive) {
|
|
4271
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4272
|
-
}
|
|
4273
4484
|
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
4274
4485
|
return;
|
|
4275
4486
|
}
|
|
4276
|
-
|
|
4277
|
-
if (!skipSetPanelActive) {
|
|
4487
|
+
if (!skipSetActive) {
|
|
4278
4488
|
this.doSetActivePanel(panel);
|
|
4279
4489
|
}
|
|
4280
|
-
if (!skipSetGroupActive) {
|
|
4281
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4490
|
+
if (!options.skipSetGroupActive) {
|
|
4491
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4492
|
+
}
|
|
4493
|
+
if (!options.skipSetActive) {
|
|
4494
|
+
this.updateContainer();
|
|
4282
4495
|
}
|
|
4283
|
-
this.updateContainer();
|
|
4284
4496
|
}
|
|
4285
|
-
removePanel(groupItemOrId
|
|
4497
|
+
removePanel(groupItemOrId, options = {
|
|
4498
|
+
skipSetActive: false,
|
|
4499
|
+
}) {
|
|
4286
4500
|
const id = typeof groupItemOrId === 'string'
|
|
4287
4501
|
? groupItemOrId
|
|
4288
4502
|
: groupItemOrId.id;
|
|
@@ -4290,7 +4504,7 @@
|
|
|
4290
4504
|
if (!panelToRemove) {
|
|
4291
4505
|
throw new Error('invalid operation');
|
|
4292
4506
|
}
|
|
4293
|
-
return this._removePanel(panelToRemove);
|
|
4507
|
+
return this._removePanel(panelToRemove, options);
|
|
4294
4508
|
}
|
|
4295
4509
|
closeAllPanels() {
|
|
4296
4510
|
if (this.panels.length > 0) {
|
|
@@ -4316,12 +4530,8 @@
|
|
|
4316
4530
|
updateActions(element) {
|
|
4317
4531
|
this.tabsContainer.setRightActionsElement(element);
|
|
4318
4532
|
}
|
|
4319
|
-
setActive(isGroupActive,
|
|
4320
|
-
var _a, _b, _c, _d;
|
|
4533
|
+
setActive(isGroupActive, force = false) {
|
|
4321
4534
|
if (!force && this.isActive === isGroupActive) {
|
|
4322
|
-
if (!skipFocus) {
|
|
4323
|
-
(_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4324
|
-
}
|
|
4325
4535
|
return;
|
|
4326
4536
|
}
|
|
4327
4537
|
this._isGroupActive = isGroupActive;
|
|
@@ -4332,11 +4542,6 @@
|
|
|
4332
4542
|
this.doSetActivePanel(this.panels[0]);
|
|
4333
4543
|
}
|
|
4334
4544
|
this.updateContainer();
|
|
4335
|
-
if (isGroupActive) {
|
|
4336
|
-
if (!skipFocus) {
|
|
4337
|
-
(_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
4338
|
-
}
|
|
4339
|
-
}
|
|
4340
4545
|
}
|
|
4341
4546
|
layout(width, height) {
|
|
4342
4547
|
var _a;
|
|
@@ -4347,17 +4552,22 @@
|
|
|
4347
4552
|
this._activePanel.layout(this._width, this._height);
|
|
4348
4553
|
}
|
|
4349
4554
|
}
|
|
4350
|
-
_removePanel(panel) {
|
|
4555
|
+
_removePanel(panel, options) {
|
|
4351
4556
|
const isActivePanel = this._activePanel === panel;
|
|
4352
4557
|
this.doRemovePanel(panel);
|
|
4353
4558
|
if (isActivePanel && this.panels.length > 0) {
|
|
4354
4559
|
const nextPanel = this.mostRecentlyUsed[0];
|
|
4355
|
-
this.openPanel(nextPanel
|
|
4560
|
+
this.openPanel(nextPanel, {
|
|
4561
|
+
skipSetActive: options.skipSetActive,
|
|
4562
|
+
skipSetGroupActive: options.skipSetActiveGroup,
|
|
4563
|
+
});
|
|
4356
4564
|
}
|
|
4357
4565
|
if (this._activePanel && this.panels.length === 0) {
|
|
4358
4566
|
this.doSetActivePanel(undefined);
|
|
4359
4567
|
}
|
|
4360
|
-
|
|
4568
|
+
if (!options.skipSetActive) {
|
|
4569
|
+
this.updateContainer();
|
|
4570
|
+
}
|
|
4361
4571
|
return panel;
|
|
4362
4572
|
}
|
|
4363
4573
|
doRemovePanel(panel) {
|
|
@@ -4372,13 +4582,13 @@
|
|
|
4372
4582
|
}
|
|
4373
4583
|
this._onDidRemovePanel.fire({ panel });
|
|
4374
4584
|
}
|
|
4375
|
-
doAddPanel(panel, index = this.panels.length,
|
|
4585
|
+
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
4376
4586
|
const existingPanel = this._panels.indexOf(panel);
|
|
4377
4587
|
const hasExistingPanel = existingPanel > -1;
|
|
4378
4588
|
this.tabsContainer.show();
|
|
4379
4589
|
this.contentContainer.show();
|
|
4380
4590
|
this.tabsContainer.openPanel(panel, index);
|
|
4381
|
-
if (!skipSetActive) {
|
|
4591
|
+
if (!options.skipSetActive) {
|
|
4382
4592
|
this.contentContainer.openPanel(panel);
|
|
4383
4593
|
}
|
|
4384
4594
|
if (hasExistingPanel) {
|
|
@@ -4390,12 +4600,17 @@
|
|
|
4390
4600
|
this._onDidAddPanel.fire({ panel });
|
|
4391
4601
|
}
|
|
4392
4602
|
doSetActivePanel(panel) {
|
|
4603
|
+
if (this._activePanel === panel) {
|
|
4604
|
+
return;
|
|
4605
|
+
}
|
|
4393
4606
|
this._activePanel = panel;
|
|
4394
4607
|
if (panel) {
|
|
4395
4608
|
this.tabsContainer.setActivePanel(panel);
|
|
4396
4609
|
panel.layout(this._width, this._height);
|
|
4397
4610
|
this.updateMru(panel);
|
|
4398
|
-
this._onDidActivePanelChange.fire({
|
|
4611
|
+
this._onDidActivePanelChange.fire({
|
|
4612
|
+
panel,
|
|
4613
|
+
});
|
|
4399
4614
|
}
|
|
4400
4615
|
}
|
|
4401
4616
|
updateMru(panel) {
|
|
@@ -4407,11 +4622,11 @@
|
|
|
4407
4622
|
updateContainer() {
|
|
4408
4623
|
var _a, _b;
|
|
4409
4624
|
toggleClass(this.container, 'empty', this.isEmpty);
|
|
4410
|
-
this.panels.forEach((panel) => panel.
|
|
4625
|
+
this.panels.forEach((panel) => panel.runEvents());
|
|
4411
4626
|
if (this.isEmpty && !this.watermark) {
|
|
4412
4627
|
const watermark = this.accessor.createWatermarkComponent();
|
|
4413
4628
|
watermark.init({
|
|
4414
|
-
containerApi:
|
|
4629
|
+
containerApi: this._api,
|
|
4415
4630
|
group: this.groupPanel,
|
|
4416
4631
|
});
|
|
4417
4632
|
this.watermark = watermark;
|
|
@@ -4444,10 +4659,32 @@
|
|
|
4444
4659
|
}
|
|
4445
4660
|
return false;
|
|
4446
4661
|
}
|
|
4447
|
-
handleDropEvent(event, position, index) {
|
|
4662
|
+
handleDropEvent(type, event, position, index) {
|
|
4448
4663
|
if (this.locked === 'no-drop-target') {
|
|
4449
4664
|
return;
|
|
4450
4665
|
}
|
|
4666
|
+
function getKind() {
|
|
4667
|
+
switch (type) {
|
|
4668
|
+
case 'header':
|
|
4669
|
+
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
4670
|
+
case 'content':
|
|
4671
|
+
return 'content';
|
|
4672
|
+
}
|
|
4673
|
+
}
|
|
4674
|
+
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
4675
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
4676
|
+
nativeEvent: event,
|
|
4677
|
+
position,
|
|
4678
|
+
panel,
|
|
4679
|
+
getData: () => getPanelData(),
|
|
4680
|
+
kind: getKind(),
|
|
4681
|
+
group: this.groupPanel,
|
|
4682
|
+
api: this._api,
|
|
4683
|
+
});
|
|
4684
|
+
this._onWillDrop.fire(willDropEvent);
|
|
4685
|
+
if (willDropEvent.defaultPrevented) {
|
|
4686
|
+
return;
|
|
4687
|
+
}
|
|
4451
4688
|
const data = getPanelData();
|
|
4452
4689
|
if (data && data.viewId === this.accessor.id) {
|
|
4453
4690
|
if (data.panelId === null) {
|
|
@@ -4480,12 +4717,14 @@
|
|
|
4480
4717
|
});
|
|
4481
4718
|
}
|
|
4482
4719
|
else {
|
|
4483
|
-
this._onDidDrop.fire({
|
|
4720
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
4484
4721
|
nativeEvent: event,
|
|
4485
4722
|
position,
|
|
4486
|
-
|
|
4723
|
+
panel,
|
|
4487
4724
|
getData: () => getPanelData(),
|
|
4488
|
-
|
|
4725
|
+
group: this.groupPanel,
|
|
4726
|
+
api: this._api,
|
|
4727
|
+
}));
|
|
4489
4728
|
}
|
|
4490
4729
|
}
|
|
4491
4730
|
dispose() {
|
|
@@ -4493,6 +4732,7 @@
|
|
|
4493
4732
|
super.dispose();
|
|
4494
4733
|
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
4495
4734
|
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4735
|
+
this.watermark = undefined;
|
|
4496
4736
|
for (const panel of this.panels) {
|
|
4497
4737
|
panel.dispose();
|
|
4498
4738
|
}
|
|
@@ -4514,15 +4754,7 @@
|
|
|
4514
4754
|
constructor(parentElement, disableResizing = false) {
|
|
4515
4755
|
super();
|
|
4516
4756
|
this._disableResizing = disableResizing;
|
|
4517
|
-
|
|
4518
|
-
this._element = parentElement;
|
|
4519
|
-
}
|
|
4520
|
-
else {
|
|
4521
|
-
this._element = document.createElement('div');
|
|
4522
|
-
this._element.style.height = '100%';
|
|
4523
|
-
this._element.style.width = '100%';
|
|
4524
|
-
this._element.className = 'dv-resizable-container';
|
|
4525
|
-
}
|
|
4757
|
+
this._element = parentElement;
|
|
4526
4758
|
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
4527
4759
|
if (this.isDisposed) {
|
|
4528
4760
|
/**
|
|
@@ -4610,25 +4842,38 @@
|
|
|
4610
4842
|
get activeGroup() {
|
|
4611
4843
|
return this._activeGroup;
|
|
4612
4844
|
}
|
|
4845
|
+
get locked() {
|
|
4846
|
+
return this.gridview.locked;
|
|
4847
|
+
}
|
|
4848
|
+
set locked(value) {
|
|
4849
|
+
this.gridview.locked = value;
|
|
4850
|
+
}
|
|
4613
4851
|
constructor(options) {
|
|
4614
|
-
super(
|
|
4852
|
+
super(document.createElement('div'), options.disableAutoResizing);
|
|
4615
4853
|
this._id = nextLayoutId$1.next();
|
|
4616
4854
|
this._groups = new Map();
|
|
4617
4855
|
this._onDidLayoutChange = new Emitter();
|
|
4618
4856
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
4619
|
-
this.
|
|
4620
|
-
this.
|
|
4621
|
-
this.
|
|
4622
|
-
this.
|
|
4623
|
-
this.
|
|
4624
|
-
this.
|
|
4857
|
+
this._onDidRemove = new Emitter();
|
|
4858
|
+
this.onDidRemove = this._onDidRemove.event;
|
|
4859
|
+
this._onDidAdd = new Emitter();
|
|
4860
|
+
this.onDidAdd = this._onDidAdd.event;
|
|
4861
|
+
this._onDidActiveChange = new Emitter();
|
|
4862
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4625
4863
|
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
4864
|
+
this.element.style.height = '100%';
|
|
4865
|
+
this.element.style.width = '100%';
|
|
4866
|
+
options.parentElement.appendChild(this.element);
|
|
4626
4867
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
4868
|
+
this.gridview.locked = !!options.locked;
|
|
4627
4869
|
this.element.appendChild(this.gridview.element);
|
|
4628
4870
|
this.layout(0, 0, true); // set some elements height/widths
|
|
4629
|
-
this.addDisposables(
|
|
4871
|
+
this.addDisposables(Disposable.from(() => {
|
|
4872
|
+
var _a;
|
|
4873
|
+
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
4874
|
+
}), this.gridview.onDidChange(() => {
|
|
4630
4875
|
this._bufferOnDidLayoutChange.fire();
|
|
4631
|
-
}), exports.DockviewEvent.any(this.
|
|
4876
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
4632
4877
|
this._bufferOnDidLayoutChange.fire();
|
|
4633
4878
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
4634
4879
|
this._onDidLayoutChange.fire();
|
|
@@ -4643,6 +4888,7 @@
|
|
|
4643
4888
|
}
|
|
4644
4889
|
maximizeGroup(panel) {
|
|
4645
4890
|
this.gridview.maximizeView(panel);
|
|
4891
|
+
this.doSetGroupActive(panel);
|
|
4646
4892
|
}
|
|
4647
4893
|
isMaximizedGroup(panel) {
|
|
4648
4894
|
return this.gridview.maximizedView() === panel;
|
|
@@ -4653,13 +4899,12 @@
|
|
|
4653
4899
|
hasMaximizedGroup() {
|
|
4654
4900
|
return this.gridview.hasMaximizedView();
|
|
4655
4901
|
}
|
|
4656
|
-
get
|
|
4657
|
-
return this.gridview.
|
|
4902
|
+
get onDidMaximizedGroupChange() {
|
|
4903
|
+
return this.gridview.onDidMaximizedNodeChange;
|
|
4658
4904
|
}
|
|
4659
4905
|
doAddGroup(group, location = [0], size) {
|
|
4660
4906
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
4661
|
-
this.
|
|
4662
|
-
this.doSetGroupActive(group);
|
|
4907
|
+
this._onDidAdd.fire(group);
|
|
4663
4908
|
}
|
|
4664
4909
|
doRemoveGroup(group, options) {
|
|
4665
4910
|
if (!this._groups.has(group.id)) {
|
|
@@ -4671,8 +4916,8 @@
|
|
|
4671
4916
|
item.disposable.dispose();
|
|
4672
4917
|
item.value.dispose();
|
|
4673
4918
|
this._groups.delete(group.id);
|
|
4919
|
+
this._onDidRemove.fire(group);
|
|
4674
4920
|
}
|
|
4675
|
-
this._onDidRemoveGroup.fire(group);
|
|
4676
4921
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
4677
4922
|
const groups = Array.from(this._groups.values());
|
|
4678
4923
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -4683,25 +4928,18 @@
|
|
|
4683
4928
|
var _a;
|
|
4684
4929
|
return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4685
4930
|
}
|
|
4686
|
-
doSetGroupActive(group
|
|
4687
|
-
var _a, _b, _c;
|
|
4931
|
+
doSetGroupActive(group) {
|
|
4688
4932
|
if (this._activeGroup === group) {
|
|
4689
4933
|
return;
|
|
4690
4934
|
}
|
|
4691
4935
|
if (this._activeGroup) {
|
|
4692
4936
|
this._activeGroup.setActive(false);
|
|
4693
|
-
if (!skipFocus) {
|
|
4694
|
-
(_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4695
|
-
}
|
|
4696
4937
|
}
|
|
4697
4938
|
if (group) {
|
|
4698
4939
|
group.setActive(true);
|
|
4699
|
-
if (!skipFocus) {
|
|
4700
|
-
(_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
|
|
4701
|
-
}
|
|
4702
4940
|
}
|
|
4703
4941
|
this._activeGroup = group;
|
|
4704
|
-
this.
|
|
4942
|
+
this._onDidActiveChange.fire(group);
|
|
4705
4943
|
}
|
|
4706
4944
|
removeGroup(group) {
|
|
4707
4945
|
this.doRemoveGroup(group);
|
|
@@ -4746,9 +4984,9 @@
|
|
|
4746
4984
|
this.gridview.layout(width, height);
|
|
4747
4985
|
}
|
|
4748
4986
|
dispose() {
|
|
4749
|
-
this.
|
|
4750
|
-
this.
|
|
4751
|
-
this.
|
|
4987
|
+
this._onDidActiveChange.dispose();
|
|
4988
|
+
this._onDidAdd.dispose();
|
|
4989
|
+
this._onDidRemove.dispose();
|
|
4752
4990
|
this._onDidLayoutChange.dispose();
|
|
4753
4991
|
for (const group of this.groups) {
|
|
4754
4992
|
group.dispose();
|
|
@@ -4758,11 +4996,15 @@
|
|
|
4758
4996
|
}
|
|
4759
4997
|
}
|
|
4760
4998
|
|
|
4999
|
+
class WillFocusEvent extends DockviewEvent {
|
|
5000
|
+
constructor() {
|
|
5001
|
+
super();
|
|
5002
|
+
}
|
|
5003
|
+
}
|
|
4761
5004
|
/**
|
|
4762
5005
|
* A core api implementation that should be used across all panel-like objects
|
|
4763
5006
|
*/
|
|
4764
5007
|
class PanelApiImpl extends CompositeDisposable {
|
|
4765
|
-
//
|
|
4766
5008
|
get isFocused() {
|
|
4767
5009
|
return this._isFocused;
|
|
4768
5010
|
}
|
|
@@ -4772,6 +5014,9 @@
|
|
|
4772
5014
|
get isVisible() {
|
|
4773
5015
|
return this._isVisible;
|
|
4774
5016
|
}
|
|
5017
|
+
get isHidden() {
|
|
5018
|
+
return this._isHidden;
|
|
5019
|
+
}
|
|
4775
5020
|
get width() {
|
|
4776
5021
|
return this._width;
|
|
4777
5022
|
}
|
|
@@ -4784,38 +5029,26 @@
|
|
|
4784
5029
|
this._isFocused = false;
|
|
4785
5030
|
this._isActive = false;
|
|
4786
5031
|
this._isVisible = true;
|
|
5032
|
+
this._isHidden = false;
|
|
4787
5033
|
this._width = 0;
|
|
4788
5034
|
this._height = 0;
|
|
4789
5035
|
this.panelUpdatesDisposable = new MutableDisposable();
|
|
4790
|
-
this._onDidDimensionChange = new Emitter(
|
|
4791
|
-
replay: true,
|
|
4792
|
-
});
|
|
5036
|
+
this._onDidDimensionChange = new Emitter();
|
|
4793
5037
|
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
4794
|
-
|
|
4795
|
-
this._onDidChangeFocus = new Emitter({
|
|
4796
|
-
replay: true,
|
|
4797
|
-
});
|
|
5038
|
+
this._onDidChangeFocus = new Emitter();
|
|
4798
5039
|
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
4799
5040
|
//
|
|
4800
|
-
this.
|
|
4801
|
-
this.
|
|
5041
|
+
this._onWillFocus = new Emitter();
|
|
5042
|
+
this.onWillFocus = this._onWillFocus.event;
|
|
4802
5043
|
//
|
|
4803
|
-
this._onDidVisibilityChange = new Emitter(
|
|
4804
|
-
replay: true,
|
|
4805
|
-
});
|
|
5044
|
+
this._onDidVisibilityChange = new Emitter();
|
|
4806
5045
|
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
4807
|
-
|
|
4808
|
-
this.
|
|
4809
|
-
this.
|
|
4810
|
-
//
|
|
4811
|
-
this._onDidActiveChange = new Emitter({
|
|
4812
|
-
replay: true,
|
|
4813
|
-
});
|
|
5046
|
+
this._onDidHiddenChange = new Emitter();
|
|
5047
|
+
this.onDidHiddenChange = this._onDidHiddenChange.event;
|
|
5048
|
+
this._onDidActiveChange = new Emitter();
|
|
4814
5049
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4815
|
-
//
|
|
4816
5050
|
this._onActiveChange = new Emitter();
|
|
4817
5051
|
this.onActiveChange = this._onActiveChange.event;
|
|
4818
|
-
//
|
|
4819
5052
|
this._onUpdateParameters = new Emitter();
|
|
4820
5053
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
4821
5054
|
this.addDisposables(this.onDidFocusChange((event) => {
|
|
@@ -4824,10 +5057,12 @@
|
|
|
4824
5057
|
this._isActive = event.isActive;
|
|
4825
5058
|
}), this.onDidVisibilityChange((event) => {
|
|
4826
5059
|
this._isVisible = event.isVisible;
|
|
5060
|
+
}), this.onDidHiddenChange((event) => {
|
|
5061
|
+
this._isHidden = event.isHidden;
|
|
4827
5062
|
}), this.onDidDimensionsChange((event) => {
|
|
4828
5063
|
this._width = event.width;
|
|
4829
5064
|
this._height = event.height;
|
|
4830
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this.
|
|
5065
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onDidHiddenChange, this._onUpdateParameters);
|
|
4831
5066
|
}
|
|
4832
5067
|
initialize(panel) {
|
|
4833
5068
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
@@ -4836,8 +5071,8 @@
|
|
|
4836
5071
|
});
|
|
4837
5072
|
});
|
|
4838
5073
|
}
|
|
4839
|
-
|
|
4840
|
-
this.
|
|
5074
|
+
setHidden(isHidden) {
|
|
5075
|
+
this._onDidHiddenChange.fire({ isHidden });
|
|
4841
5076
|
}
|
|
4842
5077
|
setActive() {
|
|
4843
5078
|
this._onActiveChange.fire();
|
|
@@ -4845,9 +5080,6 @@
|
|
|
4845
5080
|
updateParameters(parameters) {
|
|
4846
5081
|
this._onUpdateParameters.fire(parameters);
|
|
4847
5082
|
}
|
|
4848
|
-
dispose() {
|
|
4849
|
-
super.dispose();
|
|
4850
|
-
}
|
|
4851
5083
|
}
|
|
4852
5084
|
|
|
4853
5085
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
@@ -4935,7 +5167,12 @@
|
|
|
4935
5167
|
}), focusTracker);
|
|
4936
5168
|
}
|
|
4937
5169
|
focus() {
|
|
4938
|
-
|
|
5170
|
+
const event = new WillFocusEvent();
|
|
5171
|
+
this.api._onWillFocus.fire(event);
|
|
5172
|
+
if (event.defaultPrevented) {
|
|
5173
|
+
return;
|
|
5174
|
+
}
|
|
5175
|
+
this._element.focus();
|
|
4939
5176
|
}
|
|
4940
5177
|
layout(width, height) {
|
|
4941
5178
|
this._width = width;
|
|
@@ -5264,9 +5501,7 @@
|
|
|
5264
5501
|
super(id);
|
|
5265
5502
|
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5266
5503
|
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5267
|
-
this._onDidConstraintsChange = new Emitter(
|
|
5268
|
-
replay: true,
|
|
5269
|
-
});
|
|
5504
|
+
this._onDidConstraintsChange = new Emitter();
|
|
5270
5505
|
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
5271
5506
|
this._onDidSizeChange = new Emitter();
|
|
5272
5507
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
@@ -5359,13 +5594,13 @@
|
|
|
5359
5594
|
this._maximumHeight = options.maximumHeight;
|
|
5360
5595
|
}
|
|
5361
5596
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
5362
|
-
this.addDisposables(this.api.
|
|
5363
|
-
const {
|
|
5597
|
+
this.addDisposables(this.api.onDidHiddenChange((event) => {
|
|
5598
|
+
const { isHidden } = event;
|
|
5364
5599
|
const { accessor } = this._params;
|
|
5365
|
-
accessor.setVisible(this,
|
|
5600
|
+
accessor.setVisible(this, !isHidden);
|
|
5366
5601
|
}), this.api.onActiveChange(() => {
|
|
5367
5602
|
const { accessor } = this._params;
|
|
5368
|
-
accessor.
|
|
5603
|
+
accessor.doSetGroupActive(this);
|
|
5369
5604
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
5370
5605
|
if (typeof event.minimumWidth === 'number' ||
|
|
5371
5606
|
typeof event.minimumWidth === 'function') {
|
|
@@ -5448,6 +5683,17 @@
|
|
|
5448
5683
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5449
5684
|
this.addDisposables(this._onDidLocationChange);
|
|
5450
5685
|
}
|
|
5686
|
+
close() {
|
|
5687
|
+
if (!this._group) {
|
|
5688
|
+
return;
|
|
5689
|
+
}
|
|
5690
|
+
return this.accessor.removeGroup(this._group);
|
|
5691
|
+
}
|
|
5692
|
+
getWindow() {
|
|
5693
|
+
return this.location.type === 'popout'
|
|
5694
|
+
? this.location.getWindow()
|
|
5695
|
+
: window;
|
|
5696
|
+
}
|
|
5451
5697
|
moveTo(options) {
|
|
5452
5698
|
var _a, _b, _c;
|
|
5453
5699
|
if (!this._group) {
|
|
@@ -5455,14 +5701,23 @@
|
|
|
5455
5701
|
}
|
|
5456
5702
|
const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
|
|
5457
5703
|
direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
|
|
5704
|
+
skipSetActive: true,
|
|
5705
|
+
});
|
|
5706
|
+
this.accessor.moveGroupOrPanel({
|
|
5707
|
+
from: { groupId: this._group.id },
|
|
5708
|
+
to: {
|
|
5709
|
+
group,
|
|
5710
|
+
position: options.group
|
|
5711
|
+
? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
|
|
5712
|
+
: 'center',
|
|
5713
|
+
},
|
|
5458
5714
|
});
|
|
5459
|
-
this.accessor.moveGroupOrPanel(group, this._group.id, undefined, options.group ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center' : 'center');
|
|
5460
5715
|
}
|
|
5461
5716
|
maximize() {
|
|
5462
5717
|
if (!this._group) {
|
|
5463
5718
|
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5464
5719
|
}
|
|
5465
|
-
if (this.location !== 'grid') {
|
|
5720
|
+
if (this.location.type !== 'grid') {
|
|
5466
5721
|
// only grid groups can be maximized
|
|
5467
5722
|
return;
|
|
5468
5723
|
}
|
|
@@ -5519,6 +5774,12 @@
|
|
|
5519
5774
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
5520
5775
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
5521
5776
|
}
|
|
5777
|
+
focus() {
|
|
5778
|
+
if (!this.api.isActive) {
|
|
5779
|
+
this.api.setActive();
|
|
5780
|
+
}
|
|
5781
|
+
super.focus();
|
|
5782
|
+
}
|
|
5522
5783
|
initialize() {
|
|
5523
5784
|
this._model.initialize();
|
|
5524
5785
|
}
|
|
@@ -5564,6 +5825,9 @@
|
|
|
5564
5825
|
}
|
|
5565
5826
|
|
|
5566
5827
|
class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
5828
|
+
get location() {
|
|
5829
|
+
return this.group.api.location;
|
|
5830
|
+
}
|
|
5567
5831
|
get title() {
|
|
5568
5832
|
return this.panel.title;
|
|
5569
5833
|
}
|
|
@@ -5575,15 +5839,34 @@
|
|
|
5575
5839
|
}
|
|
5576
5840
|
set group(value) {
|
|
5577
5841
|
const isOldGroupActive = this.isGroupActive;
|
|
5578
|
-
this._group
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5842
|
+
if (this._group !== value) {
|
|
5843
|
+
this._group = value;
|
|
5844
|
+
this._onDidGroupChange.fire({});
|
|
5845
|
+
let _trackGroupActive = isOldGroupActive; // prevent duplicate events with same state
|
|
5846
|
+
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidLocationChange((event) => {
|
|
5847
|
+
if (this.group !== this.panel.group) {
|
|
5848
|
+
return;
|
|
5849
|
+
}
|
|
5850
|
+
this._onDidLocationChange.fire(event);
|
|
5851
|
+
}), this.group.api.onDidActiveChange(() => {
|
|
5852
|
+
if (this.group !== this.panel.group) {
|
|
5853
|
+
return;
|
|
5854
|
+
}
|
|
5855
|
+
if (_trackGroupActive !== this.isGroupActive) {
|
|
5856
|
+
_trackGroupActive = this.isGroupActive;
|
|
5857
|
+
this._onDidActiveGroupChange.fire({
|
|
5858
|
+
isActive: this.isGroupActive,
|
|
5859
|
+
});
|
|
5860
|
+
}
|
|
5861
|
+
}));
|
|
5862
|
+
// if (this.isGroupActive !== isOldGroupActive) {
|
|
5863
|
+
// this._onDidActiveGroupChange.fire({
|
|
5864
|
+
// isActive: this.isGroupActive,
|
|
5865
|
+
// });
|
|
5866
|
+
// }
|
|
5867
|
+
this._onDidLocationChange.fire({
|
|
5868
|
+
location: this.group.api.location,
|
|
5583
5869
|
});
|
|
5584
|
-
if (this.isGroupActive !== isOldGroupActive) {
|
|
5585
|
-
this._onDidActiveGroupChange.fire();
|
|
5586
|
-
}
|
|
5587
5870
|
}
|
|
5588
5871
|
}
|
|
5589
5872
|
get group() {
|
|
@@ -5601,14 +5884,26 @@
|
|
|
5601
5884
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
5602
5885
|
this._onDidRendererChange = new Emitter();
|
|
5603
5886
|
this.onDidRendererChange = this._onDidRendererChange.event;
|
|
5604
|
-
this.
|
|
5887
|
+
this._onDidLocationChange = new Emitter();
|
|
5888
|
+
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5889
|
+
this.groupEventsDisposable = new MutableDisposable();
|
|
5605
5890
|
this.initialize(panel);
|
|
5606
5891
|
this._group = group;
|
|
5607
|
-
this.addDisposables(this.
|
|
5892
|
+
this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
|
|
5893
|
+
}
|
|
5894
|
+
getWindow() {
|
|
5895
|
+
return this.group.api.getWindow();
|
|
5608
5896
|
}
|
|
5609
5897
|
moveTo(options) {
|
|
5610
5898
|
var _a;
|
|
5611
|
-
this.accessor.moveGroupOrPanel(
|
|
5899
|
+
this.accessor.moveGroupOrPanel({
|
|
5900
|
+
from: { groupId: this._group.id, panelId: this.panel.id },
|
|
5901
|
+
to: {
|
|
5902
|
+
group: options.group,
|
|
5903
|
+
position: (_a = options.position) !== null && _a !== void 0 ? _a : 'center',
|
|
5904
|
+
index: options.index,
|
|
5905
|
+
},
|
|
5906
|
+
});
|
|
5612
5907
|
}
|
|
5613
5908
|
setTitle(title) {
|
|
5614
5909
|
this.panel.setTitle(title);
|
|
@@ -5669,7 +5964,14 @@
|
|
|
5669
5964
|
this.setTitle(params.title);
|
|
5670
5965
|
}
|
|
5671
5966
|
focus() {
|
|
5672
|
-
|
|
5967
|
+
const event = new WillFocusEvent();
|
|
5968
|
+
this.api._onWillFocus.fire(event);
|
|
5969
|
+
if (event.defaultPrevented) {
|
|
5970
|
+
return;
|
|
5971
|
+
}
|
|
5972
|
+
if (!this.api.isActive) {
|
|
5973
|
+
this.api.setActive();
|
|
5974
|
+
}
|
|
5673
5975
|
}
|
|
5674
5976
|
toJSON() {
|
|
5675
5977
|
return {
|
|
@@ -5726,20 +6028,40 @@
|
|
|
5726
6028
|
},
|
|
5727
6029
|
});
|
|
5728
6030
|
}
|
|
5729
|
-
updateParentGroup(group,
|
|
6031
|
+
updateParentGroup(group, options) {
|
|
5730
6032
|
this._group = group;
|
|
5731
|
-
this.api.group =
|
|
6033
|
+
this.api.group = this._group;
|
|
5732
6034
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
5733
|
-
this.api.
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
6035
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6036
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetActive)) {
|
|
6037
|
+
if (this.api.isActive !== isActive) {
|
|
6038
|
+
this.api._onDidActiveChange.fire({
|
|
6039
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6040
|
+
});
|
|
6041
|
+
}
|
|
6042
|
+
}
|
|
6043
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6044
|
+
this.api._onDidVisibilityChange.fire({
|
|
6045
|
+
isVisible: isPanelVisible,
|
|
6046
|
+
});
|
|
6047
|
+
}
|
|
6048
|
+
}
|
|
6049
|
+
runEvents() {
|
|
6050
|
+
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
6051
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6052
|
+
if (this.api.isActive !== isActive) {
|
|
6053
|
+
this.api._onDidActiveChange.fire({
|
|
6054
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6055
|
+
});
|
|
6056
|
+
}
|
|
6057
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6058
|
+
this.api._onDidVisibilityChange.fire({
|
|
6059
|
+
isVisible: isPanelVisible,
|
|
6060
|
+
});
|
|
6061
|
+
}
|
|
5740
6062
|
}
|
|
5741
6063
|
layout(width, height) {
|
|
5742
|
-
//
|
|
6064
|
+
// TODO: Can we somehow do height without header height or indicate what the header height is?
|
|
5743
6065
|
this.api._onDidDimensionChange.fire({
|
|
5744
6066
|
width,
|
|
5745
6067
|
height: height,
|
|
@@ -5861,8 +6183,6 @@
|
|
|
5861
6183
|
this.id = id;
|
|
5862
6184
|
this.contentComponent = contentComponent;
|
|
5863
6185
|
this.tabComponent = tabComponent;
|
|
5864
|
-
this._group = null;
|
|
5865
|
-
this._isPanelVisible = null;
|
|
5866
6186
|
this._content = this.createContentComponent(this.id, contentComponent);
|
|
5867
6187
|
this._tab = this.createTabComponent(this.id, tabComponent);
|
|
5868
6188
|
}
|
|
@@ -5870,25 +6190,8 @@
|
|
|
5870
6190
|
this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
|
|
5871
6191
|
this.tab.init(params);
|
|
5872
6192
|
}
|
|
5873
|
-
updateParentGroup(
|
|
5874
|
-
|
|
5875
|
-
this._group = group;
|
|
5876
|
-
if (this._content.onGroupChange) {
|
|
5877
|
-
this._content.onGroupChange(group);
|
|
5878
|
-
}
|
|
5879
|
-
if (this._tab.onGroupChange) {
|
|
5880
|
-
this._tab.onGroupChange(group);
|
|
5881
|
-
}
|
|
5882
|
-
}
|
|
5883
|
-
if (isPanelVisible !== this._isPanelVisible) {
|
|
5884
|
-
this._isPanelVisible = isPanelVisible;
|
|
5885
|
-
if (this._content.onPanelVisibleChange) {
|
|
5886
|
-
this._content.onPanelVisibleChange(isPanelVisible);
|
|
5887
|
-
}
|
|
5888
|
-
if (this._tab.onPanelVisibleChange) {
|
|
5889
|
-
this._tab.onPanelVisibleChange(isPanelVisible);
|
|
5890
|
-
}
|
|
5891
|
-
}
|
|
6193
|
+
updateParentGroup(_group, _isPanelVisible) {
|
|
6194
|
+
// noop
|
|
5892
6195
|
}
|
|
5893
6196
|
layout(width, height) {
|
|
5894
6197
|
var _a, _b;
|
|
@@ -6321,117 +6624,6 @@
|
|
|
6321
6624
|
}
|
|
6322
6625
|
}
|
|
6323
6626
|
|
|
6324
|
-
class PopoutWindow extends CompositeDisposable {
|
|
6325
|
-
constructor(id, className, options) {
|
|
6326
|
-
super();
|
|
6327
|
-
this.id = id;
|
|
6328
|
-
this.className = className;
|
|
6329
|
-
this.options = options;
|
|
6330
|
-
this._onDidClose = new Emitter();
|
|
6331
|
-
this.onDidClose = this._onDidClose.event;
|
|
6332
|
-
this._window = null;
|
|
6333
|
-
this.addDisposables(this._onDidClose, {
|
|
6334
|
-
dispose: () => {
|
|
6335
|
-
this.close();
|
|
6336
|
-
},
|
|
6337
|
-
});
|
|
6338
|
-
}
|
|
6339
|
-
dimensions() {
|
|
6340
|
-
if (!this._window) {
|
|
6341
|
-
return null;
|
|
6342
|
-
}
|
|
6343
|
-
const left = this._window.value.screenX;
|
|
6344
|
-
const top = this._window.value.screenY;
|
|
6345
|
-
const width = this._window.value.innerWidth;
|
|
6346
|
-
const height = this._window.value.innerHeight;
|
|
6347
|
-
return { top, left, width, height };
|
|
6348
|
-
}
|
|
6349
|
-
close() {
|
|
6350
|
-
if (this._window) {
|
|
6351
|
-
this._window.disposable.dispose();
|
|
6352
|
-
this._window.value.close();
|
|
6353
|
-
this._window = null;
|
|
6354
|
-
}
|
|
6355
|
-
}
|
|
6356
|
-
open(content) {
|
|
6357
|
-
if (this._window) {
|
|
6358
|
-
throw new Error('instance of popout window is already open');
|
|
6359
|
-
}
|
|
6360
|
-
const url = `${this.options.url}`;
|
|
6361
|
-
const features = Object.entries({
|
|
6362
|
-
top: this.options.top,
|
|
6363
|
-
left: this.options.left,
|
|
6364
|
-
width: this.options.width,
|
|
6365
|
-
height: this.options.height,
|
|
6366
|
-
})
|
|
6367
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
6368
|
-
.join(',');
|
|
6369
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6370
|
-
const externalWindow = window.open(url, this.id, features);
|
|
6371
|
-
if (!externalWindow) {
|
|
6372
|
-
return;
|
|
6373
|
-
}
|
|
6374
|
-
const disposable = new CompositeDisposable();
|
|
6375
|
-
this._window = { value: externalWindow, disposable };
|
|
6376
|
-
const cleanUp = () => {
|
|
6377
|
-
this._onDidClose.fire();
|
|
6378
|
-
this._window = null;
|
|
6379
|
-
};
|
|
6380
|
-
// prevent any default content from loading
|
|
6381
|
-
// externalWindow.document.body.replaceWith(document.createElement('div'));
|
|
6382
|
-
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6383
|
-
cleanUp();
|
|
6384
|
-
this.close();
|
|
6385
|
-
}));
|
|
6386
|
-
externalWindow.addEventListener('load', () => {
|
|
6387
|
-
const externalDocument = externalWindow.document;
|
|
6388
|
-
externalDocument.title = document.title;
|
|
6389
|
-
const div = document.createElement('div');
|
|
6390
|
-
div.classList.add('dv-popout-window');
|
|
6391
|
-
div.style.position = 'absolute';
|
|
6392
|
-
div.style.width = '100%';
|
|
6393
|
-
div.style.height = '100%';
|
|
6394
|
-
div.style.top = '0px';
|
|
6395
|
-
div.style.left = '0px';
|
|
6396
|
-
div.classList.add(this.className);
|
|
6397
|
-
div.appendChild(content);
|
|
6398
|
-
externalDocument.body.replaceChildren(div);
|
|
6399
|
-
externalDocument.body.classList.add(this.className);
|
|
6400
|
-
addStyles(externalDocument, window.document.styleSheets);
|
|
6401
|
-
externalWindow.addEventListener('beforeunload', () => {
|
|
6402
|
-
// TODO: indicate external window is closing
|
|
6403
|
-
cleanUp();
|
|
6404
|
-
});
|
|
6405
|
-
});
|
|
6406
|
-
}
|
|
6407
|
-
}
|
|
6408
|
-
|
|
6409
|
-
class DockviewPopoutGroupPanel extends CompositeDisposable {
|
|
6410
|
-
constructor(id, group, options) {
|
|
6411
|
-
var _a;
|
|
6412
|
-
super();
|
|
6413
|
-
this.id = id;
|
|
6414
|
-
this.group = group;
|
|
6415
|
-
this.options = options;
|
|
6416
|
-
this.window = new PopoutWindow(id, (_a = options.className) !== null && _a !== void 0 ? _a : '', {
|
|
6417
|
-
url: this.options.popoutUrl,
|
|
6418
|
-
left: this.options.box.left,
|
|
6419
|
-
top: this.options.box.top,
|
|
6420
|
-
width: this.options.box.width,
|
|
6421
|
-
height: this.options.box.height,
|
|
6422
|
-
});
|
|
6423
|
-
group.model.location = 'popout';
|
|
6424
|
-
this.addDisposables(this.window, {
|
|
6425
|
-
dispose: () => {
|
|
6426
|
-
group.model.location = 'grid';
|
|
6427
|
-
},
|
|
6428
|
-
}, this.window.onDidClose(() => {
|
|
6429
|
-
this.dispose();
|
|
6430
|
-
}));
|
|
6431
|
-
this.window.open(group.element);
|
|
6432
|
-
}
|
|
6433
|
-
}
|
|
6434
|
-
|
|
6435
6627
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6436
6628
|
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6437
6629
|
|
|
@@ -6445,11 +6637,13 @@
|
|
|
6445
6637
|
super();
|
|
6446
6638
|
this.element = element;
|
|
6447
6639
|
this.map = {};
|
|
6640
|
+
this._disposed = false;
|
|
6448
6641
|
this.addDisposables(Disposable.from(() => {
|
|
6449
6642
|
for (const value of Object.values(this.map)) {
|
|
6450
6643
|
value.disposable.dispose();
|
|
6451
6644
|
value.destroy.dispose();
|
|
6452
6645
|
}
|
|
6646
|
+
this._disposed = true;
|
|
6453
6647
|
}));
|
|
6454
6648
|
}
|
|
6455
6649
|
detatch(panel) {
|
|
@@ -6489,7 +6683,7 @@
|
|
|
6489
6683
|
focusContainer.style.top = `${box.top - box2.top}px`;
|
|
6490
6684
|
focusContainer.style.width = `${box.width}px`;
|
|
6491
6685
|
focusContainer.style.height = `${box.height}px`;
|
|
6492
|
-
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location === 'floating');
|
|
6686
|
+
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
|
|
6493
6687
|
};
|
|
6494
6688
|
const visibilityChanged = () => {
|
|
6495
6689
|
if (panel.api.isVisible) {
|
|
@@ -6535,8 +6729,11 @@
|
|
|
6535
6729
|
resize();
|
|
6536
6730
|
}));
|
|
6537
6731
|
this.map[panel.api.id].destroy = Disposable.from(() => {
|
|
6538
|
-
|
|
6539
|
-
|
|
6732
|
+
var _a;
|
|
6733
|
+
if (panel.view.content.element.parentElement === focusContainer) {
|
|
6734
|
+
focusContainer.removeChild(panel.view.content.element);
|
|
6735
|
+
}
|
|
6736
|
+
(_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
|
|
6540
6737
|
});
|
|
6541
6738
|
queueMicrotask(() => {
|
|
6542
6739
|
if (this.isDisposed) {
|
|
@@ -6557,11 +6754,164 @@
|
|
|
6557
6754
|
}
|
|
6558
6755
|
}
|
|
6559
6756
|
|
|
6757
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6758
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6759
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6760
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6761
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6762
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6763
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6764
|
+
});
|
|
6765
|
+
};
|
|
6766
|
+
class PopoutWindow extends CompositeDisposable {
|
|
6767
|
+
get window() {
|
|
6768
|
+
var _a, _b;
|
|
6769
|
+
return (_b = (_a = this._window) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;
|
|
6770
|
+
}
|
|
6771
|
+
constructor(target, className, options) {
|
|
6772
|
+
super();
|
|
6773
|
+
this.target = target;
|
|
6774
|
+
this.className = className;
|
|
6775
|
+
this.options = options;
|
|
6776
|
+
this._onWillClose = new Emitter();
|
|
6777
|
+
this.onWillClose = this._onWillClose.event;
|
|
6778
|
+
this._onDidClose = new Emitter();
|
|
6779
|
+
this.onDidClose = this._onDidClose.event;
|
|
6780
|
+
this._window = null;
|
|
6781
|
+
this.addDisposables(this._onWillClose, this._onDidClose, {
|
|
6782
|
+
dispose: () => {
|
|
6783
|
+
this.close();
|
|
6784
|
+
},
|
|
6785
|
+
});
|
|
6786
|
+
}
|
|
6787
|
+
dimensions() {
|
|
6788
|
+
if (!this._window) {
|
|
6789
|
+
return null;
|
|
6790
|
+
}
|
|
6791
|
+
const left = this._window.value.screenX;
|
|
6792
|
+
const top = this._window.value.screenY;
|
|
6793
|
+
const width = this._window.value.innerWidth;
|
|
6794
|
+
const height = this._window.value.innerHeight;
|
|
6795
|
+
return { top, left, width, height };
|
|
6796
|
+
}
|
|
6797
|
+
close() {
|
|
6798
|
+
var _a, _b;
|
|
6799
|
+
if (this._window) {
|
|
6800
|
+
this._onWillClose.fire();
|
|
6801
|
+
(_b = (_a = this.options).onWillClose) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6802
|
+
id: this.target,
|
|
6803
|
+
window: this._window.value,
|
|
6804
|
+
});
|
|
6805
|
+
this._window.disposable.dispose();
|
|
6806
|
+
this._window.value.close();
|
|
6807
|
+
this._window = null;
|
|
6808
|
+
this._onDidClose.fire();
|
|
6809
|
+
}
|
|
6810
|
+
}
|
|
6811
|
+
open() {
|
|
6812
|
+
var _a, _b;
|
|
6813
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6814
|
+
if (this._window) {
|
|
6815
|
+
throw new Error('instance of popout window is already open');
|
|
6816
|
+
}
|
|
6817
|
+
const url = `${this.options.url}`;
|
|
6818
|
+
const features = Object.entries({
|
|
6819
|
+
top: this.options.top,
|
|
6820
|
+
left: this.options.left,
|
|
6821
|
+
width: this.options.width,
|
|
6822
|
+
height: this.options.height,
|
|
6823
|
+
})
|
|
6824
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
6825
|
+
.join(',');
|
|
6826
|
+
/**
|
|
6827
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6828
|
+
*/
|
|
6829
|
+
const externalWindow = window.open(url, this.target, features);
|
|
6830
|
+
if (!externalWindow) {
|
|
6831
|
+
/**
|
|
6832
|
+
* Popup blocked
|
|
6833
|
+
*/
|
|
6834
|
+
return null;
|
|
6835
|
+
}
|
|
6836
|
+
const disposable = new CompositeDisposable();
|
|
6837
|
+
this._window = { value: externalWindow, disposable };
|
|
6838
|
+
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6839
|
+
/**
|
|
6840
|
+
* before the main window closes we should close this popup too
|
|
6841
|
+
* to be good citizens
|
|
6842
|
+
*
|
|
6843
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6844
|
+
*/
|
|
6845
|
+
this.close();
|
|
6846
|
+
}));
|
|
6847
|
+
const container = this.createPopoutWindowContainer();
|
|
6848
|
+
if (this.className) {
|
|
6849
|
+
container.classList.add(this.className);
|
|
6850
|
+
}
|
|
6851
|
+
(_b = (_a = this.options).onDidOpen) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6852
|
+
id: this.target,
|
|
6853
|
+
window: externalWindow,
|
|
6854
|
+
});
|
|
6855
|
+
return new Promise((resolve) => {
|
|
6856
|
+
externalWindow.addEventListener('unload', (e) => {
|
|
6857
|
+
// if page fails to load before unloading
|
|
6858
|
+
// this.close();
|
|
6859
|
+
});
|
|
6860
|
+
externalWindow.addEventListener('load', () => {
|
|
6861
|
+
/**
|
|
6862
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
|
|
6863
|
+
*/
|
|
6864
|
+
const externalDocument = externalWindow.document;
|
|
6865
|
+
externalDocument.title = document.title;
|
|
6866
|
+
externalDocument.body.appendChild(container);
|
|
6867
|
+
addStyles(externalDocument, window.document.styleSheets);
|
|
6868
|
+
/**
|
|
6869
|
+
* beforeunload must be registered after load for reasons I could not determine
|
|
6870
|
+
* otherwise the beforeunload event will not fire when the window is closed
|
|
6871
|
+
*/
|
|
6872
|
+
addDisposableWindowListener(externalWindow, 'beforeunload', () => {
|
|
6873
|
+
/**
|
|
6874
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6875
|
+
*/
|
|
6876
|
+
this.close();
|
|
6877
|
+
});
|
|
6878
|
+
resolve(container);
|
|
6879
|
+
});
|
|
6880
|
+
});
|
|
6881
|
+
});
|
|
6882
|
+
}
|
|
6883
|
+
createPopoutWindowContainer() {
|
|
6884
|
+
const el = document.createElement('div');
|
|
6885
|
+
el.classList.add('dv-popout-window');
|
|
6886
|
+
el.id = 'dv-popout-window';
|
|
6887
|
+
el.style.position = 'absolute';
|
|
6888
|
+
el.style.width = '100%';
|
|
6889
|
+
el.style.height = '100%';
|
|
6890
|
+
el.style.top = '0px';
|
|
6891
|
+
el.style.left = '0px';
|
|
6892
|
+
return el;
|
|
6893
|
+
}
|
|
6894
|
+
}
|
|
6895
|
+
|
|
6560
6896
|
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6561
6897
|
activationSize: { type: 'pixels', value: 10 },
|
|
6562
6898
|
size: { type: 'pixels', value: 20 },
|
|
6563
6899
|
};
|
|
6564
|
-
function
|
|
6900
|
+
function moveGroupWithoutDestroying(options) {
|
|
6901
|
+
const activePanel = options.from.activePanel;
|
|
6902
|
+
const panels = [...options.from.panels].map((panel) => {
|
|
6903
|
+
const removedPanel = options.from.model.removePanel(panel);
|
|
6904
|
+
options.from.model.renderContainer.detatch(panel);
|
|
6905
|
+
return removedPanel;
|
|
6906
|
+
});
|
|
6907
|
+
panels.forEach((panel) => {
|
|
6908
|
+
options.to.model.openPanel(panel, {
|
|
6909
|
+
skipSetActive: activePanel !== panel,
|
|
6910
|
+
skipSetGroupActive: true,
|
|
6911
|
+
});
|
|
6912
|
+
});
|
|
6913
|
+
}
|
|
6914
|
+
function getDockviewTheme(element) {
|
|
6565
6915
|
function toClassList(element) {
|
|
6566
6916
|
const list = [];
|
|
6567
6917
|
for (let i = 0; i < element.classList.length; i++) {
|
|
@@ -6612,6 +6962,7 @@
|
|
|
6612
6962
|
styles: options.styles,
|
|
6613
6963
|
parentElement: options.parentElement,
|
|
6614
6964
|
disableAutoResizing: options.disableAutoResizing,
|
|
6965
|
+
locked: options.locked,
|
|
6615
6966
|
});
|
|
6616
6967
|
this.nextGroupId = sequentialNumberGenerator();
|
|
6617
6968
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -6622,6 +6973,10 @@
|
|
|
6622
6973
|
this.onWillDragGroup = this._onWillDragGroup.event;
|
|
6623
6974
|
this._onDidDrop = new Emitter();
|
|
6624
6975
|
this.onDidDrop = this._onDidDrop.event;
|
|
6976
|
+
this._onWillDrop = new Emitter();
|
|
6977
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
6978
|
+
this._onWillShowOverlay = new Emitter();
|
|
6979
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
6625
6980
|
this._onDidRemovePanel = new Emitter();
|
|
6626
6981
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
6627
6982
|
this._onDidAddPanel = new Emitter();
|
|
@@ -6630,15 +6985,36 @@
|
|
|
6630
6985
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
6631
6986
|
this._onDidActivePanelChange = new Emitter();
|
|
6632
6987
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
6988
|
+
this._onDidMovePanel = new Emitter();
|
|
6633
6989
|
this._floatingGroups = [];
|
|
6634
6990
|
this._popoutGroups = [];
|
|
6991
|
+
this._ignoreEvents = 0;
|
|
6992
|
+
this._onDidRemoveGroup = new Emitter();
|
|
6993
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
6994
|
+
this._onDidAddGroup = new Emitter();
|
|
6995
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
6996
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
6997
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
6998
|
+
this._moving = false;
|
|
6635
6999
|
const gready = document.createElement('div');
|
|
6636
7000
|
gready.className = 'dv-overlay-render-container';
|
|
6637
7001
|
this.gridview.element.appendChild(gready);
|
|
6638
7002
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
6639
7003
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
6640
7004
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
6641
|
-
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop,
|
|
7005
|
+
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) => {
|
|
7006
|
+
if (!this._moving) {
|
|
7007
|
+
this._onDidAddGroup.fire(event);
|
|
7008
|
+
}
|
|
7009
|
+
}), this.onDidRemove((event) => {
|
|
7010
|
+
if (!this._moving) {
|
|
7011
|
+
this._onDidRemoveGroup.fire(event);
|
|
7012
|
+
}
|
|
7013
|
+
}), this.onDidActiveChange((event) => {
|
|
7014
|
+
if (!this._moving) {
|
|
7015
|
+
this._onDidActiveGroupChange.fire(event);
|
|
7016
|
+
}
|
|
7017
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
6642
7018
|
this.updateWatermark();
|
|
6643
7019
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
6644
7020
|
this._bufferOnDidLayoutChange.fire();
|
|
@@ -6649,7 +7025,7 @@
|
|
|
6649
7025
|
}
|
|
6650
7026
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6651
7027
|
for (const group of [...this._popoutGroups]) {
|
|
6652
|
-
group.dispose();
|
|
7028
|
+
group.disposable.dispose();
|
|
6653
7029
|
}
|
|
6654
7030
|
}));
|
|
6655
7031
|
this._options = options;
|
|
@@ -6695,7 +7071,7 @@
|
|
|
6695
7071
|
return this.options.showDndOverlay({
|
|
6696
7072
|
nativeEvent: event,
|
|
6697
7073
|
position: position,
|
|
6698
|
-
target:
|
|
7074
|
+
target: 'edge',
|
|
6699
7075
|
getData: getPanelData,
|
|
6700
7076
|
});
|
|
6701
7077
|
}
|
|
@@ -6706,86 +7082,249 @@
|
|
|
6706
7082
|
});
|
|
6707
7083
|
this.addDisposables(this._rootDropTarget.onDrop((event) => {
|
|
6708
7084
|
var _a;
|
|
7085
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
7086
|
+
nativeEvent: event.nativeEvent,
|
|
7087
|
+
position: event.position,
|
|
7088
|
+
panel: undefined,
|
|
7089
|
+
api: this._api,
|
|
7090
|
+
group: undefined,
|
|
7091
|
+
getData: getPanelData,
|
|
7092
|
+
kind: 'content',
|
|
7093
|
+
});
|
|
7094
|
+
this._onWillDrop.fire(willDropEvent);
|
|
7095
|
+
if (willDropEvent.defaultPrevented) {
|
|
7096
|
+
return;
|
|
7097
|
+
}
|
|
6709
7098
|
const data = getPanelData();
|
|
6710
7099
|
if (data) {
|
|
6711
|
-
this.moveGroupOrPanel(
|
|
7100
|
+
this.moveGroupOrPanel({
|
|
7101
|
+
from: {
|
|
7102
|
+
groupId: data.groupId,
|
|
7103
|
+
panelId: (_a = data.panelId) !== null && _a !== void 0 ? _a : undefined,
|
|
7104
|
+
},
|
|
7105
|
+
to: {
|
|
7106
|
+
group: this.orthogonalize(event.position),
|
|
7107
|
+
position: 'center',
|
|
7108
|
+
},
|
|
7109
|
+
});
|
|
6712
7110
|
}
|
|
6713
7111
|
else {
|
|
6714
|
-
this._onDidDrop.fire(
|
|
7112
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
7113
|
+
nativeEvent: event.nativeEvent,
|
|
7114
|
+
position: event.position,
|
|
7115
|
+
panel: undefined,
|
|
7116
|
+
api: this._api,
|
|
7117
|
+
group: undefined,
|
|
7118
|
+
getData: getPanelData,
|
|
7119
|
+
}));
|
|
6715
7120
|
}
|
|
6716
7121
|
}), this._rootDropTarget);
|
|
6717
7122
|
this._api = new DockviewApi(this);
|
|
6718
7123
|
this.updateWatermark();
|
|
6719
7124
|
}
|
|
6720
|
-
addPopoutGroup(
|
|
6721
|
-
var _a;
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
7125
|
+
addPopoutGroup(itemToPopout, options) {
|
|
7126
|
+
var _a, _b, _c;
|
|
7127
|
+
if (itemToPopout instanceof DockviewPanel &&
|
|
7128
|
+
itemToPopout.group.size === 1) {
|
|
7129
|
+
return this.addPopoutGroup(itemToPopout.group);
|
|
7130
|
+
}
|
|
7131
|
+
const theme = getDockviewTheme(this.gridview.element);
|
|
7132
|
+
const element = this.element;
|
|
7133
|
+
function getBox() {
|
|
7134
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7135
|
+
return options.position;
|
|
7136
|
+
}
|
|
7137
|
+
if (itemToPopout instanceof DockviewGroupPanel) {
|
|
7138
|
+
return itemToPopout.element.getBoundingClientRect();
|
|
7139
|
+
}
|
|
7140
|
+
if (itemToPopout.group) {
|
|
7141
|
+
return itemToPopout.group.element.getBoundingClientRect();
|
|
7142
|
+
}
|
|
7143
|
+
return element.getBoundingClientRect();
|
|
7144
|
+
}
|
|
7145
|
+
const box = getBox();
|
|
7146
|
+
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;
|
|
7147
|
+
if (itemToPopout.api.location.type === 'grid') {
|
|
7148
|
+
itemToPopout.api.setHidden(true);
|
|
7149
|
+
}
|
|
7150
|
+
const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
|
|
7151
|
+
theme !== null && theme !== void 0 ? theme : '', {
|
|
7152
|
+
url: (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : '/popout.html',
|
|
7153
|
+
left: window.screenX + box.left,
|
|
7154
|
+
top: window.screenY + box.top,
|
|
7155
|
+
width: box.width,
|
|
7156
|
+
height: box.height,
|
|
7157
|
+
onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
|
|
7158
|
+
onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
|
|
7159
|
+
});
|
|
7160
|
+
const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
|
|
7161
|
+
popoutWindowDisposable.dispose();
|
|
7162
|
+
}));
|
|
7163
|
+
return _window
|
|
7164
|
+
.open()
|
|
7165
|
+
.then((popoutContainer) => {
|
|
7166
|
+
var _a;
|
|
7167
|
+
if (_window.isDisposed) {
|
|
7168
|
+
return;
|
|
6733
7169
|
}
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
if (!box) {
|
|
6738
|
-
box = group.element.getBoundingClientRect();
|
|
7170
|
+
if (popoutContainer === null) {
|
|
7171
|
+
popoutWindowDisposable.dispose();
|
|
7172
|
+
return;
|
|
6739
7173
|
}
|
|
6740
|
-
const
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
7174
|
+
const gready = document.createElement('div');
|
|
7175
|
+
gready.className = 'dv-overlay-render-container';
|
|
7176
|
+
const overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7177
|
+
const referenceGroup = itemToPopout instanceof DockviewPanel
|
|
7178
|
+
? itemToPopout.group
|
|
7179
|
+
: itemToPopout;
|
|
7180
|
+
const referenceLocation = itemToPopout.api.location.type;
|
|
7181
|
+
const group = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) !== null && _a !== void 0 ? _a : this.createGroup({ id: groupId });
|
|
7182
|
+
group.model.renderContainer = overlayRenderContainer;
|
|
7183
|
+
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup)) {
|
|
7184
|
+
this._onDidAddGroup.fire(group);
|
|
7185
|
+
}
|
|
7186
|
+
if (itemToPopout instanceof DockviewPanel) {
|
|
7187
|
+
this.movingLock(() => {
|
|
7188
|
+
const panel = referenceGroup.model.removePanel(itemToPopout);
|
|
7189
|
+
group.model.openPanel(panel);
|
|
7190
|
+
});
|
|
7191
|
+
}
|
|
7192
|
+
else {
|
|
7193
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7194
|
+
from: referenceGroup,
|
|
7195
|
+
to: group,
|
|
7196
|
+
}));
|
|
7197
|
+
switch (referenceLocation) {
|
|
7198
|
+
case 'grid':
|
|
7199
|
+
referenceGroup.api.setHidden(true);
|
|
7200
|
+
break;
|
|
7201
|
+
case 'floating':
|
|
7202
|
+
case 'popout':
|
|
7203
|
+
this.removeGroup(referenceGroup);
|
|
7204
|
+
break;
|
|
7205
|
+
}
|
|
7206
|
+
}
|
|
7207
|
+
popoutContainer.classList.add('dv-dockview');
|
|
7208
|
+
popoutContainer.style.overflow = 'hidden';
|
|
7209
|
+
popoutContainer.appendChild(gready);
|
|
7210
|
+
popoutContainer.appendChild(group.element);
|
|
7211
|
+
group.model.location = {
|
|
7212
|
+
type: 'popout',
|
|
7213
|
+
getWindow: () => _window.window,
|
|
7214
|
+
};
|
|
7215
|
+
this.doSetGroupAndPanelActive(group);
|
|
7216
|
+
popoutWindowDisposable.addDisposables(group.api.onDidActiveChange((event) => {
|
|
7217
|
+
var _a;
|
|
7218
|
+
if (event.isActive) {
|
|
7219
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7220
|
+
}
|
|
7221
|
+
}), group.api.onWillFocus(() => {
|
|
7222
|
+
var _a;
|
|
7223
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7224
|
+
}));
|
|
7225
|
+
let returnedGroup;
|
|
7226
|
+
const value = {
|
|
7227
|
+
window: _window,
|
|
7228
|
+
popoutGroup: group,
|
|
7229
|
+
referenceGroup: this.getPanel(referenceGroup.id)
|
|
7230
|
+
? referenceGroup.id
|
|
7231
|
+
: undefined,
|
|
7232
|
+
disposable: {
|
|
7233
|
+
dispose: () => {
|
|
7234
|
+
popoutWindowDisposable.dispose();
|
|
7235
|
+
return returnedGroup;
|
|
7236
|
+
},
|
|
7237
|
+
},
|
|
7238
|
+
};
|
|
7239
|
+
popoutWindowDisposable.addDisposables(
|
|
7240
|
+
/**
|
|
7241
|
+
* ResizeObserver seems slow here, I do not know why but we don't need it
|
|
7242
|
+
* since we can reply on the window resize event as we will occupy the full
|
|
7243
|
+
* window dimensions
|
|
7244
|
+
*/
|
|
7245
|
+
addDisposableWindowListener(_window.window, 'resize', () => {
|
|
7246
|
+
group.layout(window.innerWidth, window.innerHeight);
|
|
7247
|
+
}), overlayRenderContainer, Disposable.from(() => {
|
|
7248
|
+
if (this.getPanel(referenceGroup.id)) {
|
|
7249
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7250
|
+
from: group,
|
|
7251
|
+
to: referenceGroup,
|
|
7252
|
+
}));
|
|
7253
|
+
if (referenceGroup.api.isHidden) {
|
|
7254
|
+
referenceGroup.api.setHidden(false);
|
|
7255
|
+
}
|
|
7256
|
+
if (this.getPanel(group.id)) {
|
|
7257
|
+
this.doRemoveGroup(group, {
|
|
7258
|
+
skipPopoutAssociated: true,
|
|
7259
|
+
});
|
|
7260
|
+
}
|
|
7261
|
+
}
|
|
7262
|
+
else {
|
|
7263
|
+
if (this.getPanel(group.id)) {
|
|
7264
|
+
const removedGroup = this.doRemoveGroup(group, {
|
|
7265
|
+
skipDispose: true,
|
|
7266
|
+
skipActive: true,
|
|
7267
|
+
});
|
|
7268
|
+
removedGroup.model.renderContainer =
|
|
7269
|
+
this.overlayRenderContainer;
|
|
7270
|
+
removedGroup.model.location = { type: 'grid' };
|
|
7271
|
+
returnedGroup = removedGroup;
|
|
7272
|
+
}
|
|
7273
|
+
}
|
|
7274
|
+
}));
|
|
7275
|
+
this._popoutGroups.push(value);
|
|
7276
|
+
this.updateWatermark();
|
|
7277
|
+
})
|
|
7278
|
+
.catch((err) => {
|
|
7279
|
+
console.error(err);
|
|
6757
7280
|
});
|
|
6758
|
-
popoutWindow.addDisposables({
|
|
6759
|
-
dispose: () => {
|
|
6760
|
-
remove(this._popoutGroups, popoutWindow);
|
|
6761
|
-
this.updateWatermark();
|
|
6762
|
-
},
|
|
6763
|
-
}, popoutWindow.window.onDidClose(() => {
|
|
6764
|
-
this.doAddGroup(group, [0]);
|
|
6765
|
-
}));
|
|
6766
|
-
this._popoutGroups.push(popoutWindow);
|
|
6767
|
-
this.updateWatermark();
|
|
6768
7281
|
}
|
|
6769
7282
|
addFloatingGroup(item, coord, options) {
|
|
6770
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7283
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6771
7284
|
let group;
|
|
6772
7285
|
if (item instanceof DockviewPanel) {
|
|
6773
7286
|
group = this.createGroup();
|
|
6774
|
-
this.
|
|
7287
|
+
this._onDidAddGroup.fire(group);
|
|
7288
|
+
this.movingLock(() => this.removePanel(item, {
|
|
6775
7289
|
removeEmptyGroup: true,
|
|
6776
7290
|
skipDispose: true,
|
|
6777
|
-
|
|
6778
|
-
|
|
7291
|
+
skipSetActiveGroup: true,
|
|
7292
|
+
}));
|
|
7293
|
+
group.model.openPanel(item, { skipSetGroupActive: true });
|
|
6779
7294
|
}
|
|
6780
7295
|
else {
|
|
6781
7296
|
group = item;
|
|
7297
|
+
const popoutReferenceGroupId = (_a = this._popoutGroups.find((_) => _.popoutGroup === group)) === null || _a === void 0 ? void 0 : _a.referenceGroup;
|
|
7298
|
+
const popoutReferenceGroup = popoutReferenceGroupId
|
|
7299
|
+
? this.getPanel(popoutReferenceGroupId)
|
|
7300
|
+
: undefined;
|
|
6782
7301
|
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
6783
7302
|
options.skipRemoveGroup;
|
|
6784
7303
|
if (!skip) {
|
|
6785
|
-
|
|
7304
|
+
if (popoutReferenceGroup) {
|
|
7305
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7306
|
+
from: item,
|
|
7307
|
+
to: popoutReferenceGroup,
|
|
7308
|
+
}));
|
|
7309
|
+
this.doRemoveGroup(item, {
|
|
7310
|
+
skipPopoutReturn: true,
|
|
7311
|
+
skipPopoutAssociated: true,
|
|
7312
|
+
});
|
|
7313
|
+
this.doRemoveGroup(popoutReferenceGroup, {
|
|
7314
|
+
skipDispose: true,
|
|
7315
|
+
});
|
|
7316
|
+
group = popoutReferenceGroup;
|
|
7317
|
+
}
|
|
7318
|
+
else {
|
|
7319
|
+
this.doRemoveGroup(item, {
|
|
7320
|
+
skipDispose: true,
|
|
7321
|
+
skipPopoutReturn: true,
|
|
7322
|
+
skipPopoutAssociated: !!popoutReferenceGroup,
|
|
7323
|
+
});
|
|
7324
|
+
}
|
|
6786
7325
|
}
|
|
6787
7326
|
}
|
|
6788
|
-
group.model.location = 'floating';
|
|
7327
|
+
group.model.location = { type: 'floating' };
|
|
6789
7328
|
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6790
7329
|
? Math.max(coord.x, 0)
|
|
6791
7330
|
: DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
@@ -6795,16 +7334,16 @@
|
|
|
6795
7334
|
const overlay = new Overlay({
|
|
6796
7335
|
container: this.gridview.element,
|
|
6797
7336
|
content: group.element,
|
|
6798
|
-
height: (
|
|
6799
|
-
width: (
|
|
7337
|
+
height: (_b = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _b !== void 0 ? _b : 300,
|
|
7338
|
+
width: (_c = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _c !== void 0 ? _c : 300,
|
|
6800
7339
|
left: overlayLeft,
|
|
6801
7340
|
top: overlayTop,
|
|
6802
7341
|
minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6803
7342
|
? undefined
|
|
6804
|
-
: (
|
|
7343
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumWidthWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6805
7344
|
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6806
7345
|
? undefined
|
|
6807
|
-
: (
|
|
7346
|
+
: (_g = (_f = this.options.floatingGroupBounds) === null || _f === void 0 ? void 0 : _f.minimumHeightWithinViewport) !== null && _g !== void 0 ? _g : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6808
7347
|
});
|
|
6809
7348
|
const el = group.element.querySelector('.void-container');
|
|
6810
7349
|
if (!el) {
|
|
@@ -6835,12 +7374,15 @@
|
|
|
6835
7374
|
}), {
|
|
6836
7375
|
dispose: () => {
|
|
6837
7376
|
disposable.dispose();
|
|
6838
|
-
group.model.location = 'grid';
|
|
7377
|
+
group.model.location = { type: 'grid' };
|
|
6839
7378
|
remove(this._floatingGroups, floatingGroupPanel);
|
|
6840
7379
|
this.updateWatermark();
|
|
6841
7380
|
},
|
|
6842
7381
|
});
|
|
6843
7382
|
this._floatingGroups.push(floatingGroupPanel);
|
|
7383
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
|
|
7384
|
+
this.doSetGroupAndPanelActive(group);
|
|
7385
|
+
}
|
|
6844
7386
|
this.updateWatermark();
|
|
6845
7387
|
}
|
|
6846
7388
|
orthogonalize(position) {
|
|
@@ -6930,8 +7472,8 @@
|
|
|
6930
7472
|
return this.panels.find((panel) => panel.id === id);
|
|
6931
7473
|
}
|
|
6932
7474
|
setActivePanel(panel) {
|
|
6933
|
-
this.doSetGroupActive(panel.group);
|
|
6934
7475
|
panel.group.model.openPanel(panel);
|
|
7476
|
+
this.doSetGroupAndPanelActive(panel.group);
|
|
6935
7477
|
}
|
|
6936
7478
|
moveToNext(options = {}) {
|
|
6937
7479
|
var _a;
|
|
@@ -6992,7 +7534,8 @@
|
|
|
6992
7534
|
});
|
|
6993
7535
|
const popoutGroups = this._popoutGroups.map((group) => {
|
|
6994
7536
|
return {
|
|
6995
|
-
data: group.
|
|
7537
|
+
data: group.popoutGroup.toJSON(),
|
|
7538
|
+
gridReferenceGroup: group.referenceGroup,
|
|
6996
7539
|
position: group.window.dimensions(),
|
|
6997
7540
|
};
|
|
6998
7541
|
});
|
|
@@ -7010,7 +7553,7 @@
|
|
|
7010
7553
|
return result;
|
|
7011
7554
|
}
|
|
7012
7555
|
fromJSON(data) {
|
|
7013
|
-
var _a, _b;
|
|
7556
|
+
var _a, _b, _c;
|
|
7014
7557
|
this.clear();
|
|
7015
7558
|
if (typeof data !== 'object' || data === null) {
|
|
7016
7559
|
throw new Error('serialized layout must be a non-null object');
|
|
@@ -7049,7 +7592,7 @@
|
|
|
7049
7592
|
const isActive = typeof activeView === 'string' &&
|
|
7050
7593
|
activeView === panel.id;
|
|
7051
7594
|
group.model.openPanel(panel, {
|
|
7052
|
-
|
|
7595
|
+
skipSetActive: !isActive,
|
|
7053
7596
|
skipSetGroupActive: true,
|
|
7054
7597
|
});
|
|
7055
7598
|
}
|
|
@@ -7079,11 +7622,16 @@
|
|
|
7079
7622
|
}
|
|
7080
7623
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7081
7624
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
7082
|
-
const { data, position } = serializedPopoutGroup;
|
|
7625
|
+
const { data, position, gridReferenceGroup } = serializedPopoutGroup;
|
|
7083
7626
|
const group = createGroupFromSerializedState(data);
|
|
7084
|
-
this.addPopoutGroup(
|
|
7627
|
+
this.addPopoutGroup((_c = (gridReferenceGroup
|
|
7628
|
+
? this.getPanel(gridReferenceGroup)
|
|
7629
|
+
: undefined)) !== null && _c !== void 0 ? _c : group, {
|
|
7085
7630
|
skipRemoveGroup: true,
|
|
7086
7631
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
7632
|
+
overridePopoutGroup: gridReferenceGroup
|
|
7633
|
+
? group
|
|
7634
|
+
: undefined,
|
|
7087
7635
|
});
|
|
7088
7636
|
}
|
|
7089
7637
|
for (const floatingGroup of this._floatingGroups) {
|
|
@@ -7130,12 +7678,13 @@
|
|
|
7130
7678
|
*/
|
|
7131
7679
|
throw err;
|
|
7132
7680
|
}
|
|
7681
|
+
this.updateWatermark();
|
|
7133
7682
|
this._onDidLayoutFromJSON.fire();
|
|
7134
7683
|
}
|
|
7135
7684
|
clear() {
|
|
7136
7685
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7137
7686
|
const hasActiveGroup = !!this.activeGroup;
|
|
7138
|
-
|
|
7687
|
+
!!this.activePanel;
|
|
7139
7688
|
for (const group of groups) {
|
|
7140
7689
|
// remove the group will automatically remove the panels
|
|
7141
7690
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7143,9 +7692,6 @@
|
|
|
7143
7692
|
if (hasActiveGroup) {
|
|
7144
7693
|
this.doSetGroupAndPanelActive(undefined);
|
|
7145
7694
|
}
|
|
7146
|
-
if (hasActivePanel) {
|
|
7147
|
-
this._onDidActivePanelChange.fire(undefined);
|
|
7148
|
-
}
|
|
7149
7695
|
this.gridview.clear();
|
|
7150
7696
|
}
|
|
7151
7697
|
closeAllGroups() {
|
|
@@ -7186,6 +7732,7 @@
|
|
|
7186
7732
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
7187
7733
|
const panel = this.createPanel(options, group);
|
|
7188
7734
|
group.model.openPanel(panel);
|
|
7735
|
+
this.doSetGroupAndPanelActive(group);
|
|
7189
7736
|
return panel;
|
|
7190
7737
|
}
|
|
7191
7738
|
}
|
|
@@ -7197,6 +7744,7 @@
|
|
|
7197
7744
|
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
7198
7745
|
if (options.floating) {
|
|
7199
7746
|
const group = this.createGroup();
|
|
7747
|
+
this._onDidAddGroup.fire(group);
|
|
7200
7748
|
const o = typeof options.floating === 'object' &&
|
|
7201
7749
|
options.floating !== null
|
|
7202
7750
|
? options.floating
|
|
@@ -7204,16 +7752,16 @@
|
|
|
7204
7752
|
this.addFloatingGroup(group, o, {
|
|
7205
7753
|
inDragMode: false,
|
|
7206
7754
|
skipRemoveGroup: true,
|
|
7755
|
+
skipActiveGroup: true,
|
|
7207
7756
|
});
|
|
7208
|
-
this._onDidAddGroup.fire(group);
|
|
7209
7757
|
panel = this.createPanel(options, group);
|
|
7210
7758
|
group.model.openPanel(panel);
|
|
7211
|
-
this.doSetGroupAndPanelActive(group);
|
|
7212
7759
|
}
|
|
7213
|
-
else if (referenceGroup.api.location === 'floating' ||
|
|
7760
|
+
else if (referenceGroup.api.location.type === 'floating' ||
|
|
7214
7761
|
target === 'center') {
|
|
7215
7762
|
panel = this.createPanel(options, referenceGroup);
|
|
7216
7763
|
referenceGroup.model.openPanel(panel);
|
|
7764
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
7217
7765
|
}
|
|
7218
7766
|
else {
|
|
7219
7767
|
const location = getGridLocation(referenceGroup.element);
|
|
@@ -7221,10 +7769,12 @@
|
|
|
7221
7769
|
const group = this.createGroupAtLocation(relativeLocation);
|
|
7222
7770
|
panel = this.createPanel(options, group);
|
|
7223
7771
|
group.model.openPanel(panel);
|
|
7772
|
+
this.doSetGroupAndPanelActive(group);
|
|
7224
7773
|
}
|
|
7225
7774
|
}
|
|
7226
7775
|
else if (options.floating) {
|
|
7227
7776
|
const group = this.createGroup();
|
|
7777
|
+
this._onDidAddGroup.fire(group);
|
|
7228
7778
|
const o = typeof options.floating === 'object' &&
|
|
7229
7779
|
options.floating !== null
|
|
7230
7780
|
? options.floating
|
|
@@ -7232,16 +7782,16 @@
|
|
|
7232
7782
|
this.addFloatingGroup(group, o, {
|
|
7233
7783
|
inDragMode: false,
|
|
7234
7784
|
skipRemoveGroup: true,
|
|
7785
|
+
skipActiveGroup: true,
|
|
7235
7786
|
});
|
|
7236
|
-
this._onDidAddGroup.fire(group);
|
|
7237
7787
|
panel = this.createPanel(options, group);
|
|
7238
7788
|
group.model.openPanel(panel);
|
|
7239
|
-
this.doSetGroupAndPanelActive(group);
|
|
7240
7789
|
}
|
|
7241
7790
|
else {
|
|
7242
7791
|
const group = this.createGroupAtLocation();
|
|
7243
7792
|
panel = this.createPanel(options, group);
|
|
7244
7793
|
group.model.openPanel(panel);
|
|
7794
|
+
this.doSetGroupAndPanelActive(group);
|
|
7245
7795
|
}
|
|
7246
7796
|
return panel;
|
|
7247
7797
|
}
|
|
@@ -7253,13 +7803,15 @@
|
|
|
7253
7803
|
if (!group) {
|
|
7254
7804
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
7255
7805
|
}
|
|
7256
|
-
group.model.removePanel(panel
|
|
7806
|
+
group.model.removePanel(panel, {
|
|
7807
|
+
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
7808
|
+
});
|
|
7257
7809
|
if (!options.skipDispose) {
|
|
7258
|
-
|
|
7810
|
+
panel.group.model.renderContainer.detatch(panel);
|
|
7259
7811
|
panel.dispose();
|
|
7260
7812
|
}
|
|
7261
7813
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
7262
|
-
this.removeGroup(group);
|
|
7814
|
+
this.removeGroup(group, { skipActive: options.skipSetActiveGroup });
|
|
7263
7815
|
}
|
|
7264
7816
|
}
|
|
7265
7817
|
createWatermarkComponent() {
|
|
@@ -7272,7 +7824,7 @@
|
|
|
7272
7824
|
}
|
|
7273
7825
|
updateWatermark() {
|
|
7274
7826
|
var _a, _b;
|
|
7275
|
-
if (this.groups.filter((x) => x.api.location === 'grid').length === 0) {
|
|
7827
|
+
if (this.groups.filter((x) => x.api.location.type === 'grid' && !x.api.isHidden).length === 0) {
|
|
7276
7828
|
if (!this.watermark) {
|
|
7277
7829
|
this.watermark = this.createWatermarkComponent();
|
|
7278
7830
|
this.watermark.init({
|
|
@@ -7318,36 +7870,42 @@
|
|
|
7318
7870
|
}
|
|
7319
7871
|
else {
|
|
7320
7872
|
const group = this.orthogonalize(directionToPosition(options.direction));
|
|
7873
|
+
if (!options.skipSetActive) {
|
|
7874
|
+
this.doSetGroupAndPanelActive(group);
|
|
7875
|
+
}
|
|
7321
7876
|
return group;
|
|
7322
7877
|
}
|
|
7323
7878
|
const target = toTarget(options.direction || 'within');
|
|
7324
7879
|
const location = getGridLocation(referenceGroup.element);
|
|
7325
7880
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7326
7881
|
this.doAddGroup(group, relativeLocation);
|
|
7882
|
+
if (!options.skipSetActive) {
|
|
7883
|
+
this.doSetGroupAndPanelActive(group);
|
|
7884
|
+
}
|
|
7327
7885
|
return group;
|
|
7328
7886
|
}
|
|
7329
7887
|
else {
|
|
7330
7888
|
this.doAddGroup(group);
|
|
7889
|
+
this.doSetGroupAndPanelActive(group);
|
|
7331
7890
|
return group;
|
|
7332
7891
|
}
|
|
7333
7892
|
}
|
|
7334
7893
|
removeGroup(group, options) {
|
|
7894
|
+
this.doRemoveGroup(group, options);
|
|
7895
|
+
}
|
|
7896
|
+
doRemoveGroup(group, options) {
|
|
7335
7897
|
var _a;
|
|
7336
7898
|
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7899
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7900
|
+
for (const panel of panels) {
|
|
7901
|
+
this.removePanel(panel, {
|
|
7902
|
+
removeEmptyGroup: false,
|
|
7903
|
+
skipDispose: (_a = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _a !== void 0 ? _a : false,
|
|
7904
|
+
});
|
|
7905
|
+
}
|
|
7342
7906
|
}
|
|
7343
7907
|
const activePanel = this.activePanel;
|
|
7344
|
-
|
|
7345
|
-
if (this.activePanel !== activePanel) {
|
|
7346
|
-
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7347
|
-
}
|
|
7348
|
-
}
|
|
7349
|
-
doRemoveGroup(group, options) {
|
|
7350
|
-
if (group.api.location === 'floating') {
|
|
7908
|
+
if (group.api.location.type === 'floating') {
|
|
7351
7909
|
const floatingGroup = this._floatingGroups.find((_) => _.group === group);
|
|
7352
7910
|
if (floatingGroup) {
|
|
7353
7911
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
@@ -7359,60 +7917,124 @@
|
|
|
7359
7917
|
floatingGroup.dispose();
|
|
7360
7918
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7361
7919
|
const groups = Array.from(this._groups.values());
|
|
7362
|
-
this.
|
|
7920
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7363
7921
|
}
|
|
7364
7922
|
return floatingGroup.group;
|
|
7365
7923
|
}
|
|
7366
7924
|
throw new Error('failed to find floating group');
|
|
7367
7925
|
}
|
|
7368
|
-
if (group.api.location === 'popout') {
|
|
7369
|
-
const selectedGroup = this._popoutGroups.find((_) => _.
|
|
7926
|
+
if (group.api.location.type === 'popout') {
|
|
7927
|
+
const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
|
|
7370
7928
|
if (selectedGroup) {
|
|
7371
7929
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7372
|
-
|
|
7930
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutAssociated)) {
|
|
7931
|
+
const refGroup = selectedGroup.referenceGroup
|
|
7932
|
+
? this.getPanel(selectedGroup.referenceGroup)
|
|
7933
|
+
: undefined;
|
|
7934
|
+
if (refGroup) {
|
|
7935
|
+
this.removeGroup(refGroup);
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
7938
|
+
selectedGroup.popoutGroup.dispose();
|
|
7373
7939
|
this._groups.delete(group.id);
|
|
7374
7940
|
this._onDidRemoveGroup.fire(group);
|
|
7375
7941
|
}
|
|
7376
|
-
selectedGroup.dispose();
|
|
7942
|
+
const removedGroup = selectedGroup.disposable.dispose();
|
|
7943
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
|
|
7944
|
+
this.doAddGroup(removedGroup, [0]);
|
|
7945
|
+
this.doSetGroupAndPanelActive(removedGroup);
|
|
7946
|
+
}
|
|
7377
7947
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7378
7948
|
const groups = Array.from(this._groups.values());
|
|
7379
|
-
this.
|
|
7949
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7380
7950
|
}
|
|
7381
|
-
|
|
7951
|
+
this.updateWatermark();
|
|
7952
|
+
return selectedGroup.popoutGroup;
|
|
7382
7953
|
}
|
|
7383
7954
|
throw new Error('failed to find popout group');
|
|
7384
7955
|
}
|
|
7385
|
-
|
|
7956
|
+
const re = super.doRemoveGroup(group, options);
|
|
7957
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
7958
|
+
if (this.activePanel !== activePanel) {
|
|
7959
|
+
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7960
|
+
}
|
|
7961
|
+
}
|
|
7962
|
+
return re;
|
|
7386
7963
|
}
|
|
7387
|
-
|
|
7388
|
-
|
|
7964
|
+
movingLock(func) {
|
|
7965
|
+
const isMoving = this._moving;
|
|
7966
|
+
try {
|
|
7967
|
+
this._moving = true;
|
|
7968
|
+
return func();
|
|
7969
|
+
}
|
|
7970
|
+
finally {
|
|
7971
|
+
this._moving = isMoving;
|
|
7972
|
+
}
|
|
7973
|
+
}
|
|
7974
|
+
moveGroupOrPanel(options) {
|
|
7975
|
+
var _a;
|
|
7976
|
+
const destinationGroup = options.to.group;
|
|
7977
|
+
const sourceGroupId = options.from.groupId;
|
|
7978
|
+
const sourceItemId = options.from.panelId;
|
|
7979
|
+
const destinationTarget = options.to.position;
|
|
7980
|
+
const destinationIndex = options.to.index;
|
|
7389
7981
|
const sourceGroup = sourceGroupId
|
|
7390
7982
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
7391
7983
|
: undefined;
|
|
7984
|
+
if (!sourceGroup) {
|
|
7985
|
+
throw new Error(`Failed to find group id ${sourceGroupId}`);
|
|
7986
|
+
}
|
|
7392
7987
|
if (sourceItemId === undefined) {
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7988
|
+
/**
|
|
7989
|
+
* Moving an entire group into another group
|
|
7990
|
+
*/
|
|
7991
|
+
this.moveGroup({
|
|
7992
|
+
from: { group: sourceGroup },
|
|
7993
|
+
to: {
|
|
7994
|
+
group: destinationGroup,
|
|
7995
|
+
position: destinationTarget,
|
|
7996
|
+
},
|
|
7997
|
+
});
|
|
7396
7998
|
return;
|
|
7397
7999
|
}
|
|
7398
8000
|
if (!destinationTarget || destinationTarget === 'center') {
|
|
7399
|
-
|
|
7400
|
-
|
|
8001
|
+
/**
|
|
8002
|
+
* Dropping a panel within another group
|
|
8003
|
+
*/
|
|
8004
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8005
|
+
skipSetActive: false,
|
|
8006
|
+
skipSetActiveGroup: true,
|
|
8007
|
+
}));
|
|
8008
|
+
if (!removedPanel) {
|
|
7401
8009
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7402
8010
|
}
|
|
7403
|
-
if (
|
|
7404
|
-
|
|
8011
|
+
if (sourceGroup.model.size === 0) {
|
|
8012
|
+
// remove the group and do not set a new group as active
|
|
8013
|
+
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
7405
8014
|
}
|
|
7406
|
-
destinationGroup.model.openPanel(
|
|
8015
|
+
this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
|
|
7407
8016
|
index: destinationIndex,
|
|
8017
|
+
skipSetGroupActive: true,
|
|
8018
|
+
}));
|
|
8019
|
+
this.doSetGroupAndPanelActive(destinationGroup);
|
|
8020
|
+
this._onDidMovePanel.fire({
|
|
8021
|
+
panel: removedPanel,
|
|
7408
8022
|
});
|
|
7409
8023
|
}
|
|
7410
8024
|
else {
|
|
8025
|
+
/**
|
|
8026
|
+
* Dropping a panel to the extremities of a group which will place that panel
|
|
8027
|
+
* into an adjacent group
|
|
8028
|
+
*/
|
|
7411
8029
|
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
7412
8030
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7413
|
-
if (sourceGroup
|
|
8031
|
+
if (sourceGroup.size < 2) {
|
|
8032
|
+
/**
|
|
8033
|
+
* If we are moving from a group which only has one panel left we will consider
|
|
8034
|
+
* moving the group itself rather than moving the panel into a newly created group
|
|
8035
|
+
*/
|
|
7414
8036
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
7415
|
-
if (sourceGroup.api.location === 'grid') {
|
|
8037
|
+
if (sourceGroup.api.location.type === 'grid') {
|
|
7416
8038
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
7417
8039
|
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
7418
8040
|
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
@@ -7420,78 +8042,123 @@
|
|
|
7420
8042
|
// if a group has one tab - we are essentially moving the 'group'
|
|
7421
8043
|
// which is equivalent to swapping two views in this case
|
|
7422
8044
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8045
|
+
return;
|
|
7423
8046
|
}
|
|
7424
8047
|
}
|
|
7425
8048
|
// source group will become empty so delete the group
|
|
7426
|
-
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
8049
|
+
const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
|
|
7427
8050
|
skipActive: true,
|
|
7428
8051
|
skipDispose: true,
|
|
7429
|
-
});
|
|
8052
|
+
}));
|
|
7430
8053
|
// after deleting the group we need to re-evaulate the ref location
|
|
7431
8054
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
7432
8055
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
7433
|
-
this.doAddGroup(targetGroup, location);
|
|
8056
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8057
|
+
this.doSetGroupAndPanelActive(targetGroup);
|
|
7434
8058
|
}
|
|
7435
8059
|
else {
|
|
7436
|
-
|
|
7437
|
-
|
|
8060
|
+
/**
|
|
8061
|
+
* The group we are removing from has many panels, we need to remove the panels we are moving,
|
|
8062
|
+
* create a new group, add the panels to that new group and add the new group in an appropiate position
|
|
8063
|
+
*/
|
|
8064
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8065
|
+
skipSetActive: false,
|
|
8066
|
+
skipSetActiveGroup: true,
|
|
8067
|
+
}));
|
|
8068
|
+
if (!removedPanel) {
|
|
7438
8069
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7439
8070
|
}
|
|
7440
8071
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7441
8072
|
const group = this.createGroupAtLocation(dropLocation);
|
|
7442
|
-
group.model.openPanel(
|
|
8073
|
+
this.movingLock(() => group.model.openPanel(removedPanel, {
|
|
8074
|
+
skipSetGroupActive: true,
|
|
8075
|
+
}));
|
|
8076
|
+
this.doSetGroupAndPanelActive(group);
|
|
7443
8077
|
}
|
|
7444
8078
|
}
|
|
7445
8079
|
}
|
|
7446
|
-
moveGroup(
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
8080
|
+
moveGroup(options) {
|
|
8081
|
+
const from = options.from.group;
|
|
8082
|
+
const to = options.to.group;
|
|
8083
|
+
const target = options.to.position;
|
|
8084
|
+
if (target === 'center') {
|
|
8085
|
+
const activePanel = from.activePanel;
|
|
8086
|
+
const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
|
|
8087
|
+
skipSetActive: true,
|
|
8088
|
+
})));
|
|
8089
|
+
if ((from === null || from === void 0 ? void 0 : from.model.size) === 0) {
|
|
8090
|
+
this.doRemoveGroup(from, { skipActive: true });
|
|
8091
|
+
}
|
|
8092
|
+
this.movingLock(() => {
|
|
7454
8093
|
for (const panel of panels) {
|
|
7455
|
-
|
|
7456
|
-
|
|
8094
|
+
to.model.openPanel(panel, {
|
|
8095
|
+
skipSetActive: panel !== activePanel,
|
|
8096
|
+
skipSetGroupActive: true,
|
|
7457
8097
|
});
|
|
7458
8098
|
}
|
|
7459
|
-
}
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
8099
|
+
});
|
|
8100
|
+
this.doSetGroupAndPanelActive(to);
|
|
8101
|
+
panels.forEach((panel) => {
|
|
8102
|
+
this._onDidMovePanel.fire({ panel });
|
|
8103
|
+
});
|
|
8104
|
+
}
|
|
8105
|
+
else {
|
|
8106
|
+
switch (from.api.location.type) {
|
|
8107
|
+
case 'grid':
|
|
8108
|
+
this.gridview.removeView(getGridLocation(from.element));
|
|
8109
|
+
break;
|
|
8110
|
+
case 'floating': {
|
|
8111
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
8112
|
+
if (!selectedFloatingGroup) {
|
|
8113
|
+
throw new Error('failed to find floating group');
|
|
7472
8114
|
}
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
8115
|
+
selectedFloatingGroup.dispose();
|
|
8116
|
+
break;
|
|
8117
|
+
}
|
|
8118
|
+
case 'popout': {
|
|
8119
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
8120
|
+
if (!selectedPopoutGroup) {
|
|
8121
|
+
throw new Error('failed to find popout group');
|
|
7479
8122
|
}
|
|
8123
|
+
selectedPopoutGroup.disposable.dispose();
|
|
7480
8124
|
}
|
|
7481
|
-
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
7482
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
7483
|
-
this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
|
|
7484
8125
|
}
|
|
8126
|
+
const referenceLocation = getGridLocation(to.element);
|
|
8127
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8128
|
+
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8129
|
+
from.panels.forEach((panel) => {
|
|
8130
|
+
this._onDidMovePanel.fire({ panel });
|
|
8131
|
+
});
|
|
7485
8132
|
}
|
|
7486
8133
|
}
|
|
7487
|
-
|
|
7488
|
-
|
|
8134
|
+
doSetGroupActive(group) {
|
|
8135
|
+
super.doSetGroupActive(group);
|
|
8136
|
+
const activePanel = this.activePanel;
|
|
8137
|
+
if (!this._moving &&
|
|
8138
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8139
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8140
|
+
}
|
|
8141
|
+
}
|
|
8142
|
+
doSetGroupAndPanelActive(group) {
|
|
8143
|
+
super.doSetGroupActive(group);
|
|
7489
8144
|
const activePanel = this.activePanel;
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
this.
|
|
8145
|
+
if (group &&
|
|
8146
|
+
this.hasMaximizedGroup() &&
|
|
8147
|
+
!this.isMaximizedGroup(group)) {
|
|
8148
|
+
this.exitMaximizedGroup();
|
|
8149
|
+
}
|
|
8150
|
+
if (!this._moving &&
|
|
8151
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8152
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
7493
8153
|
}
|
|
7494
8154
|
}
|
|
8155
|
+
getNextGroupId() {
|
|
8156
|
+
let id = this.nextGroupId.next();
|
|
8157
|
+
while (this._groups.has(id)) {
|
|
8158
|
+
id = this.nextGroupId.next();
|
|
8159
|
+
}
|
|
8160
|
+
return id;
|
|
8161
|
+
}
|
|
7495
8162
|
createGroup(options) {
|
|
7496
8163
|
if (!options) {
|
|
7497
8164
|
options = {};
|
|
@@ -7508,7 +8175,7 @@
|
|
|
7508
8175
|
}
|
|
7509
8176
|
}
|
|
7510
8177
|
const view = new DockviewGroupPanel(this, id, options);
|
|
7511
|
-
view.init({ params: {}, accessor:
|
|
8178
|
+
view.init({ params: {}, accessor: this });
|
|
7512
8179
|
if (!this._groups.has(view.id)) {
|
|
7513
8180
|
const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {
|
|
7514
8181
|
this._onWillDragPanel.fire(event);
|
|
@@ -7516,20 +8183,48 @@
|
|
|
7516
8183
|
this._onWillDragGroup.fire(event);
|
|
7517
8184
|
}), view.model.onMove((event) => {
|
|
7518
8185
|
const { groupId, itemId, target, index } = event;
|
|
7519
|
-
this.moveGroupOrPanel(
|
|
8186
|
+
this.moveGroupOrPanel({
|
|
8187
|
+
from: { groupId: groupId, panelId: itemId },
|
|
8188
|
+
to: {
|
|
8189
|
+
group: view,
|
|
8190
|
+
position: target,
|
|
8191
|
+
index,
|
|
8192
|
+
},
|
|
8193
|
+
});
|
|
7520
8194
|
}), view.model.onDidDrop((event) => {
|
|
7521
|
-
this._onDidDrop.fire(
|
|
8195
|
+
this._onDidDrop.fire(event);
|
|
8196
|
+
}), view.model.onWillDrop((event) => {
|
|
8197
|
+
this._onWillDrop.fire(event);
|
|
8198
|
+
}), view.model.onWillShowOverlay((event) => {
|
|
8199
|
+
if (this.options.disableDnd) {
|
|
8200
|
+
event.preventDefault();
|
|
8201
|
+
return;
|
|
8202
|
+
}
|
|
8203
|
+
this._onWillShowOverlay.fire(event);
|
|
7522
8204
|
}), view.model.onDidAddPanel((event) => {
|
|
8205
|
+
if (this._moving) {
|
|
8206
|
+
return;
|
|
8207
|
+
}
|
|
7523
8208
|
this._onDidAddPanel.fire(event.panel);
|
|
7524
8209
|
}), view.model.onDidRemovePanel((event) => {
|
|
8210
|
+
if (this._moving) {
|
|
8211
|
+
return;
|
|
8212
|
+
}
|
|
7525
8213
|
this._onDidRemovePanel.fire(event.panel);
|
|
7526
8214
|
}), view.model.onDidActivePanelChange((event) => {
|
|
7527
|
-
this.
|
|
8215
|
+
if (this._moving) {
|
|
8216
|
+
return;
|
|
8217
|
+
}
|
|
8218
|
+
if (event.panel !== this.activePanel) {
|
|
8219
|
+
return;
|
|
8220
|
+
}
|
|
8221
|
+
if (this._onDidActivePanelChange.value !== event.panel) {
|
|
8222
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
8223
|
+
}
|
|
7528
8224
|
}));
|
|
7529
8225
|
this._groups.set(view.id, { value: view, disposable });
|
|
7530
8226
|
}
|
|
7531
|
-
// TODO: must be called after the above listeners have been setup,
|
|
7532
|
-
// not an ideal pattern
|
|
8227
|
+
// TODO: must be called after the above listeners have been setup, not an ideal pattern
|
|
7533
8228
|
view.initialize();
|
|
7534
8229
|
return view;
|
|
7535
8230
|
}
|
|
@@ -7582,7 +8277,20 @@
|
|
|
7582
8277
|
});
|
|
7583
8278
|
this._onDidLayoutfromJSON = new Emitter();
|
|
7584
8279
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
8280
|
+
this._onDidRemoveGroup = new Emitter();
|
|
8281
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
8282
|
+
this._onDidAddGroup = new Emitter();
|
|
8283
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
8284
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
8285
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
7585
8286
|
this._options = options;
|
|
8287
|
+
this.addDisposables(this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
|
|
8288
|
+
this._onDidAddGroup.fire(event);
|
|
8289
|
+
}), this.onDidRemove((event) => {
|
|
8290
|
+
this._onDidRemoveGroup.fire(event);
|
|
8291
|
+
}), this.onDidActiveChange((event) => {
|
|
8292
|
+
this._onDidActiveGroupChange.fire(event);
|
|
8293
|
+
}));
|
|
7586
8294
|
if (!this.options.components) {
|
|
7587
8295
|
this.options.components = {};
|
|
7588
8296
|
}
|
|
@@ -7757,6 +8465,7 @@
|
|
|
7757
8465
|
});
|
|
7758
8466
|
this.registerPanel(view);
|
|
7759
8467
|
this.doAddGroup(view, relativeLocation, options.size);
|
|
8468
|
+
this.doSetGroupActive(view);
|
|
7760
8469
|
return view;
|
|
7761
8470
|
}
|
|
7762
8471
|
registerPanel(panel) {
|
|
@@ -8442,10 +9151,10 @@
|
|
|
8442
9151
|
this._onDidChange = new Emitter();
|
|
8443
9152
|
this.onDidChange = this._onDidChange.event;
|
|
8444
9153
|
this.api.initialize(this);
|
|
8445
|
-
this.addDisposables(this._onDidChange, this.api.
|
|
8446
|
-
const {
|
|
9154
|
+
this.addDisposables(this._onDidChange, this.api.onDidHiddenChange((event) => {
|
|
9155
|
+
const { isHidden } = event;
|
|
8447
9156
|
const { accessor } = this._params;
|
|
8448
|
-
accessor.setVisible(this,
|
|
9157
|
+
accessor.setVisible(this, !isHidden);
|
|
8449
9158
|
}), this.api.onActiveChange(() => {
|
|
8450
9159
|
const { accessor } = this._params;
|
|
8451
9160
|
accessor.setActive(this);
|
|
@@ -8567,13 +9276,13 @@
|
|
|
8567
9276
|
if (this.disposed) {
|
|
8568
9277
|
throw new Error('invalid operation: resource is already disposed');
|
|
8569
9278
|
}
|
|
8570
|
-
if (
|
|
9279
|
+
if (!isReactComponent(this.component)) {
|
|
8571
9280
|
/**
|
|
8572
9281
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
8573
|
-
* if we do not intercept
|
|
8574
|
-
* for the same reason
|
|
9282
|
+
* if we do not intercept then React library will throw a very obsure error
|
|
9283
|
+
* for the same reason... at least at this point we will emit a sensible stacktrace.
|
|
8575
9284
|
*/
|
|
8576
|
-
throw new Error('
|
|
9285
|
+
throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');
|
|
8577
9286
|
}
|
|
8578
9287
|
const bridgeComponent = React__namespace.createElement(React__namespace.forwardRef(ReactComponentBridge), {
|
|
8579
9288
|
component: this
|
|
@@ -8625,9 +9334,13 @@
|
|
|
8625
9334
|
}, []);
|
|
8626
9335
|
return [portals, addPortal];
|
|
8627
9336
|
};
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
9337
|
+
function isReactComponent(component) {
|
|
9338
|
+
/**
|
|
9339
|
+
* Yes, we could use "react-is" but that would introduce an unwanted peer dependency
|
|
9340
|
+
* so for now we will check in a rather crude fashion...
|
|
9341
|
+
*/
|
|
9342
|
+
return (typeof component === 'function' /** Functional Componnts */ ||
|
|
9343
|
+
!!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
|
|
8631
9344
|
}
|
|
8632
9345
|
|
|
8633
9346
|
class ReactPanelContentPart {
|
|
@@ -8887,6 +9600,8 @@
|
|
|
8887
9600
|
defaultRenderer: props.defaultRenderer,
|
|
8888
9601
|
debug: props.debug,
|
|
8889
9602
|
rootOverlayModel: props.rootOverlayModel,
|
|
9603
|
+
locked: props.locked,
|
|
9604
|
+
disableDnd: props.disableDnd,
|
|
8890
9605
|
});
|
|
8891
9606
|
const { clientWidth, clientHeight } = domRef.current;
|
|
8892
9607
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -8898,6 +9613,20 @@
|
|
|
8898
9613
|
dockview.dispose();
|
|
8899
9614
|
};
|
|
8900
9615
|
}, []);
|
|
9616
|
+
React__namespace.useEffect(() => {
|
|
9617
|
+
if (!dockviewRef.current) {
|
|
9618
|
+
return;
|
|
9619
|
+
}
|
|
9620
|
+
dockviewRef.current.locked = !!props.locked;
|
|
9621
|
+
}, [props.locked]);
|
|
9622
|
+
React__namespace.useEffect(() => {
|
|
9623
|
+
if (!dockviewRef.current) {
|
|
9624
|
+
return;
|
|
9625
|
+
}
|
|
9626
|
+
dockviewRef.current.updateOptions({
|
|
9627
|
+
disableDnd: props.disableDnd,
|
|
9628
|
+
});
|
|
9629
|
+
}, [props.disableDnd]);
|
|
8901
9630
|
React__namespace.useEffect(() => {
|
|
8902
9631
|
if (!dockviewRef.current) {
|
|
8903
9632
|
return () => {
|
|
@@ -8913,6 +9642,21 @@
|
|
|
8913
9642
|
disposable.dispose();
|
|
8914
9643
|
};
|
|
8915
9644
|
}, [props.onDidDrop]);
|
|
9645
|
+
React__namespace.useEffect(() => {
|
|
9646
|
+
if (!dockviewRef.current) {
|
|
9647
|
+
return () => {
|
|
9648
|
+
// noop
|
|
9649
|
+
};
|
|
9650
|
+
}
|
|
9651
|
+
const disposable = dockviewRef.current.onWillDrop((event) => {
|
|
9652
|
+
if (props.onWillDrop) {
|
|
9653
|
+
props.onWillDrop(event);
|
|
9654
|
+
}
|
|
9655
|
+
});
|
|
9656
|
+
return () => {
|
|
9657
|
+
disposable.dispose();
|
|
9658
|
+
};
|
|
9659
|
+
}, [props.onWillDrop]);
|
|
8916
9660
|
React__namespace.useEffect(() => {
|
|
8917
9661
|
if (!dockviewRef.current) {
|
|
8918
9662
|
return;
|
|
@@ -9155,7 +9899,9 @@
|
|
|
9155
9899
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
9156
9900
|
params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
|
|
9157
9901
|
api: this.api,
|
|
9158
|
-
|
|
9902
|
+
// TODO: fix casting hack
|
|
9903
|
+
containerApi: new GridviewApi(this._params
|
|
9904
|
+
.accessor),
|
|
9159
9905
|
});
|
|
9160
9906
|
}
|
|
9161
9907
|
}
|
|
@@ -9338,12 +10084,14 @@
|
|
|
9338
10084
|
exports.DockviewComponent = DockviewComponent;
|
|
9339
10085
|
exports.DockviewCompositeDisposable = CompositeDisposable;
|
|
9340
10086
|
exports.DockviewDefaultTab = DockviewDefaultTab;
|
|
10087
|
+
exports.DockviewDidDropEvent = DockviewDidDropEvent;
|
|
9341
10088
|
exports.DockviewEmitter = Emitter;
|
|
9342
10089
|
exports.DockviewGroupPanel = DockviewGroupPanel;
|
|
9343
10090
|
exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
|
|
9344
10091
|
exports.DockviewMutableDisposable = MutableDisposable;
|
|
9345
10092
|
exports.DockviewPanel = DockviewPanel;
|
|
9346
10093
|
exports.DockviewReact = DockviewReact;
|
|
10094
|
+
exports.DockviewWillDropEvent = DockviewWillDropEvent;
|
|
9347
10095
|
exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
|
|
9348
10096
|
exports.Gridview = Gridview;
|
|
9349
10097
|
exports.GridviewApi = GridviewApi;
|
|
@@ -9367,6 +10115,7 @@
|
|
|
9367
10115
|
exports.SplitviewPanel = SplitviewPanel;
|
|
9368
10116
|
exports.SplitviewReact = SplitviewReact;
|
|
9369
10117
|
exports.Tab = Tab;
|
|
10118
|
+
exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
|
|
9370
10119
|
exports.createComponent = createComponent;
|
|
9371
10120
|
exports.directionToPosition = directionToPosition;
|
|
9372
10121
|
exports.getDirectionOrientation = getDirectionOrientation;
|
|
@@ -9381,7 +10130,7 @@
|
|
|
9381
10130
|
exports.isGroupOptionsWithPanel = isGroupOptionsWithPanel;
|
|
9382
10131
|
exports.isPanelOptionsWithGroup = isPanelOptionsWithGroup;
|
|
9383
10132
|
exports.isPanelOptionsWithPanel = isPanelOptionsWithPanel;
|
|
9384
|
-
exports.
|
|
10133
|
+
exports.isReactComponent = isReactComponent;
|
|
9385
10134
|
exports.orthogonal = orthogonal;
|
|
9386
10135
|
exports.positionToDirection = positionToDirection;
|
|
9387
10136
|
exports.toTarget = toTarget;
|