dockview 1.9.2 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dockview/defaultTab.d.ts +0 -1
- package/dist/cjs/dockview/defaultTab.js +0 -1
- package/dist/cjs/dockview/dockview.d.ts +5 -3
- package/dist/cjs/dockview/dockview.js +31 -1
- package/dist/cjs/dockview/headerActionsRenderer.d.ts +0 -1
- package/dist/cjs/dockview/headerActionsRenderer.js +0 -1
- package/dist/cjs/dockview/reactContentPart.d.ts +0 -1
- package/dist/cjs/dockview/reactContentPart.js +0 -1
- package/dist/cjs/dockview/reactHeaderPart.d.ts +0 -1
- package/dist/cjs/dockview/reactHeaderPart.js +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.d.ts +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.js +0 -1
- package/dist/cjs/gridview/gridview.d.ts +0 -1
- package/dist/cjs/gridview/gridview.js +0 -1
- package/dist/cjs/gridview/view.d.ts +0 -1
- package/dist/cjs/gridview/view.js +3 -2
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/paneview/paneview.d.ts +0 -1
- package/dist/cjs/paneview/paneview.js +0 -1
- package/dist/cjs/paneview/view.d.ts +0 -1
- package/dist/cjs/paneview/view.js +0 -1
- package/dist/cjs/react.d.ts +1 -2
- package/dist/cjs/react.js +13 -10
- package/dist/cjs/splitview/splitview.d.ts +0 -1
- package/dist/cjs/splitview/splitview.js +0 -1
- package/dist/cjs/splitview/view.d.ts +0 -1
- package/dist/cjs/splitview/view.js +0 -1
- package/dist/cjs/svg.d.ts +0 -1
- package/dist/cjs/svg.js +0 -1
- package/dist/cjs/types.d.ts +0 -1
- package/dist/cjs/types.js +0 -1
- package/dist/dockview.amd.js +1325 -544
- package/dist/dockview.amd.js.map +1 -1
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.js.map +1 -1
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.min.noStyle.js.map +1 -1
- package/dist/dockview.amd.noStyle.js +1325 -544
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +1325 -544
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +1322 -544
- package/dist/dockview.esm.js.map +1 -1
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.esm.min.js.map +1 -1
- package/dist/dockview.js +1325 -544
- package/dist/dockview.js.map +1 -1
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.min.noStyle.js.map +1 -1
- package/dist/dockview.noStyle.js +1325 -544
- package/dist/dockview.noStyle.js.map +1 -1
- package/dist/esm/dockview/defaultTab.d.ts +0 -1
- package/dist/esm/dockview/defaultTab.js +0 -1
- package/dist/esm/dockview/dockview.d.ts +5 -3
- package/dist/esm/dockview/dockview.js +31 -1
- package/dist/esm/dockview/headerActionsRenderer.d.ts +0 -1
- package/dist/esm/dockview/headerActionsRenderer.js +0 -1
- package/dist/esm/dockview/reactContentPart.d.ts +0 -1
- package/dist/esm/dockview/reactContentPart.js +0 -1
- package/dist/esm/dockview/reactHeaderPart.d.ts +0 -1
- package/dist/esm/dockview/reactHeaderPart.js +0 -1
- package/dist/esm/dockview/reactWatermarkPart.d.ts +0 -1
- package/dist/esm/dockview/reactWatermarkPart.js +0 -1
- package/dist/esm/gridview/gridview.d.ts +0 -1
- package/dist/esm/gridview/gridview.js +0 -1
- package/dist/esm/gridview/view.d.ts +0 -1
- package/dist/esm/gridview/view.js +3 -2
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/paneview/paneview.d.ts +0 -1
- package/dist/esm/paneview/paneview.js +0 -1
- package/dist/esm/paneview/view.d.ts +0 -1
- package/dist/esm/paneview/view.js +0 -1
- package/dist/esm/react.d.ts +1 -2
- package/dist/esm/react.js +11 -8
- package/dist/esm/splitview/splitview.d.ts +0 -1
- package/dist/esm/splitview/splitview.js +0 -1
- package/dist/esm/splitview/view.d.ts +0 -1
- package/dist/esm/splitview/view.js +0 -1
- package/dist/esm/svg.d.ts +0 -1
- package/dist/esm/svg.js +0 -1
- package/dist/esm/types.d.ts +0 -1
- package/dist/esm/types.js +0 -1
- package/package.json +4 -4
- package/dist/cjs/dockview/defaultTab.d.ts.map +0 -1
- package/dist/cjs/dockview/defaultTab.js.map +0 -1
- package/dist/cjs/dockview/dockview.d.ts.map +0 -1
- package/dist/cjs/dockview/dockview.js.map +0 -1
- package/dist/cjs/dockview/headerActionsRenderer.d.ts.map +0 -1
- package/dist/cjs/dockview/headerActionsRenderer.js.map +0 -1
- package/dist/cjs/dockview/reactContentPart.d.ts.map +0 -1
- package/dist/cjs/dockview/reactContentPart.js.map +0 -1
- package/dist/cjs/dockview/reactHeaderPart.d.ts.map +0 -1
- package/dist/cjs/dockview/reactHeaderPart.js.map +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.d.ts.map +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.js.map +0 -1
- package/dist/cjs/gridview/gridview.d.ts.map +0 -1
- package/dist/cjs/gridview/gridview.js.map +0 -1
- package/dist/cjs/gridview/view.d.ts.map +0 -1
- package/dist/cjs/gridview/view.js.map +0 -1
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/paneview/paneview.d.ts.map +0 -1
- package/dist/cjs/paneview/paneview.js.map +0 -1
- package/dist/cjs/paneview/view.d.ts.map +0 -1
- package/dist/cjs/paneview/view.js.map +0 -1
- package/dist/cjs/react.d.ts.map +0 -1
- package/dist/cjs/react.js.map +0 -1
- package/dist/cjs/splitview/splitview.d.ts.map +0 -1
- package/dist/cjs/splitview/splitview.js.map +0 -1
- package/dist/cjs/splitview/view.d.ts.map +0 -1
- package/dist/cjs/splitview/view.js.map +0 -1
- package/dist/cjs/svg.d.ts.map +0 -1
- package/dist/cjs/svg.js.map +0 -1
- package/dist/cjs/types.d.ts.map +0 -1
- package/dist/cjs/types.js.map +0 -1
- package/dist/esm/dockview/defaultTab.d.ts.map +0 -1
- package/dist/esm/dockview/defaultTab.js.map +0 -1
- package/dist/esm/dockview/dockview.d.ts.map +0 -1
- package/dist/esm/dockview/dockview.js.map +0 -1
- package/dist/esm/dockview/headerActionsRenderer.d.ts.map +0 -1
- package/dist/esm/dockview/headerActionsRenderer.js.map +0 -1
- package/dist/esm/dockview/reactContentPart.d.ts.map +0 -1
- package/dist/esm/dockview/reactContentPart.js.map +0 -1
- package/dist/esm/dockview/reactHeaderPart.d.ts.map +0 -1
- package/dist/esm/dockview/reactHeaderPart.js.map +0 -1
- package/dist/esm/dockview/reactWatermarkPart.d.ts.map +0 -1
- package/dist/esm/dockview/reactWatermarkPart.js.map +0 -1
- package/dist/esm/gridview/gridview.d.ts.map +0 -1
- package/dist/esm/gridview/gridview.js.map +0 -1
- package/dist/esm/gridview/view.d.ts.map +0 -1
- package/dist/esm/gridview/view.js.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/paneview/paneview.d.ts.map +0 -1
- package/dist/esm/paneview/paneview.js.map +0 -1
- package/dist/esm/paneview/view.d.ts.map +0 -1
- package/dist/esm/paneview/view.js.map +0 -1
- package/dist/esm/react.d.ts.map +0 -1
- package/dist/esm/react.js.map +0 -1
- package/dist/esm/splitview/splitview.d.ts.map +0 -1
- package/dist/esm/splitview/splitview.js.map +0 -1
- package/dist/esm/splitview/view.d.ts.map +0 -1
- package/dist/esm/splitview/view.js.map +0 -1
- package/dist/esm/svg.d.ts.map +0 -1
- package/dist/esm/svg.js.map +0 -1
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js.map +0 -1
package/dist/dockview.noStyle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.10.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -112,6 +112,17 @@
|
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
115
|
+
class DockviewEvent {
|
|
116
|
+
constructor() {
|
|
117
|
+
this._defaultPrevented = false;
|
|
118
|
+
}
|
|
119
|
+
get defaultPrevented() {
|
|
120
|
+
return this._defaultPrevented;
|
|
121
|
+
}
|
|
122
|
+
preventDefault() {
|
|
123
|
+
this._defaultPrevented = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
115
126
|
class LeakageMonitor {
|
|
116
127
|
constructor() {
|
|
117
128
|
this.events = new Map();
|
|
@@ -155,6 +166,9 @@
|
|
|
155
166
|
}
|
|
156
167
|
Emitter.ENABLE_TRACKING = isEnabled;
|
|
157
168
|
}
|
|
169
|
+
get value() {
|
|
170
|
+
return this._last;
|
|
171
|
+
}
|
|
158
172
|
constructor(options) {
|
|
159
173
|
this.options = options;
|
|
160
174
|
this._listeners = [];
|
|
@@ -277,8 +291,12 @@
|
|
|
277
291
|
args.forEach((arg) => this._disposables.push(arg));
|
|
278
292
|
}
|
|
279
293
|
dispose() {
|
|
280
|
-
this.
|
|
294
|
+
if (this._isDisposed) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
281
297
|
this._isDisposed = true;
|
|
298
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
299
|
+
this._disposables = [];
|
|
282
300
|
}
|
|
283
301
|
}
|
|
284
302
|
class MutableDisposable {
|
|
@@ -762,6 +780,13 @@
|
|
|
762
780
|
this._endSnappingEnabled = endSnappingEnabled;
|
|
763
781
|
this.updateSashEnablement();
|
|
764
782
|
}
|
|
783
|
+
get disabled() {
|
|
784
|
+
return this._disabled;
|
|
785
|
+
}
|
|
786
|
+
set disabled(value) {
|
|
787
|
+
this._disabled = value;
|
|
788
|
+
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
789
|
+
}
|
|
765
790
|
constructor(container, options) {
|
|
766
791
|
this.container = container;
|
|
767
792
|
this.viewItems = [];
|
|
@@ -772,6 +797,7 @@
|
|
|
772
797
|
this._proportions = undefined;
|
|
773
798
|
this._startSnappingEnabled = true;
|
|
774
799
|
this._endSnappingEnabled = true;
|
|
800
|
+
this._disabled = false;
|
|
775
801
|
this._onDidSashEnd = new Emitter();
|
|
776
802
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
777
803
|
this._onDidAddView = new Emitter();
|
|
@@ -1446,6 +1472,9 @@
|
|
|
1446
1472
|
this._onDidChange.fire();
|
|
1447
1473
|
}));
|
|
1448
1474
|
}
|
|
1475
|
+
setViewVisible(index, visible) {
|
|
1476
|
+
this.splitview.setViewVisible(index, visible);
|
|
1477
|
+
}
|
|
1449
1478
|
addPane(pane, size, index = this.splitview.length, skipLayout = false) {
|
|
1450
1479
|
const disposable = pane.onDidChangeExpansionState(() => {
|
|
1451
1480
|
this.setupAnimation();
|
|
@@ -1699,7 +1728,13 @@
|
|
|
1699
1728
|
}
|
|
1700
1729
|
return exports.LayoutPriority.Normal;
|
|
1701
1730
|
}
|
|
1702
|
-
|
|
1731
|
+
get disabled() {
|
|
1732
|
+
return this.splitview.disabled;
|
|
1733
|
+
}
|
|
1734
|
+
set disabled(value) {
|
|
1735
|
+
this.splitview.disabled = value;
|
|
1736
|
+
}
|
|
1737
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, childDescriptors) {
|
|
1703
1738
|
super();
|
|
1704
1739
|
this.orientation = orientation;
|
|
1705
1740
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1744,6 +1779,7 @@
|
|
|
1744
1779
|
styles,
|
|
1745
1780
|
});
|
|
1746
1781
|
}
|
|
1782
|
+
this.disabled = disabled;
|
|
1747
1783
|
this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
|
|
1748
1784
|
this._onDidChange.fire({});
|
|
1749
1785
|
}));
|
|
@@ -1877,7 +1913,7 @@
|
|
|
1877
1913
|
}
|
|
1878
1914
|
function flipNode(node, size, orthogonalSize) {
|
|
1879
1915
|
if (node instanceof BranchNode) {
|
|
1880
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
1916
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1881
1917
|
let totalSize = 0;
|
|
1882
1918
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1883
1919
|
const child = node.children[i];
|
|
@@ -2013,31 +2049,57 @@
|
|
|
2013
2049
|
get maximumHeight() {
|
|
2014
2050
|
return this.root.maximumHeight;
|
|
2015
2051
|
}
|
|
2052
|
+
get locked() {
|
|
2053
|
+
return this._locked;
|
|
2054
|
+
}
|
|
2055
|
+
set locked(value) {
|
|
2056
|
+
this._locked = value;
|
|
2057
|
+
const branch = [this.root];
|
|
2058
|
+
/**
|
|
2059
|
+
* simple depth-first-search to cover all nodes
|
|
2060
|
+
*
|
|
2061
|
+
* @see https://en.wikipedia.org/wiki/Depth-first_search
|
|
2062
|
+
*/
|
|
2063
|
+
while (branch.length > 0) {
|
|
2064
|
+
const node = branch.pop();
|
|
2065
|
+
if (node instanceof BranchNode) {
|
|
2066
|
+
node.disabled = value;
|
|
2067
|
+
branch.push(...node.children);
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2016
2071
|
maximizedView() {
|
|
2017
2072
|
var _a;
|
|
2018
|
-
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.view;
|
|
2073
|
+
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
2019
2074
|
}
|
|
2020
2075
|
hasMaximizedView() {
|
|
2021
2076
|
return this._maximizedNode !== undefined;
|
|
2022
2077
|
}
|
|
2023
2078
|
maximizeView(view) {
|
|
2079
|
+
var _a;
|
|
2024
2080
|
const location = getGridLocation(view.element);
|
|
2025
2081
|
const [_, node] = this.getNode(location);
|
|
2026
2082
|
if (!(node instanceof LeafNode)) {
|
|
2027
2083
|
return;
|
|
2028
2084
|
}
|
|
2029
|
-
if (this._maximizedNode === node) {
|
|
2085
|
+
if (((_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf) === node) {
|
|
2030
2086
|
return;
|
|
2031
2087
|
}
|
|
2032
2088
|
if (this.hasMaximizedView()) {
|
|
2033
2089
|
this.exitMaximizedView();
|
|
2034
2090
|
}
|
|
2091
|
+
const hiddenOnMaximize = [];
|
|
2035
2092
|
function hideAllViewsBut(parent, exclude) {
|
|
2036
2093
|
for (let i = 0; i < parent.children.length; i++) {
|
|
2037
2094
|
const child = parent.children[i];
|
|
2038
2095
|
if (child instanceof LeafNode) {
|
|
2039
2096
|
if (child !== exclude) {
|
|
2040
|
-
parent.
|
|
2097
|
+
if (parent.isChildVisible(i)) {
|
|
2098
|
+
parent.setChildVisible(i, false);
|
|
2099
|
+
}
|
|
2100
|
+
else {
|
|
2101
|
+
hiddenOnMaximize.push(child);
|
|
2102
|
+
}
|
|
2041
2103
|
}
|
|
2042
2104
|
}
|
|
2043
2105
|
else {
|
|
@@ -2046,18 +2108,21 @@
|
|
|
2046
2108
|
}
|
|
2047
2109
|
}
|
|
2048
2110
|
hideAllViewsBut(this.root, node);
|
|
2049
|
-
this._maximizedNode = node;
|
|
2050
|
-
this.
|
|
2111
|
+
this._maximizedNode = { leaf: node, hiddenOnMaximize };
|
|
2112
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2051
2113
|
}
|
|
2052
2114
|
exitMaximizedView() {
|
|
2053
2115
|
if (!this._maximizedNode) {
|
|
2054
2116
|
return;
|
|
2055
2117
|
}
|
|
2118
|
+
const hiddenOnMaximize = this._maximizedNode.hiddenOnMaximize;
|
|
2056
2119
|
function showViewsInReverseOrder(parent) {
|
|
2057
2120
|
for (let index = parent.children.length - 1; index >= 0; index--) {
|
|
2058
2121
|
const child = parent.children[index];
|
|
2059
2122
|
if (child instanceof LeafNode) {
|
|
2060
|
-
|
|
2123
|
+
if (!hiddenOnMaximize.includes(child)) {
|
|
2124
|
+
parent.setChildVisible(index, true);
|
|
2125
|
+
}
|
|
2061
2126
|
}
|
|
2062
2127
|
else {
|
|
2063
2128
|
showViewsInReverseOrder(child);
|
|
@@ -2066,13 +2131,13 @@
|
|
|
2066
2131
|
}
|
|
2067
2132
|
showViewsInReverseOrder(this.root);
|
|
2068
2133
|
this._maximizedNode = undefined;
|
|
2069
|
-
this.
|
|
2134
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2070
2135
|
}
|
|
2071
2136
|
serialize() {
|
|
2072
2137
|
if (this.hasMaximizedView()) {
|
|
2073
2138
|
/**
|
|
2074
|
-
* do not persist maximized view state
|
|
2075
|
-
*
|
|
2139
|
+
* do not persist maximized view state
|
|
2140
|
+
* firstly exit any maximized views to ensure the correct dimensions are persisted
|
|
2076
2141
|
*/
|
|
2077
2142
|
this.exitMaximizedView();
|
|
2078
2143
|
}
|
|
@@ -2087,14 +2152,14 @@
|
|
|
2087
2152
|
dispose() {
|
|
2088
2153
|
this.disposable.dispose();
|
|
2089
2154
|
this._onDidChange.dispose();
|
|
2090
|
-
this.
|
|
2155
|
+
this._onDidMaximizedNodeChange.dispose();
|
|
2091
2156
|
this.root.dispose();
|
|
2092
2157
|
this._maximizedNode = undefined;
|
|
2093
2158
|
this.element.remove();
|
|
2094
2159
|
}
|
|
2095
2160
|
clear() {
|
|
2096
2161
|
const orientation = this.root.orientation;
|
|
2097
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize);
|
|
2162
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this._locked);
|
|
2098
2163
|
}
|
|
2099
2164
|
deserialize(json, deserializer) {
|
|
2100
2165
|
const orientation = json.orientation;
|
|
@@ -2115,8 +2180,8 @@
|
|
|
2115
2180
|
};
|
|
2116
2181
|
});
|
|
2117
2182
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2118
|
-
orthogonalSize, // <- size - flips at each depth
|
|
2119
|
-
children);
|
|
2183
|
+
orthogonalSize, // <- size - flips at each depth,
|
|
2184
|
+
this._locked, children);
|
|
2120
2185
|
}
|
|
2121
2186
|
else {
|
|
2122
2187
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2149,7 +2214,7 @@
|
|
|
2149
2214
|
}
|
|
2150
2215
|
const oldRoot = this.root;
|
|
2151
2216
|
oldRoot.element.remove();
|
|
2152
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
|
|
2217
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this._locked);
|
|
2153
2218
|
if (oldRoot.children.length === 0) ;
|
|
2154
2219
|
else if (oldRoot.children.length === 1) {
|
|
2155
2220
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2217,15 +2282,16 @@
|
|
|
2217
2282
|
constructor(proportionalLayout, styles, orientation) {
|
|
2218
2283
|
this.proportionalLayout = proportionalLayout;
|
|
2219
2284
|
this.styles = styles;
|
|
2285
|
+
this._locked = false;
|
|
2220
2286
|
this._maximizedNode = undefined;
|
|
2221
2287
|
this.disposable = new MutableDisposable();
|
|
2222
2288
|
this._onDidChange = new Emitter();
|
|
2223
2289
|
this.onDidChange = this._onDidChange.event;
|
|
2224
|
-
this.
|
|
2225
|
-
this.
|
|
2290
|
+
this._onDidMaximizedNodeChange = new Emitter();
|
|
2291
|
+
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2226
2292
|
this.element = document.createElement('div');
|
|
2227
2293
|
this.element.className = 'grid-view';
|
|
2228
|
-
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
2294
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this._locked);
|
|
2229
2295
|
}
|
|
2230
2296
|
isViewVisible(location) {
|
|
2231
2297
|
const [rest, index] = tail(location);
|
|
@@ -2276,7 +2342,7 @@
|
|
|
2276
2342
|
}
|
|
2277
2343
|
const child = grandParent.removeChild(parentIndex);
|
|
2278
2344
|
child.dispose();
|
|
2279
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2345
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this._locked);
|
|
2280
2346
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2281
2347
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2282
2348
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2904,13 +2970,36 @@
|
|
|
2904
2970
|
return this.component.onDidDrop;
|
|
2905
2971
|
}
|
|
2906
2972
|
/**
|
|
2907
|
-
* Invoked
|
|
2973
|
+
* Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and
|
|
2974
|
+
* prevent the event from occuring using the standard `preventDefault()` syntax.
|
|
2975
|
+
*
|
|
2976
|
+
* Preventing certain events may causes unexpected behaviours, use carefully.
|
|
2977
|
+
*/
|
|
2978
|
+
get onWillDrop() {
|
|
2979
|
+
return this.component.onWillDrop;
|
|
2980
|
+
}
|
|
2981
|
+
/**
|
|
2982
|
+
* Invoked before an overlay is shown indicating a drop target.
|
|
2983
|
+
*
|
|
2984
|
+
* Calling `event.preventDefault()` will prevent the overlay being shown and prevent
|
|
2985
|
+
* the any subsequent drop event.
|
|
2986
|
+
*/
|
|
2987
|
+
get onWillShowOverlay() {
|
|
2988
|
+
return this.component.onWillShowOverlay;
|
|
2989
|
+
}
|
|
2990
|
+
/**
|
|
2991
|
+
* Invoked before a group is dragged.
|
|
2992
|
+
*
|
|
2993
|
+
* Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting.
|
|
2994
|
+
*
|
|
2908
2995
|
*/
|
|
2909
2996
|
get onWillDragGroup() {
|
|
2910
2997
|
return this.component.onWillDragGroup;
|
|
2911
2998
|
}
|
|
2912
2999
|
/**
|
|
2913
|
-
* Invoked before a panel is dragged.
|
|
3000
|
+
* Invoked before a panel is dragged.
|
|
3001
|
+
*
|
|
3002
|
+
* Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
|
|
2914
3003
|
*/
|
|
2915
3004
|
get onWillDragPanel() {
|
|
2916
3005
|
return this.component.onWillDragPanel;
|
|
@@ -3038,17 +3127,17 @@
|
|
|
3038
3127
|
hasMaximizedGroup() {
|
|
3039
3128
|
return this.component.hasMaximizedGroup();
|
|
3040
3129
|
}
|
|
3041
|
-
|
|
3130
|
+
exitMaximizedGroup() {
|
|
3042
3131
|
this.component.exitMaximizedGroup();
|
|
3043
3132
|
}
|
|
3044
|
-
get
|
|
3045
|
-
return this.component.
|
|
3133
|
+
get onDidMaximizedGroupChange() {
|
|
3134
|
+
return this.component.onDidMaximizedGroupChange;
|
|
3046
3135
|
}
|
|
3047
3136
|
/**
|
|
3048
3137
|
* Add a popout group in a new Window
|
|
3049
3138
|
*/
|
|
3050
3139
|
addPopoutGroup(item, options) {
|
|
3051
|
-
this.component.addPopoutGroup(item, options);
|
|
3140
|
+
return this.component.addPopoutGroup(item, options);
|
|
3052
3141
|
}
|
|
3053
3142
|
}
|
|
3054
3143
|
|
|
@@ -3102,6 +3191,18 @@
|
|
|
3102
3191
|
}
|
|
3103
3192
|
}
|
|
3104
3193
|
|
|
3194
|
+
class WillShowOverlayEvent extends DockviewEvent {
|
|
3195
|
+
get nativeEvent() {
|
|
3196
|
+
return this.options.nativeEvent;
|
|
3197
|
+
}
|
|
3198
|
+
get position() {
|
|
3199
|
+
return this.options.position;
|
|
3200
|
+
}
|
|
3201
|
+
constructor(options) {
|
|
3202
|
+
super();
|
|
3203
|
+
this.options = options;
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3105
3206
|
function directionToPosition(direction) {
|
|
3106
3207
|
switch (direction) {
|
|
3107
3208
|
case 'above':
|
|
@@ -3154,6 +3255,8 @@
|
|
|
3154
3255
|
this.options = options;
|
|
3155
3256
|
this._onDrop = new Emitter();
|
|
3156
3257
|
this.onDrop = this._onDrop.event;
|
|
3258
|
+
this._onWillShowOverlay = new Emitter();
|
|
3259
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3157
3260
|
// use a set to take advantage of #<set>.has
|
|
3158
3261
|
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
3159
3262
|
this.dnd = new DragAndDropObserver(this.element, {
|
|
@@ -3182,6 +3285,19 @@
|
|
|
3182
3285
|
this.removeDropTarget();
|
|
3183
3286
|
return;
|
|
3184
3287
|
}
|
|
3288
|
+
const willShowOverlayEvent = new WillShowOverlayEvent({
|
|
3289
|
+
nativeEvent: e,
|
|
3290
|
+
position: quadrant,
|
|
3291
|
+
});
|
|
3292
|
+
/**
|
|
3293
|
+
* Provide an opportunity to prevent the overlay appearing and in turn
|
|
3294
|
+
* any dnd behaviours
|
|
3295
|
+
*/
|
|
3296
|
+
this._onWillShowOverlay.fire(willShowOverlayEvent);
|
|
3297
|
+
if (willShowOverlayEvent.defaultPrevented) {
|
|
3298
|
+
this.removeDropTarget();
|
|
3299
|
+
return;
|
|
3300
|
+
}
|
|
3185
3301
|
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
3186
3302
|
if (!this.options.canDisplayOverlay) {
|
|
3187
3303
|
this.removeDropTarget();
|
|
@@ -3224,7 +3340,7 @@
|
|
|
3224
3340
|
}
|
|
3225
3341
|
},
|
|
3226
3342
|
});
|
|
3227
|
-
this.addDisposables(this._onDrop, this.dnd);
|
|
3343
|
+
this.addDisposables(this._onDrop, this._onWillShowOverlay, this.dnd);
|
|
3228
3344
|
}
|
|
3229
3345
|
setTargetZones(acceptedTargetZones) {
|
|
3230
3346
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
@@ -3277,25 +3393,44 @@
|
|
|
3277
3393
|
size = clamp(0, sizeOptions.value, height) / height;
|
|
3278
3394
|
}
|
|
3279
3395
|
}
|
|
3280
|
-
const
|
|
3281
|
-
|
|
3282
|
-
|
|
3396
|
+
const box = { top: '0px', left: '0px', width: '100%', height: '100%' };
|
|
3397
|
+
/**
|
|
3398
|
+
* You can also achieve the overlay placement using the transform CSS property
|
|
3399
|
+
* to translate and scale the element however this has the undesired effect of
|
|
3400
|
+
* 'skewing' the element. Comment left here for anybody that ever revisits this.
|
|
3401
|
+
*
|
|
3402
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
|
3403
|
+
*
|
|
3404
|
+
* right
|
|
3405
|
+
* translateX(${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3406
|
+
*
|
|
3407
|
+
* left
|
|
3408
|
+
* translateX(-${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3409
|
+
*
|
|
3410
|
+
* top
|
|
3411
|
+
* translateY(-${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3412
|
+
*
|
|
3413
|
+
* bottom
|
|
3414
|
+
* translateY(${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3415
|
+
*/
|
|
3283
3416
|
if (rightClass) {
|
|
3284
|
-
|
|
3417
|
+
box.left = `${100 * (1 - size)}%`;
|
|
3418
|
+
box.width = `${100 * size}%`;
|
|
3285
3419
|
}
|
|
3286
3420
|
else if (leftClass) {
|
|
3287
|
-
|
|
3421
|
+
box.width = `${100 * size}%`;
|
|
3288
3422
|
}
|
|
3289
3423
|
else if (topClass) {
|
|
3290
|
-
|
|
3424
|
+
box.height = `${100 * size}%`;
|
|
3291
3425
|
}
|
|
3292
3426
|
else if (bottomClass) {
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
else {
|
|
3296
|
-
transform = '';
|
|
3427
|
+
box.top = `${100 * (1 - size)}%`;
|
|
3428
|
+
box.height = `${100 * size}%`;
|
|
3297
3429
|
}
|
|
3298
|
-
this.overlayElement.style.
|
|
3430
|
+
this.overlayElement.style.top = box.top;
|
|
3431
|
+
this.overlayElement.style.left = box.left;
|
|
3432
|
+
this.overlayElement.style.width = box.width;
|
|
3433
|
+
this.overlayElement.style.height = box.height;
|
|
3299
3434
|
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3300
3435
|
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3301
3436
|
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
@@ -3363,14 +3498,6 @@
|
|
|
3363
3498
|
return 'center';
|
|
3364
3499
|
}
|
|
3365
3500
|
|
|
3366
|
-
exports.DockviewDropTargets = void 0;
|
|
3367
|
-
(function (DockviewDropTargets) {
|
|
3368
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3369
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3370
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3371
|
-
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3372
|
-
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3373
|
-
|
|
3374
3501
|
class ContentContainer extends CompositeDisposable {
|
|
3375
3502
|
get element() {
|
|
3376
3503
|
return this._element;
|
|
@@ -3398,7 +3525,7 @@
|
|
|
3398
3525
|
const data = getPanelData();
|
|
3399
3526
|
if (!data &&
|
|
3400
3527
|
event.shiftKey &&
|
|
3401
|
-
this.group.location !== 'floating') {
|
|
3528
|
+
this.group.location.type !== 'floating') {
|
|
3402
3529
|
return false;
|
|
3403
3530
|
}
|
|
3404
3531
|
if (data && data.viewId === this.accessor.id) {
|
|
@@ -3416,7 +3543,7 @@
|
|
|
3416
3543
|
data.groupId === this.group.id;
|
|
3417
3544
|
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3418
3545
|
}
|
|
3419
|
-
return this.group.canDisplayOverlay(event, position,
|
|
3546
|
+
return this.group.canDisplayOverlay(event, position, 'content');
|
|
3420
3547
|
},
|
|
3421
3548
|
});
|
|
3422
3549
|
this.addDisposables(this.dropTarget);
|
|
@@ -3441,7 +3568,7 @@
|
|
|
3441
3568
|
let container;
|
|
3442
3569
|
switch (panel.api.renderer) {
|
|
3443
3570
|
case 'onlyWhenVisibile':
|
|
3444
|
-
this.
|
|
3571
|
+
this.group.renderContainer.detatch(panel);
|
|
3445
3572
|
if (this.panel) {
|
|
3446
3573
|
if (doRender) {
|
|
3447
3574
|
this._element.appendChild(this.panel.view.content.element);
|
|
@@ -3453,7 +3580,7 @@
|
|
|
3453
3580
|
if (panel.view.content.element.parentElement === this._element) {
|
|
3454
3581
|
this._element.removeChild(panel.view.content.element);
|
|
3455
3582
|
}
|
|
3456
|
-
container = this.
|
|
3583
|
+
container = this.group.renderContainer.attach({
|
|
3457
3584
|
panel,
|
|
3458
3585
|
referenceContainer: this,
|
|
3459
3586
|
});
|
|
@@ -3484,9 +3611,10 @@
|
|
|
3484
3611
|
// noop
|
|
3485
3612
|
}
|
|
3486
3613
|
closePanel() {
|
|
3614
|
+
var _a;
|
|
3487
3615
|
if (this.panel) {
|
|
3488
3616
|
if (this.panel.api.renderer === 'onlyWhenVisibile') {
|
|
3489
|
-
this.
|
|
3617
|
+
(_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
|
|
3490
3618
|
}
|
|
3491
3619
|
}
|
|
3492
3620
|
this.panel = undefined;
|
|
@@ -3597,7 +3725,7 @@
|
|
|
3597
3725
|
this._element.draggable = true;
|
|
3598
3726
|
toggleClass(this.element, 'inactive-tab', true);
|
|
3599
3727
|
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
3600
|
-
this.
|
|
3728
|
+
this.dropTarget = new Droptarget(this._element, {
|
|
3601
3729
|
acceptedTargetZones: ['center'],
|
|
3602
3730
|
canDisplayOverlay: (event, position) => {
|
|
3603
3731
|
if (this.group.locked) {
|
|
@@ -3612,9 +3740,10 @@
|
|
|
3612
3740
|
}
|
|
3613
3741
|
return this.panel.id !== data.panelId;
|
|
3614
3742
|
}
|
|
3615
|
-
return this.group.model.canDisplayOverlay(event, position,
|
|
3743
|
+
return this.group.model.canDisplayOverlay(event, position, 'tab');
|
|
3616
3744
|
},
|
|
3617
3745
|
});
|
|
3746
|
+
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
3618
3747
|
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
3619
3748
|
this._onDragStart.fire(event);
|
|
3620
3749
|
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
@@ -3622,9 +3751,9 @@
|
|
|
3622
3751
|
return;
|
|
3623
3752
|
}
|
|
3624
3753
|
this._onChanged.fire(event);
|
|
3625
|
-
}), this.
|
|
3754
|
+
}), this.dropTarget.onDrop((event) => {
|
|
3626
3755
|
this._onDropped.fire(event);
|
|
3627
|
-
}), this.
|
|
3756
|
+
}), this.dropTarget);
|
|
3628
3757
|
}
|
|
3629
3758
|
setActive(isActive) {
|
|
3630
3759
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -3671,7 +3800,7 @@
|
|
|
3671
3800
|
}, true));
|
|
3672
3801
|
}
|
|
3673
3802
|
isCancelled(_event) {
|
|
3674
|
-
if (this.group.api.location === 'floating' && !_event.shiftKey) {
|
|
3803
|
+
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
3675
3804
|
return true;
|
|
3676
3805
|
}
|
|
3677
3806
|
return false;
|
|
@@ -3723,7 +3852,7 @@
|
|
|
3723
3852
|
this.accessor.doSetGroupActive(this.group);
|
|
3724
3853
|
}));
|
|
3725
3854
|
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3726
|
-
this.
|
|
3855
|
+
this.dropTraget = new Droptarget(this._element, {
|
|
3727
3856
|
acceptedTargetZones: ['center'],
|
|
3728
3857
|
canDisplayOverlay: (event, position) => {
|
|
3729
3858
|
var _a;
|
|
@@ -3737,14 +3866,15 @@
|
|
|
3737
3866
|
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
3738
3867
|
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
3739
3868
|
}
|
|
3740
|
-
return group.model.canDisplayOverlay(event, position,
|
|
3869
|
+
return group.model.canDisplayOverlay(event, position, 'header_space');
|
|
3741
3870
|
},
|
|
3742
3871
|
});
|
|
3872
|
+
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
3743
3873
|
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3744
3874
|
this._onDragStart.fire(event);
|
|
3745
|
-
}), this.
|
|
3875
|
+
}), this.dropTraget.onDrop((event) => {
|
|
3746
3876
|
this._onDrop.fire(event);
|
|
3747
|
-
}), this.
|
|
3877
|
+
}), this.dropTraget);
|
|
3748
3878
|
}
|
|
3749
3879
|
}
|
|
3750
3880
|
|
|
@@ -3832,19 +3962,11 @@
|
|
|
3832
3962
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
3833
3963
|
this._onGroupDragStart = new Emitter();
|
|
3834
3964
|
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3835
|
-
this.
|
|
3965
|
+
this._onWillShowOverlay = new Emitter();
|
|
3966
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3836
3967
|
this._element = document.createElement('div');
|
|
3837
3968
|
this._element.className = 'tabs-and-actions-container';
|
|
3838
3969
|
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
3839
|
-
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3840
|
-
if (e.api.group === this.group) {
|
|
3841
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3842
|
-
}
|
|
3843
|
-
}), this.accessor.onDidRemovePanel((e) => {
|
|
3844
|
-
if (e.api.group === this.group) {
|
|
3845
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3846
|
-
}
|
|
3847
|
-
}));
|
|
3848
3970
|
this.rightActionsContainer = document.createElement('div');
|
|
3849
3971
|
this.rightActionsContainer.className = 'right-actions-container';
|
|
3850
3972
|
this.leftActionsContainer = document.createElement('div');
|
|
@@ -3859,7 +3981,15 @@
|
|
|
3859
3981
|
this._element.appendChild(this.leftActionsContainer);
|
|
3860
3982
|
this._element.appendChild(this.voidContainer.element);
|
|
3861
3983
|
this._element.appendChild(this.rightActionsContainer);
|
|
3862
|
-
this.addDisposables(this.
|
|
3984
|
+
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3985
|
+
if (e.api.group === this.group) {
|
|
3986
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3987
|
+
}
|
|
3988
|
+
}), this.accessor.onDidRemovePanel((e) => {
|
|
3989
|
+
if (e.api.group === this.group) {
|
|
3990
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3991
|
+
}
|
|
3992
|
+
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3863
3993
|
this._onGroupDragStart.fire({
|
|
3864
3994
|
nativeEvent: event,
|
|
3865
3995
|
group: this.group,
|
|
@@ -3869,11 +3999,15 @@
|
|
|
3869
3999
|
event: event.nativeEvent,
|
|
3870
4000
|
index: this.tabs.length,
|
|
3871
4001
|
});
|
|
4002
|
+
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
4003
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4004
|
+
kind: 'header_space',
|
|
4005
|
+
}));
|
|
3872
4006
|
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
3873
4007
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3874
4008
|
if (isFloatingGroupsEnabled &&
|
|
3875
4009
|
event.shiftKey &&
|
|
3876
|
-
this.group.api.location !== 'floating') {
|
|
4010
|
+
this.group.api.location.type !== 'floating') {
|
|
3877
4011
|
event.preventDefault();
|
|
3878
4012
|
const { top, left } = this.element.getBoundingClientRect();
|
|
3879
4013
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
@@ -3936,9 +4070,9 @@
|
|
|
3936
4070
|
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
3937
4071
|
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
3938
4072
|
}), tab.onChanged((event) => {
|
|
3939
|
-
var _a;
|
|
3940
4073
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3941
|
-
const isFloatingWithOnePanel = this.group.api.location === 'floating' &&
|
|
4074
|
+
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
4075
|
+
this.size === 1;
|
|
3942
4076
|
if (isFloatingGroupsEnabled &&
|
|
3943
4077
|
!isFloatingWithOnePanel &&
|
|
3944
4078
|
event.shiftKey) {
|
|
@@ -3952,20 +4086,20 @@
|
|
|
3952
4086
|
}, { inDragMode: true });
|
|
3953
4087
|
return;
|
|
3954
4088
|
}
|
|
3955
|
-
const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
3956
|
-
this.group.model.isContentFocused;
|
|
3957
4089
|
const isLeftClick = event.button === 0;
|
|
3958
4090
|
if (!isLeftClick || event.defaultPrevented) {
|
|
3959
4091
|
return;
|
|
3960
4092
|
}
|
|
3961
|
-
this.group.
|
|
3962
|
-
|
|
3963
|
-
}
|
|
4093
|
+
if (this.group.activePanel !== panel) {
|
|
4094
|
+
this.group.model.openPanel(panel);
|
|
4095
|
+
}
|
|
3964
4096
|
}), tab.onDrop((event) => {
|
|
3965
4097
|
this._onDrop.fire({
|
|
3966
4098
|
event: event.nativeEvent,
|
|
3967
4099
|
index: this.tabs.findIndex((x) => x.value === tab),
|
|
3968
4100
|
});
|
|
4101
|
+
}), tab.onWillShowOverlay((event) => {
|
|
4102
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, { kind: 'tab' }));
|
|
3969
4103
|
}));
|
|
3970
4104
|
const value = { value: tab, disposable };
|
|
3971
4105
|
this.addTab(value, index);
|
|
@@ -3983,6 +4117,60 @@
|
|
|
3983
4117
|
}
|
|
3984
4118
|
}
|
|
3985
4119
|
|
|
4120
|
+
class DockviewDidDropEvent extends DockviewEvent {
|
|
4121
|
+
get nativeEvent() {
|
|
4122
|
+
return this.options.nativeEvent;
|
|
4123
|
+
}
|
|
4124
|
+
get position() {
|
|
4125
|
+
return this.options.position;
|
|
4126
|
+
}
|
|
4127
|
+
get panel() {
|
|
4128
|
+
return this.options.panel;
|
|
4129
|
+
}
|
|
4130
|
+
get group() {
|
|
4131
|
+
return this.options.group;
|
|
4132
|
+
}
|
|
4133
|
+
get api() {
|
|
4134
|
+
return this.options.api;
|
|
4135
|
+
}
|
|
4136
|
+
constructor(options) {
|
|
4137
|
+
super();
|
|
4138
|
+
this.options = options;
|
|
4139
|
+
}
|
|
4140
|
+
getData() {
|
|
4141
|
+
return this.options.getData();
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4144
|
+
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4145
|
+
get kind() {
|
|
4146
|
+
return this._kind;
|
|
4147
|
+
}
|
|
4148
|
+
constructor(options) {
|
|
4149
|
+
super(options);
|
|
4150
|
+
this._kind = options.kind;
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
4153
|
+
class WillShowOverlayLocationEvent {
|
|
4154
|
+
get kind() {
|
|
4155
|
+
return this._kind;
|
|
4156
|
+
}
|
|
4157
|
+
get nativeEvent() {
|
|
4158
|
+
return this.event.nativeEvent;
|
|
4159
|
+
}
|
|
4160
|
+
get position() {
|
|
4161
|
+
return this.event.position;
|
|
4162
|
+
}
|
|
4163
|
+
get defaultPrevented() {
|
|
4164
|
+
return this.event.defaultPrevented;
|
|
4165
|
+
}
|
|
4166
|
+
preventDefault() {
|
|
4167
|
+
this.event.preventDefault();
|
|
4168
|
+
}
|
|
4169
|
+
constructor(event, options) {
|
|
4170
|
+
this.event = event;
|
|
4171
|
+
this._kind = options.kind;
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
3986
4174
|
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
3987
4175
|
get element() {
|
|
3988
4176
|
throw new Error('not supported');
|
|
@@ -4028,7 +4216,7 @@
|
|
|
4028
4216
|
this._location = value;
|
|
4029
4217
|
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4030
4218
|
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4031
|
-
switch (value) {
|
|
4219
|
+
switch (value.type) {
|
|
4032
4220
|
case 'grid':
|
|
4033
4221
|
this.contentContainer.dropTarget.setTargetZones([
|
|
4034
4222
|
'top',
|
|
@@ -4064,7 +4252,7 @@
|
|
|
4064
4252
|
this.groupPanel = groupPanel;
|
|
4065
4253
|
this._isGroupActive = false;
|
|
4066
4254
|
this._locked = false;
|
|
4067
|
-
this._location = 'grid';
|
|
4255
|
+
this._location = { type: 'grid' };
|
|
4068
4256
|
this.mostRecentlyUsed = [];
|
|
4069
4257
|
this._onDidChange = new Emitter();
|
|
4070
4258
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -4075,6 +4263,10 @@
|
|
|
4075
4263
|
this.onMove = this._onMove.event;
|
|
4076
4264
|
this._onDidDrop = new Emitter();
|
|
4077
4265
|
this.onDidDrop = this._onDidDrop.event;
|
|
4266
|
+
this._onWillDrop = new Emitter();
|
|
4267
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
4268
|
+
this._onWillShowOverlay = new Emitter();
|
|
4269
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4078
4270
|
this._onTabDragStart = new Emitter();
|
|
4079
4271
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
4080
4272
|
this._onGroupDragStart = new Emitter();
|
|
@@ -4085,46 +4277,69 @@
|
|
|
4085
4277
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4086
4278
|
this._onDidActivePanelChange = new Emitter();
|
|
4087
4279
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4280
|
+
this._overwriteRenderContainer = null;
|
|
4088
4281
|
toggleClass(this.container, 'groupview', true);
|
|
4282
|
+
this._api = new DockviewApi(this.accessor);
|
|
4089
4283
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
4090
4284
|
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
4091
4285
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
4092
4286
|
this.header.hidden = !!options.hideHeader;
|
|
4093
4287
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
4094
|
-
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this.tabsContainer.onTabDragStart((event) => {
|
|
4288
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
4095
4289
|
this._onTabDragStart.fire(event);
|
|
4096
4290
|
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
4097
4291
|
this._onGroupDragStart.fire(event);
|
|
4098
4292
|
}), this.tabsContainer.onDrop((event) => {
|
|
4099
|
-
this.handleDropEvent(event.event, 'center', event.index);
|
|
4293
|
+
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
4100
4294
|
}), this.contentContainer.onDidFocus(() => {
|
|
4101
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4295
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4102
4296
|
}), this.contentContainer.onDidBlur(() => {
|
|
4103
4297
|
// noop
|
|
4104
4298
|
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
4105
|
-
this.handleDropEvent(event.nativeEvent, event.position);
|
|
4106
|
-
}), this.
|
|
4299
|
+
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
4300
|
+
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
4301
|
+
this._onWillShowOverlay.fire(event);
|
|
4302
|
+
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
4303
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4304
|
+
kind: 'content',
|
|
4305
|
+
}));
|
|
4306
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
4307
|
+
}
|
|
4308
|
+
focusContent() {
|
|
4309
|
+
this.contentContainer.element.focus();
|
|
4310
|
+
}
|
|
4311
|
+
set renderContainer(value) {
|
|
4312
|
+
this.panels.forEach((panel) => {
|
|
4313
|
+
this.renderContainer.detatch(panel);
|
|
4314
|
+
});
|
|
4315
|
+
this._overwriteRenderContainer = value;
|
|
4316
|
+
this.panels.forEach((panel) => {
|
|
4317
|
+
this.rerender(panel);
|
|
4318
|
+
});
|
|
4319
|
+
}
|
|
4320
|
+
get renderContainer() {
|
|
4321
|
+
var _a;
|
|
4322
|
+
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
4107
4323
|
}
|
|
4108
4324
|
initialize() {
|
|
4109
|
-
|
|
4110
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
|
|
4325
|
+
if (this.options.panels) {
|
|
4111
4326
|
this.options.panels.forEach((panel) => {
|
|
4112
4327
|
this.doAddPanel(panel);
|
|
4113
4328
|
});
|
|
4114
4329
|
}
|
|
4115
|
-
if (
|
|
4330
|
+
if (this.options.activePanel) {
|
|
4116
4331
|
this.openPanel(this.options.activePanel);
|
|
4117
4332
|
}
|
|
4118
4333
|
// must be run after the constructor otherwise this.parent may not be
|
|
4119
4334
|
// correctly initialized
|
|
4120
|
-
this.setActive(this.isActive, true
|
|
4335
|
+
this.setActive(this.isActive, true);
|
|
4121
4336
|
this.updateContainer();
|
|
4122
4337
|
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
4123
4338
|
this._rightHeaderActions =
|
|
4124
4339
|
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
4125
4340
|
this.addDisposables(this._rightHeaderActions);
|
|
4126
4341
|
this._rightHeaderActions.init({
|
|
4127
|
-
containerApi:
|
|
4342
|
+
containerApi: this._api,
|
|
4128
4343
|
api: this.groupPanel.api,
|
|
4129
4344
|
});
|
|
4130
4345
|
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
@@ -4134,7 +4349,7 @@
|
|
|
4134
4349
|
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
4135
4350
|
this.addDisposables(this._leftHeaderActions);
|
|
4136
4351
|
this._leftHeaderActions.init({
|
|
4137
|
-
containerApi:
|
|
4352
|
+
containerApi: this._api,
|
|
4138
4353
|
api: this.groupPanel.api,
|
|
4139
4354
|
});
|
|
4140
4355
|
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
@@ -4144,7 +4359,7 @@
|
|
|
4144
4359
|
this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
|
|
4145
4360
|
this.addDisposables(this._prefixHeaderActions);
|
|
4146
4361
|
this._prefixHeaderActions.init({
|
|
4147
|
-
containerApi:
|
|
4362
|
+
containerApi: this._api,
|
|
4148
4363
|
api: this.groupPanel.api,
|
|
4149
4364
|
});
|
|
4150
4365
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
@@ -4224,35 +4439,45 @@
|
|
|
4224
4439
|
//noop
|
|
4225
4440
|
}
|
|
4226
4441
|
focus() {
|
|
4227
|
-
var _a
|
|
4228
|
-
(
|
|
4442
|
+
var _a;
|
|
4443
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4229
4444
|
}
|
|
4230
4445
|
openPanel(panel, options = {}) {
|
|
4446
|
+
/**
|
|
4447
|
+
* set the panel group
|
|
4448
|
+
* add the panel
|
|
4449
|
+
* check if group active
|
|
4450
|
+
* check if panel active
|
|
4451
|
+
*/
|
|
4231
4452
|
if (typeof options.index !== 'number' ||
|
|
4232
4453
|
options.index > this.panels.length) {
|
|
4233
4454
|
options.index = this.panels.length;
|
|
4234
4455
|
}
|
|
4235
|
-
const
|
|
4236
|
-
const skipSetGroupActive = !!options.skipSetGroupActive;
|
|
4456
|
+
const skipSetActive = !!options.skipSetActive;
|
|
4237
4457
|
// ensure the group is updated before we fire any events
|
|
4238
|
-
panel.updateParentGroup(this.groupPanel,
|
|
4458
|
+
panel.updateParentGroup(this.groupPanel, {
|
|
4459
|
+
skipSetActive: options.skipSetActive,
|
|
4460
|
+
});
|
|
4461
|
+
this.doAddPanel(panel, options.index, {
|
|
4462
|
+
skipSetActive: skipSetActive,
|
|
4463
|
+
});
|
|
4239
4464
|
if (this._activePanel === panel) {
|
|
4240
|
-
if (!skipSetGroupActive) {
|
|
4241
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4242
|
-
}
|
|
4243
4465
|
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
4244
4466
|
return;
|
|
4245
4467
|
}
|
|
4246
|
-
|
|
4247
|
-
if (!skipSetPanelActive) {
|
|
4468
|
+
if (!skipSetActive) {
|
|
4248
4469
|
this.doSetActivePanel(panel);
|
|
4249
4470
|
}
|
|
4250
|
-
if (!skipSetGroupActive) {
|
|
4251
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4471
|
+
if (!options.skipSetGroupActive) {
|
|
4472
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4473
|
+
}
|
|
4474
|
+
if (!options.skipSetActive) {
|
|
4475
|
+
this.updateContainer();
|
|
4252
4476
|
}
|
|
4253
|
-
this.updateContainer();
|
|
4254
4477
|
}
|
|
4255
|
-
removePanel(groupItemOrId
|
|
4478
|
+
removePanel(groupItemOrId, options = {
|
|
4479
|
+
skipSetActive: false,
|
|
4480
|
+
}) {
|
|
4256
4481
|
const id = typeof groupItemOrId === 'string'
|
|
4257
4482
|
? groupItemOrId
|
|
4258
4483
|
: groupItemOrId.id;
|
|
@@ -4260,7 +4485,7 @@
|
|
|
4260
4485
|
if (!panelToRemove) {
|
|
4261
4486
|
throw new Error('invalid operation');
|
|
4262
4487
|
}
|
|
4263
|
-
return this._removePanel(panelToRemove);
|
|
4488
|
+
return this._removePanel(panelToRemove, options);
|
|
4264
4489
|
}
|
|
4265
4490
|
closeAllPanels() {
|
|
4266
4491
|
if (this.panels.length > 0) {
|
|
@@ -4286,12 +4511,8 @@
|
|
|
4286
4511
|
updateActions(element) {
|
|
4287
4512
|
this.tabsContainer.setRightActionsElement(element);
|
|
4288
4513
|
}
|
|
4289
|
-
setActive(isGroupActive,
|
|
4290
|
-
var _a, _b, _c, _d;
|
|
4514
|
+
setActive(isGroupActive, force = false) {
|
|
4291
4515
|
if (!force && this.isActive === isGroupActive) {
|
|
4292
|
-
if (!skipFocus) {
|
|
4293
|
-
(_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4294
|
-
}
|
|
4295
4516
|
return;
|
|
4296
4517
|
}
|
|
4297
4518
|
this._isGroupActive = isGroupActive;
|
|
@@ -4302,11 +4523,6 @@
|
|
|
4302
4523
|
this.doSetActivePanel(this.panels[0]);
|
|
4303
4524
|
}
|
|
4304
4525
|
this.updateContainer();
|
|
4305
|
-
if (isGroupActive) {
|
|
4306
|
-
if (!skipFocus) {
|
|
4307
|
-
(_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
4308
|
-
}
|
|
4309
|
-
}
|
|
4310
4526
|
}
|
|
4311
4527
|
layout(width, height) {
|
|
4312
4528
|
var _a;
|
|
@@ -4317,17 +4533,22 @@
|
|
|
4317
4533
|
this._activePanel.layout(this._width, this._height);
|
|
4318
4534
|
}
|
|
4319
4535
|
}
|
|
4320
|
-
_removePanel(panel) {
|
|
4536
|
+
_removePanel(panel, options) {
|
|
4321
4537
|
const isActivePanel = this._activePanel === panel;
|
|
4322
4538
|
this.doRemovePanel(panel);
|
|
4323
4539
|
if (isActivePanel && this.panels.length > 0) {
|
|
4324
4540
|
const nextPanel = this.mostRecentlyUsed[0];
|
|
4325
|
-
this.openPanel(nextPanel
|
|
4541
|
+
this.openPanel(nextPanel, {
|
|
4542
|
+
skipSetActive: options.skipSetActive,
|
|
4543
|
+
skipSetGroupActive: options.skipSetActiveGroup,
|
|
4544
|
+
});
|
|
4326
4545
|
}
|
|
4327
4546
|
if (this._activePanel && this.panels.length === 0) {
|
|
4328
4547
|
this.doSetActivePanel(undefined);
|
|
4329
4548
|
}
|
|
4330
|
-
|
|
4549
|
+
if (!options.skipSetActive) {
|
|
4550
|
+
this.updateContainer();
|
|
4551
|
+
}
|
|
4331
4552
|
return panel;
|
|
4332
4553
|
}
|
|
4333
4554
|
doRemovePanel(panel) {
|
|
@@ -4342,13 +4563,13 @@
|
|
|
4342
4563
|
}
|
|
4343
4564
|
this._onDidRemovePanel.fire({ panel });
|
|
4344
4565
|
}
|
|
4345
|
-
doAddPanel(panel, index = this.panels.length,
|
|
4566
|
+
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
4346
4567
|
const existingPanel = this._panels.indexOf(panel);
|
|
4347
4568
|
const hasExistingPanel = existingPanel > -1;
|
|
4348
4569
|
this.tabsContainer.show();
|
|
4349
4570
|
this.contentContainer.show();
|
|
4350
4571
|
this.tabsContainer.openPanel(panel, index);
|
|
4351
|
-
if (!skipSetActive) {
|
|
4572
|
+
if (!options.skipSetActive) {
|
|
4352
4573
|
this.contentContainer.openPanel(panel);
|
|
4353
4574
|
}
|
|
4354
4575
|
if (hasExistingPanel) {
|
|
@@ -4360,12 +4581,17 @@
|
|
|
4360
4581
|
this._onDidAddPanel.fire({ panel });
|
|
4361
4582
|
}
|
|
4362
4583
|
doSetActivePanel(panel) {
|
|
4584
|
+
if (this._activePanel === panel) {
|
|
4585
|
+
return;
|
|
4586
|
+
}
|
|
4363
4587
|
this._activePanel = panel;
|
|
4364
4588
|
if (panel) {
|
|
4365
4589
|
this.tabsContainer.setActivePanel(panel);
|
|
4366
4590
|
panel.layout(this._width, this._height);
|
|
4367
4591
|
this.updateMru(panel);
|
|
4368
|
-
this._onDidActivePanelChange.fire({
|
|
4592
|
+
this._onDidActivePanelChange.fire({
|
|
4593
|
+
panel,
|
|
4594
|
+
});
|
|
4369
4595
|
}
|
|
4370
4596
|
}
|
|
4371
4597
|
updateMru(panel) {
|
|
@@ -4377,11 +4603,11 @@
|
|
|
4377
4603
|
updateContainer() {
|
|
4378
4604
|
var _a, _b;
|
|
4379
4605
|
toggleClass(this.container, 'empty', this.isEmpty);
|
|
4380
|
-
this.panels.forEach((panel) => panel.
|
|
4606
|
+
this.panels.forEach((panel) => panel.runEvents());
|
|
4381
4607
|
if (this.isEmpty && !this.watermark) {
|
|
4382
4608
|
const watermark = this.accessor.createWatermarkComponent();
|
|
4383
4609
|
watermark.init({
|
|
4384
|
-
containerApi:
|
|
4610
|
+
containerApi: this._api,
|
|
4385
4611
|
group: this.groupPanel,
|
|
4386
4612
|
});
|
|
4387
4613
|
this.watermark = watermark;
|
|
@@ -4414,10 +4640,32 @@
|
|
|
4414
4640
|
}
|
|
4415
4641
|
return false;
|
|
4416
4642
|
}
|
|
4417
|
-
handleDropEvent(event, position, index) {
|
|
4643
|
+
handleDropEvent(type, event, position, index) {
|
|
4418
4644
|
if (this.locked === 'no-drop-target') {
|
|
4419
4645
|
return;
|
|
4420
4646
|
}
|
|
4647
|
+
function getKind() {
|
|
4648
|
+
switch (type) {
|
|
4649
|
+
case 'header':
|
|
4650
|
+
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
4651
|
+
case 'content':
|
|
4652
|
+
return 'content';
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
4656
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
4657
|
+
nativeEvent: event,
|
|
4658
|
+
position,
|
|
4659
|
+
panel,
|
|
4660
|
+
getData: () => getPanelData(),
|
|
4661
|
+
kind: getKind(),
|
|
4662
|
+
group: this.groupPanel,
|
|
4663
|
+
api: this._api,
|
|
4664
|
+
});
|
|
4665
|
+
this._onWillDrop.fire(willDropEvent);
|
|
4666
|
+
if (willDropEvent.defaultPrevented) {
|
|
4667
|
+
return;
|
|
4668
|
+
}
|
|
4421
4669
|
const data = getPanelData();
|
|
4422
4670
|
if (data && data.viewId === this.accessor.id) {
|
|
4423
4671
|
if (data.panelId === null) {
|
|
@@ -4450,12 +4698,14 @@
|
|
|
4450
4698
|
});
|
|
4451
4699
|
}
|
|
4452
4700
|
else {
|
|
4453
|
-
this._onDidDrop.fire({
|
|
4701
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
4454
4702
|
nativeEvent: event,
|
|
4455
4703
|
position,
|
|
4456
|
-
|
|
4704
|
+
panel,
|
|
4457
4705
|
getData: () => getPanelData(),
|
|
4458
|
-
|
|
4706
|
+
group: this.groupPanel,
|
|
4707
|
+
api: this._api,
|
|
4708
|
+
}));
|
|
4459
4709
|
}
|
|
4460
4710
|
}
|
|
4461
4711
|
dispose() {
|
|
@@ -4463,6 +4713,7 @@
|
|
|
4463
4713
|
super.dispose();
|
|
4464
4714
|
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
4465
4715
|
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4716
|
+
this.watermark = undefined;
|
|
4466
4717
|
for (const panel of this.panels) {
|
|
4467
4718
|
panel.dispose();
|
|
4468
4719
|
}
|
|
@@ -4484,15 +4735,7 @@
|
|
|
4484
4735
|
constructor(parentElement, disableResizing = false) {
|
|
4485
4736
|
super();
|
|
4486
4737
|
this._disableResizing = disableResizing;
|
|
4487
|
-
|
|
4488
|
-
this._element = parentElement;
|
|
4489
|
-
}
|
|
4490
|
-
else {
|
|
4491
|
-
this._element = document.createElement('div');
|
|
4492
|
-
this._element.style.height = '100%';
|
|
4493
|
-
this._element.style.width = '100%';
|
|
4494
|
-
this._element.className = 'dv-resizable-container';
|
|
4495
|
-
}
|
|
4738
|
+
this._element = parentElement;
|
|
4496
4739
|
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
4497
4740
|
if (this.isDisposed) {
|
|
4498
4741
|
/**
|
|
@@ -4580,25 +4823,38 @@
|
|
|
4580
4823
|
get activeGroup() {
|
|
4581
4824
|
return this._activeGroup;
|
|
4582
4825
|
}
|
|
4826
|
+
get locked() {
|
|
4827
|
+
return this.gridview.locked;
|
|
4828
|
+
}
|
|
4829
|
+
set locked(value) {
|
|
4830
|
+
this.gridview.locked = value;
|
|
4831
|
+
}
|
|
4583
4832
|
constructor(options) {
|
|
4584
|
-
super(
|
|
4833
|
+
super(document.createElement('div'), options.disableAutoResizing);
|
|
4585
4834
|
this._id = nextLayoutId$1.next();
|
|
4586
4835
|
this._groups = new Map();
|
|
4587
4836
|
this._onDidLayoutChange = new Emitter();
|
|
4588
4837
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
4589
|
-
this.
|
|
4590
|
-
this.
|
|
4591
|
-
this.
|
|
4592
|
-
this.
|
|
4593
|
-
this.
|
|
4594
|
-
this.
|
|
4838
|
+
this._onDidRemove = new Emitter();
|
|
4839
|
+
this.onDidRemove = this._onDidRemove.event;
|
|
4840
|
+
this._onDidAdd = new Emitter();
|
|
4841
|
+
this.onDidAdd = this._onDidAdd.event;
|
|
4842
|
+
this._onDidActiveChange = new Emitter();
|
|
4843
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4595
4844
|
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
4845
|
+
this.element.style.height = '100%';
|
|
4846
|
+
this.element.style.width = '100%';
|
|
4847
|
+
options.parentElement.appendChild(this.element);
|
|
4596
4848
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
4849
|
+
this.gridview.locked = !!options.locked;
|
|
4597
4850
|
this.element.appendChild(this.gridview.element);
|
|
4598
4851
|
this.layout(0, 0, true); // set some elements height/widths
|
|
4599
|
-
this.addDisposables(
|
|
4852
|
+
this.addDisposables(Disposable.from(() => {
|
|
4853
|
+
var _a;
|
|
4854
|
+
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
4855
|
+
}), this.gridview.onDidChange(() => {
|
|
4600
4856
|
this._bufferOnDidLayoutChange.fire();
|
|
4601
|
-
}), exports.DockviewEvent.any(this.
|
|
4857
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
4602
4858
|
this._bufferOnDidLayoutChange.fire();
|
|
4603
4859
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
4604
4860
|
this._onDidLayoutChange.fire();
|
|
@@ -4613,6 +4869,7 @@
|
|
|
4613
4869
|
}
|
|
4614
4870
|
maximizeGroup(panel) {
|
|
4615
4871
|
this.gridview.maximizeView(panel);
|
|
4872
|
+
this.doSetGroupActive(panel);
|
|
4616
4873
|
}
|
|
4617
4874
|
isMaximizedGroup(panel) {
|
|
4618
4875
|
return this.gridview.maximizedView() === panel;
|
|
@@ -4623,13 +4880,12 @@
|
|
|
4623
4880
|
hasMaximizedGroup() {
|
|
4624
4881
|
return this.gridview.hasMaximizedView();
|
|
4625
4882
|
}
|
|
4626
|
-
get
|
|
4627
|
-
return this.gridview.
|
|
4883
|
+
get onDidMaximizedGroupChange() {
|
|
4884
|
+
return this.gridview.onDidMaximizedNodeChange;
|
|
4628
4885
|
}
|
|
4629
4886
|
doAddGroup(group, location = [0], size) {
|
|
4630
4887
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
4631
|
-
this.
|
|
4632
|
-
this.doSetGroupActive(group);
|
|
4888
|
+
this._onDidAdd.fire(group);
|
|
4633
4889
|
}
|
|
4634
4890
|
doRemoveGroup(group, options) {
|
|
4635
4891
|
if (!this._groups.has(group.id)) {
|
|
@@ -4641,8 +4897,8 @@
|
|
|
4641
4897
|
item.disposable.dispose();
|
|
4642
4898
|
item.value.dispose();
|
|
4643
4899
|
this._groups.delete(group.id);
|
|
4900
|
+
this._onDidRemove.fire(group);
|
|
4644
4901
|
}
|
|
4645
|
-
this._onDidRemoveGroup.fire(group);
|
|
4646
4902
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
4647
4903
|
const groups = Array.from(this._groups.values());
|
|
4648
4904
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -4653,25 +4909,18 @@
|
|
|
4653
4909
|
var _a;
|
|
4654
4910
|
return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4655
4911
|
}
|
|
4656
|
-
doSetGroupActive(group
|
|
4657
|
-
var _a, _b, _c;
|
|
4912
|
+
doSetGroupActive(group) {
|
|
4658
4913
|
if (this._activeGroup === group) {
|
|
4659
4914
|
return;
|
|
4660
4915
|
}
|
|
4661
4916
|
if (this._activeGroup) {
|
|
4662
4917
|
this._activeGroup.setActive(false);
|
|
4663
|
-
if (!skipFocus) {
|
|
4664
|
-
(_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4665
|
-
}
|
|
4666
4918
|
}
|
|
4667
4919
|
if (group) {
|
|
4668
4920
|
group.setActive(true);
|
|
4669
|
-
if (!skipFocus) {
|
|
4670
|
-
(_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
|
|
4671
|
-
}
|
|
4672
4921
|
}
|
|
4673
4922
|
this._activeGroup = group;
|
|
4674
|
-
this.
|
|
4923
|
+
this._onDidActiveChange.fire(group);
|
|
4675
4924
|
}
|
|
4676
4925
|
removeGroup(group) {
|
|
4677
4926
|
this.doRemoveGroup(group);
|
|
@@ -4716,9 +4965,9 @@
|
|
|
4716
4965
|
this.gridview.layout(width, height);
|
|
4717
4966
|
}
|
|
4718
4967
|
dispose() {
|
|
4719
|
-
this.
|
|
4720
|
-
this.
|
|
4721
|
-
this.
|
|
4968
|
+
this._onDidActiveChange.dispose();
|
|
4969
|
+
this._onDidAdd.dispose();
|
|
4970
|
+
this._onDidRemove.dispose();
|
|
4722
4971
|
this._onDidLayoutChange.dispose();
|
|
4723
4972
|
for (const group of this.groups) {
|
|
4724
4973
|
group.dispose();
|
|
@@ -4728,11 +4977,15 @@
|
|
|
4728
4977
|
}
|
|
4729
4978
|
}
|
|
4730
4979
|
|
|
4980
|
+
class WillFocusEvent extends DockviewEvent {
|
|
4981
|
+
constructor() {
|
|
4982
|
+
super();
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
4731
4985
|
/**
|
|
4732
4986
|
* A core api implementation that should be used across all panel-like objects
|
|
4733
4987
|
*/
|
|
4734
4988
|
class PanelApiImpl extends CompositeDisposable {
|
|
4735
|
-
//
|
|
4736
4989
|
get isFocused() {
|
|
4737
4990
|
return this._isFocused;
|
|
4738
4991
|
}
|
|
@@ -4757,35 +5010,22 @@
|
|
|
4757
5010
|
this._width = 0;
|
|
4758
5011
|
this._height = 0;
|
|
4759
5012
|
this.panelUpdatesDisposable = new MutableDisposable();
|
|
4760
|
-
this._onDidDimensionChange = new Emitter(
|
|
4761
|
-
replay: true,
|
|
4762
|
-
});
|
|
5013
|
+
this._onDidDimensionChange = new Emitter();
|
|
4763
5014
|
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
4764
|
-
|
|
4765
|
-
this._onDidChangeFocus = new Emitter({
|
|
4766
|
-
replay: true,
|
|
4767
|
-
});
|
|
5015
|
+
this._onDidChangeFocus = new Emitter();
|
|
4768
5016
|
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
4769
5017
|
//
|
|
4770
|
-
this.
|
|
4771
|
-
this.
|
|
5018
|
+
this._onWillFocus = new Emitter();
|
|
5019
|
+
this.onWillFocus = this._onWillFocus.event;
|
|
4772
5020
|
//
|
|
4773
|
-
this._onDidVisibilityChange = new Emitter(
|
|
4774
|
-
replay: true,
|
|
4775
|
-
});
|
|
5021
|
+
this._onDidVisibilityChange = new Emitter();
|
|
4776
5022
|
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
4777
|
-
|
|
4778
|
-
this.
|
|
4779
|
-
this.
|
|
4780
|
-
//
|
|
4781
|
-
this._onDidActiveChange = new Emitter({
|
|
4782
|
-
replay: true,
|
|
4783
|
-
});
|
|
5023
|
+
this._onWillVisibilityChange = new Emitter();
|
|
5024
|
+
this.onWillVisibilityChange = this._onWillVisibilityChange.event;
|
|
5025
|
+
this._onDidActiveChange = new Emitter();
|
|
4784
5026
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4785
|
-
//
|
|
4786
5027
|
this._onActiveChange = new Emitter();
|
|
4787
5028
|
this.onActiveChange = this._onActiveChange.event;
|
|
4788
|
-
//
|
|
4789
5029
|
this._onUpdateParameters = new Emitter();
|
|
4790
5030
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
4791
5031
|
this.addDisposables(this.onDidFocusChange((event) => {
|
|
@@ -4797,7 +5037,7 @@
|
|
|
4797
5037
|
}), this.onDidDimensionsChange((event) => {
|
|
4798
5038
|
this._width = event.width;
|
|
4799
5039
|
this._height = event.height;
|
|
4800
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this.
|
|
5040
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
|
|
4801
5041
|
}
|
|
4802
5042
|
initialize(panel) {
|
|
4803
5043
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
@@ -4807,7 +5047,7 @@
|
|
|
4807
5047
|
});
|
|
4808
5048
|
}
|
|
4809
5049
|
setVisible(isVisible) {
|
|
4810
|
-
this.
|
|
5050
|
+
this._onWillVisibilityChange.fire({ isVisible });
|
|
4811
5051
|
}
|
|
4812
5052
|
setActive() {
|
|
4813
5053
|
this._onActiveChange.fire();
|
|
@@ -4815,9 +5055,6 @@
|
|
|
4815
5055
|
updateParameters(parameters) {
|
|
4816
5056
|
this._onUpdateParameters.fire(parameters);
|
|
4817
5057
|
}
|
|
4818
|
-
dispose() {
|
|
4819
|
-
super.dispose();
|
|
4820
|
-
}
|
|
4821
5058
|
}
|
|
4822
5059
|
|
|
4823
5060
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
@@ -4905,7 +5142,12 @@
|
|
|
4905
5142
|
}), focusTracker);
|
|
4906
5143
|
}
|
|
4907
5144
|
focus() {
|
|
4908
|
-
|
|
5145
|
+
const event = new WillFocusEvent();
|
|
5146
|
+
this.api._onWillFocus.fire(event);
|
|
5147
|
+
if (event.defaultPrevented) {
|
|
5148
|
+
return;
|
|
5149
|
+
}
|
|
5150
|
+
this._element.focus();
|
|
4909
5151
|
}
|
|
4910
5152
|
layout(width, height) {
|
|
4911
5153
|
this._width = width;
|
|
@@ -5023,7 +5265,11 @@
|
|
|
5023
5265
|
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
5024
5266
|
this._orientation = orientation;
|
|
5025
5267
|
this.element.classList.add('pane');
|
|
5026
|
-
this.addDisposables(this.api.
|
|
5268
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
5269
|
+
const { isVisible } = event;
|
|
5270
|
+
const { accessor } = this._params;
|
|
5271
|
+
accessor.setVisible(this, isVisible);
|
|
5272
|
+
}), this.api.onDidSizeChange((event) => {
|
|
5027
5273
|
this._onDidChange.fire({ size: event.size });
|
|
5028
5274
|
}), addDisposableListener(this.element, 'mouseenter', (ev) => {
|
|
5029
5275
|
this.api._onMouseEnter.fire(ev);
|
|
@@ -5234,9 +5480,7 @@
|
|
|
5234
5480
|
super(id);
|
|
5235
5481
|
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5236
5482
|
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5237
|
-
this._onDidConstraintsChange = new Emitter(
|
|
5238
|
-
replay: true,
|
|
5239
|
-
});
|
|
5483
|
+
this._onDidConstraintsChange = new Emitter();
|
|
5240
5484
|
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
5241
5485
|
this._onDidSizeChange = new Emitter();
|
|
5242
5486
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
@@ -5329,13 +5573,13 @@
|
|
|
5329
5573
|
this._maximumHeight = options.maximumHeight;
|
|
5330
5574
|
}
|
|
5331
5575
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
5332
|
-
this.addDisposables(this.api.
|
|
5576
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
5333
5577
|
const { isVisible } = event;
|
|
5334
5578
|
const { accessor } = this._params;
|
|
5335
5579
|
accessor.setVisible(this, isVisible);
|
|
5336
5580
|
}), this.api.onActiveChange(() => {
|
|
5337
5581
|
const { accessor } = this._params;
|
|
5338
|
-
accessor.
|
|
5582
|
+
accessor.doSetGroupActive(this);
|
|
5339
5583
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
5340
5584
|
if (typeof event.minimumWidth === 'number' ||
|
|
5341
5585
|
typeof event.minimumWidth === 'function') {
|
|
@@ -5418,6 +5662,17 @@
|
|
|
5418
5662
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5419
5663
|
this.addDisposables(this._onDidLocationChange);
|
|
5420
5664
|
}
|
|
5665
|
+
close() {
|
|
5666
|
+
if (!this._group) {
|
|
5667
|
+
return;
|
|
5668
|
+
}
|
|
5669
|
+
return this.accessor.removeGroup(this._group);
|
|
5670
|
+
}
|
|
5671
|
+
getWindow() {
|
|
5672
|
+
return this.location.type === 'popout'
|
|
5673
|
+
? this.location.getWindow()
|
|
5674
|
+
: window;
|
|
5675
|
+
}
|
|
5421
5676
|
moveTo(options) {
|
|
5422
5677
|
var _a, _b, _c;
|
|
5423
5678
|
if (!this._group) {
|
|
@@ -5425,14 +5680,23 @@
|
|
|
5425
5680
|
}
|
|
5426
5681
|
const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
|
|
5427
5682
|
direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
|
|
5683
|
+
skipSetActive: true,
|
|
5684
|
+
});
|
|
5685
|
+
this.accessor.moveGroupOrPanel({
|
|
5686
|
+
from: { groupId: this._group.id },
|
|
5687
|
+
to: {
|
|
5688
|
+
group,
|
|
5689
|
+
position: options.group
|
|
5690
|
+
? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
|
|
5691
|
+
: 'center',
|
|
5692
|
+
},
|
|
5428
5693
|
});
|
|
5429
|
-
this.accessor.moveGroupOrPanel(group, this._group.id, undefined, options.group ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center' : 'center');
|
|
5430
5694
|
}
|
|
5431
5695
|
maximize() {
|
|
5432
5696
|
if (!this._group) {
|
|
5433
5697
|
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5434
5698
|
}
|
|
5435
|
-
if (this.location !== 'grid') {
|
|
5699
|
+
if (this.location.type !== 'grid') {
|
|
5436
5700
|
// only grid groups can be maximized
|
|
5437
5701
|
return;
|
|
5438
5702
|
}
|
|
@@ -5489,6 +5753,12 @@
|
|
|
5489
5753
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
5490
5754
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
5491
5755
|
}
|
|
5756
|
+
focus() {
|
|
5757
|
+
if (!this.api.isActive) {
|
|
5758
|
+
this.api.setActive();
|
|
5759
|
+
}
|
|
5760
|
+
super.focus();
|
|
5761
|
+
}
|
|
5492
5762
|
initialize() {
|
|
5493
5763
|
this._model.initialize();
|
|
5494
5764
|
}
|
|
@@ -5534,6 +5804,9 @@
|
|
|
5534
5804
|
}
|
|
5535
5805
|
|
|
5536
5806
|
class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
5807
|
+
get location() {
|
|
5808
|
+
return this.group.api.location;
|
|
5809
|
+
}
|
|
5537
5810
|
get title() {
|
|
5538
5811
|
return this.panel.title;
|
|
5539
5812
|
}
|
|
@@ -5544,16 +5817,14 @@
|
|
|
5544
5817
|
return this.panel.renderer;
|
|
5545
5818
|
}
|
|
5546
5819
|
set group(value) {
|
|
5547
|
-
const
|
|
5548
|
-
this._group
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
this.
|
|
5552
|
-
|
|
5820
|
+
const oldGroup = this._group;
|
|
5821
|
+
if (this._group !== value) {
|
|
5822
|
+
this._group = value;
|
|
5823
|
+
this._onDidGroupChange.fire({});
|
|
5824
|
+
this.setupGroupEventListeners(oldGroup);
|
|
5825
|
+
this._onDidLocationChange.fire({
|
|
5826
|
+
location: this.group.api.location,
|
|
5553
5827
|
});
|
|
5554
|
-
if (this.isGroupActive !== isOldGroupActive) {
|
|
5555
|
-
this._onDidActiveGroupChange.fire();
|
|
5556
|
-
}
|
|
5557
5828
|
}
|
|
5558
5829
|
}
|
|
5559
5830
|
get group() {
|
|
@@ -5571,14 +5842,27 @@
|
|
|
5571
5842
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
5572
5843
|
this._onDidRendererChange = new Emitter();
|
|
5573
5844
|
this.onDidRendererChange = this._onDidRendererChange.event;
|
|
5574
|
-
this.
|
|
5845
|
+
this._onDidLocationChange = new Emitter();
|
|
5846
|
+
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5847
|
+
this.groupEventsDisposable = new MutableDisposable();
|
|
5575
5848
|
this.initialize(panel);
|
|
5576
5849
|
this._group = group;
|
|
5577
|
-
this.
|
|
5850
|
+
this.setupGroupEventListeners();
|
|
5851
|
+
this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
|
|
5852
|
+
}
|
|
5853
|
+
getWindow() {
|
|
5854
|
+
return this.group.api.getWindow();
|
|
5578
5855
|
}
|
|
5579
5856
|
moveTo(options) {
|
|
5580
5857
|
var _a;
|
|
5581
|
-
this.accessor.moveGroupOrPanel(
|
|
5858
|
+
this.accessor.moveGroupOrPanel({
|
|
5859
|
+
from: { groupId: this._group.id, panelId: this.panel.id },
|
|
5860
|
+
to: {
|
|
5861
|
+
group: options.group,
|
|
5862
|
+
position: (_a = options.position) !== null && _a !== void 0 ? _a : 'center',
|
|
5863
|
+
index: options.index,
|
|
5864
|
+
},
|
|
5865
|
+
});
|
|
5582
5866
|
}
|
|
5583
5867
|
setTitle(title) {
|
|
5584
5868
|
this.panel.setTitle(title);
|
|
@@ -5598,6 +5882,35 @@
|
|
|
5598
5882
|
exitMaximized() {
|
|
5599
5883
|
this.group.api.exitMaximized();
|
|
5600
5884
|
}
|
|
5885
|
+
setupGroupEventListeners(previousGroup) {
|
|
5886
|
+
var _a;
|
|
5887
|
+
let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
|
|
5888
|
+
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
|
|
5889
|
+
if (!event.isVisible && this.isVisible) {
|
|
5890
|
+
this._onDidVisibilityChange.fire(event);
|
|
5891
|
+
}
|
|
5892
|
+
else if (event.isVisible &&
|
|
5893
|
+
!this.isVisible &&
|
|
5894
|
+
this.group.model.isPanelActive(this.panel)) {
|
|
5895
|
+
this._onDidVisibilityChange.fire(event);
|
|
5896
|
+
}
|
|
5897
|
+
}), this.group.api.onDidLocationChange((event) => {
|
|
5898
|
+
if (this.group !== this.panel.group) {
|
|
5899
|
+
return;
|
|
5900
|
+
}
|
|
5901
|
+
this._onDidLocationChange.fire(event);
|
|
5902
|
+
}), this.group.api.onDidActiveChange(() => {
|
|
5903
|
+
if (this.group !== this.panel.group) {
|
|
5904
|
+
return;
|
|
5905
|
+
}
|
|
5906
|
+
if (_trackGroupActive !== this.isGroupActive) {
|
|
5907
|
+
_trackGroupActive = this.isGroupActive;
|
|
5908
|
+
this._onDidActiveGroupChange.fire({
|
|
5909
|
+
isActive: this.isGroupActive,
|
|
5910
|
+
});
|
|
5911
|
+
}
|
|
5912
|
+
}));
|
|
5913
|
+
}
|
|
5601
5914
|
}
|
|
5602
5915
|
|
|
5603
5916
|
class DockviewPanel extends CompositeDisposable {
|
|
@@ -5639,7 +5952,14 @@
|
|
|
5639
5952
|
this.setTitle(params.title);
|
|
5640
5953
|
}
|
|
5641
5954
|
focus() {
|
|
5642
|
-
|
|
5955
|
+
const event = new WillFocusEvent();
|
|
5956
|
+
this.api._onWillFocus.fire(event);
|
|
5957
|
+
if (event.defaultPrevented) {
|
|
5958
|
+
return;
|
|
5959
|
+
}
|
|
5960
|
+
if (!this.api.isActive) {
|
|
5961
|
+
this.api.setActive();
|
|
5962
|
+
}
|
|
5643
5963
|
}
|
|
5644
5964
|
toJSON() {
|
|
5645
5965
|
return {
|
|
@@ -5696,24 +6016,44 @@
|
|
|
5696
6016
|
},
|
|
5697
6017
|
});
|
|
5698
6018
|
}
|
|
5699
|
-
updateParentGroup(group,
|
|
6019
|
+
updateParentGroup(group, options) {
|
|
5700
6020
|
this._group = group;
|
|
5701
|
-
this.api.group =
|
|
6021
|
+
this.api.group = this._group;
|
|
5702
6022
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
5703
|
-
this.api.
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
6023
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6024
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetActive)) {
|
|
6025
|
+
if (this.api.isActive !== isActive) {
|
|
6026
|
+
this.api._onDidActiveChange.fire({
|
|
6027
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6028
|
+
});
|
|
6029
|
+
}
|
|
6030
|
+
}
|
|
6031
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6032
|
+
this.api._onDidVisibilityChange.fire({
|
|
6033
|
+
isVisible: isPanelVisible,
|
|
6034
|
+
});
|
|
6035
|
+
}
|
|
5710
6036
|
}
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
this.api.
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
6037
|
+
runEvents() {
|
|
6038
|
+
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
6039
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6040
|
+
if (this.api.isActive !== isActive) {
|
|
6041
|
+
this.api._onDidActiveChange.fire({
|
|
6042
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6043
|
+
});
|
|
6044
|
+
}
|
|
6045
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6046
|
+
this.api._onDidVisibilityChange.fire({
|
|
6047
|
+
isVisible: isPanelVisible,
|
|
6048
|
+
});
|
|
6049
|
+
}
|
|
6050
|
+
}
|
|
6051
|
+
layout(width, height) {
|
|
6052
|
+
// TODO: Can we somehow do height without header height or indicate what the header height is?
|
|
6053
|
+
this.api._onDidDimensionChange.fire({
|
|
6054
|
+
width,
|
|
6055
|
+
height: height,
|
|
6056
|
+
});
|
|
5717
6057
|
this.view.layout(width, height);
|
|
5718
6058
|
}
|
|
5719
6059
|
dispose() {
|
|
@@ -5831,8 +6171,6 @@
|
|
|
5831
6171
|
this.id = id;
|
|
5832
6172
|
this.contentComponent = contentComponent;
|
|
5833
6173
|
this.tabComponent = tabComponent;
|
|
5834
|
-
this._group = null;
|
|
5835
|
-
this._isPanelVisible = null;
|
|
5836
6174
|
this._content = this.createContentComponent(this.id, contentComponent);
|
|
5837
6175
|
this._tab = this.createTabComponent(this.id, tabComponent);
|
|
5838
6176
|
}
|
|
@@ -5840,25 +6178,8 @@
|
|
|
5840
6178
|
this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
|
|
5841
6179
|
this.tab.init(params);
|
|
5842
6180
|
}
|
|
5843
|
-
updateParentGroup(
|
|
5844
|
-
|
|
5845
|
-
this._group = group;
|
|
5846
|
-
if (this._content.onGroupChange) {
|
|
5847
|
-
this._content.onGroupChange(group);
|
|
5848
|
-
}
|
|
5849
|
-
if (this._tab.onGroupChange) {
|
|
5850
|
-
this._tab.onGroupChange(group);
|
|
5851
|
-
}
|
|
5852
|
-
}
|
|
5853
|
-
if (isPanelVisible !== this._isPanelVisible) {
|
|
5854
|
-
this._isPanelVisible = isPanelVisible;
|
|
5855
|
-
if (this._content.onPanelVisibleChange) {
|
|
5856
|
-
this._content.onPanelVisibleChange(isPanelVisible);
|
|
5857
|
-
}
|
|
5858
|
-
if (this._tab.onPanelVisibleChange) {
|
|
5859
|
-
this._tab.onPanelVisibleChange(isPanelVisible);
|
|
5860
|
-
}
|
|
5861
|
-
}
|
|
6181
|
+
updateParentGroup(_group, _isPanelVisible) {
|
|
6182
|
+
// noop
|
|
5862
6183
|
}
|
|
5863
6184
|
layout(width, height) {
|
|
5864
6185
|
var _a, _b;
|
|
@@ -6291,117 +6612,6 @@
|
|
|
6291
6612
|
}
|
|
6292
6613
|
}
|
|
6293
6614
|
|
|
6294
|
-
class PopoutWindow extends CompositeDisposable {
|
|
6295
|
-
constructor(id, className, options) {
|
|
6296
|
-
super();
|
|
6297
|
-
this.id = id;
|
|
6298
|
-
this.className = className;
|
|
6299
|
-
this.options = options;
|
|
6300
|
-
this._onDidClose = new Emitter();
|
|
6301
|
-
this.onDidClose = this._onDidClose.event;
|
|
6302
|
-
this._window = null;
|
|
6303
|
-
this.addDisposables(this._onDidClose, {
|
|
6304
|
-
dispose: () => {
|
|
6305
|
-
this.close();
|
|
6306
|
-
},
|
|
6307
|
-
});
|
|
6308
|
-
}
|
|
6309
|
-
dimensions() {
|
|
6310
|
-
if (!this._window) {
|
|
6311
|
-
return null;
|
|
6312
|
-
}
|
|
6313
|
-
const left = this._window.value.screenX;
|
|
6314
|
-
const top = this._window.value.screenY;
|
|
6315
|
-
const width = this._window.value.innerWidth;
|
|
6316
|
-
const height = this._window.value.innerHeight;
|
|
6317
|
-
return { top, left, width, height };
|
|
6318
|
-
}
|
|
6319
|
-
close() {
|
|
6320
|
-
if (this._window) {
|
|
6321
|
-
this._window.disposable.dispose();
|
|
6322
|
-
this._window.value.close();
|
|
6323
|
-
this._window = null;
|
|
6324
|
-
}
|
|
6325
|
-
}
|
|
6326
|
-
open(content) {
|
|
6327
|
-
if (this._window) {
|
|
6328
|
-
throw new Error('instance of popout window is already open');
|
|
6329
|
-
}
|
|
6330
|
-
const url = `${this.options.url}`;
|
|
6331
|
-
const features = Object.entries({
|
|
6332
|
-
top: this.options.top,
|
|
6333
|
-
left: this.options.left,
|
|
6334
|
-
width: this.options.width,
|
|
6335
|
-
height: this.options.height,
|
|
6336
|
-
})
|
|
6337
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
6338
|
-
.join(',');
|
|
6339
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6340
|
-
const externalWindow = window.open(url, this.id, features);
|
|
6341
|
-
if (!externalWindow) {
|
|
6342
|
-
return;
|
|
6343
|
-
}
|
|
6344
|
-
const disposable = new CompositeDisposable();
|
|
6345
|
-
this._window = { value: externalWindow, disposable };
|
|
6346
|
-
const cleanUp = () => {
|
|
6347
|
-
this._onDidClose.fire();
|
|
6348
|
-
this._window = null;
|
|
6349
|
-
};
|
|
6350
|
-
// prevent any default content from loading
|
|
6351
|
-
// externalWindow.document.body.replaceWith(document.createElement('div'));
|
|
6352
|
-
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6353
|
-
cleanUp();
|
|
6354
|
-
this.close();
|
|
6355
|
-
}));
|
|
6356
|
-
externalWindow.addEventListener('load', () => {
|
|
6357
|
-
const externalDocument = externalWindow.document;
|
|
6358
|
-
externalDocument.title = document.title;
|
|
6359
|
-
const div = document.createElement('div');
|
|
6360
|
-
div.classList.add('dv-popout-window');
|
|
6361
|
-
div.style.position = 'absolute';
|
|
6362
|
-
div.style.width = '100%';
|
|
6363
|
-
div.style.height = '100%';
|
|
6364
|
-
div.style.top = '0px';
|
|
6365
|
-
div.style.left = '0px';
|
|
6366
|
-
div.classList.add(this.className);
|
|
6367
|
-
div.appendChild(content);
|
|
6368
|
-
externalDocument.body.replaceChildren(div);
|
|
6369
|
-
externalDocument.body.classList.add(this.className);
|
|
6370
|
-
addStyles(externalDocument, window.document.styleSheets);
|
|
6371
|
-
externalWindow.addEventListener('beforeunload', () => {
|
|
6372
|
-
// TODO: indicate external window is closing
|
|
6373
|
-
cleanUp();
|
|
6374
|
-
});
|
|
6375
|
-
});
|
|
6376
|
-
}
|
|
6377
|
-
}
|
|
6378
|
-
|
|
6379
|
-
class DockviewPopoutGroupPanel extends CompositeDisposable {
|
|
6380
|
-
constructor(id, group, options) {
|
|
6381
|
-
var _a;
|
|
6382
|
-
super();
|
|
6383
|
-
this.id = id;
|
|
6384
|
-
this.group = group;
|
|
6385
|
-
this.options = options;
|
|
6386
|
-
this.window = new PopoutWindow(id, (_a = options.className) !== null && _a !== void 0 ? _a : '', {
|
|
6387
|
-
url: this.options.popoutUrl,
|
|
6388
|
-
left: this.options.box.left,
|
|
6389
|
-
top: this.options.box.top,
|
|
6390
|
-
width: this.options.box.width,
|
|
6391
|
-
height: this.options.box.height,
|
|
6392
|
-
});
|
|
6393
|
-
group.model.location = 'popout';
|
|
6394
|
-
this.addDisposables(this.window, {
|
|
6395
|
-
dispose: () => {
|
|
6396
|
-
group.model.location = 'grid';
|
|
6397
|
-
},
|
|
6398
|
-
}, this.window.onDidClose(() => {
|
|
6399
|
-
this.dispose();
|
|
6400
|
-
}));
|
|
6401
|
-
this.window.open(group.element);
|
|
6402
|
-
}
|
|
6403
|
-
}
|
|
6404
|
-
|
|
6405
6615
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6406
6616
|
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6407
6617
|
|
|
@@ -6415,11 +6625,13 @@
|
|
|
6415
6625
|
super();
|
|
6416
6626
|
this.element = element;
|
|
6417
6627
|
this.map = {};
|
|
6628
|
+
this._disposed = false;
|
|
6418
6629
|
this.addDisposables(Disposable.from(() => {
|
|
6419
6630
|
for (const value of Object.values(this.map)) {
|
|
6420
6631
|
value.disposable.dispose();
|
|
6421
6632
|
value.destroy.dispose();
|
|
6422
6633
|
}
|
|
6634
|
+
this._disposed = true;
|
|
6423
6635
|
}));
|
|
6424
6636
|
}
|
|
6425
6637
|
detatch(panel) {
|
|
@@ -6459,7 +6671,7 @@
|
|
|
6459
6671
|
focusContainer.style.top = `${box.top - box2.top}px`;
|
|
6460
6672
|
focusContainer.style.width = `${box.width}px`;
|
|
6461
6673
|
focusContainer.style.height = `${box.height}px`;
|
|
6462
|
-
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location === 'floating');
|
|
6674
|
+
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
|
|
6463
6675
|
};
|
|
6464
6676
|
const visibilityChanged = () => {
|
|
6465
6677
|
if (panel.api.isVisible) {
|
|
@@ -6505,8 +6717,11 @@
|
|
|
6505
6717
|
resize();
|
|
6506
6718
|
}));
|
|
6507
6719
|
this.map[panel.api.id].destroy = Disposable.from(() => {
|
|
6508
|
-
|
|
6509
|
-
|
|
6720
|
+
var _a;
|
|
6721
|
+
if (panel.view.content.element.parentElement === focusContainer) {
|
|
6722
|
+
focusContainer.removeChild(panel.view.content.element);
|
|
6723
|
+
}
|
|
6724
|
+
(_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
|
|
6510
6725
|
});
|
|
6511
6726
|
queueMicrotask(() => {
|
|
6512
6727
|
if (this.isDisposed) {
|
|
@@ -6527,11 +6742,164 @@
|
|
|
6527
6742
|
}
|
|
6528
6743
|
}
|
|
6529
6744
|
|
|
6745
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6746
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6747
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6748
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6749
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6750
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6751
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6752
|
+
});
|
|
6753
|
+
};
|
|
6754
|
+
class PopoutWindow extends CompositeDisposable {
|
|
6755
|
+
get window() {
|
|
6756
|
+
var _a, _b;
|
|
6757
|
+
return (_b = (_a = this._window) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;
|
|
6758
|
+
}
|
|
6759
|
+
constructor(target, className, options) {
|
|
6760
|
+
super();
|
|
6761
|
+
this.target = target;
|
|
6762
|
+
this.className = className;
|
|
6763
|
+
this.options = options;
|
|
6764
|
+
this._onWillClose = new Emitter();
|
|
6765
|
+
this.onWillClose = this._onWillClose.event;
|
|
6766
|
+
this._onDidClose = new Emitter();
|
|
6767
|
+
this.onDidClose = this._onDidClose.event;
|
|
6768
|
+
this._window = null;
|
|
6769
|
+
this.addDisposables(this._onWillClose, this._onDidClose, {
|
|
6770
|
+
dispose: () => {
|
|
6771
|
+
this.close();
|
|
6772
|
+
},
|
|
6773
|
+
});
|
|
6774
|
+
}
|
|
6775
|
+
dimensions() {
|
|
6776
|
+
if (!this._window) {
|
|
6777
|
+
return null;
|
|
6778
|
+
}
|
|
6779
|
+
const left = this._window.value.screenX;
|
|
6780
|
+
const top = this._window.value.screenY;
|
|
6781
|
+
const width = this._window.value.innerWidth;
|
|
6782
|
+
const height = this._window.value.innerHeight;
|
|
6783
|
+
return { top, left, width, height };
|
|
6784
|
+
}
|
|
6785
|
+
close() {
|
|
6786
|
+
var _a, _b;
|
|
6787
|
+
if (this._window) {
|
|
6788
|
+
this._onWillClose.fire();
|
|
6789
|
+
(_b = (_a = this.options).onWillClose) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6790
|
+
id: this.target,
|
|
6791
|
+
window: this._window.value,
|
|
6792
|
+
});
|
|
6793
|
+
this._window.disposable.dispose();
|
|
6794
|
+
this._window.value.close();
|
|
6795
|
+
this._window = null;
|
|
6796
|
+
this._onDidClose.fire();
|
|
6797
|
+
}
|
|
6798
|
+
}
|
|
6799
|
+
open() {
|
|
6800
|
+
var _a, _b;
|
|
6801
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6802
|
+
if (this._window) {
|
|
6803
|
+
throw new Error('instance of popout window is already open');
|
|
6804
|
+
}
|
|
6805
|
+
const url = `${this.options.url}`;
|
|
6806
|
+
const features = Object.entries({
|
|
6807
|
+
top: this.options.top,
|
|
6808
|
+
left: this.options.left,
|
|
6809
|
+
width: this.options.width,
|
|
6810
|
+
height: this.options.height,
|
|
6811
|
+
})
|
|
6812
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
6813
|
+
.join(',');
|
|
6814
|
+
/**
|
|
6815
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6816
|
+
*/
|
|
6817
|
+
const externalWindow = window.open(url, this.target, features);
|
|
6818
|
+
if (!externalWindow) {
|
|
6819
|
+
/**
|
|
6820
|
+
* Popup blocked
|
|
6821
|
+
*/
|
|
6822
|
+
return null;
|
|
6823
|
+
}
|
|
6824
|
+
const disposable = new CompositeDisposable();
|
|
6825
|
+
this._window = { value: externalWindow, disposable };
|
|
6826
|
+
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6827
|
+
/**
|
|
6828
|
+
* before the main window closes we should close this popup too
|
|
6829
|
+
* to be good citizens
|
|
6830
|
+
*
|
|
6831
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6832
|
+
*/
|
|
6833
|
+
this.close();
|
|
6834
|
+
}));
|
|
6835
|
+
const container = this.createPopoutWindowContainer();
|
|
6836
|
+
if (this.className) {
|
|
6837
|
+
container.classList.add(this.className);
|
|
6838
|
+
}
|
|
6839
|
+
(_b = (_a = this.options).onDidOpen) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6840
|
+
id: this.target,
|
|
6841
|
+
window: externalWindow,
|
|
6842
|
+
});
|
|
6843
|
+
return new Promise((resolve) => {
|
|
6844
|
+
externalWindow.addEventListener('unload', (e) => {
|
|
6845
|
+
// if page fails to load before unloading
|
|
6846
|
+
// this.close();
|
|
6847
|
+
});
|
|
6848
|
+
externalWindow.addEventListener('load', () => {
|
|
6849
|
+
/**
|
|
6850
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
|
|
6851
|
+
*/
|
|
6852
|
+
const externalDocument = externalWindow.document;
|
|
6853
|
+
externalDocument.title = document.title;
|
|
6854
|
+
externalDocument.body.appendChild(container);
|
|
6855
|
+
addStyles(externalDocument, window.document.styleSheets);
|
|
6856
|
+
/**
|
|
6857
|
+
* beforeunload must be registered after load for reasons I could not determine
|
|
6858
|
+
* otherwise the beforeunload event will not fire when the window is closed
|
|
6859
|
+
*/
|
|
6860
|
+
addDisposableWindowListener(externalWindow, 'beforeunload', () => {
|
|
6861
|
+
/**
|
|
6862
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6863
|
+
*/
|
|
6864
|
+
this.close();
|
|
6865
|
+
});
|
|
6866
|
+
resolve(container);
|
|
6867
|
+
});
|
|
6868
|
+
});
|
|
6869
|
+
});
|
|
6870
|
+
}
|
|
6871
|
+
createPopoutWindowContainer() {
|
|
6872
|
+
const el = document.createElement('div');
|
|
6873
|
+
el.classList.add('dv-popout-window');
|
|
6874
|
+
el.id = 'dv-popout-window';
|
|
6875
|
+
el.style.position = 'absolute';
|
|
6876
|
+
el.style.width = '100%';
|
|
6877
|
+
el.style.height = '100%';
|
|
6878
|
+
el.style.top = '0px';
|
|
6879
|
+
el.style.left = '0px';
|
|
6880
|
+
return el;
|
|
6881
|
+
}
|
|
6882
|
+
}
|
|
6883
|
+
|
|
6530
6884
|
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6531
6885
|
activationSize: { type: 'pixels', value: 10 },
|
|
6532
6886
|
size: { type: 'pixels', value: 20 },
|
|
6533
6887
|
};
|
|
6534
|
-
function
|
|
6888
|
+
function moveGroupWithoutDestroying(options) {
|
|
6889
|
+
const activePanel = options.from.activePanel;
|
|
6890
|
+
const panels = [...options.from.panels].map((panel) => {
|
|
6891
|
+
const removedPanel = options.from.model.removePanel(panel);
|
|
6892
|
+
options.from.model.renderContainer.detatch(panel);
|
|
6893
|
+
return removedPanel;
|
|
6894
|
+
});
|
|
6895
|
+
panels.forEach((panel) => {
|
|
6896
|
+
options.to.model.openPanel(panel, {
|
|
6897
|
+
skipSetActive: activePanel !== panel,
|
|
6898
|
+
skipSetGroupActive: true,
|
|
6899
|
+
});
|
|
6900
|
+
});
|
|
6901
|
+
}
|
|
6902
|
+
function getDockviewTheme(element) {
|
|
6535
6903
|
function toClassList(element) {
|
|
6536
6904
|
const list = [];
|
|
6537
6905
|
for (let i = 0; i < element.classList.length; i++) {
|
|
@@ -6582,6 +6950,7 @@
|
|
|
6582
6950
|
styles: options.styles,
|
|
6583
6951
|
parentElement: options.parentElement,
|
|
6584
6952
|
disableAutoResizing: options.disableAutoResizing,
|
|
6953
|
+
locked: options.locked,
|
|
6585
6954
|
});
|
|
6586
6955
|
this.nextGroupId = sequentialNumberGenerator();
|
|
6587
6956
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -6592,6 +6961,10 @@
|
|
|
6592
6961
|
this.onWillDragGroup = this._onWillDragGroup.event;
|
|
6593
6962
|
this._onDidDrop = new Emitter();
|
|
6594
6963
|
this.onDidDrop = this._onDidDrop.event;
|
|
6964
|
+
this._onWillDrop = new Emitter();
|
|
6965
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
6966
|
+
this._onWillShowOverlay = new Emitter();
|
|
6967
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
6595
6968
|
this._onDidRemovePanel = new Emitter();
|
|
6596
6969
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
6597
6970
|
this._onDidAddPanel = new Emitter();
|
|
@@ -6600,15 +6973,36 @@
|
|
|
6600
6973
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
6601
6974
|
this._onDidActivePanelChange = new Emitter();
|
|
6602
6975
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
6976
|
+
this._onDidMovePanel = new Emitter();
|
|
6603
6977
|
this._floatingGroups = [];
|
|
6604
6978
|
this._popoutGroups = [];
|
|
6979
|
+
this._ignoreEvents = 0;
|
|
6980
|
+
this._onDidRemoveGroup = new Emitter();
|
|
6981
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
6982
|
+
this._onDidAddGroup = new Emitter();
|
|
6983
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
6984
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
6985
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
6986
|
+
this._moving = false;
|
|
6605
6987
|
const gready = document.createElement('div');
|
|
6606
6988
|
gready.className = 'dv-overlay-render-container';
|
|
6607
6989
|
this.gridview.element.appendChild(gready);
|
|
6608
6990
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
6609
6991
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
6610
6992
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
6611
|
-
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop,
|
|
6993
|
+
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) => {
|
|
6994
|
+
if (!this._moving) {
|
|
6995
|
+
this._onDidAddGroup.fire(event);
|
|
6996
|
+
}
|
|
6997
|
+
}), this.onDidRemove((event) => {
|
|
6998
|
+
if (!this._moving) {
|
|
6999
|
+
this._onDidRemoveGroup.fire(event);
|
|
7000
|
+
}
|
|
7001
|
+
}), this.onDidActiveChange((event) => {
|
|
7002
|
+
if (!this._moving) {
|
|
7003
|
+
this._onDidActiveGroupChange.fire(event);
|
|
7004
|
+
}
|
|
7005
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
6612
7006
|
this.updateWatermark();
|
|
6613
7007
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
6614
7008
|
this._bufferOnDidLayoutChange.fire();
|
|
@@ -6619,7 +7013,7 @@
|
|
|
6619
7013
|
}
|
|
6620
7014
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6621
7015
|
for (const group of [...this._popoutGroups]) {
|
|
6622
|
-
group.dispose();
|
|
7016
|
+
group.disposable.dispose();
|
|
6623
7017
|
}
|
|
6624
7018
|
}));
|
|
6625
7019
|
this._options = options;
|
|
@@ -6665,7 +7059,7 @@
|
|
|
6665
7059
|
return this.options.showDndOverlay({
|
|
6666
7060
|
nativeEvent: event,
|
|
6667
7061
|
position: position,
|
|
6668
|
-
target:
|
|
7062
|
+
target: 'edge',
|
|
6669
7063
|
getData: getPanelData,
|
|
6670
7064
|
});
|
|
6671
7065
|
}
|
|
@@ -6674,88 +7068,259 @@
|
|
|
6674
7068
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
6675
7069
|
overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
6676
7070
|
});
|
|
6677
|
-
this.addDisposables(this._rootDropTarget.
|
|
7071
|
+
this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
|
|
7072
|
+
if (this.gridview.length > 0 && event.position === 'center') {
|
|
7073
|
+
// option only available when no panels in primary grid
|
|
7074
|
+
return;
|
|
7075
|
+
}
|
|
7076
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
7077
|
+
kind: 'edge',
|
|
7078
|
+
}));
|
|
7079
|
+
}), this._rootDropTarget.onDrop((event) => {
|
|
6678
7080
|
var _a;
|
|
7081
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
7082
|
+
nativeEvent: event.nativeEvent,
|
|
7083
|
+
position: event.position,
|
|
7084
|
+
panel: undefined,
|
|
7085
|
+
api: this._api,
|
|
7086
|
+
group: undefined,
|
|
7087
|
+
getData: getPanelData,
|
|
7088
|
+
kind: 'edge',
|
|
7089
|
+
});
|
|
7090
|
+
this._onWillDrop.fire(willDropEvent);
|
|
7091
|
+
if (willDropEvent.defaultPrevented) {
|
|
7092
|
+
return;
|
|
7093
|
+
}
|
|
6679
7094
|
const data = getPanelData();
|
|
6680
7095
|
if (data) {
|
|
6681
|
-
this.moveGroupOrPanel(
|
|
7096
|
+
this.moveGroupOrPanel({
|
|
7097
|
+
from: {
|
|
7098
|
+
groupId: data.groupId,
|
|
7099
|
+
panelId: (_a = data.panelId) !== null && _a !== void 0 ? _a : undefined,
|
|
7100
|
+
},
|
|
7101
|
+
to: {
|
|
7102
|
+
group: this.orthogonalize(event.position),
|
|
7103
|
+
position: 'center',
|
|
7104
|
+
},
|
|
7105
|
+
});
|
|
6682
7106
|
}
|
|
6683
7107
|
else {
|
|
6684
|
-
this._onDidDrop.fire(
|
|
7108
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
7109
|
+
nativeEvent: event.nativeEvent,
|
|
7110
|
+
position: event.position,
|
|
7111
|
+
panel: undefined,
|
|
7112
|
+
api: this._api,
|
|
7113
|
+
group: undefined,
|
|
7114
|
+
getData: getPanelData,
|
|
7115
|
+
}));
|
|
6685
7116
|
}
|
|
6686
7117
|
}), this._rootDropTarget);
|
|
6687
7118
|
this._api = new DockviewApi(this);
|
|
6688
7119
|
this.updateWatermark();
|
|
6689
7120
|
}
|
|
6690
|
-
addPopoutGroup(
|
|
6691
|
-
var _a;
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
7121
|
+
addPopoutGroup(itemToPopout, options) {
|
|
7122
|
+
var _a, _b, _c;
|
|
7123
|
+
if (itemToPopout instanceof DockviewPanel &&
|
|
7124
|
+
itemToPopout.group.size === 1) {
|
|
7125
|
+
return this.addPopoutGroup(itemToPopout.group);
|
|
7126
|
+
}
|
|
7127
|
+
const theme = getDockviewTheme(this.gridview.element);
|
|
7128
|
+
const element = this.element;
|
|
7129
|
+
function getBox() {
|
|
7130
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7131
|
+
return options.position;
|
|
7132
|
+
}
|
|
7133
|
+
if (itemToPopout instanceof DockviewGroupPanel) {
|
|
7134
|
+
return itemToPopout.element.getBoundingClientRect();
|
|
7135
|
+
}
|
|
7136
|
+
if (itemToPopout.group) {
|
|
7137
|
+
return itemToPopout.group.element.getBoundingClientRect();
|
|
7138
|
+
}
|
|
7139
|
+
return element.getBoundingClientRect();
|
|
7140
|
+
}
|
|
7141
|
+
const box = getBox();
|
|
7142
|
+
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;
|
|
7143
|
+
if (itemToPopout.api.location.type === 'grid') {
|
|
7144
|
+
itemToPopout.api.setVisible(false);
|
|
7145
|
+
}
|
|
7146
|
+
const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
|
|
7147
|
+
theme !== null && theme !== void 0 ? theme : '', {
|
|
7148
|
+
url: (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : '/popout.html',
|
|
7149
|
+
left: window.screenX + box.left,
|
|
7150
|
+
top: window.screenY + box.top,
|
|
7151
|
+
width: box.width,
|
|
7152
|
+
height: box.height,
|
|
7153
|
+
onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
|
|
7154
|
+
onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
|
|
7155
|
+
});
|
|
7156
|
+
const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
|
|
7157
|
+
popoutWindowDisposable.dispose();
|
|
7158
|
+
}));
|
|
7159
|
+
return _window
|
|
7160
|
+
.open()
|
|
7161
|
+
.then((popoutContainer) => {
|
|
7162
|
+
var _a;
|
|
7163
|
+
if (_window.isDisposed) {
|
|
7164
|
+
return;
|
|
6703
7165
|
}
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
if (!box) {
|
|
6708
|
-
box = group.element.getBoundingClientRect();
|
|
7166
|
+
if (popoutContainer === null) {
|
|
7167
|
+
popoutWindowDisposable.dispose();
|
|
7168
|
+
return;
|
|
6709
7169
|
}
|
|
6710
|
-
const
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
7170
|
+
const gready = document.createElement('div');
|
|
7171
|
+
gready.className = 'dv-overlay-render-container';
|
|
7172
|
+
const overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7173
|
+
const referenceGroup = itemToPopout instanceof DockviewPanel
|
|
7174
|
+
? itemToPopout.group
|
|
7175
|
+
: itemToPopout;
|
|
7176
|
+
const referenceLocation = itemToPopout.api.location.type;
|
|
7177
|
+
const group = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) !== null && _a !== void 0 ? _a : this.createGroup({ id: groupId });
|
|
7178
|
+
group.model.renderContainer = overlayRenderContainer;
|
|
7179
|
+
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup)) {
|
|
7180
|
+
this._onDidAddGroup.fire(group);
|
|
7181
|
+
}
|
|
7182
|
+
if (itemToPopout instanceof DockviewPanel) {
|
|
7183
|
+
this.movingLock(() => {
|
|
7184
|
+
const panel = referenceGroup.model.removePanel(itemToPopout);
|
|
7185
|
+
group.model.openPanel(panel);
|
|
7186
|
+
});
|
|
7187
|
+
}
|
|
7188
|
+
else {
|
|
7189
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7190
|
+
from: referenceGroup,
|
|
7191
|
+
to: group,
|
|
7192
|
+
}));
|
|
7193
|
+
switch (referenceLocation) {
|
|
7194
|
+
case 'grid':
|
|
7195
|
+
referenceGroup.api.setVisible(false);
|
|
7196
|
+
break;
|
|
7197
|
+
case 'floating':
|
|
7198
|
+
case 'popout':
|
|
7199
|
+
this.removeGroup(referenceGroup);
|
|
7200
|
+
break;
|
|
7201
|
+
}
|
|
7202
|
+
}
|
|
7203
|
+
popoutContainer.classList.add('dv-dockview');
|
|
7204
|
+
popoutContainer.style.overflow = 'hidden';
|
|
7205
|
+
popoutContainer.appendChild(gready);
|
|
7206
|
+
popoutContainer.appendChild(group.element);
|
|
7207
|
+
group.model.location = {
|
|
7208
|
+
type: 'popout',
|
|
7209
|
+
getWindow: () => _window.window,
|
|
7210
|
+
};
|
|
7211
|
+
this.doSetGroupAndPanelActive(group);
|
|
7212
|
+
popoutWindowDisposable.addDisposables(group.api.onDidActiveChange((event) => {
|
|
7213
|
+
var _a;
|
|
7214
|
+
if (event.isActive) {
|
|
7215
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7216
|
+
}
|
|
7217
|
+
}), group.api.onWillFocus(() => {
|
|
7218
|
+
var _a;
|
|
7219
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7220
|
+
}));
|
|
7221
|
+
let returnedGroup;
|
|
7222
|
+
const value = {
|
|
7223
|
+
window: _window,
|
|
7224
|
+
popoutGroup: group,
|
|
7225
|
+
referenceGroup: this.getPanel(referenceGroup.id)
|
|
7226
|
+
? referenceGroup.id
|
|
7227
|
+
: undefined,
|
|
7228
|
+
disposable: {
|
|
7229
|
+
dispose: () => {
|
|
7230
|
+
popoutWindowDisposable.dispose();
|
|
7231
|
+
return returnedGroup;
|
|
7232
|
+
},
|
|
7233
|
+
},
|
|
7234
|
+
};
|
|
7235
|
+
popoutWindowDisposable.addDisposables(
|
|
7236
|
+
/**
|
|
7237
|
+
* ResizeObserver seems slow here, I do not know why but we don't need it
|
|
7238
|
+
* since we can reply on the window resize event as we will occupy the full
|
|
7239
|
+
* window dimensions
|
|
7240
|
+
*/
|
|
7241
|
+
addDisposableWindowListener(_window.window, 'resize', () => {
|
|
7242
|
+
group.layout(window.innerWidth, window.innerHeight);
|
|
7243
|
+
}), overlayRenderContainer, Disposable.from(() => {
|
|
7244
|
+
if (this.getPanel(referenceGroup.id)) {
|
|
7245
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7246
|
+
from: group,
|
|
7247
|
+
to: referenceGroup,
|
|
7248
|
+
}));
|
|
7249
|
+
if (!referenceGroup.api.isVisible) {
|
|
7250
|
+
referenceGroup.api.setVisible(true);
|
|
7251
|
+
}
|
|
7252
|
+
if (this.getPanel(group.id)) {
|
|
7253
|
+
this.doRemoveGroup(group, {
|
|
7254
|
+
skipPopoutAssociated: true,
|
|
7255
|
+
});
|
|
7256
|
+
}
|
|
7257
|
+
}
|
|
7258
|
+
else {
|
|
7259
|
+
if (this.getPanel(group.id)) {
|
|
7260
|
+
const removedGroup = this.doRemoveGroup(group, {
|
|
7261
|
+
skipDispose: true,
|
|
7262
|
+
skipActive: true,
|
|
7263
|
+
});
|
|
7264
|
+
removedGroup.model.renderContainer =
|
|
7265
|
+
this.overlayRenderContainer;
|
|
7266
|
+
removedGroup.model.location = { type: 'grid' };
|
|
7267
|
+
returnedGroup = removedGroup;
|
|
7268
|
+
}
|
|
7269
|
+
}
|
|
7270
|
+
}));
|
|
7271
|
+
this._popoutGroups.push(value);
|
|
7272
|
+
this.updateWatermark();
|
|
7273
|
+
})
|
|
7274
|
+
.catch((err) => {
|
|
7275
|
+
console.error(err);
|
|
6727
7276
|
});
|
|
6728
|
-
popoutWindow.addDisposables({
|
|
6729
|
-
dispose: () => {
|
|
6730
|
-
remove(this._popoutGroups, popoutWindow);
|
|
6731
|
-
this.updateWatermark();
|
|
6732
|
-
},
|
|
6733
|
-
}, popoutWindow.window.onDidClose(() => {
|
|
6734
|
-
this.doAddGroup(group, [0]);
|
|
6735
|
-
}));
|
|
6736
|
-
this._popoutGroups.push(popoutWindow);
|
|
6737
|
-
this.updateWatermark();
|
|
6738
7277
|
}
|
|
6739
7278
|
addFloatingGroup(item, coord, options) {
|
|
6740
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7279
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6741
7280
|
let group;
|
|
6742
7281
|
if (item instanceof DockviewPanel) {
|
|
6743
7282
|
group = this.createGroup();
|
|
6744
|
-
this.
|
|
7283
|
+
this._onDidAddGroup.fire(group);
|
|
7284
|
+
this.movingLock(() => this.removePanel(item, {
|
|
6745
7285
|
removeEmptyGroup: true,
|
|
6746
7286
|
skipDispose: true,
|
|
6747
|
-
|
|
6748
|
-
|
|
7287
|
+
skipSetActiveGroup: true,
|
|
7288
|
+
}));
|
|
7289
|
+
group.model.openPanel(item, { skipSetGroupActive: true });
|
|
6749
7290
|
}
|
|
6750
7291
|
else {
|
|
6751
7292
|
group = item;
|
|
7293
|
+
const popoutReferenceGroupId = (_a = this._popoutGroups.find((_) => _.popoutGroup === group)) === null || _a === void 0 ? void 0 : _a.referenceGroup;
|
|
7294
|
+
const popoutReferenceGroup = popoutReferenceGroupId
|
|
7295
|
+
? this.getPanel(popoutReferenceGroupId)
|
|
7296
|
+
: undefined;
|
|
6752
7297
|
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
6753
7298
|
options.skipRemoveGroup;
|
|
6754
7299
|
if (!skip) {
|
|
6755
|
-
|
|
7300
|
+
if (popoutReferenceGroup) {
|
|
7301
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7302
|
+
from: item,
|
|
7303
|
+
to: popoutReferenceGroup,
|
|
7304
|
+
}));
|
|
7305
|
+
this.doRemoveGroup(item, {
|
|
7306
|
+
skipPopoutReturn: true,
|
|
7307
|
+
skipPopoutAssociated: true,
|
|
7308
|
+
});
|
|
7309
|
+
this.doRemoveGroup(popoutReferenceGroup, {
|
|
7310
|
+
skipDispose: true,
|
|
7311
|
+
});
|
|
7312
|
+
group = popoutReferenceGroup;
|
|
7313
|
+
}
|
|
7314
|
+
else {
|
|
7315
|
+
this.doRemoveGroup(item, {
|
|
7316
|
+
skipDispose: true,
|
|
7317
|
+
skipPopoutReturn: true,
|
|
7318
|
+
skipPopoutAssociated: !!popoutReferenceGroup,
|
|
7319
|
+
});
|
|
7320
|
+
}
|
|
6756
7321
|
}
|
|
6757
7322
|
}
|
|
6758
|
-
group.model.location = 'floating';
|
|
7323
|
+
group.model.location = { type: 'floating' };
|
|
6759
7324
|
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6760
7325
|
? Math.max(coord.x, 0)
|
|
6761
7326
|
: DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
@@ -6765,16 +7330,16 @@
|
|
|
6765
7330
|
const overlay = new Overlay({
|
|
6766
7331
|
container: this.gridview.element,
|
|
6767
7332
|
content: group.element,
|
|
6768
|
-
height: (
|
|
6769
|
-
width: (
|
|
7333
|
+
height: (_b = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _b !== void 0 ? _b : 300,
|
|
7334
|
+
width: (_c = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _c !== void 0 ? _c : 300,
|
|
6770
7335
|
left: overlayLeft,
|
|
6771
7336
|
top: overlayTop,
|
|
6772
7337
|
minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6773
7338
|
? undefined
|
|
6774
|
-
: (
|
|
7339
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumWidthWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6775
7340
|
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6776
7341
|
? undefined
|
|
6777
|
-
: (
|
|
7342
|
+
: (_g = (_f = this.options.floatingGroupBounds) === null || _f === void 0 ? void 0 : _f.minimumHeightWithinViewport) !== null && _g !== void 0 ? _g : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6778
7343
|
});
|
|
6779
7344
|
const el = group.element.querySelector('.void-container');
|
|
6780
7345
|
if (!el) {
|
|
@@ -6805,12 +7370,15 @@
|
|
|
6805
7370
|
}), {
|
|
6806
7371
|
dispose: () => {
|
|
6807
7372
|
disposable.dispose();
|
|
6808
|
-
group.model.location = 'grid';
|
|
7373
|
+
group.model.location = { type: 'grid' };
|
|
6809
7374
|
remove(this._floatingGroups, floatingGroupPanel);
|
|
6810
7375
|
this.updateWatermark();
|
|
6811
7376
|
},
|
|
6812
7377
|
});
|
|
6813
7378
|
this._floatingGroups.push(floatingGroupPanel);
|
|
7379
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
|
|
7380
|
+
this.doSetGroupAndPanelActive(group);
|
|
7381
|
+
}
|
|
6814
7382
|
this.updateWatermark();
|
|
6815
7383
|
}
|
|
6816
7384
|
orthogonalize(position) {
|
|
@@ -6900,8 +7468,8 @@
|
|
|
6900
7468
|
return this.panels.find((panel) => panel.id === id);
|
|
6901
7469
|
}
|
|
6902
7470
|
setActivePanel(panel) {
|
|
6903
|
-
this.doSetGroupActive(panel.group);
|
|
6904
7471
|
panel.group.model.openPanel(panel);
|
|
7472
|
+
this.doSetGroupAndPanelActive(panel.group);
|
|
6905
7473
|
}
|
|
6906
7474
|
moveToNext(options = {}) {
|
|
6907
7475
|
var _a;
|
|
@@ -6962,7 +7530,8 @@
|
|
|
6962
7530
|
});
|
|
6963
7531
|
const popoutGroups = this._popoutGroups.map((group) => {
|
|
6964
7532
|
return {
|
|
6965
|
-
data: group.
|
|
7533
|
+
data: group.popoutGroup.toJSON(),
|
|
7534
|
+
gridReferenceGroup: group.referenceGroup,
|
|
6966
7535
|
position: group.window.dimensions(),
|
|
6967
7536
|
};
|
|
6968
7537
|
});
|
|
@@ -6980,7 +7549,7 @@
|
|
|
6980
7549
|
return result;
|
|
6981
7550
|
}
|
|
6982
7551
|
fromJSON(data) {
|
|
6983
|
-
var _a, _b;
|
|
7552
|
+
var _a, _b, _c;
|
|
6984
7553
|
this.clear();
|
|
6985
7554
|
if (typeof data !== 'object' || data === null) {
|
|
6986
7555
|
throw new Error('serialized layout must be a non-null object');
|
|
@@ -7019,7 +7588,7 @@
|
|
|
7019
7588
|
const isActive = typeof activeView === 'string' &&
|
|
7020
7589
|
activeView === panel.id;
|
|
7021
7590
|
group.model.openPanel(panel, {
|
|
7022
|
-
|
|
7591
|
+
skipSetActive: !isActive,
|
|
7023
7592
|
skipSetGroupActive: true,
|
|
7024
7593
|
});
|
|
7025
7594
|
}
|
|
@@ -7049,11 +7618,16 @@
|
|
|
7049
7618
|
}
|
|
7050
7619
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7051
7620
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
7052
|
-
const { data, position } = serializedPopoutGroup;
|
|
7621
|
+
const { data, position, gridReferenceGroup } = serializedPopoutGroup;
|
|
7053
7622
|
const group = createGroupFromSerializedState(data);
|
|
7054
|
-
this.addPopoutGroup(
|
|
7623
|
+
this.addPopoutGroup((_c = (gridReferenceGroup
|
|
7624
|
+
? this.getPanel(gridReferenceGroup)
|
|
7625
|
+
: undefined)) !== null && _c !== void 0 ? _c : group, {
|
|
7055
7626
|
skipRemoveGroup: true,
|
|
7056
7627
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
7628
|
+
overridePopoutGroup: gridReferenceGroup
|
|
7629
|
+
? group
|
|
7630
|
+
: undefined,
|
|
7057
7631
|
});
|
|
7058
7632
|
}
|
|
7059
7633
|
for (const floatingGroup of this._floatingGroups) {
|
|
@@ -7100,12 +7674,13 @@
|
|
|
7100
7674
|
*/
|
|
7101
7675
|
throw err;
|
|
7102
7676
|
}
|
|
7677
|
+
this.updateWatermark();
|
|
7103
7678
|
this._onDidLayoutFromJSON.fire();
|
|
7104
7679
|
}
|
|
7105
7680
|
clear() {
|
|
7106
7681
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7107
7682
|
const hasActiveGroup = !!this.activeGroup;
|
|
7108
|
-
|
|
7683
|
+
!!this.activePanel;
|
|
7109
7684
|
for (const group of groups) {
|
|
7110
7685
|
// remove the group will automatically remove the panels
|
|
7111
7686
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7113,9 +7688,6 @@
|
|
|
7113
7688
|
if (hasActiveGroup) {
|
|
7114
7689
|
this.doSetGroupAndPanelActive(undefined);
|
|
7115
7690
|
}
|
|
7116
|
-
if (hasActivePanel) {
|
|
7117
|
-
this._onDidActivePanelChange.fire(undefined);
|
|
7118
|
-
}
|
|
7119
7691
|
this.gridview.clear();
|
|
7120
7692
|
}
|
|
7121
7693
|
closeAllGroups() {
|
|
@@ -7156,6 +7728,7 @@
|
|
|
7156
7728
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
7157
7729
|
const panel = this.createPanel(options, group);
|
|
7158
7730
|
group.model.openPanel(panel);
|
|
7731
|
+
this.doSetGroupAndPanelActive(group);
|
|
7159
7732
|
return panel;
|
|
7160
7733
|
}
|
|
7161
7734
|
}
|
|
@@ -7167,6 +7740,7 @@
|
|
|
7167
7740
|
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
7168
7741
|
if (options.floating) {
|
|
7169
7742
|
const group = this.createGroup();
|
|
7743
|
+
this._onDidAddGroup.fire(group);
|
|
7170
7744
|
const o = typeof options.floating === 'object' &&
|
|
7171
7745
|
options.floating !== null
|
|
7172
7746
|
? options.floating
|
|
@@ -7174,16 +7748,16 @@
|
|
|
7174
7748
|
this.addFloatingGroup(group, o, {
|
|
7175
7749
|
inDragMode: false,
|
|
7176
7750
|
skipRemoveGroup: true,
|
|
7751
|
+
skipActiveGroup: true,
|
|
7177
7752
|
});
|
|
7178
|
-
this._onDidAddGroup.fire(group);
|
|
7179
7753
|
panel = this.createPanel(options, group);
|
|
7180
7754
|
group.model.openPanel(panel);
|
|
7181
|
-
this.doSetGroupAndPanelActive(group);
|
|
7182
7755
|
}
|
|
7183
|
-
else if (referenceGroup.api.location === 'floating' ||
|
|
7756
|
+
else if (referenceGroup.api.location.type === 'floating' ||
|
|
7184
7757
|
target === 'center') {
|
|
7185
7758
|
panel = this.createPanel(options, referenceGroup);
|
|
7186
7759
|
referenceGroup.model.openPanel(panel);
|
|
7760
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
7187
7761
|
}
|
|
7188
7762
|
else {
|
|
7189
7763
|
const location = getGridLocation(referenceGroup.element);
|
|
@@ -7191,10 +7765,12 @@
|
|
|
7191
7765
|
const group = this.createGroupAtLocation(relativeLocation);
|
|
7192
7766
|
panel = this.createPanel(options, group);
|
|
7193
7767
|
group.model.openPanel(panel);
|
|
7768
|
+
this.doSetGroupAndPanelActive(group);
|
|
7194
7769
|
}
|
|
7195
7770
|
}
|
|
7196
7771
|
else if (options.floating) {
|
|
7197
7772
|
const group = this.createGroup();
|
|
7773
|
+
this._onDidAddGroup.fire(group);
|
|
7198
7774
|
const o = typeof options.floating === 'object' &&
|
|
7199
7775
|
options.floating !== null
|
|
7200
7776
|
? options.floating
|
|
@@ -7202,16 +7778,16 @@
|
|
|
7202
7778
|
this.addFloatingGroup(group, o, {
|
|
7203
7779
|
inDragMode: false,
|
|
7204
7780
|
skipRemoveGroup: true,
|
|
7781
|
+
skipActiveGroup: true,
|
|
7205
7782
|
});
|
|
7206
|
-
this._onDidAddGroup.fire(group);
|
|
7207
7783
|
panel = this.createPanel(options, group);
|
|
7208
7784
|
group.model.openPanel(panel);
|
|
7209
|
-
this.doSetGroupAndPanelActive(group);
|
|
7210
7785
|
}
|
|
7211
7786
|
else {
|
|
7212
7787
|
const group = this.createGroupAtLocation();
|
|
7213
7788
|
panel = this.createPanel(options, group);
|
|
7214
7789
|
group.model.openPanel(panel);
|
|
7790
|
+
this.doSetGroupAndPanelActive(group);
|
|
7215
7791
|
}
|
|
7216
7792
|
return panel;
|
|
7217
7793
|
}
|
|
@@ -7223,13 +7799,15 @@
|
|
|
7223
7799
|
if (!group) {
|
|
7224
7800
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
7225
7801
|
}
|
|
7226
|
-
group.model.removePanel(panel
|
|
7802
|
+
group.model.removePanel(panel, {
|
|
7803
|
+
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
7804
|
+
});
|
|
7227
7805
|
if (!options.skipDispose) {
|
|
7228
|
-
|
|
7806
|
+
panel.group.model.renderContainer.detatch(panel);
|
|
7229
7807
|
panel.dispose();
|
|
7230
7808
|
}
|
|
7231
7809
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
7232
|
-
this.removeGroup(group);
|
|
7810
|
+
this.removeGroup(group, { skipActive: options.skipSetActiveGroup });
|
|
7233
7811
|
}
|
|
7234
7812
|
}
|
|
7235
7813
|
createWatermarkComponent() {
|
|
@@ -7242,7 +7820,7 @@
|
|
|
7242
7820
|
}
|
|
7243
7821
|
updateWatermark() {
|
|
7244
7822
|
var _a, _b;
|
|
7245
|
-
if (this.groups.filter((x) => x.api.location === 'grid').length === 0) {
|
|
7823
|
+
if (this.groups.filter((x) => x.api.location.type === 'grid' && x.api.isVisible).length === 0) {
|
|
7246
7824
|
if (!this.watermark) {
|
|
7247
7825
|
this.watermark = this.createWatermarkComponent();
|
|
7248
7826
|
this.watermark.init({
|
|
@@ -7288,36 +7866,42 @@
|
|
|
7288
7866
|
}
|
|
7289
7867
|
else {
|
|
7290
7868
|
const group = this.orthogonalize(directionToPosition(options.direction));
|
|
7869
|
+
if (!options.skipSetActive) {
|
|
7870
|
+
this.doSetGroupAndPanelActive(group);
|
|
7871
|
+
}
|
|
7291
7872
|
return group;
|
|
7292
7873
|
}
|
|
7293
7874
|
const target = toTarget(options.direction || 'within');
|
|
7294
7875
|
const location = getGridLocation(referenceGroup.element);
|
|
7295
7876
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7296
7877
|
this.doAddGroup(group, relativeLocation);
|
|
7878
|
+
if (!options.skipSetActive) {
|
|
7879
|
+
this.doSetGroupAndPanelActive(group);
|
|
7880
|
+
}
|
|
7297
7881
|
return group;
|
|
7298
7882
|
}
|
|
7299
7883
|
else {
|
|
7300
7884
|
this.doAddGroup(group);
|
|
7885
|
+
this.doSetGroupAndPanelActive(group);
|
|
7301
7886
|
return group;
|
|
7302
7887
|
}
|
|
7303
7888
|
}
|
|
7304
7889
|
removeGroup(group, options) {
|
|
7890
|
+
this.doRemoveGroup(group, options);
|
|
7891
|
+
}
|
|
7892
|
+
doRemoveGroup(group, options) {
|
|
7305
7893
|
var _a;
|
|
7306
7894
|
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7895
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7896
|
+
for (const panel of panels) {
|
|
7897
|
+
this.removePanel(panel, {
|
|
7898
|
+
removeEmptyGroup: false,
|
|
7899
|
+
skipDispose: (_a = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _a !== void 0 ? _a : false,
|
|
7900
|
+
});
|
|
7901
|
+
}
|
|
7312
7902
|
}
|
|
7313
7903
|
const activePanel = this.activePanel;
|
|
7314
|
-
|
|
7315
|
-
if (this.activePanel !== activePanel) {
|
|
7316
|
-
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7317
|
-
}
|
|
7318
|
-
}
|
|
7319
|
-
doRemoveGroup(group, options) {
|
|
7320
|
-
if (group.api.location === 'floating') {
|
|
7904
|
+
if (group.api.location.type === 'floating') {
|
|
7321
7905
|
const floatingGroup = this._floatingGroups.find((_) => _.group === group);
|
|
7322
7906
|
if (floatingGroup) {
|
|
7323
7907
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
@@ -7329,60 +7913,124 @@
|
|
|
7329
7913
|
floatingGroup.dispose();
|
|
7330
7914
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7331
7915
|
const groups = Array.from(this._groups.values());
|
|
7332
|
-
this.
|
|
7916
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7333
7917
|
}
|
|
7334
7918
|
return floatingGroup.group;
|
|
7335
7919
|
}
|
|
7336
7920
|
throw new Error('failed to find floating group');
|
|
7337
7921
|
}
|
|
7338
|
-
if (group.api.location === 'popout') {
|
|
7339
|
-
const selectedGroup = this._popoutGroups.find((_) => _.
|
|
7922
|
+
if (group.api.location.type === 'popout') {
|
|
7923
|
+
const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
|
|
7340
7924
|
if (selectedGroup) {
|
|
7341
7925
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7342
|
-
|
|
7926
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutAssociated)) {
|
|
7927
|
+
const refGroup = selectedGroup.referenceGroup
|
|
7928
|
+
? this.getPanel(selectedGroup.referenceGroup)
|
|
7929
|
+
: undefined;
|
|
7930
|
+
if (refGroup) {
|
|
7931
|
+
this.removeGroup(refGroup);
|
|
7932
|
+
}
|
|
7933
|
+
}
|
|
7934
|
+
selectedGroup.popoutGroup.dispose();
|
|
7343
7935
|
this._groups.delete(group.id);
|
|
7344
7936
|
this._onDidRemoveGroup.fire(group);
|
|
7345
7937
|
}
|
|
7346
|
-
selectedGroup.dispose();
|
|
7938
|
+
const removedGroup = selectedGroup.disposable.dispose();
|
|
7939
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
|
|
7940
|
+
this.doAddGroup(removedGroup, [0]);
|
|
7941
|
+
this.doSetGroupAndPanelActive(removedGroup);
|
|
7942
|
+
}
|
|
7347
7943
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7348
7944
|
const groups = Array.from(this._groups.values());
|
|
7349
|
-
this.
|
|
7945
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7350
7946
|
}
|
|
7351
|
-
|
|
7947
|
+
this.updateWatermark();
|
|
7948
|
+
return selectedGroup.popoutGroup;
|
|
7352
7949
|
}
|
|
7353
7950
|
throw new Error('failed to find popout group');
|
|
7354
7951
|
}
|
|
7355
|
-
|
|
7952
|
+
const re = super.doRemoveGroup(group, options);
|
|
7953
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
7954
|
+
if (this.activePanel !== activePanel) {
|
|
7955
|
+
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7956
|
+
}
|
|
7957
|
+
}
|
|
7958
|
+
return re;
|
|
7356
7959
|
}
|
|
7357
|
-
|
|
7358
|
-
|
|
7960
|
+
movingLock(func) {
|
|
7961
|
+
const isMoving = this._moving;
|
|
7962
|
+
try {
|
|
7963
|
+
this._moving = true;
|
|
7964
|
+
return func();
|
|
7965
|
+
}
|
|
7966
|
+
finally {
|
|
7967
|
+
this._moving = isMoving;
|
|
7968
|
+
}
|
|
7969
|
+
}
|
|
7970
|
+
moveGroupOrPanel(options) {
|
|
7971
|
+
var _a;
|
|
7972
|
+
const destinationGroup = options.to.group;
|
|
7973
|
+
const sourceGroupId = options.from.groupId;
|
|
7974
|
+
const sourceItemId = options.from.panelId;
|
|
7975
|
+
const destinationTarget = options.to.position;
|
|
7976
|
+
const destinationIndex = options.to.index;
|
|
7359
7977
|
const sourceGroup = sourceGroupId
|
|
7360
7978
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
7361
7979
|
: undefined;
|
|
7980
|
+
if (!sourceGroup) {
|
|
7981
|
+
throw new Error(`Failed to find group id ${sourceGroupId}`);
|
|
7982
|
+
}
|
|
7362
7983
|
if (sourceItemId === undefined) {
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7984
|
+
/**
|
|
7985
|
+
* Moving an entire group into another group
|
|
7986
|
+
*/
|
|
7987
|
+
this.moveGroup({
|
|
7988
|
+
from: { group: sourceGroup },
|
|
7989
|
+
to: {
|
|
7990
|
+
group: destinationGroup,
|
|
7991
|
+
position: destinationTarget,
|
|
7992
|
+
},
|
|
7993
|
+
});
|
|
7366
7994
|
return;
|
|
7367
7995
|
}
|
|
7368
7996
|
if (!destinationTarget || destinationTarget === 'center') {
|
|
7369
|
-
|
|
7370
|
-
|
|
7997
|
+
/**
|
|
7998
|
+
* Dropping a panel within another group
|
|
7999
|
+
*/
|
|
8000
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8001
|
+
skipSetActive: false,
|
|
8002
|
+
skipSetActiveGroup: true,
|
|
8003
|
+
}));
|
|
8004
|
+
if (!removedPanel) {
|
|
7371
8005
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7372
8006
|
}
|
|
7373
|
-
if (
|
|
7374
|
-
|
|
8007
|
+
if (sourceGroup.model.size === 0) {
|
|
8008
|
+
// remove the group and do not set a new group as active
|
|
8009
|
+
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
7375
8010
|
}
|
|
7376
|
-
destinationGroup.model.openPanel(
|
|
8011
|
+
this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
|
|
7377
8012
|
index: destinationIndex,
|
|
8013
|
+
skipSetGroupActive: true,
|
|
8014
|
+
}));
|
|
8015
|
+
this.doSetGroupAndPanelActive(destinationGroup);
|
|
8016
|
+
this._onDidMovePanel.fire({
|
|
8017
|
+
panel: removedPanel,
|
|
7378
8018
|
});
|
|
7379
8019
|
}
|
|
7380
8020
|
else {
|
|
8021
|
+
/**
|
|
8022
|
+
* Dropping a panel to the extremities of a group which will place that panel
|
|
8023
|
+
* into an adjacent group
|
|
8024
|
+
*/
|
|
7381
8025
|
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
7382
8026
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7383
|
-
if (sourceGroup
|
|
8027
|
+
if (sourceGroup.size < 2) {
|
|
8028
|
+
/**
|
|
8029
|
+
* If we are moving from a group which only has one panel left we will consider
|
|
8030
|
+
* moving the group itself rather than moving the panel into a newly created group
|
|
8031
|
+
*/
|
|
7384
8032
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
7385
|
-
if (sourceGroup.api.location === 'grid') {
|
|
8033
|
+
if (sourceGroup.api.location.type === 'grid') {
|
|
7386
8034
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
7387
8035
|
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
7388
8036
|
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
@@ -7390,77 +8038,122 @@
|
|
|
7390
8038
|
// if a group has one tab - we are essentially moving the 'group'
|
|
7391
8039
|
// which is equivalent to swapping two views in this case
|
|
7392
8040
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8041
|
+
return;
|
|
7393
8042
|
}
|
|
7394
8043
|
}
|
|
7395
8044
|
// source group will become empty so delete the group
|
|
7396
|
-
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
8045
|
+
const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
|
|
7397
8046
|
skipActive: true,
|
|
7398
8047
|
skipDispose: true,
|
|
7399
|
-
});
|
|
8048
|
+
}));
|
|
7400
8049
|
// after deleting the group we need to re-evaulate the ref location
|
|
7401
8050
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
7402
8051
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
7403
|
-
this.doAddGroup(targetGroup, location);
|
|
8052
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8053
|
+
this.doSetGroupAndPanelActive(targetGroup);
|
|
7404
8054
|
}
|
|
7405
8055
|
else {
|
|
7406
|
-
|
|
7407
|
-
|
|
8056
|
+
/**
|
|
8057
|
+
* The group we are removing from has many panels, we need to remove the panels we are moving,
|
|
8058
|
+
* create a new group, add the panels to that new group and add the new group in an appropiate position
|
|
8059
|
+
*/
|
|
8060
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8061
|
+
skipSetActive: false,
|
|
8062
|
+
skipSetActiveGroup: true,
|
|
8063
|
+
}));
|
|
8064
|
+
if (!removedPanel) {
|
|
7408
8065
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7409
8066
|
}
|
|
7410
8067
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7411
8068
|
const group = this.createGroupAtLocation(dropLocation);
|
|
7412
|
-
group.model.openPanel(
|
|
8069
|
+
this.movingLock(() => group.model.openPanel(removedPanel, {
|
|
8070
|
+
skipSetGroupActive: true,
|
|
8071
|
+
}));
|
|
8072
|
+
this.doSetGroupAndPanelActive(group);
|
|
7413
8073
|
}
|
|
7414
8074
|
}
|
|
7415
8075
|
}
|
|
7416
|
-
moveGroup(
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
8076
|
+
moveGroup(options) {
|
|
8077
|
+
const from = options.from.group;
|
|
8078
|
+
const to = options.to.group;
|
|
8079
|
+
const target = options.to.position;
|
|
8080
|
+
if (target === 'center') {
|
|
8081
|
+
const activePanel = from.activePanel;
|
|
8082
|
+
const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
|
|
8083
|
+
skipSetActive: true,
|
|
8084
|
+
})));
|
|
8085
|
+
if ((from === null || from === void 0 ? void 0 : from.model.size) === 0) {
|
|
8086
|
+
this.doRemoveGroup(from, { skipActive: true });
|
|
8087
|
+
}
|
|
8088
|
+
this.movingLock(() => {
|
|
7424
8089
|
for (const panel of panels) {
|
|
7425
|
-
|
|
7426
|
-
|
|
8090
|
+
to.model.openPanel(panel, {
|
|
8091
|
+
skipSetActive: panel !== activePanel,
|
|
8092
|
+
skipSetGroupActive: true,
|
|
7427
8093
|
});
|
|
7428
8094
|
}
|
|
7429
|
-
}
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
8095
|
+
});
|
|
8096
|
+
this.doSetGroupAndPanelActive(to);
|
|
8097
|
+
panels.forEach((panel) => {
|
|
8098
|
+
this._onDidMovePanel.fire({ panel });
|
|
8099
|
+
});
|
|
8100
|
+
}
|
|
8101
|
+
else {
|
|
8102
|
+
switch (from.api.location.type) {
|
|
8103
|
+
case 'grid':
|
|
8104
|
+
this.gridview.removeView(getGridLocation(from.element));
|
|
8105
|
+
break;
|
|
8106
|
+
case 'floating': {
|
|
8107
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
8108
|
+
if (!selectedFloatingGroup) {
|
|
8109
|
+
throw new Error('failed to find floating group');
|
|
7442
8110
|
}
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
8111
|
+
selectedFloatingGroup.dispose();
|
|
8112
|
+
break;
|
|
8113
|
+
}
|
|
8114
|
+
case 'popout': {
|
|
8115
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
8116
|
+
if (!selectedPopoutGroup) {
|
|
8117
|
+
throw new Error('failed to find popout group');
|
|
7449
8118
|
}
|
|
8119
|
+
selectedPopoutGroup.disposable.dispose();
|
|
7450
8120
|
}
|
|
7451
|
-
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
7452
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
7453
|
-
this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
|
|
7454
8121
|
}
|
|
8122
|
+
const referenceLocation = getGridLocation(to.element);
|
|
8123
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8124
|
+
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8125
|
+
from.panels.forEach((panel) => {
|
|
8126
|
+
this._onDidMovePanel.fire({ panel });
|
|
8127
|
+
});
|
|
7455
8128
|
}
|
|
7456
8129
|
}
|
|
7457
|
-
|
|
7458
|
-
|
|
8130
|
+
doSetGroupActive(group) {
|
|
8131
|
+
super.doSetGroupActive(group);
|
|
8132
|
+
const activePanel = this.activePanel;
|
|
8133
|
+
if (!this._moving &&
|
|
8134
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8135
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8136
|
+
}
|
|
8137
|
+
}
|
|
8138
|
+
doSetGroupAndPanelActive(group) {
|
|
8139
|
+
super.doSetGroupActive(group);
|
|
7459
8140
|
const activePanel = this.activePanel;
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
this.
|
|
8141
|
+
if (group &&
|
|
8142
|
+
this.hasMaximizedGroup() &&
|
|
8143
|
+
!this.isMaximizedGroup(group)) {
|
|
8144
|
+
this.exitMaximizedGroup();
|
|
8145
|
+
}
|
|
8146
|
+
if (!this._moving &&
|
|
8147
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8148
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8149
|
+
}
|
|
8150
|
+
}
|
|
8151
|
+
getNextGroupId() {
|
|
8152
|
+
let id = this.nextGroupId.next();
|
|
8153
|
+
while (this._groups.has(id)) {
|
|
8154
|
+
id = this.nextGroupId.next();
|
|
7463
8155
|
}
|
|
8156
|
+
return id;
|
|
7464
8157
|
}
|
|
7465
8158
|
createGroup(options) {
|
|
7466
8159
|
if (!options) {
|
|
@@ -7478,7 +8171,7 @@
|
|
|
7478
8171
|
}
|
|
7479
8172
|
}
|
|
7480
8173
|
const view = new DockviewGroupPanel(this, id, options);
|
|
7481
|
-
view.init({ params: {}, accessor:
|
|
8174
|
+
view.init({ params: {}, accessor: this });
|
|
7482
8175
|
if (!this._groups.has(view.id)) {
|
|
7483
8176
|
const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {
|
|
7484
8177
|
this._onWillDragPanel.fire(event);
|
|
@@ -7486,20 +8179,48 @@
|
|
|
7486
8179
|
this._onWillDragGroup.fire(event);
|
|
7487
8180
|
}), view.model.onMove((event) => {
|
|
7488
8181
|
const { groupId, itemId, target, index } = event;
|
|
7489
|
-
this.moveGroupOrPanel(
|
|
8182
|
+
this.moveGroupOrPanel({
|
|
8183
|
+
from: { groupId: groupId, panelId: itemId },
|
|
8184
|
+
to: {
|
|
8185
|
+
group: view,
|
|
8186
|
+
position: target,
|
|
8187
|
+
index,
|
|
8188
|
+
},
|
|
8189
|
+
});
|
|
7490
8190
|
}), view.model.onDidDrop((event) => {
|
|
7491
|
-
this._onDidDrop.fire(
|
|
8191
|
+
this._onDidDrop.fire(event);
|
|
8192
|
+
}), view.model.onWillDrop((event) => {
|
|
8193
|
+
this._onWillDrop.fire(event);
|
|
8194
|
+
}), view.model.onWillShowOverlay((event) => {
|
|
8195
|
+
if (this.options.disableDnd) {
|
|
8196
|
+
event.preventDefault();
|
|
8197
|
+
return;
|
|
8198
|
+
}
|
|
8199
|
+
this._onWillShowOverlay.fire(event);
|
|
7492
8200
|
}), view.model.onDidAddPanel((event) => {
|
|
8201
|
+
if (this._moving) {
|
|
8202
|
+
return;
|
|
8203
|
+
}
|
|
7493
8204
|
this._onDidAddPanel.fire(event.panel);
|
|
7494
8205
|
}), view.model.onDidRemovePanel((event) => {
|
|
8206
|
+
if (this._moving) {
|
|
8207
|
+
return;
|
|
8208
|
+
}
|
|
7495
8209
|
this._onDidRemovePanel.fire(event.panel);
|
|
7496
8210
|
}), view.model.onDidActivePanelChange((event) => {
|
|
7497
|
-
this.
|
|
8211
|
+
if (this._moving) {
|
|
8212
|
+
return;
|
|
8213
|
+
}
|
|
8214
|
+
if (event.panel !== this.activePanel) {
|
|
8215
|
+
return;
|
|
8216
|
+
}
|
|
8217
|
+
if (this._onDidActivePanelChange.value !== event.panel) {
|
|
8218
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
8219
|
+
}
|
|
7498
8220
|
}));
|
|
7499
8221
|
this._groups.set(view.id, { value: view, disposable });
|
|
7500
8222
|
}
|
|
7501
|
-
// TODO: must be called after the above listeners have been setup,
|
|
7502
|
-
// not an ideal pattern
|
|
8223
|
+
// TODO: must be called after the above listeners have been setup, not an ideal pattern
|
|
7503
8224
|
view.initialize();
|
|
7504
8225
|
return view;
|
|
7505
8226
|
}
|
|
@@ -7552,7 +8273,20 @@
|
|
|
7552
8273
|
});
|
|
7553
8274
|
this._onDidLayoutfromJSON = new Emitter();
|
|
7554
8275
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
8276
|
+
this._onDidRemoveGroup = new Emitter();
|
|
8277
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
8278
|
+
this._onDidAddGroup = new Emitter();
|
|
8279
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
8280
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
8281
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
7555
8282
|
this._options = options;
|
|
8283
|
+
this.addDisposables(this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
|
|
8284
|
+
this._onDidAddGroup.fire(event);
|
|
8285
|
+
}), this.onDidRemove((event) => {
|
|
8286
|
+
this._onDidRemoveGroup.fire(event);
|
|
8287
|
+
}), this.onDidActiveChange((event) => {
|
|
8288
|
+
this._onDidActiveGroupChange.fire(event);
|
|
8289
|
+
}));
|
|
7556
8290
|
if (!this.options.components) {
|
|
7557
8291
|
this.options.components = {};
|
|
7558
8292
|
}
|
|
@@ -7727,6 +8461,7 @@
|
|
|
7727
8461
|
});
|
|
7728
8462
|
this.registerPanel(view);
|
|
7729
8463
|
this.doAddGroup(view, relativeLocation, options.size);
|
|
8464
|
+
this.doSetGroupActive(view);
|
|
7730
8465
|
return view;
|
|
7731
8466
|
}
|
|
7732
8467
|
registerPanel(panel) {
|
|
@@ -7868,19 +8603,19 @@
|
|
|
7868
8603
|
const index = this.panels.indexOf(panel);
|
|
7869
8604
|
this.splitview.setViewVisible(index, visible);
|
|
7870
8605
|
}
|
|
7871
|
-
setActive(
|
|
7872
|
-
this._activePanel =
|
|
8606
|
+
setActive(panel, skipFocus) {
|
|
8607
|
+
this._activePanel = panel;
|
|
7873
8608
|
this.panels
|
|
7874
|
-
.filter((v) => v !==
|
|
8609
|
+
.filter((v) => v !== panel)
|
|
7875
8610
|
.forEach((v) => {
|
|
7876
8611
|
v.api._onDidActiveChange.fire({ isActive: false });
|
|
7877
8612
|
if (!skipFocus) {
|
|
7878
8613
|
v.focus();
|
|
7879
8614
|
}
|
|
7880
8615
|
});
|
|
7881
|
-
|
|
8616
|
+
panel.api._onDidActiveChange.fire({ isActive: true });
|
|
7882
8617
|
if (!skipFocus) {
|
|
7883
|
-
|
|
8618
|
+
panel.focus();
|
|
7884
8619
|
}
|
|
7885
8620
|
}
|
|
7886
8621
|
removePanel(panel, sizing) {
|
|
@@ -8179,6 +8914,10 @@
|
|
|
8179
8914
|
});
|
|
8180
8915
|
this.addDisposables(this._disposable);
|
|
8181
8916
|
}
|
|
8917
|
+
setVisible(panel, visible) {
|
|
8918
|
+
const index = this.panels.indexOf(panel);
|
|
8919
|
+
this.paneview.setViewVisible(index, visible);
|
|
8920
|
+
}
|
|
8182
8921
|
focus() {
|
|
8183
8922
|
//noop
|
|
8184
8923
|
}
|
|
@@ -8225,6 +8964,7 @@
|
|
|
8225
8964
|
isExpanded: options.isExpanded,
|
|
8226
8965
|
title: options.title,
|
|
8227
8966
|
containerApi: new PaneviewApi(this),
|
|
8967
|
+
accessor: this,
|
|
8228
8968
|
});
|
|
8229
8969
|
this.paneview.addPane(view, size, index);
|
|
8230
8970
|
view.orientation = this.paneview.orientation;
|
|
@@ -8324,6 +9064,7 @@
|
|
|
8324
9064
|
title: data.title,
|
|
8325
9065
|
isExpanded: !!view.expanded,
|
|
8326
9066
|
containerApi: new PaneviewApi(this),
|
|
9067
|
+
accessor: this,
|
|
8327
9068
|
});
|
|
8328
9069
|
panel.orientation = this.paneview.orientation;
|
|
8329
9070
|
});
|
|
@@ -8412,7 +9153,7 @@
|
|
|
8412
9153
|
this._onDidChange = new Emitter();
|
|
8413
9154
|
this.onDidChange = this._onDidChange.event;
|
|
8414
9155
|
this.api.initialize(this);
|
|
8415
|
-
this.addDisposables(this._onDidChange, this.api.
|
|
9156
|
+
this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => {
|
|
8416
9157
|
const { isVisible } = event;
|
|
8417
9158
|
const { accessor } = this._params;
|
|
8418
9159
|
accessor.setVisible(this, isVisible);
|
|
@@ -8537,13 +9278,13 @@
|
|
|
8537
9278
|
if (this.disposed) {
|
|
8538
9279
|
throw new Error('invalid operation: resource is already disposed');
|
|
8539
9280
|
}
|
|
8540
|
-
if (
|
|
9281
|
+
if (!isReactComponent(this.component)) {
|
|
8541
9282
|
/**
|
|
8542
9283
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
8543
|
-
* if we do not intercept
|
|
8544
|
-
* for the same reason
|
|
9284
|
+
* if we do not intercept then React library will throw a very obsure error
|
|
9285
|
+
* for the same reason... at least at this point we will emit a sensible stacktrace.
|
|
8545
9286
|
*/
|
|
8546
|
-
throw new Error('
|
|
9287
|
+
throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');
|
|
8547
9288
|
}
|
|
8548
9289
|
const bridgeComponent = React__namespace.createElement(React__namespace.forwardRef(ReactComponentBridge), {
|
|
8549
9290
|
component: this
|
|
@@ -8595,9 +9336,13 @@
|
|
|
8595
9336
|
}, []);
|
|
8596
9337
|
return [portals, addPortal];
|
|
8597
9338
|
};
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
9339
|
+
function isReactComponent(component) {
|
|
9340
|
+
/**
|
|
9341
|
+
* Yes, we could use "react-is" but that would introduce an unwanted peer dependency
|
|
9342
|
+
* so for now we will check in a rather crude fashion...
|
|
9343
|
+
*/
|
|
9344
|
+
return (typeof component === 'function' /** Functional Componnts */ ||
|
|
9345
|
+
!!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
|
|
8601
9346
|
}
|
|
8602
9347
|
|
|
8603
9348
|
class ReactPanelContentPart {
|
|
@@ -8857,6 +9602,8 @@
|
|
|
8857
9602
|
defaultRenderer: props.defaultRenderer,
|
|
8858
9603
|
debug: props.debug,
|
|
8859
9604
|
rootOverlayModel: props.rootOverlayModel,
|
|
9605
|
+
locked: props.locked,
|
|
9606
|
+
disableDnd: props.disableDnd,
|
|
8860
9607
|
});
|
|
8861
9608
|
const { clientWidth, clientHeight } = domRef.current;
|
|
8862
9609
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -8868,6 +9615,20 @@
|
|
|
8868
9615
|
dockview.dispose();
|
|
8869
9616
|
};
|
|
8870
9617
|
}, []);
|
|
9618
|
+
React__namespace.useEffect(() => {
|
|
9619
|
+
if (!dockviewRef.current) {
|
|
9620
|
+
return;
|
|
9621
|
+
}
|
|
9622
|
+
dockviewRef.current.locked = !!props.locked;
|
|
9623
|
+
}, [props.locked]);
|
|
9624
|
+
React__namespace.useEffect(() => {
|
|
9625
|
+
if (!dockviewRef.current) {
|
|
9626
|
+
return;
|
|
9627
|
+
}
|
|
9628
|
+
dockviewRef.current.updateOptions({
|
|
9629
|
+
disableDnd: props.disableDnd,
|
|
9630
|
+
});
|
|
9631
|
+
}, [props.disableDnd]);
|
|
8871
9632
|
React__namespace.useEffect(() => {
|
|
8872
9633
|
if (!dockviewRef.current) {
|
|
8873
9634
|
return () => {
|
|
@@ -8883,6 +9644,21 @@
|
|
|
8883
9644
|
disposable.dispose();
|
|
8884
9645
|
};
|
|
8885
9646
|
}, [props.onDidDrop]);
|
|
9647
|
+
React__namespace.useEffect(() => {
|
|
9648
|
+
if (!dockviewRef.current) {
|
|
9649
|
+
return () => {
|
|
9650
|
+
// noop
|
|
9651
|
+
};
|
|
9652
|
+
}
|
|
9653
|
+
const disposable = dockviewRef.current.onWillDrop((event) => {
|
|
9654
|
+
if (props.onWillDrop) {
|
|
9655
|
+
props.onWillDrop(event);
|
|
9656
|
+
}
|
|
9657
|
+
});
|
|
9658
|
+
return () => {
|
|
9659
|
+
disposable.dispose();
|
|
9660
|
+
};
|
|
9661
|
+
}, [props.onWillDrop]);
|
|
8886
9662
|
React__namespace.useEffect(() => {
|
|
8887
9663
|
if (!dockviewRef.current) {
|
|
8888
9664
|
return;
|
|
@@ -9125,7 +9901,9 @@
|
|
|
9125
9901
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
9126
9902
|
params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
|
|
9127
9903
|
api: this.api,
|
|
9128
|
-
|
|
9904
|
+
// TODO: fix casting hack
|
|
9905
|
+
containerApi: new GridviewApi(this._params
|
|
9906
|
+
.accessor),
|
|
9129
9907
|
});
|
|
9130
9908
|
}
|
|
9131
9909
|
}
|
|
@@ -9308,12 +10086,14 @@
|
|
|
9308
10086
|
exports.DockviewComponent = DockviewComponent;
|
|
9309
10087
|
exports.DockviewCompositeDisposable = CompositeDisposable;
|
|
9310
10088
|
exports.DockviewDefaultTab = DockviewDefaultTab;
|
|
10089
|
+
exports.DockviewDidDropEvent = DockviewDidDropEvent;
|
|
9311
10090
|
exports.DockviewEmitter = Emitter;
|
|
9312
10091
|
exports.DockviewGroupPanel = DockviewGroupPanel;
|
|
9313
10092
|
exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
|
|
9314
10093
|
exports.DockviewMutableDisposable = MutableDisposable;
|
|
9315
10094
|
exports.DockviewPanel = DockviewPanel;
|
|
9316
10095
|
exports.DockviewReact = DockviewReact;
|
|
10096
|
+
exports.DockviewWillDropEvent = DockviewWillDropEvent;
|
|
9317
10097
|
exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
|
|
9318
10098
|
exports.Gridview = Gridview;
|
|
9319
10099
|
exports.GridviewApi = GridviewApi;
|
|
@@ -9337,6 +10117,7 @@
|
|
|
9337
10117
|
exports.SplitviewPanel = SplitviewPanel;
|
|
9338
10118
|
exports.SplitviewReact = SplitviewReact;
|
|
9339
10119
|
exports.Tab = Tab;
|
|
10120
|
+
exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
|
|
9340
10121
|
exports.createComponent = createComponent;
|
|
9341
10122
|
exports.directionToPosition = directionToPosition;
|
|
9342
10123
|
exports.getDirectionOrientation = getDirectionOrientation;
|
|
@@ -9351,7 +10132,7 @@
|
|
|
9351
10132
|
exports.isGroupOptionsWithPanel = isGroupOptionsWithPanel;
|
|
9352
10133
|
exports.isPanelOptionsWithGroup = isPanelOptionsWithGroup;
|
|
9353
10134
|
exports.isPanelOptionsWithPanel = isPanelOptionsWithPanel;
|
|
9354
|
-
exports.
|
|
10135
|
+
exports.isReactComponent = isReactComponent;
|
|
9355
10136
|
exports.orthogonal = orthogonal;
|
|
9356
10137
|
exports.positionToDirection = positionToDirection;
|
|
9357
10138
|
exports.toTarget = toTarget;
|