dockview 1.9.2 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dockview/defaultTab.d.ts +0 -1
- package/dist/cjs/dockview/defaultTab.js +0 -1
- package/dist/cjs/dockview/dockview.d.ts +5 -3
- package/dist/cjs/dockview/dockview.js +31 -1
- package/dist/cjs/dockview/headerActionsRenderer.d.ts +0 -1
- package/dist/cjs/dockview/headerActionsRenderer.js +0 -1
- package/dist/cjs/dockview/reactContentPart.d.ts +0 -1
- package/dist/cjs/dockview/reactContentPart.js +0 -1
- package/dist/cjs/dockview/reactHeaderPart.d.ts +0 -1
- package/dist/cjs/dockview/reactHeaderPart.js +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.d.ts +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.js +0 -1
- package/dist/cjs/gridview/gridview.d.ts +0 -1
- package/dist/cjs/gridview/gridview.js +0 -1
- package/dist/cjs/gridview/view.d.ts +0 -1
- package/dist/cjs/gridview/view.js +3 -2
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/paneview/paneview.d.ts +0 -1
- package/dist/cjs/paneview/paneview.js +0 -1
- package/dist/cjs/paneview/view.d.ts +0 -1
- package/dist/cjs/paneview/view.js +0 -1
- package/dist/cjs/react.d.ts +1 -2
- package/dist/cjs/react.js +13 -10
- package/dist/cjs/splitview/splitview.d.ts +0 -1
- package/dist/cjs/splitview/splitview.js +0 -1
- package/dist/cjs/splitview/view.d.ts +0 -1
- package/dist/cjs/splitview/view.js +0 -1
- package/dist/cjs/svg.d.ts +0 -1
- package/dist/cjs/svg.js +0 -1
- package/dist/cjs/types.d.ts +0 -1
- package/dist/cjs/types.js +0 -1
- package/dist/dockview.amd.js +1325 -544
- package/dist/dockview.amd.js.map +1 -1
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.js.map +1 -1
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.min.noStyle.js.map +1 -1
- package/dist/dockview.amd.noStyle.js +1325 -544
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +1325 -544
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +1322 -544
- package/dist/dockview.esm.js.map +1 -1
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.esm.min.js.map +1 -1
- package/dist/dockview.js +1325 -544
- package/dist/dockview.js.map +1 -1
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.min.noStyle.js.map +1 -1
- package/dist/dockview.noStyle.js +1325 -544
- package/dist/dockview.noStyle.js.map +1 -1
- package/dist/esm/dockview/defaultTab.d.ts +0 -1
- package/dist/esm/dockview/defaultTab.js +0 -1
- package/dist/esm/dockview/dockview.d.ts +5 -3
- package/dist/esm/dockview/dockview.js +31 -1
- package/dist/esm/dockview/headerActionsRenderer.d.ts +0 -1
- package/dist/esm/dockview/headerActionsRenderer.js +0 -1
- package/dist/esm/dockview/reactContentPart.d.ts +0 -1
- package/dist/esm/dockview/reactContentPart.js +0 -1
- package/dist/esm/dockview/reactHeaderPart.d.ts +0 -1
- package/dist/esm/dockview/reactHeaderPart.js +0 -1
- package/dist/esm/dockview/reactWatermarkPart.d.ts +0 -1
- package/dist/esm/dockview/reactWatermarkPart.js +0 -1
- package/dist/esm/gridview/gridview.d.ts +0 -1
- package/dist/esm/gridview/gridview.js +0 -1
- package/dist/esm/gridview/view.d.ts +0 -1
- package/dist/esm/gridview/view.js +3 -2
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/paneview/paneview.d.ts +0 -1
- package/dist/esm/paneview/paneview.js +0 -1
- package/dist/esm/paneview/view.d.ts +0 -1
- package/dist/esm/paneview/view.js +0 -1
- package/dist/esm/react.d.ts +1 -2
- package/dist/esm/react.js +11 -8
- package/dist/esm/splitview/splitview.d.ts +0 -1
- package/dist/esm/splitview/splitview.js +0 -1
- package/dist/esm/splitview/view.d.ts +0 -1
- package/dist/esm/splitview/view.js +0 -1
- package/dist/esm/svg.d.ts +0 -1
- package/dist/esm/svg.js +0 -1
- package/dist/esm/types.d.ts +0 -1
- package/dist/esm/types.js +0 -1
- package/package.json +4 -4
- package/dist/cjs/dockview/defaultTab.d.ts.map +0 -1
- package/dist/cjs/dockview/defaultTab.js.map +0 -1
- package/dist/cjs/dockview/dockview.d.ts.map +0 -1
- package/dist/cjs/dockview/dockview.js.map +0 -1
- package/dist/cjs/dockview/headerActionsRenderer.d.ts.map +0 -1
- package/dist/cjs/dockview/headerActionsRenderer.js.map +0 -1
- package/dist/cjs/dockview/reactContentPart.d.ts.map +0 -1
- package/dist/cjs/dockview/reactContentPart.js.map +0 -1
- package/dist/cjs/dockview/reactHeaderPart.d.ts.map +0 -1
- package/dist/cjs/dockview/reactHeaderPart.js.map +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.d.ts.map +0 -1
- package/dist/cjs/dockview/reactWatermarkPart.js.map +0 -1
- package/dist/cjs/gridview/gridview.d.ts.map +0 -1
- package/dist/cjs/gridview/gridview.js.map +0 -1
- package/dist/cjs/gridview/view.d.ts.map +0 -1
- package/dist/cjs/gridview/view.js.map +0 -1
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/paneview/paneview.d.ts.map +0 -1
- package/dist/cjs/paneview/paneview.js.map +0 -1
- package/dist/cjs/paneview/view.d.ts.map +0 -1
- package/dist/cjs/paneview/view.js.map +0 -1
- package/dist/cjs/react.d.ts.map +0 -1
- package/dist/cjs/react.js.map +0 -1
- package/dist/cjs/splitview/splitview.d.ts.map +0 -1
- package/dist/cjs/splitview/splitview.js.map +0 -1
- package/dist/cjs/splitview/view.d.ts.map +0 -1
- package/dist/cjs/splitview/view.js.map +0 -1
- package/dist/cjs/svg.d.ts.map +0 -1
- package/dist/cjs/svg.js.map +0 -1
- package/dist/cjs/types.d.ts.map +0 -1
- package/dist/cjs/types.js.map +0 -1
- package/dist/esm/dockview/defaultTab.d.ts.map +0 -1
- package/dist/esm/dockview/defaultTab.js.map +0 -1
- package/dist/esm/dockview/dockview.d.ts.map +0 -1
- package/dist/esm/dockview/dockview.js.map +0 -1
- package/dist/esm/dockview/headerActionsRenderer.d.ts.map +0 -1
- package/dist/esm/dockview/headerActionsRenderer.js.map +0 -1
- package/dist/esm/dockview/reactContentPart.d.ts.map +0 -1
- package/dist/esm/dockview/reactContentPart.js.map +0 -1
- package/dist/esm/dockview/reactHeaderPart.d.ts.map +0 -1
- package/dist/esm/dockview/reactHeaderPart.js.map +0 -1
- package/dist/esm/dockview/reactWatermarkPart.d.ts.map +0 -1
- package/dist/esm/dockview/reactWatermarkPart.js.map +0 -1
- package/dist/esm/gridview/gridview.d.ts.map +0 -1
- package/dist/esm/gridview/gridview.js.map +0 -1
- package/dist/esm/gridview/view.d.ts.map +0 -1
- package/dist/esm/gridview/view.js.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/paneview/paneview.d.ts.map +0 -1
- package/dist/esm/paneview/paneview.js.map +0 -1
- package/dist/esm/paneview/view.d.ts.map +0 -1
- package/dist/esm/paneview/view.js.map +0 -1
- package/dist/esm/react.d.ts.map +0 -1
- package/dist/esm/react.js.map +0 -1
- package/dist/esm/splitview/splitview.d.ts.map +0 -1
- package/dist/esm/splitview/splitview.js.map +0 -1
- package/dist/esm/splitview/view.d.ts.map +0 -1
- package/dist/esm/splitview/view.js.map +0 -1
- package/dist/esm/svg.d.ts.map +0 -1
- package/dist/esm/svg.js.map +0 -1
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js.map +0 -1
package/dist/dockview.amd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.10.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -138,6 +138,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
140
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
141
|
+
class DockviewEvent {
|
|
142
|
+
constructor() {
|
|
143
|
+
this._defaultPrevented = false;
|
|
144
|
+
}
|
|
145
|
+
get defaultPrevented() {
|
|
146
|
+
return this._defaultPrevented;
|
|
147
|
+
}
|
|
148
|
+
preventDefault() {
|
|
149
|
+
this._defaultPrevented = true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
141
152
|
class LeakageMonitor {
|
|
142
153
|
constructor() {
|
|
143
154
|
this.events = new Map();
|
|
@@ -181,6 +192,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
181
192
|
}
|
|
182
193
|
Emitter.ENABLE_TRACKING = isEnabled;
|
|
183
194
|
}
|
|
195
|
+
get value() {
|
|
196
|
+
return this._last;
|
|
197
|
+
}
|
|
184
198
|
constructor(options) {
|
|
185
199
|
this.options = options;
|
|
186
200
|
this._listeners = [];
|
|
@@ -303,8 +317,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
303
317
|
args.forEach((arg) => this._disposables.push(arg));
|
|
304
318
|
}
|
|
305
319
|
dispose() {
|
|
306
|
-
this.
|
|
320
|
+
if (this._isDisposed) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
307
323
|
this._isDisposed = true;
|
|
324
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
325
|
+
this._disposables = [];
|
|
308
326
|
}
|
|
309
327
|
}
|
|
310
328
|
class MutableDisposable {
|
|
@@ -788,6 +806,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
788
806
|
this._endSnappingEnabled = endSnappingEnabled;
|
|
789
807
|
this.updateSashEnablement();
|
|
790
808
|
}
|
|
809
|
+
get disabled() {
|
|
810
|
+
return this._disabled;
|
|
811
|
+
}
|
|
812
|
+
set disabled(value) {
|
|
813
|
+
this._disabled = value;
|
|
814
|
+
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
815
|
+
}
|
|
791
816
|
constructor(container, options) {
|
|
792
817
|
this.container = container;
|
|
793
818
|
this.viewItems = [];
|
|
@@ -798,6 +823,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
798
823
|
this._proportions = undefined;
|
|
799
824
|
this._startSnappingEnabled = true;
|
|
800
825
|
this._endSnappingEnabled = true;
|
|
826
|
+
this._disabled = false;
|
|
801
827
|
this._onDidSashEnd = new Emitter();
|
|
802
828
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
803
829
|
this._onDidAddView = new Emitter();
|
|
@@ -1472,6 +1498,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1472
1498
|
this._onDidChange.fire();
|
|
1473
1499
|
}));
|
|
1474
1500
|
}
|
|
1501
|
+
setViewVisible(index, visible) {
|
|
1502
|
+
this.splitview.setViewVisible(index, visible);
|
|
1503
|
+
}
|
|
1475
1504
|
addPane(pane, size, index = this.splitview.length, skipLayout = false) {
|
|
1476
1505
|
const disposable = pane.onDidChangeExpansionState(() => {
|
|
1477
1506
|
this.setupAnimation();
|
|
@@ -1725,7 +1754,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1725
1754
|
}
|
|
1726
1755
|
return exports.LayoutPriority.Normal;
|
|
1727
1756
|
}
|
|
1728
|
-
|
|
1757
|
+
get disabled() {
|
|
1758
|
+
return this.splitview.disabled;
|
|
1759
|
+
}
|
|
1760
|
+
set disabled(value) {
|
|
1761
|
+
this.splitview.disabled = value;
|
|
1762
|
+
}
|
|
1763
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, childDescriptors) {
|
|
1729
1764
|
super();
|
|
1730
1765
|
this.orientation = orientation;
|
|
1731
1766
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1770,6 +1805,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1770
1805
|
styles,
|
|
1771
1806
|
});
|
|
1772
1807
|
}
|
|
1808
|
+
this.disabled = disabled;
|
|
1773
1809
|
this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
|
|
1774
1810
|
this._onDidChange.fire({});
|
|
1775
1811
|
}));
|
|
@@ -1903,7 +1939,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1903
1939
|
}
|
|
1904
1940
|
function flipNode(node, size, orthogonalSize) {
|
|
1905
1941
|
if (node instanceof BranchNode) {
|
|
1906
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
1942
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1907
1943
|
let totalSize = 0;
|
|
1908
1944
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1909
1945
|
const child = node.children[i];
|
|
@@ -2039,31 +2075,57 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2039
2075
|
get maximumHeight() {
|
|
2040
2076
|
return this.root.maximumHeight;
|
|
2041
2077
|
}
|
|
2078
|
+
get locked() {
|
|
2079
|
+
return this._locked;
|
|
2080
|
+
}
|
|
2081
|
+
set locked(value) {
|
|
2082
|
+
this._locked = value;
|
|
2083
|
+
const branch = [this.root];
|
|
2084
|
+
/**
|
|
2085
|
+
* simple depth-first-search to cover all nodes
|
|
2086
|
+
*
|
|
2087
|
+
* @see https://en.wikipedia.org/wiki/Depth-first_search
|
|
2088
|
+
*/
|
|
2089
|
+
while (branch.length > 0) {
|
|
2090
|
+
const node = branch.pop();
|
|
2091
|
+
if (node instanceof BranchNode) {
|
|
2092
|
+
node.disabled = value;
|
|
2093
|
+
branch.push(...node.children);
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2042
2097
|
maximizedView() {
|
|
2043
2098
|
var _a;
|
|
2044
|
-
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.view;
|
|
2099
|
+
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
2045
2100
|
}
|
|
2046
2101
|
hasMaximizedView() {
|
|
2047
2102
|
return this._maximizedNode !== undefined;
|
|
2048
2103
|
}
|
|
2049
2104
|
maximizeView(view) {
|
|
2105
|
+
var _a;
|
|
2050
2106
|
const location = getGridLocation(view.element);
|
|
2051
2107
|
const [_, node] = this.getNode(location);
|
|
2052
2108
|
if (!(node instanceof LeafNode)) {
|
|
2053
2109
|
return;
|
|
2054
2110
|
}
|
|
2055
|
-
if (this._maximizedNode === node) {
|
|
2111
|
+
if (((_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf) === node) {
|
|
2056
2112
|
return;
|
|
2057
2113
|
}
|
|
2058
2114
|
if (this.hasMaximizedView()) {
|
|
2059
2115
|
this.exitMaximizedView();
|
|
2060
2116
|
}
|
|
2117
|
+
const hiddenOnMaximize = [];
|
|
2061
2118
|
function hideAllViewsBut(parent, exclude) {
|
|
2062
2119
|
for (let i = 0; i < parent.children.length; i++) {
|
|
2063
2120
|
const child = parent.children[i];
|
|
2064
2121
|
if (child instanceof LeafNode) {
|
|
2065
2122
|
if (child !== exclude) {
|
|
2066
|
-
parent.
|
|
2123
|
+
if (parent.isChildVisible(i)) {
|
|
2124
|
+
parent.setChildVisible(i, false);
|
|
2125
|
+
}
|
|
2126
|
+
else {
|
|
2127
|
+
hiddenOnMaximize.push(child);
|
|
2128
|
+
}
|
|
2067
2129
|
}
|
|
2068
2130
|
}
|
|
2069
2131
|
else {
|
|
@@ -2072,18 +2134,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2072
2134
|
}
|
|
2073
2135
|
}
|
|
2074
2136
|
hideAllViewsBut(this.root, node);
|
|
2075
|
-
this._maximizedNode = node;
|
|
2076
|
-
this.
|
|
2137
|
+
this._maximizedNode = { leaf: node, hiddenOnMaximize };
|
|
2138
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2077
2139
|
}
|
|
2078
2140
|
exitMaximizedView() {
|
|
2079
2141
|
if (!this._maximizedNode) {
|
|
2080
2142
|
return;
|
|
2081
2143
|
}
|
|
2144
|
+
const hiddenOnMaximize = this._maximizedNode.hiddenOnMaximize;
|
|
2082
2145
|
function showViewsInReverseOrder(parent) {
|
|
2083
2146
|
for (let index = parent.children.length - 1; index >= 0; index--) {
|
|
2084
2147
|
const child = parent.children[index];
|
|
2085
2148
|
if (child instanceof LeafNode) {
|
|
2086
|
-
|
|
2149
|
+
if (!hiddenOnMaximize.includes(child)) {
|
|
2150
|
+
parent.setChildVisible(index, true);
|
|
2151
|
+
}
|
|
2087
2152
|
}
|
|
2088
2153
|
else {
|
|
2089
2154
|
showViewsInReverseOrder(child);
|
|
@@ -2092,13 +2157,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2092
2157
|
}
|
|
2093
2158
|
showViewsInReverseOrder(this.root);
|
|
2094
2159
|
this._maximizedNode = undefined;
|
|
2095
|
-
this.
|
|
2160
|
+
this._onDidMaximizedNodeChange.fire();
|
|
2096
2161
|
}
|
|
2097
2162
|
serialize() {
|
|
2098
2163
|
if (this.hasMaximizedView()) {
|
|
2099
2164
|
/**
|
|
2100
|
-
* do not persist maximized view state
|
|
2101
|
-
*
|
|
2165
|
+
* do not persist maximized view state
|
|
2166
|
+
* firstly exit any maximized views to ensure the correct dimensions are persisted
|
|
2102
2167
|
*/
|
|
2103
2168
|
this.exitMaximizedView();
|
|
2104
2169
|
}
|
|
@@ -2113,14 +2178,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2113
2178
|
dispose() {
|
|
2114
2179
|
this.disposable.dispose();
|
|
2115
2180
|
this._onDidChange.dispose();
|
|
2116
|
-
this.
|
|
2181
|
+
this._onDidMaximizedNodeChange.dispose();
|
|
2117
2182
|
this.root.dispose();
|
|
2118
2183
|
this._maximizedNode = undefined;
|
|
2119
2184
|
this.element.remove();
|
|
2120
2185
|
}
|
|
2121
2186
|
clear() {
|
|
2122
2187
|
const orientation = this.root.orientation;
|
|
2123
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize);
|
|
2188
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this._locked);
|
|
2124
2189
|
}
|
|
2125
2190
|
deserialize(json, deserializer) {
|
|
2126
2191
|
const orientation = json.orientation;
|
|
@@ -2141,8 +2206,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2141
2206
|
};
|
|
2142
2207
|
});
|
|
2143
2208
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2144
|
-
orthogonalSize, // <- size - flips at each depth
|
|
2145
|
-
children);
|
|
2209
|
+
orthogonalSize, // <- size - flips at each depth,
|
|
2210
|
+
this._locked, children);
|
|
2146
2211
|
}
|
|
2147
2212
|
else {
|
|
2148
2213
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2175,7 +2240,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2175
2240
|
}
|
|
2176
2241
|
const oldRoot = this.root;
|
|
2177
2242
|
oldRoot.element.remove();
|
|
2178
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
|
|
2243
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this._locked);
|
|
2179
2244
|
if (oldRoot.children.length === 0) ;
|
|
2180
2245
|
else if (oldRoot.children.length === 1) {
|
|
2181
2246
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2243,15 +2308,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2243
2308
|
constructor(proportionalLayout, styles, orientation) {
|
|
2244
2309
|
this.proportionalLayout = proportionalLayout;
|
|
2245
2310
|
this.styles = styles;
|
|
2311
|
+
this._locked = false;
|
|
2246
2312
|
this._maximizedNode = undefined;
|
|
2247
2313
|
this.disposable = new MutableDisposable();
|
|
2248
2314
|
this._onDidChange = new Emitter();
|
|
2249
2315
|
this.onDidChange = this._onDidChange.event;
|
|
2250
|
-
this.
|
|
2251
|
-
this.
|
|
2316
|
+
this._onDidMaximizedNodeChange = new Emitter();
|
|
2317
|
+
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2252
2318
|
this.element = document.createElement('div');
|
|
2253
2319
|
this.element.className = 'grid-view';
|
|
2254
|
-
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
2320
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this._locked);
|
|
2255
2321
|
}
|
|
2256
2322
|
isViewVisible(location) {
|
|
2257
2323
|
const [rest, index] = tail(location);
|
|
@@ -2302,7 +2368,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2302
2368
|
}
|
|
2303
2369
|
const child = grandParent.removeChild(parentIndex);
|
|
2304
2370
|
child.dispose();
|
|
2305
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2371
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this._locked);
|
|
2306
2372
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2307
2373
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2308
2374
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2930,13 +2996,36 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2930
2996
|
return this.component.onDidDrop;
|
|
2931
2997
|
}
|
|
2932
2998
|
/**
|
|
2933
|
-
* Invoked
|
|
2999
|
+
* Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and
|
|
3000
|
+
* prevent the event from occuring using the standard `preventDefault()` syntax.
|
|
3001
|
+
*
|
|
3002
|
+
* Preventing certain events may causes unexpected behaviours, use carefully.
|
|
3003
|
+
*/
|
|
3004
|
+
get onWillDrop() {
|
|
3005
|
+
return this.component.onWillDrop;
|
|
3006
|
+
}
|
|
3007
|
+
/**
|
|
3008
|
+
* Invoked before an overlay is shown indicating a drop target.
|
|
3009
|
+
*
|
|
3010
|
+
* Calling `event.preventDefault()` will prevent the overlay being shown and prevent
|
|
3011
|
+
* the any subsequent drop event.
|
|
3012
|
+
*/
|
|
3013
|
+
get onWillShowOverlay() {
|
|
3014
|
+
return this.component.onWillShowOverlay;
|
|
3015
|
+
}
|
|
3016
|
+
/**
|
|
3017
|
+
* Invoked before a group is dragged.
|
|
3018
|
+
*
|
|
3019
|
+
* Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting.
|
|
3020
|
+
*
|
|
2934
3021
|
*/
|
|
2935
3022
|
get onWillDragGroup() {
|
|
2936
3023
|
return this.component.onWillDragGroup;
|
|
2937
3024
|
}
|
|
2938
3025
|
/**
|
|
2939
|
-
* Invoked before a panel is dragged.
|
|
3026
|
+
* Invoked before a panel is dragged.
|
|
3027
|
+
*
|
|
3028
|
+
* Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
|
|
2940
3029
|
*/
|
|
2941
3030
|
get onWillDragPanel() {
|
|
2942
3031
|
return this.component.onWillDragPanel;
|
|
@@ -3064,17 +3153,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3064
3153
|
hasMaximizedGroup() {
|
|
3065
3154
|
return this.component.hasMaximizedGroup();
|
|
3066
3155
|
}
|
|
3067
|
-
|
|
3156
|
+
exitMaximizedGroup() {
|
|
3068
3157
|
this.component.exitMaximizedGroup();
|
|
3069
3158
|
}
|
|
3070
|
-
get
|
|
3071
|
-
return this.component.
|
|
3159
|
+
get onDidMaximizedGroupChange() {
|
|
3160
|
+
return this.component.onDidMaximizedGroupChange;
|
|
3072
3161
|
}
|
|
3073
3162
|
/**
|
|
3074
3163
|
* Add a popout group in a new Window
|
|
3075
3164
|
*/
|
|
3076
3165
|
addPopoutGroup(item, options) {
|
|
3077
|
-
this.component.addPopoutGroup(item, options);
|
|
3166
|
+
return this.component.addPopoutGroup(item, options);
|
|
3078
3167
|
}
|
|
3079
3168
|
}
|
|
3080
3169
|
|
|
@@ -3128,6 +3217,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3128
3217
|
}
|
|
3129
3218
|
}
|
|
3130
3219
|
|
|
3220
|
+
class WillShowOverlayEvent extends DockviewEvent {
|
|
3221
|
+
get nativeEvent() {
|
|
3222
|
+
return this.options.nativeEvent;
|
|
3223
|
+
}
|
|
3224
|
+
get position() {
|
|
3225
|
+
return this.options.position;
|
|
3226
|
+
}
|
|
3227
|
+
constructor(options) {
|
|
3228
|
+
super();
|
|
3229
|
+
this.options = options;
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3131
3232
|
function directionToPosition(direction) {
|
|
3132
3233
|
switch (direction) {
|
|
3133
3234
|
case 'above':
|
|
@@ -3180,6 +3281,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3180
3281
|
this.options = options;
|
|
3181
3282
|
this._onDrop = new Emitter();
|
|
3182
3283
|
this.onDrop = this._onDrop.event;
|
|
3284
|
+
this._onWillShowOverlay = new Emitter();
|
|
3285
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3183
3286
|
// use a set to take advantage of #<set>.has
|
|
3184
3287
|
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
3185
3288
|
this.dnd = new DragAndDropObserver(this.element, {
|
|
@@ -3208,6 +3311,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3208
3311
|
this.removeDropTarget();
|
|
3209
3312
|
return;
|
|
3210
3313
|
}
|
|
3314
|
+
const willShowOverlayEvent = new WillShowOverlayEvent({
|
|
3315
|
+
nativeEvent: e,
|
|
3316
|
+
position: quadrant,
|
|
3317
|
+
});
|
|
3318
|
+
/**
|
|
3319
|
+
* Provide an opportunity to prevent the overlay appearing and in turn
|
|
3320
|
+
* any dnd behaviours
|
|
3321
|
+
*/
|
|
3322
|
+
this._onWillShowOverlay.fire(willShowOverlayEvent);
|
|
3323
|
+
if (willShowOverlayEvent.defaultPrevented) {
|
|
3324
|
+
this.removeDropTarget();
|
|
3325
|
+
return;
|
|
3326
|
+
}
|
|
3211
3327
|
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
3212
3328
|
if (!this.options.canDisplayOverlay) {
|
|
3213
3329
|
this.removeDropTarget();
|
|
@@ -3250,7 +3366,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3250
3366
|
}
|
|
3251
3367
|
},
|
|
3252
3368
|
});
|
|
3253
|
-
this.addDisposables(this._onDrop, this.dnd);
|
|
3369
|
+
this.addDisposables(this._onDrop, this._onWillShowOverlay, this.dnd);
|
|
3254
3370
|
}
|
|
3255
3371
|
setTargetZones(acceptedTargetZones) {
|
|
3256
3372
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
@@ -3303,25 +3419,44 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3303
3419
|
size = clamp(0, sizeOptions.value, height) / height;
|
|
3304
3420
|
}
|
|
3305
3421
|
}
|
|
3306
|
-
const
|
|
3307
|
-
|
|
3308
|
-
|
|
3422
|
+
const box = { top: '0px', left: '0px', width: '100%', height: '100%' };
|
|
3423
|
+
/**
|
|
3424
|
+
* You can also achieve the overlay placement using the transform CSS property
|
|
3425
|
+
* to translate and scale the element however this has the undesired effect of
|
|
3426
|
+
* 'skewing' the element. Comment left here for anybody that ever revisits this.
|
|
3427
|
+
*
|
|
3428
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
|
3429
|
+
*
|
|
3430
|
+
* right
|
|
3431
|
+
* translateX(${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3432
|
+
*
|
|
3433
|
+
* left
|
|
3434
|
+
* translateX(-${100 * (1 - size) / 2}%) scaleX(${scale})
|
|
3435
|
+
*
|
|
3436
|
+
* top
|
|
3437
|
+
* translateY(-${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3438
|
+
*
|
|
3439
|
+
* bottom
|
|
3440
|
+
* translateY(${100 * (1 - size) / 2}%) scaleY(${scale})
|
|
3441
|
+
*/
|
|
3309
3442
|
if (rightClass) {
|
|
3310
|
-
|
|
3443
|
+
box.left = `${100 * (1 - size)}%`;
|
|
3444
|
+
box.width = `${100 * size}%`;
|
|
3311
3445
|
}
|
|
3312
3446
|
else if (leftClass) {
|
|
3313
|
-
|
|
3447
|
+
box.width = `${100 * size}%`;
|
|
3314
3448
|
}
|
|
3315
3449
|
else if (topClass) {
|
|
3316
|
-
|
|
3450
|
+
box.height = `${100 * size}%`;
|
|
3317
3451
|
}
|
|
3318
3452
|
else if (bottomClass) {
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
else {
|
|
3322
|
-
transform = '';
|
|
3453
|
+
box.top = `${100 * (1 - size)}%`;
|
|
3454
|
+
box.height = `${100 * size}%`;
|
|
3323
3455
|
}
|
|
3324
|
-
this.overlayElement.style.
|
|
3456
|
+
this.overlayElement.style.top = box.top;
|
|
3457
|
+
this.overlayElement.style.left = box.left;
|
|
3458
|
+
this.overlayElement.style.width = box.width;
|
|
3459
|
+
this.overlayElement.style.height = box.height;
|
|
3325
3460
|
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3326
3461
|
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3327
3462
|
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
@@ -3389,14 +3524,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3389
3524
|
return 'center';
|
|
3390
3525
|
}
|
|
3391
3526
|
|
|
3392
|
-
exports.DockviewDropTargets = void 0;
|
|
3393
|
-
(function (DockviewDropTargets) {
|
|
3394
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3395
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3396
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3397
|
-
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3398
|
-
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3399
|
-
|
|
3400
3527
|
class ContentContainer extends CompositeDisposable {
|
|
3401
3528
|
get element() {
|
|
3402
3529
|
return this._element;
|
|
@@ -3424,7 +3551,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3424
3551
|
const data = getPanelData();
|
|
3425
3552
|
if (!data &&
|
|
3426
3553
|
event.shiftKey &&
|
|
3427
|
-
this.group.location !== 'floating') {
|
|
3554
|
+
this.group.location.type !== 'floating') {
|
|
3428
3555
|
return false;
|
|
3429
3556
|
}
|
|
3430
3557
|
if (data && data.viewId === this.accessor.id) {
|
|
@@ -3442,7 +3569,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3442
3569
|
data.groupId === this.group.id;
|
|
3443
3570
|
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3444
3571
|
}
|
|
3445
|
-
return this.group.canDisplayOverlay(event, position,
|
|
3572
|
+
return this.group.canDisplayOverlay(event, position, 'content');
|
|
3446
3573
|
},
|
|
3447
3574
|
});
|
|
3448
3575
|
this.addDisposables(this.dropTarget);
|
|
@@ -3467,7 +3594,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3467
3594
|
let container;
|
|
3468
3595
|
switch (panel.api.renderer) {
|
|
3469
3596
|
case 'onlyWhenVisibile':
|
|
3470
|
-
this.
|
|
3597
|
+
this.group.renderContainer.detatch(panel);
|
|
3471
3598
|
if (this.panel) {
|
|
3472
3599
|
if (doRender) {
|
|
3473
3600
|
this._element.appendChild(this.panel.view.content.element);
|
|
@@ -3479,7 +3606,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3479
3606
|
if (panel.view.content.element.parentElement === this._element) {
|
|
3480
3607
|
this._element.removeChild(panel.view.content.element);
|
|
3481
3608
|
}
|
|
3482
|
-
container = this.
|
|
3609
|
+
container = this.group.renderContainer.attach({
|
|
3483
3610
|
panel,
|
|
3484
3611
|
referenceContainer: this,
|
|
3485
3612
|
});
|
|
@@ -3510,9 +3637,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3510
3637
|
// noop
|
|
3511
3638
|
}
|
|
3512
3639
|
closePanel() {
|
|
3640
|
+
var _a;
|
|
3513
3641
|
if (this.panel) {
|
|
3514
3642
|
if (this.panel.api.renderer === 'onlyWhenVisibile') {
|
|
3515
|
-
this.
|
|
3643
|
+
(_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
|
|
3516
3644
|
}
|
|
3517
3645
|
}
|
|
3518
3646
|
this.panel = undefined;
|
|
@@ -3623,7 +3751,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3623
3751
|
this._element.draggable = true;
|
|
3624
3752
|
toggleClass(this.element, 'inactive-tab', true);
|
|
3625
3753
|
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
3626
|
-
this.
|
|
3754
|
+
this.dropTarget = new Droptarget(this._element, {
|
|
3627
3755
|
acceptedTargetZones: ['center'],
|
|
3628
3756
|
canDisplayOverlay: (event, position) => {
|
|
3629
3757
|
if (this.group.locked) {
|
|
@@ -3638,9 +3766,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3638
3766
|
}
|
|
3639
3767
|
return this.panel.id !== data.panelId;
|
|
3640
3768
|
}
|
|
3641
|
-
return this.group.model.canDisplayOverlay(event, position,
|
|
3769
|
+
return this.group.model.canDisplayOverlay(event, position, 'tab');
|
|
3642
3770
|
},
|
|
3643
3771
|
});
|
|
3772
|
+
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
3644
3773
|
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
3645
3774
|
this._onDragStart.fire(event);
|
|
3646
3775
|
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
@@ -3648,9 +3777,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3648
3777
|
return;
|
|
3649
3778
|
}
|
|
3650
3779
|
this._onChanged.fire(event);
|
|
3651
|
-
}), this.
|
|
3780
|
+
}), this.dropTarget.onDrop((event) => {
|
|
3652
3781
|
this._onDropped.fire(event);
|
|
3653
|
-
}), this.
|
|
3782
|
+
}), this.dropTarget);
|
|
3654
3783
|
}
|
|
3655
3784
|
setActive(isActive) {
|
|
3656
3785
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -3697,7 +3826,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3697
3826
|
}, true));
|
|
3698
3827
|
}
|
|
3699
3828
|
isCancelled(_event) {
|
|
3700
|
-
if (this.group.api.location === 'floating' && !_event.shiftKey) {
|
|
3829
|
+
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
3701
3830
|
return true;
|
|
3702
3831
|
}
|
|
3703
3832
|
return false;
|
|
@@ -3749,7 +3878,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3749
3878
|
this.accessor.doSetGroupActive(this.group);
|
|
3750
3879
|
}));
|
|
3751
3880
|
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3752
|
-
this.
|
|
3881
|
+
this.dropTraget = new Droptarget(this._element, {
|
|
3753
3882
|
acceptedTargetZones: ['center'],
|
|
3754
3883
|
canDisplayOverlay: (event, position) => {
|
|
3755
3884
|
var _a;
|
|
@@ -3763,14 +3892,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3763
3892
|
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
3764
3893
|
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
3765
3894
|
}
|
|
3766
|
-
return group.model.canDisplayOverlay(event, position,
|
|
3895
|
+
return group.model.canDisplayOverlay(event, position, 'header_space');
|
|
3767
3896
|
},
|
|
3768
3897
|
});
|
|
3898
|
+
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
3769
3899
|
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3770
3900
|
this._onDragStart.fire(event);
|
|
3771
|
-
}), this.
|
|
3901
|
+
}), this.dropTraget.onDrop((event) => {
|
|
3772
3902
|
this._onDrop.fire(event);
|
|
3773
|
-
}), this.
|
|
3903
|
+
}), this.dropTraget);
|
|
3774
3904
|
}
|
|
3775
3905
|
}
|
|
3776
3906
|
|
|
@@ -3858,19 +3988,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3858
3988
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
3859
3989
|
this._onGroupDragStart = new Emitter();
|
|
3860
3990
|
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3861
|
-
this.
|
|
3991
|
+
this._onWillShowOverlay = new Emitter();
|
|
3992
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3862
3993
|
this._element = document.createElement('div');
|
|
3863
3994
|
this._element.className = 'tabs-and-actions-container';
|
|
3864
3995
|
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
3865
|
-
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3866
|
-
if (e.api.group === this.group) {
|
|
3867
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3868
|
-
}
|
|
3869
|
-
}), this.accessor.onDidRemovePanel((e) => {
|
|
3870
|
-
if (e.api.group === this.group) {
|
|
3871
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3872
|
-
}
|
|
3873
|
-
}));
|
|
3874
3996
|
this.rightActionsContainer = document.createElement('div');
|
|
3875
3997
|
this.rightActionsContainer.className = 'right-actions-container';
|
|
3876
3998
|
this.leftActionsContainer = document.createElement('div');
|
|
@@ -3885,7 +4007,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3885
4007
|
this._element.appendChild(this.leftActionsContainer);
|
|
3886
4008
|
this._element.appendChild(this.voidContainer.element);
|
|
3887
4009
|
this._element.appendChild(this.rightActionsContainer);
|
|
3888
|
-
this.addDisposables(this.
|
|
4010
|
+
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
4011
|
+
if (e.api.group === this.group) {
|
|
4012
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4013
|
+
}
|
|
4014
|
+
}), this.accessor.onDidRemovePanel((e) => {
|
|
4015
|
+
if (e.api.group === this.group) {
|
|
4016
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4017
|
+
}
|
|
4018
|
+
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3889
4019
|
this._onGroupDragStart.fire({
|
|
3890
4020
|
nativeEvent: event,
|
|
3891
4021
|
group: this.group,
|
|
@@ -3895,11 +4025,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3895
4025
|
event: event.nativeEvent,
|
|
3896
4026
|
index: this.tabs.length,
|
|
3897
4027
|
});
|
|
4028
|
+
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
4029
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4030
|
+
kind: 'header_space',
|
|
4031
|
+
}));
|
|
3898
4032
|
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
3899
4033
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3900
4034
|
if (isFloatingGroupsEnabled &&
|
|
3901
4035
|
event.shiftKey &&
|
|
3902
|
-
this.group.api.location !== 'floating') {
|
|
4036
|
+
this.group.api.location.type !== 'floating') {
|
|
3903
4037
|
event.preventDefault();
|
|
3904
4038
|
const { top, left } = this.element.getBoundingClientRect();
|
|
3905
4039
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
@@ -3962,9 +4096,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3962
4096
|
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
3963
4097
|
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
3964
4098
|
}), tab.onChanged((event) => {
|
|
3965
|
-
var _a;
|
|
3966
4099
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3967
|
-
const isFloatingWithOnePanel = this.group.api.location === 'floating' &&
|
|
4100
|
+
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
4101
|
+
this.size === 1;
|
|
3968
4102
|
if (isFloatingGroupsEnabled &&
|
|
3969
4103
|
!isFloatingWithOnePanel &&
|
|
3970
4104
|
event.shiftKey) {
|
|
@@ -3978,20 +4112,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3978
4112
|
}, { inDragMode: true });
|
|
3979
4113
|
return;
|
|
3980
4114
|
}
|
|
3981
|
-
const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
3982
|
-
this.group.model.isContentFocused;
|
|
3983
4115
|
const isLeftClick = event.button === 0;
|
|
3984
4116
|
if (!isLeftClick || event.defaultPrevented) {
|
|
3985
4117
|
return;
|
|
3986
4118
|
}
|
|
3987
|
-
this.group.
|
|
3988
|
-
|
|
3989
|
-
}
|
|
4119
|
+
if (this.group.activePanel !== panel) {
|
|
4120
|
+
this.group.model.openPanel(panel);
|
|
4121
|
+
}
|
|
3990
4122
|
}), tab.onDrop((event) => {
|
|
3991
4123
|
this._onDrop.fire({
|
|
3992
4124
|
event: event.nativeEvent,
|
|
3993
4125
|
index: this.tabs.findIndex((x) => x.value === tab),
|
|
3994
4126
|
});
|
|
4127
|
+
}), tab.onWillShowOverlay((event) => {
|
|
4128
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, { kind: 'tab' }));
|
|
3995
4129
|
}));
|
|
3996
4130
|
const value = { value: tab, disposable };
|
|
3997
4131
|
this.addTab(value, index);
|
|
@@ -4009,6 +4143,60 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4009
4143
|
}
|
|
4010
4144
|
}
|
|
4011
4145
|
|
|
4146
|
+
class DockviewDidDropEvent extends DockviewEvent {
|
|
4147
|
+
get nativeEvent() {
|
|
4148
|
+
return this.options.nativeEvent;
|
|
4149
|
+
}
|
|
4150
|
+
get position() {
|
|
4151
|
+
return this.options.position;
|
|
4152
|
+
}
|
|
4153
|
+
get panel() {
|
|
4154
|
+
return this.options.panel;
|
|
4155
|
+
}
|
|
4156
|
+
get group() {
|
|
4157
|
+
return this.options.group;
|
|
4158
|
+
}
|
|
4159
|
+
get api() {
|
|
4160
|
+
return this.options.api;
|
|
4161
|
+
}
|
|
4162
|
+
constructor(options) {
|
|
4163
|
+
super();
|
|
4164
|
+
this.options = options;
|
|
4165
|
+
}
|
|
4166
|
+
getData() {
|
|
4167
|
+
return this.options.getData();
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
4170
|
+
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4171
|
+
get kind() {
|
|
4172
|
+
return this._kind;
|
|
4173
|
+
}
|
|
4174
|
+
constructor(options) {
|
|
4175
|
+
super(options);
|
|
4176
|
+
this._kind = options.kind;
|
|
4177
|
+
}
|
|
4178
|
+
}
|
|
4179
|
+
class WillShowOverlayLocationEvent {
|
|
4180
|
+
get kind() {
|
|
4181
|
+
return this._kind;
|
|
4182
|
+
}
|
|
4183
|
+
get nativeEvent() {
|
|
4184
|
+
return this.event.nativeEvent;
|
|
4185
|
+
}
|
|
4186
|
+
get position() {
|
|
4187
|
+
return this.event.position;
|
|
4188
|
+
}
|
|
4189
|
+
get defaultPrevented() {
|
|
4190
|
+
return this.event.defaultPrevented;
|
|
4191
|
+
}
|
|
4192
|
+
preventDefault() {
|
|
4193
|
+
this.event.preventDefault();
|
|
4194
|
+
}
|
|
4195
|
+
constructor(event, options) {
|
|
4196
|
+
this.event = event;
|
|
4197
|
+
this._kind = options.kind;
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4012
4200
|
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
4013
4201
|
get element() {
|
|
4014
4202
|
throw new Error('not supported');
|
|
@@ -4054,7 +4242,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4054
4242
|
this._location = value;
|
|
4055
4243
|
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4056
4244
|
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4057
|
-
switch (value) {
|
|
4245
|
+
switch (value.type) {
|
|
4058
4246
|
case 'grid':
|
|
4059
4247
|
this.contentContainer.dropTarget.setTargetZones([
|
|
4060
4248
|
'top',
|
|
@@ -4090,7 +4278,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4090
4278
|
this.groupPanel = groupPanel;
|
|
4091
4279
|
this._isGroupActive = false;
|
|
4092
4280
|
this._locked = false;
|
|
4093
|
-
this._location = 'grid';
|
|
4281
|
+
this._location = { type: 'grid' };
|
|
4094
4282
|
this.mostRecentlyUsed = [];
|
|
4095
4283
|
this._onDidChange = new Emitter();
|
|
4096
4284
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -4101,6 +4289,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4101
4289
|
this.onMove = this._onMove.event;
|
|
4102
4290
|
this._onDidDrop = new Emitter();
|
|
4103
4291
|
this.onDidDrop = this._onDidDrop.event;
|
|
4292
|
+
this._onWillDrop = new Emitter();
|
|
4293
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
4294
|
+
this._onWillShowOverlay = new Emitter();
|
|
4295
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4104
4296
|
this._onTabDragStart = new Emitter();
|
|
4105
4297
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
4106
4298
|
this._onGroupDragStart = new Emitter();
|
|
@@ -4111,46 +4303,69 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4111
4303
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4112
4304
|
this._onDidActivePanelChange = new Emitter();
|
|
4113
4305
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4306
|
+
this._overwriteRenderContainer = null;
|
|
4114
4307
|
toggleClass(this.container, 'groupview', true);
|
|
4308
|
+
this._api = new DockviewApi(this.accessor);
|
|
4115
4309
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
4116
4310
|
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
4117
4311
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
4118
4312
|
this.header.hidden = !!options.hideHeader;
|
|
4119
4313
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
4120
|
-
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this.tabsContainer.onTabDragStart((event) => {
|
|
4314
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
4121
4315
|
this._onTabDragStart.fire(event);
|
|
4122
4316
|
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
4123
4317
|
this._onGroupDragStart.fire(event);
|
|
4124
4318
|
}), this.tabsContainer.onDrop((event) => {
|
|
4125
|
-
this.handleDropEvent(event.event, 'center', event.index);
|
|
4319
|
+
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
4126
4320
|
}), this.contentContainer.onDidFocus(() => {
|
|
4127
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4321
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4128
4322
|
}), this.contentContainer.onDidBlur(() => {
|
|
4129
4323
|
// noop
|
|
4130
4324
|
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
4131
|
-
this.handleDropEvent(event.nativeEvent, event.position);
|
|
4132
|
-
}), this.
|
|
4325
|
+
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
4326
|
+
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
4327
|
+
this._onWillShowOverlay.fire(event);
|
|
4328
|
+
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
4329
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4330
|
+
kind: 'content',
|
|
4331
|
+
}));
|
|
4332
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
4333
|
+
}
|
|
4334
|
+
focusContent() {
|
|
4335
|
+
this.contentContainer.element.focus();
|
|
4336
|
+
}
|
|
4337
|
+
set renderContainer(value) {
|
|
4338
|
+
this.panels.forEach((panel) => {
|
|
4339
|
+
this.renderContainer.detatch(panel);
|
|
4340
|
+
});
|
|
4341
|
+
this._overwriteRenderContainer = value;
|
|
4342
|
+
this.panels.forEach((panel) => {
|
|
4343
|
+
this.rerender(panel);
|
|
4344
|
+
});
|
|
4345
|
+
}
|
|
4346
|
+
get renderContainer() {
|
|
4347
|
+
var _a;
|
|
4348
|
+
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
4133
4349
|
}
|
|
4134
4350
|
initialize() {
|
|
4135
|
-
|
|
4136
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
|
|
4351
|
+
if (this.options.panels) {
|
|
4137
4352
|
this.options.panels.forEach((panel) => {
|
|
4138
4353
|
this.doAddPanel(panel);
|
|
4139
4354
|
});
|
|
4140
4355
|
}
|
|
4141
|
-
if (
|
|
4356
|
+
if (this.options.activePanel) {
|
|
4142
4357
|
this.openPanel(this.options.activePanel);
|
|
4143
4358
|
}
|
|
4144
4359
|
// must be run after the constructor otherwise this.parent may not be
|
|
4145
4360
|
// correctly initialized
|
|
4146
|
-
this.setActive(this.isActive, true
|
|
4361
|
+
this.setActive(this.isActive, true);
|
|
4147
4362
|
this.updateContainer();
|
|
4148
4363
|
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
4149
4364
|
this._rightHeaderActions =
|
|
4150
4365
|
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
4151
4366
|
this.addDisposables(this._rightHeaderActions);
|
|
4152
4367
|
this._rightHeaderActions.init({
|
|
4153
|
-
containerApi:
|
|
4368
|
+
containerApi: this._api,
|
|
4154
4369
|
api: this.groupPanel.api,
|
|
4155
4370
|
});
|
|
4156
4371
|
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
@@ -4160,7 +4375,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4160
4375
|
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
4161
4376
|
this.addDisposables(this._leftHeaderActions);
|
|
4162
4377
|
this._leftHeaderActions.init({
|
|
4163
|
-
containerApi:
|
|
4378
|
+
containerApi: this._api,
|
|
4164
4379
|
api: this.groupPanel.api,
|
|
4165
4380
|
});
|
|
4166
4381
|
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
@@ -4170,7 +4385,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4170
4385
|
this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
|
|
4171
4386
|
this.addDisposables(this._prefixHeaderActions);
|
|
4172
4387
|
this._prefixHeaderActions.init({
|
|
4173
|
-
containerApi:
|
|
4388
|
+
containerApi: this._api,
|
|
4174
4389
|
api: this.groupPanel.api,
|
|
4175
4390
|
});
|
|
4176
4391
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
@@ -4250,35 +4465,45 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4250
4465
|
//noop
|
|
4251
4466
|
}
|
|
4252
4467
|
focus() {
|
|
4253
|
-
var _a
|
|
4254
|
-
(
|
|
4468
|
+
var _a;
|
|
4469
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4255
4470
|
}
|
|
4256
4471
|
openPanel(panel, options = {}) {
|
|
4472
|
+
/**
|
|
4473
|
+
* set the panel group
|
|
4474
|
+
* add the panel
|
|
4475
|
+
* check if group active
|
|
4476
|
+
* check if panel active
|
|
4477
|
+
*/
|
|
4257
4478
|
if (typeof options.index !== 'number' ||
|
|
4258
4479
|
options.index > this.panels.length) {
|
|
4259
4480
|
options.index = this.panels.length;
|
|
4260
4481
|
}
|
|
4261
|
-
const
|
|
4262
|
-
const skipSetGroupActive = !!options.skipSetGroupActive;
|
|
4482
|
+
const skipSetActive = !!options.skipSetActive;
|
|
4263
4483
|
// ensure the group is updated before we fire any events
|
|
4264
|
-
panel.updateParentGroup(this.groupPanel,
|
|
4484
|
+
panel.updateParentGroup(this.groupPanel, {
|
|
4485
|
+
skipSetActive: options.skipSetActive,
|
|
4486
|
+
});
|
|
4487
|
+
this.doAddPanel(panel, options.index, {
|
|
4488
|
+
skipSetActive: skipSetActive,
|
|
4489
|
+
});
|
|
4265
4490
|
if (this._activePanel === panel) {
|
|
4266
|
-
if (!skipSetGroupActive) {
|
|
4267
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4268
|
-
}
|
|
4269
4491
|
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
4270
4492
|
return;
|
|
4271
4493
|
}
|
|
4272
|
-
|
|
4273
|
-
if (!skipSetPanelActive) {
|
|
4494
|
+
if (!skipSetActive) {
|
|
4274
4495
|
this.doSetActivePanel(panel);
|
|
4275
4496
|
}
|
|
4276
|
-
if (!skipSetGroupActive) {
|
|
4277
|
-
this.accessor.doSetGroupActive(this.groupPanel
|
|
4497
|
+
if (!options.skipSetGroupActive) {
|
|
4498
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4499
|
+
}
|
|
4500
|
+
if (!options.skipSetActive) {
|
|
4501
|
+
this.updateContainer();
|
|
4278
4502
|
}
|
|
4279
|
-
this.updateContainer();
|
|
4280
4503
|
}
|
|
4281
|
-
removePanel(groupItemOrId
|
|
4504
|
+
removePanel(groupItemOrId, options = {
|
|
4505
|
+
skipSetActive: false,
|
|
4506
|
+
}) {
|
|
4282
4507
|
const id = typeof groupItemOrId === 'string'
|
|
4283
4508
|
? groupItemOrId
|
|
4284
4509
|
: groupItemOrId.id;
|
|
@@ -4286,7 +4511,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4286
4511
|
if (!panelToRemove) {
|
|
4287
4512
|
throw new Error('invalid operation');
|
|
4288
4513
|
}
|
|
4289
|
-
return this._removePanel(panelToRemove);
|
|
4514
|
+
return this._removePanel(panelToRemove, options);
|
|
4290
4515
|
}
|
|
4291
4516
|
closeAllPanels() {
|
|
4292
4517
|
if (this.panels.length > 0) {
|
|
@@ -4312,12 +4537,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4312
4537
|
updateActions(element) {
|
|
4313
4538
|
this.tabsContainer.setRightActionsElement(element);
|
|
4314
4539
|
}
|
|
4315
|
-
setActive(isGroupActive,
|
|
4316
|
-
var _a, _b, _c, _d;
|
|
4540
|
+
setActive(isGroupActive, force = false) {
|
|
4317
4541
|
if (!force && this.isActive === isGroupActive) {
|
|
4318
|
-
if (!skipFocus) {
|
|
4319
|
-
(_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4320
|
-
}
|
|
4321
4542
|
return;
|
|
4322
4543
|
}
|
|
4323
4544
|
this._isGroupActive = isGroupActive;
|
|
@@ -4328,11 +4549,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4328
4549
|
this.doSetActivePanel(this.panels[0]);
|
|
4329
4550
|
}
|
|
4330
4551
|
this.updateContainer();
|
|
4331
|
-
if (isGroupActive) {
|
|
4332
|
-
if (!skipFocus) {
|
|
4333
|
-
(_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
4334
|
-
}
|
|
4335
|
-
}
|
|
4336
4552
|
}
|
|
4337
4553
|
layout(width, height) {
|
|
4338
4554
|
var _a;
|
|
@@ -4343,17 +4559,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4343
4559
|
this._activePanel.layout(this._width, this._height);
|
|
4344
4560
|
}
|
|
4345
4561
|
}
|
|
4346
|
-
_removePanel(panel) {
|
|
4562
|
+
_removePanel(panel, options) {
|
|
4347
4563
|
const isActivePanel = this._activePanel === panel;
|
|
4348
4564
|
this.doRemovePanel(panel);
|
|
4349
4565
|
if (isActivePanel && this.panels.length > 0) {
|
|
4350
4566
|
const nextPanel = this.mostRecentlyUsed[0];
|
|
4351
|
-
this.openPanel(nextPanel
|
|
4567
|
+
this.openPanel(nextPanel, {
|
|
4568
|
+
skipSetActive: options.skipSetActive,
|
|
4569
|
+
skipSetGroupActive: options.skipSetActiveGroup,
|
|
4570
|
+
});
|
|
4352
4571
|
}
|
|
4353
4572
|
if (this._activePanel && this.panels.length === 0) {
|
|
4354
4573
|
this.doSetActivePanel(undefined);
|
|
4355
4574
|
}
|
|
4356
|
-
|
|
4575
|
+
if (!options.skipSetActive) {
|
|
4576
|
+
this.updateContainer();
|
|
4577
|
+
}
|
|
4357
4578
|
return panel;
|
|
4358
4579
|
}
|
|
4359
4580
|
doRemovePanel(panel) {
|
|
@@ -4368,13 +4589,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4368
4589
|
}
|
|
4369
4590
|
this._onDidRemovePanel.fire({ panel });
|
|
4370
4591
|
}
|
|
4371
|
-
doAddPanel(panel, index = this.panels.length,
|
|
4592
|
+
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
4372
4593
|
const existingPanel = this._panels.indexOf(panel);
|
|
4373
4594
|
const hasExistingPanel = existingPanel > -1;
|
|
4374
4595
|
this.tabsContainer.show();
|
|
4375
4596
|
this.contentContainer.show();
|
|
4376
4597
|
this.tabsContainer.openPanel(panel, index);
|
|
4377
|
-
if (!skipSetActive) {
|
|
4598
|
+
if (!options.skipSetActive) {
|
|
4378
4599
|
this.contentContainer.openPanel(panel);
|
|
4379
4600
|
}
|
|
4380
4601
|
if (hasExistingPanel) {
|
|
@@ -4386,12 +4607,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4386
4607
|
this._onDidAddPanel.fire({ panel });
|
|
4387
4608
|
}
|
|
4388
4609
|
doSetActivePanel(panel) {
|
|
4610
|
+
if (this._activePanel === panel) {
|
|
4611
|
+
return;
|
|
4612
|
+
}
|
|
4389
4613
|
this._activePanel = panel;
|
|
4390
4614
|
if (panel) {
|
|
4391
4615
|
this.tabsContainer.setActivePanel(panel);
|
|
4392
4616
|
panel.layout(this._width, this._height);
|
|
4393
4617
|
this.updateMru(panel);
|
|
4394
|
-
this._onDidActivePanelChange.fire({
|
|
4618
|
+
this._onDidActivePanelChange.fire({
|
|
4619
|
+
panel,
|
|
4620
|
+
});
|
|
4395
4621
|
}
|
|
4396
4622
|
}
|
|
4397
4623
|
updateMru(panel) {
|
|
@@ -4403,11 +4629,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4403
4629
|
updateContainer() {
|
|
4404
4630
|
var _a, _b;
|
|
4405
4631
|
toggleClass(this.container, 'empty', this.isEmpty);
|
|
4406
|
-
this.panels.forEach((panel) => panel.
|
|
4632
|
+
this.panels.forEach((panel) => panel.runEvents());
|
|
4407
4633
|
if (this.isEmpty && !this.watermark) {
|
|
4408
4634
|
const watermark = this.accessor.createWatermarkComponent();
|
|
4409
4635
|
watermark.init({
|
|
4410
|
-
containerApi:
|
|
4636
|
+
containerApi: this._api,
|
|
4411
4637
|
group: this.groupPanel,
|
|
4412
4638
|
});
|
|
4413
4639
|
this.watermark = watermark;
|
|
@@ -4440,10 +4666,32 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4440
4666
|
}
|
|
4441
4667
|
return false;
|
|
4442
4668
|
}
|
|
4443
|
-
handleDropEvent(event, position, index) {
|
|
4669
|
+
handleDropEvent(type, event, position, index) {
|
|
4444
4670
|
if (this.locked === 'no-drop-target') {
|
|
4445
4671
|
return;
|
|
4446
4672
|
}
|
|
4673
|
+
function getKind() {
|
|
4674
|
+
switch (type) {
|
|
4675
|
+
case 'header':
|
|
4676
|
+
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
4677
|
+
case 'content':
|
|
4678
|
+
return 'content';
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4681
|
+
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
4682
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
4683
|
+
nativeEvent: event,
|
|
4684
|
+
position,
|
|
4685
|
+
panel,
|
|
4686
|
+
getData: () => getPanelData(),
|
|
4687
|
+
kind: getKind(),
|
|
4688
|
+
group: this.groupPanel,
|
|
4689
|
+
api: this._api,
|
|
4690
|
+
});
|
|
4691
|
+
this._onWillDrop.fire(willDropEvent);
|
|
4692
|
+
if (willDropEvent.defaultPrevented) {
|
|
4693
|
+
return;
|
|
4694
|
+
}
|
|
4447
4695
|
const data = getPanelData();
|
|
4448
4696
|
if (data && data.viewId === this.accessor.id) {
|
|
4449
4697
|
if (data.panelId === null) {
|
|
@@ -4476,12 +4724,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4476
4724
|
});
|
|
4477
4725
|
}
|
|
4478
4726
|
else {
|
|
4479
|
-
this._onDidDrop.fire({
|
|
4727
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
4480
4728
|
nativeEvent: event,
|
|
4481
4729
|
position,
|
|
4482
|
-
|
|
4730
|
+
panel,
|
|
4483
4731
|
getData: () => getPanelData(),
|
|
4484
|
-
|
|
4732
|
+
group: this.groupPanel,
|
|
4733
|
+
api: this._api,
|
|
4734
|
+
}));
|
|
4485
4735
|
}
|
|
4486
4736
|
}
|
|
4487
4737
|
dispose() {
|
|
@@ -4489,6 +4739,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4489
4739
|
super.dispose();
|
|
4490
4740
|
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
4491
4741
|
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4742
|
+
this.watermark = undefined;
|
|
4492
4743
|
for (const panel of this.panels) {
|
|
4493
4744
|
panel.dispose();
|
|
4494
4745
|
}
|
|
@@ -4510,15 +4761,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4510
4761
|
constructor(parentElement, disableResizing = false) {
|
|
4511
4762
|
super();
|
|
4512
4763
|
this._disableResizing = disableResizing;
|
|
4513
|
-
|
|
4514
|
-
this._element = parentElement;
|
|
4515
|
-
}
|
|
4516
|
-
else {
|
|
4517
|
-
this._element = document.createElement('div');
|
|
4518
|
-
this._element.style.height = '100%';
|
|
4519
|
-
this._element.style.width = '100%';
|
|
4520
|
-
this._element.className = 'dv-resizable-container';
|
|
4521
|
-
}
|
|
4764
|
+
this._element = parentElement;
|
|
4522
4765
|
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
4523
4766
|
if (this.isDisposed) {
|
|
4524
4767
|
/**
|
|
@@ -4606,25 +4849,38 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4606
4849
|
get activeGroup() {
|
|
4607
4850
|
return this._activeGroup;
|
|
4608
4851
|
}
|
|
4852
|
+
get locked() {
|
|
4853
|
+
return this.gridview.locked;
|
|
4854
|
+
}
|
|
4855
|
+
set locked(value) {
|
|
4856
|
+
this.gridview.locked = value;
|
|
4857
|
+
}
|
|
4609
4858
|
constructor(options) {
|
|
4610
|
-
super(
|
|
4859
|
+
super(document.createElement('div'), options.disableAutoResizing);
|
|
4611
4860
|
this._id = nextLayoutId$1.next();
|
|
4612
4861
|
this._groups = new Map();
|
|
4613
4862
|
this._onDidLayoutChange = new Emitter();
|
|
4614
4863
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
4615
|
-
this.
|
|
4616
|
-
this.
|
|
4617
|
-
this.
|
|
4618
|
-
this.
|
|
4619
|
-
this.
|
|
4620
|
-
this.
|
|
4864
|
+
this._onDidRemove = new Emitter();
|
|
4865
|
+
this.onDidRemove = this._onDidRemove.event;
|
|
4866
|
+
this._onDidAdd = new Emitter();
|
|
4867
|
+
this.onDidAdd = this._onDidAdd.event;
|
|
4868
|
+
this._onDidActiveChange = new Emitter();
|
|
4869
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4621
4870
|
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
4871
|
+
this.element.style.height = '100%';
|
|
4872
|
+
this.element.style.width = '100%';
|
|
4873
|
+
options.parentElement.appendChild(this.element);
|
|
4622
4874
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
4875
|
+
this.gridview.locked = !!options.locked;
|
|
4623
4876
|
this.element.appendChild(this.gridview.element);
|
|
4624
4877
|
this.layout(0, 0, true); // set some elements height/widths
|
|
4625
|
-
this.addDisposables(
|
|
4878
|
+
this.addDisposables(Disposable.from(() => {
|
|
4879
|
+
var _a;
|
|
4880
|
+
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
4881
|
+
}), this.gridview.onDidChange(() => {
|
|
4626
4882
|
this._bufferOnDidLayoutChange.fire();
|
|
4627
|
-
}), exports.DockviewEvent.any(this.
|
|
4883
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
4628
4884
|
this._bufferOnDidLayoutChange.fire();
|
|
4629
4885
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
4630
4886
|
this._onDidLayoutChange.fire();
|
|
@@ -4639,6 +4895,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4639
4895
|
}
|
|
4640
4896
|
maximizeGroup(panel) {
|
|
4641
4897
|
this.gridview.maximizeView(panel);
|
|
4898
|
+
this.doSetGroupActive(panel);
|
|
4642
4899
|
}
|
|
4643
4900
|
isMaximizedGroup(panel) {
|
|
4644
4901
|
return this.gridview.maximizedView() === panel;
|
|
@@ -4649,13 +4906,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4649
4906
|
hasMaximizedGroup() {
|
|
4650
4907
|
return this.gridview.hasMaximizedView();
|
|
4651
4908
|
}
|
|
4652
|
-
get
|
|
4653
|
-
return this.gridview.
|
|
4909
|
+
get onDidMaximizedGroupChange() {
|
|
4910
|
+
return this.gridview.onDidMaximizedNodeChange;
|
|
4654
4911
|
}
|
|
4655
4912
|
doAddGroup(group, location = [0], size) {
|
|
4656
4913
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
4657
|
-
this.
|
|
4658
|
-
this.doSetGroupActive(group);
|
|
4914
|
+
this._onDidAdd.fire(group);
|
|
4659
4915
|
}
|
|
4660
4916
|
doRemoveGroup(group, options) {
|
|
4661
4917
|
if (!this._groups.has(group.id)) {
|
|
@@ -4667,8 +4923,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4667
4923
|
item.disposable.dispose();
|
|
4668
4924
|
item.value.dispose();
|
|
4669
4925
|
this._groups.delete(group.id);
|
|
4926
|
+
this._onDidRemove.fire(group);
|
|
4670
4927
|
}
|
|
4671
|
-
this._onDidRemoveGroup.fire(group);
|
|
4672
4928
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
4673
4929
|
const groups = Array.from(this._groups.values());
|
|
4674
4930
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -4679,25 +4935,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4679
4935
|
var _a;
|
|
4680
4936
|
return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4681
4937
|
}
|
|
4682
|
-
doSetGroupActive(group
|
|
4683
|
-
var _a, _b, _c;
|
|
4938
|
+
doSetGroupActive(group) {
|
|
4684
4939
|
if (this._activeGroup === group) {
|
|
4685
4940
|
return;
|
|
4686
4941
|
}
|
|
4687
4942
|
if (this._activeGroup) {
|
|
4688
4943
|
this._activeGroup.setActive(false);
|
|
4689
|
-
if (!skipFocus) {
|
|
4690
|
-
(_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4691
|
-
}
|
|
4692
4944
|
}
|
|
4693
4945
|
if (group) {
|
|
4694
4946
|
group.setActive(true);
|
|
4695
|
-
if (!skipFocus) {
|
|
4696
|
-
(_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
|
|
4697
|
-
}
|
|
4698
4947
|
}
|
|
4699
4948
|
this._activeGroup = group;
|
|
4700
|
-
this.
|
|
4949
|
+
this._onDidActiveChange.fire(group);
|
|
4701
4950
|
}
|
|
4702
4951
|
removeGroup(group) {
|
|
4703
4952
|
this.doRemoveGroup(group);
|
|
@@ -4742,9 +4991,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4742
4991
|
this.gridview.layout(width, height);
|
|
4743
4992
|
}
|
|
4744
4993
|
dispose() {
|
|
4745
|
-
this.
|
|
4746
|
-
this.
|
|
4747
|
-
this.
|
|
4994
|
+
this._onDidActiveChange.dispose();
|
|
4995
|
+
this._onDidAdd.dispose();
|
|
4996
|
+
this._onDidRemove.dispose();
|
|
4748
4997
|
this._onDidLayoutChange.dispose();
|
|
4749
4998
|
for (const group of this.groups) {
|
|
4750
4999
|
group.dispose();
|
|
@@ -4754,11 +5003,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4754
5003
|
}
|
|
4755
5004
|
}
|
|
4756
5005
|
|
|
5006
|
+
class WillFocusEvent extends DockviewEvent {
|
|
5007
|
+
constructor() {
|
|
5008
|
+
super();
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
4757
5011
|
/**
|
|
4758
5012
|
* A core api implementation that should be used across all panel-like objects
|
|
4759
5013
|
*/
|
|
4760
5014
|
class PanelApiImpl extends CompositeDisposable {
|
|
4761
|
-
//
|
|
4762
5015
|
get isFocused() {
|
|
4763
5016
|
return this._isFocused;
|
|
4764
5017
|
}
|
|
@@ -4783,35 +5036,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4783
5036
|
this._width = 0;
|
|
4784
5037
|
this._height = 0;
|
|
4785
5038
|
this.panelUpdatesDisposable = new MutableDisposable();
|
|
4786
|
-
this._onDidDimensionChange = new Emitter(
|
|
4787
|
-
replay: true,
|
|
4788
|
-
});
|
|
5039
|
+
this._onDidDimensionChange = new Emitter();
|
|
4789
5040
|
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
4790
|
-
|
|
4791
|
-
this._onDidChangeFocus = new Emitter({
|
|
4792
|
-
replay: true,
|
|
4793
|
-
});
|
|
5041
|
+
this._onDidChangeFocus = new Emitter();
|
|
4794
5042
|
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
4795
5043
|
//
|
|
4796
|
-
this.
|
|
4797
|
-
this.
|
|
5044
|
+
this._onWillFocus = new Emitter();
|
|
5045
|
+
this.onWillFocus = this._onWillFocus.event;
|
|
4798
5046
|
//
|
|
4799
|
-
this._onDidVisibilityChange = new Emitter(
|
|
4800
|
-
replay: true,
|
|
4801
|
-
});
|
|
5047
|
+
this._onDidVisibilityChange = new Emitter();
|
|
4802
5048
|
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
4803
|
-
|
|
4804
|
-
this.
|
|
4805
|
-
this.
|
|
4806
|
-
//
|
|
4807
|
-
this._onDidActiveChange = new Emitter({
|
|
4808
|
-
replay: true,
|
|
4809
|
-
});
|
|
5049
|
+
this._onWillVisibilityChange = new Emitter();
|
|
5050
|
+
this.onWillVisibilityChange = this._onWillVisibilityChange.event;
|
|
5051
|
+
this._onDidActiveChange = new Emitter();
|
|
4810
5052
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4811
|
-
//
|
|
4812
5053
|
this._onActiveChange = new Emitter();
|
|
4813
5054
|
this.onActiveChange = this._onActiveChange.event;
|
|
4814
|
-
//
|
|
4815
5055
|
this._onUpdateParameters = new Emitter();
|
|
4816
5056
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
4817
5057
|
this.addDisposables(this.onDidFocusChange((event) => {
|
|
@@ -4823,7 +5063,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4823
5063
|
}), this.onDidDimensionsChange((event) => {
|
|
4824
5064
|
this._width = event.width;
|
|
4825
5065
|
this._height = event.height;
|
|
4826
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this.
|
|
5066
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
|
|
4827
5067
|
}
|
|
4828
5068
|
initialize(panel) {
|
|
4829
5069
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
@@ -4833,7 +5073,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4833
5073
|
});
|
|
4834
5074
|
}
|
|
4835
5075
|
setVisible(isVisible) {
|
|
4836
|
-
this.
|
|
5076
|
+
this._onWillVisibilityChange.fire({ isVisible });
|
|
4837
5077
|
}
|
|
4838
5078
|
setActive() {
|
|
4839
5079
|
this._onActiveChange.fire();
|
|
@@ -4841,9 +5081,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4841
5081
|
updateParameters(parameters) {
|
|
4842
5082
|
this._onUpdateParameters.fire(parameters);
|
|
4843
5083
|
}
|
|
4844
|
-
dispose() {
|
|
4845
|
-
super.dispose();
|
|
4846
|
-
}
|
|
4847
5084
|
}
|
|
4848
5085
|
|
|
4849
5086
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
@@ -4931,7 +5168,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4931
5168
|
}), focusTracker);
|
|
4932
5169
|
}
|
|
4933
5170
|
focus() {
|
|
4934
|
-
|
|
5171
|
+
const event = new WillFocusEvent();
|
|
5172
|
+
this.api._onWillFocus.fire(event);
|
|
5173
|
+
if (event.defaultPrevented) {
|
|
5174
|
+
return;
|
|
5175
|
+
}
|
|
5176
|
+
this._element.focus();
|
|
4935
5177
|
}
|
|
4936
5178
|
layout(width, height) {
|
|
4937
5179
|
this._width = width;
|
|
@@ -5049,7 +5291,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5049
5291
|
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
5050
5292
|
this._orientation = orientation;
|
|
5051
5293
|
this.element.classList.add('pane');
|
|
5052
|
-
this.addDisposables(this.api.
|
|
5294
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
5295
|
+
const { isVisible } = event;
|
|
5296
|
+
const { accessor } = this._params;
|
|
5297
|
+
accessor.setVisible(this, isVisible);
|
|
5298
|
+
}), this.api.onDidSizeChange((event) => {
|
|
5053
5299
|
this._onDidChange.fire({ size: event.size });
|
|
5054
5300
|
}), addDisposableListener(this.element, 'mouseenter', (ev) => {
|
|
5055
5301
|
this.api._onMouseEnter.fire(ev);
|
|
@@ -5260,9 +5506,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5260
5506
|
super(id);
|
|
5261
5507
|
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5262
5508
|
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5263
|
-
this._onDidConstraintsChange = new Emitter(
|
|
5264
|
-
replay: true,
|
|
5265
|
-
});
|
|
5509
|
+
this._onDidConstraintsChange = new Emitter();
|
|
5266
5510
|
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
5267
5511
|
this._onDidSizeChange = new Emitter();
|
|
5268
5512
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
@@ -5355,13 +5599,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5355
5599
|
this._maximumHeight = options.maximumHeight;
|
|
5356
5600
|
}
|
|
5357
5601
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
5358
|
-
this.addDisposables(this.api.
|
|
5602
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
5359
5603
|
const { isVisible } = event;
|
|
5360
5604
|
const { accessor } = this._params;
|
|
5361
5605
|
accessor.setVisible(this, isVisible);
|
|
5362
5606
|
}), this.api.onActiveChange(() => {
|
|
5363
5607
|
const { accessor } = this._params;
|
|
5364
|
-
accessor.
|
|
5608
|
+
accessor.doSetGroupActive(this);
|
|
5365
5609
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
5366
5610
|
if (typeof event.minimumWidth === 'number' ||
|
|
5367
5611
|
typeof event.minimumWidth === 'function') {
|
|
@@ -5444,6 +5688,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5444
5688
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5445
5689
|
this.addDisposables(this._onDidLocationChange);
|
|
5446
5690
|
}
|
|
5691
|
+
close() {
|
|
5692
|
+
if (!this._group) {
|
|
5693
|
+
return;
|
|
5694
|
+
}
|
|
5695
|
+
return this.accessor.removeGroup(this._group);
|
|
5696
|
+
}
|
|
5697
|
+
getWindow() {
|
|
5698
|
+
return this.location.type === 'popout'
|
|
5699
|
+
? this.location.getWindow()
|
|
5700
|
+
: window;
|
|
5701
|
+
}
|
|
5447
5702
|
moveTo(options) {
|
|
5448
5703
|
var _a, _b, _c;
|
|
5449
5704
|
if (!this._group) {
|
|
@@ -5451,14 +5706,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5451
5706
|
}
|
|
5452
5707
|
const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
|
|
5453
5708
|
direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
|
|
5709
|
+
skipSetActive: true,
|
|
5710
|
+
});
|
|
5711
|
+
this.accessor.moveGroupOrPanel({
|
|
5712
|
+
from: { groupId: this._group.id },
|
|
5713
|
+
to: {
|
|
5714
|
+
group,
|
|
5715
|
+
position: options.group
|
|
5716
|
+
? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
|
|
5717
|
+
: 'center',
|
|
5718
|
+
},
|
|
5454
5719
|
});
|
|
5455
|
-
this.accessor.moveGroupOrPanel(group, this._group.id, undefined, options.group ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center' : 'center');
|
|
5456
5720
|
}
|
|
5457
5721
|
maximize() {
|
|
5458
5722
|
if (!this._group) {
|
|
5459
5723
|
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5460
5724
|
}
|
|
5461
|
-
if (this.location !== 'grid') {
|
|
5725
|
+
if (this.location.type !== 'grid') {
|
|
5462
5726
|
// only grid groups can be maximized
|
|
5463
5727
|
return;
|
|
5464
5728
|
}
|
|
@@ -5515,6 +5779,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5515
5779
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
5516
5780
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
5517
5781
|
}
|
|
5782
|
+
focus() {
|
|
5783
|
+
if (!this.api.isActive) {
|
|
5784
|
+
this.api.setActive();
|
|
5785
|
+
}
|
|
5786
|
+
super.focus();
|
|
5787
|
+
}
|
|
5518
5788
|
initialize() {
|
|
5519
5789
|
this._model.initialize();
|
|
5520
5790
|
}
|
|
@@ -5560,6 +5830,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5560
5830
|
}
|
|
5561
5831
|
|
|
5562
5832
|
class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
5833
|
+
get location() {
|
|
5834
|
+
return this.group.api.location;
|
|
5835
|
+
}
|
|
5563
5836
|
get title() {
|
|
5564
5837
|
return this.panel.title;
|
|
5565
5838
|
}
|
|
@@ -5570,16 +5843,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5570
5843
|
return this.panel.renderer;
|
|
5571
5844
|
}
|
|
5572
5845
|
set group(value) {
|
|
5573
|
-
const
|
|
5574
|
-
this._group
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
this.
|
|
5578
|
-
|
|
5846
|
+
const oldGroup = this._group;
|
|
5847
|
+
if (this._group !== value) {
|
|
5848
|
+
this._group = value;
|
|
5849
|
+
this._onDidGroupChange.fire({});
|
|
5850
|
+
this.setupGroupEventListeners(oldGroup);
|
|
5851
|
+
this._onDidLocationChange.fire({
|
|
5852
|
+
location: this.group.api.location,
|
|
5579
5853
|
});
|
|
5580
|
-
if (this.isGroupActive !== isOldGroupActive) {
|
|
5581
|
-
this._onDidActiveGroupChange.fire();
|
|
5582
|
-
}
|
|
5583
5854
|
}
|
|
5584
5855
|
}
|
|
5585
5856
|
get group() {
|
|
@@ -5597,14 +5868,27 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5597
5868
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
5598
5869
|
this._onDidRendererChange = new Emitter();
|
|
5599
5870
|
this.onDidRendererChange = this._onDidRendererChange.event;
|
|
5600
|
-
this.
|
|
5871
|
+
this._onDidLocationChange = new Emitter();
|
|
5872
|
+
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5873
|
+
this.groupEventsDisposable = new MutableDisposable();
|
|
5601
5874
|
this.initialize(panel);
|
|
5602
5875
|
this._group = group;
|
|
5603
|
-
this.
|
|
5876
|
+
this.setupGroupEventListeners();
|
|
5877
|
+
this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
|
|
5878
|
+
}
|
|
5879
|
+
getWindow() {
|
|
5880
|
+
return this.group.api.getWindow();
|
|
5604
5881
|
}
|
|
5605
5882
|
moveTo(options) {
|
|
5606
5883
|
var _a;
|
|
5607
|
-
this.accessor.moveGroupOrPanel(
|
|
5884
|
+
this.accessor.moveGroupOrPanel({
|
|
5885
|
+
from: { groupId: this._group.id, panelId: this.panel.id },
|
|
5886
|
+
to: {
|
|
5887
|
+
group: options.group,
|
|
5888
|
+
position: (_a = options.position) !== null && _a !== void 0 ? _a : 'center',
|
|
5889
|
+
index: options.index,
|
|
5890
|
+
},
|
|
5891
|
+
});
|
|
5608
5892
|
}
|
|
5609
5893
|
setTitle(title) {
|
|
5610
5894
|
this.panel.setTitle(title);
|
|
@@ -5624,6 +5908,35 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5624
5908
|
exitMaximized() {
|
|
5625
5909
|
this.group.api.exitMaximized();
|
|
5626
5910
|
}
|
|
5911
|
+
setupGroupEventListeners(previousGroup) {
|
|
5912
|
+
var _a;
|
|
5913
|
+
let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
|
|
5914
|
+
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
|
|
5915
|
+
if (!event.isVisible && this.isVisible) {
|
|
5916
|
+
this._onDidVisibilityChange.fire(event);
|
|
5917
|
+
}
|
|
5918
|
+
else if (event.isVisible &&
|
|
5919
|
+
!this.isVisible &&
|
|
5920
|
+
this.group.model.isPanelActive(this.panel)) {
|
|
5921
|
+
this._onDidVisibilityChange.fire(event);
|
|
5922
|
+
}
|
|
5923
|
+
}), this.group.api.onDidLocationChange((event) => {
|
|
5924
|
+
if (this.group !== this.panel.group) {
|
|
5925
|
+
return;
|
|
5926
|
+
}
|
|
5927
|
+
this._onDidLocationChange.fire(event);
|
|
5928
|
+
}), this.group.api.onDidActiveChange(() => {
|
|
5929
|
+
if (this.group !== this.panel.group) {
|
|
5930
|
+
return;
|
|
5931
|
+
}
|
|
5932
|
+
if (_trackGroupActive !== this.isGroupActive) {
|
|
5933
|
+
_trackGroupActive = this.isGroupActive;
|
|
5934
|
+
this._onDidActiveGroupChange.fire({
|
|
5935
|
+
isActive: this.isGroupActive,
|
|
5936
|
+
});
|
|
5937
|
+
}
|
|
5938
|
+
}));
|
|
5939
|
+
}
|
|
5627
5940
|
}
|
|
5628
5941
|
|
|
5629
5942
|
class DockviewPanel extends CompositeDisposable {
|
|
@@ -5665,7 +5978,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5665
5978
|
this.setTitle(params.title);
|
|
5666
5979
|
}
|
|
5667
5980
|
focus() {
|
|
5668
|
-
|
|
5981
|
+
const event = new WillFocusEvent();
|
|
5982
|
+
this.api._onWillFocus.fire(event);
|
|
5983
|
+
if (event.defaultPrevented) {
|
|
5984
|
+
return;
|
|
5985
|
+
}
|
|
5986
|
+
if (!this.api.isActive) {
|
|
5987
|
+
this.api.setActive();
|
|
5988
|
+
}
|
|
5669
5989
|
}
|
|
5670
5990
|
toJSON() {
|
|
5671
5991
|
return {
|
|
@@ -5722,24 +6042,44 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5722
6042
|
},
|
|
5723
6043
|
});
|
|
5724
6044
|
}
|
|
5725
|
-
updateParentGroup(group,
|
|
6045
|
+
updateParentGroup(group, options) {
|
|
5726
6046
|
this._group = group;
|
|
5727
|
-
this.api.group =
|
|
6047
|
+
this.api.group = this._group;
|
|
5728
6048
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
5729
|
-
this.api.
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
6049
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6050
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipSetActive)) {
|
|
6051
|
+
if (this.api.isActive !== isActive) {
|
|
6052
|
+
this.api._onDidActiveChange.fire({
|
|
6053
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6054
|
+
});
|
|
6055
|
+
}
|
|
6056
|
+
}
|
|
6057
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6058
|
+
this.api._onDidVisibilityChange.fire({
|
|
6059
|
+
isVisible: isPanelVisible,
|
|
6060
|
+
});
|
|
6061
|
+
}
|
|
5736
6062
|
}
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
this.api.
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
6063
|
+
runEvents() {
|
|
6064
|
+
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
6065
|
+
const isActive = this.group.api.isActive && isPanelVisible;
|
|
6066
|
+
if (this.api.isActive !== isActive) {
|
|
6067
|
+
this.api._onDidActiveChange.fire({
|
|
6068
|
+
isActive: this.group.api.isActive && isPanelVisible,
|
|
6069
|
+
});
|
|
6070
|
+
}
|
|
6071
|
+
if (this.api.isVisible !== isPanelVisible) {
|
|
6072
|
+
this.api._onDidVisibilityChange.fire({
|
|
6073
|
+
isVisible: isPanelVisible,
|
|
6074
|
+
});
|
|
6075
|
+
}
|
|
6076
|
+
}
|
|
6077
|
+
layout(width, height) {
|
|
6078
|
+
// TODO: Can we somehow do height without header height or indicate what the header height is?
|
|
6079
|
+
this.api._onDidDimensionChange.fire({
|
|
6080
|
+
width,
|
|
6081
|
+
height: height,
|
|
6082
|
+
});
|
|
5743
6083
|
this.view.layout(width, height);
|
|
5744
6084
|
}
|
|
5745
6085
|
dispose() {
|
|
@@ -5857,8 +6197,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5857
6197
|
this.id = id;
|
|
5858
6198
|
this.contentComponent = contentComponent;
|
|
5859
6199
|
this.tabComponent = tabComponent;
|
|
5860
|
-
this._group = null;
|
|
5861
|
-
this._isPanelVisible = null;
|
|
5862
6200
|
this._content = this.createContentComponent(this.id, contentComponent);
|
|
5863
6201
|
this._tab = this.createTabComponent(this.id, tabComponent);
|
|
5864
6202
|
}
|
|
@@ -5866,25 +6204,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5866
6204
|
this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
|
|
5867
6205
|
this.tab.init(params);
|
|
5868
6206
|
}
|
|
5869
|
-
updateParentGroup(
|
|
5870
|
-
|
|
5871
|
-
this._group = group;
|
|
5872
|
-
if (this._content.onGroupChange) {
|
|
5873
|
-
this._content.onGroupChange(group);
|
|
5874
|
-
}
|
|
5875
|
-
if (this._tab.onGroupChange) {
|
|
5876
|
-
this._tab.onGroupChange(group);
|
|
5877
|
-
}
|
|
5878
|
-
}
|
|
5879
|
-
if (isPanelVisible !== this._isPanelVisible) {
|
|
5880
|
-
this._isPanelVisible = isPanelVisible;
|
|
5881
|
-
if (this._content.onPanelVisibleChange) {
|
|
5882
|
-
this._content.onPanelVisibleChange(isPanelVisible);
|
|
5883
|
-
}
|
|
5884
|
-
if (this._tab.onPanelVisibleChange) {
|
|
5885
|
-
this._tab.onPanelVisibleChange(isPanelVisible);
|
|
5886
|
-
}
|
|
5887
|
-
}
|
|
6207
|
+
updateParentGroup(_group, _isPanelVisible) {
|
|
6208
|
+
// noop
|
|
5888
6209
|
}
|
|
5889
6210
|
layout(width, height) {
|
|
5890
6211
|
var _a, _b;
|
|
@@ -6317,117 +6638,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6317
6638
|
}
|
|
6318
6639
|
}
|
|
6319
6640
|
|
|
6320
|
-
class PopoutWindow extends CompositeDisposable {
|
|
6321
|
-
constructor(id, className, options) {
|
|
6322
|
-
super();
|
|
6323
|
-
this.id = id;
|
|
6324
|
-
this.className = className;
|
|
6325
|
-
this.options = options;
|
|
6326
|
-
this._onDidClose = new Emitter();
|
|
6327
|
-
this.onDidClose = this._onDidClose.event;
|
|
6328
|
-
this._window = null;
|
|
6329
|
-
this.addDisposables(this._onDidClose, {
|
|
6330
|
-
dispose: () => {
|
|
6331
|
-
this.close();
|
|
6332
|
-
},
|
|
6333
|
-
});
|
|
6334
|
-
}
|
|
6335
|
-
dimensions() {
|
|
6336
|
-
if (!this._window) {
|
|
6337
|
-
return null;
|
|
6338
|
-
}
|
|
6339
|
-
const left = this._window.value.screenX;
|
|
6340
|
-
const top = this._window.value.screenY;
|
|
6341
|
-
const width = this._window.value.innerWidth;
|
|
6342
|
-
const height = this._window.value.innerHeight;
|
|
6343
|
-
return { top, left, width, height };
|
|
6344
|
-
}
|
|
6345
|
-
close() {
|
|
6346
|
-
if (this._window) {
|
|
6347
|
-
this._window.disposable.dispose();
|
|
6348
|
-
this._window.value.close();
|
|
6349
|
-
this._window = null;
|
|
6350
|
-
}
|
|
6351
|
-
}
|
|
6352
|
-
open(content) {
|
|
6353
|
-
if (this._window) {
|
|
6354
|
-
throw new Error('instance of popout window is already open');
|
|
6355
|
-
}
|
|
6356
|
-
const url = `${this.options.url}`;
|
|
6357
|
-
const features = Object.entries({
|
|
6358
|
-
top: this.options.top,
|
|
6359
|
-
left: this.options.left,
|
|
6360
|
-
width: this.options.width,
|
|
6361
|
-
height: this.options.height,
|
|
6362
|
-
})
|
|
6363
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
6364
|
-
.join(',');
|
|
6365
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6366
|
-
const externalWindow = window.open(url, this.id, features);
|
|
6367
|
-
if (!externalWindow) {
|
|
6368
|
-
return;
|
|
6369
|
-
}
|
|
6370
|
-
const disposable = new CompositeDisposable();
|
|
6371
|
-
this._window = { value: externalWindow, disposable };
|
|
6372
|
-
const cleanUp = () => {
|
|
6373
|
-
this._onDidClose.fire();
|
|
6374
|
-
this._window = null;
|
|
6375
|
-
};
|
|
6376
|
-
// prevent any default content from loading
|
|
6377
|
-
// externalWindow.document.body.replaceWith(document.createElement('div'));
|
|
6378
|
-
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6379
|
-
cleanUp();
|
|
6380
|
-
this.close();
|
|
6381
|
-
}));
|
|
6382
|
-
externalWindow.addEventListener('load', () => {
|
|
6383
|
-
const externalDocument = externalWindow.document;
|
|
6384
|
-
externalDocument.title = document.title;
|
|
6385
|
-
const div = document.createElement('div');
|
|
6386
|
-
div.classList.add('dv-popout-window');
|
|
6387
|
-
div.style.position = 'absolute';
|
|
6388
|
-
div.style.width = '100%';
|
|
6389
|
-
div.style.height = '100%';
|
|
6390
|
-
div.style.top = '0px';
|
|
6391
|
-
div.style.left = '0px';
|
|
6392
|
-
div.classList.add(this.className);
|
|
6393
|
-
div.appendChild(content);
|
|
6394
|
-
externalDocument.body.replaceChildren(div);
|
|
6395
|
-
externalDocument.body.classList.add(this.className);
|
|
6396
|
-
addStyles(externalDocument, window.document.styleSheets);
|
|
6397
|
-
externalWindow.addEventListener('beforeunload', () => {
|
|
6398
|
-
// TODO: indicate external window is closing
|
|
6399
|
-
cleanUp();
|
|
6400
|
-
});
|
|
6401
|
-
});
|
|
6402
|
-
}
|
|
6403
|
-
}
|
|
6404
|
-
|
|
6405
|
-
class DockviewPopoutGroupPanel extends CompositeDisposable {
|
|
6406
|
-
constructor(id, group, options) {
|
|
6407
|
-
var _a;
|
|
6408
|
-
super();
|
|
6409
|
-
this.id = id;
|
|
6410
|
-
this.group = group;
|
|
6411
|
-
this.options = options;
|
|
6412
|
-
this.window = new PopoutWindow(id, (_a = options.className) !== null && _a !== void 0 ? _a : '', {
|
|
6413
|
-
url: this.options.popoutUrl,
|
|
6414
|
-
left: this.options.box.left,
|
|
6415
|
-
top: this.options.box.top,
|
|
6416
|
-
width: this.options.box.width,
|
|
6417
|
-
height: this.options.box.height,
|
|
6418
|
-
});
|
|
6419
|
-
group.model.location = 'popout';
|
|
6420
|
-
this.addDisposables(this.window, {
|
|
6421
|
-
dispose: () => {
|
|
6422
|
-
group.model.location = 'grid';
|
|
6423
|
-
},
|
|
6424
|
-
}, this.window.onDidClose(() => {
|
|
6425
|
-
this.dispose();
|
|
6426
|
-
}));
|
|
6427
|
-
this.window.open(group.element);
|
|
6428
|
-
}
|
|
6429
|
-
}
|
|
6430
|
-
|
|
6431
6641
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6432
6642
|
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6433
6643
|
|
|
@@ -6441,11 +6651,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6441
6651
|
super();
|
|
6442
6652
|
this.element = element;
|
|
6443
6653
|
this.map = {};
|
|
6654
|
+
this._disposed = false;
|
|
6444
6655
|
this.addDisposables(Disposable.from(() => {
|
|
6445
6656
|
for (const value of Object.values(this.map)) {
|
|
6446
6657
|
value.disposable.dispose();
|
|
6447
6658
|
value.destroy.dispose();
|
|
6448
6659
|
}
|
|
6660
|
+
this._disposed = true;
|
|
6449
6661
|
}));
|
|
6450
6662
|
}
|
|
6451
6663
|
detatch(panel) {
|
|
@@ -6485,7 +6697,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6485
6697
|
focusContainer.style.top = `${box.top - box2.top}px`;
|
|
6486
6698
|
focusContainer.style.width = `${box.width}px`;
|
|
6487
6699
|
focusContainer.style.height = `${box.height}px`;
|
|
6488
|
-
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location === 'floating');
|
|
6700
|
+
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
|
|
6489
6701
|
};
|
|
6490
6702
|
const visibilityChanged = () => {
|
|
6491
6703
|
if (panel.api.isVisible) {
|
|
@@ -6531,8 +6743,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6531
6743
|
resize();
|
|
6532
6744
|
}));
|
|
6533
6745
|
this.map[panel.api.id].destroy = Disposable.from(() => {
|
|
6534
|
-
|
|
6535
|
-
|
|
6746
|
+
var _a;
|
|
6747
|
+
if (panel.view.content.element.parentElement === focusContainer) {
|
|
6748
|
+
focusContainer.removeChild(panel.view.content.element);
|
|
6749
|
+
}
|
|
6750
|
+
(_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
|
|
6536
6751
|
});
|
|
6537
6752
|
queueMicrotask(() => {
|
|
6538
6753
|
if (this.isDisposed) {
|
|
@@ -6553,11 +6768,164 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6553
6768
|
}
|
|
6554
6769
|
}
|
|
6555
6770
|
|
|
6771
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6772
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6773
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6774
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6775
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6776
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6777
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6778
|
+
});
|
|
6779
|
+
};
|
|
6780
|
+
class PopoutWindow extends CompositeDisposable {
|
|
6781
|
+
get window() {
|
|
6782
|
+
var _a, _b;
|
|
6783
|
+
return (_b = (_a = this._window) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;
|
|
6784
|
+
}
|
|
6785
|
+
constructor(target, className, options) {
|
|
6786
|
+
super();
|
|
6787
|
+
this.target = target;
|
|
6788
|
+
this.className = className;
|
|
6789
|
+
this.options = options;
|
|
6790
|
+
this._onWillClose = new Emitter();
|
|
6791
|
+
this.onWillClose = this._onWillClose.event;
|
|
6792
|
+
this._onDidClose = new Emitter();
|
|
6793
|
+
this.onDidClose = this._onDidClose.event;
|
|
6794
|
+
this._window = null;
|
|
6795
|
+
this.addDisposables(this._onWillClose, this._onDidClose, {
|
|
6796
|
+
dispose: () => {
|
|
6797
|
+
this.close();
|
|
6798
|
+
},
|
|
6799
|
+
});
|
|
6800
|
+
}
|
|
6801
|
+
dimensions() {
|
|
6802
|
+
if (!this._window) {
|
|
6803
|
+
return null;
|
|
6804
|
+
}
|
|
6805
|
+
const left = this._window.value.screenX;
|
|
6806
|
+
const top = this._window.value.screenY;
|
|
6807
|
+
const width = this._window.value.innerWidth;
|
|
6808
|
+
const height = this._window.value.innerHeight;
|
|
6809
|
+
return { top, left, width, height };
|
|
6810
|
+
}
|
|
6811
|
+
close() {
|
|
6812
|
+
var _a, _b;
|
|
6813
|
+
if (this._window) {
|
|
6814
|
+
this._onWillClose.fire();
|
|
6815
|
+
(_b = (_a = this.options).onWillClose) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6816
|
+
id: this.target,
|
|
6817
|
+
window: this._window.value,
|
|
6818
|
+
});
|
|
6819
|
+
this._window.disposable.dispose();
|
|
6820
|
+
this._window.value.close();
|
|
6821
|
+
this._window = null;
|
|
6822
|
+
this._onDidClose.fire();
|
|
6823
|
+
}
|
|
6824
|
+
}
|
|
6825
|
+
open() {
|
|
6826
|
+
var _a, _b;
|
|
6827
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6828
|
+
if (this._window) {
|
|
6829
|
+
throw new Error('instance of popout window is already open');
|
|
6830
|
+
}
|
|
6831
|
+
const url = `${this.options.url}`;
|
|
6832
|
+
const features = Object.entries({
|
|
6833
|
+
top: this.options.top,
|
|
6834
|
+
left: this.options.left,
|
|
6835
|
+
width: this.options.width,
|
|
6836
|
+
height: this.options.height,
|
|
6837
|
+
})
|
|
6838
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
6839
|
+
.join(',');
|
|
6840
|
+
/**
|
|
6841
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6842
|
+
*/
|
|
6843
|
+
const externalWindow = window.open(url, this.target, features);
|
|
6844
|
+
if (!externalWindow) {
|
|
6845
|
+
/**
|
|
6846
|
+
* Popup blocked
|
|
6847
|
+
*/
|
|
6848
|
+
return null;
|
|
6849
|
+
}
|
|
6850
|
+
const disposable = new CompositeDisposable();
|
|
6851
|
+
this._window = { value: externalWindow, disposable };
|
|
6852
|
+
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6853
|
+
/**
|
|
6854
|
+
* before the main window closes we should close this popup too
|
|
6855
|
+
* to be good citizens
|
|
6856
|
+
*
|
|
6857
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6858
|
+
*/
|
|
6859
|
+
this.close();
|
|
6860
|
+
}));
|
|
6861
|
+
const container = this.createPopoutWindowContainer();
|
|
6862
|
+
if (this.className) {
|
|
6863
|
+
container.classList.add(this.className);
|
|
6864
|
+
}
|
|
6865
|
+
(_b = (_a = this.options).onDidOpen) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
6866
|
+
id: this.target,
|
|
6867
|
+
window: externalWindow,
|
|
6868
|
+
});
|
|
6869
|
+
return new Promise((resolve) => {
|
|
6870
|
+
externalWindow.addEventListener('unload', (e) => {
|
|
6871
|
+
// if page fails to load before unloading
|
|
6872
|
+
// this.close();
|
|
6873
|
+
});
|
|
6874
|
+
externalWindow.addEventListener('load', () => {
|
|
6875
|
+
/**
|
|
6876
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
|
|
6877
|
+
*/
|
|
6878
|
+
const externalDocument = externalWindow.document;
|
|
6879
|
+
externalDocument.title = document.title;
|
|
6880
|
+
externalDocument.body.appendChild(container);
|
|
6881
|
+
addStyles(externalDocument, window.document.styleSheets);
|
|
6882
|
+
/**
|
|
6883
|
+
* beforeunload must be registered after load for reasons I could not determine
|
|
6884
|
+
* otherwise the beforeunload event will not fire when the window is closed
|
|
6885
|
+
*/
|
|
6886
|
+
addDisposableWindowListener(externalWindow, 'beforeunload', () => {
|
|
6887
|
+
/**
|
|
6888
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
6889
|
+
*/
|
|
6890
|
+
this.close();
|
|
6891
|
+
});
|
|
6892
|
+
resolve(container);
|
|
6893
|
+
});
|
|
6894
|
+
});
|
|
6895
|
+
});
|
|
6896
|
+
}
|
|
6897
|
+
createPopoutWindowContainer() {
|
|
6898
|
+
const el = document.createElement('div');
|
|
6899
|
+
el.classList.add('dv-popout-window');
|
|
6900
|
+
el.id = 'dv-popout-window';
|
|
6901
|
+
el.style.position = 'absolute';
|
|
6902
|
+
el.style.width = '100%';
|
|
6903
|
+
el.style.height = '100%';
|
|
6904
|
+
el.style.top = '0px';
|
|
6905
|
+
el.style.left = '0px';
|
|
6906
|
+
return el;
|
|
6907
|
+
}
|
|
6908
|
+
}
|
|
6909
|
+
|
|
6556
6910
|
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6557
6911
|
activationSize: { type: 'pixels', value: 10 },
|
|
6558
6912
|
size: { type: 'pixels', value: 20 },
|
|
6559
6913
|
};
|
|
6560
|
-
function
|
|
6914
|
+
function moveGroupWithoutDestroying(options) {
|
|
6915
|
+
const activePanel = options.from.activePanel;
|
|
6916
|
+
const panels = [...options.from.panels].map((panel) => {
|
|
6917
|
+
const removedPanel = options.from.model.removePanel(panel);
|
|
6918
|
+
options.from.model.renderContainer.detatch(panel);
|
|
6919
|
+
return removedPanel;
|
|
6920
|
+
});
|
|
6921
|
+
panels.forEach((panel) => {
|
|
6922
|
+
options.to.model.openPanel(panel, {
|
|
6923
|
+
skipSetActive: activePanel !== panel,
|
|
6924
|
+
skipSetGroupActive: true,
|
|
6925
|
+
});
|
|
6926
|
+
});
|
|
6927
|
+
}
|
|
6928
|
+
function getDockviewTheme(element) {
|
|
6561
6929
|
function toClassList(element) {
|
|
6562
6930
|
const list = [];
|
|
6563
6931
|
for (let i = 0; i < element.classList.length; i++) {
|
|
@@ -6608,6 +6976,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6608
6976
|
styles: options.styles,
|
|
6609
6977
|
parentElement: options.parentElement,
|
|
6610
6978
|
disableAutoResizing: options.disableAutoResizing,
|
|
6979
|
+
locked: options.locked,
|
|
6611
6980
|
});
|
|
6612
6981
|
this.nextGroupId = sequentialNumberGenerator();
|
|
6613
6982
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -6618,6 +6987,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6618
6987
|
this.onWillDragGroup = this._onWillDragGroup.event;
|
|
6619
6988
|
this._onDidDrop = new Emitter();
|
|
6620
6989
|
this.onDidDrop = this._onDidDrop.event;
|
|
6990
|
+
this._onWillDrop = new Emitter();
|
|
6991
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
6992
|
+
this._onWillShowOverlay = new Emitter();
|
|
6993
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
6621
6994
|
this._onDidRemovePanel = new Emitter();
|
|
6622
6995
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
6623
6996
|
this._onDidAddPanel = new Emitter();
|
|
@@ -6626,15 +6999,36 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6626
6999
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
6627
7000
|
this._onDidActivePanelChange = new Emitter();
|
|
6628
7001
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
7002
|
+
this._onDidMovePanel = new Emitter();
|
|
6629
7003
|
this._floatingGroups = [];
|
|
6630
7004
|
this._popoutGroups = [];
|
|
7005
|
+
this._ignoreEvents = 0;
|
|
7006
|
+
this._onDidRemoveGroup = new Emitter();
|
|
7007
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
7008
|
+
this._onDidAddGroup = new Emitter();
|
|
7009
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
7010
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
7011
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
7012
|
+
this._moving = false;
|
|
6631
7013
|
const gready = document.createElement('div');
|
|
6632
7014
|
gready.className = 'dv-overlay-render-container';
|
|
6633
7015
|
this.gridview.element.appendChild(gready);
|
|
6634
7016
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
6635
7017
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
6636
7018
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
6637
|
-
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop,
|
|
7019
|
+
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) => {
|
|
7020
|
+
if (!this._moving) {
|
|
7021
|
+
this._onDidAddGroup.fire(event);
|
|
7022
|
+
}
|
|
7023
|
+
}), this.onDidRemove((event) => {
|
|
7024
|
+
if (!this._moving) {
|
|
7025
|
+
this._onDidRemoveGroup.fire(event);
|
|
7026
|
+
}
|
|
7027
|
+
}), this.onDidActiveChange((event) => {
|
|
7028
|
+
if (!this._moving) {
|
|
7029
|
+
this._onDidActiveGroupChange.fire(event);
|
|
7030
|
+
}
|
|
7031
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
6638
7032
|
this.updateWatermark();
|
|
6639
7033
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
6640
7034
|
this._bufferOnDidLayoutChange.fire();
|
|
@@ -6645,7 +7039,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6645
7039
|
}
|
|
6646
7040
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6647
7041
|
for (const group of [...this._popoutGroups]) {
|
|
6648
|
-
group.dispose();
|
|
7042
|
+
group.disposable.dispose();
|
|
6649
7043
|
}
|
|
6650
7044
|
}));
|
|
6651
7045
|
this._options = options;
|
|
@@ -6691,7 +7085,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6691
7085
|
return this.options.showDndOverlay({
|
|
6692
7086
|
nativeEvent: event,
|
|
6693
7087
|
position: position,
|
|
6694
|
-
target:
|
|
7088
|
+
target: 'edge',
|
|
6695
7089
|
getData: getPanelData,
|
|
6696
7090
|
});
|
|
6697
7091
|
}
|
|
@@ -6700,88 +7094,259 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6700
7094
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
6701
7095
|
overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
6702
7096
|
});
|
|
6703
|
-
this.addDisposables(this._rootDropTarget.
|
|
7097
|
+
this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
|
|
7098
|
+
if (this.gridview.length > 0 && event.position === 'center') {
|
|
7099
|
+
// option only available when no panels in primary grid
|
|
7100
|
+
return;
|
|
7101
|
+
}
|
|
7102
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
7103
|
+
kind: 'edge',
|
|
7104
|
+
}));
|
|
7105
|
+
}), this._rootDropTarget.onDrop((event) => {
|
|
6704
7106
|
var _a;
|
|
7107
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
7108
|
+
nativeEvent: event.nativeEvent,
|
|
7109
|
+
position: event.position,
|
|
7110
|
+
panel: undefined,
|
|
7111
|
+
api: this._api,
|
|
7112
|
+
group: undefined,
|
|
7113
|
+
getData: getPanelData,
|
|
7114
|
+
kind: 'edge',
|
|
7115
|
+
});
|
|
7116
|
+
this._onWillDrop.fire(willDropEvent);
|
|
7117
|
+
if (willDropEvent.defaultPrevented) {
|
|
7118
|
+
return;
|
|
7119
|
+
}
|
|
6705
7120
|
const data = getPanelData();
|
|
6706
7121
|
if (data) {
|
|
6707
|
-
this.moveGroupOrPanel(
|
|
7122
|
+
this.moveGroupOrPanel({
|
|
7123
|
+
from: {
|
|
7124
|
+
groupId: data.groupId,
|
|
7125
|
+
panelId: (_a = data.panelId) !== null && _a !== void 0 ? _a : undefined,
|
|
7126
|
+
},
|
|
7127
|
+
to: {
|
|
7128
|
+
group: this.orthogonalize(event.position),
|
|
7129
|
+
position: 'center',
|
|
7130
|
+
},
|
|
7131
|
+
});
|
|
6708
7132
|
}
|
|
6709
7133
|
else {
|
|
6710
|
-
this._onDidDrop.fire(
|
|
7134
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
7135
|
+
nativeEvent: event.nativeEvent,
|
|
7136
|
+
position: event.position,
|
|
7137
|
+
panel: undefined,
|
|
7138
|
+
api: this._api,
|
|
7139
|
+
group: undefined,
|
|
7140
|
+
getData: getPanelData,
|
|
7141
|
+
}));
|
|
6711
7142
|
}
|
|
6712
7143
|
}), this._rootDropTarget);
|
|
6713
7144
|
this._api = new DockviewApi(this);
|
|
6714
7145
|
this.updateWatermark();
|
|
6715
7146
|
}
|
|
6716
|
-
addPopoutGroup(
|
|
6717
|
-
var _a;
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
7147
|
+
addPopoutGroup(itemToPopout, options) {
|
|
7148
|
+
var _a, _b, _c;
|
|
7149
|
+
if (itemToPopout instanceof DockviewPanel &&
|
|
7150
|
+
itemToPopout.group.size === 1) {
|
|
7151
|
+
return this.addPopoutGroup(itemToPopout.group);
|
|
7152
|
+
}
|
|
7153
|
+
const theme = getDockviewTheme(this.gridview.element);
|
|
7154
|
+
const element = this.element;
|
|
7155
|
+
function getBox() {
|
|
7156
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7157
|
+
return options.position;
|
|
7158
|
+
}
|
|
7159
|
+
if (itemToPopout instanceof DockviewGroupPanel) {
|
|
7160
|
+
return itemToPopout.element.getBoundingClientRect();
|
|
7161
|
+
}
|
|
7162
|
+
if (itemToPopout.group) {
|
|
7163
|
+
return itemToPopout.group.element.getBoundingClientRect();
|
|
7164
|
+
}
|
|
7165
|
+
return element.getBoundingClientRect();
|
|
7166
|
+
}
|
|
7167
|
+
const box = getBox();
|
|
7168
|
+
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;
|
|
7169
|
+
if (itemToPopout.api.location.type === 'grid') {
|
|
7170
|
+
itemToPopout.api.setVisible(false);
|
|
7171
|
+
}
|
|
7172
|
+
const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
|
|
7173
|
+
theme !== null && theme !== void 0 ? theme : '', {
|
|
7174
|
+
url: (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : '/popout.html',
|
|
7175
|
+
left: window.screenX + box.left,
|
|
7176
|
+
top: window.screenY + box.top,
|
|
7177
|
+
width: box.width,
|
|
7178
|
+
height: box.height,
|
|
7179
|
+
onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,
|
|
7180
|
+
onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,
|
|
7181
|
+
});
|
|
7182
|
+
const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {
|
|
7183
|
+
popoutWindowDisposable.dispose();
|
|
7184
|
+
}));
|
|
7185
|
+
return _window
|
|
7186
|
+
.open()
|
|
7187
|
+
.then((popoutContainer) => {
|
|
7188
|
+
var _a;
|
|
7189
|
+
if (_window.isDisposed) {
|
|
7190
|
+
return;
|
|
6729
7191
|
}
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
if (!box) {
|
|
6734
|
-
box = group.element.getBoundingClientRect();
|
|
7192
|
+
if (popoutContainer === null) {
|
|
7193
|
+
popoutWindowDisposable.dispose();
|
|
7194
|
+
return;
|
|
6735
7195
|
}
|
|
6736
|
-
const
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
7196
|
+
const gready = document.createElement('div');
|
|
7197
|
+
gready.className = 'dv-overlay-render-container';
|
|
7198
|
+
const overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7199
|
+
const referenceGroup = itemToPopout instanceof DockviewPanel
|
|
7200
|
+
? itemToPopout.group
|
|
7201
|
+
: itemToPopout;
|
|
7202
|
+
const referenceLocation = itemToPopout.api.location.type;
|
|
7203
|
+
const group = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) !== null && _a !== void 0 ? _a : this.createGroup({ id: groupId });
|
|
7204
|
+
group.model.renderContainer = overlayRenderContainer;
|
|
7205
|
+
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup)) {
|
|
7206
|
+
this._onDidAddGroup.fire(group);
|
|
7207
|
+
}
|
|
7208
|
+
if (itemToPopout instanceof DockviewPanel) {
|
|
7209
|
+
this.movingLock(() => {
|
|
7210
|
+
const panel = referenceGroup.model.removePanel(itemToPopout);
|
|
7211
|
+
group.model.openPanel(panel);
|
|
7212
|
+
});
|
|
7213
|
+
}
|
|
7214
|
+
else {
|
|
7215
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7216
|
+
from: referenceGroup,
|
|
7217
|
+
to: group,
|
|
7218
|
+
}));
|
|
7219
|
+
switch (referenceLocation) {
|
|
7220
|
+
case 'grid':
|
|
7221
|
+
referenceGroup.api.setVisible(false);
|
|
7222
|
+
break;
|
|
7223
|
+
case 'floating':
|
|
7224
|
+
case 'popout':
|
|
7225
|
+
this.removeGroup(referenceGroup);
|
|
7226
|
+
break;
|
|
7227
|
+
}
|
|
7228
|
+
}
|
|
7229
|
+
popoutContainer.classList.add('dv-dockview');
|
|
7230
|
+
popoutContainer.style.overflow = 'hidden';
|
|
7231
|
+
popoutContainer.appendChild(gready);
|
|
7232
|
+
popoutContainer.appendChild(group.element);
|
|
7233
|
+
group.model.location = {
|
|
7234
|
+
type: 'popout',
|
|
7235
|
+
getWindow: () => _window.window,
|
|
7236
|
+
};
|
|
7237
|
+
this.doSetGroupAndPanelActive(group);
|
|
7238
|
+
popoutWindowDisposable.addDisposables(group.api.onDidActiveChange((event) => {
|
|
7239
|
+
var _a;
|
|
7240
|
+
if (event.isActive) {
|
|
7241
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7242
|
+
}
|
|
7243
|
+
}), group.api.onWillFocus(() => {
|
|
7244
|
+
var _a;
|
|
7245
|
+
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
7246
|
+
}));
|
|
7247
|
+
let returnedGroup;
|
|
7248
|
+
const value = {
|
|
7249
|
+
window: _window,
|
|
7250
|
+
popoutGroup: group,
|
|
7251
|
+
referenceGroup: this.getPanel(referenceGroup.id)
|
|
7252
|
+
? referenceGroup.id
|
|
7253
|
+
: undefined,
|
|
7254
|
+
disposable: {
|
|
7255
|
+
dispose: () => {
|
|
7256
|
+
popoutWindowDisposable.dispose();
|
|
7257
|
+
return returnedGroup;
|
|
7258
|
+
},
|
|
7259
|
+
},
|
|
7260
|
+
};
|
|
7261
|
+
popoutWindowDisposable.addDisposables(
|
|
7262
|
+
/**
|
|
7263
|
+
* ResizeObserver seems slow here, I do not know why but we don't need it
|
|
7264
|
+
* since we can reply on the window resize event as we will occupy the full
|
|
7265
|
+
* window dimensions
|
|
7266
|
+
*/
|
|
7267
|
+
addDisposableWindowListener(_window.window, 'resize', () => {
|
|
7268
|
+
group.layout(window.innerWidth, window.innerHeight);
|
|
7269
|
+
}), overlayRenderContainer, Disposable.from(() => {
|
|
7270
|
+
if (this.getPanel(referenceGroup.id)) {
|
|
7271
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7272
|
+
from: group,
|
|
7273
|
+
to: referenceGroup,
|
|
7274
|
+
}));
|
|
7275
|
+
if (!referenceGroup.api.isVisible) {
|
|
7276
|
+
referenceGroup.api.setVisible(true);
|
|
7277
|
+
}
|
|
7278
|
+
if (this.getPanel(group.id)) {
|
|
7279
|
+
this.doRemoveGroup(group, {
|
|
7280
|
+
skipPopoutAssociated: true,
|
|
7281
|
+
});
|
|
7282
|
+
}
|
|
7283
|
+
}
|
|
7284
|
+
else {
|
|
7285
|
+
if (this.getPanel(group.id)) {
|
|
7286
|
+
const removedGroup = this.doRemoveGroup(group, {
|
|
7287
|
+
skipDispose: true,
|
|
7288
|
+
skipActive: true,
|
|
7289
|
+
});
|
|
7290
|
+
removedGroup.model.renderContainer =
|
|
7291
|
+
this.overlayRenderContainer;
|
|
7292
|
+
removedGroup.model.location = { type: 'grid' };
|
|
7293
|
+
returnedGroup = removedGroup;
|
|
7294
|
+
}
|
|
7295
|
+
}
|
|
7296
|
+
}));
|
|
7297
|
+
this._popoutGroups.push(value);
|
|
7298
|
+
this.updateWatermark();
|
|
7299
|
+
})
|
|
7300
|
+
.catch((err) => {
|
|
7301
|
+
console.error(err);
|
|
6753
7302
|
});
|
|
6754
|
-
popoutWindow.addDisposables({
|
|
6755
|
-
dispose: () => {
|
|
6756
|
-
remove(this._popoutGroups, popoutWindow);
|
|
6757
|
-
this.updateWatermark();
|
|
6758
|
-
},
|
|
6759
|
-
}, popoutWindow.window.onDidClose(() => {
|
|
6760
|
-
this.doAddGroup(group, [0]);
|
|
6761
|
-
}));
|
|
6762
|
-
this._popoutGroups.push(popoutWindow);
|
|
6763
|
-
this.updateWatermark();
|
|
6764
7303
|
}
|
|
6765
7304
|
addFloatingGroup(item, coord, options) {
|
|
6766
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7305
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6767
7306
|
let group;
|
|
6768
7307
|
if (item instanceof DockviewPanel) {
|
|
6769
7308
|
group = this.createGroup();
|
|
6770
|
-
this.
|
|
7309
|
+
this._onDidAddGroup.fire(group);
|
|
7310
|
+
this.movingLock(() => this.removePanel(item, {
|
|
6771
7311
|
removeEmptyGroup: true,
|
|
6772
7312
|
skipDispose: true,
|
|
6773
|
-
|
|
6774
|
-
|
|
7313
|
+
skipSetActiveGroup: true,
|
|
7314
|
+
}));
|
|
7315
|
+
group.model.openPanel(item, { skipSetGroupActive: true });
|
|
6775
7316
|
}
|
|
6776
7317
|
else {
|
|
6777
7318
|
group = item;
|
|
7319
|
+
const popoutReferenceGroupId = (_a = this._popoutGroups.find((_) => _.popoutGroup === group)) === null || _a === void 0 ? void 0 : _a.referenceGroup;
|
|
7320
|
+
const popoutReferenceGroup = popoutReferenceGroupId
|
|
7321
|
+
? this.getPanel(popoutReferenceGroupId)
|
|
7322
|
+
: undefined;
|
|
6778
7323
|
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
6779
7324
|
options.skipRemoveGroup;
|
|
6780
7325
|
if (!skip) {
|
|
6781
|
-
|
|
7326
|
+
if (popoutReferenceGroup) {
|
|
7327
|
+
this.movingLock(() => moveGroupWithoutDestroying({
|
|
7328
|
+
from: item,
|
|
7329
|
+
to: popoutReferenceGroup,
|
|
7330
|
+
}));
|
|
7331
|
+
this.doRemoveGroup(item, {
|
|
7332
|
+
skipPopoutReturn: true,
|
|
7333
|
+
skipPopoutAssociated: true,
|
|
7334
|
+
});
|
|
7335
|
+
this.doRemoveGroup(popoutReferenceGroup, {
|
|
7336
|
+
skipDispose: true,
|
|
7337
|
+
});
|
|
7338
|
+
group = popoutReferenceGroup;
|
|
7339
|
+
}
|
|
7340
|
+
else {
|
|
7341
|
+
this.doRemoveGroup(item, {
|
|
7342
|
+
skipDispose: true,
|
|
7343
|
+
skipPopoutReturn: true,
|
|
7344
|
+
skipPopoutAssociated: !!popoutReferenceGroup,
|
|
7345
|
+
});
|
|
7346
|
+
}
|
|
6782
7347
|
}
|
|
6783
7348
|
}
|
|
6784
|
-
group.model.location = 'floating';
|
|
7349
|
+
group.model.location = { type: 'floating' };
|
|
6785
7350
|
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6786
7351
|
? Math.max(coord.x, 0)
|
|
6787
7352
|
: DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
@@ -6791,16 +7356,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6791
7356
|
const overlay = new Overlay({
|
|
6792
7357
|
container: this.gridview.element,
|
|
6793
7358
|
content: group.element,
|
|
6794
|
-
height: (
|
|
6795
|
-
width: (
|
|
7359
|
+
height: (_b = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _b !== void 0 ? _b : 300,
|
|
7360
|
+
width: (_c = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _c !== void 0 ? _c : 300,
|
|
6796
7361
|
left: overlayLeft,
|
|
6797
7362
|
top: overlayTop,
|
|
6798
7363
|
minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6799
7364
|
? undefined
|
|
6800
|
-
: (
|
|
7365
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumWidthWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6801
7366
|
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
6802
7367
|
? undefined
|
|
6803
|
-
: (
|
|
7368
|
+
: (_g = (_f = this.options.floatingGroupBounds) === null || _f === void 0 ? void 0 : _f.minimumHeightWithinViewport) !== null && _g !== void 0 ? _g : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
6804
7369
|
});
|
|
6805
7370
|
const el = group.element.querySelector('.void-container');
|
|
6806
7371
|
if (!el) {
|
|
@@ -6831,12 +7396,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6831
7396
|
}), {
|
|
6832
7397
|
dispose: () => {
|
|
6833
7398
|
disposable.dispose();
|
|
6834
|
-
group.model.location = 'grid';
|
|
7399
|
+
group.model.location = { type: 'grid' };
|
|
6835
7400
|
remove(this._floatingGroups, floatingGroupPanel);
|
|
6836
7401
|
this.updateWatermark();
|
|
6837
7402
|
},
|
|
6838
7403
|
});
|
|
6839
7404
|
this._floatingGroups.push(floatingGroupPanel);
|
|
7405
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {
|
|
7406
|
+
this.doSetGroupAndPanelActive(group);
|
|
7407
|
+
}
|
|
6840
7408
|
this.updateWatermark();
|
|
6841
7409
|
}
|
|
6842
7410
|
orthogonalize(position) {
|
|
@@ -6926,8 +7494,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6926
7494
|
return this.panels.find((panel) => panel.id === id);
|
|
6927
7495
|
}
|
|
6928
7496
|
setActivePanel(panel) {
|
|
6929
|
-
this.doSetGroupActive(panel.group);
|
|
6930
7497
|
panel.group.model.openPanel(panel);
|
|
7498
|
+
this.doSetGroupAndPanelActive(panel.group);
|
|
6931
7499
|
}
|
|
6932
7500
|
moveToNext(options = {}) {
|
|
6933
7501
|
var _a;
|
|
@@ -6988,7 +7556,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6988
7556
|
});
|
|
6989
7557
|
const popoutGroups = this._popoutGroups.map((group) => {
|
|
6990
7558
|
return {
|
|
6991
|
-
data: group.
|
|
7559
|
+
data: group.popoutGroup.toJSON(),
|
|
7560
|
+
gridReferenceGroup: group.referenceGroup,
|
|
6992
7561
|
position: group.window.dimensions(),
|
|
6993
7562
|
};
|
|
6994
7563
|
});
|
|
@@ -7006,7 +7575,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7006
7575
|
return result;
|
|
7007
7576
|
}
|
|
7008
7577
|
fromJSON(data) {
|
|
7009
|
-
var _a, _b;
|
|
7578
|
+
var _a, _b, _c;
|
|
7010
7579
|
this.clear();
|
|
7011
7580
|
if (typeof data !== 'object' || data === null) {
|
|
7012
7581
|
throw new Error('serialized layout must be a non-null object');
|
|
@@ -7045,7 +7614,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7045
7614
|
const isActive = typeof activeView === 'string' &&
|
|
7046
7615
|
activeView === panel.id;
|
|
7047
7616
|
group.model.openPanel(panel, {
|
|
7048
|
-
|
|
7617
|
+
skipSetActive: !isActive,
|
|
7049
7618
|
skipSetGroupActive: true,
|
|
7050
7619
|
});
|
|
7051
7620
|
}
|
|
@@ -7075,11 +7644,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7075
7644
|
}
|
|
7076
7645
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7077
7646
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
7078
|
-
const { data, position } = serializedPopoutGroup;
|
|
7647
|
+
const { data, position, gridReferenceGroup } = serializedPopoutGroup;
|
|
7079
7648
|
const group = createGroupFromSerializedState(data);
|
|
7080
|
-
this.addPopoutGroup(
|
|
7649
|
+
this.addPopoutGroup((_c = (gridReferenceGroup
|
|
7650
|
+
? this.getPanel(gridReferenceGroup)
|
|
7651
|
+
: undefined)) !== null && _c !== void 0 ? _c : group, {
|
|
7081
7652
|
skipRemoveGroup: true,
|
|
7082
7653
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
7654
|
+
overridePopoutGroup: gridReferenceGroup
|
|
7655
|
+
? group
|
|
7656
|
+
: undefined,
|
|
7083
7657
|
});
|
|
7084
7658
|
}
|
|
7085
7659
|
for (const floatingGroup of this._floatingGroups) {
|
|
@@ -7126,12 +7700,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7126
7700
|
*/
|
|
7127
7701
|
throw err;
|
|
7128
7702
|
}
|
|
7703
|
+
this.updateWatermark();
|
|
7129
7704
|
this._onDidLayoutFromJSON.fire();
|
|
7130
7705
|
}
|
|
7131
7706
|
clear() {
|
|
7132
7707
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
7133
7708
|
const hasActiveGroup = !!this.activeGroup;
|
|
7134
|
-
|
|
7709
|
+
!!this.activePanel;
|
|
7135
7710
|
for (const group of groups) {
|
|
7136
7711
|
// remove the group will automatically remove the panels
|
|
7137
7712
|
this.removeGroup(group, { skipActive: true });
|
|
@@ -7139,9 +7714,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7139
7714
|
if (hasActiveGroup) {
|
|
7140
7715
|
this.doSetGroupAndPanelActive(undefined);
|
|
7141
7716
|
}
|
|
7142
|
-
if (hasActivePanel) {
|
|
7143
|
-
this._onDidActivePanelChange.fire(undefined);
|
|
7144
|
-
}
|
|
7145
7717
|
this.gridview.clear();
|
|
7146
7718
|
}
|
|
7147
7719
|
closeAllGroups() {
|
|
@@ -7182,6 +7754,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7182
7754
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
7183
7755
|
const panel = this.createPanel(options, group);
|
|
7184
7756
|
group.model.openPanel(panel);
|
|
7757
|
+
this.doSetGroupAndPanelActive(group);
|
|
7185
7758
|
return panel;
|
|
7186
7759
|
}
|
|
7187
7760
|
}
|
|
@@ -7193,6 +7766,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7193
7766
|
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
7194
7767
|
if (options.floating) {
|
|
7195
7768
|
const group = this.createGroup();
|
|
7769
|
+
this._onDidAddGroup.fire(group);
|
|
7196
7770
|
const o = typeof options.floating === 'object' &&
|
|
7197
7771
|
options.floating !== null
|
|
7198
7772
|
? options.floating
|
|
@@ -7200,16 +7774,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7200
7774
|
this.addFloatingGroup(group, o, {
|
|
7201
7775
|
inDragMode: false,
|
|
7202
7776
|
skipRemoveGroup: true,
|
|
7777
|
+
skipActiveGroup: true,
|
|
7203
7778
|
});
|
|
7204
|
-
this._onDidAddGroup.fire(group);
|
|
7205
7779
|
panel = this.createPanel(options, group);
|
|
7206
7780
|
group.model.openPanel(panel);
|
|
7207
|
-
this.doSetGroupAndPanelActive(group);
|
|
7208
7781
|
}
|
|
7209
|
-
else if (referenceGroup.api.location === 'floating' ||
|
|
7782
|
+
else if (referenceGroup.api.location.type === 'floating' ||
|
|
7210
7783
|
target === 'center') {
|
|
7211
7784
|
panel = this.createPanel(options, referenceGroup);
|
|
7212
7785
|
referenceGroup.model.openPanel(panel);
|
|
7786
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
7213
7787
|
}
|
|
7214
7788
|
else {
|
|
7215
7789
|
const location = getGridLocation(referenceGroup.element);
|
|
@@ -7217,10 +7791,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7217
7791
|
const group = this.createGroupAtLocation(relativeLocation);
|
|
7218
7792
|
panel = this.createPanel(options, group);
|
|
7219
7793
|
group.model.openPanel(panel);
|
|
7794
|
+
this.doSetGroupAndPanelActive(group);
|
|
7220
7795
|
}
|
|
7221
7796
|
}
|
|
7222
7797
|
else if (options.floating) {
|
|
7223
7798
|
const group = this.createGroup();
|
|
7799
|
+
this._onDidAddGroup.fire(group);
|
|
7224
7800
|
const o = typeof options.floating === 'object' &&
|
|
7225
7801
|
options.floating !== null
|
|
7226
7802
|
? options.floating
|
|
@@ -7228,16 +7804,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7228
7804
|
this.addFloatingGroup(group, o, {
|
|
7229
7805
|
inDragMode: false,
|
|
7230
7806
|
skipRemoveGroup: true,
|
|
7807
|
+
skipActiveGroup: true,
|
|
7231
7808
|
});
|
|
7232
|
-
this._onDidAddGroup.fire(group);
|
|
7233
7809
|
panel = this.createPanel(options, group);
|
|
7234
7810
|
group.model.openPanel(panel);
|
|
7235
|
-
this.doSetGroupAndPanelActive(group);
|
|
7236
7811
|
}
|
|
7237
7812
|
else {
|
|
7238
7813
|
const group = this.createGroupAtLocation();
|
|
7239
7814
|
panel = this.createPanel(options, group);
|
|
7240
7815
|
group.model.openPanel(panel);
|
|
7816
|
+
this.doSetGroupAndPanelActive(group);
|
|
7241
7817
|
}
|
|
7242
7818
|
return panel;
|
|
7243
7819
|
}
|
|
@@ -7249,13 +7825,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7249
7825
|
if (!group) {
|
|
7250
7826
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
7251
7827
|
}
|
|
7252
|
-
group.model.removePanel(panel
|
|
7828
|
+
group.model.removePanel(panel, {
|
|
7829
|
+
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
7830
|
+
});
|
|
7253
7831
|
if (!options.skipDispose) {
|
|
7254
|
-
|
|
7832
|
+
panel.group.model.renderContainer.detatch(panel);
|
|
7255
7833
|
panel.dispose();
|
|
7256
7834
|
}
|
|
7257
7835
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
7258
|
-
this.removeGroup(group);
|
|
7836
|
+
this.removeGroup(group, { skipActive: options.skipSetActiveGroup });
|
|
7259
7837
|
}
|
|
7260
7838
|
}
|
|
7261
7839
|
createWatermarkComponent() {
|
|
@@ -7268,7 +7846,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7268
7846
|
}
|
|
7269
7847
|
updateWatermark() {
|
|
7270
7848
|
var _a, _b;
|
|
7271
|
-
if (this.groups.filter((x) => x.api.location === 'grid').length === 0) {
|
|
7849
|
+
if (this.groups.filter((x) => x.api.location.type === 'grid' && x.api.isVisible).length === 0) {
|
|
7272
7850
|
if (!this.watermark) {
|
|
7273
7851
|
this.watermark = this.createWatermarkComponent();
|
|
7274
7852
|
this.watermark.init({
|
|
@@ -7314,36 +7892,42 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7314
7892
|
}
|
|
7315
7893
|
else {
|
|
7316
7894
|
const group = this.orthogonalize(directionToPosition(options.direction));
|
|
7895
|
+
if (!options.skipSetActive) {
|
|
7896
|
+
this.doSetGroupAndPanelActive(group);
|
|
7897
|
+
}
|
|
7317
7898
|
return group;
|
|
7318
7899
|
}
|
|
7319
7900
|
const target = toTarget(options.direction || 'within');
|
|
7320
7901
|
const location = getGridLocation(referenceGroup.element);
|
|
7321
7902
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7322
7903
|
this.doAddGroup(group, relativeLocation);
|
|
7904
|
+
if (!options.skipSetActive) {
|
|
7905
|
+
this.doSetGroupAndPanelActive(group);
|
|
7906
|
+
}
|
|
7323
7907
|
return group;
|
|
7324
7908
|
}
|
|
7325
7909
|
else {
|
|
7326
7910
|
this.doAddGroup(group);
|
|
7911
|
+
this.doSetGroupAndPanelActive(group);
|
|
7327
7912
|
return group;
|
|
7328
7913
|
}
|
|
7329
7914
|
}
|
|
7330
7915
|
removeGroup(group, options) {
|
|
7916
|
+
this.doRemoveGroup(group, options);
|
|
7917
|
+
}
|
|
7918
|
+
doRemoveGroup(group, options) {
|
|
7331
7919
|
var _a;
|
|
7332
7920
|
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7921
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7922
|
+
for (const panel of panels) {
|
|
7923
|
+
this.removePanel(panel, {
|
|
7924
|
+
removeEmptyGroup: false,
|
|
7925
|
+
skipDispose: (_a = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _a !== void 0 ? _a : false,
|
|
7926
|
+
});
|
|
7927
|
+
}
|
|
7338
7928
|
}
|
|
7339
7929
|
const activePanel = this.activePanel;
|
|
7340
|
-
|
|
7341
|
-
if (this.activePanel !== activePanel) {
|
|
7342
|
-
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7343
|
-
}
|
|
7344
|
-
}
|
|
7345
|
-
doRemoveGroup(group, options) {
|
|
7346
|
-
if (group.api.location === 'floating') {
|
|
7930
|
+
if (group.api.location.type === 'floating') {
|
|
7347
7931
|
const floatingGroup = this._floatingGroups.find((_) => _.group === group);
|
|
7348
7932
|
if (floatingGroup) {
|
|
7349
7933
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
@@ -7355,60 +7939,124 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7355
7939
|
floatingGroup.dispose();
|
|
7356
7940
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7357
7941
|
const groups = Array.from(this._groups.values());
|
|
7358
|
-
this.
|
|
7942
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7359
7943
|
}
|
|
7360
7944
|
return floatingGroup.group;
|
|
7361
7945
|
}
|
|
7362
7946
|
throw new Error('failed to find floating group');
|
|
7363
7947
|
}
|
|
7364
|
-
if (group.api.location === 'popout') {
|
|
7365
|
-
const selectedGroup = this._popoutGroups.find((_) => _.
|
|
7948
|
+
if (group.api.location.type === 'popout') {
|
|
7949
|
+
const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
|
|
7366
7950
|
if (selectedGroup) {
|
|
7367
7951
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7368
|
-
|
|
7952
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutAssociated)) {
|
|
7953
|
+
const refGroup = selectedGroup.referenceGroup
|
|
7954
|
+
? this.getPanel(selectedGroup.referenceGroup)
|
|
7955
|
+
: undefined;
|
|
7956
|
+
if (refGroup) {
|
|
7957
|
+
this.removeGroup(refGroup);
|
|
7958
|
+
}
|
|
7959
|
+
}
|
|
7960
|
+
selectedGroup.popoutGroup.dispose();
|
|
7369
7961
|
this._groups.delete(group.id);
|
|
7370
7962
|
this._onDidRemoveGroup.fire(group);
|
|
7371
7963
|
}
|
|
7372
|
-
selectedGroup.dispose();
|
|
7964
|
+
const removedGroup = selectedGroup.disposable.dispose();
|
|
7965
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {
|
|
7966
|
+
this.doAddGroup(removedGroup, [0]);
|
|
7967
|
+
this.doSetGroupAndPanelActive(removedGroup);
|
|
7968
|
+
}
|
|
7373
7969
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7374
7970
|
const groups = Array.from(this._groups.values());
|
|
7375
|
-
this.
|
|
7971
|
+
this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7376
7972
|
}
|
|
7377
|
-
|
|
7973
|
+
this.updateWatermark();
|
|
7974
|
+
return selectedGroup.popoutGroup;
|
|
7378
7975
|
}
|
|
7379
7976
|
throw new Error('failed to find popout group');
|
|
7380
7977
|
}
|
|
7381
|
-
|
|
7978
|
+
const re = super.doRemoveGroup(group, options);
|
|
7979
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
7980
|
+
if (this.activePanel !== activePanel) {
|
|
7981
|
+
this._onDidActivePanelChange.fire(this.activePanel);
|
|
7982
|
+
}
|
|
7983
|
+
}
|
|
7984
|
+
return re;
|
|
7382
7985
|
}
|
|
7383
|
-
|
|
7384
|
-
|
|
7986
|
+
movingLock(func) {
|
|
7987
|
+
const isMoving = this._moving;
|
|
7988
|
+
try {
|
|
7989
|
+
this._moving = true;
|
|
7990
|
+
return func();
|
|
7991
|
+
}
|
|
7992
|
+
finally {
|
|
7993
|
+
this._moving = isMoving;
|
|
7994
|
+
}
|
|
7995
|
+
}
|
|
7996
|
+
moveGroupOrPanel(options) {
|
|
7997
|
+
var _a;
|
|
7998
|
+
const destinationGroup = options.to.group;
|
|
7999
|
+
const sourceGroupId = options.from.groupId;
|
|
8000
|
+
const sourceItemId = options.from.panelId;
|
|
8001
|
+
const destinationTarget = options.to.position;
|
|
8002
|
+
const destinationIndex = options.to.index;
|
|
7385
8003
|
const sourceGroup = sourceGroupId
|
|
7386
8004
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
7387
8005
|
: undefined;
|
|
8006
|
+
if (!sourceGroup) {
|
|
8007
|
+
throw new Error(`Failed to find group id ${sourceGroupId}`);
|
|
8008
|
+
}
|
|
7388
8009
|
if (sourceItemId === undefined) {
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
8010
|
+
/**
|
|
8011
|
+
* Moving an entire group into another group
|
|
8012
|
+
*/
|
|
8013
|
+
this.moveGroup({
|
|
8014
|
+
from: { group: sourceGroup },
|
|
8015
|
+
to: {
|
|
8016
|
+
group: destinationGroup,
|
|
8017
|
+
position: destinationTarget,
|
|
8018
|
+
},
|
|
8019
|
+
});
|
|
7392
8020
|
return;
|
|
7393
8021
|
}
|
|
7394
8022
|
if (!destinationTarget || destinationTarget === 'center') {
|
|
7395
|
-
|
|
7396
|
-
|
|
8023
|
+
/**
|
|
8024
|
+
* Dropping a panel within another group
|
|
8025
|
+
*/
|
|
8026
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8027
|
+
skipSetActive: false,
|
|
8028
|
+
skipSetActiveGroup: true,
|
|
8029
|
+
}));
|
|
8030
|
+
if (!removedPanel) {
|
|
7397
8031
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7398
8032
|
}
|
|
7399
|
-
if (
|
|
7400
|
-
|
|
8033
|
+
if (sourceGroup.model.size === 0) {
|
|
8034
|
+
// remove the group and do not set a new group as active
|
|
8035
|
+
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
7401
8036
|
}
|
|
7402
|
-
destinationGroup.model.openPanel(
|
|
8037
|
+
this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
|
|
7403
8038
|
index: destinationIndex,
|
|
8039
|
+
skipSetGroupActive: true,
|
|
8040
|
+
}));
|
|
8041
|
+
this.doSetGroupAndPanelActive(destinationGroup);
|
|
8042
|
+
this._onDidMovePanel.fire({
|
|
8043
|
+
panel: removedPanel,
|
|
7404
8044
|
});
|
|
7405
8045
|
}
|
|
7406
8046
|
else {
|
|
8047
|
+
/**
|
|
8048
|
+
* Dropping a panel to the extremities of a group which will place that panel
|
|
8049
|
+
* into an adjacent group
|
|
8050
|
+
*/
|
|
7407
8051
|
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
7408
8052
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7409
|
-
if (sourceGroup
|
|
8053
|
+
if (sourceGroup.size < 2) {
|
|
8054
|
+
/**
|
|
8055
|
+
* If we are moving from a group which only has one panel left we will consider
|
|
8056
|
+
* moving the group itself rather than moving the panel into a newly created group
|
|
8057
|
+
*/
|
|
7410
8058
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
7411
|
-
if (sourceGroup.api.location === 'grid') {
|
|
8059
|
+
if (sourceGroup.api.location.type === 'grid') {
|
|
7412
8060
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
7413
8061
|
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
7414
8062
|
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
@@ -7416,77 +8064,122 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7416
8064
|
// if a group has one tab - we are essentially moving the 'group'
|
|
7417
8065
|
// which is equivalent to swapping two views in this case
|
|
7418
8066
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8067
|
+
return;
|
|
7419
8068
|
}
|
|
7420
8069
|
}
|
|
7421
8070
|
// source group will become empty so delete the group
|
|
7422
|
-
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
8071
|
+
const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
|
|
7423
8072
|
skipActive: true,
|
|
7424
8073
|
skipDispose: true,
|
|
7425
|
-
});
|
|
8074
|
+
}));
|
|
7426
8075
|
// after deleting the group we need to re-evaulate the ref location
|
|
7427
8076
|
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
7428
8077
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
7429
|
-
this.doAddGroup(targetGroup, location);
|
|
8078
|
+
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8079
|
+
this.doSetGroupAndPanelActive(targetGroup);
|
|
7430
8080
|
}
|
|
7431
8081
|
else {
|
|
7432
|
-
|
|
7433
|
-
|
|
8082
|
+
/**
|
|
8083
|
+
* The group we are removing from has many panels, we need to remove the panels we are moving,
|
|
8084
|
+
* create a new group, add the panels to that new group and add the new group in an appropiate position
|
|
8085
|
+
*/
|
|
8086
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
8087
|
+
skipSetActive: false,
|
|
8088
|
+
skipSetActiveGroup: true,
|
|
8089
|
+
}));
|
|
8090
|
+
if (!removedPanel) {
|
|
7434
8091
|
throw new Error(`No panel with id ${sourceItemId}`);
|
|
7435
8092
|
}
|
|
7436
8093
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
7437
8094
|
const group = this.createGroupAtLocation(dropLocation);
|
|
7438
|
-
group.model.openPanel(
|
|
8095
|
+
this.movingLock(() => group.model.openPanel(removedPanel, {
|
|
8096
|
+
skipSetGroupActive: true,
|
|
8097
|
+
}));
|
|
8098
|
+
this.doSetGroupAndPanelActive(group);
|
|
7439
8099
|
}
|
|
7440
8100
|
}
|
|
7441
8101
|
}
|
|
7442
|
-
moveGroup(
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
8102
|
+
moveGroup(options) {
|
|
8103
|
+
const from = options.from.group;
|
|
8104
|
+
const to = options.to.group;
|
|
8105
|
+
const target = options.to.position;
|
|
8106
|
+
if (target === 'center') {
|
|
8107
|
+
const activePanel = from.activePanel;
|
|
8108
|
+
const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
|
|
8109
|
+
skipSetActive: true,
|
|
8110
|
+
})));
|
|
8111
|
+
if ((from === null || from === void 0 ? void 0 : from.model.size) === 0) {
|
|
8112
|
+
this.doRemoveGroup(from, { skipActive: true });
|
|
8113
|
+
}
|
|
8114
|
+
this.movingLock(() => {
|
|
7450
8115
|
for (const panel of panels) {
|
|
7451
|
-
|
|
7452
|
-
|
|
8116
|
+
to.model.openPanel(panel, {
|
|
8117
|
+
skipSetActive: panel !== activePanel,
|
|
8118
|
+
skipSetGroupActive: true,
|
|
7453
8119
|
});
|
|
7454
8120
|
}
|
|
7455
|
-
}
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
8121
|
+
});
|
|
8122
|
+
this.doSetGroupAndPanelActive(to);
|
|
8123
|
+
panels.forEach((panel) => {
|
|
8124
|
+
this._onDidMovePanel.fire({ panel });
|
|
8125
|
+
});
|
|
8126
|
+
}
|
|
8127
|
+
else {
|
|
8128
|
+
switch (from.api.location.type) {
|
|
8129
|
+
case 'grid':
|
|
8130
|
+
this.gridview.removeView(getGridLocation(from.element));
|
|
8131
|
+
break;
|
|
8132
|
+
case 'floating': {
|
|
8133
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
8134
|
+
if (!selectedFloatingGroup) {
|
|
8135
|
+
throw new Error('failed to find floating group');
|
|
7468
8136
|
}
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
8137
|
+
selectedFloatingGroup.dispose();
|
|
8138
|
+
break;
|
|
8139
|
+
}
|
|
8140
|
+
case 'popout': {
|
|
8141
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
8142
|
+
if (!selectedPopoutGroup) {
|
|
8143
|
+
throw new Error('failed to find popout group');
|
|
7475
8144
|
}
|
|
8145
|
+
selectedPopoutGroup.disposable.dispose();
|
|
7476
8146
|
}
|
|
7477
|
-
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
7478
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
7479
|
-
this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
|
|
7480
8147
|
}
|
|
8148
|
+
const referenceLocation = getGridLocation(to.element);
|
|
8149
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8150
|
+
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8151
|
+
from.panels.forEach((panel) => {
|
|
8152
|
+
this._onDidMovePanel.fire({ panel });
|
|
8153
|
+
});
|
|
7481
8154
|
}
|
|
7482
8155
|
}
|
|
7483
|
-
|
|
7484
|
-
|
|
8156
|
+
doSetGroupActive(group) {
|
|
8157
|
+
super.doSetGroupActive(group);
|
|
8158
|
+
const activePanel = this.activePanel;
|
|
8159
|
+
if (!this._moving &&
|
|
8160
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8161
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8162
|
+
}
|
|
8163
|
+
}
|
|
8164
|
+
doSetGroupAndPanelActive(group) {
|
|
8165
|
+
super.doSetGroupActive(group);
|
|
7485
8166
|
const activePanel = this.activePanel;
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
this.
|
|
8167
|
+
if (group &&
|
|
8168
|
+
this.hasMaximizedGroup() &&
|
|
8169
|
+
!this.isMaximizedGroup(group)) {
|
|
8170
|
+
this.exitMaximizedGroup();
|
|
8171
|
+
}
|
|
8172
|
+
if (!this._moving &&
|
|
8173
|
+
activePanel !== this._onDidActivePanelChange.value) {
|
|
8174
|
+
this._onDidActivePanelChange.fire(activePanel);
|
|
8175
|
+
}
|
|
8176
|
+
}
|
|
8177
|
+
getNextGroupId() {
|
|
8178
|
+
let id = this.nextGroupId.next();
|
|
8179
|
+
while (this._groups.has(id)) {
|
|
8180
|
+
id = this.nextGroupId.next();
|
|
7489
8181
|
}
|
|
8182
|
+
return id;
|
|
7490
8183
|
}
|
|
7491
8184
|
createGroup(options) {
|
|
7492
8185
|
if (!options) {
|
|
@@ -7504,7 +8197,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7504
8197
|
}
|
|
7505
8198
|
}
|
|
7506
8199
|
const view = new DockviewGroupPanel(this, id, options);
|
|
7507
|
-
view.init({ params: {}, accessor:
|
|
8200
|
+
view.init({ params: {}, accessor: this });
|
|
7508
8201
|
if (!this._groups.has(view.id)) {
|
|
7509
8202
|
const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {
|
|
7510
8203
|
this._onWillDragPanel.fire(event);
|
|
@@ -7512,20 +8205,48 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7512
8205
|
this._onWillDragGroup.fire(event);
|
|
7513
8206
|
}), view.model.onMove((event) => {
|
|
7514
8207
|
const { groupId, itemId, target, index } = event;
|
|
7515
|
-
this.moveGroupOrPanel(
|
|
8208
|
+
this.moveGroupOrPanel({
|
|
8209
|
+
from: { groupId: groupId, panelId: itemId },
|
|
8210
|
+
to: {
|
|
8211
|
+
group: view,
|
|
8212
|
+
position: target,
|
|
8213
|
+
index,
|
|
8214
|
+
},
|
|
8215
|
+
});
|
|
7516
8216
|
}), view.model.onDidDrop((event) => {
|
|
7517
|
-
this._onDidDrop.fire(
|
|
8217
|
+
this._onDidDrop.fire(event);
|
|
8218
|
+
}), view.model.onWillDrop((event) => {
|
|
8219
|
+
this._onWillDrop.fire(event);
|
|
8220
|
+
}), view.model.onWillShowOverlay((event) => {
|
|
8221
|
+
if (this.options.disableDnd) {
|
|
8222
|
+
event.preventDefault();
|
|
8223
|
+
return;
|
|
8224
|
+
}
|
|
8225
|
+
this._onWillShowOverlay.fire(event);
|
|
7518
8226
|
}), view.model.onDidAddPanel((event) => {
|
|
8227
|
+
if (this._moving) {
|
|
8228
|
+
return;
|
|
8229
|
+
}
|
|
7519
8230
|
this._onDidAddPanel.fire(event.panel);
|
|
7520
8231
|
}), view.model.onDidRemovePanel((event) => {
|
|
8232
|
+
if (this._moving) {
|
|
8233
|
+
return;
|
|
8234
|
+
}
|
|
7521
8235
|
this._onDidRemovePanel.fire(event.panel);
|
|
7522
8236
|
}), view.model.onDidActivePanelChange((event) => {
|
|
7523
|
-
this.
|
|
8237
|
+
if (this._moving) {
|
|
8238
|
+
return;
|
|
8239
|
+
}
|
|
8240
|
+
if (event.panel !== this.activePanel) {
|
|
8241
|
+
return;
|
|
8242
|
+
}
|
|
8243
|
+
if (this._onDidActivePanelChange.value !== event.panel) {
|
|
8244
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
8245
|
+
}
|
|
7524
8246
|
}));
|
|
7525
8247
|
this._groups.set(view.id, { value: view, disposable });
|
|
7526
8248
|
}
|
|
7527
|
-
// TODO: must be called after the above listeners have been setup,
|
|
7528
|
-
// not an ideal pattern
|
|
8249
|
+
// TODO: must be called after the above listeners have been setup, not an ideal pattern
|
|
7529
8250
|
view.initialize();
|
|
7530
8251
|
return view;
|
|
7531
8252
|
}
|
|
@@ -7578,7 +8299,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7578
8299
|
});
|
|
7579
8300
|
this._onDidLayoutfromJSON = new Emitter();
|
|
7580
8301
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
8302
|
+
this._onDidRemoveGroup = new Emitter();
|
|
8303
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
8304
|
+
this._onDidAddGroup = new Emitter();
|
|
8305
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
8306
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
8307
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
7581
8308
|
this._options = options;
|
|
8309
|
+
this.addDisposables(this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
|
|
8310
|
+
this._onDidAddGroup.fire(event);
|
|
8311
|
+
}), this.onDidRemove((event) => {
|
|
8312
|
+
this._onDidRemoveGroup.fire(event);
|
|
8313
|
+
}), this.onDidActiveChange((event) => {
|
|
8314
|
+
this._onDidActiveGroupChange.fire(event);
|
|
8315
|
+
}));
|
|
7582
8316
|
if (!this.options.components) {
|
|
7583
8317
|
this.options.components = {};
|
|
7584
8318
|
}
|
|
@@ -7753,6 +8487,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7753
8487
|
});
|
|
7754
8488
|
this.registerPanel(view);
|
|
7755
8489
|
this.doAddGroup(view, relativeLocation, options.size);
|
|
8490
|
+
this.doSetGroupActive(view);
|
|
7756
8491
|
return view;
|
|
7757
8492
|
}
|
|
7758
8493
|
registerPanel(panel) {
|
|
@@ -7894,19 +8629,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7894
8629
|
const index = this.panels.indexOf(panel);
|
|
7895
8630
|
this.splitview.setViewVisible(index, visible);
|
|
7896
8631
|
}
|
|
7897
|
-
setActive(
|
|
7898
|
-
this._activePanel =
|
|
8632
|
+
setActive(panel, skipFocus) {
|
|
8633
|
+
this._activePanel = panel;
|
|
7899
8634
|
this.panels
|
|
7900
|
-
.filter((v) => v !==
|
|
8635
|
+
.filter((v) => v !== panel)
|
|
7901
8636
|
.forEach((v) => {
|
|
7902
8637
|
v.api._onDidActiveChange.fire({ isActive: false });
|
|
7903
8638
|
if (!skipFocus) {
|
|
7904
8639
|
v.focus();
|
|
7905
8640
|
}
|
|
7906
8641
|
});
|
|
7907
|
-
|
|
8642
|
+
panel.api._onDidActiveChange.fire({ isActive: true });
|
|
7908
8643
|
if (!skipFocus) {
|
|
7909
|
-
|
|
8644
|
+
panel.focus();
|
|
7910
8645
|
}
|
|
7911
8646
|
}
|
|
7912
8647
|
removePanel(panel, sizing) {
|
|
@@ -8205,6 +8940,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8205
8940
|
});
|
|
8206
8941
|
this.addDisposables(this._disposable);
|
|
8207
8942
|
}
|
|
8943
|
+
setVisible(panel, visible) {
|
|
8944
|
+
const index = this.panels.indexOf(panel);
|
|
8945
|
+
this.paneview.setViewVisible(index, visible);
|
|
8946
|
+
}
|
|
8208
8947
|
focus() {
|
|
8209
8948
|
//noop
|
|
8210
8949
|
}
|
|
@@ -8251,6 +8990,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8251
8990
|
isExpanded: options.isExpanded,
|
|
8252
8991
|
title: options.title,
|
|
8253
8992
|
containerApi: new PaneviewApi(this),
|
|
8993
|
+
accessor: this,
|
|
8254
8994
|
});
|
|
8255
8995
|
this.paneview.addPane(view, size, index);
|
|
8256
8996
|
view.orientation = this.paneview.orientation;
|
|
@@ -8350,6 +9090,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8350
9090
|
title: data.title,
|
|
8351
9091
|
isExpanded: !!view.expanded,
|
|
8352
9092
|
containerApi: new PaneviewApi(this),
|
|
9093
|
+
accessor: this,
|
|
8353
9094
|
});
|
|
8354
9095
|
panel.orientation = this.paneview.orientation;
|
|
8355
9096
|
});
|
|
@@ -8438,7 +9179,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8438
9179
|
this._onDidChange = new Emitter();
|
|
8439
9180
|
this.onDidChange = this._onDidChange.event;
|
|
8440
9181
|
this.api.initialize(this);
|
|
8441
|
-
this.addDisposables(this._onDidChange, this.api.
|
|
9182
|
+
this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => {
|
|
8442
9183
|
const { isVisible } = event;
|
|
8443
9184
|
const { accessor } = this._params;
|
|
8444
9185
|
accessor.setVisible(this, isVisible);
|
|
@@ -8563,13 +9304,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8563
9304
|
if (this.disposed) {
|
|
8564
9305
|
throw new Error('invalid operation: resource is already disposed');
|
|
8565
9306
|
}
|
|
8566
|
-
if (
|
|
9307
|
+
if (!isReactComponent(this.component)) {
|
|
8567
9308
|
/**
|
|
8568
9309
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
8569
|
-
* if we do not intercept
|
|
8570
|
-
* for the same reason
|
|
9310
|
+
* if we do not intercept then React library will throw a very obsure error
|
|
9311
|
+
* for the same reason... at least at this point we will emit a sensible stacktrace.
|
|
8571
9312
|
*/
|
|
8572
|
-
throw new Error('
|
|
9313
|
+
throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');
|
|
8573
9314
|
}
|
|
8574
9315
|
const bridgeComponent = React__namespace.createElement(React__namespace.forwardRef(ReactComponentBridge), {
|
|
8575
9316
|
component: this
|
|
@@ -8621,9 +9362,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8621
9362
|
}, []);
|
|
8622
9363
|
return [portals, addPortal];
|
|
8623
9364
|
};
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
9365
|
+
function isReactComponent(component) {
|
|
9366
|
+
/**
|
|
9367
|
+
* Yes, we could use "react-is" but that would introduce an unwanted peer dependency
|
|
9368
|
+
* so for now we will check in a rather crude fashion...
|
|
9369
|
+
*/
|
|
9370
|
+
return (typeof component === 'function' /** Functional Componnts */ ||
|
|
9371
|
+
!!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
|
|
8627
9372
|
}
|
|
8628
9373
|
|
|
8629
9374
|
class ReactPanelContentPart {
|
|
@@ -8883,6 +9628,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8883
9628
|
defaultRenderer: props.defaultRenderer,
|
|
8884
9629
|
debug: props.debug,
|
|
8885
9630
|
rootOverlayModel: props.rootOverlayModel,
|
|
9631
|
+
locked: props.locked,
|
|
9632
|
+
disableDnd: props.disableDnd,
|
|
8886
9633
|
});
|
|
8887
9634
|
const { clientWidth, clientHeight } = domRef.current;
|
|
8888
9635
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -8894,6 +9641,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8894
9641
|
dockview.dispose();
|
|
8895
9642
|
};
|
|
8896
9643
|
}, []);
|
|
9644
|
+
React__namespace.useEffect(() => {
|
|
9645
|
+
if (!dockviewRef.current) {
|
|
9646
|
+
return;
|
|
9647
|
+
}
|
|
9648
|
+
dockviewRef.current.locked = !!props.locked;
|
|
9649
|
+
}, [props.locked]);
|
|
9650
|
+
React__namespace.useEffect(() => {
|
|
9651
|
+
if (!dockviewRef.current) {
|
|
9652
|
+
return;
|
|
9653
|
+
}
|
|
9654
|
+
dockviewRef.current.updateOptions({
|
|
9655
|
+
disableDnd: props.disableDnd,
|
|
9656
|
+
});
|
|
9657
|
+
}, [props.disableDnd]);
|
|
8897
9658
|
React__namespace.useEffect(() => {
|
|
8898
9659
|
if (!dockviewRef.current) {
|
|
8899
9660
|
return () => {
|
|
@@ -8909,6 +9670,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8909
9670
|
disposable.dispose();
|
|
8910
9671
|
};
|
|
8911
9672
|
}, [props.onDidDrop]);
|
|
9673
|
+
React__namespace.useEffect(() => {
|
|
9674
|
+
if (!dockviewRef.current) {
|
|
9675
|
+
return () => {
|
|
9676
|
+
// noop
|
|
9677
|
+
};
|
|
9678
|
+
}
|
|
9679
|
+
const disposable = dockviewRef.current.onWillDrop((event) => {
|
|
9680
|
+
if (props.onWillDrop) {
|
|
9681
|
+
props.onWillDrop(event);
|
|
9682
|
+
}
|
|
9683
|
+
});
|
|
9684
|
+
return () => {
|
|
9685
|
+
disposable.dispose();
|
|
9686
|
+
};
|
|
9687
|
+
}, [props.onWillDrop]);
|
|
8912
9688
|
React__namespace.useEffect(() => {
|
|
8913
9689
|
if (!dockviewRef.current) {
|
|
8914
9690
|
return;
|
|
@@ -9151,7 +9927,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9151
9927
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
9152
9928
|
params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
|
|
9153
9929
|
api: this.api,
|
|
9154
|
-
|
|
9930
|
+
// TODO: fix casting hack
|
|
9931
|
+
containerApi: new GridviewApi(this._params
|
|
9932
|
+
.accessor),
|
|
9155
9933
|
});
|
|
9156
9934
|
}
|
|
9157
9935
|
}
|
|
@@ -9334,12 +10112,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9334
10112
|
exports.DockviewComponent = DockviewComponent;
|
|
9335
10113
|
exports.DockviewCompositeDisposable = CompositeDisposable;
|
|
9336
10114
|
exports.DockviewDefaultTab = DockviewDefaultTab;
|
|
10115
|
+
exports.DockviewDidDropEvent = DockviewDidDropEvent;
|
|
9337
10116
|
exports.DockviewEmitter = Emitter;
|
|
9338
10117
|
exports.DockviewGroupPanel = DockviewGroupPanel;
|
|
9339
10118
|
exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
|
|
9340
10119
|
exports.DockviewMutableDisposable = MutableDisposable;
|
|
9341
10120
|
exports.DockviewPanel = DockviewPanel;
|
|
9342
10121
|
exports.DockviewReact = DockviewReact;
|
|
10122
|
+
exports.DockviewWillDropEvent = DockviewWillDropEvent;
|
|
9343
10123
|
exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
|
|
9344
10124
|
exports.Gridview = Gridview;
|
|
9345
10125
|
exports.GridviewApi = GridviewApi;
|
|
@@ -9363,6 +10143,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9363
10143
|
exports.SplitviewPanel = SplitviewPanel;
|
|
9364
10144
|
exports.SplitviewReact = SplitviewReact;
|
|
9365
10145
|
exports.Tab = Tab;
|
|
10146
|
+
exports.WillShowOverlayLocationEvent = WillShowOverlayLocationEvent;
|
|
9366
10147
|
exports.createComponent = createComponent;
|
|
9367
10148
|
exports.directionToPosition = directionToPosition;
|
|
9368
10149
|
exports.getDirectionOrientation = getDirectionOrientation;
|
|
@@ -9377,7 +10158,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9377
10158
|
exports.isGroupOptionsWithPanel = isGroupOptionsWithPanel;
|
|
9378
10159
|
exports.isPanelOptionsWithGroup = isPanelOptionsWithGroup;
|
|
9379
10160
|
exports.isPanelOptionsWithPanel = isPanelOptionsWithPanel;
|
|
9380
|
-
exports.
|
|
10161
|
+
exports.isReactComponent = isReactComponent;
|
|
9381
10162
|
exports.orthogonal = orthogonal;
|
|
9382
10163
|
exports.positionToDirection = positionToDirection;
|
|
9383
10164
|
exports.toTarget = toTarget;
|