dockview 1.5.1 → 1.5.2
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/LICENSE +21 -21
- package/README.md +52 -52
- package/dist/cjs/actionbar/actionsContainer.d.ts +7 -7
- package/dist/cjs/actionbar/actionsContainer.js +26 -26
- package/dist/cjs/api/component.api.d.ts +144 -144
- package/dist/cjs/api/component.api.js +571 -571
- package/dist/cjs/api/gridviewPanelApi.d.ts +36 -36
- package/dist/cjs/api/gridviewPanelApi.js +47 -47
- package/dist/cjs/api/groupPanelApi.d.ts +34 -34
- package/dist/cjs/api/groupPanelApi.js +85 -85
- package/dist/cjs/api/panelApi.d.ts +81 -81
- package/dist/cjs/api/panelApi.js +121 -121
- package/dist/cjs/api/paneviewPanelApi.d.ts +26 -26
- package/dist/cjs/api/paneviewPanelApi.js +57 -57
- package/dist/cjs/api/splitviewPanelApi.d.ts +32 -32
- package/dist/cjs/api/splitviewPanelApi.js +47 -47
- package/dist/cjs/array.d.ts +13 -13
- package/dist/cjs/array.js +77 -77
- package/dist/cjs/dnd/abstractDragHandler.d.ts +11 -11
- package/dist/cjs/dnd/abstractDragHandler.js +115 -115
- package/dist/cjs/dnd/dataTransfer.d.ts +31 -31
- package/dist/cjs/dnd/dataTransfer.js +100 -100
- package/dist/cjs/dnd/dnd.d.ts +27 -27
- package/dist/cjs/dnd/dnd.js +64 -64
- package/dist/cjs/dnd/droptarget.d.ts +37 -37
- package/dist/cjs/dnd/droptarget.js +201 -201
- package/dist/cjs/dockview/components/tab/defaultTab.d.ts +27 -27
- package/dist/cjs/dockview/components/tab/defaultTab.js +121 -121
- package/dist/cjs/dockview/components/watermark/watermark.d.ts +20 -20
- package/dist/cjs/dockview/components/watermark/watermark.js +101 -101
- package/dist/cjs/dockview/defaultGroupPanelView.d.ts +29 -29
- package/dist/cjs/dockview/defaultGroupPanelView.js +68 -68
- package/dist/cjs/dockview/deserializer.d.ts +5 -5
- package/dist/cjs/dockview/deserializer.js +2 -2
- package/dist/cjs/dockview/dockviewComponent.d.ts +125 -125
- package/dist/cjs/dockview/dockviewComponent.js +614 -614
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +31 -31
- package/dist/cjs/dockview/dockviewGroupPanel.js +156 -156
- package/dist/cjs/dockview/options.d.ts +88 -88
- package/dist/cjs/dockview/options.js +2 -2
- package/dist/cjs/dom.d.ts +14 -14
- package/dist/cjs/dom.js +182 -182
- package/dist/cjs/events.d.ts +30 -30
- package/dist/cjs/events.js +129 -129
- package/dist/cjs/gridview/baseComponentGridview.d.ts +87 -87
- package/dist/cjs/gridview/baseComponentGridview.js +279 -279
- package/dist/cjs/gridview/basePanelView.d.ts +43 -43
- package/dist/cjs/gridview/basePanelView.js +123 -123
- package/dist/cjs/gridview/branchNode.d.ts +49 -46
- package/dist/cjs/gridview/branchNode.js +342 -342
- package/dist/cjs/gridview/branchNode.js.map +1 -1
- package/dist/cjs/gridview/gridview.d.ts +126 -123
- package/dist/cjs/gridview/gridview.js +479 -479
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewComponent.d.ts +85 -85
- package/dist/cjs/gridview/gridviewComponent.js +325 -325
- package/dist/cjs/gridview/gridviewPanel.d.ts +60 -60
- package/dist/cjs/gridview/gridviewPanel.js +202 -202
- package/dist/cjs/gridview/leafNode.d.ts +34 -31
- package/dist/cjs/gridview/leafNode.js +170 -165
- package/dist/cjs/gridview/leafNode.js.map +1 -1
- package/dist/cjs/gridview/options.d.ts +18 -18
- package/dist/cjs/gridview/options.js +2 -2
- package/dist/cjs/gridview/types.d.ts +3 -3
- package/dist/cjs/gridview/types.js +2 -2
- package/dist/cjs/groupview/dnd.d.ts +5 -5
- package/dist/cjs/groupview/dnd.js +9 -9
- package/dist/cjs/groupview/groupPanel.d.ts +32 -32
- package/dist/cjs/groupview/groupPanel.js +2 -2
- package/dist/cjs/groupview/groupview.d.ts +177 -177
- package/dist/cjs/groupview/groupview.js +589 -589
- package/dist/cjs/groupview/groupviewPanel.d.ts +35 -35
- package/dist/cjs/groupview/groupviewPanel.js +128 -128
- package/dist/cjs/groupview/panel/content.d.ts +30 -30
- package/dist/cjs/groupview/panel/content.js +100 -100
- package/dist/cjs/groupview/tab.d.ts +41 -41
- package/dist/cjs/groupview/tab.js +120 -120
- package/dist/cjs/groupview/titlebar/tabsContainer.d.ts +68 -68
- package/dist/cjs/groupview/titlebar/tabsContainer.js +258 -258
- package/dist/cjs/groupview/types.d.ts +52 -52
- package/dist/cjs/groupview/types.js +2 -2
- package/dist/cjs/hostedContainer.d.ts +23 -23
- package/dist/cjs/hostedContainer.js +73 -73
- package/dist/cjs/index.d.ts +30 -30
- package/dist/cjs/index.js +46 -46
- package/dist/cjs/lifecycle.d.ts +22 -22
- package/dist/cjs/lifecycle.js +88 -88
- package/dist/cjs/math.d.ts +4 -4
- package/dist/cjs/math.js +15 -15
- package/dist/cjs/panel/componentFactory.d.ts +8 -8
- package/dist/cjs/panel/componentFactory.js +30 -30
- package/dist/cjs/panel/types.d.ts +33 -33
- package/dist/cjs/panel/types.js +2 -2
- package/dist/cjs/paneview/defaultPaneviewHeader.d.ts +21 -21
- package/dist/cjs/paneview/defaultPaneviewHeader.js +90 -90
- package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +19 -19
- package/dist/cjs/paneview/draggablePaneviewPanel.js +129 -129
- package/dist/cjs/paneview/options.d.ts +27 -27
- package/dist/cjs/paneview/options.js +2 -2
- package/dist/cjs/paneview/paneview.d.ts +40 -40
- package/dist/cjs/paneview/paneview.js +201 -201
- package/dist/cjs/paneview/paneviewComponent.d.ts +129 -129
- package/dist/cjs/paneview/paneviewComponent.js +394 -394
- package/dist/cjs/paneview/paneviewPanel.d.ts +92 -89
- package/dist/cjs/paneview/paneviewPanel.js +274 -274
- package/dist/cjs/paneview/paneviewPanel.js.map +1 -1
- package/dist/cjs/react/deserializer.d.ts +9 -9
- package/dist/cjs/react/deserializer.js +43 -43
- package/dist/cjs/react/dockview/defaultTab.d.ts +4 -4
- package/dist/cjs/react/dockview/defaultTab.js +72 -72
- package/dist/cjs/react/dockview/dockview.d.ts +34 -34
- package/dist/cjs/react/dockview/dockview.js +212 -212
- package/dist/cjs/react/dockview/groupControlsRenderer.d.ts +43 -43
- package/dist/cjs/react/dockview/groupControlsRenderer.js +86 -86
- package/dist/cjs/react/dockview/reactContentPart.d.ts +30 -30
- package/dist/cjs/react/dockview/reactContentPart.js +58 -58
- package/dist/cjs/react/dockview/reactHeaderPart.d.ts +26 -26
- package/dist/cjs/react/dockview/reactHeaderPart.js +55 -55
- package/dist/cjs/react/dockview/reactWatermarkPart.d.ts +29 -29
- package/dist/cjs/react/dockview/reactWatermarkPart.js +65 -65
- package/dist/cjs/react/dockview/v2/reactContentRenderer.d.ts +29 -29
- package/dist/cjs/react/dockview/v2/reactContentRenderer.js +87 -87
- package/dist/cjs/react/dockview/v2/reactGroupPanelView.d.ts +7 -7
- package/dist/cjs/react/dockview/v2/reactGroupPanelView.js +34 -34
- package/dist/cjs/react/dockview/v2/webviewContentRenderer.d.ts +18 -18
- package/dist/cjs/react/dockview/v2/webviewContentRenderer.js +45 -45
- package/dist/cjs/react/gridview/gridview.d.ts +24 -24
- package/dist/cjs/react/gridview/gridview.js +112 -112
- package/dist/cjs/react/gridview/view.d.ts +11 -11
- package/dist/cjs/react/gridview/view.js +40 -40
- package/dist/cjs/react/index.d.ts +9 -9
- package/dist/cjs/react/index.js +23 -23
- package/dist/cjs/react/paneview/paneview.d.ts +30 -30
- package/dist/cjs/react/paneview/paneview.js +155 -155
- package/dist/cjs/react/paneview/view.d.ts +20 -20
- package/dist/cjs/react/paneview/view.js +44 -44
- package/dist/cjs/react/react.d.ts +36 -36
- package/dist/cjs/react/react.js +194 -194
- package/dist/cjs/react/splitview/splitview.d.ts +24 -24
- package/dist/cjs/react/splitview/splitview.js +108 -108
- package/dist/cjs/react/splitview/view.d.ts +10 -10
- package/dist/cjs/react/splitview/view.js +40 -40
- package/dist/cjs/react/svg.d.ts +3 -3
- package/dist/cjs/react/svg.js +35 -35
- package/dist/cjs/react/types.d.ts +7 -7
- package/dist/cjs/react/types.js +2 -2
- package/dist/cjs/splitview/core/options.d.ts +26 -26
- package/dist/cjs/splitview/core/options.js +2 -2
- package/dist/cjs/splitview/core/splitview.d.ts +127 -124
- package/dist/cjs/splitview/core/splitview.js +908 -908
- package/dist/cjs/splitview/core/splitview.js.map +1 -1
- package/dist/cjs/splitview/core/viewItem.d.ts +25 -25
- package/dist/cjs/splitview/core/viewItem.js +124 -124
- package/dist/cjs/splitview/splitviewComponent.d.ts +101 -101
- package/dist/cjs/splitview/splitviewComponent.js +373 -373
- package/dist/cjs/splitview/splitviewPanel.d.ts +45 -42
- package/dist/cjs/splitview/splitviewPanel.js +178 -178
- package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
- package/dist/cjs/svg.d.ts +3 -3
- package/dist/cjs/svg.js +43 -43
- package/dist/cjs/types.d.ts +7 -7
- package/dist/cjs/types.js +2 -2
- package/dist/dockview.amd.js +6737 -6732
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.noStyle.js +6743 -6738
- package/dist/dockview.cjs.js +6736 -6731
- package/dist/dockview.esm.js +6731 -6726
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.js +6737 -6732
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.noStyle.js +6743 -6738
- package/dist/esm/actionbar/actionsContainer.d.ts +7 -7
- package/dist/esm/actionbar/actionsContainer.js +17 -17
- package/dist/esm/api/component.api.d.ts +144 -144
- package/dist/esm/api/component.api.js +326 -326
- package/dist/esm/api/gridviewPanelApi.d.ts +36 -36
- package/dist/esm/api/gridviewPanelApi.js +25 -25
- package/dist/esm/api/groupPanelApi.d.ts +34 -34
- package/dist/esm/api/groupPanelApi.js +50 -50
- package/dist/esm/api/panelApi.d.ts +81 -81
- package/dist/esm/api/panelApi.js +79 -79
- package/dist/esm/api/paneviewPanelApi.d.ts +26 -26
- package/dist/esm/api/paneviewPanelApi.js +27 -27
- package/dist/esm/api/splitviewPanelApi.d.ts +32 -32
- package/dist/esm/api/splitviewPanelApi.js +25 -25
- package/dist/esm/array.d.ts +13 -13
- package/dist/esm/array.js +67 -67
- package/dist/esm/dnd/abstractDragHandler.d.ts +11 -11
- package/dist/esm/dnd/abstractDragHandler.js +37 -37
- package/dist/esm/dnd/dataTransfer.d.ts +31 -31
- package/dist/esm/dnd/dataTransfer.js +69 -69
- package/dist/esm/dnd/dnd.d.ts +27 -27
- package/dist/esm/dnd/dnd.js +41 -41
- package/dist/esm/dnd/droptarget.d.ts +37 -37
- package/dist/esm/dnd/droptarget.js +167 -167
- package/dist/esm/dockview/components/tab/defaultTab.d.ts +27 -27
- package/dist/esm/dockview/components/tab/defaultTab.js +79 -79
- package/dist/esm/dockview/components/watermark/watermark.d.ts +20 -20
- package/dist/esm/dockview/components/watermark/watermark.js +70 -70
- package/dist/esm/dockview/defaultGroupPanelView.d.ts +29 -29
- package/dist/esm/dockview/defaultGroupPanelView.js +44 -44
- package/dist/esm/dockview/deserializer.d.ts +5 -5
- package/dist/esm/dockview/deserializer.js +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +125 -125
- package/dist/esm/dockview/dockviewComponent.js +468 -468
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +31 -31
- package/dist/esm/dockview/dockviewGroupPanel.js +107 -107
- package/dist/esm/dockview/options.d.ts +88 -88
- package/dist/esm/dockview/options.js +1 -1
- package/dist/esm/dom.d.ts +14 -14
- package/dist/esm/dom.js +113 -113
- package/dist/esm/events.d.ts +30 -30
- package/dist/esm/events.js +88 -88
- package/dist/esm/gridview/baseComponentGridview.d.ts +87 -87
- package/dist/esm/gridview/baseComponentGridview.js +189 -189
- package/dist/esm/gridview/basePanelView.d.ts +43 -43
- package/dist/esm/gridview/basePanelView.js +74 -74
- package/dist/esm/gridview/branchNode.d.ts +49 -46
- package/dist/esm/gridview/branchNode.js +218 -218
- package/dist/esm/gridview/gridview.d.ts +126 -123
- package/dist/esm/gridview/gridview.js +397 -397
- package/dist/esm/gridview/gridviewComponent.d.ts +85 -85
- package/dist/esm/gridview/gridviewComponent.js +238 -238
- package/dist/esm/gridview/gridviewPanel.d.ts +60 -60
- package/dist/esm/gridview/gridviewPanel.js +138 -138
- package/dist/esm/gridview/leafNode.d.ts +34 -31
- package/dist/esm/gridview/leafNode.js +103 -98
- package/dist/esm/gridview/options.d.ts +18 -18
- package/dist/esm/gridview/options.js +1 -1
- package/dist/esm/gridview/types.d.ts +3 -3
- package/dist/esm/gridview/types.js +1 -1
- package/dist/esm/groupview/dnd.d.ts +5 -5
- package/dist/esm/groupview/dnd.js +6 -6
- package/dist/esm/groupview/groupPanel.d.ts +32 -32
- package/dist/esm/groupview/groupPanel.js +1 -1
- package/dist/esm/groupview/groupview.d.ts +177 -177
- package/dist/esm/groupview/groupview.js +444 -444
- package/dist/esm/groupview/groupviewPanel.d.ts +35 -35
- package/dist/esm/groupview/groupviewPanel.js +61 -61
- package/dist/esm/groupview/panel/content.d.ts +30 -30
- package/dist/esm/groupview/panel/content.js +73 -73
- package/dist/esm/groupview/tab.d.ts +41 -41
- package/dist/esm/groupview/tab.js +90 -90
- package/dist/esm/groupview/titlebar/tabsContainer.d.ts +68 -68
- package/dist/esm/groupview/titlebar/tabsContainer.js +190 -190
- package/dist/esm/groupview/types.d.ts +52 -52
- package/dist/esm/groupview/types.js +1 -1
- package/dist/esm/hostedContainer.d.ts +23 -23
- package/dist/esm/hostedContainer.js +63 -63
- package/dist/esm/index.d.ts +30 -30
- package/dist/esm/index.js +23 -23
- package/dist/esm/lifecycle.d.ts +22 -22
- package/dist/esm/lifecycle.js +39 -39
- package/dist/esm/math.d.ts +4 -4
- package/dist/esm/math.js +10 -10
- package/dist/esm/panel/componentFactory.d.ts +8 -8
- package/dist/esm/panel/componentFactory.js +24 -24
- package/dist/esm/panel/types.d.ts +33 -33
- package/dist/esm/panel/types.js +1 -1
- package/dist/esm/paneview/defaultPaneviewHeader.d.ts +21 -21
- package/dist/esm/paneview/defaultPaneviewHeader.js +63 -63
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +19 -19
- package/dist/esm/paneview/draggablePaneviewPanel.js +90 -90
- package/dist/esm/paneview/options.d.ts +27 -27
- package/dist/esm/paneview/options.js +1 -1
- package/dist/esm/paneview/paneview.d.ts +40 -40
- package/dist/esm/paneview/paneview.js +145 -145
- package/dist/esm/paneview/paneviewComponent.d.ts +129 -129
- package/dist/esm/paneview/paneviewComponent.js +270 -270
- package/dist/esm/paneview/paneviewPanel.d.ts +92 -89
- package/dist/esm/paneview/paneviewPanel.js +191 -191
- package/dist/esm/react/deserializer.d.ts +9 -9
- package/dist/esm/react/deserializer.js +38 -38
- package/dist/esm/react/dockview/defaultTab.d.ts +4 -4
- package/dist/esm/react/dockview/defaultTab.js +34 -34
- package/dist/esm/react/dockview/dockview.d.ts +34 -34
- package/dist/esm/react/dockview/dockview.js +157 -157
- package/dist/esm/react/dockview/groupControlsRenderer.d.ts +43 -43
- package/dist/esm/react/dockview/groupControlsRenderer.js +68 -68
- package/dist/esm/react/dockview/reactContentPart.d.ts +30 -30
- package/dist/esm/react/dockview/reactContentPart.js +49 -49
- package/dist/esm/react/dockview/reactHeaderPart.d.ts +26 -26
- package/dist/esm/react/dockview/reactHeaderPart.js +46 -46
- package/dist/esm/react/dockview/reactWatermarkPart.d.ts +29 -29
- package/dist/esm/react/dockview/reactWatermarkPart.js +55 -55
- package/dist/esm/react/dockview/v2/reactContentRenderer.d.ts +29 -29
- package/dist/esm/react/dockview/v2/reactContentRenderer.js +69 -69
- package/dist/esm/react/dockview/v2/reactGroupPanelView.d.ts +7 -7
- package/dist/esm/react/dockview/v2/reactGroupPanelView.js +12 -12
- package/dist/esm/react/dockview/v2/webviewContentRenderer.d.ts +18 -18
- package/dist/esm/react/dockview/v2/webviewContentRenderer.js +36 -36
- package/dist/esm/react/gridview/gridview.d.ts +24 -24
- package/dist/esm/react/gridview/gridview.js +70 -70
- package/dist/esm/react/gridview/view.d.ts +11 -11
- package/dist/esm/react/gridview/view.js +18 -18
- package/dist/esm/react/index.d.ts +9 -9
- package/dist/esm/react/index.js +7 -7
- package/dist/esm/react/paneview/paneview.d.ts +30 -30
- package/dist/esm/react/paneview/paneview.js +100 -100
- package/dist/esm/react/paneview/view.d.ts +20 -20
- package/dist/esm/react/paneview/view.js +35 -35
- package/dist/esm/react/react.d.ts +36 -36
- package/dist/esm/react/react.js +125 -125
- package/dist/esm/react/splitview/splitview.d.ts +24 -24
- package/dist/esm/react/splitview/splitview.js +66 -66
- package/dist/esm/react/splitview/view.d.ts +10 -10
- package/dist/esm/react/splitview/view.js +18 -18
- package/dist/esm/react/svg.d.ts +3 -3
- package/dist/esm/react/svg.js +7 -7
- package/dist/esm/react/types.d.ts +7 -7
- package/dist/esm/react/types.js +1 -1
- package/dist/esm/splitview/core/options.d.ts +26 -26
- package/dist/esm/splitview/core/options.js +1 -1
- package/dist/esm/splitview/core/splitview.d.ts +127 -124
- package/dist/esm/splitview/core/splitview.js +689 -689
- package/dist/esm/splitview/core/viewItem.d.ts +25 -25
- package/dist/esm/splitview/core/viewItem.js +79 -79
- package/dist/esm/splitview/splitviewComponent.d.ts +101 -101
- package/dist/esm/splitview/splitviewComponent.js +249 -249
- package/dist/esm/splitview/splitviewPanel.d.ts +45 -42
- package/dist/esm/splitview/splitviewPanel.js +107 -107
- package/dist/esm/svg.d.ts +3 -3
- package/dist/esm/svg.js +31 -31
- package/dist/esm/types.d.ts +7 -7
- package/dist/esm/types.js +1 -1
- package/package.json +2 -2
|
@@ -1,468 +1,468 @@
|
|
|
1
|
-
import { getRelativeLocation, getGridLocation, } from '../gridview/gridview';
|
|
2
|
-
import { Position } from '../dnd/droptarget';
|
|
3
|
-
import { tail, sequenceEquals } from '../array';
|
|
4
|
-
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
5
|
-
import { CompositeDisposable } from '../lifecycle';
|
|
6
|
-
import { Event, Emitter } from '../events';
|
|
7
|
-
import { Watermark } from './components/watermark/watermark';
|
|
8
|
-
import { sequentialNumberGenerator } from '../math';
|
|
9
|
-
import { createComponent } from '../panel/componentFactory';
|
|
10
|
-
import { BaseGrid, toTarget, } from '../gridview/baseComponentGridview';
|
|
11
|
-
import { DockviewApi } from '../api/component.api';
|
|
12
|
-
import { Orientation } from '../splitview/core/splitview';
|
|
13
|
-
import { DefaultTab } from './components/tab/defaultTab';
|
|
14
|
-
import { GroupPanel } from '../groupview/groupviewPanel';
|
|
15
|
-
import { DefaultGroupPanelView } from './defaultGroupPanelView';
|
|
16
|
-
const nextGroupId = sequentialNumberGenerator();
|
|
17
|
-
export class DockviewComponent extends BaseGrid {
|
|
18
|
-
constructor(element, options) {
|
|
19
|
-
super(element, {
|
|
20
|
-
proportionalLayout: true,
|
|
21
|
-
orientation: options.orientation || Orientation.HORIZONTAL,
|
|
22
|
-
styles: options.styles,
|
|
23
|
-
});
|
|
24
|
-
this._onDidDrop = new Emitter();
|
|
25
|
-
this.onDidDrop = this._onDidDrop.event;
|
|
26
|
-
this._onDidRemovePanel = new Emitter();
|
|
27
|
-
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
28
|
-
this._onDidAddPanel = new Emitter();
|
|
29
|
-
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
30
|
-
this._onDidLayoutFromJSON = new Emitter();
|
|
31
|
-
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
32
|
-
this._onDidActivePanelChange = new Emitter();
|
|
33
|
-
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
34
|
-
this.addDisposables(this._onDidDrop, Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
35
|
-
this._bufferOnDidLayoutChange.fire();
|
|
36
|
-
}));
|
|
37
|
-
this._options = options;
|
|
38
|
-
if (!this.options.components) {
|
|
39
|
-
this.options.components = {};
|
|
40
|
-
}
|
|
41
|
-
if (!this.options.frameworkComponents) {
|
|
42
|
-
this.options.frameworkComponents = {};
|
|
43
|
-
}
|
|
44
|
-
if (!this.options.frameworkTabComponents) {
|
|
45
|
-
this.options.frameworkTabComponents = {};
|
|
46
|
-
}
|
|
47
|
-
if (!this.options.tabComponents) {
|
|
48
|
-
this.options.tabComponents = {};
|
|
49
|
-
}
|
|
50
|
-
if (!this.options.watermarkComponent &&
|
|
51
|
-
!this.options.watermarkFrameworkComponent) {
|
|
52
|
-
this.options.watermarkComponent = Watermark;
|
|
53
|
-
}
|
|
54
|
-
this._api = new DockviewApi(this);
|
|
55
|
-
}
|
|
56
|
-
get totalPanels() {
|
|
57
|
-
return this.panels.length;
|
|
58
|
-
}
|
|
59
|
-
get panels() {
|
|
60
|
-
return this.groups.flatMap((group) => group.panels);
|
|
61
|
-
}
|
|
62
|
-
get deserializer() {
|
|
63
|
-
return this._deserializer;
|
|
64
|
-
}
|
|
65
|
-
set deserializer(value) {
|
|
66
|
-
this._deserializer = value;
|
|
67
|
-
}
|
|
68
|
-
get options() {
|
|
69
|
-
return this._options;
|
|
70
|
-
}
|
|
71
|
-
get activePanel() {
|
|
72
|
-
const activeGroup = this.activeGroup;
|
|
73
|
-
if (!activeGroup) {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
return activeGroup.activePanel;
|
|
77
|
-
}
|
|
78
|
-
set tabHeight(height) {
|
|
79
|
-
this.options.tabHeight = height;
|
|
80
|
-
this._groups.forEach((value) => {
|
|
81
|
-
value.value.model.header.height = height;
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
get tabHeight() {
|
|
85
|
-
return this.options.tabHeight;
|
|
86
|
-
}
|
|
87
|
-
updateOptions(options) {
|
|
88
|
-
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
89
|
-
this.gridview.orientation !== options.orientation;
|
|
90
|
-
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
91
|
-
if (hasOrientationChanged) {
|
|
92
|
-
this.gridview.orientation = options.orientation;
|
|
93
|
-
}
|
|
94
|
-
this.layout(this.gridview.width, this.gridview.height, true);
|
|
95
|
-
}
|
|
96
|
-
focus() {
|
|
97
|
-
var _a;
|
|
98
|
-
(_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
|
|
99
|
-
}
|
|
100
|
-
getGroupPanel(id) {
|
|
101
|
-
return this.panels.find((panel) => panel.id === id);
|
|
102
|
-
}
|
|
103
|
-
setActivePanel(panel) {
|
|
104
|
-
this.doSetGroupActive(panel.group);
|
|
105
|
-
panel.group.model.openPanel(panel);
|
|
106
|
-
}
|
|
107
|
-
moveToNext(options = {}) {
|
|
108
|
-
var _a;
|
|
109
|
-
if (!options.group) {
|
|
110
|
-
if (!this.activeGroup) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
options.group = this.activeGroup;
|
|
114
|
-
}
|
|
115
|
-
if (options.includePanel && options.group) {
|
|
116
|
-
if (options.group.activePanel !==
|
|
117
|
-
options.group.panels[options.group.panels.length - 1]) {
|
|
118
|
-
options.group.model.moveToNext({ suppressRoll: true });
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
const location = getGridLocation(options.group.element);
|
|
123
|
-
const next = (_a = this.gridview.next(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
124
|
-
this.doSetGroupActive(next);
|
|
125
|
-
}
|
|
126
|
-
moveToPrevious(options = {}) {
|
|
127
|
-
var _a;
|
|
128
|
-
if (!options.group) {
|
|
129
|
-
if (!this.activeGroup) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
options.group = this.activeGroup;
|
|
133
|
-
}
|
|
134
|
-
if (options.includePanel && options.group) {
|
|
135
|
-
if (options.group.activePanel !==
|
|
136
|
-
options.group.panels[0]) {
|
|
137
|
-
options.group.model.moveToPrevious({ suppressRoll: true });
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
const location = getGridLocation(options.group.element);
|
|
142
|
-
const next = (_a = this.gridview.previous(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
143
|
-
if (next) {
|
|
144
|
-
this.doSetGroupActive(next);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Serialize the current state of the layout
|
|
149
|
-
*
|
|
150
|
-
* @returns A JSON respresentation of the layout
|
|
151
|
-
*/
|
|
152
|
-
toJSON() {
|
|
153
|
-
var _a;
|
|
154
|
-
const data = this.gridview.serialize();
|
|
155
|
-
const panels = this.panels.reduce((collection, panel) => {
|
|
156
|
-
collection[panel.id] = panel.toJSON();
|
|
157
|
-
return collection;
|
|
158
|
-
}, {});
|
|
159
|
-
return {
|
|
160
|
-
grid: data,
|
|
161
|
-
panels,
|
|
162
|
-
activeGroup: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
|
|
163
|
-
options: { tabHeight: this.tabHeight },
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
fromJSON(data) {
|
|
167
|
-
this.clear();
|
|
168
|
-
if (!this.deserializer) {
|
|
169
|
-
throw new Error('invalid deserializer');
|
|
170
|
-
}
|
|
171
|
-
const { grid, panels, options, activeGroup } = data;
|
|
172
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.tabHeight) === 'number') {
|
|
173
|
-
this.tabHeight = options.tabHeight;
|
|
174
|
-
}
|
|
175
|
-
if (!this.deserializer) {
|
|
176
|
-
throw new Error('no deserializer provided');
|
|
177
|
-
}
|
|
178
|
-
this.gridview.deserialize(grid, {
|
|
179
|
-
fromJSON: (node) => {
|
|
180
|
-
const { id, locked, hideHeader, views, activeView } = node.data;
|
|
181
|
-
const group = this.createGroup({
|
|
182
|
-
id,
|
|
183
|
-
locked: !!locked,
|
|
184
|
-
hideHeader: !!hideHeader,
|
|
185
|
-
});
|
|
186
|
-
this._onDidAddGroup.fire(group);
|
|
187
|
-
for (const child of views) {
|
|
188
|
-
const panel = this.deserializer.fromJSON(panels[child], group);
|
|
189
|
-
const isActive = typeof activeView === 'string' && activeView === panel.id;
|
|
190
|
-
group.model.openPanel(panel, {
|
|
191
|
-
skipSetPanelActive: !isActive,
|
|
192
|
-
skipSetGroupActive: true
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
if (!group.activePanel && group.panels.length > 0) {
|
|
196
|
-
group.model.openPanel(group.panels[group.panels.length - 1], {
|
|
197
|
-
skipSetGroupActive: true
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
return group;
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
if (typeof activeGroup === 'string') {
|
|
204
|
-
const panel = this.getPanel(activeGroup);
|
|
205
|
-
if (panel) {
|
|
206
|
-
this.doSetGroupActive(panel);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
this.gridview.layout(this.width, this.height);
|
|
210
|
-
this._onDidLayoutFromJSON.fire();
|
|
211
|
-
}
|
|
212
|
-
clear() {
|
|
213
|
-
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
214
|
-
const hasActiveGroup = !!this.activeGroup;
|
|
215
|
-
const hasActivePanel = !!this.activePanel;
|
|
216
|
-
for (const group of groups) {
|
|
217
|
-
// remove the group will automatically remove the panels
|
|
218
|
-
this.removeGroup(group, true);
|
|
219
|
-
}
|
|
220
|
-
if (hasActiveGroup) {
|
|
221
|
-
this.doSetGroupActive(undefined);
|
|
222
|
-
}
|
|
223
|
-
if (hasActivePanel) {
|
|
224
|
-
this._onDidActivePanelChange.fire(undefined);
|
|
225
|
-
}
|
|
226
|
-
this.gridview.clear();
|
|
227
|
-
}
|
|
228
|
-
closeAllGroups() {
|
|
229
|
-
for (const entry of this._groups.entries()) {
|
|
230
|
-
const [_, group] = entry;
|
|
231
|
-
group.value.model.closeAllPanels();
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
addPanel(options) {
|
|
235
|
-
var _a, _b;
|
|
236
|
-
if (this.panels.find((_) => _.id === options.id)) {
|
|
237
|
-
throw new Error(`panel with id ${options.id} already exists`);
|
|
238
|
-
}
|
|
239
|
-
let referenceGroup;
|
|
240
|
-
if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
|
|
241
|
-
const referencePanel = this.getGroupPanel(options.position.referencePanel);
|
|
242
|
-
if (!referencePanel) {
|
|
243
|
-
throw new Error(`referencePanel ${options.position.referencePanel} does not exist`);
|
|
244
|
-
}
|
|
245
|
-
referenceGroup = this.findGroup(referencePanel);
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
referenceGroup = this.activeGroup;
|
|
249
|
-
}
|
|
250
|
-
let panel;
|
|
251
|
-
if (referenceGroup) {
|
|
252
|
-
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
253
|
-
if (target === Position.Center) {
|
|
254
|
-
panel = this.createPanel(options, referenceGroup);
|
|
255
|
-
referenceGroup.model.openPanel(panel);
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
const location = getGridLocation(referenceGroup.element);
|
|
259
|
-
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
260
|
-
const group = this.createGroupAtLocation(relativeLocation);
|
|
261
|
-
panel = this.createPanel(options, group);
|
|
262
|
-
group.model.openPanel(panel);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
const group = this.createGroupAtLocation();
|
|
267
|
-
panel = this.createPanel(options, group);
|
|
268
|
-
group.model.openPanel(panel);
|
|
269
|
-
}
|
|
270
|
-
return panel;
|
|
271
|
-
}
|
|
272
|
-
removePanel(panel, options = {
|
|
273
|
-
removeEmptyGroup: true,
|
|
274
|
-
skipDispose: false,
|
|
275
|
-
}) {
|
|
276
|
-
const group = panel.group;
|
|
277
|
-
if (!group) {
|
|
278
|
-
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
279
|
-
}
|
|
280
|
-
group.model.removePanel(panel);
|
|
281
|
-
panel.dispose();
|
|
282
|
-
const retainGroupForWatermark = this.size === 1;
|
|
283
|
-
if (!retainGroupForWatermark &&
|
|
284
|
-
group.size === 0 &&
|
|
285
|
-
options.removeEmptyGroup) {
|
|
286
|
-
this.removeGroup(group);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
createWatermarkComponent() {
|
|
290
|
-
var _a;
|
|
291
|
-
return createComponent('watermark-id', 'watermark-name', this.options.watermarkComponent
|
|
292
|
-
? { 'watermark-name': this.options.watermarkComponent }
|
|
293
|
-
: {}, this.options.watermarkFrameworkComponent
|
|
294
|
-
? { 'watermark-name': this.options.watermarkFrameworkComponent }
|
|
295
|
-
: {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
|
|
296
|
-
}
|
|
297
|
-
addEmptyGroup(options) {
|
|
298
|
-
const group = this.createGroup();
|
|
299
|
-
if (options) {
|
|
300
|
-
const referencePanel = this.panels.find((panel) => panel.id === options.referencePanel);
|
|
301
|
-
if (!referencePanel) {
|
|
302
|
-
throw new Error(`reference panel ${options.referencePanel} does not exist`);
|
|
303
|
-
}
|
|
304
|
-
const referenceGroup = this.findGroup(referencePanel);
|
|
305
|
-
if (!referenceGroup) {
|
|
306
|
-
throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
|
|
307
|
-
}
|
|
308
|
-
const target = toTarget(options.direction || 'within');
|
|
309
|
-
const location = getGridLocation(referenceGroup.element);
|
|
310
|
-
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
311
|
-
this.doAddGroup(group, relativeLocation);
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
this.doAddGroup(group);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
removeGroup(group, skipActive = false) {
|
|
318
|
-
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
319
|
-
for (const panel of panels) {
|
|
320
|
-
this.removePanel(panel, {
|
|
321
|
-
removeEmptyGroup: false,
|
|
322
|
-
skipDispose: false,
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
super.doRemoveGroup(group, { skipActive });
|
|
326
|
-
}
|
|
327
|
-
moveGroupOrPanel(referenceGroup, groupId, itemId, target, index) {
|
|
328
|
-
var _a;
|
|
329
|
-
const sourceGroup = groupId
|
|
330
|
-
? (_a = this._groups.get(groupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
331
|
-
: undefined;
|
|
332
|
-
if (!target || target === Position.Center) {
|
|
333
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
334
|
-
this.panels.find((panel) => panel.id === itemId);
|
|
335
|
-
if (!groupItem) {
|
|
336
|
-
throw new Error(`No panel with id ${itemId}`);
|
|
337
|
-
}
|
|
338
|
-
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
339
|
-
this.doRemoveGroup(sourceGroup);
|
|
340
|
-
}
|
|
341
|
-
referenceGroup.model.openPanel(groupItem, { index });
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
345
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
346
|
-
if (sourceGroup && sourceGroup.size < 2) {
|
|
347
|
-
const [targetParentLocation, to] = tail(targetLocation);
|
|
348
|
-
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
349
|
-
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
350
|
-
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
351
|
-
// special case when 'swapping' two views within same grid location
|
|
352
|
-
// if a group has one tab - we are essentially moving the 'group'
|
|
353
|
-
// which is equivalent to swapping two views in this case
|
|
354
|
-
this.gridview.moveView(sourceParentLocation, from, to);
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
// source group will become empty so delete the group
|
|
358
|
-
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
359
|
-
skipActive: true,
|
|
360
|
-
skipDispose: true,
|
|
361
|
-
});
|
|
362
|
-
// after deleting the group we need to re-evaulate the ref location
|
|
363
|
-
const updatedReferenceLocation = getGridLocation(referenceGroup.element);
|
|
364
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);
|
|
365
|
-
this.doAddGroup(targetGroup, location);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
370
|
-
this.panels.find((panel) => panel.id === itemId);
|
|
371
|
-
if (!groupItem) {
|
|
372
|
-
throw new Error(`No panel with id ${itemId}`);
|
|
373
|
-
}
|
|
374
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
375
|
-
const group = this.createGroupAtLocation(dropLocation);
|
|
376
|
-
group.model.openPanel(groupItem);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
doSetGroupActive(group, skipFocus) {
|
|
381
|
-
var _a, _b;
|
|
382
|
-
const isGroupAlreadyFocused = this._activeGroup === group;
|
|
383
|
-
super.doSetGroupActive(group, skipFocus);
|
|
384
|
-
if (!isGroupAlreadyFocused && ((_a = this._activeGroup) === null || _a === void 0 ? void 0 : _a.activePanel)) {
|
|
385
|
-
this._onDidActivePanelChange.fire((_b = this._activeGroup) === null || _b === void 0 ? void 0 : _b.activePanel);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
createGroup(options) {
|
|
389
|
-
if (!options) {
|
|
390
|
-
options = { tabHeight: this.tabHeight };
|
|
391
|
-
}
|
|
392
|
-
if (typeof options.tabHeight !== 'number') {
|
|
393
|
-
options.tabHeight = this.tabHeight;
|
|
394
|
-
}
|
|
395
|
-
let id = options === null || options === void 0 ? void 0 : options.id;
|
|
396
|
-
if (id && this._groups.has(options.id)) {
|
|
397
|
-
console.warn(`Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
|
|
398
|
-
id = undefined;
|
|
399
|
-
}
|
|
400
|
-
if (!id) {
|
|
401
|
-
id = nextGroupId.next();
|
|
402
|
-
while (this._groups.has(id)) {
|
|
403
|
-
id = nextGroupId.next();
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
const view = new GroupPanel(this, id, options);
|
|
407
|
-
view.init({ params: {}, accessor: null }); // required to initialized .part and allow for correct disposal of group
|
|
408
|
-
if (!this._groups.has(view.id)) {
|
|
409
|
-
const disposable = new CompositeDisposable(view.model.onMove((event) => {
|
|
410
|
-
const { groupId, itemId, target, index } = event;
|
|
411
|
-
this.moveGroupOrPanel(view, groupId, itemId, target, index);
|
|
412
|
-
}), view.model.onDidDrop((event) => {
|
|
413
|
-
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: view }));
|
|
414
|
-
}), view.model.onDidAddPanel((event) => {
|
|
415
|
-
this._onDidAddPanel.fire(event.panel);
|
|
416
|
-
}), view.model.onDidRemovePanel((event) => {
|
|
417
|
-
this._onDidRemovePanel.fire(event.panel);
|
|
418
|
-
}), view.model.onDidActivePanelChange((event) => {
|
|
419
|
-
this._onDidActivePanelChange.fire(event.panel);
|
|
420
|
-
}));
|
|
421
|
-
this._groups.set(view.id, { value: view, disposable });
|
|
422
|
-
}
|
|
423
|
-
// TODO: must be called after the above listeners have been setup,
|
|
424
|
-
// not an ideal pattern
|
|
425
|
-
view.initialize();
|
|
426
|
-
if (typeof this.options.tabHeight === 'number') {
|
|
427
|
-
view.model.header.height = this.options.tabHeight;
|
|
428
|
-
}
|
|
429
|
-
return view;
|
|
430
|
-
}
|
|
431
|
-
createPanel(options, group) {
|
|
432
|
-
const view = new DefaultGroupPanelView({
|
|
433
|
-
content: this.createContentComponent(options.id, options.component),
|
|
434
|
-
tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
|
|
435
|
-
});
|
|
436
|
-
const panel = new DockviewGroupPanel(options.id, this, this._api, group);
|
|
437
|
-
panel.init({
|
|
438
|
-
view,
|
|
439
|
-
title: options.title || options.id,
|
|
440
|
-
params: (options === null || options === void 0 ? void 0 : options.params) || {},
|
|
441
|
-
});
|
|
442
|
-
return panel;
|
|
443
|
-
}
|
|
444
|
-
createContentComponent(id, componentName) {
|
|
445
|
-
var _a;
|
|
446
|
-
return createComponent(id, componentName, this.options.components || {}, this.options.frameworkComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.content);
|
|
447
|
-
}
|
|
448
|
-
createTabComponent(id, componentName) {
|
|
449
|
-
var _a;
|
|
450
|
-
return createComponent(id, componentName, this.options.tabComponents || {}, this.options.frameworkTabComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.tab, () => new DefaultTab());
|
|
451
|
-
}
|
|
452
|
-
createGroupAtLocation(location = [0]) {
|
|
453
|
-
const group = this.createGroup();
|
|
454
|
-
this.doAddGroup(group, location);
|
|
455
|
-
return group;
|
|
456
|
-
}
|
|
457
|
-
findGroup(panel) {
|
|
458
|
-
var _a;
|
|
459
|
-
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
460
|
-
}
|
|
461
|
-
dispose() {
|
|
462
|
-
super.dispose();
|
|
463
|
-
this._onDidActivePanelChange.dispose();
|
|
464
|
-
this._onDidAddPanel.dispose();
|
|
465
|
-
this._onDidRemovePanel.dispose();
|
|
466
|
-
this._onDidLayoutFromJSON.dispose();
|
|
467
|
-
}
|
|
468
|
-
}
|
|
1
|
+
import { getRelativeLocation, getGridLocation, } from '../gridview/gridview';
|
|
2
|
+
import { Position } from '../dnd/droptarget';
|
|
3
|
+
import { tail, sequenceEquals } from '../array';
|
|
4
|
+
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
5
|
+
import { CompositeDisposable } from '../lifecycle';
|
|
6
|
+
import { Event, Emitter } from '../events';
|
|
7
|
+
import { Watermark } from './components/watermark/watermark';
|
|
8
|
+
import { sequentialNumberGenerator } from '../math';
|
|
9
|
+
import { createComponent } from '../panel/componentFactory';
|
|
10
|
+
import { BaseGrid, toTarget, } from '../gridview/baseComponentGridview';
|
|
11
|
+
import { DockviewApi } from '../api/component.api';
|
|
12
|
+
import { Orientation } from '../splitview/core/splitview';
|
|
13
|
+
import { DefaultTab } from './components/tab/defaultTab';
|
|
14
|
+
import { GroupPanel } from '../groupview/groupviewPanel';
|
|
15
|
+
import { DefaultGroupPanelView } from './defaultGroupPanelView';
|
|
16
|
+
const nextGroupId = sequentialNumberGenerator();
|
|
17
|
+
export class DockviewComponent extends BaseGrid {
|
|
18
|
+
constructor(element, options) {
|
|
19
|
+
super(element, {
|
|
20
|
+
proportionalLayout: true,
|
|
21
|
+
orientation: options.orientation || Orientation.HORIZONTAL,
|
|
22
|
+
styles: options.styles,
|
|
23
|
+
});
|
|
24
|
+
this._onDidDrop = new Emitter();
|
|
25
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
26
|
+
this._onDidRemovePanel = new Emitter();
|
|
27
|
+
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
28
|
+
this._onDidAddPanel = new Emitter();
|
|
29
|
+
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
30
|
+
this._onDidLayoutFromJSON = new Emitter();
|
|
31
|
+
this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
|
|
32
|
+
this._onDidActivePanelChange = new Emitter();
|
|
33
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
34
|
+
this.addDisposables(this._onDidDrop, Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
35
|
+
this._bufferOnDidLayoutChange.fire();
|
|
36
|
+
}));
|
|
37
|
+
this._options = options;
|
|
38
|
+
if (!this.options.components) {
|
|
39
|
+
this.options.components = {};
|
|
40
|
+
}
|
|
41
|
+
if (!this.options.frameworkComponents) {
|
|
42
|
+
this.options.frameworkComponents = {};
|
|
43
|
+
}
|
|
44
|
+
if (!this.options.frameworkTabComponents) {
|
|
45
|
+
this.options.frameworkTabComponents = {};
|
|
46
|
+
}
|
|
47
|
+
if (!this.options.tabComponents) {
|
|
48
|
+
this.options.tabComponents = {};
|
|
49
|
+
}
|
|
50
|
+
if (!this.options.watermarkComponent &&
|
|
51
|
+
!this.options.watermarkFrameworkComponent) {
|
|
52
|
+
this.options.watermarkComponent = Watermark;
|
|
53
|
+
}
|
|
54
|
+
this._api = new DockviewApi(this);
|
|
55
|
+
}
|
|
56
|
+
get totalPanels() {
|
|
57
|
+
return this.panels.length;
|
|
58
|
+
}
|
|
59
|
+
get panels() {
|
|
60
|
+
return this.groups.flatMap((group) => group.panels);
|
|
61
|
+
}
|
|
62
|
+
get deserializer() {
|
|
63
|
+
return this._deserializer;
|
|
64
|
+
}
|
|
65
|
+
set deserializer(value) {
|
|
66
|
+
this._deserializer = value;
|
|
67
|
+
}
|
|
68
|
+
get options() {
|
|
69
|
+
return this._options;
|
|
70
|
+
}
|
|
71
|
+
get activePanel() {
|
|
72
|
+
const activeGroup = this.activeGroup;
|
|
73
|
+
if (!activeGroup) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return activeGroup.activePanel;
|
|
77
|
+
}
|
|
78
|
+
set tabHeight(height) {
|
|
79
|
+
this.options.tabHeight = height;
|
|
80
|
+
this._groups.forEach((value) => {
|
|
81
|
+
value.value.model.header.height = height;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
get tabHeight() {
|
|
85
|
+
return this.options.tabHeight;
|
|
86
|
+
}
|
|
87
|
+
updateOptions(options) {
|
|
88
|
+
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
89
|
+
this.gridview.orientation !== options.orientation;
|
|
90
|
+
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
91
|
+
if (hasOrientationChanged) {
|
|
92
|
+
this.gridview.orientation = options.orientation;
|
|
93
|
+
}
|
|
94
|
+
this.layout(this.gridview.width, this.gridview.height, true);
|
|
95
|
+
}
|
|
96
|
+
focus() {
|
|
97
|
+
var _a;
|
|
98
|
+
(_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
|
|
99
|
+
}
|
|
100
|
+
getGroupPanel(id) {
|
|
101
|
+
return this.panels.find((panel) => panel.id === id);
|
|
102
|
+
}
|
|
103
|
+
setActivePanel(panel) {
|
|
104
|
+
this.doSetGroupActive(panel.group);
|
|
105
|
+
panel.group.model.openPanel(panel);
|
|
106
|
+
}
|
|
107
|
+
moveToNext(options = {}) {
|
|
108
|
+
var _a;
|
|
109
|
+
if (!options.group) {
|
|
110
|
+
if (!this.activeGroup) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
options.group = this.activeGroup;
|
|
114
|
+
}
|
|
115
|
+
if (options.includePanel && options.group) {
|
|
116
|
+
if (options.group.activePanel !==
|
|
117
|
+
options.group.panels[options.group.panels.length - 1]) {
|
|
118
|
+
options.group.model.moveToNext({ suppressRoll: true });
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const location = getGridLocation(options.group.element);
|
|
123
|
+
const next = (_a = this.gridview.next(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
124
|
+
this.doSetGroupActive(next);
|
|
125
|
+
}
|
|
126
|
+
moveToPrevious(options = {}) {
|
|
127
|
+
var _a;
|
|
128
|
+
if (!options.group) {
|
|
129
|
+
if (!this.activeGroup) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
options.group = this.activeGroup;
|
|
133
|
+
}
|
|
134
|
+
if (options.includePanel && options.group) {
|
|
135
|
+
if (options.group.activePanel !==
|
|
136
|
+
options.group.panels[0]) {
|
|
137
|
+
options.group.model.moveToPrevious({ suppressRoll: true });
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const location = getGridLocation(options.group.element);
|
|
142
|
+
const next = (_a = this.gridview.previous(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
143
|
+
if (next) {
|
|
144
|
+
this.doSetGroupActive(next);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Serialize the current state of the layout
|
|
149
|
+
*
|
|
150
|
+
* @returns A JSON respresentation of the layout
|
|
151
|
+
*/
|
|
152
|
+
toJSON() {
|
|
153
|
+
var _a;
|
|
154
|
+
const data = this.gridview.serialize();
|
|
155
|
+
const panels = this.panels.reduce((collection, panel) => {
|
|
156
|
+
collection[panel.id] = panel.toJSON();
|
|
157
|
+
return collection;
|
|
158
|
+
}, {});
|
|
159
|
+
return {
|
|
160
|
+
grid: data,
|
|
161
|
+
panels,
|
|
162
|
+
activeGroup: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
|
|
163
|
+
options: { tabHeight: this.tabHeight },
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
fromJSON(data) {
|
|
167
|
+
this.clear();
|
|
168
|
+
if (!this.deserializer) {
|
|
169
|
+
throw new Error('invalid deserializer');
|
|
170
|
+
}
|
|
171
|
+
const { grid, panels, options, activeGroup } = data;
|
|
172
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.tabHeight) === 'number') {
|
|
173
|
+
this.tabHeight = options.tabHeight;
|
|
174
|
+
}
|
|
175
|
+
if (!this.deserializer) {
|
|
176
|
+
throw new Error('no deserializer provided');
|
|
177
|
+
}
|
|
178
|
+
this.gridview.deserialize(grid, {
|
|
179
|
+
fromJSON: (node) => {
|
|
180
|
+
const { id, locked, hideHeader, views, activeView } = node.data;
|
|
181
|
+
const group = this.createGroup({
|
|
182
|
+
id,
|
|
183
|
+
locked: !!locked,
|
|
184
|
+
hideHeader: !!hideHeader,
|
|
185
|
+
});
|
|
186
|
+
this._onDidAddGroup.fire(group);
|
|
187
|
+
for (const child of views) {
|
|
188
|
+
const panel = this.deserializer.fromJSON(panels[child], group);
|
|
189
|
+
const isActive = typeof activeView === 'string' && activeView === panel.id;
|
|
190
|
+
group.model.openPanel(panel, {
|
|
191
|
+
skipSetPanelActive: !isActive,
|
|
192
|
+
skipSetGroupActive: true
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (!group.activePanel && group.panels.length > 0) {
|
|
196
|
+
group.model.openPanel(group.panels[group.panels.length - 1], {
|
|
197
|
+
skipSetGroupActive: true
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return group;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
if (typeof activeGroup === 'string') {
|
|
204
|
+
const panel = this.getPanel(activeGroup);
|
|
205
|
+
if (panel) {
|
|
206
|
+
this.doSetGroupActive(panel);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
this.gridview.layout(this.width, this.height);
|
|
210
|
+
this._onDidLayoutFromJSON.fire();
|
|
211
|
+
}
|
|
212
|
+
clear() {
|
|
213
|
+
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
214
|
+
const hasActiveGroup = !!this.activeGroup;
|
|
215
|
+
const hasActivePanel = !!this.activePanel;
|
|
216
|
+
for (const group of groups) {
|
|
217
|
+
// remove the group will automatically remove the panels
|
|
218
|
+
this.removeGroup(group, true);
|
|
219
|
+
}
|
|
220
|
+
if (hasActiveGroup) {
|
|
221
|
+
this.doSetGroupActive(undefined);
|
|
222
|
+
}
|
|
223
|
+
if (hasActivePanel) {
|
|
224
|
+
this._onDidActivePanelChange.fire(undefined);
|
|
225
|
+
}
|
|
226
|
+
this.gridview.clear();
|
|
227
|
+
}
|
|
228
|
+
closeAllGroups() {
|
|
229
|
+
for (const entry of this._groups.entries()) {
|
|
230
|
+
const [_, group] = entry;
|
|
231
|
+
group.value.model.closeAllPanels();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
addPanel(options) {
|
|
235
|
+
var _a, _b;
|
|
236
|
+
if (this.panels.find((_) => _.id === options.id)) {
|
|
237
|
+
throw new Error(`panel with id ${options.id} already exists`);
|
|
238
|
+
}
|
|
239
|
+
let referenceGroup;
|
|
240
|
+
if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
|
|
241
|
+
const referencePanel = this.getGroupPanel(options.position.referencePanel);
|
|
242
|
+
if (!referencePanel) {
|
|
243
|
+
throw new Error(`referencePanel ${options.position.referencePanel} does not exist`);
|
|
244
|
+
}
|
|
245
|
+
referenceGroup = this.findGroup(referencePanel);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
referenceGroup = this.activeGroup;
|
|
249
|
+
}
|
|
250
|
+
let panel;
|
|
251
|
+
if (referenceGroup) {
|
|
252
|
+
const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');
|
|
253
|
+
if (target === Position.Center) {
|
|
254
|
+
panel = this.createPanel(options, referenceGroup);
|
|
255
|
+
referenceGroup.model.openPanel(panel);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
const location = getGridLocation(referenceGroup.element);
|
|
259
|
+
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
260
|
+
const group = this.createGroupAtLocation(relativeLocation);
|
|
261
|
+
panel = this.createPanel(options, group);
|
|
262
|
+
group.model.openPanel(panel);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
const group = this.createGroupAtLocation();
|
|
267
|
+
panel = this.createPanel(options, group);
|
|
268
|
+
group.model.openPanel(panel);
|
|
269
|
+
}
|
|
270
|
+
return panel;
|
|
271
|
+
}
|
|
272
|
+
removePanel(panel, options = {
|
|
273
|
+
removeEmptyGroup: true,
|
|
274
|
+
skipDispose: false,
|
|
275
|
+
}) {
|
|
276
|
+
const group = panel.group;
|
|
277
|
+
if (!group) {
|
|
278
|
+
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
279
|
+
}
|
|
280
|
+
group.model.removePanel(panel);
|
|
281
|
+
panel.dispose();
|
|
282
|
+
const retainGroupForWatermark = this.size === 1;
|
|
283
|
+
if (!retainGroupForWatermark &&
|
|
284
|
+
group.size === 0 &&
|
|
285
|
+
options.removeEmptyGroup) {
|
|
286
|
+
this.removeGroup(group);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
createWatermarkComponent() {
|
|
290
|
+
var _a;
|
|
291
|
+
return createComponent('watermark-id', 'watermark-name', this.options.watermarkComponent
|
|
292
|
+
? { 'watermark-name': this.options.watermarkComponent }
|
|
293
|
+
: {}, this.options.watermarkFrameworkComponent
|
|
294
|
+
? { 'watermark-name': this.options.watermarkFrameworkComponent }
|
|
295
|
+
: {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
|
|
296
|
+
}
|
|
297
|
+
addEmptyGroup(options) {
|
|
298
|
+
const group = this.createGroup();
|
|
299
|
+
if (options) {
|
|
300
|
+
const referencePanel = this.panels.find((panel) => panel.id === options.referencePanel);
|
|
301
|
+
if (!referencePanel) {
|
|
302
|
+
throw new Error(`reference panel ${options.referencePanel} does not exist`);
|
|
303
|
+
}
|
|
304
|
+
const referenceGroup = this.findGroup(referencePanel);
|
|
305
|
+
if (!referenceGroup) {
|
|
306
|
+
throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
|
|
307
|
+
}
|
|
308
|
+
const target = toTarget(options.direction || 'within');
|
|
309
|
+
const location = getGridLocation(referenceGroup.element);
|
|
310
|
+
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
311
|
+
this.doAddGroup(group, relativeLocation);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
this.doAddGroup(group);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
removeGroup(group, skipActive = false) {
|
|
318
|
+
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
319
|
+
for (const panel of panels) {
|
|
320
|
+
this.removePanel(panel, {
|
|
321
|
+
removeEmptyGroup: false,
|
|
322
|
+
skipDispose: false,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
super.doRemoveGroup(group, { skipActive });
|
|
326
|
+
}
|
|
327
|
+
moveGroupOrPanel(referenceGroup, groupId, itemId, target, index) {
|
|
328
|
+
var _a;
|
|
329
|
+
const sourceGroup = groupId
|
|
330
|
+
? (_a = this._groups.get(groupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
331
|
+
: undefined;
|
|
332
|
+
if (!target || target === Position.Center) {
|
|
333
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
334
|
+
this.panels.find((panel) => panel.id === itemId);
|
|
335
|
+
if (!groupItem) {
|
|
336
|
+
throw new Error(`No panel with id ${itemId}`);
|
|
337
|
+
}
|
|
338
|
+
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
339
|
+
this.doRemoveGroup(sourceGroup);
|
|
340
|
+
}
|
|
341
|
+
referenceGroup.model.openPanel(groupItem, { index });
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
const referenceLocation = getGridLocation(referenceGroup.element);
|
|
345
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
346
|
+
if (sourceGroup && sourceGroup.size < 2) {
|
|
347
|
+
const [targetParentLocation, to] = tail(targetLocation);
|
|
348
|
+
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
349
|
+
const [sourceParentLocation, from] = tail(sourceLocation);
|
|
350
|
+
if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
|
|
351
|
+
// special case when 'swapping' two views within same grid location
|
|
352
|
+
// if a group has one tab - we are essentially moving the 'group'
|
|
353
|
+
// which is equivalent to swapping two views in this case
|
|
354
|
+
this.gridview.moveView(sourceParentLocation, from, to);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
// source group will become empty so delete the group
|
|
358
|
+
const targetGroup = this.doRemoveGroup(sourceGroup, {
|
|
359
|
+
skipActive: true,
|
|
360
|
+
skipDispose: true,
|
|
361
|
+
});
|
|
362
|
+
// after deleting the group we need to re-evaulate the ref location
|
|
363
|
+
const updatedReferenceLocation = getGridLocation(referenceGroup.element);
|
|
364
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);
|
|
365
|
+
this.doAddGroup(targetGroup, location);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
370
|
+
this.panels.find((panel) => panel.id === itemId);
|
|
371
|
+
if (!groupItem) {
|
|
372
|
+
throw new Error(`No panel with id ${itemId}`);
|
|
373
|
+
}
|
|
374
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
375
|
+
const group = this.createGroupAtLocation(dropLocation);
|
|
376
|
+
group.model.openPanel(groupItem);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
doSetGroupActive(group, skipFocus) {
|
|
381
|
+
var _a, _b;
|
|
382
|
+
const isGroupAlreadyFocused = this._activeGroup === group;
|
|
383
|
+
super.doSetGroupActive(group, skipFocus);
|
|
384
|
+
if (!isGroupAlreadyFocused && ((_a = this._activeGroup) === null || _a === void 0 ? void 0 : _a.activePanel)) {
|
|
385
|
+
this._onDidActivePanelChange.fire((_b = this._activeGroup) === null || _b === void 0 ? void 0 : _b.activePanel);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
createGroup(options) {
|
|
389
|
+
if (!options) {
|
|
390
|
+
options = { tabHeight: this.tabHeight };
|
|
391
|
+
}
|
|
392
|
+
if (typeof options.tabHeight !== 'number') {
|
|
393
|
+
options.tabHeight = this.tabHeight;
|
|
394
|
+
}
|
|
395
|
+
let id = options === null || options === void 0 ? void 0 : options.id;
|
|
396
|
+
if (id && this._groups.has(options.id)) {
|
|
397
|
+
console.warn(`Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);
|
|
398
|
+
id = undefined;
|
|
399
|
+
}
|
|
400
|
+
if (!id) {
|
|
401
|
+
id = nextGroupId.next();
|
|
402
|
+
while (this._groups.has(id)) {
|
|
403
|
+
id = nextGroupId.next();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const view = new GroupPanel(this, id, options);
|
|
407
|
+
view.init({ params: {}, accessor: null }); // required to initialized .part and allow for correct disposal of group
|
|
408
|
+
if (!this._groups.has(view.id)) {
|
|
409
|
+
const disposable = new CompositeDisposable(view.model.onMove((event) => {
|
|
410
|
+
const { groupId, itemId, target, index } = event;
|
|
411
|
+
this.moveGroupOrPanel(view, groupId, itemId, target, index);
|
|
412
|
+
}), view.model.onDidDrop((event) => {
|
|
413
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: view }));
|
|
414
|
+
}), view.model.onDidAddPanel((event) => {
|
|
415
|
+
this._onDidAddPanel.fire(event.panel);
|
|
416
|
+
}), view.model.onDidRemovePanel((event) => {
|
|
417
|
+
this._onDidRemovePanel.fire(event.panel);
|
|
418
|
+
}), view.model.onDidActivePanelChange((event) => {
|
|
419
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
420
|
+
}));
|
|
421
|
+
this._groups.set(view.id, { value: view, disposable });
|
|
422
|
+
}
|
|
423
|
+
// TODO: must be called after the above listeners have been setup,
|
|
424
|
+
// not an ideal pattern
|
|
425
|
+
view.initialize();
|
|
426
|
+
if (typeof this.options.tabHeight === 'number') {
|
|
427
|
+
view.model.header.height = this.options.tabHeight;
|
|
428
|
+
}
|
|
429
|
+
return view;
|
|
430
|
+
}
|
|
431
|
+
createPanel(options, group) {
|
|
432
|
+
const view = new DefaultGroupPanelView({
|
|
433
|
+
content: this.createContentComponent(options.id, options.component),
|
|
434
|
+
tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
|
|
435
|
+
});
|
|
436
|
+
const panel = new DockviewGroupPanel(options.id, this, this._api, group);
|
|
437
|
+
panel.init({
|
|
438
|
+
view,
|
|
439
|
+
title: options.title || options.id,
|
|
440
|
+
params: (options === null || options === void 0 ? void 0 : options.params) || {},
|
|
441
|
+
});
|
|
442
|
+
return panel;
|
|
443
|
+
}
|
|
444
|
+
createContentComponent(id, componentName) {
|
|
445
|
+
var _a;
|
|
446
|
+
return createComponent(id, componentName, this.options.components || {}, this.options.frameworkComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.content);
|
|
447
|
+
}
|
|
448
|
+
createTabComponent(id, componentName) {
|
|
449
|
+
var _a;
|
|
450
|
+
return createComponent(id, componentName, this.options.tabComponents || {}, this.options.frameworkTabComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.tab, () => new DefaultTab());
|
|
451
|
+
}
|
|
452
|
+
createGroupAtLocation(location = [0]) {
|
|
453
|
+
const group = this.createGroup();
|
|
454
|
+
this.doAddGroup(group, location);
|
|
455
|
+
return group;
|
|
456
|
+
}
|
|
457
|
+
findGroup(panel) {
|
|
458
|
+
var _a;
|
|
459
|
+
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
460
|
+
}
|
|
461
|
+
dispose() {
|
|
462
|
+
super.dispose();
|
|
463
|
+
this._onDidActivePanelChange.dispose();
|
|
464
|
+
this._onDidAddPanel.dispose();
|
|
465
|
+
this._onDidRemovePanel.dispose();
|
|
466
|
+
this._onDidLayoutFromJSON.dispose();
|
|
467
|
+
}
|
|
468
|
+
}
|