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.esm.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
|
*/
|
|
@@ -119,6 +119,17 @@ var Event;
|
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
121
|
})(Event || (Event = {}));
|
|
122
|
+
class DockviewEvent {
|
|
123
|
+
constructor() {
|
|
124
|
+
this._defaultPrevented = false;
|
|
125
|
+
}
|
|
126
|
+
get defaultPrevented() {
|
|
127
|
+
return this._defaultPrevented;
|
|
128
|
+
}
|
|
129
|
+
preventDefault() {
|
|
130
|
+
this._defaultPrevented = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
122
133
|
class LeakageMonitor {
|
|
123
134
|
constructor() {
|
|
124
135
|
this.events = new Map();
|
|
@@ -162,6 +173,9 @@ class Emitter {
|
|
|
162
173
|
}
|
|
163
174
|
Emitter.ENABLE_TRACKING = isEnabled;
|
|
164
175
|
}
|
|
176
|
+
get value() {
|
|
177
|
+
return this._last;
|
|
178
|
+
}
|
|
165
179
|
constructor(options) {
|
|
166
180
|
this.options = options;
|
|
167
181
|
this._listeners = [];
|
|
@@ -284,8 +298,12 @@ class CompositeDisposable {
|
|
|
284
298
|
args.forEach((arg) => this._disposables.push(arg));
|
|
285
299
|
}
|
|
286
300
|
dispose() {
|
|
287
|
-
this.
|
|
301
|
+
if (this._isDisposed) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
288
304
|
this._isDisposed = true;
|
|
305
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
306
|
+
this._disposables = [];
|
|
289
307
|
}
|
|
290
308
|
}
|
|
291
309
|
class MutableDisposable {
|
|
@@ -769,6 +787,13 @@ class Splitview {
|
|
|
769
787
|
this._endSnappingEnabled = endSnappingEnabled;
|
|
770
788
|
this.updateSashEnablement();
|
|
771
789
|
}
|
|
790
|
+
get disabled() {
|
|
791
|
+
return this._disabled;
|
|
792
|
+
}
|
|
793
|
+
set disabled(value) {
|
|
794
|
+
this._disabled = value;
|
|
795
|
+
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
796
|
+
}
|
|
772
797
|
constructor(container, options) {
|
|
773
798
|
this.container = container;
|
|
774
799
|
this.viewItems = [];
|
|
@@ -779,6 +804,7 @@ class Splitview {
|
|
|
779
804
|
this._proportions = undefined;
|
|
780
805
|
this._startSnappingEnabled = true;
|
|
781
806
|
this._endSnappingEnabled = true;
|
|
807
|
+
this._disabled = false;
|
|
782
808
|
this._onDidSashEnd = new Emitter();
|
|
783
809
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
784
810
|
this._onDidAddView = new Emitter();
|
|
@@ -1706,7 +1732,13 @@ class BranchNode extends CompositeDisposable {
|
|
|
1706
1732
|
}
|
|
1707
1733
|
return LayoutPriority.Normal;
|
|
1708
1734
|
}
|
|
1709
|
-
|
|
1735
|
+
get disabled() {
|
|
1736
|
+
return this.splitview.disabled;
|
|
1737
|
+
}
|
|
1738
|
+
set disabled(value) {
|
|
1739
|
+
this.splitview.disabled = value;
|
|
1740
|
+
}
|
|
1741
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, childDescriptors) {
|
|
1710
1742
|
super();
|
|
1711
1743
|
this.orientation = orientation;
|
|
1712
1744
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1751,6 +1783,7 @@ class BranchNode extends CompositeDisposable {
|
|
|
1751
1783
|
styles,
|
|
1752
1784
|
});
|
|
1753
1785
|
}
|
|
1786
|
+
this.disabled = disabled;
|
|
1754
1787
|
this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
|
|
1755
1788
|
this._onDidChange.fire({});
|
|
1756
1789
|
}));
|
|
@@ -1884,7 +1917,7 @@ function findLeaf(candiateNode, last) {
|
|
|
1884
1917
|
}
|
|
1885
1918
|
function flipNode(node, size, orthogonalSize) {
|
|
1886
1919
|
if (node instanceof BranchNode) {
|
|
1887
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
1920
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1888
1921
|
let totalSize = 0;
|
|
1889
1922
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1890
1923
|
const child = node.children[i];
|
|
@@ -2020,31 +2053,57 @@ class Gridview {
|
|
|
2020
2053
|
get maximumHeight() {
|
|
2021
2054
|
return this.root.maximumHeight;
|
|
2022
2055
|
}
|
|
2056
|
+
get locked() {
|
|
2057
|
+
return this._locked;
|
|
2058
|
+
}
|
|
2059
|
+
set locked(value) {
|
|
2060
|
+
this._locked = value;
|
|
2061
|
+
const branch = [this.root];
|
|
2062
|
+
/**
|
|
2063
|
+
* simple depth-first-search to cover all nodes
|
|
2064
|
+
*
|
|
2065
|
+
* @see https://en.wikipedia.org/wiki/Depth-first_search
|
|
2066
|
+
*/
|
|
2067
|
+
while (branch.length > 0) {
|
|
2068
|
+
const node = branch.pop();
|
|
2069
|
+
if (node instanceof BranchNode) {
|
|
2070
|
+
node.disabled = value;
|
|
2071
|
+
branch.push(...node.children);
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2023
2075
|
maximizedView() {
|
|
2024
2076
|
var _a;
|
|
2025
|
-
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.view;
|
|
2077
|
+
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
2026
2078
|
}
|
|
2027
2079
|
hasMaximizedView() {
|
|
2028
2080
|
return this._maximizedNode !== undefined;
|
|
2029
2081
|
}
|
|
2030
2082
|
maximizeView(view) {
|
|
2083
|
+
var _a;
|
|
2031
2084
|
const location = getGridLocation(view.element);
|
|
2032
2085
|
const [_, node] = this.getNode(location);
|
|
2033
2086
|
if (!(node instanceof LeafNode)) {
|
|
2034
2087
|
return;
|
|
2035
2088
|
}
|
|
2036
|
-
if (this._maximizedNode === node) {
|
|
2089
|
+
if (((_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf) === node) {
|
|
2037
2090
|
return;
|
|
2038
2091
|
}
|
|
2039
2092
|
if (this.hasMaximizedView()) {
|
|
2040
2093
|
this.exitMaximizedView();
|
|
2041
2094
|
}
|
|
2095
|
+
const hiddenOnMaximize = [];
|
|
2042
2096
|
function hideAllViewsBut(parent, exclude) {
|
|
2043
2097
|
for (let i = 0; i < parent.children.length; i++) {
|
|
2044
2098
|
const child = parent.children[i];
|
|
2045
2099
|
if (child instanceof LeafNode) {
|
|
2046
2100
|
if (child !== exclude) {
|
|
2047
|
-
parent.
|
|
2101
|
+
if (parent.isChildVisible(i)) {
|
|
2102
|
+
parent.setChildVisible(i, false);
|
|
2103
|
+
}
|
|
2104
|
+
else {
|
|
2105
|
+
hiddenOnMaximize.push(child);
|
|
2106
|
+
}
|
|
2048
2107
|
}
|
|
2049
2108
|
}
|
|
2050
2109
|
else {
|
|
@@ -2053,18 +2112,21 @@ class Gridview {
|
|
|
2053
2112
|
}
|
|
2054
2113
|
}
|
|
2055
2114
|
hideAllViewsBut(this.root, node);
|
|
2056
|
-
this._maximizedNode = node;
|
|
2057
|
-
this.
|
|
2115
|
+
this._maximizedNode = { leaf: node, hiddenOnMaximize };
|
|
2116
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2058
2117
|
}
|
|
2059
2118
|
exitMaximizedView() {
|
|
2060
2119
|
if (!this._maximizedNode) {
|
|
2061
2120
|
return;
|
|
2062
2121
|
}
|
|
2122
|
+
const hiddenOnMaximize = this._maximizedNode.hiddenOnMaximize;
|
|
2063
2123
|
function showViewsInReverseOrder(parent) {
|
|
2064
2124
|
for (let index = parent.children.length - 1; index >= 0; index--) {
|
|
2065
2125
|
const child = parent.children[index];
|
|
2066
2126
|
if (child instanceof LeafNode) {
|
|
2067
|
-
|
|
2127
|
+
if (!hiddenOnMaximize.includes(child)) {
|
|
2128
|
+
parent.setChildVisible(index, true);
|
|
2129
|
+
}
|
|
2068
2130
|
}
|
|
2069
2131
|
else {
|
|
2070
2132
|
showViewsInReverseOrder(child);
|
|
@@ -2073,13 +2135,13 @@ class Gridview {
|
|
|
2073
2135
|
}
|
|
2074
2136
|
showViewsInReverseOrder(this.root);
|
|
2075
2137
|
this._maximizedNode = undefined;
|
|
2076
|
-
this.
|
|
2138
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2077
2139
|
}
|
|
2078
2140
|
serialize() {
|
|
2079
2141
|
if (this.hasMaximizedView()) {
|
|
2080
2142
|
/**
|
|
2081
|
-
* do not persist maximized view state
|
|
2082
|
-
*
|
|
2143
|
+
* do not persist maximized view state
|
|
2144
|
+
* firstly exit any maximized views to ensure the correct dimensions are persisted
|
|
2083
2145
|
*/
|
|
2084
2146
|
this.exitMaximizedView();
|
|
2085
2147
|
}
|
|
@@ -2094,14 +2156,14 @@ class Gridview {
|
|
|
2094
2156
|
dispose() {
|
|
2095
2157
|
this.disposable.dispose();
|
|
2096
2158
|
this._onDidChange.dispose();
|
|
2097
|
-
this.
|
|
2159
|
+
this._onDidMaximizedNodeChange.dispose();
|
|
2098
2160
|
this.root.dispose();
|
|
2099
2161
|
this._maximizedNode = undefined;
|
|
2100
2162
|
this.element.remove();
|
|
2101
2163
|
}
|
|
2102
2164
|
clear() {
|
|
2103
2165
|
const orientation = this.root.orientation;
|
|
2104
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize);
|
|
2166
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this._locked);
|
|
2105
2167
|
}
|
|
2106
2168
|
deserialize(json, deserializer) {
|
|
2107
2169
|
const orientation = json.orientation;
|
|
@@ -2122,8 +2184,8 @@ class Gridview {
|
|
|
2122
2184
|
};
|
|
2123
2185
|
});
|
|
2124
2186
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2125
|
-
orthogonalSize, // <- size - flips at each depth
|
|
2126
|
-
children);
|
|
2187
|
+
orthogonalSize, // <- size - flips at each depth,
|
|
2188
|
+
this._locked, children);
|
|
2127
2189
|
}
|
|
2128
2190
|
else {
|
|
2129
2191
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2156,7 +2218,7 @@ class Gridview {
|
|
|
2156
2218
|
}
|
|
2157
2219
|
const oldRoot = this.root;
|
|
2158
2220
|
oldRoot.element.remove();
|
|
2159
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
|
|
2221
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this._locked);
|
|
2160
2222
|
if (oldRoot.children.length === 0) ;
|
|
2161
2223
|
else if (oldRoot.children.length === 1) {
|
|
2162
2224
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2224,15 +2286,16 @@ class Gridview {
|
|
|
2224
2286
|
constructor(proportionalLayout, styles, orientation) {
|
|
2225
2287
|
this.proportionalLayout = proportionalLayout;
|
|
2226
2288
|
this.styles = styles;
|
|
2289
|
+
this._locked = false;
|
|
2227
2290
|
this._maximizedNode = undefined;
|
|
2228
2291
|
this.disposable = new MutableDisposable();
|
|
2229
2292
|
this._onDidChange = new Emitter();
|
|
2230
2293
|
this.onDidChange = this._onDidChange.event;
|
|
2231
|
-
this.
|
|
2232
|
-
this.
|
|
2294
|
+
this._onDidMaximizedNodeChange = new Emitter();
|
|
2295
|
+
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2233
2296
|
this.element = document.createElement('div');
|
|
2234
2297
|
this.element.className = 'grid-view';
|
|
2235
|
-
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
2298
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this._locked);
|
|
2236
2299
|
}
|
|
2237
2300
|
isViewVisible(location) {
|
|
2238
2301
|
const [rest, index] = tail(location);
|
|
@@ -2283,7 +2346,7 @@ class Gridview {
|
|
|
2283
2346
|
}
|
|
2284
2347
|
const child = grandParent.removeChild(parentIndex);
|
|
2285
2348
|
child.dispose();
|
|
2286
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2349
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this._locked);
|
|
2287
2350
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2288
2351
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2289
2352
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2910,6 +2973,21 @@ class DockviewApi {
|
|
|
2910
2973
|
get onDidDrop() {
|
|
2911
2974
|
return this.component.onDidDrop;
|
|
2912
2975
|
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and
|
|
2978
|
+
* prevent the event from occuring using the standard `preventDefault()` syntax.
|
|
2979
|
+
*
|
|
2980
|
+
* Preventing certain events may causes unexpected behaviours, use carefully.
|
|
2981
|
+
*/
|
|
2982
|
+
get onWillDrop() {
|
|
2983
|
+
return this.component.onWillDrop;
|
|
2984
|
+
}
|
|
2985
|
+
/**
|
|
2986
|
+
*
|
|
2987
|
+
*/
|
|
2988
|
+
get onWillShowOverlay() {
|
|
2989
|
+
return this.component.onWillShowOverlay;
|
|
2990
|
+
}
|
|
2913
2991
|
/**
|
|
2914
2992
|
* Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality.
|
|
2915
2993
|
*/
|
|
@@ -3045,17 +3123,17 @@ class DockviewApi {
|
|
|
3045
3123
|
hasMaximizedGroup() {
|
|
3046
3124
|
return this.component.hasMaximizedGroup();
|
|
3047
3125
|
}
|
|
3048
|
-
|
|
3126
|
+
exitMaximizedGroup() {
|
|
3049
3127
|
this.component.exitMaximizedGroup();
|
|
3050
3128
|
}
|
|
3051
|
-
get
|
|
3052
|
-
return this.component.
|
|
3129
|
+
get onDidMaximizedGroupChange() {
|
|
3130
|
+
return this.component.onDidMaximizedGroupChange;
|
|
3053
3131
|
}
|
|
3054
3132
|
/**
|
|
3055
3133
|
* Add a popout group in a new Window
|
|
3056
3134
|
*/
|
|
3057
3135
|
addPopoutGroup(item, options) {
|
|
3058
|
-
this.component.addPopoutGroup(item, options);
|
|
3136
|
+
return this.component.addPopoutGroup(item, options);
|
|
3059
3137
|
}
|
|
3060
3138
|
}
|
|
3061
3139
|
|
|
@@ -3109,6 +3187,18 @@ class DragAndDropObserver extends CompositeDisposable {
|
|
|
3109
3187
|
}
|
|
3110
3188
|
}
|
|
3111
3189
|
|
|
3190
|
+
class WillShowOverlayEvent extends DockviewEvent {
|
|
3191
|
+
get nativeEvent() {
|
|
3192
|
+
return this.options.nativeEvent;
|
|
3193
|
+
}
|
|
3194
|
+
get position() {
|
|
3195
|
+
return this.options.position;
|
|
3196
|
+
}
|
|
3197
|
+
constructor(options) {
|
|
3198
|
+
super();
|
|
3199
|
+
this.options = options;
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3112
3202
|
function directionToPosition(direction) {
|
|
3113
3203
|
switch (direction) {
|
|
3114
3204
|
case 'above':
|
|
@@ -3161,6 +3251,8 @@ class Droptarget extends CompositeDisposable {
|
|
|
3161
3251
|
this.options = options;
|
|
3162
3252
|
this._onDrop = new Emitter();
|
|
3163
3253
|
this.onDrop = this._onDrop.event;
|
|
3254
|
+
this._onWillShowOverlay = new Emitter();
|
|
3255
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3164
3256
|
// use a set to take advantage of #<set>.has
|
|
3165
3257
|
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
3166
3258
|
this.dnd = new DragAndDropObserver(this.element, {
|
|
@@ -3189,6 +3281,19 @@ class Droptarget extends CompositeDisposable {
|
|
|
3189
3281
|
this.removeDropTarget();
|
|
3190
3282
|
return;
|
|
3191
3283
|
}
|
|
3284
|
+
const willShowOverlayEvent = new WillShowOverlayEvent({
|
|
3285
|
+
nativeEvent: e,
|
|
3286
|
+
position: quadrant,
|
|
3287
|
+
});
|
|
3288
|
+
/**
|
|
3289
|
+
* Provide an opportunity to prevent the overlay appearing and in turn
|
|
3290
|
+
* any dnd behaviours
|
|
3291
|
+
*/
|
|
3292
|
+
this._onWillShowOverlay.fire(willShowOverlayEvent);
|
|
3293
|
+
if (willShowOverlayEvent.defaultPrevented) {
|
|
3294
|
+
this.removeDropTarget();
|
|
3295
|
+
return;
|
|
3296
|
+
}
|
|
3192
3297
|
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
3193
3298
|
if (!this.options.canDisplayOverlay) {
|
|
3194
3299
|
this.removeDropTarget();
|
|
@@ -3231,7 +3336,7 @@ class Droptarget extends CompositeDisposable {
|
|
|
3231
3336
|
}
|
|
3232
3337
|
},
|
|
3233
3338
|
});
|
|
3234
|
-
this.addDisposables(this._onDrop, this.dnd);
|
|
3339
|
+
this.addDisposables(this._onDrop, this._onWillShowOverlay, this.dnd);
|
|
3235
3340
|
}
|
|
3236
3341
|
setTargetZones(acceptedTargetZones) {
|
|
3237
3342
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
@@ -3284,25 +3389,44 @@ class Droptarget extends CompositeDisposable {
|
|
|
3284
3389
|
size = clamp(0, sizeOptions.value, height) / height;
|
|
3285
3390
|
}
|
|
3286
3391
|
}
|
|
3287
|
-
const
|
|
3288
|
-
|
|
3289
|
-
|
|
3392
|
+
const box = { top: '0px', left: '0px', width: '100%', height: '100%' };
|
|
3393
|
+
/**
|
|
3394
|
+
* You can also achieve the overlay placement using the transform CSS property
|
|
3395
|
+
* to translate and scale the element however this has the undesired effect of
|
|
3396
|
+
* 'skewing' the element. Comment left here for anybody that ever revisits this.
|
|
3397
|
+
*
|
|
3398
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
|
3399
|
+
*
|
|
3400
|
+
* right
|
|
3401
|
+
* translateX(${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3402
|
+
*
|
|
3403
|
+
* left
|
|
3404
|
+
* translateX(-${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3405
|
+
*
|
|
3406
|
+
* top
|
|
3407
|
+
* translateY(-${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3408
|
+
*
|
|
3409
|
+
* bottom
|
|
3410
|
+
* translateY(${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3411
|
+
*/
|
|
3290
3412
|
if (rightClass) {
|
|
3291
|
-
|
|
3413
|
+
box.left = `${100 * (1 - size)}%`;
|
|
3414
|
+
box.width = `${100 * size}%`;
|
|
3292
3415
|
}
|
|
3293
3416
|
else if (leftClass) {
|
|
3294
|
-
|
|
3417
|
+
box.width = `${100 * size}%`;
|
|
3295
3418
|
}
|
|
3296
3419
|
else if (topClass) {
|
|
3297
|
-
|
|
3420
|
+
box.height = `${100 * size}%`;
|
|
3298
3421
|
}
|
|
3299
3422
|
else if (bottomClass) {
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
else {
|
|
3303
|
-
transform = '';
|
|
3423
|
+
box.top = `${100 * (1 - size)}%`;
|
|
3424
|
+
box.height = `${100 * size}%`;
|
|
3304
3425
|
}
|
|
3305
|
-
this.overlayElement.style.
|
|
3426
|
+
this.overlayElement.style.top = box.top;
|
|
3427
|
+
this.overlayElement.style.left = box.left;
|
|
3428
|
+
this.overlayElement.style.width = box.width;
|
|
3429
|
+
this.overlayElement.style.height = box.height;
|
|
3306
3430
|
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3307
3431
|
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3308
3432
|
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
@@ -3370,14 +3494,6 @@ function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold)
|
|
|
3370
3494
|
return 'center';
|
|
3371
3495
|
}
|
|
3372
3496
|
|
|
3373
|
-
var DockviewDropTargets;
|
|
3374
|
-
(function (DockviewDropTargets) {
|
|
3375
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3376
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3377
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3378
|
-
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3379
|
-
})(DockviewDropTargets || (DockviewDropTargets = {}));
|
|
3380
|
-
|
|
3381
3497
|
class ContentContainer extends CompositeDisposable {
|
|
3382
3498
|
get element() {
|
|
3383
3499
|
return this._element;
|
|
@@ -3405,7 +3521,7 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3405
3521
|
const data = getPanelData();
|
|
3406
3522
|
if (!data &&
|
|
3407
3523
|
event.shiftKey &&
|
|
3408
|
-
this.group.location !== 'floating') {
|
|
3524
|
+
this.group.location.type !== 'floating') {
|
|
3409
3525
|
return false;
|
|
3410
3526
|
}
|
|
3411
3527
|
if (data && data.viewId === this.accessor.id) {
|
|
@@ -3423,7 +3539,7 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3423
3539
|
data.groupId === this.group.id;
|
|
3424
3540
|
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3425
3541
|
}
|
|
3426
|
-
return this.group.canDisplayOverlay(event, position,
|
|
3542
|
+
return this.group.canDisplayOverlay(event, position, 'panel');
|
|
3427
3543
|
},
|
|
3428
3544
|
});
|
|
3429
3545
|
this.addDisposables(this.dropTarget);
|
|
@@ -3448,7 +3564,7 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3448
3564
|
let container;
|
|
3449
3565
|
switch (panel.api.renderer) {
|
|
3450
3566
|
case 'onlyWhenVisibile':
|
|
3451
|
-
this.
|
|
3567
|
+
this.group.renderContainer.detatch(panel);
|
|
3452
3568
|
if (this.panel) {
|
|
3453
3569
|
if (doRender) {
|
|
3454
3570
|
this._element.appendChild(this.panel.view.content.element);
|
|
@@ -3460,7 +3576,7 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3460
3576
|
if (panel.view.content.element.parentElement === this._element) {
|
|
3461
3577
|
this._element.removeChild(panel.view.content.element);
|
|
3462
3578
|
}
|
|
3463
|
-
container = this.
|
|
3579
|
+
container = this.group.renderContainer.attach({
|
|
3464
3580
|
panel,
|
|
3465
3581
|
referenceContainer: this,
|
|
3466
3582
|
});
|
|
@@ -3491,9 +3607,10 @@ class ContentContainer extends CompositeDisposable {
|
|
|
3491
3607
|
// noop
|
|
3492
3608
|
}
|
|
3493
3609
|
closePanel() {
|
|
3610
|
+
var _a;
|
|
3494
3611
|
if (this.panel) {
|
|
3495
3612
|
if (this.panel.api.renderer === 'onlyWhenVisibile') {
|
|
3496
|
-
this.
|
|
3613
|
+
(_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
|
|
3497
3614
|
}
|
|
3498
3615
|
}
|
|
3499
3616
|
this.panel = undefined;
|
|
@@ -3604,7 +3721,7 @@ class Tab extends CompositeDisposable {
|
|
|
3604
3721
|
this._element.draggable = true;
|
|
3605
3722
|
toggleClass(this.element, 'inactive-tab', true);
|
|
3606
3723
|
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
3607
|
-
this.
|
|
3724
|
+
this.dropTarget = new Droptarget(this._element, {
|
|
3608
3725
|
acceptedTargetZones: ['center'],
|
|
3609
3726
|
canDisplayOverlay: (event, position) => {
|
|
3610
3727
|
if (this.group.locked) {
|
|
@@ -3619,9 +3736,10 @@ class Tab extends CompositeDisposable {
|
|
|
3619
3736
|
}
|
|
3620
3737
|
return this.panel.id !== data.panelId;
|
|
3621
3738
|
}
|
|
3622
|
-
return this.group.model.canDisplayOverlay(event, position,
|
|
3739
|
+
return this.group.model.canDisplayOverlay(event, position, 'tab');
|
|
3623
3740
|
},
|
|
3624
3741
|
});
|
|
3742
|
+
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
3625
3743
|
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
3626
3744
|
this._onDragStart.fire(event);
|
|
3627
3745
|
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
@@ -3629,9 +3747,9 @@ class Tab extends CompositeDisposable {
|
|
|
3629
3747
|
return;
|
|
3630
3748
|
}
|
|
3631
3749
|
this._onChanged.fire(event);
|
|
3632
|
-
}), this.
|
|
3750
|
+
}), this.dropTarget.onDrop((event) => {
|
|
3633
3751
|
this._onDropped.fire(event);
|
|
3634
|
-
}), this.
|
|
3752
|
+
}), this.dropTarget);
|
|
3635
3753
|
}
|
|
3636
3754
|
setActive(isActive) {
|
|
3637
3755
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -3678,7 +3796,7 @@ class GroupDragHandler extends DragHandler {
|
|
|
3678
3796
|
}, true));
|
|
3679
3797
|
}
|
|
3680
3798
|
isCancelled(_event) {
|
|
3681
|
-
if (this.group.api.location === 'floating' && !_event.shiftKey) {
|
|
3799
|
+
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
3682
3800
|
return true;
|
|
3683
3801
|
}
|
|
3684
3802
|
return false;
|
|
@@ -3730,7 +3848,7 @@ class VoidContainer extends CompositeDisposable {
|
|
|
3730
3848
|
this.accessor.doSetGroupActive(this.group);
|
|
3731
3849
|
}));
|
|
3732
3850
|
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3733
|
-
this.
|
|
3851
|
+
this.dropTraget = new Droptarget(this._element, {
|
|
3734
3852
|
acceptedTargetZones: ['center'],
|
|
3735
3853
|
canDisplayOverlay: (event, position) => {
|
|
3736
3854
|
var _a;
|
|
@@ -3744,14 +3862,15 @@ class VoidContainer extends CompositeDisposable {
|
|
|
3744
3862
|
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
3745
3863
|
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
3746
3864
|
}
|
|
3747
|
-
return group.model.canDisplayOverlay(event, position,
|
|
3865
|
+
return group.model.canDisplayOverlay(event, position, 'panel');
|
|
3748
3866
|
},
|
|
3749
3867
|
});
|
|
3868
|
+
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
3750
3869
|
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3751
3870
|
this._onDragStart.fire(event);
|
|
3752
|
-
}), this.
|
|
3871
|
+
}), this.dropTraget.onDrop((event) => {
|
|
3753
3872
|
this._onDrop.fire(event);
|
|
3754
|
-
}), this.
|
|
3873
|
+
}), this.dropTraget);
|
|
3755
3874
|
}
|
|
3756
3875
|
}
|
|
3757
3876
|
|
|
@@ -3839,19 +3958,11 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3839
3958
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
3840
3959
|
this._onGroupDragStart = new Emitter();
|
|
3841
3960
|
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3842
|
-
this.
|
|
3961
|
+
this._onWillShowOverlay = new Emitter();
|
|
3962
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3843
3963
|
this._element = document.createElement('div');
|
|
3844
3964
|
this._element.className = 'tabs-and-actions-container';
|
|
3845
3965
|
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
3846
|
-
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3847
|
-
if (e.api.group === this.group) {
|
|
3848
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3849
|
-
}
|
|
3850
|
-
}), this.accessor.onDidRemovePanel((e) => {
|
|
3851
|
-
if (e.api.group === this.group) {
|
|
3852
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3853
|
-
}
|
|
3854
|
-
}));
|
|
3855
3966
|
this.rightActionsContainer = document.createElement('div');
|
|
3856
3967
|
this.rightActionsContainer.className = 'right-actions-container';
|
|
3857
3968
|
this.leftActionsContainer = document.createElement('div');
|
|
@@ -3866,7 +3977,15 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3866
3977
|
this._element.appendChild(this.leftActionsContainer);
|
|
3867
3978
|
this._element.appendChild(this.voidContainer.element);
|
|
3868
3979
|
this._element.appendChild(this.rightActionsContainer);
|
|
3869
|
-
this.addDisposables(this.
|
|
3980
|
+
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3981
|
+
if (e.api.group === this.group) {
|
|
3982
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3983
|
+
}
|
|
3984
|
+
}), this.accessor.onDidRemovePanel((e) => {
|
|
3985
|
+
if (e.api.group === this.group) {
|
|
3986
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3987
|
+
}
|
|
3988
|
+
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3870
3989
|
this._onGroupDragStart.fire({
|
|
3871
3990
|
nativeEvent: event,
|
|
3872
3991
|
group: this.group,
|
|
@@ -3876,11 +3995,15 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3876
3995
|
event: event.nativeEvent,
|
|
3877
3996
|
index: this.tabs.length,
|
|
3878
3997
|
});
|
|
3998
|
+
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
3999
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4000
|
+
kind: 'header_space',
|
|
4001
|
+
}));
|
|
3879
4002
|
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
3880
4003
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3881
4004
|
if (isFloatingGroupsEnabled &&
|
|
3882
4005
|
event.shiftKey &&
|
|
3883
|
-
this.group.api.location !== 'floating') {
|
|
4006
|
+
this.group.api.location.type !== 'floating') {
|
|
3884
4007
|
event.preventDefault();
|
|
3885
4008
|
const { top, left } = this.element.getBoundingClientRect();
|
|
3886
4009
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
@@ -3943,9 +4066,9 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3943
4066
|
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
3944
4067
|
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
3945
4068
|
}), tab.onChanged((event) => {
|
|
3946
|
-
var _a;
|
|
3947
4069
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3948
|
-
const isFloatingWithOnePanel = this.group.api.location === 'floating' &&
|
|
4070
|
+
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
4071
|
+
this.size === 1;
|
|
3949
4072
|
if (isFloatingGroupsEnabled &&
|
|
3950
4073
|
!isFloatingWithOnePanel &&
|
|
3951
4074
|
event.shiftKey) {
|
|
@@ -3959,20 +4082,20 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3959
4082
|
}, { inDragMode: true });
|
|
3960
4083
|
return;
|
|
3961
4084
|
}
|
|
3962
|
-
const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
3963
|
-
this.group.model.isContentFocused;
|
|
3964
4085
|
const isLeftClick = event.button === 0;
|
|
3965
4086
|
if (!isLeftClick || event.defaultPrevented) {
|
|
3966
4087
|
return;
|
|
3967
4088
|
}
|
|
3968
|
-
this.group.
|
|
3969
|
-
|
|
3970
|
-
}
|
|
4089
|
+
if (this.group.activePanel !== panel) {
|
|
4090
|
+
this.group.model.openPanel(panel);
|
|
4091
|
+
}
|
|
3971
4092
|
}), tab.onDrop((event) => {
|
|
3972
4093
|
this._onDrop.fire({
|
|
3973
4094
|
event: event.nativeEvent,
|
|
3974
4095
|
index: this.tabs.findIndex((x) => x.value === tab),
|
|
3975
4096
|
});
|
|
4097
|
+
}), tab.onWillShowOverlay((event) => {
|
|
4098
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, { kind: 'tab' }));
|
|
3976
4099
|
}));
|
|
3977
4100
|
const value = { value: tab, disposable };
|
|
3978
4101
|
this.addTab(value, index);
|
|
@@ -3990,6 +4113,60 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3990
4113
|
}
|
|
3991
4114
|
}
|
|
3992
4115
|
|
|
4116
|
+
class DockviewDidDropEvent extends DockviewEvent {
|
|
4117
|
+
get nativeEvent() {
|
|
4118
|
+
return this.options.nativeEvent;
|
|
4119
|
+
}
|
|
4120
|
+
get position() {
|
|
4121
|
+
return this.options.position;
|
|
4122
|
+
}
|
|
4123
|
+
get panel() {
|
|
4124
|
+
return this.options.panel;
|
|
4125
|
+
}
|
|
4126
|
+
get group() {
|
|
4127
|
+
return this.options.group;
|
|
4128
|
+
}
|
|
4129
|
+
get api() {
|
|
4130
|
+
return this.options.api;
|
|
4131
|
+
}
|
|
4132
|
+
constructor(options) {
|
|
4133
|
+
super();
|
|
4134
|
+
this.options = options;
|
|
4135
|
+
}
|
|
4136
|
+
getData() {
|
|
4137
|
+
return this.options.getData();
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4141
|
+
get kind() {
|
|
4142
|
+
return this._kind;
|
|
4143
|
+
}
|
|
4144
|
+
constructor(options) {
|
|
4145
|
+
super(options);
|
|
4146
|
+
this._kind = options.kind;
|
|
4147
|
+
}
|
|
4148
|
+
}
|
|
4149
|
+
class WillShowOverlayLocationEvent {
|
|
4150
|
+
get kind() {
|
|
4151
|
+
return this._kind;
|
|
4152
|
+
}
|
|
4153
|
+
get nativeEvent() {
|
|
4154
|
+
return this.event.nativeEvent;
|
|
4155
|
+
}
|
|
4156
|
+
get position() {
|
|
4157
|
+
return this.event.position;
|
|
4158
|
+
}
|
|
4159
|
+
get defaultPrevented() {
|
|
4160
|
+
return this.event.defaultPrevented;
|
|
4161
|
+
}
|
|
4162
|
+
preventDefault() {
|
|
4163
|
+
this.event.preventDefault();
|
|
4164
|
+
}
|
|
4165
|
+
constructor(event, options) {
|
|
4166
|
+
this.event = event;
|
|
4167
|
+
this._kind = options.kind;
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
3993
4170
|
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
3994
4171
|
get element() {
|
|
3995
4172
|
throw new Error('not supported');
|
|
@@ -4035,7 +4212,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4035
4212
|
this._location = value;
|
|
4036
4213
|
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4037
4214
|
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4038
|
-
switch (value) {
|
|
4215
|
+
switch (value.type) {
|
|
4039
4216
|
case 'grid':
|
|
4040
4217
|
this.contentContainer.dropTarget.setTargetZones([
|
|
4041
4218
|
'top',
|
|
@@ -4071,7 +4248,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4071
4248
|
this.groupPanel = groupPanel;
|
|
4072
4249
|
this._isGroupActive = false;
|
|
4073
4250
|
this._locked = false;
|
|
4074
|
-
this._location = 'grid';
|
|
4251
|
+
this._location = { type: 'grid' };
|
|
4075
4252
|
this.mostRecentlyUsed = [];
|
|
4076
4253
|
this._onDidChange = new Emitter();
|
|
4077
4254
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -4082,6 +4259,10 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4082
4259
|
this.onMove = this._onMove.event;
|
|
4083
4260
|
this._onDidDrop = new Emitter();
|
|
4084
4261
|
this.onDidDrop = this._onDidDrop.event;
|
|
4262
|
+
this._onWillDrop = new Emitter();
|
|
4263
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
4264
|
+
this._onWillShowOverlay = new Emitter();
|
|
4265
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4085
4266
|
this._onTabDragStart = new Emitter();
|
|
4086
4267
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
4087
4268
|
this._onGroupDragStart = new Emitter();
|
|
@@ -4092,46 +4273,69 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4092
4273
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4093
4274
|
this._onDidActivePanelChange = new Emitter();
|
|
4094
4275
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4276
|
+
this._overwriteRenderContainer = null;
|
|
4095
4277
|
toggleClass(this.container, 'groupview', true);
|
|
4278
|
+
this._api = new DockviewApi(this.accessor);
|
|
4096
4279
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
4097
4280
|
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
4098
4281
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
4099
4282
|
this.header.hidden = !!options.hideHeader;
|
|
4100
4283
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
4101
|
-
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this.tabsContainer.onTabDragStart((event) => {
|
|
4284
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
4102
4285
|
this._onTabDragStart.fire(event);
|
|
4103
4286
|
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
4104
4287
|
this._onGroupDragStart.fire(event);
|
|
4105
4288
|
}), this.tabsContainer.onDrop((event) => {
|
|
4106
|
-
this.handleDropEvent(event.event, 'center', event.index);
|
|
4289
|
+
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
4107
4290
|
}), this.contentContainer.onDidFocus(() => {
|
|
4108
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4291
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4109
4292
|
}), this.contentContainer.onDidBlur(() => {
|
|
4110
4293
|
// noop
|
|
4111
4294
|
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
4112
|
-
this.handleDropEvent(event.nativeEvent, event.position);
|
|
4113
|
-
}), this.
|
|
4295
|
+
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
4296
|
+
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
4297
|
+
this._onWillShowOverlay.fire(event);
|
|
4298
|
+
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
4299
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4300
|
+
kind: 'content',
|
|
4301
|
+
}));
|
|
4302
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
4303
|
+
}
|
|
4304
|
+
focusContent() {
|
|
4305
|
+
this.contentContainer.element.focus();
|
|
4306
|
+
}
|
|
4307
|
+
set renderContainer(value) {
|
|
4308
|
+
this.panels.forEach((panel) => {
|
|
4309
|
+
this.renderContainer.detatch(panel);
|
|
4310
|
+
});
|
|
4311
|
+
this._overwriteRenderContainer = value;
|
|
4312
|
+
this.panels.forEach((panel) => {
|
|
4313
|
+
this.rerender(panel);
|
|
4314
|
+
});
|
|
4315
|
+
}
|
|
4316
|
+
get renderContainer() {
|
|
4317
|
+
var _a;
|
|
4318
|
+
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
4114
4319
|
}
|
|
4115
4320
|
initialize() {
|
|
4116
|
-
|
|
4117
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
|
|
4321
|
+
if (this.options.panels) {
|
|
4118
4322
|
this.options.panels.forEach((panel) => {
|
|
4119
4323
|
this.doAddPanel(panel);
|
|
4120
4324
|
});
|
|
4121
4325
|
}
|
|
4122
|
-
if (
|
|
4326
|
+
if (this.options.activePanel) {
|
|
4123
4327
|
this.openPanel(this.options.activePanel);
|
|
4124
4328
|
}
|
|
4125
4329
|
// must be run after the constructor otherwise this.parent may not be
|
|
4126
4330
|
// correctly initialized
|
|
4127
|
-
this.setActive(this.isActive, true
|
|
4331
|
+
this.setActive(this.isActive, true);
|
|
4128
4332
|
this.updateContainer();
|
|
4129
4333
|
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
4130
4334
|
this._rightHeaderActions =
|
|
4131
4335
|
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
4132
4336
|
this.addDisposables(this._rightHeaderActions);
|
|
4133
4337
|
this._rightHeaderActions.init({
|
|
4134
|
-
containerApi:
|
|
4338
|
+
containerApi: this._api,
|
|
4135
4339
|
api: this.groupPanel.api,
|
|
4136
4340
|
});
|
|
4137
4341
|
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
@@ -4141,7 +4345,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4141
4345
|
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
4142
4346
|
this.addDisposables(this._leftHeaderActions);
|
|
4143
4347
|
this._leftHeaderActions.init({
|
|
4144
|
-
containerApi:
|
|
4348
|
+
containerApi: this._api,
|
|
4145
4349
|
api: this.groupPanel.api,
|
|
4146
4350
|
});
|
|
4147
4351
|
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
@@ -4151,7 +4355,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4151
4355
|
this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
|
|
4152
4356
|
this.addDisposables(this._prefixHeaderActions);
|
|
4153
4357
|
this._prefixHeaderActions.init({
|
|
4154
|
-
containerApi:
|
|
4358
|
+
containerApi: this._api,
|
|
4155
4359
|
api: this.groupPanel.api,
|
|
4156
4360
|
});
|
|
4157
4361
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
@@ -4231,35 +4435,45 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4231
4435
|
//noop
|
|
4232
4436
|
}
|
|
4233
4437
|
focus() {
|
|
4234
|
-
var _a
|
|
4235
|
-
(
|
|
4438
|
+
var _a;
|
|
4439
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4236
4440
|
}
|
|
4237
4441
|
openPanel(panel, options = {}) {
|
|
4442
|
+
/**
|
|
4443
|
+
* set the panel group
|
|
4444
|
+
* add the panel
|
|
4445
|
+
* check if group active
|
|
4446
|
+
* check if panel active
|
|
4447
|
+
*/
|
|
4238
4448
|
if (typeof options.index !== 'number' ||
|
|
4239
4449
|
options.index > this.panels.length) {
|
|
4240
4450
|
options.index = this.panels.length;
|
|
4241
4451
|
}
|
|
4242
|
-
const
|
|
4243
|
-
const skipSetGroupActive = !!options.skipSetGroupActive;
|
|
4452
|
+
const skipSetActive = !!options.skipSetActive;
|
|
4244
4453
|
// ensure the group is updated before we fire any events
|
|
4245
|
-
panel.updateParentGroup(this.groupPanel,
|
|
4454
|
+
panel.updateParentGroup(this.groupPanel, {
|
|
4455
|
+
skipSetActive: options.skipSetActive,
|
|
4456
|
+
});
|
|
4457
|
+
this.doAddPanel(panel, options.index, {
|
|
4458
|
+
skipSetActive: skipSetActive,
|
|
4459
|
+
});
|
|
4246
4460
|
if (this._activePanel === panel) {
|
|
4247
|
-
if (!skipSetGroupActive) {
|
|
4248
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4249
|
-
}
|
|
4250
4461
|
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
4251
4462
|
return;
|
|
4252
4463
|
}
|
|
4253
|
-
|
|
4254
|
-
if (!skipSetPanelActive) {
|
|
4464
|
+
if (!skipSetActive) {
|
|
4255
4465
|
this.doSetActivePanel(panel);
|
|
4256
4466
|
}
|
|
4257
|
-
if (!skipSetGroupActive) {
|
|
4258
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4467
|
+
if (!options.skipSetGroupActive) {
|
|
4468
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4469
|
+
}
|
|
4470
|
+
if (!options.skipSetActive) {
|
|
4471
|
+
this.updateContainer();
|
|
4259
4472
|
}
|
|
4260
|
-
this.updateContainer();
|
|
4261
4473
|
}
|
|
4262
|
-
removePanel(groupItemOrId
|
|
4474
|
+
removePanel(groupItemOrId, options = {
|
|
4475
|
+
skipSetActive: false,
|
|
4476
|
+
}) {
|
|
4263
4477
|
const id = typeof groupItemOrId === 'string'
|
|
4264
4478
|
? groupItemOrId
|
|
4265
4479
|
: groupItemOrId.id;
|
|
@@ -4267,7 +4481,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4267
4481
|
if (!panelToRemove) {
|
|
4268
4482
|
throw new Error('invalid operation');
|
|
4269
4483
|
}
|
|
4270
|
-
return this._removePanel(panelToRemove);
|
|
4484
|
+
return this._removePanel(panelToRemove, options);
|
|
4271
4485
|
}
|
|
4272
4486
|
closeAllPanels() {
|
|
4273
4487
|
if (this.panels.length > 0) {
|
|
@@ -4293,12 +4507,8 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4293
4507
|
updateActions(element) {
|
|
4294
4508
|
this.tabsContainer.setRightActionsElement(element);
|
|
4295
4509
|
}
|
|
4296
|
-
setActive(isGroupActive,
|
|
4297
|
-
var _a, _b, _c, _d;
|
|
4510
|
+
setActive(isGroupActive, force = false) {
|
|
4298
4511
|
if (!force && this.isActive === isGroupActive) {
|
|
4299
|
-
if (!skipFocus) {
|
|
4300
|
-
(_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4301
|
-
}
|
|
4302
4512
|
return;
|
|
4303
4513
|
}
|
|
4304
4514
|
this._isGroupActive = isGroupActive;
|
|
@@ -4309,11 +4519,6 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4309
4519
|
this.doSetActivePanel(this.panels[0]);
|
|
4310
4520
|
}
|
|
4311
4521
|
this.updateContainer();
|
|
4312
|
-
if (isGroupActive) {
|
|
4313
|
-
if (!skipFocus) {
|
|
4314
|
-
(_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
4315
|
-
}
|
|
4316
|
-
}
|
|
4317
4522
|
}
|
|
4318
4523
|
layout(width, height) {
|
|
4319
4524
|
var _a;
|
|
@@ -4324,17 +4529,22 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4324
4529
|
this._activePanel.layout(this._width, this._height);
|
|
4325
4530
|
}
|
|
4326
4531
|
}
|
|
4327
|
-
_removePanel(panel) {
|
|
4532
|
+
_removePanel(panel, options) {
|
|
4328
4533
|
const isActivePanel = this._activePanel === panel;
|
|
4329
4534
|
this.doRemovePanel(panel);
|
|
4330
4535
|
if (isActivePanel && this.panels.length > 0) {
|
|
4331
4536
|
const nextPanel = this.mostRecentlyUsed[0];
|
|
4332
|
-
this.openPanel(nextPanel
|
|
4537
|
+
this.openPanel(nextPanel, {
|
|
4538
|
+
skipSetActive: options.skipSetActive,
|
|
4539
|
+
skipSetGroupActive: options.skipSetActiveGroup,
|
|
4540
|
+
});
|
|
4333
4541
|
}
|
|
4334
4542
|
if (this._activePanel && this.panels.length === 0) {
|
|
4335
4543
|
this.doSetActivePanel(undefined);
|
|
4336
4544
|
}
|
|
4337
|
-
|
|
4545
|
+
if (!options.skipSetActive) {
|
|
4546
|
+
this.updateContainer();
|
|
4547
|
+
}
|
|
4338
4548
|
return panel;
|
|
4339
4549
|
}
|
|
4340
4550
|
doRemovePanel(panel) {
|
|
@@ -4349,13 +4559,13 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4349
4559
|
}
|
|
4350
4560
|
this._onDidRemovePanel.fire({ panel });
|
|
4351
4561
|
}
|
|
4352
|
-
doAddPanel(panel, index = this.panels.length,
|
|
4562
|
+
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
4353
4563
|
const existingPanel = this._panels.indexOf(panel);
|
|
4354
4564
|
const hasExistingPanel = existingPanel > -1;
|
|
4355
4565
|
this.tabsContainer.show();
|
|
4356
4566
|
this.contentContainer.show();
|
|
4357
4567
|
this.tabsContainer.openPanel(panel, index);
|
|
4358
|
-
if (!skipSetActive) {
|
|
4568
|
+
if (!options.skipSetActive) {
|
|
4359
4569
|
this.contentContainer.openPanel(panel);
|
|
4360
4570
|
}
|
|
4361
4571
|
if (hasExistingPanel) {
|
|
@@ -4367,12 +4577,17 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4367
4577
|
this._onDidAddPanel.fire({ panel });
|
|
4368
4578
|
}
|
|
4369
4579
|
doSetActivePanel(panel) {
|
|
4580
|
+
if (this._activePanel === panel) {
|
|
4581
|
+
return;
|
|
4582
|
+
}
|
|
4370
4583
|
this._activePanel = panel;
|
|
4371
4584
|
if (panel) {
|
|
4372
4585
|
this.tabsContainer.setActivePanel(panel);
|
|
4373
4586
|
panel.layout(this._width, this._height);
|
|
4374
4587
|
this.updateMru(panel);
|
|
4375
|
-
this._onDidActivePanelChange.fire({
|
|
4588
|
+
this._onDidActivePanelChange.fire({
|
|
4589
|
+
panel,
|
|
4590
|
+
});
|
|
4376
4591
|
}
|
|
4377
4592
|
}
|
|
4378
4593
|
updateMru(panel) {
|
|
@@ -4384,11 +4599,11 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4384
4599
|
updateContainer() {
|
|
4385
4600
|
var _a, _b;
|
|
4386
4601
|
toggleClass(this.container, 'empty', this.isEmpty);
|
|
4387
|
-
this.panels.forEach((panel) => panel.
|
|
4602
|
+
this.panels.forEach((panel) => panel.runEvents());
|
|
4388
4603
|
if (this.isEmpty && !this.watermark) {
|
|
4389
4604
|
const watermark = this.accessor.createWatermarkComponent();
|
|
4390
4605
|
watermark.init({
|
|
4391
|
-
containerApi:
|
|
4606
|
+
containerApi: this._api,
|
|
4392
4607
|
group: this.groupPanel,
|
|
4393
4608
|
});
|
|
4394
4609
|
this.watermark = watermark;
|
|
@@ -4421,10 +4636,32 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4421
4636
|
}
|
|
4422
4637
|
return false;
|
|
4423
4638
|
}
|
|
4424
|
-
handleDropEvent(event, position, index) {
|
|
4639
|
+
handleDropEvent(type, event, position, index) {
|
|
4425
4640
|
if (this.locked === 'no-drop-target') {
|
|
4426
4641
|
return;
|
|
4427
4642
|
}
|
|
4643
|
+
function getKind() {
|
|
4644
|
+
switch (type) {
|
|
4645
|
+
case 'header':
|
|
4646
|
+
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
4647
|
+
case 'content':
|
|
4648
|
+
return 'content';
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
4652
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
4653
|
+
nativeEvent: event,
|
|
4654
|
+
position,
|
|
4655
|
+
panel,
|
|
4656
|
+
getData: () => getPanelData(),
|
|
4657
|
+
kind: getKind(),
|
|
4658
|
+
group: this.groupPanel,
|
|
4659
|
+
api: this._api,
|
|
4660
|
+
});
|
|
4661
|
+
this._onWillDrop.fire(willDropEvent);
|
|
4662
|
+
if (willDropEvent.defaultPrevented) {
|
|
4663
|
+
return;
|
|
4664
|
+
}
|
|
4428
4665
|
const data = getPanelData();
|
|
4429
4666
|
if (data && data.viewId === this.accessor.id) {
|
|
4430
4667
|
if (data.panelId === null) {
|
|
@@ -4457,12 +4694,14 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4457
4694
|
});
|
|
4458
4695
|
}
|
|
4459
4696
|
else {
|
|
4460
|
-
this._onDidDrop.fire({
|
|
4697
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
4461
4698
|
nativeEvent: event,
|
|
4462
4699
|
position,
|
|
4463
|
-
|
|
4700
|
+
panel,
|
|
4464
4701
|
getData: () => getPanelData(),
|
|
4465
|
-
|
|
4702
|
+
group: this.groupPanel,
|
|
4703
|
+
api: this._api,
|
|
4704
|
+
}));
|
|
4466
4705
|
}
|
|
4467
4706
|
}
|
|
4468
4707
|
dispose() {
|
|
@@ -4470,6 +4709,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
4470
4709
|
super.dispose();
|
|
4471
4710
|
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
4472
4711
|
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4712
|
+
this.watermark = undefined;
|
|
4473
4713
|
for (const panel of this.panels) {
|
|
4474
4714
|
panel.dispose();
|
|
4475
4715
|
}
|
|
@@ -4491,15 +4731,7 @@ class Resizable extends CompositeDisposable {
|
|
|
4491
4731
|
constructor(parentElement, disableResizing = false) {
|
|
4492
4732
|
super();
|
|
4493
4733
|
this._disableResizing = disableResizing;
|
|
4494
|
-
|
|
4495
|
-
this._element = parentElement;
|
|
4496
|
-
}
|
|
4497
|
-
else {
|
|
4498
|
-
this._element = document.createElement('div');
|
|
4499
|
-
this._element.style.height = '100%';
|
|
4500
|
-
this._element.style.width = '100%';
|
|
4501
|
-
this._element.className = 'dv-resizable-container';
|
|
4502
|
-
}
|
|
4734
|
+
this._element = parentElement;
|
|
4503
4735
|
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
4504
4736
|
if (this.isDisposed) {
|
|
4505
4737
|
/**
|
|
@@ -4587,25 +4819,38 @@ class BaseGrid extends Resizable {
|
|
|
4587
4819
|
get activeGroup() {
|
|
4588
4820
|
return this._activeGroup;
|
|
4589
4821
|
}
|
|
4822
|
+
get locked() {
|
|
4823
|
+
return this.gridview.locked;
|
|
4824
|
+
}
|
|
4825
|
+
set locked(value) {
|
|
4826
|
+
this.gridview.locked = value;
|
|
4827
|
+
}
|
|
4590
4828
|
constructor(options) {
|
|
4591
|
-
super(
|
|
4829
|
+
super(document.createElement('div'), options.disableAutoResizing);
|
|
4592
4830
|
this._id = nextLayoutId$1.next();
|
|
4593
4831
|
this._groups = new Map();
|
|
4594
4832
|
this._onDidLayoutChange = new Emitter();
|
|
4595
4833
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
4596
|
-
this.
|
|
4597
|
-
this.
|
|
4598
|
-
this.
|
|
4599
|
-
this.
|
|
4600
|
-
this.
|
|
4601
|
-
this.
|
|
4834
|
+
this._onDidRemove = new Emitter();
|
|
4835
|
+
this.onDidRemove = this._onDidRemove.event;
|
|
4836
|
+
this._onDidAdd = new Emitter();
|
|
4837
|
+
this.onDidAdd = this._onDidAdd.event;
|
|
4838
|
+
this._onDidActiveChange = new Emitter();
|
|
4839
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4602
4840
|
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
4841
|
+
this.element.style.height = '100%';
|
|
4842
|
+
this.element.style.width = '100%';
|
|
4843
|
+
options.parentElement.appendChild(this.element);
|
|
4603
4844
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
4845
|
+
this.gridview.locked = !!options.locked;
|
|
4604
4846
|
this.element.appendChild(this.gridview.element);
|
|
4605
4847
|
this.layout(0, 0, true); // set some elements height/widths
|
|
4606
|
-
this.addDisposables(
|
|
4848
|
+
this.addDisposables(Disposable.from(() => {
|
|
4849
|
+
var _a;
|
|
4850
|
+
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
4851
|
+
}), this.gridview.onDidChange(() => {
|
|
4607
4852
|
this._bufferOnDidLayoutChange.fire();
|
|
4608
|
-
}), Event.any(this.
|
|
4853
|
+
}), Event.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
4609
4854
|
this._bufferOnDidLayoutChange.fire();
|
|
4610
4855
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
4611
4856
|
this._onDidLayoutChange.fire();
|
|
@@ -4620,6 +4865,7 @@ class BaseGrid extends Resizable {
|
|
|
4620
4865
|
}
|
|
4621
4866
|
maximizeGroup(panel) {
|
|
4622
4867
|
this.gridview.maximizeView(panel);
|
|
4868
|
+
this.doSetGroupActive(panel);
|
|
4623
4869
|
}
|
|
4624
4870
|
isMaximizedGroup(panel) {
|
|
4625
4871
|
return this.gridview.maximizedView() === panel;
|
|
@@ -4630,13 +4876,12 @@ class BaseGrid extends Resizable {
|
|
|
4630
4876
|
hasMaximizedGroup() {
|
|
4631
4877
|
return this.gridview.hasMaximizedView();
|
|
4632
4878
|
}
|
|
4633
|
-
get
|
|
4634
|
-
return this.gridview.
|
|
4879
|
+
get onDidMaximizedGroupChange() {
|
|
4880
|
+
return this.gridview.onDidMaximizedNodeChange;
|
|
4635
4881
|
}
|
|
4636
4882
|
doAddGroup(group, location = [0], size) {
|
|
4637
4883
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : Sizing.Distribute, location);
|
|
4638
|
-
this.
|
|
4639
|
-
this.doSetGroupActive(group);
|
|
4884
|
+
this._onDidAdd.fire(group);
|
|
4640
4885
|
}
|
|
4641
4886
|
doRemoveGroup(group, options) {
|
|
4642
4887
|
if (!this._groups.has(group.id)) {
|
|
@@ -4648,8 +4893,8 @@ class BaseGrid extends Resizable {
|
|
|
4648
4893
|
item.disposable.dispose();
|
|
4649
4894
|
item.value.dispose();
|
|
4650
4895
|
this._groups.delete(group.id);
|
|
4896
|
+
this._onDidRemove.fire(group);
|
|
4651
4897
|
}
|
|
4652
|
-
this._onDidRemoveGroup.fire(group);
|
|
4653
4898
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
4654
4899
|
const groups = Array.from(this._groups.values());
|
|
4655
4900
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -4660,25 +4905,18 @@ class BaseGrid extends Resizable {
|
|
|
4660
4905
|
var _a;
|
|
4661
4906
|
return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4662
4907
|
}
|
|
4663
|
-
doSetGroupActive(group
|
|
4664
|
-
var _a, _b, _c;
|
|
4908
|
+
doSetGroupActive(group) {
|
|
4665
4909
|
if (this._activeGroup === group) {
|
|
4666
4910
|
return;
|
|
4667
4911
|
}
|
|
4668
4912
|
if (this._activeGroup) {
|
|
4669
4913
|
this._activeGroup.setActive(false);
|
|
4670
|
-
if (!skipFocus) {
|
|
4671
|
-
(_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4672
|
-
}
|
|
4673
4914
|
}
|
|
4674
4915
|
if (group) {
|
|
4675
4916
|
group.setActive(true);
|
|
4676
|
-
if (!skipFocus) {
|
|
4677
|
-
(_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
|
|
4678
|
-
}
|
|
4679
4917
|
}
|
|
4680
4918
|
this._activeGroup = group;
|
|
4681
|
-
this.
|
|
4919
|
+
this._onDidActiveChange.fire(group);
|
|
4682
4920
|
}
|
|
4683
4921
|
removeGroup(group) {
|
|
4684
4922
|
this.doRemoveGroup(group);
|
|
@@ -4723,9 +4961,9 @@ class BaseGrid extends Resizable {
|
|
|
4723
4961
|
this.gridview.layout(width, height);
|
|
4724
4962
|
}
|
|
4725
4963
|
dispose() {
|
|
4726
|
-
this.
|
|
4727
|
-
this.
|
|
4728
|
-
this.
|
|
4964
|
+
this._onDidActiveChange.dispose();
|
|
4965
|
+
this._onDidAdd.dispose();
|
|
4966
|
+
this._onDidRemove.dispose();
|
|
4729
4967
|
this._onDidLayoutChange.dispose();
|
|
4730
4968
|
for (const group of this.groups) {
|
|
4731
4969
|
group.dispose();
|
|
@@ -4735,11 +4973,15 @@ class BaseGrid extends Resizable {
|
|
|
4735
4973
|
}
|
|
4736
4974
|
}
|
|
4737
4975
|
|
|
4976
|
+
class WillFocusEvent extends DockviewEvent {
|
|
4977
|
+
constructor() {
|
|
4978
|
+
super();
|
|
4979
|
+
}
|
|
4980
|
+
}
|
|
4738
4981
|
/**
|
|
4739
4982
|
* A core api implementation that should be used across all panel-like objects
|
|
4740
4983
|
*/
|
|
4741
4984
|
class PanelApiImpl extends CompositeDisposable {
|
|
4742
|
-
//
|
|
4743
4985
|
get isFocused() {
|
|
4744
4986
|
return this._isFocused;
|
|
4745
4987
|
}
|
|
@@ -4749,6 +4991,9 @@ class PanelApiImpl extends CompositeDisposable {
|
|
|
4749
4991
|
get isVisible() {
|
|
4750
4992
|
return this._isVisible;
|
|
4751
4993
|
}
|
|
4994
|
+
get isHidden() {
|
|
4995
|
+
return this._isHidden;
|
|
4996
|
+
}
|
|
4752
4997
|
get width() {
|
|
4753
4998
|
return this._width;
|
|
4754
4999
|
}
|
|
@@ -4761,38 +5006,26 @@ class PanelApiImpl extends CompositeDisposable {
|
|
|
4761
5006
|
this._isFocused = false;
|
|
4762
5007
|
this._isActive = false;
|
|
4763
5008
|
this._isVisible = true;
|
|
5009
|
+
this._isHidden = false;
|
|
4764
5010
|
this._width = 0;
|
|
4765
5011
|
this._height = 0;
|
|
4766
5012
|
this.panelUpdatesDisposable = new MutableDisposable();
|
|
4767
|
-
this._onDidDimensionChange = new Emitter(
|
|
4768
|
-
replay: true,
|
|
4769
|
-
});
|
|
5013
|
+
this._onDidDimensionChange = new Emitter();
|
|
4770
5014
|
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
4771
|
-
|
|
4772
|
-
this._onDidChangeFocus = new Emitter({
|
|
4773
|
-
replay: true,
|
|
4774
|
-
});
|
|
5015
|
+
this._onDidChangeFocus = new Emitter();
|
|
4775
5016
|
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
4776
5017
|
//
|
|
4777
|
-
this.
|
|
4778
|
-
this.
|
|
5018
|
+
this._onWillFocus = new Emitter();
|
|
5019
|
+
this.onWillFocus = this._onWillFocus.event;
|
|
4779
5020
|
//
|
|
4780
|
-
this._onDidVisibilityChange = new Emitter(
|
|
4781
|
-
replay: true,
|
|
4782
|
-
});
|
|
5021
|
+
this._onDidVisibilityChange = new Emitter();
|
|
4783
5022
|
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
4784
|
-
|
|
4785
|
-
this.
|
|
4786
|
-
this.
|
|
4787
|
-
//
|
|
4788
|
-
this._onDidActiveChange = new Emitter({
|
|
4789
|
-
replay: true,
|
|
4790
|
-
});
|
|
5023
|
+
this._onDidHiddenChange = new Emitter();
|
|
5024
|
+
this.onDidHiddenChange = this._onDidHiddenChange.event;
|
|
5025
|
+
this._onDidActiveChange = new Emitter();
|
|
4791
5026
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4792
|
-
//
|
|
4793
5027
|
this._onActiveChange = new Emitter();
|
|
4794
5028
|
this.onActiveChange = this._onActiveChange.event;
|
|
4795
|
-
//
|
|
4796
5029
|
this._onUpdateParameters = new Emitter();
|
|
4797
5030
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
4798
5031
|
this.addDisposables(this.onDidFocusChange((event) => {
|
|
@@ -4801,10 +5034,12 @@ class PanelApiImpl extends CompositeDisposable {
|
|
|
4801
5034
|
this._isActive = event.isActive;
|
|
4802
5035
|
}), this.onDidVisibilityChange((event) => {
|
|
4803
5036
|
this._isVisible = event.isVisible;
|
|
5037
|
+
}), this.onDidHiddenChange((event) => {
|
|
5038
|
+
this._isHidden = event.isHidden;
|
|
4804
5039
|
}), this.onDidDimensionsChange((event) => {
|
|
4805
5040
|
this._width = event.width;
|
|
4806
5041
|
this._height = event.height;
|
|
4807
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this.
|
|
5042
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onDidHiddenChange, this._onUpdateParameters);
|
|
4808
5043
|
}
|
|
4809
5044
|
initialize(panel) {
|
|
4810
5045
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
@@ -4813,8 +5048,8 @@ class PanelApiImpl extends CompositeDisposable {
|
|
|
4813
5048
|
});
|
|
4814
5049
|
});
|
|
4815
5050
|
}
|
|
4816
|
-
|
|
4817
|
-
this.
|
|
5051
|
+
setHidden(isHidden) {
|
|
5052
|
+
this._onDidHiddenChange.fire({ isHidden });
|
|
4818
5053
|
}
|
|
4819
5054
|
setActive() {
|
|
4820
5055
|
this._onActiveChange.fire();
|
|
@@ -4822,9 +5057,6 @@ class PanelApiImpl extends CompositeDisposable {
|
|
|
4822
5057
|
updateParameters(parameters) {
|
|
4823
5058
|
this._onUpdateParameters.fire(parameters);
|
|
4824
5059
|
}
|
|
4825
|
-
dispose() {
|
|
4826
|
-
super.dispose();
|
|
4827
|
-
}
|
|
4828
5060
|
}
|
|
4829
5061
|
|
|
4830
5062
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
@@ -4912,7 +5144,12 @@ class BasePanelView extends CompositeDisposable {
|
|
|
4912
5144
|
}), focusTracker);
|
|
4913
5145
|
}
|
|
4914
5146
|
focus() {
|
|
4915
|
-
|
|
5147
|
+
const event = new WillFocusEvent();
|
|
5148
|
+
this.api._onWillFocus.fire(event);
|
|
5149
|
+
if (event.defaultPrevented) {
|
|
5150
|
+
return;
|
|
5151
|
+
}
|
|
5152
|
+
this._element.focus();
|
|
4916
5153
|
}
|
|
4917
5154
|
layout(width, height) {
|
|
4918
5155
|
this._width = width;
|
|
@@ -5241,9 +5478,7 @@ class GridviewPanelApiImpl extends PanelApiImpl {
|
|
|
5241
5478
|
super(id);
|
|
5242
5479
|
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5243
5480
|
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5244
|
-
this._onDidConstraintsChange = new Emitter(
|
|
5245
|
-
replay: true,
|
|
5246
|
-
});
|
|
5481
|
+
this._onDidConstraintsChange = new Emitter();
|
|
5247
5482
|
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
5248
5483
|
this._onDidSizeChange = new Emitter();
|
|
5249
5484
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
@@ -5336,13 +5571,13 @@ class GridviewPanel extends BasePanelView {
|
|
|
5336
5571
|
this._maximumHeight = options.maximumHeight;
|
|
5337
5572
|
}
|
|
5338
5573
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
5339
|
-
this.addDisposables(this.api.
|
|
5340
|
-
const {
|
|
5574
|
+
this.addDisposables(this.api.onDidHiddenChange((event) => {
|
|
5575
|
+
const { isHidden } = event;
|
|
5341
5576
|
const { accessor } = this._params;
|
|
5342
|
-
accessor.setVisible(this,
|
|
5577
|
+
accessor.setVisible(this, !isHidden);
|
|
5343
5578
|
}), this.api.onActiveChange(() => {
|
|
5344
5579
|
const { accessor } = this._params;
|
|
5345
|
-
accessor.
|
|
5580
|
+
accessor.doSetGroupActive(this);
|
|
5346
5581
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
5347
5582
|
if (typeof event.minimumWidth === 'number' ||
|
|
5348
5583
|
typeof event.minimumWidth === 'function') {
|
|
@@ -5425,6 +5660,17 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5425
5660
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5426
5661
|
this.addDisposables(this._onDidLocationChange);
|
|
5427
5662
|
}
|
|
5663
|
+
close() {
|
|
5664
|
+
if (!this._group) {
|
|
5665
|
+
return;
|
|
5666
|
+
}
|
|
5667
|
+
return this.accessor.removeGroup(this._group);
|
|
5668
|
+
}
|
|
5669
|
+
getWindow() {
|
|
5670
|
+
return this.location.type === 'popout'
|
|
5671
|
+
? this.location.getWindow()
|
|
5672
|
+
: window;
|
|
5673
|
+
}
|
|
5428
5674
|
moveTo(options) {
|
|
5429
5675
|
var _a, _b, _c;
|
|
5430
5676
|
if (!this._group) {
|
|
@@ -5432,14 +5678,23 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5432
5678
|
}
|
|
5433
5679
|
const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
|
|
5434
5680
|
direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
|
|
5681
|
+
skipSetActive: true,
|
|
5682
|
+
});
|
|
5683
|
+
this.accessor.moveGroupOrPanel({
|
|
5684
|
+
from: { groupId: this._group.id },
|
|
5685
|
+
to: {
|
|
5686
|
+
group,
|
|
5687
|
+
position: options.group
|
|
5688
|
+
? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
|
|
5689
|
+
: 'center',
|
|
5690
|
+
},
|
|
5435
5691
|
});
|
|
5436
|
-
this.accessor.moveGroupOrPanel(group, this._group.id, undefined, options.group ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center' : 'center');
|
|
5437
5692
|
}
|
|
5438
5693
|
maximize() {
|
|
5439
5694
|
if (!this._group) {
|
|
5440
5695
|
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5441
5696
|
}
|
|
5442
|
-
if (this.location !== 'grid') {
|
|
5697
|
+
if (this.location.type !== 'grid') {
|
|
5443
5698
|
// only grid groups can be maximized
|
|
5444
5699
|
return;
|
|
5445
5700
|
}
|
|
@@ -5496,6 +5751,12 @@ class DockviewGroupPanel extends GridviewPanel {
|
|
|
5496
5751
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
5497
5752
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
5498
5753
|
}
|
|
5754
|
+
focus() {
|
|
5755
|
+
if (!this.api.isActive) {
|
|
5756
|
+
this.api.setActive();
|
|
5757
|
+
}
|
|
5758
|
+
super.focus();
|
|
5759
|
+
}
|
|
5499
5760
|
initialize() {
|
|
5500
5761
|
this._model.initialize();
|
|
5501
5762
|
}
|
|
@@ -5541,6 +5802,9 @@ function isGroupOptionsWithGroup(data) {
|
|
|
5541
5802
|
}
|
|
5542
5803
|
|
|
5543
5804
|
class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
5805
|
+
get location() {
|
|
5806
|
+
return this.group.api.location;
|
|
5807
|
+
}
|
|
5544
5808
|
get title() {
|
|
5545
5809
|
return this.panel.title;
|
|
5546
5810
|
}
|
|
@@ -5552,15 +5816,34 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5552
5816
|
}
|
|
5553
5817
|
set group(value) {
|
|
5554
5818
|
const isOldGroupActive = this.isGroupActive;
|
|
5555
|
-
this._group
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5819
|
+
if (this._group !== value) {
|
|
5820
|
+
this._group = value;
|
|
5821
|
+
this._onDidGroupChange.fire({});
|
|
5822
|
+
let _trackGroupActive = isOldGroupActive; // prevent duplicate events with same state
|
|
5823
|
+
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidLocationChange((event) => {
|
|
5824
|
+
if (this.group !== this.panel.group) {
|
|
5825
|
+
return;
|
|
5826
|
+
}
|
|
5827
|
+
this._onDidLocationChange.fire(event);
|
|
5828
|
+
}), this.group.api.onDidActiveChange(() => {
|
|
5829
|
+
if (this.group !== this.panel.group) {
|
|
5830
|
+
return;
|
|
5831
|
+
}
|
|
5832
|
+
if (_trackGroupActive !== this.isGroupActive) {
|
|
5833
|
+
_trackGroupActive = this.isGroupActive;
|
|
5834
|
+
this._onDidActiveGroupChange.fire({
|
|
5835
|
+
isActive: this.isGroupActive,
|
|
5836
|
+
});
|
|
5837
|
+
}
|
|
5838
|
+
}));
|
|
5839
|
+
// if (this.isGroupActive !== isOldGroupActive) {
|
|
5840
|
+
// this._onDidActiveGroupChange.fire({
|
|
5841
|
+
// isActive: this.isGroupActive,
|
|
5842
|
+
// });
|
|
5843
|
+
// }
|
|
5844
|
+
this._onDidLocationChange.fire({
|
|
5845
|
+
location: this.group.api.location,
|
|
5560
5846
|
});
|
|
5561
|
-
if (this.isGroupActive !== isOldGroupActive) {
|
|
5562
|
-
this._onDidActiveGroupChange.fire();
|
|
5563
|
-
}
|
|
5564
5847
|
}
|
|
5565
5848
|
}
|
|
5566
5849
|
get group() {
|
|
@@ -5578,14 +5861,26 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
5578
5861
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
5579
5862
|
this._onDidRendererChange = new Emitter();
|
|
5580
5863
|
this.onDidRendererChange = this._onDidRendererChange.event;
|
|
5581
|
-
this.
|
|
5864
|
+
this._onDidLocationChange = new Emitter();
|
|
5865
|
+
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5866
|
+
this.groupEventsDisposable = new MutableDisposable();
|
|
5582
5867
|
this.initialize(panel);
|
|
5583
5868
|
this._group = group;
|
|
5584
|
-
this.addDisposables(this.
|
|
5869
|
+
this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
|
|
5870
|
+
}
|
|
5871
|
+
getWindow() {
|
|
5872
|
+
return this.group.api.getWindow();
|
|
5585
5873
|
}
|
|
5586
5874
|
moveTo(options) {
|
|
5587
5875
|
var _a;
|
|
5588
|
-
this.accessor.moveGroupOrPanel(
|
|
5876
|
+
this.accessor.moveGroupOrPanel({
|
|
5877
|
+
from: { groupId: this._group.id, panelId: this.panel.id },
|
|
5878
|
+
to: {
|
|
5879
|
+
group: options.group,
|
|
5880
|
+
position: (_a = options.position) !== null && _a !== void 0 ? _a : 'center',
|
|
5881
|
+
index: options.index,
|
|
5882
|
+
},
|
|
5883
|
+
});
|
|
5589
5884
|
}
|
|
5590
5885
|
setTitle(title) {
|
|
5591
5886
|
this.panel.setTitle(title);
|
|
@@ -5646,7 +5941,14 @@ class DockviewPanel extends CompositeDisposable {
|
|
|
5646
5941
|
this.setTitle(params.title);
|
|
5647
5942
|
}
|
|
5648
5943
|
focus() {
|
|
5649
|
-
|
|
5944
|
+
const event = new WillFocusEvent();
|
|
5945
|
+
this.api._onWillFocus.fire(event);
|
|
5946
|
+
if (event.defaultPrevented) {
|
|
5947
|
+
return;
|
|
5948
|
+
}
|
|
5949
|
+
if (!this.api.isActive) {
|
|
5950
|
+
this.api.setActive();
|
|
5951
|
+
}
|
|
5650
5952
|
}
|
|
5651
5953
|
toJSON() {
|
|
5652
5954
|
return {
|
|
@@ -5703,20 +6005,40 @@ class DockviewPanel extends CompositeDisposable {
|
|
|
5703
6005
|
},
|
|
5704
6006
|
});
|
|
5705
6007
|
}
|
|
5706
|
-
updateParentGroup(group,
|
|
6008
|
+
updateParentGroup(group, options) {
|
|
5707
6009
|
this._group = group;
|
|
5708
|
-
this.api.group =
|
|
6010
|
+
this.api.group = this._group;
|
|
5709
6011
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
5710
|
-
this.api.
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
6012
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6013
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetActive)) {
|
|
6014
|
+
if (this.api.isActive !== isActive) {
|
|
6015
|
+
this.api._onDidActiveChange.fire({
|
|
6016
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6017
|
+
});
|
|
6018
|
+
}
|
|
6019
|
+
}
|
|
6020
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6021
|
+
this.api._onDidVisibilityChange.fire({
|
|
6022
|
+
isVisible: isPanelVisible,
|
|
6023
|
+
});
|
|
6024
|
+
}
|
|
6025
|
+
}
|
|
6026
|
+
runEvents() {
|
|
6027
|
+
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
6028
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6029
|
+
if (this.api.isActive !== isActive) {
|
|
6030
|
+
this.api._onDidActiveChange.fire({
|
|
6031
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6032
|
+
});
|
|
6033
|
+
}
|
|
6034
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6035
|
+
this.api._onDidVisibilityChange.fire({
|
|
6036
|
+
isVisible: isPanelVisible,
|
|
6037
|
+
});
|
|
6038
|
+
}
|
|
5717
6039
|
}
|
|
5718
6040
|
layout(width, height) {
|
|
5719
|
-
//
|
|
6041
|
+
// TODO: Can we somehow do height without header height or indicate what the header height is?
|
|
5720
6042
|
this.api._onDidDimensionChange.fire({
|
|
5721
6043
|
width,
|
|
5722
6044
|
height: height,
|
|
@@ -5838,8 +6160,6 @@ class DockviewPanelModel {
|
|
|
5838
6160
|
this.id = id;
|
|
5839
6161
|
this.contentComponent = contentComponent;
|
|
5840
6162
|
this.tabComponent = tabComponent;
|
|
5841
|
-
this._group = null;
|
|
5842
|
-
this._isPanelVisible = null;
|
|
5843
6163
|
this._content = this.createContentComponent(this.id, contentComponent);
|
|
5844
6164
|
this._tab = this.createTabComponent(this.id, tabComponent);
|
|
5845
6165
|
}
|
|
@@ -5847,25 +6167,8 @@ class DockviewPanelModel {
|
|
|
5847
6167
|
this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
|
|
5848
6168
|
this.tab.init(params);
|
|
5849
6169
|
}
|
|
5850
|
-
updateParentGroup(
|
|
5851
|
-
|
|
5852
|
-
this._group = group;
|
|
5853
|
-
if (this._content.onGroupChange) {
|
|
5854
|
-
this._content.onGroupChange(group);
|
|
5855
|
-
}
|
|
5856
|
-
if (this._tab.onGroupChange) {
|
|
5857
|
-
this._tab.onGroupChange(group);
|
|
5858
|
-
}
|
|
5859
|
-
}
|
|
5860
|
-
if (isPanelVisible !== this._isPanelVisible) {
|
|
5861
|
-
this._isPanelVisible = isPanelVisible;
|
|
5862
|
-
if (this._content.onPanelVisibleChange) {
|
|
5863
|
-
this._content.onPanelVisibleChange(isPanelVisible);
|
|
5864
|
-
}
|
|
5865
|
-
if (this._tab.onPanelVisibleChange) {
|
|
5866
|
-
this._tab.onPanelVisibleChange(isPanelVisible);
|
|
5867
|
-
}
|
|
5868
|
-
}
|
|
6170
|
+
updateParentGroup(_group, _isPanelVisible) {
|
|
6171
|
+
// noop
|
|
5869
6172
|
}
|
|
5870
6173
|
layout(width, height) {
|
|
5871
6174
|
var _a, _b;
|
|
@@ -6298,117 +6601,6 @@ class DockviewFloatingGroupPanel extends CompositeDisposable {
|
|
|
6298
6601
|
}
|
|
6299
6602
|
}
|
|
6300
6603
|
|
|
6301
|
-
class PopoutWindow extends CompositeDisposable {
|
|
6302
|
-
constructor(id, className, options) {
|
|
6303
|
-
super();
|
|
6304
|
-
this.id = id;
|
|
6305
|
-
this.className = className;
|
|
6306
|
-
this.options = options;
|
|
6307
|
-
this._onDidClose = new Emitter();
|
|
6308
|
-
this.onDidClose = this._onDidClose.event;
|
|
6309
|
-
this._window = null;
|
|
6310
|
-
this.addDisposables(this._onDidClose, {
|
|
6311
|
-
dispose: () => {
|
|
6312
|
-
this.close();
|
|
6313
|
-
},
|
|
6314
|
-
});
|
|
6315
|
-
}
|
|
6316
|
-
dimensions() {
|
|
6317
|
-
if (!this._window) {
|
|
6318
|
-
return null;
|
|
6319
|
-
}
|
|
6320
|
-
const left = this._window.value.screenX;
|
|
6321
|
-
const top = this._window.value.screenY;
|
|
6322
|
-
const width = this._window.value.innerWidth;
|
|
6323
|
-
const height = this._window.value.innerHeight;
|
|
6324
|
-
return { top, left, width, height };
|
|
6325
|
-
}
|
|
6326
|
-
close() {
|
|
6327
|
-
if (this._window) {
|
|
6328
|
-
this._window.disposable.dispose();
|
|
6329
|
-
this._window.value.close();
|
|
6330
|
-
this._window = null;
|
|
6331
|
-
}
|
|
6332
|
-
}
|
|
6333
|
-
open(content) {
|
|
6334
|
-
if (this._window) {
|
|
6335
|
-
throw new Error('instance of popout window is already open');
|
|
6336
|
-
}
|
|
6337
|
-
const url = `${this.options.url}`;
|
|
6338
|
-
const features = Object.entries({
|
|
6339
|
-
top: this.options.top,
|
|
6340
|
-
left: this.options.left,
|
|
6341
|
-
width: this.options.width,
|
|
6342
|
-
height: this.options.height,
|
|
6343
|
-
})
|
|
6344
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
6345
|
-
.join(',');
|
|
6346
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6347
|
-
const externalWindow = window.open(url, this.id, features);
|
|
6348
|
-
if (!externalWindow) {
|
|
6349
|
-
return;
|
|
6350
|
-
}
|
|
6351
|
-
const disposable = new CompositeDisposable();
|
|
6352
|
-
this._window = { value: externalWindow, disposable };
|
|
6353
|
-
const cleanUp = () => {
|
|
6354
|
-
this._onDidClose.fire();
|
|
6355
|
-
this._window = null;
|
|
6356
|
-
};
|
|
6357
|
-
// prevent any default content from loading
|
|
6358
|
-
// externalWindow.document.body.replaceWith(document.createElement('div'));
|
|
6359
|
-
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6360
|
-
cleanUp();
|
|
6361
|
-
this.close();
|
|
6362
|
-
}));
|
|
6363
|
-
externalWindow.addEventListener('load', () => {
|
|
6364
|
-
const externalDocument = externalWindow.document;
|
|
6365
|
-
externalDocument.title = document.title;
|
|
6366
|
-
const div = document.createElement('div');
|
|
6367
|
-
div.classList.add('dv-popout-window');
|
|
6368
|
-
div.style.position = 'absolute';
|
|
6369
|
-
div.style.width = '100%';
|
|
6370
|
-
div.style.height = '100%';
|
|
6371
|
-
div.style.top = '0px';
|
|
6372
|
-
div.style.left = '0px';
|
|
6373
|
-
div.classList.add(this.className);
|
|
6374
|
-
div.appendChild(content);
|
|
6375
|
-
externalDocument.body.replaceChildren(div);
|
|
6376
|
-
externalDocument.body.classList.add(this.className);
|
|
6377
|
-
addStyles(externalDocument, window.document.styleSheets);
|
|
6378
|
-
externalWindow.addEventListener('beforeunload', () => {
|
|
6379
|
-
// TODO: indicate external window is closing
|
|
6380
|
-
cleanUp();
|
|
6381
|
-
});
|
|
6382
|
-
});
|
|
6383
|
-
}
|
|
6384
|
-
}
|
|
6385
|
-
|
|
6386
|
-
class DockviewPopoutGroupPanel extends CompositeDisposable {
|
|
6387
|
-
constructor(id, group, options) {
|
|
6388
|
-
var _a;
|
|
6389
|
-
super();
|
|
6390
|
-
this.id = id;
|
|
6391
|
-
this.group = group;
|
|
6392
|
-
this.options = options;
|
|
6393
|
-
this.window = new PopoutWindow(id, (_a = options.className) !== null && _a !== void 0 ? _a : '', {
|
|
6394
|
-
url: this.options.popoutUrl,
|
|
6395
|
-
left: this.options.box.left,
|
|
6396
|
-
top: this.options.box.top,
|
|
6397
|
-
width: this.options.box.width,
|
|
6398
|
-
height: this.options.box.height,
|
|
6399
|
-
});
|
|
6400
|
-
group.model.location = 'popout';
|
|
6401
|
-
this.addDisposables(this.window, {
|
|
6402
|
-
dispose: () => {
|
|
6403
|
-
group.model.location = 'grid';
|
|
6404
|
-
},
|
|
6405
|
-
}, this.window.onDidClose(() => {
|
|
6406
|
-
this.dispose();
|
|
6407
|
-
}));
|
|
6408
|
-
this.window.open(group.element);
|
|
6409
|
-
}
|
|
6410
|
-
}
|
|
6411
|
-
|
|
6412
6604
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6413
6605
|
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6414
6606
|
|
|
@@ -6422,11 +6614,13 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
6422
6614
|
super();
|
|
6423
6615
|
this.element = element;
|
|
6424
6616
|
this.map = {};
|
|
6617
|
+
this._disposed = false;
|
|
6425
6618
|
this.addDisposables(Disposable.from(() => {
|
|
6426
6619
|
for (const value of Object.values(this.map)) {
|
|
6427
6620
|
value.disposable.dispose();
|
|
6428
6621
|
value.destroy.dispose();
|
|
6429
6622
|
}
|
|
6623
|
+
this._disposed = true;
|
|
6430
6624
|
}));
|
|
6431
6625
|
}
|
|
6432
6626
|
detatch(panel) {
|
|
@@ -6466,7 +6660,7 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
6466
6660
|
focusContainer.style.top = `${box.top - box2.top}px`;
|
|
6467
6661
|
focusContainer.style.width = `${box.width}px`;
|
|
6468
6662
|
focusContainer.style.height = `${box.height}px`;
|
|
6469
|
-
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location === 'floating');
|
|
6663
|
+
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
|
|
6470
6664
|
};
|
|
6471
6665
|
const visibilityChanged = () => {
|
|
6472
6666
|
if (panel.api.isVisible) {
|
|
@@ -6512,8 +6706,11 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
6512
6706
|
resize();
|
|
6513
6707
|
}));
|
|
6514
6708
|
this.map[panel.api.id].destroy = Disposable.from(() => {
|
|
6515
|
-
|
|
6516
|
-
|
|
6709
|
+
var _a;
|
|
6710
|
+
if (panel.view.content.element.parentElement === focusContainer) {
|
|
6711
|
+
focusContainer.removeChild(panel.view.content.element);
|
|
6712
|
+
}
|
|
6713
|
+
(_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
|
|
6517
6714
|
});
|
|
6518
6715
|
queueMicrotask(() => {
|
|
6519
6716
|
if (this.isDisposed) {
|
|
@@ -6534,11 +6731,164 @@ class OverlayRenderContainer extends CompositeDisposable {
|
|
|
6534
6731
|
}
|
|
6535
6732
|
}
|
|
6536
6733
|
|
|
6734
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6735
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6736
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6737
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6738
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6739
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6740
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6741
|
+
});
|
|
6742
|
+
};
|
|
6743
|
+
class PopoutWindow extends CompositeDisposable {
|
|
6744
|
+
get window() {
|
|
6745
|
+
var _a, _b;
|
|
6746
|
+
return (_b = (_a = this._window) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;
|
|
6747
|
+
}
|
|
6748
|
+
constructor(target, className, options) {
|
|
6749
|
+
super();
|
|
6750
|
+
this.target = target;
|
|
6751
|
+
this.className = className;
|
|
6752
|
+
this.options = options;
|
|
6753
|
+
this._onWillClose = new Emitter();
|
|
6754
|
+
this.onWillClose = this._onWillClose.event;
|
|
6755
|
+
this._onDidClose = new Emitter();
|
|
6756
|
+
this.onDidClose = this._onDidClose.event;
|
|
6757
|
+
this._window = null;
|
|
6758
|
+
this.addDisposables(this._onWillClose, this._onDidClose, {
|
|
6759
|
+
dispose: () => {
|
|
6760
|
+
this.close();
|
|
6761
|
+
},
|
|
6762
|
+
});
|
|
6763
|
+
}
|
|
6764
|
+
dimensions() {
|
|
6765
|
+
if (!this._window) {
|
|
6766
|
+
return null;
|
|
6767
|
+
}
|
|
6768
|
+
const left = this._window.value.screenX;
|
|
6769
|
+
const top = this._window.value.screenY;
|
|
6770
|
+
const width = this._window.value.innerWidth;
|
|
6771
|
+
const height = this._window.value.innerHeight;
|
|
6772
|
+
return { top, left, width, height };
|
|
6773
|
+
}
|
|
6774
|
+
close() {
|
|
6775
|
+
var _a, _b;
|
|
6776
|
+
if (this._window) {
|
|
6777
|
+
this._onWillClose.fire();
|
|
6778
|
+
(_b = (_a = this.options).onWillClose) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6779
|
+
id: this.target,
|
|
6780
|
+
window: this._window.value,
|
|
6781
|
+
});
|
|
6782
|
+
this._window.disposable.dispose();
|
|
6783
|
+
this._window.value.close();
|
|
6784
|
+
this._window = null;
|
|
6785
|
+
this._onDidClose.fire();
|
|
6786
|
+
}
|
|
6787
|
+
}
|
|
6788
|
+
open() {
|
|
6789
|
+
var _a, _b;
|
|
6790
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6791
|
+
if (this._window) {
|
|
6792
|
+
throw new Error('instance of popout window is already open');
|
|
6793
|
+
}
|
|
6794
|
+
const url = `${this.options.url}`;
|
|
6795
|
+
const features = Object.entries({
|
|
6796
|
+
top: this.options.top,
|
|
6797
|
+
left: this.options.left,
|
|
6798
|
+
width: this.options.width,
|
|
6799
|
+
height: this.options.height,
|
|
6800
|
+
})
|
|
6801
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
6802
|
+
.join(',');
|
|
6803
|
+
/**
|
|
6804
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6805
|
+
*/
|
|
6806
|
+
const externalWindow = window.open(url, this.target, features);
|
|
6807
|
+
if (!externalWindow) {
|
|
6808
|
+
/**
|
|
6809
|
+
* Popup blocked
|
|
6810
|
+
*/
|
|
6811
|
+
return null;
|
|
6812
|
+
}
|
|
6813
|
+
const disposable = new CompositeDisposable();
|
|
6814
|
+
this._window = { value: externalWindow, disposable };
|
|
6815
|
+
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6816
|
+
/**
|
|
6817
|
+
* before the main window closes we should close this popup too
|
|
6818
|
+
* to be good citizens
|
|
6819
|
+
*
|
|
6820
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6821
|
+
*/
|
|
6822
|
+
this.close();
|
|
6823
|
+
}));
|
|
6824
|
+
const container = this.createPopoutWindowContainer();
|
|
6825
|
+
if (this.className) {
|
|
6826
|
+
container.classList.add(this.className);
|
|
6827
|
+
}
|
|
6828
|
+
(_b = (_a = this.options).onDidOpen) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6829
|
+
id: this.target,
|
|
6830
|
+
window: externalWindow,
|
|
6831
|
+
});
|
|
6832
|
+
return new Promise((resolve) => {
|
|
6833
|
+
externalWindow.addEventListener('unload', (e) => {
|
|
6834
|
+
// if page fails to load before unloading
|
|
6835
|
+
// this.close();
|
|
6836
|
+
});
|
|
6837
|
+
externalWindow.addEventListener('load', () => {
|
|
6838
|
+
/**
|
|
6839
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
|
|
6840
|
+
*/
|
|
6841
|
+
const externalDocument = externalWindow.document;
|
|
6842
|
+
externalDocument.title = document.title;
|
|
6843
|
+
externalDocument.body.appendChild(container);
|
|
6844
|
+
addStyles(externalDocument, window.document.styleSheets);
|
|
6845
|
+
/**
|
|
6846
|
+
* beforeunload must be registered after load for reasons I could not determine
|
|
6847
|
+
* otherwise the beforeunload event will not fire when the window is closed
|
|
6848
|
+
*/
|
|
6849
|
+
addDisposableWindowListener(externalWindow, 'beforeunload', () => {
|
|
6850
|
+
/**
|
|
6851
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6852
|
+
*/
|
|
6853
|
+
this.close();
|
|
6854
|
+
});
|
|
6855
|
+
resolve(container);
|
|
6856
|
+
});
|
|
6857
|
+
});
|
|
6858
|
+
});
|
|
6859
|
+
}
|
|
6860
|
+
createPopoutWindowContainer() {
|
|
6861
|
+
const el = document.createElement('div');
|
|
6862
|
+
el.classList.add('dv-popout-window');
|
|
6863
|
+
el.id = 'dv-popout-window';
|
|
6864
|
+
el.style.position = 'absolute';
|
|
6865
|
+
el.style.width = '100%';
|
|
6866
|
+
el.style.height = '100%';
|
|
6867
|
+
el.style.top = '0px';
|
|
6868
|
+
el.style.left = '0px';
|
|
6869
|
+
return el;
|
|
6870
|
+
}
|
|
6871
|
+
}
|
|
6872
|
+
|
|
6537
6873
|
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6538
6874
|
activationSize: { type: 'pixels', value: 10 },
|
|
6539
6875
|
size: { type: 'pixels', value: 20 },
|
|
6540
6876
|
};
|
|
6541
|
-
function
|
|
6877
|
+
function moveGroupWithoutDestroying(options) {
|
|
6878
|
+
const activePanel = options.from.activePanel;
|
|
6879
|
+
const panels = [...options.from.panels].map((panel) => {
|
|
6880
|
+
const removedPanel = options.from.model.removePanel(panel);
|
|
6881
|
+
options.from.model.renderContainer.detatch(panel);
|
|
6882
|
+
return removedPanel;
|
|
6883
|
+
});
|
|
6884
|
+
panels.forEach((panel) => {
|
|
6885
|
+
options.to.model.openPanel(panel, {
|
|
6886
|
+
skipSetActive: activePanel !== panel,
|
|
6887
|
+
skipSetGroupActive: true,
|
|
6888
|
+
});
|
|
6889
|
+
});
|
|
6890
|
+
}
|
|
6891
|
+
function getDockviewTheme(element) {
|
|
6542
6892
|
function toClassList(element) {
|
|
6543
6893
|
const list = [];
|
|
6544
6894
|
for (let i = 0; i < element.classList.length; i++) {
|
|
@@ -6589,6 +6939,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
6589
6939
|
styles: options.styles,
|
|
6590
6940
|
parentElement: options.parentElement,
|
|
6591
6941
|
disableAutoResizing: options.disableAutoResizing,
|
|
6942
|
+
locked: options.locked,
|
|
6592
6943
|
});
|
|
6593
6944
|
this.nextGroupId = sequentialNumberGenerator();
|
|
6594
6945
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -6599,6 +6950,10 @@ class DockviewComponent extends BaseGrid {
|
|
|
6599
6950
|
this.onWillDragGroup = this._onWillDragGroup.event;
|
|
6600
6951
|
this._onDidDrop = new Emitter();
|
|
6601
6952
|
this.onDidDrop = this._onDidDrop.event;
|
|
6953
|
+
this._onWillDrop = new Emitter();
|
|
6954
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
6955
|
+
this._onWillShowOverlay = new Emitter();
|
|
6956
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
6602
6957
|
this._onDidRemovePanel = new Emitter();
|
|
6603
6958
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
6604
6959
|
this._onDidAddPanel = new Emitter();
|
|
@@ -6607,15 +6962,36 @@ class DockviewComponent extends BaseGrid {
|
|
|
6607
6962
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
6608
6963
|
this._onDidActivePanelChange = new Emitter();
|
|
6609
6964
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
6965
|
+
this._onDidMovePanel = new Emitter();
|
|
6610
6966
|
this._floatingGroups = [];
|
|
6611
6967
|
this._popoutGroups = [];
|
|
6968
|
+
this._ignoreEvents = 0;
|
|
6969
|
+
this._onDidRemoveGroup = new Emitter();
|
|
6970
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
6971
|
+
this._onDidAddGroup = new Emitter();
|
|
6972
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
6973
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
6974
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
6975
|
+
this._moving = false;
|
|
6612
6976
|
const gready = document.createElement('div');
|
|
6613
6977
|
gready.className = 'dv-overlay-render-container';
|
|
6614
6978
|
this.gridview.element.appendChild(gready);
|
|
6615
6979
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
6616
6980
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
6617
6981
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
6618
|
-
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop,
|
|
6982
|
+
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) => {
|
|
6983
|
+
if (!this._moving) {
|
|
6984
|
+
this._onDidAddGroup.fire(event);
|
|
6985
|
+
}
|
|
6986
|
+
}), this.onDidRemove((event) => {
|
|
6987
|
+
if (!this._moving) {
|
|
6988
|
+
this._onDidRemoveGroup.fire(event);
|
|
6989
|
+
}
|
|
6990
|
+
}), this.onDidActiveChange((event) => {
|
|
6991
|
+
if (!this._moving) {
|
|
6992
|
+
this._onDidActiveGroupChange.fire(event);
|
|
6993
|
+
}
|
|
6994
|
+
}), Event.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
6619
6995
|
this.updateWatermark();
|
|
6620
6996
|
}), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
6621
6997
|
this._bufferOnDidLayoutChange.fire();
|
|
@@ -6626,7 +7002,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
6626
7002
|
}
|
|
6627
7003
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6628
7004
|
for (const group of [...this._popoutGroups]) {
|
|
6629
|
-
group.dispose();
|
|
7005
|
+
group.disposable.dispose();
|
|
6630
7006
|
}
|
|
6631
7007
|
}));
|
|
6632
7008
|
this._options = options;
|
|
@@ -6672,7 +7048,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
6672
7048
|
return this.options.showDndOverlay({
|
|
6673
7049
|
nativeEvent: event,
|
|
6674
7050
|
position: position,
|
|
6675
|
-
target:
|
|
7051
|
+
target: 'edge',
|
|
6676
7052
|
getData: getPanelData,
|
|
6677
7053
|
});
|
|
6678
7054
|
}
|
|
@@ -6683,86 +7059,249 @@ class DockviewComponent extends BaseGrid {
|
|
|
6683
7059
|
});
|
|
6684
7060
|
this.addDisposables(this._rootDropTarget.onDrop((event) => {
|
|
6685
7061
|
var _a;
|
|
7062
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
7063
|
+
nativeEvent: event.nativeEvent,
|
|
7064
|
+
position: event.position,
|
|
7065
|
+
panel: undefined,
|
|
7066
|
+
api: this._api,
|
|
7067
|
+
group: undefined,
|
|
7068
|
+
getData: getPanelData,
|
|
7069
|
+
kind: 'content',
|
|
7070
|
+
});
|
|
7071
|
+
this._onWillDrop.fire(willDropEvent);
|
|
7072
|
+
if (willDropEvent.defaultPrevented) {
|
|
7073
|
+
return;
|
|
7074
|
+
}
|
|
6686
7075
|
const data = getPanelData();
|
|
6687
7076
|
if (data) {
|
|
6688
|
-
this.moveGroupOrPanel(
|
|
7077
|
+
this.moveGroupOrPanel({
|
|
7078
|
+
from: {
|
|
7079
|
+
groupId: data.groupId,
|
|
7080
|
+
panelId: (_a = data.panelId) !== null && _a !== void 0 ? _a : undefined,
|
|
7081
|
+
},
|
|
7082
|
+
to: {
|
|
7083
|
+
group: this.orthogonalize(event.position),
|
|
7084
|
+
position: 'center',
|
|
7085
|
+
},
|
|
7086
|
+
});
|
|
6689
7087
|
}
|
|
6690
7088
|
else {
|
|
6691
|
-
this._onDidDrop.fire(
|
|
7089
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
7090
|
+
nativeEvent: event.nativeEvent,
|
|
7091
|
+
position: event.position,
|
|
7092
|
+
panel: undefined,
|
|
7093
|
+
api: this._api,
|
|
7094
|
+
group: undefined,
|
|
7095
|
+
getData: getPanelData,
|
|
7096
|
+
}));
|
|
6692
7097
|
}
|
|
6693
7098
|
}), this._rootDropTarget);
|
|
6694
7099
|
this._api = new DockviewApi(this);
|
|
6695
7100
|
this.updateWatermark();
|
|
6696
7101
|
}
|
|
6697
|
-
addPopoutGroup(
|
|
6698
|
-
var _a;
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
7102
|
+
addPopoutGroup(itemToPopout, options) {
|
|
7103
|
+
var _a, _b, _c;
|
|
7104
|
+
if (itemToPopout instanceof DockviewPanel &&
|
|
7105
|
+
itemToPopout.group.size === 1) {
|
|
7106
|
+
return this.addPopoutGroup(itemToPopout.group);
|
|
7107
|
+
}
|
|
7108
|
+
const theme = getDockviewTheme(this.gridview.element);
|
|
7109
|
+
const element = this.element;
|
|
7110
|
+
function getBox() {
|
|
7111
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7112
|
+
return options.position;
|
|
7113
|
+
}
|
|
7114
|
+
if (itemToPopout instanceof DockviewGroupPanel) {
|
|
7115
|
+
return itemToPopout.element.getBoundingClientRect();
|
|
7116
|
+
}
|
|
7117
|
+
if (itemToPopout.group) {
|
|
7118
|
+
return itemToPopout.group.element.getBoundingClientRect();
|
|
7119
|
+
}
|
|
7120
|
+
return element.getBoundingClientRect();
|
|
7121
|
+
}
|
|
7122
|
+
const box = getBox();
|
|
7123
|
+
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;
|
|
7124
|
+
if (itemToPopout.api.location.type === 'grid') {
|
|
7125
|
+
itemToPopout.api.setHidden(true);
|
|
7126
|
+
}
|
|
7127
|
+
const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
|
|
7128
|
+
theme !== null && theme !== void 0 ? theme : '', {
|
|
7129
|
+
url: (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : '/popout.html',
|
|
7130
|
+
left: window.screenX + box.left,
|
|
7131
|
+
top: window.screenY + box.top,
|
|
7132
|
+
width: box.width,
|
|
7133
|
+
height: box.height,
|
|
7134
|
+
onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
|
|
7135
|
+
onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
|
|
7136
|
+
});
|
|
7137
|
+
const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
|
|
7138
|
+
popoutWindowDisposable.dispose();
|
|
7139
|
+
}));
|
|
7140
|
+
return _window
|
|
7141
|
+
.open()
|
|
7142
|
+
.then((popoutContainer) => {
|
|
7143
|
+
var _a;
|
|
7144
|
+
if (_window.isDisposed) {
|
|
7145
|
+
return;
|
|
6710
7146
|
}
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
if (!box) {
|
|
6715
|
-
box = group.element.getBoundingClientRect();
|
|
7147
|
+
if (popoutContainer === null) {
|
|
7148
|
+
popoutWindowDisposable.dispose();
|
|
7149
|
+
return;
|
|
6716
7150
|
}
|
|
6717
|
-
const
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
7151
|
+
const gready = document.createElement('div');
|
|
7152
|
+
gready.className = 'dv-overlay-render-container';
|
|
7153
|
+
const overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7154
|
+
const referenceGroup = itemToPopout instanceof DockviewPanel
|
|
7155
|
+
? itemToPopout.group
|
|
7156
|
+
: itemToPopout;
|
|
7157
|
+
const referenceLocation = itemToPopout.api.location.type;
|
|
7158
|
+
const group = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) !== null && _a !== void 0 ? _a : this.createGroup({ id: groupId });
|
|
7159
|
+
group.model.renderContainer = overlayRenderContainer;
|
|
7160
|
+
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup)) {
|
|
7161
|
+
this._onDidAddGroup.fire(group);
|
|
7162
|
+
}
|
|
7163
|
+
if (itemToPopout instanceof DockviewPanel) {
|
|
7164
|
+
this.movingLock(() => {
|
|
7165
|
+
const panel = referenceGroup.model.removePanel(itemToPopout);
|
|
7166
|
+
group.model.openPanel(panel);
|
|
7167
|
+
});
|
|
7168
|
+
}
|
|
7169
|
+
else {
|
|
7170
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7171
|
+
from: referenceGroup,
|
|
7172
|
+
to: group,
|
|
7173
|
+
}));
|
|
7174
|
+
switch (referenceLocation) {
|
|
7175
|
+
case 'grid':
|
|
7176
|
+
referenceGroup.api.setHidden(true);
|
|
7177
|
+
break;
|
|
7178
|
+
case 'floating':
|
|
7179
|
+
case 'popout':
|
|
7180
|
+
this.removeGroup(referenceGroup);
|
|
7181
|
+
break;
|
|
7182
|
+
}
|
|
7183
|
+
}
|
|
7184
|
+
popoutContainer.classList.add('dv-dockview');
|
|
7185
|
+
popoutContainer.style.overflow = 'hidden';
|
|
7186
|
+
popoutContainer.appendChild(gready);
|
|
7187
|
+
popoutContainer.appendChild(group.element);
|
|
7188
|
+
group.model.location = {
|
|
7189
|
+
type: 'popout',
|
|
7190
|
+
getWindow: () => _window.window,
|
|
7191
|
+
};
|
|
7192
|
+
this.doSetGroupAndPanelActive(group);
|
|
7193
|
+
popoutWindowDisposable.addDisposables(group.api.onDidActiveChange((event) => {
|
|
7194
|
+
var _a;
|
|
7195
|
+
if (event.isActive) {
|
|
7196
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7197
|
+
}
|
|
7198
|
+
}), group.api.onWillFocus(() => {
|
|
7199
|
+
var _a;
|
|
7200
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7201
|
+
}));
|
|
7202
|
+
let returnedGroup;
|
|
7203
|
+
const value = {
|
|
7204
|
+
window: _window,
|
|
7205
|
+
popoutGroup: group,
|
|
7206
|
+
referenceGroup: this.getPanel(referenceGroup.id)
|
|
7207
|
+
? referenceGroup.id
|
|
7208
|
+
: undefined,
|
|
7209
|
+
disposable: {
|
|
7210
|
+
dispose: () => {
|
|
7211
|
+
popoutWindowDisposable.dispose();
|
|
7212
|
+
return returnedGroup;
|
|
7213
|
+
},
|
|
7214
|
+
},
|
|
7215
|
+
};
|
|
7216
|
+
popoutWindowDisposable.addDisposables(
|
|
7217
|
+
/**
|
|
7218
|
+
* ResizeObserver seems slow here, I do not know why but we don't need it
|
|
7219
|
+
* since we can reply on the window resize event as we will occupy the full
|
|
7220
|
+
* window dimensions
|
|
7221
|
+
*/
|
|
7222
|
+
addDisposableWindowListener(_window.window, 'resize', () => {
|
|
7223
|
+
group.layout(window.innerWidth, window.innerHeight);
|
|
7224
|
+
}), overlayRenderContainer, Disposable.from(() => {
|
|
7225
|
+
if (this.getPanel(referenceGroup.id)) {
|
|
7226
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7227
|
+
from: group,
|
|
7228
|
+
to: referenceGroup,
|
|
7229
|
+
}));
|
|
7230
|
+
if (referenceGroup.api.isHidden) {
|
|
7231
|
+
referenceGroup.api.setHidden(false);
|
|
7232
|
+
}
|
|
7233
|
+
if (this.getPanel(group.id)) {
|
|
7234
|
+
this.doRemoveGroup(group, {
|
|
7235
|
+
skipPopoutAssociated: true,
|
|
7236
|
+
});
|
|
7237
|
+
}
|
|
7238
|
+
}
|
|
7239
|
+
else {
|
|
7240
|
+
if (this.getPanel(group.id)) {
|
|
7241
|
+
const removedGroup = this.doRemoveGroup(group, {
|
|
7242
|
+
skipDispose: true,
|
|
7243
|
+
skipActive: true,
|
|
7244
|
+
});
|
|
7245
|
+
removedGroup.model.renderContainer =
|
|
7246
|
+
this.overlayRenderContainer;
|
|
7247
|
+
removedGroup.model.location = { type: 'grid' };
|
|
7248
|
+
returnedGroup = removedGroup;
|
|
7249
|
+
}
|
|
7250
|
+
}
|
|
7251
|
+
}));
|
|
7252
|
+
this._popoutGroups.push(value);
|
|
7253
|
+
this.updateWatermark();
|
|
7254
|
+
})
|
|
7255
|
+
.catch((err) => {
|
|
7256
|
+
console.error(err);
|
|
6734
7257
|
});
|
|
6735
|
-
popoutWindow.addDisposables({
|
|
6736
|
-
dispose: () => {
|
|
6737
|
-
remove(this._popoutGroups, popoutWindow);
|
|
6738
|
-
this.updateWatermark();
|
|
6739
|
-
},
|
|
6740
|
-
}, popoutWindow.window.onDidClose(() => {
|
|
6741
|
-
this.doAddGroup(group, [0]);
|
|
6742
|
-
}));
|
|
6743
|
-
this._popoutGroups.push(popoutWindow);
|
|
6744
|
-
this.updateWatermark();
|
|
6745
7258
|
}
|
|
6746
7259
|
addFloatingGroup(item, coord, options) {
|
|
6747
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7260
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6748
7261
|
let group;
|
|
6749
7262
|
if (item instanceof DockviewPanel) {
|
|
6750
7263
|
group = this.createGroup();
|
|
6751
|
-
this.
|
|
7264
|
+
this._onDidAddGroup.fire(group);
|
|
7265
|
+
this.movingLock(() => this.removePanel(item, {
|
|
6752
7266
|
removeEmptyGroup: true,
|
|
6753
7267
|
skipDispose: true,
|
|
6754
|
-
|
|
6755
|
-
|
|
7268
|
+
skipSetActiveGroup: true,
|
|
7269
|
+
}));
|
|
7270
|
+
group.model.openPanel(item, { skipSetGroupActive: true });
|
|
6756
7271
|
}
|
|
6757
7272
|
else {
|
|
6758
7273
|
group = item;
|
|
7274
|
+
const popoutReferenceGroupId = (_a = this._popoutGroups.find((_) => _.popoutGroup === group)) === null || _a === void 0 ? void 0 : _a.referenceGroup;
|
|
7275
|
+
const popoutReferenceGroup = popoutReferenceGroupId
|
|
7276
|
+
? this.getPanel(popoutReferenceGroupId)
|
|
7277
|
+
: undefined;
|
|
6759
7278
|
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
6760
7279
|
options.skipRemoveGroup;
|
|
6761
7280
|
if (!skip) {
|
|
6762
|
-
|
|
7281
|
+
if (popoutReferenceGroup) {
|
|
7282
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7283
|
+
from: item,
|
|
7284
|
+
to: popoutReferenceGroup,
|
|
7285
|
+
}));
|
|
7286
|
+
this.doRemoveGroup(item, {
|
|
7287
|
+
skipPopoutReturn: true,
|
|
7288
|
+
skipPopoutAssociated: true,
|
|
7289
|
+
});
|
|
7290
|
+
this.doRemoveGroup(popoutReferenceGroup, {
|
|
7291
|
+
skipDispose: true,
|
|
7292
|
+
});
|
|
7293
|
+
group = popoutReferenceGroup;
|
|
7294
|
+
}
|
|
7295
|
+
else {
|
|
7296
|
+
this.doRemoveGroup(item, {
|
|
7297
|
+
skipDispose: true,
|
|
7298
|
+
skipPopoutReturn: true,
|
|
7299
|
+
skipPopoutAssociated: !!popoutReferenceGroup,
|
|
7300
|
+
});
|
|
7301
|
+
}
|
|
6763
7302
|
}
|
|
6764
7303
|
}
|
|
6765
|
-
group.model.location = 'floating';
|
|
7304
|
+
group.model.location = { type: 'floating' };
|
|
6766
7305
|
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6767
7306
|
? Math.max(coord.x, 0)
|
|
6768
7307
|
: DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
@@ -6772,16 +7311,16 @@ class DockviewComponent extends BaseGrid {
|
|
|
6772
7311
|
const overlay = new Overlay({
|
|
6773
7312
|
container: this.gridview.element,
|
|
6774
7313
|
content: group.element,
|
|
6775
|
-
height: (
|
|
6776
|
-
width: (
|
|
7314
|
+
height: (_b = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _b !== void 0 ? _b : 300,
|
|
7315
|
+
width: (_c = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _c !== void 0 ? _c : 300,
|
|
6777
7316
|
left: overlayLeft,
|
|
6778
7317
|
top: overlayTop,
|
|
6779
7318
|
minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6780
7319
|
? undefined
|
|
6781
|
-
: (
|
|
7320
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumWidthWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6782
7321
|
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6783
7322
|
? undefined
|
|
6784
|
-
: (
|
|
7323
|
+
: (_g = (_f = this.options.floatingGroupBounds) === null || _f === void 0 ? void 0 : _f.minimumHeightWithinViewport) !== null && _g !== void 0 ? _g : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6785
7324
|
});
|
|
6786
7325
|
const el = group.element.querySelector('.void-container');
|
|
6787
7326
|
if (!el) {
|
|
@@ -6812,12 +7351,15 @@ class DockviewComponent extends BaseGrid {
|
|
|
6812
7351
|
}), {
|
|
6813
7352
|
dispose: () => {
|
|
6814
7353
|
disposable.dispose();
|
|
6815
|
-
group.model.location = 'grid';
|
|
7354
|
+
group.model.location = { type: 'grid' };
|
|
6816
7355
|
remove(this._floatingGroups, floatingGroupPanel);
|
|
6817
7356
|
this.updateWatermark();
|
|
6818
7357
|
},
|
|
6819
7358
|
});
|
|
6820
7359
|
this._floatingGroups.push(floatingGroupPanel);
|
|
7360
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
|
|
7361
|
+
this.doSetGroupAndPanelActive(group);
|
|
7362
|
+
}
|
|
6821
7363
|
this.updateWatermark();
|
|
6822
7364
|
}
|
|
6823
7365
|
orthogonalize(position) {
|
|
@@ -6907,8 +7449,8 @@ class DockviewComponent extends BaseGrid {
|
|
|
6907
7449
|
return this.panels.find((panel) => panel.id === id);
|
|
6908
7450
|
}
|
|
6909
7451
|
setActivePanel(panel) {
|
|
6910
|
-
this.doSetGroupActive(panel.group);
|
|
6911
7452
|
panel.group.model.openPanel(panel);
|
|
7453
|
+
this.doSetGroupAndPanelActive(panel.group);
|
|
6912
7454
|
}
|
|
6913
7455
|
moveToNext(options = {}) {
|
|
6914
7456
|
var _a;
|
|
@@ -6969,7 +7511,8 @@ class DockviewComponent extends BaseGrid {
|
|
|
6969
7511
|
});
|
|
6970
7512
|
const popoutGroups = this._popoutGroups.map((group) => {
|
|
6971
7513
|
return {
|
|
6972
|
-
data: group.
|
|
7514
|
+
data: group.popoutGroup.toJSON(),
|
|
7515
|
+
gridReferenceGroup: group.referenceGroup,
|
|
6973
7516
|
position: group.window.dimensions(),
|
|
6974
7517
|
};
|
|
6975
7518
|
});
|
|
@@ -6987,7 +7530,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
6987
7530
|
return result;
|
|
6988
7531
|
}
|
|
6989
7532
|
fromJSON(data) {
|
|
6990
|
-
var _a, _b;
|
|
7533
|
+
var _a, _b, _c;
|
|
6991
7534
|
this.clear();
|
|
6992
7535
|
if (typeof data !== 'object' || data === null) {
|
|
6993
7536
|
throw new Error('serialized layout must be a non-null object');
|
|
@@ -7026,7 +7569,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7026
7569
|
const isActive = typeof activeView === 'string' &&
|
|
7027
7570
|
activeView === panel.id;
|
|
7028
7571
|
group.model.openPanel(panel, {
|
|
7029
|
-
|
|
7572
|
+
skipSetActive: !isActive,
|
|
7030
7573
|
skipSetGroupActive: true,
|
|
7031
7574
|
});
|
|
7032
7575
|
}
|
|
@@ -7056,11 +7599,16 @@ class DockviewComponent extends BaseGrid {
|
|
|
7056
7599
|
}
|
|
7057
7600
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7058
7601
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
7059
|
-
const { data, position } = serializedPopoutGroup;
|
|
7602
|
+
const { data, position, gridReferenceGroup } = serializedPopoutGroup;
|
|
7060
7603
|
const group = createGroupFromSerializedState(data);
|
|
7061
|
-
this.addPopoutGroup(
|
|
7604
|
+
this.addPopoutGroup((_c = (gridReferenceGroup
|
|
7605
|
+
? this.getPanel(gridReferenceGroup)
|
|
7606
|
+
: undefined)) !== null && _c !== void 0 ? _c : group, {
|
|
7062
7607
|
skipRemoveGroup: true,
|
|
7063
7608
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
7609
|
+
overridePopoutGroup: gridReferenceGroup
|
|
7610
|
+
? group
|
|
7611
|
+
: undefined,
|
|
7064
7612
|
});
|
|
7065
7613
|
}
|
|
7066
7614
|
for (const floatingGroup of this._floatingGroups) {
|
|
@@ -7107,12 +7655,13 @@ class DockviewComponent extends BaseGrid {
|
|
|
7107
7655
|
*/
|
|
7108
7656
|
throw err;
|
|
7109
7657
|
}
|
|
7658
|
+
this.updateWatermark();
|
|
7110
7659
|
this._onDidLayoutFromJSON.fire();
|
|
7111
7660
|
}
|
|
7112
7661
|
clear() {
|
|
7113
7662
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7114
7663
|
const hasActiveGroup = !!this.activeGroup;
|
|
7115
|
-
|
|
7664
|
+
!!this.activePanel;
|
|
7116
7665
|
for (const group of groups) {
|
|
7117
7666
|
// remove the group will automatically remove the panels
|
|
7118
7667
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7120,9 +7669,6 @@ class DockviewComponent extends BaseGrid {
|
|
|
7120
7669
|
if (hasActiveGroup) {
|
|
7121
7670
|
this.doSetGroupAndPanelActive(undefined);
|
|
7122
7671
|
}
|
|
7123
|
-
if (hasActivePanel) {
|
|
7124
|
-
this._onDidActivePanelChange.fire(undefined);
|
|
7125
|
-
}
|
|
7126
7672
|
this.gridview.clear();
|
|
7127
7673
|
}
|
|
7128
7674
|
closeAllGroups() {
|
|
@@ -7163,6 +7709,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7163
7709
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
7164
7710
|
const panel = this.createPanel(options, group);
|
|
7165
7711
|
group.model.openPanel(panel);
|
|
7712
|
+
this.doSetGroupAndPanelActive(group);
|
|
7166
7713
|
return panel;
|
|
7167
7714
|
}
|
|
7168
7715
|
}
|
|
@@ -7174,6 +7721,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7174
7721
|
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
7175
7722
|
if (options.floating) {
|
|
7176
7723
|
const group = this.createGroup();
|
|
7724
|
+
this._onDidAddGroup.fire(group);
|
|
7177
7725
|
const o = typeof options.floating === 'object' &&
|
|
7178
7726
|
options.floating !== null
|
|
7179
7727
|
? options.floating
|
|
@@ -7181,16 +7729,16 @@ class DockviewComponent extends BaseGrid {
|
|
|
7181
7729
|
this.addFloatingGroup(group, o, {
|
|
7182
7730
|
inDragMode: false,
|
|
7183
7731
|
skipRemoveGroup: true,
|
|
7732
|
+
skipActiveGroup: true,
|
|
7184
7733
|
});
|
|
7185
|
-
this._onDidAddGroup.fire(group);
|
|
7186
7734
|
panel = this.createPanel(options, group);
|
|
7187
7735
|
group.model.openPanel(panel);
|
|
7188
|
-
this.doSetGroupAndPanelActive(group);
|
|
7189
7736
|
}
|
|
7190
|
-
else if (referenceGroup.api.location === 'floating' ||
|
|
7737
|
+
else if (referenceGroup.api.location.type === 'floating' ||
|
|
7191
7738
|
target === 'center') {
|
|
7192
7739
|
panel = this.createPanel(options, referenceGroup);
|
|
7193
7740
|
referenceGroup.model.openPanel(panel);
|
|
7741
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
7194
7742
|
}
|
|
7195
7743
|
else {
|
|
7196
7744
|
const location = getGridLocation(referenceGroup.element);
|
|
@@ -7198,10 +7746,12 @@ class DockviewComponent extends BaseGrid {
|
|
|
7198
7746
|
const group = this.createGroupAtLocation(relativeLocation);
|
|
7199
7747
|
panel = this.createPanel(options, group);
|
|
7200
7748
|
group.model.openPanel(panel);
|
|
7749
|
+
this.doSetGroupAndPanelActive(group);
|
|
7201
7750
|
}
|
|
7202
7751
|
}
|
|
7203
7752
|
else if (options.floating) {
|
|
7204
7753
|
const group = this.createGroup();
|
|
7754
|
+
this._onDidAddGroup.fire(group);
|
|
7205
7755
|
const o = typeof options.floating === 'object' &&
|
|
7206
7756
|
options.floating !== null
|
|
7207
7757
|
? options.floating
|
|
@@ -7209,16 +7759,16 @@ class DockviewComponent extends BaseGrid {
|
|
|
7209
7759
|
this.addFloatingGroup(group, o, {
|
|
7210
7760
|
inDragMode: false,
|
|
7211
7761
|
skipRemoveGroup: true,
|
|
7762
|
+
skipActiveGroup: true,
|
|
7212
7763
|
});
|
|
7213
|
-
this._onDidAddGroup.fire(group);
|
|
7214
7764
|
panel = this.createPanel(options, group);
|
|
7215
7765
|
group.model.openPanel(panel);
|
|
7216
|
-
this.doSetGroupAndPanelActive(group);
|
|
7217
7766
|
}
|
|
7218
7767
|
else {
|
|
7219
7768
|
const group = this.createGroupAtLocation();
|
|
7220
7769
|
panel = this.createPanel(options, group);
|
|
7221
7770
|
group.model.openPanel(panel);
|
|
7771
|
+
this.doSetGroupAndPanelActive(group);
|
|
7222
7772
|
}
|
|
7223
7773
|
return panel;
|
|
7224
7774
|
}
|
|
@@ -7230,13 +7780,15 @@ class DockviewComponent extends BaseGrid {
|
|
|
7230
7780
|
if (!group) {
|
|
7231
7781
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
7232
7782
|
}
|
|
7233
|
-
group.model.removePanel(panel
|
|
7783
|
+
group.model.removePanel(panel, {
|
|
7784
|
+
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
7785
|
+
});
|
|
7234
7786
|
if (!options.skipDispose) {
|
|
7235
|
-
|
|
7787
|
+
panel.group.model.renderContainer.detatch(panel);
|
|
7236
7788
|
panel.dispose();
|
|
7237
7789
|
}
|
|
7238
7790
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
7239
|
-
this.removeGroup(group);
|
|
7791
|
+
this.removeGroup(group, { skipActive: options.skipSetActiveGroup });
|
|
7240
7792
|
}
|
|
7241
7793
|
}
|
|
7242
7794
|
createWatermarkComponent() {
|
|
@@ -7249,7 +7801,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7249
7801
|
}
|
|
7250
7802
|
updateWatermark() {
|
|
7251
7803
|
var _a, _b;
|
|
7252
|
-
if (this.groups.filter((x) => x.api.location === 'grid').length === 0) {
|
|
7804
|
+
if (this.groups.filter((x) => x.api.location.type === 'grid' && !x.api.isHidden).length === 0) {
|
|
7253
7805
|
if (!this.watermark) {
|
|
7254
7806
|
this.watermark = this.createWatermarkComponent();
|
|
7255
7807
|
this.watermark.init({
|
|
@@ -7295,36 +7847,42 @@ class DockviewComponent extends BaseGrid {
|
|
|
7295
7847
|
}
|
|
7296
7848
|
else {
|
|
7297
7849
|
const group = this.orthogonalize(directionToPosition(options.direction));
|
|
7850
|
+
if (!options.skipSetActive) {
|
|
7851
|
+
this.doSetGroupAndPanelActive(group);
|
|
7852
|
+
}
|
|
7298
7853
|
return group;
|
|
7299
7854
|
}
|
|
7300
7855
|
const target = toTarget(options.direction || 'within');
|
|
7301
7856
|
const location = getGridLocation(referenceGroup.element);
|
|
7302
7857
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7303
7858
|
this.doAddGroup(group, relativeLocation);
|
|
7859
|
+
if (!options.skipSetActive) {
|
|
7860
|
+
this.doSetGroupAndPanelActive(group);
|
|
7861
|
+
}
|
|
7304
7862
|
return group;
|
|
7305
7863
|
}
|
|
7306
7864
|
else {
|
|
7307
7865
|
this.doAddGroup(group);
|
|
7866
|
+
this.doSetGroupAndPanelActive(group);
|
|
7308
7867
|
return group;
|
|
7309
7868
|
}
|
|
7310
7869
|
}
|
|
7311
7870
|
removeGroup(group, options) {
|
|
7871
|
+
this.doRemoveGroup(group, options);
|
|
7872
|
+
}
|
|
7873
|
+
doRemoveGroup(group, options) {
|
|
7312
7874
|
var _a;
|
|
7313
7875
|
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7876
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7877
|
+
for (const panel of panels) {
|
|
7878
|
+
this.removePanel(panel, {
|
|
7879
|
+
removeEmptyGroup: false,
|
|
7880
|
+
skipDispose: (_a = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _a !== void 0 ? _a : false,
|
|
7881
|
+
});
|
|
7882
|
+
}
|
|
7319
7883
|
}
|
|
7320
7884
|
const activePanel = this.activePanel;
|
|
7321
|
-
|
|
7322
|
-
if (this.activePanel !== activePanel) {
|
|
7323
|
-
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7324
|
-
}
|
|
7325
|
-
}
|
|
7326
|
-
doRemoveGroup(group, options) {
|
|
7327
|
-
if (group.api.location === 'floating') {
|
|
7885
|
+
if (group.api.location.type === 'floating') {
|
|
7328
7886
|
const floatingGroup = this._floatingGroups.find((_) => _.group === group);
|
|
7329
7887
|
if (floatingGroup) {
|
|
7330
7888
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
@@ -7336,60 +7894,124 @@ class DockviewComponent extends BaseGrid {
|
|
|
7336
7894
|
floatingGroup.dispose();
|
|
7337
7895
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7338
7896
|
const groups = Array.from(this._groups.values());
|
|
7339
|
-
this.
|
|
7897
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7340
7898
|
}
|
|
7341
7899
|
return floatingGroup.group;
|
|
7342
7900
|
}
|
|
7343
7901
|
throw new Error('failed to find floating group');
|
|
7344
7902
|
}
|
|
7345
|
-
if (group.api.location === 'popout') {
|
|
7346
|
-
const selectedGroup = this._popoutGroups.find((_) => _.
|
|
7903
|
+
if (group.api.location.type === 'popout') {
|
|
7904
|
+
const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
|
|
7347
7905
|
if (selectedGroup) {
|
|
7348
7906
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7349
|
-
|
|
7907
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutAssociated)) {
|
|
7908
|
+
const refGroup = selectedGroup.referenceGroup
|
|
7909
|
+
? this.getPanel(selectedGroup.referenceGroup)
|
|
7910
|
+
: undefined;
|
|
7911
|
+
if (refGroup) {
|
|
7912
|
+
this.removeGroup(refGroup);
|
|
7913
|
+
}
|
|
7914
|
+
}
|
|
7915
|
+
selectedGroup.popoutGroup.dispose();
|
|
7350
7916
|
this._groups.delete(group.id);
|
|
7351
7917
|
this._onDidRemoveGroup.fire(group);
|
|
7352
7918
|
}
|
|
7353
|
-
selectedGroup.dispose();
|
|
7919
|
+
const removedGroup = selectedGroup.disposable.dispose();
|
|
7920
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
|
|
7921
|
+
this.doAddGroup(removedGroup, [0]);
|
|
7922
|
+
this.doSetGroupAndPanelActive(removedGroup);
|
|
7923
|
+
}
|
|
7354
7924
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7355
7925
|
const groups = Array.from(this._groups.values());
|
|
7356
|
-
this.
|
|
7926
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7357
7927
|
}
|
|
7358
|
-
|
|
7928
|
+
this.updateWatermark();
|
|
7929
|
+
return selectedGroup.popoutGroup;
|
|
7359
7930
|
}
|
|
7360
7931
|
throw new Error('failed to find popout group');
|
|
7361
7932
|
}
|
|
7362
|
-
|
|
7933
|
+
const re = super.doRemoveGroup(group, options);
|
|
7934
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
7935
|
+
if (this.activePanel !== activePanel) {
|
|
7936
|
+
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7937
|
+
}
|
|
7938
|
+
}
|
|
7939
|
+
return re;
|
|
7363
7940
|
}
|
|
7364
|
-
|
|
7365
|
-
|
|
7941
|
+
movingLock(func) {
|
|
7942
|
+
const isMoving = this._moving;
|
|
7943
|
+
try {
|
|
7944
|
+
this._moving = true;
|
|
7945
|
+
return func();
|
|
7946
|
+
}
|
|
7947
|
+
finally {
|
|
7948
|
+
this._moving = isMoving;
|
|
7949
|
+
}
|
|
7950
|
+
}
|
|
7951
|
+
moveGroupOrPanel(options) {
|
|
7952
|
+
var _a;
|
|
7953
|
+
const destinationGroup = options.to.group;
|
|
7954
|
+
const sourceGroupId = options.from.groupId;
|
|
7955
|
+
const sourceItemId = options.from.panelId;
|
|
7956
|
+
const destinationTarget = options.to.position;
|
|
7957
|
+
const destinationIndex = options.to.index;
|
|
7366
7958
|
const sourceGroup = sourceGroupId
|
|
7367
7959
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
7368
7960
|
: undefined;
|
|
7961
|
+
if (!sourceGroup) {
|
|
7962
|
+
throw new Error(`Failed to find group id ${sourceGroupId}`);
|
|
7963
|
+
}
|
|
7369
7964
|
if (sourceItemId === undefined) {
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7965
|
+
/**
|
|
7966
|
+
* Moving an entire group into another group
|
|
7967
|
+
*/
|
|
7968
|
+
this.moveGroup({
|
|
7969
|
+
from: { group: sourceGroup },
|
|
7970
|
+
to: {
|
|
7971
|
+
group: destinationGroup,
|
|
7972
|
+
position: destinationTarget,
|
|
7973
|
+
},
|
|
7974
|
+
});
|
|
7373
7975
|
return;
|
|
7374
7976
|
}
|
|
7375
7977
|
if (!destinationTarget || destinationTarget === 'center') {
|
|
7376
|
-
|
|
7377
|
-
|
|
7978
|
+
/**
|
|
7979
|
+
* Dropping a panel within another group
|
|
7980
|
+
*/
|
|
7981
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
7982
|
+
skipSetActive: false,
|
|
7983
|
+
skipSetActiveGroup: true,
|
|
7984
|
+
}));
|
|
7985
|
+
if (!removedPanel) {
|
|
7378
7986
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7379
7987
|
}
|
|
7380
|
-
if (
|
|
7381
|
-
|
|
7988
|
+
if (sourceGroup.model.size === 0) {
|
|
7989
|
+
// remove the group and do not set a new group as active
|
|
7990
|
+
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
7382
7991
|
}
|
|
7383
|
-
destinationGroup.model.openPanel(
|
|
7992
|
+
this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
|
|
7384
7993
|
index: destinationIndex,
|
|
7994
|
+
skipSetGroupActive: true,
|
|
7995
|
+
}));
|
|
7996
|
+
this.doSetGroupAndPanelActive(destinationGroup);
|
|
7997
|
+
this._onDidMovePanel.fire({
|
|
7998
|
+
panel: removedPanel,
|
|
7385
7999
|
});
|
|
7386
8000
|
}
|
|
7387
8001
|
else {
|
|
8002
|
+
/**
|
|
8003
|
+
* Dropping a panel to the extremities of a group which will place that panel
|
|
8004
|
+
* into an adjacent group
|
|
8005
|
+
*/
|
|
7388
8006
|
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
7389
8007
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7390
|
-
if (sourceGroup
|
|
8008
|
+
if (sourceGroup.size < 2) {
|
|
8009
|
+
/**
|
|
8010
|
+
* If we are moving from a group which only has one panel left we will consider
|
|
8011
|
+
* moving the group itself rather than moving the panel into a newly created group
|
|
8012
|
+
*/
|
|
7391
8013
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
7392
|
-
if (sourceGroup.api.location === 'grid') {
|
|
8014
|
+
if (sourceGroup.api.location.type === 'grid') {
|
|
7393
8015
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
7394
8016
|
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
7395
8017
|
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
@@ -7397,78 +8019,123 @@ class DockviewComponent extends BaseGrid {
|
|
|
7397
8019
|
// if a group has one tab - we are essentially moving the 'group'
|
|
7398
8020
|
// which is equivalent to swapping two views in this case
|
|
7399
8021
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8022
|
+
return;
|
|
7400
8023
|
}
|
|
7401
8024
|
}
|
|
7402
8025
|
// source group will become empty so delete the group
|
|
7403
|
-
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
8026
|
+
const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
|
|
7404
8027
|
skipActive: true,
|
|
7405
8028
|
skipDispose: true,
|
|
7406
|
-
});
|
|
8029
|
+
}));
|
|
7407
8030
|
// after deleting the group we need to re-evaulate the ref location
|
|
7408
8031
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
7409
8032
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
7410
|
-
this.doAddGroup(targetGroup, location);
|
|
8033
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8034
|
+
this.doSetGroupAndPanelActive(targetGroup);
|
|
7411
8035
|
}
|
|
7412
8036
|
else {
|
|
7413
|
-
|
|
7414
|
-
|
|
8037
|
+
/**
|
|
8038
|
+
* The group we are removing from has many panels, we need to remove the panels we are moving,
|
|
8039
|
+
* create a new group, add the panels to that new group and add the new group in an appropiate position
|
|
8040
|
+
*/
|
|
8041
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8042
|
+
skipSetActive: false,
|
|
8043
|
+
skipSetActiveGroup: true,
|
|
8044
|
+
}));
|
|
8045
|
+
if (!removedPanel) {
|
|
7415
8046
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7416
8047
|
}
|
|
7417
8048
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7418
8049
|
const group = this.createGroupAtLocation(dropLocation);
|
|
7419
|
-
group.model.openPanel(
|
|
8050
|
+
this.movingLock(() => group.model.openPanel(removedPanel, {
|
|
8051
|
+
skipSetGroupActive: true,
|
|
8052
|
+
}));
|
|
8053
|
+
this.doSetGroupAndPanelActive(group);
|
|
7420
8054
|
}
|
|
7421
8055
|
}
|
|
7422
8056
|
}
|
|
7423
|
-
moveGroup(
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
8057
|
+
moveGroup(options) {
|
|
8058
|
+
const from = options.from.group;
|
|
8059
|
+
const to = options.to.group;
|
|
8060
|
+
const target = options.to.position;
|
|
8061
|
+
if (target === 'center') {
|
|
8062
|
+
const activePanel = from.activePanel;
|
|
8063
|
+
const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
|
|
8064
|
+
skipSetActive: true,
|
|
8065
|
+
})));
|
|
8066
|
+
if ((from === null || from === void 0 ? void 0 : from.model.size) === 0) {
|
|
8067
|
+
this.doRemoveGroup(from, { skipActive: true });
|
|
8068
|
+
}
|
|
8069
|
+
this.movingLock(() => {
|
|
7431
8070
|
for (const panel of panels) {
|
|
7432
|
-
|
|
7433
|
-
|
|
8071
|
+
to.model.openPanel(panel, {
|
|
8072
|
+
skipSetActive: panel !== activePanel,
|
|
8073
|
+
skipSetGroupActive: true,
|
|
7434
8074
|
});
|
|
7435
8075
|
}
|
|
7436
|
-
}
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
8076
|
+
});
|
|
8077
|
+
this.doSetGroupAndPanelActive(to);
|
|
8078
|
+
panels.forEach((panel) => {
|
|
8079
|
+
this._onDidMovePanel.fire({ panel });
|
|
8080
|
+
});
|
|
8081
|
+
}
|
|
8082
|
+
else {
|
|
8083
|
+
switch (from.api.location.type) {
|
|
8084
|
+
case 'grid':
|
|
8085
|
+
this.gridview.removeView(getGridLocation(from.element));
|
|
8086
|
+
break;
|
|
8087
|
+
case 'floating': {
|
|
8088
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
8089
|
+
if (!selectedFloatingGroup) {
|
|
8090
|
+
throw new Error('failed to find floating group');
|
|
7449
8091
|
}
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
8092
|
+
selectedFloatingGroup.dispose();
|
|
8093
|
+
break;
|
|
8094
|
+
}
|
|
8095
|
+
case 'popout': {
|
|
8096
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
8097
|
+
if (!selectedPopoutGroup) {
|
|
8098
|
+
throw new Error('failed to find popout group');
|
|
7456
8099
|
}
|
|
8100
|
+
selectedPopoutGroup.disposable.dispose();
|
|
7457
8101
|
}
|
|
7458
|
-
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
7459
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
7460
|
-
this.gridview.addView(sourceGroup, Sizing.Distribute, dropLocation);
|
|
7461
8102
|
}
|
|
8103
|
+
const referenceLocation = getGridLocation(to.element);
|
|
8104
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8105
|
+
this.gridview.addView(from, Sizing.Distribute, dropLocation);
|
|
8106
|
+
from.panels.forEach((panel) => {
|
|
8107
|
+
this._onDidMovePanel.fire({ panel });
|
|
8108
|
+
});
|
|
7462
8109
|
}
|
|
7463
8110
|
}
|
|
7464
|
-
|
|
7465
|
-
|
|
8111
|
+
doSetGroupActive(group) {
|
|
8112
|
+
super.doSetGroupActive(group);
|
|
8113
|
+
const activePanel = this.activePanel;
|
|
8114
|
+
if (!this._moving &&
|
|
8115
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8116
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8117
|
+
}
|
|
8118
|
+
}
|
|
8119
|
+
doSetGroupAndPanelActive(group) {
|
|
8120
|
+
super.doSetGroupActive(group);
|
|
7466
8121
|
const activePanel = this.activePanel;
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
this.
|
|
8122
|
+
if (group &&
|
|
8123
|
+
this.hasMaximizedGroup() &&
|
|
8124
|
+
!this.isMaximizedGroup(group)) {
|
|
8125
|
+
this.exitMaximizedGroup();
|
|
8126
|
+
}
|
|
8127
|
+
if (!this._moving &&
|
|
8128
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8129
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
7470
8130
|
}
|
|
7471
8131
|
}
|
|
8132
|
+
getNextGroupId() {
|
|
8133
|
+
let id = this.nextGroupId.next();
|
|
8134
|
+
while (this._groups.has(id)) {
|
|
8135
|
+
id = this.nextGroupId.next();
|
|
8136
|
+
}
|
|
8137
|
+
return id;
|
|
8138
|
+
}
|
|
7472
8139
|
createGroup(options) {
|
|
7473
8140
|
if (!options) {
|
|
7474
8141
|
options = {};
|
|
@@ -7485,7 +8152,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
7485
8152
|
}
|
|
7486
8153
|
}
|
|
7487
8154
|
const view = new DockviewGroupPanel(this, id, options);
|
|
7488
|
-
view.init({ params: {}, accessor:
|
|
8155
|
+
view.init({ params: {}, accessor: this });
|
|
7489
8156
|
if (!this._groups.has(view.id)) {
|
|
7490
8157
|
const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {
|
|
7491
8158
|
this._onWillDragPanel.fire(event);
|
|
@@ -7493,20 +8160,48 @@ class DockviewComponent extends BaseGrid {
|
|
|
7493
8160
|
this._onWillDragGroup.fire(event);
|
|
7494
8161
|
}), view.model.onMove((event) => {
|
|
7495
8162
|
const { groupId, itemId, target, index } = event;
|
|
7496
|
-
this.moveGroupOrPanel(
|
|
8163
|
+
this.moveGroupOrPanel({
|
|
8164
|
+
from: { groupId: groupId, panelId: itemId },
|
|
8165
|
+
to: {
|
|
8166
|
+
group: view,
|
|
8167
|
+
position: target,
|
|
8168
|
+
index,
|
|
8169
|
+
},
|
|
8170
|
+
});
|
|
7497
8171
|
}), view.model.onDidDrop((event) => {
|
|
7498
|
-
this._onDidDrop.fire(
|
|
8172
|
+
this._onDidDrop.fire(event);
|
|
8173
|
+
}), view.model.onWillDrop((event) => {
|
|
8174
|
+
this._onWillDrop.fire(event);
|
|
8175
|
+
}), view.model.onWillShowOverlay((event) => {
|
|
8176
|
+
if (this.options.disableDnd) {
|
|
8177
|
+
event.preventDefault();
|
|
8178
|
+
return;
|
|
8179
|
+
}
|
|
8180
|
+
this._onWillShowOverlay.fire(event);
|
|
7499
8181
|
}), view.model.onDidAddPanel((event) => {
|
|
8182
|
+
if (this._moving) {
|
|
8183
|
+
return;
|
|
8184
|
+
}
|
|
7500
8185
|
this._onDidAddPanel.fire(event.panel);
|
|
7501
8186
|
}), view.model.onDidRemovePanel((event) => {
|
|
8187
|
+
if (this._moving) {
|
|
8188
|
+
return;
|
|
8189
|
+
}
|
|
7502
8190
|
this._onDidRemovePanel.fire(event.panel);
|
|
7503
8191
|
}), view.model.onDidActivePanelChange((event) => {
|
|
7504
|
-
this.
|
|
8192
|
+
if (this._moving) {
|
|
8193
|
+
return;
|
|
8194
|
+
}
|
|
8195
|
+
if (event.panel !== this.activePanel) {
|
|
8196
|
+
return;
|
|
8197
|
+
}
|
|
8198
|
+
if (this._onDidActivePanelChange.value !== event.panel) {
|
|
8199
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
8200
|
+
}
|
|
7505
8201
|
}));
|
|
7506
8202
|
this._groups.set(view.id, { value: view, disposable });
|
|
7507
8203
|
}
|
|
7508
|
-
// TODO: must be called after the above listeners have been setup,
|
|
7509
|
-
// not an ideal pattern
|
|
8204
|
+
// TODO: must be called after the above listeners have been setup, not an ideal pattern
|
|
7510
8205
|
view.initialize();
|
|
7511
8206
|
return view;
|
|
7512
8207
|
}
|
|
@@ -7559,7 +8254,20 @@ class GridviewComponent extends BaseGrid {
|
|
|
7559
8254
|
});
|
|
7560
8255
|
this._onDidLayoutfromJSON = new Emitter();
|
|
7561
8256
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
8257
|
+
this._onDidRemoveGroup = new Emitter();
|
|
8258
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
8259
|
+
this._onDidAddGroup = new Emitter();
|
|
8260
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
8261
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
8262
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
7562
8263
|
this._options = options;
|
|
8264
|
+
this.addDisposables(this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
|
|
8265
|
+
this._onDidAddGroup.fire(event);
|
|
8266
|
+
}), this.onDidRemove((event) => {
|
|
8267
|
+
this._onDidRemoveGroup.fire(event);
|
|
8268
|
+
}), this.onDidActiveChange((event) => {
|
|
8269
|
+
this._onDidActiveGroupChange.fire(event);
|
|
8270
|
+
}));
|
|
7563
8271
|
if (!this.options.components) {
|
|
7564
8272
|
this.options.components = {};
|
|
7565
8273
|
}
|
|
@@ -7734,6 +8442,7 @@ class GridviewComponent extends BaseGrid {
|
|
|
7734
8442
|
});
|
|
7735
8443
|
this.registerPanel(view);
|
|
7736
8444
|
this.doAddGroup(view, relativeLocation, options.size);
|
|
8445
|
+
this.doSetGroupActive(view);
|
|
7737
8446
|
return view;
|
|
7738
8447
|
}
|
|
7739
8448
|
registerPanel(panel) {
|
|
@@ -8419,10 +9128,10 @@ class SplitviewPanel extends BasePanelView {
|
|
|
8419
9128
|
this._onDidChange = new Emitter();
|
|
8420
9129
|
this.onDidChange = this._onDidChange.event;
|
|
8421
9130
|
this.api.initialize(this);
|
|
8422
|
-
this.addDisposables(this._onDidChange, this.api.
|
|
8423
|
-
const {
|
|
9131
|
+
this.addDisposables(this._onDidChange, this.api.onDidHiddenChange((event) => {
|
|
9132
|
+
const { isHidden } = event;
|
|
8424
9133
|
const { accessor } = this._params;
|
|
8425
|
-
accessor.setVisible(this,
|
|
9134
|
+
accessor.setVisible(this, !isHidden);
|
|
8426
9135
|
}), this.api.onActiveChange(() => {
|
|
8427
9136
|
const { accessor } = this._params;
|
|
8428
9137
|
accessor.setActive(this);
|
|
@@ -8544,13 +9253,13 @@ class ReactPart {
|
|
|
8544
9253
|
if (this.disposed) {
|
|
8545
9254
|
throw new Error('invalid operation: resource is already disposed');
|
|
8546
9255
|
}
|
|
8547
|
-
if (
|
|
9256
|
+
if (!isReactComponent(this.component)) {
|
|
8548
9257
|
/**
|
|
8549
9258
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
8550
|
-
* if we do not intercept
|
|
8551
|
-
* for the same reason
|
|
9259
|
+
* if we do not intercept then React library will throw a very obsure error
|
|
9260
|
+
* for the same reason... at least at this point we will emit a sensible stacktrace.
|
|
8552
9261
|
*/
|
|
8553
|
-
throw new Error('
|
|
9262
|
+
throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');
|
|
8554
9263
|
}
|
|
8555
9264
|
const bridgeComponent = React.createElement(React.forwardRef(ReactComponentBridge), {
|
|
8556
9265
|
component: this
|
|
@@ -8602,9 +9311,13 @@ const usePortalsLifecycle = () => {
|
|
|
8602
9311
|
}, []);
|
|
8603
9312
|
return [portals, addPortal];
|
|
8604
9313
|
};
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
9314
|
+
function isReactComponent(component) {
|
|
9315
|
+
/**
|
|
9316
|
+
* Yes, we could use "react-is" but that would introduce an unwanted peer dependency
|
|
9317
|
+
* so for now we will check in a rather crude fashion...
|
|
9318
|
+
*/
|
|
9319
|
+
return (typeof component === 'function' /** Functional Componnts */ ||
|
|
9320
|
+
!!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
|
|
8608
9321
|
}
|
|
8609
9322
|
|
|
8610
9323
|
class ReactPanelContentPart {
|
|
@@ -8864,6 +9577,8 @@ const DockviewReact = React.forwardRef((props, ref) => {
|
|
|
8864
9577
|
defaultRenderer: props.defaultRenderer,
|
|
8865
9578
|
debug: props.debug,
|
|
8866
9579
|
rootOverlayModel: props.rootOverlayModel,
|
|
9580
|
+
locked: props.locked,
|
|
9581
|
+
disableDnd: props.disableDnd,
|
|
8867
9582
|
});
|
|
8868
9583
|
const { clientWidth, clientHeight } = domRef.current;
|
|
8869
9584
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -8875,6 +9590,20 @@ const DockviewReact = React.forwardRef((props, ref) => {
|
|
|
8875
9590
|
dockview.dispose();
|
|
8876
9591
|
};
|
|
8877
9592
|
}, []);
|
|
9593
|
+
React.useEffect(() => {
|
|
9594
|
+
if (!dockviewRef.current) {
|
|
9595
|
+
return;
|
|
9596
|
+
}
|
|
9597
|
+
dockviewRef.current.locked = !!props.locked;
|
|
9598
|
+
}, [props.locked]);
|
|
9599
|
+
React.useEffect(() => {
|
|
9600
|
+
if (!dockviewRef.current) {
|
|
9601
|
+
return;
|
|
9602
|
+
}
|
|
9603
|
+
dockviewRef.current.updateOptions({
|
|
9604
|
+
disableDnd: props.disableDnd,
|
|
9605
|
+
});
|
|
9606
|
+
}, [props.disableDnd]);
|
|
8878
9607
|
React.useEffect(() => {
|
|
8879
9608
|
if (!dockviewRef.current) {
|
|
8880
9609
|
return () => {
|
|
@@ -8890,6 +9619,21 @@ const DockviewReact = React.forwardRef((props, ref) => {
|
|
|
8890
9619
|
disposable.dispose();
|
|
8891
9620
|
};
|
|
8892
9621
|
}, [props.onDidDrop]);
|
|
9622
|
+
React.useEffect(() => {
|
|
9623
|
+
if (!dockviewRef.current) {
|
|
9624
|
+
return () => {
|
|
9625
|
+
// noop
|
|
9626
|
+
};
|
|
9627
|
+
}
|
|
9628
|
+
const disposable = dockviewRef.current.onWillDrop((event) => {
|
|
9629
|
+
if (props.onWillDrop) {
|
|
9630
|
+
props.onWillDrop(event);
|
|
9631
|
+
}
|
|
9632
|
+
});
|
|
9633
|
+
return () => {
|
|
9634
|
+
disposable.dispose();
|
|
9635
|
+
};
|
|
9636
|
+
}, [props.onWillDrop]);
|
|
8893
9637
|
React.useEffect(() => {
|
|
8894
9638
|
if (!dockviewRef.current) {
|
|
8895
9639
|
return;
|
|
@@ -9132,7 +9876,9 @@ class ReactGridPanelView extends GridviewPanel {
|
|
|
9132
9876
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
9133
9877
|
params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
|
|
9134
9878
|
api: this.api,
|
|
9135
|
-
|
|
9879
|
+
// TODO: fix casting hack
|
|
9880
|
+
containerApi: new GridviewApi(this._params
|
|
9881
|
+
.accessor),
|
|
9136
9882
|
});
|
|
9137
9883
|
}
|
|
9138
9884
|
}
|
|
@@ -9307,5 +10053,5 @@ const PaneviewReact = React.forwardRef((props, ref) => {
|
|
|
9307
10053
|
});
|
|
9308
10054
|
PaneviewReact.displayName = 'PaneviewComponent';
|
|
9309
10055
|
|
|
9310
|
-
export { BaseGrid, ContentContainer, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDefaultTab,
|
|
10056
|
+
export { BaseGrid, ContentContainer, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDefaultTab, DockviewDidDropEvent, Emitter as DockviewEmitter, Event as DockviewEvent, DockviewGroupPanel, DockviewGroupPanelModel, MutableDisposable as DockviewMutableDisposable, DockviewPanel, DockviewReact, DockviewWillDropEvent, DraggablePaneviewPanel, Gridview, GridviewApi, GridviewComponent, GridviewPanel, GridviewReact, LayoutPriority, LocalSelectionTransfer, Orientation, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewReact, ReactPart, ReactPartContext, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, SplitviewReact, Tab, WillShowOverlayLocationEvent, createComponent, directionToPosition, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRelativeLocation, indexInParent, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, isReactComponent, orthogonal, positionToDirection, toTarget, usePortalsLifecycle };
|
|
9311
10057
|
//# sourceMappingURL=dockview.esm.js.map
|