dockview-react 1.14.1 → 1.15.0
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/dockview-react.amd.js +347 -139
- package/dist/dockview-react.amd.js.map +1 -1
- package/dist/dockview-react.amd.min.js +2 -2
- package/dist/dockview-react.amd.min.js.map +1 -1
- package/dist/dockview-react.amd.min.noStyle.js +2 -2
- package/dist/dockview-react.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-react.amd.noStyle.js +346 -138
- package/dist/dockview-react.amd.noStyle.js.map +1 -1
- package/dist/dockview-react.cjs.js +347 -139
- package/dist/dockview-react.cjs.js.map +1 -1
- package/dist/dockview-react.esm.js +347 -139
- package/dist/dockview-react.esm.js.map +1 -1
- package/dist/dockview-react.esm.min.js +2 -2
- package/dist/dockview-react.esm.min.js.map +1 -1
- package/dist/dockview-react.js +347 -139
- package/dist/dockview-react.js.map +1 -1
- package/dist/dockview-react.min.js +2 -2
- package/dist/dockview-react.min.js.map +1 -1
- package/dist/dockview-react.min.noStyle.js +2 -2
- package/dist/dockview-react.min.noStyle.js.map +1 -1
- package/dist/dockview-react.noStyle.js +346 -138
- package/dist/dockview-react.noStyle.js.map +1 -1
- package/dist/styles/dockview.css +0 -13
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-react
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.15.0
|
|
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(() => {
|
|
@@ -3213,6 +3281,9 @@
|
|
|
3213
3281
|
get onDidRemovePanel() {
|
|
3214
3282
|
return this.component.onDidRemovePanel;
|
|
3215
3283
|
}
|
|
3284
|
+
get onDidMovePanel() {
|
|
3285
|
+
return this.component.onDidMovePanel;
|
|
3286
|
+
}
|
|
3216
3287
|
/**
|
|
3217
3288
|
* Invoked after a layout is deserialzied using the `fromJSON` method.
|
|
3218
3289
|
*/
|
|
@@ -3353,8 +3424,8 @@
|
|
|
3353
3424
|
/**
|
|
3354
3425
|
* Add a floating group
|
|
3355
3426
|
*/
|
|
3356
|
-
addFloatingGroup(item,
|
|
3357
|
-
return this.component.addFloatingGroup(item,
|
|
3427
|
+
addFloatingGroup(item, options) {
|
|
3428
|
+
return this.component.addFloatingGroup(item, options);
|
|
3358
3429
|
}
|
|
3359
3430
|
/**
|
|
3360
3431
|
* Create a component from a serialized object.
|
|
@@ -3404,6 +3475,9 @@
|
|
|
3404
3475
|
addPopoutGroup(item, options) {
|
|
3405
3476
|
return this.component.addPopoutGroup(item, options);
|
|
3406
3477
|
}
|
|
3478
|
+
setGap(gap) {
|
|
3479
|
+
this.component.updateOptions({ gap });
|
|
3480
|
+
}
|
|
3407
3481
|
}
|
|
3408
3482
|
|
|
3409
3483
|
class DragHandler extends CompositeDisposable {
|
|
@@ -4773,7 +4847,8 @@
|
|
|
4773
4847
|
this.accessor.addFloatingGroup(this.group, {
|
|
4774
4848
|
x: left - rootLeft + 20,
|
|
4775
4849
|
y: top - rootTop + 20,
|
|
4776
|
-
|
|
4850
|
+
inDragMode: true,
|
|
4851
|
+
});
|
|
4777
4852
|
}
|
|
4778
4853
|
}), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
4779
4854
|
if (event.defaultPrevented) {
|
|
@@ -4842,7 +4917,8 @@
|
|
|
4842
4917
|
this.accessor.addFloatingGroup(panel, {
|
|
4843
4918
|
x: left - rootLeft,
|
|
4844
4919
|
y: top - rootTop,
|
|
4845
|
-
|
|
4920
|
+
inDragMode: true,
|
|
4921
|
+
});
|
|
4846
4922
|
return;
|
|
4847
4923
|
}
|
|
4848
4924
|
const isLeftClick = event.button === 0;
|
|
@@ -4915,6 +4991,7 @@
|
|
|
4915
4991
|
rootOverlayModel: undefined,
|
|
4916
4992
|
locked: undefined,
|
|
4917
4993
|
disableDnd: undefined,
|
|
4994
|
+
gap: undefined,
|
|
4918
4995
|
};
|
|
4919
4996
|
return Object.keys(properties);
|
|
4920
4997
|
})();
|
|
@@ -5645,6 +5722,9 @@
|
|
|
5645
5722
|
get isActive() {
|
|
5646
5723
|
return this.api.isActive;
|
|
5647
5724
|
}
|
|
5725
|
+
get isVisible() {
|
|
5726
|
+
return this.api.isVisible;
|
|
5727
|
+
}
|
|
5648
5728
|
constructor(id, component, options, api) {
|
|
5649
5729
|
super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
|
|
5650
5730
|
this._evaluatedMinimumWidth = 0;
|
|
@@ -6181,52 +6261,40 @@
|
|
|
6181
6261
|
}
|
|
6182
6262
|
constructor() {
|
|
6183
6263
|
super();
|
|
6184
|
-
//
|
|
6185
|
-
this.params = {};
|
|
6186
6264
|
this._element = document.createElement('div');
|
|
6187
6265
|
this._element.className = 'dv-default-tab';
|
|
6188
|
-
//
|
|
6189
6266
|
this._content = document.createElement('div');
|
|
6190
6267
|
this._content.className = 'dv-default-tab-content';
|
|
6191
6268
|
this.action = document.createElement('div');
|
|
6192
6269
|
this.action.className = 'dv-default-tab-action';
|
|
6193
6270
|
this.action.appendChild(createCloseButton());
|
|
6194
|
-
//
|
|
6195
6271
|
this._element.appendChild(this._content);
|
|
6196
6272
|
this._element.appendChild(this.action);
|
|
6197
|
-
//
|
|
6198
6273
|
this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
|
|
6199
6274
|
ev.preventDefault();
|
|
6200
6275
|
}));
|
|
6201
6276
|
this.render();
|
|
6202
6277
|
}
|
|
6203
|
-
update(event) {
|
|
6204
|
-
this.params = Object.assign(Object.assign({}, this.params), event.params);
|
|
6205
|
-
this.render();
|
|
6206
|
-
}
|
|
6207
|
-
focus() {
|
|
6208
|
-
//noop
|
|
6209
|
-
}
|
|
6210
6278
|
init(params) {
|
|
6211
|
-
this.
|
|
6212
|
-
this.
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6279
|
+
this._title = params.title;
|
|
6280
|
+
this.addDisposables(params.api.onDidTitleChange((event) => {
|
|
6281
|
+
this._title = event.title;
|
|
6282
|
+
this.render();
|
|
6283
|
+
}), addDisposableListener(this.action, 'mousedown', (ev) => {
|
|
6284
|
+
ev.preventDefault();
|
|
6285
|
+
}), addDisposableListener(this.action, 'click', (ev) => {
|
|
6286
|
+
if (ev.defaultPrevented) {
|
|
6287
|
+
return;
|
|
6288
|
+
}
|
|
6289
|
+
ev.preventDefault();
|
|
6290
|
+
params.api.close();
|
|
6291
|
+
}));
|
|
6222
6292
|
this.render();
|
|
6223
6293
|
}
|
|
6224
|
-
layout(_width, _height) {
|
|
6225
|
-
// noop
|
|
6226
|
-
}
|
|
6227
6294
|
render() {
|
|
6228
|
-
|
|
6229
|
-
|
|
6295
|
+
var _a;
|
|
6296
|
+
if (this._content.textContent !== this._title) {
|
|
6297
|
+
this._content.textContent = (_a = this._title) !== null && _a !== void 0 ? _a : '';
|
|
6230
6298
|
}
|
|
6231
6299
|
}
|
|
6232
6300
|
}
|
|
@@ -6419,12 +6487,7 @@
|
|
|
6419
6487
|
this._element.appendChild(this.options.content);
|
|
6420
6488
|
this.options.container.appendChild(this._element);
|
|
6421
6489
|
// if input bad resize within acceptable boundaries
|
|
6422
|
-
this.setBounds({
|
|
6423
|
-
height: this.options.height,
|
|
6424
|
-
width: this.options.width,
|
|
6425
|
-
top: this.options.top,
|
|
6426
|
-
left: this.options.left,
|
|
6427
|
-
});
|
|
6490
|
+
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 })));
|
|
6428
6491
|
}
|
|
6429
6492
|
setBounds(bounds = {}) {
|
|
6430
6493
|
if (typeof bounds.height === 'number') {
|
|
@@ -6433,11 +6496,25 @@
|
|
|
6433
6496
|
if (typeof bounds.width === 'number') {
|
|
6434
6497
|
this._element.style.width = `${bounds.width}px`;
|
|
6435
6498
|
}
|
|
6436
|
-
if (typeof bounds.top === 'number') {
|
|
6499
|
+
if ('top' in bounds && typeof bounds.top === 'number') {
|
|
6437
6500
|
this._element.style.top = `${bounds.top}px`;
|
|
6501
|
+
this._element.style.bottom = 'auto';
|
|
6502
|
+
this.verticalAlignment = 'top';
|
|
6503
|
+
}
|
|
6504
|
+
if ('bottom' in bounds && typeof bounds.bottom === 'number') {
|
|
6505
|
+
this._element.style.bottom = `${bounds.bottom}px`;
|
|
6506
|
+
this._element.style.top = 'auto';
|
|
6507
|
+
this.verticalAlignment = 'bottom';
|
|
6438
6508
|
}
|
|
6439
|
-
if (typeof bounds.left === 'number') {
|
|
6509
|
+
if ('left' in bounds && typeof bounds.left === 'number') {
|
|
6440
6510
|
this._element.style.left = `${bounds.left}px`;
|
|
6511
|
+
this._element.style.right = 'auto';
|
|
6512
|
+
this.horiziontalAlignment = 'left';
|
|
6513
|
+
}
|
|
6514
|
+
if ('right' in bounds && typeof bounds.right === 'number') {
|
|
6515
|
+
this._element.style.right = `${bounds.right}px`;
|
|
6516
|
+
this._element.style.left = 'auto';
|
|
6517
|
+
this.horiziontalAlignment = 'right';
|
|
6441
6518
|
}
|
|
6442
6519
|
const containerRect = this.options.container.getBoundingClientRect();
|
|
6443
6520
|
const overlayRect = this._element.getBoundingClientRect();
|
|
@@ -6445,24 +6522,54 @@
|
|
|
6445
6522
|
// a minimum width of minimumViewportWidth must be inside the viewport
|
|
6446
6523
|
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
6447
6524
|
// a minimum height of minimumViewportHeight must be inside the viewport
|
|
6448
|
-
const yOffset =
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
this.
|
|
6525
|
+
const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
|
|
6526
|
+
if (this.verticalAlignment === 'top') {
|
|
6527
|
+
const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6528
|
+
this._element.style.top = `${top}px`;
|
|
6529
|
+
this._element.style.bottom = 'auto';
|
|
6530
|
+
}
|
|
6531
|
+
if (this.verticalAlignment === 'bottom') {
|
|
6532
|
+
const bottom = clamp(containerRect.bottom - overlayRect.bottom, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6533
|
+
this._element.style.bottom = `${bottom}px`;
|
|
6534
|
+
this._element.style.top = 'auto';
|
|
6535
|
+
}
|
|
6536
|
+
if (this.horiziontalAlignment === 'left') {
|
|
6537
|
+
const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6538
|
+
this._element.style.left = `${left}px`;
|
|
6539
|
+
this._element.style.right = 'auto';
|
|
6540
|
+
}
|
|
6541
|
+
if (this.horiziontalAlignment === 'right') {
|
|
6542
|
+
const right = clamp(containerRect.right - overlayRect.right, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6543
|
+
this._element.style.right = `${right}px`;
|
|
6544
|
+
this._element.style.left = 'auto';
|
|
6545
|
+
}
|
|
6455
6546
|
this._onDidChange.fire();
|
|
6456
6547
|
}
|
|
6457
6548
|
toJSON() {
|
|
6458
6549
|
const container = this.options.container.getBoundingClientRect();
|
|
6459
6550
|
const element = this._element.getBoundingClientRect();
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6551
|
+
const result = {};
|
|
6552
|
+
if (this.verticalAlignment === 'top') {
|
|
6553
|
+
result.top = parseFloat(this._element.style.top);
|
|
6554
|
+
}
|
|
6555
|
+
else if (this.verticalAlignment === 'bottom') {
|
|
6556
|
+
result.bottom = parseFloat(this._element.style.bottom);
|
|
6557
|
+
}
|
|
6558
|
+
else {
|
|
6559
|
+
result.top = element.top - container.top;
|
|
6560
|
+
}
|
|
6561
|
+
if (this.horiziontalAlignment === 'left') {
|
|
6562
|
+
result.left = parseFloat(this._element.style.left);
|
|
6563
|
+
}
|
|
6564
|
+
else if (this.horiziontalAlignment === 'right') {
|
|
6565
|
+
result.right = parseFloat(this._element.style.right);
|
|
6566
|
+
}
|
|
6567
|
+
else {
|
|
6568
|
+
result.left = element.left - container.left;
|
|
6569
|
+
}
|
|
6570
|
+
result.width = element.width;
|
|
6571
|
+
result.height = element.height;
|
|
6572
|
+
return result;
|
|
6466
6573
|
}
|
|
6467
6574
|
setupDrag(dragTarget, options = { inDragMode: false }) {
|
|
6468
6575
|
const move = new MutableDisposable();
|
|
@@ -6494,12 +6601,30 @@
|
|
|
6494
6601
|
};
|
|
6495
6602
|
}
|
|
6496
6603
|
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
6497
|
-
const yOffset = Math.max(0, this.
|
|
6498
|
-
? this.getMinimumHeight(overlayRect.height)
|
|
6499
|
-
: 0);
|
|
6500
|
-
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6604
|
+
const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
|
|
6501
6605
|
const top = clamp(y - offset.y, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6502
|
-
|
|
6606
|
+
const bottom = clamp(offset.y -
|
|
6607
|
+
y +
|
|
6608
|
+
containerRect.height -
|
|
6609
|
+
overlayRect.height, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6610
|
+
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6611
|
+
const right = clamp(offset.x - x + containerRect.width - overlayRect.width, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6612
|
+
const bounds = {};
|
|
6613
|
+
// Anchor to top or to bottom depending on which one is closer
|
|
6614
|
+
if (top <= bottom) {
|
|
6615
|
+
bounds.top = top;
|
|
6616
|
+
}
|
|
6617
|
+
else {
|
|
6618
|
+
bounds.bottom = bottom;
|
|
6619
|
+
}
|
|
6620
|
+
// Anchor to left or to right depending on which one is closer
|
|
6621
|
+
if (left <= right) {
|
|
6622
|
+
bounds.left = left;
|
|
6623
|
+
}
|
|
6624
|
+
else {
|
|
6625
|
+
bounds.right = right;
|
|
6626
|
+
}
|
|
6627
|
+
this.setBounds(bounds);
|
|
6503
6628
|
}), addDisposableWindowListener(window, 'mouseup', () => {
|
|
6504
6629
|
toggleClass(this._element, 'dv-resize-container-dragging', false);
|
|
6505
6630
|
move.dispose();
|
|
@@ -6567,8 +6692,10 @@
|
|
|
6567
6692
|
};
|
|
6568
6693
|
}
|
|
6569
6694
|
let top = undefined;
|
|
6695
|
+
let bottom = undefined;
|
|
6570
6696
|
let height = undefined;
|
|
6571
6697
|
let left = undefined;
|
|
6698
|
+
let right = undefined;
|
|
6572
6699
|
let width = undefined;
|
|
6573
6700
|
const moveTop = () => {
|
|
6574
6701
|
top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
|
|
@@ -6582,6 +6709,7 @@
|
|
|
6582
6709
|
startPosition.originalY +
|
|
6583
6710
|
startPosition.originalHeight -
|
|
6584
6711
|
top;
|
|
6712
|
+
bottom = containerRect.height - top - height;
|
|
6585
6713
|
};
|
|
6586
6714
|
const moveBottom = () => {
|
|
6587
6715
|
top =
|
|
@@ -6593,6 +6721,7 @@
|
|
|
6593
6721
|
? -top +
|
|
6594
6722
|
this.options.minimumInViewportHeight
|
|
6595
6723
|
: Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
|
|
6724
|
+
bottom = containerRect.height - top - height;
|
|
6596
6725
|
};
|
|
6597
6726
|
const moveLeft = () => {
|
|
6598
6727
|
left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
|
|
@@ -6606,6 +6735,7 @@
|
|
|
6606
6735
|
startPosition.originalX +
|
|
6607
6736
|
startPosition.originalWidth -
|
|
6608
6737
|
left;
|
|
6738
|
+
right = containerRect.width - left - width;
|
|
6609
6739
|
};
|
|
6610
6740
|
const moveRight = () => {
|
|
6611
6741
|
left =
|
|
@@ -6617,6 +6747,7 @@
|
|
|
6617
6747
|
? -left +
|
|
6618
6748
|
this.options.minimumInViewportWidth
|
|
6619
6749
|
: Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
|
|
6750
|
+
right = containerRect.width - left - width;
|
|
6620
6751
|
};
|
|
6621
6752
|
switch (direction) {
|
|
6622
6753
|
case 'top':
|
|
@@ -6648,7 +6779,24 @@
|
|
|
6648
6779
|
moveRight();
|
|
6649
6780
|
break;
|
|
6650
6781
|
}
|
|
6651
|
-
|
|
6782
|
+
const bounds = {};
|
|
6783
|
+
// Anchor to top or to bottom depending on which one is closer
|
|
6784
|
+
if (top <= bottom) {
|
|
6785
|
+
bounds.top = top;
|
|
6786
|
+
}
|
|
6787
|
+
else {
|
|
6788
|
+
bounds.bottom = bottom;
|
|
6789
|
+
}
|
|
6790
|
+
// Anchor to left or to right depending on which one is closer
|
|
6791
|
+
if (left <= right) {
|
|
6792
|
+
bounds.left = left;
|
|
6793
|
+
}
|
|
6794
|
+
else {
|
|
6795
|
+
bounds.right = right;
|
|
6796
|
+
}
|
|
6797
|
+
bounds.height = height;
|
|
6798
|
+
bounds.width = width;
|
|
6799
|
+
this.setBounds(bounds);
|
|
6652
6800
|
}), {
|
|
6653
6801
|
dispose: () => {
|
|
6654
6802
|
for (const iframe of iframes) {
|
|
@@ -6671,7 +6819,7 @@
|
|
|
6671
6819
|
if (typeof this.options.minimumInViewportHeight === 'number') {
|
|
6672
6820
|
return height - this.options.minimumInViewportHeight;
|
|
6673
6821
|
}
|
|
6674
|
-
return
|
|
6822
|
+
return 0;
|
|
6675
6823
|
}
|
|
6676
6824
|
dispose() {
|
|
6677
6825
|
this._element.remove();
|
|
@@ -6694,7 +6842,7 @@
|
|
|
6694
6842
|
}
|
|
6695
6843
|
|
|
6696
6844
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6697
|
-
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6845
|
+
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100, width: 300, height: 300 };
|
|
6698
6846
|
|
|
6699
6847
|
function createFocusableElement() {
|
|
6700
6848
|
const element = document.createElement('div');
|
|
@@ -7037,6 +7185,7 @@
|
|
|
7037
7185
|
parentElement: options.parentElement,
|
|
7038
7186
|
disableAutoResizing: options.disableAutoResizing,
|
|
7039
7187
|
locked: options.locked,
|
|
7188
|
+
margin: options.gap,
|
|
7040
7189
|
});
|
|
7041
7190
|
this.nextGroupId = sequentialNumberGenerator();
|
|
7042
7191
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -7062,9 +7211,9 @@
|
|
|
7062
7211
|
this._onDidActivePanelChange = new Emitter();
|
|
7063
7212
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
7064
7213
|
this._onDidMovePanel = new Emitter();
|
|
7214
|
+
this.onDidMovePanel = this._onDidMovePanel.event;
|
|
7065
7215
|
this._floatingGroups = [];
|
|
7066
7216
|
this._popoutGroups = [];
|
|
7067
|
-
this._ignoreEvents = 0;
|
|
7068
7217
|
this._onDidRemoveGroup = new Emitter();
|
|
7069
7218
|
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
7070
7219
|
this._onDidAddGroup = new Emitter();
|
|
@@ -7078,7 +7227,9 @@
|
|
|
7078
7227
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7079
7228
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
7080
7229
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
7081
|
-
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.
|
|
7230
|
+
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(() => {
|
|
7231
|
+
this.updateWatermark();
|
|
7232
|
+
}), this.onDidAdd((event) => {
|
|
7082
7233
|
if (!this._moving) {
|
|
7083
7234
|
this._onDidAddGroup.fire(event);
|
|
7084
7235
|
}
|
|
@@ -7092,7 +7243,7 @@
|
|
|
7092
7243
|
}
|
|
7093
7244
|
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
7094
7245
|
this.updateWatermark();
|
|
7095
|
-
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
7246
|
+
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidMovePanel, this.onDidActivePanelChange)(() => {
|
|
7096
7247
|
this._bufferOnDidLayoutChange.fire();
|
|
7097
7248
|
}), exports.DockviewDisposable.from(() => {
|
|
7098
7249
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
@@ -7343,8 +7494,8 @@
|
|
|
7343
7494
|
console.error('dockview: failed to create popout window', err);
|
|
7344
7495
|
});
|
|
7345
7496
|
}
|
|
7346
|
-
addFloatingGroup(item,
|
|
7347
|
-
var _a, _b, _c, _d, _e
|
|
7497
|
+
addFloatingGroup(item, options) {
|
|
7498
|
+
var _a, _b, _c, _d, _e;
|
|
7348
7499
|
let group;
|
|
7349
7500
|
if (item instanceof DockviewPanel) {
|
|
7350
7501
|
group = this.createGroup();
|
|
@@ -7389,26 +7540,62 @@
|
|
|
7389
7540
|
}
|
|
7390
7541
|
}
|
|
7391
7542
|
group.model.location = { type: 'floating' };
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7543
|
+
function getAnchoredBox() {
|
|
7544
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7545
|
+
const result = {};
|
|
7546
|
+
if ('left' in options.position) {
|
|
7547
|
+
result.left = Math.max(options.position.left, 0);
|
|
7548
|
+
}
|
|
7549
|
+
else if ('right' in options.position) {
|
|
7550
|
+
result.right = Math.max(options.position.right, 0);
|
|
7551
|
+
}
|
|
7552
|
+
else {
|
|
7553
|
+
result.left = DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
7554
|
+
}
|
|
7555
|
+
if ('top' in options.position) {
|
|
7556
|
+
result.top = Math.max(options.position.top, 0);
|
|
7557
|
+
}
|
|
7558
|
+
else if ('bottom' in options.position) {
|
|
7559
|
+
result.bottom = Math.max(options.position.bottom, 0);
|
|
7560
|
+
}
|
|
7561
|
+
else {
|
|
7562
|
+
result.top = DEFAULT_FLOATING_GROUP_POSITION.top;
|
|
7563
|
+
}
|
|
7564
|
+
if ('width' in options.position) {
|
|
7565
|
+
result.width = Math.max(options.position.width, 0);
|
|
7566
|
+
}
|
|
7567
|
+
else {
|
|
7568
|
+
result.width = DEFAULT_FLOATING_GROUP_POSITION.width;
|
|
7569
|
+
}
|
|
7570
|
+
if ('height' in options.position) {
|
|
7571
|
+
result.height = Math.max(options.position.height, 0);
|
|
7572
|
+
}
|
|
7573
|
+
else {
|
|
7574
|
+
result.height = DEFAULT_FLOATING_GROUP_POSITION.height;
|
|
7575
|
+
}
|
|
7576
|
+
return result;
|
|
7577
|
+
}
|
|
7578
|
+
return {
|
|
7579
|
+
left: typeof (options === null || options === void 0 ? void 0 : options.x) === 'number'
|
|
7580
|
+
? Math.max(options.x, 0)
|
|
7581
|
+
: DEFAULT_FLOATING_GROUP_POSITION.left,
|
|
7582
|
+
top: typeof (options === null || options === void 0 ? void 0 : options.y) === 'number'
|
|
7583
|
+
? Math.max(options.y, 0)
|
|
7584
|
+
: DEFAULT_FLOATING_GROUP_POSITION.top,
|
|
7585
|
+
width: typeof (options === null || options === void 0 ? void 0 : options.width) === 'number'
|
|
7586
|
+
? Math.max(options.width, 0)
|
|
7587
|
+
: DEFAULT_FLOATING_GROUP_POSITION.width,
|
|
7588
|
+
height: typeof (options === null || options === void 0 ? void 0 : options.height) === 'number'
|
|
7589
|
+
? Math.max(options.height, 0)
|
|
7590
|
+
: DEFAULT_FLOATING_GROUP_POSITION.height,
|
|
7591
|
+
};
|
|
7592
|
+
}
|
|
7593
|
+
const anchoredBox = getAnchoredBox();
|
|
7594
|
+
const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
7406
7595
|
? undefined
|
|
7407
|
-
: (
|
|
7408
|
-
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
7596
|
+
: (_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'
|
|
7409
7597
|
? undefined
|
|
7410
|
-
: (
|
|
7411
|
-
});
|
|
7598
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
7412
7599
|
const el = group.element.querySelector('.void-container');
|
|
7413
7600
|
if (!el) {
|
|
7414
7601
|
throw new Error('failed to find drag handle');
|
|
@@ -7506,12 +7693,18 @@
|
|
|
7506
7693
|
group.overlay.minimumInViewportWidth =
|
|
7507
7694
|
(_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
7508
7695
|
}
|
|
7509
|
-
group.overlay.setBounds(
|
|
7696
|
+
group.overlay.setBounds();
|
|
7510
7697
|
}
|
|
7511
7698
|
}
|
|
7512
7699
|
if (changed_rootOverlayOptions) {
|
|
7513
7700
|
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
7514
7701
|
}
|
|
7702
|
+
if (this.gridview.margin !== 0 && options.gap === undefined) {
|
|
7703
|
+
this.gridview.margin = 0;
|
|
7704
|
+
}
|
|
7705
|
+
if (typeof options.gap === 'number') {
|
|
7706
|
+
this.gridview.margin = options.gap;
|
|
7707
|
+
}
|
|
7515
7708
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
7516
7709
|
}
|
|
7517
7710
|
layout(width, height, forceResize) {
|
|
@@ -7673,11 +7866,10 @@
|
|
|
7673
7866
|
const { data, position } = serializedFloatingGroup;
|
|
7674
7867
|
const group = createGroupFromSerializedState(data);
|
|
7675
7868
|
this.addFloatingGroup(group, {
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
}, { skipRemoveGroup: true, inDragMode: false });
|
|
7869
|
+
position: position,
|
|
7870
|
+
skipRemoveGroup: true,
|
|
7871
|
+
inDragMode: false,
|
|
7872
|
+
});
|
|
7681
7873
|
}
|
|
7682
7874
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7683
7875
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
@@ -7812,11 +8004,7 @@
|
|
|
7812
8004
|
options.floating !== null
|
|
7813
8005
|
? options.floating
|
|
7814
8006
|
: {};
|
|
7815
|
-
this.addFloatingGroup(group, o, {
|
|
7816
|
-
inDragMode: false,
|
|
7817
|
-
skipRemoveGroup: true,
|
|
7818
|
-
skipActiveGroup: true,
|
|
7819
|
-
});
|
|
8007
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, o), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
7820
8008
|
panel = this.createPanel(options, group);
|
|
7821
8009
|
group.model.openPanel(panel, {
|
|
7822
8010
|
skipSetActive: options.inactive,
|
|
@@ -7855,11 +8043,7 @@
|
|
|
7855
8043
|
options.floating !== null
|
|
7856
8044
|
? options.floating
|
|
7857
8045
|
: {};
|
|
7858
|
-
this.addFloatingGroup(group, coordinates, {
|
|
7859
|
-
inDragMode: false,
|
|
7860
|
-
skipRemoveGroup: true,
|
|
7861
|
-
skipActiveGroup: true,
|
|
7862
|
-
});
|
|
8046
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, coordinates), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
7863
8047
|
panel = this.createPanel(options, group);
|
|
7864
8048
|
group.model.openPanel(panel, {
|
|
7865
8049
|
skipSetActive: options.inactive,
|
|
@@ -7914,6 +8098,7 @@
|
|
|
7914
8098
|
});
|
|
7915
8099
|
const watermarkContainer = document.createElement('div');
|
|
7916
8100
|
watermarkContainer.className = 'dv-watermark-container';
|
|
8101
|
+
addTestId(watermarkContainer, 'watermark-component');
|
|
7917
8102
|
watermarkContainer.appendChild(this.watermark.element);
|
|
7918
8103
|
this.gridview.element.appendChild(watermarkContainer);
|
|
7919
8104
|
}
|
|
@@ -8102,6 +8287,7 @@
|
|
|
8102
8287
|
this.doSetGroupAndPanelActive(destinationGroup);
|
|
8103
8288
|
this._onDidMovePanel.fire({
|
|
8104
8289
|
panel: removedPanel,
|
|
8290
|
+
from: sourceGroup,
|
|
8105
8291
|
});
|
|
8106
8292
|
}
|
|
8107
8293
|
else {
|
|
@@ -8125,6 +8311,10 @@
|
|
|
8125
8311
|
// if a group has one tab - we are essentially moving the 'group'
|
|
8126
8312
|
// which is equivalent to swapping two views in this case
|
|
8127
8313
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8314
|
+
this._onDidMovePanel.fire({
|
|
8315
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
8316
|
+
from: sourceGroup,
|
|
8317
|
+
});
|
|
8128
8318
|
return;
|
|
8129
8319
|
}
|
|
8130
8320
|
}
|
|
@@ -8138,6 +8328,10 @@
|
|
|
8138
8328
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
8139
8329
|
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8140
8330
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
8331
|
+
this._onDidMovePanel.fire({
|
|
8332
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
8333
|
+
from: sourceGroup,
|
|
8334
|
+
});
|
|
8141
8335
|
}
|
|
8142
8336
|
else {
|
|
8143
8337
|
/**
|
|
@@ -8157,6 +8351,10 @@
|
|
|
8157
8351
|
skipSetGroupActive: true,
|
|
8158
8352
|
}));
|
|
8159
8353
|
this.doSetGroupAndPanelActive(group);
|
|
8354
|
+
this._onDidMovePanel.fire({
|
|
8355
|
+
panel: removedPanel,
|
|
8356
|
+
from: sourceGroup,
|
|
8357
|
+
});
|
|
8160
8358
|
}
|
|
8161
8359
|
}
|
|
8162
8360
|
}
|
|
@@ -8181,9 +8379,6 @@
|
|
|
8181
8379
|
}
|
|
8182
8380
|
});
|
|
8183
8381
|
this.doSetGroupAndPanelActive(to);
|
|
8184
|
-
panels.forEach((panel) => {
|
|
8185
|
-
this._onDidMovePanel.fire({ panel });
|
|
8186
|
-
});
|
|
8187
8382
|
}
|
|
8188
8383
|
else {
|
|
8189
8384
|
switch (from.api.location.type) {
|
|
@@ -8209,10 +8404,10 @@
|
|
|
8209
8404
|
const referenceLocation = getGridLocation(to.element);
|
|
8210
8405
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8211
8406
|
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8212
|
-
from.panels.forEach((panel) => {
|
|
8213
|
-
this._onDidMovePanel.fire({ panel });
|
|
8214
|
-
});
|
|
8215
8407
|
}
|
|
8408
|
+
from.panels.forEach((panel) => {
|
|
8409
|
+
this._onDidMovePanel.fire({ panel, from });
|
|
8410
|
+
});
|
|
8216
8411
|
}
|
|
8217
8412
|
doSetGroupActive(group) {
|
|
8218
8413
|
super.doSetGroupActive(group);
|
|
@@ -9836,8 +10031,21 @@
|
|
|
9836
10031
|
}
|
|
9837
10032
|
return t;
|
|
9838
10033
|
};
|
|
10034
|
+
function useTitle(api) {
|
|
10035
|
+
const [title, setTitle] = React.useState(api.title);
|
|
10036
|
+
React.useEffect(() => {
|
|
10037
|
+
const disposable = api.onDidTitleChange((event) => {
|
|
10038
|
+
setTitle(event.title);
|
|
10039
|
+
});
|
|
10040
|
+
return () => {
|
|
10041
|
+
disposable.dispose();
|
|
10042
|
+
};
|
|
10043
|
+
}, [api]);
|
|
10044
|
+
return title;
|
|
10045
|
+
}
|
|
9839
10046
|
const DockviewDefaultTab = (_a) => {
|
|
9840
10047
|
var { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride } = _a, rest = __rest(_a, ["api", "containerApi", "params", "hideClose", "closeActionOverride"]);
|
|
10048
|
+
const title = useTitle(api);
|
|
9841
10049
|
const onClose = React.useCallback((event) => {
|
|
9842
10050
|
event.preventDefault();
|
|
9843
10051
|
if (closeActionOverride) {
|
|
@@ -9860,7 +10068,7 @@
|
|
|
9860
10068
|
}
|
|
9861
10069
|
}, [api, rest.onClick]);
|
|
9862
10070
|
return (React.createElement("div", Object.assign({ "data-testid": "dockview-dv-default-tab" }, rest, { onClick: onClick, className: "dv-default-tab" }),
|
|
9863
|
-
React.createElement("span", { className: "dv-default-tab-content" },
|
|
10071
|
+
React.createElement("span", { className: "dv-default-tab-content" }, title),
|
|
9864
10072
|
!hideClose && (React.createElement("div", { className: "dv-default-tab-action", onMouseDown: onMouseDown, onClick: onClose },
|
|
9865
10073
|
React.createElement(CloseButton, null)))));
|
|
9866
10074
|
};
|