dockview 0.0.28 → 1.0.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 +60 -0
- 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 +135 -131
- package/dist/cjs/api/component.api.js +486 -444
- package/dist/cjs/api/component.api.js.map +1 -1
- package/dist/cjs/api/gridviewPanelApi.d.ts +36 -36
- package/dist/cjs/api/gridviewPanelApi.js +46 -46
- package/dist/cjs/api/groupPanelApi.d.ts +44 -44
- package/dist/cjs/api/groupPanelApi.js +94 -94
- package/dist/cjs/api/groupPanelApi.js.map +1 -1
- package/dist/cjs/api/panelApi.d.ts +107 -107
- package/dist/cjs/api/panelApi.js +140 -140
- package/dist/cjs/api/paneviewPanelApi.d.ts +26 -26
- package/dist/cjs/api/paneviewPanelApi.js +56 -56
- package/dist/cjs/api/splitviewPanelApi.d.ts +33 -33
- package/dist/cjs/api/splitviewPanelApi.js +51 -51
- 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 +56 -56
- package/dist/cjs/dnd/dataTransfer.js +144 -144
- package/dist/cjs/dnd/dataTransfer.js.map +1 -1
- package/dist/cjs/dnd/dnd.d.ts +40 -40
- package/dist/cjs/dnd/dnd.js +142 -142
- package/dist/cjs/dnd/droptarget.d.ts +33 -37
- package/dist/cjs/dnd/droptarget.js +177 -177
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dockview/components/tab/defaultTab.d.ts +44 -44
- package/dist/cjs/dockview/components/tab/defaultTab.js +186 -186
- package/dist/cjs/dockview/components/watermark/watermark.d.ts +20 -20
- package/dist/cjs/dockview/components/watermark/watermark.js +99 -99
- package/dist/cjs/dockview/defaultGroupPanelView.d.ts +34 -34
- package/dist/cjs/dockview/defaultGroupPanelView.js +85 -83
- package/dist/cjs/dockview/defaultGroupPanelView.js.map +1 -1
- package/dist/cjs/dockview/deserializer.d.ts +14 -14
- package/dist/cjs/dockview/deserializer.js +47 -47
- package/dist/cjs/dockview/dockviewComponent.d.ts +121 -121
- package/dist/cjs/dockview/dockviewComponent.js +692 -692
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +35 -35
- package/dist/cjs/dockview/dockviewGroupPanel.js +195 -195
- package/dist/cjs/dockview/options.d.ts +79 -79
- 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 -23
- package/dist/cjs/events.js +108 -87
- package/dist/cjs/events.js.map +1 -1
- package/dist/cjs/functions.d.ts +1 -1
- package/dist/cjs/functions.js +41 -41
- package/dist/cjs/gridview/baseComponentGridview.d.ts +98 -98
- package/dist/cjs/gridview/baseComponentGridview.js +285 -292
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
- package/dist/cjs/gridview/basePanelView.d.ts +46 -46
- package/dist/cjs/gridview/basePanelView.js +115 -115
- package/dist/cjs/gridview/branchNode.d.ts +46 -46
- package/dist/cjs/gridview/branchNode.js +342 -342
- package/dist/cjs/gridview/gridview.d.ts +123 -123
- package/dist/cjs/gridview/gridview.js +476 -477
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewComponent.d.ts +88 -88
- package/dist/cjs/gridview/gridviewComponent.js +303 -303
- package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.d.ts +62 -62
- package/dist/cjs/gridview/gridviewPanel.js +205 -205
- package/dist/cjs/gridview/leafNode.d.ts +31 -31
- package/dist/cjs/gridview/leafNode.js +164 -164
- 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 +41 -41
- package/dist/cjs/groupview/groupPanel.js +2 -2
- package/dist/cjs/groupview/groupview.d.ts +154 -154
- package/dist/cjs/groupview/groupview.js +633 -633
- package/dist/cjs/groupview/groupview.js.map +1 -1
- package/dist/cjs/groupview/groupviewPanel.d.ts +18 -18
- package/dist/cjs/groupview/groupviewPanel.js +83 -83
- package/dist/cjs/groupview/panel/content.d.ts +30 -30
- package/dist/cjs/groupview/panel/content.js +99 -99
- package/dist/cjs/groupview/panel/hostedPanel.d.ts +22 -22
- package/dist/cjs/groupview/panel/hostedPanel.js +56 -56
- package/dist/cjs/groupview/panel/hostedPanel.js.map +1 -1
- package/dist/cjs/groupview/tab.d.ts +44 -44
- package/dist/cjs/groupview/tab.js +182 -182
- package/dist/cjs/groupview/titlebar/tabsContainer.d.ts +66 -66
- package/dist/cjs/groupview/titlebar/tabsContainer.js +260 -260
- package/dist/cjs/groupview/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/groupview/types.d.ts +59 -59
- 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/hostedContainer.js.map +1 -1
- package/dist/cjs/index.d.ts +28 -26
- package/dist/cjs/index.js +37 -35
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/json.d.ts +1 -1
- package/dist/cjs/json.js +13 -13
- package/dist/cjs/lifecycle.d.ts +22 -22
- package/dist/cjs/lifecycle.js +87 -87
- package/dist/cjs/math.d.ts +4 -4
- package/dist/cjs/math.js +15 -15
- package/dist/cjs/math.js.map +1 -1
- package/dist/cjs/panel/componentFactory.d.ts +8 -8
- package/dist/cjs/panel/componentFactory.js +30 -30
- package/dist/cjs/panel/componentFactory.js.map +1 -1
- package/dist/cjs/panel/types.d.ts +34 -34
- package/dist/cjs/panel/types.js +2 -2
- package/dist/cjs/paneview/defaultPaneviewHeader.d.ts +18 -18
- package/dist/cjs/paneview/defaultPaneviewHeader.js +64 -64
- package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +17 -17
- package/dist/cjs/paneview/draggablePaneviewPanel.js +111 -111
- package/dist/cjs/paneview/options.d.ts +25 -25
- package/dist/cjs/paneview/options.js +2 -2
- package/dist/cjs/paneview/paneview.d.ts +38 -38
- package/dist/cjs/paneview/paneview.js +195 -198
- package/dist/cjs/paneview/paneview.js.map +1 -1
- package/dist/cjs/paneview/paneviewComponent.d.ts +115 -113
- package/dist/cjs/paneview/paneviewComponent.js +338 -338
- package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
- package/dist/cjs/paneview/paneviewPanel.d.ts +85 -85
- package/dist/cjs/paneview/paneviewPanel.js +262 -262
- package/dist/cjs/paneview/paneviewPanel.js.map +1 -1
- package/dist/cjs/react/deserializer.d.ts +8 -8
- package/dist/cjs/react/deserializer.js +39 -39
- package/dist/cjs/react/dockview/components.d.ts +11 -11
- package/dist/cjs/react/dockview/components.js +76 -76
- package/dist/cjs/react/dockview/dockview.d.ts +34 -34
- package/dist/cjs/react/dockview/dockview.js +151 -135
- package/dist/cjs/react/dockview/dockview.js.map +1 -1
- package/dist/cjs/react/dockview/reactContentPart.d.ts +47 -47
- package/dist/cjs/react/dockview/reactContentPart.js +88 -88
- package/dist/cjs/react/dockview/reactHeaderPart.d.ts +24 -24
- package/dist/cjs/react/dockview/reactHeaderPart.js +50 -50
- package/dist/cjs/react/dockview/reactWatermarkPart.d.ts +30 -30
- package/dist/cjs/react/dockview/reactWatermarkPart.js +66 -66
- package/dist/cjs/react/dockview/v2/reactContentRenderer.d.ts +30 -30
- package/dist/cjs/react/dockview/v2/reactContentRenderer.js +90 -90
- 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 +104 -96
- package/dist/cjs/react/gridview/gridview.js.map +1 -1
- package/dist/cjs/react/gridview/view.d.ts +10 -10
- package/dist/cjs/react/gridview/view.js +40 -40
- package/dist/cjs/react/index.d.ts +9 -9
- package/dist/cjs/react/index.js +21 -21
- package/dist/cjs/react/paneview/paneview.d.ts +28 -28
- package/dist/cjs/react/paneview/paneview.js +142 -138
- package/dist/cjs/react/paneview/paneview.js.map +1 -1
- 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 +35 -35
- package/dist/cjs/react/react.js +181 -181
- package/dist/cjs/react/react.js.map +1 -1
- package/dist/cjs/react/splitview/splitview.d.ts +24 -24
- package/dist/cjs/react/splitview/splitview.js +101 -93
- package/dist/cjs/react/splitview/splitview.js.map +1 -1
- package/dist/cjs/react/splitview/view.d.ts +10 -10
- package/dist/cjs/react/splitview/view.js +40 -40
- 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 +124 -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 +100 -100
- package/dist/cjs/splitview/splitviewComponent.js +327 -327
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.d.ts +47 -47
- package/dist/cjs/splitview/splitviewPanel.js +178 -178
- package/dist/cjs/types.d.ts +7 -7
- package/dist/cjs/types.js +2 -2
- package/dist/dockview.amd.js +6759 -6712
- package/dist/dockview.amd.min.js +3 -3
- package/dist/dockview.amd.min.noStyle.js +3 -3
- package/dist/dockview.amd.noStyle.js +6752 -6705
- package/dist/dockview.cjs.js +6755 -6708
- package/dist/dockview.esm.js +6750 -6707
- package/dist/dockview.esm.min.js +3 -3
- package/dist/dockview.js +6759 -6712
- package/dist/dockview.min.js +3 -3
- package/dist/dockview.min.noStyle.js +3 -3
- package/dist/dockview.noStyle.js +6752 -6705
- 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 +135 -131
- package/dist/esm/api/component.api.js +305 -287
- package/dist/esm/api/gridviewPanelApi.d.ts +36 -36
- package/dist/esm/api/gridviewPanelApi.js +24 -24
- package/dist/esm/api/groupPanelApi.d.ts +44 -44
- package/dist/esm/api/groupPanelApi.js +52 -52
- package/dist/esm/api/panelApi.d.ts +107 -107
- package/dist/esm/api/panelApi.js +98 -98
- package/dist/esm/api/paneviewPanelApi.d.ts +26 -26
- package/dist/esm/api/paneviewPanelApi.js +26 -26
- package/dist/esm/api/splitviewPanelApi.d.ts +33 -33
- package/dist/esm/api/splitviewPanelApi.js +29 -29
- 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 +56 -56
- package/dist/esm/dnd/dataTransfer.js +109 -109
- package/dist/esm/dnd/dnd.d.ts +40 -40
- package/dist/esm/dnd/dnd.js +109 -109
- package/dist/esm/dnd/droptarget.d.ts +33 -37
- package/dist/esm/dnd/droptarget.js +143 -143
- package/dist/esm/dockview/components/tab/defaultTab.d.ts +44 -44
- package/dist/esm/dockview/components/tab/defaultTab.js +130 -130
- package/dist/esm/dockview/components/watermark/watermark.d.ts +20 -20
- package/dist/esm/dockview/components/watermark/watermark.js +68 -68
- package/dist/esm/dockview/defaultGroupPanelView.d.ts +34 -34
- package/dist/esm/dockview/defaultGroupPanelView.js +57 -55
- package/dist/esm/dockview/deserializer.d.ts +14 -14
- package/dist/esm/dockview/deserializer.js +20 -20
- package/dist/esm/dockview/dockviewComponent.d.ts +121 -121
- package/dist/esm/dockview/dockviewComponent.js +533 -533
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +35 -35
- package/dist/esm/dockview/dockviewGroupPanel.js +145 -145
- package/dist/esm/dockview/options.d.ts +79 -79
- 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 -23
- package/dist/esm/events.js +89 -71
- package/dist/esm/functions.d.ts +1 -1
- package/dist/esm/functions.js +8 -8
- package/dist/esm/gridview/baseComponentGridview.d.ts +98 -98
- package/dist/esm/gridview/baseComponentGridview.js +217 -224
- package/dist/esm/gridview/basePanelView.d.ts +46 -46
- package/dist/esm/gridview/basePanelView.js +70 -70
- package/dist/esm/gridview/branchNode.d.ts +46 -46
- package/dist/esm/gridview/branchNode.js +218 -218
- package/dist/esm/gridview/gridview.d.ts +123 -123
- package/dist/esm/gridview/gridview.js +395 -396
- package/dist/esm/gridview/gridviewComponent.d.ts +88 -88
- package/dist/esm/gridview/gridviewComponent.js +238 -238
- package/dist/esm/gridview/gridviewPanel.d.ts +62 -62
- package/dist/esm/gridview/gridviewPanel.js +141 -141
- package/dist/esm/gridview/leafNode.d.ts +31 -31
- package/dist/esm/gridview/leafNode.js +97 -97
- 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 +41 -41
- package/dist/esm/groupview/groupPanel.js +1 -1
- package/dist/esm/groupview/groupview.d.ts +154 -154
- package/dist/esm/groupview/groupview.js +448 -448
- package/dist/esm/groupview/groupviewPanel.d.ts +18 -18
- package/dist/esm/groupview/groupviewPanel.js +41 -41
- package/dist/esm/groupview/panel/content.d.ts +30 -30
- package/dist/esm/groupview/panel/content.js +72 -72
- package/dist/esm/groupview/panel/hostedPanel.d.ts +22 -22
- package/dist/esm/groupview/panel/hostedPanel.js +43 -43
- package/dist/esm/groupview/tab.d.ts +44 -44
- package/dist/esm/groupview/tab.js +101 -101
- package/dist/esm/groupview/titlebar/tabsContainer.d.ts +66 -66
- package/dist/esm/groupview/titlebar/tabsContainer.js +185 -185
- package/dist/esm/groupview/types.d.ts +59 -59
- 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 +28 -26
- package/dist/esm/index.js +23 -21
- package/dist/esm/json.d.ts +1 -1
- package/dist/esm/json.js +9 -9
- package/dist/esm/lifecycle.d.ts +22 -22
- package/dist/esm/lifecycle.js +38 -38
- 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 +34 -34
- package/dist/esm/panel/types.js +1 -1
- package/dist/esm/paneview/defaultPaneviewHeader.d.ts +18 -18
- package/dist/esm/paneview/defaultPaneviewHeader.js +37 -37
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +17 -17
- package/dist/esm/paneview/draggablePaneviewPanel.js +72 -72
- package/dist/esm/paneview/options.d.ts +25 -25
- package/dist/esm/paneview/options.js +1 -1
- package/dist/esm/paneview/paneview.d.ts +38 -38
- package/dist/esm/paneview/paneview.js +141 -144
- package/dist/esm/paneview/paneviewComponent.d.ts +115 -113
- package/dist/esm/paneview/paneviewComponent.js +247 -247
- package/dist/esm/paneview/paneviewPanel.d.ts +85 -85
- package/dist/esm/paneview/paneviewPanel.js +183 -183
- package/dist/esm/react/deserializer.d.ts +8 -8
- package/dist/esm/react/deserializer.js +34 -34
- package/dist/esm/react/dockview/components.d.ts +11 -11
- package/dist/esm/react/dockview/components.js +54 -54
- package/dist/esm/react/dockview/dockview.d.ts +34 -34
- package/dist/esm/react/dockview/dockview.js +113 -97
- package/dist/esm/react/dockview/reactContentPart.d.ts +47 -47
- package/dist/esm/react/dockview/reactContentPart.js +75 -75
- package/dist/esm/react/dockview/reactHeaderPart.d.ts +24 -24
- package/dist/esm/react/dockview/reactHeaderPart.js +41 -41
- package/dist/esm/react/dockview/reactWatermarkPart.d.ts +30 -30
- package/dist/esm/react/dockview/reactWatermarkPart.js +56 -56
- package/dist/esm/react/dockview/v2/reactContentRenderer.d.ts +30 -30
- package/dist/esm/react/dockview/v2/reactContentRenderer.js +72 -72
- 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 +66 -58
- package/dist/esm/react/gridview/view.d.ts +10 -10
- package/dist/esm/react/gridview/view.js +18 -18
- package/dist/esm/react/index.d.ts +9 -9
- package/dist/esm/react/index.js +9 -9
- package/dist/esm/react/paneview/paneview.d.ts +28 -28
- package/dist/esm/react/paneview/paneview.js +91 -87
- 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 +35 -35
- package/dist/esm/react/react.js +116 -116
- package/dist/esm/react/splitview/splitview.d.ts +24 -24
- package/dist/esm/react/splitview/splitview.js +63 -55
- package/dist/esm/react/splitview/view.d.ts +10 -10
- package/dist/esm/react/splitview/view.js +18 -18
- 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 +124 -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 +100 -100
- package/dist/esm/splitview/splitviewComponent.js +241 -241
- package/dist/esm/splitview/splitviewPanel.d.ts +47 -47
- package/dist/esm/splitview/splitviewPanel.js +107 -107
- package/dist/esm/types.d.ts +7 -7
- package/dist/esm/types.js +1 -1
- package/dist/styles/dockview.css +45 -45
- package/package.json +75 -75
- package/dist/cjs/footnote.d.ts +0 -1
- package/dist/cjs/footnote.js +0 -20
- package/dist/cjs/footnote.js.map +0 -1
- package/dist/esm/footnote.d.ts +0 -1
- package/dist/esm/footnote.js +0 -19
|
@@ -1,634 +1,634 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
54
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
55
|
-
if (!m) return o;
|
|
56
|
-
var i = m.call(o), r, ar = [], e;
|
|
57
|
-
try {
|
|
58
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
59
|
-
}
|
|
60
|
-
catch (error) { e = { error: error }; }
|
|
61
|
-
finally {
|
|
62
|
-
try {
|
|
63
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
64
|
-
}
|
|
65
|
-
finally { if (e) throw e.error; }
|
|
66
|
-
}
|
|
67
|
-
return ar;
|
|
68
|
-
};
|
|
69
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
70
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
71
|
-
if (ar || !(i in from)) {
|
|
72
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
73
|
-
ar[i] = from[i];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
77
|
-
};
|
|
78
|
-
var __values = (this && this.__values) || function(o) {
|
|
79
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
80
|
-
if (m) return m.call(o);
|
|
81
|
-
if (o && typeof o.length === "number") return {
|
|
82
|
-
next: function () {
|
|
83
|
-
if (o && i >= o.length) o = void 0;
|
|
84
|
-
return { value: o && o[i++], done: !o };
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
88
|
-
};
|
|
89
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90
|
-
exports.Groupview = exports.GroupChangeKind2 = void 0;
|
|
91
|
-
var component_api_1 = require("../api/component.api");
|
|
92
|
-
var dataTransfer_1 = require("../dnd/dataTransfer");
|
|
93
|
-
var droptarget_1 = require("../dnd/droptarget");
|
|
94
|
-
var dom_1 = require("../dom");
|
|
95
|
-
var events_1 = require("../events");
|
|
96
|
-
var lifecycle_1 = require("../lifecycle");
|
|
97
|
-
var content_1 = require("./panel/content");
|
|
98
|
-
var tabsContainer_1 = require("./titlebar/tabsContainer");
|
|
99
|
-
var dnd_1 = require("./dnd");
|
|
100
|
-
var GroupChangeKind2;
|
|
101
|
-
(function (GroupChangeKind2) {
|
|
102
|
-
GroupChangeKind2["ADD_PANEL"] = "ADD_PANEL";
|
|
103
|
-
GroupChangeKind2["REMOVE_PANEL"] = "REMOVE_PANEL";
|
|
104
|
-
GroupChangeKind2["PANEL_ACTIVE"] = "PANEL_ACTIVE";
|
|
105
|
-
GroupChangeKind2["GROUP_ACTIVE"] = "GROUP_ACTIVE";
|
|
106
|
-
})(GroupChangeKind2 = exports.GroupChangeKind2 || (exports.GroupChangeKind2 = {}));
|
|
107
|
-
var Groupview = /** @class */ (function (_super) {
|
|
108
|
-
__extends(Groupview, _super);
|
|
109
|
-
function Groupview(container, accessor, id, options, parent) {
|
|
110
|
-
var _this = _super.call(this) || this;
|
|
111
|
-
_this.container = container;
|
|
112
|
-
_this.accessor = accessor;
|
|
113
|
-
_this.id = id;
|
|
114
|
-
_this.options = options;
|
|
115
|
-
_this.parent = parent;
|
|
116
|
-
_this._isGroupActive = false;
|
|
117
|
-
_this.mostRecentlyUsed = [];
|
|
118
|
-
_this._onDidChange = new events_1.Emitter();
|
|
119
|
-
_this.onDidChange = _this._onDidChange.event;
|
|
120
|
-
_this._width = 0;
|
|
121
|
-
_this._height = 0;
|
|
122
|
-
_this._panels = [];
|
|
123
|
-
_this._onMove = new events_1.Emitter();
|
|
124
|
-
_this.onMove = _this._onMove.event;
|
|
125
|
-
_this._onDidGroupChange = new events_1.Emitter();
|
|
126
|
-
_this.onDidGroupChange = _this._onDidGroupChange.event;
|
|
127
|
-
_this.closePanel = function (panel) { return __awaiter(_this, void 0, void 0, function () {
|
|
128
|
-
var _a;
|
|
129
|
-
return __generator(this, function (_b) {
|
|
130
|
-
switch (_b.label) {
|
|
131
|
-
case 0:
|
|
132
|
-
_a = panel.close;
|
|
133
|
-
if (!_a) return [3 /*break*/, 2];
|
|
134
|
-
return [4 /*yield*/, panel.close()];
|
|
135
|
-
case 1:
|
|
136
|
-
_a = !(_b.sent());
|
|
137
|
-
_b.label = 2;
|
|
138
|
-
case 2:
|
|
139
|
-
if (_a) {
|
|
140
|
-
return [2 /*return*/, false];
|
|
141
|
-
}
|
|
142
|
-
this.doClose(panel);
|
|
143
|
-
return [2 /*return*/, true];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}); };
|
|
147
|
-
_this.container.classList.add('groupview');
|
|
148
|
-
_this.addDisposables(_this._onMove, _this._onDidGroupChange);
|
|
149
|
-
_this.tabsContainer = new tabsContainer_1.TabsContainer(_this.accessor, _this.parent, {
|
|
150
|
-
tabHeight: options.tabHeight,
|
|
151
|
-
});
|
|
152
|
-
_this.contentContainer = new content_1.ContentContainer();
|
|
153
|
-
_this.dropTarget = new droptarget_1.Droptarget(_this.contentContainer.element, {
|
|
154
|
-
validOverlays: 'all',
|
|
155
|
-
canDisplayOverlay: function (event) {
|
|
156
|
-
var data = (0, dataTransfer_1.getPanelData)();
|
|
157
|
-
if (data) {
|
|
158
|
-
var groupHasOnePanelAndIsActiveDragElement = _this._panels.length === 1 && data.groupId === _this.id;
|
|
159
|
-
return !groupHasOnePanelAndIsActiveDragElement;
|
|
160
|
-
}
|
|
161
|
-
return _this.canDisplayOverlay(event, dnd_1.DockviewDropTargets.Panel);
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
container.append(_this.tabsContainer.element, _this.contentContainer.element);
|
|
165
|
-
_this.addDisposables(_this._onMove, _this._onDidGroupChange, _this.tabsContainer.onDrop(function (event) {
|
|
166
|
-
_this.handleDropEvent(event.event, droptarget_1.Position.Center, event.index);
|
|
167
|
-
}), _this.contentContainer.onDidFocus(function () {
|
|
168
|
-
_this.accessor.doSetGroupActive(_this.parent, true);
|
|
169
|
-
}), _this.contentContainer.onDidBlur(function () {
|
|
170
|
-
//
|
|
171
|
-
}), _this.dropTarget.onDrop(function (event) {
|
|
172
|
-
_this.handleDropEvent(event.
|
|
173
|
-
}));
|
|
174
|
-
return _this;
|
|
175
|
-
}
|
|
176
|
-
Object.defineProperty(Groupview.prototype, "element", {
|
|
177
|
-
get: function () {
|
|
178
|
-
throw new Error('not supported');
|
|
179
|
-
},
|
|
180
|
-
enumerable: false,
|
|
181
|
-
configurable: true
|
|
182
|
-
});
|
|
183
|
-
Object.defineProperty(Groupview.prototype, "activePanel", {
|
|
184
|
-
get: function () {
|
|
185
|
-
return this._activePanel;
|
|
186
|
-
},
|
|
187
|
-
enumerable: false,
|
|
188
|
-
configurable: true
|
|
189
|
-
});
|
|
190
|
-
Object.defineProperty(Groupview.prototype, "tabHeight", {
|
|
191
|
-
get: function () {
|
|
192
|
-
return this.tabsContainer.height;
|
|
193
|
-
},
|
|
194
|
-
set: function (height) {
|
|
195
|
-
this.tabsContainer.height = height;
|
|
196
|
-
this.layout(this._width, this._height);
|
|
197
|
-
},
|
|
198
|
-
enumerable: false,
|
|
199
|
-
configurable: true
|
|
200
|
-
});
|
|
201
|
-
Object.defineProperty(Groupview.prototype, "isActive", {
|
|
202
|
-
get: function () {
|
|
203
|
-
return this._isGroupActive;
|
|
204
|
-
},
|
|
205
|
-
enumerable: false,
|
|
206
|
-
configurable: true
|
|
207
|
-
});
|
|
208
|
-
Object.defineProperty(Groupview.prototype, "panels", {
|
|
209
|
-
get: function () {
|
|
210
|
-
return this._panels;
|
|
211
|
-
},
|
|
212
|
-
enumerable: false,
|
|
213
|
-
configurable: true
|
|
214
|
-
});
|
|
215
|
-
Object.defineProperty(Groupview.prototype, "size", {
|
|
216
|
-
get: function () {
|
|
217
|
-
return this._panels.length;
|
|
218
|
-
},
|
|
219
|
-
enumerable: false,
|
|
220
|
-
configurable: true
|
|
221
|
-
});
|
|
222
|
-
Object.defineProperty(Groupview.prototype, "isEmpty", {
|
|
223
|
-
get: function () {
|
|
224
|
-
return this._panels.length === 0;
|
|
225
|
-
},
|
|
226
|
-
enumerable: false,
|
|
227
|
-
configurable: true
|
|
228
|
-
});
|
|
229
|
-
Object.defineProperty(Groupview.prototype, "minimumHeight", {
|
|
230
|
-
get: function () {
|
|
231
|
-
return 100;
|
|
232
|
-
},
|
|
233
|
-
enumerable: false,
|
|
234
|
-
configurable: true
|
|
235
|
-
});
|
|
236
|
-
Object.defineProperty(Groupview.prototype, "maximumHeight", {
|
|
237
|
-
get: function () {
|
|
238
|
-
return Number.MAX_SAFE_INTEGER;
|
|
239
|
-
},
|
|
240
|
-
enumerable: false,
|
|
241
|
-
configurable: true
|
|
242
|
-
});
|
|
243
|
-
Object.defineProperty(Groupview.prototype, "minimumWidth", {
|
|
244
|
-
get: function () {
|
|
245
|
-
return 100;
|
|
246
|
-
},
|
|
247
|
-
enumerable: false,
|
|
248
|
-
configurable: true
|
|
249
|
-
});
|
|
250
|
-
Object.defineProperty(Groupview.prototype, "maximumWidth", {
|
|
251
|
-
get: function () {
|
|
252
|
-
return Number.MAX_SAFE_INTEGER;
|
|
253
|
-
},
|
|
254
|
-
enumerable: false,
|
|
255
|
-
configurable: true
|
|
256
|
-
});
|
|
257
|
-
Groupview.prototype.initialize = function () {
|
|
258
|
-
var _this = this;
|
|
259
|
-
var _a, _b;
|
|
260
|
-
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
|
|
261
|
-
this.options.panels.forEach(function (panel) {
|
|
262
|
-
_this.doAddPanel(panel);
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.activePanel) {
|
|
266
|
-
this.openPanel(this.options.activePanel);
|
|
267
|
-
}
|
|
268
|
-
// must be run after the constructor otherwise this.parent may not be
|
|
269
|
-
// correctly initialized
|
|
270
|
-
this.setActive(this.isActive, true, true);
|
|
271
|
-
this.updateContainer();
|
|
272
|
-
};
|
|
273
|
-
Groupview.prototype.isContentFocused = function () {
|
|
274
|
-
if (!document.activeElement) {
|
|
275
|
-
return false;
|
|
276
|
-
}
|
|
277
|
-
return (0, dom_1.isAncestor)(document.activeElement, this.contentContainer.element);
|
|
278
|
-
};
|
|
279
|
-
Groupview.prototype.indexOf = function (panel) {
|
|
280
|
-
return this.tabsContainer.indexOf(panel.id);
|
|
281
|
-
};
|
|
282
|
-
Groupview.prototype.toJSON = function () {
|
|
283
|
-
var _a;
|
|
284
|
-
return {
|
|
285
|
-
views: this.tabsContainer.panels,
|
|
286
|
-
activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
|
|
287
|
-
id: this.id,
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
Groupview.prototype.moveToNext = function (options) {
|
|
291
|
-
if (!options) {
|
|
292
|
-
options = {};
|
|
293
|
-
}
|
|
294
|
-
if (!options.panel) {
|
|
295
|
-
options.panel = this.activePanel;
|
|
296
|
-
}
|
|
297
|
-
var index = options.panel ? this.panels.indexOf(options.panel) : -1;
|
|
298
|
-
var normalizedIndex;
|
|
299
|
-
if (index < this.panels.length - 1) {
|
|
300
|
-
normalizedIndex = index + 1;
|
|
301
|
-
}
|
|
302
|
-
else if (!options.suppressRoll) {
|
|
303
|
-
normalizedIndex = 0;
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
this.openPanel(this.panels[normalizedIndex]);
|
|
309
|
-
};
|
|
310
|
-
Groupview.prototype.moveToPrevious = function (options) {
|
|
311
|
-
if (!options) {
|
|
312
|
-
options = {};
|
|
313
|
-
}
|
|
314
|
-
if (!options.panel) {
|
|
315
|
-
options.panel = this.activePanel;
|
|
316
|
-
}
|
|
317
|
-
if (!options.panel) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
var index = this.panels.indexOf(options.panel);
|
|
321
|
-
var normalizedIndex;
|
|
322
|
-
if (index > 0) {
|
|
323
|
-
normalizedIndex = index - 1;
|
|
324
|
-
}
|
|
325
|
-
else if (!options.suppressRoll) {
|
|
326
|
-
normalizedIndex = this.panels.length - 1;
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
this.openPanel(this.panels[normalizedIndex]);
|
|
332
|
-
};
|
|
333
|
-
Groupview.prototype.containsPanel = function (panel) {
|
|
334
|
-
return this.panels.includes(panel);
|
|
335
|
-
};
|
|
336
|
-
Groupview.prototype.init = function (params) {
|
|
337
|
-
//noop
|
|
338
|
-
};
|
|
339
|
-
Groupview.prototype.update = function (params) {
|
|
340
|
-
//noop
|
|
341
|
-
};
|
|
342
|
-
Groupview.prototype.focus = function () {
|
|
343
|
-
var _a;
|
|
344
|
-
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
345
|
-
};
|
|
346
|
-
Groupview.prototype.openPanel = function (panel, options) {
|
|
347
|
-
if (options === void 0) { options = {}; }
|
|
348
|
-
if (typeof options.index !== 'number' ||
|
|
349
|
-
options.index > this.panels.length) {
|
|
350
|
-
options.index = this.panels.length;
|
|
351
|
-
}
|
|
352
|
-
if (this._activePanel === panel) {
|
|
353
|
-
this.accessor.doSetGroupActive(this.parent);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
this.doAddPanel(panel, options.index);
|
|
357
|
-
this.doSetActivePanel(panel);
|
|
358
|
-
this.accessor.doSetGroupActive(this.parent, !!options.skipFocus);
|
|
359
|
-
this.updateContainer();
|
|
360
|
-
};
|
|
361
|
-
Groupview.prototype.removePanel = function (groupItemOrId) {
|
|
362
|
-
var id = typeof groupItemOrId === 'string'
|
|
363
|
-
? groupItemOrId
|
|
364
|
-
: groupItemOrId.id;
|
|
365
|
-
var panelToRemove = this._panels.find(function (panel) { return panel.id === id; });
|
|
366
|
-
if (!panelToRemove) {
|
|
367
|
-
throw new Error('invalid operation');
|
|
368
|
-
}
|
|
369
|
-
return this._removePanel(panelToRemove);
|
|
370
|
-
};
|
|
371
|
-
Groupview.prototype.closeAllPanels = function () {
|
|
372
|
-
var _a;
|
|
373
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
374
|
-
var index, canClose, _b, i, panel, canClose, arrPanelCpy;
|
|
375
|
-
var _this = this;
|
|
376
|
-
return __generator(this, function (_c) {
|
|
377
|
-
switch (_c.label) {
|
|
378
|
-
case 0:
|
|
379
|
-
index = this._activePanel
|
|
380
|
-
? this.panels.indexOf(this._activePanel)
|
|
381
|
-
: -1;
|
|
382
|
-
if (!(this._activePanel && index > -1)) return [3 /*break*/, 3];
|
|
383
|
-
if (this.panels.indexOf(this._activePanel) < 0) {
|
|
384
|
-
console.warn('active panel not tracked');
|
|
385
|
-
}
|
|
386
|
-
_b = !((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.close);
|
|
387
|
-
if (_b) return [3 /*break*/, 2];
|
|
388
|
-
return [4 /*yield*/, this._activePanel.close()];
|
|
389
|
-
case 1:
|
|
390
|
-
_b = (_c.sent());
|
|
391
|
-
_c.label = 2;
|
|
392
|
-
case 2:
|
|
393
|
-
canClose = _b;
|
|
394
|
-
if (!canClose) {
|
|
395
|
-
return [2 /*return*/, false];
|
|
396
|
-
}
|
|
397
|
-
_c.label = 3;
|
|
398
|
-
case 3:
|
|
399
|
-
i = 0;
|
|
400
|
-
_c.label = 4;
|
|
401
|
-
case 4:
|
|
402
|
-
if (!(i < this.panels.length)) return [3 /*break*/, 7];
|
|
403
|
-
if (i === index) {
|
|
404
|
-
return [3 /*break*/, 6];
|
|
405
|
-
}
|
|
406
|
-
panel = this.panels[i];
|
|
407
|
-
this.openPanel(panel);
|
|
408
|
-
if (!panel.close) return [3 /*break*/, 6];
|
|
409
|
-
return [4 /*yield*/, panel.close()];
|
|
410
|
-
case 5:
|
|
411
|
-
canClose = _c.sent();
|
|
412
|
-
if (!canClose) {
|
|
413
|
-
return [2 /*return*/, false];
|
|
414
|
-
}
|
|
415
|
-
_c.label = 6;
|
|
416
|
-
case 6:
|
|
417
|
-
i++;
|
|
418
|
-
return [3 /*break*/, 4];
|
|
419
|
-
case 7:
|
|
420
|
-
if (!(this.panels.length > 0)) return [3 /*break*/, 9];
|
|
421
|
-
arrPanelCpy = __spreadArray([], __read(this.panels), false);
|
|
422
|
-
return [4 /*yield*/, Promise.all(arrPanelCpy.map(function (p) { return _this.doClose(p); }))];
|
|
423
|
-
case 8:
|
|
424
|
-
_c.sent();
|
|
425
|
-
return [3 /*break*/, 10];
|
|
426
|
-
case 9:
|
|
427
|
-
this.accessor.removeGroup(this.parent);
|
|
428
|
-
_c.label = 10;
|
|
429
|
-
case 10: return [2 /*return*/, true];
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
});
|
|
433
|
-
};
|
|
434
|
-
Groupview.prototype.doClose = function (panel) {
|
|
435
|
-
this.accessor.removePanel(panel);
|
|
436
|
-
};
|
|
437
|
-
Groupview.prototype.isPanelActive = function (panel) {
|
|
438
|
-
return this._activePanel === panel;
|
|
439
|
-
};
|
|
440
|
-
Groupview.prototype.updateActions = function () {
|
|
441
|
-
var _a, _b;
|
|
442
|
-
if (this.isActive && ((_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.actions)) {
|
|
443
|
-
this.tabsContainer.setActionElement(this._activePanel.view.actions.element);
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
this.tabsContainer.setActionElement(undefined);
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
Groupview.prototype.setActive = function (isGroupActive, skipFocus, force) {
|
|
450
|
-
var _a, _b;
|
|
451
|
-
if (skipFocus === void 0) { skipFocus = false; }
|
|
452
|
-
if (force === void 0) { force = false; }
|
|
453
|
-
if (!force && this.isActive === isGroupActive) {
|
|
454
|
-
if (!skipFocus) {
|
|
455
|
-
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
456
|
-
}
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
this._isGroupActive = isGroupActive;
|
|
460
|
-
(0, dom_1.toggleClass)(this.container, 'active-group', isGroupActive);
|
|
461
|
-
(0, dom_1.toggleClass)(this.container, 'inactive-group', !isGroupActive);
|
|
462
|
-
this.tabsContainer.setActive(this.isActive);
|
|
463
|
-
if (!this._activePanel && this.panels.length > 0) {
|
|
464
|
-
this.doSetActivePanel(this.panels[0]);
|
|
465
|
-
}
|
|
466
|
-
this.updateContainer();
|
|
467
|
-
if (isGroupActive) {
|
|
468
|
-
if (!skipFocus) {
|
|
469
|
-
(_b = this._activePanel) === null || _b === void 0 ? void 0 : _b.focus();
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
Groupview.prototype.layout = function (width, height) {
|
|
474
|
-
var _a;
|
|
475
|
-
this._width = width;
|
|
476
|
-
this._height = height;
|
|
477
|
-
this.contentContainer.layout(this._width, this._height);
|
|
478
|
-
if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
|
|
479
|
-
this._activePanel.layout(this._width, this._height);
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
Groupview.prototype._removePanel = function (panel) {
|
|
483
|
-
var isActivePanel = this._activePanel === panel;
|
|
484
|
-
this.doRemovePanel(panel);
|
|
485
|
-
if (isActivePanel && this.panels.length > 0) {
|
|
486
|
-
var nextPanel = this.mostRecentlyUsed[0];
|
|
487
|
-
this.openPanel(nextPanel);
|
|
488
|
-
}
|
|
489
|
-
if (this._activePanel && this.panels.length === 0) {
|
|
490
|
-
this.doSetActivePanel(undefined);
|
|
491
|
-
}
|
|
492
|
-
this.updateContainer();
|
|
493
|
-
return panel;
|
|
494
|
-
};
|
|
495
|
-
Groupview.prototype.doRemovePanel = function (panel) {
|
|
496
|
-
var index = this.panels.indexOf(panel);
|
|
497
|
-
if (this._activePanel === panel) {
|
|
498
|
-
this.contentContainer.closePanel();
|
|
499
|
-
}
|
|
500
|
-
this.tabsContainer.delete(panel.id);
|
|
501
|
-
this._panels.splice(index, 1);
|
|
502
|
-
if (this.mostRecentlyUsed.includes(panel)) {
|
|
503
|
-
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
504
|
-
}
|
|
505
|
-
this._onDidGroupChange.fire({
|
|
506
|
-
kind: GroupChangeKind2.REMOVE_PANEL,
|
|
507
|
-
panel: panel,
|
|
508
|
-
});
|
|
509
|
-
};
|
|
510
|
-
Groupview.prototype.doAddPanel = function (panel, index) {
|
|
511
|
-
if (index === void 0) { index = this.panels.length; }
|
|
512
|
-
var existingPanel = this._panels.indexOf(panel);
|
|
513
|
-
var hasExistingPanel = existingPanel > -1;
|
|
514
|
-
this.tabsContainer.openPanel(panel, index);
|
|
515
|
-
this.contentContainer.openPanel(panel);
|
|
516
|
-
this.tabsContainer.show();
|
|
517
|
-
this.contentContainer.show();
|
|
518
|
-
if (hasExistingPanel) {
|
|
519
|
-
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
this.updateMru(panel);
|
|
523
|
-
this.panels.splice(index, 0, panel);
|
|
524
|
-
this._onDidGroupChange.fire({
|
|
525
|
-
kind: GroupChangeKind2.ADD_PANEL,
|
|
526
|
-
panel: panel,
|
|
527
|
-
});
|
|
528
|
-
};
|
|
529
|
-
Groupview.prototype.doSetActivePanel = function (panel) {
|
|
530
|
-
this._activePanel = panel;
|
|
531
|
-
if (panel) {
|
|
532
|
-
this.tabsContainer.setActivePanel(panel);
|
|
533
|
-
panel.layout(this._width, this._height);
|
|
534
|
-
this.updateMru(panel);
|
|
535
|
-
this._onDidGroupChange.fire({
|
|
536
|
-
kind: GroupChangeKind2.PANEL_ACTIVE,
|
|
537
|
-
panel: panel,
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
Groupview.prototype.updateMru = function (panel) {
|
|
542
|
-
if (this.mostRecentlyUsed.includes(panel)) {
|
|
543
|
-
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
544
|
-
}
|
|
545
|
-
this.mostRecentlyUsed = __spreadArray([panel], __read(this.mostRecentlyUsed), false);
|
|
546
|
-
};
|
|
547
|
-
Groupview.prototype.updateContainer = function () {
|
|
548
|
-
var _this = this;
|
|
549
|
-
this.updateActions();
|
|
550
|
-
(0, dom_1.toggleClass)(this.container, 'empty', this.isEmpty);
|
|
551
|
-
this.panels.forEach(function (panel) {
|
|
552
|
-
return panel.updateParentGroup(_this.parent, _this.isActive);
|
|
553
|
-
});
|
|
554
|
-
if (this.isEmpty && !this.watermark) {
|
|
555
|
-
var watermark = this.accessor.createWatermarkComponent();
|
|
556
|
-
watermark.init({
|
|
557
|
-
containerApi: new component_api_1.DockviewApi(this.accessor),
|
|
558
|
-
params: {},
|
|
559
|
-
title: '',
|
|
560
|
-
api: null,
|
|
561
|
-
});
|
|
562
|
-
this.watermark = watermark;
|
|
563
|
-
(0, events_1.addDisposableListener)(this.watermark.element, 'click', function () {
|
|
564
|
-
if (!_this.isActive) {
|
|
565
|
-
_this.accessor.doSetGroupActive(_this.parent);
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
this.contentContainer.hide();
|
|
569
|
-
this.tabsContainer.hide();
|
|
570
|
-
this.container.appendChild(this.watermark.element);
|
|
571
|
-
this.watermark.updateParentGroup(this.parent, true);
|
|
572
|
-
}
|
|
573
|
-
if (!this.isEmpty && this.watermark) {
|
|
574
|
-
this.watermark.element.remove();
|
|
575
|
-
this.watermark.dispose();
|
|
576
|
-
this.watermark = undefined;
|
|
577
|
-
this.contentContainer.show();
|
|
578
|
-
this.tabsContainer.show();
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
Groupview.prototype.canDisplayOverlay = function (dragOverEvent, target) {
|
|
582
|
-
// custom overlay handler
|
|
583
|
-
return false;
|
|
584
|
-
};
|
|
585
|
-
Groupview.prototype.handleDropEvent = function (event, position, index) {
|
|
586
|
-
var data = (0, dataTransfer_1.getPanelData)();
|
|
587
|
-
if (data) {
|
|
588
|
-
var fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
|
|
589
|
-
if (fromSameGroup && this.tabsContainer.size === 1) {
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
var groupId = data.groupId, panelId = data.panelId;
|
|
593
|
-
var isSameGroup = this.id === groupId;
|
|
594
|
-
if (isSameGroup && !position) {
|
|
595
|
-
var oldIndex = this.tabsContainer.indexOf(panelId);
|
|
596
|
-
if (oldIndex === index) {
|
|
597
|
-
return;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
this._onMove.fire({
|
|
601
|
-
target: position,
|
|
602
|
-
groupId: data.groupId,
|
|
603
|
-
itemId: data.panelId,
|
|
604
|
-
index: index,
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
else {
|
|
608
|
-
// custom drop handler
|
|
609
|
-
}
|
|
610
|
-
};
|
|
611
|
-
Groupview.prototype.dispose = function () {
|
|
612
|
-
var e_1, _a;
|
|
613
|
-
try {
|
|
614
|
-
for (var _b = __values(this.panels), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
615
|
-
var panel = _c.value;
|
|
616
|
-
panel.dispose();
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
620
|
-
finally {
|
|
621
|
-
try {
|
|
622
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
623
|
-
}
|
|
624
|
-
finally { if (e_1) throw e_1.error; }
|
|
625
|
-
}
|
|
626
|
-
_super.prototype.dispose.call(this);
|
|
627
|
-
this.dropTarget.dispose();
|
|
628
|
-
this.tabsContainer.dispose();
|
|
629
|
-
this.contentContainer.dispose();
|
|
630
|
-
};
|
|
631
|
-
return Groupview;
|
|
632
|
-
}(lifecycle_1.CompositeDisposable));
|
|
633
|
-
exports.Groupview = Groupview;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
54
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
55
|
+
if (!m) return o;
|
|
56
|
+
var i = m.call(o), r, ar = [], e;
|
|
57
|
+
try {
|
|
58
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
59
|
+
}
|
|
60
|
+
catch (error) { e = { error: error }; }
|
|
61
|
+
finally {
|
|
62
|
+
try {
|
|
63
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
64
|
+
}
|
|
65
|
+
finally { if (e) throw e.error; }
|
|
66
|
+
}
|
|
67
|
+
return ar;
|
|
68
|
+
};
|
|
69
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
70
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
71
|
+
if (ar || !(i in from)) {
|
|
72
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
73
|
+
ar[i] = from[i];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
77
|
+
};
|
|
78
|
+
var __values = (this && this.__values) || function(o) {
|
|
79
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
80
|
+
if (m) return m.call(o);
|
|
81
|
+
if (o && typeof o.length === "number") return {
|
|
82
|
+
next: function () {
|
|
83
|
+
if (o && i >= o.length) o = void 0;
|
|
84
|
+
return { value: o && o[i++], done: !o };
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
88
|
+
};
|
|
89
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90
|
+
exports.Groupview = exports.GroupChangeKind2 = void 0;
|
|
91
|
+
var component_api_1 = require("../api/component.api");
|
|
92
|
+
var dataTransfer_1 = require("../dnd/dataTransfer");
|
|
93
|
+
var droptarget_1 = require("../dnd/droptarget");
|
|
94
|
+
var dom_1 = require("../dom");
|
|
95
|
+
var events_1 = require("../events");
|
|
96
|
+
var lifecycle_1 = require("../lifecycle");
|
|
97
|
+
var content_1 = require("./panel/content");
|
|
98
|
+
var tabsContainer_1 = require("./titlebar/tabsContainer");
|
|
99
|
+
var dnd_1 = require("./dnd");
|
|
100
|
+
var GroupChangeKind2;
|
|
101
|
+
(function (GroupChangeKind2) {
|
|
102
|
+
GroupChangeKind2["ADD_PANEL"] = "ADD_PANEL";
|
|
103
|
+
GroupChangeKind2["REMOVE_PANEL"] = "REMOVE_PANEL";
|
|
104
|
+
GroupChangeKind2["PANEL_ACTIVE"] = "PANEL_ACTIVE";
|
|
105
|
+
GroupChangeKind2["GROUP_ACTIVE"] = "GROUP_ACTIVE";
|
|
106
|
+
})(GroupChangeKind2 = exports.GroupChangeKind2 || (exports.GroupChangeKind2 = {}));
|
|
107
|
+
var Groupview = /** @class */ (function (_super) {
|
|
108
|
+
__extends(Groupview, _super);
|
|
109
|
+
function Groupview(container, accessor, id, options, parent) {
|
|
110
|
+
var _this = _super.call(this) || this;
|
|
111
|
+
_this.container = container;
|
|
112
|
+
_this.accessor = accessor;
|
|
113
|
+
_this.id = id;
|
|
114
|
+
_this.options = options;
|
|
115
|
+
_this.parent = parent;
|
|
116
|
+
_this._isGroupActive = false;
|
|
117
|
+
_this.mostRecentlyUsed = [];
|
|
118
|
+
_this._onDidChange = new events_1.Emitter();
|
|
119
|
+
_this.onDidChange = _this._onDidChange.event;
|
|
120
|
+
_this._width = 0;
|
|
121
|
+
_this._height = 0;
|
|
122
|
+
_this._panels = [];
|
|
123
|
+
_this._onMove = new events_1.Emitter();
|
|
124
|
+
_this.onMove = _this._onMove.event;
|
|
125
|
+
_this._onDidGroupChange = new events_1.Emitter();
|
|
126
|
+
_this.onDidGroupChange = _this._onDidGroupChange.event;
|
|
127
|
+
_this.closePanel = function (panel) { return __awaiter(_this, void 0, void 0, function () {
|
|
128
|
+
var _a;
|
|
129
|
+
return __generator(this, function (_b) {
|
|
130
|
+
switch (_b.label) {
|
|
131
|
+
case 0:
|
|
132
|
+
_a = panel.close;
|
|
133
|
+
if (!_a) return [3 /*break*/, 2];
|
|
134
|
+
return [4 /*yield*/, panel.close()];
|
|
135
|
+
case 1:
|
|
136
|
+
_a = !(_b.sent());
|
|
137
|
+
_b.label = 2;
|
|
138
|
+
case 2:
|
|
139
|
+
if (_a) {
|
|
140
|
+
return [2 /*return*/, false];
|
|
141
|
+
}
|
|
142
|
+
this.doClose(panel);
|
|
143
|
+
return [2 /*return*/, true];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}); };
|
|
147
|
+
_this.container.classList.add('groupview');
|
|
148
|
+
_this.addDisposables(_this._onMove, _this._onDidGroupChange);
|
|
149
|
+
_this.tabsContainer = new tabsContainer_1.TabsContainer(_this.accessor, _this.parent, {
|
|
150
|
+
tabHeight: options.tabHeight,
|
|
151
|
+
});
|
|
152
|
+
_this.contentContainer = new content_1.ContentContainer();
|
|
153
|
+
_this.dropTarget = new droptarget_1.Droptarget(_this.contentContainer.element, {
|
|
154
|
+
validOverlays: 'all',
|
|
155
|
+
canDisplayOverlay: function (event) {
|
|
156
|
+
var data = (0, dataTransfer_1.getPanelData)();
|
|
157
|
+
if (data) {
|
|
158
|
+
var groupHasOnePanelAndIsActiveDragElement = _this._panels.length === 1 && data.groupId === _this.id;
|
|
159
|
+
return !groupHasOnePanelAndIsActiveDragElement;
|
|
160
|
+
}
|
|
161
|
+
return _this.canDisplayOverlay(event, dnd_1.DockviewDropTargets.Panel);
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
container.append(_this.tabsContainer.element, _this.contentContainer.element);
|
|
165
|
+
_this.addDisposables(_this._onMove, _this._onDidGroupChange, _this.tabsContainer.onDrop(function (event) {
|
|
166
|
+
_this.handleDropEvent(event.event, droptarget_1.Position.Center, event.index);
|
|
167
|
+
}), _this.contentContainer.onDidFocus(function () {
|
|
168
|
+
_this.accessor.doSetGroupActive(_this.parent, true);
|
|
169
|
+
}), _this.contentContainer.onDidBlur(function () {
|
|
170
|
+
// noop
|
|
171
|
+
}), _this.dropTarget.onDrop(function (event) {
|
|
172
|
+
_this.handleDropEvent(event.nativeEvent, event.position);
|
|
173
|
+
}));
|
|
174
|
+
return _this;
|
|
175
|
+
}
|
|
176
|
+
Object.defineProperty(Groupview.prototype, "element", {
|
|
177
|
+
get: function () {
|
|
178
|
+
throw new Error('not supported');
|
|
179
|
+
},
|
|
180
|
+
enumerable: false,
|
|
181
|
+
configurable: true
|
|
182
|
+
});
|
|
183
|
+
Object.defineProperty(Groupview.prototype, "activePanel", {
|
|
184
|
+
get: function () {
|
|
185
|
+
return this._activePanel;
|
|
186
|
+
},
|
|
187
|
+
enumerable: false,
|
|
188
|
+
configurable: true
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(Groupview.prototype, "tabHeight", {
|
|
191
|
+
get: function () {
|
|
192
|
+
return this.tabsContainer.height;
|
|
193
|
+
},
|
|
194
|
+
set: function (height) {
|
|
195
|
+
this.tabsContainer.height = height;
|
|
196
|
+
this.layout(this._width, this._height);
|
|
197
|
+
},
|
|
198
|
+
enumerable: false,
|
|
199
|
+
configurable: true
|
|
200
|
+
});
|
|
201
|
+
Object.defineProperty(Groupview.prototype, "isActive", {
|
|
202
|
+
get: function () {
|
|
203
|
+
return this._isGroupActive;
|
|
204
|
+
},
|
|
205
|
+
enumerable: false,
|
|
206
|
+
configurable: true
|
|
207
|
+
});
|
|
208
|
+
Object.defineProperty(Groupview.prototype, "panels", {
|
|
209
|
+
get: function () {
|
|
210
|
+
return this._panels;
|
|
211
|
+
},
|
|
212
|
+
enumerable: false,
|
|
213
|
+
configurable: true
|
|
214
|
+
});
|
|
215
|
+
Object.defineProperty(Groupview.prototype, "size", {
|
|
216
|
+
get: function () {
|
|
217
|
+
return this._panels.length;
|
|
218
|
+
},
|
|
219
|
+
enumerable: false,
|
|
220
|
+
configurable: true
|
|
221
|
+
});
|
|
222
|
+
Object.defineProperty(Groupview.prototype, "isEmpty", {
|
|
223
|
+
get: function () {
|
|
224
|
+
return this._panels.length === 0;
|
|
225
|
+
},
|
|
226
|
+
enumerable: false,
|
|
227
|
+
configurable: true
|
|
228
|
+
});
|
|
229
|
+
Object.defineProperty(Groupview.prototype, "minimumHeight", {
|
|
230
|
+
get: function () {
|
|
231
|
+
return 100;
|
|
232
|
+
},
|
|
233
|
+
enumerable: false,
|
|
234
|
+
configurable: true
|
|
235
|
+
});
|
|
236
|
+
Object.defineProperty(Groupview.prototype, "maximumHeight", {
|
|
237
|
+
get: function () {
|
|
238
|
+
return Number.MAX_SAFE_INTEGER;
|
|
239
|
+
},
|
|
240
|
+
enumerable: false,
|
|
241
|
+
configurable: true
|
|
242
|
+
});
|
|
243
|
+
Object.defineProperty(Groupview.prototype, "minimumWidth", {
|
|
244
|
+
get: function () {
|
|
245
|
+
return 100;
|
|
246
|
+
},
|
|
247
|
+
enumerable: false,
|
|
248
|
+
configurable: true
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(Groupview.prototype, "maximumWidth", {
|
|
251
|
+
get: function () {
|
|
252
|
+
return Number.MAX_SAFE_INTEGER;
|
|
253
|
+
},
|
|
254
|
+
enumerable: false,
|
|
255
|
+
configurable: true
|
|
256
|
+
});
|
|
257
|
+
Groupview.prototype.initialize = function () {
|
|
258
|
+
var _this = this;
|
|
259
|
+
var _a, _b;
|
|
260
|
+
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.panels) {
|
|
261
|
+
this.options.panels.forEach(function (panel) {
|
|
262
|
+
_this.doAddPanel(panel);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.activePanel) {
|
|
266
|
+
this.openPanel(this.options.activePanel);
|
|
267
|
+
}
|
|
268
|
+
// must be run after the constructor otherwise this.parent may not be
|
|
269
|
+
// correctly initialized
|
|
270
|
+
this.setActive(this.isActive, true, true);
|
|
271
|
+
this.updateContainer();
|
|
272
|
+
};
|
|
273
|
+
Groupview.prototype.isContentFocused = function () {
|
|
274
|
+
if (!document.activeElement) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
return (0, dom_1.isAncestor)(document.activeElement, this.contentContainer.element);
|
|
278
|
+
};
|
|
279
|
+
Groupview.prototype.indexOf = function (panel) {
|
|
280
|
+
return this.tabsContainer.indexOf(panel.id);
|
|
281
|
+
};
|
|
282
|
+
Groupview.prototype.toJSON = function () {
|
|
283
|
+
var _a;
|
|
284
|
+
return {
|
|
285
|
+
views: this.tabsContainer.panels,
|
|
286
|
+
activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
|
|
287
|
+
id: this.id,
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
Groupview.prototype.moveToNext = function (options) {
|
|
291
|
+
if (!options) {
|
|
292
|
+
options = {};
|
|
293
|
+
}
|
|
294
|
+
if (!options.panel) {
|
|
295
|
+
options.panel = this.activePanel;
|
|
296
|
+
}
|
|
297
|
+
var index = options.panel ? this.panels.indexOf(options.panel) : -1;
|
|
298
|
+
var normalizedIndex;
|
|
299
|
+
if (index < this.panels.length - 1) {
|
|
300
|
+
normalizedIndex = index + 1;
|
|
301
|
+
}
|
|
302
|
+
else if (!options.suppressRoll) {
|
|
303
|
+
normalizedIndex = 0;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
this.openPanel(this.panels[normalizedIndex]);
|
|
309
|
+
};
|
|
310
|
+
Groupview.prototype.moveToPrevious = function (options) {
|
|
311
|
+
if (!options) {
|
|
312
|
+
options = {};
|
|
313
|
+
}
|
|
314
|
+
if (!options.panel) {
|
|
315
|
+
options.panel = this.activePanel;
|
|
316
|
+
}
|
|
317
|
+
if (!options.panel) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
var index = this.panels.indexOf(options.panel);
|
|
321
|
+
var normalizedIndex;
|
|
322
|
+
if (index > 0) {
|
|
323
|
+
normalizedIndex = index - 1;
|
|
324
|
+
}
|
|
325
|
+
else if (!options.suppressRoll) {
|
|
326
|
+
normalizedIndex = this.panels.length - 1;
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this.openPanel(this.panels[normalizedIndex]);
|
|
332
|
+
};
|
|
333
|
+
Groupview.prototype.containsPanel = function (panel) {
|
|
334
|
+
return this.panels.includes(panel);
|
|
335
|
+
};
|
|
336
|
+
Groupview.prototype.init = function (params) {
|
|
337
|
+
//noop
|
|
338
|
+
};
|
|
339
|
+
Groupview.prototype.update = function (params) {
|
|
340
|
+
//noop
|
|
341
|
+
};
|
|
342
|
+
Groupview.prototype.focus = function () {
|
|
343
|
+
var _a;
|
|
344
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
345
|
+
};
|
|
346
|
+
Groupview.prototype.openPanel = function (panel, options) {
|
|
347
|
+
if (options === void 0) { options = {}; }
|
|
348
|
+
if (typeof options.index !== 'number' ||
|
|
349
|
+
options.index > this.panels.length) {
|
|
350
|
+
options.index = this.panels.length;
|
|
351
|
+
}
|
|
352
|
+
if (this._activePanel === panel) {
|
|
353
|
+
this.accessor.doSetGroupActive(this.parent);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
this.doAddPanel(panel, options.index);
|
|
357
|
+
this.doSetActivePanel(panel);
|
|
358
|
+
this.accessor.doSetGroupActive(this.parent, !!options.skipFocus);
|
|
359
|
+
this.updateContainer();
|
|
360
|
+
};
|
|
361
|
+
Groupview.prototype.removePanel = function (groupItemOrId) {
|
|
362
|
+
var id = typeof groupItemOrId === 'string'
|
|
363
|
+
? groupItemOrId
|
|
364
|
+
: groupItemOrId.id;
|
|
365
|
+
var panelToRemove = this._panels.find(function (panel) { return panel.id === id; });
|
|
366
|
+
if (!panelToRemove) {
|
|
367
|
+
throw new Error('invalid operation');
|
|
368
|
+
}
|
|
369
|
+
return this._removePanel(panelToRemove);
|
|
370
|
+
};
|
|
371
|
+
Groupview.prototype.closeAllPanels = function () {
|
|
372
|
+
var _a;
|
|
373
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
374
|
+
var index, canClose, _b, i, panel, canClose, arrPanelCpy;
|
|
375
|
+
var _this = this;
|
|
376
|
+
return __generator(this, function (_c) {
|
|
377
|
+
switch (_c.label) {
|
|
378
|
+
case 0:
|
|
379
|
+
index = this._activePanel
|
|
380
|
+
? this.panels.indexOf(this._activePanel)
|
|
381
|
+
: -1;
|
|
382
|
+
if (!(this._activePanel && index > -1)) return [3 /*break*/, 3];
|
|
383
|
+
if (this.panels.indexOf(this._activePanel) < 0) {
|
|
384
|
+
console.warn('active panel not tracked');
|
|
385
|
+
}
|
|
386
|
+
_b = !((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.close);
|
|
387
|
+
if (_b) return [3 /*break*/, 2];
|
|
388
|
+
return [4 /*yield*/, this._activePanel.close()];
|
|
389
|
+
case 1:
|
|
390
|
+
_b = (_c.sent());
|
|
391
|
+
_c.label = 2;
|
|
392
|
+
case 2:
|
|
393
|
+
canClose = _b;
|
|
394
|
+
if (!canClose) {
|
|
395
|
+
return [2 /*return*/, false];
|
|
396
|
+
}
|
|
397
|
+
_c.label = 3;
|
|
398
|
+
case 3:
|
|
399
|
+
i = 0;
|
|
400
|
+
_c.label = 4;
|
|
401
|
+
case 4:
|
|
402
|
+
if (!(i < this.panels.length)) return [3 /*break*/, 7];
|
|
403
|
+
if (i === index) {
|
|
404
|
+
return [3 /*break*/, 6];
|
|
405
|
+
}
|
|
406
|
+
panel = this.panels[i];
|
|
407
|
+
this.openPanel(panel);
|
|
408
|
+
if (!panel.close) return [3 /*break*/, 6];
|
|
409
|
+
return [4 /*yield*/, panel.close()];
|
|
410
|
+
case 5:
|
|
411
|
+
canClose = _c.sent();
|
|
412
|
+
if (!canClose) {
|
|
413
|
+
return [2 /*return*/, false];
|
|
414
|
+
}
|
|
415
|
+
_c.label = 6;
|
|
416
|
+
case 6:
|
|
417
|
+
i++;
|
|
418
|
+
return [3 /*break*/, 4];
|
|
419
|
+
case 7:
|
|
420
|
+
if (!(this.panels.length > 0)) return [3 /*break*/, 9];
|
|
421
|
+
arrPanelCpy = __spreadArray([], __read(this.panels), false);
|
|
422
|
+
return [4 /*yield*/, Promise.all(arrPanelCpy.map(function (p) { return _this.doClose(p); }))];
|
|
423
|
+
case 8:
|
|
424
|
+
_c.sent();
|
|
425
|
+
return [3 /*break*/, 10];
|
|
426
|
+
case 9:
|
|
427
|
+
this.accessor.removeGroup(this.parent);
|
|
428
|
+
_c.label = 10;
|
|
429
|
+
case 10: return [2 /*return*/, true];
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
Groupview.prototype.doClose = function (panel) {
|
|
435
|
+
this.accessor.removePanel(panel);
|
|
436
|
+
};
|
|
437
|
+
Groupview.prototype.isPanelActive = function (panel) {
|
|
438
|
+
return this._activePanel === panel;
|
|
439
|
+
};
|
|
440
|
+
Groupview.prototype.updateActions = function () {
|
|
441
|
+
var _a, _b;
|
|
442
|
+
if (this.isActive && ((_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.actions)) {
|
|
443
|
+
this.tabsContainer.setActionElement(this._activePanel.view.actions.element);
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
this.tabsContainer.setActionElement(undefined);
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
Groupview.prototype.setActive = function (isGroupActive, skipFocus, force) {
|
|
450
|
+
var _a, _b;
|
|
451
|
+
if (skipFocus === void 0) { skipFocus = false; }
|
|
452
|
+
if (force === void 0) { force = false; }
|
|
453
|
+
if (!force && this.isActive === isGroupActive) {
|
|
454
|
+
if (!skipFocus) {
|
|
455
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
456
|
+
}
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
this._isGroupActive = isGroupActive;
|
|
460
|
+
(0, dom_1.toggleClass)(this.container, 'active-group', isGroupActive);
|
|
461
|
+
(0, dom_1.toggleClass)(this.container, 'inactive-group', !isGroupActive);
|
|
462
|
+
this.tabsContainer.setActive(this.isActive);
|
|
463
|
+
if (!this._activePanel && this.panels.length > 0) {
|
|
464
|
+
this.doSetActivePanel(this.panels[0]);
|
|
465
|
+
}
|
|
466
|
+
this.updateContainer();
|
|
467
|
+
if (isGroupActive) {
|
|
468
|
+
if (!skipFocus) {
|
|
469
|
+
(_b = this._activePanel) === null || _b === void 0 ? void 0 : _b.focus();
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
Groupview.prototype.layout = function (width, height) {
|
|
474
|
+
var _a;
|
|
475
|
+
this._width = width;
|
|
476
|
+
this._height = height;
|
|
477
|
+
this.contentContainer.layout(this._width, this._height);
|
|
478
|
+
if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
|
|
479
|
+
this._activePanel.layout(this._width, this._height);
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
Groupview.prototype._removePanel = function (panel) {
|
|
483
|
+
var isActivePanel = this._activePanel === panel;
|
|
484
|
+
this.doRemovePanel(panel);
|
|
485
|
+
if (isActivePanel && this.panels.length > 0) {
|
|
486
|
+
var nextPanel = this.mostRecentlyUsed[0];
|
|
487
|
+
this.openPanel(nextPanel);
|
|
488
|
+
}
|
|
489
|
+
if (this._activePanel && this.panels.length === 0) {
|
|
490
|
+
this.doSetActivePanel(undefined);
|
|
491
|
+
}
|
|
492
|
+
this.updateContainer();
|
|
493
|
+
return panel;
|
|
494
|
+
};
|
|
495
|
+
Groupview.prototype.doRemovePanel = function (panel) {
|
|
496
|
+
var index = this.panels.indexOf(panel);
|
|
497
|
+
if (this._activePanel === panel) {
|
|
498
|
+
this.contentContainer.closePanel();
|
|
499
|
+
}
|
|
500
|
+
this.tabsContainer.delete(panel.id);
|
|
501
|
+
this._panels.splice(index, 1);
|
|
502
|
+
if (this.mostRecentlyUsed.includes(panel)) {
|
|
503
|
+
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
504
|
+
}
|
|
505
|
+
this._onDidGroupChange.fire({
|
|
506
|
+
kind: GroupChangeKind2.REMOVE_PANEL,
|
|
507
|
+
panel: panel,
|
|
508
|
+
});
|
|
509
|
+
};
|
|
510
|
+
Groupview.prototype.doAddPanel = function (panel, index) {
|
|
511
|
+
if (index === void 0) { index = this.panels.length; }
|
|
512
|
+
var existingPanel = this._panels.indexOf(panel);
|
|
513
|
+
var hasExistingPanel = existingPanel > -1;
|
|
514
|
+
this.tabsContainer.openPanel(panel, index);
|
|
515
|
+
this.contentContainer.openPanel(panel);
|
|
516
|
+
this.tabsContainer.show();
|
|
517
|
+
this.contentContainer.show();
|
|
518
|
+
if (hasExistingPanel) {
|
|
519
|
+
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
this.updateMru(panel);
|
|
523
|
+
this.panels.splice(index, 0, panel);
|
|
524
|
+
this._onDidGroupChange.fire({
|
|
525
|
+
kind: GroupChangeKind2.ADD_PANEL,
|
|
526
|
+
panel: panel,
|
|
527
|
+
});
|
|
528
|
+
};
|
|
529
|
+
Groupview.prototype.doSetActivePanel = function (panel) {
|
|
530
|
+
this._activePanel = panel;
|
|
531
|
+
if (panel) {
|
|
532
|
+
this.tabsContainer.setActivePanel(panel);
|
|
533
|
+
panel.layout(this._width, this._height);
|
|
534
|
+
this.updateMru(panel);
|
|
535
|
+
this._onDidGroupChange.fire({
|
|
536
|
+
kind: GroupChangeKind2.PANEL_ACTIVE,
|
|
537
|
+
panel: panel,
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
Groupview.prototype.updateMru = function (panel) {
|
|
542
|
+
if (this.mostRecentlyUsed.includes(panel)) {
|
|
543
|
+
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
544
|
+
}
|
|
545
|
+
this.mostRecentlyUsed = __spreadArray([panel], __read(this.mostRecentlyUsed), false);
|
|
546
|
+
};
|
|
547
|
+
Groupview.prototype.updateContainer = function () {
|
|
548
|
+
var _this = this;
|
|
549
|
+
this.updateActions();
|
|
550
|
+
(0, dom_1.toggleClass)(this.container, 'empty', this.isEmpty);
|
|
551
|
+
this.panels.forEach(function (panel) {
|
|
552
|
+
return panel.updateParentGroup(_this.parent, _this.isActive);
|
|
553
|
+
});
|
|
554
|
+
if (this.isEmpty && !this.watermark) {
|
|
555
|
+
var watermark = this.accessor.createWatermarkComponent();
|
|
556
|
+
watermark.init({
|
|
557
|
+
containerApi: new component_api_1.DockviewApi(this.accessor),
|
|
558
|
+
params: {},
|
|
559
|
+
title: '',
|
|
560
|
+
api: null,
|
|
561
|
+
});
|
|
562
|
+
this.watermark = watermark;
|
|
563
|
+
(0, events_1.addDisposableListener)(this.watermark.element, 'click', function () {
|
|
564
|
+
if (!_this.isActive) {
|
|
565
|
+
_this.accessor.doSetGroupActive(_this.parent);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
this.contentContainer.hide();
|
|
569
|
+
this.tabsContainer.hide();
|
|
570
|
+
this.container.appendChild(this.watermark.element);
|
|
571
|
+
this.watermark.updateParentGroup(this.parent, true);
|
|
572
|
+
}
|
|
573
|
+
if (!this.isEmpty && this.watermark) {
|
|
574
|
+
this.watermark.element.remove();
|
|
575
|
+
this.watermark.dispose();
|
|
576
|
+
this.watermark = undefined;
|
|
577
|
+
this.contentContainer.show();
|
|
578
|
+
this.tabsContainer.show();
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
Groupview.prototype.canDisplayOverlay = function (dragOverEvent, target) {
|
|
582
|
+
// custom overlay handler
|
|
583
|
+
return false;
|
|
584
|
+
};
|
|
585
|
+
Groupview.prototype.handleDropEvent = function (event, position, index) {
|
|
586
|
+
var data = (0, dataTransfer_1.getPanelData)();
|
|
587
|
+
if (data) {
|
|
588
|
+
var fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
|
|
589
|
+
if (fromSameGroup && this.tabsContainer.size === 1) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
var groupId = data.groupId, panelId = data.panelId;
|
|
593
|
+
var isSameGroup = this.id === groupId;
|
|
594
|
+
if (isSameGroup && !position) {
|
|
595
|
+
var oldIndex = this.tabsContainer.indexOf(panelId);
|
|
596
|
+
if (oldIndex === index) {
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
this._onMove.fire({
|
|
601
|
+
target: position,
|
|
602
|
+
groupId: data.groupId,
|
|
603
|
+
itemId: data.panelId,
|
|
604
|
+
index: index,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
// custom drop handler
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
Groupview.prototype.dispose = function () {
|
|
612
|
+
var e_1, _a;
|
|
613
|
+
try {
|
|
614
|
+
for (var _b = __values(this.panels), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
615
|
+
var panel = _c.value;
|
|
616
|
+
panel.dispose();
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
620
|
+
finally {
|
|
621
|
+
try {
|
|
622
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
623
|
+
}
|
|
624
|
+
finally { if (e_1) throw e_1.error; }
|
|
625
|
+
}
|
|
626
|
+
_super.prototype.dispose.call(this);
|
|
627
|
+
this.dropTarget.dispose();
|
|
628
|
+
this.tabsContainer.dispose();
|
|
629
|
+
this.contentContainer.dispose();
|
|
630
|
+
};
|
|
631
|
+
return Groupview;
|
|
632
|
+
}(lifecycle_1.CompositeDisposable));
|
|
633
|
+
exports.Groupview = Groupview;
|
|
634
634
|
//# sourceMappingURL=groupview.js.map
|