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
|
@@ -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
|
*/
|
|
@@ -108,6 +108,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
110
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
111
|
+
class DockviewEvent {
|
|
112
|
+
constructor() {
|
|
113
|
+
this._defaultPrevented = false;
|
|
114
|
+
}
|
|
115
|
+
get defaultPrevented() {
|
|
116
|
+
return this._defaultPrevented;
|
|
117
|
+
}
|
|
118
|
+
preventDefault() {
|
|
119
|
+
this._defaultPrevented = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
111
122
|
class LeakageMonitor {
|
|
112
123
|
constructor() {
|
|
113
124
|
this.events = new Map();
|
|
@@ -151,6 +162,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
151
162
|
}
|
|
152
163
|
Emitter.ENABLE_TRACKING = isEnabled;
|
|
153
164
|
}
|
|
165
|
+
get value() {
|
|
166
|
+
return this._last;
|
|
167
|
+
}
|
|
154
168
|
constructor(options) {
|
|
155
169
|
this.options = options;
|
|
156
170
|
this._listeners = [];
|
|
@@ -273,8 +287,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
273
287
|
args.forEach((arg) => this._disposables.push(arg));
|
|
274
288
|
}
|
|
275
289
|
dispose() {
|
|
276
|
-
this.
|
|
290
|
+
if (this._isDisposed) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
277
293
|
this._isDisposed = true;
|
|
294
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
295
|
+
this._disposables = [];
|
|
278
296
|
}
|
|
279
297
|
}
|
|
280
298
|
class MutableDisposable {
|
|
@@ -758,6 +776,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
758
776
|
this._endSnappingEnabled = endSnappingEnabled;
|
|
759
777
|
this.updateSashEnablement();
|
|
760
778
|
}
|
|
779
|
+
get disabled() {
|
|
780
|
+
return this._disabled;
|
|
781
|
+
}
|
|
782
|
+
set disabled(value) {
|
|
783
|
+
this._disabled = value;
|
|
784
|
+
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
785
|
+
}
|
|
761
786
|
constructor(container, options) {
|
|
762
787
|
this.container = container;
|
|
763
788
|
this.viewItems = [];
|
|
@@ -768,6 +793,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
768
793
|
this._proportions = undefined;
|
|
769
794
|
this._startSnappingEnabled = true;
|
|
770
795
|
this._endSnappingEnabled = true;
|
|
796
|
+
this._disabled = false;
|
|
771
797
|
this._onDidSashEnd = new Emitter();
|
|
772
798
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
773
799
|
this._onDidAddView = new Emitter();
|
|
@@ -1442,6 +1468,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1442
1468
|
this._onDidChange.fire();
|
|
1443
1469
|
}));
|
|
1444
1470
|
}
|
|
1471
|
+
setViewVisible(index, visible) {
|
|
1472
|
+
this.splitview.setViewVisible(index, visible);
|
|
1473
|
+
}
|
|
1445
1474
|
addPane(pane, size, index = this.splitview.length, skipLayout = false) {
|
|
1446
1475
|
const disposable = pane.onDidChangeExpansionState(() => {
|
|
1447
1476
|
this.setupAnimation();
|
|
@@ -1695,7 +1724,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1695
1724
|
}
|
|
1696
1725
|
return exports.LayoutPriority.Normal;
|
|
1697
1726
|
}
|
|
1698
|
-
|
|
1727
|
+
get disabled() {
|
|
1728
|
+
return this.splitview.disabled;
|
|
1729
|
+
}
|
|
1730
|
+
set disabled(value) {
|
|
1731
|
+
this.splitview.disabled = value;
|
|
1732
|
+
}
|
|
1733
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, childDescriptors) {
|
|
1699
1734
|
super();
|
|
1700
1735
|
this.orientation = orientation;
|
|
1701
1736
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1740,6 +1775,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1740
1775
|
styles,
|
|
1741
1776
|
});
|
|
1742
1777
|
}
|
|
1778
|
+
this.disabled = disabled;
|
|
1743
1779
|
this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
|
|
1744
1780
|
this._onDidChange.fire({});
|
|
1745
1781
|
}));
|
|
@@ -1873,7 +1909,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1873
1909
|
}
|
|
1874
1910
|
function flipNode(node, size, orthogonalSize) {
|
|
1875
1911
|
if (node instanceof BranchNode) {
|
|
1876
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
1912
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1877
1913
|
let totalSize = 0;
|
|
1878
1914
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1879
1915
|
const child = node.children[i];
|
|
@@ -2009,31 +2045,57 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2009
2045
|
get maximumHeight() {
|
|
2010
2046
|
return this.root.maximumHeight;
|
|
2011
2047
|
}
|
|
2048
|
+
get locked() {
|
|
2049
|
+
return this._locked;
|
|
2050
|
+
}
|
|
2051
|
+
set locked(value) {
|
|
2052
|
+
this._locked = value;
|
|
2053
|
+
const branch = [this.root];
|
|
2054
|
+
/**
|
|
2055
|
+
* simple depth-first-search to cover all nodes
|
|
2056
|
+
*
|
|
2057
|
+
* @see https://en.wikipedia.org/wiki/Depth-first_search
|
|
2058
|
+
*/
|
|
2059
|
+
while (branch.length > 0) {
|
|
2060
|
+
const node = branch.pop();
|
|
2061
|
+
if (node instanceof BranchNode) {
|
|
2062
|
+
node.disabled = value;
|
|
2063
|
+
branch.push(...node.children);
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2012
2067
|
maximizedView() {
|
|
2013
2068
|
var _a;
|
|
2014
|
-
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.view;
|
|
2069
|
+
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
2015
2070
|
}
|
|
2016
2071
|
hasMaximizedView() {
|
|
2017
2072
|
return this._maximizedNode !== undefined;
|
|
2018
2073
|
}
|
|
2019
2074
|
maximizeView(view) {
|
|
2075
|
+
var _a;
|
|
2020
2076
|
const location = getGridLocation(view.element);
|
|
2021
2077
|
const [_, node] = this.getNode(location);
|
|
2022
2078
|
if (!(node instanceof LeafNode)) {
|
|
2023
2079
|
return;
|
|
2024
2080
|
}
|
|
2025
|
-
if (this._maximizedNode === node) {
|
|
2081
|
+
if (((_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf) === node) {
|
|
2026
2082
|
return;
|
|
2027
2083
|
}
|
|
2028
2084
|
if (this.hasMaximizedView()) {
|
|
2029
2085
|
this.exitMaximizedView();
|
|
2030
2086
|
}
|
|
2087
|
+
const hiddenOnMaximize = [];
|
|
2031
2088
|
function hideAllViewsBut(parent, exclude) {
|
|
2032
2089
|
for (let i = 0; i < parent.children.length; i++) {
|
|
2033
2090
|
const child = parent.children[i];
|
|
2034
2091
|
if (child instanceof LeafNode) {
|
|
2035
2092
|
if (child !== exclude) {
|
|
2036
|
-
parent.
|
|
2093
|
+
if (parent.isChildVisible(i)) {
|
|
2094
|
+
parent.setChildVisible(i, false);
|
|
2095
|
+
}
|
|
2096
|
+
else {
|
|
2097
|
+
hiddenOnMaximize.push(child);
|
|
2098
|
+
}
|
|
2037
2099
|
}
|
|
2038
2100
|
}
|
|
2039
2101
|
else {
|
|
@@ -2042,18 +2104,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2042
2104
|
}
|
|
2043
2105
|
}
|
|
2044
2106
|
hideAllViewsBut(this.root, node);
|
|
2045
|
-
this._maximizedNode = node;
|
|
2046
|
-
this.
|
|
2107
|
+
this._maximizedNode = { leaf: node, hiddenOnMaximize };
|
|
2108
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2047
2109
|
}
|
|
2048
2110
|
exitMaximizedView() {
|
|
2049
2111
|
if (!this._maximizedNode) {
|
|
2050
2112
|
return;
|
|
2051
2113
|
}
|
|
2114
|
+
const hiddenOnMaximize = this._maximizedNode.hiddenOnMaximize;
|
|
2052
2115
|
function showViewsInReverseOrder(parent) {
|
|
2053
2116
|
for (let index = parent.children.length - 1; index >= 0; index--) {
|
|
2054
2117
|
const child = parent.children[index];
|
|
2055
2118
|
if (child instanceof LeafNode) {
|
|
2056
|
-
|
|
2119
|
+
if (!hiddenOnMaximize.includes(child)) {
|
|
2120
|
+
parent.setChildVisible(index, true);
|
|
2121
|
+
}
|
|
2057
2122
|
}
|
|
2058
2123
|
else {
|
|
2059
2124
|
showViewsInReverseOrder(child);
|
|
@@ -2062,13 +2127,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2062
2127
|
}
|
|
2063
2128
|
showViewsInReverseOrder(this.root);
|
|
2064
2129
|
this._maximizedNode = undefined;
|
|
2065
|
-
this.
|
|
2130
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2066
2131
|
}
|
|
2067
2132
|
serialize() {
|
|
2068
2133
|
if (this.hasMaximizedView()) {
|
|
2069
2134
|
/**
|
|
2070
|
-
* do not persist maximized view state
|
|
2071
|
-
*
|
|
2135
|
+
* do not persist maximized view state
|
|
2136
|
+
* firstly exit any maximized views to ensure the correct dimensions are persisted
|
|
2072
2137
|
*/
|
|
2073
2138
|
this.exitMaximizedView();
|
|
2074
2139
|
}
|
|
@@ -2083,14 +2148,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2083
2148
|
dispose() {
|
|
2084
2149
|
this.disposable.dispose();
|
|
2085
2150
|
this._onDidChange.dispose();
|
|
2086
|
-
this.
|
|
2151
|
+
this._onDidMaximizedNodeChange.dispose();
|
|
2087
2152
|
this.root.dispose();
|
|
2088
2153
|
this._maximizedNode = undefined;
|
|
2089
2154
|
this.element.remove();
|
|
2090
2155
|
}
|
|
2091
2156
|
clear() {
|
|
2092
2157
|
const orientation = this.root.orientation;
|
|
2093
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize);
|
|
2158
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this._locked);
|
|
2094
2159
|
}
|
|
2095
2160
|
deserialize(json, deserializer) {
|
|
2096
2161
|
const orientation = json.orientation;
|
|
@@ -2111,8 +2176,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2111
2176
|
};
|
|
2112
2177
|
});
|
|
2113
2178
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2114
|
-
orthogonalSize, // <- size - flips at each depth
|
|
2115
|
-
children);
|
|
2179
|
+
orthogonalSize, // <- size - flips at each depth,
|
|
2180
|
+
this._locked, children);
|
|
2116
2181
|
}
|
|
2117
2182
|
else {
|
|
2118
2183
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2145,7 +2210,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2145
2210
|
}
|
|
2146
2211
|
const oldRoot = this.root;
|
|
2147
2212
|
oldRoot.element.remove();
|
|
2148
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
|
|
2213
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this._locked);
|
|
2149
2214
|
if (oldRoot.children.length === 0) ;
|
|
2150
2215
|
else if (oldRoot.children.length === 1) {
|
|
2151
2216
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2213,15 +2278,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2213
2278
|
constructor(proportionalLayout, styles, orientation) {
|
|
2214
2279
|
this.proportionalLayout = proportionalLayout;
|
|
2215
2280
|
this.styles = styles;
|
|
2281
|
+
this._locked = false;
|
|
2216
2282
|
this._maximizedNode = undefined;
|
|
2217
2283
|
this.disposable = new MutableDisposable();
|
|
2218
2284
|
this._onDidChange = new Emitter();
|
|
2219
2285
|
this.onDidChange = this._onDidChange.event;
|
|
2220
|
-
this.
|
|
2221
|
-
this.
|
|
2286
|
+
this._onDidMaximizedNodeChange = new Emitter();
|
|
2287
|
+
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2222
2288
|
this.element = document.createElement('div');
|
|
2223
2289
|
this.element.className = 'grid-view';
|
|
2224
|
-
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
2290
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this._locked);
|
|
2225
2291
|
}
|
|
2226
2292
|
isViewVisible(location) {
|
|
2227
2293
|
const [rest, index] = tail(location);
|
|
@@ -2272,7 +2338,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2272
2338
|
}
|
|
2273
2339
|
const child = grandParent.removeChild(parentIndex);
|
|
2274
2340
|
child.dispose();
|
|
2275
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2341
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this._locked);
|
|
2276
2342
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2277
2343
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2278
2344
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2900,13 +2966,36 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2900
2966
|
return this.component.onDidDrop;
|
|
2901
2967
|
}
|
|
2902
2968
|
/**
|
|
2903
|
-
* Invoked
|
|
2969
|
+
* Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and
|
|
2970
|
+
* prevent the event from occuring using the standard `preventDefault()` syntax.
|
|
2971
|
+
*
|
|
2972
|
+
* Preventing certain events may causes unexpected behaviours, use carefully.
|
|
2973
|
+
*/
|
|
2974
|
+
get onWillDrop() {
|
|
2975
|
+
return this.component.onWillDrop;
|
|
2976
|
+
}
|
|
2977
|
+
/**
|
|
2978
|
+
* Invoked before an overlay is shown indicating a drop target.
|
|
2979
|
+
*
|
|
2980
|
+
* Calling `event.preventDefault()` will prevent the overlay being shown and prevent
|
|
2981
|
+
* the any subsequent drop event.
|
|
2982
|
+
*/
|
|
2983
|
+
get onWillShowOverlay() {
|
|
2984
|
+
return this.component.onWillShowOverlay;
|
|
2985
|
+
}
|
|
2986
|
+
/**
|
|
2987
|
+
* Invoked before a group is dragged.
|
|
2988
|
+
*
|
|
2989
|
+
* Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting.
|
|
2990
|
+
*
|
|
2904
2991
|
*/
|
|
2905
2992
|
get onWillDragGroup() {
|
|
2906
2993
|
return this.component.onWillDragGroup;
|
|
2907
2994
|
}
|
|
2908
2995
|
/**
|
|
2909
|
-
* Invoked before a panel is dragged.
|
|
2996
|
+
* Invoked before a panel is dragged.
|
|
2997
|
+
*
|
|
2998
|
+
* Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
|
|
2910
2999
|
*/
|
|
2911
3000
|
get onWillDragPanel() {
|
|
2912
3001
|
return this.component.onWillDragPanel;
|
|
@@ -3034,17 +3123,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3034
3123
|
hasMaximizedGroup() {
|
|
3035
3124
|
return this.component.hasMaximizedGroup();
|
|
3036
3125
|
}
|
|
3037
|
-
|
|
3126
|
+
exitMaximizedGroup() {
|
|
3038
3127
|
this.component.exitMaximizedGroup();
|
|
3039
3128
|
}
|
|
3040
|
-
get
|
|
3041
|
-
return this.component.
|
|
3129
|
+
get onDidMaximizedGroupChange() {
|
|
3130
|
+
return this.component.onDidMaximizedGroupChange;
|
|
3042
3131
|
}
|
|
3043
3132
|
/**
|
|
3044
3133
|
* Add a popout group in a new Window
|
|
3045
3134
|
*/
|
|
3046
3135
|
addPopoutGroup(item, options) {
|
|
3047
|
-
this.component.addPopoutGroup(item, options);
|
|
3136
|
+
return this.component.addPopoutGroup(item, options);
|
|
3048
3137
|
}
|
|
3049
3138
|
}
|
|
3050
3139
|
|
|
@@ -3098,6 +3187,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3098
3187
|
}
|
|
3099
3188
|
}
|
|
3100
3189
|
|
|
3190
|
+
class WillShowOverlayEvent extends DockviewEvent {
|
|
3191
|
+
get nativeEvent() {
|
|
3192
|
+
return this.options.nativeEvent;
|
|
3193
|
+
}
|
|
3194
|
+
get position() {
|
|
3195
|
+
return this.options.position;
|
|
3196
|
+
}
|
|
3197
|
+
constructor(options) {
|
|
3198
|
+
super();
|
|
3199
|
+
this.options = options;
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3101
3202
|
function directionToPosition(direction) {
|
|
3102
3203
|
switch (direction) {
|
|
3103
3204
|
case 'above':
|
|
@@ -3150,6 +3251,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3150
3251
|
this.options = options;
|
|
3151
3252
|
this._onDrop = new Emitter();
|
|
3152
3253
|
this.onDrop = this._onDrop.event;
|
|
3254
|
+
this._onWillShowOverlay = new Emitter();
|
|
3255
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3153
3256
|
// use a set to take advantage of #<set>.has
|
|
3154
3257
|
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
3155
3258
|
this.dnd = new DragAndDropObserver(this.element, {
|
|
@@ -3178,6 +3281,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3178
3281
|
this.removeDropTarget();
|
|
3179
3282
|
return;
|
|
3180
3283
|
}
|
|
3284
|
+
const willShowOverlayEvent = new WillShowOverlayEvent({
|
|
3285
|
+
nativeEvent: e,
|
|
3286
|
+
position: quadrant,
|
|
3287
|
+
});
|
|
3288
|
+
/**
|
|
3289
|
+
* Provide an opportunity to prevent the overlay appearing and in turn
|
|
3290
|
+
* any dnd behaviours
|
|
3291
|
+
*/
|
|
3292
|
+
this._onWillShowOverlay.fire(willShowOverlayEvent);
|
|
3293
|
+
if (willShowOverlayEvent.defaultPrevented) {
|
|
3294
|
+
this.removeDropTarget();
|
|
3295
|
+
return;
|
|
3296
|
+
}
|
|
3181
3297
|
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
3182
3298
|
if (!this.options.canDisplayOverlay) {
|
|
3183
3299
|
this.removeDropTarget();
|
|
@@ -3220,7 +3336,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3220
3336
|
}
|
|
3221
3337
|
},
|
|
3222
3338
|
});
|
|
3223
|
-
this.addDisposables(this._onDrop, this.dnd);
|
|
3339
|
+
this.addDisposables(this._onDrop, this._onWillShowOverlay, this.dnd);
|
|
3224
3340
|
}
|
|
3225
3341
|
setTargetZones(acceptedTargetZones) {
|
|
3226
3342
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
@@ -3273,25 +3389,44 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3273
3389
|
size = clamp(0, sizeOptions.value, height) / height;
|
|
3274
3390
|
}
|
|
3275
3391
|
}
|
|
3276
|
-
const
|
|
3277
|
-
|
|
3278
|
-
|
|
3392
|
+
const box = { top: '0px', left: '0px', width: '100%', height: '100%' };
|
|
3393
|
+
/**
|
|
3394
|
+
* You can also achieve the overlay placement using the transform CSS property
|
|
3395
|
+
* to translate and scale the element however this has the undesired effect of
|
|
3396
|
+
* 'skewing' the element. Comment left here for anybody that ever revisits this.
|
|
3397
|
+
*
|
|
3398
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
|
3399
|
+
*
|
|
3400
|
+
* right
|
|
3401
|
+
* translateX(${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3402
|
+
*
|
|
3403
|
+
* left
|
|
3404
|
+
* translateX(-${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3405
|
+
*
|
|
3406
|
+
* top
|
|
3407
|
+
* translateY(-${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3408
|
+
*
|
|
3409
|
+
* bottom
|
|
3410
|
+
* translateY(${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3411
|
+
*/
|
|
3279
3412
|
if (rightClass) {
|
|
3280
|
-
|
|
3413
|
+
box.left = `${100 * (1 - size)}%`;
|
|
3414
|
+
box.width = `${100 * size}%`;
|
|
3281
3415
|
}
|
|
3282
3416
|
else if (leftClass) {
|
|
3283
|
-
|
|
3417
|
+
box.width = `${100 * size}%`;
|
|
3284
3418
|
}
|
|
3285
3419
|
else if (topClass) {
|
|
3286
|
-
|
|
3420
|
+
box.height = `${100 * size}%`;
|
|
3287
3421
|
}
|
|
3288
3422
|
else if (bottomClass) {
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
else {
|
|
3292
|
-
transform = '';
|
|
3423
|
+
box.top = `${100 * (1 - size)}%`;
|
|
3424
|
+
box.height = `${100 * size}%`;
|
|
3293
3425
|
}
|
|
3294
|
-
this.overlayElement.style.
|
|
3426
|
+
this.overlayElement.style.top = box.top;
|
|
3427
|
+
this.overlayElement.style.left = box.left;
|
|
3428
|
+
this.overlayElement.style.width = box.width;
|
|
3429
|
+
this.overlayElement.style.height = box.height;
|
|
3295
3430
|
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3296
3431
|
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3297
3432
|
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
@@ -3359,14 +3494,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3359
3494
|
return 'center';
|
|
3360
3495
|
}
|
|
3361
3496
|
|
|
3362
|
-
exports.DockviewDropTargets = void 0;
|
|
3363
|
-
(function (DockviewDropTargets) {
|
|
3364
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3365
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3366
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3367
|
-
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3368
|
-
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3369
|
-
|
|
3370
3497
|
class ContentContainer extends CompositeDisposable {
|
|
3371
3498
|
get element() {
|
|
3372
3499
|
return this._element;
|
|
@@ -3394,7 +3521,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3394
3521
|
const data = getPanelData();
|
|
3395
3522
|
if (!data &&
|
|
3396
3523
|
event.shiftKey &&
|
|
3397
|
-
this.group.location !== 'floating') {
|
|
3524
|
+
this.group.location.type !== 'floating') {
|
|
3398
3525
|
return false;
|
|
3399
3526
|
}
|
|
3400
3527
|
if (data && data.viewId === this.accessor.id) {
|
|
@@ -3412,7 +3539,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3412
3539
|
data.groupId === this.group.id;
|
|
3413
3540
|
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3414
3541
|
}
|
|
3415
|
-
return this.group.canDisplayOverlay(event, position,
|
|
3542
|
+
return this.group.canDisplayOverlay(event, position, 'content');
|
|
3416
3543
|
},
|
|
3417
3544
|
});
|
|
3418
3545
|
this.addDisposables(this.dropTarget);
|
|
@@ -3437,7 +3564,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3437
3564
|
let container;
|
|
3438
3565
|
switch (panel.api.renderer) {
|
|
3439
3566
|
case 'onlyWhenVisibile':
|
|
3440
|
-
this.
|
|
3567
|
+
this.group.renderContainer.detatch(panel);
|
|
3441
3568
|
if (this.panel) {
|
|
3442
3569
|
if (doRender) {
|
|
3443
3570
|
this._element.appendChild(this.panel.view.content.element);
|
|
@@ -3449,7 +3576,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3449
3576
|
if (panel.view.content.element.parentElement === this._element) {
|
|
3450
3577
|
this._element.removeChild(panel.view.content.element);
|
|
3451
3578
|
}
|
|
3452
|
-
container = this.
|
|
3579
|
+
container = this.group.renderContainer.attach({
|
|
3453
3580
|
panel,
|
|
3454
3581
|
referenceContainer: this,
|
|
3455
3582
|
});
|
|
@@ -3480,9 +3607,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3480
3607
|
// noop
|
|
3481
3608
|
}
|
|
3482
3609
|
closePanel() {
|
|
3610
|
+
var _a;
|
|
3483
3611
|
if (this.panel) {
|
|
3484
3612
|
if (this.panel.api.renderer === 'onlyWhenVisibile') {
|
|
3485
|
-
this.
|
|
3613
|
+
(_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
|
|
3486
3614
|
}
|
|
3487
3615
|
}
|
|
3488
3616
|
this.panel = undefined;
|
|
@@ -3593,7 +3721,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3593
3721
|
this._element.draggable = true;
|
|
3594
3722
|
toggleClass(this.element, 'inactive-tab', true);
|
|
3595
3723
|
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
3596
|
-
this.
|
|
3724
|
+
this.dropTarget = new Droptarget(this._element, {
|
|
3597
3725
|
acceptedTargetZones: ['center'],
|
|
3598
3726
|
canDisplayOverlay: (event, position) => {
|
|
3599
3727
|
if (this.group.locked) {
|
|
@@ -3608,9 +3736,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3608
3736
|
}
|
|
3609
3737
|
return this.panel.id !== data.panelId;
|
|
3610
3738
|
}
|
|
3611
|
-
return this.group.model.canDisplayOverlay(event, position,
|
|
3739
|
+
return this.group.model.canDisplayOverlay(event, position, 'tab');
|
|
3612
3740
|
},
|
|
3613
3741
|
});
|
|
3742
|
+
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
3614
3743
|
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
3615
3744
|
this._onDragStart.fire(event);
|
|
3616
3745
|
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
@@ -3618,9 +3747,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3618
3747
|
return;
|
|
3619
3748
|
}
|
|
3620
3749
|
this._onChanged.fire(event);
|
|
3621
|
-
}), this.
|
|
3750
|
+
}), this.dropTarget.onDrop((event) => {
|
|
3622
3751
|
this._onDropped.fire(event);
|
|
3623
|
-
}), this.
|
|
3752
|
+
}), this.dropTarget);
|
|
3624
3753
|
}
|
|
3625
3754
|
setActive(isActive) {
|
|
3626
3755
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -3667,7 +3796,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3667
3796
|
}, true));
|
|
3668
3797
|
}
|
|
3669
3798
|
isCancelled(_event) {
|
|
3670
|
-
if (this.group.api.location === 'floating' && !_event.shiftKey) {
|
|
3799
|
+
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
3671
3800
|
return true;
|
|
3672
3801
|
}
|
|
3673
3802
|
return false;
|
|
@@ -3719,7 +3848,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3719
3848
|
this.accessor.doSetGroupActive(this.group);
|
|
3720
3849
|
}));
|
|
3721
3850
|
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3722
|
-
this.
|
|
3851
|
+
this.dropTraget = new Droptarget(this._element, {
|
|
3723
3852
|
acceptedTargetZones: ['center'],
|
|
3724
3853
|
canDisplayOverlay: (event, position) => {
|
|
3725
3854
|
var _a;
|
|
@@ -3733,14 +3862,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3733
3862
|
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
3734
3863
|
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
3735
3864
|
}
|
|
3736
|
-
return group.model.canDisplayOverlay(event, position,
|
|
3865
|
+
return group.model.canDisplayOverlay(event, position, 'header_space');
|
|
3737
3866
|
},
|
|
3738
3867
|
});
|
|
3868
|
+
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
3739
3869
|
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3740
3870
|
this._onDragStart.fire(event);
|
|
3741
|
-
}), this.
|
|
3871
|
+
}), this.dropTraget.onDrop((event) => {
|
|
3742
3872
|
this._onDrop.fire(event);
|
|
3743
|
-
}), this.
|
|
3873
|
+
}), this.dropTraget);
|
|
3744
3874
|
}
|
|
3745
3875
|
}
|
|
3746
3876
|
|
|
@@ -3828,19 +3958,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3828
3958
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
3829
3959
|
this._onGroupDragStart = new Emitter();
|
|
3830
3960
|
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3831
|
-
this.
|
|
3961
|
+
this._onWillShowOverlay = new Emitter();
|
|
3962
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3832
3963
|
this._element = document.createElement('div');
|
|
3833
3964
|
this._element.className = 'tabs-and-actions-container';
|
|
3834
3965
|
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
3835
|
-
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3836
|
-
if (e.api.group === this.group) {
|
|
3837
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3838
|
-
}
|
|
3839
|
-
}), this.accessor.onDidRemovePanel((e) => {
|
|
3840
|
-
if (e.api.group === this.group) {
|
|
3841
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3842
|
-
}
|
|
3843
|
-
}));
|
|
3844
3966
|
this.rightActionsContainer = document.createElement('div');
|
|
3845
3967
|
this.rightActionsContainer.className = 'right-actions-container';
|
|
3846
3968
|
this.leftActionsContainer = document.createElement('div');
|
|
@@ -3855,7 +3977,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3855
3977
|
this._element.appendChild(this.leftActionsContainer);
|
|
3856
3978
|
this._element.appendChild(this.voidContainer.element);
|
|
3857
3979
|
this._element.appendChild(this.rightActionsContainer);
|
|
3858
|
-
this.addDisposables(this.
|
|
3980
|
+
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3981
|
+
if (e.api.group === this.group) {
|
|
3982
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3983
|
+
}
|
|
3984
|
+
}), this.accessor.onDidRemovePanel((e) => {
|
|
3985
|
+
if (e.api.group === this.group) {
|
|
3986
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3987
|
+
}
|
|
3988
|
+
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3859
3989
|
this._onGroupDragStart.fire({
|
|
3860
3990
|
nativeEvent: event,
|
|
3861
3991
|
group: this.group,
|
|
@@ -3865,11 +3995,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3865
3995
|
event: event.nativeEvent,
|
|
3866
3996
|
index: this.tabs.length,
|
|
3867
3997
|
});
|
|
3998
|
+
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
3999
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4000
|
+
kind: 'header_space',
|
|
4001
|
+
}));
|
|
3868
4002
|
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
3869
4003
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3870
4004
|
if (isFloatingGroupsEnabled &&
|
|
3871
4005
|
event.shiftKey &&
|
|
3872
|
-
this.group.api.location !== 'floating') {
|
|
4006
|
+
this.group.api.location.type !== 'floating') {
|
|
3873
4007
|
event.preventDefault();
|
|
3874
4008
|
const { top, left } = this.element.getBoundingClientRect();
|
|
3875
4009
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
@@ -3932,9 +4066,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3932
4066
|
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
3933
4067
|
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
3934
4068
|
}), tab.onChanged((event) => {
|
|
3935
|
-
var _a;
|
|
3936
4069
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3937
|
-
const isFloatingWithOnePanel = this.group.api.location === 'floating' &&
|
|
4070
|
+
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
4071
|
+
this.size === 1;
|
|
3938
4072
|
if (isFloatingGroupsEnabled &&
|
|
3939
4073
|
!isFloatingWithOnePanel &&
|
|
3940
4074
|
event.shiftKey) {
|
|
@@ -3948,20 +4082,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3948
4082
|
}, { inDragMode: true });
|
|
3949
4083
|
return;
|
|
3950
4084
|
}
|
|
3951
|
-
const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
3952
|
-
this.group.model.isContentFocused;
|
|
3953
4085
|
const isLeftClick = event.button === 0;
|
|
3954
4086
|
if (!isLeftClick || event.defaultPrevented) {
|
|
3955
4087
|
return;
|
|
3956
4088
|
}
|
|
3957
|
-
this.group.
|
|
3958
|
-
|
|
3959
|
-
}
|
|
4089
|
+
if (this.group.activePanel !== panel) {
|
|
4090
|
+
this.group.model.openPanel(panel);
|
|
4091
|
+
}
|
|
3960
4092
|
}), tab.onDrop((event) => {
|
|
3961
4093
|
this._onDrop.fire({
|
|
3962
4094
|
event: event.nativeEvent,
|
|
3963
4095
|
index: this.tabs.findIndex((x) => x.value === tab),
|
|
3964
4096
|
});
|
|
4097
|
+
}), tab.onWillShowOverlay((event) => {
|
|
4098
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, { kind: 'tab' }));
|
|
3965
4099
|
}));
|
|
3966
4100
|
const value = { value: tab, disposable };
|
|
3967
4101
|
this.addTab(value, index);
|
|
@@ -3979,6 +4113,60 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3979
4113
|
}
|
|
3980
4114
|
}
|
|
3981
4115
|
|
|
4116
|
+
class DockviewDidDropEvent extends DockviewEvent {
|
|
4117
|
+
get nativeEvent() {
|
|
4118
|
+
return this.options.nativeEvent;
|
|
4119
|
+
}
|
|
4120
|
+
get position() {
|
|
4121
|
+
return this.options.position;
|
|
4122
|
+
}
|
|
4123
|
+
get panel() {
|
|
4124
|
+
return this.options.panel;
|
|
4125
|
+
}
|
|
4126
|
+
get group() {
|
|
4127
|
+
return this.options.group;
|
|
4128
|
+
}
|
|
4129
|
+
get api() {
|
|
4130
|
+
return this.options.api;
|
|
4131
|
+
}
|
|
4132
|
+
constructor(options) {
|
|
4133
|
+
super();
|
|
4134
|
+
this.options = options;
|
|
4135
|
+
}
|
|
4136
|
+
getData() {
|
|
4137
|
+
return this.options.getData();
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4141
|
+
get kind() {
|
|
4142
|
+
return this._kind;
|
|
4143
|
+
}
|
|
4144
|
+
constructor(options) {
|
|
4145
|
+
super(options);
|
|
4146
|
+
this._kind = options.kind;
|
|
4147
|
+
}
|
|
4148
|
+
}
|
|
4149
|
+
class WillShowOverlayLocationEvent {
|
|
4150
|
+
get kind() {
|
|
4151
|
+
return this._kind;
|
|
4152
|
+
}
|
|
4153
|
+
get nativeEvent() {
|
|
4154
|
+
return this.event.nativeEvent;
|
|
4155
|
+
}
|
|
4156
|
+
get position() {
|
|
4157
|
+
return this.event.position;
|
|
4158
|
+
}
|
|
4159
|
+
get defaultPrevented() {
|
|
4160
|
+
return this.event.defaultPrevented;
|
|
4161
|
+
}
|
|
4162
|
+
preventDefault() {
|
|
4163
|
+
this.event.preventDefault();
|
|
4164
|
+
}
|
|
4165
|
+
constructor(event, options) {
|
|
4166
|
+
this.event = event;
|
|
4167
|
+
this._kind = options.kind;
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
3982
4170
|
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
3983
4171
|
get element() {
|
|
3984
4172
|
throw new Error('not supported');
|
|
@@ -4024,7 +4212,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4024
4212
|
this._location = value;
|
|
4025
4213
|
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4026
4214
|
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4027
|
-
switch (value) {
|
|
4215
|
+
switch (value.type) {
|
|
4028
4216
|
case 'grid':
|
|
4029
4217
|
this.contentContainer.dropTarget.setTargetZones([
|
|
4030
4218
|
'top',
|
|
@@ -4060,7 +4248,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4060
4248
|
this.groupPanel = groupPanel;
|
|
4061
4249
|
this._isGroupActive = false;
|
|
4062
4250
|
this._locked = false;
|
|
4063
|
-
this._location = 'grid';
|
|
4251
|
+
this._location = { type: 'grid' };
|
|
4064
4252
|
this.mostRecentlyUsed = [];
|
|
4065
4253
|
this._onDidChange = new Emitter();
|
|
4066
4254
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -4071,6 +4259,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4071
4259
|
this.onMove = this._onMove.event;
|
|
4072
4260
|
this._onDidDrop = new Emitter();
|
|
4073
4261
|
this.onDidDrop = this._onDidDrop.event;
|
|
4262
|
+
this._onWillDrop = new Emitter();
|
|
4263
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
4264
|
+
this._onWillShowOverlay = new Emitter();
|
|
4265
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4074
4266
|
this._onTabDragStart = new Emitter();
|
|
4075
4267
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
4076
4268
|
this._onGroupDragStart = new Emitter();
|
|
@@ -4081,46 +4273,69 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4081
4273
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4082
4274
|
this._onDidActivePanelChange = new Emitter();
|
|
4083
4275
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4276
|
+
this._overwriteRenderContainer = null;
|
|
4084
4277
|
toggleClass(this.container, 'groupview', true);
|
|
4278
|
+
this._api = new DockviewApi(this.accessor);
|
|
4085
4279
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
4086
4280
|
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
4087
4281
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
4088
4282
|
this.header.hidden = !!options.hideHeader;
|
|
4089
4283
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
4090
|
-
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this.tabsContainer.onTabDragStart((event) => {
|
|
4284
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
4091
4285
|
this._onTabDragStart.fire(event);
|
|
4092
4286
|
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
4093
4287
|
this._onGroupDragStart.fire(event);
|
|
4094
4288
|
}), this.tabsContainer.onDrop((event) => {
|
|
4095
|
-
this.handleDropEvent(event.event, 'center', event.index);
|
|
4289
|
+
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
4096
4290
|
}), this.contentContainer.onDidFocus(() => {
|
|
4097
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4291
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4098
4292
|
}), this.contentContainer.onDidBlur(() => {
|
|
4099
4293
|
// noop
|
|
4100
4294
|
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
4101
|
-
this.handleDropEvent(event.nativeEvent, event.position);
|
|
4102
|
-
}), this.
|
|
4295
|
+
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
4296
|
+
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
4297
|
+
this._onWillShowOverlay.fire(event);
|
|
4298
|
+
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
4299
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4300
|
+
kind: 'content',
|
|
4301
|
+
}));
|
|
4302
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
4303
|
+
}
|
|
4304
|
+
focusContent() {
|
|
4305
|
+
this.contentContainer.element.focus();
|
|
4306
|
+
}
|
|
4307
|
+
set renderContainer(value) {
|
|
4308
|
+
this.panels.forEach((panel) => {
|
|
4309
|
+
this.renderContainer.detatch(panel);
|
|
4310
|
+
});
|
|
4311
|
+
this._overwriteRenderContainer = value;
|
|
4312
|
+
this.panels.forEach((panel) => {
|
|
4313
|
+
this.rerender(panel);
|
|
4314
|
+
});
|
|
4315
|
+
}
|
|
4316
|
+
get renderContainer() {
|
|
4317
|
+
var _a;
|
|
4318
|
+
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
4103
4319
|
}
|
|
4104
4320
|
initialize() {
|
|
4105
|
-
|
|
4106
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
|
|
4321
|
+
if (this.options.panels) {
|
|
4107
4322
|
this.options.panels.forEach((panel) => {
|
|
4108
4323
|
this.doAddPanel(panel);
|
|
4109
4324
|
});
|
|
4110
4325
|
}
|
|
4111
|
-
if (
|
|
4326
|
+
if (this.options.activePanel) {
|
|
4112
4327
|
this.openPanel(this.options.activePanel);
|
|
4113
4328
|
}
|
|
4114
4329
|
// must be run after the constructor otherwise this.parent may not be
|
|
4115
4330
|
// correctly initialized
|
|
4116
|
-
this.setActive(this.isActive, true
|
|
4331
|
+
this.setActive(this.isActive, true);
|
|
4117
4332
|
this.updateContainer();
|
|
4118
4333
|
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
4119
4334
|
this._rightHeaderActions =
|
|
4120
4335
|
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
4121
4336
|
this.addDisposables(this._rightHeaderActions);
|
|
4122
4337
|
this._rightHeaderActions.init({
|
|
4123
|
-
containerApi:
|
|
4338
|
+
containerApi: this._api,
|
|
4124
4339
|
api: this.groupPanel.api,
|
|
4125
4340
|
});
|
|
4126
4341
|
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
@@ -4130,7 +4345,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4130
4345
|
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
4131
4346
|
this.addDisposables(this._leftHeaderActions);
|
|
4132
4347
|
this._leftHeaderActions.init({
|
|
4133
|
-
containerApi:
|
|
4348
|
+
containerApi: this._api,
|
|
4134
4349
|
api: this.groupPanel.api,
|
|
4135
4350
|
});
|
|
4136
4351
|
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
@@ -4140,7 +4355,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4140
4355
|
this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
|
|
4141
4356
|
this.addDisposables(this._prefixHeaderActions);
|
|
4142
4357
|
this._prefixHeaderActions.init({
|
|
4143
|
-
containerApi:
|
|
4358
|
+
containerApi: this._api,
|
|
4144
4359
|
api: this.groupPanel.api,
|
|
4145
4360
|
});
|
|
4146
4361
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
@@ -4220,35 +4435,45 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4220
4435
|
//noop
|
|
4221
4436
|
}
|
|
4222
4437
|
focus() {
|
|
4223
|
-
var _a
|
|
4224
|
-
(
|
|
4438
|
+
var _a;
|
|
4439
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4225
4440
|
}
|
|
4226
4441
|
openPanel(panel, options = {}) {
|
|
4442
|
+
/**
|
|
4443
|
+
* set the panel group
|
|
4444
|
+
* add the panel
|
|
4445
|
+
* check if group active
|
|
4446
|
+
* check if panel active
|
|
4447
|
+
*/
|
|
4227
4448
|
if (typeof options.index !== 'number' ||
|
|
4228
4449
|
options.index > this.panels.length) {
|
|
4229
4450
|
options.index = this.panels.length;
|
|
4230
4451
|
}
|
|
4231
|
-
const
|
|
4232
|
-
const skipSetGroupActive = !!options.skipSetGroupActive;
|
|
4452
|
+
const skipSetActive = !!options.skipSetActive;
|
|
4233
4453
|
// ensure the group is updated before we fire any events
|
|
4234
|
-
panel.updateParentGroup(this.groupPanel,
|
|
4454
|
+
panel.updateParentGroup(this.groupPanel, {
|
|
4455
|
+
skipSetActive: options.skipSetActive,
|
|
4456
|
+
});
|
|
4457
|
+
this.doAddPanel(panel, options.index, {
|
|
4458
|
+
skipSetActive: skipSetActive,
|
|
4459
|
+
});
|
|
4235
4460
|
if (this._activePanel === panel) {
|
|
4236
|
-
if (!skipSetGroupActive) {
|
|
4237
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4238
|
-
}
|
|
4239
4461
|
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
4240
4462
|
return;
|
|
4241
4463
|
}
|
|
4242
|
-
|
|
4243
|
-
if (!skipSetPanelActive) {
|
|
4464
|
+
if (!skipSetActive) {
|
|
4244
4465
|
this.doSetActivePanel(panel);
|
|
4245
4466
|
}
|
|
4246
|
-
if (!skipSetGroupActive) {
|
|
4247
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4467
|
+
if (!options.skipSetGroupActive) {
|
|
4468
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4469
|
+
}
|
|
4470
|
+
if (!options.skipSetActive) {
|
|
4471
|
+
this.updateContainer();
|
|
4248
4472
|
}
|
|
4249
|
-
this.updateContainer();
|
|
4250
4473
|
}
|
|
4251
|
-
removePanel(groupItemOrId
|
|
4474
|
+
removePanel(groupItemOrId, options = {
|
|
4475
|
+
skipSetActive: false,
|
|
4476
|
+
}) {
|
|
4252
4477
|
const id = typeof groupItemOrId === 'string'
|
|
4253
4478
|
? groupItemOrId
|
|
4254
4479
|
: groupItemOrId.id;
|
|
@@ -4256,7 +4481,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4256
4481
|
if (!panelToRemove) {
|
|
4257
4482
|
throw new Error('invalid operation');
|
|
4258
4483
|
}
|
|
4259
|
-
return this._removePanel(panelToRemove);
|
|
4484
|
+
return this._removePanel(panelToRemove, options);
|
|
4260
4485
|
}
|
|
4261
4486
|
closeAllPanels() {
|
|
4262
4487
|
if (this.panels.length > 0) {
|
|
@@ -4282,12 +4507,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4282
4507
|
updateActions(element) {
|
|
4283
4508
|
this.tabsContainer.setRightActionsElement(element);
|
|
4284
4509
|
}
|
|
4285
|
-
setActive(isGroupActive,
|
|
4286
|
-
var _a, _b, _c, _d;
|
|
4510
|
+
setActive(isGroupActive, force = false) {
|
|
4287
4511
|
if (!force && this.isActive === isGroupActive) {
|
|
4288
|
-
if (!skipFocus) {
|
|
4289
|
-
(_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4290
|
-
}
|
|
4291
4512
|
return;
|
|
4292
4513
|
}
|
|
4293
4514
|
this._isGroupActive = isGroupActive;
|
|
@@ -4298,11 +4519,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4298
4519
|
this.doSetActivePanel(this.panels[0]);
|
|
4299
4520
|
}
|
|
4300
4521
|
this.updateContainer();
|
|
4301
|
-
if (isGroupActive) {
|
|
4302
|
-
if (!skipFocus) {
|
|
4303
|
-
(_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
4304
|
-
}
|
|
4305
|
-
}
|
|
4306
4522
|
}
|
|
4307
4523
|
layout(width, height) {
|
|
4308
4524
|
var _a;
|
|
@@ -4313,17 +4529,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4313
4529
|
this._activePanel.layout(this._width, this._height);
|
|
4314
4530
|
}
|
|
4315
4531
|
}
|
|
4316
|
-
_removePanel(panel) {
|
|
4532
|
+
_removePanel(panel, options) {
|
|
4317
4533
|
const isActivePanel = this._activePanel === panel;
|
|
4318
4534
|
this.doRemovePanel(panel);
|
|
4319
4535
|
if (isActivePanel && this.panels.length > 0) {
|
|
4320
4536
|
const nextPanel = this.mostRecentlyUsed[0];
|
|
4321
|
-
this.openPanel(nextPanel
|
|
4537
|
+
this.openPanel(nextPanel, {
|
|
4538
|
+
skipSetActive: options.skipSetActive,
|
|
4539
|
+
skipSetGroupActive: options.skipSetActiveGroup,
|
|
4540
|
+
});
|
|
4322
4541
|
}
|
|
4323
4542
|
if (this._activePanel && this.panels.length === 0) {
|
|
4324
4543
|
this.doSetActivePanel(undefined);
|
|
4325
4544
|
}
|
|
4326
|
-
|
|
4545
|
+
if (!options.skipSetActive) {
|
|
4546
|
+
this.updateContainer();
|
|
4547
|
+
}
|
|
4327
4548
|
return panel;
|
|
4328
4549
|
}
|
|
4329
4550
|
doRemovePanel(panel) {
|
|
@@ -4338,13 +4559,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4338
4559
|
}
|
|
4339
4560
|
this._onDidRemovePanel.fire({ panel });
|
|
4340
4561
|
}
|
|
4341
|
-
doAddPanel(panel, index = this.panels.length,
|
|
4562
|
+
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
4342
4563
|
const existingPanel = this._panels.indexOf(panel);
|
|
4343
4564
|
const hasExistingPanel = existingPanel > -1;
|
|
4344
4565
|
this.tabsContainer.show();
|
|
4345
4566
|
this.contentContainer.show();
|
|
4346
4567
|
this.tabsContainer.openPanel(panel, index);
|
|
4347
|
-
if (!skipSetActive) {
|
|
4568
|
+
if (!options.skipSetActive) {
|
|
4348
4569
|
this.contentContainer.openPanel(panel);
|
|
4349
4570
|
}
|
|
4350
4571
|
if (hasExistingPanel) {
|
|
@@ -4356,12 +4577,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4356
4577
|
this._onDidAddPanel.fire({ panel });
|
|
4357
4578
|
}
|
|
4358
4579
|
doSetActivePanel(panel) {
|
|
4580
|
+
if (this._activePanel === panel) {
|
|
4581
|
+
return;
|
|
4582
|
+
}
|
|
4359
4583
|
this._activePanel = panel;
|
|
4360
4584
|
if (panel) {
|
|
4361
4585
|
this.tabsContainer.setActivePanel(panel);
|
|
4362
4586
|
panel.layout(this._width, this._height);
|
|
4363
4587
|
this.updateMru(panel);
|
|
4364
|
-
this._onDidActivePanelChange.fire({
|
|
4588
|
+
this._onDidActivePanelChange.fire({
|
|
4589
|
+
panel,
|
|
4590
|
+
});
|
|
4365
4591
|
}
|
|
4366
4592
|
}
|
|
4367
4593
|
updateMru(panel) {
|
|
@@ -4373,11 +4599,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4373
4599
|
updateContainer() {
|
|
4374
4600
|
var _a, _b;
|
|
4375
4601
|
toggleClass(this.container, 'empty', this.isEmpty);
|
|
4376
|
-
this.panels.forEach((panel) => panel.
|
|
4602
|
+
this.panels.forEach((panel) => panel.runEvents());
|
|
4377
4603
|
if (this.isEmpty && !this.watermark) {
|
|
4378
4604
|
const watermark = this.accessor.createWatermarkComponent();
|
|
4379
4605
|
watermark.init({
|
|
4380
|
-
containerApi:
|
|
4606
|
+
containerApi: this._api,
|
|
4381
4607
|
group: this.groupPanel,
|
|
4382
4608
|
});
|
|
4383
4609
|
this.watermark = watermark;
|
|
@@ -4410,10 +4636,32 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4410
4636
|
}
|
|
4411
4637
|
return false;
|
|
4412
4638
|
}
|
|
4413
|
-
handleDropEvent(event, position, index) {
|
|
4639
|
+
handleDropEvent(type, event, position, index) {
|
|
4414
4640
|
if (this.locked === 'no-drop-target') {
|
|
4415
4641
|
return;
|
|
4416
4642
|
}
|
|
4643
|
+
function getKind() {
|
|
4644
|
+
switch (type) {
|
|
4645
|
+
case 'header':
|
|
4646
|
+
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
4647
|
+
case 'content':
|
|
4648
|
+
return 'content';
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
4652
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
4653
|
+
nativeEvent: event,
|
|
4654
|
+
position,
|
|
4655
|
+
panel,
|
|
4656
|
+
getData: () => getPanelData(),
|
|
4657
|
+
kind: getKind(),
|
|
4658
|
+
group: this.groupPanel,
|
|
4659
|
+
api: this._api,
|
|
4660
|
+
});
|
|
4661
|
+
this._onWillDrop.fire(willDropEvent);
|
|
4662
|
+
if (willDropEvent.defaultPrevented) {
|
|
4663
|
+
return;
|
|
4664
|
+
}
|
|
4417
4665
|
const data = getPanelData();
|
|
4418
4666
|
if (data && data.viewId === this.accessor.id) {
|
|
4419
4667
|
if (data.panelId === null) {
|
|
@@ -4446,12 +4694,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4446
4694
|
});
|
|
4447
4695
|
}
|
|
4448
4696
|
else {
|
|
4449
|
-
this._onDidDrop.fire({
|
|
4697
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
4450
4698
|
nativeEvent: event,
|
|
4451
4699
|
position,
|
|
4452
|
-
|
|
4700
|
+
panel,
|
|
4453
4701
|
getData: () => getPanelData(),
|
|
4454
|
-
|
|
4702
|
+
group: this.groupPanel,
|
|
4703
|
+
api: this._api,
|
|
4704
|
+
}));
|
|
4455
4705
|
}
|
|
4456
4706
|
}
|
|
4457
4707
|
dispose() {
|
|
@@ -4459,6 +4709,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4459
4709
|
super.dispose();
|
|
4460
4710
|
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
4461
4711
|
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4712
|
+
this.watermark = undefined;
|
|
4462
4713
|
for (const panel of this.panels) {
|
|
4463
4714
|
panel.dispose();
|
|
4464
4715
|
}
|
|
@@ -4480,15 +4731,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4480
4731
|
constructor(parentElement, disableResizing = false) {
|
|
4481
4732
|
super();
|
|
4482
4733
|
this._disableResizing = disableResizing;
|
|
4483
|
-
|
|
4484
|
-
this._element = parentElement;
|
|
4485
|
-
}
|
|
4486
|
-
else {
|
|
4487
|
-
this._element = document.createElement('div');
|
|
4488
|
-
this._element.style.height = '100%';
|
|
4489
|
-
this._element.style.width = '100%';
|
|
4490
|
-
this._element.className = 'dv-resizable-container';
|
|
4491
|
-
}
|
|
4734
|
+
this._element = parentElement;
|
|
4492
4735
|
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
4493
4736
|
if (this.isDisposed) {
|
|
4494
4737
|
/**
|
|
@@ -4576,25 +4819,38 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4576
4819
|
get activeGroup() {
|
|
4577
4820
|
return this._activeGroup;
|
|
4578
4821
|
}
|
|
4822
|
+
get locked() {
|
|
4823
|
+
return this.gridview.locked;
|
|
4824
|
+
}
|
|
4825
|
+
set locked(value) {
|
|
4826
|
+
this.gridview.locked = value;
|
|
4827
|
+
}
|
|
4579
4828
|
constructor(options) {
|
|
4580
|
-
super(
|
|
4829
|
+
super(document.createElement('div'), options.disableAutoResizing);
|
|
4581
4830
|
this._id = nextLayoutId$1.next();
|
|
4582
4831
|
this._groups = new Map();
|
|
4583
4832
|
this._onDidLayoutChange = new Emitter();
|
|
4584
4833
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
4585
|
-
this.
|
|
4586
|
-
this.
|
|
4587
|
-
this.
|
|
4588
|
-
this.
|
|
4589
|
-
this.
|
|
4590
|
-
this.
|
|
4834
|
+
this._onDidRemove = new Emitter();
|
|
4835
|
+
this.onDidRemove = this._onDidRemove.event;
|
|
4836
|
+
this._onDidAdd = new Emitter();
|
|
4837
|
+
this.onDidAdd = this._onDidAdd.event;
|
|
4838
|
+
this._onDidActiveChange = new Emitter();
|
|
4839
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4591
4840
|
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
4841
|
+
this.element.style.height = '100%';
|
|
4842
|
+
this.element.style.width = '100%';
|
|
4843
|
+
options.parentElement.appendChild(this.element);
|
|
4592
4844
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
4845
|
+
this.gridview.locked = !!options.locked;
|
|
4593
4846
|
this.element.appendChild(this.gridview.element);
|
|
4594
4847
|
this.layout(0, 0, true); // set some elements height/widths
|
|
4595
|
-
this.addDisposables(
|
|
4848
|
+
this.addDisposables(Disposable.from(() => {
|
|
4849
|
+
var _a;
|
|
4850
|
+
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
4851
|
+
}), this.gridview.onDidChange(() => {
|
|
4596
4852
|
this._bufferOnDidLayoutChange.fire();
|
|
4597
|
-
}), exports.DockviewEvent.any(this.
|
|
4853
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
4598
4854
|
this._bufferOnDidLayoutChange.fire();
|
|
4599
4855
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
4600
4856
|
this._onDidLayoutChange.fire();
|
|
@@ -4609,6 +4865,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4609
4865
|
}
|
|
4610
4866
|
maximizeGroup(panel) {
|
|
4611
4867
|
this.gridview.maximizeView(panel);
|
|
4868
|
+
this.doSetGroupActive(panel);
|
|
4612
4869
|
}
|
|
4613
4870
|
isMaximizedGroup(panel) {
|
|
4614
4871
|
return this.gridview.maximizedView() === panel;
|
|
@@ -4619,13 +4876,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4619
4876
|
hasMaximizedGroup() {
|
|
4620
4877
|
return this.gridview.hasMaximizedView();
|
|
4621
4878
|
}
|
|
4622
|
-
get
|
|
4623
|
-
return this.gridview.
|
|
4879
|
+
get onDidMaximizedGroupChange() {
|
|
4880
|
+
return this.gridview.onDidMaximizedNodeChange;
|
|
4624
4881
|
}
|
|
4625
4882
|
doAddGroup(group, location = [0], size) {
|
|
4626
4883
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
4627
|
-
this.
|
|
4628
|
-
this.doSetGroupActive(group);
|
|
4884
|
+
this._onDidAdd.fire(group);
|
|
4629
4885
|
}
|
|
4630
4886
|
doRemoveGroup(group, options) {
|
|
4631
4887
|
if (!this._groups.has(group.id)) {
|
|
@@ -4637,8 +4893,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4637
4893
|
item.disposable.dispose();
|
|
4638
4894
|
item.value.dispose();
|
|
4639
4895
|
this._groups.delete(group.id);
|
|
4896
|
+
this._onDidRemove.fire(group);
|
|
4640
4897
|
}
|
|
4641
|
-
this._onDidRemoveGroup.fire(group);
|
|
4642
4898
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
4643
4899
|
const groups = Array.from(this._groups.values());
|
|
4644
4900
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -4649,25 +4905,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4649
4905
|
var _a;
|
|
4650
4906
|
return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4651
4907
|
}
|
|
4652
|
-
doSetGroupActive(group
|
|
4653
|
-
var _a, _b, _c;
|
|
4908
|
+
doSetGroupActive(group) {
|
|
4654
4909
|
if (this._activeGroup === group) {
|
|
4655
4910
|
return;
|
|
4656
4911
|
}
|
|
4657
4912
|
if (this._activeGroup) {
|
|
4658
4913
|
this._activeGroup.setActive(false);
|
|
4659
|
-
if (!skipFocus) {
|
|
4660
|
-
(_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4661
|
-
}
|
|
4662
4914
|
}
|
|
4663
4915
|
if (group) {
|
|
4664
4916
|
group.setActive(true);
|
|
4665
|
-
if (!skipFocus) {
|
|
4666
|
-
(_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
|
|
4667
|
-
}
|
|
4668
4917
|
}
|
|
4669
4918
|
this._activeGroup = group;
|
|
4670
|
-
this.
|
|
4919
|
+
this._onDidActiveChange.fire(group);
|
|
4671
4920
|
}
|
|
4672
4921
|
removeGroup(group) {
|
|
4673
4922
|
this.doRemoveGroup(group);
|
|
@@ -4712,9 +4961,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4712
4961
|
this.gridview.layout(width, height);
|
|
4713
4962
|
}
|
|
4714
4963
|
dispose() {
|
|
4715
|
-
this.
|
|
4716
|
-
this.
|
|
4717
|
-
this.
|
|
4964
|
+
this._onDidActiveChange.dispose();
|
|
4965
|
+
this._onDidAdd.dispose();
|
|
4966
|
+
this._onDidRemove.dispose();
|
|
4718
4967
|
this._onDidLayoutChange.dispose();
|
|
4719
4968
|
for (const group of this.groups) {
|
|
4720
4969
|
group.dispose();
|
|
@@ -4724,11 +4973,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4724
4973
|
}
|
|
4725
4974
|
}
|
|
4726
4975
|
|
|
4976
|
+
class WillFocusEvent extends DockviewEvent {
|
|
4977
|
+
constructor() {
|
|
4978
|
+
super();
|
|
4979
|
+
}
|
|
4980
|
+
}
|
|
4727
4981
|
/**
|
|
4728
4982
|
* A core api implementation that should be used across all panel-like objects
|
|
4729
4983
|
*/
|
|
4730
4984
|
class PanelApiImpl extends CompositeDisposable {
|
|
4731
|
-
//
|
|
4732
4985
|
get isFocused() {
|
|
4733
4986
|
return this._isFocused;
|
|
4734
4987
|
}
|
|
@@ -4753,35 +5006,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4753
5006
|
this._width = 0;
|
|
4754
5007
|
this._height = 0;
|
|
4755
5008
|
this.panelUpdatesDisposable = new MutableDisposable();
|
|
4756
|
-
this._onDidDimensionChange = new Emitter(
|
|
4757
|
-
replay: true,
|
|
4758
|
-
});
|
|
5009
|
+
this._onDidDimensionChange = new Emitter();
|
|
4759
5010
|
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
4760
|
-
|
|
4761
|
-
this._onDidChangeFocus = new Emitter({
|
|
4762
|
-
replay: true,
|
|
4763
|
-
});
|
|
5011
|
+
this._onDidChangeFocus = new Emitter();
|
|
4764
5012
|
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
4765
5013
|
//
|
|
4766
|
-
this.
|
|
4767
|
-
this.
|
|
5014
|
+
this._onWillFocus = new Emitter();
|
|
5015
|
+
this.onWillFocus = this._onWillFocus.event;
|
|
4768
5016
|
//
|
|
4769
|
-
this._onDidVisibilityChange = new Emitter(
|
|
4770
|
-
replay: true,
|
|
4771
|
-
});
|
|
5017
|
+
this._onDidVisibilityChange = new Emitter();
|
|
4772
5018
|
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
4773
|
-
|
|
4774
|
-
this.
|
|
4775
|
-
this.
|
|
4776
|
-
//
|
|
4777
|
-
this._onDidActiveChange = new Emitter({
|
|
4778
|
-
replay: true,
|
|
4779
|
-
});
|
|
5019
|
+
this._onWillVisibilityChange = new Emitter();
|
|
5020
|
+
this.onWillVisibilityChange = this._onWillVisibilityChange.event;
|
|
5021
|
+
this._onDidActiveChange = new Emitter();
|
|
4780
5022
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4781
|
-
//
|
|
4782
5023
|
this._onActiveChange = new Emitter();
|
|
4783
5024
|
this.onActiveChange = this._onActiveChange.event;
|
|
4784
|
-
//
|
|
4785
5025
|
this._onUpdateParameters = new Emitter();
|
|
4786
5026
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
4787
5027
|
this.addDisposables(this.onDidFocusChange((event) => {
|
|
@@ -4793,7 +5033,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4793
5033
|
}), this.onDidDimensionsChange((event) => {
|
|
4794
5034
|
this._width = event.width;
|
|
4795
5035
|
this._height = event.height;
|
|
4796
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this.
|
|
5036
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
|
|
4797
5037
|
}
|
|
4798
5038
|
initialize(panel) {
|
|
4799
5039
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
@@ -4803,7 +5043,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4803
5043
|
});
|
|
4804
5044
|
}
|
|
4805
5045
|
setVisible(isVisible) {
|
|
4806
|
-
this.
|
|
5046
|
+
this._onWillVisibilityChange.fire({ isVisible });
|
|
4807
5047
|
}
|
|
4808
5048
|
setActive() {
|
|
4809
5049
|
this._onActiveChange.fire();
|
|
@@ -4811,9 +5051,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4811
5051
|
updateParameters(parameters) {
|
|
4812
5052
|
this._onUpdateParameters.fire(parameters);
|
|
4813
5053
|
}
|
|
4814
|
-
dispose() {
|
|
4815
|
-
super.dispose();
|
|
4816
|
-
}
|
|
4817
5054
|
}
|
|
4818
5055
|
|
|
4819
5056
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
@@ -4901,7 +5138,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4901
5138
|
}), focusTracker);
|
|
4902
5139
|
}
|
|
4903
5140
|
focus() {
|
|
4904
|
-
|
|
5141
|
+
const event = new WillFocusEvent();
|
|
5142
|
+
this.api._onWillFocus.fire(event);
|
|
5143
|
+
if (event.defaultPrevented) {
|
|
5144
|
+
return;
|
|
5145
|
+
}
|
|
5146
|
+
this._element.focus();
|
|
4905
5147
|
}
|
|
4906
5148
|
layout(width, height) {
|
|
4907
5149
|
this._width = width;
|
|
@@ -5019,7 +5261,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5019
5261
|
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
5020
5262
|
this._orientation = orientation;
|
|
5021
5263
|
this.element.classList.add('pane');
|
|
5022
|
-
this.addDisposables(this.api.
|
|
5264
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
5265
|
+
const { isVisible } = event;
|
|
5266
|
+
const { accessor } = this._params;
|
|
5267
|
+
accessor.setVisible(this, isVisible);
|
|
5268
|
+
}), this.api.onDidSizeChange((event) => {
|
|
5023
5269
|
this._onDidChange.fire({ size: event.size });
|
|
5024
5270
|
}), addDisposableListener(this.element, 'mouseenter', (ev) => {
|
|
5025
5271
|
this.api._onMouseEnter.fire(ev);
|
|
@@ -5230,9 +5476,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5230
5476
|
super(id);
|
|
5231
5477
|
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5232
5478
|
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5233
|
-
this._onDidConstraintsChange = new Emitter(
|
|
5234
|
-
replay: true,
|
|
5235
|
-
});
|
|
5479
|
+
this._onDidConstraintsChange = new Emitter();
|
|
5236
5480
|
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
5237
5481
|
this._onDidSizeChange = new Emitter();
|
|
5238
5482
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
@@ -5325,13 +5569,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5325
5569
|
this._maximumHeight = options.maximumHeight;
|
|
5326
5570
|
}
|
|
5327
5571
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
5328
|
-
this.addDisposables(this.api.
|
|
5572
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
5329
5573
|
const { isVisible } = event;
|
|
5330
5574
|
const { accessor } = this._params;
|
|
5331
5575
|
accessor.setVisible(this, isVisible);
|
|
5332
5576
|
}), this.api.onActiveChange(() => {
|
|
5333
5577
|
const { accessor } = this._params;
|
|
5334
|
-
accessor.
|
|
5578
|
+
accessor.doSetGroupActive(this);
|
|
5335
5579
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
5336
5580
|
if (typeof event.minimumWidth === 'number' ||
|
|
5337
5581
|
typeof event.minimumWidth === 'function') {
|
|
@@ -5414,6 +5658,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5414
5658
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5415
5659
|
this.addDisposables(this._onDidLocationChange);
|
|
5416
5660
|
}
|
|
5661
|
+
close() {
|
|
5662
|
+
if (!this._group) {
|
|
5663
|
+
return;
|
|
5664
|
+
}
|
|
5665
|
+
return this.accessor.removeGroup(this._group);
|
|
5666
|
+
}
|
|
5667
|
+
getWindow() {
|
|
5668
|
+
return this.location.type === 'popout'
|
|
5669
|
+
? this.location.getWindow()
|
|
5670
|
+
: window;
|
|
5671
|
+
}
|
|
5417
5672
|
moveTo(options) {
|
|
5418
5673
|
var _a, _b, _c;
|
|
5419
5674
|
if (!this._group) {
|
|
@@ -5421,14 +5676,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5421
5676
|
}
|
|
5422
5677
|
const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
|
|
5423
5678
|
direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
|
|
5679
|
+
skipSetActive: true,
|
|
5680
|
+
});
|
|
5681
|
+
this.accessor.moveGroupOrPanel({
|
|
5682
|
+
from: { groupId: this._group.id },
|
|
5683
|
+
to: {
|
|
5684
|
+
group,
|
|
5685
|
+
position: options.group
|
|
5686
|
+
? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
|
|
5687
|
+
: 'center',
|
|
5688
|
+
},
|
|
5424
5689
|
});
|
|
5425
|
-
this.accessor.moveGroupOrPanel(group, this._group.id, undefined, options.group ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center' : 'center');
|
|
5426
5690
|
}
|
|
5427
5691
|
maximize() {
|
|
5428
5692
|
if (!this._group) {
|
|
5429
5693
|
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5430
5694
|
}
|
|
5431
|
-
if (this.location !== 'grid') {
|
|
5695
|
+
if (this.location.type !== 'grid') {
|
|
5432
5696
|
// only grid groups can be maximized
|
|
5433
5697
|
return;
|
|
5434
5698
|
}
|
|
@@ -5485,6 +5749,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5485
5749
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
5486
5750
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
5487
5751
|
}
|
|
5752
|
+
focus() {
|
|
5753
|
+
if (!this.api.isActive) {
|
|
5754
|
+
this.api.setActive();
|
|
5755
|
+
}
|
|
5756
|
+
super.focus();
|
|
5757
|
+
}
|
|
5488
5758
|
initialize() {
|
|
5489
5759
|
this._model.initialize();
|
|
5490
5760
|
}
|
|
@@ -5530,6 +5800,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5530
5800
|
}
|
|
5531
5801
|
|
|
5532
5802
|
class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
5803
|
+
get location() {
|
|
5804
|
+
return this.group.api.location;
|
|
5805
|
+
}
|
|
5533
5806
|
get title() {
|
|
5534
5807
|
return this.panel.title;
|
|
5535
5808
|
}
|
|
@@ -5540,16 +5813,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5540
5813
|
return this.panel.renderer;
|
|
5541
5814
|
}
|
|
5542
5815
|
set group(value) {
|
|
5543
|
-
const
|
|
5544
|
-
this._group
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
this.
|
|
5548
|
-
|
|
5816
|
+
const oldGroup = this._group;
|
|
5817
|
+
if (this._group !== value) {
|
|
5818
|
+
this._group = value;
|
|
5819
|
+
this._onDidGroupChange.fire({});
|
|
5820
|
+
this.setupGroupEventListeners(oldGroup);
|
|
5821
|
+
this._onDidLocationChange.fire({
|
|
5822
|
+
location: this.group.api.location,
|
|
5549
5823
|
});
|
|
5550
|
-
if (this.isGroupActive !== isOldGroupActive) {
|
|
5551
|
-
this._onDidActiveGroupChange.fire();
|
|
5552
|
-
}
|
|
5553
5824
|
}
|
|
5554
5825
|
}
|
|
5555
5826
|
get group() {
|
|
@@ -5567,14 +5838,27 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5567
5838
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
5568
5839
|
this._onDidRendererChange = new Emitter();
|
|
5569
5840
|
this.onDidRendererChange = this._onDidRendererChange.event;
|
|
5570
|
-
this.
|
|
5841
|
+
this._onDidLocationChange = new Emitter();
|
|
5842
|
+
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5843
|
+
this.groupEventsDisposable = new MutableDisposable();
|
|
5571
5844
|
this.initialize(panel);
|
|
5572
5845
|
this._group = group;
|
|
5573
|
-
this.
|
|
5846
|
+
this.setupGroupEventListeners();
|
|
5847
|
+
this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
|
|
5848
|
+
}
|
|
5849
|
+
getWindow() {
|
|
5850
|
+
return this.group.api.getWindow();
|
|
5574
5851
|
}
|
|
5575
5852
|
moveTo(options) {
|
|
5576
5853
|
var _a;
|
|
5577
|
-
this.accessor.moveGroupOrPanel(
|
|
5854
|
+
this.accessor.moveGroupOrPanel({
|
|
5855
|
+
from: { groupId: this._group.id, panelId: this.panel.id },
|
|
5856
|
+
to: {
|
|
5857
|
+
group: options.group,
|
|
5858
|
+
position: (_a = options.position) !== null && _a !== void 0 ? _a : 'center',
|
|
5859
|
+
index: options.index,
|
|
5860
|
+
},
|
|
5861
|
+
});
|
|
5578
5862
|
}
|
|
5579
5863
|
setTitle(title) {
|
|
5580
5864
|
this.panel.setTitle(title);
|
|
@@ -5594,6 +5878,35 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5594
5878
|
exitMaximized() {
|
|
5595
5879
|
this.group.api.exitMaximized();
|
|
5596
5880
|
}
|
|
5881
|
+
setupGroupEventListeners(previousGroup) {
|
|
5882
|
+
var _a;
|
|
5883
|
+
let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
|
|
5884
|
+
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
|
|
5885
|
+
if (!event.isVisible && this.isVisible) {
|
|
5886
|
+
this._onDidVisibilityChange.fire(event);
|
|
5887
|
+
}
|
|
5888
|
+
else if (event.isVisible &&
|
|
5889
|
+
!this.isVisible &&
|
|
5890
|
+
this.group.model.isPanelActive(this.panel)) {
|
|
5891
|
+
this._onDidVisibilityChange.fire(event);
|
|
5892
|
+
}
|
|
5893
|
+
}), this.group.api.onDidLocationChange((event) => {
|
|
5894
|
+
if (this.group !== this.panel.group) {
|
|
5895
|
+
return;
|
|
5896
|
+
}
|
|
5897
|
+
this._onDidLocationChange.fire(event);
|
|
5898
|
+
}), this.group.api.onDidActiveChange(() => {
|
|
5899
|
+
if (this.group !== this.panel.group) {
|
|
5900
|
+
return;
|
|
5901
|
+
}
|
|
5902
|
+
if (_trackGroupActive !== this.isGroupActive) {
|
|
5903
|
+
_trackGroupActive = this.isGroupActive;
|
|
5904
|
+
this._onDidActiveGroupChange.fire({
|
|
5905
|
+
isActive: this.isGroupActive,
|
|
5906
|
+
});
|
|
5907
|
+
}
|
|
5908
|
+
}));
|
|
5909
|
+
}
|
|
5597
5910
|
}
|
|
5598
5911
|
|
|
5599
5912
|
class DockviewPanel extends CompositeDisposable {
|
|
@@ -5635,7 +5948,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5635
5948
|
this.setTitle(params.title);
|
|
5636
5949
|
}
|
|
5637
5950
|
focus() {
|
|
5638
|
-
|
|
5951
|
+
const event = new WillFocusEvent();
|
|
5952
|
+
this.api._onWillFocus.fire(event);
|
|
5953
|
+
if (event.defaultPrevented) {
|
|
5954
|
+
return;
|
|
5955
|
+
}
|
|
5956
|
+
if (!this.api.isActive) {
|
|
5957
|
+
this.api.setActive();
|
|
5958
|
+
}
|
|
5639
5959
|
}
|
|
5640
5960
|
toJSON() {
|
|
5641
5961
|
return {
|
|
@@ -5692,24 +6012,44 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5692
6012
|
},
|
|
5693
6013
|
});
|
|
5694
6014
|
}
|
|
5695
|
-
updateParentGroup(group,
|
|
6015
|
+
updateParentGroup(group, options) {
|
|
5696
6016
|
this._group = group;
|
|
5697
|
-
this.api.group =
|
|
6017
|
+
this.api.group = this._group;
|
|
5698
6018
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
5699
|
-
this.api.
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
6019
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6020
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetActive)) {
|
|
6021
|
+
if (this.api.isActive !== isActive) {
|
|
6022
|
+
this.api._onDidActiveChange.fire({
|
|
6023
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6024
|
+
});
|
|
6025
|
+
}
|
|
6026
|
+
}
|
|
6027
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6028
|
+
this.api._onDidVisibilityChange.fire({
|
|
6029
|
+
isVisible: isPanelVisible,
|
|
6030
|
+
});
|
|
6031
|
+
}
|
|
5706
6032
|
}
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
this.api.
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
6033
|
+
runEvents() {
|
|
6034
|
+
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
6035
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6036
|
+
if (this.api.isActive !== isActive) {
|
|
6037
|
+
this.api._onDidActiveChange.fire({
|
|
6038
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6039
|
+
});
|
|
6040
|
+
}
|
|
6041
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6042
|
+
this.api._onDidVisibilityChange.fire({
|
|
6043
|
+
isVisible: isPanelVisible,
|
|
6044
|
+
});
|
|
6045
|
+
}
|
|
6046
|
+
}
|
|
6047
|
+
layout(width, height) {
|
|
6048
|
+
// TODO: Can we somehow do height without header height or indicate what the header height is?
|
|
6049
|
+
this.api._onDidDimensionChange.fire({
|
|
6050
|
+
width,
|
|
6051
|
+
height: height,
|
|
6052
|
+
});
|
|
5713
6053
|
this.view.layout(width, height);
|
|
5714
6054
|
}
|
|
5715
6055
|
dispose() {
|
|
@@ -5827,8 +6167,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5827
6167
|
this.id = id;
|
|
5828
6168
|
this.contentComponent = contentComponent;
|
|
5829
6169
|
this.tabComponent = tabComponent;
|
|
5830
|
-
this._group = null;
|
|
5831
|
-
this._isPanelVisible = null;
|
|
5832
6170
|
this._content = this.createContentComponent(this.id, contentComponent);
|
|
5833
6171
|
this._tab = this.createTabComponent(this.id, tabComponent);
|
|
5834
6172
|
}
|
|
@@ -5836,25 +6174,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5836
6174
|
this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
|
|
5837
6175
|
this.tab.init(params);
|
|
5838
6176
|
}
|
|
5839
|
-
updateParentGroup(
|
|
5840
|
-
|
|
5841
|
-
this._group = group;
|
|
5842
|
-
if (this._content.onGroupChange) {
|
|
5843
|
-
this._content.onGroupChange(group);
|
|
5844
|
-
}
|
|
5845
|
-
if (this._tab.onGroupChange) {
|
|
5846
|
-
this._tab.onGroupChange(group);
|
|
5847
|
-
}
|
|
5848
|
-
}
|
|
5849
|
-
if (isPanelVisible !== this._isPanelVisible) {
|
|
5850
|
-
this._isPanelVisible = isPanelVisible;
|
|
5851
|
-
if (this._content.onPanelVisibleChange) {
|
|
5852
|
-
this._content.onPanelVisibleChange(isPanelVisible);
|
|
5853
|
-
}
|
|
5854
|
-
if (this._tab.onPanelVisibleChange) {
|
|
5855
|
-
this._tab.onPanelVisibleChange(isPanelVisible);
|
|
5856
|
-
}
|
|
5857
|
-
}
|
|
6177
|
+
updateParentGroup(_group, _isPanelVisible) {
|
|
6178
|
+
// noop
|
|
5858
6179
|
}
|
|
5859
6180
|
layout(width, height) {
|
|
5860
6181
|
var _a, _b;
|
|
@@ -6287,117 +6608,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6287
6608
|
}
|
|
6288
6609
|
}
|
|
6289
6610
|
|
|
6290
|
-
class PopoutWindow extends CompositeDisposable {
|
|
6291
|
-
constructor(id, className, options) {
|
|
6292
|
-
super();
|
|
6293
|
-
this.id = id;
|
|
6294
|
-
this.className = className;
|
|
6295
|
-
this.options = options;
|
|
6296
|
-
this._onDidClose = new Emitter();
|
|
6297
|
-
this.onDidClose = this._onDidClose.event;
|
|
6298
|
-
this._window = null;
|
|
6299
|
-
this.addDisposables(this._onDidClose, {
|
|
6300
|
-
dispose: () => {
|
|
6301
|
-
this.close();
|
|
6302
|
-
},
|
|
6303
|
-
});
|
|
6304
|
-
}
|
|
6305
|
-
dimensions() {
|
|
6306
|
-
if (!this._window) {
|
|
6307
|
-
return null;
|
|
6308
|
-
}
|
|
6309
|
-
const left = this._window.value.screenX;
|
|
6310
|
-
const top = this._window.value.screenY;
|
|
6311
|
-
const width = this._window.value.innerWidth;
|
|
6312
|
-
const height = this._window.value.innerHeight;
|
|
6313
|
-
return { top, left, width, height };
|
|
6314
|
-
}
|
|
6315
|
-
close() {
|
|
6316
|
-
if (this._window) {
|
|
6317
|
-
this._window.disposable.dispose();
|
|
6318
|
-
this._window.value.close();
|
|
6319
|
-
this._window = null;
|
|
6320
|
-
}
|
|
6321
|
-
}
|
|
6322
|
-
open(content) {
|
|
6323
|
-
if (this._window) {
|
|
6324
|
-
throw new Error('instance of popout window is already open');
|
|
6325
|
-
}
|
|
6326
|
-
const url = `${this.options.url}`;
|
|
6327
|
-
const features = Object.entries({
|
|
6328
|
-
top: this.options.top,
|
|
6329
|
-
left: this.options.left,
|
|
6330
|
-
width: this.options.width,
|
|
6331
|
-
height: this.options.height,
|
|
6332
|
-
})
|
|
6333
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
6334
|
-
.join(',');
|
|
6335
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6336
|
-
const externalWindow = window.open(url, this.id, features);
|
|
6337
|
-
if (!externalWindow) {
|
|
6338
|
-
return;
|
|
6339
|
-
}
|
|
6340
|
-
const disposable = new CompositeDisposable();
|
|
6341
|
-
this._window = { value: externalWindow, disposable };
|
|
6342
|
-
const cleanUp = () => {
|
|
6343
|
-
this._onDidClose.fire();
|
|
6344
|
-
this._window = null;
|
|
6345
|
-
};
|
|
6346
|
-
// prevent any default content from loading
|
|
6347
|
-
// externalWindow.document.body.replaceWith(document.createElement('div'));
|
|
6348
|
-
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6349
|
-
cleanUp();
|
|
6350
|
-
this.close();
|
|
6351
|
-
}));
|
|
6352
|
-
externalWindow.addEventListener('load', () => {
|
|
6353
|
-
const externalDocument = externalWindow.document;
|
|
6354
|
-
externalDocument.title = document.title;
|
|
6355
|
-
const div = document.createElement('div');
|
|
6356
|
-
div.classList.add('dv-popout-window');
|
|
6357
|
-
div.style.position = 'absolute';
|
|
6358
|
-
div.style.width = '100%';
|
|
6359
|
-
div.style.height = '100%';
|
|
6360
|
-
div.style.top = '0px';
|
|
6361
|
-
div.style.left = '0px';
|
|
6362
|
-
div.classList.add(this.className);
|
|
6363
|
-
div.appendChild(content);
|
|
6364
|
-
externalDocument.body.replaceChildren(div);
|
|
6365
|
-
externalDocument.body.classList.add(this.className);
|
|
6366
|
-
addStyles(externalDocument, window.document.styleSheets);
|
|
6367
|
-
externalWindow.addEventListener('beforeunload', () => {
|
|
6368
|
-
// TODO: indicate external window is closing
|
|
6369
|
-
cleanUp();
|
|
6370
|
-
});
|
|
6371
|
-
});
|
|
6372
|
-
}
|
|
6373
|
-
}
|
|
6374
|
-
|
|
6375
|
-
class DockviewPopoutGroupPanel extends CompositeDisposable {
|
|
6376
|
-
constructor(id, group, options) {
|
|
6377
|
-
var _a;
|
|
6378
|
-
super();
|
|
6379
|
-
this.id = id;
|
|
6380
|
-
this.group = group;
|
|
6381
|
-
this.options = options;
|
|
6382
|
-
this.window = new PopoutWindow(id, (_a = options.className) !== null && _a !== void 0 ? _a : '', {
|
|
6383
|
-
url: this.options.popoutUrl,
|
|
6384
|
-
left: this.options.box.left,
|
|
6385
|
-
top: this.options.box.top,
|
|
6386
|
-
width: this.options.box.width,
|
|
6387
|
-
height: this.options.box.height,
|
|
6388
|
-
});
|
|
6389
|
-
group.model.location = 'popout';
|
|
6390
|
-
this.addDisposables(this.window, {
|
|
6391
|
-
dispose: () => {
|
|
6392
|
-
group.model.location = 'grid';
|
|
6393
|
-
},
|
|
6394
|
-
}, this.window.onDidClose(() => {
|
|
6395
|
-
this.dispose();
|
|
6396
|
-
}));
|
|
6397
|
-
this.window.open(group.element);
|
|
6398
|
-
}
|
|
6399
|
-
}
|
|
6400
|
-
|
|
6401
6611
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6402
6612
|
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6403
6613
|
|
|
@@ -6411,11 +6621,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6411
6621
|
super();
|
|
6412
6622
|
this.element = element;
|
|
6413
6623
|
this.map = {};
|
|
6624
|
+
this._disposed = false;
|
|
6414
6625
|
this.addDisposables(Disposable.from(() => {
|
|
6415
6626
|
for (const value of Object.values(this.map)) {
|
|
6416
6627
|
value.disposable.dispose();
|
|
6417
6628
|
value.destroy.dispose();
|
|
6418
6629
|
}
|
|
6630
|
+
this._disposed = true;
|
|
6419
6631
|
}));
|
|
6420
6632
|
}
|
|
6421
6633
|
detatch(panel) {
|
|
@@ -6455,7 +6667,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6455
6667
|
focusContainer.style.top = `${box.top - box2.top}px`;
|
|
6456
6668
|
focusContainer.style.width = `${box.width}px`;
|
|
6457
6669
|
focusContainer.style.height = `${box.height}px`;
|
|
6458
|
-
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location === 'floating');
|
|
6670
|
+
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
|
|
6459
6671
|
};
|
|
6460
6672
|
const visibilityChanged = () => {
|
|
6461
6673
|
if (panel.api.isVisible) {
|
|
@@ -6501,8 +6713,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6501
6713
|
resize();
|
|
6502
6714
|
}));
|
|
6503
6715
|
this.map[panel.api.id].destroy = Disposable.from(() => {
|
|
6504
|
-
|
|
6505
|
-
|
|
6716
|
+
var _a;
|
|
6717
|
+
if (panel.view.content.element.parentElement === focusContainer) {
|
|
6718
|
+
focusContainer.removeChild(panel.view.content.element);
|
|
6719
|
+
}
|
|
6720
|
+
(_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
|
|
6506
6721
|
});
|
|
6507
6722
|
queueMicrotask(() => {
|
|
6508
6723
|
if (this.isDisposed) {
|
|
@@ -6523,11 +6738,164 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6523
6738
|
}
|
|
6524
6739
|
}
|
|
6525
6740
|
|
|
6741
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6742
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6743
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6744
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6745
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6746
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6747
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6748
|
+
});
|
|
6749
|
+
};
|
|
6750
|
+
class PopoutWindow extends CompositeDisposable {
|
|
6751
|
+
get window() {
|
|
6752
|
+
var _a, _b;
|
|
6753
|
+
return (_b = (_a = this._window) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;
|
|
6754
|
+
}
|
|
6755
|
+
constructor(target, className, options) {
|
|
6756
|
+
super();
|
|
6757
|
+
this.target = target;
|
|
6758
|
+
this.className = className;
|
|
6759
|
+
this.options = options;
|
|
6760
|
+
this._onWillClose = new Emitter();
|
|
6761
|
+
this.onWillClose = this._onWillClose.event;
|
|
6762
|
+
this._onDidClose = new Emitter();
|
|
6763
|
+
this.onDidClose = this._onDidClose.event;
|
|
6764
|
+
this._window = null;
|
|
6765
|
+
this.addDisposables(this._onWillClose, this._onDidClose, {
|
|
6766
|
+
dispose: () => {
|
|
6767
|
+
this.close();
|
|
6768
|
+
},
|
|
6769
|
+
});
|
|
6770
|
+
}
|
|
6771
|
+
dimensions() {
|
|
6772
|
+
if (!this._window) {
|
|
6773
|
+
return null;
|
|
6774
|
+
}
|
|
6775
|
+
const left = this._window.value.screenX;
|
|
6776
|
+
const top = this._window.value.screenY;
|
|
6777
|
+
const width = this._window.value.innerWidth;
|
|
6778
|
+
const height = this._window.value.innerHeight;
|
|
6779
|
+
return { top, left, width, height };
|
|
6780
|
+
}
|
|
6781
|
+
close() {
|
|
6782
|
+
var _a, _b;
|
|
6783
|
+
if (this._window) {
|
|
6784
|
+
this._onWillClose.fire();
|
|
6785
|
+
(_b = (_a = this.options).onWillClose) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6786
|
+
id: this.target,
|
|
6787
|
+
window: this._window.value,
|
|
6788
|
+
});
|
|
6789
|
+
this._window.disposable.dispose();
|
|
6790
|
+
this._window.value.close();
|
|
6791
|
+
this._window = null;
|
|
6792
|
+
this._onDidClose.fire();
|
|
6793
|
+
}
|
|
6794
|
+
}
|
|
6795
|
+
open() {
|
|
6796
|
+
var _a, _b;
|
|
6797
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6798
|
+
if (this._window) {
|
|
6799
|
+
throw new Error('instance of popout window is already open');
|
|
6800
|
+
}
|
|
6801
|
+
const url = `${this.options.url}`;
|
|
6802
|
+
const features = Object.entries({
|
|
6803
|
+
top: this.options.top,
|
|
6804
|
+
left: this.options.left,
|
|
6805
|
+
width: this.options.width,
|
|
6806
|
+
height: this.options.height,
|
|
6807
|
+
})
|
|
6808
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
6809
|
+
.join(',');
|
|
6810
|
+
/**
|
|
6811
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6812
|
+
*/
|
|
6813
|
+
const externalWindow = window.open(url, this.target, features);
|
|
6814
|
+
if (!externalWindow) {
|
|
6815
|
+
/**
|
|
6816
|
+
* Popup blocked
|
|
6817
|
+
*/
|
|
6818
|
+
return null;
|
|
6819
|
+
}
|
|
6820
|
+
const disposable = new CompositeDisposable();
|
|
6821
|
+
this._window = { value: externalWindow, disposable };
|
|
6822
|
+
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6823
|
+
/**
|
|
6824
|
+
* before the main window closes we should close this popup too
|
|
6825
|
+
* to be good citizens
|
|
6826
|
+
*
|
|
6827
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6828
|
+
*/
|
|
6829
|
+
this.close();
|
|
6830
|
+
}));
|
|
6831
|
+
const container = this.createPopoutWindowContainer();
|
|
6832
|
+
if (this.className) {
|
|
6833
|
+
container.classList.add(this.className);
|
|
6834
|
+
}
|
|
6835
|
+
(_b = (_a = this.options).onDidOpen) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6836
|
+
id: this.target,
|
|
6837
|
+
window: externalWindow,
|
|
6838
|
+
});
|
|
6839
|
+
return new Promise((resolve) => {
|
|
6840
|
+
externalWindow.addEventListener('unload', (e) => {
|
|
6841
|
+
// if page fails to load before unloading
|
|
6842
|
+
// this.close();
|
|
6843
|
+
});
|
|
6844
|
+
externalWindow.addEventListener('load', () => {
|
|
6845
|
+
/**
|
|
6846
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
|
|
6847
|
+
*/
|
|
6848
|
+
const externalDocument = externalWindow.document;
|
|
6849
|
+
externalDocument.title = document.title;
|
|
6850
|
+
externalDocument.body.appendChild(container);
|
|
6851
|
+
addStyles(externalDocument, window.document.styleSheets);
|
|
6852
|
+
/**
|
|
6853
|
+
* beforeunload must be registered after load for reasons I could not determine
|
|
6854
|
+
* otherwise the beforeunload event will not fire when the window is closed
|
|
6855
|
+
*/
|
|
6856
|
+
addDisposableWindowListener(externalWindow, 'beforeunload', () => {
|
|
6857
|
+
/**
|
|
6858
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6859
|
+
*/
|
|
6860
|
+
this.close();
|
|
6861
|
+
});
|
|
6862
|
+
resolve(container);
|
|
6863
|
+
});
|
|
6864
|
+
});
|
|
6865
|
+
});
|
|
6866
|
+
}
|
|
6867
|
+
createPopoutWindowContainer() {
|
|
6868
|
+
const el = document.createElement('div');
|
|
6869
|
+
el.classList.add('dv-popout-window');
|
|
6870
|
+
el.id = 'dv-popout-window';
|
|
6871
|
+
el.style.position = 'absolute';
|
|
6872
|
+
el.style.width = '100%';
|
|
6873
|
+
el.style.height = '100%';
|
|
6874
|
+
el.style.top = '0px';
|
|
6875
|
+
el.style.left = '0px';
|
|
6876
|
+
return el;
|
|
6877
|
+
}
|
|
6878
|
+
}
|
|
6879
|
+
|
|
6526
6880
|
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6527
6881
|
activationSize: { type: 'pixels', value: 10 },
|
|
6528
6882
|
size: { type: 'pixels', value: 20 },
|
|
6529
6883
|
};
|
|
6530
|
-
function
|
|
6884
|
+
function moveGroupWithoutDestroying(options) {
|
|
6885
|
+
const activePanel = options.from.activePanel;
|
|
6886
|
+
const panels = [...options.from.panels].map((panel) => {
|
|
6887
|
+
const removedPanel = options.from.model.removePanel(panel);
|
|
6888
|
+
options.from.model.renderContainer.detatch(panel);
|
|
6889
|
+
return removedPanel;
|
|
6890
|
+
});
|
|
6891
|
+
panels.forEach((panel) => {
|
|
6892
|
+
options.to.model.openPanel(panel, {
|
|
6893
|
+
skipSetActive: activePanel !== panel,
|
|
6894
|
+
skipSetGroupActive: true,
|
|
6895
|
+
});
|
|
6896
|
+
});
|
|
6897
|
+
}
|
|
6898
|
+
function getDockviewTheme(element) {
|
|
6531
6899
|
function toClassList(element) {
|
|
6532
6900
|
const list = [];
|
|
6533
6901
|
for (let i = 0; i < element.classList.length; i++) {
|
|
@@ -6578,6 +6946,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6578
6946
|
styles: options.styles,
|
|
6579
6947
|
parentElement: options.parentElement,
|
|
6580
6948
|
disableAutoResizing: options.disableAutoResizing,
|
|
6949
|
+
locked: options.locked,
|
|
6581
6950
|
});
|
|
6582
6951
|
this.nextGroupId = sequentialNumberGenerator();
|
|
6583
6952
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -6588,6 +6957,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6588
6957
|
this.onWillDragGroup = this._onWillDragGroup.event;
|
|
6589
6958
|
this._onDidDrop = new Emitter();
|
|
6590
6959
|
this.onDidDrop = this._onDidDrop.event;
|
|
6960
|
+
this._onWillDrop = new Emitter();
|
|
6961
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
6962
|
+
this._onWillShowOverlay = new Emitter();
|
|
6963
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
6591
6964
|
this._onDidRemovePanel = new Emitter();
|
|
6592
6965
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
6593
6966
|
this._onDidAddPanel = new Emitter();
|
|
@@ -6596,15 +6969,36 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6596
6969
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
6597
6970
|
this._onDidActivePanelChange = new Emitter();
|
|
6598
6971
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
6972
|
+
this._onDidMovePanel = new Emitter();
|
|
6599
6973
|
this._floatingGroups = [];
|
|
6600
6974
|
this._popoutGroups = [];
|
|
6975
|
+
this._ignoreEvents = 0;
|
|
6976
|
+
this._onDidRemoveGroup = new Emitter();
|
|
6977
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
6978
|
+
this._onDidAddGroup = new Emitter();
|
|
6979
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
6980
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
6981
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
6982
|
+
this._moving = false;
|
|
6601
6983
|
const gready = document.createElement('div');
|
|
6602
6984
|
gready.className = 'dv-overlay-render-container';
|
|
6603
6985
|
this.gridview.element.appendChild(gready);
|
|
6604
6986
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
6605
6987
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
6606
6988
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
6607
|
-
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop,
|
|
6989
|
+
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) => {
|
|
6990
|
+
if (!this._moving) {
|
|
6991
|
+
this._onDidAddGroup.fire(event);
|
|
6992
|
+
}
|
|
6993
|
+
}), this.onDidRemove((event) => {
|
|
6994
|
+
if (!this._moving) {
|
|
6995
|
+
this._onDidRemoveGroup.fire(event);
|
|
6996
|
+
}
|
|
6997
|
+
}), this.onDidActiveChange((event) => {
|
|
6998
|
+
if (!this._moving) {
|
|
6999
|
+
this._onDidActiveGroupChange.fire(event);
|
|
7000
|
+
}
|
|
7001
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
6608
7002
|
this.updateWatermark();
|
|
6609
7003
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
6610
7004
|
this._bufferOnDidLayoutChange.fire();
|
|
@@ -6615,7 +7009,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6615
7009
|
}
|
|
6616
7010
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6617
7011
|
for (const group of [...this._popoutGroups]) {
|
|
6618
|
-
group.dispose();
|
|
7012
|
+
group.disposable.dispose();
|
|
6619
7013
|
}
|
|
6620
7014
|
}));
|
|
6621
7015
|
this._options = options;
|
|
@@ -6661,7 +7055,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6661
7055
|
return this.options.showDndOverlay({
|
|
6662
7056
|
nativeEvent: event,
|
|
6663
7057
|
position: position,
|
|
6664
|
-
target:
|
|
7058
|
+
target: 'edge',
|
|
6665
7059
|
getData: getPanelData,
|
|
6666
7060
|
});
|
|
6667
7061
|
}
|
|
@@ -6670,88 +7064,259 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6670
7064
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
6671
7065
|
overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
6672
7066
|
});
|
|
6673
|
-
this.addDisposables(this._rootDropTarget.
|
|
7067
|
+
this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
|
|
7068
|
+
if (this.gridview.length > 0 && event.position === 'center') {
|
|
7069
|
+
// option only available when no panels in primary grid
|
|
7070
|
+
return;
|
|
7071
|
+
}
|
|
7072
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
7073
|
+
kind: 'edge',
|
|
7074
|
+
}));
|
|
7075
|
+
}), this._rootDropTarget.onDrop((event) => {
|
|
6674
7076
|
var _a;
|
|
7077
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
7078
|
+
nativeEvent: event.nativeEvent,
|
|
7079
|
+
position: event.position,
|
|
7080
|
+
panel: undefined,
|
|
7081
|
+
api: this._api,
|
|
7082
|
+
group: undefined,
|
|
7083
|
+
getData: getPanelData,
|
|
7084
|
+
kind: 'edge',
|
|
7085
|
+
});
|
|
7086
|
+
this._onWillDrop.fire(willDropEvent);
|
|
7087
|
+
if (willDropEvent.defaultPrevented) {
|
|
7088
|
+
return;
|
|
7089
|
+
}
|
|
6675
7090
|
const data = getPanelData();
|
|
6676
7091
|
if (data) {
|
|
6677
|
-
this.moveGroupOrPanel(
|
|
7092
|
+
this.moveGroupOrPanel({
|
|
7093
|
+
from: {
|
|
7094
|
+
groupId: data.groupId,
|
|
7095
|
+
panelId: (_a = data.panelId) !== null && _a !== void 0 ? _a : undefined,
|
|
7096
|
+
},
|
|
7097
|
+
to: {
|
|
7098
|
+
group: this.orthogonalize(event.position),
|
|
7099
|
+
position: 'center',
|
|
7100
|
+
},
|
|
7101
|
+
});
|
|
6678
7102
|
}
|
|
6679
7103
|
else {
|
|
6680
|
-
this._onDidDrop.fire(
|
|
7104
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
7105
|
+
nativeEvent: event.nativeEvent,
|
|
7106
|
+
position: event.position,
|
|
7107
|
+
panel: undefined,
|
|
7108
|
+
api: this._api,
|
|
7109
|
+
group: undefined,
|
|
7110
|
+
getData: getPanelData,
|
|
7111
|
+
}));
|
|
6681
7112
|
}
|
|
6682
7113
|
}), this._rootDropTarget);
|
|
6683
7114
|
this._api = new DockviewApi(this);
|
|
6684
7115
|
this.updateWatermark();
|
|
6685
7116
|
}
|
|
6686
|
-
addPopoutGroup(
|
|
6687
|
-
var _a;
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
7117
|
+
addPopoutGroup(itemToPopout, options) {
|
|
7118
|
+
var _a, _b, _c;
|
|
7119
|
+
if (itemToPopout instanceof DockviewPanel &&
|
|
7120
|
+
itemToPopout.group.size === 1) {
|
|
7121
|
+
return this.addPopoutGroup(itemToPopout.group);
|
|
7122
|
+
}
|
|
7123
|
+
const theme = getDockviewTheme(this.gridview.element);
|
|
7124
|
+
const element = this.element;
|
|
7125
|
+
function getBox() {
|
|
7126
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7127
|
+
return options.position;
|
|
7128
|
+
}
|
|
7129
|
+
if (itemToPopout instanceof DockviewGroupPanel) {
|
|
7130
|
+
return itemToPopout.element.getBoundingClientRect();
|
|
7131
|
+
}
|
|
7132
|
+
if (itemToPopout.group) {
|
|
7133
|
+
return itemToPopout.group.element.getBoundingClientRect();
|
|
7134
|
+
}
|
|
7135
|
+
return element.getBoundingClientRect();
|
|
7136
|
+
}
|
|
7137
|
+
const box = getBox();
|
|
7138
|
+
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;
|
|
7139
|
+
if (itemToPopout.api.location.type === 'grid') {
|
|
7140
|
+
itemToPopout.api.setVisible(false);
|
|
7141
|
+
}
|
|
7142
|
+
const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
|
|
7143
|
+
theme !== null && theme !== void 0 ? theme : '', {
|
|
7144
|
+
url: (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : '/popout.html',
|
|
7145
|
+
left: window.screenX + box.left,
|
|
7146
|
+
top: window.screenY + box.top,
|
|
7147
|
+
width: box.width,
|
|
7148
|
+
height: box.height,
|
|
7149
|
+
onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
|
|
7150
|
+
onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
|
|
7151
|
+
});
|
|
7152
|
+
const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
|
|
7153
|
+
popoutWindowDisposable.dispose();
|
|
7154
|
+
}));
|
|
7155
|
+
return _window
|
|
7156
|
+
.open()
|
|
7157
|
+
.then((popoutContainer) => {
|
|
7158
|
+
var _a;
|
|
7159
|
+
if (_window.isDisposed) {
|
|
7160
|
+
return;
|
|
6699
7161
|
}
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
if (!box) {
|
|
6704
|
-
box = group.element.getBoundingClientRect();
|
|
7162
|
+
if (popoutContainer === null) {
|
|
7163
|
+
popoutWindowDisposable.dispose();
|
|
7164
|
+
return;
|
|
6705
7165
|
}
|
|
6706
|
-
const
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
7166
|
+
const gready = document.createElement('div');
|
|
7167
|
+
gready.className = 'dv-overlay-render-container';
|
|
7168
|
+
const overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7169
|
+
const referenceGroup = itemToPopout instanceof DockviewPanel
|
|
7170
|
+
? itemToPopout.group
|
|
7171
|
+
: itemToPopout;
|
|
7172
|
+
const referenceLocation = itemToPopout.api.location.type;
|
|
7173
|
+
const group = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) !== null && _a !== void 0 ? _a : this.createGroup({ id: groupId });
|
|
7174
|
+
group.model.renderContainer = overlayRenderContainer;
|
|
7175
|
+
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup)) {
|
|
7176
|
+
this._onDidAddGroup.fire(group);
|
|
7177
|
+
}
|
|
7178
|
+
if (itemToPopout instanceof DockviewPanel) {
|
|
7179
|
+
this.movingLock(() => {
|
|
7180
|
+
const panel = referenceGroup.model.removePanel(itemToPopout);
|
|
7181
|
+
group.model.openPanel(panel);
|
|
7182
|
+
});
|
|
7183
|
+
}
|
|
7184
|
+
else {
|
|
7185
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7186
|
+
from: referenceGroup,
|
|
7187
|
+
to: group,
|
|
7188
|
+
}));
|
|
7189
|
+
switch (referenceLocation) {
|
|
7190
|
+
case 'grid':
|
|
7191
|
+
referenceGroup.api.setVisible(false);
|
|
7192
|
+
break;
|
|
7193
|
+
case 'floating':
|
|
7194
|
+
case 'popout':
|
|
7195
|
+
this.removeGroup(referenceGroup);
|
|
7196
|
+
break;
|
|
7197
|
+
}
|
|
7198
|
+
}
|
|
7199
|
+
popoutContainer.classList.add('dv-dockview');
|
|
7200
|
+
popoutContainer.style.overflow = 'hidden';
|
|
7201
|
+
popoutContainer.appendChild(gready);
|
|
7202
|
+
popoutContainer.appendChild(group.element);
|
|
7203
|
+
group.model.location = {
|
|
7204
|
+
type: 'popout',
|
|
7205
|
+
getWindow: () => _window.window,
|
|
7206
|
+
};
|
|
7207
|
+
this.doSetGroupAndPanelActive(group);
|
|
7208
|
+
popoutWindowDisposable.addDisposables(group.api.onDidActiveChange((event) => {
|
|
7209
|
+
var _a;
|
|
7210
|
+
if (event.isActive) {
|
|
7211
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7212
|
+
}
|
|
7213
|
+
}), group.api.onWillFocus(() => {
|
|
7214
|
+
var _a;
|
|
7215
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7216
|
+
}));
|
|
7217
|
+
let returnedGroup;
|
|
7218
|
+
const value = {
|
|
7219
|
+
window: _window,
|
|
7220
|
+
popoutGroup: group,
|
|
7221
|
+
referenceGroup: this.getPanel(referenceGroup.id)
|
|
7222
|
+
? referenceGroup.id
|
|
7223
|
+
: undefined,
|
|
7224
|
+
disposable: {
|
|
7225
|
+
dispose: () => {
|
|
7226
|
+
popoutWindowDisposable.dispose();
|
|
7227
|
+
return returnedGroup;
|
|
7228
|
+
},
|
|
7229
|
+
},
|
|
7230
|
+
};
|
|
7231
|
+
popoutWindowDisposable.addDisposables(
|
|
7232
|
+
/**
|
|
7233
|
+
* ResizeObserver seems slow here, I do not know why but we don't need it
|
|
7234
|
+
* since we can reply on the window resize event as we will occupy the full
|
|
7235
|
+
* window dimensions
|
|
7236
|
+
*/
|
|
7237
|
+
addDisposableWindowListener(_window.window, 'resize', () => {
|
|
7238
|
+
group.layout(window.innerWidth, window.innerHeight);
|
|
7239
|
+
}), overlayRenderContainer, Disposable.from(() => {
|
|
7240
|
+
if (this.getPanel(referenceGroup.id)) {
|
|
7241
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7242
|
+
from: group,
|
|
7243
|
+
to: referenceGroup,
|
|
7244
|
+
}));
|
|
7245
|
+
if (!referenceGroup.api.isVisible) {
|
|
7246
|
+
referenceGroup.api.setVisible(true);
|
|
7247
|
+
}
|
|
7248
|
+
if (this.getPanel(group.id)) {
|
|
7249
|
+
this.doRemoveGroup(group, {
|
|
7250
|
+
skipPopoutAssociated: true,
|
|
7251
|
+
});
|
|
7252
|
+
}
|
|
7253
|
+
}
|
|
7254
|
+
else {
|
|
7255
|
+
if (this.getPanel(group.id)) {
|
|
7256
|
+
const removedGroup = this.doRemoveGroup(group, {
|
|
7257
|
+
skipDispose: true,
|
|
7258
|
+
skipActive: true,
|
|
7259
|
+
});
|
|
7260
|
+
removedGroup.model.renderContainer =
|
|
7261
|
+
this.overlayRenderContainer;
|
|
7262
|
+
removedGroup.model.location = { type: 'grid' };
|
|
7263
|
+
returnedGroup = removedGroup;
|
|
7264
|
+
}
|
|
7265
|
+
}
|
|
7266
|
+
}));
|
|
7267
|
+
this._popoutGroups.push(value);
|
|
7268
|
+
this.updateWatermark();
|
|
7269
|
+
})
|
|
7270
|
+
.catch((err) => {
|
|
7271
|
+
console.error(err);
|
|
6723
7272
|
});
|
|
6724
|
-
popoutWindow.addDisposables({
|
|
6725
|
-
dispose: () => {
|
|
6726
|
-
remove(this._popoutGroups, popoutWindow);
|
|
6727
|
-
this.updateWatermark();
|
|
6728
|
-
},
|
|
6729
|
-
}, popoutWindow.window.onDidClose(() => {
|
|
6730
|
-
this.doAddGroup(group, [0]);
|
|
6731
|
-
}));
|
|
6732
|
-
this._popoutGroups.push(popoutWindow);
|
|
6733
|
-
this.updateWatermark();
|
|
6734
7273
|
}
|
|
6735
7274
|
addFloatingGroup(item, coord, options) {
|
|
6736
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7275
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6737
7276
|
let group;
|
|
6738
7277
|
if (item instanceof DockviewPanel) {
|
|
6739
7278
|
group = this.createGroup();
|
|
6740
|
-
this.
|
|
7279
|
+
this._onDidAddGroup.fire(group);
|
|
7280
|
+
this.movingLock(() => this.removePanel(item, {
|
|
6741
7281
|
removeEmptyGroup: true,
|
|
6742
7282
|
skipDispose: true,
|
|
6743
|
-
|
|
6744
|
-
|
|
7283
|
+
skipSetActiveGroup: true,
|
|
7284
|
+
}));
|
|
7285
|
+
group.model.openPanel(item, { skipSetGroupActive: true });
|
|
6745
7286
|
}
|
|
6746
7287
|
else {
|
|
6747
7288
|
group = item;
|
|
7289
|
+
const popoutReferenceGroupId = (_a = this._popoutGroups.find((_) => _.popoutGroup === group)) === null || _a === void 0 ? void 0 : _a.referenceGroup;
|
|
7290
|
+
const popoutReferenceGroup = popoutReferenceGroupId
|
|
7291
|
+
? this.getPanel(popoutReferenceGroupId)
|
|
7292
|
+
: undefined;
|
|
6748
7293
|
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
6749
7294
|
options.skipRemoveGroup;
|
|
6750
7295
|
if (!skip) {
|
|
6751
|
-
|
|
7296
|
+
if (popoutReferenceGroup) {
|
|
7297
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7298
|
+
from: item,
|
|
7299
|
+
to: popoutReferenceGroup,
|
|
7300
|
+
}));
|
|
7301
|
+
this.doRemoveGroup(item, {
|
|
7302
|
+
skipPopoutReturn: true,
|
|
7303
|
+
skipPopoutAssociated: true,
|
|
7304
|
+
});
|
|
7305
|
+
this.doRemoveGroup(popoutReferenceGroup, {
|
|
7306
|
+
skipDispose: true,
|
|
7307
|
+
});
|
|
7308
|
+
group = popoutReferenceGroup;
|
|
7309
|
+
}
|
|
7310
|
+
else {
|
|
7311
|
+
this.doRemoveGroup(item, {
|
|
7312
|
+
skipDispose: true,
|
|
7313
|
+
skipPopoutReturn: true,
|
|
7314
|
+
skipPopoutAssociated: !!popoutReferenceGroup,
|
|
7315
|
+
});
|
|
7316
|
+
}
|
|
6752
7317
|
}
|
|
6753
7318
|
}
|
|
6754
|
-
group.model.location = 'floating';
|
|
7319
|
+
group.model.location = { type: 'floating' };
|
|
6755
7320
|
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6756
7321
|
? Math.max(coord.x, 0)
|
|
6757
7322
|
: DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
@@ -6761,16 +7326,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6761
7326
|
const overlay = new Overlay({
|
|
6762
7327
|
container: this.gridview.element,
|
|
6763
7328
|
content: group.element,
|
|
6764
|
-
height: (
|
|
6765
|
-
width: (
|
|
7329
|
+
height: (_b = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _b !== void 0 ? _b : 300,
|
|
7330
|
+
width: (_c = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _c !== void 0 ? _c : 300,
|
|
6766
7331
|
left: overlayLeft,
|
|
6767
7332
|
top: overlayTop,
|
|
6768
7333
|
minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6769
7334
|
? undefined
|
|
6770
|
-
: (
|
|
7335
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumWidthWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6771
7336
|
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6772
7337
|
? undefined
|
|
6773
|
-
: (
|
|
7338
|
+
: (_g = (_f = this.options.floatingGroupBounds) === null || _f === void 0 ? void 0 : _f.minimumHeightWithinViewport) !== null && _g !== void 0 ? _g : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6774
7339
|
});
|
|
6775
7340
|
const el = group.element.querySelector('.void-container');
|
|
6776
7341
|
if (!el) {
|
|
@@ -6801,12 +7366,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6801
7366
|
}), {
|
|
6802
7367
|
dispose: () => {
|
|
6803
7368
|
disposable.dispose();
|
|
6804
|
-
group.model.location = 'grid';
|
|
7369
|
+
group.model.location = { type: 'grid' };
|
|
6805
7370
|
remove(this._floatingGroups, floatingGroupPanel);
|
|
6806
7371
|
this.updateWatermark();
|
|
6807
7372
|
},
|
|
6808
7373
|
});
|
|
6809
7374
|
this._floatingGroups.push(floatingGroupPanel);
|
|
7375
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
|
|
7376
|
+
this.doSetGroupAndPanelActive(group);
|
|
7377
|
+
}
|
|
6810
7378
|
this.updateWatermark();
|
|
6811
7379
|
}
|
|
6812
7380
|
orthogonalize(position) {
|
|
@@ -6896,8 +7464,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6896
7464
|
return this.panels.find((panel) => panel.id === id);
|
|
6897
7465
|
}
|
|
6898
7466
|
setActivePanel(panel) {
|
|
6899
|
-
this.doSetGroupActive(panel.group);
|
|
6900
7467
|
panel.group.model.openPanel(panel);
|
|
7468
|
+
this.doSetGroupAndPanelActive(panel.group);
|
|
6901
7469
|
}
|
|
6902
7470
|
moveToNext(options = {}) {
|
|
6903
7471
|
var _a;
|
|
@@ -6958,7 +7526,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6958
7526
|
});
|
|
6959
7527
|
const popoutGroups = this._popoutGroups.map((group) => {
|
|
6960
7528
|
return {
|
|
6961
|
-
data: group.
|
|
7529
|
+
data: group.popoutGroup.toJSON(),
|
|
7530
|
+
gridReferenceGroup: group.referenceGroup,
|
|
6962
7531
|
position: group.window.dimensions(),
|
|
6963
7532
|
};
|
|
6964
7533
|
});
|
|
@@ -6976,7 +7545,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6976
7545
|
return result;
|
|
6977
7546
|
}
|
|
6978
7547
|
fromJSON(data) {
|
|
6979
|
-
var _a, _b;
|
|
7548
|
+
var _a, _b, _c;
|
|
6980
7549
|
this.clear();
|
|
6981
7550
|
if (typeof data !== 'object' || data === null) {
|
|
6982
7551
|
throw new Error('serialized layout must be a non-null object');
|
|
@@ -7015,7 +7584,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7015
7584
|
const isActive = typeof activeView === 'string' &&
|
|
7016
7585
|
activeView === panel.id;
|
|
7017
7586
|
group.model.openPanel(panel, {
|
|
7018
|
-
|
|
7587
|
+
skipSetActive: !isActive,
|
|
7019
7588
|
skipSetGroupActive: true,
|
|
7020
7589
|
});
|
|
7021
7590
|
}
|
|
@@ -7045,11 +7614,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7045
7614
|
}
|
|
7046
7615
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7047
7616
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
7048
|
-
const { data, position } = serializedPopoutGroup;
|
|
7617
|
+
const { data, position, gridReferenceGroup } = serializedPopoutGroup;
|
|
7049
7618
|
const group = createGroupFromSerializedState(data);
|
|
7050
|
-
this.addPopoutGroup(
|
|
7619
|
+
this.addPopoutGroup((_c = (gridReferenceGroup
|
|
7620
|
+
? this.getPanel(gridReferenceGroup)
|
|
7621
|
+
: undefined)) !== null && _c !== void 0 ? _c : group, {
|
|
7051
7622
|
skipRemoveGroup: true,
|
|
7052
7623
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
7624
|
+
overridePopoutGroup: gridReferenceGroup
|
|
7625
|
+
? group
|
|
7626
|
+
: undefined,
|
|
7053
7627
|
});
|
|
7054
7628
|
}
|
|
7055
7629
|
for (const floatingGroup of this._floatingGroups) {
|
|
@@ -7096,12 +7670,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7096
7670
|
*/
|
|
7097
7671
|
throw err;
|
|
7098
7672
|
}
|
|
7673
|
+
this.updateWatermark();
|
|
7099
7674
|
this._onDidLayoutFromJSON.fire();
|
|
7100
7675
|
}
|
|
7101
7676
|
clear() {
|
|
7102
7677
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7103
7678
|
const hasActiveGroup = !!this.activeGroup;
|
|
7104
|
-
|
|
7679
|
+
!!this.activePanel;
|
|
7105
7680
|
for (const group of groups) {
|
|
7106
7681
|
// remove the group will automatically remove the panels
|
|
7107
7682
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7109,9 +7684,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7109
7684
|
if (hasActiveGroup) {
|
|
7110
7685
|
this.doSetGroupAndPanelActive(undefined);
|
|
7111
7686
|
}
|
|
7112
|
-
if (hasActivePanel) {
|
|
7113
|
-
this._onDidActivePanelChange.fire(undefined);
|
|
7114
|
-
}
|
|
7115
7687
|
this.gridview.clear();
|
|
7116
7688
|
}
|
|
7117
7689
|
closeAllGroups() {
|
|
@@ -7152,6 +7724,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7152
7724
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
7153
7725
|
const panel = this.createPanel(options, group);
|
|
7154
7726
|
group.model.openPanel(panel);
|
|
7727
|
+
this.doSetGroupAndPanelActive(group);
|
|
7155
7728
|
return panel;
|
|
7156
7729
|
}
|
|
7157
7730
|
}
|
|
@@ -7163,6 +7736,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7163
7736
|
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
7164
7737
|
if (options.floating) {
|
|
7165
7738
|
const group = this.createGroup();
|
|
7739
|
+
this._onDidAddGroup.fire(group);
|
|
7166
7740
|
const o = typeof options.floating === 'object' &&
|
|
7167
7741
|
options.floating !== null
|
|
7168
7742
|
? options.floating
|
|
@@ -7170,16 +7744,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7170
7744
|
this.addFloatingGroup(group, o, {
|
|
7171
7745
|
inDragMode: false,
|
|
7172
7746
|
skipRemoveGroup: true,
|
|
7747
|
+
skipActiveGroup: true,
|
|
7173
7748
|
});
|
|
7174
|
-
this._onDidAddGroup.fire(group);
|
|
7175
7749
|
panel = this.createPanel(options, group);
|
|
7176
7750
|
group.model.openPanel(panel);
|
|
7177
|
-
this.doSetGroupAndPanelActive(group);
|
|
7178
7751
|
}
|
|
7179
|
-
else if (referenceGroup.api.location === 'floating' ||
|
|
7752
|
+
else if (referenceGroup.api.location.type === 'floating' ||
|
|
7180
7753
|
target === 'center') {
|
|
7181
7754
|
panel = this.createPanel(options, referenceGroup);
|
|
7182
7755
|
referenceGroup.model.openPanel(panel);
|
|
7756
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
7183
7757
|
}
|
|
7184
7758
|
else {
|
|
7185
7759
|
const location = getGridLocation(referenceGroup.element);
|
|
@@ -7187,10 +7761,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7187
7761
|
const group = this.createGroupAtLocation(relativeLocation);
|
|
7188
7762
|
panel = this.createPanel(options, group);
|
|
7189
7763
|
group.model.openPanel(panel);
|
|
7764
|
+
this.doSetGroupAndPanelActive(group);
|
|
7190
7765
|
}
|
|
7191
7766
|
}
|
|
7192
7767
|
else if (options.floating) {
|
|
7193
7768
|
const group = this.createGroup();
|
|
7769
|
+
this._onDidAddGroup.fire(group);
|
|
7194
7770
|
const o = typeof options.floating === 'object' &&
|
|
7195
7771
|
options.floating !== null
|
|
7196
7772
|
? options.floating
|
|
@@ -7198,16 +7774,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7198
7774
|
this.addFloatingGroup(group, o, {
|
|
7199
7775
|
inDragMode: false,
|
|
7200
7776
|
skipRemoveGroup: true,
|
|
7777
|
+
skipActiveGroup: true,
|
|
7201
7778
|
});
|
|
7202
|
-
this._onDidAddGroup.fire(group);
|
|
7203
7779
|
panel = this.createPanel(options, group);
|
|
7204
7780
|
group.model.openPanel(panel);
|
|
7205
|
-
this.doSetGroupAndPanelActive(group);
|
|
7206
7781
|
}
|
|
7207
7782
|
else {
|
|
7208
7783
|
const group = this.createGroupAtLocation();
|
|
7209
7784
|
panel = this.createPanel(options, group);
|
|
7210
7785
|
group.model.openPanel(panel);
|
|
7786
|
+
this.doSetGroupAndPanelActive(group);
|
|
7211
7787
|
}
|
|
7212
7788
|
return panel;
|
|
7213
7789
|
}
|
|
@@ -7219,13 +7795,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7219
7795
|
if (!group) {
|
|
7220
7796
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
7221
7797
|
}
|
|
7222
|
-
group.model.removePanel(panel
|
|
7798
|
+
group.model.removePanel(panel, {
|
|
7799
|
+
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
7800
|
+
});
|
|
7223
7801
|
if (!options.skipDispose) {
|
|
7224
|
-
|
|
7802
|
+
panel.group.model.renderContainer.detatch(panel);
|
|
7225
7803
|
panel.dispose();
|
|
7226
7804
|
}
|
|
7227
7805
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
7228
|
-
this.removeGroup(group);
|
|
7806
|
+
this.removeGroup(group, { skipActive: options.skipSetActiveGroup });
|
|
7229
7807
|
}
|
|
7230
7808
|
}
|
|
7231
7809
|
createWatermarkComponent() {
|
|
@@ -7238,7 +7816,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7238
7816
|
}
|
|
7239
7817
|
updateWatermark() {
|
|
7240
7818
|
var _a, _b;
|
|
7241
|
-
if (this.groups.filter((x) => x.api.location === 'grid').length === 0) {
|
|
7819
|
+
if (this.groups.filter((x) => x.api.location.type === 'grid' && x.api.isVisible).length === 0) {
|
|
7242
7820
|
if (!this.watermark) {
|
|
7243
7821
|
this.watermark = this.createWatermarkComponent();
|
|
7244
7822
|
this.watermark.init({
|
|
@@ -7284,36 +7862,42 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7284
7862
|
}
|
|
7285
7863
|
else {
|
|
7286
7864
|
const group = this.orthogonalize(directionToPosition(options.direction));
|
|
7865
|
+
if (!options.skipSetActive) {
|
|
7866
|
+
this.doSetGroupAndPanelActive(group);
|
|
7867
|
+
}
|
|
7287
7868
|
return group;
|
|
7288
7869
|
}
|
|
7289
7870
|
const target = toTarget(options.direction || 'within');
|
|
7290
7871
|
const location = getGridLocation(referenceGroup.element);
|
|
7291
7872
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7292
7873
|
this.doAddGroup(group, relativeLocation);
|
|
7874
|
+
if (!options.skipSetActive) {
|
|
7875
|
+
this.doSetGroupAndPanelActive(group);
|
|
7876
|
+
}
|
|
7293
7877
|
return group;
|
|
7294
7878
|
}
|
|
7295
7879
|
else {
|
|
7296
7880
|
this.doAddGroup(group);
|
|
7881
|
+
this.doSetGroupAndPanelActive(group);
|
|
7297
7882
|
return group;
|
|
7298
7883
|
}
|
|
7299
7884
|
}
|
|
7300
7885
|
removeGroup(group, options) {
|
|
7886
|
+
this.doRemoveGroup(group, options);
|
|
7887
|
+
}
|
|
7888
|
+
doRemoveGroup(group, options) {
|
|
7301
7889
|
var _a;
|
|
7302
7890
|
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7891
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7892
|
+
for (const panel of panels) {
|
|
7893
|
+
this.removePanel(panel, {
|
|
7894
|
+
removeEmptyGroup: false,
|
|
7895
|
+
skipDispose: (_a = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _a !== void 0 ? _a : false,
|
|
7896
|
+
});
|
|
7897
|
+
}
|
|
7308
7898
|
}
|
|
7309
7899
|
const activePanel = this.activePanel;
|
|
7310
|
-
|
|
7311
|
-
if (this.activePanel !== activePanel) {
|
|
7312
|
-
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7313
|
-
}
|
|
7314
|
-
}
|
|
7315
|
-
doRemoveGroup(group, options) {
|
|
7316
|
-
if (group.api.location === 'floating') {
|
|
7900
|
+
if (group.api.location.type === 'floating') {
|
|
7317
7901
|
const floatingGroup = this._floatingGroups.find((_) => _.group === group);
|
|
7318
7902
|
if (floatingGroup) {
|
|
7319
7903
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
@@ -7325,60 +7909,124 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7325
7909
|
floatingGroup.dispose();
|
|
7326
7910
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7327
7911
|
const groups = Array.from(this._groups.values());
|
|
7328
|
-
this.
|
|
7912
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7329
7913
|
}
|
|
7330
7914
|
return floatingGroup.group;
|
|
7331
7915
|
}
|
|
7332
7916
|
throw new Error('failed to find floating group');
|
|
7333
7917
|
}
|
|
7334
|
-
if (group.api.location === 'popout') {
|
|
7335
|
-
const selectedGroup = this._popoutGroups.find((_) => _.
|
|
7918
|
+
if (group.api.location.type === 'popout') {
|
|
7919
|
+
const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
|
|
7336
7920
|
if (selectedGroup) {
|
|
7337
7921
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7338
|
-
|
|
7922
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutAssociated)) {
|
|
7923
|
+
const refGroup = selectedGroup.referenceGroup
|
|
7924
|
+
? this.getPanel(selectedGroup.referenceGroup)
|
|
7925
|
+
: undefined;
|
|
7926
|
+
if (refGroup) {
|
|
7927
|
+
this.removeGroup(refGroup);
|
|
7928
|
+
}
|
|
7929
|
+
}
|
|
7930
|
+
selectedGroup.popoutGroup.dispose();
|
|
7339
7931
|
this._groups.delete(group.id);
|
|
7340
7932
|
this._onDidRemoveGroup.fire(group);
|
|
7341
7933
|
}
|
|
7342
|
-
selectedGroup.dispose();
|
|
7934
|
+
const removedGroup = selectedGroup.disposable.dispose();
|
|
7935
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
|
|
7936
|
+
this.doAddGroup(removedGroup, [0]);
|
|
7937
|
+
this.doSetGroupAndPanelActive(removedGroup);
|
|
7938
|
+
}
|
|
7343
7939
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7344
7940
|
const groups = Array.from(this._groups.values());
|
|
7345
|
-
this.
|
|
7941
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7346
7942
|
}
|
|
7347
|
-
|
|
7943
|
+
this.updateWatermark();
|
|
7944
|
+
return selectedGroup.popoutGroup;
|
|
7348
7945
|
}
|
|
7349
7946
|
throw new Error('failed to find popout group');
|
|
7350
7947
|
}
|
|
7351
|
-
|
|
7948
|
+
const re = super.doRemoveGroup(group, options);
|
|
7949
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
7950
|
+
if (this.activePanel !== activePanel) {
|
|
7951
|
+
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7952
|
+
}
|
|
7953
|
+
}
|
|
7954
|
+
return re;
|
|
7352
7955
|
}
|
|
7353
|
-
|
|
7354
|
-
|
|
7956
|
+
movingLock(func) {
|
|
7957
|
+
const isMoving = this._moving;
|
|
7958
|
+
try {
|
|
7959
|
+
this._moving = true;
|
|
7960
|
+
return func();
|
|
7961
|
+
}
|
|
7962
|
+
finally {
|
|
7963
|
+
this._moving = isMoving;
|
|
7964
|
+
}
|
|
7965
|
+
}
|
|
7966
|
+
moveGroupOrPanel(options) {
|
|
7967
|
+
var _a;
|
|
7968
|
+
const destinationGroup = options.to.group;
|
|
7969
|
+
const sourceGroupId = options.from.groupId;
|
|
7970
|
+
const sourceItemId = options.from.panelId;
|
|
7971
|
+
const destinationTarget = options.to.position;
|
|
7972
|
+
const destinationIndex = options.to.index;
|
|
7355
7973
|
const sourceGroup = sourceGroupId
|
|
7356
7974
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
7357
7975
|
: undefined;
|
|
7976
|
+
if (!sourceGroup) {
|
|
7977
|
+
throw new Error(`Failed to find group id ${sourceGroupId}`);
|
|
7978
|
+
}
|
|
7358
7979
|
if (sourceItemId === undefined) {
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7980
|
+
/**
|
|
7981
|
+
* Moving an entire group into another group
|
|
7982
|
+
*/
|
|
7983
|
+
this.moveGroup({
|
|
7984
|
+
from: { group: sourceGroup },
|
|
7985
|
+
to: {
|
|
7986
|
+
group: destinationGroup,
|
|
7987
|
+
position: destinationTarget,
|
|
7988
|
+
},
|
|
7989
|
+
});
|
|
7362
7990
|
return;
|
|
7363
7991
|
}
|
|
7364
7992
|
if (!destinationTarget || destinationTarget === 'center') {
|
|
7365
|
-
|
|
7366
|
-
|
|
7993
|
+
/**
|
|
7994
|
+
* Dropping a panel within another group
|
|
7995
|
+
*/
|
|
7996
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
7997
|
+
skipSetActive: false,
|
|
7998
|
+
skipSetActiveGroup: true,
|
|
7999
|
+
}));
|
|
8000
|
+
if (!removedPanel) {
|
|
7367
8001
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7368
8002
|
}
|
|
7369
|
-
if (
|
|
7370
|
-
|
|
8003
|
+
if (sourceGroup.model.size === 0) {
|
|
8004
|
+
// remove the group and do not set a new group as active
|
|
8005
|
+
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
7371
8006
|
}
|
|
7372
|
-
destinationGroup.model.openPanel(
|
|
8007
|
+
this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
|
|
7373
8008
|
index: destinationIndex,
|
|
8009
|
+
skipSetGroupActive: true,
|
|
8010
|
+
}));
|
|
8011
|
+
this.doSetGroupAndPanelActive(destinationGroup);
|
|
8012
|
+
this._onDidMovePanel.fire({
|
|
8013
|
+
panel: removedPanel,
|
|
7374
8014
|
});
|
|
7375
8015
|
}
|
|
7376
8016
|
else {
|
|
8017
|
+
/**
|
|
8018
|
+
* Dropping a panel to the extremities of a group which will place that panel
|
|
8019
|
+
* into an adjacent group
|
|
8020
|
+
*/
|
|
7377
8021
|
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
7378
8022
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7379
|
-
if (sourceGroup
|
|
8023
|
+
if (sourceGroup.size < 2) {
|
|
8024
|
+
/**
|
|
8025
|
+
* If we are moving from a group which only has one panel left we will consider
|
|
8026
|
+
* moving the group itself rather than moving the panel into a newly created group
|
|
8027
|
+
*/
|
|
7380
8028
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
7381
|
-
if (sourceGroup.api.location === 'grid') {
|
|
8029
|
+
if (sourceGroup.api.location.type === 'grid') {
|
|
7382
8030
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
7383
8031
|
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
7384
8032
|
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
@@ -7386,77 +8034,122 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7386
8034
|
// if a group has one tab - we are essentially moving the 'group'
|
|
7387
8035
|
// which is equivalent to swapping two views in this case
|
|
7388
8036
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8037
|
+
return;
|
|
7389
8038
|
}
|
|
7390
8039
|
}
|
|
7391
8040
|
// source group will become empty so delete the group
|
|
7392
|
-
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
8041
|
+
const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
|
|
7393
8042
|
skipActive: true,
|
|
7394
8043
|
skipDispose: true,
|
|
7395
|
-
});
|
|
8044
|
+
}));
|
|
7396
8045
|
// after deleting the group we need to re-evaulate the ref location
|
|
7397
8046
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
7398
8047
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
7399
|
-
this.doAddGroup(targetGroup, location);
|
|
8048
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8049
|
+
this.doSetGroupAndPanelActive(targetGroup);
|
|
7400
8050
|
}
|
|
7401
8051
|
else {
|
|
7402
|
-
|
|
7403
|
-
|
|
8052
|
+
/**
|
|
8053
|
+
* The group we are removing from has many panels, we need to remove the panels we are moving,
|
|
8054
|
+
* create a new group, add the panels to that new group and add the new group in an appropiate position
|
|
8055
|
+
*/
|
|
8056
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8057
|
+
skipSetActive: false,
|
|
8058
|
+
skipSetActiveGroup: true,
|
|
8059
|
+
}));
|
|
8060
|
+
if (!removedPanel) {
|
|
7404
8061
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7405
8062
|
}
|
|
7406
8063
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7407
8064
|
const group = this.createGroupAtLocation(dropLocation);
|
|
7408
|
-
group.model.openPanel(
|
|
8065
|
+
this.movingLock(() => group.model.openPanel(removedPanel, {
|
|
8066
|
+
skipSetGroupActive: true,
|
|
8067
|
+
}));
|
|
8068
|
+
this.doSetGroupAndPanelActive(group);
|
|
7409
8069
|
}
|
|
7410
8070
|
}
|
|
7411
8071
|
}
|
|
7412
|
-
moveGroup(
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
8072
|
+
moveGroup(options) {
|
|
8073
|
+
const from = options.from.group;
|
|
8074
|
+
const to = options.to.group;
|
|
8075
|
+
const target = options.to.position;
|
|
8076
|
+
if (target === 'center') {
|
|
8077
|
+
const activePanel = from.activePanel;
|
|
8078
|
+
const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
|
|
8079
|
+
skipSetActive: true,
|
|
8080
|
+
})));
|
|
8081
|
+
if ((from === null || from === void 0 ? void 0 : from.model.size) === 0) {
|
|
8082
|
+
this.doRemoveGroup(from, { skipActive: true });
|
|
8083
|
+
}
|
|
8084
|
+
this.movingLock(() => {
|
|
7420
8085
|
for (const panel of panels) {
|
|
7421
|
-
|
|
7422
|
-
|
|
8086
|
+
to.model.openPanel(panel, {
|
|
8087
|
+
skipSetActive: panel !== activePanel,
|
|
8088
|
+
skipSetGroupActive: true,
|
|
7423
8089
|
});
|
|
7424
8090
|
}
|
|
7425
|
-
}
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
8091
|
+
});
|
|
8092
|
+
this.doSetGroupAndPanelActive(to);
|
|
8093
|
+
panels.forEach((panel) => {
|
|
8094
|
+
this._onDidMovePanel.fire({ panel });
|
|
8095
|
+
});
|
|
8096
|
+
}
|
|
8097
|
+
else {
|
|
8098
|
+
switch (from.api.location.type) {
|
|
8099
|
+
case 'grid':
|
|
8100
|
+
this.gridview.removeView(getGridLocation(from.element));
|
|
8101
|
+
break;
|
|
8102
|
+
case 'floating': {
|
|
8103
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
8104
|
+
if (!selectedFloatingGroup) {
|
|
8105
|
+
throw new Error('failed to find floating group');
|
|
7438
8106
|
}
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
8107
|
+
selectedFloatingGroup.dispose();
|
|
8108
|
+
break;
|
|
8109
|
+
}
|
|
8110
|
+
case 'popout': {
|
|
8111
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
8112
|
+
if (!selectedPopoutGroup) {
|
|
8113
|
+
throw new Error('failed to find popout group');
|
|
7445
8114
|
}
|
|
8115
|
+
selectedPopoutGroup.disposable.dispose();
|
|
7446
8116
|
}
|
|
7447
|
-
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
7448
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
7449
|
-
this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
|
|
7450
8117
|
}
|
|
8118
|
+
const referenceLocation = getGridLocation(to.element);
|
|
8119
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8120
|
+
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8121
|
+
from.panels.forEach((panel) => {
|
|
8122
|
+
this._onDidMovePanel.fire({ panel });
|
|
8123
|
+
});
|
|
7451
8124
|
}
|
|
7452
8125
|
}
|
|
7453
|
-
|
|
7454
|
-
|
|
8126
|
+
doSetGroupActive(group) {
|
|
8127
|
+
super.doSetGroupActive(group);
|
|
8128
|
+
const activePanel = this.activePanel;
|
|
8129
|
+
if (!this._moving &&
|
|
8130
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8131
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8132
|
+
}
|
|
8133
|
+
}
|
|
8134
|
+
doSetGroupAndPanelActive(group) {
|
|
8135
|
+
super.doSetGroupActive(group);
|
|
7455
8136
|
const activePanel = this.activePanel;
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
this.
|
|
8137
|
+
if (group &&
|
|
8138
|
+
this.hasMaximizedGroup() &&
|
|
8139
|
+
!this.isMaximizedGroup(group)) {
|
|
8140
|
+
this.exitMaximizedGroup();
|
|
8141
|
+
}
|
|
8142
|
+
if (!this._moving &&
|
|
8143
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8144
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8145
|
+
}
|
|
8146
|
+
}
|
|
8147
|
+
getNextGroupId() {
|
|
8148
|
+
let id = this.nextGroupId.next();
|
|
8149
|
+
while (this._groups.has(id)) {
|
|
8150
|
+
id = this.nextGroupId.next();
|
|
7459
8151
|
}
|
|
8152
|
+
return id;
|
|
7460
8153
|
}
|
|
7461
8154
|
createGroup(options) {
|
|
7462
8155
|
if (!options) {
|
|
@@ -7474,7 +8167,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7474
8167
|
}
|
|
7475
8168
|
}
|
|
7476
8169
|
const view = new DockviewGroupPanel(this, id, options);
|
|
7477
|
-
view.init({ params: {}, accessor:
|
|
8170
|
+
view.init({ params: {}, accessor: this });
|
|
7478
8171
|
if (!this._groups.has(view.id)) {
|
|
7479
8172
|
const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {
|
|
7480
8173
|
this._onWillDragPanel.fire(event);
|
|
@@ -7482,20 +8175,48 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7482
8175
|
this._onWillDragGroup.fire(event);
|
|
7483
8176
|
}), view.model.onMove((event) => {
|
|
7484
8177
|
const { groupId, itemId, target, index } = event;
|
|
7485
|
-
this.moveGroupOrPanel(
|
|
8178
|
+
this.moveGroupOrPanel({
|
|
8179
|
+
from: { groupId: groupId, panelId: itemId },
|
|
8180
|
+
to: {
|
|
8181
|
+
group: view,
|
|
8182
|
+
position: target,
|
|
8183
|
+
index,
|
|
8184
|
+
},
|
|
8185
|
+
});
|
|
7486
8186
|
}), view.model.onDidDrop((event) => {
|
|
7487
|
-
this._onDidDrop.fire(
|
|
8187
|
+
this._onDidDrop.fire(event);
|
|
8188
|
+
}), view.model.onWillDrop((event) => {
|
|
8189
|
+
this._onWillDrop.fire(event);
|
|
8190
|
+
}), view.model.onWillShowOverlay((event) => {
|
|
8191
|
+
if (this.options.disableDnd) {
|
|
8192
|
+
event.preventDefault();
|
|
8193
|
+
return;
|
|
8194
|
+
}
|
|
8195
|
+
this._onWillShowOverlay.fire(event);
|
|
7488
8196
|
}), view.model.onDidAddPanel((event) => {
|
|
8197
|
+
if (this._moving) {
|
|
8198
|
+
return;
|
|
8199
|
+
}
|
|
7489
8200
|
this._onDidAddPanel.fire(event.panel);
|
|
7490
8201
|
}), view.model.onDidRemovePanel((event) => {
|
|
8202
|
+
if (this._moving) {
|
|
8203
|
+
return;
|
|
8204
|
+
}
|
|
7491
8205
|
this._onDidRemovePanel.fire(event.panel);
|
|
7492
8206
|
}), view.model.onDidActivePanelChange((event) => {
|
|
7493
|
-
this.
|
|
8207
|
+
if (this._moving) {
|
|
8208
|
+
return;
|
|
8209
|
+
}
|
|
8210
|
+
if (event.panel !== this.activePanel) {
|
|
8211
|
+
return;
|
|
8212
|
+
}
|
|
8213
|
+
if (this._onDidActivePanelChange.value !== event.panel) {
|
|
8214
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
8215
|
+
}
|
|
7494
8216
|
}));
|
|
7495
8217
|
this._groups.set(view.id, { value: view, disposable });
|
|
7496
8218
|
}
|
|
7497
|
-
// TODO: must be called after the above listeners have been setup,
|
|
7498
|
-
// not an ideal pattern
|
|
8219
|
+
// TODO: must be called after the above listeners have been setup, not an ideal pattern
|
|
7499
8220
|
view.initialize();
|
|
7500
8221
|
return view;
|
|
7501
8222
|
}
|
|
@@ -7548,7 +8269,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7548
8269
|
});
|
|
7549
8270
|
this._onDidLayoutfromJSON = new Emitter();
|
|
7550
8271
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
8272
|
+
this._onDidRemoveGroup = new Emitter();
|
|
8273
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
8274
|
+
this._onDidAddGroup = new Emitter();
|
|
8275
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
8276
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
8277
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
7551
8278
|
this._options = options;
|
|
8279
|
+
this.addDisposables(this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
|
|
8280
|
+
this._onDidAddGroup.fire(event);
|
|
8281
|
+
}), this.onDidRemove((event) => {
|
|
8282
|
+
this._onDidRemoveGroup.fire(event);
|
|
8283
|
+
}), this.onDidActiveChange((event) => {
|
|
8284
|
+
this._onDidActiveGroupChange.fire(event);
|
|
8285
|
+
}));
|
|
7552
8286
|
if (!this.options.components) {
|
|
7553
8287
|
this.options.components = {};
|
|
7554
8288
|
}
|
|
@@ -7723,6 +8457,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7723
8457
|
});
|
|
7724
8458
|
this.registerPanel(view);
|
|
7725
8459
|
this.doAddGroup(view, relativeLocation, options.size);
|
|
8460
|
+
this.doSetGroupActive(view);
|
|
7726
8461
|
return view;
|
|
7727
8462
|
}
|
|
7728
8463
|
registerPanel(panel) {
|
|
@@ -7864,19 +8599,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7864
8599
|
const index = this.panels.indexOf(panel);
|
|
7865
8600
|
this.splitview.setViewVisible(index, visible);
|
|
7866
8601
|
}
|
|
7867
|
-
setActive(
|
|
7868
|
-
this._activePanel =
|
|
8602
|
+
setActive(panel, skipFocus) {
|
|
8603
|
+
this._activePanel = panel;
|
|
7869
8604
|
this.panels
|
|
7870
|
-
.filter((v) => v !==
|
|
8605
|
+
.filter((v) => v !== panel)
|
|
7871
8606
|
.forEach((v) => {
|
|
7872
8607
|
v.api._onDidActiveChange.fire({ isActive: false });
|
|
7873
8608
|
if (!skipFocus) {
|
|
7874
8609
|
v.focus();
|
|
7875
8610
|
}
|
|
7876
8611
|
});
|
|
7877
|
-
|
|
8612
|
+
panel.api._onDidActiveChange.fire({ isActive: true });
|
|
7878
8613
|
if (!skipFocus) {
|
|
7879
|
-
|
|
8614
|
+
panel.focus();
|
|
7880
8615
|
}
|
|
7881
8616
|
}
|
|
7882
8617
|
removePanel(panel, sizing) {
|
|
@@ -8175,6 +8910,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8175
8910
|
});
|
|
8176
8911
|
this.addDisposables(this._disposable);
|
|
8177
8912
|
}
|
|
8913
|
+
setVisible(panel, visible) {
|
|
8914
|
+
const index = this.panels.indexOf(panel);
|
|
8915
|
+
this.paneview.setViewVisible(index, visible);
|
|
8916
|
+
}
|
|
8178
8917
|
focus() {
|
|
8179
8918
|
//noop
|
|
8180
8919
|
}
|
|
@@ -8221,6 +8960,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8221
8960
|
isExpanded: options.isExpanded,
|
|
8222
8961
|
title: options.title,
|
|
8223
8962
|
containerApi: new PaneviewApi(this),
|
|
8963
|
+
accessor: this,
|
|
8224
8964
|
});
|
|
8225
8965
|
this.paneview.addPane(view, size, index);
|
|
8226
8966
|
view.orientation = this.paneview.orientation;
|
|
@@ -8320,6 +9060,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8320
9060
|
title: data.title,
|
|
8321
9061
|
isExpanded: !!view.expanded,
|
|
8322
9062
|
containerApi: new PaneviewApi(this),
|
|
9063
|
+
accessor: this,
|
|
8323
9064
|
});
|
|
8324
9065
|
panel.orientation = this.paneview.orientation;
|
|
8325
9066
|
});
|
|
@@ -8408,7 +9149,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8408
9149
|
this._onDidChange = new Emitter();
|
|
8409
9150
|
this.onDidChange = this._onDidChange.event;
|
|
8410
9151
|
this.api.initialize(this);
|
|
8411
|
-
this.addDisposables(this._onDidChange, this.api.
|
|
9152
|
+
this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => {
|
|
8412
9153
|
const { isVisible } = event;
|
|
8413
9154
|
const { accessor } = this._params;
|
|
8414
9155
|
accessor.setVisible(this, isVisible);
|
|
@@ -8533,13 +9274,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8533
9274
|
if (this.disposed) {
|
|
8534
9275
|
throw new Error('invalid operation: resource is already disposed');
|
|
8535
9276
|
}
|
|
8536
|
-
if (
|
|
9277
|
+
if (!isReactComponent(this.component)) {
|
|
8537
9278
|
/**
|
|
8538
9279
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
8539
|
-
* if we do not intercept
|
|
8540
|
-
* for the same reason
|
|
9280
|
+
* if we do not intercept then React library will throw a very obsure error
|
|
9281
|
+
* for the same reason... at least at this point we will emit a sensible stacktrace.
|
|
8541
9282
|
*/
|
|
8542
|
-
throw new Error('
|
|
9283
|
+
throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');
|
|
8543
9284
|
}
|
|
8544
9285
|
const bridgeComponent = React__namespace.createElement(React__namespace.forwardRef(ReactComponentBridge), {
|
|
8545
9286
|
component: this
|
|
@@ -8591,9 +9332,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8591
9332
|
}, []);
|
|
8592
9333
|
return [portals, addPortal];
|
|
8593
9334
|
};
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
9335
|
+
function isReactComponent(component) {
|
|
9336
|
+
/**
|
|
9337
|
+
* Yes, we could use "react-is" but that would introduce an unwanted peer dependency
|
|
9338
|
+
* so for now we will check in a rather crude fashion...
|
|
9339
|
+
*/
|
|
9340
|
+
return (typeof component === 'function' /** Functional Componnts */ ||
|
|
9341
|
+
!!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
|
|
8597
9342
|
}
|
|
8598
9343
|
|
|
8599
9344
|
class ReactPanelContentPart {
|
|
@@ -8853,6 +9598,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8853
9598
|
defaultRenderer: props.defaultRenderer,
|
|
8854
9599
|
debug: props.debug,
|
|
8855
9600
|
rootOverlayModel: props.rootOverlayModel,
|
|
9601
|
+
locked: props.locked,
|
|
9602
|
+
disableDnd: props.disableDnd,
|
|
8856
9603
|
});
|
|
8857
9604
|
const { clientWidth, clientHeight } = domRef.current;
|
|
8858
9605
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -8864,6 +9611,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8864
9611
|
dockview.dispose();
|
|
8865
9612
|
};
|
|
8866
9613
|
}, []);
|
|
9614
|
+
React__namespace.useEffect(() => {
|
|
9615
|
+
if (!dockviewRef.current) {
|
|
9616
|
+
return;
|
|
9617
|
+
}
|
|
9618
|
+
dockviewRef.current.locked = !!props.locked;
|
|
9619
|
+
}, [props.locked]);
|
|
9620
|
+
React__namespace.useEffect(() => {
|
|
9621
|
+
if (!dockviewRef.current) {
|
|
9622
|
+
return;
|
|
9623
|
+
}
|
|
9624
|
+
dockviewRef.current.updateOptions({
|
|
9625
|
+
disableDnd: props.disableDnd,
|
|
9626
|
+
});
|
|
9627
|
+
}, [props.disableDnd]);
|
|
8867
9628
|
React__namespace.useEffect(() => {
|
|
8868
9629
|
if (!dockviewRef.current) {
|
|
8869
9630
|
return () => {
|
|
@@ -8879,6 +9640,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8879
9640
|
disposable.dispose();
|
|
8880
9641
|
};
|
|
8881
9642
|
}, [props.onDidDrop]);
|
|
9643
|
+
React__namespace.useEffect(() => {
|
|
9644
|
+
if (!dockviewRef.current) {
|
|
9645
|
+
return () => {
|
|
9646
|
+
// noop
|
|
9647
|
+
};
|
|
9648
|
+
}
|
|
9649
|
+
const disposable = dockviewRef.current.onWillDrop((event) => {
|
|
9650
|
+
if (props.onWillDrop) {
|
|
9651
|
+
props.onWillDrop(event);
|
|
9652
|
+
}
|
|
9653
|
+
});
|
|
9654
|
+
return () => {
|
|
9655
|
+
disposable.dispose();
|
|
9656
|
+
};
|
|
9657
|
+
}, [props.onWillDrop]);
|
|
8882
9658
|
React__namespace.useEffect(() => {
|
|
8883
9659
|
if (!dockviewRef.current) {
|
|
8884
9660
|
return;
|
|
@@ -9121,7 +9897,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9121
9897
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
9122
9898
|
params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
|
|
9123
9899
|
api: this.api,
|
|
9124
|
-
|
|
9900
|
+
// TODO: fix casting hack
|
|
9901
|
+
containerApi: new GridviewApi(this._params
|
|
9902
|
+
.accessor),
|
|
9125
9903
|
});
|
|
9126
9904
|
}
|
|
9127
9905
|
}
|
|
@@ -9304,12 +10082,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9304
10082
|
exports.DockviewComponent = DockviewComponent;
|
|
9305
10083
|
exports.DockviewCompositeDisposable = CompositeDisposable;
|
|
9306
10084
|
exports.DockviewDefaultTab = DockviewDefaultTab;
|
|
10085
|
+
exports.DockviewDidDropEvent = DockviewDidDropEvent;
|
|
9307
10086
|
exports.DockviewEmitter = Emitter;
|
|
9308
10087
|
exports.DockviewGroupPanel = DockviewGroupPanel;
|
|
9309
10088
|
exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
|
|
9310
10089
|
exports.DockviewMutableDisposable = MutableDisposable;
|
|
9311
10090
|
exports.DockviewPanel = DockviewPanel;
|
|
9312
10091
|
exports.DockviewReact = DockviewReact;
|
|
10092
|
+
exports.DockviewWillDropEvent = DockviewWillDropEvent;
|
|
9313
10093
|
exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
|
|
9314
10094
|
exports.Gridview = Gridview;
|
|
9315
10095
|
exports.GridviewApi = GridviewApi;
|
|
@@ -9333,6 +10113,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9333
10113
|
exports.SplitviewPanel = SplitviewPanel;
|
|
9334
10114
|
exports.SplitviewReact = SplitviewReact;
|
|
9335
10115
|
exports.Tab = Tab;
|
|
10116
|
+
exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
|
|
9336
10117
|
exports.createComponent = createComponent;
|
|
9337
10118
|
exports.directionToPosition = directionToPosition;
|
|
9338
10119
|
exports.getDirectionOrientation = getDirectionOrientation;
|
|
@@ -9347,7 +10128,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9347
10128
|
exports.isGroupOptionsWithPanel = isGroupOptionsWithPanel;
|
|
9348
10129
|
exports.isPanelOptionsWithGroup = isPanelOptionsWithGroup;
|
|
9349
10130
|
exports.isPanelOptionsWithPanel = isPanelOptionsWithPanel;
|
|
9350
|
-
exports.
|
|
10131
|
+
exports.isReactComponent = isReactComponent;
|
|
9351
10132
|
exports.orthogonal = orthogonal;
|
|
9352
10133
|
exports.positionToDirection = positionToDirection;
|
|
9353
10134
|
exports.toTarget = toTarget;
|