dockview-core 1.8.5 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -11
- package/dist/cjs/api/component.api.d.ts +12 -0
- package/dist/cjs/api/component.api.d.ts.map +1 -1
- package/dist/cjs/api/component.api.js +22 -0
- package/dist/cjs/api/component.api.js.map +1 -1
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +15 -8
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts.map +1 -1
- package/dist/cjs/api/dockviewGroupPanelApi.js +39 -9
- package/dist/cjs/api/dockviewGroupPanelApi.js.map +1 -1
- package/dist/cjs/api/dockviewPanelApi.d.ts +19 -2
- package/dist/cjs/api/dockviewPanelApi.d.ts.map +1 -1
- package/dist/cjs/api/dockviewPanelApi.js +23 -3
- package/dist/cjs/api/dockviewPanelApi.js.map +1 -1
- package/dist/cjs/api/gridviewPanelApi.js.map +1 -1
- package/dist/cjs/api/panelApi.js.map +1 -1
- package/dist/cjs/api/paneviewPanelApi.js.map +1 -1
- package/dist/cjs/api/splitviewPanelApi.js.map +1 -1
- package/dist/cjs/array.js.map +1 -1
- package/dist/cjs/constants.d.ts +6 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +6 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
- package/dist/cjs/dnd/dataTransfer.js.map +1 -1
- package/dist/cjs/dnd/dnd.d.ts +5 -0
- package/dist/cjs/dnd/dnd.d.ts.map +1 -1
- package/dist/cjs/dnd/dnd.js +28 -13
- package/dist/cjs/dnd/dnd.js.map +1 -1
- package/dist/cjs/dnd/droptarget.d.ts +13 -12
- package/dist/cjs/dnd/droptarget.d.ts.map +1 -1
- package/dist/cjs/dnd/droptarget.js +40 -49
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dnd/groupDragHandler.js +1 -1
- package/dist/cjs/dnd/groupDragHandler.js.map +1 -1
- package/dist/cjs/dnd/overlay.d.ts +4 -17
- package/dist/cjs/dnd/overlay.d.ts.map +1 -1
- package/dist/cjs/dnd/overlay.js.map +1 -1
- package/dist/cjs/dockview/components/panel/content.d.ts +14 -1
- package/dist/cjs/dockview/components/panel/content.d.ts.map +1 -1
- package/dist/cjs/dockview/components/panel/content.js +85 -26
- package/dist/cjs/dockview/components/panel/content.js.map +1 -1
- package/dist/cjs/dockview/components/tab/defaultTab.js.map +1 -1
- package/dist/cjs/dockview/components/tab/tab.js.map +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +2 -2
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/dockview/components/titlebar/voidContainer.js.map +1 -1
- package/dist/cjs/dockview/components/watermark/watermark.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 +6 -4
- package/dist/cjs/dockview/deserializer.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +23 -10
- package/dist/cjs/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.js +305 -115
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanel.js +4 -2
- package/dist/cjs/dockview/dockviewGroupPanel.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +5 -4
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +37 -43
- package/dist/cjs/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.d.ts +8 -1
- package/dist/cjs/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.js +23 -1
- package/dist/cjs/dockview/dockviewPanel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPanelModel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPopoutGroupPanel.d.ts +16 -0
- package/dist/cjs/dockview/dockviewPopoutGroupPanel.d.ts.map +1 -0
- package/dist/cjs/dockview/dockviewPopoutGroupPanel.js +50 -0
- package/dist/cjs/dockview/dockviewPopoutGroupPanel.js.map +1 -0
- package/dist/cjs/dockview/options.d.ts +7 -1
- package/dist/cjs/dockview/options.d.ts.map +1 -1
- package/dist/cjs/dockview/options.js.map +1 -1
- package/dist/cjs/dockview/types.d.ts +2 -0
- package/dist/cjs/dockview/types.d.ts.map +1 -1
- package/dist/cjs/dockview/types.js.map +1 -1
- package/dist/cjs/dom.d.ts +12 -0
- package/dist/cjs/dom.d.ts.map +1 -1
- package/dist/cjs/dom.js +80 -1
- package/dist/cjs/dom.js.map +1 -1
- package/dist/cjs/events.js.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +10 -0
- package/dist/cjs/gridview/baseComponentGridview.d.ts.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.js +19 -0
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
- package/dist/cjs/gridview/basePanelView.js.map +1 -1
- package/dist/cjs/gridview/branchNode.d.ts +2 -0
- package/dist/cjs/gridview/branchNode.d.ts.map +1 -1
- package/dist/cjs/gridview/branchNode.js +37 -10
- package/dist/cjs/gridview/branchNode.js.map +1 -1
- package/dist/cjs/gridview/gridview.d.ts +10 -3
- package/dist/cjs/gridview/gridview.d.ts.map +1 -1
- package/dist/cjs/gridview/gridview.js +80 -0
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
- package/dist/cjs/gridview/leafNode.d.ts.map +1 -1
- package/dist/cjs/gridview/leafNode.js +1 -2
- package/dist/cjs/gridview/leafNode.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lifecycle.d.ts +1 -0
- package/dist/cjs/lifecycle.d.ts.map +1 -1
- package/dist/cjs/lifecycle.js +8 -0
- package/dist/cjs/lifecycle.js.map +1 -1
- package/dist/cjs/math.js.map +1 -1
- package/dist/cjs/overlayRenderContainer.d.ts +19 -0
- package/dist/cjs/overlayRenderContainer.d.ts.map +1 -0
- package/dist/cjs/overlayRenderContainer.js +170 -0
- package/dist/cjs/overlayRenderContainer.js.map +1 -0
- package/dist/cjs/panel/componentFactory.js.map +1 -1
- package/dist/cjs/paneview/defaultPaneviewHeader.js.map +1 -1
- package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -1
- package/dist/cjs/paneview/paneview.js.map +1 -1
- package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
- package/dist/cjs/paneview/paneviewPanel.js.map +1 -1
- package/dist/cjs/popoutWindow.d.ts +18 -0
- package/dist/cjs/popoutWindow.d.ts.map +1 -0
- package/dist/cjs/popoutWindow.js +130 -0
- package/dist/cjs/popoutWindow.js.map +1 -0
- package/dist/cjs/resizable.d.ts.map +1 -1
- package/dist/cjs/resizable.js +16 -1
- package/dist/cjs/resizable.js.map +1 -1
- package/dist/cjs/splitview/splitview.d.ts +5 -4
- package/dist/cjs/splitview/splitview.d.ts.map +1 -1
- package/dist/cjs/splitview/splitview.js +31 -8
- package/dist/cjs/splitview/splitview.js.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
- package/dist/cjs/splitview/viewItem.js.map +1 -1
- package/dist/cjs/types.d.ts +6 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/dockview-core.amd.js +966 -229
- package/dist/dockview-core.amd.js.map +1 -1
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.js.map +1 -1
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-core.amd.noStyle.js +965 -228
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +966 -229
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +966 -229
- package/dist/dockview-core.esm.js.map +1 -1
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.esm.min.js.map +1 -1
- package/dist/dockview-core.js +966 -229
- package/dist/dockview-core.js.map +1 -1
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +965 -228
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +12 -0
- package/dist/esm/api/component.api.d.ts.map +1 -1
- package/dist/esm/api/component.api.js +18 -0
- package/dist/esm/api/component.api.js.map +1 -1
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +15 -8
- package/dist/esm/api/dockviewGroupPanelApi.d.ts.map +1 -1
- package/dist/esm/api/dockviewGroupPanelApi.js +39 -9
- package/dist/esm/api/dockviewGroupPanelApi.js.map +1 -1
- package/dist/esm/api/dockviewPanelApi.d.ts +19 -2
- package/dist/esm/api/dockviewPanelApi.d.ts.map +1 -1
- package/dist/esm/api/dockviewPanelApi.js +19 -3
- package/dist/esm/api/dockviewPanelApi.js.map +1 -1
- package/dist/esm/api/gridviewPanelApi.js.map +1 -1
- package/dist/esm/array.js.map +1 -1
- package/dist/esm/constants.d.ts +6 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +3 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/dnd/abstractDragHandler.js.map +1 -1
- package/dist/esm/dnd/dataTransfer.js.map +1 -1
- package/dist/esm/dnd/dnd.d.ts +5 -0
- package/dist/esm/dnd/dnd.d.ts.map +1 -1
- package/dist/esm/dnd/dnd.js +28 -13
- package/dist/esm/dnd/dnd.js.map +1 -1
- package/dist/esm/dnd/droptarget.d.ts +13 -12
- package/dist/esm/dnd/droptarget.d.ts.map +1 -1
- package/dist/esm/dnd/droptarget.js +40 -49
- package/dist/esm/dnd/droptarget.js.map +1 -1
- package/dist/esm/dnd/groupDragHandler.js +1 -1
- package/dist/esm/dnd/groupDragHandler.js.map +1 -1
- package/dist/esm/dnd/overlay.d.ts +4 -17
- package/dist/esm/dnd/overlay.d.ts.map +1 -1
- package/dist/esm/dnd/overlay.js.map +1 -1
- package/dist/esm/dockview/components/panel/content.d.ts +14 -1
- package/dist/esm/dockview/components/panel/content.d.ts.map +1 -1
- package/dist/esm/dockview/components/panel/content.js +84 -26
- package/dist/esm/dockview/components/panel/content.js.map +1 -1
- package/dist/esm/dockview/components/tab/defaultTab.js.map +1 -1
- package/dist/esm/dockview/components/tab/tab.js.map +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +2 -2
- package/dist/esm/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/esm/dockview/components/titlebar/voidContainer.js.map +1 -1
- package/dist/esm/dockview/components/watermark/watermark.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 +6 -4
- package/dist/esm/dockview/deserializer.js.map +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +23 -10
- package/dist/esm/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewComponent.js +207 -55
- package/dist/esm/dockview/dockviewComponent.js.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanel.js +4 -2
- package/dist/esm/dockview/dockviewGroupPanel.js.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +5 -4
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.js +39 -45
- package/dist/esm/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/esm/dockview/dockviewPanel.d.ts +8 -1
- package/dist/esm/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewPanel.js +19 -1
- package/dist/esm/dockview/dockviewPanel.js.map +1 -1
- package/dist/esm/dockview/dockviewPanelModel.js.map +1 -1
- package/dist/esm/dockview/dockviewPopoutGroupPanel.d.ts +16 -0
- package/dist/esm/dockview/dockviewPopoutGroupPanel.d.ts.map +1 -0
- package/dist/esm/dockview/dockviewPopoutGroupPanel.js +28 -0
- package/dist/esm/dockview/dockviewPopoutGroupPanel.js.map +1 -0
- package/dist/esm/dockview/options.d.ts +7 -1
- package/dist/esm/dockview/options.d.ts.map +1 -1
- package/dist/esm/dockview/options.js.map +1 -1
- package/dist/esm/dockview/types.d.ts +2 -0
- package/dist/esm/dockview/types.d.ts.map +1 -1
- package/dist/esm/dockview/types.js.map +1 -1
- package/dist/esm/dom.d.ts +12 -0
- package/dist/esm/dom.d.ts.map +1 -1
- package/dist/esm/dom.js +55 -0
- package/dist/esm/dom.js.map +1 -1
- package/dist/esm/events.js.map +1 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts +10 -0
- package/dist/esm/gridview/baseComponentGridview.d.ts.map +1 -1
- package/dist/esm/gridview/baseComponentGridview.js +15 -0
- package/dist/esm/gridview/baseComponentGridview.js.map +1 -1
- package/dist/esm/gridview/basePanelView.js.map +1 -1
- package/dist/esm/gridview/branchNode.d.ts +2 -0
- package/dist/esm/gridview/branchNode.d.ts.map +1 -1
- package/dist/esm/gridview/branchNode.js +26 -5
- package/dist/esm/gridview/branchNode.js.map +1 -1
- package/dist/esm/gridview/gridview.d.ts +10 -3
- package/dist/esm/gridview/gridview.d.ts.map +1 -1
- package/dist/esm/gridview/gridview.js +80 -0
- package/dist/esm/gridview/gridview.js.map +1 -1
- package/dist/esm/gridview/gridviewComponent.js.map +1 -1
- package/dist/esm/gridview/gridviewPanel.js.map +1 -1
- package/dist/esm/gridview/leafNode.d.ts.map +1 -1
- package/dist/esm/gridview/leafNode.js +0 -1
- package/dist/esm/gridview/leafNode.js.map +1 -1
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lifecycle.d.ts +1 -0
- package/dist/esm/lifecycle.d.ts.map +1 -1
- package/dist/esm/lifecycle.js +8 -0
- package/dist/esm/lifecycle.js.map +1 -1
- package/dist/esm/math.js.map +1 -1
- package/dist/esm/overlayRenderContainer.d.ts +19 -0
- package/dist/esm/overlayRenderContainer.d.ts.map +1 -0
- package/dist/esm/overlayRenderContainer.js +125 -0
- package/dist/esm/overlayRenderContainer.js.map +1 -0
- package/dist/esm/panel/componentFactory.js.map +1 -1
- package/dist/esm/paneview/defaultPaneviewHeader.js.map +1 -1
- package/dist/esm/paneview/draggablePaneviewPanel.js.map +1 -1
- package/dist/esm/paneview/paneview.js.map +1 -1
- package/dist/esm/paneview/paneviewComponent.js.map +1 -1
- package/dist/esm/paneview/paneviewPanel.js.map +1 -1
- package/dist/esm/popoutWindow.d.ts +18 -0
- package/dist/esm/popoutWindow.d.ts.map +1 -0
- package/dist/esm/popoutWindow.js +88 -0
- package/dist/esm/popoutWindow.js.map +1 -0
- package/dist/esm/resizable.d.ts.map +1 -1
- package/dist/esm/resizable.js +17 -2
- package/dist/esm/resizable.js.map +1 -1
- package/dist/esm/splitview/splitview.d.ts +5 -4
- package/dist/esm/splitview/splitview.d.ts.map +1 -1
- package/dist/esm/splitview/splitview.js +25 -8
- package/dist/esm/splitview/splitview.js.map +1 -1
- package/dist/esm/splitview/splitviewComponent.js.map +1 -1
- package/dist/esm/splitview/splitviewPanel.js.map +1 -1
- package/dist/esm/splitview/viewItem.js.map +1 -1
- package/dist/esm/types.d.ts +6 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/styles/dockview.css +38 -7
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.9.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -236,6 +236,14 @@
|
|
|
236
236
|
// noop
|
|
237
237
|
},
|
|
238
238
|
};
|
|
239
|
+
function from(func) {
|
|
240
|
+
return {
|
|
241
|
+
dispose: () => {
|
|
242
|
+
func();
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
Disposable.from = from;
|
|
239
247
|
})(Disposable || (Disposable = {}));
|
|
240
248
|
class CompositeDisposable {
|
|
241
249
|
get isDisposed() {
|
|
@@ -420,6 +428,61 @@
|
|
|
420
428
|
function quasiDefaultPrevented(event) {
|
|
421
429
|
return event[QUASI_PREVENT_DEFAULT_KEY];
|
|
422
430
|
}
|
|
431
|
+
function addStyles(document, styleSheetList) {
|
|
432
|
+
const styleSheets = Array.from(styleSheetList);
|
|
433
|
+
for (const styleSheet of styleSheets) {
|
|
434
|
+
if (styleSheet.href) {
|
|
435
|
+
const link = document.createElement('link');
|
|
436
|
+
link.href = styleSheet.href;
|
|
437
|
+
link.type = styleSheet.type;
|
|
438
|
+
link.rel = 'stylesheet';
|
|
439
|
+
document.head.appendChild(link);
|
|
440
|
+
}
|
|
441
|
+
let cssTexts = [];
|
|
442
|
+
try {
|
|
443
|
+
if (styleSheet.cssRules) {
|
|
444
|
+
cssTexts = Array.from(styleSheet.cssRules).map((rule) => rule.cssText);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
catch (err) {
|
|
448
|
+
// security errors (lack of permissions), ignore
|
|
449
|
+
}
|
|
450
|
+
for (const rule of cssTexts) {
|
|
451
|
+
const style = document.createElement('style');
|
|
452
|
+
style.appendChild(document.createTextNode(rule));
|
|
453
|
+
document.head.appendChild(style);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
function getDomNodePagePosition(domNode) {
|
|
458
|
+
const { left, top, width, height } = domNode.getBoundingClientRect();
|
|
459
|
+
return {
|
|
460
|
+
left: left + window.scrollX,
|
|
461
|
+
top: top + window.scrollY,
|
|
462
|
+
width: width,
|
|
463
|
+
height: height,
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Check whether an element is in the DOM (including the Shadow DOM)
|
|
468
|
+
* @see https://terodox.tech/how-to-tell-if-an-element-is-in-the-dom-including-the-shadow-dom/
|
|
469
|
+
*/
|
|
470
|
+
function isInDocument(element) {
|
|
471
|
+
let currentElement = element;
|
|
472
|
+
while (currentElement === null || currentElement === void 0 ? void 0 : currentElement.parentNode) {
|
|
473
|
+
if (currentElement.parentNode === document) {
|
|
474
|
+
return true;
|
|
475
|
+
}
|
|
476
|
+
else if (currentElement.parentNode instanceof DocumentFragment) {
|
|
477
|
+
// handle shadow DOMs
|
|
478
|
+
currentElement = currentElement.parentNode.host;
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
currentElement = currentElement.parentNode;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
423
486
|
|
|
424
487
|
function tail(arr) {
|
|
425
488
|
if (arr.length === 0) {
|
|
@@ -617,6 +680,9 @@
|
|
|
617
680
|
Sizing.Invisible = Invisible;
|
|
618
681
|
})(exports.Sizing || (exports.Sizing = {}));
|
|
619
682
|
class Splitview {
|
|
683
|
+
get contentSize() {
|
|
684
|
+
return this._contentSize;
|
|
685
|
+
}
|
|
620
686
|
get size() {
|
|
621
687
|
return this._size;
|
|
622
688
|
}
|
|
@@ -682,7 +748,7 @@
|
|
|
682
748
|
this.sashes = [];
|
|
683
749
|
this._size = 0;
|
|
684
750
|
this._orthogonalSize = 0;
|
|
685
|
-
this.
|
|
751
|
+
this._contentSize = 0;
|
|
686
752
|
this._proportions = undefined;
|
|
687
753
|
this._startSnappingEnabled = true;
|
|
688
754
|
this._endSnappingEnabled = true;
|
|
@@ -801,7 +867,7 @@
|
|
|
801
867
|
);
|
|
802
868
|
});
|
|
803
869
|
// Initialize content size and proportions for first layout
|
|
804
|
-
this.
|
|
870
|
+
this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
805
871
|
this.saveProportions();
|
|
806
872
|
}
|
|
807
873
|
}
|
|
@@ -1075,7 +1141,7 @@
|
|
|
1075
1141
|
this.addView(view, sizing, to);
|
|
1076
1142
|
}
|
|
1077
1143
|
layout(size, orthogonalSize) {
|
|
1078
|
-
const previousSize = Math.max(this.size, this.
|
|
1144
|
+
const previousSize = Math.max(this.size, this._contentSize);
|
|
1079
1145
|
this.size = size;
|
|
1080
1146
|
this.orthogonalSize = orthogonalSize;
|
|
1081
1147
|
if (!this.proportions) {
|
|
@@ -1085,9 +1151,23 @@
|
|
|
1085
1151
|
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1086
1152
|
}
|
|
1087
1153
|
else {
|
|
1154
|
+
let total = 0;
|
|
1088
1155
|
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1089
1156
|
const item = this.viewItems[i];
|
|
1090
|
-
|
|
1157
|
+
const proportion = this.proportions[i];
|
|
1158
|
+
if (typeof proportion === 'number') {
|
|
1159
|
+
total += proportion;
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
size -= item.size;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1166
|
+
const item = this.viewItems[i];
|
|
1167
|
+
const proportion = this.proportions[i];
|
|
1168
|
+
if (typeof proportion === 'number' && total > 0) {
|
|
1169
|
+
item.size = clamp(Math.round((proportion * size) / total), item.minimumSize, item.maximumSize);
|
|
1170
|
+
}
|
|
1091
1171
|
}
|
|
1092
1172
|
}
|
|
1093
1173
|
this.distributeEmptySpace();
|
|
@@ -1124,12 +1204,12 @@
|
|
|
1124
1204
|
}
|
|
1125
1205
|
}
|
|
1126
1206
|
saveProportions() {
|
|
1127
|
-
if (this.proportionalLayout && this.
|
|
1128
|
-
this._proportions = this.viewItems.map((i) => i.size / this.
|
|
1207
|
+
if (this.proportionalLayout && this._contentSize > 0) {
|
|
1208
|
+
this._proportions = this.viewItems.map((i) => i.visible ? i.size / this._contentSize : undefined);
|
|
1129
1209
|
}
|
|
1130
1210
|
}
|
|
1131
1211
|
layoutViews() {
|
|
1132
|
-
this.
|
|
1212
|
+
this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1133
1213
|
let sum = 0;
|
|
1134
1214
|
const x = [];
|
|
1135
1215
|
this.updateSashEnablement();
|
|
@@ -1223,7 +1303,7 @@
|
|
|
1223
1303
|
}
|
|
1224
1304
|
else if (snappedAfter &&
|
|
1225
1305
|
collapsesDown[index] &&
|
|
1226
|
-
(position < this.
|
|
1306
|
+
(position < this._contentSize || this.endSnappingEnabled)) {
|
|
1227
1307
|
this.updateSash(sash, exports.SashState.MAXIMUM);
|
|
1228
1308
|
}
|
|
1229
1309
|
else {
|
|
@@ -1512,7 +1592,6 @@
|
|
|
1512
1592
|
setVisible(visible) {
|
|
1513
1593
|
if (this.view.setVisible) {
|
|
1514
1594
|
this.view.setVisible(visible);
|
|
1515
|
-
this._onDidChange.fire({});
|
|
1516
1595
|
}
|
|
1517
1596
|
}
|
|
1518
1597
|
layout(size, orthogonalSize) {
|
|
@@ -1544,10 +1623,14 @@
|
|
|
1544
1623
|
get minimumSize() {
|
|
1545
1624
|
return this.children.length === 0
|
|
1546
1625
|
? 0
|
|
1547
|
-
: Math.max(...this.children.map((c) =>
|
|
1626
|
+
: Math.max(...this.children.map((c, index) => this.splitview.isViewVisible(index)
|
|
1627
|
+
? c.minimumOrthogonalSize
|
|
1628
|
+
: 0));
|
|
1548
1629
|
}
|
|
1549
1630
|
get maximumSize() {
|
|
1550
|
-
return Math.min(...this.children.map((c) =>
|
|
1631
|
+
return Math.min(...this.children.map((c, index) => this.splitview.isViewVisible(index)
|
|
1632
|
+
? c.maximumOrthogonalSize
|
|
1633
|
+
: Number.POSITIVE_INFINITY));
|
|
1551
1634
|
}
|
|
1552
1635
|
get minimumOrthogonalSize() {
|
|
1553
1636
|
return this.splitview.minimumSize;
|
|
@@ -1605,6 +1688,8 @@
|
|
|
1605
1688
|
this.children = [];
|
|
1606
1689
|
this._onDidChange = new Emitter();
|
|
1607
1690
|
this.onDidChange = this._onDidChange.event;
|
|
1691
|
+
this._onDidVisibilityChange = new Emitter();
|
|
1692
|
+
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
1608
1693
|
this._orthogonalSize = orthogonalSize;
|
|
1609
1694
|
this._size = size;
|
|
1610
1695
|
this.element = document.createElement('div');
|
|
@@ -1639,7 +1724,7 @@
|
|
|
1639
1724
|
styles,
|
|
1640
1725
|
});
|
|
1641
1726
|
}
|
|
1642
|
-
this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
|
|
1727
|
+
this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
|
|
1643
1728
|
this._onDidChange.fire({});
|
|
1644
1729
|
}));
|
|
1645
1730
|
this.setupChildrenEvents();
|
|
@@ -1662,7 +1747,15 @@
|
|
|
1662
1747
|
if (this.splitview.isViewVisible(index) === visible) {
|
|
1663
1748
|
return;
|
|
1664
1749
|
}
|
|
1750
|
+
const wereAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1665
1751
|
this.splitview.setViewVisible(index, visible);
|
|
1752
|
+
const areAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1753
|
+
// If all children are hidden then the parent should hide the entire splitview
|
|
1754
|
+
// If the entire splitview is hidden then the parent should show the splitview when a child is shown
|
|
1755
|
+
if ((visible && wereAllChildrenHidden) ||
|
|
1756
|
+
(!visible && areAllChildrenHidden)) {
|
|
1757
|
+
this._onDidVisibilityChange.fire(visible);
|
|
1758
|
+
}
|
|
1666
1759
|
}
|
|
1667
1760
|
moveChild(from, to) {
|
|
1668
1761
|
if (from === to) {
|
|
@@ -1726,13 +1819,20 @@
|
|
|
1726
1819
|
}
|
|
1727
1820
|
setupChildrenEvents() {
|
|
1728
1821
|
this._childrenDisposable.dispose();
|
|
1729
|
-
this._childrenDisposable = exports.DockviewEvent.any(...this.children.map((c) => c.onDidChange))((e) => {
|
|
1822
|
+
this._childrenDisposable = new CompositeDisposable(exports.DockviewEvent.any(...this.children.map((c) => c.onDidChange))((e) => {
|
|
1730
1823
|
/**
|
|
1731
1824
|
* indicate a change has occured to allows any re-rendering but don't bubble
|
|
1732
1825
|
* event because that was specific to this branch
|
|
1733
1826
|
*/
|
|
1734
1827
|
this._onDidChange.fire({ size: e.orthogonalSize });
|
|
1735
|
-
})
|
|
1828
|
+
}), ...this.children.map((c, i) => {
|
|
1829
|
+
if (c instanceof BranchNode) {
|
|
1830
|
+
return c.onDidVisibilityChange((visible) => {
|
|
1831
|
+
this.setChildVisible(i, visible);
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
return Disposable.NONE;
|
|
1835
|
+
}));
|
|
1736
1836
|
}
|
|
1737
1837
|
dispose() {
|
|
1738
1838
|
this._childrenDisposable.dispose();
|
|
@@ -1893,7 +1993,69 @@
|
|
|
1893
1993
|
get maximumHeight() {
|
|
1894
1994
|
return this.root.maximumHeight;
|
|
1895
1995
|
}
|
|
1996
|
+
maximizedView() {
|
|
1997
|
+
var _a;
|
|
1998
|
+
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.view;
|
|
1999
|
+
}
|
|
2000
|
+
hasMaximizedView() {
|
|
2001
|
+
return this._maximizedNode !== undefined;
|
|
2002
|
+
}
|
|
2003
|
+
maximizeView(view) {
|
|
2004
|
+
const location = getGridLocation(view.element);
|
|
2005
|
+
const [_, node] = this.getNode(location);
|
|
2006
|
+
if (!(node instanceof LeafNode)) {
|
|
2007
|
+
return;
|
|
2008
|
+
}
|
|
2009
|
+
if (this._maximizedNode === node) {
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
if (this.hasMaximizedView()) {
|
|
2013
|
+
this.exitMaximizedView();
|
|
2014
|
+
}
|
|
2015
|
+
function hideAllViewsBut(parent, exclude) {
|
|
2016
|
+
for (let i = 0; i < parent.children.length; i++) {
|
|
2017
|
+
const child = parent.children[i];
|
|
2018
|
+
if (child instanceof LeafNode) {
|
|
2019
|
+
if (child !== exclude) {
|
|
2020
|
+
parent.setChildVisible(i, false);
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
else {
|
|
2024
|
+
hideAllViewsBut(child, exclude);
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
hideAllViewsBut(this.root, node);
|
|
2029
|
+
this._maximizedNode = node;
|
|
2030
|
+
this._onDidMaxmizedNodeChange.fire();
|
|
2031
|
+
}
|
|
2032
|
+
exitMaximizedView() {
|
|
2033
|
+
if (!this._maximizedNode) {
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
function showViewsInReverseOrder(parent) {
|
|
2037
|
+
for (let index = parent.children.length - 1; index >= 0; index--) {
|
|
2038
|
+
const child = parent.children[index];
|
|
2039
|
+
if (child instanceof LeafNode) {
|
|
2040
|
+
parent.setChildVisible(index, true);
|
|
2041
|
+
}
|
|
2042
|
+
else {
|
|
2043
|
+
showViewsInReverseOrder(child);
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
showViewsInReverseOrder(this.root);
|
|
2048
|
+
this._maximizedNode = undefined;
|
|
2049
|
+
this._onDidMaxmizedNodeChange.fire();
|
|
2050
|
+
}
|
|
1896
2051
|
serialize() {
|
|
2052
|
+
if (this.hasMaximizedView()) {
|
|
2053
|
+
/**
|
|
2054
|
+
* do not persist maximized view state but we must first exit any maximized views
|
|
2055
|
+
* before serialization to ensure the correct dimensions are persisted
|
|
2056
|
+
*/
|
|
2057
|
+
this.exitMaximizedView();
|
|
2058
|
+
}
|
|
1897
2059
|
const root = serializeBranchNode(this.getView(), this.orientation);
|
|
1898
2060
|
return {
|
|
1899
2061
|
root,
|
|
@@ -1905,7 +2067,9 @@
|
|
|
1905
2067
|
dispose() {
|
|
1906
2068
|
this.disposable.dispose();
|
|
1907
2069
|
this._onDidChange.dispose();
|
|
2070
|
+
this._onDidMaxmizedNodeChange.dispose();
|
|
1908
2071
|
this.root.dispose();
|
|
2072
|
+
this._maximizedNode = undefined;
|
|
1909
2073
|
this.element.remove();
|
|
1910
2074
|
}
|
|
1911
2075
|
clear() {
|
|
@@ -1946,6 +2110,7 @@
|
|
|
1946
2110
|
const oldRoot = this._root;
|
|
1947
2111
|
if (oldRoot) {
|
|
1948
2112
|
oldRoot.dispose();
|
|
2113
|
+
this._maximizedNode = undefined;
|
|
1949
2114
|
this.element.removeChild(oldRoot.element);
|
|
1950
2115
|
}
|
|
1951
2116
|
this._root = root;
|
|
@@ -2032,9 +2197,12 @@
|
|
|
2032
2197
|
constructor(proportionalLayout, styles, orientation) {
|
|
2033
2198
|
this.proportionalLayout = proportionalLayout;
|
|
2034
2199
|
this.styles = styles;
|
|
2200
|
+
this._maximizedNode = undefined;
|
|
2035
2201
|
this.disposable = new MutableDisposable();
|
|
2036
2202
|
this._onDidChange = new Emitter();
|
|
2037
2203
|
this.onDidChange = this._onDidChange.event;
|
|
2204
|
+
this._onDidMaxmizedNodeChange = new Emitter();
|
|
2205
|
+
this.onDidMaxmizedNodeChange = this._onDidMaxmizedNodeChange.event;
|
|
2038
2206
|
this.element = document.createElement('div');
|
|
2039
2207
|
this.element.className = 'grid-view';
|
|
2040
2208
|
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
@@ -2048,6 +2216,9 @@
|
|
|
2048
2216
|
return parent.isChildVisible(index);
|
|
2049
2217
|
}
|
|
2050
2218
|
setViewVisible(location, visible) {
|
|
2219
|
+
if (this.hasMaximizedView()) {
|
|
2220
|
+
this.exitMaximizedView();
|
|
2221
|
+
}
|
|
2051
2222
|
const [rest, index] = tail(location);
|
|
2052
2223
|
const [, parent] = this.getNode(rest);
|
|
2053
2224
|
if (!(parent instanceof BranchNode)) {
|
|
@@ -2056,6 +2227,9 @@
|
|
|
2056
2227
|
parent.setChildVisible(index, visible);
|
|
2057
2228
|
}
|
|
2058
2229
|
moveView(parentLocation, from, to) {
|
|
2230
|
+
if (this.hasMaximizedView()) {
|
|
2231
|
+
this.exitMaximizedView();
|
|
2232
|
+
}
|
|
2059
2233
|
const [, parent] = this.getNode(parentLocation);
|
|
2060
2234
|
if (!(parent instanceof BranchNode)) {
|
|
2061
2235
|
throw new Error('Invalid location');
|
|
@@ -2063,6 +2237,9 @@
|
|
|
2063
2237
|
parent.moveChild(from, to);
|
|
2064
2238
|
}
|
|
2065
2239
|
addView(view, size, location) {
|
|
2240
|
+
if (this.hasMaximizedView()) {
|
|
2241
|
+
this.exitMaximizedView();
|
|
2242
|
+
}
|
|
2066
2243
|
const [rest, index] = tail(location);
|
|
2067
2244
|
const [pathToParent, parent] = this.getNode(rest);
|
|
2068
2245
|
if (parent instanceof BranchNode) {
|
|
@@ -2095,6 +2272,9 @@
|
|
|
2095
2272
|
return this.removeView(location, sizing);
|
|
2096
2273
|
}
|
|
2097
2274
|
removeView(location, sizing) {
|
|
2275
|
+
if (this.hasMaximizedView()) {
|
|
2276
|
+
this.exitMaximizedView();
|
|
2277
|
+
}
|
|
2098
2278
|
const [rest, index] = tail(location);
|
|
2099
2279
|
const [pathToParent, parent] = this.getNode(rest);
|
|
2100
2280
|
if (!(parent instanceof BranchNode)) {
|
|
@@ -2832,6 +3012,24 @@
|
|
|
2832
3012
|
moveToPrevious(options) {
|
|
2833
3013
|
this.component.moveToPrevious(options);
|
|
2834
3014
|
}
|
|
3015
|
+
maximizeGroup(panel) {
|
|
3016
|
+
this.component.maximizeGroup(panel.group);
|
|
3017
|
+
}
|
|
3018
|
+
hasMaximizedGroup() {
|
|
3019
|
+
return this.component.hasMaximizedGroup();
|
|
3020
|
+
}
|
|
3021
|
+
exitMaxmizedGroup() {
|
|
3022
|
+
this.component.exitMaximizedGroup();
|
|
3023
|
+
}
|
|
3024
|
+
get onDidMaxmizedGroupChange() {
|
|
3025
|
+
return this.component.onDidMaxmizedGroupChange;
|
|
3026
|
+
}
|
|
3027
|
+
/**
|
|
3028
|
+
* Add a popout group in a new Window
|
|
3029
|
+
*/
|
|
3030
|
+
addPopoutGroup(item, options) {
|
|
3031
|
+
this.component.addPopoutGroup(item, options);
|
|
3032
|
+
}
|
|
2835
3033
|
}
|
|
2836
3034
|
|
|
2837
3035
|
class DragAndDropObserver extends CompositeDisposable {
|
|
@@ -2842,36 +3040,48 @@
|
|
|
2842
3040
|
this.target = null;
|
|
2843
3041
|
this.registerListeners();
|
|
2844
3042
|
}
|
|
3043
|
+
onDragEnter(e) {
|
|
3044
|
+
this.target = e.target;
|
|
3045
|
+
this.callbacks.onDragEnter(e);
|
|
3046
|
+
}
|
|
3047
|
+
onDragOver(e) {
|
|
3048
|
+
e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
|
|
3049
|
+
if (this.callbacks.onDragOver) {
|
|
3050
|
+
this.callbacks.onDragOver(e);
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
onDragLeave(e) {
|
|
3054
|
+
if (this.target === e.target) {
|
|
3055
|
+
this.target = null;
|
|
3056
|
+
this.callbacks.onDragLeave(e);
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
onDragEnd(e) {
|
|
3060
|
+
this.target = null;
|
|
3061
|
+
this.callbacks.onDragEnd(e);
|
|
3062
|
+
}
|
|
3063
|
+
onDrop(e) {
|
|
3064
|
+
this.callbacks.onDrop(e);
|
|
3065
|
+
}
|
|
2845
3066
|
registerListeners() {
|
|
2846
3067
|
this.addDisposables(addDisposableListener(this.element, 'dragenter', (e) => {
|
|
2847
|
-
this.
|
|
2848
|
-
this.callbacks.onDragEnter(e);
|
|
3068
|
+
this.onDragEnter(e);
|
|
2849
3069
|
}, true));
|
|
2850
3070
|
this.addDisposables(addDisposableListener(this.element, 'dragover', (e) => {
|
|
2851
|
-
|
|
2852
|
-
if (this.callbacks.onDragOver) {
|
|
2853
|
-
this.callbacks.onDragOver(e);
|
|
2854
|
-
}
|
|
3071
|
+
this.onDragOver(e);
|
|
2855
3072
|
}, true));
|
|
2856
3073
|
this.addDisposables(addDisposableListener(this.element, 'dragleave', (e) => {
|
|
2857
|
-
|
|
2858
|
-
this.target = null;
|
|
2859
|
-
this.callbacks.onDragLeave(e);
|
|
2860
|
-
}
|
|
3074
|
+
this.onDragLeave(e);
|
|
2861
3075
|
}));
|
|
2862
3076
|
this.addDisposables(addDisposableListener(this.element, 'dragend', (e) => {
|
|
2863
|
-
this.
|
|
2864
|
-
this.callbacks.onDragEnd(e);
|
|
3077
|
+
this.onDragEnd(e);
|
|
2865
3078
|
}));
|
|
2866
3079
|
this.addDisposables(addDisposableListener(this.element, 'drop', (e) => {
|
|
2867
|
-
this.
|
|
3080
|
+
this.onDrop(e);
|
|
2868
3081
|
}));
|
|
2869
3082
|
}
|
|
2870
3083
|
}
|
|
2871
3084
|
|
|
2872
|
-
function numberOrFallback(maybeNumber, fallback) {
|
|
2873
|
-
return typeof maybeNumber === 'number' ? maybeNumber : fallback;
|
|
2874
|
-
}
|
|
2875
3085
|
function directionToPosition(direction) {
|
|
2876
3086
|
switch (direction) {
|
|
2877
3087
|
case 'above':
|
|
@@ -2904,6 +3114,16 @@
|
|
|
2904
3114
|
throw new Error(`invalid position '${position}'`);
|
|
2905
3115
|
}
|
|
2906
3116
|
}
|
|
3117
|
+
const DEFAULT_ACTIVATION_SIZE = {
|
|
3118
|
+
value: 20,
|
|
3119
|
+
type: 'percentage',
|
|
3120
|
+
};
|
|
3121
|
+
const DEFAULT_SIZE = {
|
|
3122
|
+
value: 50,
|
|
3123
|
+
type: 'percentage',
|
|
3124
|
+
};
|
|
3125
|
+
const SMALL_WIDTH_BOUNDARY = 100;
|
|
3126
|
+
const SMALL_HEIGHT_BOUNDARY = 100;
|
|
2907
3127
|
class Droptarget extends CompositeDisposable {
|
|
2908
3128
|
get state() {
|
|
2909
3129
|
return this._state;
|
|
@@ -2916,7 +3136,7 @@
|
|
|
2916
3136
|
this.onDrop = this._onDrop.event;
|
|
2917
3137
|
// use a set to take advantage of #<set>.has
|
|
2918
3138
|
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
2919
|
-
this.
|
|
3139
|
+
this.dnd = new DragAndDropObserver(this.element, {
|
|
2920
3140
|
onDragEnter: () => undefined,
|
|
2921
3141
|
onDragOver: (e) => {
|
|
2922
3142
|
if (this._acceptedTargetZonesSet.size === 0) {
|
|
@@ -2964,7 +3184,7 @@
|
|
|
2964
3184
|
this.element.append(this.targetElement);
|
|
2965
3185
|
}
|
|
2966
3186
|
this.toggleClasses(quadrant, width, height);
|
|
2967
|
-
this.
|
|
3187
|
+
this._state = quadrant;
|
|
2968
3188
|
},
|
|
2969
3189
|
onDragLeave: () => {
|
|
2970
3190
|
this.removeDropTarget();
|
|
@@ -2983,11 +3203,15 @@
|
|
|
2983
3203
|
this._onDrop.fire({ position: state, nativeEvent: e });
|
|
2984
3204
|
}
|
|
2985
3205
|
},
|
|
2986
|
-
})
|
|
3206
|
+
});
|
|
3207
|
+
this.addDisposables(this._onDrop, this.dnd);
|
|
2987
3208
|
}
|
|
2988
3209
|
setTargetZones(acceptedTargetZones) {
|
|
2989
3210
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
2990
3211
|
}
|
|
3212
|
+
setOverlayModel(model) {
|
|
3213
|
+
this.options.overlayModel = model;
|
|
3214
|
+
}
|
|
2991
3215
|
dispose() {
|
|
2992
3216
|
this.removeDropTarget();
|
|
2993
3217
|
super.dispose();
|
|
@@ -2999,19 +3223,19 @@
|
|
|
2999
3223
|
event[Droptarget.USED_EVENT_ID] = true;
|
|
3000
3224
|
}
|
|
3001
3225
|
/**
|
|
3002
|
-
* Check is the event has already been used by another instance
|
|
3226
|
+
* Check is the event has already been used by another instance of DropTarget
|
|
3003
3227
|
*/
|
|
3004
3228
|
isAlreadyUsed(event) {
|
|
3005
3229
|
const value = event[Droptarget.USED_EVENT_ID];
|
|
3006
3230
|
return typeof value === 'boolean' && value;
|
|
3007
3231
|
}
|
|
3008
3232
|
toggleClasses(quadrant, width, height) {
|
|
3009
|
-
var _a, _b
|
|
3233
|
+
var _a, _b;
|
|
3010
3234
|
if (!this.overlayElement) {
|
|
3011
3235
|
return;
|
|
3012
3236
|
}
|
|
3013
|
-
const isSmallX = width <
|
|
3014
|
-
const isSmallY = height <
|
|
3237
|
+
const isSmallX = width < SMALL_WIDTH_BOUNDARY;
|
|
3238
|
+
const isSmallY = height < SMALL_HEIGHT_BOUNDARY;
|
|
3015
3239
|
const isLeft = quadrant === 'left';
|
|
3016
3240
|
const isRight = quadrant === 'right';
|
|
3017
3241
|
const isTop = quadrant === 'top';
|
|
@@ -3020,20 +3244,17 @@
|
|
|
3020
3244
|
const leftClass = !isSmallX && isLeft;
|
|
3021
3245
|
const topClass = !isSmallY && isTop;
|
|
3022
3246
|
const bottomClass = !isSmallY && isBottom;
|
|
3023
|
-
let size =
|
|
3024
|
-
|
|
3025
|
-
|
|
3247
|
+
let size = 1;
|
|
3248
|
+
const sizeOptions = (_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : DEFAULT_SIZE;
|
|
3249
|
+
if (sizeOptions.type === 'percentage') {
|
|
3250
|
+
size = clamp(sizeOptions.value, 0, 100) / 100;
|
|
3026
3251
|
}
|
|
3027
|
-
|
|
3252
|
+
else {
|
|
3028
3253
|
if (rightClass || leftClass) {
|
|
3029
|
-
size =
|
|
3030
|
-
clamp(0, this.options.overlayModel.size.value, width) /
|
|
3031
|
-
width;
|
|
3254
|
+
size = clamp(0, sizeOptions.value, width) / width;
|
|
3032
3255
|
}
|
|
3033
3256
|
if (topClass || bottomClass) {
|
|
3034
|
-
size =
|
|
3035
|
-
clamp(0, this.options.overlayModel.size.value, height) /
|
|
3036
|
-
height;
|
|
3257
|
+
size = clamp(0, sizeOptions.value, height) / height;
|
|
3037
3258
|
}
|
|
3038
3259
|
}
|
|
3039
3260
|
const translate = (1 - size) / 2;
|
|
@@ -3055,39 +3276,22 @@
|
|
|
3055
3276
|
transform = '';
|
|
3056
3277
|
}
|
|
3057
3278
|
this.overlayElement.style.transform = transform;
|
|
3058
|
-
toggleClass(this.overlayElement, 'small-
|
|
3059
|
-
toggleClass(this.overlayElement, 'small-
|
|
3060
|
-
toggleClass(this.overlayElement, '
|
|
3061
|
-
toggleClass(this.overlayElement, '
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
case 'top':
|
|
3066
|
-
this._state = 'top';
|
|
3067
|
-
break;
|
|
3068
|
-
case 'left':
|
|
3069
|
-
this._state = 'left';
|
|
3070
|
-
break;
|
|
3071
|
-
case 'bottom':
|
|
3072
|
-
this._state = 'bottom';
|
|
3073
|
-
break;
|
|
3074
|
-
case 'right':
|
|
3075
|
-
this._state = 'right';
|
|
3076
|
-
break;
|
|
3077
|
-
case 'center':
|
|
3078
|
-
this._state = 'center';
|
|
3079
|
-
break;
|
|
3080
|
-
}
|
|
3279
|
+
toggleClass(this.overlayElement, 'dv-drop-target-small-vertical', isSmallY);
|
|
3280
|
+
toggleClass(this.overlayElement, 'dv-drop-target-small-horizontal', isSmallX);
|
|
3281
|
+
toggleClass(this.overlayElement, 'dv-drop-target-left', isLeft);
|
|
3282
|
+
toggleClass(this.overlayElement, 'dv-drop-target-right', isRight);
|
|
3283
|
+
toggleClass(this.overlayElement, 'dv-drop-target-top', isTop);
|
|
3284
|
+
toggleClass(this.overlayElement, 'dv-drop-target-bottom', isBottom);
|
|
3285
|
+
toggleClass(this.overlayElement, 'dv-drop-target-center', quadrant === 'center');
|
|
3081
3286
|
}
|
|
3082
3287
|
calculateQuadrant(overlayType, x, y, width, height) {
|
|
3083
|
-
var _a, _b
|
|
3084
|
-
const
|
|
3085
|
-
|
|
3086
|
-
const value = numberOrFallback((_f = (_e = (_d = this.options) === null || _d === void 0 ? void 0 : _d.overlayModel) === null || _e === void 0 ? void 0 : _e.activationSize) === null || _f === void 0 ? void 0 : _f.value, 20);
|
|
3288
|
+
var _a, _b;
|
|
3289
|
+
const activationSizeOptions = (_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.activationSize) !== null && _b !== void 0 ? _b : DEFAULT_ACTIVATION_SIZE;
|
|
3290
|
+
const isPercentage = activationSizeOptions.type === 'percentage';
|
|
3087
3291
|
if (isPercentage) {
|
|
3088
|
-
return calculateQuadrantAsPercentage(overlayType, x, y, width, height, value);
|
|
3292
|
+
return calculateQuadrantAsPercentage(overlayType, x, y, width, height, activationSizeOptions.value);
|
|
3089
3293
|
}
|
|
3090
|
-
return calculateQuadrantAsPixels(overlayType, x, y, width, height, value);
|
|
3294
|
+
return calculateQuadrantAsPixels(overlayType, x, y, width, height, activationSizeOptions.value);
|
|
3091
3295
|
}
|
|
3092
3296
|
removeDropTarget() {
|
|
3093
3297
|
if (this.targetElement) {
|
|
@@ -3139,12 +3343,22 @@
|
|
|
3139
3343
|
return 'center';
|
|
3140
3344
|
}
|
|
3141
3345
|
|
|
3346
|
+
exports.DockviewDropTargets = void 0;
|
|
3347
|
+
(function (DockviewDropTargets) {
|
|
3348
|
+
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3349
|
+
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3350
|
+
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3351
|
+
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3352
|
+
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3353
|
+
|
|
3142
3354
|
class ContentContainer extends CompositeDisposable {
|
|
3143
3355
|
get element() {
|
|
3144
3356
|
return this._element;
|
|
3145
3357
|
}
|
|
3146
|
-
constructor() {
|
|
3358
|
+
constructor(accessor, group) {
|
|
3147
3359
|
super();
|
|
3360
|
+
this.accessor = accessor;
|
|
3361
|
+
this.group = group;
|
|
3148
3362
|
this.disposable = new MutableDisposable();
|
|
3149
3363
|
this._onDidFocus = new Emitter();
|
|
3150
3364
|
this.onDidFocus = this._onDidFocus.event;
|
|
@@ -3154,11 +3368,38 @@
|
|
|
3154
3368
|
this._element.className = 'content-container';
|
|
3155
3369
|
this._element.tabIndex = -1;
|
|
3156
3370
|
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3371
|
+
this.dropTarget = new Droptarget(this.element, {
|
|
3372
|
+
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
3373
|
+
canDisplayOverlay: (event, position) => {
|
|
3374
|
+
if (this.group.locked === 'no-drop-target' ||
|
|
3375
|
+
(this.group.locked && position === 'center')) {
|
|
3376
|
+
return false;
|
|
3377
|
+
}
|
|
3378
|
+
const data = getPanelData();
|
|
3379
|
+
if (!data &&
|
|
3380
|
+
event.shiftKey &&
|
|
3381
|
+
this.group.location !== 'floating') {
|
|
3382
|
+
return false;
|
|
3383
|
+
}
|
|
3384
|
+
if (data && data.viewId === this.accessor.id) {
|
|
3385
|
+
if (data.groupId === this.group.id) {
|
|
3386
|
+
if (position === 'center') {
|
|
3387
|
+
// don't allow to drop on self for center position
|
|
3388
|
+
return false;
|
|
3389
|
+
}
|
|
3390
|
+
if (data.panelId === null) {
|
|
3391
|
+
// don't allow group move to drop anywhere on self
|
|
3392
|
+
return false;
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
const groupHasOnePanelAndIsActiveDragElement = this.group.panels.length === 1 &&
|
|
3396
|
+
data.groupId === this.group.id;
|
|
3397
|
+
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3398
|
+
}
|
|
3399
|
+
return this.group.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
|
|
3400
|
+
},
|
|
3401
|
+
});
|
|
3402
|
+
this.addDisposables(this.dropTarget);
|
|
3162
3403
|
}
|
|
3163
3404
|
show() {
|
|
3164
3405
|
this.element.style.display = '';
|
|
@@ -3166,23 +3407,43 @@
|
|
|
3166
3407
|
hide() {
|
|
3167
3408
|
this.element.style.display = 'none';
|
|
3168
3409
|
}
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
this.panel = undefined;
|
|
3410
|
+
renderPanel(panel, options = { asActive: true }) {
|
|
3411
|
+
const doRender = options.asActive ||
|
|
3412
|
+
(this.panel && this.group.isPanelActive(this.panel));
|
|
3413
|
+
if (this.panel &&
|
|
3414
|
+
this.panel.view.content.element.parentElement === this._element) {
|
|
3415
|
+
/**
|
|
3416
|
+
* If the currently attached panel is mounted directly to the content then remove it
|
|
3417
|
+
*/
|
|
3418
|
+
this._element.removeChild(this.panel.view.content.element);
|
|
3179
3419
|
}
|
|
3180
3420
|
this.panel = panel;
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3421
|
+
let container;
|
|
3422
|
+
switch (panel.api.renderer) {
|
|
3423
|
+
case 'onlyWhenVisibile':
|
|
3424
|
+
this.accessor.overlayRenderContainer.detatch(panel);
|
|
3425
|
+
if (this.panel) {
|
|
3426
|
+
if (doRender) {
|
|
3427
|
+
this._element.appendChild(this.panel.view.content.element);
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
container = this._element;
|
|
3431
|
+
break;
|
|
3432
|
+
case 'always':
|
|
3433
|
+
if (panel.view.content.element.parentElement === this._element) {
|
|
3434
|
+
this._element.removeChild(panel.view.content.element);
|
|
3435
|
+
}
|
|
3436
|
+
container = this.accessor.overlayRenderContainer.attach({
|
|
3437
|
+
panel,
|
|
3438
|
+
referenceContainer: this,
|
|
3439
|
+
});
|
|
3440
|
+
break;
|
|
3441
|
+
}
|
|
3442
|
+
if (doRender) {
|
|
3443
|
+
const _onDidFocus = panel.view.content.onDidFocus;
|
|
3444
|
+
const _onDidBlur = panel.view.content.onDidBlur;
|
|
3445
|
+
const focusTracker = trackFocus(container);
|
|
3446
|
+
const disposable = new CompositeDisposable();
|
|
3186
3447
|
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
3187
3448
|
if (_onDidFocus) {
|
|
3188
3449
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
@@ -3190,17 +3451,23 @@
|
|
|
3190
3451
|
if (_onDidBlur) {
|
|
3191
3452
|
disposable.addDisposables(_onDidBlur(() => this._onDidBlur.fire()));
|
|
3192
3453
|
}
|
|
3193
|
-
this.
|
|
3454
|
+
this.disposable.value = disposable;
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
openPanel(panel) {
|
|
3458
|
+
if (this.panel === panel) {
|
|
3459
|
+
return;
|
|
3194
3460
|
}
|
|
3195
|
-
this.
|
|
3461
|
+
this.renderPanel(panel);
|
|
3196
3462
|
}
|
|
3197
3463
|
layout(_width, _height) {
|
|
3198
3464
|
// noop
|
|
3199
3465
|
}
|
|
3200
3466
|
closePanel() {
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3467
|
+
if (this.panel) {
|
|
3468
|
+
if (this.accessor.options.defaultRenderer === 'onlyWhenVisibile') {
|
|
3469
|
+
this._element.removeChild(this.panel.view.content.element);
|
|
3470
|
+
}
|
|
3204
3471
|
this.panel = undefined;
|
|
3205
3472
|
}
|
|
3206
3473
|
}
|
|
@@ -3210,14 +3477,6 @@
|
|
|
3210
3477
|
}
|
|
3211
3478
|
}
|
|
3212
3479
|
|
|
3213
|
-
exports.DockviewDropTargets = void 0;
|
|
3214
|
-
(function (DockviewDropTargets) {
|
|
3215
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3216
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3217
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3218
|
-
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3219
|
-
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3220
|
-
|
|
3221
3480
|
class DragHandler extends CompositeDisposable {
|
|
3222
3481
|
constructor(el) {
|
|
3223
3482
|
super();
|
|
@@ -3392,7 +3651,7 @@
|
|
|
3392
3651
|
}, true));
|
|
3393
3652
|
}
|
|
3394
3653
|
isCancelled(_event) {
|
|
3395
|
-
if (this.group.api.
|
|
3654
|
+
if (this.group.api.location === 'floating' && !_event.shiftKey) {
|
|
3396
3655
|
return true;
|
|
3397
3656
|
}
|
|
3398
3657
|
return false;
|
|
@@ -3594,7 +3853,7 @@
|
|
|
3594
3853
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3595
3854
|
if (isFloatingGroupsEnabled &&
|
|
3596
3855
|
event.shiftKey &&
|
|
3597
|
-
|
|
3856
|
+
this.group.api.location !== 'floating') {
|
|
3598
3857
|
event.preventDefault();
|
|
3599
3858
|
const { top, left } = this.element.getBoundingClientRect();
|
|
3600
3859
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
@@ -3659,7 +3918,7 @@
|
|
|
3659
3918
|
}), tab.onChanged((event) => {
|
|
3660
3919
|
var _a;
|
|
3661
3920
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3662
|
-
const isFloatingWithOnePanel = this.group.api.
|
|
3921
|
+
const isFloatingWithOnePanel = this.group.api.location === 'floating' && this.size === 1;
|
|
3663
3922
|
if (isFloatingGroupsEnabled &&
|
|
3664
3923
|
!isFloatingWithOnePanel &&
|
|
3665
3924
|
event.shiftKey) {
|
|
@@ -3742,15 +4001,37 @@
|
|
|
3742
4001
|
}
|
|
3743
4002
|
return isAncestor(document.activeElement, this.contentContainer.element);
|
|
3744
4003
|
}
|
|
3745
|
-
get
|
|
3746
|
-
return this.
|
|
3747
|
-
}
|
|
3748
|
-
set
|
|
3749
|
-
this.
|
|
3750
|
-
this.
|
|
3751
|
-
toggleClass(this.container, 'dv-groupview-
|
|
3752
|
-
|
|
3753
|
-
|
|
4004
|
+
get location() {
|
|
4005
|
+
return this._location;
|
|
4006
|
+
}
|
|
4007
|
+
set location(value) {
|
|
4008
|
+
this._location = value;
|
|
4009
|
+
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4010
|
+
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4011
|
+
switch (value) {
|
|
4012
|
+
case 'grid':
|
|
4013
|
+
this.contentContainer.dropTarget.setTargetZones([
|
|
4014
|
+
'top',
|
|
4015
|
+
'bottom',
|
|
4016
|
+
'left',
|
|
4017
|
+
'right',
|
|
4018
|
+
'center',
|
|
4019
|
+
]);
|
|
4020
|
+
break;
|
|
4021
|
+
case 'floating':
|
|
4022
|
+
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
4023
|
+
this.contentContainer.dropTarget.setTargetZones(value
|
|
4024
|
+
? ['center']
|
|
4025
|
+
: ['top', 'bottom', 'left', 'right', 'center']);
|
|
4026
|
+
toggleClass(this.container, 'dv-groupview-floating', true);
|
|
4027
|
+
break;
|
|
4028
|
+
case 'popout':
|
|
4029
|
+
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
4030
|
+
toggleClass(this.container, 'dv-groupview-popout', true);
|
|
4031
|
+
break;
|
|
4032
|
+
}
|
|
4033
|
+
this.groupPanel.api._onDidLocationChange.fire({
|
|
4034
|
+
location: this.location,
|
|
3754
4035
|
});
|
|
3755
4036
|
}
|
|
3756
4037
|
constructor(container, accessor, id, options, groupPanel) {
|
|
@@ -3763,7 +4044,7 @@
|
|
|
3763
4044
|
this.groupPanel = groupPanel;
|
|
3764
4045
|
this._isGroupActive = false;
|
|
3765
4046
|
this._locked = false;
|
|
3766
|
-
this.
|
|
4047
|
+
this._location = 'grid';
|
|
3767
4048
|
this.mostRecentlyUsed = [];
|
|
3768
4049
|
this._onDidChange = new Emitter();
|
|
3769
4050
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -3786,35 +4067,7 @@
|
|
|
3786
4067
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
3787
4068
|
toggleClass(this.container, 'groupview', true);
|
|
3788
4069
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
3789
|
-
this.contentContainer = new ContentContainer();
|
|
3790
|
-
this.dropTarget = new Droptarget(this.contentContainer.element, {
|
|
3791
|
-
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
3792
|
-
canDisplayOverlay: (event, position) => {
|
|
3793
|
-
if (this.locked === 'no-drop-target' ||
|
|
3794
|
-
(this.locked && position === 'center')) {
|
|
3795
|
-
return false;
|
|
3796
|
-
}
|
|
3797
|
-
const data = getPanelData();
|
|
3798
|
-
if (!data && event.shiftKey && !this.isFloating) {
|
|
3799
|
-
return false;
|
|
3800
|
-
}
|
|
3801
|
-
if (data && data.viewId === this.accessor.id) {
|
|
3802
|
-
if (data.groupId === this.id) {
|
|
3803
|
-
if (position === 'center') {
|
|
3804
|
-
// don't allow to drop on self for center position
|
|
3805
|
-
return false;
|
|
3806
|
-
}
|
|
3807
|
-
if (data.panelId === null) {
|
|
3808
|
-
// don't allow group move to drop anywhere on self
|
|
3809
|
-
return false;
|
|
3810
|
-
}
|
|
3811
|
-
}
|
|
3812
|
-
const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
|
|
3813
|
-
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3814
|
-
}
|
|
3815
|
-
return this.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
|
|
3816
|
-
},
|
|
3817
|
-
});
|
|
4070
|
+
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
3818
4071
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3819
4072
|
this.header.hidden = !!options.hideHeader;
|
|
3820
4073
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
@@ -3828,7 +4081,7 @@
|
|
|
3828
4081
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
3829
4082
|
}), this.contentContainer.onDidBlur(() => {
|
|
3830
4083
|
// noop
|
|
3831
|
-
}), this.dropTarget.onDrop((event) => {
|
|
4084
|
+
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
3832
4085
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3833
4086
|
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3834
4087
|
}
|
|
@@ -3877,6 +4130,9 @@
|
|
|
3877
4130
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
3878
4131
|
}
|
|
3879
4132
|
}
|
|
4133
|
+
rerender(panel) {
|
|
4134
|
+
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
4135
|
+
}
|
|
3880
4136
|
indexOf(panel) {
|
|
3881
4137
|
return this.tabsContainer.indexOf(panel.id);
|
|
3882
4138
|
}
|
|
@@ -4068,12 +4324,12 @@
|
|
|
4068
4324
|
doAddPanel(panel, index = this.panels.length, skipSetActive = false) {
|
|
4069
4325
|
const existingPanel = this._panels.indexOf(panel);
|
|
4070
4326
|
const hasExistingPanel = existingPanel > -1;
|
|
4327
|
+
this.tabsContainer.show();
|
|
4328
|
+
this.contentContainer.show();
|
|
4071
4329
|
this.tabsContainer.openPanel(panel, index);
|
|
4072
4330
|
if (!skipSetActive) {
|
|
4073
4331
|
this.contentContainer.openPanel(panel);
|
|
4074
4332
|
}
|
|
4075
|
-
this.tabsContainer.show();
|
|
4076
|
-
this.contentContainer.show();
|
|
4077
4333
|
if (hasExistingPanel) {
|
|
4078
4334
|
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
4079
4335
|
return;
|
|
@@ -4189,7 +4445,6 @@
|
|
|
4189
4445
|
for (const panel of this.panels) {
|
|
4190
4446
|
panel.dispose();
|
|
4191
4447
|
}
|
|
4192
|
-
this.dropTarget.dispose();
|
|
4193
4448
|
this.tabsContainer.dispose();
|
|
4194
4449
|
this.contentContainer.dispose();
|
|
4195
4450
|
}
|
|
@@ -4228,7 +4483,22 @@
|
|
|
4228
4483
|
if (this.disableResizing) {
|
|
4229
4484
|
return;
|
|
4230
4485
|
}
|
|
4231
|
-
if (!
|
|
4486
|
+
if (!this._element.offsetParent) {
|
|
4487
|
+
/**
|
|
4488
|
+
* offsetParent === null is equivalent to display: none being set on the element or one
|
|
4489
|
+
* of it's parents. In the display: none case the size will become (0, 0) which we do
|
|
4490
|
+
* not want to propagate.
|
|
4491
|
+
*
|
|
4492
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
4493
|
+
*
|
|
4494
|
+
* You could use checkVisibility() but at the time of writing it's not supported across
|
|
4495
|
+
* all Browsers
|
|
4496
|
+
*
|
|
4497
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility
|
|
4498
|
+
*/
|
|
4499
|
+
return;
|
|
4500
|
+
}
|
|
4501
|
+
if (!isInDocument(this._element)) {
|
|
4232
4502
|
/**
|
|
4233
4503
|
* since the event is dispatched through requestAnimationFrame there is a small chance
|
|
4234
4504
|
* the component is no longer attached to the DOM, if that is the case the dimensions
|
|
@@ -4320,6 +4590,21 @@
|
|
|
4320
4590
|
isVisible(panel) {
|
|
4321
4591
|
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
4322
4592
|
}
|
|
4593
|
+
maximizeGroup(panel) {
|
|
4594
|
+
this.gridview.maximizeView(panel);
|
|
4595
|
+
}
|
|
4596
|
+
isMaximizedGroup(panel) {
|
|
4597
|
+
return this.gridview.maximizedView() === panel;
|
|
4598
|
+
}
|
|
4599
|
+
exitMaximizedGroup() {
|
|
4600
|
+
this.gridview.exitMaximizedView();
|
|
4601
|
+
}
|
|
4602
|
+
hasMaximizedGroup() {
|
|
4603
|
+
return this.gridview.hasMaximizedView();
|
|
4604
|
+
}
|
|
4605
|
+
get onDidMaxmizedGroupChange() {
|
|
4606
|
+
return this.gridview.onDidMaxmizedNodeChange;
|
|
4607
|
+
}
|
|
4323
4608
|
doAddGroup(group, location = [0], size) {
|
|
4324
4609
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
4325
4610
|
this._onDidAddGroup.fire(group);
|
|
@@ -5096,32 +5381,63 @@
|
|
|
5096
5381
|
}
|
|
5097
5382
|
}
|
|
5098
5383
|
|
|
5384
|
+
// TODO find a better way to initialize and avoid needing null checks
|
|
5385
|
+
const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
|
|
5099
5386
|
class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
5100
|
-
get
|
|
5387
|
+
get location() {
|
|
5101
5388
|
if (!this._group) {
|
|
5102
|
-
throw new Error(
|
|
5389
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5103
5390
|
}
|
|
5104
|
-
return this._group.model.
|
|
5391
|
+
return this._group.model.location;
|
|
5105
5392
|
}
|
|
5106
5393
|
constructor(id, accessor) {
|
|
5107
5394
|
super(id);
|
|
5108
5395
|
this.accessor = accessor;
|
|
5109
|
-
this.
|
|
5110
|
-
this.
|
|
5111
|
-
this.addDisposables(this.
|
|
5396
|
+
this._onDidLocationChange = new Emitter();
|
|
5397
|
+
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5398
|
+
this.addDisposables(this._onDidLocationChange);
|
|
5112
5399
|
}
|
|
5113
5400
|
moveTo(options) {
|
|
5114
|
-
var _a;
|
|
5401
|
+
var _a, _b, _c;
|
|
5402
|
+
if (!this._group) {
|
|
5403
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5404
|
+
}
|
|
5405
|
+
const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
|
|
5406
|
+
direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
|
|
5407
|
+
});
|
|
5408
|
+
this.accessor.moveGroupOrPanel(group, this._group.id, undefined, options.group ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center' : 'center');
|
|
5409
|
+
}
|
|
5410
|
+
maximize() {
|
|
5411
|
+
if (!this._group) {
|
|
5412
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5413
|
+
}
|
|
5414
|
+
if (this.location !== 'grid') {
|
|
5415
|
+
// only grid groups can be maximized
|
|
5416
|
+
return;
|
|
5417
|
+
}
|
|
5418
|
+
this.accessor.maximizeGroup(this._group);
|
|
5419
|
+
}
|
|
5420
|
+
isMaximized() {
|
|
5115
5421
|
if (!this._group) {
|
|
5116
|
-
throw new Error(
|
|
5422
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5423
|
+
}
|
|
5424
|
+
return this.accessor.isMaximizedGroup(this._group);
|
|
5425
|
+
}
|
|
5426
|
+
exitMaximized() {
|
|
5427
|
+
if (!this._group) {
|
|
5428
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5429
|
+
}
|
|
5430
|
+
if (this.isMaximized()) {
|
|
5431
|
+
this.accessor.exitMaximizedGroup();
|
|
5117
5432
|
}
|
|
5118
|
-
this.accessor.moveGroupOrPanel(options.group, this._group.id, undefined, (_a = options.position) !== null && _a !== void 0 ? _a : 'center');
|
|
5119
5433
|
}
|
|
5120
5434
|
initialize(group) {
|
|
5121
5435
|
this._group = group;
|
|
5122
5436
|
}
|
|
5123
5437
|
}
|
|
5124
5438
|
|
|
5439
|
+
const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
|
|
5440
|
+
const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
|
|
5125
5441
|
class DockviewGroupPanel extends GridviewPanel {
|
|
5126
5442
|
get panels() {
|
|
5127
5443
|
return this._model.panels;
|
|
@@ -5146,8 +5462,8 @@
|
|
|
5146
5462
|
}
|
|
5147
5463
|
constructor(accessor, id, options) {
|
|
5148
5464
|
super(id, 'groupview_default', {
|
|
5149
|
-
minimumHeight:
|
|
5150
|
-
minimumWidth:
|
|
5465
|
+
minimumHeight: MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
|
|
5466
|
+
minimumWidth: MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
|
|
5151
5467
|
}, new DockviewGroupPanelApiImpl(id, accessor));
|
|
5152
5468
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
5153
5469
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
@@ -5201,8 +5517,10 @@
|
|
|
5201
5517
|
return this.panel.title;
|
|
5202
5518
|
}
|
|
5203
5519
|
get isGroupActive() {
|
|
5204
|
-
|
|
5205
|
-
|
|
5520
|
+
return this.group.isActive;
|
|
5521
|
+
}
|
|
5522
|
+
get renderer() {
|
|
5523
|
+
return this.panel.renderer;
|
|
5206
5524
|
}
|
|
5207
5525
|
set group(value) {
|
|
5208
5526
|
const isOldGroupActive = this.isGroupActive;
|
|
@@ -5230,10 +5548,12 @@
|
|
|
5230
5548
|
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
5231
5549
|
this._onDidGroupChange = new Emitter();
|
|
5232
5550
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
5551
|
+
this._onDidRendererChange = new Emitter();
|
|
5552
|
+
this.onDidRendererChange = this._onDidRendererChange.event;
|
|
5233
5553
|
this.disposable = new MutableDisposable();
|
|
5234
5554
|
this.initialize(panel);
|
|
5235
5555
|
this._group = group;
|
|
5236
|
-
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
5556
|
+
this.addDisposables(this.disposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
5237
5557
|
}
|
|
5238
5558
|
moveTo(options) {
|
|
5239
5559
|
var _a;
|
|
@@ -5242,9 +5562,21 @@
|
|
|
5242
5562
|
setTitle(title) {
|
|
5243
5563
|
this.panel.setTitle(title);
|
|
5244
5564
|
}
|
|
5565
|
+
setRenderer(renderer) {
|
|
5566
|
+
this.panel.setRenderer(renderer);
|
|
5567
|
+
}
|
|
5245
5568
|
close() {
|
|
5246
5569
|
this.group.model.closePanel(this.panel);
|
|
5247
5570
|
}
|
|
5571
|
+
maximize() {
|
|
5572
|
+
this.group.api.maximize();
|
|
5573
|
+
}
|
|
5574
|
+
isMaximized() {
|
|
5575
|
+
return this.group.api.isMaximized();
|
|
5576
|
+
}
|
|
5577
|
+
exitMaximized() {
|
|
5578
|
+
this.group.api.exitMaximized();
|
|
5579
|
+
}
|
|
5248
5580
|
}
|
|
5249
5581
|
|
|
5250
5582
|
class DockviewPanel extends CompositeDisposable {
|
|
@@ -5257,11 +5589,17 @@
|
|
|
5257
5589
|
get group() {
|
|
5258
5590
|
return this._group;
|
|
5259
5591
|
}
|
|
5260
|
-
|
|
5592
|
+
get renderer() {
|
|
5593
|
+
var _a;
|
|
5594
|
+
return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
|
|
5595
|
+
}
|
|
5596
|
+
constructor(id, accessor, containerApi, group, view, options) {
|
|
5261
5597
|
super();
|
|
5262
5598
|
this.id = id;
|
|
5599
|
+
this.accessor = accessor;
|
|
5263
5600
|
this.containerApi = containerApi;
|
|
5264
5601
|
this.view = view;
|
|
5602
|
+
this._renderer = options.renderer;
|
|
5265
5603
|
this._group = group;
|
|
5266
5604
|
this.api = new DockviewPanelApiImpl(this, this._group, accessor);
|
|
5267
5605
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
@@ -5270,6 +5608,8 @@
|
|
|
5270
5608
|
// forward the resize event to the group since if you want to resize a panel
|
|
5271
5609
|
// you are actually just resizing the panels parent which is the group
|
|
5272
5610
|
this.group.api.setSize(event);
|
|
5611
|
+
}), this.api.onDidRendererChange((event) => {
|
|
5612
|
+
this.group.model.rerender(this);
|
|
5273
5613
|
}));
|
|
5274
5614
|
}
|
|
5275
5615
|
init(params) {
|
|
@@ -5289,6 +5629,7 @@
|
|
|
5289
5629
|
? this._params
|
|
5290
5630
|
: undefined,
|
|
5291
5631
|
title: this.title,
|
|
5632
|
+
renderer: this._renderer,
|
|
5292
5633
|
};
|
|
5293
5634
|
}
|
|
5294
5635
|
setTitle(title) {
|
|
@@ -5304,6 +5645,15 @@
|
|
|
5304
5645
|
this.api._onDidTitleChange.fire({ title });
|
|
5305
5646
|
}
|
|
5306
5647
|
}
|
|
5648
|
+
setRenderer(renderer) {
|
|
5649
|
+
const didChange = renderer !== this.renderer;
|
|
5650
|
+
if (didChange) {
|
|
5651
|
+
this._renderer = renderer;
|
|
5652
|
+
this.api._onDidRendererChange.fire({
|
|
5653
|
+
renderer: renderer,
|
|
5654
|
+
});
|
|
5655
|
+
}
|
|
5656
|
+
}
|
|
5307
5657
|
update(event) {
|
|
5308
5658
|
var _a;
|
|
5309
5659
|
// merge the new parameters with the existing parameters
|
|
@@ -5522,8 +5872,8 @@
|
|
|
5522
5872
|
}
|
|
5523
5873
|
|
|
5524
5874
|
class DefaultDockviewDeserialzier {
|
|
5525
|
-
constructor(
|
|
5526
|
-
this.
|
|
5875
|
+
constructor(accessor) {
|
|
5876
|
+
this.accessor = accessor;
|
|
5527
5877
|
}
|
|
5528
5878
|
fromJSON(panelData, group) {
|
|
5529
5879
|
var _a, _b;
|
|
@@ -5537,8 +5887,10 @@
|
|
|
5537
5887
|
const tabComponent = viewData
|
|
5538
5888
|
? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
|
|
5539
5889
|
: panelData.tabComponent;
|
|
5540
|
-
const view = new DockviewPanelModel(this.
|
|
5541
|
-
const panel = new DockviewPanel(panelId, this.
|
|
5890
|
+
const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
|
|
5891
|
+
const panel = new DockviewPanel(panelId, this.accessor, new DockviewApi(this.accessor), group, view, {
|
|
5892
|
+
renderer: panelData.renderer,
|
|
5893
|
+
});
|
|
5542
5894
|
panel.init({
|
|
5543
5895
|
title: title !== null && title !== void 0 ? title : panelId,
|
|
5544
5896
|
params: params !== null && params !== void 0 ? params : {},
|
|
@@ -5918,7 +6270,265 @@
|
|
|
5918
6270
|
}
|
|
5919
6271
|
}
|
|
5920
6272
|
|
|
6273
|
+
class PopoutWindow extends CompositeDisposable {
|
|
6274
|
+
constructor(id, className, options) {
|
|
6275
|
+
super();
|
|
6276
|
+
this.id = id;
|
|
6277
|
+
this.className = className;
|
|
6278
|
+
this.options = options;
|
|
6279
|
+
this._onDidClose = new Emitter();
|
|
6280
|
+
this.onDidClose = this._onDidClose.event;
|
|
6281
|
+
this._window = null;
|
|
6282
|
+
this.addDisposables(this._onDidClose, {
|
|
6283
|
+
dispose: () => {
|
|
6284
|
+
this.close();
|
|
6285
|
+
},
|
|
6286
|
+
});
|
|
6287
|
+
}
|
|
6288
|
+
dimensions() {
|
|
6289
|
+
if (!this._window) {
|
|
6290
|
+
return null;
|
|
6291
|
+
}
|
|
6292
|
+
const left = this._window.value.screenX;
|
|
6293
|
+
const top = this._window.value.screenY;
|
|
6294
|
+
const width = this._window.value.innerWidth;
|
|
6295
|
+
const height = this._window.value.innerHeight;
|
|
6296
|
+
return { top, left, width, height };
|
|
6297
|
+
}
|
|
6298
|
+
close() {
|
|
6299
|
+
if (this._window) {
|
|
6300
|
+
this._window.disposable.dispose();
|
|
6301
|
+
this._window.value.close();
|
|
6302
|
+
this._window = null;
|
|
6303
|
+
}
|
|
6304
|
+
}
|
|
6305
|
+
open(content) {
|
|
6306
|
+
if (this._window) {
|
|
6307
|
+
throw new Error('instance of popout window is already open');
|
|
6308
|
+
}
|
|
6309
|
+
const url = `${this.options.url}`;
|
|
6310
|
+
const features = Object.entries({
|
|
6311
|
+
top: this.options.top,
|
|
6312
|
+
left: this.options.left,
|
|
6313
|
+
width: this.options.width,
|
|
6314
|
+
height: this.options.height,
|
|
6315
|
+
})
|
|
6316
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
6317
|
+
.join(',');
|
|
6318
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6319
|
+
const externalWindow = window.open(url, this.id, features);
|
|
6320
|
+
if (!externalWindow) {
|
|
6321
|
+
return;
|
|
6322
|
+
}
|
|
6323
|
+
const disposable = new CompositeDisposable();
|
|
6324
|
+
this._window = { value: externalWindow, disposable };
|
|
6325
|
+
const cleanUp = () => {
|
|
6326
|
+
this._onDidClose.fire();
|
|
6327
|
+
this._window = null;
|
|
6328
|
+
};
|
|
6329
|
+
// prevent any default content from loading
|
|
6330
|
+
// externalWindow.document.body.replaceWith(document.createElement('div'));
|
|
6331
|
+
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6332
|
+
cleanUp();
|
|
6333
|
+
this.close();
|
|
6334
|
+
}));
|
|
6335
|
+
externalWindow.addEventListener('load', () => {
|
|
6336
|
+
const externalDocument = externalWindow.document;
|
|
6337
|
+
externalDocument.title = document.title;
|
|
6338
|
+
const div = document.createElement('div');
|
|
6339
|
+
div.classList.add('dv-popout-window');
|
|
6340
|
+
div.style.position = 'absolute';
|
|
6341
|
+
div.style.width = '100%';
|
|
6342
|
+
div.style.height = '100%';
|
|
6343
|
+
div.style.top = '0px';
|
|
6344
|
+
div.style.left = '0px';
|
|
6345
|
+
div.classList.add(this.className);
|
|
6346
|
+
div.appendChild(content);
|
|
6347
|
+
externalDocument.body.replaceChildren(div);
|
|
6348
|
+
externalDocument.body.classList.add(this.className);
|
|
6349
|
+
addStyles(externalDocument, window.document.styleSheets);
|
|
6350
|
+
externalWindow.addEventListener('beforeunload', () => {
|
|
6351
|
+
// TODO: indicate external window is closing
|
|
6352
|
+
cleanUp();
|
|
6353
|
+
});
|
|
6354
|
+
});
|
|
6355
|
+
}
|
|
6356
|
+
}
|
|
6357
|
+
|
|
6358
|
+
class DockviewPopoutGroupPanel extends CompositeDisposable {
|
|
6359
|
+
constructor(id, group, options) {
|
|
6360
|
+
var _a;
|
|
6361
|
+
super();
|
|
6362
|
+
this.id = id;
|
|
6363
|
+
this.group = group;
|
|
6364
|
+
this.options = options;
|
|
6365
|
+
this.window = new PopoutWindow(id, (_a = options.className) !== null && _a !== void 0 ? _a : '', {
|
|
6366
|
+
url: this.options.popoutUrl,
|
|
6367
|
+
left: this.options.box.left,
|
|
6368
|
+
top: this.options.box.top,
|
|
6369
|
+
width: this.options.box.width,
|
|
6370
|
+
height: this.options.box.height,
|
|
6371
|
+
});
|
|
6372
|
+
group.model.location = 'popout';
|
|
6373
|
+
this.addDisposables(this.window, {
|
|
6374
|
+
dispose: () => {
|
|
6375
|
+
group.model.location = 'grid';
|
|
6376
|
+
},
|
|
6377
|
+
}, this.window.onDidClose(() => {
|
|
6378
|
+
this.dispose();
|
|
6379
|
+
}));
|
|
6380
|
+
this.window.open(group.element);
|
|
6381
|
+
}
|
|
6382
|
+
}
|
|
6383
|
+
|
|
5921
6384
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6385
|
+
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6386
|
+
|
|
6387
|
+
function createFocusableElement() {
|
|
6388
|
+
const element = document.createElement('div');
|
|
6389
|
+
element.tabIndex = -1;
|
|
6390
|
+
return element;
|
|
6391
|
+
}
|
|
6392
|
+
class OverlayRenderContainer extends CompositeDisposable {
|
|
6393
|
+
constructor(element) {
|
|
6394
|
+
super();
|
|
6395
|
+
this.element = element;
|
|
6396
|
+
this.map = {};
|
|
6397
|
+
this.addDisposables(Disposable.from(() => {
|
|
6398
|
+
for (const value of Object.values(this.map)) {
|
|
6399
|
+
value.disposable.dispose();
|
|
6400
|
+
value.destroy.dispose();
|
|
6401
|
+
}
|
|
6402
|
+
}));
|
|
6403
|
+
}
|
|
6404
|
+
detatch(panel) {
|
|
6405
|
+
if (this.map[panel.api.id]) {
|
|
6406
|
+
const { disposable, destroy } = this.map[panel.api.id];
|
|
6407
|
+
disposable.dispose();
|
|
6408
|
+
destroy.dispose();
|
|
6409
|
+
delete this.map[panel.api.id];
|
|
6410
|
+
return true;
|
|
6411
|
+
}
|
|
6412
|
+
return false;
|
|
6413
|
+
}
|
|
6414
|
+
attach(options) {
|
|
6415
|
+
const { panel, referenceContainer } = options;
|
|
6416
|
+
if (!this.map[panel.api.id]) {
|
|
6417
|
+
const element = createFocusableElement();
|
|
6418
|
+
element.className = 'dv-render-overlay';
|
|
6419
|
+
this.map[panel.api.id] = {
|
|
6420
|
+
panel,
|
|
6421
|
+
disposable: Disposable.NONE,
|
|
6422
|
+
destroy: Disposable.NONE,
|
|
6423
|
+
element,
|
|
6424
|
+
};
|
|
6425
|
+
}
|
|
6426
|
+
const focusContainer = this.map[panel.api.id].element;
|
|
6427
|
+
if (panel.view.content.element.parentElement !== focusContainer) {
|
|
6428
|
+
focusContainer.appendChild(panel.view.content.element);
|
|
6429
|
+
}
|
|
6430
|
+
if (focusContainer.parentElement !== this.element) {
|
|
6431
|
+
this.element.appendChild(focusContainer);
|
|
6432
|
+
}
|
|
6433
|
+
const resize = () => {
|
|
6434
|
+
// TODO propagate position to avoid getDomNodePagePosition calls, possible performance bottleneck?
|
|
6435
|
+
const box = getDomNodePagePosition(referenceContainer.element);
|
|
6436
|
+
const box2 = getDomNodePagePosition(this.element);
|
|
6437
|
+
focusContainer.style.left = `${box.left - box2.left}px`;
|
|
6438
|
+
focusContainer.style.top = `${box.top - box2.top}px`;
|
|
6439
|
+
focusContainer.style.width = `${box.width}px`;
|
|
6440
|
+
focusContainer.style.height = `${box.height}px`;
|
|
6441
|
+
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location === 'floating');
|
|
6442
|
+
};
|
|
6443
|
+
const visibilityChanged = () => {
|
|
6444
|
+
if (panel.api.isVisible) {
|
|
6445
|
+
resize();
|
|
6446
|
+
}
|
|
6447
|
+
focusContainer.style.display = panel.api.isVisible ? '' : 'none';
|
|
6448
|
+
};
|
|
6449
|
+
const disposable = new CompositeDisposable(
|
|
6450
|
+
/**
|
|
6451
|
+
* since container is positioned absoutely we must explicitly forward
|
|
6452
|
+
* the dnd events for the expect behaviours to continue to occur in terms of dnd
|
|
6453
|
+
*
|
|
6454
|
+
* the dnd observer does not need to be conditional on whether the panel is visible since
|
|
6455
|
+
* non-visible panels are 'display: none' and in such case the dnd observer will not fire.
|
|
6456
|
+
*/
|
|
6457
|
+
new DragAndDropObserver(focusContainer, {
|
|
6458
|
+
onDragEnd: (e) => {
|
|
6459
|
+
referenceContainer.dropTarget.dnd.onDragEnd(e);
|
|
6460
|
+
},
|
|
6461
|
+
onDragEnter: (e) => {
|
|
6462
|
+
referenceContainer.dropTarget.dnd.onDragEnter(e);
|
|
6463
|
+
},
|
|
6464
|
+
onDragLeave: (e) => {
|
|
6465
|
+
referenceContainer.dropTarget.dnd.onDragLeave(e);
|
|
6466
|
+
},
|
|
6467
|
+
onDrop: (e) => {
|
|
6468
|
+
referenceContainer.dropTarget.dnd.onDrop(e);
|
|
6469
|
+
},
|
|
6470
|
+
onDragOver: (e) => {
|
|
6471
|
+
referenceContainer.dropTarget.dnd.onDragOver(e);
|
|
6472
|
+
},
|
|
6473
|
+
}), panel.api.onDidVisibilityChange((event) => {
|
|
6474
|
+
/**
|
|
6475
|
+
* Control the visibility of the content, however even when not visible (display: none)
|
|
6476
|
+
* the content is still maintained within the DOM hence DOM specific attributes
|
|
6477
|
+
* such as scroll position are maintained when next made visible.
|
|
6478
|
+
*/
|
|
6479
|
+
visibilityChanged();
|
|
6480
|
+
}), panel.api.onDidDimensionsChange(() => {
|
|
6481
|
+
if (!panel.api.isVisible) {
|
|
6482
|
+
return;
|
|
6483
|
+
}
|
|
6484
|
+
resize();
|
|
6485
|
+
}));
|
|
6486
|
+
this.map[panel.api.id].destroy = Disposable.from(() => {
|
|
6487
|
+
focusContainer.removeChild(panel.view.content.element);
|
|
6488
|
+
this.element.removeChild(focusContainer);
|
|
6489
|
+
});
|
|
6490
|
+
queueMicrotask(() => {
|
|
6491
|
+
if (this.isDisposed) {
|
|
6492
|
+
return;
|
|
6493
|
+
}
|
|
6494
|
+
/**
|
|
6495
|
+
* wait until everything has finished in the current stack-frame call before
|
|
6496
|
+
* calling the first resize as other size-altering events may still occur before
|
|
6497
|
+
* the end of the stack-frame.
|
|
6498
|
+
*/
|
|
6499
|
+
visibilityChanged();
|
|
6500
|
+
});
|
|
6501
|
+
// dispose of logic asoccciated with previous reference-container
|
|
6502
|
+
this.map[panel.api.id].disposable.dispose();
|
|
6503
|
+
// and reset the disposable to the active reference-container
|
|
6504
|
+
this.map[panel.api.id].disposable = disposable;
|
|
6505
|
+
return focusContainer;
|
|
6506
|
+
}
|
|
6507
|
+
}
|
|
6508
|
+
|
|
6509
|
+
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
6510
|
+
activationSize: { type: 'pixels', value: 10 },
|
|
6511
|
+
size: { type: 'pixels', value: 20 },
|
|
6512
|
+
};
|
|
6513
|
+
function getTheme(element) {
|
|
6514
|
+
function toClassList(element) {
|
|
6515
|
+
const list = [];
|
|
6516
|
+
for (let i = 0; i < element.classList.length; i++) {
|
|
6517
|
+
list.push(element.classList.item(i));
|
|
6518
|
+
}
|
|
6519
|
+
return list;
|
|
6520
|
+
}
|
|
6521
|
+
let theme = undefined;
|
|
6522
|
+
let parent = element;
|
|
6523
|
+
while (parent !== null) {
|
|
6524
|
+
theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
|
|
6525
|
+
if (typeof theme === 'string') {
|
|
6526
|
+
break;
|
|
6527
|
+
}
|
|
6528
|
+
parent = parent.parentElement;
|
|
6529
|
+
}
|
|
6530
|
+
return theme;
|
|
6531
|
+
}
|
|
5922
6532
|
class DockviewComponent extends BaseGrid {
|
|
5923
6533
|
get orientation() {
|
|
5924
6534
|
return this.gridview.orientation;
|
|
@@ -5939,8 +6549,12 @@
|
|
|
5939
6549
|
}
|
|
5940
6550
|
return activeGroup.activePanel;
|
|
5941
6551
|
}
|
|
5942
|
-
|
|
6552
|
+
get renderer() {
|
|
5943
6553
|
var _a;
|
|
6554
|
+
return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisibile';
|
|
6555
|
+
}
|
|
6556
|
+
constructor(options) {
|
|
6557
|
+
var _a, _b;
|
|
5944
6558
|
super({
|
|
5945
6559
|
proportionalLayout: true,
|
|
5946
6560
|
orientation: (_a = options.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
|
|
@@ -5965,12 +6579,27 @@
|
|
|
5965
6579
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
5966
6580
|
this._onDidActivePanelChange = new Emitter();
|
|
5967
6581
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
5968
|
-
this.
|
|
6582
|
+
this._floatingGroups = [];
|
|
6583
|
+
this._popoutGroups = [];
|
|
6584
|
+
const gready = document.createElement('div');
|
|
6585
|
+
gready.className = 'dv-overlay-render-container';
|
|
6586
|
+
this.gridview.element.appendChild(gready);
|
|
6587
|
+
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
5969
6588
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
5970
|
-
|
|
6589
|
+
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
6590
|
+
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
|
|
5971
6591
|
this.updateWatermark();
|
|
5972
6592
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
5973
6593
|
this._bufferOnDidLayoutChange.fire();
|
|
6594
|
+
}), Disposable.from(() => {
|
|
6595
|
+
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6596
|
+
for (const group of [...this._floatingGroups]) {
|
|
6597
|
+
group.dispose();
|
|
6598
|
+
}
|
|
6599
|
+
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6600
|
+
for (const group of [...this._popoutGroups]) {
|
|
6601
|
+
group.dispose();
|
|
6602
|
+
}
|
|
5974
6603
|
}));
|
|
5975
6604
|
this._options = options;
|
|
5976
6605
|
if (!this.options.components) {
|
|
@@ -5989,7 +6618,7 @@
|
|
|
5989
6618
|
!this.options.watermarkFrameworkComponent) {
|
|
5990
6619
|
this.options.watermarkComponent = Watermark;
|
|
5991
6620
|
}
|
|
5992
|
-
|
|
6621
|
+
this._rootDropTarget = new Droptarget(this.element, {
|
|
5993
6622
|
canDisplayOverlay: (event, position) => {
|
|
5994
6623
|
const data = getPanelData();
|
|
5995
6624
|
if (data) {
|
|
@@ -6022,12 +6651,9 @@
|
|
|
6022
6651
|
return false;
|
|
6023
6652
|
},
|
|
6024
6653
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
6025
|
-
overlayModel:
|
|
6026
|
-
activationSize: { type: 'pixels', value: 10 },
|
|
6027
|
-
size: { type: 'pixels', value: 20 },
|
|
6028
|
-
},
|
|
6654
|
+
overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
6029
6655
|
});
|
|
6030
|
-
this.addDisposables(
|
|
6656
|
+
this.addDisposables(this._rootDropTarget.onDrop((event) => {
|
|
6031
6657
|
var _a;
|
|
6032
6658
|
const data = getPanelData();
|
|
6033
6659
|
if (data) {
|
|
@@ -6036,10 +6662,59 @@
|
|
|
6036
6662
|
else {
|
|
6037
6663
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
6038
6664
|
}
|
|
6039
|
-
}),
|
|
6665
|
+
}), this._rootDropTarget);
|
|
6040
6666
|
this._api = new DockviewApi(this);
|
|
6041
6667
|
this.updateWatermark();
|
|
6042
6668
|
}
|
|
6669
|
+
addPopoutGroup(item, options) {
|
|
6670
|
+
var _a;
|
|
6671
|
+
let group;
|
|
6672
|
+
let box = options === null || options === void 0 ? void 0 : options.position;
|
|
6673
|
+
if (item instanceof DockviewPanel) {
|
|
6674
|
+
group = this.createGroup();
|
|
6675
|
+
this.removePanel(item, {
|
|
6676
|
+
removeEmptyGroup: true,
|
|
6677
|
+
skipDispose: true,
|
|
6678
|
+
});
|
|
6679
|
+
group.model.openPanel(item);
|
|
6680
|
+
if (!box) {
|
|
6681
|
+
box = this.element.getBoundingClientRect();
|
|
6682
|
+
}
|
|
6683
|
+
}
|
|
6684
|
+
else {
|
|
6685
|
+
group = item;
|
|
6686
|
+
if (!box) {
|
|
6687
|
+
box = group.element.getBoundingClientRect();
|
|
6688
|
+
}
|
|
6689
|
+
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
6690
|
+
options.skipRemoveGroup;
|
|
6691
|
+
if (!skip) {
|
|
6692
|
+
this.doRemoveGroup(item, { skipDispose: true });
|
|
6693
|
+
}
|
|
6694
|
+
}
|
|
6695
|
+
const theme = getTheme(this.gridview.element);
|
|
6696
|
+
const popoutWindow = new DockviewPopoutGroupPanel(`${this.id}-${group.id}`, // globally unique within dockview
|
|
6697
|
+
group, {
|
|
6698
|
+
className: theme !== null && theme !== void 0 ? theme : '',
|
|
6699
|
+
popoutUrl: (_a = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _a !== void 0 ? _a : '/popout.html',
|
|
6700
|
+
box: {
|
|
6701
|
+
left: window.screenX + box.left,
|
|
6702
|
+
top: window.screenY + box.top,
|
|
6703
|
+
width: box.width,
|
|
6704
|
+
height: box.height,
|
|
6705
|
+
},
|
|
6706
|
+
});
|
|
6707
|
+
popoutWindow.addDisposables({
|
|
6708
|
+
dispose: () => {
|
|
6709
|
+
remove(this._popoutGroups, popoutWindow);
|
|
6710
|
+
this.updateWatermark();
|
|
6711
|
+
},
|
|
6712
|
+
}, popoutWindow.window.onDidClose(() => {
|
|
6713
|
+
this.doAddGroup(group, [0]);
|
|
6714
|
+
}));
|
|
6715
|
+
this._popoutGroups.push(popoutWindow);
|
|
6716
|
+
this.updateWatermark();
|
|
6717
|
+
}
|
|
6043
6718
|
addFloatingGroup(item, coord, options) {
|
|
6044
6719
|
var _a, _b, _c, _d, _e, _f;
|
|
6045
6720
|
let group;
|
|
@@ -6059,9 +6734,13 @@
|
|
|
6059
6734
|
this.doRemoveGroup(item, { skipDispose: true });
|
|
6060
6735
|
}
|
|
6061
6736
|
}
|
|
6062
|
-
group.model.
|
|
6063
|
-
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6064
|
-
|
|
6737
|
+
group.model.location = 'floating';
|
|
6738
|
+
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6739
|
+
? Math.max(coord.x, 0)
|
|
6740
|
+
: DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
6741
|
+
const overlayTop = typeof (coord === null || coord === void 0 ? void 0 : coord.y) === 'number'
|
|
6742
|
+
? Math.max(coord.y, 0)
|
|
6743
|
+
: DEFAULT_FLOATING_GROUP_POSITION.top;
|
|
6065
6744
|
const overlay = new Overlay({
|
|
6066
6745
|
container: this.gridview.element,
|
|
6067
6746
|
content: group.element,
|
|
@@ -6105,12 +6784,12 @@
|
|
|
6105
6784
|
}), {
|
|
6106
6785
|
dispose: () => {
|
|
6107
6786
|
disposable.dispose();
|
|
6108
|
-
group.model.
|
|
6109
|
-
remove(this.
|
|
6787
|
+
group.model.location = 'grid';
|
|
6788
|
+
remove(this._floatingGroups, floatingGroupPanel);
|
|
6110
6789
|
this.updateWatermark();
|
|
6111
6790
|
},
|
|
6112
6791
|
});
|
|
6113
|
-
this.
|
|
6792
|
+
this._floatingGroups.push(floatingGroupPanel);
|
|
6114
6793
|
this.updateWatermark();
|
|
6115
6794
|
}
|
|
6116
6795
|
orthogonalize(position) {
|
|
@@ -6146,16 +6825,18 @@
|
|
|
6146
6825
|
}
|
|
6147
6826
|
updateOptions(options) {
|
|
6148
6827
|
var _a, _b;
|
|
6149
|
-
const
|
|
6828
|
+
const changed_orientation = typeof options.orientation === 'string' &&
|
|
6150
6829
|
this.gridview.orientation !== options.orientation;
|
|
6151
|
-
const
|
|
6830
|
+
const changed_floatingGroupBounds = options.floatingGroupBounds !== undefined &&
|
|
6152
6831
|
options.floatingGroupBounds !== this.options.floatingGroupBounds;
|
|
6832
|
+
const changed_rootOverlayOptions = options.rootOverlayModel !== undefined &&
|
|
6833
|
+
options.rootOverlayModel !== this.options.rootOverlayModel;
|
|
6153
6834
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
6154
|
-
if (
|
|
6835
|
+
if (changed_orientation) {
|
|
6155
6836
|
this.gridview.orientation = options.orientation;
|
|
6156
6837
|
}
|
|
6157
|
-
if (
|
|
6158
|
-
for (const group of this.
|
|
6838
|
+
if (changed_floatingGroupBounds) {
|
|
6839
|
+
for (const group of this._floatingGroups) {
|
|
6159
6840
|
switch (this.options.floatingGroupBounds) {
|
|
6160
6841
|
case 'boundedWithinViewport':
|
|
6161
6842
|
group.overlay.minimumInViewportHeight = undefined;
|
|
@@ -6176,12 +6857,15 @@
|
|
|
6176
6857
|
group.overlay.setBounds({});
|
|
6177
6858
|
}
|
|
6178
6859
|
}
|
|
6860
|
+
if (changed_rootOverlayOptions) {
|
|
6861
|
+
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
6862
|
+
}
|
|
6179
6863
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
6180
6864
|
}
|
|
6181
6865
|
layout(width, height, forceResize) {
|
|
6182
6866
|
super.layout(width, height, forceResize);
|
|
6183
|
-
if (this.
|
|
6184
|
-
for (const floating of this.
|
|
6867
|
+
if (this._floatingGroups) {
|
|
6868
|
+
for (const floating of this._floatingGroups) {
|
|
6185
6869
|
// ensure floting groups stay within visible boundaries
|
|
6186
6870
|
floating.overlay.setBounds();
|
|
6187
6871
|
}
|
|
@@ -6249,10 +6933,16 @@
|
|
|
6249
6933
|
collection[panel.id] = panel.toJSON();
|
|
6250
6934
|
return collection;
|
|
6251
6935
|
}, {});
|
|
6252
|
-
const floats = this.
|
|
6936
|
+
const floats = this._floatingGroups.map((group) => {
|
|
6253
6937
|
return {
|
|
6254
|
-
data:
|
|
6255
|
-
position:
|
|
6938
|
+
data: group.group.toJSON(),
|
|
6939
|
+
position: group.overlay.toJSON(),
|
|
6940
|
+
};
|
|
6941
|
+
});
|
|
6942
|
+
const popoutGroups = this._popoutGroups.map((group) => {
|
|
6943
|
+
return {
|
|
6944
|
+
data: group.group.toJSON(),
|
|
6945
|
+
position: group.window.dimensions(),
|
|
6256
6946
|
};
|
|
6257
6947
|
});
|
|
6258
6948
|
const result = {
|
|
@@ -6263,10 +6953,13 @@
|
|
|
6263
6953
|
if (floats.length > 0) {
|
|
6264
6954
|
result.floatingGroups = floats;
|
|
6265
6955
|
}
|
|
6956
|
+
if (popoutGroups.length > 0) {
|
|
6957
|
+
result.popoutGroups = popoutGroups;
|
|
6958
|
+
}
|
|
6266
6959
|
return result;
|
|
6267
6960
|
}
|
|
6268
6961
|
fromJSON(data) {
|
|
6269
|
-
var _a;
|
|
6962
|
+
var _a, _b;
|
|
6270
6963
|
this.clear();
|
|
6271
6964
|
if (typeof data !== 'object' || data === null) {
|
|
6272
6965
|
throw new Error('serialized layout must be a non-null object');
|
|
@@ -6333,7 +7026,16 @@
|
|
|
6333
7026
|
width: position.width,
|
|
6334
7027
|
}, { skipRemoveGroup: true, inDragMode: false });
|
|
6335
7028
|
}
|
|
6336
|
-
|
|
7029
|
+
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7030
|
+
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
7031
|
+
const { data, position } = serializedPopoutGroup;
|
|
7032
|
+
const group = createGroupFromSerializedState(data);
|
|
7033
|
+
this.addPopoutGroup(group, {
|
|
7034
|
+
skipRemoveGroup: true,
|
|
7035
|
+
position: position !== null && position !== void 0 ? position : undefined,
|
|
7036
|
+
});
|
|
7037
|
+
}
|
|
7038
|
+
for (const floatingGroup of this._floatingGroups) {
|
|
6337
7039
|
floatingGroup.overlay.setBounds();
|
|
6338
7040
|
}
|
|
6339
7041
|
if (typeof activeGroup === 'string') {
|
|
@@ -6365,7 +7067,7 @@
|
|
|
6365
7067
|
this._onDidRemoveGroup.fire(group);
|
|
6366
7068
|
}
|
|
6367
7069
|
// iterate over a reassigned array since original array will be modified
|
|
6368
|
-
for (const floatingGroup of [...this.
|
|
7070
|
+
for (const floatingGroup of [...this._floatingGroups]) {
|
|
6369
7071
|
floatingGroup.dispose();
|
|
6370
7072
|
}
|
|
6371
7073
|
// fires clean-up events and clears the underlying HTML gridview.
|
|
@@ -6457,7 +7159,8 @@
|
|
|
6457
7159
|
group.model.openPanel(panel);
|
|
6458
7160
|
this.doSetGroupAndPanelActive(group);
|
|
6459
7161
|
}
|
|
6460
|
-
else if (referenceGroup.api.
|
|
7162
|
+
else if (referenceGroup.api.location === 'floating' ||
|
|
7163
|
+
target === 'center') {
|
|
6461
7164
|
panel = this.createPanel(options, referenceGroup);
|
|
6462
7165
|
referenceGroup.model.openPanel(panel);
|
|
6463
7166
|
}
|
|
@@ -6501,6 +7204,7 @@
|
|
|
6501
7204
|
}
|
|
6502
7205
|
group.model.removePanel(panel);
|
|
6503
7206
|
if (!options.skipDispose) {
|
|
7207
|
+
this.overlayRenderContainer.detatch(panel);
|
|
6504
7208
|
panel.dispose();
|
|
6505
7209
|
}
|
|
6506
7210
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
@@ -6517,7 +7221,7 @@
|
|
|
6517
7221
|
}
|
|
6518
7222
|
updateWatermark() {
|
|
6519
7223
|
var _a, _b;
|
|
6520
|
-
if (this.groups.filter((x) =>
|
|
7224
|
+
if (this.groups.filter((x) => x.api.location === 'grid').length === 0) {
|
|
6521
7225
|
if (!this.watermark) {
|
|
6522
7226
|
this.watermark = this.createWatermarkComponent();
|
|
6523
7227
|
this.watermark.init({
|
|
@@ -6592,19 +7296,40 @@
|
|
|
6592
7296
|
}
|
|
6593
7297
|
}
|
|
6594
7298
|
doRemoveGroup(group, options) {
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
if (
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
7299
|
+
if (group.api.location === 'floating') {
|
|
7300
|
+
const floatingGroup = this._floatingGroups.find((_) => _.group === group);
|
|
7301
|
+
if (floatingGroup) {
|
|
7302
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7303
|
+
floatingGroup.group.dispose();
|
|
7304
|
+
this._groups.delete(group.id);
|
|
7305
|
+
this._onDidRemoveGroup.fire(group);
|
|
7306
|
+
}
|
|
7307
|
+
remove(this._floatingGroups, floatingGroup);
|
|
7308
|
+
floatingGroup.dispose();
|
|
7309
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7310
|
+
const groups = Array.from(this._groups.values());
|
|
7311
|
+
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7312
|
+
}
|
|
7313
|
+
return floatingGroup.group;
|
|
6601
7314
|
}
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
7315
|
+
throw new Error('failed to find floating group');
|
|
7316
|
+
}
|
|
7317
|
+
if (group.api.location === 'popout') {
|
|
7318
|
+
const selectedGroup = this._popoutGroups.find((_) => _.group === group);
|
|
7319
|
+
if (selectedGroup) {
|
|
7320
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7321
|
+
selectedGroup.group.dispose();
|
|
7322
|
+
this._groups.delete(group.id);
|
|
7323
|
+
this._onDidRemoveGroup.fire(group);
|
|
7324
|
+
}
|
|
7325
|
+
selectedGroup.dispose();
|
|
7326
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7327
|
+
const groups = Array.from(this._groups.values());
|
|
7328
|
+
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7329
|
+
}
|
|
7330
|
+
return selectedGroup.group;
|
|
6606
7331
|
}
|
|
6607
|
-
|
|
7332
|
+
throw new Error('failed to find popout group');
|
|
6608
7333
|
}
|
|
6609
7334
|
return super.doRemoveGroup(group, options);
|
|
6610
7335
|
}
|
|
@@ -6636,8 +7361,7 @@
|
|
|
6636
7361
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
6637
7362
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
6638
7363
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
6639
|
-
|
|
6640
|
-
if (!isFloating) {
|
|
7364
|
+
if (sourceGroup.api.location === 'grid') {
|
|
6641
7365
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
6642
7366
|
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
6643
7367
|
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
@@ -6683,12 +7407,25 @@
|
|
|
6683
7407
|
}
|
|
6684
7408
|
}
|
|
6685
7409
|
else {
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
7410
|
+
switch (sourceGroup.api.location) {
|
|
7411
|
+
case 'grid':
|
|
7412
|
+
this.gridview.removeView(getGridLocation(sourceGroup.element));
|
|
7413
|
+
break;
|
|
7414
|
+
case 'floating': {
|
|
7415
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === sourceGroup);
|
|
7416
|
+
if (!selectedFloatingGroup) {
|
|
7417
|
+
throw new Error('failed to find floating group');
|
|
7418
|
+
}
|
|
7419
|
+
selectedFloatingGroup.dispose();
|
|
7420
|
+
break;
|
|
7421
|
+
}
|
|
7422
|
+
case 'popout': {
|
|
7423
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.group === sourceGroup);
|
|
7424
|
+
if (!selectedPopoutGroup) {
|
|
7425
|
+
throw new Error('failed to find popout group');
|
|
7426
|
+
}
|
|
7427
|
+
selectedPopoutGroup.dispose();
|
|
7428
|
+
}
|
|
6692
7429
|
}
|
|
6693
7430
|
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
6694
7431
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
@@ -6750,7 +7487,7 @@
|
|
|
6750
7487
|
const contentComponent = options.component;
|
|
6751
7488
|
const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
|
|
6752
7489
|
const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
|
|
6753
|
-
const panel = new DockviewPanel(options.id, this, this._api, group, view);
|
|
7490
|
+
const panel = new DockviewPanel(options.id, this, this._api, group, view, { renderer: options.renderer });
|
|
6754
7491
|
panel.init({
|
|
6755
7492
|
title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
|
|
6756
7493
|
params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
|