dockview-core 1.8.5 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +2 -0
- package/dist/cjs/dnd/droptarget.d.ts.map +1 -1
- package/dist/cjs/dnd/droptarget.js +3 -2
- 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 +21 -9
- package/dist/cjs/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.js +287 -103
- 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 +5 -0
- 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 +2 -1
- 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.js +1 -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 +896 -170
- 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 +895 -169
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +896 -170
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +896 -170
- 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 +896 -170
- 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 +895 -169
- 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 +2 -0
- package/dist/esm/dnd/droptarget.d.ts.map +1 -1
- package/dist/esm/dnd/droptarget.js +3 -2
- 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 +21 -9
- package/dist/esm/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewComponent.js +188 -42
- 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 +5 -0
- 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 +2 -1
- 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.js +2 -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 +33 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.9.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -232,6 +232,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
232
232
|
// noop
|
|
233
233
|
},
|
|
234
234
|
};
|
|
235
|
+
function from(func) {
|
|
236
|
+
return {
|
|
237
|
+
dispose: () => {
|
|
238
|
+
func();
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
Disposable.from = from;
|
|
235
243
|
})(Disposable || (Disposable = {}));
|
|
236
244
|
class CompositeDisposable {
|
|
237
245
|
get isDisposed() {
|
|
@@ -416,6 +424,61 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
416
424
|
function quasiDefaultPrevented(event) {
|
|
417
425
|
return event[QUASI_PREVENT_DEFAULT_KEY];
|
|
418
426
|
}
|
|
427
|
+
function addStyles(document, styleSheetList) {
|
|
428
|
+
const styleSheets = Array.from(styleSheetList);
|
|
429
|
+
for (const styleSheet of styleSheets) {
|
|
430
|
+
if (styleSheet.href) {
|
|
431
|
+
const link = document.createElement('link');
|
|
432
|
+
link.href = styleSheet.href;
|
|
433
|
+
link.type = styleSheet.type;
|
|
434
|
+
link.rel = 'stylesheet';
|
|
435
|
+
document.head.appendChild(link);
|
|
436
|
+
}
|
|
437
|
+
let cssTexts = [];
|
|
438
|
+
try {
|
|
439
|
+
if (styleSheet.cssRules) {
|
|
440
|
+
cssTexts = Array.from(styleSheet.cssRules).map((rule) => rule.cssText);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
catch (err) {
|
|
444
|
+
// security errors (lack of permissions), ignore
|
|
445
|
+
}
|
|
446
|
+
for (const rule of cssTexts) {
|
|
447
|
+
const style = document.createElement('style');
|
|
448
|
+
style.appendChild(document.createTextNode(rule));
|
|
449
|
+
document.head.appendChild(style);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
function getDomNodePagePosition(domNode) {
|
|
454
|
+
const { left, top, width, height } = domNode.getBoundingClientRect();
|
|
455
|
+
return {
|
|
456
|
+
left: left + window.scrollX,
|
|
457
|
+
top: top + window.scrollY,
|
|
458
|
+
width: width,
|
|
459
|
+
height: height,
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Check whether an element is in the DOM (including the Shadow DOM)
|
|
464
|
+
* @see https://terodox.tech/how-to-tell-if-an-element-is-in-the-dom-including-the-shadow-dom/
|
|
465
|
+
*/
|
|
466
|
+
function isInDocument(element) {
|
|
467
|
+
let currentElement = element;
|
|
468
|
+
while (currentElement === null || currentElement === void 0 ? void 0 : currentElement.parentNode) {
|
|
469
|
+
if (currentElement.parentNode === document) {
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
else if (currentElement.parentNode instanceof DocumentFragment) {
|
|
473
|
+
// handle shadow DOMs
|
|
474
|
+
currentElement = currentElement.parentNode.host;
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
currentElement = currentElement.parentNode;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
419
482
|
|
|
420
483
|
function tail(arr) {
|
|
421
484
|
if (arr.length === 0) {
|
|
@@ -613,6 +676,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
613
676
|
Sizing.Invisible = Invisible;
|
|
614
677
|
})(exports.Sizing || (exports.Sizing = {}));
|
|
615
678
|
class Splitview {
|
|
679
|
+
get contentSize() {
|
|
680
|
+
return this._contentSize;
|
|
681
|
+
}
|
|
616
682
|
get size() {
|
|
617
683
|
return this._size;
|
|
618
684
|
}
|
|
@@ -678,7 +744,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
678
744
|
this.sashes = [];
|
|
679
745
|
this._size = 0;
|
|
680
746
|
this._orthogonalSize = 0;
|
|
681
|
-
this.
|
|
747
|
+
this._contentSize = 0;
|
|
682
748
|
this._proportions = undefined;
|
|
683
749
|
this._startSnappingEnabled = true;
|
|
684
750
|
this._endSnappingEnabled = true;
|
|
@@ -797,7 +863,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
797
863
|
);
|
|
798
864
|
});
|
|
799
865
|
// Initialize content size and proportions for first layout
|
|
800
|
-
this.
|
|
866
|
+
this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
801
867
|
this.saveProportions();
|
|
802
868
|
}
|
|
803
869
|
}
|
|
@@ -1071,7 +1137,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1071
1137
|
this.addView(view, sizing, to);
|
|
1072
1138
|
}
|
|
1073
1139
|
layout(size, orthogonalSize) {
|
|
1074
|
-
const previousSize = Math.max(this.size, this.
|
|
1140
|
+
const previousSize = Math.max(this.size, this._contentSize);
|
|
1075
1141
|
this.size = size;
|
|
1076
1142
|
this.orthogonalSize = orthogonalSize;
|
|
1077
1143
|
if (!this.proportions) {
|
|
@@ -1081,9 +1147,23 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1081
1147
|
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1082
1148
|
}
|
|
1083
1149
|
else {
|
|
1150
|
+
let total = 0;
|
|
1151
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1152
|
+
const item = this.viewItems[i];
|
|
1153
|
+
const proportion = this.proportions[i];
|
|
1154
|
+
if (typeof proportion === 'number') {
|
|
1155
|
+
total += proportion;
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
size -= item.size;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1084
1161
|
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1085
1162
|
const item = this.viewItems[i];
|
|
1086
|
-
|
|
1163
|
+
const proportion = this.proportions[i];
|
|
1164
|
+
if (typeof proportion === 'number' && total > 0) {
|
|
1165
|
+
item.size = clamp(Math.round((proportion * size) / total), item.minimumSize, item.maximumSize);
|
|
1166
|
+
}
|
|
1087
1167
|
}
|
|
1088
1168
|
}
|
|
1089
1169
|
this.distributeEmptySpace();
|
|
@@ -1120,12 +1200,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1120
1200
|
}
|
|
1121
1201
|
}
|
|
1122
1202
|
saveProportions() {
|
|
1123
|
-
if (this.proportionalLayout && this.
|
|
1124
|
-
this._proportions = this.viewItems.map((i) => i.size / this.
|
|
1203
|
+
if (this.proportionalLayout && this._contentSize > 0) {
|
|
1204
|
+
this._proportions = this.viewItems.map((i) => i.visible ? i.size / this._contentSize : undefined);
|
|
1125
1205
|
}
|
|
1126
1206
|
}
|
|
1127
1207
|
layoutViews() {
|
|
1128
|
-
this.
|
|
1208
|
+
this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1129
1209
|
let sum = 0;
|
|
1130
1210
|
const x = [];
|
|
1131
1211
|
this.updateSashEnablement();
|
|
@@ -1219,7 +1299,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1219
1299
|
}
|
|
1220
1300
|
else if (snappedAfter &&
|
|
1221
1301
|
collapsesDown[index] &&
|
|
1222
|
-
(position < this.
|
|
1302
|
+
(position < this._contentSize || this.endSnappingEnabled)) {
|
|
1223
1303
|
this.updateSash(sash, exports.SashState.MAXIMUM);
|
|
1224
1304
|
}
|
|
1225
1305
|
else {
|
|
@@ -1508,7 +1588,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1508
1588
|
setVisible(visible) {
|
|
1509
1589
|
if (this.view.setVisible) {
|
|
1510
1590
|
this.view.setVisible(visible);
|
|
1511
|
-
this._onDidChange.fire({});
|
|
1512
1591
|
}
|
|
1513
1592
|
}
|
|
1514
1593
|
layout(size, orthogonalSize) {
|
|
@@ -1540,10 +1619,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1540
1619
|
get minimumSize() {
|
|
1541
1620
|
return this.children.length === 0
|
|
1542
1621
|
? 0
|
|
1543
|
-
: Math.max(...this.children.map((c) =>
|
|
1622
|
+
: Math.max(...this.children.map((c, index) => this.splitview.isViewVisible(index)
|
|
1623
|
+
? c.minimumOrthogonalSize
|
|
1624
|
+
: 0));
|
|
1544
1625
|
}
|
|
1545
1626
|
get maximumSize() {
|
|
1546
|
-
return Math.min(...this.children.map((c) =>
|
|
1627
|
+
return Math.min(...this.children.map((c, index) => this.splitview.isViewVisible(index)
|
|
1628
|
+
? c.maximumOrthogonalSize
|
|
1629
|
+
: Number.POSITIVE_INFINITY));
|
|
1547
1630
|
}
|
|
1548
1631
|
get minimumOrthogonalSize() {
|
|
1549
1632
|
return this.splitview.minimumSize;
|
|
@@ -1601,6 +1684,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1601
1684
|
this.children = [];
|
|
1602
1685
|
this._onDidChange = new Emitter();
|
|
1603
1686
|
this.onDidChange = this._onDidChange.event;
|
|
1687
|
+
this._onDidVisibilityChange = new Emitter();
|
|
1688
|
+
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
1604
1689
|
this._orthogonalSize = orthogonalSize;
|
|
1605
1690
|
this._size = size;
|
|
1606
1691
|
this.element = document.createElement('div');
|
|
@@ -1635,7 +1720,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1635
1720
|
styles,
|
|
1636
1721
|
});
|
|
1637
1722
|
}
|
|
1638
|
-
this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
|
|
1723
|
+
this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {
|
|
1639
1724
|
this._onDidChange.fire({});
|
|
1640
1725
|
}));
|
|
1641
1726
|
this.setupChildrenEvents();
|
|
@@ -1658,7 +1743,15 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1658
1743
|
if (this.splitview.isViewVisible(index) === visible) {
|
|
1659
1744
|
return;
|
|
1660
1745
|
}
|
|
1746
|
+
const wereAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1661
1747
|
this.splitview.setViewVisible(index, visible);
|
|
1748
|
+
const areAllChildrenHidden = this.splitview.contentSize === 0;
|
|
1749
|
+
// If all children are hidden then the parent should hide the entire splitview
|
|
1750
|
+
// If the entire splitview is hidden then the parent should show the splitview when a child is shown
|
|
1751
|
+
if ((visible && wereAllChildrenHidden) ||
|
|
1752
|
+
(!visible && areAllChildrenHidden)) {
|
|
1753
|
+
this._onDidVisibilityChange.fire(visible);
|
|
1754
|
+
}
|
|
1662
1755
|
}
|
|
1663
1756
|
moveChild(from, to) {
|
|
1664
1757
|
if (from === to) {
|
|
@@ -1722,13 +1815,20 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1722
1815
|
}
|
|
1723
1816
|
setupChildrenEvents() {
|
|
1724
1817
|
this._childrenDisposable.dispose();
|
|
1725
|
-
this._childrenDisposable = exports.DockviewEvent.any(...this.children.map((c) => c.onDidChange))((e) => {
|
|
1818
|
+
this._childrenDisposable = new CompositeDisposable(exports.DockviewEvent.any(...this.children.map((c) => c.onDidChange))((e) => {
|
|
1726
1819
|
/**
|
|
1727
1820
|
* indicate a change has occured to allows any re-rendering but don't bubble
|
|
1728
1821
|
* event because that was specific to this branch
|
|
1729
1822
|
*/
|
|
1730
1823
|
this._onDidChange.fire({ size: e.orthogonalSize });
|
|
1731
|
-
})
|
|
1824
|
+
}), ...this.children.map((c, i) => {
|
|
1825
|
+
if (c instanceof BranchNode) {
|
|
1826
|
+
return c.onDidVisibilityChange((visible) => {
|
|
1827
|
+
this.setChildVisible(i, visible);
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
return Disposable.NONE;
|
|
1831
|
+
}));
|
|
1732
1832
|
}
|
|
1733
1833
|
dispose() {
|
|
1734
1834
|
this._childrenDisposable.dispose();
|
|
@@ -1889,7 +1989,69 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1889
1989
|
get maximumHeight() {
|
|
1890
1990
|
return this.root.maximumHeight;
|
|
1891
1991
|
}
|
|
1992
|
+
maximizedView() {
|
|
1993
|
+
var _a;
|
|
1994
|
+
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.view;
|
|
1995
|
+
}
|
|
1996
|
+
hasMaximizedView() {
|
|
1997
|
+
return this._maximizedNode !== undefined;
|
|
1998
|
+
}
|
|
1999
|
+
maximizeView(view) {
|
|
2000
|
+
const location = getGridLocation(view.element);
|
|
2001
|
+
const [_, node] = this.getNode(location);
|
|
2002
|
+
if (!(node instanceof LeafNode)) {
|
|
2003
|
+
return;
|
|
2004
|
+
}
|
|
2005
|
+
if (this._maximizedNode === node) {
|
|
2006
|
+
return;
|
|
2007
|
+
}
|
|
2008
|
+
if (this.hasMaximizedView()) {
|
|
2009
|
+
this.exitMaximizedView();
|
|
2010
|
+
}
|
|
2011
|
+
function hideAllViewsBut(parent, exclude) {
|
|
2012
|
+
for (let i = 0; i < parent.children.length; i++) {
|
|
2013
|
+
const child = parent.children[i];
|
|
2014
|
+
if (child instanceof LeafNode) {
|
|
2015
|
+
if (child !== exclude) {
|
|
2016
|
+
parent.setChildVisible(i, false);
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
else {
|
|
2020
|
+
hideAllViewsBut(child, exclude);
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
hideAllViewsBut(this.root, node);
|
|
2025
|
+
this._maximizedNode = node;
|
|
2026
|
+
this._onDidMaxmizedNodeChange.fire();
|
|
2027
|
+
}
|
|
2028
|
+
exitMaximizedView() {
|
|
2029
|
+
if (!this._maximizedNode) {
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
function showViewsInReverseOrder(parent) {
|
|
2033
|
+
for (let index = parent.children.length - 1; index >= 0; index--) {
|
|
2034
|
+
const child = parent.children[index];
|
|
2035
|
+
if (child instanceof LeafNode) {
|
|
2036
|
+
parent.setChildVisible(index, true);
|
|
2037
|
+
}
|
|
2038
|
+
else {
|
|
2039
|
+
showViewsInReverseOrder(child);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
showViewsInReverseOrder(this.root);
|
|
2044
|
+
this._maximizedNode = undefined;
|
|
2045
|
+
this._onDidMaxmizedNodeChange.fire();
|
|
2046
|
+
}
|
|
1892
2047
|
serialize() {
|
|
2048
|
+
if (this.hasMaximizedView()) {
|
|
2049
|
+
/**
|
|
2050
|
+
* do not persist maximized view state but we must first exit any maximized views
|
|
2051
|
+
* before serialization to ensure the correct dimensions are persisted
|
|
2052
|
+
*/
|
|
2053
|
+
this.exitMaximizedView();
|
|
2054
|
+
}
|
|
1893
2055
|
const root = serializeBranchNode(this.getView(), this.orientation);
|
|
1894
2056
|
return {
|
|
1895
2057
|
root,
|
|
@@ -1901,7 +2063,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1901
2063
|
dispose() {
|
|
1902
2064
|
this.disposable.dispose();
|
|
1903
2065
|
this._onDidChange.dispose();
|
|
2066
|
+
this._onDidMaxmizedNodeChange.dispose();
|
|
1904
2067
|
this.root.dispose();
|
|
2068
|
+
this._maximizedNode = undefined;
|
|
1905
2069
|
this.element.remove();
|
|
1906
2070
|
}
|
|
1907
2071
|
clear() {
|
|
@@ -1942,6 +2106,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1942
2106
|
const oldRoot = this._root;
|
|
1943
2107
|
if (oldRoot) {
|
|
1944
2108
|
oldRoot.dispose();
|
|
2109
|
+
this._maximizedNode = undefined;
|
|
1945
2110
|
this.element.removeChild(oldRoot.element);
|
|
1946
2111
|
}
|
|
1947
2112
|
this._root = root;
|
|
@@ -2028,9 +2193,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2028
2193
|
constructor(proportionalLayout, styles, orientation) {
|
|
2029
2194
|
this.proportionalLayout = proportionalLayout;
|
|
2030
2195
|
this.styles = styles;
|
|
2196
|
+
this._maximizedNode = undefined;
|
|
2031
2197
|
this.disposable = new MutableDisposable();
|
|
2032
2198
|
this._onDidChange = new Emitter();
|
|
2033
2199
|
this.onDidChange = this._onDidChange.event;
|
|
2200
|
+
this._onDidMaxmizedNodeChange = new Emitter();
|
|
2201
|
+
this.onDidMaxmizedNodeChange = this._onDidMaxmizedNodeChange.event;
|
|
2034
2202
|
this.element = document.createElement('div');
|
|
2035
2203
|
this.element.className = 'grid-view';
|
|
2036
2204
|
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
@@ -2044,6 +2212,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2044
2212
|
return parent.isChildVisible(index);
|
|
2045
2213
|
}
|
|
2046
2214
|
setViewVisible(location, visible) {
|
|
2215
|
+
if (this.hasMaximizedView()) {
|
|
2216
|
+
this.exitMaximizedView();
|
|
2217
|
+
}
|
|
2047
2218
|
const [rest, index] = tail(location);
|
|
2048
2219
|
const [, parent] = this.getNode(rest);
|
|
2049
2220
|
if (!(parent instanceof BranchNode)) {
|
|
@@ -2052,6 +2223,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2052
2223
|
parent.setChildVisible(index, visible);
|
|
2053
2224
|
}
|
|
2054
2225
|
moveView(parentLocation, from, to) {
|
|
2226
|
+
if (this.hasMaximizedView()) {
|
|
2227
|
+
this.exitMaximizedView();
|
|
2228
|
+
}
|
|
2055
2229
|
const [, parent] = this.getNode(parentLocation);
|
|
2056
2230
|
if (!(parent instanceof BranchNode)) {
|
|
2057
2231
|
throw new Error('Invalid location');
|
|
@@ -2059,6 +2233,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2059
2233
|
parent.moveChild(from, to);
|
|
2060
2234
|
}
|
|
2061
2235
|
addView(view, size, location) {
|
|
2236
|
+
if (this.hasMaximizedView()) {
|
|
2237
|
+
this.exitMaximizedView();
|
|
2238
|
+
}
|
|
2062
2239
|
const [rest, index] = tail(location);
|
|
2063
2240
|
const [pathToParent, parent] = this.getNode(rest);
|
|
2064
2241
|
if (parent instanceof BranchNode) {
|
|
@@ -2091,6 +2268,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2091
2268
|
return this.removeView(location, sizing);
|
|
2092
2269
|
}
|
|
2093
2270
|
removeView(location, sizing) {
|
|
2271
|
+
if (this.hasMaximizedView()) {
|
|
2272
|
+
this.exitMaximizedView();
|
|
2273
|
+
}
|
|
2094
2274
|
const [rest, index] = tail(location);
|
|
2095
2275
|
const [pathToParent, parent] = this.getNode(rest);
|
|
2096
2276
|
if (!(parent instanceof BranchNode)) {
|
|
@@ -2828,6 +3008,24 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2828
3008
|
moveToPrevious(options) {
|
|
2829
3009
|
this.component.moveToPrevious(options);
|
|
2830
3010
|
}
|
|
3011
|
+
maximizeGroup(panel) {
|
|
3012
|
+
this.component.maximizeGroup(panel.group);
|
|
3013
|
+
}
|
|
3014
|
+
hasMaximizedGroup() {
|
|
3015
|
+
return this.component.hasMaximizedGroup();
|
|
3016
|
+
}
|
|
3017
|
+
exitMaxmizedGroup() {
|
|
3018
|
+
this.component.exitMaximizedGroup();
|
|
3019
|
+
}
|
|
3020
|
+
get onDidMaxmizedGroupChange() {
|
|
3021
|
+
return this.component.onDidMaxmizedGroupChange;
|
|
3022
|
+
}
|
|
3023
|
+
/**
|
|
3024
|
+
* Add a popout group in a new Window
|
|
3025
|
+
*/
|
|
3026
|
+
addPopoutGroup(item, options) {
|
|
3027
|
+
this.component.addPopoutGroup(item, options);
|
|
3028
|
+
}
|
|
2831
3029
|
}
|
|
2832
3030
|
|
|
2833
3031
|
class DragAndDropObserver extends CompositeDisposable {
|
|
@@ -2838,29 +3036,44 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2838
3036
|
this.target = null;
|
|
2839
3037
|
this.registerListeners();
|
|
2840
3038
|
}
|
|
3039
|
+
onDragEnter(e) {
|
|
3040
|
+
this.target = e.target;
|
|
3041
|
+
this.callbacks.onDragEnter(e);
|
|
3042
|
+
}
|
|
3043
|
+
onDragOver(e) {
|
|
3044
|
+
e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
|
|
3045
|
+
if (this.callbacks.onDragOver) {
|
|
3046
|
+
this.callbacks.onDragOver(e);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
onDragLeave(e) {
|
|
3050
|
+
if (this.target === e.target) {
|
|
3051
|
+
this.target = null;
|
|
3052
|
+
this.callbacks.onDragLeave(e);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
onDragEnd(e) {
|
|
3056
|
+
this.target = null;
|
|
3057
|
+
this.callbacks.onDragEnd(e);
|
|
3058
|
+
}
|
|
3059
|
+
onDrop(e) {
|
|
3060
|
+
this.callbacks.onDrop(e);
|
|
3061
|
+
}
|
|
2841
3062
|
registerListeners() {
|
|
2842
3063
|
this.addDisposables(addDisposableListener(this.element, 'dragenter', (e) => {
|
|
2843
|
-
this.
|
|
2844
|
-
this.callbacks.onDragEnter(e);
|
|
3064
|
+
this.onDragEnter(e);
|
|
2845
3065
|
}, true));
|
|
2846
3066
|
this.addDisposables(addDisposableListener(this.element, 'dragover', (e) => {
|
|
2847
|
-
|
|
2848
|
-
if (this.callbacks.onDragOver) {
|
|
2849
|
-
this.callbacks.onDragOver(e);
|
|
2850
|
-
}
|
|
3067
|
+
this.onDragOver(e);
|
|
2851
3068
|
}, true));
|
|
2852
3069
|
this.addDisposables(addDisposableListener(this.element, 'dragleave', (e) => {
|
|
2853
|
-
|
|
2854
|
-
this.target = null;
|
|
2855
|
-
this.callbacks.onDragLeave(e);
|
|
2856
|
-
}
|
|
3070
|
+
this.onDragLeave(e);
|
|
2857
3071
|
}));
|
|
2858
3072
|
this.addDisposables(addDisposableListener(this.element, 'dragend', (e) => {
|
|
2859
|
-
this.
|
|
2860
|
-
this.callbacks.onDragEnd(e);
|
|
3073
|
+
this.onDragEnd(e);
|
|
2861
3074
|
}));
|
|
2862
3075
|
this.addDisposables(addDisposableListener(this.element, 'drop', (e) => {
|
|
2863
|
-
this.
|
|
3076
|
+
this.onDrop(e);
|
|
2864
3077
|
}));
|
|
2865
3078
|
}
|
|
2866
3079
|
}
|
|
@@ -2912,7 +3125,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2912
3125
|
this.onDrop = this._onDrop.event;
|
|
2913
3126
|
// use a set to take advantage of #<set>.has
|
|
2914
3127
|
this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);
|
|
2915
|
-
this.
|
|
3128
|
+
this.dnd = new DragAndDropObserver(this.element, {
|
|
2916
3129
|
onDragEnter: () => undefined,
|
|
2917
3130
|
onDragOver: (e) => {
|
|
2918
3131
|
if (this._acceptedTargetZonesSet.size === 0) {
|
|
@@ -2979,7 +3192,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2979
3192
|
this._onDrop.fire({ position: state, nativeEvent: e });
|
|
2980
3193
|
}
|
|
2981
3194
|
},
|
|
2982
|
-
})
|
|
3195
|
+
});
|
|
3196
|
+
this.addDisposables(this._onDrop, this.dnd);
|
|
2983
3197
|
}
|
|
2984
3198
|
setTargetZones(acceptedTargetZones) {
|
|
2985
3199
|
this._acceptedTargetZonesSet = new Set(acceptedTargetZones);
|
|
@@ -3135,12 +3349,22 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3135
3349
|
return 'center';
|
|
3136
3350
|
}
|
|
3137
3351
|
|
|
3352
|
+
exports.DockviewDropTargets = void 0;
|
|
3353
|
+
(function (DockviewDropTargets) {
|
|
3354
|
+
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3355
|
+
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3356
|
+
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3357
|
+
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3358
|
+
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3359
|
+
|
|
3138
3360
|
class ContentContainer extends CompositeDisposable {
|
|
3139
3361
|
get element() {
|
|
3140
3362
|
return this._element;
|
|
3141
3363
|
}
|
|
3142
|
-
constructor() {
|
|
3364
|
+
constructor(accessor, group) {
|
|
3143
3365
|
super();
|
|
3366
|
+
this.accessor = accessor;
|
|
3367
|
+
this.group = group;
|
|
3144
3368
|
this.disposable = new MutableDisposable();
|
|
3145
3369
|
this._onDidFocus = new Emitter();
|
|
3146
3370
|
this.onDidFocus = this._onDidFocus.event;
|
|
@@ -3150,11 +3374,38 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3150
3374
|
this._element.className = 'content-container';
|
|
3151
3375
|
this._element.tabIndex = -1;
|
|
3152
3376
|
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3377
|
+
this.dropTarget = new Droptarget(this.element, {
|
|
3378
|
+
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
3379
|
+
canDisplayOverlay: (event, position) => {
|
|
3380
|
+
if (this.group.locked === 'no-drop-target' ||
|
|
3381
|
+
(this.group.locked && position === 'center')) {
|
|
3382
|
+
return false;
|
|
3383
|
+
}
|
|
3384
|
+
const data = getPanelData();
|
|
3385
|
+
if (!data &&
|
|
3386
|
+
event.shiftKey &&
|
|
3387
|
+
this.group.location !== 'floating') {
|
|
3388
|
+
return false;
|
|
3389
|
+
}
|
|
3390
|
+
if (data && data.viewId === this.accessor.id) {
|
|
3391
|
+
if (data.groupId === this.group.id) {
|
|
3392
|
+
if (position === 'center') {
|
|
3393
|
+
// don't allow to drop on self for center position
|
|
3394
|
+
return false;
|
|
3395
|
+
}
|
|
3396
|
+
if (data.panelId === null) {
|
|
3397
|
+
// don't allow group move to drop anywhere on self
|
|
3398
|
+
return false;
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
const groupHasOnePanelAndIsActiveDragElement = this.group.panels.length === 1 &&
|
|
3402
|
+
data.groupId === this.group.id;
|
|
3403
|
+
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3404
|
+
}
|
|
3405
|
+
return this.group.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
|
|
3406
|
+
},
|
|
3407
|
+
});
|
|
3408
|
+
this.addDisposables(this.dropTarget);
|
|
3158
3409
|
}
|
|
3159
3410
|
show() {
|
|
3160
3411
|
this.element.style.display = '';
|
|
@@ -3162,23 +3413,43 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3162
3413
|
hide() {
|
|
3163
3414
|
this.element.style.display = 'none';
|
|
3164
3415
|
}
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
this.panel = undefined;
|
|
3416
|
+
renderPanel(panel, options = { asActive: true }) {
|
|
3417
|
+
const doRender = options.asActive ||
|
|
3418
|
+
(this.panel && this.group.isPanelActive(this.panel));
|
|
3419
|
+
if (this.panel &&
|
|
3420
|
+
this.panel.view.content.element.parentElement === this._element) {
|
|
3421
|
+
/**
|
|
3422
|
+
* If the currently attached panel is mounted directly to the content then remove it
|
|
3423
|
+
*/
|
|
3424
|
+
this._element.removeChild(this.panel.view.content.element);
|
|
3175
3425
|
}
|
|
3176
3426
|
this.panel = panel;
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3427
|
+
let container;
|
|
3428
|
+
switch (panel.api.renderer) {
|
|
3429
|
+
case 'onlyWhenVisibile':
|
|
3430
|
+
this.accessor.overlayRenderContainer.detatch(panel);
|
|
3431
|
+
if (this.panel) {
|
|
3432
|
+
if (doRender) {
|
|
3433
|
+
this._element.appendChild(this.panel.view.content.element);
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
container = this._element;
|
|
3437
|
+
break;
|
|
3438
|
+
case 'always':
|
|
3439
|
+
if (panel.view.content.element.parentElement === this._element) {
|
|
3440
|
+
this._element.removeChild(panel.view.content.element);
|
|
3441
|
+
}
|
|
3442
|
+
container = this.accessor.overlayRenderContainer.attach({
|
|
3443
|
+
panel,
|
|
3444
|
+
referenceContainer: this,
|
|
3445
|
+
});
|
|
3446
|
+
break;
|
|
3447
|
+
}
|
|
3448
|
+
if (doRender) {
|
|
3449
|
+
const _onDidFocus = panel.view.content.onDidFocus;
|
|
3450
|
+
const _onDidBlur = panel.view.content.onDidBlur;
|
|
3451
|
+
const focusTracker = trackFocus(container);
|
|
3452
|
+
const disposable = new CompositeDisposable();
|
|
3182
3453
|
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
3183
3454
|
if (_onDidFocus) {
|
|
3184
3455
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
@@ -3186,17 +3457,23 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3186
3457
|
if (_onDidBlur) {
|
|
3187
3458
|
disposable.addDisposables(_onDidBlur(() => this._onDidBlur.fire()));
|
|
3188
3459
|
}
|
|
3189
|
-
this.
|
|
3460
|
+
this.disposable.value = disposable;
|
|
3190
3461
|
}
|
|
3191
|
-
|
|
3462
|
+
}
|
|
3463
|
+
openPanel(panel) {
|
|
3464
|
+
if (this.panel === panel) {
|
|
3465
|
+
return;
|
|
3466
|
+
}
|
|
3467
|
+
this.renderPanel(panel);
|
|
3192
3468
|
}
|
|
3193
3469
|
layout(_width, _height) {
|
|
3194
3470
|
// noop
|
|
3195
3471
|
}
|
|
3196
3472
|
closePanel() {
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3473
|
+
if (this.panel) {
|
|
3474
|
+
if (this.accessor.options.defaultRenderer === 'onlyWhenVisibile') {
|
|
3475
|
+
this._element.removeChild(this.panel.view.content.element);
|
|
3476
|
+
}
|
|
3200
3477
|
this.panel = undefined;
|
|
3201
3478
|
}
|
|
3202
3479
|
}
|
|
@@ -3206,14 +3483,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3206
3483
|
}
|
|
3207
3484
|
}
|
|
3208
3485
|
|
|
3209
|
-
exports.DockviewDropTargets = void 0;
|
|
3210
|
-
(function (DockviewDropTargets) {
|
|
3211
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
3212
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
3213
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
3214
|
-
DockviewDropTargets[DockviewDropTargets["Edge"] = 3] = "Edge";
|
|
3215
|
-
})(exports.DockviewDropTargets || (exports.DockviewDropTargets = {}));
|
|
3216
|
-
|
|
3217
3486
|
class DragHandler extends CompositeDisposable {
|
|
3218
3487
|
constructor(el) {
|
|
3219
3488
|
super();
|
|
@@ -3388,7 +3657,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3388
3657
|
}, true));
|
|
3389
3658
|
}
|
|
3390
3659
|
isCancelled(_event) {
|
|
3391
|
-
if (this.group.api.
|
|
3660
|
+
if (this.group.api.location === 'floating' && !_event.shiftKey) {
|
|
3392
3661
|
return true;
|
|
3393
3662
|
}
|
|
3394
3663
|
return false;
|
|
@@ -3590,7 +3859,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3590
3859
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3591
3860
|
if (isFloatingGroupsEnabled &&
|
|
3592
3861
|
event.shiftKey &&
|
|
3593
|
-
|
|
3862
|
+
this.group.api.location !== 'floating') {
|
|
3594
3863
|
event.preventDefault();
|
|
3595
3864
|
const { top, left } = this.element.getBoundingClientRect();
|
|
3596
3865
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
@@ -3655,7 +3924,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3655
3924
|
}), tab.onChanged((event) => {
|
|
3656
3925
|
var _a;
|
|
3657
3926
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3658
|
-
const isFloatingWithOnePanel = this.group.api.
|
|
3927
|
+
const isFloatingWithOnePanel = this.group.api.location === 'floating' && this.size === 1;
|
|
3659
3928
|
if (isFloatingGroupsEnabled &&
|
|
3660
3929
|
!isFloatingWithOnePanel &&
|
|
3661
3930
|
event.shiftKey) {
|
|
@@ -3738,15 +4007,37 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3738
4007
|
}
|
|
3739
4008
|
return isAncestor(document.activeElement, this.contentContainer.element);
|
|
3740
4009
|
}
|
|
3741
|
-
get
|
|
3742
|
-
return this.
|
|
3743
|
-
}
|
|
3744
|
-
set
|
|
3745
|
-
this.
|
|
3746
|
-
this.
|
|
3747
|
-
toggleClass(this.container, 'dv-groupview-
|
|
3748
|
-
|
|
3749
|
-
|
|
4010
|
+
get location() {
|
|
4011
|
+
return this._location;
|
|
4012
|
+
}
|
|
4013
|
+
set location(value) {
|
|
4014
|
+
this._location = value;
|
|
4015
|
+
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4016
|
+
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4017
|
+
switch (value) {
|
|
4018
|
+
case 'grid':
|
|
4019
|
+
this.contentContainer.dropTarget.setTargetZones([
|
|
4020
|
+
'top',
|
|
4021
|
+
'bottom',
|
|
4022
|
+
'left',
|
|
4023
|
+
'right',
|
|
4024
|
+
'center',
|
|
4025
|
+
]);
|
|
4026
|
+
break;
|
|
4027
|
+
case 'floating':
|
|
4028
|
+
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
4029
|
+
this.contentContainer.dropTarget.setTargetZones(value
|
|
4030
|
+
? ['center']
|
|
4031
|
+
: ['top', 'bottom', 'left', 'right', 'center']);
|
|
4032
|
+
toggleClass(this.container, 'dv-groupview-floating', true);
|
|
4033
|
+
break;
|
|
4034
|
+
case 'popout':
|
|
4035
|
+
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
4036
|
+
toggleClass(this.container, 'dv-groupview-popout', true);
|
|
4037
|
+
break;
|
|
4038
|
+
}
|
|
4039
|
+
this.groupPanel.api._onDidLocationChange.fire({
|
|
4040
|
+
location: this.location,
|
|
3750
4041
|
});
|
|
3751
4042
|
}
|
|
3752
4043
|
constructor(container, accessor, id, options, groupPanel) {
|
|
@@ -3759,7 +4050,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3759
4050
|
this.groupPanel = groupPanel;
|
|
3760
4051
|
this._isGroupActive = false;
|
|
3761
4052
|
this._locked = false;
|
|
3762
|
-
this.
|
|
4053
|
+
this._location = 'grid';
|
|
3763
4054
|
this.mostRecentlyUsed = [];
|
|
3764
4055
|
this._onDidChange = new Emitter();
|
|
3765
4056
|
this.onDidChange = this._onDidChange.event;
|
|
@@ -3782,35 +4073,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3782
4073
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
3783
4074
|
toggleClass(this.container, 'groupview', true);
|
|
3784
4075
|
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
3785
|
-
this.contentContainer = new ContentContainer();
|
|
3786
|
-
this.dropTarget = new Droptarget(this.contentContainer.element, {
|
|
3787
|
-
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
3788
|
-
canDisplayOverlay: (event, position) => {
|
|
3789
|
-
if (this.locked === 'no-drop-target' ||
|
|
3790
|
-
(this.locked && position === 'center')) {
|
|
3791
|
-
return false;
|
|
3792
|
-
}
|
|
3793
|
-
const data = getPanelData();
|
|
3794
|
-
if (!data && event.shiftKey && !this.isFloating) {
|
|
3795
|
-
return false;
|
|
3796
|
-
}
|
|
3797
|
-
if (data && data.viewId === this.accessor.id) {
|
|
3798
|
-
if (data.groupId === this.id) {
|
|
3799
|
-
if (position === 'center') {
|
|
3800
|
-
// don't allow to drop on self for center position
|
|
3801
|
-
return false;
|
|
3802
|
-
}
|
|
3803
|
-
if (data.panelId === null) {
|
|
3804
|
-
// don't allow group move to drop anywhere on self
|
|
3805
|
-
return false;
|
|
3806
|
-
}
|
|
3807
|
-
}
|
|
3808
|
-
const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
|
|
3809
|
-
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3810
|
-
}
|
|
3811
|
-
return this.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
|
|
3812
|
-
},
|
|
3813
|
-
});
|
|
4076
|
+
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
3814
4077
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3815
4078
|
this.header.hidden = !!options.hideHeader;
|
|
3816
4079
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
@@ -3824,7 +4087,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3824
4087
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
3825
4088
|
}), this.contentContainer.onDidBlur(() => {
|
|
3826
4089
|
// noop
|
|
3827
|
-
}), this.dropTarget.onDrop((event) => {
|
|
4090
|
+
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
3828
4091
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3829
4092
|
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3830
4093
|
}
|
|
@@ -3873,6 +4136,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3873
4136
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
3874
4137
|
}
|
|
3875
4138
|
}
|
|
4139
|
+
rerender(panel) {
|
|
4140
|
+
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
4141
|
+
}
|
|
3876
4142
|
indexOf(panel) {
|
|
3877
4143
|
return this.tabsContainer.indexOf(panel.id);
|
|
3878
4144
|
}
|
|
@@ -4064,12 +4330,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4064
4330
|
doAddPanel(panel, index = this.panels.length, skipSetActive = false) {
|
|
4065
4331
|
const existingPanel = this._panels.indexOf(panel);
|
|
4066
4332
|
const hasExistingPanel = existingPanel > -1;
|
|
4333
|
+
this.tabsContainer.show();
|
|
4334
|
+
this.contentContainer.show();
|
|
4067
4335
|
this.tabsContainer.openPanel(panel, index);
|
|
4068
4336
|
if (!skipSetActive) {
|
|
4069
4337
|
this.contentContainer.openPanel(panel);
|
|
4070
4338
|
}
|
|
4071
|
-
this.tabsContainer.show();
|
|
4072
|
-
this.contentContainer.show();
|
|
4073
4339
|
if (hasExistingPanel) {
|
|
4074
4340
|
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
4075
4341
|
return;
|
|
@@ -4185,7 +4451,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4185
4451
|
for (const panel of this.panels) {
|
|
4186
4452
|
panel.dispose();
|
|
4187
4453
|
}
|
|
4188
|
-
this.dropTarget.dispose();
|
|
4189
4454
|
this.tabsContainer.dispose();
|
|
4190
4455
|
this.contentContainer.dispose();
|
|
4191
4456
|
}
|
|
@@ -4224,7 +4489,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4224
4489
|
if (this.disableResizing) {
|
|
4225
4490
|
return;
|
|
4226
4491
|
}
|
|
4227
|
-
if (!
|
|
4492
|
+
if (!isInDocument(this._element)) {
|
|
4228
4493
|
/**
|
|
4229
4494
|
* since the event is dispatched through requestAnimationFrame there is a small chance
|
|
4230
4495
|
* the component is no longer attached to the DOM, if that is the case the dimensions
|
|
@@ -4316,6 +4581,21 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4316
4581
|
isVisible(panel) {
|
|
4317
4582
|
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
4318
4583
|
}
|
|
4584
|
+
maximizeGroup(panel) {
|
|
4585
|
+
this.gridview.maximizeView(panel);
|
|
4586
|
+
}
|
|
4587
|
+
isMaximizedGroup(panel) {
|
|
4588
|
+
return this.gridview.maximizedView() === panel;
|
|
4589
|
+
}
|
|
4590
|
+
exitMaximizedGroup() {
|
|
4591
|
+
this.gridview.exitMaximizedView();
|
|
4592
|
+
}
|
|
4593
|
+
hasMaximizedGroup() {
|
|
4594
|
+
return this.gridview.hasMaximizedView();
|
|
4595
|
+
}
|
|
4596
|
+
get onDidMaxmizedGroupChange() {
|
|
4597
|
+
return this.gridview.onDidMaxmizedNodeChange;
|
|
4598
|
+
}
|
|
4319
4599
|
doAddGroup(group, location = [0], size) {
|
|
4320
4600
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
4321
4601
|
this._onDidAddGroup.fire(group);
|
|
@@ -5092,32 +5372,63 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5092
5372
|
}
|
|
5093
5373
|
}
|
|
5094
5374
|
|
|
5375
|
+
// TODO find a better way to initialize and avoid needing null checks
|
|
5376
|
+
const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
|
|
5095
5377
|
class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
5096
|
-
get
|
|
5378
|
+
get location() {
|
|
5097
5379
|
if (!this._group) {
|
|
5098
|
-
throw new Error(
|
|
5380
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5099
5381
|
}
|
|
5100
|
-
return this._group.model.
|
|
5382
|
+
return this._group.model.location;
|
|
5101
5383
|
}
|
|
5102
5384
|
constructor(id, accessor) {
|
|
5103
5385
|
super(id);
|
|
5104
5386
|
this.accessor = accessor;
|
|
5105
|
-
this.
|
|
5106
|
-
this.
|
|
5107
|
-
this.addDisposables(this.
|
|
5387
|
+
this._onDidLocationChange = new Emitter();
|
|
5388
|
+
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5389
|
+
this.addDisposables(this._onDidLocationChange);
|
|
5108
5390
|
}
|
|
5109
5391
|
moveTo(options) {
|
|
5110
|
-
var _a;
|
|
5392
|
+
var _a, _b, _c;
|
|
5393
|
+
if (!this._group) {
|
|
5394
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5395
|
+
}
|
|
5396
|
+
const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
|
|
5397
|
+
direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
|
|
5398
|
+
});
|
|
5399
|
+
this.accessor.moveGroupOrPanel(group, this._group.id, undefined, options.group ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center' : 'center');
|
|
5400
|
+
}
|
|
5401
|
+
maximize() {
|
|
5402
|
+
if (!this._group) {
|
|
5403
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5404
|
+
}
|
|
5405
|
+
if (this.location !== 'grid') {
|
|
5406
|
+
// only grid groups can be maximized
|
|
5407
|
+
return;
|
|
5408
|
+
}
|
|
5409
|
+
this.accessor.maximizeGroup(this._group);
|
|
5410
|
+
}
|
|
5411
|
+
isMaximized() {
|
|
5111
5412
|
if (!this._group) {
|
|
5112
|
-
throw new Error(
|
|
5413
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5414
|
+
}
|
|
5415
|
+
return this.accessor.isMaximizedGroup(this._group);
|
|
5416
|
+
}
|
|
5417
|
+
exitMaximized() {
|
|
5418
|
+
if (!this._group) {
|
|
5419
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
5420
|
+
}
|
|
5421
|
+
if (this.isMaximized()) {
|
|
5422
|
+
this.accessor.exitMaximizedGroup();
|
|
5113
5423
|
}
|
|
5114
|
-
this.accessor.moveGroupOrPanel(options.group, this._group.id, undefined, (_a = options.position) !== null && _a !== void 0 ? _a : 'center');
|
|
5115
5424
|
}
|
|
5116
5425
|
initialize(group) {
|
|
5117
5426
|
this._group = group;
|
|
5118
5427
|
}
|
|
5119
5428
|
}
|
|
5120
5429
|
|
|
5430
|
+
const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
|
|
5431
|
+
const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
|
|
5121
5432
|
class DockviewGroupPanel extends GridviewPanel {
|
|
5122
5433
|
get panels() {
|
|
5123
5434
|
return this._model.panels;
|
|
@@ -5142,8 +5453,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5142
5453
|
}
|
|
5143
5454
|
constructor(accessor, id, options) {
|
|
5144
5455
|
super(id, 'groupview_default', {
|
|
5145
|
-
minimumHeight:
|
|
5146
|
-
minimumWidth:
|
|
5456
|
+
minimumHeight: MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
|
|
5457
|
+
minimumWidth: MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
|
|
5147
5458
|
}, new DockviewGroupPanelApiImpl(id, accessor));
|
|
5148
5459
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
5149
5460
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
@@ -5197,8 +5508,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5197
5508
|
return this.panel.title;
|
|
5198
5509
|
}
|
|
5199
5510
|
get isGroupActive() {
|
|
5200
|
-
|
|
5201
|
-
|
|
5511
|
+
return this.group.isActive;
|
|
5512
|
+
}
|
|
5513
|
+
get renderer() {
|
|
5514
|
+
return this.panel.renderer;
|
|
5202
5515
|
}
|
|
5203
5516
|
set group(value) {
|
|
5204
5517
|
const isOldGroupActive = this.isGroupActive;
|
|
@@ -5226,10 +5539,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5226
5539
|
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
5227
5540
|
this._onDidGroupChange = new Emitter();
|
|
5228
5541
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
5542
|
+
this._onDidRendererChange = new Emitter();
|
|
5543
|
+
this.onDidRendererChange = this._onDidRendererChange.event;
|
|
5229
5544
|
this.disposable = new MutableDisposable();
|
|
5230
5545
|
this.initialize(panel);
|
|
5231
5546
|
this._group = group;
|
|
5232
|
-
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
5547
|
+
this.addDisposables(this.disposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
5233
5548
|
}
|
|
5234
5549
|
moveTo(options) {
|
|
5235
5550
|
var _a;
|
|
@@ -5238,9 +5553,21 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5238
5553
|
setTitle(title) {
|
|
5239
5554
|
this.panel.setTitle(title);
|
|
5240
5555
|
}
|
|
5556
|
+
setRenderer(renderer) {
|
|
5557
|
+
this.panel.setRenderer(renderer);
|
|
5558
|
+
}
|
|
5241
5559
|
close() {
|
|
5242
5560
|
this.group.model.closePanel(this.panel);
|
|
5243
5561
|
}
|
|
5562
|
+
maximize() {
|
|
5563
|
+
this.group.api.maximize();
|
|
5564
|
+
}
|
|
5565
|
+
isMaximized() {
|
|
5566
|
+
return this.group.api.isMaximized();
|
|
5567
|
+
}
|
|
5568
|
+
exitMaximized() {
|
|
5569
|
+
this.group.api.exitMaximized();
|
|
5570
|
+
}
|
|
5244
5571
|
}
|
|
5245
5572
|
|
|
5246
5573
|
class DockviewPanel extends CompositeDisposable {
|
|
@@ -5253,11 +5580,17 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5253
5580
|
get group() {
|
|
5254
5581
|
return this._group;
|
|
5255
5582
|
}
|
|
5256
|
-
|
|
5583
|
+
get renderer() {
|
|
5584
|
+
var _a;
|
|
5585
|
+
return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
|
|
5586
|
+
}
|
|
5587
|
+
constructor(id, accessor, containerApi, group, view, options) {
|
|
5257
5588
|
super();
|
|
5258
5589
|
this.id = id;
|
|
5590
|
+
this.accessor = accessor;
|
|
5259
5591
|
this.containerApi = containerApi;
|
|
5260
5592
|
this.view = view;
|
|
5593
|
+
this._renderer = options.renderer;
|
|
5261
5594
|
this._group = group;
|
|
5262
5595
|
this.api = new DockviewPanelApiImpl(this, this._group, accessor);
|
|
5263
5596
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
@@ -5266,6 +5599,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5266
5599
|
// forward the resize event to the group since if you want to resize a panel
|
|
5267
5600
|
// you are actually just resizing the panels parent which is the group
|
|
5268
5601
|
this.group.api.setSize(event);
|
|
5602
|
+
}), this.api.onDidRendererChange((event) => {
|
|
5603
|
+
this.group.model.rerender(this);
|
|
5269
5604
|
}));
|
|
5270
5605
|
}
|
|
5271
5606
|
init(params) {
|
|
@@ -5285,6 +5620,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5285
5620
|
? this._params
|
|
5286
5621
|
: undefined,
|
|
5287
5622
|
title: this.title,
|
|
5623
|
+
renderer: this._renderer,
|
|
5288
5624
|
};
|
|
5289
5625
|
}
|
|
5290
5626
|
setTitle(title) {
|
|
@@ -5300,6 +5636,15 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5300
5636
|
this.api._onDidTitleChange.fire({ title });
|
|
5301
5637
|
}
|
|
5302
5638
|
}
|
|
5639
|
+
setRenderer(renderer) {
|
|
5640
|
+
const didChange = renderer !== this.renderer;
|
|
5641
|
+
if (didChange) {
|
|
5642
|
+
this._renderer = renderer;
|
|
5643
|
+
this.api._onDidRendererChange.fire({
|
|
5644
|
+
renderer: renderer,
|
|
5645
|
+
});
|
|
5646
|
+
}
|
|
5647
|
+
}
|
|
5303
5648
|
update(event) {
|
|
5304
5649
|
var _a;
|
|
5305
5650
|
// merge the new parameters with the existing parameters
|
|
@@ -5518,8 +5863,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5518
5863
|
}
|
|
5519
5864
|
|
|
5520
5865
|
class DefaultDockviewDeserialzier {
|
|
5521
|
-
constructor(
|
|
5522
|
-
this.
|
|
5866
|
+
constructor(accessor) {
|
|
5867
|
+
this.accessor = accessor;
|
|
5523
5868
|
}
|
|
5524
5869
|
fromJSON(panelData, group) {
|
|
5525
5870
|
var _a, _b;
|
|
@@ -5533,8 +5878,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5533
5878
|
const tabComponent = viewData
|
|
5534
5879
|
? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
|
|
5535
5880
|
: panelData.tabComponent;
|
|
5536
|
-
const view = new DockviewPanelModel(this.
|
|
5537
|
-
const panel = new DockviewPanel(panelId, this.
|
|
5881
|
+
const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
|
|
5882
|
+
const panel = new DockviewPanel(panelId, this.accessor, new DockviewApi(this.accessor), group, view, {
|
|
5883
|
+
renderer: panelData.renderer,
|
|
5884
|
+
});
|
|
5538
5885
|
panel.init({
|
|
5539
5886
|
title: title !== null && title !== void 0 ? title : panelId,
|
|
5540
5887
|
params: params !== null && params !== void 0 ? params : {},
|
|
@@ -5914,7 +6261,261 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5914
6261
|
}
|
|
5915
6262
|
}
|
|
5916
6263
|
|
|
6264
|
+
class PopoutWindow extends CompositeDisposable {
|
|
6265
|
+
constructor(id, className, options) {
|
|
6266
|
+
super();
|
|
6267
|
+
this.id = id;
|
|
6268
|
+
this.className = className;
|
|
6269
|
+
this.options = options;
|
|
6270
|
+
this._onDidClose = new Emitter();
|
|
6271
|
+
this.onDidClose = this._onDidClose.event;
|
|
6272
|
+
this._window = null;
|
|
6273
|
+
this.addDisposables(this._onDidClose, {
|
|
6274
|
+
dispose: () => {
|
|
6275
|
+
this.close();
|
|
6276
|
+
},
|
|
6277
|
+
});
|
|
6278
|
+
}
|
|
6279
|
+
dimensions() {
|
|
6280
|
+
if (!this._window) {
|
|
6281
|
+
return null;
|
|
6282
|
+
}
|
|
6283
|
+
const left = this._window.value.screenX;
|
|
6284
|
+
const top = this._window.value.screenY;
|
|
6285
|
+
const width = this._window.value.innerWidth;
|
|
6286
|
+
const height = this._window.value.innerHeight;
|
|
6287
|
+
return { top, left, width, height };
|
|
6288
|
+
}
|
|
6289
|
+
close() {
|
|
6290
|
+
if (this._window) {
|
|
6291
|
+
this._window.disposable.dispose();
|
|
6292
|
+
this._window.value.close();
|
|
6293
|
+
this._window = null;
|
|
6294
|
+
}
|
|
6295
|
+
}
|
|
6296
|
+
open(content) {
|
|
6297
|
+
if (this._window) {
|
|
6298
|
+
throw new Error('instance of popout window is already open');
|
|
6299
|
+
}
|
|
6300
|
+
const url = `${this.options.url}`;
|
|
6301
|
+
const features = Object.entries({
|
|
6302
|
+
top: this.options.top,
|
|
6303
|
+
left: this.options.left,
|
|
6304
|
+
width: this.options.width,
|
|
6305
|
+
height: this.options.height,
|
|
6306
|
+
})
|
|
6307
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
6308
|
+
.join(',');
|
|
6309
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
6310
|
+
const externalWindow = window.open(url, this.id, features);
|
|
6311
|
+
if (!externalWindow) {
|
|
6312
|
+
return;
|
|
6313
|
+
}
|
|
6314
|
+
const disposable = new CompositeDisposable();
|
|
6315
|
+
this._window = { value: externalWindow, disposable };
|
|
6316
|
+
const cleanUp = () => {
|
|
6317
|
+
this._onDidClose.fire();
|
|
6318
|
+
this._window = null;
|
|
6319
|
+
};
|
|
6320
|
+
// prevent any default content from loading
|
|
6321
|
+
// externalWindow.document.body.replaceWith(document.createElement('div'));
|
|
6322
|
+
disposable.addDisposables(addDisposableWindowListener(window, 'beforeunload', () => {
|
|
6323
|
+
cleanUp();
|
|
6324
|
+
this.close();
|
|
6325
|
+
}));
|
|
6326
|
+
externalWindow.addEventListener('load', () => {
|
|
6327
|
+
const externalDocument = externalWindow.document;
|
|
6328
|
+
externalDocument.title = document.title;
|
|
6329
|
+
const div = document.createElement('div');
|
|
6330
|
+
div.classList.add('dv-popout-window');
|
|
6331
|
+
div.style.position = 'absolute';
|
|
6332
|
+
div.style.width = '100%';
|
|
6333
|
+
div.style.height = '100%';
|
|
6334
|
+
div.style.top = '0px';
|
|
6335
|
+
div.style.left = '0px';
|
|
6336
|
+
div.classList.add(this.className);
|
|
6337
|
+
div.appendChild(content);
|
|
6338
|
+
externalDocument.body.replaceChildren(div);
|
|
6339
|
+
externalDocument.body.classList.add(this.className);
|
|
6340
|
+
addStyles(externalDocument, window.document.styleSheets);
|
|
6341
|
+
externalWindow.addEventListener('beforeunload', () => {
|
|
6342
|
+
// TODO: indicate external window is closing
|
|
6343
|
+
cleanUp();
|
|
6344
|
+
});
|
|
6345
|
+
});
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6348
|
+
|
|
6349
|
+
class DockviewPopoutGroupPanel extends CompositeDisposable {
|
|
6350
|
+
constructor(id, group, options) {
|
|
6351
|
+
var _a;
|
|
6352
|
+
super();
|
|
6353
|
+
this.id = id;
|
|
6354
|
+
this.group = group;
|
|
6355
|
+
this.options = options;
|
|
6356
|
+
this.window = new PopoutWindow(id, (_a = options.className) !== null && _a !== void 0 ? _a : '', {
|
|
6357
|
+
url: this.options.popoutUrl,
|
|
6358
|
+
left: this.options.box.left,
|
|
6359
|
+
top: this.options.box.top,
|
|
6360
|
+
width: this.options.box.width,
|
|
6361
|
+
height: this.options.box.height,
|
|
6362
|
+
});
|
|
6363
|
+
group.model.location = 'popout';
|
|
6364
|
+
this.addDisposables(this.window, {
|
|
6365
|
+
dispose: () => {
|
|
6366
|
+
group.model.location = 'grid';
|
|
6367
|
+
},
|
|
6368
|
+
}, this.window.onDidClose(() => {
|
|
6369
|
+
this.dispose();
|
|
6370
|
+
}));
|
|
6371
|
+
this.window.open(group.element);
|
|
6372
|
+
}
|
|
6373
|
+
}
|
|
6374
|
+
|
|
5917
6375
|
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
6376
|
+
const DEFAULT_FLOATING_GROUP_POSITION = { left: 100, top: 100 };
|
|
6377
|
+
|
|
6378
|
+
function createFocusableElement() {
|
|
6379
|
+
const element = document.createElement('div');
|
|
6380
|
+
element.tabIndex = -1;
|
|
6381
|
+
return element;
|
|
6382
|
+
}
|
|
6383
|
+
class OverlayRenderContainer extends CompositeDisposable {
|
|
6384
|
+
constructor(element) {
|
|
6385
|
+
super();
|
|
6386
|
+
this.element = element;
|
|
6387
|
+
this.map = {};
|
|
6388
|
+
this.addDisposables(Disposable.from(() => {
|
|
6389
|
+
for (const value of Object.values(this.map)) {
|
|
6390
|
+
value.disposable.dispose();
|
|
6391
|
+
value.destroy.dispose();
|
|
6392
|
+
}
|
|
6393
|
+
}));
|
|
6394
|
+
}
|
|
6395
|
+
detatch(panel) {
|
|
6396
|
+
if (this.map[panel.api.id]) {
|
|
6397
|
+
const { disposable, destroy } = this.map[panel.api.id];
|
|
6398
|
+
disposable.dispose();
|
|
6399
|
+
destroy.dispose();
|
|
6400
|
+
delete this.map[panel.api.id];
|
|
6401
|
+
return true;
|
|
6402
|
+
}
|
|
6403
|
+
return false;
|
|
6404
|
+
}
|
|
6405
|
+
attach(options) {
|
|
6406
|
+
const { panel, referenceContainer } = options;
|
|
6407
|
+
if (!this.map[panel.api.id]) {
|
|
6408
|
+
const element = createFocusableElement();
|
|
6409
|
+
element.className = 'dv-render-overlay';
|
|
6410
|
+
this.map[panel.api.id] = {
|
|
6411
|
+
panel,
|
|
6412
|
+
disposable: Disposable.NONE,
|
|
6413
|
+
destroy: Disposable.NONE,
|
|
6414
|
+
element,
|
|
6415
|
+
};
|
|
6416
|
+
}
|
|
6417
|
+
const focusContainer = this.map[panel.api.id].element;
|
|
6418
|
+
if (panel.view.content.element.parentElement !== focusContainer) {
|
|
6419
|
+
focusContainer.appendChild(panel.view.content.element);
|
|
6420
|
+
}
|
|
6421
|
+
if (focusContainer.parentElement !== this.element) {
|
|
6422
|
+
this.element.appendChild(focusContainer);
|
|
6423
|
+
}
|
|
6424
|
+
const resize = () => {
|
|
6425
|
+
// TODO propagate position to avoid getDomNodePagePosition calls, possible performance bottleneck?
|
|
6426
|
+
const box = getDomNodePagePosition(referenceContainer.element);
|
|
6427
|
+
const box2 = getDomNodePagePosition(this.element);
|
|
6428
|
+
focusContainer.style.left = `${box.left - box2.left}px`;
|
|
6429
|
+
focusContainer.style.top = `${box.top - box2.top}px`;
|
|
6430
|
+
focusContainer.style.width = `${box.width}px`;
|
|
6431
|
+
focusContainer.style.height = `${box.height}px`;
|
|
6432
|
+
toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location === 'floating');
|
|
6433
|
+
};
|
|
6434
|
+
const visibilityChanged = () => {
|
|
6435
|
+
if (panel.api.isVisible) {
|
|
6436
|
+
resize();
|
|
6437
|
+
}
|
|
6438
|
+
focusContainer.style.display = panel.api.isVisible ? '' : 'none';
|
|
6439
|
+
};
|
|
6440
|
+
const disposable = new CompositeDisposable(
|
|
6441
|
+
/**
|
|
6442
|
+
* since container is positioned absoutely we must explicitly forward
|
|
6443
|
+
* the dnd events for the expect behaviours to continue to occur in terms of dnd
|
|
6444
|
+
*
|
|
6445
|
+
* the dnd observer does not need to be conditional on whether the panel is visible since
|
|
6446
|
+
* non-visible panels are 'display: none' and in such case the dnd observer will not fire.
|
|
6447
|
+
*/
|
|
6448
|
+
new DragAndDropObserver(focusContainer, {
|
|
6449
|
+
onDragEnd: (e) => {
|
|
6450
|
+
referenceContainer.dropTarget.dnd.onDragEnd(e);
|
|
6451
|
+
},
|
|
6452
|
+
onDragEnter: (e) => {
|
|
6453
|
+
referenceContainer.dropTarget.dnd.onDragEnter(e);
|
|
6454
|
+
},
|
|
6455
|
+
onDragLeave: (e) => {
|
|
6456
|
+
referenceContainer.dropTarget.dnd.onDragLeave(e);
|
|
6457
|
+
},
|
|
6458
|
+
onDrop: (e) => {
|
|
6459
|
+
referenceContainer.dropTarget.dnd.onDrop(e);
|
|
6460
|
+
},
|
|
6461
|
+
onDragOver: (e) => {
|
|
6462
|
+
referenceContainer.dropTarget.dnd.onDragOver(e);
|
|
6463
|
+
},
|
|
6464
|
+
}), panel.api.onDidVisibilityChange((event) => {
|
|
6465
|
+
/**
|
|
6466
|
+
* Control the visibility of the content, however even when not visible (display: none)
|
|
6467
|
+
* the content is still maintained within the DOM hence DOM specific attributes
|
|
6468
|
+
* such as scroll position are maintained when next made visible.
|
|
6469
|
+
*/
|
|
6470
|
+
visibilityChanged();
|
|
6471
|
+
}), panel.api.onDidDimensionsChange(() => {
|
|
6472
|
+
if (!panel.api.isVisible) {
|
|
6473
|
+
return;
|
|
6474
|
+
}
|
|
6475
|
+
resize();
|
|
6476
|
+
}));
|
|
6477
|
+
this.map[panel.api.id].destroy = Disposable.from(() => {
|
|
6478
|
+
focusContainer.removeChild(panel.view.content.element);
|
|
6479
|
+
this.element.removeChild(focusContainer);
|
|
6480
|
+
});
|
|
6481
|
+
queueMicrotask(() => {
|
|
6482
|
+
if (this.isDisposed) {
|
|
6483
|
+
return;
|
|
6484
|
+
}
|
|
6485
|
+
/**
|
|
6486
|
+
* wait until everything has finished in the current stack-frame call before
|
|
6487
|
+
* calling the first resize as other size-altering events may still occur before
|
|
6488
|
+
* the end of the stack-frame.
|
|
6489
|
+
*/
|
|
6490
|
+
visibilityChanged();
|
|
6491
|
+
});
|
|
6492
|
+
// dispose of logic asoccciated with previous reference-container
|
|
6493
|
+
this.map[panel.api.id].disposable.dispose();
|
|
6494
|
+
// and reset the disposable to the active reference-container
|
|
6495
|
+
this.map[panel.api.id].disposable = disposable;
|
|
6496
|
+
return focusContainer;
|
|
6497
|
+
}
|
|
6498
|
+
}
|
|
6499
|
+
|
|
6500
|
+
function getTheme(element) {
|
|
6501
|
+
function toClassList(element) {
|
|
6502
|
+
const list = [];
|
|
6503
|
+
for (let i = 0; i < element.classList.length; i++) {
|
|
6504
|
+
list.push(element.classList.item(i));
|
|
6505
|
+
}
|
|
6506
|
+
return list;
|
|
6507
|
+
}
|
|
6508
|
+
let theme = undefined;
|
|
6509
|
+
let parent = element;
|
|
6510
|
+
while (parent !== null) {
|
|
6511
|
+
theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
|
|
6512
|
+
if (typeof theme === 'string') {
|
|
6513
|
+
break;
|
|
6514
|
+
}
|
|
6515
|
+
parent = parent.parentElement;
|
|
6516
|
+
}
|
|
6517
|
+
return theme;
|
|
6518
|
+
}
|
|
5918
6519
|
class DockviewComponent extends BaseGrid {
|
|
5919
6520
|
get orientation() {
|
|
5920
6521
|
return this.gridview.orientation;
|
|
@@ -5935,6 +6536,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5935
6536
|
}
|
|
5936
6537
|
return activeGroup.activePanel;
|
|
5937
6538
|
}
|
|
6539
|
+
get renderer() {
|
|
6540
|
+
var _a;
|
|
6541
|
+
return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisibile';
|
|
6542
|
+
}
|
|
5938
6543
|
constructor(options) {
|
|
5939
6544
|
var _a;
|
|
5940
6545
|
super({
|
|
@@ -5961,12 +6566,27 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5961
6566
|
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
5962
6567
|
this._onDidActivePanelChange = new Emitter();
|
|
5963
6568
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
5964
|
-
this.
|
|
6569
|
+
this._floatingGroups = [];
|
|
6570
|
+
this._popoutGroups = [];
|
|
6571
|
+
const gready = document.createElement('div');
|
|
6572
|
+
gready.className = 'dv-overlay-render-container';
|
|
6573
|
+
this.gridview.element.appendChild(gready);
|
|
6574
|
+
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
5965
6575
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
5966
|
-
|
|
6576
|
+
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
6577
|
+
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)(() => {
|
|
5967
6578
|
this.updateWatermark();
|
|
5968
6579
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
5969
6580
|
this._bufferOnDidLayoutChange.fire();
|
|
6581
|
+
}), Disposable.from(() => {
|
|
6582
|
+
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6583
|
+
for (const group of [...this._floatingGroups]) {
|
|
6584
|
+
group.dispose();
|
|
6585
|
+
}
|
|
6586
|
+
// iterate over a copy of the array since .dispose() mutates the original array
|
|
6587
|
+
for (const group of [...this._popoutGroups]) {
|
|
6588
|
+
group.dispose();
|
|
6589
|
+
}
|
|
5970
6590
|
}));
|
|
5971
6591
|
this._options = options;
|
|
5972
6592
|
if (!this.options.components) {
|
|
@@ -6036,6 +6656,55 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6036
6656
|
this._api = new DockviewApi(this);
|
|
6037
6657
|
this.updateWatermark();
|
|
6038
6658
|
}
|
|
6659
|
+
addPopoutGroup(item, options) {
|
|
6660
|
+
var _a;
|
|
6661
|
+
let group;
|
|
6662
|
+
let box = options === null || options === void 0 ? void 0 : options.position;
|
|
6663
|
+
if (item instanceof DockviewPanel) {
|
|
6664
|
+
group = this.createGroup();
|
|
6665
|
+
this.removePanel(item, {
|
|
6666
|
+
removeEmptyGroup: true,
|
|
6667
|
+
skipDispose: true,
|
|
6668
|
+
});
|
|
6669
|
+
group.model.openPanel(item);
|
|
6670
|
+
if (!box) {
|
|
6671
|
+
box = this.element.getBoundingClientRect();
|
|
6672
|
+
}
|
|
6673
|
+
}
|
|
6674
|
+
else {
|
|
6675
|
+
group = item;
|
|
6676
|
+
if (!box) {
|
|
6677
|
+
box = group.element.getBoundingClientRect();
|
|
6678
|
+
}
|
|
6679
|
+
const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&
|
|
6680
|
+
options.skipRemoveGroup;
|
|
6681
|
+
if (!skip) {
|
|
6682
|
+
this.doRemoveGroup(item, { skipDispose: true });
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
const theme = getTheme(this.gridview.element);
|
|
6686
|
+
const popoutWindow = new DockviewPopoutGroupPanel(`${this.id}-${group.id}`, // globally unique within dockview
|
|
6687
|
+
group, {
|
|
6688
|
+
className: theme !== null && theme !== void 0 ? theme : '',
|
|
6689
|
+
popoutUrl: (_a = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _a !== void 0 ? _a : '/popout.html',
|
|
6690
|
+
box: {
|
|
6691
|
+
left: window.screenX + box.left,
|
|
6692
|
+
top: window.screenY + box.top,
|
|
6693
|
+
width: box.width,
|
|
6694
|
+
height: box.height,
|
|
6695
|
+
},
|
|
6696
|
+
});
|
|
6697
|
+
popoutWindow.addDisposables({
|
|
6698
|
+
dispose: () => {
|
|
6699
|
+
remove(this._popoutGroups, popoutWindow);
|
|
6700
|
+
this.updateWatermark();
|
|
6701
|
+
},
|
|
6702
|
+
}, popoutWindow.window.onDidClose(() => {
|
|
6703
|
+
this.doAddGroup(group, [0]);
|
|
6704
|
+
}));
|
|
6705
|
+
this._popoutGroups.push(popoutWindow);
|
|
6706
|
+
this.updateWatermark();
|
|
6707
|
+
}
|
|
6039
6708
|
addFloatingGroup(item, coord, options) {
|
|
6040
6709
|
var _a, _b, _c, _d, _e, _f;
|
|
6041
6710
|
let group;
|
|
@@ -6055,9 +6724,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6055
6724
|
this.doRemoveGroup(item, { skipDispose: true });
|
|
6056
6725
|
}
|
|
6057
6726
|
}
|
|
6058
|
-
group.model.
|
|
6059
|
-
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6060
|
-
|
|
6727
|
+
group.model.location = 'floating';
|
|
6728
|
+
const overlayLeft = typeof (coord === null || coord === void 0 ? void 0 : coord.x) === 'number'
|
|
6729
|
+
? Math.max(coord.x, 0)
|
|
6730
|
+
: DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
6731
|
+
const overlayTop = typeof (coord === null || coord === void 0 ? void 0 : coord.y) === 'number'
|
|
6732
|
+
? Math.max(coord.y, 0)
|
|
6733
|
+
: DEFAULT_FLOATING_GROUP_POSITION.top;
|
|
6061
6734
|
const overlay = new Overlay({
|
|
6062
6735
|
container: this.gridview.element,
|
|
6063
6736
|
content: group.element,
|
|
@@ -6101,12 +6774,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6101
6774
|
}), {
|
|
6102
6775
|
dispose: () => {
|
|
6103
6776
|
disposable.dispose();
|
|
6104
|
-
group.model.
|
|
6105
|
-
remove(this.
|
|
6777
|
+
group.model.location = 'grid';
|
|
6778
|
+
remove(this._floatingGroups, floatingGroupPanel);
|
|
6106
6779
|
this.updateWatermark();
|
|
6107
6780
|
},
|
|
6108
6781
|
});
|
|
6109
|
-
this.
|
|
6782
|
+
this._floatingGroups.push(floatingGroupPanel);
|
|
6110
6783
|
this.updateWatermark();
|
|
6111
6784
|
}
|
|
6112
6785
|
orthogonalize(position) {
|
|
@@ -6151,7 +6824,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6151
6824
|
this.gridview.orientation = options.orientation;
|
|
6152
6825
|
}
|
|
6153
6826
|
if (hasFloatingGroupOptionsChanged) {
|
|
6154
|
-
for (const group of this.
|
|
6827
|
+
for (const group of this._floatingGroups) {
|
|
6155
6828
|
switch (this.options.floatingGroupBounds) {
|
|
6156
6829
|
case 'boundedWithinViewport':
|
|
6157
6830
|
group.overlay.minimumInViewportHeight = undefined;
|
|
@@ -6176,8 +6849,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6176
6849
|
}
|
|
6177
6850
|
layout(width, height, forceResize) {
|
|
6178
6851
|
super.layout(width, height, forceResize);
|
|
6179
|
-
if (this.
|
|
6180
|
-
for (const floating of this.
|
|
6852
|
+
if (this._floatingGroups) {
|
|
6853
|
+
for (const floating of this._floatingGroups) {
|
|
6181
6854
|
// ensure floting groups stay within visible boundaries
|
|
6182
6855
|
floating.overlay.setBounds();
|
|
6183
6856
|
}
|
|
@@ -6245,10 +6918,16 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6245
6918
|
collection[panel.id] = panel.toJSON();
|
|
6246
6919
|
return collection;
|
|
6247
6920
|
}, {});
|
|
6248
|
-
const floats = this.
|
|
6921
|
+
const floats = this._floatingGroups.map((group) => {
|
|
6922
|
+
return {
|
|
6923
|
+
data: group.group.toJSON(),
|
|
6924
|
+
position: group.overlay.toJSON(),
|
|
6925
|
+
};
|
|
6926
|
+
});
|
|
6927
|
+
const popoutGroups = this._popoutGroups.map((group) => {
|
|
6249
6928
|
return {
|
|
6250
|
-
data:
|
|
6251
|
-
position:
|
|
6929
|
+
data: group.group.toJSON(),
|
|
6930
|
+
position: group.window.dimensions(),
|
|
6252
6931
|
};
|
|
6253
6932
|
});
|
|
6254
6933
|
const result = {
|
|
@@ -6259,10 +6938,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6259
6938
|
if (floats.length > 0) {
|
|
6260
6939
|
result.floatingGroups = floats;
|
|
6261
6940
|
}
|
|
6941
|
+
if (popoutGroups.length > 0) {
|
|
6942
|
+
result.popoutGroups = popoutGroups;
|
|
6943
|
+
}
|
|
6262
6944
|
return result;
|
|
6263
6945
|
}
|
|
6264
6946
|
fromJSON(data) {
|
|
6265
|
-
var _a;
|
|
6947
|
+
var _a, _b;
|
|
6266
6948
|
this.clear();
|
|
6267
6949
|
if (typeof data !== 'object' || data === null) {
|
|
6268
6950
|
throw new Error('serialized layout must be a non-null object');
|
|
@@ -6329,7 +7011,16 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6329
7011
|
width: position.width,
|
|
6330
7012
|
}, { skipRemoveGroup: true, inDragMode: false });
|
|
6331
7013
|
}
|
|
6332
|
-
|
|
7014
|
+
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
7015
|
+
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
7016
|
+
const { data, position } = serializedPopoutGroup;
|
|
7017
|
+
const group = createGroupFromSerializedState(data);
|
|
7018
|
+
this.addPopoutGroup(group, {
|
|
7019
|
+
skipRemoveGroup: true,
|
|
7020
|
+
position: position !== null && position !== void 0 ? position : undefined,
|
|
7021
|
+
});
|
|
7022
|
+
}
|
|
7023
|
+
for (const floatingGroup of this._floatingGroups) {
|
|
6333
7024
|
floatingGroup.overlay.setBounds();
|
|
6334
7025
|
}
|
|
6335
7026
|
if (typeof activeGroup === 'string') {
|
|
@@ -6361,7 +7052,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6361
7052
|
this._onDidRemoveGroup.fire(group);
|
|
6362
7053
|
}
|
|
6363
7054
|
// iterate over a reassigned array since original array will be modified
|
|
6364
|
-
for (const floatingGroup of [...this.
|
|
7055
|
+
for (const floatingGroup of [...this._floatingGroups]) {
|
|
6365
7056
|
floatingGroup.dispose();
|
|
6366
7057
|
}
|
|
6367
7058
|
// fires clean-up events and clears the underlying HTML gridview.
|
|
@@ -6453,7 +7144,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6453
7144
|
group.model.openPanel(panel);
|
|
6454
7145
|
this.doSetGroupAndPanelActive(group);
|
|
6455
7146
|
}
|
|
6456
|
-
else if (referenceGroup.api.
|
|
7147
|
+
else if (referenceGroup.api.location === 'floating' ||
|
|
7148
|
+
target === 'center') {
|
|
6457
7149
|
panel = this.createPanel(options, referenceGroup);
|
|
6458
7150
|
referenceGroup.model.openPanel(panel);
|
|
6459
7151
|
}
|
|
@@ -6497,6 +7189,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6497
7189
|
}
|
|
6498
7190
|
group.model.removePanel(panel);
|
|
6499
7191
|
if (!options.skipDispose) {
|
|
7192
|
+
this.overlayRenderContainer.detatch(panel);
|
|
6500
7193
|
panel.dispose();
|
|
6501
7194
|
}
|
|
6502
7195
|
if (group.size === 0 && options.removeEmptyGroup) {
|
|
@@ -6513,7 +7206,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6513
7206
|
}
|
|
6514
7207
|
updateWatermark() {
|
|
6515
7208
|
var _a, _b;
|
|
6516
|
-
if (this.groups.filter((x) =>
|
|
7209
|
+
if (this.groups.filter((x) => x.api.location === 'grid').length === 0) {
|
|
6517
7210
|
if (!this.watermark) {
|
|
6518
7211
|
this.watermark = this.createWatermarkComponent();
|
|
6519
7212
|
this.watermark.init({
|
|
@@ -6588,19 +7281,40 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6588
7281
|
}
|
|
6589
7282
|
}
|
|
6590
7283
|
doRemoveGroup(group, options) {
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
if (
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
7284
|
+
if (group.api.location === 'floating') {
|
|
7285
|
+
const floatingGroup = this._floatingGroups.find((_) => _.group === group);
|
|
7286
|
+
if (floatingGroup) {
|
|
7287
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7288
|
+
floatingGroup.group.dispose();
|
|
7289
|
+
this._groups.delete(group.id);
|
|
7290
|
+
this._onDidRemoveGroup.fire(group);
|
|
7291
|
+
}
|
|
7292
|
+
remove(this._floatingGroups, floatingGroup);
|
|
7293
|
+
floatingGroup.dispose();
|
|
7294
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7295
|
+
const groups = Array.from(this._groups.values());
|
|
7296
|
+
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7297
|
+
}
|
|
7298
|
+
return floatingGroup.group;
|
|
6597
7299
|
}
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
7300
|
+
throw new Error('failed to find floating group');
|
|
7301
|
+
}
|
|
7302
|
+
if (group.api.location === 'popout') {
|
|
7303
|
+
const selectedGroup = this._popoutGroups.find((_) => _.group === group);
|
|
7304
|
+
if (selectedGroup) {
|
|
7305
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
7306
|
+
selectedGroup.group.dispose();
|
|
7307
|
+
this._groups.delete(group.id);
|
|
7308
|
+
this._onDidRemoveGroup.fire(group);
|
|
7309
|
+
}
|
|
7310
|
+
selectedGroup.dispose();
|
|
7311
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
7312
|
+
const groups = Array.from(this._groups.values());
|
|
7313
|
+
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
7314
|
+
}
|
|
7315
|
+
return selectedGroup.group;
|
|
6602
7316
|
}
|
|
6603
|
-
|
|
7317
|
+
throw new Error('failed to find popout group');
|
|
6604
7318
|
}
|
|
6605
7319
|
return super.doRemoveGroup(group, options);
|
|
6606
7320
|
}
|
|
@@ -6632,8 +7346,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6632
7346
|
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
6633
7347
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
6634
7348
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
6635
|
-
|
|
6636
|
-
if (!isFloating) {
|
|
7349
|
+
if (sourceGroup.api.location === 'grid') {
|
|
6637
7350
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
6638
7351
|
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
6639
7352
|
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
@@ -6679,12 +7392,25 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6679
7392
|
}
|
|
6680
7393
|
}
|
|
6681
7394
|
else {
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
7395
|
+
switch (sourceGroup.api.location) {
|
|
7396
|
+
case 'grid':
|
|
7397
|
+
this.gridview.removeView(getGridLocation(sourceGroup.element));
|
|
7398
|
+
break;
|
|
7399
|
+
case 'floating': {
|
|
7400
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === sourceGroup);
|
|
7401
|
+
if (!selectedFloatingGroup) {
|
|
7402
|
+
throw new Error('failed to find floating group');
|
|
7403
|
+
}
|
|
7404
|
+
selectedFloatingGroup.dispose();
|
|
7405
|
+
break;
|
|
7406
|
+
}
|
|
7407
|
+
case 'popout': {
|
|
7408
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.group === sourceGroup);
|
|
7409
|
+
if (!selectedPopoutGroup) {
|
|
7410
|
+
throw new Error('failed to find popout group');
|
|
7411
|
+
}
|
|
7412
|
+
selectedPopoutGroup.dispose();
|
|
7413
|
+
}
|
|
6688
7414
|
}
|
|
6689
7415
|
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
6690
7416
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
@@ -6746,7 +7472,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6746
7472
|
const contentComponent = options.component;
|
|
6747
7473
|
const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
|
|
6748
7474
|
const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
|
|
6749
|
-
const panel = new DockviewPanel(options.id, this, this._api, group, view);
|
|
7475
|
+
const panel = new DockviewPanel(options.id, this, this._api, group, view, { renderer: options.renderer });
|
|
6750
7476
|
panel.init({
|
|
6751
7477
|
title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
|
|
6752
7478
|
params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
|