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
|
*/
|
|
@@ -532,6 +532,9 @@
|
|
|
532
532
|
}
|
|
533
533
|
return false;
|
|
534
534
|
}
|
|
535
|
+
function addTestId(element, id) {
|
|
536
|
+
element.setAttribute('data-testid', id);
|
|
537
|
+
}
|
|
535
538
|
|
|
536
539
|
function tail(arr) {
|
|
537
540
|
if (arr.length === 0) {
|
|
@@ -593,7 +596,11 @@
|
|
|
593
596
|
|
|
594
597
|
const clamp = (value, min, max) => {
|
|
595
598
|
if (min > max) {
|
|
596
|
-
|
|
599
|
+
/**
|
|
600
|
+
* caveat: an error should be thrown here if this was a proper `clamp` function but we need to handle
|
|
601
|
+
* cases where `min` > `max` and in those cases return `min`.
|
|
602
|
+
*/
|
|
603
|
+
return min;
|
|
597
604
|
}
|
|
598
605
|
return Math.min(max, Math.max(value, min));
|
|
599
606
|
};
|
|
@@ -798,7 +805,14 @@
|
|
|
798
805
|
this._disabled = value;
|
|
799
806
|
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
800
807
|
}
|
|
808
|
+
get margin() {
|
|
809
|
+
return this._margin;
|
|
810
|
+
}
|
|
811
|
+
set margin(value) {
|
|
812
|
+
this._margin = value;
|
|
813
|
+
}
|
|
801
814
|
constructor(container, options) {
|
|
815
|
+
var _a;
|
|
802
816
|
this.container = container;
|
|
803
817
|
this.viewItems = [];
|
|
804
818
|
this.sashes = [];
|
|
@@ -809,6 +823,7 @@
|
|
|
809
823
|
this._startSnappingEnabled = true;
|
|
810
824
|
this._endSnappingEnabled = true;
|
|
811
825
|
this._disabled = false;
|
|
826
|
+
this._margin = 0;
|
|
812
827
|
this._onDidSashEnd = new Emitter();
|
|
813
828
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
814
829
|
this._onDidAddView = new Emitter();
|
|
@@ -897,6 +912,7 @@
|
|
|
897
912
|
};
|
|
898
913
|
this._orientation = options.orientation;
|
|
899
914
|
this.element = this.createContainer();
|
|
915
|
+
this.margin = (_a = options.margin) !== null && _a !== void 0 ? _a : 0;
|
|
900
916
|
this.proportionalLayout =
|
|
901
917
|
options.proportionalLayout === undefined
|
|
902
918
|
? true
|
|
@@ -951,9 +967,7 @@
|
|
|
951
967
|
if (index < 0 || index >= this.viewItems.length) {
|
|
952
968
|
throw new Error('Index out of bounds');
|
|
953
969
|
}
|
|
954
|
-
toggleClass(this.container, 'visible', visible);
|
|
955
970
|
const viewItem = this.viewItems[index];
|
|
956
|
-
toggleClass(this.container, 'visible', visible);
|
|
957
971
|
viewItem.setVisible(visible, viewItem.size);
|
|
958
972
|
this.distributeEmptySpace(index);
|
|
959
973
|
this.layoutViews();
|
|
@@ -1265,15 +1279,29 @@
|
|
|
1265
1279
|
this._proportions = this.viewItems.map((i) => i.visible ? i.size / this._contentSize : undefined);
|
|
1266
1280
|
}
|
|
1267
1281
|
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Margin explain:
|
|
1284
|
+
*
|
|
1285
|
+
* For `n` views in a splitview there will be `n-1` margins `m`.
|
|
1286
|
+
*
|
|
1287
|
+
* To fit the margins each view must reduce in size by `(m * (n - 1)) / n`.
|
|
1288
|
+
*
|
|
1289
|
+
* For each view `i` the offet must be adjusted by `m * i/(n - 1)`.
|
|
1290
|
+
*/
|
|
1268
1291
|
layoutViews() {
|
|
1269
1292
|
this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1270
|
-
let sum = 0;
|
|
1271
|
-
const x = [];
|
|
1272
1293
|
this.updateSashEnablement();
|
|
1294
|
+
if (this.viewItems.length === 0) {
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
const sashCount = this.viewItems.length - 1;
|
|
1298
|
+
const marginReducedSize = (this.margin * sashCount) / this.viewItems.length;
|
|
1299
|
+
let totalLeftOffset = 0;
|
|
1300
|
+
const viewLeftOffsets = [];
|
|
1273
1301
|
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
const offset = Math.min(Math.max(0,
|
|
1302
|
+
totalLeftOffset += this.viewItems[i].size;
|
|
1303
|
+
viewLeftOffsets.push(totalLeftOffset);
|
|
1304
|
+
const offset = Math.min(Math.max(0, totalLeftOffset - 2), this.size - this.margin);
|
|
1277
1305
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1278
1306
|
this.sashes[i].container.style.left = `${offset}px`;
|
|
1279
1307
|
this.sashes[i].container.style.top = `0px`;
|
|
@@ -1284,19 +1312,24 @@
|
|
|
1284
1312
|
}
|
|
1285
1313
|
}
|
|
1286
1314
|
this.viewItems.forEach((view, i) => {
|
|
1315
|
+
const size = view.size - marginReducedSize;
|
|
1316
|
+
const offset = i === 0
|
|
1317
|
+
? 0
|
|
1318
|
+
: viewLeftOffsets[i - 1] +
|
|
1319
|
+
(i / sashCount) * marginReducedSize;
|
|
1287
1320
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1288
|
-
view.container.style.width = `${
|
|
1289
|
-
view.container.style.left =
|
|
1321
|
+
view.container.style.width = `${size}px`;
|
|
1322
|
+
view.container.style.left = `${offset}px`;
|
|
1290
1323
|
view.container.style.top = '';
|
|
1291
1324
|
view.container.style.height = '';
|
|
1292
1325
|
}
|
|
1293
1326
|
if (this._orientation === exports.Orientation.VERTICAL) {
|
|
1294
|
-
view.container.style.height = `${
|
|
1295
|
-
view.container.style.top =
|
|
1327
|
+
view.container.style.height = `${size}px`;
|
|
1328
|
+
view.container.style.top = `${offset}px`;
|
|
1296
1329
|
view.container.style.width = '';
|
|
1297
1330
|
view.container.style.left = '';
|
|
1298
1331
|
}
|
|
1299
|
-
view.view.layout(view.size, this._orthogonalSize);
|
|
1332
|
+
view.view.layout(view.size - marginReducedSize, this._orthogonalSize);
|
|
1300
1333
|
});
|
|
1301
1334
|
}
|
|
1302
1335
|
findFirstSnapIndex(indexes) {
|
|
@@ -1745,7 +1778,18 @@
|
|
|
1745
1778
|
set disabled(value) {
|
|
1746
1779
|
this.splitview.disabled = value;
|
|
1747
1780
|
}
|
|
1748
|
-
|
|
1781
|
+
get margin() {
|
|
1782
|
+
return this.splitview.margin;
|
|
1783
|
+
}
|
|
1784
|
+
set margin(value) {
|
|
1785
|
+
this.splitview.margin = value;
|
|
1786
|
+
this.children.forEach((child) => {
|
|
1787
|
+
if (child instanceof BranchNode) {
|
|
1788
|
+
child.margin = value;
|
|
1789
|
+
}
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, margin, childDescriptors) {
|
|
1749
1793
|
super();
|
|
1750
1794
|
this.orientation = orientation;
|
|
1751
1795
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1765,6 +1809,7 @@
|
|
|
1765
1809
|
orientation: this.orientation,
|
|
1766
1810
|
proportionalLayout,
|
|
1767
1811
|
styles,
|
|
1812
|
+
margin,
|
|
1768
1813
|
});
|
|
1769
1814
|
this.splitview.layout(this.size, this.orthogonalSize);
|
|
1770
1815
|
}
|
|
@@ -1788,6 +1833,7 @@
|
|
|
1788
1833
|
descriptor,
|
|
1789
1834
|
proportionalLayout,
|
|
1790
1835
|
styles,
|
|
1836
|
+
margin,
|
|
1791
1837
|
});
|
|
1792
1838
|
}
|
|
1793
1839
|
this.disabled = disabled;
|
|
@@ -1796,10 +1842,8 @@
|
|
|
1796
1842
|
}));
|
|
1797
1843
|
this.setupChildrenEvents();
|
|
1798
1844
|
}
|
|
1799
|
-
setVisible(
|
|
1800
|
-
|
|
1801
|
-
child.setVisible(visible);
|
|
1802
|
-
}
|
|
1845
|
+
setVisible(_visible) {
|
|
1846
|
+
// noop
|
|
1803
1847
|
}
|
|
1804
1848
|
isChildVisible(index) {
|
|
1805
1849
|
if (index < 0 || index >= this.children.length) {
|
|
@@ -1816,12 +1860,13 @@
|
|
|
1816
1860
|
}
|
|
1817
1861
|
const wereAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1818
1862
|
this.splitview.setViewVisible(index, visible);
|
|
1863
|
+
// }
|
|
1819
1864
|
const areAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1820
1865
|
// If all children are hidden then the parent should hide the entire splitview
|
|
1821
1866
|
// If the entire splitview is hidden then the parent should show the splitview when a child is shown
|
|
1822
1867
|
if ((visible && wereAllChildrenHidden) ||
|
|
1823
1868
|
(!visible && areAllChildrenHidden)) {
|
|
1824
|
-
this._onDidVisibilityChange.fire(visible);
|
|
1869
|
+
this._onDidVisibilityChange.fire({ visible });
|
|
1825
1870
|
}
|
|
1826
1871
|
}
|
|
1827
1872
|
moveChild(from, to) {
|
|
@@ -1894,7 +1939,7 @@
|
|
|
1894
1939
|
this._onDidChange.fire({ size: e.orthogonalSize });
|
|
1895
1940
|
}), ...this.children.map((c, i) => {
|
|
1896
1941
|
if (c instanceof BranchNode) {
|
|
1897
|
-
return c.onDidVisibilityChange((visible) => {
|
|
1942
|
+
return c.onDidVisibilityChange(({ visible }) => {
|
|
1898
1943
|
this.setChildVisible(i, visible);
|
|
1899
1944
|
});
|
|
1900
1945
|
}
|
|
@@ -1924,7 +1969,7 @@
|
|
|
1924
1969
|
}
|
|
1925
1970
|
function flipNode(node, size, orthogonalSize) {
|
|
1926
1971
|
if (node instanceof BranchNode) {
|
|
1927
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1972
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
|
|
1928
1973
|
let totalSize = 0;
|
|
1929
1974
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1930
1975
|
const child = node.children[i];
|
|
@@ -2079,6 +2124,13 @@
|
|
|
2079
2124
|
}
|
|
2080
2125
|
}
|
|
2081
2126
|
}
|
|
2127
|
+
get margin() {
|
|
2128
|
+
return this._margin;
|
|
2129
|
+
}
|
|
2130
|
+
set margin(value) {
|
|
2131
|
+
this._margin = value;
|
|
2132
|
+
this.root.margin = value;
|
|
2133
|
+
}
|
|
2082
2134
|
maximizedView() {
|
|
2083
2135
|
var _a;
|
|
2084
2136
|
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
@@ -2164,13 +2216,14 @@
|
|
|
2164
2216
|
this.disposable.dispose();
|
|
2165
2217
|
this._onDidChange.dispose();
|
|
2166
2218
|
this._onDidMaximizedNodeChange.dispose();
|
|
2219
|
+
this._onDidViewVisibilityChange.dispose();
|
|
2167
2220
|
this.root.dispose();
|
|
2168
2221
|
this._maximizedNode = undefined;
|
|
2169
2222
|
this.element.remove();
|
|
2170
2223
|
}
|
|
2171
2224
|
clear() {
|
|
2172
2225
|
const orientation = this.root.orientation;
|
|
2173
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.
|
|
2226
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.locked, this.margin);
|
|
2174
2227
|
}
|
|
2175
2228
|
deserialize(json, deserializer) {
|
|
2176
2229
|
const orientation = json.orientation;
|
|
@@ -2181,6 +2234,7 @@
|
|
|
2181
2234
|
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
|
|
2182
2235
|
}
|
|
2183
2236
|
_deserializeNode(node, orientation, deserializer, orthogonalSize) {
|
|
2237
|
+
var _a;
|
|
2184
2238
|
let result;
|
|
2185
2239
|
if (node.type === 'branch') {
|
|
2186
2240
|
const serializedChildren = node.data;
|
|
@@ -2192,10 +2246,14 @@
|
|
|
2192
2246
|
});
|
|
2193
2247
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2194
2248
|
orthogonalSize, // <- size - flips at each depth,
|
|
2195
|
-
this.
|
|
2249
|
+
this.locked, this.margin, children);
|
|
2196
2250
|
}
|
|
2197
2251
|
else {
|
|
2198
|
-
|
|
2252
|
+
const view = deserializer.fromJSON(node);
|
|
2253
|
+
if (typeof node.visible === 'boolean') {
|
|
2254
|
+
(_a = view.setVisible) === null || _a === void 0 ? void 0 : _a.call(view, node.visible);
|
|
2255
|
+
}
|
|
2256
|
+
result = new LeafNode(view, orientation, orthogonalSize, node.size);
|
|
2199
2257
|
}
|
|
2200
2258
|
return result;
|
|
2201
2259
|
}
|
|
@@ -2225,7 +2283,7 @@
|
|
|
2225
2283
|
}
|
|
2226
2284
|
const oldRoot = this.root;
|
|
2227
2285
|
oldRoot.element.remove();
|
|
2228
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.
|
|
2286
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.locked, this.margin);
|
|
2229
2287
|
if (oldRoot.children.length === 0) ;
|
|
2230
2288
|
else if (oldRoot.children.length === 1) {
|
|
2231
2289
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2290,19 +2348,24 @@
|
|
|
2290
2348
|
}
|
|
2291
2349
|
return findLeaf(this.root, reverse);
|
|
2292
2350
|
}
|
|
2293
|
-
constructor(proportionalLayout, styles, orientation) {
|
|
2351
|
+
constructor(proportionalLayout, styles, orientation, locked, margin) {
|
|
2294
2352
|
this.proportionalLayout = proportionalLayout;
|
|
2295
2353
|
this.styles = styles;
|
|
2296
2354
|
this._locked = false;
|
|
2355
|
+
this._margin = 0;
|
|
2297
2356
|
this._maximizedNode = undefined;
|
|
2298
2357
|
this.disposable = new MutableDisposable();
|
|
2299
2358
|
this._onDidChange = new Emitter();
|
|
2300
2359
|
this.onDidChange = this._onDidChange.event;
|
|
2360
|
+
this._onDidViewVisibilityChange = new Emitter();
|
|
2361
|
+
this.onDidViewVisibilityChange = this._onDidViewVisibilityChange.event;
|
|
2301
2362
|
this._onDidMaximizedNodeChange = new Emitter();
|
|
2302
2363
|
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2303
2364
|
this.element = document.createElement('div');
|
|
2304
2365
|
this.element.className = 'grid-view';
|
|
2305
|
-
this.
|
|
2366
|
+
this._locked = locked !== null && locked !== void 0 ? locked : false;
|
|
2367
|
+
this._margin = margin !== null && margin !== void 0 ? margin : 0;
|
|
2368
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this.locked, this.margin);
|
|
2306
2369
|
}
|
|
2307
2370
|
isViewVisible(location) {
|
|
2308
2371
|
const [rest, index] = tail(location);
|
|
@@ -2321,6 +2384,7 @@
|
|
|
2321
2384
|
if (!(parent instanceof BranchNode)) {
|
|
2322
2385
|
throw new Error('Invalid from location');
|
|
2323
2386
|
}
|
|
2387
|
+
this._onDidViewVisibilityChange.fire();
|
|
2324
2388
|
parent.setChildVisible(index, visible);
|
|
2325
2389
|
}
|
|
2326
2390
|
moveView(parentLocation, from, to) {
|
|
@@ -2353,7 +2417,7 @@
|
|
|
2353
2417
|
}
|
|
2354
2418
|
const child = grandParent.removeChild(parentIndex);
|
|
2355
2419
|
child.dispose();
|
|
2356
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.
|
|
2420
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.locked, this.margin);
|
|
2357
2421
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2358
2422
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2359
2423
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2592,14 +2656,18 @@
|
|
|
2592
2656
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2593
2657
|
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
2594
2658
|
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
2659
|
+
this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
|
|
2660
|
+
this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
|
|
2595
2661
|
this.element.style.height = '100%';
|
|
2596
2662
|
this.element.style.width = '100%';
|
|
2597
2663
|
options.parentElement.appendChild(this.element);
|
|
2598
|
-
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
2664
|
+
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
|
|
2599
2665
|
this.gridview.locked = !!options.locked;
|
|
2600
2666
|
this.element.appendChild(this.gridview.element);
|
|
2601
2667
|
this.layout(0, 0, true); // set some elements height/widths
|
|
2602
|
-
this.addDisposables(
|
|
2668
|
+
this.addDisposables(this.gridview.onDidViewVisibilityChange(() => this._onDidViewVisibilityChangeMicroTaskQueue.fire()), this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
2669
|
+
this.layout(this.width, this.height, true);
|
|
2670
|
+
}), exports.DockviewDisposable.from(() => {
|
|
2603
2671
|
var _a;
|
|
2604
2672
|
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
2605
2673
|
}), this.gridview.onDidChange(() => {
|
|
@@ -3177,6 +3245,9 @@
|
|
|
3177
3245
|
get totalPanels() {
|
|
3178
3246
|
return this.component.totalPanels;
|
|
3179
3247
|
}
|
|
3248
|
+
get gap() {
|
|
3249
|
+
return this.component.gap;
|
|
3250
|
+
}
|
|
3180
3251
|
/**
|
|
3181
3252
|
* Invoked when the active group changes. May be undefined if no group is active.
|
|
3182
3253
|
*/
|
|
@@ -3213,6 +3284,9 @@
|
|
|
3213
3284
|
get onDidRemovePanel() {
|
|
3214
3285
|
return this.component.onDidRemovePanel;
|
|
3215
3286
|
}
|
|
3287
|
+
get onDidMovePanel() {
|
|
3288
|
+
return this.component.onDidMovePanel;
|
|
3289
|
+
}
|
|
3216
3290
|
/**
|
|
3217
3291
|
* Invoked after a layout is deserialzied using the `fromJSON` method.
|
|
3218
3292
|
*/
|
|
@@ -3353,8 +3427,8 @@
|
|
|
3353
3427
|
/**
|
|
3354
3428
|
* Add a floating group
|
|
3355
3429
|
*/
|
|
3356
|
-
addFloatingGroup(item,
|
|
3357
|
-
return this.component.addFloatingGroup(item,
|
|
3430
|
+
addFloatingGroup(item, options) {
|
|
3431
|
+
return this.component.addFloatingGroup(item, options);
|
|
3358
3432
|
}
|
|
3359
3433
|
/**
|
|
3360
3434
|
* Create a component from a serialized object.
|
|
@@ -3404,6 +3478,9 @@
|
|
|
3404
3478
|
addPopoutGroup(item, options) {
|
|
3405
3479
|
return this.component.addPopoutGroup(item, options);
|
|
3406
3480
|
}
|
|
3481
|
+
setGap(gap) {
|
|
3482
|
+
this.component.updateOptions({ gap });
|
|
3483
|
+
}
|
|
3407
3484
|
}
|
|
3408
3485
|
|
|
3409
3486
|
class DragHandler extends CompositeDisposable {
|
|
@@ -4773,7 +4850,8 @@
|
|
|
4773
4850
|
this.accessor.addFloatingGroup(this.group, {
|
|
4774
4851
|
x: left - rootLeft + 20,
|
|
4775
4852
|
y: top - rootTop + 20,
|
|
4776
|
-
|
|
4853
|
+
inDragMode: true,
|
|
4854
|
+
});
|
|
4777
4855
|
}
|
|
4778
4856
|
}), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
4779
4857
|
if (event.defaultPrevented) {
|
|
@@ -4842,7 +4920,8 @@
|
|
|
4842
4920
|
this.accessor.addFloatingGroup(panel, {
|
|
4843
4921
|
x: left - rootLeft,
|
|
4844
4922
|
y: top - rootTop,
|
|
4845
|
-
|
|
4923
|
+
inDragMode: true,
|
|
4924
|
+
});
|
|
4846
4925
|
return;
|
|
4847
4926
|
}
|
|
4848
4927
|
const isLeftClick = event.button === 0;
|
|
@@ -4915,6 +4994,7 @@
|
|
|
4915
4994
|
rootOverlayModel: undefined,
|
|
4916
4995
|
locked: undefined,
|
|
4917
4996
|
disableDnd: undefined,
|
|
4997
|
+
gap: undefined,
|
|
4918
4998
|
};
|
|
4919
4999
|
return Object.keys(properties);
|
|
4920
5000
|
})();
|
|
@@ -5645,6 +5725,9 @@
|
|
|
5645
5725
|
get isActive() {
|
|
5646
5726
|
return this.api.isActive;
|
|
5647
5727
|
}
|
|
5728
|
+
get isVisible() {
|
|
5729
|
+
return this.api.isVisible;
|
|
5730
|
+
}
|
|
5648
5731
|
constructor(id, component, options, api) {
|
|
5649
5732
|
super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
|
|
5650
5733
|
this._evaluatedMinimumWidth = 0;
|
|
@@ -6407,12 +6490,7 @@
|
|
|
6407
6490
|
this._element.appendChild(this.options.content);
|
|
6408
6491
|
this.options.container.appendChild(this._element);
|
|
6409
6492
|
// if input bad resize within acceptable boundaries
|
|
6410
|
-
this.setBounds({
|
|
6411
|
-
height: this.options.height,
|
|
6412
|
-
width: this.options.width,
|
|
6413
|
-
top: this.options.top,
|
|
6414
|
-
left: this.options.left,
|
|
6415
|
-
});
|
|
6493
|
+
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 })));
|
|
6416
6494
|
}
|
|
6417
6495
|
setBounds(bounds = {}) {
|
|
6418
6496
|
if (typeof bounds.height === 'number') {
|
|
@@ -6421,11 +6499,25 @@
|
|
|
6421
6499
|
if (typeof bounds.width === 'number') {
|
|
6422
6500
|
this._element.style.width = `${bounds.width}px`;
|
|
6423
6501
|
}
|
|
6424
|
-
if (typeof bounds.top === 'number') {
|
|
6502
|
+
if ('top' in bounds && typeof bounds.top === 'number') {
|
|
6425
6503
|
this._element.style.top = `${bounds.top}px`;
|
|
6504
|
+
this._element.style.bottom = 'auto';
|
|
6505
|
+
this.verticalAlignment = 'top';
|
|
6506
|
+
}
|
|
6507
|
+
if ('bottom' in bounds && typeof bounds.bottom === 'number') {
|
|
6508
|
+
this._element.style.bottom = `${bounds.bottom}px`;
|
|
6509
|
+
this._element.style.top = 'auto';
|
|
6510
|
+
this.verticalAlignment = 'bottom';
|
|
6426
6511
|
}
|
|
6427
|
-
if (typeof bounds.left === 'number') {
|
|
6512
|
+
if ('left' in bounds && typeof bounds.left === 'number') {
|
|
6428
6513
|
this._element.style.left = `${bounds.left}px`;
|
|
6514
|
+
this._element.style.right = 'auto';
|
|
6515
|
+
this.horiziontalAlignment = 'left';
|
|
6516
|
+
}
|
|
6517
|
+
if ('right' in bounds && typeof bounds.right === 'number') {
|
|
6518
|
+
this._element.style.right = `${bounds.right}px`;
|
|
6519
|
+
this._element.style.left = 'auto';
|
|
6520
|
+
this.horiziontalAlignment = 'right';
|
|
6429
6521
|
}
|
|
6430
6522
|
const containerRect = this.options.container.getBoundingClientRect();
|
|
6431
6523
|
const overlayRect = this._element.getBoundingClientRect();
|
|
@@ -6433,24 +6525,54 @@
|
|
|
6433
6525
|
// a minimum width of minimumViewportWidth must be inside the viewport
|
|
6434
6526
|
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
6435
6527
|
// a minimum height of minimumViewportHeight must be inside the viewport
|
|
6436
|
-
const yOffset =
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
this.
|
|
6528
|
+
const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
|
|
6529
|
+
if (this.verticalAlignment === 'top') {
|
|
6530
|
+
const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6531
|
+
this._element.style.top = `${top}px`;
|
|
6532
|
+
this._element.style.bottom = 'auto';
|
|
6533
|
+
}
|
|
6534
|
+
if (this.verticalAlignment === 'bottom') {
|
|
6535
|
+
const bottom = clamp(containerRect.bottom - overlayRect.bottom, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6536
|
+
this._element.style.bottom = `${bottom}px`;
|
|
6537
|
+
this._element.style.top = 'auto';
|
|
6538
|
+
}
|
|
6539
|
+
if (this.horiziontalAlignment === 'left') {
|
|
6540
|
+
const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6541
|
+
this._element.style.left = `${left}px`;
|
|
6542
|
+
this._element.style.right = 'auto';
|
|
6543
|
+
}
|
|
6544
|
+
if (this.horiziontalAlignment === 'right') {
|
|
6545
|
+
const right = clamp(containerRect.right - overlayRect.right, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6546
|
+
this._element.style.right = `${right}px`;
|
|
6547
|
+
this._element.style.left = 'auto';
|
|
6548
|
+
}
|
|
6443
6549
|
this._onDidChange.fire();
|
|
6444
6550
|
}
|
|
6445
6551
|
toJSON() {
|
|
6446
6552
|
const container = this.options.container.getBoundingClientRect();
|
|
6447
6553
|
const element = this._element.getBoundingClientRect();
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6554
|
+
const result = {};
|
|
6555
|
+
if (this.verticalAlignment === 'top') {
|
|
6556
|
+
result.top = parseFloat(this._element.style.top);
|
|
6557
|
+
}
|
|
6558
|
+
else if (this.verticalAlignment === 'bottom') {
|
|
6559
|
+
result.bottom = parseFloat(this._element.style.bottom);
|
|
6560
|
+
}
|
|
6561
|
+
else {
|
|
6562
|
+
result.top = element.top - container.top;
|
|
6563
|
+
}
|
|
6564
|
+
if (this.horiziontalAlignment === 'left') {
|
|
6565
|
+
result.left = parseFloat(this._element.style.left);
|
|
6566
|
+
}
|
|
6567
|
+
else if (this.horiziontalAlignment === 'right') {
|
|
6568
|
+
result.right = parseFloat(this._element.style.right);
|
|
6569
|
+
}
|
|
6570
|
+
else {
|
|
6571
|
+
result.left = element.left - container.left;
|
|
6572
|
+
}
|
|
6573
|
+
result.width = element.width;
|
|
6574
|
+
result.height = element.height;
|
|
6575
|
+
return result;
|
|
6454
6576
|
}
|
|
6455
6577
|
setupDrag(dragTarget, options = { inDragMode: false }) {
|
|
6456
6578
|
const move = new MutableDisposable();
|
|
@@ -6482,12 +6604,30 @@
|
|
|
6482
6604
|
};
|
|
6483
6605
|
}
|
|
6484
6606
|
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
6485
|
-
const yOffset = Math.max(0, this.
|
|
6486
|
-
? this.getMinimumHeight(overlayRect.height)
|
|
6487
|
-
: 0);
|
|
6488
|
-
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6607
|
+
const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
|
|
6489
6608
|
const top = clamp(y - offset.y, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6490
|
-
|
|
6609
|
+
const bottom = clamp(offset.y -
|
|
6610
|
+
y +
|
|
6611
|
+
containerRect.height -
|
|
6612
|
+
overlayRect.height, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6613
|
+
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6614
|
+
const right = clamp(offset.x - x + containerRect.width - overlayRect.width, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6615
|
+
const bounds = {};
|
|
6616
|
+
// Anchor to top or to bottom depending on which one is closer
|
|
6617
|
+
if (top <= bottom) {
|
|
6618
|
+
bounds.top = top;
|
|
6619
|
+
}
|
|
6620
|
+
else {
|
|
6621
|
+
bounds.bottom = bottom;
|
|
6622
|
+
}
|
|
6623
|
+
// Anchor to left or to right depending on which one is closer
|
|
6624
|
+
if (left <= right) {
|
|
6625
|
+
bounds.left = left;
|
|
6626
|
+
}
|
|
6627
|
+
else {
|
|
6628
|
+
bounds.right = right;
|
|
6629
|
+
}
|
|
6630
|
+
this.setBounds(bounds);
|
|
6491
6631
|
}), addDisposableWindowListener(window, 'mouseup', () => {
|
|
6492
6632
|
toggleClass(this._element, 'dv-resize-container-dragging', false);
|
|
6493
6633
|
move.dispose();
|
|
@@ -6555,8 +6695,10 @@
|
|
|
6555
6695
|
};
|
|
6556
6696
|
}
|
|
6557
6697
|
let top = undefined;
|
|
6698
|
+
let bottom = undefined;
|
|
6558
6699
|
let height = undefined;
|
|
6559
6700
|
let left = undefined;
|
|
6701
|
+
let right = undefined;
|
|
6560
6702
|
let width = undefined;
|
|
6561
6703
|
const moveTop = () => {
|
|
6562
6704
|
top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
|
|
@@ -6570,6 +6712,7 @@
|
|
|
6570
6712
|
startPosition.originalY +
|
|
6571
6713
|
startPosition.originalHeight -
|
|
6572
6714
|
top;
|
|
6715
|
+
bottom = containerRect.height - top - height;
|
|
6573
6716
|
};
|
|
6574
6717
|
const moveBottom = () => {
|
|
6575
6718
|
top =
|
|
@@ -6581,6 +6724,7 @@
|
|
|
6581
6724
|
? -top +
|
|
6582
6725
|
this.options.minimumInViewportHeight
|
|
6583
6726
|
: Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
|
|
6727
|
+
bottom = containerRect.height - top - height;
|
|
6584
6728
|
};
|
|
6585
6729
|
const moveLeft = () => {
|
|
6586
6730
|
left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
|
|
@@ -6594,6 +6738,7 @@
|
|
|
6594
6738
|
startPosition.originalX +
|
|
6595
6739
|
startPosition.originalWidth -
|
|
6596
6740
|
left;
|
|
6741
|
+
right = containerRect.width - left - width;
|
|
6597
6742
|
};
|
|
6598
6743
|
const moveRight = () => {
|
|
6599
6744
|
left =
|
|
@@ -6605,6 +6750,7 @@
|
|
|
6605
6750
|
? -left +
|
|
6606
6751
|
this.options.minimumInViewportWidth
|
|
6607
6752
|
: Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
|
|
6753
|
+
right = containerRect.width - left - width;
|
|
6608
6754
|
};
|
|
6609
6755
|
switch (direction) {
|
|
6610
6756
|
case 'top':
|
|
@@ -6636,7 +6782,24 @@
|
|
|
6636
6782
|
moveRight();
|
|
6637
6783
|
break;
|
|
6638
6784
|
}
|
|
6639
|
-
|
|
6785
|
+
const bounds = {};
|
|
6786
|
+
// Anchor to top or to bottom depending on which one is closer
|
|
6787
|
+
if (top <= bottom) {
|
|
6788
|
+
bounds.top = top;
|
|
6789
|
+
}
|
|
6790
|
+
else {
|
|
6791
|
+
bounds.bottom = bottom;
|
|
6792
|
+
}
|
|
6793
|
+
// Anchor to left or to right depending on which one is closer
|
|
6794
|
+
if (left <= right) {
|
|
6795
|
+
bounds.left = left;
|
|
6796
|
+
}
|
|
6797
|
+
else {
|
|
6798
|
+
bounds.right = right;
|
|
6799
|
+
}
|
|
6800
|
+
bounds.height = height;
|
|
6801
|
+
bounds.width = width;
|
|
6802
|
+
this.setBounds(bounds);
|
|
6640
6803
|
}), {
|
|
6641
6804
|
dispose: () => {
|
|
6642
6805
|
for (const iframe of iframes) {
|
|
@@ -6659,7 +6822,7 @@
|
|
|
6659
6822
|
if (typeof this.options.minimumInViewportHeight === 'number') {
|
|
6660
6823
|
return height - this.options.minimumInViewportHeight;
|
|
6661
6824
|
}
|
|
6662
|
-
return
|
|
6825
|
+
return 0;
|
|
6663
6826
|
}
|
|
6664
6827
|
dispose() {
|
|
6665
6828
|
this._element.remove();
|
|
@@ -6682,7 +6845,7 @@
|
|
|
6682
6845
|
}
|
|
6683
6846
|
|
|
6684
6847
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6685
|
-
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6848
|
+
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100, width: 300, height: 300 };
|
|
6686
6849
|
|
|
6687
6850
|
function createFocusableElement() {
|
|
6688
6851
|
const element = document.createElement('div');
|
|
@@ -7037,6 +7200,9 @@
|
|
|
7037
7200
|
get api() {
|
|
7038
7201
|
return this._api;
|
|
7039
7202
|
}
|
|
7203
|
+
get gap() {
|
|
7204
|
+
return this.gridview.margin;
|
|
7205
|
+
}
|
|
7040
7206
|
constructor(options) {
|
|
7041
7207
|
var _a;
|
|
7042
7208
|
super({
|
|
@@ -7048,6 +7214,7 @@
|
|
|
7048
7214
|
parentElement: options.parentElement,
|
|
7049
7215
|
disableAutoResizing: options.disableAutoResizing,
|
|
7050
7216
|
locked: options.locked,
|
|
7217
|
+
margin: options.gap,
|
|
7051
7218
|
});
|
|
7052
7219
|
this.nextGroupId = sequentialNumberGenerator();
|
|
7053
7220
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -7073,9 +7240,9 @@
|
|
|
7073
7240
|
this._onDidActivePanelChange = new Emitter();
|
|
7074
7241
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
7075
7242
|
this._onDidMovePanel = new Emitter();
|
|
7243
|
+
this.onDidMovePanel = this._onDidMovePanel.event;
|
|
7076
7244
|
this._floatingGroups = [];
|
|
7077
7245
|
this._popoutGroups = [];
|
|
7078
|
-
this._ignoreEvents = 0;
|
|
7079
7246
|
this._onDidRemoveGroup = new Emitter();
|
|
7080
7247
|
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
7081
7248
|
this._onDidAddGroup = new Emitter();
|
|
@@ -7089,7 +7256,9 @@
|
|
|
7089
7256
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7090
7257
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
7091
7258
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
7092
|
-
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.
|
|
7259
|
+
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(() => {
|
|
7260
|
+
this.updateWatermark();
|
|
7261
|
+
}), this.onDidAdd((event) => {
|
|
7093
7262
|
if (!this._moving) {
|
|
7094
7263
|
this._onDidAddGroup.fire(event);
|
|
7095
7264
|
}
|
|
@@ -7103,7 +7272,7 @@
|
|
|
7103
7272
|
}
|
|
7104
7273
|
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
7105
7274
|
this.updateWatermark();
|
|
7106
|
-
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
7275
|
+
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidMovePanel, this.onDidActivePanelChange)(() => {
|
|
7107
7276
|
this._bufferOnDidLayoutChange.fire();
|
|
7108
7277
|
}), exports.DockviewDisposable.from(() => {
|
|
7109
7278
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
@@ -7203,7 +7372,7 @@
|
|
|
7203
7372
|
var _a, _b, _c;
|
|
7204
7373
|
if (itemToPopout instanceof DockviewPanel &&
|
|
7205
7374
|
itemToPopout.group.size === 1) {
|
|
7206
|
-
return this.addPopoutGroup(itemToPopout.group);
|
|
7375
|
+
return this.addPopoutGroup(itemToPopout.group, options);
|
|
7207
7376
|
}
|
|
7208
7377
|
const theme = getDockviewTheme(this.gridview.element);
|
|
7209
7378
|
const element = this.element;
|
|
@@ -7354,8 +7523,8 @@
|
|
|
7354
7523
|
console.error('dockview: failed to create popout window', err);
|
|
7355
7524
|
});
|
|
7356
7525
|
}
|
|
7357
|
-
addFloatingGroup(item,
|
|
7358
|
-
var _a, _b, _c, _d, _e
|
|
7526
|
+
addFloatingGroup(item, options) {
|
|
7527
|
+
var _a, _b, _c, _d, _e;
|
|
7359
7528
|
let group;
|
|
7360
7529
|
if (item instanceof DockviewPanel) {
|
|
7361
7530
|
group = this.createGroup();
|
|
@@ -7400,26 +7569,62 @@
|
|
|
7400
7569
|
}
|
|
7401
7570
|
}
|
|
7402
7571
|
group.model.location = { type: 'floating' };
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7572
|
+
function getAnchoredBox() {
|
|
7573
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7574
|
+
const result = {};
|
|
7575
|
+
if ('left' in options.position) {
|
|
7576
|
+
result.left = Math.max(options.position.left, 0);
|
|
7577
|
+
}
|
|
7578
|
+
else if ('right' in options.position) {
|
|
7579
|
+
result.right = Math.max(options.position.right, 0);
|
|
7580
|
+
}
|
|
7581
|
+
else {
|
|
7582
|
+
result.left = DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
7583
|
+
}
|
|
7584
|
+
if ('top' in options.position) {
|
|
7585
|
+
result.top = Math.max(options.position.top, 0);
|
|
7586
|
+
}
|
|
7587
|
+
else if ('bottom' in options.position) {
|
|
7588
|
+
result.bottom = Math.max(options.position.bottom, 0);
|
|
7589
|
+
}
|
|
7590
|
+
else {
|
|
7591
|
+
result.top = DEFAULT_FLOATING_GROUP_POSITION.top;
|
|
7592
|
+
}
|
|
7593
|
+
if (typeof options.width === 'number') {
|
|
7594
|
+
result.width = Math.max(options.width, 0);
|
|
7595
|
+
}
|
|
7596
|
+
else {
|
|
7597
|
+
result.width = DEFAULT_FLOATING_GROUP_POSITION.width;
|
|
7598
|
+
}
|
|
7599
|
+
if (typeof options.height === 'number') {
|
|
7600
|
+
result.height = Math.max(options.height, 0);
|
|
7601
|
+
}
|
|
7602
|
+
else {
|
|
7603
|
+
result.height = DEFAULT_FLOATING_GROUP_POSITION.height;
|
|
7604
|
+
}
|
|
7605
|
+
return result;
|
|
7606
|
+
}
|
|
7607
|
+
return {
|
|
7608
|
+
left: typeof (options === null || options === void 0 ? void 0 : options.x) === 'number'
|
|
7609
|
+
? Math.max(options.x, 0)
|
|
7610
|
+
: DEFAULT_FLOATING_GROUP_POSITION.left,
|
|
7611
|
+
top: typeof (options === null || options === void 0 ? void 0 : options.y) === 'number'
|
|
7612
|
+
? Math.max(options.y, 0)
|
|
7613
|
+
: DEFAULT_FLOATING_GROUP_POSITION.top,
|
|
7614
|
+
width: typeof (options === null || options === void 0 ? void 0 : options.width) === 'number'
|
|
7615
|
+
? Math.max(options.width, 0)
|
|
7616
|
+
: DEFAULT_FLOATING_GROUP_POSITION.width,
|
|
7617
|
+
height: typeof (options === null || options === void 0 ? void 0 : options.height) === 'number'
|
|
7618
|
+
? Math.max(options.height, 0)
|
|
7619
|
+
: DEFAULT_FLOATING_GROUP_POSITION.height,
|
|
7620
|
+
};
|
|
7621
|
+
}
|
|
7622
|
+
const anchoredBox = getAnchoredBox();
|
|
7623
|
+
const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
7417
7624
|
? undefined
|
|
7418
|
-
: (
|
|
7419
|
-
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
7625
|
+
: (_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'
|
|
7420
7626
|
? undefined
|
|
7421
|
-
: (
|
|
7422
|
-
});
|
|
7627
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
7423
7628
|
const el = group.element.querySelector('.void-container');
|
|
7424
7629
|
if (!el) {
|
|
7425
7630
|
throw new Error('failed to find drag handle');
|
|
@@ -7517,12 +7722,21 @@
|
|
|
7517
7722
|
group.overlay.minimumInViewportWidth =
|
|
7518
7723
|
(_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
7519
7724
|
}
|
|
7520
|
-
group.overlay.setBounds(
|
|
7725
|
+
group.overlay.setBounds();
|
|
7521
7726
|
}
|
|
7522
7727
|
}
|
|
7523
7728
|
if (changed_rootOverlayOptions) {
|
|
7524
7729
|
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
7525
7730
|
}
|
|
7731
|
+
if (
|
|
7732
|
+
// if explicitly set as `undefined`
|
|
7733
|
+
'gap' in options &&
|
|
7734
|
+
options.gap === undefined) {
|
|
7735
|
+
this.gridview.margin = 0;
|
|
7736
|
+
}
|
|
7737
|
+
if (typeof options.gap === 'number') {
|
|
7738
|
+
this.gridview.margin = options.gap;
|
|
7739
|
+
}
|
|
7526
7740
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
7527
7741
|
}
|
|
7528
7742
|
layout(width, height, forceResize) {
|
|
@@ -7684,11 +7898,10 @@
|
|
|
7684
7898
|
const { data, position } = serializedFloatingGroup;
|
|
7685
7899
|
const group = createGroupFromSerializedState(data);
|
|
7686
7900
|
this.addFloatingGroup(group, {
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
}, { skipRemoveGroup: true, inDragMode: false });
|
|
7901
|
+
position: position,
|
|
7902
|
+
skipRemoveGroup: true,
|
|
7903
|
+
inDragMode: false,
|
|
7904
|
+
});
|
|
7692
7905
|
}
|
|
7693
7906
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7694
7907
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
@@ -7819,15 +8032,11 @@
|
|
|
7819
8032
|
if (options.floating) {
|
|
7820
8033
|
const group = this.createGroup();
|
|
7821
8034
|
this._onDidAddGroup.fire(group);
|
|
7822
|
-
const
|
|
8035
|
+
const floatingGroupOptions = typeof options.floating === 'object' &&
|
|
7823
8036
|
options.floating !== null
|
|
7824
8037
|
? options.floating
|
|
7825
8038
|
: {};
|
|
7826
|
-
this.addFloatingGroup(group,
|
|
7827
|
-
inDragMode: false,
|
|
7828
|
-
skipRemoveGroup: true,
|
|
7829
|
-
skipActiveGroup: true,
|
|
7830
|
-
});
|
|
8039
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, floatingGroupOptions), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
7831
8040
|
panel = this.createPanel(options, group);
|
|
7832
8041
|
group.model.openPanel(panel, {
|
|
7833
8042
|
skipSetActive: options.inactive,
|
|
@@ -7866,11 +8075,7 @@
|
|
|
7866
8075
|
options.floating !== null
|
|
7867
8076
|
? options.floating
|
|
7868
8077
|
: {};
|
|
7869
|
-
this.addFloatingGroup(group, coordinates, {
|
|
7870
|
-
inDragMode: false,
|
|
7871
|
-
skipRemoveGroup: true,
|
|
7872
|
-
skipActiveGroup: true,
|
|
7873
|
-
});
|
|
8078
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, coordinates), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
7874
8079
|
panel = this.createPanel(options, group);
|
|
7875
8080
|
group.model.openPanel(panel, {
|
|
7876
8081
|
skipSetActive: options.inactive,
|
|
@@ -7925,6 +8130,7 @@
|
|
|
7925
8130
|
});
|
|
7926
8131
|
const watermarkContainer = document.createElement('div');
|
|
7927
8132
|
watermarkContainer.className = 'dv-watermark-container';
|
|
8133
|
+
addTestId(watermarkContainer, 'watermark-component');
|
|
7928
8134
|
watermarkContainer.appendChild(this.watermark.element);
|
|
7929
8135
|
this.gridview.element.appendChild(watermarkContainer);
|
|
7930
8136
|
}
|
|
@@ -8113,6 +8319,7 @@
|
|
|
8113
8319
|
this.doSetGroupAndPanelActive(destinationGroup);
|
|
8114
8320
|
this._onDidMovePanel.fire({
|
|
8115
8321
|
panel: removedPanel,
|
|
8322
|
+
from: sourceGroup,
|
|
8116
8323
|
});
|
|
8117
8324
|
}
|
|
8118
8325
|
else {
|
|
@@ -8136,6 +8343,10 @@
|
|
|
8136
8343
|
// if a group has one tab - we are essentially moving the 'group'
|
|
8137
8344
|
// which is equivalent to swapping two views in this case
|
|
8138
8345
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8346
|
+
this._onDidMovePanel.fire({
|
|
8347
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
8348
|
+
from: sourceGroup,
|
|
8349
|
+
});
|
|
8139
8350
|
return;
|
|
8140
8351
|
}
|
|
8141
8352
|
}
|
|
@@ -8149,6 +8360,10 @@
|
|
|
8149
8360
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
8150
8361
|
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8151
8362
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
8363
|
+
this._onDidMovePanel.fire({
|
|
8364
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
8365
|
+
from: sourceGroup,
|
|
8366
|
+
});
|
|
8152
8367
|
}
|
|
8153
8368
|
else {
|
|
8154
8369
|
/**
|
|
@@ -8168,6 +8383,10 @@
|
|
|
8168
8383
|
skipSetGroupActive: true,
|
|
8169
8384
|
}));
|
|
8170
8385
|
this.doSetGroupAndPanelActive(group);
|
|
8386
|
+
this._onDidMovePanel.fire({
|
|
8387
|
+
panel: removedPanel,
|
|
8388
|
+
from: sourceGroup,
|
|
8389
|
+
});
|
|
8171
8390
|
}
|
|
8172
8391
|
}
|
|
8173
8392
|
}
|
|
@@ -8192,9 +8411,6 @@
|
|
|
8192
8411
|
}
|
|
8193
8412
|
});
|
|
8194
8413
|
this.doSetGroupAndPanelActive(to);
|
|
8195
|
-
panels.forEach((panel) => {
|
|
8196
|
-
this._onDidMovePanel.fire({ panel });
|
|
8197
|
-
});
|
|
8198
8414
|
}
|
|
8199
8415
|
else {
|
|
8200
8416
|
switch (from.api.location.type) {
|
|
@@ -8220,10 +8436,10 @@
|
|
|
8220
8436
|
const referenceLocation = getGridLocation(to.element);
|
|
8221
8437
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8222
8438
|
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8223
|
-
from.panels.forEach((panel) => {
|
|
8224
|
-
this._onDidMovePanel.fire({ panel });
|
|
8225
|
-
});
|
|
8226
8439
|
}
|
|
8440
|
+
from.panels.forEach((panel) => {
|
|
8441
|
+
this._onDidMovePanel.fire({ panel, from });
|
|
8442
|
+
});
|
|
8227
8443
|
}
|
|
8228
8444
|
doSetGroupActive(group) {
|
|
8229
8445
|
super.doSetGroupActive(group);
|