dockview-core 1.7.6 → 1.8.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/README.md +2 -1
- package/dist/cjs/api/component.api.d.ts +6 -1
- package/dist/cjs/api/component.api.d.ts.map +1 -1
- package/dist/cjs/api/component.api.js +6 -0
- package/dist/cjs/api/component.api.js.map +1 -1
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +30 -0
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts.map +1 -0
- package/dist/cjs/api/dockviewGroupPanelApi.js +54 -0
- package/dist/cjs/api/dockviewGroupPanelApi.js.map +1 -0
- package/dist/cjs/api/dockviewPanelApi.d.ts +14 -1
- package/dist/cjs/api/dockviewPanelApi.d.ts.map +1 -1
- package/dist/cjs/api/dockviewPanelApi.js +6 -1
- package/dist/cjs/api/dockviewPanelApi.js.map +1 -1
- package/dist/cjs/array.d.ts +1 -0
- package/dist/cjs/array.d.ts.map +1 -1
- package/dist/cjs/array.js +10 -1
- package/dist/cjs/array.js.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.d.ts +1 -0
- package/dist/cjs/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.js +7 -0
- package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
- package/dist/cjs/dnd/droptarget.d.ts +11 -0
- package/dist/cjs/dnd/droptarget.d.ts.map +1 -1
- package/dist/cjs/dnd/droptarget.js +32 -9
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dnd/groupDragHandler.d.ts +1 -0
- package/dist/cjs/dnd/groupDragHandler.d.ts.map +1 -1
- package/dist/cjs/dnd/groupDragHandler.js +18 -0
- package/dist/cjs/dnd/groupDragHandler.js.map +1 -1
- package/dist/cjs/dnd/overlay.d.ts +40 -0
- package/dist/cjs/dnd/overlay.d.ts.map +1 -0
- package/dist/cjs/dnd/overlay.js +382 -0
- package/dist/cjs/dnd/overlay.js.map +1 -0
- package/dist/cjs/dockview/components/tab/tab.d.ts +2 -2
- package/dist/cjs/dockview/components/tab/tab.d.ts.map +1 -1
- package/dist/cjs/dockview/components/tab/tab.js +0 -7
- package/dist/cjs/dockview/components/tab/tab.js.map +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +8 -4
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +54 -10
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/dockview/deserializer.d.ts +2 -2
- package/dist/cjs/dockview/deserializer.d.ts.map +1 -1
- package/dist/cjs/dockview/deserializer.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +41 -9
- package/dist/cjs/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.js +277 -76
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +24 -0
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts.map +1 -0
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +35 -0
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.js.map +1 -0
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +5 -6
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanel.js +3 -2
- package/dist/cjs/dockview/dockviewGroupPanel.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +5 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +43 -12
- package/dist/cjs/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.d.ts +2 -2
- package/dist/cjs/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.js +1 -1
- package/dist/cjs/dockview/dockviewPanel.js.map +1 -1
- package/dist/cjs/dockview/options.d.ts +22 -6
- package/dist/cjs/dockview/options.d.ts.map +1 -1
- package/dist/cjs/dockview/options.js.map +1 -1
- package/dist/cjs/dom.d.ts +5 -3
- package/dist/cjs/dom.d.ts.map +1 -1
- package/dist/cjs/dom.js +13 -1
- package/dist/cjs/dom.js.map +1 -1
- package/dist/cjs/events.d.ts.map +1 -1
- package/dist/cjs/gridview/branchNode.js +2 -2
- package/dist/cjs/gridview/branchNode.js.map +1 -1
- package/dist/cjs/gridview/gridview.d.ts.map +1 -1
- package/dist/cjs/gridview/gridview.js +9 -7
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewComponent.d.ts.map +1 -1
- package/dist/cjs/gridview/gridviewComponent.js +4 -1
- package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.d.ts +3 -3
- package/dist/cjs/gridview/gridviewPanel.d.ts.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.js +2 -2
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/math.d.ts.map +1 -1
- package/dist/cjs/paneview/paneviewComponent.d.ts.map +1 -1
- package/dist/cjs/paneview/paneviewComponent.js +4 -1
- package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.d.ts.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.js +4 -1
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/dockview-core.amd.js +764 -133
- package/dist/dockview-core.amd.js.map +1 -0
- package/dist/dockview-core.amd.min.js +3 -2
- package/dist/dockview-core.amd.min.js.map +1 -0
- package/dist/dockview-core.amd.min.noStyle.js +3 -2
- package/dist/dockview-core.amd.min.noStyle.js.map +1 -0
- package/dist/dockview-core.amd.noStyle.js +763 -132
- package/dist/dockview-core.amd.noStyle.js.map +1 -0
- package/dist/dockview-core.cjs.js +764 -133
- package/dist/dockview-core.cjs.js.map +1 -0
- package/dist/dockview-core.esm.js +765 -133
- package/dist/dockview-core.esm.js.map +1 -0
- package/dist/dockview-core.esm.min.js +3 -2
- package/dist/dockview-core.esm.min.js.map +1 -0
- package/dist/dockview-core.js +764 -133
- package/dist/dockview-core.js.map +1 -0
- package/dist/dockview-core.min.js +3 -2
- package/dist/dockview-core.min.js.map +1 -0
- package/dist/dockview-core.min.noStyle.js +3 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -0
- package/dist/dockview-core.noStyle.js +763 -132
- package/dist/dockview-core.noStyle.js.map +1 -0
- package/dist/esm/api/component.api.d.ts +6 -1
- package/dist/esm/api/component.api.d.ts.map +1 -1
- package/dist/esm/api/component.api.js +6 -0
- package/dist/esm/api/component.api.js.map +1 -1
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +30 -0
- package/dist/esm/api/dockviewGroupPanelApi.d.ts.map +1 -0
- package/dist/esm/api/dockviewGroupPanelApi.js +28 -0
- package/dist/esm/api/dockviewGroupPanelApi.js.map +1 -0
- package/dist/esm/api/dockviewPanelApi.d.ts +14 -1
- package/dist/esm/api/dockviewPanelApi.d.ts.map +1 -1
- package/dist/esm/api/dockviewPanelApi.js +6 -1
- package/dist/esm/api/dockviewPanelApi.js.map +1 -1
- package/dist/esm/array.d.ts +1 -0
- package/dist/esm/array.d.ts.map +1 -1
- package/dist/esm/array.js +8 -0
- package/dist/esm/array.js.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.d.ts +1 -0
- package/dist/esm/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.js +7 -0
- package/dist/esm/dnd/abstractDragHandler.js.map +1 -1
- package/dist/esm/dnd/droptarget.d.ts +11 -0
- package/dist/esm/dnd/droptarget.d.ts.map +1 -1
- package/dist/esm/dnd/droptarget.js +32 -9
- package/dist/esm/dnd/droptarget.js.map +1 -1
- package/dist/esm/dnd/groupDragHandler.d.ts +1 -0
- package/dist/esm/dnd/groupDragHandler.d.ts.map +1 -1
- package/dist/esm/dnd/groupDragHandler.js +18 -0
- package/dist/esm/dnd/groupDragHandler.js.map +1 -1
- package/dist/esm/dnd/overlay.d.ts +40 -0
- package/dist/esm/dnd/overlay.d.ts.map +1 -0
- package/dist/esm/dnd/overlay.js +282 -0
- package/dist/esm/dnd/overlay.js.map +1 -0
- package/dist/esm/dockview/components/tab/tab.d.ts +2 -2
- package/dist/esm/dockview/components/tab/tab.d.ts.map +1 -1
- package/dist/esm/dockview/components/tab/tab.js +0 -7
- package/dist/esm/dockview/components/tab/tab.js.map +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +8 -4
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +54 -10
- package/dist/esm/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/esm/dockview/deserializer.d.ts +2 -2
- package/dist/esm/dockview/deserializer.d.ts.map +1 -1
- package/dist/esm/dockview/deserializer.js.map +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +41 -9
- package/dist/esm/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewComponent.js +223 -54
- package/dist/esm/dockview/dockviewComponent.js.map +1 -1
- package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +24 -0
- package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts.map +1 -0
- package/dist/esm/dockview/dockviewFloatingGroupPanel.js +13 -0
- package/dist/esm/dockview/dockviewFloatingGroupPanel.js.map +1 -0
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +5 -6
- package/dist/esm/dockview/dockviewGroupPanel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanel.js +3 -2
- package/dist/esm/dockview/dockviewGroupPanel.js.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +5 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.js +36 -9
- package/dist/esm/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/esm/dockview/dockviewPanel.d.ts +2 -2
- package/dist/esm/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewPanel.js +1 -1
- package/dist/esm/dockview/dockviewPanel.js.map +1 -1
- package/dist/esm/dockview/options.d.ts +22 -6
- package/dist/esm/dockview/options.d.ts.map +1 -1
- package/dist/esm/dockview/options.js.map +1 -1
- package/dist/esm/dom.d.ts +5 -3
- package/dist/esm/dom.d.ts.map +1 -1
- package/dist/esm/dom.js +10 -0
- package/dist/esm/dom.js.map +1 -1
- package/dist/esm/events.d.ts.map +1 -1
- package/dist/esm/gridview/branchNode.js +2 -2
- package/dist/esm/gridview/branchNode.js.map +1 -1
- package/dist/esm/gridview/gridview.d.ts.map +1 -1
- package/dist/esm/gridview/gridview.js +9 -6
- package/dist/esm/gridview/gridview.js.map +1 -1
- package/dist/esm/gridview/gridviewComponent.d.ts.map +1 -1
- package/dist/esm/gridview/gridviewComponent.js +4 -1
- package/dist/esm/gridview/gridviewComponent.js.map +1 -1
- package/dist/esm/gridview/gridviewPanel.d.ts +3 -3
- package/dist/esm/gridview/gridviewPanel.d.ts.map +1 -1
- package/dist/esm/gridview/gridviewPanel.js +2 -2
- package/dist/esm/gridview/gridviewPanel.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/math.d.ts.map +1 -1
- package/dist/esm/math.js.map +1 -1
- package/dist/esm/paneview/paneviewComponent.d.ts.map +1 -1
- package/dist/esm/paneview/paneviewComponent.js +4 -1
- package/dist/esm/paneview/paneviewComponent.js.map +1 -1
- package/dist/esm/splitview/splitviewComponent.d.ts.map +1 -1
- package/dist/esm/splitview/splitviewComponent.js +4 -1
- package/dist/esm/splitview/splitviewComponent.js.map +1 -1
- package/dist/styles/dockview.css +216 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.8.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -273,6 +273,31 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
|
|
277
|
+
const Component = typeof componentName === 'string'
|
|
278
|
+
? components[componentName]
|
|
279
|
+
: undefined;
|
|
280
|
+
const FrameworkComponent = typeof componentName === 'string'
|
|
281
|
+
? frameworkComponents[componentName]
|
|
282
|
+
: undefined;
|
|
283
|
+
if (Component && FrameworkComponent) {
|
|
284
|
+
throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
|
|
285
|
+
}
|
|
286
|
+
if (FrameworkComponent) {
|
|
287
|
+
if (!createFrameworkComponent) {
|
|
288
|
+
throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
|
|
289
|
+
}
|
|
290
|
+
return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
|
|
291
|
+
}
|
|
292
|
+
if (!Component) {
|
|
293
|
+
if (fallback) {
|
|
294
|
+
return fallback();
|
|
295
|
+
}
|
|
296
|
+
throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
|
|
297
|
+
}
|
|
298
|
+
return new Component(id, componentName);
|
|
299
|
+
}
|
|
300
|
+
|
|
276
301
|
function watchElementResize(element, cb) {
|
|
277
302
|
const observer = new ResizeObserver((entires) => {
|
|
278
303
|
/**
|
|
@@ -386,31 +411,16 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
386
411
|
refreshState() {
|
|
387
412
|
this._refreshStateHandler();
|
|
388
413
|
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
|
|
400
|
-
}
|
|
401
|
-
if (FrameworkComponent) {
|
|
402
|
-
if (!createFrameworkComponent) {
|
|
403
|
-
throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
|
|
404
|
-
}
|
|
405
|
-
return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
|
|
406
|
-
}
|
|
407
|
-
if (!Component) {
|
|
408
|
-
if (fallback) {
|
|
409
|
-
return fallback();
|
|
410
|
-
}
|
|
411
|
-
throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
|
|
412
|
-
}
|
|
413
|
-
return new Component(id, componentName);
|
|
414
|
+
}
|
|
415
|
+
// quasi: apparently, but not really; seemingly
|
|
416
|
+
const QUASI_PREVENT_DEFAULT_KEY = 'dv-quasiPreventDefault';
|
|
417
|
+
// mark an event directly for other listeners to check
|
|
418
|
+
function quasiPreventDefault(event) {
|
|
419
|
+
event[QUASI_PREVENT_DEFAULT_KEY] = true;
|
|
420
|
+
}
|
|
421
|
+
// check if this event has been marked
|
|
422
|
+
function quasiDefaultPrevented(event) {
|
|
423
|
+
return event[QUASI_PREVENT_DEFAULT_KEY];
|
|
414
424
|
}
|
|
415
425
|
|
|
416
426
|
function tail(arr) {
|
|
@@ -461,6 +471,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
461
471
|
}
|
|
462
472
|
}
|
|
463
473
|
return -1;
|
|
474
|
+
}
|
|
475
|
+
function remove(array, value) {
|
|
476
|
+
const index = array.findIndex((t) => t === value);
|
|
477
|
+
if (index > -1) {
|
|
478
|
+
array.splice(index, 1);
|
|
479
|
+
return true;
|
|
480
|
+
}
|
|
481
|
+
return false;
|
|
464
482
|
}
|
|
465
483
|
|
|
466
484
|
const clamp = (value, min, max) => {
|
|
@@ -1603,7 +1621,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1603
1621
|
: true,
|
|
1604
1622
|
};
|
|
1605
1623
|
}),
|
|
1606
|
-
size: this.
|
|
1624
|
+
size: this.orthogonalSize,
|
|
1607
1625
|
};
|
|
1608
1626
|
this.children = childDescriptors.map((c) => c.node);
|
|
1609
1627
|
this.splitview = new Splitview(this.element, {
|
|
@@ -1666,7 +1684,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1666
1684
|
layout(size, orthogonalSize) {
|
|
1667
1685
|
this._size = orthogonalSize;
|
|
1668
1686
|
this._orthogonalSize = size;
|
|
1669
|
-
this.splitview.layout(
|
|
1687
|
+
this.splitview.layout(orthogonalSize, size);
|
|
1670
1688
|
}
|
|
1671
1689
|
addChild(node, size, index, skipLayout) {
|
|
1672
1690
|
if (index < 0 || index > this.children.length) {
|
|
@@ -1891,9 +1909,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1891
1909
|
this._deserialize(json.root, orientation, deserializer, height);
|
|
1892
1910
|
}
|
|
1893
1911
|
_deserialize(root, orientation, deserializer, orthogonalSize) {
|
|
1894
|
-
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize
|
|
1912
|
+
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
|
|
1895
1913
|
}
|
|
1896
|
-
_deserializeNode(node, orientation, deserializer, orthogonalSize
|
|
1914
|
+
_deserializeNode(node, orientation, deserializer, orthogonalSize) {
|
|
1897
1915
|
let result;
|
|
1898
1916
|
if (node.type === 'branch') {
|
|
1899
1917
|
const serializedChildren = node.data;
|
|
@@ -1903,9 +1921,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1903
1921
|
visible: serializedChild.visible,
|
|
1904
1922
|
};
|
|
1905
1923
|
});
|
|
1906
|
-
//
|
|
1907
|
-
//
|
|
1908
|
-
|
|
1924
|
+
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
1925
|
+
orthogonalSize, // <- size - flips at each depth
|
|
1926
|
+
children);
|
|
1909
1927
|
}
|
|
1910
1928
|
else {
|
|
1911
1929
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -1938,7 +1956,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1938
1956
|
const oldRoot = this.root;
|
|
1939
1957
|
oldRoot.element.remove();
|
|
1940
1958
|
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
|
|
1941
|
-
if (oldRoot.children.length ===
|
|
1959
|
+
if (oldRoot.children.length === 0) ;
|
|
1960
|
+
else if (oldRoot.children.length === 1) {
|
|
1942
1961
|
// can remove one level of redundant branching if there is only a single child
|
|
1943
1962
|
const childReference = oldRoot.children[0];
|
|
1944
1963
|
const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
@@ -2454,6 +2473,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2454
2473
|
addPanel(options) {
|
|
2455
2474
|
return this.component.addPanel(options);
|
|
2456
2475
|
}
|
|
2476
|
+
removePanel(panel) {
|
|
2477
|
+
this.component.removePanel(panel);
|
|
2478
|
+
}
|
|
2457
2479
|
addGroup(options) {
|
|
2458
2480
|
return this.component.addGroup(options);
|
|
2459
2481
|
}
|
|
@@ -2472,6 +2494,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2472
2494
|
getGroup(id) {
|
|
2473
2495
|
return this.component.getPanel(id);
|
|
2474
2496
|
}
|
|
2497
|
+
addFloatingGroup(item, coord) {
|
|
2498
|
+
return this.component.addFloatingGroup(item, coord);
|
|
2499
|
+
}
|
|
2475
2500
|
fromJSON(data) {
|
|
2476
2501
|
this.component.fromJSON(data);
|
|
2477
2502
|
}
|
|
@@ -2564,10 +2589,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2564
2589
|
this._onDrop = new Emitter();
|
|
2565
2590
|
this.onDrop = this._onDrop.event;
|
|
2566
2591
|
// use a set to take advantage of #<set>.has
|
|
2567
|
-
|
|
2592
|
+
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
2568
2593
|
this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
|
|
2569
2594
|
onDragEnter: () => undefined,
|
|
2570
2595
|
onDragOver: (e) => {
|
|
2596
|
+
if (this._acceptedTargetZonesSet.size === 0) {
|
|
2597
|
+
this.removeDropTarget();
|
|
2598
|
+
return;
|
|
2599
|
+
}
|
|
2571
2600
|
const width = this.element.clientWidth;
|
|
2572
2601
|
const height = this.element.clientHeight;
|
|
2573
2602
|
if (width === 0 || height === 0) {
|
|
@@ -2576,20 +2605,28 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2576
2605
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
2577
2606
|
const x = e.clientX - rect.left;
|
|
2578
2607
|
const y = e.clientY - rect.top;
|
|
2579
|
-
const quadrant = this.calculateQuadrant(
|
|
2580
|
-
|
|
2608
|
+
const quadrant = this.calculateQuadrant(this._acceptedTargetZonesSet, x, y, width, height);
|
|
2609
|
+
/**
|
|
2610
|
+
* If the event has already been used by another DropTarget instance
|
|
2611
|
+
* then don't show a second drop target, only one target should be
|
|
2612
|
+
* active at any one time
|
|
2613
|
+
*/
|
|
2614
|
+
if (this.isAlreadyUsed(e) || quadrant === null) {
|
|
2581
2615
|
// no drop target should be displayed
|
|
2582
2616
|
this.removeDropTarget();
|
|
2583
2617
|
return;
|
|
2584
2618
|
}
|
|
2585
2619
|
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
2586
2620
|
if (!this.options.canDisplayOverlay) {
|
|
2621
|
+
this.removeDropTarget();
|
|
2587
2622
|
return;
|
|
2588
2623
|
}
|
|
2589
2624
|
}
|
|
2590
2625
|
else if (!this.options.canDisplayOverlay(e, quadrant)) {
|
|
2626
|
+
this.removeDropTarget();
|
|
2591
2627
|
return;
|
|
2592
2628
|
}
|
|
2629
|
+
this.markAsUsed(e);
|
|
2593
2630
|
if (!this.targetElement) {
|
|
2594
2631
|
this.targetElement = document.createElement('div');
|
|
2595
2632
|
this.targetElement.className = 'drop-target-dropzone';
|
|
@@ -2600,12 +2637,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2600
2637
|
this.element.classList.add('drop-target');
|
|
2601
2638
|
this.element.append(this.targetElement);
|
|
2602
2639
|
}
|
|
2603
|
-
if (this.options.acceptedTargetZones.length === 0) {
|
|
2604
|
-
return;
|
|
2605
|
-
}
|
|
2606
|
-
if (!this.targetElement || !this.overlayElement) {
|
|
2607
|
-
return;
|
|
2608
|
-
}
|
|
2609
2640
|
this.toggleClasses(quadrant, width, height);
|
|
2610
2641
|
this.setState(quadrant);
|
|
2611
2642
|
},
|
|
@@ -2628,10 +2659,26 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2628
2659
|
},
|
|
2629
2660
|
}));
|
|
2630
2661
|
}
|
|
2662
|
+
setTargetZones(acceptedTargetZones) {
|
|
2663
|
+
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
2664
|
+
}
|
|
2631
2665
|
dispose() {
|
|
2632
2666
|
this.removeDropTarget();
|
|
2633
2667
|
super.dispose();
|
|
2634
2668
|
}
|
|
2669
|
+
/**
|
|
2670
|
+
* Add a property to the event object for other potential listeners to check
|
|
2671
|
+
*/
|
|
2672
|
+
markAsUsed(event) {
|
|
2673
|
+
event[Droptarget.USED_EVENT_ID] = true;
|
|
2674
|
+
}
|
|
2675
|
+
/**
|
|
2676
|
+
* Check is the event has already been used by another instance od DropTarget
|
|
2677
|
+
*/
|
|
2678
|
+
isAlreadyUsed(event) {
|
|
2679
|
+
const value = event[Droptarget.USED_EVENT_ID];
|
|
2680
|
+
return typeof value === 'boolean' && value;
|
|
2681
|
+
}
|
|
2635
2682
|
toggleClasses(quadrant, width, height) {
|
|
2636
2683
|
var _a, _b, _c, _d;
|
|
2637
2684
|
if (!this.overlayElement) {
|
|
@@ -2726,6 +2773,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2726
2773
|
}
|
|
2727
2774
|
}
|
|
2728
2775
|
}
|
|
2776
|
+
Droptarget.USED_EVENT_ID = '__dockview_droptarget_event_is_used__';
|
|
2729
2777
|
function calculateQuadrantAsPercentage(overlayType, x, y, width, height, threshold) {
|
|
2730
2778
|
const xp = (100 * x) / width;
|
|
2731
2779
|
const yp = (100 * y) / height;
|
|
@@ -2855,8 +2903,15 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2855
2903
|
this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
|
|
2856
2904
|
this.configure();
|
|
2857
2905
|
}
|
|
2906
|
+
isCancelled(_event) {
|
|
2907
|
+
return false;
|
|
2908
|
+
}
|
|
2858
2909
|
configure() {
|
|
2859
2910
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2911
|
+
if (this.isCancelled(event)) {
|
|
2912
|
+
event.preventDefault();
|
|
2913
|
+
return;
|
|
2914
|
+
}
|
|
2860
2915
|
const iframes = [
|
|
2861
2916
|
...getElementsByTagName('iframe'),
|
|
2862
2917
|
...getElementsByTagName('webview'),
|
|
@@ -2930,13 +2985,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2930
2985
|
if (event.defaultPrevented) {
|
|
2931
2986
|
return;
|
|
2932
2987
|
}
|
|
2933
|
-
/**
|
|
2934
|
-
* TODO: alternative to stopPropagation
|
|
2935
|
-
*
|
|
2936
|
-
* I need to stop the event propagation here since otherwise it'll be intercepted by event handlers
|
|
2937
|
-
* on the tabs-container. I cannot use event.preventDefault() since I need the on DragStart event to occur
|
|
2938
|
-
*/
|
|
2939
|
-
event.stopPropagation();
|
|
2940
2988
|
this._onChanged.fire(event);
|
|
2941
2989
|
}));
|
|
2942
2990
|
this.droptarget = new Droptarget(this._element, {
|
|
@@ -2994,6 +3042,22 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2994
3042
|
this.accessorId = accessorId;
|
|
2995
3043
|
this.group = group;
|
|
2996
3044
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
3045
|
+
this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
|
|
3046
|
+
if (e.shiftKey) {
|
|
3047
|
+
/**
|
|
3048
|
+
* You cannot call e.preventDefault() because that will prevent drag events from firing
|
|
3049
|
+
* but we also need to stop any group overlay drag events from occuring
|
|
3050
|
+
* Use a custom event marker that can be checked by the overlay drag events
|
|
3051
|
+
*/
|
|
3052
|
+
quasiPreventDefault(e);
|
|
3053
|
+
}
|
|
3054
|
+
}, true));
|
|
3055
|
+
}
|
|
3056
|
+
isCancelled(_event) {
|
|
3057
|
+
if (this.group.api.isFloating && !_event.shiftKey) {
|
|
3058
|
+
return true;
|
|
3059
|
+
}
|
|
3060
|
+
return false;
|
|
2997
3061
|
}
|
|
2998
3062
|
getData(dataTransfer) {
|
|
2999
3063
|
this.panelTransfer.setData([new PanelTransfer(this.accessorId, this.group.id, null)], PanelTransfer.prototype);
|
|
@@ -3084,17 +3148,30 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3084
3148
|
hide() {
|
|
3085
3149
|
this._element.style.display = 'none';
|
|
3086
3150
|
}
|
|
3087
|
-
|
|
3088
|
-
if (this.
|
|
3151
|
+
setRightActionsElement(element) {
|
|
3152
|
+
if (this.rightActions === element) {
|
|
3089
3153
|
return;
|
|
3090
3154
|
}
|
|
3091
|
-
if (this.
|
|
3092
|
-
this.
|
|
3093
|
-
this.
|
|
3155
|
+
if (this.rightActions) {
|
|
3156
|
+
this.rightActions.remove();
|
|
3157
|
+
this.rightActions = undefined;
|
|
3094
3158
|
}
|
|
3095
3159
|
if (element) {
|
|
3096
|
-
this.
|
|
3097
|
-
this.
|
|
3160
|
+
this.rightActionsContainer.appendChild(element);
|
|
3161
|
+
this.rightActions = element;
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
setLeftActionsElement(element) {
|
|
3165
|
+
if (this.leftActions === element) {
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3168
|
+
if (this.leftActions) {
|
|
3169
|
+
this.leftActions.remove();
|
|
3170
|
+
this.leftActions = undefined;
|
|
3171
|
+
}
|
|
3172
|
+
if (element) {
|
|
3173
|
+
this.leftActionsContainer.appendChild(element);
|
|
3174
|
+
this.leftActions = element;
|
|
3098
3175
|
}
|
|
3099
3176
|
}
|
|
3100
3177
|
get element() {
|
|
@@ -3129,19 +3206,35 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3129
3206
|
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3130
3207
|
}
|
|
3131
3208
|
}));
|
|
3132
|
-
this.
|
|
3133
|
-
this.
|
|
3209
|
+
this.rightActionsContainer = document.createElement('div');
|
|
3210
|
+
this.rightActionsContainer.className = 'right-actions-container';
|
|
3211
|
+
this.leftActionsContainer = document.createElement('div');
|
|
3212
|
+
this.leftActionsContainer.className = 'left-actions-container';
|
|
3134
3213
|
this.tabContainer = document.createElement('div');
|
|
3135
3214
|
this.tabContainer.className = 'tabs-container';
|
|
3136
3215
|
this.voidContainer = new VoidContainer(this.accessor, this.group);
|
|
3137
3216
|
this._element.appendChild(this.tabContainer);
|
|
3217
|
+
this._element.appendChild(this.leftActionsContainer);
|
|
3138
3218
|
this._element.appendChild(this.voidContainer.element);
|
|
3139
|
-
this._element.appendChild(this.
|
|
3219
|
+
this._element.appendChild(this.rightActionsContainer);
|
|
3140
3220
|
this.addDisposables(this.voidContainer, this.voidContainer.onDrop((event) => {
|
|
3141
3221
|
this._onDrop.fire({
|
|
3142
3222
|
event: event.nativeEvent,
|
|
3143
3223
|
index: this.tabs.length,
|
|
3144
3224
|
});
|
|
3225
|
+
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
3226
|
+
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3227
|
+
if (isFloatingGroupsEnabled &&
|
|
3228
|
+
event.shiftKey &&
|
|
3229
|
+
!this.group.api.isFloating) {
|
|
3230
|
+
event.preventDefault();
|
|
3231
|
+
const { top, left } = this.element.getBoundingClientRect();
|
|
3232
|
+
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
3233
|
+
this.accessor.addFloatingGroup(this.group, {
|
|
3234
|
+
x: left - rootLeft + 20,
|
|
3235
|
+
y: top - rootTop + 20,
|
|
3236
|
+
}, { inDragMode: true });
|
|
3237
|
+
}
|
|
3145
3238
|
}), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
3146
3239
|
if (event.defaultPrevented) {
|
|
3147
3240
|
return;
|
|
@@ -3195,6 +3288,21 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3195
3288
|
tabToAdd.setContent(panel.view.tab);
|
|
3196
3289
|
const disposable = CompositeDisposable.from(tabToAdd.onChanged((event) => {
|
|
3197
3290
|
var _a;
|
|
3291
|
+
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3292
|
+
const isFloatingWithOnePanel = this.group.api.isFloating && this.size === 1;
|
|
3293
|
+
if (isFloatingGroupsEnabled &&
|
|
3294
|
+
!isFloatingWithOnePanel &&
|
|
3295
|
+
event.shiftKey) {
|
|
3296
|
+
event.preventDefault();
|
|
3297
|
+
const panel = this.accessor.getGroupPanel(tabToAdd.panelId);
|
|
3298
|
+
const { top, left } = tabToAdd.element.getBoundingClientRect();
|
|
3299
|
+
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
3300
|
+
this.accessor.addFloatingGroup(panel, {
|
|
3301
|
+
x: left - rootLeft,
|
|
3302
|
+
y: top - rootTop,
|
|
3303
|
+
}, { inDragMode: true });
|
|
3304
|
+
return;
|
|
3305
|
+
}
|
|
3198
3306
|
const alreadyFocused = panel.id === ((_a = this.group.model.activePanel) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
3199
3307
|
this.group.model.isContentFocused;
|
|
3200
3308
|
const isLeftClick = event.button === 0;
|
|
@@ -3264,6 +3372,17 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3264
3372
|
}
|
|
3265
3373
|
return isAncestor(document.activeElement, this.contentContainer.element);
|
|
3266
3374
|
}
|
|
3375
|
+
get isFloating() {
|
|
3376
|
+
return this._isFloating;
|
|
3377
|
+
}
|
|
3378
|
+
set isFloating(value) {
|
|
3379
|
+
this._isFloating = value;
|
|
3380
|
+
this.dropTarget.setTargetZones(value ? ['center'] : ['top', 'bottom', 'left', 'right', 'center']);
|
|
3381
|
+
toggleClass(this.container, 'dv-groupview-floating', value);
|
|
3382
|
+
this.groupPanel.api._onDidFloatingStateChange.fire({
|
|
3383
|
+
isFloating: this.isFloating,
|
|
3384
|
+
});
|
|
3385
|
+
}
|
|
3267
3386
|
constructor(container, accessor, id, options, groupPanel) {
|
|
3268
3387
|
super();
|
|
3269
3388
|
this.container = container;
|
|
@@ -3273,6 +3392,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3273
3392
|
this.groupPanel = groupPanel;
|
|
3274
3393
|
this._isGroupActive = false;
|
|
3275
3394
|
this._locked = false;
|
|
3395
|
+
this._isFloating = false;
|
|
3276
3396
|
this.mostRecentlyUsed = [];
|
|
3277
3397
|
this._onDidChange = new Emitter();
|
|
3278
3398
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -3289,7 +3409,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3289
3409
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
3290
3410
|
this._onDidActivePanelChange = new Emitter();
|
|
3291
3411
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
3292
|
-
this.container
|
|
3412
|
+
toggleClass(this.container, 'groupview', true);
|
|
3293
3413
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
3294
3414
|
this.contentContainer = new ContentContainer();
|
|
3295
3415
|
this.dropTarget = new Droptarget(this.contentContainer.element, {
|
|
@@ -3299,6 +3419,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3299
3419
|
return false;
|
|
3300
3420
|
}
|
|
3301
3421
|
const data = getPanelData();
|
|
3422
|
+
if (!data && event.shiftKey && !this.isFloating) {
|
|
3423
|
+
return false;
|
|
3424
|
+
}
|
|
3302
3425
|
if (data && data.viewId === this.accessor.id) {
|
|
3303
3426
|
if (data.groupId === this.id) {
|
|
3304
3427
|
if (position === 'center') {
|
|
@@ -3343,14 +3466,25 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3343
3466
|
// correctly initialized
|
|
3344
3467
|
this.setActive(this.isActive, true, true);
|
|
3345
3468
|
this.updateContainer();
|
|
3346
|
-
if (this.accessor.options.
|
|
3347
|
-
this.
|
|
3348
|
-
|
|
3349
|
-
this.
|
|
3469
|
+
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
3470
|
+
this._rightHeaderActions =
|
|
3471
|
+
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
3472
|
+
this.addDisposables(this._rightHeaderActions);
|
|
3473
|
+
this._rightHeaderActions.init({
|
|
3474
|
+
containerApi: new DockviewApi(this.accessor),
|
|
3475
|
+
api: this.groupPanel.api,
|
|
3476
|
+
});
|
|
3477
|
+
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
3478
|
+
}
|
|
3479
|
+
if (this.accessor.options.createLeftHeaderActionsElement) {
|
|
3480
|
+
this._leftHeaderActions =
|
|
3481
|
+
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
3482
|
+
this.addDisposables(this._leftHeaderActions);
|
|
3483
|
+
this._leftHeaderActions.init({
|
|
3350
3484
|
containerApi: new DockviewApi(this.accessor),
|
|
3351
3485
|
api: this.groupPanel.api,
|
|
3352
3486
|
});
|
|
3353
|
-
this.tabsContainer.
|
|
3487
|
+
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
3354
3488
|
}
|
|
3355
3489
|
}
|
|
3356
3490
|
indexOf(panel) {
|
|
@@ -3483,7 +3617,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3483
3617
|
return this._activePanel === panel;
|
|
3484
3618
|
}
|
|
3485
3619
|
updateActions(element) {
|
|
3486
|
-
this.tabsContainer.
|
|
3620
|
+
this.tabsContainer.setRightActionsElement(element);
|
|
3487
3621
|
}
|
|
3488
3622
|
setActive(isGroupActive, skipFocus = false, force = false) {
|
|
3489
3623
|
var _a, _b, _c, _d;
|
|
@@ -3655,9 +3789,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3655
3789
|
}
|
|
3656
3790
|
}
|
|
3657
3791
|
dispose() {
|
|
3658
|
-
var _a, _b;
|
|
3792
|
+
var _a, _b, _c;
|
|
3659
3793
|
super.dispose();
|
|
3660
|
-
(
|
|
3794
|
+
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
3795
|
+
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
3661
3796
|
for (const panel of this.panels) {
|
|
3662
3797
|
panel.dispose();
|
|
3663
3798
|
}
|
|
@@ -4451,8 +4586,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4451
4586
|
get isActive() {
|
|
4452
4587
|
return this.api.isActive;
|
|
4453
4588
|
}
|
|
4454
|
-
constructor(id, component, options) {
|
|
4455
|
-
super(id, component, new GridviewPanelApiImpl(id));
|
|
4589
|
+
constructor(id, component, options, api) {
|
|
4590
|
+
super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id));
|
|
4456
4591
|
this._evaluatedMinimumWidth = 0;
|
|
4457
4592
|
this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
|
|
4458
4593
|
this._evaluatedMinimumHeight = 0;
|
|
@@ -4550,6 +4685,32 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4550
4685
|
}
|
|
4551
4686
|
}
|
|
4552
4687
|
|
|
4688
|
+
class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
4689
|
+
get isFloating() {
|
|
4690
|
+
if (!this._group) {
|
|
4691
|
+
throw new Error(`DockviewGroupPanelApiImpl not initialized`);
|
|
4692
|
+
}
|
|
4693
|
+
return this._group.model.isFloating;
|
|
4694
|
+
}
|
|
4695
|
+
constructor(id, accessor) {
|
|
4696
|
+
super(id);
|
|
4697
|
+
this.accessor = accessor;
|
|
4698
|
+
this._onDidFloatingStateChange = new Emitter();
|
|
4699
|
+
this.onDidFloatingStateChange = this._onDidFloatingStateChange.event;
|
|
4700
|
+
this.addDisposables(this._onDidFloatingStateChange);
|
|
4701
|
+
}
|
|
4702
|
+
moveTo(options) {
|
|
4703
|
+
var _a;
|
|
4704
|
+
if (!this._group) {
|
|
4705
|
+
throw new Error(`DockviewGroupPanelApiImpl not initialized`);
|
|
4706
|
+
}
|
|
4707
|
+
this.accessor.moveGroupOrPanel(options.group, this._group.id, undefined, (_a = options.position) !== null && _a !== void 0 ? _a : 'center');
|
|
4708
|
+
}
|
|
4709
|
+
initialize(group) {
|
|
4710
|
+
this._group = group;
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
|
|
4553
4714
|
class DockviewGroupPanel extends GridviewPanel {
|
|
4554
4715
|
get panels() {
|
|
4555
4716
|
return this._model.panels;
|
|
@@ -4576,7 +4737,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4576
4737
|
super(id, 'groupview_default', {
|
|
4577
4738
|
minimumHeight: 100,
|
|
4578
4739
|
minimumWidth: 100,
|
|
4579
|
-
});
|
|
4740
|
+
}, new DockviewGroupPanelApiImpl(id, accessor));
|
|
4741
|
+
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
4580
4742
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
4581
4743
|
}
|
|
4582
4744
|
initialize() {
|
|
@@ -4594,7 +4756,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4594
4756
|
return this._model;
|
|
4595
4757
|
}
|
|
4596
4758
|
toJSON() {
|
|
4597
|
-
// TODO fix typing
|
|
4598
4759
|
return this.model.toJSON();
|
|
4599
4760
|
}
|
|
4600
4761
|
}
|
|
@@ -4648,9 +4809,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4648
4809
|
get group() {
|
|
4649
4810
|
return this._group;
|
|
4650
4811
|
}
|
|
4651
|
-
constructor(panel, group) {
|
|
4812
|
+
constructor(panel, group, accessor) {
|
|
4652
4813
|
super(panel.id);
|
|
4653
4814
|
this.panel = panel;
|
|
4815
|
+
this.accessor = accessor;
|
|
4654
4816
|
this._onDidTitleChange = new Emitter();
|
|
4655
4817
|
this.onDidTitleChange = this._onDidTitleChange.event;
|
|
4656
4818
|
this._onDidActiveGroupChange = new Emitter();
|
|
@@ -4662,6 +4824,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4662
4824
|
this._group = group;
|
|
4663
4825
|
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
4664
4826
|
}
|
|
4827
|
+
moveTo(options) {
|
|
4828
|
+
var _a;
|
|
4829
|
+
this.accessor.moveGroupOrPanel(options.group, this._group.id, this.panel.id, (_a = options.position) !== null && _a !== void 0 ? _a : 'center', options.index);
|
|
4830
|
+
}
|
|
4665
4831
|
setTitle(title) {
|
|
4666
4832
|
this.panel.setTitle(title);
|
|
4667
4833
|
}
|
|
@@ -4686,7 +4852,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4686
4852
|
this.containerApi = containerApi;
|
|
4687
4853
|
this.view = view;
|
|
4688
4854
|
this._group = group;
|
|
4689
|
-
this.api = new DockviewPanelApiImpl(this, this._group);
|
|
4855
|
+
this.api = new DockviewPanelApiImpl(this, this._group, accessor);
|
|
4690
4856
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
4691
4857
|
accessor.setActivePanel(this);
|
|
4692
4858
|
}), this.api.onDidSizeChange((event) => {
|
|
@@ -5027,6 +5193,296 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5027
5193
|
}
|
|
5028
5194
|
}
|
|
5029
5195
|
|
|
5196
|
+
const bringElementToFront = (() => {
|
|
5197
|
+
let previous = null;
|
|
5198
|
+
function pushToTop(element) {
|
|
5199
|
+
if (previous !== element && previous !== null) {
|
|
5200
|
+
toggleClass(previous, 'dv-bring-to-front', false);
|
|
5201
|
+
}
|
|
5202
|
+
toggleClass(element, 'dv-bring-to-front', true);
|
|
5203
|
+
previous = element;
|
|
5204
|
+
}
|
|
5205
|
+
return pushToTop;
|
|
5206
|
+
})();
|
|
5207
|
+
class Overlay extends CompositeDisposable {
|
|
5208
|
+
constructor(options) {
|
|
5209
|
+
super();
|
|
5210
|
+
this.options = options;
|
|
5211
|
+
this._element = document.createElement('div');
|
|
5212
|
+
this._onDidChange = new Emitter();
|
|
5213
|
+
this.onDidChange = this._onDidChange.event;
|
|
5214
|
+
this._onDidChangeEnd = new Emitter();
|
|
5215
|
+
this.onDidChangeEnd = this._onDidChangeEnd.event;
|
|
5216
|
+
this.addDisposables(this._onDidChange, this._onDidChangeEnd);
|
|
5217
|
+
this._element.className = 'dv-resize-container';
|
|
5218
|
+
this.setupResize('top');
|
|
5219
|
+
this.setupResize('bottom');
|
|
5220
|
+
this.setupResize('left');
|
|
5221
|
+
this.setupResize('right');
|
|
5222
|
+
this.setupResize('topleft');
|
|
5223
|
+
this.setupResize('topright');
|
|
5224
|
+
this.setupResize('bottomleft');
|
|
5225
|
+
this.setupResize('bottomright');
|
|
5226
|
+
this._element.appendChild(this.options.content);
|
|
5227
|
+
this.options.container.appendChild(this._element);
|
|
5228
|
+
// if input bad resize within acceptable boundaries
|
|
5229
|
+
this.setBounds({
|
|
5230
|
+
height: this.options.height,
|
|
5231
|
+
width: this.options.width,
|
|
5232
|
+
top: this.options.top,
|
|
5233
|
+
left: this.options.left,
|
|
5234
|
+
});
|
|
5235
|
+
}
|
|
5236
|
+
setBounds(bounds = {}) {
|
|
5237
|
+
if (typeof bounds.height === 'number') {
|
|
5238
|
+
this._element.style.height = `${bounds.height}px`;
|
|
5239
|
+
}
|
|
5240
|
+
if (typeof bounds.width === 'number') {
|
|
5241
|
+
this._element.style.width = `${bounds.width}px`;
|
|
5242
|
+
}
|
|
5243
|
+
if (typeof bounds.top === 'number') {
|
|
5244
|
+
this._element.style.top = `${bounds.top}px`;
|
|
5245
|
+
}
|
|
5246
|
+
if (typeof bounds.left === 'number') {
|
|
5247
|
+
this._element.style.left = `${bounds.left}px`;
|
|
5248
|
+
}
|
|
5249
|
+
const containerRect = this.options.container.getBoundingClientRect();
|
|
5250
|
+
const overlayRect = this._element.getBoundingClientRect();
|
|
5251
|
+
// region: ensure bounds within allowable limits
|
|
5252
|
+
// a minimum width of minimumViewportWidth must be inside the viewport
|
|
5253
|
+
const xOffset = Math.max(0, overlayRect.width - this.options.minimumInViewportWidth);
|
|
5254
|
+
// a minimum height of minimumViewportHeight must be inside the viewport
|
|
5255
|
+
const yOffset = Math.max(0, overlayRect.height - this.options.minimumInViewportHeight);
|
|
5256
|
+
const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
5257
|
+
const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
5258
|
+
this._element.style.left = `${left}px`;
|
|
5259
|
+
this._element.style.top = `${top}px`;
|
|
5260
|
+
this._onDidChange.fire();
|
|
5261
|
+
}
|
|
5262
|
+
toJSON() {
|
|
5263
|
+
const container = this.options.container.getBoundingClientRect();
|
|
5264
|
+
const element = this._element.getBoundingClientRect();
|
|
5265
|
+
return {
|
|
5266
|
+
top: element.top - container.top,
|
|
5267
|
+
left: element.left - container.left,
|
|
5268
|
+
width: element.width,
|
|
5269
|
+
height: element.height,
|
|
5270
|
+
};
|
|
5271
|
+
}
|
|
5272
|
+
setupDrag(dragTarget, options = { inDragMode: false }) {
|
|
5273
|
+
const move = new MutableDisposable();
|
|
5274
|
+
const track = () => {
|
|
5275
|
+
let offset = null;
|
|
5276
|
+
const iframes = [
|
|
5277
|
+
...getElementsByTagName('iframe'),
|
|
5278
|
+
...getElementsByTagName('webview'),
|
|
5279
|
+
];
|
|
5280
|
+
for (const iframe of iframes) {
|
|
5281
|
+
iframe.style.pointerEvents = 'none';
|
|
5282
|
+
}
|
|
5283
|
+
move.value = new CompositeDisposable({
|
|
5284
|
+
dispose: () => {
|
|
5285
|
+
for (const iframe of iframes) {
|
|
5286
|
+
iframe.style.pointerEvents = 'auto';
|
|
5287
|
+
}
|
|
5288
|
+
},
|
|
5289
|
+
}, addDisposableWindowListener(window, 'mousemove', (e) => {
|
|
5290
|
+
const containerRect = this.options.container.getBoundingClientRect();
|
|
5291
|
+
const x = e.clientX - containerRect.left;
|
|
5292
|
+
const y = e.clientY - containerRect.top;
|
|
5293
|
+
toggleClass(this._element, 'dv-resize-container-dragging', true);
|
|
5294
|
+
const overlayRect = this._element.getBoundingClientRect();
|
|
5295
|
+
if (offset === null) {
|
|
5296
|
+
offset = {
|
|
5297
|
+
x: e.clientX - overlayRect.left,
|
|
5298
|
+
y: e.clientY - overlayRect.top,
|
|
5299
|
+
};
|
|
5300
|
+
}
|
|
5301
|
+
const xOffset = Math.max(0, overlayRect.width - this.options.minimumInViewportWidth);
|
|
5302
|
+
const yOffset = Math.max(0, overlayRect.height -
|
|
5303
|
+
this.options.minimumInViewportHeight);
|
|
5304
|
+
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
5305
|
+
const top = clamp(y - offset.y, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
5306
|
+
this.setBounds({ top, left });
|
|
5307
|
+
}), addDisposableWindowListener(window, 'mouseup', () => {
|
|
5308
|
+
toggleClass(this._element, 'dv-resize-container-dragging', false);
|
|
5309
|
+
move.dispose();
|
|
5310
|
+
this._onDidChangeEnd.fire();
|
|
5311
|
+
}));
|
|
5312
|
+
};
|
|
5313
|
+
this.addDisposables(move, addDisposableListener(dragTarget, 'mousedown', (event) => {
|
|
5314
|
+
if (event.defaultPrevented) {
|
|
5315
|
+
event.preventDefault();
|
|
5316
|
+
return;
|
|
5317
|
+
}
|
|
5318
|
+
// if somebody has marked this event then treat as a defaultPrevented
|
|
5319
|
+
// without actually calling event.preventDefault()
|
|
5320
|
+
if (quasiDefaultPrevented(event)) {
|
|
5321
|
+
return;
|
|
5322
|
+
}
|
|
5323
|
+
track();
|
|
5324
|
+
}), addDisposableListener(this.options.content, 'mousedown', (event) => {
|
|
5325
|
+
if (event.defaultPrevented) {
|
|
5326
|
+
return;
|
|
5327
|
+
}
|
|
5328
|
+
// if somebody has marked this event then treat as a defaultPrevented
|
|
5329
|
+
// without actually calling event.preventDefault()
|
|
5330
|
+
if (quasiDefaultPrevented(event)) {
|
|
5331
|
+
return;
|
|
5332
|
+
}
|
|
5333
|
+
if (event.shiftKey) {
|
|
5334
|
+
track();
|
|
5335
|
+
}
|
|
5336
|
+
}), addDisposableListener(this.options.content, 'mousedown', () => {
|
|
5337
|
+
bringElementToFront(this._element);
|
|
5338
|
+
}, true));
|
|
5339
|
+
bringElementToFront(this._element);
|
|
5340
|
+
if (options.inDragMode) {
|
|
5341
|
+
track();
|
|
5342
|
+
}
|
|
5343
|
+
}
|
|
5344
|
+
setupResize(direction) {
|
|
5345
|
+
const resizeHandleElement = document.createElement('div');
|
|
5346
|
+
resizeHandleElement.className = `dv-resize-handle-${direction}`;
|
|
5347
|
+
this._element.appendChild(resizeHandleElement);
|
|
5348
|
+
const move = new MutableDisposable();
|
|
5349
|
+
this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
|
|
5350
|
+
e.preventDefault();
|
|
5351
|
+
let startPosition = null;
|
|
5352
|
+
const iframes = [
|
|
5353
|
+
...getElementsByTagName('iframe'),
|
|
5354
|
+
...getElementsByTagName('webview'),
|
|
5355
|
+
];
|
|
5356
|
+
for (const iframe of iframes) {
|
|
5357
|
+
iframe.style.pointerEvents = 'none';
|
|
5358
|
+
}
|
|
5359
|
+
move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
|
|
5360
|
+
const containerRect = this.options.container.getBoundingClientRect();
|
|
5361
|
+
const overlayRect = this._element.getBoundingClientRect();
|
|
5362
|
+
const y = e.clientY - containerRect.top;
|
|
5363
|
+
const x = e.clientX - containerRect.left;
|
|
5364
|
+
if (startPosition === null) {
|
|
5365
|
+
// record the initial dimensions since as all subsequence moves are relative to this
|
|
5366
|
+
startPosition = {
|
|
5367
|
+
originalY: y,
|
|
5368
|
+
originalHeight: overlayRect.height,
|
|
5369
|
+
originalX: x,
|
|
5370
|
+
originalWidth: overlayRect.width,
|
|
5371
|
+
};
|
|
5372
|
+
}
|
|
5373
|
+
let top = undefined;
|
|
5374
|
+
let height = undefined;
|
|
5375
|
+
let left = undefined;
|
|
5376
|
+
let width = undefined;
|
|
5377
|
+
const minimumInViewportHeight = this.options.minimumInViewportHeight;
|
|
5378
|
+
const minimumInViewportWidth = this.options.minimumInViewportWidth;
|
|
5379
|
+
function moveTop() {
|
|
5380
|
+
top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
|
|
5381
|
+
startPosition.originalHeight >
|
|
5382
|
+
containerRect.height
|
|
5383
|
+
? containerRect.height -
|
|
5384
|
+
minimumInViewportHeight
|
|
5385
|
+
: Math.max(0, startPosition.originalY +
|
|
5386
|
+
startPosition.originalHeight -
|
|
5387
|
+
Overlay.MINIMUM_HEIGHT));
|
|
5388
|
+
height =
|
|
5389
|
+
startPosition.originalY +
|
|
5390
|
+
startPosition.originalHeight -
|
|
5391
|
+
top;
|
|
5392
|
+
}
|
|
5393
|
+
function moveBottom() {
|
|
5394
|
+
top =
|
|
5395
|
+
startPosition.originalY -
|
|
5396
|
+
startPosition.originalHeight;
|
|
5397
|
+
height = clamp(y - top, top < 0
|
|
5398
|
+
? -top + minimumInViewportHeight
|
|
5399
|
+
: Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
|
|
5400
|
+
}
|
|
5401
|
+
function moveLeft() {
|
|
5402
|
+
left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
|
|
5403
|
+
startPosition.originalWidth >
|
|
5404
|
+
containerRect.width
|
|
5405
|
+
? containerRect.width -
|
|
5406
|
+
minimumInViewportWidth
|
|
5407
|
+
: Math.max(0, startPosition.originalX +
|
|
5408
|
+
startPosition.originalWidth -
|
|
5409
|
+
Overlay.MINIMUM_WIDTH));
|
|
5410
|
+
width =
|
|
5411
|
+
startPosition.originalX +
|
|
5412
|
+
startPosition.originalWidth -
|
|
5413
|
+
left;
|
|
5414
|
+
}
|
|
5415
|
+
function moveRight() {
|
|
5416
|
+
left =
|
|
5417
|
+
startPosition.originalX -
|
|
5418
|
+
startPosition.originalWidth;
|
|
5419
|
+
width = clamp(x - left, left < 0
|
|
5420
|
+
? -left + minimumInViewportWidth
|
|
5421
|
+
: Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
|
|
5422
|
+
}
|
|
5423
|
+
switch (direction) {
|
|
5424
|
+
case 'top':
|
|
5425
|
+
moveTop();
|
|
5426
|
+
break;
|
|
5427
|
+
case 'bottom':
|
|
5428
|
+
moveBottom();
|
|
5429
|
+
break;
|
|
5430
|
+
case 'left':
|
|
5431
|
+
moveLeft();
|
|
5432
|
+
break;
|
|
5433
|
+
case 'right':
|
|
5434
|
+
moveRight();
|
|
5435
|
+
break;
|
|
5436
|
+
case 'topleft':
|
|
5437
|
+
moveTop();
|
|
5438
|
+
moveLeft();
|
|
5439
|
+
break;
|
|
5440
|
+
case 'topright':
|
|
5441
|
+
moveTop();
|
|
5442
|
+
moveRight();
|
|
5443
|
+
break;
|
|
5444
|
+
case 'bottomleft':
|
|
5445
|
+
moveBottom();
|
|
5446
|
+
moveLeft();
|
|
5447
|
+
break;
|
|
5448
|
+
case 'bottomright':
|
|
5449
|
+
moveBottom();
|
|
5450
|
+
moveRight();
|
|
5451
|
+
break;
|
|
5452
|
+
}
|
|
5453
|
+
this.setBounds({ height, width, top, left });
|
|
5454
|
+
}), {
|
|
5455
|
+
dispose: () => {
|
|
5456
|
+
for (const iframe of iframes) {
|
|
5457
|
+
iframe.style.pointerEvents = 'auto';
|
|
5458
|
+
}
|
|
5459
|
+
},
|
|
5460
|
+
}, addDisposableWindowListener(window, 'mouseup', () => {
|
|
5461
|
+
move.dispose();
|
|
5462
|
+
this._onDidChangeEnd.fire();
|
|
5463
|
+
}));
|
|
5464
|
+
}));
|
|
5465
|
+
}
|
|
5466
|
+
dispose() {
|
|
5467
|
+
this._element.remove();
|
|
5468
|
+
super.dispose();
|
|
5469
|
+
}
|
|
5470
|
+
}
|
|
5471
|
+
Overlay.MINIMUM_HEIGHT = 20;
|
|
5472
|
+
Overlay.MINIMUM_WIDTH = 20;
|
|
5473
|
+
|
|
5474
|
+
class DockviewFloatingGroupPanel extends CompositeDisposable {
|
|
5475
|
+
constructor(group, overlay) {
|
|
5476
|
+
super();
|
|
5477
|
+
this.group = group;
|
|
5478
|
+
this.overlay = overlay;
|
|
5479
|
+
this.addDisposables(overlay);
|
|
5480
|
+
}
|
|
5481
|
+
position(bounds) {
|
|
5482
|
+
this.overlay.setBounds(bounds);
|
|
5483
|
+
}
|
|
5484
|
+
}
|
|
5485
|
+
|
|
5030
5486
|
class DockviewComponent extends BaseGrid {
|
|
5031
5487
|
get orientation() {
|
|
5032
5488
|
return this.gridview.orientation;
|
|
@@ -5067,7 +5523,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5067
5523
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
5068
5524
|
this._onDidActivePanelChange = new Emitter();
|
|
5069
5525
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
5070
|
-
this.
|
|
5526
|
+
this.floatingGroups = [];
|
|
5527
|
+
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
5071
5528
|
this.addDisposables(this._onDidDrop, exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
|
|
5072
5529
|
this.updateWatermark();
|
|
5073
5530
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
@@ -5097,6 +5554,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5097
5554
|
if (data.viewId !== this.id) {
|
|
5098
5555
|
return false;
|
|
5099
5556
|
}
|
|
5557
|
+
if (position === 'center') {
|
|
5558
|
+
// center drop target is only allowed if there are no panels in the grid
|
|
5559
|
+
// floating panels are allowed
|
|
5560
|
+
return this.gridview.length === 0;
|
|
5561
|
+
}
|
|
5100
5562
|
return true;
|
|
5101
5563
|
}
|
|
5102
5564
|
if (this.options.showDndOverlay) {
|
|
@@ -5109,7 +5571,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5109
5571
|
}
|
|
5110
5572
|
return false;
|
|
5111
5573
|
},
|
|
5112
|
-
acceptedTargetZones: ['top', 'bottom', 'left', 'right'],
|
|
5574
|
+
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
5113
5575
|
overlayModel: {
|
|
5114
5576
|
activationSize: { type: 'pixels', value: 10 },
|
|
5115
5577
|
size: { type: 'pixels', value: 20 },
|
|
@@ -5127,6 +5589,75 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5127
5589
|
this._api = new DockviewApi(this);
|
|
5128
5590
|
this.updateWatermark();
|
|
5129
5591
|
}
|
|
5592
|
+
addFloatingGroup(item, coord, options) {
|
|
5593
|
+
var _a, _b;
|
|
5594
|
+
let group;
|
|
5595
|
+
if (item instanceof DockviewPanel) {
|
|
5596
|
+
group = this.createGroup();
|
|
5597
|
+
this.removePanel(item, {
|
|
5598
|
+
removeEmptyGroup: true,
|
|
5599
|
+
skipDispose: true,
|
|
5600
|
+
});
|
|
5601
|
+
group.model.openPanel(item);
|
|
5602
|
+
}
|
|
5603
|
+
else {
|
|
5604
|
+
group = item;
|
|
5605
|
+
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
5606
|
+
options.skipRemoveGroup;
|
|
5607
|
+
if (!skip) {
|
|
5608
|
+
this.doRemoveGroup(item, { skipDispose: true });
|
|
5609
|
+
}
|
|
5610
|
+
}
|
|
5611
|
+
group.model.isFloating = true;
|
|
5612
|
+
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number' ? Math.max(coord.x, 0) : 100;
|
|
5613
|
+
const overlayTop = typeof (coord === null || coord === void 0 ? void 0 : coord.y) === 'number' ? Math.max(coord.y, 0) : 100;
|
|
5614
|
+
const overlay = new Overlay({
|
|
5615
|
+
container: this.gridview.element,
|
|
5616
|
+
content: group.element,
|
|
5617
|
+
height: (_a = coord === null || coord === void 0 ? void 0 : coord.height) !== null && _a !== void 0 ? _a : 300,
|
|
5618
|
+
width: (_b = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _b !== void 0 ? _b : 300,
|
|
5619
|
+
left: overlayLeft,
|
|
5620
|
+
top: overlayTop,
|
|
5621
|
+
minimumInViewportWidth: 100,
|
|
5622
|
+
minimumInViewportHeight: 100,
|
|
5623
|
+
});
|
|
5624
|
+
const el = group.element.querySelector('.void-container');
|
|
5625
|
+
if (!el) {
|
|
5626
|
+
throw new Error('failed to find drag handle');
|
|
5627
|
+
}
|
|
5628
|
+
overlay.setupDrag(el, {
|
|
5629
|
+
inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
|
|
5630
|
+
? options.inDragMode
|
|
5631
|
+
: false,
|
|
5632
|
+
});
|
|
5633
|
+
const floatingGroupPanel = new DockviewFloatingGroupPanel(group, overlay);
|
|
5634
|
+
const disposable = watchElementResize(group.element, (entry) => {
|
|
5635
|
+
const { width, height } = entry.contentRect;
|
|
5636
|
+
group.layout(width, height); // let the group know it's size is changing so it can fire events to the panel
|
|
5637
|
+
});
|
|
5638
|
+
floatingGroupPanel.addDisposables(overlay.onDidChange(() => {
|
|
5639
|
+
// this is either a resize or a move
|
|
5640
|
+
// to inform the panels .layout(...) the group with it's current size
|
|
5641
|
+
// don't care about resize since the above watcher handles that
|
|
5642
|
+
group.layout(group.height, group.width);
|
|
5643
|
+
}), overlay.onDidChangeEnd(() => {
|
|
5644
|
+
this._bufferOnDidLayoutChange.fire();
|
|
5645
|
+
}), group.onDidChange((event) => {
|
|
5646
|
+
overlay.setBounds({
|
|
5647
|
+
height: event === null || event === void 0 ? void 0 : event.height,
|
|
5648
|
+
width: event === null || event === void 0 ? void 0 : event.width,
|
|
5649
|
+
});
|
|
5650
|
+
}), {
|
|
5651
|
+
dispose: () => {
|
|
5652
|
+
disposable.dispose();
|
|
5653
|
+
group.model.isFloating = false;
|
|
5654
|
+
remove(this.floatingGroups, floatingGroupPanel);
|
|
5655
|
+
this.updateWatermark();
|
|
5656
|
+
},
|
|
5657
|
+
});
|
|
5658
|
+
this.floatingGroups.push(floatingGroupPanel);
|
|
5659
|
+
this.updateWatermark();
|
|
5660
|
+
}
|
|
5130
5661
|
orthogonalize(position) {
|
|
5131
5662
|
switch (position) {
|
|
5132
5663
|
case 'top':
|
|
@@ -5149,6 +5680,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5149
5680
|
switch (position) {
|
|
5150
5681
|
case 'top':
|
|
5151
5682
|
case 'left':
|
|
5683
|
+
case 'center':
|
|
5152
5684
|
return this.createGroupAtLocation([0]); // insert into first position
|
|
5153
5685
|
case 'bottom':
|
|
5154
5686
|
case 'right':
|
|
@@ -5166,6 +5698,15 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5166
5698
|
}
|
|
5167
5699
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
5168
5700
|
}
|
|
5701
|
+
layout(width, height, forceResize) {
|
|
5702
|
+
super.layout(width, height, forceResize);
|
|
5703
|
+
if (this.floatingGroups) {
|
|
5704
|
+
for (const floating of this.floatingGroups) {
|
|
5705
|
+
// ensure floting groups stay within visible boundaries
|
|
5706
|
+
floating.overlay.setBounds();
|
|
5707
|
+
}
|
|
5708
|
+
}
|
|
5709
|
+
}
|
|
5169
5710
|
focus() {
|
|
5170
5711
|
var _a;
|
|
5171
5712
|
(_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -5228,51 +5769,81 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5228
5769
|
collection[panel.id] = panel.toJSON();
|
|
5229
5770
|
return collection;
|
|
5230
5771
|
}, {});
|
|
5231
|
-
|
|
5772
|
+
const floats = this.floatingGroups.map((floatingGroup) => {
|
|
5773
|
+
return {
|
|
5774
|
+
data: floatingGroup.group.toJSON(),
|
|
5775
|
+
position: floatingGroup.overlay.toJSON(),
|
|
5776
|
+
};
|
|
5777
|
+
});
|
|
5778
|
+
const result = {
|
|
5232
5779
|
grid: data,
|
|
5233
5780
|
panels,
|
|
5234
5781
|
activeGroup: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
|
|
5235
5782
|
};
|
|
5783
|
+
if (floats.length > 0) {
|
|
5784
|
+
result.floatingGroups = floats;
|
|
5785
|
+
}
|
|
5786
|
+
return result;
|
|
5236
5787
|
}
|
|
5237
5788
|
fromJSON(data) {
|
|
5789
|
+
var _a;
|
|
5238
5790
|
this.clear();
|
|
5239
5791
|
const { grid, panels, activeGroup } = data;
|
|
5240
5792
|
if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
|
|
5241
5793
|
throw new Error('root must be of type branch');
|
|
5242
5794
|
}
|
|
5795
|
+
// take note of the existing dimensions
|
|
5796
|
+
const width = this.width;
|
|
5797
|
+
const height = this.height;
|
|
5798
|
+
const createGroupFromSerializedState = (data) => {
|
|
5799
|
+
const { id, locked, hideHeader, views, activeView } = data;
|
|
5800
|
+
const group = this.createGroup({
|
|
5801
|
+
id,
|
|
5802
|
+
locked: !!locked,
|
|
5803
|
+
hideHeader: !!hideHeader,
|
|
5804
|
+
});
|
|
5805
|
+
this._onDidAddGroup.fire(group);
|
|
5806
|
+
for (const child of views) {
|
|
5807
|
+
const panel = this._deserializer.fromJSON(panels[child], group);
|
|
5808
|
+
const isActive = typeof activeView === 'string' && activeView === panel.id;
|
|
5809
|
+
group.model.openPanel(panel, {
|
|
5810
|
+
skipSetPanelActive: !isActive,
|
|
5811
|
+
skipSetGroupActive: true,
|
|
5812
|
+
});
|
|
5813
|
+
}
|
|
5814
|
+
if (!group.activePanel && group.panels.length > 0) {
|
|
5815
|
+
group.model.openPanel(group.panels[group.panels.length - 1], {
|
|
5816
|
+
skipSetGroupActive: true,
|
|
5817
|
+
});
|
|
5818
|
+
}
|
|
5819
|
+
return group;
|
|
5820
|
+
};
|
|
5243
5821
|
this.gridview.deserialize(grid, {
|
|
5244
5822
|
fromJSON: (node) => {
|
|
5245
|
-
|
|
5246
|
-
const group = this.createGroup({
|
|
5247
|
-
id,
|
|
5248
|
-
locked: !!locked,
|
|
5249
|
-
hideHeader: !!hideHeader,
|
|
5250
|
-
});
|
|
5251
|
-
this._onDidAddGroup.fire(group);
|
|
5252
|
-
for (const child of views) {
|
|
5253
|
-
const panel = this._deserializer.fromJSON(panels[child], group);
|
|
5254
|
-
const isActive = typeof activeView === 'string' &&
|
|
5255
|
-
activeView === panel.id;
|
|
5256
|
-
group.model.openPanel(panel, {
|
|
5257
|
-
skipSetPanelActive: !isActive,
|
|
5258
|
-
skipSetGroupActive: true,
|
|
5259
|
-
});
|
|
5260
|
-
}
|
|
5261
|
-
if (!group.activePanel && group.panels.length > 0) {
|
|
5262
|
-
group.model.openPanel(group.panels[group.panels.length - 1], {
|
|
5263
|
-
skipSetGroupActive: true,
|
|
5264
|
-
});
|
|
5265
|
-
}
|
|
5266
|
-
return group;
|
|
5823
|
+
return createGroupFromSerializedState(node.data);
|
|
5267
5824
|
},
|
|
5268
5825
|
});
|
|
5826
|
+
this.layout(width, height, true);
|
|
5827
|
+
const serializedFloatingGroups = (_a = data.floatingGroups) !== null && _a !== void 0 ? _a : [];
|
|
5828
|
+
for (const serializedFloatingGroup of serializedFloatingGroups) {
|
|
5829
|
+
const { data, position } = serializedFloatingGroup;
|
|
5830
|
+
const group = createGroupFromSerializedState(data);
|
|
5831
|
+
this.addFloatingGroup(group, {
|
|
5832
|
+
x: position.left,
|
|
5833
|
+
y: position.top,
|
|
5834
|
+
height: position.height,
|
|
5835
|
+
width: position.width,
|
|
5836
|
+
}, { skipRemoveGroup: true, inDragMode: false });
|
|
5837
|
+
}
|
|
5838
|
+
for (const floatingGroup of this.floatingGroups) {
|
|
5839
|
+
floatingGroup.overlay.setBounds();
|
|
5840
|
+
}
|
|
5269
5841
|
if (typeof activeGroup === 'string') {
|
|
5270
5842
|
const panel = this.getPanel(activeGroup);
|
|
5271
5843
|
if (panel) {
|
|
5272
5844
|
this.doSetGroupActive(panel);
|
|
5273
5845
|
}
|
|
5274
5846
|
}
|
|
5275
|
-
this.gridview.layout(this.width, this.height);
|
|
5276
5847
|
this._onDidLayoutFromJSON.fire();
|
|
5277
5848
|
}
|
|
5278
5849
|
clear() {
|
|
@@ -5281,7 +5852,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5281
5852
|
const hasActivePanel = !!this.activePanel;
|
|
5282
5853
|
for (const group of groups) {
|
|
5283
5854
|
// remove the group will automatically remove the panels
|
|
5284
|
-
this.removeGroup(group, true);
|
|
5855
|
+
this.removeGroup(group, { skipActive: true });
|
|
5285
5856
|
}
|
|
5286
5857
|
if (hasActiveGroup) {
|
|
5287
5858
|
this.doSetGroupActive(undefined);
|
|
@@ -5303,6 +5874,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5303
5874
|
throw new Error(`panel with id ${options.id} already exists`);
|
|
5304
5875
|
}
|
|
5305
5876
|
let referenceGroup;
|
|
5877
|
+
if (options.position && options.floating) {
|
|
5878
|
+
throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
|
|
5879
|
+
}
|
|
5306
5880
|
if (options.position) {
|
|
5307
5881
|
if (isPanelOptionsWithPanel(options.position)) {
|
|
5308
5882
|
const referencePanel = typeof options.position.referencePanel === 'string'
|
|
@@ -5335,7 +5909,20 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5335
5909
|
let panel;
|
|
5336
5910
|
if (referenceGroup) {
|
|
5337
5911
|
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
5338
|
-
if (
|
|
5912
|
+
if (options.floating) {
|
|
5913
|
+
const group = this.createGroup();
|
|
5914
|
+
panel = this.createPanel(options, group);
|
|
5915
|
+
group.model.openPanel(panel);
|
|
5916
|
+
const o = typeof options.floating === 'object' &&
|
|
5917
|
+
options.floating !== null
|
|
5918
|
+
? options.floating
|
|
5919
|
+
: {};
|
|
5920
|
+
this.addFloatingGroup(group, o, {
|
|
5921
|
+
inDragMode: false,
|
|
5922
|
+
skipRemoveGroup: true,
|
|
5923
|
+
});
|
|
5924
|
+
}
|
|
5925
|
+
else if (referenceGroup.api.isFloating || target === 'center') {
|
|
5339
5926
|
panel = this.createPanel(options, referenceGroup);
|
|
5340
5927
|
referenceGroup.model.openPanel(panel);
|
|
5341
5928
|
}
|
|
@@ -5347,6 +5934,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5347
5934
|
group.model.openPanel(panel);
|
|
5348
5935
|
}
|
|
5349
5936
|
}
|
|
5937
|
+
else if (options.floating) {
|
|
5938
|
+
const group = this.createGroup();
|
|
5939
|
+
panel = this.createPanel(options, group);
|
|
5940
|
+
group.model.openPanel(panel);
|
|
5941
|
+
const o = typeof options.floating === 'object' &&
|
|
5942
|
+
options.floating !== null
|
|
5943
|
+
? options.floating
|
|
5944
|
+
: {};
|
|
5945
|
+
this.addFloatingGroup(group, o, {
|
|
5946
|
+
inDragMode: false,
|
|
5947
|
+
skipRemoveGroup: true,
|
|
5948
|
+
});
|
|
5949
|
+
}
|
|
5350
5950
|
else {
|
|
5351
5951
|
const group = this.createGroupAtLocation();
|
|
5352
5952
|
panel = this.createPanel(options, group);
|
|
@@ -5363,7 +5963,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5363
5963
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
5364
5964
|
}
|
|
5365
5965
|
group.model.removePanel(panel);
|
|
5366
|
-
|
|
5966
|
+
if (!options.skipDispose) {
|
|
5967
|
+
panel.dispose();
|
|
5968
|
+
}
|
|
5367
5969
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
5368
5970
|
this.removeGroup(group);
|
|
5369
5971
|
}
|
|
@@ -5378,7 +5980,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5378
5980
|
}
|
|
5379
5981
|
updateWatermark() {
|
|
5380
5982
|
var _a, _b;
|
|
5381
|
-
if (this.groups.length === 0) {
|
|
5983
|
+
if (this.groups.filter((x) => !x.api.isFloating).length === 0) {
|
|
5382
5984
|
if (!this.watermark) {
|
|
5383
5985
|
this.watermark = this.createWatermarkComponent();
|
|
5384
5986
|
this.watermark.init({
|
|
@@ -5387,7 +5989,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5387
5989
|
const watermarkContainer = document.createElement('div');
|
|
5388
5990
|
watermarkContainer.className = 'dv-watermark-container';
|
|
5389
5991
|
watermarkContainer.appendChild(this.watermark.element);
|
|
5390
|
-
this.element.appendChild(watermarkContainer);
|
|
5992
|
+
this.gridview.element.appendChild(watermarkContainer);
|
|
5391
5993
|
}
|
|
5392
5994
|
}
|
|
5393
5995
|
else if (this.watermark) {
|
|
@@ -5437,15 +6039,28 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5437
6039
|
return group;
|
|
5438
6040
|
}
|
|
5439
6041
|
}
|
|
5440
|
-
removeGroup(group,
|
|
6042
|
+
removeGroup(group, options) {
|
|
6043
|
+
var _a;
|
|
5441
6044
|
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
5442
6045
|
for (const panel of panels) {
|
|
5443
6046
|
this.removePanel(panel, {
|
|
5444
6047
|
removeEmptyGroup: false,
|
|
5445
|
-
skipDispose: false,
|
|
6048
|
+
skipDispose: (_a = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _a !== void 0 ? _a : false,
|
|
5446
6049
|
});
|
|
5447
6050
|
}
|
|
5448
|
-
|
|
6051
|
+
this.doRemoveGroup(group, options);
|
|
6052
|
+
}
|
|
6053
|
+
doRemoveGroup(group, options) {
|
|
6054
|
+
const floatingGroup = this.floatingGroups.find((_) => _.group === group);
|
|
6055
|
+
if (floatingGroup) {
|
|
6056
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
6057
|
+
floatingGroup.group.dispose();
|
|
6058
|
+
this._groups.delete(group.id);
|
|
6059
|
+
}
|
|
6060
|
+
floatingGroup.dispose();
|
|
6061
|
+
return floatingGroup.group;
|
|
6062
|
+
}
|
|
6063
|
+
return super.doRemoveGroup(group, options);
|
|
5449
6064
|
}
|
|
5450
6065
|
moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
|
|
5451
6066
|
var _a;
|
|
@@ -5476,25 +6091,26 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5476
6091
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5477
6092
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
5478
6093
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
5479
|
-
const
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
5490
|
-
skipActive: true,
|
|
5491
|
-
skipDispose: true,
|
|
5492
|
-
});
|
|
5493
|
-
// after deleting the group we need to re-evaulate the ref location
|
|
5494
|
-
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
5495
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
5496
|
-
this.doAddGroup(targetGroup, location);
|
|
6094
|
+
const isFloating = this.floatingGroups.find((x) => x.group === sourceGroup);
|
|
6095
|
+
if (!isFloating) {
|
|
6096
|
+
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
6097
|
+
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
6098
|
+
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
6099
|
+
// special case when 'swapping' two views within same grid location
|
|
6100
|
+
// if a group has one tab - we are essentially moving the 'group'
|
|
6101
|
+
// which is equivalent to swapping two views in this case
|
|
6102
|
+
this.gridview.moveView(sourceParentLocation, from, to);
|
|
6103
|
+
}
|
|
5497
6104
|
}
|
|
6105
|
+
// source group will become empty so delete the group
|
|
6106
|
+
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
6107
|
+
skipActive: true,
|
|
6108
|
+
skipDispose: true,
|
|
6109
|
+
});
|
|
6110
|
+
// after deleting the group we need to re-evaulate the ref location
|
|
6111
|
+
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
6112
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
6113
|
+
this.doAddGroup(targetGroup, location);
|
|
5498
6114
|
}
|
|
5499
6115
|
else {
|
|
5500
6116
|
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
@@ -5523,7 +6139,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5523
6139
|
}
|
|
5524
6140
|
}
|
|
5525
6141
|
else {
|
|
5526
|
-
this.
|
|
6142
|
+
const floatingGroup = this.floatingGroups.find((x) => x.group === sourceGroup);
|
|
6143
|
+
if (floatingGroup) {
|
|
6144
|
+
floatingGroup.dispose();
|
|
6145
|
+
}
|
|
6146
|
+
else {
|
|
6147
|
+
this.gridview.removeView(getGridLocation(sourceGroup.element));
|
|
6148
|
+
}
|
|
5527
6149
|
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
5528
6150
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
5529
6151
|
this.gridview.addView(sourceGroup, exports.Sizing.Distribute, dropLocation);
|
|
@@ -5678,6 +6300,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5678
6300
|
this.clear();
|
|
5679
6301
|
const { grid, activePanel } = serializedGridview;
|
|
5680
6302
|
const queue = [];
|
|
6303
|
+
// take note of the existing dimensions
|
|
6304
|
+
const width = this.width;
|
|
6305
|
+
const height = this.height;
|
|
5681
6306
|
this.gridview.deserialize(grid, {
|
|
5682
6307
|
fromJSON: (node) => {
|
|
5683
6308
|
const { data } = node;
|
|
@@ -5703,7 +6328,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5703
6328
|
return view;
|
|
5704
6329
|
},
|
|
5705
6330
|
});
|
|
5706
|
-
this.layout(
|
|
6331
|
+
this.layout(width, height, true);
|
|
5707
6332
|
queue.forEach((f) => f());
|
|
5708
6333
|
if (typeof activePanel === 'string') {
|
|
5709
6334
|
const panel = this.getPanel(activePanel);
|
|
@@ -6017,6 +6642,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6017
6642
|
this.clear();
|
|
6018
6643
|
const { views, orientation, size, activeView } = serializedSplitview;
|
|
6019
6644
|
const queue = [];
|
|
6645
|
+
// take note of the existing dimensions
|
|
6646
|
+
const width = this.width;
|
|
6647
|
+
const height = this.height;
|
|
6020
6648
|
this.splitview = new Splitview(this.element, {
|
|
6021
6649
|
orientation,
|
|
6022
6650
|
proportionalLayout: this.options.proportionalLayout,
|
|
@@ -6053,7 +6681,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6053
6681
|
}),
|
|
6054
6682
|
},
|
|
6055
6683
|
});
|
|
6056
|
-
this.layout(
|
|
6684
|
+
this.layout(width, height);
|
|
6057
6685
|
queue.forEach((f) => f());
|
|
6058
6686
|
if (typeof activeView === 'string') {
|
|
6059
6687
|
const panel = this.getPanel(activeView);
|
|
@@ -6320,6 +6948,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6320
6948
|
this.clear();
|
|
6321
6949
|
const { views, size } = serializedPaneview;
|
|
6322
6950
|
const queue = [];
|
|
6951
|
+
// take note of the existing dimensions
|
|
6952
|
+
const width = this.width;
|
|
6953
|
+
const height = this.height;
|
|
6323
6954
|
this.paneview = new Paneview(this.element, {
|
|
6324
6955
|
orientation: exports.Orientation.VERTICAL,
|
|
6325
6956
|
descriptor: {
|
|
@@ -6375,7 +7006,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6375
7006
|
}),
|
|
6376
7007
|
},
|
|
6377
7008
|
});
|
|
6378
|
-
this.layout(
|
|
7009
|
+
this.layout(width, height);
|
|
6379
7010
|
queue.forEach((f) => f());
|
|
6380
7011
|
this._onDidLayoutfromJSON.fire();
|
|
6381
7012
|
}
|
|
@@ -6561,6 +7192,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6561
7192
|
exports.orthogonal = orthogonal;
|
|
6562
7193
|
exports.positionToDirection = positionToDirection;
|
|
6563
7194
|
exports.toTarget = toTarget;
|
|
6564
|
-
exports.watchElementResize = watchElementResize;
|
|
6565
7195
|
|
|
6566
7196
|
}));
|
|
7197
|
+
//# sourceMappingURL=dockview-core.amd.noStyle.js.map
|