dockview-core 1.14.2 → 1.15.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/api/component.api.d.ts +5 -5
- package/dist/cjs/api/component.api.js +19 -2
- package/dist/cjs/constants.d.ts +2 -0
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/dnd/overlay.d.ts +6 -4
- package/dist/cjs/dnd/overlay.js +119 -28
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +4 -2
- package/dist/cjs/dockview/dockviewComponent.d.ts +24 -17
- package/dist/cjs/dockview/dockviewComponent.js +104 -47
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +3 -12
- package/dist/cjs/dockview/options.d.ts +10 -6
- package/dist/cjs/dockview/options.js +1 -0
- package/dist/cjs/dom.d.ts +1 -0
- package/dist/cjs/dom.js +5 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +3 -0
- package/dist/cjs/gridview/baseComponentGridview.js +8 -2
- package/dist/cjs/gridview/branchNode.d.ts +7 -3
- package/dist/cjs/gridview/branchNode.js +24 -29
- package/dist/cjs/gridview/gridview.d.ts +7 -1
- package/dist/cjs/gridview/gridview.js +31 -8
- package/dist/cjs/gridview/gridviewPanel.d.ts +1 -0
- package/dist/cjs/gridview/gridviewPanel.js +7 -0
- package/dist/cjs/math.js +5 -1
- package/dist/cjs/splitview/splitview.d.ts +13 -0
- package/dist/cjs/splitview/splitview.js +42 -12
- package/dist/cjs/types.d.ts +23 -0
- package/dist/dockview-core.amd.js +328 -112
- package/dist/dockview-core.amd.js.map +1 -1
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.js.map +1 -1
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-core.amd.noStyle.js +327 -111
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +328 -112
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +328 -112
- package/dist/dockview-core.esm.js.map +1 -1
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.esm.min.js.map +1 -1
- package/dist/dockview-core.js +328 -112
- package/dist/dockview-core.js.map +1 -1
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +327 -111
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +5 -5
- package/dist/esm/api/component.api.js +11 -2
- package/dist/esm/constants.d.ts +2 -0
- package/dist/esm/constants.js +1 -1
- package/dist/esm/dnd/overlay.d.ts +6 -4
- package/dist/esm/dnd/overlay.js +108 -28
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +4 -2
- package/dist/esm/dockview/dockviewComponent.d.ts +24 -17
- package/dist/esm/dockview/dockviewComponent.js +101 -48
- package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +3 -12
- package/dist/esm/dockview/options.d.ts +10 -6
- package/dist/esm/dockview/options.js +1 -0
- package/dist/esm/dom.d.ts +1 -0
- package/dist/esm/dom.js +3 -0
- package/dist/esm/gridview/baseComponentGridview.d.ts +3 -0
- package/dist/esm/gridview/baseComponentGridview.js +6 -2
- package/dist/esm/gridview/branchNode.d.ts +7 -3
- package/dist/esm/gridview/branchNode.js +19 -7
- package/dist/esm/gridview/gridview.d.ts +7 -1
- package/dist/esm/gridview/gridview.js +27 -8
- package/dist/esm/gridview/gridviewPanel.d.ts +1 -0
- package/dist/esm/gridview/gridviewPanel.js +3 -0
- package/dist/esm/math.js +5 -1
- package/dist/esm/splitview/splitview.d.ts +13 -0
- package/dist/esm/splitview/splitview.js +38 -12
- package/dist/esm/types.d.ts +23 -0
- package/dist/styles/dockview.css +0 -13
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.15.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -528,6 +528,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
528
528
|
}
|
|
529
529
|
return false;
|
|
530
530
|
}
|
|
531
|
+
function addTestId(element, id) {
|
|
532
|
+
element.setAttribute('data-testid', id);
|
|
533
|
+
}
|
|
531
534
|
|
|
532
535
|
function tail(arr) {
|
|
533
536
|
if (arr.length === 0) {
|
|
@@ -589,7 +592,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
589
592
|
|
|
590
593
|
const clamp = (value, min, max) => {
|
|
591
594
|
if (min > max) {
|
|
592
|
-
|
|
595
|
+
/**
|
|
596
|
+
* caveat: an error should be thrown here if this was a proper `clamp` function but we need to handle
|
|
597
|
+
* cases where `min` > `max` and in those cases return `min`.
|
|
598
|
+
*/
|
|
599
|
+
return min;
|
|
593
600
|
}
|
|
594
601
|
return Math.min(max, Math.max(value, min));
|
|
595
602
|
};
|
|
@@ -794,7 +801,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
794
801
|
this._disabled = value;
|
|
795
802
|
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
796
803
|
}
|
|
804
|
+
get margin() {
|
|
805
|
+
return this._margin;
|
|
806
|
+
}
|
|
807
|
+
set margin(value) {
|
|
808
|
+
this._margin = value;
|
|
809
|
+
}
|
|
797
810
|
constructor(container, options) {
|
|
811
|
+
var _a;
|
|
798
812
|
this.container = container;
|
|
799
813
|
this.viewItems = [];
|
|
800
814
|
this.sashes = [];
|
|
@@ -805,6 +819,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
805
819
|
this._startSnappingEnabled = true;
|
|
806
820
|
this._endSnappingEnabled = true;
|
|
807
821
|
this._disabled = false;
|
|
822
|
+
this._margin = 0;
|
|
808
823
|
this._onDidSashEnd = new Emitter();
|
|
809
824
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
810
825
|
this._onDidAddView = new Emitter();
|
|
@@ -893,6 +908,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
893
908
|
};
|
|
894
909
|
this._orientation = options.orientation;
|
|
895
910
|
this.element = this.createContainer();
|
|
911
|
+
this.margin = (_a = options.margin) !== null && _a !== void 0 ? _a : 0;
|
|
896
912
|
this.proportionalLayout =
|
|
897
913
|
options.proportionalLayout === undefined
|
|
898
914
|
? true
|
|
@@ -947,9 +963,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
947
963
|
if (index < 0 || index >= this.viewItems.length) {
|
|
948
964
|
throw new Error('Index out of bounds');
|
|
949
965
|
}
|
|
950
|
-
toggleClass(this.container, 'visible', visible);
|
|
951
966
|
const viewItem = this.viewItems[index];
|
|
952
|
-
toggleClass(this.container, 'visible', visible);
|
|
953
967
|
viewItem.setVisible(visible, viewItem.size);
|
|
954
968
|
this.distributeEmptySpace(index);
|
|
955
969
|
this.layoutViews();
|
|
@@ -1261,15 +1275,29 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1261
1275
|
this._proportions = this.viewItems.map((i) => i.visible ? i.size / this._contentSize : undefined);
|
|
1262
1276
|
}
|
|
1263
1277
|
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Margin explain:
|
|
1280
|
+
*
|
|
1281
|
+
* For `n` views in a splitview there will be `n-1` margins `m`.
|
|
1282
|
+
*
|
|
1283
|
+
* To fit the margins each view must reduce in size by `(m * (n - 1)) / n`.
|
|
1284
|
+
*
|
|
1285
|
+
* For each view `i` the offet must be adjusted by `m * i/(n - 1)`.
|
|
1286
|
+
*/
|
|
1264
1287
|
layoutViews() {
|
|
1265
1288
|
this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1266
|
-
let sum = 0;
|
|
1267
|
-
const x = [];
|
|
1268
1289
|
this.updateSashEnablement();
|
|
1290
|
+
if (this.viewItems.length === 0) {
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
const sashCount = this.viewItems.length - 1;
|
|
1294
|
+
const marginReducedSize = (this.margin * sashCount) / this.viewItems.length;
|
|
1295
|
+
let totalLeftOffset = 0;
|
|
1296
|
+
const viewLeftOffsets = [];
|
|
1269
1297
|
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
const offset = Math.min(Math.max(0,
|
|
1298
|
+
totalLeftOffset += this.viewItems[i].size;
|
|
1299
|
+
viewLeftOffsets.push(totalLeftOffset);
|
|
1300
|
+
const offset = Math.min(Math.max(0, totalLeftOffset - 2), this.size - this.margin);
|
|
1273
1301
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1274
1302
|
this.sashes[i].container.style.left = `${offset}px`;
|
|
1275
1303
|
this.sashes[i].container.style.top = `0px`;
|
|
@@ -1280,19 +1308,24 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1280
1308
|
}
|
|
1281
1309
|
}
|
|
1282
1310
|
this.viewItems.forEach((view, i) => {
|
|
1311
|
+
const size = view.size - marginReducedSize;
|
|
1312
|
+
const offset = i === 0
|
|
1313
|
+
? 0
|
|
1314
|
+
: viewLeftOffsets[i - 1] +
|
|
1315
|
+
(i / sashCount) * marginReducedSize;
|
|
1283
1316
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1284
|
-
view.container.style.width = `${
|
|
1285
|
-
view.container.style.left =
|
|
1317
|
+
view.container.style.width = `${size}px`;
|
|
1318
|
+
view.container.style.left = `${offset}px`;
|
|
1286
1319
|
view.container.style.top = '';
|
|
1287
1320
|
view.container.style.height = '';
|
|
1288
1321
|
}
|
|
1289
1322
|
if (this._orientation === exports.Orientation.VERTICAL) {
|
|
1290
|
-
view.container.style.height = `${
|
|
1291
|
-
view.container.style.top =
|
|
1323
|
+
view.container.style.height = `${size}px`;
|
|
1324
|
+
view.container.style.top = `${offset}px`;
|
|
1292
1325
|
view.container.style.width = '';
|
|
1293
1326
|
view.container.style.left = '';
|
|
1294
1327
|
}
|
|
1295
|
-
view.view.layout(view.size, this._orthogonalSize);
|
|
1328
|
+
view.view.layout(view.size - marginReducedSize, this._orthogonalSize);
|
|
1296
1329
|
});
|
|
1297
1330
|
}
|
|
1298
1331
|
findFirstSnapIndex(indexes) {
|
|
@@ -1741,7 +1774,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1741
1774
|
set disabled(value) {
|
|
1742
1775
|
this.splitview.disabled = value;
|
|
1743
1776
|
}
|
|
1744
|
-
|
|
1777
|
+
get margin() {
|
|
1778
|
+
return this.splitview.margin;
|
|
1779
|
+
}
|
|
1780
|
+
set margin(value) {
|
|
1781
|
+
this.splitview.margin = value;
|
|
1782
|
+
this.children.forEach((child) => {
|
|
1783
|
+
if (child instanceof BranchNode) {
|
|
1784
|
+
child.margin = value;
|
|
1785
|
+
}
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, margin, childDescriptors) {
|
|
1745
1789
|
super();
|
|
1746
1790
|
this.orientation = orientation;
|
|
1747
1791
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1761,6 +1805,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1761
1805
|
orientation: this.orientation,
|
|
1762
1806
|
proportionalLayout,
|
|
1763
1807
|
styles,
|
|
1808
|
+
margin,
|
|
1764
1809
|
});
|
|
1765
1810
|
this.splitview.layout(this.size, this.orthogonalSize);
|
|
1766
1811
|
}
|
|
@@ -1784,6 +1829,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1784
1829
|
descriptor,
|
|
1785
1830
|
proportionalLayout,
|
|
1786
1831
|
styles,
|
|
1832
|
+
margin,
|
|
1787
1833
|
});
|
|
1788
1834
|
}
|
|
1789
1835
|
this.disabled = disabled;
|
|
@@ -1792,10 +1838,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1792
1838
|
}));
|
|
1793
1839
|
this.setupChildrenEvents();
|
|
1794
1840
|
}
|
|
1795
|
-
setVisible(
|
|
1796
|
-
|
|
1797
|
-
child.setVisible(visible);
|
|
1798
|
-
}
|
|
1841
|
+
setVisible(_visible) {
|
|
1842
|
+
// noop
|
|
1799
1843
|
}
|
|
1800
1844
|
isChildVisible(index) {
|
|
1801
1845
|
if (index < 0 || index >= this.children.length) {
|
|
@@ -1812,12 +1856,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1812
1856
|
}
|
|
1813
1857
|
const wereAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1814
1858
|
this.splitview.setViewVisible(index, visible);
|
|
1859
|
+
// }
|
|
1815
1860
|
const areAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1816
1861
|
// If all children are hidden then the parent should hide the entire splitview
|
|
1817
1862
|
// If the entire splitview is hidden then the parent should show the splitview when a child is shown
|
|
1818
1863
|
if ((visible && wereAllChildrenHidden) ||
|
|
1819
1864
|
(!visible && areAllChildrenHidden)) {
|
|
1820
|
-
this._onDidVisibilityChange.fire(visible);
|
|
1865
|
+
this._onDidVisibilityChange.fire({ visible });
|
|
1821
1866
|
}
|
|
1822
1867
|
}
|
|
1823
1868
|
moveChild(from, to) {
|
|
@@ -1890,7 +1935,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1890
1935
|
this._onDidChange.fire({ size: e.orthogonalSize });
|
|
1891
1936
|
}), ...this.children.map((c, i) => {
|
|
1892
1937
|
if (c instanceof BranchNode) {
|
|
1893
|
-
return c.onDidVisibilityChange((visible) => {
|
|
1938
|
+
return c.onDidVisibilityChange(({ visible }) => {
|
|
1894
1939
|
this.setChildVisible(i, visible);
|
|
1895
1940
|
});
|
|
1896
1941
|
}
|
|
@@ -1920,7 +1965,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1920
1965
|
}
|
|
1921
1966
|
function flipNode(node, size, orthogonalSize) {
|
|
1922
1967
|
if (node instanceof BranchNode) {
|
|
1923
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1968
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
|
|
1924
1969
|
let totalSize = 0;
|
|
1925
1970
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1926
1971
|
const child = node.children[i];
|
|
@@ -2075,6 +2120,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2075
2120
|
}
|
|
2076
2121
|
}
|
|
2077
2122
|
}
|
|
2123
|
+
get margin() {
|
|
2124
|
+
return this._margin;
|
|
2125
|
+
}
|
|
2126
|
+
set margin(value) {
|
|
2127
|
+
this._margin = value;
|
|
2128
|
+
this.root.margin = value;
|
|
2129
|
+
}
|
|
2078
2130
|
maximizedView() {
|
|
2079
2131
|
var _a;
|
|
2080
2132
|
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
@@ -2160,13 +2212,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2160
2212
|
this.disposable.dispose();
|
|
2161
2213
|
this._onDidChange.dispose();
|
|
2162
2214
|
this._onDidMaximizedNodeChange.dispose();
|
|
2215
|
+
this._onDidViewVisibilityChange.dispose();
|
|
2163
2216
|
this.root.dispose();
|
|
2164
2217
|
this._maximizedNode = undefined;
|
|
2165
2218
|
this.element.remove();
|
|
2166
2219
|
}
|
|
2167
2220
|
clear() {
|
|
2168
2221
|
const orientation = this.root.orientation;
|
|
2169
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.
|
|
2222
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.locked, this.margin);
|
|
2170
2223
|
}
|
|
2171
2224
|
deserialize(json, deserializer) {
|
|
2172
2225
|
const orientation = json.orientation;
|
|
@@ -2177,6 +2230,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2177
2230
|
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
|
|
2178
2231
|
}
|
|
2179
2232
|
_deserializeNode(node, orientation, deserializer, orthogonalSize) {
|
|
2233
|
+
var _a;
|
|
2180
2234
|
let result;
|
|
2181
2235
|
if (node.type === 'branch') {
|
|
2182
2236
|
const serializedChildren = node.data;
|
|
@@ -2188,10 +2242,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2188
2242
|
});
|
|
2189
2243
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2190
2244
|
orthogonalSize, // <- size - flips at each depth,
|
|
2191
|
-
this.
|
|
2245
|
+
this.locked, this.margin, children);
|
|
2192
2246
|
}
|
|
2193
2247
|
else {
|
|
2194
|
-
|
|
2248
|
+
const view = deserializer.fromJSON(node);
|
|
2249
|
+
if (typeof node.visible === 'boolean') {
|
|
2250
|
+
(_a = view.setVisible) === null || _a === void 0 ? void 0 : _a.call(view, node.visible);
|
|
2251
|
+
}
|
|
2252
|
+
result = new LeafNode(view, orientation, orthogonalSize, node.size);
|
|
2195
2253
|
}
|
|
2196
2254
|
return result;
|
|
2197
2255
|
}
|
|
@@ -2221,7 +2279,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2221
2279
|
}
|
|
2222
2280
|
const oldRoot = this.root;
|
|
2223
2281
|
oldRoot.element.remove();
|
|
2224
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.
|
|
2282
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.locked, this.margin);
|
|
2225
2283
|
if (oldRoot.children.length === 0) ;
|
|
2226
2284
|
else if (oldRoot.children.length === 1) {
|
|
2227
2285
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2286,19 +2344,24 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2286
2344
|
}
|
|
2287
2345
|
return findLeaf(this.root, reverse);
|
|
2288
2346
|
}
|
|
2289
|
-
constructor(proportionalLayout, styles, orientation) {
|
|
2347
|
+
constructor(proportionalLayout, styles, orientation, locked, margin) {
|
|
2290
2348
|
this.proportionalLayout = proportionalLayout;
|
|
2291
2349
|
this.styles = styles;
|
|
2292
2350
|
this._locked = false;
|
|
2351
|
+
this._margin = 0;
|
|
2293
2352
|
this._maximizedNode = undefined;
|
|
2294
2353
|
this.disposable = new MutableDisposable();
|
|
2295
2354
|
this._onDidChange = new Emitter();
|
|
2296
2355
|
this.onDidChange = this._onDidChange.event;
|
|
2356
|
+
this._onDidViewVisibilityChange = new Emitter();
|
|
2357
|
+
this.onDidViewVisibilityChange = this._onDidViewVisibilityChange.event;
|
|
2297
2358
|
this._onDidMaximizedNodeChange = new Emitter();
|
|
2298
2359
|
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2299
2360
|
this.element = document.createElement('div');
|
|
2300
2361
|
this.element.className = 'grid-view';
|
|
2301
|
-
this.
|
|
2362
|
+
this._locked = locked !== null && locked !== void 0 ? locked : false;
|
|
2363
|
+
this._margin = margin !== null && margin !== void 0 ? margin : 0;
|
|
2364
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this.locked, this.margin);
|
|
2302
2365
|
}
|
|
2303
2366
|
isViewVisible(location) {
|
|
2304
2367
|
const [rest, index] = tail(location);
|
|
@@ -2317,6 +2380,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2317
2380
|
if (!(parent instanceof BranchNode)) {
|
|
2318
2381
|
throw new Error('Invalid from location');
|
|
2319
2382
|
}
|
|
2383
|
+
this._onDidViewVisibilityChange.fire();
|
|
2320
2384
|
parent.setChildVisible(index, visible);
|
|
2321
2385
|
}
|
|
2322
2386
|
moveView(parentLocation, from, to) {
|
|
@@ -2349,7 +2413,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2349
2413
|
}
|
|
2350
2414
|
const child = grandParent.removeChild(parentIndex);
|
|
2351
2415
|
child.dispose();
|
|
2352
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.
|
|
2416
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.locked, this.margin);
|
|
2353
2417
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2354
2418
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2355
2419
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2588,14 +2652,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2588
2652
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2589
2653
|
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
2590
2654
|
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
2655
|
+
this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
|
|
2656
|
+
this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
|
|
2591
2657
|
this.element.style.height = '100%';
|
|
2592
2658
|
this.element.style.width = '100%';
|
|
2593
2659
|
options.parentElement.appendChild(this.element);
|
|
2594
|
-
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
2660
|
+
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
|
|
2595
2661
|
this.gridview.locked = !!options.locked;
|
|
2596
2662
|
this.element.appendChild(this.gridview.element);
|
|
2597
2663
|
this.layout(0, 0, true); // set some elements height/widths
|
|
2598
|
-
this.addDisposables(
|
|
2664
|
+
this.addDisposables(this.gridview.onDidViewVisibilityChange(() => this._onDidViewVisibilityChangeMicroTaskQueue.fire()), this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
2665
|
+
this.layout(this.width, this.height, true);
|
|
2666
|
+
}), exports.DockviewDisposable.from(() => {
|
|
2599
2667
|
var _a;
|
|
2600
2668
|
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
2601
2669
|
}), this.gridview.onDidChange(() => {
|
|
@@ -3173,6 +3241,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3173
3241
|
get totalPanels() {
|
|
3174
3242
|
return this.component.totalPanels;
|
|
3175
3243
|
}
|
|
3244
|
+
get gap() {
|
|
3245
|
+
return this.component.gap;
|
|
3246
|
+
}
|
|
3176
3247
|
/**
|
|
3177
3248
|
* Invoked when the active group changes. May be undefined if no group is active.
|
|
3178
3249
|
*/
|
|
@@ -3209,6 +3280,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3209
3280
|
get onDidRemovePanel() {
|
|
3210
3281
|
return this.component.onDidRemovePanel;
|
|
3211
3282
|
}
|
|
3283
|
+
get onDidMovePanel() {
|
|
3284
|
+
return this.component.onDidMovePanel;
|
|
3285
|
+
}
|
|
3212
3286
|
/**
|
|
3213
3287
|
* Invoked after a layout is deserialzied using the `fromJSON` method.
|
|
3214
3288
|
*/
|
|
@@ -3349,8 +3423,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3349
3423
|
/**
|
|
3350
3424
|
* Add a floating group
|
|
3351
3425
|
*/
|
|
3352
|
-
addFloatingGroup(item,
|
|
3353
|
-
return this.component.addFloatingGroup(item,
|
|
3426
|
+
addFloatingGroup(item, options) {
|
|
3427
|
+
return this.component.addFloatingGroup(item, options);
|
|
3354
3428
|
}
|
|
3355
3429
|
/**
|
|
3356
3430
|
* Create a component from a serialized object.
|
|
@@ -3400,6 +3474,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3400
3474
|
addPopoutGroup(item, options) {
|
|
3401
3475
|
return this.component.addPopoutGroup(item, options);
|
|
3402
3476
|
}
|
|
3477
|
+
setGap(gap) {
|
|
3478
|
+
this.component.updateOptions({ gap });
|
|
3479
|
+
}
|
|
3403
3480
|
}
|
|
3404
3481
|
|
|
3405
3482
|
class DragHandler extends CompositeDisposable {
|
|
@@ -4769,7 +4846,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4769
4846
|
this.accessor.addFloatingGroup(this.group, {
|
|
4770
4847
|
x: left - rootLeft + 20,
|
|
4771
4848
|
y: top - rootTop + 20,
|
|
4772
|
-
|
|
4849
|
+
inDragMode: true,
|
|
4850
|
+
});
|
|
4773
4851
|
}
|
|
4774
4852
|
}), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
4775
4853
|
if (event.defaultPrevented) {
|
|
@@ -4838,7 +4916,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4838
4916
|
this.accessor.addFloatingGroup(panel, {
|
|
4839
4917
|
x: left - rootLeft,
|
|
4840
4918
|
y: top - rootTop,
|
|
4841
|
-
|
|
4919
|
+
inDragMode: true,
|
|
4920
|
+
});
|
|
4842
4921
|
return;
|
|
4843
4922
|
}
|
|
4844
4923
|
const isLeftClick = event.button === 0;
|
|
@@ -4911,6 +4990,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4911
4990
|
rootOverlayModel: undefined,
|
|
4912
4991
|
locked: undefined,
|
|
4913
4992
|
disableDnd: undefined,
|
|
4993
|
+
gap: undefined,
|
|
4914
4994
|
};
|
|
4915
4995
|
return Object.keys(properties);
|
|
4916
4996
|
})();
|
|
@@ -5641,6 +5721,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5641
5721
|
get isActive() {
|
|
5642
5722
|
return this.api.isActive;
|
|
5643
5723
|
}
|
|
5724
|
+
get isVisible() {
|
|
5725
|
+
return this.api.isVisible;
|
|
5726
|
+
}
|
|
5644
5727
|
constructor(id, component, options, api) {
|
|
5645
5728
|
super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
|
|
5646
5729
|
this._evaluatedMinimumWidth = 0;
|
|
@@ -6403,12 +6486,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6403
6486
|
this._element.appendChild(this.options.content);
|
|
6404
6487
|
this.options.container.appendChild(this._element);
|
|
6405
6488
|
// if input bad resize within acceptable boundaries
|
|
6406
|
-
this.setBounds({
|
|
6407
|
-
height: this.options.height,
|
|
6408
|
-
width: this.options.width,
|
|
6409
|
-
top: this.options.top,
|
|
6410
|
-
left: this.options.left,
|
|
6411
|
-
});
|
|
6489
|
+
this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({ height: this.options.height, width: this.options.width }, ('top' in this.options && { top: this.options.top })), ('bottom' in this.options && { bottom: this.options.bottom })), ('left' in this.options && { left: this.options.left })), ('right' in this.options && { right: this.options.right })));
|
|
6412
6490
|
}
|
|
6413
6491
|
setBounds(bounds = {}) {
|
|
6414
6492
|
if (typeof bounds.height === 'number') {
|
|
@@ -6417,11 +6495,25 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6417
6495
|
if (typeof bounds.width === 'number') {
|
|
6418
6496
|
this._element.style.width = `${bounds.width}px`;
|
|
6419
6497
|
}
|
|
6420
|
-
if (typeof bounds.top === 'number') {
|
|
6498
|
+
if ('top' in bounds && typeof bounds.top === 'number') {
|
|
6421
6499
|
this._element.style.top = `${bounds.top}px`;
|
|
6500
|
+
this._element.style.bottom = 'auto';
|
|
6501
|
+
this.verticalAlignment = 'top';
|
|
6502
|
+
}
|
|
6503
|
+
if ('bottom' in bounds && typeof bounds.bottom === 'number') {
|
|
6504
|
+
this._element.style.bottom = `${bounds.bottom}px`;
|
|
6505
|
+
this._element.style.top = 'auto';
|
|
6506
|
+
this.verticalAlignment = 'bottom';
|
|
6422
6507
|
}
|
|
6423
|
-
if (typeof bounds.left === 'number') {
|
|
6508
|
+
if ('left' in bounds && typeof bounds.left === 'number') {
|
|
6424
6509
|
this._element.style.left = `${bounds.left}px`;
|
|
6510
|
+
this._element.style.right = 'auto';
|
|
6511
|
+
this.horiziontalAlignment = 'left';
|
|
6512
|
+
}
|
|
6513
|
+
if ('right' in bounds && typeof bounds.right === 'number') {
|
|
6514
|
+
this._element.style.right = `${bounds.right}px`;
|
|
6515
|
+
this._element.style.left = 'auto';
|
|
6516
|
+
this.horiziontalAlignment = 'right';
|
|
6425
6517
|
}
|
|
6426
6518
|
const containerRect = this.options.container.getBoundingClientRect();
|
|
6427
6519
|
const overlayRect = this._element.getBoundingClientRect();
|
|
@@ -6429,24 +6521,54 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6429
6521
|
// a minimum width of minimumViewportWidth must be inside the viewport
|
|
6430
6522
|
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
6431
6523
|
// a minimum height of minimumViewportHeight must be inside the viewport
|
|
6432
|
-
const yOffset =
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
this.
|
|
6524
|
+
const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
|
|
6525
|
+
if (this.verticalAlignment === 'top') {
|
|
6526
|
+
const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6527
|
+
this._element.style.top = `${top}px`;
|
|
6528
|
+
this._element.style.bottom = 'auto';
|
|
6529
|
+
}
|
|
6530
|
+
if (this.verticalAlignment === 'bottom') {
|
|
6531
|
+
const bottom = clamp(containerRect.bottom - overlayRect.bottom, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6532
|
+
this._element.style.bottom = `${bottom}px`;
|
|
6533
|
+
this._element.style.top = 'auto';
|
|
6534
|
+
}
|
|
6535
|
+
if (this.horiziontalAlignment === 'left') {
|
|
6536
|
+
const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6537
|
+
this._element.style.left = `${left}px`;
|
|
6538
|
+
this._element.style.right = 'auto';
|
|
6539
|
+
}
|
|
6540
|
+
if (this.horiziontalAlignment === 'right') {
|
|
6541
|
+
const right = clamp(containerRect.right - overlayRect.right, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6542
|
+
this._element.style.right = `${right}px`;
|
|
6543
|
+
this._element.style.left = 'auto';
|
|
6544
|
+
}
|
|
6439
6545
|
this._onDidChange.fire();
|
|
6440
6546
|
}
|
|
6441
6547
|
toJSON() {
|
|
6442
6548
|
const container = this.options.container.getBoundingClientRect();
|
|
6443
6549
|
const element = this._element.getBoundingClientRect();
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6550
|
+
const result = {};
|
|
6551
|
+
if (this.verticalAlignment === 'top') {
|
|
6552
|
+
result.top = parseFloat(this._element.style.top);
|
|
6553
|
+
}
|
|
6554
|
+
else if (this.verticalAlignment === 'bottom') {
|
|
6555
|
+
result.bottom = parseFloat(this._element.style.bottom);
|
|
6556
|
+
}
|
|
6557
|
+
else {
|
|
6558
|
+
result.top = element.top - container.top;
|
|
6559
|
+
}
|
|
6560
|
+
if (this.horiziontalAlignment === 'left') {
|
|
6561
|
+
result.left = parseFloat(this._element.style.left);
|
|
6562
|
+
}
|
|
6563
|
+
else if (this.horiziontalAlignment === 'right') {
|
|
6564
|
+
result.right = parseFloat(this._element.style.right);
|
|
6565
|
+
}
|
|
6566
|
+
else {
|
|
6567
|
+
result.left = element.left - container.left;
|
|
6568
|
+
}
|
|
6569
|
+
result.width = element.width;
|
|
6570
|
+
result.height = element.height;
|
|
6571
|
+
return result;
|
|
6450
6572
|
}
|
|
6451
6573
|
setupDrag(dragTarget, options = { inDragMode: false }) {
|
|
6452
6574
|
const move = new MutableDisposable();
|
|
@@ -6478,12 +6600,30 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6478
6600
|
};
|
|
6479
6601
|
}
|
|
6480
6602
|
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
6481
|
-
const yOffset = Math.max(0, this.
|
|
6482
|
-
? this.getMinimumHeight(overlayRect.height)
|
|
6483
|
-
: 0);
|
|
6484
|
-
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6603
|
+
const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
|
|
6485
6604
|
const top = clamp(y - offset.y, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6486
|
-
|
|
6605
|
+
const bottom = clamp(offset.y -
|
|
6606
|
+
y +
|
|
6607
|
+
containerRect.height -
|
|
6608
|
+
overlayRect.height, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6609
|
+
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6610
|
+
const right = clamp(offset.x - x + containerRect.width - overlayRect.width, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6611
|
+
const bounds = {};
|
|
6612
|
+
// Anchor to top or to bottom depending on which one is closer
|
|
6613
|
+
if (top <= bottom) {
|
|
6614
|
+
bounds.top = top;
|
|
6615
|
+
}
|
|
6616
|
+
else {
|
|
6617
|
+
bounds.bottom = bottom;
|
|
6618
|
+
}
|
|
6619
|
+
// Anchor to left or to right depending on which one is closer
|
|
6620
|
+
if (left <= right) {
|
|
6621
|
+
bounds.left = left;
|
|
6622
|
+
}
|
|
6623
|
+
else {
|
|
6624
|
+
bounds.right = right;
|
|
6625
|
+
}
|
|
6626
|
+
this.setBounds(bounds);
|
|
6487
6627
|
}), addDisposableWindowListener(window, 'mouseup', () => {
|
|
6488
6628
|
toggleClass(this._element, 'dv-resize-container-dragging', false);
|
|
6489
6629
|
move.dispose();
|
|
@@ -6551,8 +6691,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6551
6691
|
};
|
|
6552
6692
|
}
|
|
6553
6693
|
let top = undefined;
|
|
6694
|
+
let bottom = undefined;
|
|
6554
6695
|
let height = undefined;
|
|
6555
6696
|
let left = undefined;
|
|
6697
|
+
let right = undefined;
|
|
6556
6698
|
let width = undefined;
|
|
6557
6699
|
const moveTop = () => {
|
|
6558
6700
|
top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
|
|
@@ -6566,6 +6708,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6566
6708
|
startPosition.originalY +
|
|
6567
6709
|
startPosition.originalHeight -
|
|
6568
6710
|
top;
|
|
6711
|
+
bottom = containerRect.height - top - height;
|
|
6569
6712
|
};
|
|
6570
6713
|
const moveBottom = () => {
|
|
6571
6714
|
top =
|
|
@@ -6577,6 +6720,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6577
6720
|
? -top +
|
|
6578
6721
|
this.options.minimumInViewportHeight
|
|
6579
6722
|
: Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
|
|
6723
|
+
bottom = containerRect.height - top - height;
|
|
6580
6724
|
};
|
|
6581
6725
|
const moveLeft = () => {
|
|
6582
6726
|
left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
|
|
@@ -6590,6 +6734,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6590
6734
|
startPosition.originalX +
|
|
6591
6735
|
startPosition.originalWidth -
|
|
6592
6736
|
left;
|
|
6737
|
+
right = containerRect.width - left - width;
|
|
6593
6738
|
};
|
|
6594
6739
|
const moveRight = () => {
|
|
6595
6740
|
left =
|
|
@@ -6601,6 +6746,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6601
6746
|
? -left +
|
|
6602
6747
|
this.options.minimumInViewportWidth
|
|
6603
6748
|
: Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
|
|
6749
|
+
right = containerRect.width - left - width;
|
|
6604
6750
|
};
|
|
6605
6751
|
switch (direction) {
|
|
6606
6752
|
case 'top':
|
|
@@ -6632,7 +6778,24 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6632
6778
|
moveRight();
|
|
6633
6779
|
break;
|
|
6634
6780
|
}
|
|
6635
|
-
|
|
6781
|
+
const bounds = {};
|
|
6782
|
+
// Anchor to top or to bottom depending on which one is closer
|
|
6783
|
+
if (top <= bottom) {
|
|
6784
|
+
bounds.top = top;
|
|
6785
|
+
}
|
|
6786
|
+
else {
|
|
6787
|
+
bounds.bottom = bottom;
|
|
6788
|
+
}
|
|
6789
|
+
// Anchor to left or to right depending on which one is closer
|
|
6790
|
+
if (left <= right) {
|
|
6791
|
+
bounds.left = left;
|
|
6792
|
+
}
|
|
6793
|
+
else {
|
|
6794
|
+
bounds.right = right;
|
|
6795
|
+
}
|
|
6796
|
+
bounds.height = height;
|
|
6797
|
+
bounds.width = width;
|
|
6798
|
+
this.setBounds(bounds);
|
|
6636
6799
|
}), {
|
|
6637
6800
|
dispose: () => {
|
|
6638
6801
|
for (const iframe of iframes) {
|
|
@@ -6655,7 +6818,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6655
6818
|
if (typeof this.options.minimumInViewportHeight === 'number') {
|
|
6656
6819
|
return height - this.options.minimumInViewportHeight;
|
|
6657
6820
|
}
|
|
6658
|
-
return
|
|
6821
|
+
return 0;
|
|
6659
6822
|
}
|
|
6660
6823
|
dispose() {
|
|
6661
6824
|
this._element.remove();
|
|
@@ -6678,7 +6841,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6678
6841
|
}
|
|
6679
6842
|
|
|
6680
6843
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6681
|
-
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6844
|
+
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100, width: 300, height: 300 };
|
|
6682
6845
|
|
|
6683
6846
|
function createFocusableElement() {
|
|
6684
6847
|
const element = document.createElement('div');
|
|
@@ -7033,6 +7196,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7033
7196
|
get api() {
|
|
7034
7197
|
return this._api;
|
|
7035
7198
|
}
|
|
7199
|
+
get gap() {
|
|
7200
|
+
return this.gridview.margin;
|
|
7201
|
+
}
|
|
7036
7202
|
constructor(options) {
|
|
7037
7203
|
var _a;
|
|
7038
7204
|
super({
|
|
@@ -7044,6 +7210,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7044
7210
|
parentElement: options.parentElement,
|
|
7045
7211
|
disableAutoResizing: options.disableAutoResizing,
|
|
7046
7212
|
locked: options.locked,
|
|
7213
|
+
margin: options.gap,
|
|
7047
7214
|
});
|
|
7048
7215
|
this.nextGroupId = sequentialNumberGenerator();
|
|
7049
7216
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -7069,9 +7236,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7069
7236
|
this._onDidActivePanelChange = new Emitter();
|
|
7070
7237
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
7071
7238
|
this._onDidMovePanel = new Emitter();
|
|
7239
|
+
this.onDidMovePanel = this._onDidMovePanel.event;
|
|
7072
7240
|
this._floatingGroups = [];
|
|
7073
7241
|
this._popoutGroups = [];
|
|
7074
|
-
this._ignoreEvents = 0;
|
|
7075
7242
|
this._onDidRemoveGroup = new Emitter();
|
|
7076
7243
|
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
7077
7244
|
this._onDidAddGroup = new Emitter();
|
|
@@ -7085,7 +7252,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7085
7252
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7086
7253
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
7087
7254
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
7088
|
-
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._onUnhandledDragOverEvent, this.
|
|
7255
|
+
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._onUnhandledDragOverEvent, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
7256
|
+
this.updateWatermark();
|
|
7257
|
+
}), this.onDidAdd((event) => {
|
|
7089
7258
|
if (!this._moving) {
|
|
7090
7259
|
this._onDidAddGroup.fire(event);
|
|
7091
7260
|
}
|
|
@@ -7099,7 +7268,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7099
7268
|
}
|
|
7100
7269
|
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
7101
7270
|
this.updateWatermark();
|
|
7102
|
-
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
7271
|
+
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidMovePanel, this.onDidActivePanelChange)(() => {
|
|
7103
7272
|
this._bufferOnDidLayoutChange.fire();
|
|
7104
7273
|
}), exports.DockviewDisposable.from(() => {
|
|
7105
7274
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
@@ -7199,7 +7368,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7199
7368
|
var _a, _b, _c;
|
|
7200
7369
|
if (itemToPopout instanceof DockviewPanel &&
|
|
7201
7370
|
itemToPopout.group.size === 1) {
|
|
7202
|
-
return this.addPopoutGroup(itemToPopout.group);
|
|
7371
|
+
return this.addPopoutGroup(itemToPopout.group, options);
|
|
7203
7372
|
}
|
|
7204
7373
|
const theme = getDockviewTheme(this.gridview.element);
|
|
7205
7374
|
const element = this.element;
|
|
@@ -7350,8 +7519,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7350
7519
|
console.error('dockview: failed to create popout window', err);
|
|
7351
7520
|
});
|
|
7352
7521
|
}
|
|
7353
|
-
addFloatingGroup(item,
|
|
7354
|
-
var _a, _b, _c, _d, _e
|
|
7522
|
+
addFloatingGroup(item, options) {
|
|
7523
|
+
var _a, _b, _c, _d, _e;
|
|
7355
7524
|
let group;
|
|
7356
7525
|
if (item instanceof DockviewPanel) {
|
|
7357
7526
|
group = this.createGroup();
|
|
@@ -7396,26 +7565,62 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7396
7565
|
}
|
|
7397
7566
|
}
|
|
7398
7567
|
group.model.location = { type: 'floating' };
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7568
|
+
function getAnchoredBox() {
|
|
7569
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7570
|
+
const result = {};
|
|
7571
|
+
if ('left' in options.position) {
|
|
7572
|
+
result.left = Math.max(options.position.left, 0);
|
|
7573
|
+
}
|
|
7574
|
+
else if ('right' in options.position) {
|
|
7575
|
+
result.right = Math.max(options.position.right, 0);
|
|
7576
|
+
}
|
|
7577
|
+
else {
|
|
7578
|
+
result.left = DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
7579
|
+
}
|
|
7580
|
+
if ('top' in options.position) {
|
|
7581
|
+
result.top = Math.max(options.position.top, 0);
|
|
7582
|
+
}
|
|
7583
|
+
else if ('bottom' in options.position) {
|
|
7584
|
+
result.bottom = Math.max(options.position.bottom, 0);
|
|
7585
|
+
}
|
|
7586
|
+
else {
|
|
7587
|
+
result.top = DEFAULT_FLOATING_GROUP_POSITION.top;
|
|
7588
|
+
}
|
|
7589
|
+
if (typeof options.width === 'number') {
|
|
7590
|
+
result.width = Math.max(options.width, 0);
|
|
7591
|
+
}
|
|
7592
|
+
else {
|
|
7593
|
+
result.width = DEFAULT_FLOATING_GROUP_POSITION.width;
|
|
7594
|
+
}
|
|
7595
|
+
if (typeof options.height === 'number') {
|
|
7596
|
+
result.height = Math.max(options.height, 0);
|
|
7597
|
+
}
|
|
7598
|
+
else {
|
|
7599
|
+
result.height = DEFAULT_FLOATING_GROUP_POSITION.height;
|
|
7600
|
+
}
|
|
7601
|
+
return result;
|
|
7602
|
+
}
|
|
7603
|
+
return {
|
|
7604
|
+
left: typeof (options === null || options === void 0 ? void 0 : options.x) === 'number'
|
|
7605
|
+
? Math.max(options.x, 0)
|
|
7606
|
+
: DEFAULT_FLOATING_GROUP_POSITION.left,
|
|
7607
|
+
top: typeof (options === null || options === void 0 ? void 0 : options.y) === 'number'
|
|
7608
|
+
? Math.max(options.y, 0)
|
|
7609
|
+
: DEFAULT_FLOATING_GROUP_POSITION.top,
|
|
7610
|
+
width: typeof (options === null || options === void 0 ? void 0 : options.width) === 'number'
|
|
7611
|
+
? Math.max(options.width, 0)
|
|
7612
|
+
: DEFAULT_FLOATING_GROUP_POSITION.width,
|
|
7613
|
+
height: typeof (options === null || options === void 0 ? void 0 : options.height) === 'number'
|
|
7614
|
+
? Math.max(options.height, 0)
|
|
7615
|
+
: DEFAULT_FLOATING_GROUP_POSITION.height,
|
|
7616
|
+
};
|
|
7617
|
+
}
|
|
7618
|
+
const anchoredBox = getAnchoredBox();
|
|
7619
|
+
const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
7413
7620
|
? undefined
|
|
7414
|
-
: (
|
|
7415
|
-
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
7621
|
+
: (_c = (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport) !== null && _c !== void 0 ? _c : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE, minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
7416
7622
|
? undefined
|
|
7417
|
-
: (
|
|
7418
|
-
});
|
|
7623
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
7419
7624
|
const el = group.element.querySelector('.void-container');
|
|
7420
7625
|
if (!el) {
|
|
7421
7626
|
throw new Error('failed to find drag handle');
|
|
@@ -7513,12 +7718,21 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7513
7718
|
group.overlay.minimumInViewportWidth =
|
|
7514
7719
|
(_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
7515
7720
|
}
|
|
7516
|
-
group.overlay.setBounds(
|
|
7721
|
+
group.overlay.setBounds();
|
|
7517
7722
|
}
|
|
7518
7723
|
}
|
|
7519
7724
|
if (changed_rootOverlayOptions) {
|
|
7520
7725
|
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
7521
7726
|
}
|
|
7727
|
+
if (
|
|
7728
|
+
// if explicitly set as `undefined`
|
|
7729
|
+
'gap' in options &&
|
|
7730
|
+
options.gap === undefined) {
|
|
7731
|
+
this.gridview.margin = 0;
|
|
7732
|
+
}
|
|
7733
|
+
if (typeof options.gap === 'number') {
|
|
7734
|
+
this.gridview.margin = options.gap;
|
|
7735
|
+
}
|
|
7522
7736
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
7523
7737
|
}
|
|
7524
7738
|
layout(width, height, forceResize) {
|
|
@@ -7680,11 +7894,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7680
7894
|
const { data, position } = serializedFloatingGroup;
|
|
7681
7895
|
const group = createGroupFromSerializedState(data);
|
|
7682
7896
|
this.addFloatingGroup(group, {
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
}, { skipRemoveGroup: true, inDragMode: false });
|
|
7897
|
+
position: position,
|
|
7898
|
+
skipRemoveGroup: true,
|
|
7899
|
+
inDragMode: false,
|
|
7900
|
+
});
|
|
7688
7901
|
}
|
|
7689
7902
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7690
7903
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
@@ -7815,15 +8028,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7815
8028
|
if (options.floating) {
|
|
7816
8029
|
const group = this.createGroup();
|
|
7817
8030
|
this._onDidAddGroup.fire(group);
|
|
7818
|
-
const
|
|
8031
|
+
const floatingGroupOptions = typeof options.floating === 'object' &&
|
|
7819
8032
|
options.floating !== null
|
|
7820
8033
|
? options.floating
|
|
7821
8034
|
: {};
|
|
7822
|
-
this.addFloatingGroup(group,
|
|
7823
|
-
inDragMode: false,
|
|
7824
|
-
skipRemoveGroup: true,
|
|
7825
|
-
skipActiveGroup: true,
|
|
7826
|
-
});
|
|
8035
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, floatingGroupOptions), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
7827
8036
|
panel = this.createPanel(options, group);
|
|
7828
8037
|
group.model.openPanel(panel, {
|
|
7829
8038
|
skipSetActive: options.inactive,
|
|
@@ -7862,11 +8071,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7862
8071
|
options.floating !== null
|
|
7863
8072
|
? options.floating
|
|
7864
8073
|
: {};
|
|
7865
|
-
this.addFloatingGroup(group, coordinates, {
|
|
7866
|
-
inDragMode: false,
|
|
7867
|
-
skipRemoveGroup: true,
|
|
7868
|
-
skipActiveGroup: true,
|
|
7869
|
-
});
|
|
8074
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, coordinates), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
7870
8075
|
panel = this.createPanel(options, group);
|
|
7871
8076
|
group.model.openPanel(panel, {
|
|
7872
8077
|
skipSetActive: options.inactive,
|
|
@@ -7921,6 +8126,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7921
8126
|
});
|
|
7922
8127
|
const watermarkContainer = document.createElement('div');
|
|
7923
8128
|
watermarkContainer.className = 'dv-watermark-container';
|
|
8129
|
+
addTestId(watermarkContainer, 'watermark-component');
|
|
7924
8130
|
watermarkContainer.appendChild(this.watermark.element);
|
|
7925
8131
|
this.gridview.element.appendChild(watermarkContainer);
|
|
7926
8132
|
}
|
|
@@ -8109,6 +8315,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8109
8315
|
this.doSetGroupAndPanelActive(destinationGroup);
|
|
8110
8316
|
this._onDidMovePanel.fire({
|
|
8111
8317
|
panel: removedPanel,
|
|
8318
|
+
from: sourceGroup,
|
|
8112
8319
|
});
|
|
8113
8320
|
}
|
|
8114
8321
|
else {
|
|
@@ -8132,6 +8339,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8132
8339
|
// if a group has one tab - we are essentially moving the 'group'
|
|
8133
8340
|
// which is equivalent to swapping two views in this case
|
|
8134
8341
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8342
|
+
this._onDidMovePanel.fire({
|
|
8343
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
8344
|
+
from: sourceGroup,
|
|
8345
|
+
});
|
|
8135
8346
|
return;
|
|
8136
8347
|
}
|
|
8137
8348
|
}
|
|
@@ -8145,6 +8356,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8145
8356
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
8146
8357
|
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8147
8358
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
8359
|
+
this._onDidMovePanel.fire({
|
|
8360
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
8361
|
+
from: sourceGroup,
|
|
8362
|
+
});
|
|
8148
8363
|
}
|
|
8149
8364
|
else {
|
|
8150
8365
|
/**
|
|
@@ -8164,6 +8379,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8164
8379
|
skipSetGroupActive: true,
|
|
8165
8380
|
}));
|
|
8166
8381
|
this.doSetGroupAndPanelActive(group);
|
|
8382
|
+
this._onDidMovePanel.fire({
|
|
8383
|
+
panel: removedPanel,
|
|
8384
|
+
from: sourceGroup,
|
|
8385
|
+
});
|
|
8167
8386
|
}
|
|
8168
8387
|
}
|
|
8169
8388
|
}
|
|
@@ -8188,9 +8407,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8188
8407
|
}
|
|
8189
8408
|
});
|
|
8190
8409
|
this.doSetGroupAndPanelActive(to);
|
|
8191
|
-
panels.forEach((panel) => {
|
|
8192
|
-
this._onDidMovePanel.fire({ panel });
|
|
8193
|
-
});
|
|
8194
8410
|
}
|
|
8195
8411
|
else {
|
|
8196
8412
|
switch (from.api.location.type) {
|
|
@@ -8216,10 +8432,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8216
8432
|
const referenceLocation = getGridLocation(to.element);
|
|
8217
8433
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8218
8434
|
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8219
|
-
from.panels.forEach((panel) => {
|
|
8220
|
-
this._onDidMovePanel.fire({ panel });
|
|
8221
|
-
});
|
|
8222
8435
|
}
|
|
8436
|
+
from.panels.forEach((panel) => {
|
|
8437
|
+
this._onDidMovePanel.fire({ panel, from });
|
|
8438
|
+
});
|
|
8223
8439
|
}
|
|
8224
8440
|
doSetGroupActive(group) {
|
|
8225
8441
|
super.doSetGroupActive(group);
|