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.noStyle.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
|
*/
|
|
@@ -112,6 +112,17 @@
|
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
115
|
+
class DockviewEvent {
|
|
116
|
+
constructor() {
|
|
117
|
+
this._defaultPrevented = false;
|
|
118
|
+
}
|
|
119
|
+
get defaultPrevented() {
|
|
120
|
+
return this._defaultPrevented;
|
|
121
|
+
}
|
|
122
|
+
preventDefault() {
|
|
123
|
+
this._defaultPrevented = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
115
126
|
class LeakageMonitor {
|
|
116
127
|
constructor() {
|
|
117
128
|
this.events = new Map();
|
|
@@ -155,6 +166,9 @@
|
|
|
155
166
|
}
|
|
156
167
|
Emitter.ENABLE_TRACKING = isEnabled;
|
|
157
168
|
}
|
|
169
|
+
get value() {
|
|
170
|
+
return this._last;
|
|
171
|
+
}
|
|
158
172
|
constructor(options) {
|
|
159
173
|
this.options = options;
|
|
160
174
|
this._listeners = [];
|
|
@@ -277,8 +291,12 @@
|
|
|
277
291
|
args.forEach((arg) => this._disposables.push(arg));
|
|
278
292
|
}
|
|
279
293
|
dispose() {
|
|
280
|
-
this.
|
|
294
|
+
if (this._isDisposed) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
281
297
|
this._isDisposed = true;
|
|
298
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
299
|
+
this._disposables = [];
|
|
282
300
|
}
|
|
283
301
|
}
|
|
284
302
|
class MutableDisposable {
|
|
@@ -762,6 +780,13 @@
|
|
|
762
780
|
this._endSnappingEnabled = endSnappingEnabled;
|
|
763
781
|
this.updateSashEnablement();
|
|
764
782
|
}
|
|
783
|
+
get disabled() {
|
|
784
|
+
return this._disabled;
|
|
785
|
+
}
|
|
786
|
+
set disabled(value) {
|
|
787
|
+
this._disabled = value;
|
|
788
|
+
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
789
|
+
}
|
|
765
790
|
constructor(container, options) {
|
|
766
791
|
this.container = container;
|
|
767
792
|
this.viewItems = [];
|
|
@@ -772,6 +797,7 @@
|
|
|
772
797
|
this._proportions = undefined;
|
|
773
798
|
this._startSnappingEnabled = true;
|
|
774
799
|
this._endSnappingEnabled = true;
|
|
800
|
+
this._disabled = false;
|
|
775
801
|
this._onDidSashEnd = new Emitter();
|
|
776
802
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
777
803
|
this._onDidAddView = new Emitter();
|
|
@@ -1699,7 +1725,13 @@
|
|
|
1699
1725
|
}
|
|
1700
1726
|
return exports.LayoutPriority.Normal;
|
|
1701
1727
|
}
|
|
1702
|
-
|
|
1728
|
+
get disabled() {
|
|
1729
|
+
return this.splitview.disabled;
|
|
1730
|
+
}
|
|
1731
|
+
set disabled(value) {
|
|
1732
|
+
this.splitview.disabled = value;
|
|
1733
|
+
}
|
|
1734
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, childDescriptors) {
|
|
1703
1735
|
super();
|
|
1704
1736
|
this.orientation = orientation;
|
|
1705
1737
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1744,6 +1776,7 @@
|
|
|
1744
1776
|
styles,
|
|
1745
1777
|
});
|
|
1746
1778
|
}
|
|
1779
|
+
this.disabled = disabled;
|
|
1747
1780
|
this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
|
|
1748
1781
|
this._onDidChange.fire({});
|
|
1749
1782
|
}));
|
|
@@ -1877,7 +1910,7 @@
|
|
|
1877
1910
|
}
|
|
1878
1911
|
function flipNode(node, size, orthogonalSize) {
|
|
1879
1912
|
if (node instanceof BranchNode) {
|
|
1880
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
1913
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1881
1914
|
let totalSize = 0;
|
|
1882
1915
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1883
1916
|
const child = node.children[i];
|
|
@@ -2013,31 +2046,57 @@
|
|
|
2013
2046
|
get maximumHeight() {
|
|
2014
2047
|
return this.root.maximumHeight;
|
|
2015
2048
|
}
|
|
2049
|
+
get locked() {
|
|
2050
|
+
return this._locked;
|
|
2051
|
+
}
|
|
2052
|
+
set locked(value) {
|
|
2053
|
+
this._locked = value;
|
|
2054
|
+
const branch = [this.root];
|
|
2055
|
+
/**
|
|
2056
|
+
* simple depth-first-search to cover all nodes
|
|
2057
|
+
*
|
|
2058
|
+
* @see https://en.wikipedia.org/wiki/Depth-first_search
|
|
2059
|
+
*/
|
|
2060
|
+
while (branch.length > 0) {
|
|
2061
|
+
const node = branch.pop();
|
|
2062
|
+
if (node instanceof BranchNode) {
|
|
2063
|
+
node.disabled = value;
|
|
2064
|
+
branch.push(...node.children);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2016
2068
|
maximizedView() {
|
|
2017
2069
|
var _a;
|
|
2018
|
-
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.view;
|
|
2070
|
+
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
2019
2071
|
}
|
|
2020
2072
|
hasMaximizedView() {
|
|
2021
2073
|
return this._maximizedNode !== undefined;
|
|
2022
2074
|
}
|
|
2023
2075
|
maximizeView(view) {
|
|
2076
|
+
var _a;
|
|
2024
2077
|
const location = getGridLocation(view.element);
|
|
2025
2078
|
const [_, node] = this.getNode(location);
|
|
2026
2079
|
if (!(node instanceof LeafNode)) {
|
|
2027
2080
|
return;
|
|
2028
2081
|
}
|
|
2029
|
-
if (this._maximizedNode === node) {
|
|
2082
|
+
if (((_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf) === node) {
|
|
2030
2083
|
return;
|
|
2031
2084
|
}
|
|
2032
2085
|
if (this.hasMaximizedView()) {
|
|
2033
2086
|
this.exitMaximizedView();
|
|
2034
2087
|
}
|
|
2088
|
+
const hiddenOnMaximize = [];
|
|
2035
2089
|
function hideAllViewsBut(parent, exclude) {
|
|
2036
2090
|
for (let i = 0; i < parent.children.length; i++) {
|
|
2037
2091
|
const child = parent.children[i];
|
|
2038
2092
|
if (child instanceof LeafNode) {
|
|
2039
2093
|
if (child !== exclude) {
|
|
2040
|
-
parent.
|
|
2094
|
+
if (parent.isChildVisible(i)) {
|
|
2095
|
+
parent.setChildVisible(i, false);
|
|
2096
|
+
}
|
|
2097
|
+
else {
|
|
2098
|
+
hiddenOnMaximize.push(child);
|
|
2099
|
+
}
|
|
2041
2100
|
}
|
|
2042
2101
|
}
|
|
2043
2102
|
else {
|
|
@@ -2046,18 +2105,21 @@
|
|
|
2046
2105
|
}
|
|
2047
2106
|
}
|
|
2048
2107
|
hideAllViewsBut(this.root, node);
|
|
2049
|
-
this._maximizedNode = node;
|
|
2050
|
-
this.
|
|
2108
|
+
this._maximizedNode = { leaf: node, hiddenOnMaximize };
|
|
2109
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2051
2110
|
}
|
|
2052
2111
|
exitMaximizedView() {
|
|
2053
2112
|
if (!this._maximizedNode) {
|
|
2054
2113
|
return;
|
|
2055
2114
|
}
|
|
2115
|
+
const hiddenOnMaximize = this._maximizedNode.hiddenOnMaximize;
|
|
2056
2116
|
function showViewsInReverseOrder(parent) {
|
|
2057
2117
|
for (let index = parent.children.length - 1; index >= 0; index--) {
|
|
2058
2118
|
const child = parent.children[index];
|
|
2059
2119
|
if (child instanceof LeafNode) {
|
|
2060
|
-
|
|
2120
|
+
if (!hiddenOnMaximize.includes(child)) {
|
|
2121
|
+
parent.setChildVisible(index, true);
|
|
2122
|
+
}
|
|
2061
2123
|
}
|
|
2062
2124
|
else {
|
|
2063
2125
|
showViewsInReverseOrder(child);
|
|
@@ -2066,13 +2128,13 @@
|
|
|
2066
2128
|
}
|
|
2067
2129
|
showViewsInReverseOrder(this.root);
|
|
2068
2130
|
this._maximizedNode = undefined;
|
|
2069
|
-
this.
|
|
2131
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2070
2132
|
}
|
|
2071
2133
|
serialize() {
|
|
2072
2134
|
if (this.hasMaximizedView()) {
|
|
2073
2135
|
/**
|
|
2074
|
-
* do not persist maximized view state
|
|
2075
|
-
*
|
|
2136
|
+
* do not persist maximized view state
|
|
2137
|
+
* firstly exit any maximized views to ensure the correct dimensions are persisted
|
|
2076
2138
|
*/
|
|
2077
2139
|
this.exitMaximizedView();
|
|
2078
2140
|
}
|
|
@@ -2087,14 +2149,14 @@
|
|
|
2087
2149
|
dispose() {
|
|
2088
2150
|
this.disposable.dispose();
|
|
2089
2151
|
this._onDidChange.dispose();
|
|
2090
|
-
this.
|
|
2152
|
+
this._onDidMaximizedNodeChange.dispose();
|
|
2091
2153
|
this.root.dispose();
|
|
2092
2154
|
this._maximizedNode = undefined;
|
|
2093
2155
|
this.element.remove();
|
|
2094
2156
|
}
|
|
2095
2157
|
clear() {
|
|
2096
2158
|
const orientation = this.root.orientation;
|
|
2097
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize);
|
|
2159
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this._locked);
|
|
2098
2160
|
}
|
|
2099
2161
|
deserialize(json, deserializer) {
|
|
2100
2162
|
const orientation = json.orientation;
|
|
@@ -2115,8 +2177,8 @@
|
|
|
2115
2177
|
};
|
|
2116
2178
|
});
|
|
2117
2179
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2118
|
-
orthogonalSize, // <- size - flips at each depth
|
|
2119
|
-
children);
|
|
2180
|
+
orthogonalSize, // <- size - flips at each depth,
|
|
2181
|
+
this._locked, children);
|
|
2120
2182
|
}
|
|
2121
2183
|
else {
|
|
2122
2184
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2149,7 +2211,7 @@
|
|
|
2149
2211
|
}
|
|
2150
2212
|
const oldRoot = this.root;
|
|
2151
2213
|
oldRoot.element.remove();
|
|
2152
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
|
|
2214
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this._locked);
|
|
2153
2215
|
if (oldRoot.children.length === 0) ;
|
|
2154
2216
|
else if (oldRoot.children.length === 1) {
|
|
2155
2217
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2217,15 +2279,16 @@
|
|
|
2217
2279
|
constructor(proportionalLayout, styles, orientation) {
|
|
2218
2280
|
this.proportionalLayout = proportionalLayout;
|
|
2219
2281
|
this.styles = styles;
|
|
2282
|
+
this._locked = false;
|
|
2220
2283
|
this._maximizedNode = undefined;
|
|
2221
2284
|
this.disposable = new MutableDisposable();
|
|
2222
2285
|
this._onDidChange = new Emitter();
|
|
2223
2286
|
this.onDidChange = this._onDidChange.event;
|
|
2224
|
-
this.
|
|
2225
|
-
this.
|
|
2287
|
+
this._onDidMaximizedNodeChange = new Emitter();
|
|
2288
|
+
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2226
2289
|
this.element = document.createElement('div');
|
|
2227
2290
|
this.element.className = 'grid-view';
|
|
2228
|
-
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
2291
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this._locked);
|
|
2229
2292
|
}
|
|
2230
2293
|
isViewVisible(location) {
|
|
2231
2294
|
const [rest, index] = tail(location);
|
|
@@ -2276,7 +2339,7 @@
|
|
|
2276
2339
|
}
|
|
2277
2340
|
const child = grandParent.removeChild(parentIndex);
|
|
2278
2341
|
child.dispose();
|
|
2279
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2342
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this._locked);
|
|
2280
2343
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2281
2344
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2282
2345
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2903,6 +2966,21 @@
|
|
|
2903
2966
|
get onDidDrop() {
|
|
2904
2967
|
return this.component.onDidDrop;
|
|
2905
2968
|
}
|
|
2969
|
+
/**
|
|
2970
|
+
* Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and
|
|
2971
|
+
* prevent the event from occuring using the standard `preventDefault()` syntax.
|
|
2972
|
+
*
|
|
2973
|
+
* Preventing certain events may causes unexpected behaviours, use carefully.
|
|
2974
|
+
*/
|
|
2975
|
+
get onWillDrop() {
|
|
2976
|
+
return this.component.onWillDrop;
|
|
2977
|
+
}
|
|
2978
|
+
/**
|
|
2979
|
+
*
|
|
2980
|
+
*/
|
|
2981
|
+
get onWillShowOverlay() {
|
|
2982
|
+
return this.component.onWillShowOverlay;
|
|
2983
|
+
}
|
|
2906
2984
|
/**
|
|
2907
2985
|
* Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality.
|
|
2908
2986
|
*/
|
|
@@ -3038,17 +3116,17 @@
|
|
|
3038
3116
|
hasMaximizedGroup() {
|
|
3039
3117
|
return this.component.hasMaximizedGroup();
|
|
3040
3118
|
}
|
|
3041
|
-
|
|
3119
|
+
exitMaximizedGroup() {
|
|
3042
3120
|
this.component.exitMaximizedGroup();
|
|
3043
3121
|
}
|
|
3044
|
-
get
|
|
3045
|
-
return this.component.
|
|
3122
|
+
get onDidMaximizedGroupChange() {
|
|
3123
|
+
return this.component.onDidMaximizedGroupChange;
|
|
3046
3124
|
}
|
|
3047
3125
|
/**
|
|
3048
3126
|
* Add a popout group in a new Window
|
|
3049
3127
|
*/
|
|
3050
3128
|
addPopoutGroup(item, options) {
|
|
3051
|
-
this.component.addPopoutGroup(item, options);
|
|
3129
|
+
return this.component.addPopoutGroup(item, options);
|
|
3052
3130
|
}
|
|
3053
3131
|
}
|
|
3054
3132
|
|
|
@@ -3102,6 +3180,18 @@
|
|
|
3102
3180
|
}
|
|
3103
3181
|
}
|
|
3104
3182
|
|
|
3183
|
+
class WillShowOverlayEvent extends DockviewEvent {
|
|
3184
|
+
get nativeEvent() {
|
|
3185
|
+
return this.options.nativeEvent;
|
|
3186
|
+
}
|
|
3187
|
+
get position() {
|
|
3188
|
+
return this.options.position;
|
|
3189
|
+
}
|
|
3190
|
+
constructor(options) {
|
|
3191
|
+
super();
|
|
3192
|
+
this.options = options;
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3105
3195
|
function directionToPosition(direction) {
|
|
3106
3196
|
switch (direction) {
|
|
3107
3197
|
case 'above':
|
|
@@ -3154,6 +3244,8 @@
|
|
|
3154
3244
|
this.options = options;
|
|
3155
3245
|
this._onDrop = new Emitter();
|
|
3156
3246
|
this.onDrop = this._onDrop.event;
|
|
3247
|
+
this._onWillShowOverlay = new Emitter();
|
|
3248
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3157
3249
|
// use a set to take advantage of #<set>.has
|
|
3158
3250
|
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
3159
3251
|
this.dnd = new DragAndDropObserver(this.element, {
|
|
@@ -3182,6 +3274,19 @@
|
|
|
3182
3274
|
this.removeDropTarget();
|
|
3183
3275
|
return;
|
|
3184
3276
|
}
|
|
3277
|
+
const willShowOverlayEvent = new WillShowOverlayEvent({
|
|
3278
|
+
nativeEvent: e,
|
|
3279
|
+
position: quadrant,
|
|
3280
|
+
});
|
|
3281
|
+
/**
|
|
3282
|
+
* Provide an opportunity to prevent the overlay appearing and in turn
|
|
3283
|
+
* any dnd behaviours
|
|
3284
|
+
*/
|
|
3285
|
+
this._onWillShowOverlay.fire(willShowOverlayEvent);
|
|
3286
|
+
if (willShowOverlayEvent.defaultPrevented) {
|
|
3287
|
+
this.removeDropTarget();
|
|
3288
|
+
return;
|
|
3289
|
+
}
|
|
3185
3290
|
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
3186
3291
|
if (!this.options.canDisplayOverlay) {
|
|
3187
3292
|
this.removeDropTarget();
|
|
@@ -3224,7 +3329,7 @@
|
|
|
3224
3329
|
}
|
|
3225
3330
|
},
|
|
3226
3331
|
});
|
|
3227
|
-
this.addDisposables(this._onDrop, this.dnd);
|
|
3332
|
+
this.addDisposables(this._onDrop, this._onWillShowOverlay, this.dnd);
|
|
3228
3333
|
}
|
|
3229
3334
|
setTargetZones(acceptedTargetZones) {
|
|
3230
3335
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
@@ -3277,25 +3382,44 @@
|
|
|
3277
3382
|
size = clamp(0, sizeOptions.value, height) / height;
|
|
3278
3383
|
}
|
|
3279
3384
|
}
|
|
3280
|
-
const
|
|
3281
|
-
|
|
3282
|
-
|
|
3385
|
+
const box = { top: '0px', left: '0px', width: '100%', height: '100%' };
|
|
3386
|
+
/**
|
|
3387
|
+
* You can also achieve the overlay placement using the transform CSS property
|
|
3388
|
+
* to translate and scale the element however this has the undesired effect of
|
|
3389
|
+
* 'skewing' the element. Comment left here for anybody that ever revisits this.
|
|
3390
|
+
*
|
|
3391
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
|
3392
|
+
*
|
|
3393
|
+
* right
|
|
3394
|
+
* translateX(${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3395
|
+
*
|
|
3396
|
+
* left
|
|
3397
|
+
* translateX(-${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3398
|
+
*
|
|
3399
|
+
* top
|
|
3400
|
+
* translateY(-${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3401
|
+
*
|
|
3402
|
+
* bottom
|
|
3403
|
+
* translateY(${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3404
|
+
*/
|
|
3283
3405
|
if (rightClass) {
|
|
3284
|
-
|
|
3406
|
+
box.left = `${100 * (1 - size)}%`;
|
|
3407
|
+
box.width = `${100 * size}%`;
|
|
3285
3408
|
}
|
|
3286
3409
|
else if (leftClass) {
|
|
3287
|
-
|
|
3410
|
+
box.width = `${100 * size}%`;
|
|
3288
3411
|
}
|
|
3289
3412
|
else if (topClass) {
|
|
3290
|
-
|
|
3413
|
+
box.height = `${100 * size}%`;
|
|
3291
3414
|
}
|
|
3292
3415
|
else if (bottomClass) {
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
else {
|
|
3296
|
-
transform = '';
|
|
3416
|
+
box.top = `${100 * (1 - size)}%`;
|
|
3417
|
+
box.height = `${100 * size}%`;
|
|
3297
3418
|
}
|
|
3298
|
-
this.overlayElement.style.
|
|
3419
|
+
this.overlayElement.style.top = box.top;
|
|
3420
|
+
this.overlayElement.style.left = box.left;
|
|
3421
|
+
this.overlayElement.style.width = box.width;
|
|
3422
|
+
this.overlayElement.style.height = box.height;
|
|
3299
3423
|
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3300
3424
|
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3301
3425
|
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
@@ -3363,14 +3487,6 @@
|
|
|
3363
3487
|
return 'center';
|
|
3364
3488
|
}
|
|
3365
3489
|
|
|
3366
|
-
exports.DockviewDropTargets = void 0;
|
|
3367
|
-
(function (DockviewDropTargets) {
|
|
3368
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3369
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3370
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3371
|
-
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3372
|
-
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3373
|
-
|
|
3374
3490
|
class ContentContainer extends CompositeDisposable {
|
|
3375
3491
|
get element() {
|
|
3376
3492
|
return this._element;
|
|
@@ -3398,7 +3514,7 @@
|
|
|
3398
3514
|
const data = getPanelData();
|
|
3399
3515
|
if (!data &&
|
|
3400
3516
|
event.shiftKey &&
|
|
3401
|
-
this.group.location !== 'floating') {
|
|
3517
|
+
this.group.location.type !== 'floating') {
|
|
3402
3518
|
return false;
|
|
3403
3519
|
}
|
|
3404
3520
|
if (data && data.viewId === this.accessor.id) {
|
|
@@ -3416,7 +3532,7 @@
|
|
|
3416
3532
|
data.groupId === this.group.id;
|
|
3417
3533
|
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3418
3534
|
}
|
|
3419
|
-
return this.group.canDisplayOverlay(event, position,
|
|
3535
|
+
return this.group.canDisplayOverlay(event, position, 'panel');
|
|
3420
3536
|
},
|
|
3421
3537
|
});
|
|
3422
3538
|
this.addDisposables(this.dropTarget);
|
|
@@ -3441,7 +3557,7 @@
|
|
|
3441
3557
|
let container;
|
|
3442
3558
|
switch (panel.api.renderer) {
|
|
3443
3559
|
case 'onlyWhenVisibile':
|
|
3444
|
-
this.
|
|
3560
|
+
this.group.renderContainer.detatch(panel);
|
|
3445
3561
|
if (this.panel) {
|
|
3446
3562
|
if (doRender) {
|
|
3447
3563
|
this._element.appendChild(this.panel.view.content.element);
|
|
@@ -3453,7 +3569,7 @@
|
|
|
3453
3569
|
if (panel.view.content.element.parentElement === this._element) {
|
|
3454
3570
|
this._element.removeChild(panel.view.content.element);
|
|
3455
3571
|
}
|
|
3456
|
-
container = this.
|
|
3572
|
+
container = this.group.renderContainer.attach({
|
|
3457
3573
|
panel,
|
|
3458
3574
|
referenceContainer: this,
|
|
3459
3575
|
});
|
|
@@ -3484,9 +3600,10 @@
|
|
|
3484
3600
|
// noop
|
|
3485
3601
|
}
|
|
3486
3602
|
closePanel() {
|
|
3603
|
+
var _a;
|
|
3487
3604
|
if (this.panel) {
|
|
3488
3605
|
if (this.panel.api.renderer === 'onlyWhenVisibile') {
|
|
3489
|
-
this.
|
|
3606
|
+
(_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
|
|
3490
3607
|
}
|
|
3491
3608
|
}
|
|
3492
3609
|
this.panel = undefined;
|
|
@@ -3597,7 +3714,7 @@
|
|
|
3597
3714
|
this._element.draggable = true;
|
|
3598
3715
|
toggleClass(this.element, 'inactive-tab', true);
|
|
3599
3716
|
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
3600
|
-
this.
|
|
3717
|
+
this.dropTarget = new Droptarget(this._element, {
|
|
3601
3718
|
acceptedTargetZones: ['center'],
|
|
3602
3719
|
canDisplayOverlay: (event, position) => {
|
|
3603
3720
|
if (this.group.locked) {
|
|
@@ -3612,9 +3729,10 @@
|
|
|
3612
3729
|
}
|
|
3613
3730
|
return this.panel.id !== data.panelId;
|
|
3614
3731
|
}
|
|
3615
|
-
return this.group.model.canDisplayOverlay(event, position,
|
|
3732
|
+
return this.group.model.canDisplayOverlay(event, position, 'tab');
|
|
3616
3733
|
},
|
|
3617
3734
|
});
|
|
3735
|
+
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
3618
3736
|
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
3619
3737
|
this._onDragStart.fire(event);
|
|
3620
3738
|
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
@@ -3622,9 +3740,9 @@
|
|
|
3622
3740
|
return;
|
|
3623
3741
|
}
|
|
3624
3742
|
this._onChanged.fire(event);
|
|
3625
|
-
}), this.
|
|
3743
|
+
}), this.dropTarget.onDrop((event) => {
|
|
3626
3744
|
this._onDropped.fire(event);
|
|
3627
|
-
}), this.
|
|
3745
|
+
}), this.dropTarget);
|
|
3628
3746
|
}
|
|
3629
3747
|
setActive(isActive) {
|
|
3630
3748
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -3671,7 +3789,7 @@
|
|
|
3671
3789
|
}, true));
|
|
3672
3790
|
}
|
|
3673
3791
|
isCancelled(_event) {
|
|
3674
|
-
if (this.group.api.location === 'floating' && !_event.shiftKey) {
|
|
3792
|
+
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
3675
3793
|
return true;
|
|
3676
3794
|
}
|
|
3677
3795
|
return false;
|
|
@@ -3723,7 +3841,7 @@
|
|
|
3723
3841
|
this.accessor.doSetGroupActive(this.group);
|
|
3724
3842
|
}));
|
|
3725
3843
|
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3726
|
-
this.
|
|
3844
|
+
this.dropTraget = new Droptarget(this._element, {
|
|
3727
3845
|
acceptedTargetZones: ['center'],
|
|
3728
3846
|
canDisplayOverlay: (event, position) => {
|
|
3729
3847
|
var _a;
|
|
@@ -3737,14 +3855,15 @@
|
|
|
3737
3855
|
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
3738
3856
|
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
3739
3857
|
}
|
|
3740
|
-
return group.model.canDisplayOverlay(event, position,
|
|
3858
|
+
return group.model.canDisplayOverlay(event, position, 'panel');
|
|
3741
3859
|
},
|
|
3742
3860
|
});
|
|
3861
|
+
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
3743
3862
|
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3744
3863
|
this._onDragStart.fire(event);
|
|
3745
|
-
}), this.
|
|
3864
|
+
}), this.dropTraget.onDrop((event) => {
|
|
3746
3865
|
this._onDrop.fire(event);
|
|
3747
|
-
}), this.
|
|
3866
|
+
}), this.dropTraget);
|
|
3748
3867
|
}
|
|
3749
3868
|
}
|
|
3750
3869
|
|
|
@@ -3832,19 +3951,11 @@
|
|
|
3832
3951
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
3833
3952
|
this._onGroupDragStart = new Emitter();
|
|
3834
3953
|
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3835
|
-
this.
|
|
3954
|
+
this._onWillShowOverlay = new Emitter();
|
|
3955
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3836
3956
|
this._element = document.createElement('div');
|
|
3837
3957
|
this._element.className = 'tabs-and-actions-container';
|
|
3838
3958
|
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
3839
|
-
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3840
|
-
if (e.api.group === this.group) {
|
|
3841
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3842
|
-
}
|
|
3843
|
-
}), this.accessor.onDidRemovePanel((e) => {
|
|
3844
|
-
if (e.api.group === this.group) {
|
|
3845
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3846
|
-
}
|
|
3847
|
-
}));
|
|
3848
3959
|
this.rightActionsContainer = document.createElement('div');
|
|
3849
3960
|
this.rightActionsContainer.className = 'right-actions-container';
|
|
3850
3961
|
this.leftActionsContainer = document.createElement('div');
|
|
@@ -3859,7 +3970,15 @@
|
|
|
3859
3970
|
this._element.appendChild(this.leftActionsContainer);
|
|
3860
3971
|
this._element.appendChild(this.voidContainer.element);
|
|
3861
3972
|
this._element.appendChild(this.rightActionsContainer);
|
|
3862
|
-
this.addDisposables(this.
|
|
3973
|
+
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3974
|
+
if (e.api.group === this.group) {
|
|
3975
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3976
|
+
}
|
|
3977
|
+
}), this.accessor.onDidRemovePanel((e) => {
|
|
3978
|
+
if (e.api.group === this.group) {
|
|
3979
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3980
|
+
}
|
|
3981
|
+
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3863
3982
|
this._onGroupDragStart.fire({
|
|
3864
3983
|
nativeEvent: event,
|
|
3865
3984
|
group: this.group,
|
|
@@ -3869,11 +3988,15 @@
|
|
|
3869
3988
|
event: event.nativeEvent,
|
|
3870
3989
|
index: this.tabs.length,
|
|
3871
3990
|
});
|
|
3991
|
+
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
3992
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
3993
|
+
kind: 'header_space',
|
|
3994
|
+
}));
|
|
3872
3995
|
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
3873
3996
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3874
3997
|
if (isFloatingGroupsEnabled &&
|
|
3875
3998
|
event.shiftKey &&
|
|
3876
|
-
this.group.api.location !== 'floating') {
|
|
3999
|
+
this.group.api.location.type !== 'floating') {
|
|
3877
4000
|
event.preventDefault();
|
|
3878
4001
|
const { top, left } = this.element.getBoundingClientRect();
|
|
3879
4002
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
@@ -3936,9 +4059,9 @@
|
|
|
3936
4059
|
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
3937
4060
|
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
3938
4061
|
}), tab.onChanged((event) => {
|
|
3939
|
-
var _a;
|
|
3940
4062
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3941
|
-
const isFloatingWithOnePanel = this.group.api.location === 'floating' &&
|
|
4063
|
+
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
4064
|
+
this.size === 1;
|
|
3942
4065
|
if (isFloatingGroupsEnabled &&
|
|
3943
4066
|
!isFloatingWithOnePanel &&
|
|
3944
4067
|
event.shiftKey) {
|
|
@@ -3952,20 +4075,20 @@
|
|
|
3952
4075
|
}, { inDragMode: true });
|
|
3953
4076
|
return;
|
|
3954
4077
|
}
|
|
3955
|
-
const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
3956
|
-
this.group.model.isContentFocused;
|
|
3957
4078
|
const isLeftClick = event.button === 0;
|
|
3958
4079
|
if (!isLeftClick || event.defaultPrevented) {
|
|
3959
4080
|
return;
|
|
3960
4081
|
}
|
|
3961
|
-
this.group.
|
|
3962
|
-
|
|
3963
|
-
}
|
|
4082
|
+
if (this.group.activePanel !== panel) {
|
|
4083
|
+
this.group.model.openPanel(panel);
|
|
4084
|
+
}
|
|
3964
4085
|
}), tab.onDrop((event) => {
|
|
3965
4086
|
this._onDrop.fire({
|
|
3966
4087
|
event: event.nativeEvent,
|
|
3967
4088
|
index: this.tabs.findIndex((x) => x.value === tab),
|
|
3968
4089
|
});
|
|
4090
|
+
}), tab.onWillShowOverlay((event) => {
|
|
4091
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, { kind: 'tab' }));
|
|
3969
4092
|
}));
|
|
3970
4093
|
const value = { value: tab, disposable };
|
|
3971
4094
|
this.addTab(value, index);
|
|
@@ -3983,6 +4106,60 @@
|
|
|
3983
4106
|
}
|
|
3984
4107
|
}
|
|
3985
4108
|
|
|
4109
|
+
class DockviewDidDropEvent extends DockviewEvent {
|
|
4110
|
+
get nativeEvent() {
|
|
4111
|
+
return this.options.nativeEvent;
|
|
4112
|
+
}
|
|
4113
|
+
get position() {
|
|
4114
|
+
return this.options.position;
|
|
4115
|
+
}
|
|
4116
|
+
get panel() {
|
|
4117
|
+
return this.options.panel;
|
|
4118
|
+
}
|
|
4119
|
+
get group() {
|
|
4120
|
+
return this.options.group;
|
|
4121
|
+
}
|
|
4122
|
+
get api() {
|
|
4123
|
+
return this.options.api;
|
|
4124
|
+
}
|
|
4125
|
+
constructor(options) {
|
|
4126
|
+
super();
|
|
4127
|
+
this.options = options;
|
|
4128
|
+
}
|
|
4129
|
+
getData() {
|
|
4130
|
+
return this.options.getData();
|
|
4131
|
+
}
|
|
4132
|
+
}
|
|
4133
|
+
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4134
|
+
get kind() {
|
|
4135
|
+
return this._kind;
|
|
4136
|
+
}
|
|
4137
|
+
constructor(options) {
|
|
4138
|
+
super(options);
|
|
4139
|
+
this._kind = options.kind;
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
class WillShowOverlayLocationEvent {
|
|
4143
|
+
get kind() {
|
|
4144
|
+
return this._kind;
|
|
4145
|
+
}
|
|
4146
|
+
get nativeEvent() {
|
|
4147
|
+
return this.event.nativeEvent;
|
|
4148
|
+
}
|
|
4149
|
+
get position() {
|
|
4150
|
+
return this.event.position;
|
|
4151
|
+
}
|
|
4152
|
+
get defaultPrevented() {
|
|
4153
|
+
return this.event.defaultPrevented;
|
|
4154
|
+
}
|
|
4155
|
+
preventDefault() {
|
|
4156
|
+
this.event.preventDefault();
|
|
4157
|
+
}
|
|
4158
|
+
constructor(event, options) {
|
|
4159
|
+
this.event = event;
|
|
4160
|
+
this._kind = options.kind;
|
|
4161
|
+
}
|
|
4162
|
+
}
|
|
3986
4163
|
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
3987
4164
|
get element() {
|
|
3988
4165
|
throw new Error('not supported');
|
|
@@ -4028,7 +4205,7 @@
|
|
|
4028
4205
|
this._location = value;
|
|
4029
4206
|
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4030
4207
|
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4031
|
-
switch (value) {
|
|
4208
|
+
switch (value.type) {
|
|
4032
4209
|
case 'grid':
|
|
4033
4210
|
this.contentContainer.dropTarget.setTargetZones([
|
|
4034
4211
|
'top',
|
|
@@ -4064,7 +4241,7 @@
|
|
|
4064
4241
|
this.groupPanel = groupPanel;
|
|
4065
4242
|
this._isGroupActive = false;
|
|
4066
4243
|
this._locked = false;
|
|
4067
|
-
this._location = 'grid';
|
|
4244
|
+
this._location = { type: 'grid' };
|
|
4068
4245
|
this.mostRecentlyUsed = [];
|
|
4069
4246
|
this._onDidChange = new Emitter();
|
|
4070
4247
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -4075,6 +4252,10 @@
|
|
|
4075
4252
|
this.onMove = this._onMove.event;
|
|
4076
4253
|
this._onDidDrop = new Emitter();
|
|
4077
4254
|
this.onDidDrop = this._onDidDrop.event;
|
|
4255
|
+
this._onWillDrop = new Emitter();
|
|
4256
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
4257
|
+
this._onWillShowOverlay = new Emitter();
|
|
4258
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4078
4259
|
this._onTabDragStart = new Emitter();
|
|
4079
4260
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
4080
4261
|
this._onGroupDragStart = new Emitter();
|
|
@@ -4085,46 +4266,69 @@
|
|
|
4085
4266
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4086
4267
|
this._onDidActivePanelChange = new Emitter();
|
|
4087
4268
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4269
|
+
this._overwriteRenderContainer = null;
|
|
4088
4270
|
toggleClass(this.container, 'groupview', true);
|
|
4271
|
+
this._api = new DockviewApi(this.accessor);
|
|
4089
4272
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
4090
4273
|
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
4091
4274
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
4092
4275
|
this.header.hidden = !!options.hideHeader;
|
|
4093
4276
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
4094
|
-
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this.tabsContainer.onTabDragStart((event) => {
|
|
4277
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
4095
4278
|
this._onTabDragStart.fire(event);
|
|
4096
4279
|
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
4097
4280
|
this._onGroupDragStart.fire(event);
|
|
4098
4281
|
}), this.tabsContainer.onDrop((event) => {
|
|
4099
|
-
this.handleDropEvent(event.event, 'center', event.index);
|
|
4282
|
+
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
4100
4283
|
}), this.contentContainer.onDidFocus(() => {
|
|
4101
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4284
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4102
4285
|
}), this.contentContainer.onDidBlur(() => {
|
|
4103
4286
|
// noop
|
|
4104
4287
|
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
4105
|
-
this.handleDropEvent(event.nativeEvent, event.position);
|
|
4106
|
-
}), this.
|
|
4288
|
+
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
4289
|
+
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
4290
|
+
this._onWillShowOverlay.fire(event);
|
|
4291
|
+
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
4292
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4293
|
+
kind: 'content',
|
|
4294
|
+
}));
|
|
4295
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
4296
|
+
}
|
|
4297
|
+
focusContent() {
|
|
4298
|
+
this.contentContainer.element.focus();
|
|
4299
|
+
}
|
|
4300
|
+
set renderContainer(value) {
|
|
4301
|
+
this.panels.forEach((panel) => {
|
|
4302
|
+
this.renderContainer.detatch(panel);
|
|
4303
|
+
});
|
|
4304
|
+
this._overwriteRenderContainer = value;
|
|
4305
|
+
this.panels.forEach((panel) => {
|
|
4306
|
+
this.rerender(panel);
|
|
4307
|
+
});
|
|
4308
|
+
}
|
|
4309
|
+
get renderContainer() {
|
|
4310
|
+
var _a;
|
|
4311
|
+
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
4107
4312
|
}
|
|
4108
4313
|
initialize() {
|
|
4109
|
-
|
|
4110
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
|
|
4314
|
+
if (this.options.panels) {
|
|
4111
4315
|
this.options.panels.forEach((panel) => {
|
|
4112
4316
|
this.doAddPanel(panel);
|
|
4113
4317
|
});
|
|
4114
4318
|
}
|
|
4115
|
-
if (
|
|
4319
|
+
if (this.options.activePanel) {
|
|
4116
4320
|
this.openPanel(this.options.activePanel);
|
|
4117
4321
|
}
|
|
4118
4322
|
// must be run after the constructor otherwise this.parent may not be
|
|
4119
4323
|
// correctly initialized
|
|
4120
|
-
this.setActive(this.isActive, true
|
|
4324
|
+
this.setActive(this.isActive, true);
|
|
4121
4325
|
this.updateContainer();
|
|
4122
4326
|
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
4123
4327
|
this._rightHeaderActions =
|
|
4124
4328
|
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
4125
4329
|
this.addDisposables(this._rightHeaderActions);
|
|
4126
4330
|
this._rightHeaderActions.init({
|
|
4127
|
-
containerApi:
|
|
4331
|
+
containerApi: this._api,
|
|
4128
4332
|
api: this.groupPanel.api,
|
|
4129
4333
|
});
|
|
4130
4334
|
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
@@ -4134,7 +4338,7 @@
|
|
|
4134
4338
|
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
4135
4339
|
this.addDisposables(this._leftHeaderActions);
|
|
4136
4340
|
this._leftHeaderActions.init({
|
|
4137
|
-
containerApi:
|
|
4341
|
+
containerApi: this._api,
|
|
4138
4342
|
api: this.groupPanel.api,
|
|
4139
4343
|
});
|
|
4140
4344
|
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
@@ -4144,7 +4348,7 @@
|
|
|
4144
4348
|
this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
|
|
4145
4349
|
this.addDisposables(this._prefixHeaderActions);
|
|
4146
4350
|
this._prefixHeaderActions.init({
|
|
4147
|
-
containerApi:
|
|
4351
|
+
containerApi: this._api,
|
|
4148
4352
|
api: this.groupPanel.api,
|
|
4149
4353
|
});
|
|
4150
4354
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
@@ -4224,35 +4428,45 @@
|
|
|
4224
4428
|
//noop
|
|
4225
4429
|
}
|
|
4226
4430
|
focus() {
|
|
4227
|
-
var _a
|
|
4228
|
-
(
|
|
4431
|
+
var _a;
|
|
4432
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4229
4433
|
}
|
|
4230
4434
|
openPanel(panel, options = {}) {
|
|
4435
|
+
/**
|
|
4436
|
+
* set the panel group
|
|
4437
|
+
* add the panel
|
|
4438
|
+
* check if group active
|
|
4439
|
+
* check if panel active
|
|
4440
|
+
*/
|
|
4231
4441
|
if (typeof options.index !== 'number' ||
|
|
4232
4442
|
options.index > this.panels.length) {
|
|
4233
4443
|
options.index = this.panels.length;
|
|
4234
4444
|
}
|
|
4235
|
-
const
|
|
4236
|
-
const skipSetGroupActive = !!options.skipSetGroupActive;
|
|
4445
|
+
const skipSetActive = !!options.skipSetActive;
|
|
4237
4446
|
// ensure the group is updated before we fire any events
|
|
4238
|
-
panel.updateParentGroup(this.groupPanel,
|
|
4447
|
+
panel.updateParentGroup(this.groupPanel, {
|
|
4448
|
+
skipSetActive: options.skipSetActive,
|
|
4449
|
+
});
|
|
4450
|
+
this.doAddPanel(panel, options.index, {
|
|
4451
|
+
skipSetActive: skipSetActive,
|
|
4452
|
+
});
|
|
4239
4453
|
if (this._activePanel === panel) {
|
|
4240
|
-
if (!skipSetGroupActive) {
|
|
4241
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4242
|
-
}
|
|
4243
4454
|
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
4244
4455
|
return;
|
|
4245
4456
|
}
|
|
4246
|
-
|
|
4247
|
-
if (!skipSetPanelActive) {
|
|
4457
|
+
if (!skipSetActive) {
|
|
4248
4458
|
this.doSetActivePanel(panel);
|
|
4249
4459
|
}
|
|
4250
|
-
if (!skipSetGroupActive) {
|
|
4251
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4460
|
+
if (!options.skipSetGroupActive) {
|
|
4461
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4462
|
+
}
|
|
4463
|
+
if (!options.skipSetActive) {
|
|
4464
|
+
this.updateContainer();
|
|
4252
4465
|
}
|
|
4253
|
-
this.updateContainer();
|
|
4254
4466
|
}
|
|
4255
|
-
removePanel(groupItemOrId
|
|
4467
|
+
removePanel(groupItemOrId, options = {
|
|
4468
|
+
skipSetActive: false,
|
|
4469
|
+
}) {
|
|
4256
4470
|
const id = typeof groupItemOrId === 'string'
|
|
4257
4471
|
? groupItemOrId
|
|
4258
4472
|
: groupItemOrId.id;
|
|
@@ -4260,7 +4474,7 @@
|
|
|
4260
4474
|
if (!panelToRemove) {
|
|
4261
4475
|
throw new Error('invalid operation');
|
|
4262
4476
|
}
|
|
4263
|
-
return this._removePanel(panelToRemove);
|
|
4477
|
+
return this._removePanel(panelToRemove, options);
|
|
4264
4478
|
}
|
|
4265
4479
|
closeAllPanels() {
|
|
4266
4480
|
if (this.panels.length > 0) {
|
|
@@ -4286,12 +4500,8 @@
|
|
|
4286
4500
|
updateActions(element) {
|
|
4287
4501
|
this.tabsContainer.setRightActionsElement(element);
|
|
4288
4502
|
}
|
|
4289
|
-
setActive(isGroupActive,
|
|
4290
|
-
var _a, _b, _c, _d;
|
|
4503
|
+
setActive(isGroupActive, force = false) {
|
|
4291
4504
|
if (!force && this.isActive === isGroupActive) {
|
|
4292
|
-
if (!skipFocus) {
|
|
4293
|
-
(_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4294
|
-
}
|
|
4295
4505
|
return;
|
|
4296
4506
|
}
|
|
4297
4507
|
this._isGroupActive = isGroupActive;
|
|
@@ -4302,11 +4512,6 @@
|
|
|
4302
4512
|
this.doSetActivePanel(this.panels[0]);
|
|
4303
4513
|
}
|
|
4304
4514
|
this.updateContainer();
|
|
4305
|
-
if (isGroupActive) {
|
|
4306
|
-
if (!skipFocus) {
|
|
4307
|
-
(_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
4308
|
-
}
|
|
4309
|
-
}
|
|
4310
4515
|
}
|
|
4311
4516
|
layout(width, height) {
|
|
4312
4517
|
var _a;
|
|
@@ -4317,17 +4522,22 @@
|
|
|
4317
4522
|
this._activePanel.layout(this._width, this._height);
|
|
4318
4523
|
}
|
|
4319
4524
|
}
|
|
4320
|
-
_removePanel(panel) {
|
|
4525
|
+
_removePanel(panel, options) {
|
|
4321
4526
|
const isActivePanel = this._activePanel === panel;
|
|
4322
4527
|
this.doRemovePanel(panel);
|
|
4323
4528
|
if (isActivePanel && this.panels.length > 0) {
|
|
4324
4529
|
const nextPanel = this.mostRecentlyUsed[0];
|
|
4325
|
-
this.openPanel(nextPanel
|
|
4530
|
+
this.openPanel(nextPanel, {
|
|
4531
|
+
skipSetActive: options.skipSetActive,
|
|
4532
|
+
skipSetGroupActive: options.skipSetActiveGroup,
|
|
4533
|
+
});
|
|
4326
4534
|
}
|
|
4327
4535
|
if (this._activePanel && this.panels.length === 0) {
|
|
4328
4536
|
this.doSetActivePanel(undefined);
|
|
4329
4537
|
}
|
|
4330
|
-
|
|
4538
|
+
if (!options.skipSetActive) {
|
|
4539
|
+
this.updateContainer();
|
|
4540
|
+
}
|
|
4331
4541
|
return panel;
|
|
4332
4542
|
}
|
|
4333
4543
|
doRemovePanel(panel) {
|
|
@@ -4342,13 +4552,13 @@
|
|
|
4342
4552
|
}
|
|
4343
4553
|
this._onDidRemovePanel.fire({ panel });
|
|
4344
4554
|
}
|
|
4345
|
-
doAddPanel(panel, index = this.panels.length,
|
|
4555
|
+
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
4346
4556
|
const existingPanel = this._panels.indexOf(panel);
|
|
4347
4557
|
const hasExistingPanel = existingPanel > -1;
|
|
4348
4558
|
this.tabsContainer.show();
|
|
4349
4559
|
this.contentContainer.show();
|
|
4350
4560
|
this.tabsContainer.openPanel(panel, index);
|
|
4351
|
-
if (!skipSetActive) {
|
|
4561
|
+
if (!options.skipSetActive) {
|
|
4352
4562
|
this.contentContainer.openPanel(panel);
|
|
4353
4563
|
}
|
|
4354
4564
|
if (hasExistingPanel) {
|
|
@@ -4360,12 +4570,17 @@
|
|
|
4360
4570
|
this._onDidAddPanel.fire({ panel });
|
|
4361
4571
|
}
|
|
4362
4572
|
doSetActivePanel(panel) {
|
|
4573
|
+
if (this._activePanel === panel) {
|
|
4574
|
+
return;
|
|
4575
|
+
}
|
|
4363
4576
|
this._activePanel = panel;
|
|
4364
4577
|
if (panel) {
|
|
4365
4578
|
this.tabsContainer.setActivePanel(panel);
|
|
4366
4579
|
panel.layout(this._width, this._height);
|
|
4367
4580
|
this.updateMru(panel);
|
|
4368
|
-
this._onDidActivePanelChange.fire({
|
|
4581
|
+
this._onDidActivePanelChange.fire({
|
|
4582
|
+
panel,
|
|
4583
|
+
});
|
|
4369
4584
|
}
|
|
4370
4585
|
}
|
|
4371
4586
|
updateMru(panel) {
|
|
@@ -4377,11 +4592,11 @@
|
|
|
4377
4592
|
updateContainer() {
|
|
4378
4593
|
var _a, _b;
|
|
4379
4594
|
toggleClass(this.container, 'empty', this.isEmpty);
|
|
4380
|
-
this.panels.forEach((panel) => panel.
|
|
4595
|
+
this.panels.forEach((panel) => panel.runEvents());
|
|
4381
4596
|
if (this.isEmpty && !this.watermark) {
|
|
4382
4597
|
const watermark = this.accessor.createWatermarkComponent();
|
|
4383
4598
|
watermark.init({
|
|
4384
|
-
containerApi:
|
|
4599
|
+
containerApi: this._api,
|
|
4385
4600
|
group: this.groupPanel,
|
|
4386
4601
|
});
|
|
4387
4602
|
this.watermark = watermark;
|
|
@@ -4414,10 +4629,32 @@
|
|
|
4414
4629
|
}
|
|
4415
4630
|
return false;
|
|
4416
4631
|
}
|
|
4417
|
-
handleDropEvent(event, position, index) {
|
|
4632
|
+
handleDropEvent(type, event, position, index) {
|
|
4418
4633
|
if (this.locked === 'no-drop-target') {
|
|
4419
4634
|
return;
|
|
4420
4635
|
}
|
|
4636
|
+
function getKind() {
|
|
4637
|
+
switch (type) {
|
|
4638
|
+
case 'header':
|
|
4639
|
+
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
4640
|
+
case 'content':
|
|
4641
|
+
return 'content';
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
4645
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
4646
|
+
nativeEvent: event,
|
|
4647
|
+
position,
|
|
4648
|
+
panel,
|
|
4649
|
+
getData: () => getPanelData(),
|
|
4650
|
+
kind: getKind(),
|
|
4651
|
+
group: this.groupPanel,
|
|
4652
|
+
api: this._api,
|
|
4653
|
+
});
|
|
4654
|
+
this._onWillDrop.fire(willDropEvent);
|
|
4655
|
+
if (willDropEvent.defaultPrevented) {
|
|
4656
|
+
return;
|
|
4657
|
+
}
|
|
4421
4658
|
const data = getPanelData();
|
|
4422
4659
|
if (data && data.viewId === this.accessor.id) {
|
|
4423
4660
|
if (data.panelId === null) {
|
|
@@ -4450,12 +4687,14 @@
|
|
|
4450
4687
|
});
|
|
4451
4688
|
}
|
|
4452
4689
|
else {
|
|
4453
|
-
this._onDidDrop.fire({
|
|
4690
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
4454
4691
|
nativeEvent: event,
|
|
4455
4692
|
position,
|
|
4456
|
-
|
|
4693
|
+
panel,
|
|
4457
4694
|
getData: () => getPanelData(),
|
|
4458
|
-
|
|
4695
|
+
group: this.groupPanel,
|
|
4696
|
+
api: this._api,
|
|
4697
|
+
}));
|
|
4459
4698
|
}
|
|
4460
4699
|
}
|
|
4461
4700
|
dispose() {
|
|
@@ -4463,6 +4702,7 @@
|
|
|
4463
4702
|
super.dispose();
|
|
4464
4703
|
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
4465
4704
|
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4705
|
+
this.watermark = undefined;
|
|
4466
4706
|
for (const panel of this.panels) {
|
|
4467
4707
|
panel.dispose();
|
|
4468
4708
|
}
|
|
@@ -4484,15 +4724,7 @@
|
|
|
4484
4724
|
constructor(parentElement, disableResizing = false) {
|
|
4485
4725
|
super();
|
|
4486
4726
|
this._disableResizing = disableResizing;
|
|
4487
|
-
|
|
4488
|
-
this._element = parentElement;
|
|
4489
|
-
}
|
|
4490
|
-
else {
|
|
4491
|
-
this._element = document.createElement('div');
|
|
4492
|
-
this._element.style.height = '100%';
|
|
4493
|
-
this._element.style.width = '100%';
|
|
4494
|
-
this._element.className = 'dv-resizable-container';
|
|
4495
|
-
}
|
|
4727
|
+
this._element = parentElement;
|
|
4496
4728
|
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
4497
4729
|
if (this.isDisposed) {
|
|
4498
4730
|
/**
|
|
@@ -4580,25 +4812,38 @@
|
|
|
4580
4812
|
get activeGroup() {
|
|
4581
4813
|
return this._activeGroup;
|
|
4582
4814
|
}
|
|
4815
|
+
get locked() {
|
|
4816
|
+
return this.gridview.locked;
|
|
4817
|
+
}
|
|
4818
|
+
set locked(value) {
|
|
4819
|
+
this.gridview.locked = value;
|
|
4820
|
+
}
|
|
4583
4821
|
constructor(options) {
|
|
4584
|
-
super(
|
|
4822
|
+
super(document.createElement('div'), options.disableAutoResizing);
|
|
4585
4823
|
this._id = nextLayoutId$1.next();
|
|
4586
4824
|
this._groups = new Map();
|
|
4587
4825
|
this._onDidLayoutChange = new Emitter();
|
|
4588
4826
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
4589
|
-
this.
|
|
4590
|
-
this.
|
|
4591
|
-
this.
|
|
4592
|
-
this.
|
|
4593
|
-
this.
|
|
4594
|
-
this.
|
|
4827
|
+
this._onDidRemove = new Emitter();
|
|
4828
|
+
this.onDidRemove = this._onDidRemove.event;
|
|
4829
|
+
this._onDidAdd = new Emitter();
|
|
4830
|
+
this.onDidAdd = this._onDidAdd.event;
|
|
4831
|
+
this._onDidActiveChange = new Emitter();
|
|
4832
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4595
4833
|
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
4834
|
+
this.element.style.height = '100%';
|
|
4835
|
+
this.element.style.width = '100%';
|
|
4836
|
+
options.parentElement.appendChild(this.element);
|
|
4596
4837
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
4838
|
+
this.gridview.locked = !!options.locked;
|
|
4597
4839
|
this.element.appendChild(this.gridview.element);
|
|
4598
4840
|
this.layout(0, 0, true); // set some elements height/widths
|
|
4599
|
-
this.addDisposables(
|
|
4841
|
+
this.addDisposables(Disposable.from(() => {
|
|
4842
|
+
var _a;
|
|
4843
|
+
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
4844
|
+
}), this.gridview.onDidChange(() => {
|
|
4600
4845
|
this._bufferOnDidLayoutChange.fire();
|
|
4601
|
-
}), exports.DockviewEvent.any(this.
|
|
4846
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
4602
4847
|
this._bufferOnDidLayoutChange.fire();
|
|
4603
4848
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
4604
4849
|
this._onDidLayoutChange.fire();
|
|
@@ -4613,6 +4858,7 @@
|
|
|
4613
4858
|
}
|
|
4614
4859
|
maximizeGroup(panel) {
|
|
4615
4860
|
this.gridview.maximizeView(panel);
|
|
4861
|
+
this.doSetGroupActive(panel);
|
|
4616
4862
|
}
|
|
4617
4863
|
isMaximizedGroup(panel) {
|
|
4618
4864
|
return this.gridview.maximizedView() === panel;
|
|
@@ -4623,13 +4869,12 @@
|
|
|
4623
4869
|
hasMaximizedGroup() {
|
|
4624
4870
|
return this.gridview.hasMaximizedView();
|
|
4625
4871
|
}
|
|
4626
|
-
get
|
|
4627
|
-
return this.gridview.
|
|
4872
|
+
get onDidMaximizedGroupChange() {
|
|
4873
|
+
return this.gridview.onDidMaximizedNodeChange;
|
|
4628
4874
|
}
|
|
4629
4875
|
doAddGroup(group, location = [0], size) {
|
|
4630
4876
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
4631
|
-
this.
|
|
4632
|
-
this.doSetGroupActive(group);
|
|
4877
|
+
this._onDidAdd.fire(group);
|
|
4633
4878
|
}
|
|
4634
4879
|
doRemoveGroup(group, options) {
|
|
4635
4880
|
if (!this._groups.has(group.id)) {
|
|
@@ -4641,8 +4886,8 @@
|
|
|
4641
4886
|
item.disposable.dispose();
|
|
4642
4887
|
item.value.dispose();
|
|
4643
4888
|
this._groups.delete(group.id);
|
|
4889
|
+
this._onDidRemove.fire(group);
|
|
4644
4890
|
}
|
|
4645
|
-
this._onDidRemoveGroup.fire(group);
|
|
4646
4891
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
4647
4892
|
const groups = Array.from(this._groups.values());
|
|
4648
4893
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -4653,25 +4898,18 @@
|
|
|
4653
4898
|
var _a;
|
|
4654
4899
|
return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4655
4900
|
}
|
|
4656
|
-
doSetGroupActive(group
|
|
4657
|
-
var _a, _b, _c;
|
|
4901
|
+
doSetGroupActive(group) {
|
|
4658
4902
|
if (this._activeGroup === group) {
|
|
4659
4903
|
return;
|
|
4660
4904
|
}
|
|
4661
4905
|
if (this._activeGroup) {
|
|
4662
4906
|
this._activeGroup.setActive(false);
|
|
4663
|
-
if (!skipFocus) {
|
|
4664
|
-
(_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4665
|
-
}
|
|
4666
4907
|
}
|
|
4667
4908
|
if (group) {
|
|
4668
4909
|
group.setActive(true);
|
|
4669
|
-
if (!skipFocus) {
|
|
4670
|
-
(_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
|
|
4671
|
-
}
|
|
4672
4910
|
}
|
|
4673
4911
|
this._activeGroup = group;
|
|
4674
|
-
this.
|
|
4912
|
+
this._onDidActiveChange.fire(group);
|
|
4675
4913
|
}
|
|
4676
4914
|
removeGroup(group) {
|
|
4677
4915
|
this.doRemoveGroup(group);
|
|
@@ -4716,9 +4954,9 @@
|
|
|
4716
4954
|
this.gridview.layout(width, height);
|
|
4717
4955
|
}
|
|
4718
4956
|
dispose() {
|
|
4719
|
-
this.
|
|
4720
|
-
this.
|
|
4721
|
-
this.
|
|
4957
|
+
this._onDidActiveChange.dispose();
|
|
4958
|
+
this._onDidAdd.dispose();
|
|
4959
|
+
this._onDidRemove.dispose();
|
|
4722
4960
|
this._onDidLayoutChange.dispose();
|
|
4723
4961
|
for (const group of this.groups) {
|
|
4724
4962
|
group.dispose();
|
|
@@ -4728,11 +4966,15 @@
|
|
|
4728
4966
|
}
|
|
4729
4967
|
}
|
|
4730
4968
|
|
|
4969
|
+
class WillFocusEvent extends DockviewEvent {
|
|
4970
|
+
constructor() {
|
|
4971
|
+
super();
|
|
4972
|
+
}
|
|
4973
|
+
}
|
|
4731
4974
|
/**
|
|
4732
4975
|
* A core api implementation that should be used across all panel-like objects
|
|
4733
4976
|
*/
|
|
4734
4977
|
class PanelApiImpl extends CompositeDisposable {
|
|
4735
|
-
//
|
|
4736
4978
|
get isFocused() {
|
|
4737
4979
|
return this._isFocused;
|
|
4738
4980
|
}
|
|
@@ -4742,6 +4984,9 @@
|
|
|
4742
4984
|
get isVisible() {
|
|
4743
4985
|
return this._isVisible;
|
|
4744
4986
|
}
|
|
4987
|
+
get isHidden() {
|
|
4988
|
+
return this._isHidden;
|
|
4989
|
+
}
|
|
4745
4990
|
get width() {
|
|
4746
4991
|
return this._width;
|
|
4747
4992
|
}
|
|
@@ -4754,38 +4999,26 @@
|
|
|
4754
4999
|
this._isFocused = false;
|
|
4755
5000
|
this._isActive = false;
|
|
4756
5001
|
this._isVisible = true;
|
|
5002
|
+
this._isHidden = false;
|
|
4757
5003
|
this._width = 0;
|
|
4758
5004
|
this._height = 0;
|
|
4759
5005
|
this.panelUpdatesDisposable = new MutableDisposable();
|
|
4760
|
-
this._onDidDimensionChange = new Emitter(
|
|
4761
|
-
replay: true,
|
|
4762
|
-
});
|
|
5006
|
+
this._onDidDimensionChange = new Emitter();
|
|
4763
5007
|
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
4764
|
-
|
|
4765
|
-
this._onDidChangeFocus = new Emitter({
|
|
4766
|
-
replay: true,
|
|
4767
|
-
});
|
|
5008
|
+
this._onDidChangeFocus = new Emitter();
|
|
4768
5009
|
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
4769
5010
|
//
|
|
4770
|
-
this.
|
|
4771
|
-
this.
|
|
5011
|
+
this._onWillFocus = new Emitter();
|
|
5012
|
+
this.onWillFocus = this._onWillFocus.event;
|
|
4772
5013
|
//
|
|
4773
|
-
this._onDidVisibilityChange = new Emitter(
|
|
4774
|
-
replay: true,
|
|
4775
|
-
});
|
|
5014
|
+
this._onDidVisibilityChange = new Emitter();
|
|
4776
5015
|
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
4777
|
-
|
|
4778
|
-
this.
|
|
4779
|
-
this.
|
|
4780
|
-
//
|
|
4781
|
-
this._onDidActiveChange = new Emitter({
|
|
4782
|
-
replay: true,
|
|
4783
|
-
});
|
|
5016
|
+
this._onDidHiddenChange = new Emitter();
|
|
5017
|
+
this.onDidHiddenChange = this._onDidHiddenChange.event;
|
|
5018
|
+
this._onDidActiveChange = new Emitter();
|
|
4784
5019
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4785
|
-
//
|
|
4786
5020
|
this._onActiveChange = new Emitter();
|
|
4787
5021
|
this.onActiveChange = this._onActiveChange.event;
|
|
4788
|
-
//
|
|
4789
5022
|
this._onUpdateParameters = new Emitter();
|
|
4790
5023
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
4791
5024
|
this.addDisposables(this.onDidFocusChange((event) => {
|
|
@@ -4794,10 +5027,12 @@
|
|
|
4794
5027
|
this._isActive = event.isActive;
|
|
4795
5028
|
}), this.onDidVisibilityChange((event) => {
|
|
4796
5029
|
this._isVisible = event.isVisible;
|
|
5030
|
+
}), this.onDidHiddenChange((event) => {
|
|
5031
|
+
this._isHidden = event.isHidden;
|
|
4797
5032
|
}), this.onDidDimensionsChange((event) => {
|
|
4798
5033
|
this._width = event.width;
|
|
4799
5034
|
this._height = event.height;
|
|
4800
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this.
|
|
5035
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onDidHiddenChange, this._onUpdateParameters);
|
|
4801
5036
|
}
|
|
4802
5037
|
initialize(panel) {
|
|
4803
5038
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
@@ -4806,8 +5041,8 @@
|
|
|
4806
5041
|
});
|
|
4807
5042
|
});
|
|
4808
5043
|
}
|
|
4809
|
-
|
|
4810
|
-
this.
|
|
5044
|
+
setHidden(isHidden) {
|
|
5045
|
+
this._onDidHiddenChange.fire({ isHidden });
|
|
4811
5046
|
}
|
|
4812
5047
|
setActive() {
|
|
4813
5048
|
this._onActiveChange.fire();
|
|
@@ -4815,9 +5050,6 @@
|
|
|
4815
5050
|
updateParameters(parameters) {
|
|
4816
5051
|
this._onUpdateParameters.fire(parameters);
|
|
4817
5052
|
}
|
|
4818
|
-
dispose() {
|
|
4819
|
-
super.dispose();
|
|
4820
|
-
}
|
|
4821
5053
|
}
|
|
4822
5054
|
|
|
4823
5055
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
@@ -4905,7 +5137,12 @@
|
|
|
4905
5137
|
}), focusTracker);
|
|
4906
5138
|
}
|
|
4907
5139
|
focus() {
|
|
4908
|
-
|
|
5140
|
+
const event = new WillFocusEvent();
|
|
5141
|
+
this.api._onWillFocus.fire(event);
|
|
5142
|
+
if (event.defaultPrevented) {
|
|
5143
|
+
return;
|
|
5144
|
+
}
|
|
5145
|
+
this._element.focus();
|
|
4909
5146
|
}
|
|
4910
5147
|
layout(width, height) {
|
|
4911
5148
|
this._width = width;
|
|
@@ -5234,9 +5471,7 @@
|
|
|
5234
5471
|
super(id);
|
|
5235
5472
|
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5236
5473
|
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5237
|
-
this._onDidConstraintsChange = new Emitter(
|
|
5238
|
-
replay: true,
|
|
5239
|
-
});
|
|
5474
|
+
this._onDidConstraintsChange = new Emitter();
|
|
5240
5475
|
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
5241
5476
|
this._onDidSizeChange = new Emitter();
|
|
5242
5477
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
@@ -5329,13 +5564,13 @@
|
|
|
5329
5564
|
this._maximumHeight = options.maximumHeight;
|
|
5330
5565
|
}
|
|
5331
5566
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
5332
|
-
this.addDisposables(this.api.
|
|
5333
|
-
const {
|
|
5567
|
+
this.addDisposables(this.api.onDidHiddenChange((event) => {
|
|
5568
|
+
const { isHidden } = event;
|
|
5334
5569
|
const { accessor } = this._params;
|
|
5335
|
-
accessor.setVisible(this,
|
|
5570
|
+
accessor.setVisible(this, !isHidden);
|
|
5336
5571
|
}), this.api.onActiveChange(() => {
|
|
5337
5572
|
const { accessor } = this._params;
|
|
5338
|
-
accessor.
|
|
5573
|
+
accessor.doSetGroupActive(this);
|
|
5339
5574
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
5340
5575
|
if (typeof event.minimumWidth === 'number' ||
|
|
5341
5576
|
typeof event.minimumWidth === 'function') {
|
|
@@ -5418,6 +5653,17 @@
|
|
|
5418
5653
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5419
5654
|
this.addDisposables(this._onDidLocationChange);
|
|
5420
5655
|
}
|
|
5656
|
+
close() {
|
|
5657
|
+
if (!this._group) {
|
|
5658
|
+
return;
|
|
5659
|
+
}
|
|
5660
|
+
return this.accessor.removeGroup(this._group);
|
|
5661
|
+
}
|
|
5662
|
+
getWindow() {
|
|
5663
|
+
return this.location.type === 'popout'
|
|
5664
|
+
? this.location.getWindow()
|
|
5665
|
+
: window;
|
|
5666
|
+
}
|
|
5421
5667
|
moveTo(options) {
|
|
5422
5668
|
var _a, _b, _c;
|
|
5423
5669
|
if (!this._group) {
|
|
@@ -5425,14 +5671,23 @@
|
|
|
5425
5671
|
}
|
|
5426
5672
|
const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
|
|
5427
5673
|
direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
|
|
5674
|
+
skipSetActive: true,
|
|
5675
|
+
});
|
|
5676
|
+
this.accessor.moveGroupOrPanel({
|
|
5677
|
+
from: { groupId: this._group.id },
|
|
5678
|
+
to: {
|
|
5679
|
+
group,
|
|
5680
|
+
position: options.group
|
|
5681
|
+
? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
|
|
5682
|
+
: 'center',
|
|
5683
|
+
},
|
|
5428
5684
|
});
|
|
5429
|
-
this.accessor.moveGroupOrPanel(group, this._group.id, undefined, options.group ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center' : 'center');
|
|
5430
5685
|
}
|
|
5431
5686
|
maximize() {
|
|
5432
5687
|
if (!this._group) {
|
|
5433
5688
|
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5434
5689
|
}
|
|
5435
|
-
if (this.location !== 'grid') {
|
|
5690
|
+
if (this.location.type !== 'grid') {
|
|
5436
5691
|
// only grid groups can be maximized
|
|
5437
5692
|
return;
|
|
5438
5693
|
}
|
|
@@ -5489,6 +5744,12 @@
|
|
|
5489
5744
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
5490
5745
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
5491
5746
|
}
|
|
5747
|
+
focus() {
|
|
5748
|
+
if (!this.api.isActive) {
|
|
5749
|
+
this.api.setActive();
|
|
5750
|
+
}
|
|
5751
|
+
super.focus();
|
|
5752
|
+
}
|
|
5492
5753
|
initialize() {
|
|
5493
5754
|
this._model.initialize();
|
|
5494
5755
|
}
|
|
@@ -5534,6 +5795,9 @@
|
|
|
5534
5795
|
}
|
|
5535
5796
|
|
|
5536
5797
|
class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
5798
|
+
get location() {
|
|
5799
|
+
return this.group.api.location;
|
|
5800
|
+
}
|
|
5537
5801
|
get title() {
|
|
5538
5802
|
return this.panel.title;
|
|
5539
5803
|
}
|
|
@@ -5545,15 +5809,34 @@
|
|
|
5545
5809
|
}
|
|
5546
5810
|
set group(value) {
|
|
5547
5811
|
const isOldGroupActive = this.isGroupActive;
|
|
5548
|
-
this._group
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5812
|
+
if (this._group !== value) {
|
|
5813
|
+
this._group = value;
|
|
5814
|
+
this._onDidGroupChange.fire({});
|
|
5815
|
+
let _trackGroupActive = isOldGroupActive; // prevent duplicate events with same state
|
|
5816
|
+
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidLocationChange((event) => {
|
|
5817
|
+
if (this.group !== this.panel.group) {
|
|
5818
|
+
return;
|
|
5819
|
+
}
|
|
5820
|
+
this._onDidLocationChange.fire(event);
|
|
5821
|
+
}), this.group.api.onDidActiveChange(() => {
|
|
5822
|
+
if (this.group !== this.panel.group) {
|
|
5823
|
+
return;
|
|
5824
|
+
}
|
|
5825
|
+
if (_trackGroupActive !== this.isGroupActive) {
|
|
5826
|
+
_trackGroupActive = this.isGroupActive;
|
|
5827
|
+
this._onDidActiveGroupChange.fire({
|
|
5828
|
+
isActive: this.isGroupActive,
|
|
5829
|
+
});
|
|
5830
|
+
}
|
|
5831
|
+
}));
|
|
5832
|
+
// if (this.isGroupActive !== isOldGroupActive) {
|
|
5833
|
+
// this._onDidActiveGroupChange.fire({
|
|
5834
|
+
// isActive: this.isGroupActive,
|
|
5835
|
+
// });
|
|
5836
|
+
// }
|
|
5837
|
+
this._onDidLocationChange.fire({
|
|
5838
|
+
location: this.group.api.location,
|
|
5553
5839
|
});
|
|
5554
|
-
if (this.isGroupActive !== isOldGroupActive) {
|
|
5555
|
-
this._onDidActiveGroupChange.fire();
|
|
5556
|
-
}
|
|
5557
5840
|
}
|
|
5558
5841
|
}
|
|
5559
5842
|
get group() {
|
|
@@ -5571,14 +5854,26 @@
|
|
|
5571
5854
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
5572
5855
|
this._onDidRendererChange = new Emitter();
|
|
5573
5856
|
this.onDidRendererChange = this._onDidRendererChange.event;
|
|
5574
|
-
this.
|
|
5857
|
+
this._onDidLocationChange = new Emitter();
|
|
5858
|
+
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5859
|
+
this.groupEventsDisposable = new MutableDisposable();
|
|
5575
5860
|
this.initialize(panel);
|
|
5576
5861
|
this._group = group;
|
|
5577
|
-
this.addDisposables(this.
|
|
5862
|
+
this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
|
|
5863
|
+
}
|
|
5864
|
+
getWindow() {
|
|
5865
|
+
return this.group.api.getWindow();
|
|
5578
5866
|
}
|
|
5579
5867
|
moveTo(options) {
|
|
5580
5868
|
var _a;
|
|
5581
|
-
this.accessor.moveGroupOrPanel(
|
|
5869
|
+
this.accessor.moveGroupOrPanel({
|
|
5870
|
+
from: { groupId: this._group.id, panelId: this.panel.id },
|
|
5871
|
+
to: {
|
|
5872
|
+
group: options.group,
|
|
5873
|
+
position: (_a = options.position) !== null && _a !== void 0 ? _a : 'center',
|
|
5874
|
+
index: options.index,
|
|
5875
|
+
},
|
|
5876
|
+
});
|
|
5582
5877
|
}
|
|
5583
5878
|
setTitle(title) {
|
|
5584
5879
|
this.panel.setTitle(title);
|
|
@@ -5639,7 +5934,14 @@
|
|
|
5639
5934
|
this.setTitle(params.title);
|
|
5640
5935
|
}
|
|
5641
5936
|
focus() {
|
|
5642
|
-
|
|
5937
|
+
const event = new WillFocusEvent();
|
|
5938
|
+
this.api._onWillFocus.fire(event);
|
|
5939
|
+
if (event.defaultPrevented) {
|
|
5940
|
+
return;
|
|
5941
|
+
}
|
|
5942
|
+
if (!this.api.isActive) {
|
|
5943
|
+
this.api.setActive();
|
|
5944
|
+
}
|
|
5643
5945
|
}
|
|
5644
5946
|
toJSON() {
|
|
5645
5947
|
return {
|
|
@@ -5696,20 +5998,40 @@
|
|
|
5696
5998
|
},
|
|
5697
5999
|
});
|
|
5698
6000
|
}
|
|
5699
|
-
updateParentGroup(group,
|
|
6001
|
+
updateParentGroup(group, options) {
|
|
5700
6002
|
this._group = group;
|
|
5701
|
-
this.api.group =
|
|
6003
|
+
this.api.group = this._group;
|
|
5702
6004
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
5703
|
-
this.api.
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
6005
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6006
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetActive)) {
|
|
6007
|
+
if (this.api.isActive !== isActive) {
|
|
6008
|
+
this.api._onDidActiveChange.fire({
|
|
6009
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6010
|
+
});
|
|
6011
|
+
}
|
|
6012
|
+
}
|
|
6013
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6014
|
+
this.api._onDidVisibilityChange.fire({
|
|
6015
|
+
isVisible: isPanelVisible,
|
|
6016
|
+
});
|
|
6017
|
+
}
|
|
6018
|
+
}
|
|
6019
|
+
runEvents() {
|
|
6020
|
+
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
6021
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6022
|
+
if (this.api.isActive !== isActive) {
|
|
6023
|
+
this.api._onDidActiveChange.fire({
|
|
6024
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6025
|
+
});
|
|
6026
|
+
}
|
|
6027
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6028
|
+
this.api._onDidVisibilityChange.fire({
|
|
6029
|
+
isVisible: isPanelVisible,
|
|
6030
|
+
});
|
|
6031
|
+
}
|
|
5710
6032
|
}
|
|
5711
6033
|
layout(width, height) {
|
|
5712
|
-
//
|
|
6034
|
+
// TODO: Can we somehow do height without header height or indicate what the header height is?
|
|
5713
6035
|
this.api._onDidDimensionChange.fire({
|
|
5714
6036
|
width,
|
|
5715
6037
|
height: height,
|
|
@@ -5831,8 +6153,6 @@
|
|
|
5831
6153
|
this.id = id;
|
|
5832
6154
|
this.contentComponent = contentComponent;
|
|
5833
6155
|
this.tabComponent = tabComponent;
|
|
5834
|
-
this._group = null;
|
|
5835
|
-
this._isPanelVisible = null;
|
|
5836
6156
|
this._content = this.createContentComponent(this.id, contentComponent);
|
|
5837
6157
|
this._tab = this.createTabComponent(this.id, tabComponent);
|
|
5838
6158
|
}
|
|
@@ -5840,25 +6160,8 @@
|
|
|
5840
6160
|
this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
|
|
5841
6161
|
this.tab.init(params);
|
|
5842
6162
|
}
|
|
5843
|
-
updateParentGroup(
|
|
5844
|
-
|
|
5845
|
-
this._group = group;
|
|
5846
|
-
if (this._content.onGroupChange) {
|
|
5847
|
-
this._content.onGroupChange(group);
|
|
5848
|
-
}
|
|
5849
|
-
if (this._tab.onGroupChange) {
|
|
5850
|
-
this._tab.onGroupChange(group);
|
|
5851
|
-
}
|
|
5852
|
-
}
|
|
5853
|
-
if (isPanelVisible !== this._isPanelVisible) {
|
|
5854
|
-
this._isPanelVisible = isPanelVisible;
|
|
5855
|
-
if (this._content.onPanelVisibleChange) {
|
|
5856
|
-
this._content.onPanelVisibleChange(isPanelVisible);
|
|
5857
|
-
}
|
|
5858
|
-
if (this._tab.onPanelVisibleChange) {
|
|
5859
|
-
this._tab.onPanelVisibleChange(isPanelVisible);
|
|
5860
|
-
}
|
|
5861
|
-
}
|
|
6163
|
+
updateParentGroup(_group, _isPanelVisible) {
|
|
6164
|
+
// noop
|
|
5862
6165
|
}
|
|
5863
6166
|
layout(width, height) {
|
|
5864
6167
|
var _a, _b;
|
|
@@ -6291,117 +6594,6 @@
|
|
|
6291
6594
|
}
|
|
6292
6595
|
}
|
|
6293
6596
|
|
|
6294
|
-
class PopoutWindow extends CompositeDisposable {
|
|
6295
|
-
constructor(id, className, options) {
|
|
6296
|
-
super();
|
|
6297
|
-
this.id = id;
|
|
6298
|
-
this.className = className;
|
|
6299
|
-
this.options = options;
|
|
6300
|
-
this._onDidClose = new Emitter();
|
|
6301
|
-
this.onDidClose = this._onDidClose.event;
|
|
6302
|
-
this._window = null;
|
|
6303
|
-
this.addDisposables(this._onDidClose, {
|
|
6304
|
-
dispose: () => {
|
|
6305
|
-
this.close();
|
|
6306
|
-
},
|
|
6307
|
-
});
|
|
6308
|
-
}
|
|
6309
|
-
dimensions() {
|
|
6310
|
-
if (!this._window) {
|
|
6311
|
-
return null;
|
|
6312
|
-
}
|
|
6313
|
-
const left = this._window.value.screenX;
|
|
6314
|
-
const top = this._window.value.screenY;
|
|
6315
|
-
const width = this._window.value.innerWidth;
|
|
6316
|
-
const height = this._window.value.innerHeight;
|
|
6317
|
-
return { top, left, width, height };
|
|
6318
|
-
}
|
|
6319
|
-
close() {
|
|
6320
|
-
if (this._window) {
|
|
6321
|
-
this._window.disposable.dispose();
|
|
6322
|
-
this._window.value.close();
|
|
6323
|
-
this._window = null;
|
|
6324
|
-
}
|
|
6325
|
-
}
|
|
6326
|
-
open(content) {
|
|
6327
|
-
if (this._window) {
|
|
6328
|
-
throw new Error('instance of popout window is already open');
|
|
6329
|
-
}
|
|
6330
|
-
const url = `${this.options.url}`;
|
|
6331
|
-
const features = Object.entries({
|
|
6332
|
-
top: this.options.top,
|
|
6333
|
-
left: this.options.left,
|
|
6334
|
-
width: this.options.width,
|
|
6335
|
-
height: this.options.height,
|
|
6336
|
-
})
|
|
6337
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
6338
|
-
.join(',');
|
|
6339
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6340
|
-
const externalWindow = window.open(url, this.id, features);
|
|
6341
|
-
if (!externalWindow) {
|
|
6342
|
-
return;
|
|
6343
|
-
}
|
|
6344
|
-
const disposable = new CompositeDisposable();
|
|
6345
|
-
this._window = { value: externalWindow, disposable };
|
|
6346
|
-
const cleanUp = () => {
|
|
6347
|
-
this._onDidClose.fire();
|
|
6348
|
-
this._window = null;
|
|
6349
|
-
};
|
|
6350
|
-
// prevent any default content from loading
|
|
6351
|
-
// externalWindow.document.body.replaceWith(document.createElement('div'));
|
|
6352
|
-
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6353
|
-
cleanUp();
|
|
6354
|
-
this.close();
|
|
6355
|
-
}));
|
|
6356
|
-
externalWindow.addEventListener('load', () => {
|
|
6357
|
-
const externalDocument = externalWindow.document;
|
|
6358
|
-
externalDocument.title = document.title;
|
|
6359
|
-
const div = document.createElement('div');
|
|
6360
|
-
div.classList.add('dv-popout-window');
|
|
6361
|
-
div.style.position = 'absolute';
|
|
6362
|
-
div.style.width = '100%';
|
|
6363
|
-
div.style.height = '100%';
|
|
6364
|
-
div.style.top = '0px';
|
|
6365
|
-
div.style.left = '0px';
|
|
6366
|
-
div.classList.add(this.className);
|
|
6367
|
-
div.appendChild(content);
|
|
6368
|
-
externalDocument.body.replaceChildren(div);
|
|
6369
|
-
externalDocument.body.classList.add(this.className);
|
|
6370
|
-
addStyles(externalDocument, window.document.styleSheets);
|
|
6371
|
-
externalWindow.addEventListener('beforeunload', () => {
|
|
6372
|
-
// TODO: indicate external window is closing
|
|
6373
|
-
cleanUp();
|
|
6374
|
-
});
|
|
6375
|
-
});
|
|
6376
|
-
}
|
|
6377
|
-
}
|
|
6378
|
-
|
|
6379
|
-
class DockviewPopoutGroupPanel extends CompositeDisposable {
|
|
6380
|
-
constructor(id, group, options) {
|
|
6381
|
-
var _a;
|
|
6382
|
-
super();
|
|
6383
|
-
this.id = id;
|
|
6384
|
-
this.group = group;
|
|
6385
|
-
this.options = options;
|
|
6386
|
-
this.window = new PopoutWindow(id, (_a = options.className) !== null && _a !== void 0 ? _a : '', {
|
|
6387
|
-
url: this.options.popoutUrl,
|
|
6388
|
-
left: this.options.box.left,
|
|
6389
|
-
top: this.options.box.top,
|
|
6390
|
-
width: this.options.box.width,
|
|
6391
|
-
height: this.options.box.height,
|
|
6392
|
-
});
|
|
6393
|
-
group.model.location = 'popout';
|
|
6394
|
-
this.addDisposables(this.window, {
|
|
6395
|
-
dispose: () => {
|
|
6396
|
-
group.model.location = 'grid';
|
|
6397
|
-
},
|
|
6398
|
-
}, this.window.onDidClose(() => {
|
|
6399
|
-
this.dispose();
|
|
6400
|
-
}));
|
|
6401
|
-
this.window.open(group.element);
|
|
6402
|
-
}
|
|
6403
|
-
}
|
|
6404
|
-
|
|
6405
6597
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6406
6598
|
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6407
6599
|
|
|
@@ -6415,11 +6607,13 @@
|
|
|
6415
6607
|
super();
|
|
6416
6608
|
this.element = element;
|
|
6417
6609
|
this.map = {};
|
|
6610
|
+
this._disposed = false;
|
|
6418
6611
|
this.addDisposables(Disposable.from(() => {
|
|
6419
6612
|
for (const value of Object.values(this.map)) {
|
|
6420
6613
|
value.disposable.dispose();
|
|
6421
6614
|
value.destroy.dispose();
|
|
6422
6615
|
}
|
|
6616
|
+
this._disposed = true;
|
|
6423
6617
|
}));
|
|
6424
6618
|
}
|
|
6425
6619
|
detatch(panel) {
|
|
@@ -6459,7 +6653,7 @@
|
|
|
6459
6653
|
focusContainer.style.top = `${box.top - box2.top}px`;
|
|
6460
6654
|
focusContainer.style.width = `${box.width}px`;
|
|
6461
6655
|
focusContainer.style.height = `${box.height}px`;
|
|
6462
|
-
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location === 'floating');
|
|
6656
|
+
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
|
|
6463
6657
|
};
|
|
6464
6658
|
const visibilityChanged = () => {
|
|
6465
6659
|
if (panel.api.isVisible) {
|
|
@@ -6505,8 +6699,11 @@
|
|
|
6505
6699
|
resize();
|
|
6506
6700
|
}));
|
|
6507
6701
|
this.map[panel.api.id].destroy = Disposable.from(() => {
|
|
6508
|
-
|
|
6509
|
-
|
|
6702
|
+
var _a;
|
|
6703
|
+
if (panel.view.content.element.parentElement === focusContainer) {
|
|
6704
|
+
focusContainer.removeChild(panel.view.content.element);
|
|
6705
|
+
}
|
|
6706
|
+
(_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
|
|
6510
6707
|
});
|
|
6511
6708
|
queueMicrotask(() => {
|
|
6512
6709
|
if (this.isDisposed) {
|
|
@@ -6527,11 +6724,164 @@
|
|
|
6527
6724
|
}
|
|
6528
6725
|
}
|
|
6529
6726
|
|
|
6727
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6728
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6729
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6730
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6731
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6732
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6733
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6734
|
+
});
|
|
6735
|
+
};
|
|
6736
|
+
class PopoutWindow extends CompositeDisposable {
|
|
6737
|
+
get window() {
|
|
6738
|
+
var _a, _b;
|
|
6739
|
+
return (_b = (_a = this._window) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;
|
|
6740
|
+
}
|
|
6741
|
+
constructor(target, className, options) {
|
|
6742
|
+
super();
|
|
6743
|
+
this.target = target;
|
|
6744
|
+
this.className = className;
|
|
6745
|
+
this.options = options;
|
|
6746
|
+
this._onWillClose = new Emitter();
|
|
6747
|
+
this.onWillClose = this._onWillClose.event;
|
|
6748
|
+
this._onDidClose = new Emitter();
|
|
6749
|
+
this.onDidClose = this._onDidClose.event;
|
|
6750
|
+
this._window = null;
|
|
6751
|
+
this.addDisposables(this._onWillClose, this._onDidClose, {
|
|
6752
|
+
dispose: () => {
|
|
6753
|
+
this.close();
|
|
6754
|
+
},
|
|
6755
|
+
});
|
|
6756
|
+
}
|
|
6757
|
+
dimensions() {
|
|
6758
|
+
if (!this._window) {
|
|
6759
|
+
return null;
|
|
6760
|
+
}
|
|
6761
|
+
const left = this._window.value.screenX;
|
|
6762
|
+
const top = this._window.value.screenY;
|
|
6763
|
+
const width = this._window.value.innerWidth;
|
|
6764
|
+
const height = this._window.value.innerHeight;
|
|
6765
|
+
return { top, left, width, height };
|
|
6766
|
+
}
|
|
6767
|
+
close() {
|
|
6768
|
+
var _a, _b;
|
|
6769
|
+
if (this._window) {
|
|
6770
|
+
this._onWillClose.fire();
|
|
6771
|
+
(_b = (_a = this.options).onWillClose) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6772
|
+
id: this.target,
|
|
6773
|
+
window: this._window.value,
|
|
6774
|
+
});
|
|
6775
|
+
this._window.disposable.dispose();
|
|
6776
|
+
this._window.value.close();
|
|
6777
|
+
this._window = null;
|
|
6778
|
+
this._onDidClose.fire();
|
|
6779
|
+
}
|
|
6780
|
+
}
|
|
6781
|
+
open() {
|
|
6782
|
+
var _a, _b;
|
|
6783
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6784
|
+
if (this._window) {
|
|
6785
|
+
throw new Error('instance of popout window is already open');
|
|
6786
|
+
}
|
|
6787
|
+
const url = `${this.options.url}`;
|
|
6788
|
+
const features = Object.entries({
|
|
6789
|
+
top: this.options.top,
|
|
6790
|
+
left: this.options.left,
|
|
6791
|
+
width: this.options.width,
|
|
6792
|
+
height: this.options.height,
|
|
6793
|
+
})
|
|
6794
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
6795
|
+
.join(',');
|
|
6796
|
+
/**
|
|
6797
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6798
|
+
*/
|
|
6799
|
+
const externalWindow = window.open(url, this.target, features);
|
|
6800
|
+
if (!externalWindow) {
|
|
6801
|
+
/**
|
|
6802
|
+
* Popup blocked
|
|
6803
|
+
*/
|
|
6804
|
+
return null;
|
|
6805
|
+
}
|
|
6806
|
+
const disposable = new CompositeDisposable();
|
|
6807
|
+
this._window = { value: externalWindow, disposable };
|
|
6808
|
+
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6809
|
+
/**
|
|
6810
|
+
* before the main window closes we should close this popup too
|
|
6811
|
+
* to be good citizens
|
|
6812
|
+
*
|
|
6813
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6814
|
+
*/
|
|
6815
|
+
this.close();
|
|
6816
|
+
}));
|
|
6817
|
+
const container = this.createPopoutWindowContainer();
|
|
6818
|
+
if (this.className) {
|
|
6819
|
+
container.classList.add(this.className);
|
|
6820
|
+
}
|
|
6821
|
+
(_b = (_a = this.options).onDidOpen) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6822
|
+
id: this.target,
|
|
6823
|
+
window: externalWindow,
|
|
6824
|
+
});
|
|
6825
|
+
return new Promise((resolve) => {
|
|
6826
|
+
externalWindow.addEventListener('unload', (e) => {
|
|
6827
|
+
// if page fails to load before unloading
|
|
6828
|
+
// this.close();
|
|
6829
|
+
});
|
|
6830
|
+
externalWindow.addEventListener('load', () => {
|
|
6831
|
+
/**
|
|
6832
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
|
|
6833
|
+
*/
|
|
6834
|
+
const externalDocument = externalWindow.document;
|
|
6835
|
+
externalDocument.title = document.title;
|
|
6836
|
+
externalDocument.body.appendChild(container);
|
|
6837
|
+
addStyles(externalDocument, window.document.styleSheets);
|
|
6838
|
+
/**
|
|
6839
|
+
* beforeunload must be registered after load for reasons I could not determine
|
|
6840
|
+
* otherwise the beforeunload event will not fire when the window is closed
|
|
6841
|
+
*/
|
|
6842
|
+
addDisposableWindowListener(externalWindow, 'beforeunload', () => {
|
|
6843
|
+
/**
|
|
6844
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6845
|
+
*/
|
|
6846
|
+
this.close();
|
|
6847
|
+
});
|
|
6848
|
+
resolve(container);
|
|
6849
|
+
});
|
|
6850
|
+
});
|
|
6851
|
+
});
|
|
6852
|
+
}
|
|
6853
|
+
createPopoutWindowContainer() {
|
|
6854
|
+
const el = document.createElement('div');
|
|
6855
|
+
el.classList.add('dv-popout-window');
|
|
6856
|
+
el.id = 'dv-popout-window';
|
|
6857
|
+
el.style.position = 'absolute';
|
|
6858
|
+
el.style.width = '100%';
|
|
6859
|
+
el.style.height = '100%';
|
|
6860
|
+
el.style.top = '0px';
|
|
6861
|
+
el.style.left = '0px';
|
|
6862
|
+
return el;
|
|
6863
|
+
}
|
|
6864
|
+
}
|
|
6865
|
+
|
|
6530
6866
|
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6531
6867
|
activationSize: { type: 'pixels', value: 10 },
|
|
6532
6868
|
size: { type: 'pixels', value: 20 },
|
|
6533
6869
|
};
|
|
6534
|
-
function
|
|
6870
|
+
function moveGroupWithoutDestroying(options) {
|
|
6871
|
+
const activePanel = options.from.activePanel;
|
|
6872
|
+
const panels = [...options.from.panels].map((panel) => {
|
|
6873
|
+
const removedPanel = options.from.model.removePanel(panel);
|
|
6874
|
+
options.from.model.renderContainer.detatch(panel);
|
|
6875
|
+
return removedPanel;
|
|
6876
|
+
});
|
|
6877
|
+
panels.forEach((panel) => {
|
|
6878
|
+
options.to.model.openPanel(panel, {
|
|
6879
|
+
skipSetActive: activePanel !== panel,
|
|
6880
|
+
skipSetGroupActive: true,
|
|
6881
|
+
});
|
|
6882
|
+
});
|
|
6883
|
+
}
|
|
6884
|
+
function getDockviewTheme(element) {
|
|
6535
6885
|
function toClassList(element) {
|
|
6536
6886
|
const list = [];
|
|
6537
6887
|
for (let i = 0; i < element.classList.length; i++) {
|
|
@@ -6582,6 +6932,7 @@
|
|
|
6582
6932
|
styles: options.styles,
|
|
6583
6933
|
parentElement: options.parentElement,
|
|
6584
6934
|
disableAutoResizing: options.disableAutoResizing,
|
|
6935
|
+
locked: options.locked,
|
|
6585
6936
|
});
|
|
6586
6937
|
this.nextGroupId = sequentialNumberGenerator();
|
|
6587
6938
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -6592,6 +6943,10 @@
|
|
|
6592
6943
|
this.onWillDragGroup = this._onWillDragGroup.event;
|
|
6593
6944
|
this._onDidDrop = new Emitter();
|
|
6594
6945
|
this.onDidDrop = this._onDidDrop.event;
|
|
6946
|
+
this._onWillDrop = new Emitter();
|
|
6947
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
6948
|
+
this._onWillShowOverlay = new Emitter();
|
|
6949
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
6595
6950
|
this._onDidRemovePanel = new Emitter();
|
|
6596
6951
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
6597
6952
|
this._onDidAddPanel = new Emitter();
|
|
@@ -6600,15 +6955,36 @@
|
|
|
6600
6955
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
6601
6956
|
this._onDidActivePanelChange = new Emitter();
|
|
6602
6957
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
6958
|
+
this._onDidMovePanel = new Emitter();
|
|
6603
6959
|
this._floatingGroups = [];
|
|
6604
6960
|
this._popoutGroups = [];
|
|
6961
|
+
this._ignoreEvents = 0;
|
|
6962
|
+
this._onDidRemoveGroup = new Emitter();
|
|
6963
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
6964
|
+
this._onDidAddGroup = new Emitter();
|
|
6965
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
6966
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
6967
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
6968
|
+
this._moving = false;
|
|
6605
6969
|
const gready = document.createElement('div');
|
|
6606
6970
|
gready.className = 'dv-overlay-render-container';
|
|
6607
6971
|
this.gridview.element.appendChild(gready);
|
|
6608
6972
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
6609
6973
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
6610
6974
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
6611
|
-
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop,
|
|
6975
|
+
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) => {
|
|
6976
|
+
if (!this._moving) {
|
|
6977
|
+
this._onDidAddGroup.fire(event);
|
|
6978
|
+
}
|
|
6979
|
+
}), this.onDidRemove((event) => {
|
|
6980
|
+
if (!this._moving) {
|
|
6981
|
+
this._onDidRemoveGroup.fire(event);
|
|
6982
|
+
}
|
|
6983
|
+
}), this.onDidActiveChange((event) => {
|
|
6984
|
+
if (!this._moving) {
|
|
6985
|
+
this._onDidActiveGroupChange.fire(event);
|
|
6986
|
+
}
|
|
6987
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
6612
6988
|
this.updateWatermark();
|
|
6613
6989
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
6614
6990
|
this._bufferOnDidLayoutChange.fire();
|
|
@@ -6619,7 +6995,7 @@
|
|
|
6619
6995
|
}
|
|
6620
6996
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6621
6997
|
for (const group of [...this._popoutGroups]) {
|
|
6622
|
-
group.dispose();
|
|
6998
|
+
group.disposable.dispose();
|
|
6623
6999
|
}
|
|
6624
7000
|
}));
|
|
6625
7001
|
this._options = options;
|
|
@@ -6665,7 +7041,7 @@
|
|
|
6665
7041
|
return this.options.showDndOverlay({
|
|
6666
7042
|
nativeEvent: event,
|
|
6667
7043
|
position: position,
|
|
6668
|
-
target:
|
|
7044
|
+
target: 'edge',
|
|
6669
7045
|
getData: getPanelData,
|
|
6670
7046
|
});
|
|
6671
7047
|
}
|
|
@@ -6676,86 +7052,249 @@
|
|
|
6676
7052
|
});
|
|
6677
7053
|
this.addDisposables(this._rootDropTarget.onDrop((event) => {
|
|
6678
7054
|
var _a;
|
|
7055
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
7056
|
+
nativeEvent: event.nativeEvent,
|
|
7057
|
+
position: event.position,
|
|
7058
|
+
panel: undefined,
|
|
7059
|
+
api: this._api,
|
|
7060
|
+
group: undefined,
|
|
7061
|
+
getData: getPanelData,
|
|
7062
|
+
kind: 'content',
|
|
7063
|
+
});
|
|
7064
|
+
this._onWillDrop.fire(willDropEvent);
|
|
7065
|
+
if (willDropEvent.defaultPrevented) {
|
|
7066
|
+
return;
|
|
7067
|
+
}
|
|
6679
7068
|
const data = getPanelData();
|
|
6680
7069
|
if (data) {
|
|
6681
|
-
this.moveGroupOrPanel(
|
|
7070
|
+
this.moveGroupOrPanel({
|
|
7071
|
+
from: {
|
|
7072
|
+
groupId: data.groupId,
|
|
7073
|
+
panelId: (_a = data.panelId) !== null && _a !== void 0 ? _a : undefined,
|
|
7074
|
+
},
|
|
7075
|
+
to: {
|
|
7076
|
+
group: this.orthogonalize(event.position),
|
|
7077
|
+
position: 'center',
|
|
7078
|
+
},
|
|
7079
|
+
});
|
|
6682
7080
|
}
|
|
6683
7081
|
else {
|
|
6684
|
-
this._onDidDrop.fire(
|
|
7082
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
7083
|
+
nativeEvent: event.nativeEvent,
|
|
7084
|
+
position: event.position,
|
|
7085
|
+
panel: undefined,
|
|
7086
|
+
api: this._api,
|
|
7087
|
+
group: undefined,
|
|
7088
|
+
getData: getPanelData,
|
|
7089
|
+
}));
|
|
6685
7090
|
}
|
|
6686
7091
|
}), this._rootDropTarget);
|
|
6687
7092
|
this._api = new DockviewApi(this);
|
|
6688
7093
|
this.updateWatermark();
|
|
6689
7094
|
}
|
|
6690
|
-
addPopoutGroup(
|
|
6691
|
-
var _a;
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
7095
|
+
addPopoutGroup(itemToPopout, options) {
|
|
7096
|
+
var _a, _b, _c;
|
|
7097
|
+
if (itemToPopout instanceof DockviewPanel &&
|
|
7098
|
+
itemToPopout.group.size === 1) {
|
|
7099
|
+
return this.addPopoutGroup(itemToPopout.group);
|
|
7100
|
+
}
|
|
7101
|
+
const theme = getDockviewTheme(this.gridview.element);
|
|
7102
|
+
const element = this.element;
|
|
7103
|
+
function getBox() {
|
|
7104
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7105
|
+
return options.position;
|
|
7106
|
+
}
|
|
7107
|
+
if (itemToPopout instanceof DockviewGroupPanel) {
|
|
7108
|
+
return itemToPopout.element.getBoundingClientRect();
|
|
7109
|
+
}
|
|
7110
|
+
if (itemToPopout.group) {
|
|
7111
|
+
return itemToPopout.group.element.getBoundingClientRect();
|
|
7112
|
+
}
|
|
7113
|
+
return element.getBoundingClientRect();
|
|
7114
|
+
}
|
|
7115
|
+
const box = getBox();
|
|
7116
|
+
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;
|
|
7117
|
+
if (itemToPopout.api.location.type === 'grid') {
|
|
7118
|
+
itemToPopout.api.setHidden(true);
|
|
7119
|
+
}
|
|
7120
|
+
const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
|
|
7121
|
+
theme !== null && theme !== void 0 ? theme : '', {
|
|
7122
|
+
url: (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : '/popout.html',
|
|
7123
|
+
left: window.screenX + box.left,
|
|
7124
|
+
top: window.screenY + box.top,
|
|
7125
|
+
width: box.width,
|
|
7126
|
+
height: box.height,
|
|
7127
|
+
onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
|
|
7128
|
+
onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
|
|
7129
|
+
});
|
|
7130
|
+
const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
|
|
7131
|
+
popoutWindowDisposable.dispose();
|
|
7132
|
+
}));
|
|
7133
|
+
return _window
|
|
7134
|
+
.open()
|
|
7135
|
+
.then((popoutContainer) => {
|
|
7136
|
+
var _a;
|
|
7137
|
+
if (_window.isDisposed) {
|
|
7138
|
+
return;
|
|
6703
7139
|
}
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
if (!box) {
|
|
6708
|
-
box = group.element.getBoundingClientRect();
|
|
7140
|
+
if (popoutContainer === null) {
|
|
7141
|
+
popoutWindowDisposable.dispose();
|
|
7142
|
+
return;
|
|
6709
7143
|
}
|
|
6710
|
-
const
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
7144
|
+
const gready = document.createElement('div');
|
|
7145
|
+
gready.className = 'dv-overlay-render-container';
|
|
7146
|
+
const overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7147
|
+
const referenceGroup = itemToPopout instanceof DockviewPanel
|
|
7148
|
+
? itemToPopout.group
|
|
7149
|
+
: itemToPopout;
|
|
7150
|
+
const referenceLocation = itemToPopout.api.location.type;
|
|
7151
|
+
const group = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) !== null && _a !== void 0 ? _a : this.createGroup({ id: groupId });
|
|
7152
|
+
group.model.renderContainer = overlayRenderContainer;
|
|
7153
|
+
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup)) {
|
|
7154
|
+
this._onDidAddGroup.fire(group);
|
|
7155
|
+
}
|
|
7156
|
+
if (itemToPopout instanceof DockviewPanel) {
|
|
7157
|
+
this.movingLock(() => {
|
|
7158
|
+
const panel = referenceGroup.model.removePanel(itemToPopout);
|
|
7159
|
+
group.model.openPanel(panel);
|
|
7160
|
+
});
|
|
7161
|
+
}
|
|
7162
|
+
else {
|
|
7163
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7164
|
+
from: referenceGroup,
|
|
7165
|
+
to: group,
|
|
7166
|
+
}));
|
|
7167
|
+
switch (referenceLocation) {
|
|
7168
|
+
case 'grid':
|
|
7169
|
+
referenceGroup.api.setHidden(true);
|
|
7170
|
+
break;
|
|
7171
|
+
case 'floating':
|
|
7172
|
+
case 'popout':
|
|
7173
|
+
this.removeGroup(referenceGroup);
|
|
7174
|
+
break;
|
|
7175
|
+
}
|
|
7176
|
+
}
|
|
7177
|
+
popoutContainer.classList.add('dv-dockview');
|
|
7178
|
+
popoutContainer.style.overflow = 'hidden';
|
|
7179
|
+
popoutContainer.appendChild(gready);
|
|
7180
|
+
popoutContainer.appendChild(group.element);
|
|
7181
|
+
group.model.location = {
|
|
7182
|
+
type: 'popout',
|
|
7183
|
+
getWindow: () => _window.window,
|
|
7184
|
+
};
|
|
7185
|
+
this.doSetGroupAndPanelActive(group);
|
|
7186
|
+
popoutWindowDisposable.addDisposables(group.api.onDidActiveChange((event) => {
|
|
7187
|
+
var _a;
|
|
7188
|
+
if (event.isActive) {
|
|
7189
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7190
|
+
}
|
|
7191
|
+
}), group.api.onWillFocus(() => {
|
|
7192
|
+
var _a;
|
|
7193
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7194
|
+
}));
|
|
7195
|
+
let returnedGroup;
|
|
7196
|
+
const value = {
|
|
7197
|
+
window: _window,
|
|
7198
|
+
popoutGroup: group,
|
|
7199
|
+
referenceGroup: this.getPanel(referenceGroup.id)
|
|
7200
|
+
? referenceGroup.id
|
|
7201
|
+
: undefined,
|
|
7202
|
+
disposable: {
|
|
7203
|
+
dispose: () => {
|
|
7204
|
+
popoutWindowDisposable.dispose();
|
|
7205
|
+
return returnedGroup;
|
|
7206
|
+
},
|
|
7207
|
+
},
|
|
7208
|
+
};
|
|
7209
|
+
popoutWindowDisposable.addDisposables(
|
|
7210
|
+
/**
|
|
7211
|
+
* ResizeObserver seems slow here, I do not know why but we don't need it
|
|
7212
|
+
* since we can reply on the window resize event as we will occupy the full
|
|
7213
|
+
* window dimensions
|
|
7214
|
+
*/
|
|
7215
|
+
addDisposableWindowListener(_window.window, 'resize', () => {
|
|
7216
|
+
group.layout(window.innerWidth, window.innerHeight);
|
|
7217
|
+
}), overlayRenderContainer, Disposable.from(() => {
|
|
7218
|
+
if (this.getPanel(referenceGroup.id)) {
|
|
7219
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7220
|
+
from: group,
|
|
7221
|
+
to: referenceGroup,
|
|
7222
|
+
}));
|
|
7223
|
+
if (referenceGroup.api.isHidden) {
|
|
7224
|
+
referenceGroup.api.setHidden(false);
|
|
7225
|
+
}
|
|
7226
|
+
if (this.getPanel(group.id)) {
|
|
7227
|
+
this.doRemoveGroup(group, {
|
|
7228
|
+
skipPopoutAssociated: true,
|
|
7229
|
+
});
|
|
7230
|
+
}
|
|
7231
|
+
}
|
|
7232
|
+
else {
|
|
7233
|
+
if (this.getPanel(group.id)) {
|
|
7234
|
+
const removedGroup = this.doRemoveGroup(group, {
|
|
7235
|
+
skipDispose: true,
|
|
7236
|
+
skipActive: true,
|
|
7237
|
+
});
|
|
7238
|
+
removedGroup.model.renderContainer =
|
|
7239
|
+
this.overlayRenderContainer;
|
|
7240
|
+
removedGroup.model.location = { type: 'grid' };
|
|
7241
|
+
returnedGroup = removedGroup;
|
|
7242
|
+
}
|
|
7243
|
+
}
|
|
7244
|
+
}));
|
|
7245
|
+
this._popoutGroups.push(value);
|
|
7246
|
+
this.updateWatermark();
|
|
7247
|
+
})
|
|
7248
|
+
.catch((err) => {
|
|
7249
|
+
console.error(err);
|
|
6727
7250
|
});
|
|
6728
|
-
popoutWindow.addDisposables({
|
|
6729
|
-
dispose: () => {
|
|
6730
|
-
remove(this._popoutGroups, popoutWindow);
|
|
6731
|
-
this.updateWatermark();
|
|
6732
|
-
},
|
|
6733
|
-
}, popoutWindow.window.onDidClose(() => {
|
|
6734
|
-
this.doAddGroup(group, [0]);
|
|
6735
|
-
}));
|
|
6736
|
-
this._popoutGroups.push(popoutWindow);
|
|
6737
|
-
this.updateWatermark();
|
|
6738
7251
|
}
|
|
6739
7252
|
addFloatingGroup(item, coord, options) {
|
|
6740
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7253
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6741
7254
|
let group;
|
|
6742
7255
|
if (item instanceof DockviewPanel) {
|
|
6743
7256
|
group = this.createGroup();
|
|
6744
|
-
this.
|
|
7257
|
+
this._onDidAddGroup.fire(group);
|
|
7258
|
+
this.movingLock(() => this.removePanel(item, {
|
|
6745
7259
|
removeEmptyGroup: true,
|
|
6746
7260
|
skipDispose: true,
|
|
6747
|
-
|
|
6748
|
-
|
|
7261
|
+
skipSetActiveGroup: true,
|
|
7262
|
+
}));
|
|
7263
|
+
group.model.openPanel(item, { skipSetGroupActive: true });
|
|
6749
7264
|
}
|
|
6750
7265
|
else {
|
|
6751
7266
|
group = item;
|
|
7267
|
+
const popoutReferenceGroupId = (_a = this._popoutGroups.find((_) => _.popoutGroup === group)) === null || _a === void 0 ? void 0 : _a.referenceGroup;
|
|
7268
|
+
const popoutReferenceGroup = popoutReferenceGroupId
|
|
7269
|
+
? this.getPanel(popoutReferenceGroupId)
|
|
7270
|
+
: undefined;
|
|
6752
7271
|
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
6753
7272
|
options.skipRemoveGroup;
|
|
6754
7273
|
if (!skip) {
|
|
6755
|
-
|
|
7274
|
+
if (popoutReferenceGroup) {
|
|
7275
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7276
|
+
from: item,
|
|
7277
|
+
to: popoutReferenceGroup,
|
|
7278
|
+
}));
|
|
7279
|
+
this.doRemoveGroup(item, {
|
|
7280
|
+
skipPopoutReturn: true,
|
|
7281
|
+
skipPopoutAssociated: true,
|
|
7282
|
+
});
|
|
7283
|
+
this.doRemoveGroup(popoutReferenceGroup, {
|
|
7284
|
+
skipDispose: true,
|
|
7285
|
+
});
|
|
7286
|
+
group = popoutReferenceGroup;
|
|
7287
|
+
}
|
|
7288
|
+
else {
|
|
7289
|
+
this.doRemoveGroup(item, {
|
|
7290
|
+
skipDispose: true,
|
|
7291
|
+
skipPopoutReturn: true,
|
|
7292
|
+
skipPopoutAssociated: !!popoutReferenceGroup,
|
|
7293
|
+
});
|
|
7294
|
+
}
|
|
6756
7295
|
}
|
|
6757
7296
|
}
|
|
6758
|
-
group.model.location = 'floating';
|
|
7297
|
+
group.model.location = { type: 'floating' };
|
|
6759
7298
|
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6760
7299
|
? Math.max(coord.x, 0)
|
|
6761
7300
|
: DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
@@ -6765,16 +7304,16 @@
|
|
|
6765
7304
|
const overlay = new Overlay({
|
|
6766
7305
|
container: this.gridview.element,
|
|
6767
7306
|
content: group.element,
|
|
6768
|
-
height: (
|
|
6769
|
-
width: (
|
|
7307
|
+
height: (_b = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _b !== void 0 ? _b : 300,
|
|
7308
|
+
width: (_c = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _c !== void 0 ? _c : 300,
|
|
6770
7309
|
left: overlayLeft,
|
|
6771
7310
|
top: overlayTop,
|
|
6772
7311
|
minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6773
7312
|
? undefined
|
|
6774
|
-
: (
|
|
7313
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumWidthWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6775
7314
|
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6776
7315
|
? undefined
|
|
6777
|
-
: (
|
|
7316
|
+
: (_g = (_f = this.options.floatingGroupBounds) === null || _f === void 0 ? void 0 : _f.minimumHeightWithinViewport) !== null && _g !== void 0 ? _g : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6778
7317
|
});
|
|
6779
7318
|
const el = group.element.querySelector('.void-container');
|
|
6780
7319
|
if (!el) {
|
|
@@ -6805,12 +7344,15 @@
|
|
|
6805
7344
|
}), {
|
|
6806
7345
|
dispose: () => {
|
|
6807
7346
|
disposable.dispose();
|
|
6808
|
-
group.model.location = 'grid';
|
|
7347
|
+
group.model.location = { type: 'grid' };
|
|
6809
7348
|
remove(this._floatingGroups, floatingGroupPanel);
|
|
6810
7349
|
this.updateWatermark();
|
|
6811
7350
|
},
|
|
6812
7351
|
});
|
|
6813
7352
|
this._floatingGroups.push(floatingGroupPanel);
|
|
7353
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
|
|
7354
|
+
this.doSetGroupAndPanelActive(group);
|
|
7355
|
+
}
|
|
6814
7356
|
this.updateWatermark();
|
|
6815
7357
|
}
|
|
6816
7358
|
orthogonalize(position) {
|
|
@@ -6900,8 +7442,8 @@
|
|
|
6900
7442
|
return this.panels.find((panel) => panel.id === id);
|
|
6901
7443
|
}
|
|
6902
7444
|
setActivePanel(panel) {
|
|
6903
|
-
this.doSetGroupActive(panel.group);
|
|
6904
7445
|
panel.group.model.openPanel(panel);
|
|
7446
|
+
this.doSetGroupAndPanelActive(panel.group);
|
|
6905
7447
|
}
|
|
6906
7448
|
moveToNext(options = {}) {
|
|
6907
7449
|
var _a;
|
|
@@ -6962,7 +7504,8 @@
|
|
|
6962
7504
|
});
|
|
6963
7505
|
const popoutGroups = this._popoutGroups.map((group) => {
|
|
6964
7506
|
return {
|
|
6965
|
-
data: group.
|
|
7507
|
+
data: group.popoutGroup.toJSON(),
|
|
7508
|
+
gridReferenceGroup: group.referenceGroup,
|
|
6966
7509
|
position: group.window.dimensions(),
|
|
6967
7510
|
};
|
|
6968
7511
|
});
|
|
@@ -6980,7 +7523,7 @@
|
|
|
6980
7523
|
return result;
|
|
6981
7524
|
}
|
|
6982
7525
|
fromJSON(data) {
|
|
6983
|
-
var _a, _b;
|
|
7526
|
+
var _a, _b, _c;
|
|
6984
7527
|
this.clear();
|
|
6985
7528
|
if (typeof data !== 'object' || data === null) {
|
|
6986
7529
|
throw new Error('serialized layout must be a non-null object');
|
|
@@ -7019,7 +7562,7 @@
|
|
|
7019
7562
|
const isActive = typeof activeView === 'string' &&
|
|
7020
7563
|
activeView === panel.id;
|
|
7021
7564
|
group.model.openPanel(panel, {
|
|
7022
|
-
|
|
7565
|
+
skipSetActive: !isActive,
|
|
7023
7566
|
skipSetGroupActive: true,
|
|
7024
7567
|
});
|
|
7025
7568
|
}
|
|
@@ -7049,11 +7592,16 @@
|
|
|
7049
7592
|
}
|
|
7050
7593
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7051
7594
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
7052
|
-
const { data, position } = serializedPopoutGroup;
|
|
7595
|
+
const { data, position, gridReferenceGroup } = serializedPopoutGroup;
|
|
7053
7596
|
const group = createGroupFromSerializedState(data);
|
|
7054
|
-
this.addPopoutGroup(
|
|
7597
|
+
this.addPopoutGroup((_c = (gridReferenceGroup
|
|
7598
|
+
? this.getPanel(gridReferenceGroup)
|
|
7599
|
+
: undefined)) !== null && _c !== void 0 ? _c : group, {
|
|
7055
7600
|
skipRemoveGroup: true,
|
|
7056
7601
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
7602
|
+
overridePopoutGroup: gridReferenceGroup
|
|
7603
|
+
? group
|
|
7604
|
+
: undefined,
|
|
7057
7605
|
});
|
|
7058
7606
|
}
|
|
7059
7607
|
for (const floatingGroup of this._floatingGroups) {
|
|
@@ -7100,12 +7648,13 @@
|
|
|
7100
7648
|
*/
|
|
7101
7649
|
throw err;
|
|
7102
7650
|
}
|
|
7651
|
+
this.updateWatermark();
|
|
7103
7652
|
this._onDidLayoutFromJSON.fire();
|
|
7104
7653
|
}
|
|
7105
7654
|
clear() {
|
|
7106
7655
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7107
7656
|
const hasActiveGroup = !!this.activeGroup;
|
|
7108
|
-
|
|
7657
|
+
!!this.activePanel;
|
|
7109
7658
|
for (const group of groups) {
|
|
7110
7659
|
// remove the group will automatically remove the panels
|
|
7111
7660
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7113,9 +7662,6 @@
|
|
|
7113
7662
|
if (hasActiveGroup) {
|
|
7114
7663
|
this.doSetGroupAndPanelActive(undefined);
|
|
7115
7664
|
}
|
|
7116
|
-
if (hasActivePanel) {
|
|
7117
|
-
this._onDidActivePanelChange.fire(undefined);
|
|
7118
|
-
}
|
|
7119
7665
|
this.gridview.clear();
|
|
7120
7666
|
}
|
|
7121
7667
|
closeAllGroups() {
|
|
@@ -7156,6 +7702,7 @@
|
|
|
7156
7702
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
7157
7703
|
const panel = this.createPanel(options, group);
|
|
7158
7704
|
group.model.openPanel(panel);
|
|
7705
|
+
this.doSetGroupAndPanelActive(group);
|
|
7159
7706
|
return panel;
|
|
7160
7707
|
}
|
|
7161
7708
|
}
|
|
@@ -7167,6 +7714,7 @@
|
|
|
7167
7714
|
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
7168
7715
|
if (options.floating) {
|
|
7169
7716
|
const group = this.createGroup();
|
|
7717
|
+
this._onDidAddGroup.fire(group);
|
|
7170
7718
|
const o = typeof options.floating === 'object' &&
|
|
7171
7719
|
options.floating !== null
|
|
7172
7720
|
? options.floating
|
|
@@ -7174,16 +7722,16 @@
|
|
|
7174
7722
|
this.addFloatingGroup(group, o, {
|
|
7175
7723
|
inDragMode: false,
|
|
7176
7724
|
skipRemoveGroup: true,
|
|
7725
|
+
skipActiveGroup: true,
|
|
7177
7726
|
});
|
|
7178
|
-
this._onDidAddGroup.fire(group);
|
|
7179
7727
|
panel = this.createPanel(options, group);
|
|
7180
7728
|
group.model.openPanel(panel);
|
|
7181
|
-
this.doSetGroupAndPanelActive(group);
|
|
7182
7729
|
}
|
|
7183
|
-
else if (referenceGroup.api.location === 'floating' ||
|
|
7730
|
+
else if (referenceGroup.api.location.type === 'floating' ||
|
|
7184
7731
|
target === 'center') {
|
|
7185
7732
|
panel = this.createPanel(options, referenceGroup);
|
|
7186
7733
|
referenceGroup.model.openPanel(panel);
|
|
7734
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
7187
7735
|
}
|
|
7188
7736
|
else {
|
|
7189
7737
|
const location = getGridLocation(referenceGroup.element);
|
|
@@ -7191,10 +7739,12 @@
|
|
|
7191
7739
|
const group = this.createGroupAtLocation(relativeLocation);
|
|
7192
7740
|
panel = this.createPanel(options, group);
|
|
7193
7741
|
group.model.openPanel(panel);
|
|
7742
|
+
this.doSetGroupAndPanelActive(group);
|
|
7194
7743
|
}
|
|
7195
7744
|
}
|
|
7196
7745
|
else if (options.floating) {
|
|
7197
7746
|
const group = this.createGroup();
|
|
7747
|
+
this._onDidAddGroup.fire(group);
|
|
7198
7748
|
const o = typeof options.floating === 'object' &&
|
|
7199
7749
|
options.floating !== null
|
|
7200
7750
|
? options.floating
|
|
@@ -7202,16 +7752,16 @@
|
|
|
7202
7752
|
this.addFloatingGroup(group, o, {
|
|
7203
7753
|
inDragMode: false,
|
|
7204
7754
|
skipRemoveGroup: true,
|
|
7755
|
+
skipActiveGroup: true,
|
|
7205
7756
|
});
|
|
7206
|
-
this._onDidAddGroup.fire(group);
|
|
7207
7757
|
panel = this.createPanel(options, group);
|
|
7208
7758
|
group.model.openPanel(panel);
|
|
7209
|
-
this.doSetGroupAndPanelActive(group);
|
|
7210
7759
|
}
|
|
7211
7760
|
else {
|
|
7212
7761
|
const group = this.createGroupAtLocation();
|
|
7213
7762
|
panel = this.createPanel(options, group);
|
|
7214
7763
|
group.model.openPanel(panel);
|
|
7764
|
+
this.doSetGroupAndPanelActive(group);
|
|
7215
7765
|
}
|
|
7216
7766
|
return panel;
|
|
7217
7767
|
}
|
|
@@ -7223,13 +7773,15 @@
|
|
|
7223
7773
|
if (!group) {
|
|
7224
7774
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
7225
7775
|
}
|
|
7226
|
-
group.model.removePanel(panel
|
|
7776
|
+
group.model.removePanel(panel, {
|
|
7777
|
+
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
7778
|
+
});
|
|
7227
7779
|
if (!options.skipDispose) {
|
|
7228
|
-
|
|
7780
|
+
panel.group.model.renderContainer.detatch(panel);
|
|
7229
7781
|
panel.dispose();
|
|
7230
7782
|
}
|
|
7231
7783
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
7232
|
-
this.removeGroup(group);
|
|
7784
|
+
this.removeGroup(group, { skipActive: options.skipSetActiveGroup });
|
|
7233
7785
|
}
|
|
7234
7786
|
}
|
|
7235
7787
|
createWatermarkComponent() {
|
|
@@ -7242,7 +7794,7 @@
|
|
|
7242
7794
|
}
|
|
7243
7795
|
updateWatermark() {
|
|
7244
7796
|
var _a, _b;
|
|
7245
|
-
if (this.groups.filter((x) => x.api.location === 'grid').length === 0) {
|
|
7797
|
+
if (this.groups.filter((x) => x.api.location.type === 'grid' && !x.api.isHidden).length === 0) {
|
|
7246
7798
|
if (!this.watermark) {
|
|
7247
7799
|
this.watermark = this.createWatermarkComponent();
|
|
7248
7800
|
this.watermark.init({
|
|
@@ -7288,36 +7840,42 @@
|
|
|
7288
7840
|
}
|
|
7289
7841
|
else {
|
|
7290
7842
|
const group = this.orthogonalize(directionToPosition(options.direction));
|
|
7843
|
+
if (!options.skipSetActive) {
|
|
7844
|
+
this.doSetGroupAndPanelActive(group);
|
|
7845
|
+
}
|
|
7291
7846
|
return group;
|
|
7292
7847
|
}
|
|
7293
7848
|
const target = toTarget(options.direction || 'within');
|
|
7294
7849
|
const location = getGridLocation(referenceGroup.element);
|
|
7295
7850
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7296
7851
|
this.doAddGroup(group, relativeLocation);
|
|
7852
|
+
if (!options.skipSetActive) {
|
|
7853
|
+
this.doSetGroupAndPanelActive(group);
|
|
7854
|
+
}
|
|
7297
7855
|
return group;
|
|
7298
7856
|
}
|
|
7299
7857
|
else {
|
|
7300
7858
|
this.doAddGroup(group);
|
|
7859
|
+
this.doSetGroupAndPanelActive(group);
|
|
7301
7860
|
return group;
|
|
7302
7861
|
}
|
|
7303
7862
|
}
|
|
7304
7863
|
removeGroup(group, options) {
|
|
7864
|
+
this.doRemoveGroup(group, options);
|
|
7865
|
+
}
|
|
7866
|
+
doRemoveGroup(group, options) {
|
|
7305
7867
|
var _a;
|
|
7306
7868
|
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7869
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7870
|
+
for (const panel of panels) {
|
|
7871
|
+
this.removePanel(panel, {
|
|
7872
|
+
removeEmptyGroup: false,
|
|
7873
|
+
skipDispose: (_a = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _a !== void 0 ? _a : false,
|
|
7874
|
+
});
|
|
7875
|
+
}
|
|
7312
7876
|
}
|
|
7313
7877
|
const activePanel = this.activePanel;
|
|
7314
|
-
|
|
7315
|
-
if (this.activePanel !== activePanel) {
|
|
7316
|
-
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7317
|
-
}
|
|
7318
|
-
}
|
|
7319
|
-
doRemoveGroup(group, options) {
|
|
7320
|
-
if (group.api.location === 'floating') {
|
|
7878
|
+
if (group.api.location.type === 'floating') {
|
|
7321
7879
|
const floatingGroup = this._floatingGroups.find((_) => _.group === group);
|
|
7322
7880
|
if (floatingGroup) {
|
|
7323
7881
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
@@ -7329,60 +7887,124 @@
|
|
|
7329
7887
|
floatingGroup.dispose();
|
|
7330
7888
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7331
7889
|
const groups = Array.from(this._groups.values());
|
|
7332
|
-
this.
|
|
7890
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7333
7891
|
}
|
|
7334
7892
|
return floatingGroup.group;
|
|
7335
7893
|
}
|
|
7336
7894
|
throw new Error('failed to find floating group');
|
|
7337
7895
|
}
|
|
7338
|
-
if (group.api.location === 'popout') {
|
|
7339
|
-
const selectedGroup = this._popoutGroups.find((_) => _.
|
|
7896
|
+
if (group.api.location.type === 'popout') {
|
|
7897
|
+
const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
|
|
7340
7898
|
if (selectedGroup) {
|
|
7341
7899
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7342
|
-
|
|
7900
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutAssociated)) {
|
|
7901
|
+
const refGroup = selectedGroup.referenceGroup
|
|
7902
|
+
? this.getPanel(selectedGroup.referenceGroup)
|
|
7903
|
+
: undefined;
|
|
7904
|
+
if (refGroup) {
|
|
7905
|
+
this.removeGroup(refGroup);
|
|
7906
|
+
}
|
|
7907
|
+
}
|
|
7908
|
+
selectedGroup.popoutGroup.dispose();
|
|
7343
7909
|
this._groups.delete(group.id);
|
|
7344
7910
|
this._onDidRemoveGroup.fire(group);
|
|
7345
7911
|
}
|
|
7346
|
-
selectedGroup.dispose();
|
|
7912
|
+
const removedGroup = selectedGroup.disposable.dispose();
|
|
7913
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
|
|
7914
|
+
this.doAddGroup(removedGroup, [0]);
|
|
7915
|
+
this.doSetGroupAndPanelActive(removedGroup);
|
|
7916
|
+
}
|
|
7347
7917
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7348
7918
|
const groups = Array.from(this._groups.values());
|
|
7349
|
-
this.
|
|
7919
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7350
7920
|
}
|
|
7351
|
-
|
|
7921
|
+
this.updateWatermark();
|
|
7922
|
+
return selectedGroup.popoutGroup;
|
|
7352
7923
|
}
|
|
7353
7924
|
throw new Error('failed to find popout group');
|
|
7354
7925
|
}
|
|
7355
|
-
|
|
7926
|
+
const re = super.doRemoveGroup(group, options);
|
|
7927
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
7928
|
+
if (this.activePanel !== activePanel) {
|
|
7929
|
+
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7930
|
+
}
|
|
7931
|
+
}
|
|
7932
|
+
return re;
|
|
7356
7933
|
}
|
|
7357
|
-
|
|
7358
|
-
|
|
7934
|
+
movingLock(func) {
|
|
7935
|
+
const isMoving = this._moving;
|
|
7936
|
+
try {
|
|
7937
|
+
this._moving = true;
|
|
7938
|
+
return func();
|
|
7939
|
+
}
|
|
7940
|
+
finally {
|
|
7941
|
+
this._moving = isMoving;
|
|
7942
|
+
}
|
|
7943
|
+
}
|
|
7944
|
+
moveGroupOrPanel(options) {
|
|
7945
|
+
var _a;
|
|
7946
|
+
const destinationGroup = options.to.group;
|
|
7947
|
+
const sourceGroupId = options.from.groupId;
|
|
7948
|
+
const sourceItemId = options.from.panelId;
|
|
7949
|
+
const destinationTarget = options.to.position;
|
|
7950
|
+
const destinationIndex = options.to.index;
|
|
7359
7951
|
const sourceGroup = sourceGroupId
|
|
7360
7952
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
7361
7953
|
: undefined;
|
|
7954
|
+
if (!sourceGroup) {
|
|
7955
|
+
throw new Error(`Failed to find group id ${sourceGroupId}`);
|
|
7956
|
+
}
|
|
7362
7957
|
if (sourceItemId === undefined) {
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7958
|
+
/**
|
|
7959
|
+
* Moving an entire group into another group
|
|
7960
|
+
*/
|
|
7961
|
+
this.moveGroup({
|
|
7962
|
+
from: { group: sourceGroup },
|
|
7963
|
+
to: {
|
|
7964
|
+
group: destinationGroup,
|
|
7965
|
+
position: destinationTarget,
|
|
7966
|
+
},
|
|
7967
|
+
});
|
|
7366
7968
|
return;
|
|
7367
7969
|
}
|
|
7368
7970
|
if (!destinationTarget || destinationTarget === 'center') {
|
|
7369
|
-
|
|
7370
|
-
|
|
7971
|
+
/**
|
|
7972
|
+
* Dropping a panel within another group
|
|
7973
|
+
*/
|
|
7974
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
7975
|
+
skipSetActive: false,
|
|
7976
|
+
skipSetActiveGroup: true,
|
|
7977
|
+
}));
|
|
7978
|
+
if (!removedPanel) {
|
|
7371
7979
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7372
7980
|
}
|
|
7373
|
-
if (
|
|
7374
|
-
|
|
7981
|
+
if (sourceGroup.model.size === 0) {
|
|
7982
|
+
// remove the group and do not set a new group as active
|
|
7983
|
+
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
7375
7984
|
}
|
|
7376
|
-
destinationGroup.model.openPanel(
|
|
7985
|
+
this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
|
|
7377
7986
|
index: destinationIndex,
|
|
7987
|
+
skipSetGroupActive: true,
|
|
7988
|
+
}));
|
|
7989
|
+
this.doSetGroupAndPanelActive(destinationGroup);
|
|
7990
|
+
this._onDidMovePanel.fire({
|
|
7991
|
+
panel: removedPanel,
|
|
7378
7992
|
});
|
|
7379
7993
|
}
|
|
7380
7994
|
else {
|
|
7995
|
+
/**
|
|
7996
|
+
* Dropping a panel to the extremities of a group which will place that panel
|
|
7997
|
+
* into an adjacent group
|
|
7998
|
+
*/
|
|
7381
7999
|
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
7382
8000
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7383
|
-
if (sourceGroup
|
|
8001
|
+
if (sourceGroup.size < 2) {
|
|
8002
|
+
/**
|
|
8003
|
+
* If we are moving from a group which only has one panel left we will consider
|
|
8004
|
+
* moving the group itself rather than moving the panel into a newly created group
|
|
8005
|
+
*/
|
|
7384
8006
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
7385
|
-
if (sourceGroup.api.location === 'grid') {
|
|
8007
|
+
if (sourceGroup.api.location.type === 'grid') {
|
|
7386
8008
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
7387
8009
|
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
7388
8010
|
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
@@ -7390,78 +8012,123 @@
|
|
|
7390
8012
|
// if a group has one tab - we are essentially moving the 'group'
|
|
7391
8013
|
// which is equivalent to swapping two views in this case
|
|
7392
8014
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8015
|
+
return;
|
|
7393
8016
|
}
|
|
7394
8017
|
}
|
|
7395
8018
|
// source group will become empty so delete the group
|
|
7396
|
-
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
8019
|
+
const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
|
|
7397
8020
|
skipActive: true,
|
|
7398
8021
|
skipDispose: true,
|
|
7399
|
-
});
|
|
8022
|
+
}));
|
|
7400
8023
|
// after deleting the group we need to re-evaulate the ref location
|
|
7401
8024
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
7402
8025
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
7403
|
-
this.doAddGroup(targetGroup, location);
|
|
8026
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8027
|
+
this.doSetGroupAndPanelActive(targetGroup);
|
|
7404
8028
|
}
|
|
7405
8029
|
else {
|
|
7406
|
-
|
|
7407
|
-
|
|
8030
|
+
/**
|
|
8031
|
+
* The group we are removing from has many panels, we need to remove the panels we are moving,
|
|
8032
|
+
* create a new group, add the panels to that new group and add the new group in an appropiate position
|
|
8033
|
+
*/
|
|
8034
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8035
|
+
skipSetActive: false,
|
|
8036
|
+
skipSetActiveGroup: true,
|
|
8037
|
+
}));
|
|
8038
|
+
if (!removedPanel) {
|
|
7408
8039
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7409
8040
|
}
|
|
7410
8041
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7411
8042
|
const group = this.createGroupAtLocation(dropLocation);
|
|
7412
|
-
group.model.openPanel(
|
|
8043
|
+
this.movingLock(() => group.model.openPanel(removedPanel, {
|
|
8044
|
+
skipSetGroupActive: true,
|
|
8045
|
+
}));
|
|
8046
|
+
this.doSetGroupAndPanelActive(group);
|
|
7413
8047
|
}
|
|
7414
8048
|
}
|
|
7415
8049
|
}
|
|
7416
|
-
moveGroup(
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
8050
|
+
moveGroup(options) {
|
|
8051
|
+
const from = options.from.group;
|
|
8052
|
+
const to = options.to.group;
|
|
8053
|
+
const target = options.to.position;
|
|
8054
|
+
if (target === 'center') {
|
|
8055
|
+
const activePanel = from.activePanel;
|
|
8056
|
+
const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
|
|
8057
|
+
skipSetActive: true,
|
|
8058
|
+
})));
|
|
8059
|
+
if ((from === null || from === void 0 ? void 0 : from.model.size) === 0) {
|
|
8060
|
+
this.doRemoveGroup(from, { skipActive: true });
|
|
8061
|
+
}
|
|
8062
|
+
this.movingLock(() => {
|
|
7424
8063
|
for (const panel of panels) {
|
|
7425
|
-
|
|
7426
|
-
|
|
8064
|
+
to.model.openPanel(panel, {
|
|
8065
|
+
skipSetActive: panel !== activePanel,
|
|
8066
|
+
skipSetGroupActive: true,
|
|
7427
8067
|
});
|
|
7428
8068
|
}
|
|
7429
|
-
}
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
8069
|
+
});
|
|
8070
|
+
this.doSetGroupAndPanelActive(to);
|
|
8071
|
+
panels.forEach((panel) => {
|
|
8072
|
+
this._onDidMovePanel.fire({ panel });
|
|
8073
|
+
});
|
|
8074
|
+
}
|
|
8075
|
+
else {
|
|
8076
|
+
switch (from.api.location.type) {
|
|
8077
|
+
case 'grid':
|
|
8078
|
+
this.gridview.removeView(getGridLocation(from.element));
|
|
8079
|
+
break;
|
|
8080
|
+
case 'floating': {
|
|
8081
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
8082
|
+
if (!selectedFloatingGroup) {
|
|
8083
|
+
throw new Error('failed to find floating group');
|
|
7442
8084
|
}
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
8085
|
+
selectedFloatingGroup.dispose();
|
|
8086
|
+
break;
|
|
8087
|
+
}
|
|
8088
|
+
case 'popout': {
|
|
8089
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
8090
|
+
if (!selectedPopoutGroup) {
|
|
8091
|
+
throw new Error('failed to find popout group');
|
|
7449
8092
|
}
|
|
8093
|
+
selectedPopoutGroup.disposable.dispose();
|
|
7450
8094
|
}
|
|
7451
|
-
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
7452
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
7453
|
-
this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
|
|
7454
8095
|
}
|
|
8096
|
+
const referenceLocation = getGridLocation(to.element);
|
|
8097
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8098
|
+
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8099
|
+
from.panels.forEach((panel) => {
|
|
8100
|
+
this._onDidMovePanel.fire({ panel });
|
|
8101
|
+
});
|
|
7455
8102
|
}
|
|
7456
8103
|
}
|
|
7457
|
-
|
|
7458
|
-
|
|
8104
|
+
doSetGroupActive(group) {
|
|
8105
|
+
super.doSetGroupActive(group);
|
|
8106
|
+
const activePanel = this.activePanel;
|
|
8107
|
+
if (!this._moving &&
|
|
8108
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8109
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8110
|
+
}
|
|
8111
|
+
}
|
|
8112
|
+
doSetGroupAndPanelActive(group) {
|
|
8113
|
+
super.doSetGroupActive(group);
|
|
7459
8114
|
const activePanel = this.activePanel;
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
this.
|
|
8115
|
+
if (group &&
|
|
8116
|
+
this.hasMaximizedGroup() &&
|
|
8117
|
+
!this.isMaximizedGroup(group)) {
|
|
8118
|
+
this.exitMaximizedGroup();
|
|
8119
|
+
}
|
|
8120
|
+
if (!this._moving &&
|
|
8121
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8122
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
7463
8123
|
}
|
|
7464
8124
|
}
|
|
8125
|
+
getNextGroupId() {
|
|
8126
|
+
let id = this.nextGroupId.next();
|
|
8127
|
+
while (this._groups.has(id)) {
|
|
8128
|
+
id = this.nextGroupId.next();
|
|
8129
|
+
}
|
|
8130
|
+
return id;
|
|
8131
|
+
}
|
|
7465
8132
|
createGroup(options) {
|
|
7466
8133
|
if (!options) {
|
|
7467
8134
|
options = {};
|
|
@@ -7478,7 +8145,7 @@
|
|
|
7478
8145
|
}
|
|
7479
8146
|
}
|
|
7480
8147
|
const view = new DockviewGroupPanel(this, id, options);
|
|
7481
|
-
view.init({ params: {}, accessor:
|
|
8148
|
+
view.init({ params: {}, accessor: this });
|
|
7482
8149
|
if (!this._groups.has(view.id)) {
|
|
7483
8150
|
const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {
|
|
7484
8151
|
this._onWillDragPanel.fire(event);
|
|
@@ -7486,20 +8153,48 @@
|
|
|
7486
8153
|
this._onWillDragGroup.fire(event);
|
|
7487
8154
|
}), view.model.onMove((event) => {
|
|
7488
8155
|
const { groupId, itemId, target, index } = event;
|
|
7489
|
-
this.moveGroupOrPanel(
|
|
8156
|
+
this.moveGroupOrPanel({
|
|
8157
|
+
from: { groupId: groupId, panelId: itemId },
|
|
8158
|
+
to: {
|
|
8159
|
+
group: view,
|
|
8160
|
+
position: target,
|
|
8161
|
+
index,
|
|
8162
|
+
},
|
|
8163
|
+
});
|
|
7490
8164
|
}), view.model.onDidDrop((event) => {
|
|
7491
|
-
this._onDidDrop.fire(
|
|
8165
|
+
this._onDidDrop.fire(event);
|
|
8166
|
+
}), view.model.onWillDrop((event) => {
|
|
8167
|
+
this._onWillDrop.fire(event);
|
|
8168
|
+
}), view.model.onWillShowOverlay((event) => {
|
|
8169
|
+
if (this.options.disableDnd) {
|
|
8170
|
+
event.preventDefault();
|
|
8171
|
+
return;
|
|
8172
|
+
}
|
|
8173
|
+
this._onWillShowOverlay.fire(event);
|
|
7492
8174
|
}), view.model.onDidAddPanel((event) => {
|
|
8175
|
+
if (this._moving) {
|
|
8176
|
+
return;
|
|
8177
|
+
}
|
|
7493
8178
|
this._onDidAddPanel.fire(event.panel);
|
|
7494
8179
|
}), view.model.onDidRemovePanel((event) => {
|
|
8180
|
+
if (this._moving) {
|
|
8181
|
+
return;
|
|
8182
|
+
}
|
|
7495
8183
|
this._onDidRemovePanel.fire(event.panel);
|
|
7496
8184
|
}), view.model.onDidActivePanelChange((event) => {
|
|
7497
|
-
this.
|
|
8185
|
+
if (this._moving) {
|
|
8186
|
+
return;
|
|
8187
|
+
}
|
|
8188
|
+
if (event.panel !== this.activePanel) {
|
|
8189
|
+
return;
|
|
8190
|
+
}
|
|
8191
|
+
if (this._onDidActivePanelChange.value !== event.panel) {
|
|
8192
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
8193
|
+
}
|
|
7498
8194
|
}));
|
|
7499
8195
|
this._groups.set(view.id, { value: view, disposable });
|
|
7500
8196
|
}
|
|
7501
|
-
// TODO: must be called after the above listeners have been setup,
|
|
7502
|
-
// not an ideal pattern
|
|
8197
|
+
// TODO: must be called after the above listeners have been setup, not an ideal pattern
|
|
7503
8198
|
view.initialize();
|
|
7504
8199
|
return view;
|
|
7505
8200
|
}
|
|
@@ -7552,7 +8247,20 @@
|
|
|
7552
8247
|
});
|
|
7553
8248
|
this._onDidLayoutfromJSON = new Emitter();
|
|
7554
8249
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
8250
|
+
this._onDidRemoveGroup = new Emitter();
|
|
8251
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
8252
|
+
this._onDidAddGroup = new Emitter();
|
|
8253
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
8254
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
8255
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
7555
8256
|
this._options = options;
|
|
8257
|
+
this.addDisposables(this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
|
|
8258
|
+
this._onDidAddGroup.fire(event);
|
|
8259
|
+
}), this.onDidRemove((event) => {
|
|
8260
|
+
this._onDidRemoveGroup.fire(event);
|
|
8261
|
+
}), this.onDidActiveChange((event) => {
|
|
8262
|
+
this._onDidActiveGroupChange.fire(event);
|
|
8263
|
+
}));
|
|
7556
8264
|
if (!this.options.components) {
|
|
7557
8265
|
this.options.components = {};
|
|
7558
8266
|
}
|
|
@@ -7727,6 +8435,7 @@
|
|
|
7727
8435
|
});
|
|
7728
8436
|
this.registerPanel(view);
|
|
7729
8437
|
this.doAddGroup(view, relativeLocation, options.size);
|
|
8438
|
+
this.doSetGroupActive(view);
|
|
7730
8439
|
return view;
|
|
7731
8440
|
}
|
|
7732
8441
|
registerPanel(panel) {
|
|
@@ -8412,10 +9121,10 @@
|
|
|
8412
9121
|
this._onDidChange = new Emitter();
|
|
8413
9122
|
this.onDidChange = this._onDidChange.event;
|
|
8414
9123
|
this.api.initialize(this);
|
|
8415
|
-
this.addDisposables(this._onDidChange, this.api.
|
|
8416
|
-
const {
|
|
9124
|
+
this.addDisposables(this._onDidChange, this.api.onDidHiddenChange((event) => {
|
|
9125
|
+
const { isHidden } = event;
|
|
8417
9126
|
const { accessor } = this._params;
|
|
8418
|
-
accessor.setVisible(this,
|
|
9127
|
+
accessor.setVisible(this, !isHidden);
|
|
8419
9128
|
}), this.api.onActiveChange(() => {
|
|
8420
9129
|
const { accessor } = this._params;
|
|
8421
9130
|
accessor.setActive(this);
|
|
@@ -8537,13 +9246,13 @@
|
|
|
8537
9246
|
if (this.disposed) {
|
|
8538
9247
|
throw new Error('invalid operation: resource is already disposed');
|
|
8539
9248
|
}
|
|
8540
|
-
if (
|
|
9249
|
+
if (!isReactComponent(this.component)) {
|
|
8541
9250
|
/**
|
|
8542
9251
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
8543
|
-
* if we do not intercept
|
|
8544
|
-
* for the same reason
|
|
9252
|
+
* if we do not intercept then React library will throw a very obsure error
|
|
9253
|
+
* for the same reason... at least at this point we will emit a sensible stacktrace.
|
|
8545
9254
|
*/
|
|
8546
|
-
throw new Error('
|
|
9255
|
+
throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');
|
|
8547
9256
|
}
|
|
8548
9257
|
const bridgeComponent = React__namespace.createElement(React__namespace.forwardRef(ReactComponentBridge), {
|
|
8549
9258
|
component: this
|
|
@@ -8595,9 +9304,13 @@
|
|
|
8595
9304
|
}, []);
|
|
8596
9305
|
return [portals, addPortal];
|
|
8597
9306
|
};
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
9307
|
+
function isReactComponent(component) {
|
|
9308
|
+
/**
|
|
9309
|
+
* Yes, we could use "react-is" but that would introduce an unwanted peer dependency
|
|
9310
|
+
* so for now we will check in a rather crude fashion...
|
|
9311
|
+
*/
|
|
9312
|
+
return (typeof component === 'function' /** Functional Componnts */ ||
|
|
9313
|
+
!!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
|
|
8601
9314
|
}
|
|
8602
9315
|
|
|
8603
9316
|
class ReactPanelContentPart {
|
|
@@ -8857,6 +9570,8 @@
|
|
|
8857
9570
|
defaultRenderer: props.defaultRenderer,
|
|
8858
9571
|
debug: props.debug,
|
|
8859
9572
|
rootOverlayModel: props.rootOverlayModel,
|
|
9573
|
+
locked: props.locked,
|
|
9574
|
+
disableDnd: props.disableDnd,
|
|
8860
9575
|
});
|
|
8861
9576
|
const { clientWidth, clientHeight } = domRef.current;
|
|
8862
9577
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -8868,6 +9583,20 @@
|
|
|
8868
9583
|
dockview.dispose();
|
|
8869
9584
|
};
|
|
8870
9585
|
}, []);
|
|
9586
|
+
React__namespace.useEffect(() => {
|
|
9587
|
+
if (!dockviewRef.current) {
|
|
9588
|
+
return;
|
|
9589
|
+
}
|
|
9590
|
+
dockviewRef.current.locked = !!props.locked;
|
|
9591
|
+
}, [props.locked]);
|
|
9592
|
+
React__namespace.useEffect(() => {
|
|
9593
|
+
if (!dockviewRef.current) {
|
|
9594
|
+
return;
|
|
9595
|
+
}
|
|
9596
|
+
dockviewRef.current.updateOptions({
|
|
9597
|
+
disableDnd: props.disableDnd,
|
|
9598
|
+
});
|
|
9599
|
+
}, [props.disableDnd]);
|
|
8871
9600
|
React__namespace.useEffect(() => {
|
|
8872
9601
|
if (!dockviewRef.current) {
|
|
8873
9602
|
return () => {
|
|
@@ -8883,6 +9612,21 @@
|
|
|
8883
9612
|
disposable.dispose();
|
|
8884
9613
|
};
|
|
8885
9614
|
}, [props.onDidDrop]);
|
|
9615
|
+
React__namespace.useEffect(() => {
|
|
9616
|
+
if (!dockviewRef.current) {
|
|
9617
|
+
return () => {
|
|
9618
|
+
// noop
|
|
9619
|
+
};
|
|
9620
|
+
}
|
|
9621
|
+
const disposable = dockviewRef.current.onWillDrop((event) => {
|
|
9622
|
+
if (props.onWillDrop) {
|
|
9623
|
+
props.onWillDrop(event);
|
|
9624
|
+
}
|
|
9625
|
+
});
|
|
9626
|
+
return () => {
|
|
9627
|
+
disposable.dispose();
|
|
9628
|
+
};
|
|
9629
|
+
}, [props.onWillDrop]);
|
|
8886
9630
|
React__namespace.useEffect(() => {
|
|
8887
9631
|
if (!dockviewRef.current) {
|
|
8888
9632
|
return;
|
|
@@ -9125,7 +9869,9 @@
|
|
|
9125
9869
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
9126
9870
|
params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
|
|
9127
9871
|
api: this.api,
|
|
9128
|
-
|
|
9872
|
+
// TODO: fix casting hack
|
|
9873
|
+
containerApi: new GridviewApi(this._params
|
|
9874
|
+
.accessor),
|
|
9129
9875
|
});
|
|
9130
9876
|
}
|
|
9131
9877
|
}
|
|
@@ -9308,12 +10054,14 @@
|
|
|
9308
10054
|
exports.DockviewComponent = DockviewComponent;
|
|
9309
10055
|
exports.DockviewCompositeDisposable = CompositeDisposable;
|
|
9310
10056
|
exports.DockviewDefaultTab = DockviewDefaultTab;
|
|
10057
|
+
exports.DockviewDidDropEvent = DockviewDidDropEvent;
|
|
9311
10058
|
exports.DockviewEmitter = Emitter;
|
|
9312
10059
|
exports.DockviewGroupPanel = DockviewGroupPanel;
|
|
9313
10060
|
exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
|
|
9314
10061
|
exports.DockviewMutableDisposable = MutableDisposable;
|
|
9315
10062
|
exports.DockviewPanel = DockviewPanel;
|
|
9316
10063
|
exports.DockviewReact = DockviewReact;
|
|
10064
|
+
exports.DockviewWillDropEvent = DockviewWillDropEvent;
|
|
9317
10065
|
exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
|
|
9318
10066
|
exports.Gridview = Gridview;
|
|
9319
10067
|
exports.GridviewApi = GridviewApi;
|
|
@@ -9337,6 +10085,7 @@
|
|
|
9337
10085
|
exports.SplitviewPanel = SplitviewPanel;
|
|
9338
10086
|
exports.SplitviewReact = SplitviewReact;
|
|
9339
10087
|
exports.Tab = Tab;
|
|
10088
|
+
exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
|
|
9340
10089
|
exports.createComponent = createComponent;
|
|
9341
10090
|
exports.directionToPosition = directionToPosition;
|
|
9342
10091
|
exports.getDirectionOrientation = getDirectionOrientation;
|
|
@@ -9351,7 +10100,7 @@
|
|
|
9351
10100
|
exports.isGroupOptionsWithPanel = isGroupOptionsWithPanel;
|
|
9352
10101
|
exports.isPanelOptionsWithGroup = isPanelOptionsWithGroup;
|
|
9353
10102
|
exports.isPanelOptionsWithPanel = isPanelOptionsWithPanel;
|
|
9354
|
-
exports.
|
|
10103
|
+
exports.isReactComponent = isReactComponent;
|
|
9355
10104
|
exports.orthogonal = orthogonal;
|
|
9356
10105
|
exports.positionToDirection = positionToDirection;
|
|
9357
10106
|
exports.toTarget = toTarget;
|