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
|
*/
|
|
@@ -528,6 +528,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
528
528
|
}
|
|
529
529
|
return false;
|
|
530
530
|
}
|
|
531
|
+
function addTestId(element, id) {
|
|
532
|
+
element.setAttribute('data-testid', id);
|
|
533
|
+
}
|
|
531
534
|
|
|
532
535
|
function tail(arr) {
|
|
533
536
|
if (arr.length === 0) {
|
|
@@ -589,7 +592,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
589
592
|
|
|
590
593
|
const clamp = (value, min, max) => {
|
|
591
594
|
if (min > max) {
|
|
592
|
-
|
|
595
|
+
/**
|
|
596
|
+
* caveat: an error should be thrown here if this was a proper `clamp` function but we need to handle
|
|
597
|
+
* cases where `min` > `max` and in those cases return `min`.
|
|
598
|
+
*/
|
|
599
|
+
return min;
|
|
593
600
|
}
|
|
594
601
|
return Math.min(max, Math.max(value, min));
|
|
595
602
|
};
|
|
@@ -794,7 +801,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
794
801
|
this._disabled = value;
|
|
795
802
|
toggleClass(this.element, 'dv-splitview-disabled', value);
|
|
796
803
|
}
|
|
804
|
+
get margin() {
|
|
805
|
+
return this._margin;
|
|
806
|
+
}
|
|
807
|
+
set margin(value) {
|
|
808
|
+
this._margin = value;
|
|
809
|
+
}
|
|
797
810
|
constructor(container, options) {
|
|
811
|
+
var _a;
|
|
798
812
|
this.container = container;
|
|
799
813
|
this.viewItems = [];
|
|
800
814
|
this.sashes = [];
|
|
@@ -805,6 +819,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
805
819
|
this._startSnappingEnabled = true;
|
|
806
820
|
this._endSnappingEnabled = true;
|
|
807
821
|
this._disabled = false;
|
|
822
|
+
this._margin = 0;
|
|
808
823
|
this._onDidSashEnd = new Emitter();
|
|
809
824
|
this.onDidSashEnd = this._onDidSashEnd.event;
|
|
810
825
|
this._onDidAddView = new Emitter();
|
|
@@ -893,6 +908,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
893
908
|
};
|
|
894
909
|
this._orientation = options.orientation;
|
|
895
910
|
this.element = this.createContainer();
|
|
911
|
+
this.margin = (_a = options.margin) !== null && _a !== void 0 ? _a : 0;
|
|
896
912
|
this.proportionalLayout =
|
|
897
913
|
options.proportionalLayout === undefined
|
|
898
914
|
? true
|
|
@@ -947,9 +963,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
947
963
|
if (index < 0 || index >= this.viewItems.length) {
|
|
948
964
|
throw new Error('Index out of bounds');
|
|
949
965
|
}
|
|
950
|
-
toggleClass(this.container, 'visible', visible);
|
|
951
966
|
const viewItem = this.viewItems[index];
|
|
952
|
-
toggleClass(this.container, 'visible', visible);
|
|
953
967
|
viewItem.setVisible(visible, viewItem.size);
|
|
954
968
|
this.distributeEmptySpace(index);
|
|
955
969
|
this.layoutViews();
|
|
@@ -1261,15 +1275,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1261
1275
|
this._proportions = this.viewItems.map((i) => i.visible ? i.size / this._contentSize : undefined);
|
|
1262
1276
|
}
|
|
1263
1277
|
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Margin explain:
|
|
1280
|
+
*
|
|
1281
|
+
* For `n` views in a splitview there will be `n-1` margins `m`.
|
|
1282
|
+
*
|
|
1283
|
+
* To fit the margins each view must reduce in size by `(m * (n - 1)) / n`.
|
|
1284
|
+
*
|
|
1285
|
+
* For each view `i` the offet must be adjusted by `m * i/(n - 1)`.
|
|
1286
|
+
*/
|
|
1264
1287
|
layoutViews() {
|
|
1265
1288
|
this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1266
|
-
let sum = 0;
|
|
1267
|
-
const x = [];
|
|
1268
1289
|
this.updateSashEnablement();
|
|
1290
|
+
if (this.viewItems.length === 0) {
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
const sashCount = this.viewItems.length - 1;
|
|
1294
|
+
const marginReducedSize = (this.margin * sashCount) / this.viewItems.length;
|
|
1295
|
+
let totalLeftOffset = 0;
|
|
1296
|
+
const viewLeftOffsets = [];
|
|
1269
1297
|
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
const offset = Math.min(Math.max(0,
|
|
1298
|
+
totalLeftOffset += this.viewItems[i].size;
|
|
1299
|
+
viewLeftOffsets.push(totalLeftOffset);
|
|
1300
|
+
const offset = Math.min(Math.max(0, totalLeftOffset - 2), this.size - this.margin);
|
|
1273
1301
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1274
1302
|
this.sashes[i].container.style.left = `${offset}px`;
|
|
1275
1303
|
this.sashes[i].container.style.top = `0px`;
|
|
@@ -1280,19 +1308,24 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1280
1308
|
}
|
|
1281
1309
|
}
|
|
1282
1310
|
this.viewItems.forEach((view, i) => {
|
|
1311
|
+
const size = view.size - marginReducedSize;
|
|
1312
|
+
const offset = i === 0
|
|
1313
|
+
? 0
|
|
1314
|
+
: viewLeftOffsets[i - 1] +
|
|
1315
|
+
(i / sashCount) * marginReducedSize;
|
|
1283
1316
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1284
|
-
view.container.style.width = `${
|
|
1285
|
-
view.container.style.left =
|
|
1317
|
+
view.container.style.width = `${size}px`;
|
|
1318
|
+
view.container.style.left = `${offset}px`;
|
|
1286
1319
|
view.container.style.top = '';
|
|
1287
1320
|
view.container.style.height = '';
|
|
1288
1321
|
}
|
|
1289
1322
|
if (this._orientation === exports.Orientation.VERTICAL) {
|
|
1290
|
-
view.container.style.height = `${
|
|
1291
|
-
view.container.style.top =
|
|
1323
|
+
view.container.style.height = `${size}px`;
|
|
1324
|
+
view.container.style.top = `${offset}px`;
|
|
1292
1325
|
view.container.style.width = '';
|
|
1293
1326
|
view.container.style.left = '';
|
|
1294
1327
|
}
|
|
1295
|
-
view.view.layout(view.size, this._orthogonalSize);
|
|
1328
|
+
view.view.layout(view.size - marginReducedSize, this._orthogonalSize);
|
|
1296
1329
|
});
|
|
1297
1330
|
}
|
|
1298
1331
|
findFirstSnapIndex(indexes) {
|
|
@@ -1741,7 +1774,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1741
1774
|
set disabled(value) {
|
|
1742
1775
|
this.splitview.disabled = value;
|
|
1743
1776
|
}
|
|
1744
|
-
|
|
1777
|
+
get margin() {
|
|
1778
|
+
return this.splitview.margin;
|
|
1779
|
+
}
|
|
1780
|
+
set margin(value) {
|
|
1781
|
+
this.splitview.margin = value;
|
|
1782
|
+
this.children.forEach((child) => {
|
|
1783
|
+
if (child instanceof BranchNode) {
|
|
1784
|
+
child.margin = value;
|
|
1785
|
+
}
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, margin, childDescriptors) {
|
|
1745
1789
|
super();
|
|
1746
1790
|
this.orientation = orientation;
|
|
1747
1791
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -1761,6 +1805,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1761
1805
|
orientation: this.orientation,
|
|
1762
1806
|
proportionalLayout,
|
|
1763
1807
|
styles,
|
|
1808
|
+
margin,
|
|
1764
1809
|
});
|
|
1765
1810
|
this.splitview.layout(this.size, this.orthogonalSize);
|
|
1766
1811
|
}
|
|
@@ -1784,6 +1829,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1784
1829
|
descriptor,
|
|
1785
1830
|
proportionalLayout,
|
|
1786
1831
|
styles,
|
|
1832
|
+
margin,
|
|
1787
1833
|
});
|
|
1788
1834
|
}
|
|
1789
1835
|
this.disabled = disabled;
|
|
@@ -1792,10 +1838,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1792
1838
|
}));
|
|
1793
1839
|
this.setupChildrenEvents();
|
|
1794
1840
|
}
|
|
1795
|
-
setVisible(
|
|
1796
|
-
|
|
1797
|
-
child.setVisible(visible);
|
|
1798
|
-
}
|
|
1841
|
+
setVisible(_visible) {
|
|
1842
|
+
// noop
|
|
1799
1843
|
}
|
|
1800
1844
|
isChildVisible(index) {
|
|
1801
1845
|
if (index < 0 || index >= this.children.length) {
|
|
@@ -1812,12 +1856,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1812
1856
|
}
|
|
1813
1857
|
const wereAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1814
1858
|
this.splitview.setViewVisible(index, visible);
|
|
1859
|
+
// }
|
|
1815
1860
|
const areAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1816
1861
|
// If all children are hidden then the parent should hide the entire splitview
|
|
1817
1862
|
// If the entire splitview is hidden then the parent should show the splitview when a child is shown
|
|
1818
1863
|
if ((visible && wereAllChildrenHidden) ||
|
|
1819
1864
|
(!visible && areAllChildrenHidden)) {
|
|
1820
|
-
this._onDidVisibilityChange.fire(visible);
|
|
1865
|
+
this._onDidVisibilityChange.fire({ visible });
|
|
1821
1866
|
}
|
|
1822
1867
|
}
|
|
1823
1868
|
moveChild(from, to) {
|
|
@@ -1890,7 +1935,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1890
1935
|
this._onDidChange.fire({ size: e.orthogonalSize });
|
|
1891
1936
|
}), ...this.children.map((c, i) => {
|
|
1892
1937
|
if (c instanceof BranchNode) {
|
|
1893
|
-
return c.onDidVisibilityChange((visible) => {
|
|
1938
|
+
return c.onDidVisibilityChange(({ visible }) => {
|
|
1894
1939
|
this.setChildVisible(i, visible);
|
|
1895
1940
|
});
|
|
1896
1941
|
}
|
|
@@ -1920,7 +1965,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1920
1965
|
}
|
|
1921
1966
|
function flipNode(node, size, orthogonalSize) {
|
|
1922
1967
|
if (node instanceof BranchNode) {
|
|
1923
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
1968
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
|
|
1924
1969
|
let totalSize = 0;
|
|
1925
1970
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
1926
1971
|
const child = node.children[i];
|
|
@@ -2075,6 +2120,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2075
2120
|
}
|
|
2076
2121
|
}
|
|
2077
2122
|
}
|
|
2123
|
+
get margin() {
|
|
2124
|
+
return this._margin;
|
|
2125
|
+
}
|
|
2126
|
+
set margin(value) {
|
|
2127
|
+
this._margin = value;
|
|
2128
|
+
this.root.margin = value;
|
|
2129
|
+
}
|
|
2078
2130
|
maximizedView() {
|
|
2079
2131
|
var _a;
|
|
2080
2132
|
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
@@ -2160,13 +2212,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2160
2212
|
this.disposable.dispose();
|
|
2161
2213
|
this._onDidChange.dispose();
|
|
2162
2214
|
this._onDidMaximizedNodeChange.dispose();
|
|
2215
|
+
this._onDidViewVisibilityChange.dispose();
|
|
2163
2216
|
this.root.dispose();
|
|
2164
2217
|
this._maximizedNode = undefined;
|
|
2165
2218
|
this.element.remove();
|
|
2166
2219
|
}
|
|
2167
2220
|
clear() {
|
|
2168
2221
|
const orientation = this.root.orientation;
|
|
2169
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.
|
|
2222
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.locked, this.margin);
|
|
2170
2223
|
}
|
|
2171
2224
|
deserialize(json, deserializer) {
|
|
2172
2225
|
const orientation = json.orientation;
|
|
@@ -2177,6 +2230,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2177
2230
|
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
|
|
2178
2231
|
}
|
|
2179
2232
|
_deserializeNode(node, orientation, deserializer, orthogonalSize) {
|
|
2233
|
+
var _a;
|
|
2180
2234
|
let result;
|
|
2181
2235
|
if (node.type === 'branch') {
|
|
2182
2236
|
const serializedChildren = node.data;
|
|
@@ -2188,10 +2242,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2188
2242
|
});
|
|
2189
2243
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
2190
2244
|
orthogonalSize, // <- size - flips at each depth,
|
|
2191
|
-
this.
|
|
2245
|
+
this.locked, this.margin, children);
|
|
2192
2246
|
}
|
|
2193
2247
|
else {
|
|
2194
|
-
|
|
2248
|
+
const view = deserializer.fromJSON(node);
|
|
2249
|
+
if (typeof node.visible === 'boolean') {
|
|
2250
|
+
(_a = view.setVisible) === null || _a === void 0 ? void 0 : _a.call(view, node.visible);
|
|
2251
|
+
}
|
|
2252
|
+
result = new LeafNode(view, orientation, orthogonalSize, node.size);
|
|
2195
2253
|
}
|
|
2196
2254
|
return result;
|
|
2197
2255
|
}
|
|
@@ -2221,7 +2279,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2221
2279
|
}
|
|
2222
2280
|
const oldRoot = this.root;
|
|
2223
2281
|
oldRoot.element.remove();
|
|
2224
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.
|
|
2282
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.locked, this.margin);
|
|
2225
2283
|
if (oldRoot.children.length === 0) ;
|
|
2226
2284
|
else if (oldRoot.children.length === 1) {
|
|
2227
2285
|
// can remove one level of redundant branching if there is only a single child
|
|
@@ -2286,19 +2344,24 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2286
2344
|
}
|
|
2287
2345
|
return findLeaf(this.root, reverse);
|
|
2288
2346
|
}
|
|
2289
|
-
constructor(proportionalLayout, styles, orientation) {
|
|
2347
|
+
constructor(proportionalLayout, styles, orientation, locked, margin) {
|
|
2290
2348
|
this.proportionalLayout = proportionalLayout;
|
|
2291
2349
|
this.styles = styles;
|
|
2292
2350
|
this._locked = false;
|
|
2351
|
+
this._margin = 0;
|
|
2293
2352
|
this._maximizedNode = undefined;
|
|
2294
2353
|
this.disposable = new MutableDisposable();
|
|
2295
2354
|
this._onDidChange = new Emitter();
|
|
2296
2355
|
this.onDidChange = this._onDidChange.event;
|
|
2356
|
+
this._onDidViewVisibilityChange = new Emitter();
|
|
2357
|
+
this.onDidViewVisibilityChange = this._onDidViewVisibilityChange.event;
|
|
2297
2358
|
this._onDidMaximizedNodeChange = new Emitter();
|
|
2298
2359
|
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
2299
2360
|
this.element = document.createElement('div');
|
|
2300
2361
|
this.element.className = 'grid-view';
|
|
2301
|
-
this.
|
|
2362
|
+
this._locked = locked !== null && locked !== void 0 ? locked : false;
|
|
2363
|
+
this._margin = margin !== null && margin !== void 0 ? margin : 0;
|
|
2364
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this.locked, this.margin);
|
|
2302
2365
|
}
|
|
2303
2366
|
isViewVisible(location) {
|
|
2304
2367
|
const [rest, index] = tail(location);
|
|
@@ -2317,6 +2380,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2317
2380
|
if (!(parent instanceof BranchNode)) {
|
|
2318
2381
|
throw new Error('Invalid from location');
|
|
2319
2382
|
}
|
|
2383
|
+
this._onDidViewVisibilityChange.fire();
|
|
2320
2384
|
parent.setChildVisible(index, visible);
|
|
2321
2385
|
}
|
|
2322
2386
|
moveView(parentLocation, from, to) {
|
|
@@ -2349,7 +2413,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2349
2413
|
}
|
|
2350
2414
|
const child = grandParent.removeChild(parentIndex);
|
|
2351
2415
|
child.dispose();
|
|
2352
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.
|
|
2416
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.locked, this.margin);
|
|
2353
2417
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2354
2418
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
2355
2419
|
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
@@ -2588,14 +2652,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2588
2652
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2589
2653
|
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
2590
2654
|
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
2655
|
+
this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
|
|
2656
|
+
this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
|
|
2591
2657
|
this.element.style.height = '100%';
|
|
2592
2658
|
this.element.style.width = '100%';
|
|
2593
2659
|
options.parentElement.appendChild(this.element);
|
|
2594
|
-
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
2660
|
+
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
|
|
2595
2661
|
this.gridview.locked = !!options.locked;
|
|
2596
2662
|
this.element.appendChild(this.gridview.element);
|
|
2597
2663
|
this.layout(0, 0, true); // set some elements height/widths
|
|
2598
|
-
this.addDisposables(
|
|
2664
|
+
this.addDisposables(this.gridview.onDidViewVisibilityChange(() => this._onDidViewVisibilityChangeMicroTaskQueue.fire()), this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
2665
|
+
this.layout(this.width, this.height, true);
|
|
2666
|
+
}), exports.DockviewDisposable.from(() => {
|
|
2599
2667
|
var _a;
|
|
2600
2668
|
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
2601
2669
|
}), this.gridview.onDidChange(() => {
|
|
@@ -3209,6 +3277,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3209
3277
|
get onDidRemovePanel() {
|
|
3210
3278
|
return this.component.onDidRemovePanel;
|
|
3211
3279
|
}
|
|
3280
|
+
get onDidMovePanel() {
|
|
3281
|
+
return this.component.onDidMovePanel;
|
|
3282
|
+
}
|
|
3212
3283
|
/**
|
|
3213
3284
|
* Invoked after a layout is deserialzied using the `fromJSON` method.
|
|
3214
3285
|
*/
|
|
@@ -3349,8 +3420,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3349
3420
|
/**
|
|
3350
3421
|
* Add a floating group
|
|
3351
3422
|
*/
|
|
3352
|
-
addFloatingGroup(item,
|
|
3353
|
-
return this.component.addFloatingGroup(item,
|
|
3423
|
+
addFloatingGroup(item, options) {
|
|
3424
|
+
return this.component.addFloatingGroup(item, options);
|
|
3354
3425
|
}
|
|
3355
3426
|
/**
|
|
3356
3427
|
* Create a component from a serialized object.
|
|
@@ -3400,6 +3471,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3400
3471
|
addPopoutGroup(item, options) {
|
|
3401
3472
|
return this.component.addPopoutGroup(item, options);
|
|
3402
3473
|
}
|
|
3474
|
+
setGap(gap) {
|
|
3475
|
+
this.component.updateOptions({ gap });
|
|
3476
|
+
}
|
|
3403
3477
|
}
|
|
3404
3478
|
|
|
3405
3479
|
class DragHandler extends CompositeDisposable {
|
|
@@ -4769,7 +4843,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4769
4843
|
this.accessor.addFloatingGroup(this.group, {
|
|
4770
4844
|
x: left - rootLeft + 20,
|
|
4771
4845
|
y: top - rootTop + 20,
|
|
4772
|
-
|
|
4846
|
+
inDragMode: true,
|
|
4847
|
+
});
|
|
4773
4848
|
}
|
|
4774
4849
|
}), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
4775
4850
|
if (event.defaultPrevented) {
|
|
@@ -4838,7 +4913,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4838
4913
|
this.accessor.addFloatingGroup(panel, {
|
|
4839
4914
|
x: left - rootLeft,
|
|
4840
4915
|
y: top - rootTop,
|
|
4841
|
-
|
|
4916
|
+
inDragMode: true,
|
|
4917
|
+
});
|
|
4842
4918
|
return;
|
|
4843
4919
|
}
|
|
4844
4920
|
const isLeftClick = event.button === 0;
|
|
@@ -4911,6 +4987,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4911
4987
|
rootOverlayModel: undefined,
|
|
4912
4988
|
locked: undefined,
|
|
4913
4989
|
disableDnd: undefined,
|
|
4990
|
+
gap: undefined,
|
|
4914
4991
|
};
|
|
4915
4992
|
return Object.keys(properties);
|
|
4916
4993
|
})();
|
|
@@ -5641,6 +5718,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5641
5718
|
get isActive() {
|
|
5642
5719
|
return this.api.isActive;
|
|
5643
5720
|
}
|
|
5721
|
+
get isVisible() {
|
|
5722
|
+
return this.api.isVisible;
|
|
5723
|
+
}
|
|
5644
5724
|
constructor(id, component, options, api) {
|
|
5645
5725
|
super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
|
|
5646
5726
|
this._evaluatedMinimumWidth = 0;
|
|
@@ -6177,52 +6257,40 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6177
6257
|
}
|
|
6178
6258
|
constructor() {
|
|
6179
6259
|
super();
|
|
6180
|
-
//
|
|
6181
|
-
this.params = {};
|
|
6182
6260
|
this._element = document.createElement('div');
|
|
6183
6261
|
this._element.className = 'dv-default-tab';
|
|
6184
|
-
//
|
|
6185
6262
|
this._content = document.createElement('div');
|
|
6186
6263
|
this._content.className = 'dv-default-tab-content';
|
|
6187
6264
|
this.action = document.createElement('div');
|
|
6188
6265
|
this.action.className = 'dv-default-tab-action';
|
|
6189
6266
|
this.action.appendChild(createCloseButton());
|
|
6190
|
-
//
|
|
6191
6267
|
this._element.appendChild(this._content);
|
|
6192
6268
|
this._element.appendChild(this.action);
|
|
6193
|
-
//
|
|
6194
6269
|
this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
|
|
6195
6270
|
ev.preventDefault();
|
|
6196
6271
|
}));
|
|
6197
6272
|
this.render();
|
|
6198
6273
|
}
|
|
6199
|
-
update(event) {
|
|
6200
|
-
this.params = Object.assign(Object.assign({}, this.params), event.params);
|
|
6201
|
-
this.render();
|
|
6202
|
-
}
|
|
6203
|
-
focus() {
|
|
6204
|
-
//noop
|
|
6205
|
-
}
|
|
6206
6274
|
init(params) {
|
|
6207
|
-
this.
|
|
6208
|
-
this.
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6275
|
+
this._title = params.title;
|
|
6276
|
+
this.addDisposables(params.api.onDidTitleChange((event) => {
|
|
6277
|
+
this._title = event.title;
|
|
6278
|
+
this.render();
|
|
6279
|
+
}), addDisposableListener(this.action, 'mousedown', (ev) => {
|
|
6280
|
+
ev.preventDefault();
|
|
6281
|
+
}), addDisposableListener(this.action, 'click', (ev) => {
|
|
6282
|
+
if (ev.defaultPrevented) {
|
|
6283
|
+
return;
|
|
6284
|
+
}
|
|
6285
|
+
ev.preventDefault();
|
|
6286
|
+
params.api.close();
|
|
6287
|
+
}));
|
|
6218
6288
|
this.render();
|
|
6219
6289
|
}
|
|
6220
|
-
layout(_width, _height) {
|
|
6221
|
-
// noop
|
|
6222
|
-
}
|
|
6223
6290
|
render() {
|
|
6224
|
-
|
|
6225
|
-
|
|
6291
|
+
var _a;
|
|
6292
|
+
if (this._content.textContent !== this._title) {
|
|
6293
|
+
this._content.textContent = (_a = this._title) !== null && _a !== void 0 ? _a : '';
|
|
6226
6294
|
}
|
|
6227
6295
|
}
|
|
6228
6296
|
}
|
|
@@ -6415,12 +6483,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6415
6483
|
this._element.appendChild(this.options.content);
|
|
6416
6484
|
this.options.container.appendChild(this._element);
|
|
6417
6485
|
// if input bad resize within acceptable boundaries
|
|
6418
|
-
this.setBounds({
|
|
6419
|
-
height: this.options.height,
|
|
6420
|
-
width: this.options.width,
|
|
6421
|
-
top: this.options.top,
|
|
6422
|
-
left: this.options.left,
|
|
6423
|
-
});
|
|
6486
|
+
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 })));
|
|
6424
6487
|
}
|
|
6425
6488
|
setBounds(bounds = {}) {
|
|
6426
6489
|
if (typeof bounds.height === 'number') {
|
|
@@ -6429,11 +6492,25 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6429
6492
|
if (typeof bounds.width === 'number') {
|
|
6430
6493
|
this._element.style.width = `${bounds.width}px`;
|
|
6431
6494
|
}
|
|
6432
|
-
if (typeof bounds.top === 'number') {
|
|
6495
|
+
if ('top' in bounds && typeof bounds.top === 'number') {
|
|
6433
6496
|
this._element.style.top = `${bounds.top}px`;
|
|
6497
|
+
this._element.style.bottom = 'auto';
|
|
6498
|
+
this.verticalAlignment = 'top';
|
|
6499
|
+
}
|
|
6500
|
+
if ('bottom' in bounds && typeof bounds.bottom === 'number') {
|
|
6501
|
+
this._element.style.bottom = `${bounds.bottom}px`;
|
|
6502
|
+
this._element.style.top = 'auto';
|
|
6503
|
+
this.verticalAlignment = 'bottom';
|
|
6434
6504
|
}
|
|
6435
|
-
if (typeof bounds.left === 'number') {
|
|
6505
|
+
if ('left' in bounds && typeof bounds.left === 'number') {
|
|
6436
6506
|
this._element.style.left = `${bounds.left}px`;
|
|
6507
|
+
this._element.style.right = 'auto';
|
|
6508
|
+
this.horiziontalAlignment = 'left';
|
|
6509
|
+
}
|
|
6510
|
+
if ('right' in bounds && typeof bounds.right === 'number') {
|
|
6511
|
+
this._element.style.right = `${bounds.right}px`;
|
|
6512
|
+
this._element.style.left = 'auto';
|
|
6513
|
+
this.horiziontalAlignment = 'right';
|
|
6437
6514
|
}
|
|
6438
6515
|
const containerRect = this.options.container.getBoundingClientRect();
|
|
6439
6516
|
const overlayRect = this._element.getBoundingClientRect();
|
|
@@ -6441,24 +6518,54 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6441
6518
|
// a minimum width of minimumViewportWidth must be inside the viewport
|
|
6442
6519
|
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
6443
6520
|
// a minimum height of minimumViewportHeight must be inside the viewport
|
|
6444
|
-
const yOffset =
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
this.
|
|
6521
|
+
const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
|
|
6522
|
+
if (this.verticalAlignment === 'top') {
|
|
6523
|
+
const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6524
|
+
this._element.style.top = `${top}px`;
|
|
6525
|
+
this._element.style.bottom = 'auto';
|
|
6526
|
+
}
|
|
6527
|
+
if (this.verticalAlignment === 'bottom') {
|
|
6528
|
+
const bottom = clamp(containerRect.bottom - overlayRect.bottom, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6529
|
+
this._element.style.bottom = `${bottom}px`;
|
|
6530
|
+
this._element.style.top = 'auto';
|
|
6531
|
+
}
|
|
6532
|
+
if (this.horiziontalAlignment === 'left') {
|
|
6533
|
+
const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6534
|
+
this._element.style.left = `${left}px`;
|
|
6535
|
+
this._element.style.right = 'auto';
|
|
6536
|
+
}
|
|
6537
|
+
if (this.horiziontalAlignment === 'right') {
|
|
6538
|
+
const right = clamp(containerRect.right - overlayRect.right, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6539
|
+
this._element.style.right = `${right}px`;
|
|
6540
|
+
this._element.style.left = 'auto';
|
|
6541
|
+
}
|
|
6451
6542
|
this._onDidChange.fire();
|
|
6452
6543
|
}
|
|
6453
6544
|
toJSON() {
|
|
6454
6545
|
const container = this.options.container.getBoundingClientRect();
|
|
6455
6546
|
const element = this._element.getBoundingClientRect();
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6547
|
+
const result = {};
|
|
6548
|
+
if (this.verticalAlignment === 'top') {
|
|
6549
|
+
result.top = parseFloat(this._element.style.top);
|
|
6550
|
+
}
|
|
6551
|
+
else if (this.verticalAlignment === 'bottom') {
|
|
6552
|
+
result.bottom = parseFloat(this._element.style.bottom);
|
|
6553
|
+
}
|
|
6554
|
+
else {
|
|
6555
|
+
result.top = element.top - container.top;
|
|
6556
|
+
}
|
|
6557
|
+
if (this.horiziontalAlignment === 'left') {
|
|
6558
|
+
result.left = parseFloat(this._element.style.left);
|
|
6559
|
+
}
|
|
6560
|
+
else if (this.horiziontalAlignment === 'right') {
|
|
6561
|
+
result.right = parseFloat(this._element.style.right);
|
|
6562
|
+
}
|
|
6563
|
+
else {
|
|
6564
|
+
result.left = element.left - container.left;
|
|
6565
|
+
}
|
|
6566
|
+
result.width = element.width;
|
|
6567
|
+
result.height = element.height;
|
|
6568
|
+
return result;
|
|
6462
6569
|
}
|
|
6463
6570
|
setupDrag(dragTarget, options = { inDragMode: false }) {
|
|
6464
6571
|
const move = new MutableDisposable();
|
|
@@ -6490,12 +6597,30 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6490
6597
|
};
|
|
6491
6598
|
}
|
|
6492
6599
|
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
6493
|
-
const yOffset = Math.max(0, this.
|
|
6494
|
-
? this.getMinimumHeight(overlayRect.height)
|
|
6495
|
-
: 0);
|
|
6496
|
-
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6600
|
+
const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));
|
|
6497
6601
|
const top = clamp(y - offset.y, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6498
|
-
|
|
6602
|
+
const bottom = clamp(offset.y -
|
|
6603
|
+
y +
|
|
6604
|
+
containerRect.height -
|
|
6605
|
+
overlayRect.height, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
6606
|
+
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6607
|
+
const right = clamp(offset.x - x + containerRect.width - overlayRect.width, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
6608
|
+
const bounds = {};
|
|
6609
|
+
// Anchor to top or to bottom depending on which one is closer
|
|
6610
|
+
if (top <= bottom) {
|
|
6611
|
+
bounds.top = top;
|
|
6612
|
+
}
|
|
6613
|
+
else {
|
|
6614
|
+
bounds.bottom = bottom;
|
|
6615
|
+
}
|
|
6616
|
+
// Anchor to left or to right depending on which one is closer
|
|
6617
|
+
if (left <= right) {
|
|
6618
|
+
bounds.left = left;
|
|
6619
|
+
}
|
|
6620
|
+
else {
|
|
6621
|
+
bounds.right = right;
|
|
6622
|
+
}
|
|
6623
|
+
this.setBounds(bounds);
|
|
6499
6624
|
}), addDisposableWindowListener(window, 'mouseup', () => {
|
|
6500
6625
|
toggleClass(this._element, 'dv-resize-container-dragging', false);
|
|
6501
6626
|
move.dispose();
|
|
@@ -6563,8 +6688,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6563
6688
|
};
|
|
6564
6689
|
}
|
|
6565
6690
|
let top = undefined;
|
|
6691
|
+
let bottom = undefined;
|
|
6566
6692
|
let height = undefined;
|
|
6567
6693
|
let left = undefined;
|
|
6694
|
+
let right = undefined;
|
|
6568
6695
|
let width = undefined;
|
|
6569
6696
|
const moveTop = () => {
|
|
6570
6697
|
top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
|
|
@@ -6578,6 +6705,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6578
6705
|
startPosition.originalY +
|
|
6579
6706
|
startPosition.originalHeight -
|
|
6580
6707
|
top;
|
|
6708
|
+
bottom = containerRect.height - top - height;
|
|
6581
6709
|
};
|
|
6582
6710
|
const moveBottom = () => {
|
|
6583
6711
|
top =
|
|
@@ -6589,6 +6717,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6589
6717
|
? -top +
|
|
6590
6718
|
this.options.minimumInViewportHeight
|
|
6591
6719
|
: Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
|
|
6720
|
+
bottom = containerRect.height - top - height;
|
|
6592
6721
|
};
|
|
6593
6722
|
const moveLeft = () => {
|
|
6594
6723
|
left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
|
|
@@ -6602,6 +6731,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6602
6731
|
startPosition.originalX +
|
|
6603
6732
|
startPosition.originalWidth -
|
|
6604
6733
|
left;
|
|
6734
|
+
right = containerRect.width - left - width;
|
|
6605
6735
|
};
|
|
6606
6736
|
const moveRight = () => {
|
|
6607
6737
|
left =
|
|
@@ -6613,6 +6743,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6613
6743
|
? -left +
|
|
6614
6744
|
this.options.minimumInViewportWidth
|
|
6615
6745
|
: Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
|
|
6746
|
+
right = containerRect.width - left - width;
|
|
6616
6747
|
};
|
|
6617
6748
|
switch (direction) {
|
|
6618
6749
|
case 'top':
|
|
@@ -6644,7 +6775,24 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6644
6775
|
moveRight();
|
|
6645
6776
|
break;
|
|
6646
6777
|
}
|
|
6647
|
-
|
|
6778
|
+
const bounds = {};
|
|
6779
|
+
// Anchor to top or to bottom depending on which one is closer
|
|
6780
|
+
if (top <= bottom) {
|
|
6781
|
+
bounds.top = top;
|
|
6782
|
+
}
|
|
6783
|
+
else {
|
|
6784
|
+
bounds.bottom = bottom;
|
|
6785
|
+
}
|
|
6786
|
+
// Anchor to left or to right depending on which one is closer
|
|
6787
|
+
if (left <= right) {
|
|
6788
|
+
bounds.left = left;
|
|
6789
|
+
}
|
|
6790
|
+
else {
|
|
6791
|
+
bounds.right = right;
|
|
6792
|
+
}
|
|
6793
|
+
bounds.height = height;
|
|
6794
|
+
bounds.width = width;
|
|
6795
|
+
this.setBounds(bounds);
|
|
6648
6796
|
}), {
|
|
6649
6797
|
dispose: () => {
|
|
6650
6798
|
for (const iframe of iframes) {
|
|
@@ -6667,7 +6815,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6667
6815
|
if (typeof this.options.minimumInViewportHeight === 'number') {
|
|
6668
6816
|
return height - this.options.minimumInViewportHeight;
|
|
6669
6817
|
}
|
|
6670
|
-
return
|
|
6818
|
+
return 0;
|
|
6671
6819
|
}
|
|
6672
6820
|
dispose() {
|
|
6673
6821
|
this._element.remove();
|
|
@@ -6690,7 +6838,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6690
6838
|
}
|
|
6691
6839
|
|
|
6692
6840
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6693
|
-
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6841
|
+
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100, width: 300, height: 300 };
|
|
6694
6842
|
|
|
6695
6843
|
function createFocusableElement() {
|
|
6696
6844
|
const element = document.createElement('div');
|
|
@@ -7033,6 +7181,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7033
7181
|
parentElement: options.parentElement,
|
|
7034
7182
|
disableAutoResizing: options.disableAutoResizing,
|
|
7035
7183
|
locked: options.locked,
|
|
7184
|
+
margin: options.gap,
|
|
7036
7185
|
});
|
|
7037
7186
|
this.nextGroupId = sequentialNumberGenerator();
|
|
7038
7187
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -7058,9 +7207,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7058
7207
|
this._onDidActivePanelChange = new Emitter();
|
|
7059
7208
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
7060
7209
|
this._onDidMovePanel = new Emitter();
|
|
7210
|
+
this.onDidMovePanel = this._onDidMovePanel.event;
|
|
7061
7211
|
this._floatingGroups = [];
|
|
7062
7212
|
this._popoutGroups = [];
|
|
7063
|
-
this._ignoreEvents = 0;
|
|
7064
7213
|
this._onDidRemoveGroup = new Emitter();
|
|
7065
7214
|
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
7066
7215
|
this._onDidAddGroup = new Emitter();
|
|
@@ -7074,7 +7223,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7074
7223
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7075
7224
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
7076
7225
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
7077
|
-
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.
|
|
7226
|
+
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(() => {
|
|
7227
|
+
this.updateWatermark();
|
|
7228
|
+
}), this.onDidAdd((event) => {
|
|
7078
7229
|
if (!this._moving) {
|
|
7079
7230
|
this._onDidAddGroup.fire(event);
|
|
7080
7231
|
}
|
|
@@ -7088,7 +7239,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7088
7239
|
}
|
|
7089
7240
|
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
7090
7241
|
this.updateWatermark();
|
|
7091
|
-
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
7242
|
+
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidMovePanel, this.onDidActivePanelChange)(() => {
|
|
7092
7243
|
this._bufferOnDidLayoutChange.fire();
|
|
7093
7244
|
}), exports.DockviewDisposable.from(() => {
|
|
7094
7245
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
@@ -7339,8 +7490,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7339
7490
|
console.error('dockview: failed to create popout window', err);
|
|
7340
7491
|
});
|
|
7341
7492
|
}
|
|
7342
|
-
addFloatingGroup(item,
|
|
7343
|
-
var _a, _b, _c, _d, _e
|
|
7493
|
+
addFloatingGroup(item, options) {
|
|
7494
|
+
var _a, _b, _c, _d, _e;
|
|
7344
7495
|
let group;
|
|
7345
7496
|
if (item instanceof DockviewPanel) {
|
|
7346
7497
|
group = this.createGroup();
|
|
@@ -7385,26 +7536,62 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7385
7536
|
}
|
|
7386
7537
|
}
|
|
7387
7538
|
group.model.location = { type: 'floating' };
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7539
|
+
function getAnchoredBox() {
|
|
7540
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
7541
|
+
const result = {};
|
|
7542
|
+
if ('left' in options.position) {
|
|
7543
|
+
result.left = Math.max(options.position.left, 0);
|
|
7544
|
+
}
|
|
7545
|
+
else if ('right' in options.position) {
|
|
7546
|
+
result.right = Math.max(options.position.right, 0);
|
|
7547
|
+
}
|
|
7548
|
+
else {
|
|
7549
|
+
result.left = DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
7550
|
+
}
|
|
7551
|
+
if ('top' in options.position) {
|
|
7552
|
+
result.top = Math.max(options.position.top, 0);
|
|
7553
|
+
}
|
|
7554
|
+
else if ('bottom' in options.position) {
|
|
7555
|
+
result.bottom = Math.max(options.position.bottom, 0);
|
|
7556
|
+
}
|
|
7557
|
+
else {
|
|
7558
|
+
result.top = DEFAULT_FLOATING_GROUP_POSITION.top;
|
|
7559
|
+
}
|
|
7560
|
+
if ('width' in options.position) {
|
|
7561
|
+
result.width = Math.max(options.position.width, 0);
|
|
7562
|
+
}
|
|
7563
|
+
else {
|
|
7564
|
+
result.width = DEFAULT_FLOATING_GROUP_POSITION.width;
|
|
7565
|
+
}
|
|
7566
|
+
if ('height' in options.position) {
|
|
7567
|
+
result.height = Math.max(options.position.height, 0);
|
|
7568
|
+
}
|
|
7569
|
+
else {
|
|
7570
|
+
result.height = DEFAULT_FLOATING_GROUP_POSITION.height;
|
|
7571
|
+
}
|
|
7572
|
+
return result;
|
|
7573
|
+
}
|
|
7574
|
+
return {
|
|
7575
|
+
left: typeof (options === null || options === void 0 ? void 0 : options.x) === 'number'
|
|
7576
|
+
? Math.max(options.x, 0)
|
|
7577
|
+
: DEFAULT_FLOATING_GROUP_POSITION.left,
|
|
7578
|
+
top: typeof (options === null || options === void 0 ? void 0 : options.y) === 'number'
|
|
7579
|
+
? Math.max(options.y, 0)
|
|
7580
|
+
: DEFAULT_FLOATING_GROUP_POSITION.top,
|
|
7581
|
+
width: typeof (options === null || options === void 0 ? void 0 : options.width) === 'number'
|
|
7582
|
+
? Math.max(options.width, 0)
|
|
7583
|
+
: DEFAULT_FLOATING_GROUP_POSITION.width,
|
|
7584
|
+
height: typeof (options === null || options === void 0 ? void 0 : options.height) === 'number'
|
|
7585
|
+
? Math.max(options.height, 0)
|
|
7586
|
+
: DEFAULT_FLOATING_GROUP_POSITION.height,
|
|
7587
|
+
};
|
|
7588
|
+
}
|
|
7589
|
+
const anchoredBox = getAnchoredBox();
|
|
7590
|
+
const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
7402
7591
|
? undefined
|
|
7403
|
-
: (
|
|
7404
|
-
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
7592
|
+
: (_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'
|
|
7405
7593
|
? undefined
|
|
7406
|
-
: (
|
|
7407
|
-
});
|
|
7594
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
7408
7595
|
const el = group.element.querySelector('.void-container');
|
|
7409
7596
|
if (!el) {
|
|
7410
7597
|
throw new Error('failed to find drag handle');
|
|
@@ -7502,12 +7689,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7502
7689
|
group.overlay.minimumInViewportWidth =
|
|
7503
7690
|
(_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
7504
7691
|
}
|
|
7505
|
-
group.overlay.setBounds(
|
|
7692
|
+
group.overlay.setBounds();
|
|
7506
7693
|
}
|
|
7507
7694
|
}
|
|
7508
7695
|
if (changed_rootOverlayOptions) {
|
|
7509
7696
|
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
7510
7697
|
}
|
|
7698
|
+
if (this.gridview.margin !== 0 && options.gap === undefined) {
|
|
7699
|
+
this.gridview.margin = 0;
|
|
7700
|
+
}
|
|
7701
|
+
if (typeof options.gap === 'number') {
|
|
7702
|
+
this.gridview.margin = options.gap;
|
|
7703
|
+
}
|
|
7511
7704
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
7512
7705
|
}
|
|
7513
7706
|
layout(width, height, forceResize) {
|
|
@@ -7669,11 +7862,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7669
7862
|
const { data, position } = serializedFloatingGroup;
|
|
7670
7863
|
const group = createGroupFromSerializedState(data);
|
|
7671
7864
|
this.addFloatingGroup(group, {
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
}, { skipRemoveGroup: true, inDragMode: false });
|
|
7865
|
+
position: position,
|
|
7866
|
+
skipRemoveGroup: true,
|
|
7867
|
+
inDragMode: false,
|
|
7868
|
+
});
|
|
7677
7869
|
}
|
|
7678
7870
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7679
7871
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
@@ -7808,11 +8000,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7808
8000
|
options.floating !== null
|
|
7809
8001
|
? options.floating
|
|
7810
8002
|
: {};
|
|
7811
|
-
this.addFloatingGroup(group, o, {
|
|
7812
|
-
inDragMode: false,
|
|
7813
|
-
skipRemoveGroup: true,
|
|
7814
|
-
skipActiveGroup: true,
|
|
7815
|
-
});
|
|
8003
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, o), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
7816
8004
|
panel = this.createPanel(options, group);
|
|
7817
8005
|
group.model.openPanel(panel, {
|
|
7818
8006
|
skipSetActive: options.inactive,
|
|
@@ -7851,11 +8039,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7851
8039
|
options.floating !== null
|
|
7852
8040
|
? options.floating
|
|
7853
8041
|
: {};
|
|
7854
|
-
this.addFloatingGroup(group, coordinates, {
|
|
7855
|
-
inDragMode: false,
|
|
7856
|
-
skipRemoveGroup: true,
|
|
7857
|
-
skipActiveGroup: true,
|
|
7858
|
-
});
|
|
8042
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, coordinates), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
7859
8043
|
panel = this.createPanel(options, group);
|
|
7860
8044
|
group.model.openPanel(panel, {
|
|
7861
8045
|
skipSetActive: options.inactive,
|
|
@@ -7910,6 +8094,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7910
8094
|
});
|
|
7911
8095
|
const watermarkContainer = document.createElement('div');
|
|
7912
8096
|
watermarkContainer.className = 'dv-watermark-container';
|
|
8097
|
+
addTestId(watermarkContainer, 'watermark-component');
|
|
7913
8098
|
watermarkContainer.appendChild(this.watermark.element);
|
|
7914
8099
|
this.gridview.element.appendChild(watermarkContainer);
|
|
7915
8100
|
}
|
|
@@ -8098,6 +8283,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8098
8283
|
this.doSetGroupAndPanelActive(destinationGroup);
|
|
8099
8284
|
this._onDidMovePanel.fire({
|
|
8100
8285
|
panel: removedPanel,
|
|
8286
|
+
from: sourceGroup,
|
|
8101
8287
|
});
|
|
8102
8288
|
}
|
|
8103
8289
|
else {
|
|
@@ -8121,6 +8307,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8121
8307
|
// if a group has one tab - we are essentially moving the 'group'
|
|
8122
8308
|
// which is equivalent to swapping two views in this case
|
|
8123
8309
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
8310
|
+
this._onDidMovePanel.fire({
|
|
8311
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
8312
|
+
from: sourceGroup,
|
|
8313
|
+
});
|
|
8124
8314
|
return;
|
|
8125
8315
|
}
|
|
8126
8316
|
}
|
|
@@ -8134,6 +8324,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8134
8324
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
8135
8325
|
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
8136
8326
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
8327
|
+
this._onDidMovePanel.fire({
|
|
8328
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
8329
|
+
from: sourceGroup,
|
|
8330
|
+
});
|
|
8137
8331
|
}
|
|
8138
8332
|
else {
|
|
8139
8333
|
/**
|
|
@@ -8153,6 +8347,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8153
8347
|
skipSetGroupActive: true,
|
|
8154
8348
|
}));
|
|
8155
8349
|
this.doSetGroupAndPanelActive(group);
|
|
8350
|
+
this._onDidMovePanel.fire({
|
|
8351
|
+
panel: removedPanel,
|
|
8352
|
+
from: sourceGroup,
|
|
8353
|
+
});
|
|
8156
8354
|
}
|
|
8157
8355
|
}
|
|
8158
8356
|
}
|
|
@@ -8177,9 +8375,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8177
8375
|
}
|
|
8178
8376
|
});
|
|
8179
8377
|
this.doSetGroupAndPanelActive(to);
|
|
8180
|
-
panels.forEach((panel) => {
|
|
8181
|
-
this._onDidMovePanel.fire({ panel });
|
|
8182
|
-
});
|
|
8183
8378
|
}
|
|
8184
8379
|
else {
|
|
8185
8380
|
switch (from.api.location.type) {
|
|
@@ -8205,10 +8400,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8205
8400
|
const referenceLocation = getGridLocation(to.element);
|
|
8206
8401
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
8207
8402
|
this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
|
|
8208
|
-
from.panels.forEach((panel) => {
|
|
8209
|
-
this._onDidMovePanel.fire({ panel });
|
|
8210
|
-
});
|
|
8211
8403
|
}
|
|
8404
|
+
from.panels.forEach((panel) => {
|
|
8405
|
+
this._onDidMovePanel.fire({ panel, from });
|
|
8406
|
+
});
|
|
8212
8407
|
}
|
|
8213
8408
|
doSetGroupActive(group) {
|
|
8214
8409
|
super.doSetGroupActive(group);
|
|
@@ -9832,8 +10027,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9832
10027
|
}
|
|
9833
10028
|
return t;
|
|
9834
10029
|
};
|
|
10030
|
+
function useTitle(api) {
|
|
10031
|
+
const [title, setTitle] = React.useState(api.title);
|
|
10032
|
+
React.useEffect(() => {
|
|
10033
|
+
const disposable = api.onDidTitleChange((event) => {
|
|
10034
|
+
setTitle(event.title);
|
|
10035
|
+
});
|
|
10036
|
+
return () => {
|
|
10037
|
+
disposable.dispose();
|
|
10038
|
+
};
|
|
10039
|
+
}, [api]);
|
|
10040
|
+
return title;
|
|
10041
|
+
}
|
|
9835
10042
|
const DockviewDefaultTab = (_a) => {
|
|
9836
10043
|
var { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride } = _a, rest = __rest(_a, ["api", "containerApi", "params", "hideClose", "closeActionOverride"]);
|
|
10044
|
+
const title = useTitle(api);
|
|
9837
10045
|
const onClose = React.useCallback((event) => {
|
|
9838
10046
|
event.preventDefault();
|
|
9839
10047
|
if (closeActionOverride) {
|
|
@@ -9856,7 +10064,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9856
10064
|
}
|
|
9857
10065
|
}, [api, rest.onClick]);
|
|
9858
10066
|
return (React.createElement("div", Object.assign({ "data-testid": "dockview-dv-default-tab" }, rest, { onClick: onClick, className: "dv-default-tab" }),
|
|
9859
|
-
React.createElement("span", { className: "dv-default-tab-content" },
|
|
10067
|
+
React.createElement("span", { className: "dv-default-tab-content" }, title),
|
|
9860
10068
|
!hideClose && (React.createElement("div", { className: "dv-default-tab-action", onMouseDown: onMouseDown, onClick: onClose },
|
|
9861
10069
|
React.createElement(CloseButton, null)))));
|
|
9862
10070
|
};
|