dockview 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +145 -144
- package/dist/cjs/api/component.api.js +578 -571
- package/dist/cjs/api/component.api.js.map +1 -1
- package/dist/cjs/api/{groupPanelApi.d.ts → dockviewPanelApi.d.ts} +34 -34
- package/dist/cjs/api/{groupPanelApi.js → dockviewPanelApi.js} +84 -86
- package/dist/cjs/api/dockviewPanelApi.js.map +1 -0
- package/dist/cjs/api/gridviewPanelApi.d.ts +37 -36
- package/dist/cjs/api/gridviewPanelApi.js +47 -47
- package/dist/cjs/api/gridviewPanelApi.js.map +1 -1
- package/dist/cjs/api/panelApi.d.ts +88 -81
- package/dist/cjs/api/panelApi.js +137 -121
- package/dist/cjs/api/panelApi.js.map +1 -1
- 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/abstractDragHandler.js.map +1 -1
- package/dist/cjs/dnd/dataTransfer.d.ts +31 -31
- package/dist/cjs/dnd/dataTransfer.js +100 -100
- package/dist/cjs/dnd/dataTransfer.js.map +1 -1
- package/dist/cjs/dnd/dnd.d.ts +27 -27
- package/dist/cjs/dnd/dnd.js +59 -64
- package/dist/cjs/dnd/dnd.js.map +1 -1
- package/dist/cjs/dnd/droptarget.d.ts +42 -37
- package/dist/cjs/dnd/droptarget.js +279 -201
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dnd/ghost.d.ts +1 -0
- package/dist/cjs/dnd/ghost.js +15 -0
- package/dist/cjs/dnd/ghost.js.map +1 -0
- package/dist/cjs/dnd/groupDragHandler.d.ts +11 -0
- package/dist/cjs/dnd/groupDragHandler.js +62 -0
- package/dist/cjs/dnd/groupDragHandler.js.map +1 -0
- 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 +6 -5
- package/dist/cjs/dockview/deserializer.js +2 -2
- package/dist/cjs/dockview/dockviewComponent.d.ts +133 -125
- package/dist/cjs/dockview/dockviewComponent.js +795 -614
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/{esm/dockview/dockviewGroupPanel.d.ts → cjs/dockview/dockviewPanel.d.ts} +42 -31
- package/dist/cjs/dockview/{dockviewGroupPanel.js → dockviewPanel.js} +161 -157
- package/dist/cjs/dockview/dockviewPanel.js.map +1 -0
- package/dist/cjs/dockview/options.d.ts +110 -88
- package/dist/cjs/dockview/options.js +31 -2
- package/dist/cjs/dockview/options.js.map +1 -1
- package/dist/cjs/dockview/validation.d.ts +2 -0
- package/dist/cjs/dockview/validation.js +135 -0
- package/dist/cjs/dockview/validation.js.map +1 -0
- 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 +278 -279
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
- 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 +132 -123
- package/dist/cjs/gridview/gridview.js +510 -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 +324 -325
- package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.d.ts +60 -60
- package/dist/cjs/gridview/gridviewPanel.js +201 -202
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
- 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 +6 -5
- package/dist/cjs/groupview/dnd.js +10 -9
- package/dist/cjs/groupview/dnd.js.map +1 -1
- package/dist/cjs/groupview/groupview.d.ts +177 -177
- package/dist/cjs/groupview/groupview.js +607 -589
- package/dist/cjs/groupview/groupview.js.map +1 -1
- 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 +31 -41
- package/dist/cjs/groupview/tab.js +124 -120
- package/dist/cjs/groupview/tab.js.map +1 -1
- package/dist/cjs/groupview/titlebar/tabsContainer.d.ts +65 -68
- package/dist/cjs/groupview/titlebar/tabsContainer.js +251 -258
- package/dist/cjs/groupview/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/groupview/titlebar/voidContainer.d.ts +15 -0
- package/dist/cjs/groupview/titlebar/voidContainer.js +74 -0
- package/dist/cjs/groupview/titlebar/voidContainer.js.map +1 -0
- package/dist/cjs/groupview/types.d.ts +68 -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 +47 -46
- package/dist/cjs/index.js.map +1 -1
- 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 +130 -129
- package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -1
- 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/paneviewComponent.js.map +1 -1
- package/dist/cjs/paneview/paneviewPanel.d.ts +92 -89
- package/dist/cjs/paneview/paneviewPanel.js +275 -274
- package/dist/cjs/paneview/paneviewPanel.js.map +1 -1
- package/dist/cjs/react/deserializer.d.ts +10 -9
- package/dist/cjs/react/deserializer.js +43 -43
- package/dist/cjs/react/deserializer.js.map +1 -1
- 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 +35 -34
- package/dist/cjs/react/dockview/dockview.js +213 -212
- package/dist/cjs/react/dockview/dockview.js.map +1 -1
- 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 +41 -40
- package/dist/cjs/react/gridview/view.js.map +1 -1
- 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/splitviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.d.ts +45 -42
- package/dist/cjs/splitview/splitviewPanel.js +179 -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 +8 -7
- package/dist/cjs/types.js +7 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/dockview.amd.js +7168 -6739
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.noStyle.js +7176 -6747
- package/dist/dockview.cjs.js +7167 -6738
- package/dist/dockview.esm.js +7152 -6726
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.js +7168 -6739
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.noStyle.js +7176 -6747
- 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 +145 -144
- package/dist/esm/api/component.api.js +329 -326
- package/dist/esm/api/{groupPanelApi.d.ts → dockviewPanelApi.d.ts} +34 -34
- package/dist/esm/api/{groupPanelApi.js → dockviewPanelApi.js} +48 -50
- package/dist/esm/api/gridviewPanelApi.d.ts +37 -36
- package/dist/esm/api/gridviewPanelApi.js +25 -25
- package/dist/esm/api/panelApi.d.ts +88 -81
- package/dist/esm/api/panelApi.js +95 -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 +36 -41
- package/dist/esm/dnd/droptarget.d.ts +42 -37
- package/dist/esm/dnd/droptarget.js +249 -167
- package/dist/esm/dnd/ghost.d.ts +1 -0
- package/dist/esm/dnd/ghost.js +10 -0
- package/dist/esm/dnd/groupDragHandler.d.ts +11 -0
- package/dist/esm/dnd/groupDragHandler.js +38 -0
- 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 +6 -5
- package/dist/esm/dockview/deserializer.js +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +133 -125
- package/dist/esm/dockview/dockviewComponent.js +632 -468
- package/dist/{cjs/dockview/dockviewGroupPanel.d.ts → esm/dockview/dockviewPanel.d.ts} +42 -31
- package/dist/esm/dockview/{dockviewGroupPanel.js → dockviewPanel.js} +111 -107
- package/dist/esm/dockview/options.d.ts +110 -88
- package/dist/esm/dockview/options.js +24 -1
- package/dist/esm/dockview/validation.d.ts +2 -0
- package/dist/esm/dockview/validation.js +86 -0
- 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 +188 -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 +132 -123
- package/dist/esm/gridview/gridview.js +423 -397
- package/dist/esm/gridview/gridviewComponent.d.ts +85 -85
- package/dist/esm/gridview/gridviewComponent.js +237 -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 +6 -5
- package/dist/esm/groupview/dnd.js +7 -6
- package/dist/esm/groupview/groupview.d.ts +177 -177
- package/dist/esm/groupview/groupview.js +462 -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 +31 -41
- package/dist/esm/groupview/tab.js +94 -90
- package/dist/esm/groupview/titlebar/tabsContainer.d.ts +65 -68
- package/dist/esm/groupview/titlebar/tabsContainer.js +183 -190
- package/dist/esm/groupview/titlebar/voidContainer.d.ts +15 -0
- package/dist/esm/groupview/titlebar/voidContainer.js +47 -0
- package/dist/esm/groupview/types.d.ts +68 -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 +91 -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 +192 -191
- package/dist/esm/react/deserializer.d.ts +10 -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 +35 -34
- package/dist/esm/react/dockview/dockview.js +158 -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 +19 -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 +108 -107
- package/dist/esm/svg.d.ts +3 -3
- package/dist/esm/svg.js +31 -31
- package/dist/esm/types.d.ts +8 -7
- package/dist/esm/types.js +3 -1
- package/dist/styles/dockview.css +23 -26
- package/package.json +12 -16
- package/dist/cjs/api/groupPanelApi.js.map +0 -1
- package/dist/cjs/dockview/dockviewGroupPanel.js.map +0 -1
- package/dist/cjs/groupview/groupPanel.d.ts +0 -32
- package/dist/cjs/groupview/groupPanel.js +0 -3
- package/dist/cjs/groupview/groupPanel.js.map +0 -1
- package/dist/esm/groupview/groupPanel.d.ts +0 -32
- package/dist/esm/groupview/groupPanel.js +0 -1
|
@@ -1,397 +1,423 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
|
|
3
|
-
* https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Orientation, Sizing, } from '../splitview/core/splitview';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
export
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.root
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const [
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const [
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
if (
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
|
|
3
|
+
* https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Orientation, Sizing, } from '../splitview/core/splitview';
|
|
6
|
+
import { tail } from '../array';
|
|
7
|
+
import { LeafNode } from './leafNode';
|
|
8
|
+
import { BranchNode } from './branchNode';
|
|
9
|
+
import { Emitter } from '../events';
|
|
10
|
+
import { MutableDisposable } from '../lifecycle';
|
|
11
|
+
function findLeaf(candiateNode, last) {
|
|
12
|
+
if (candiateNode instanceof LeafNode) {
|
|
13
|
+
return candiateNode;
|
|
14
|
+
}
|
|
15
|
+
if (candiateNode instanceof BranchNode) {
|
|
16
|
+
return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);
|
|
17
|
+
}
|
|
18
|
+
throw new Error('invalid node');
|
|
19
|
+
}
|
|
20
|
+
function flipNode(node, size, orthogonalSize) {
|
|
21
|
+
if (node instanceof BranchNode) {
|
|
22
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
23
|
+
let totalSize = 0;
|
|
24
|
+
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
25
|
+
const child = node.children[i];
|
|
26
|
+
const childSize = child instanceof BranchNode ? child.orthogonalSize : child.size;
|
|
27
|
+
let newSize = node.size === 0
|
|
28
|
+
? 0
|
|
29
|
+
: Math.round((size * childSize) / node.size);
|
|
30
|
+
totalSize += newSize;
|
|
31
|
+
// The last view to add should adjust to rounding errors
|
|
32
|
+
if (i === 0) {
|
|
33
|
+
newSize += size - totalSize;
|
|
34
|
+
}
|
|
35
|
+
result.addChild(flipNode(child, orthogonalSize, newSize), newSize, 0, true);
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return new LeafNode(node.view, orthogonal(node.orientation), orthogonalSize);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function indexInParent(element) {
|
|
44
|
+
const parentElement = element.parentElement;
|
|
45
|
+
if (!parentElement) {
|
|
46
|
+
throw new Error('Invalid grid element');
|
|
47
|
+
}
|
|
48
|
+
let el = parentElement.firstElementChild;
|
|
49
|
+
let index = 0;
|
|
50
|
+
while (el !== element && el !== parentElement.lastElementChild && el) {
|
|
51
|
+
el = el.nextElementSibling;
|
|
52
|
+
index++;
|
|
53
|
+
}
|
|
54
|
+
return index;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Find the grid location of a specific DOM element by traversing the parent
|
|
58
|
+
* chain and finding each child index on the way.
|
|
59
|
+
*
|
|
60
|
+
* This will break as soon as DOM structures of the Splitview or Gridview change.
|
|
61
|
+
*/
|
|
62
|
+
export function getGridLocation(element) {
|
|
63
|
+
const parentElement = element.parentElement;
|
|
64
|
+
if (!parentElement) {
|
|
65
|
+
throw new Error('Invalid grid element');
|
|
66
|
+
}
|
|
67
|
+
if (/\bgrid-view\b/.test(parentElement.className)) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
const index = indexInParent(parentElement);
|
|
71
|
+
const ancestor = parentElement.parentElement.parentElement.parentElement;
|
|
72
|
+
return [...getGridLocation(ancestor), index];
|
|
73
|
+
}
|
|
74
|
+
export function getRelativeLocation(rootOrientation, location, direction) {
|
|
75
|
+
const orientation = getLocationOrientation(rootOrientation, location);
|
|
76
|
+
const directionOrientation = getDirectionOrientation(direction);
|
|
77
|
+
if (orientation === directionOrientation) {
|
|
78
|
+
const [rest, _index] = tail(location);
|
|
79
|
+
let index = _index;
|
|
80
|
+
if (direction === 'right' || direction === 'bottom') {
|
|
81
|
+
index += 1;
|
|
82
|
+
}
|
|
83
|
+
return [...rest, index];
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const index = direction === 'right' || direction === 'bottom' ? 1 : 0;
|
|
87
|
+
return [...location, index];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export function getDirectionOrientation(direction) {
|
|
91
|
+
return direction === 'top' || direction === 'bottom'
|
|
92
|
+
? Orientation.VERTICAL
|
|
93
|
+
: Orientation.HORIZONTAL;
|
|
94
|
+
}
|
|
95
|
+
export function getLocationOrientation(rootOrientation, location) {
|
|
96
|
+
return location.length % 2 === 0
|
|
97
|
+
? orthogonal(rootOrientation)
|
|
98
|
+
: rootOrientation;
|
|
99
|
+
}
|
|
100
|
+
export const orthogonal = (orientation) => orientation === Orientation.HORIZONTAL
|
|
101
|
+
? Orientation.VERTICAL
|
|
102
|
+
: Orientation.HORIZONTAL;
|
|
103
|
+
export function isGridBranchNode(node) {
|
|
104
|
+
return !!node.children;
|
|
105
|
+
}
|
|
106
|
+
const serializeBranchNode = (node, orientation) => {
|
|
107
|
+
const size = orientation === Orientation.VERTICAL ? node.box.width : node.box.height;
|
|
108
|
+
if (!isGridBranchNode(node)) {
|
|
109
|
+
if (typeof node.cachedVisibleSize === 'number') {
|
|
110
|
+
return {
|
|
111
|
+
type: 'leaf',
|
|
112
|
+
data: node.view.toJSON(),
|
|
113
|
+
size: node.cachedVisibleSize,
|
|
114
|
+
visible: false,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return { type: 'leaf', data: node.view.toJSON(), size };
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
type: 'branch',
|
|
121
|
+
data: node.children.map((c) => serializeBranchNode(c, orthogonal(orientation))),
|
|
122
|
+
size,
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
export class Gridview {
|
|
126
|
+
get length() {
|
|
127
|
+
return this._root ? this._root.children.length : 0;
|
|
128
|
+
}
|
|
129
|
+
serialize() {
|
|
130
|
+
const root = serializeBranchNode(this.getView(), this.orientation);
|
|
131
|
+
return {
|
|
132
|
+
root,
|
|
133
|
+
width: this.width,
|
|
134
|
+
height: this.height,
|
|
135
|
+
orientation: this.orientation,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
dispose() {
|
|
139
|
+
this.disposable.dispose();
|
|
140
|
+
this._onDidChange.dispose();
|
|
141
|
+
this.root.dispose();
|
|
142
|
+
this.element.remove();
|
|
143
|
+
}
|
|
144
|
+
clear() {
|
|
145
|
+
const orientation = this.root.orientation;
|
|
146
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize);
|
|
147
|
+
}
|
|
148
|
+
deserialize(json, deserializer) {
|
|
149
|
+
const orientation = json.orientation;
|
|
150
|
+
const height = orientation === Orientation.VERTICAL ? json.height : json.width;
|
|
151
|
+
this._deserialize(json.root, orientation, deserializer, height);
|
|
152
|
+
}
|
|
153
|
+
_deserialize(root, orientation, deserializer, orthogonalSize) {
|
|
154
|
+
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize, true);
|
|
155
|
+
}
|
|
156
|
+
_deserializeNode(node, orientation, deserializer, orthogonalSize, isRoot = false) {
|
|
157
|
+
let result;
|
|
158
|
+
if (node.type === 'branch') {
|
|
159
|
+
const serializedChildren = node.data;
|
|
160
|
+
const children = serializedChildren.map((serializedChild) => {
|
|
161
|
+
return {
|
|
162
|
+
node: this._deserializeNode(serializedChild, orthogonal(orientation), deserializer, node.size),
|
|
163
|
+
visible: serializedChild.visible,
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
// HORIZONTAL => height=orthogonalsize width=size
|
|
167
|
+
// VERTICAL => height=size width=orthogonalsize
|
|
168
|
+
result = new BranchNode(orientation, this.proportionalLayout, this.styles, isRoot ? orthogonalSize : node.size, isRoot ? node.size : orthogonalSize, children);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
get orientation() {
|
|
176
|
+
return this.root.orientation;
|
|
177
|
+
}
|
|
178
|
+
set orientation(orientation) {
|
|
179
|
+
if (this.root.orientation === orientation) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const { size, orthogonalSize } = this.root;
|
|
183
|
+
this.root = flipNode(this.root, orthogonalSize, size);
|
|
184
|
+
this.root.layout(size, orthogonalSize);
|
|
185
|
+
}
|
|
186
|
+
get root() {
|
|
187
|
+
return this._root;
|
|
188
|
+
}
|
|
189
|
+
set root(root) {
|
|
190
|
+
const oldRoot = this._root;
|
|
191
|
+
if (oldRoot) {
|
|
192
|
+
oldRoot.dispose();
|
|
193
|
+
this.element.removeChild(oldRoot.element);
|
|
194
|
+
}
|
|
195
|
+
this._root = root;
|
|
196
|
+
this.element.appendChild(this._root.element);
|
|
197
|
+
this.disposable.value = this._root.onDidChange((e) => {
|
|
198
|
+
this._onDidChange.fire(e);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* If the root is orientated as a VERTICAL node then nest the existing root within a new HORIZIONTAL root node
|
|
203
|
+
* If the root is orientated as a HORIZONTAL node then nest the existing root within a new VERITCAL root node
|
|
204
|
+
*/
|
|
205
|
+
insertOrthogonalSplitviewAtRoot() {
|
|
206
|
+
if (!this._root) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const oldRoot = this.root;
|
|
210
|
+
oldRoot.element.remove();
|
|
211
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size);
|
|
212
|
+
if (oldRoot.children.length === 1) {
|
|
213
|
+
// can remove one level of redundant branching if there is only a single child
|
|
214
|
+
const childReference = oldRoot.children[0];
|
|
215
|
+
oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
216
|
+
oldRoot.dispose();
|
|
217
|
+
this._root.addChild(childReference, Sizing.Distribute, 0);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
this._root.addChild(oldRoot, Sizing.Distribute, 0);
|
|
221
|
+
}
|
|
222
|
+
this.element.appendChild(this._root.element);
|
|
223
|
+
this.disposable.value = this._root.onDidChange((e) => {
|
|
224
|
+
this._onDidChange.fire(e);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
next(location) {
|
|
228
|
+
return this.progmaticSelect(location);
|
|
229
|
+
}
|
|
230
|
+
previous(location) {
|
|
231
|
+
return this.progmaticSelect(location, true);
|
|
232
|
+
}
|
|
233
|
+
getView(location) {
|
|
234
|
+
const node = location ? this.getNode(location)[1] : this.root;
|
|
235
|
+
return this._getViews(node, this.orientation);
|
|
236
|
+
}
|
|
237
|
+
_getViews(node, orientation, cachedVisibleSize) {
|
|
238
|
+
const box = { height: node.height, width: node.width };
|
|
239
|
+
if (node instanceof LeafNode) {
|
|
240
|
+
return { box, view: node.view, cachedVisibleSize };
|
|
241
|
+
}
|
|
242
|
+
const children = [];
|
|
243
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
244
|
+
const child = node.children[i];
|
|
245
|
+
const nodeCachedVisibleSize = node.getChildCachedVisibleSize(i);
|
|
246
|
+
children.push(this._getViews(child, orthogonal(orientation), nodeCachedVisibleSize));
|
|
247
|
+
}
|
|
248
|
+
return { box, children };
|
|
249
|
+
}
|
|
250
|
+
progmaticSelect(location, reverse = false) {
|
|
251
|
+
const [path, node] = this.getNode(location);
|
|
252
|
+
if (!(node instanceof LeafNode)) {
|
|
253
|
+
throw new Error('invalid location');
|
|
254
|
+
}
|
|
255
|
+
for (let i = path.length - 1; i > -1; i--) {
|
|
256
|
+
const n = path[i];
|
|
257
|
+
const l = location[i] || 0;
|
|
258
|
+
const canProgressInCurrentLevel = reverse
|
|
259
|
+
? l - 1 > -1
|
|
260
|
+
: l + 1 < n.children.length;
|
|
261
|
+
if (canProgressInCurrentLevel) {
|
|
262
|
+
return findLeaf(n.children[reverse ? l - 1 : l + 1], reverse);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return findLeaf(this.root, reverse);
|
|
266
|
+
}
|
|
267
|
+
get width() {
|
|
268
|
+
return this.root.width;
|
|
269
|
+
}
|
|
270
|
+
get height() {
|
|
271
|
+
return this.root.height;
|
|
272
|
+
}
|
|
273
|
+
get minimumWidth() {
|
|
274
|
+
return this.root.minimumWidth;
|
|
275
|
+
}
|
|
276
|
+
get minimumHeight() {
|
|
277
|
+
return this.root.minimumHeight;
|
|
278
|
+
}
|
|
279
|
+
get maximumWidth() {
|
|
280
|
+
return this.root.maximumHeight;
|
|
281
|
+
}
|
|
282
|
+
get maximumHeight() {
|
|
283
|
+
return this.root.maximumHeight;
|
|
284
|
+
}
|
|
285
|
+
constructor(proportionalLayout, styles, orientation) {
|
|
286
|
+
this.proportionalLayout = proportionalLayout;
|
|
287
|
+
this.styles = styles;
|
|
288
|
+
this.disposable = new MutableDisposable();
|
|
289
|
+
this._onDidChange = new Emitter();
|
|
290
|
+
this.onDidChange = this._onDidChange.event;
|
|
291
|
+
this.element = document.createElement('div');
|
|
292
|
+
this.element.className = 'grid-view';
|
|
293
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0);
|
|
294
|
+
}
|
|
295
|
+
isViewVisible(location) {
|
|
296
|
+
const [rest, index] = tail(location);
|
|
297
|
+
const [, parent] = this.getNode(rest);
|
|
298
|
+
if (!(parent instanceof BranchNode)) {
|
|
299
|
+
throw new Error('Invalid from location');
|
|
300
|
+
}
|
|
301
|
+
return parent.isChildVisible(index);
|
|
302
|
+
}
|
|
303
|
+
setViewVisible(location, visible) {
|
|
304
|
+
const [rest, index] = tail(location);
|
|
305
|
+
const [, parent] = this.getNode(rest);
|
|
306
|
+
if (!(parent instanceof BranchNode)) {
|
|
307
|
+
throw new Error('Invalid from location');
|
|
308
|
+
}
|
|
309
|
+
parent.setChildVisible(index, visible);
|
|
310
|
+
}
|
|
311
|
+
moveView(parentLocation, from, to) {
|
|
312
|
+
const [, parent] = this.getNode(parentLocation);
|
|
313
|
+
if (!(parent instanceof BranchNode)) {
|
|
314
|
+
throw new Error('Invalid location');
|
|
315
|
+
}
|
|
316
|
+
parent.moveChild(from, to);
|
|
317
|
+
}
|
|
318
|
+
addView(view, size, location) {
|
|
319
|
+
const [rest, index] = tail(location);
|
|
320
|
+
const [pathToParent, parent] = this.getNode(rest);
|
|
321
|
+
if (parent instanceof BranchNode) {
|
|
322
|
+
const node = new LeafNode(view, orthogonal(parent.orientation), parent.orthogonalSize);
|
|
323
|
+
parent.addChild(node, size, index);
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
327
|
+
const [parentIndex, ...__] = [...rest].reverse();
|
|
328
|
+
let newSiblingSize = 0;
|
|
329
|
+
const newSiblingCachedVisibleSize = grandParent.getChildCachedVisibleSize(parentIndex);
|
|
330
|
+
if (typeof newSiblingCachedVisibleSize === 'number') {
|
|
331
|
+
newSiblingSize = Sizing.Invisible(newSiblingCachedVisibleSize);
|
|
332
|
+
}
|
|
333
|
+
grandParent.removeChild(parentIndex);
|
|
334
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
335
|
+
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
336
|
+
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
337
|
+
newParent.addChild(newSibling, newSiblingSize, 0);
|
|
338
|
+
if (typeof size !== 'number' && size.type === 'split') {
|
|
339
|
+
size = { type: 'split', index: 0 };
|
|
340
|
+
}
|
|
341
|
+
const node = new LeafNode(view, grandParent.orientation, parent.size);
|
|
342
|
+
newParent.addChild(node, size, index);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
remove(view, sizing) {
|
|
346
|
+
const location = getGridLocation(view.element);
|
|
347
|
+
return this.removeView(location, sizing);
|
|
348
|
+
}
|
|
349
|
+
removeView(location, sizing) {
|
|
350
|
+
const [rest, index] = tail(location);
|
|
351
|
+
const [pathToParent, parent] = this.getNode(rest);
|
|
352
|
+
if (!(parent instanceof BranchNode)) {
|
|
353
|
+
throw new Error('Invalid location');
|
|
354
|
+
}
|
|
355
|
+
const node = parent.children[index];
|
|
356
|
+
if (!(node instanceof LeafNode)) {
|
|
357
|
+
throw new Error('Invalid location');
|
|
358
|
+
}
|
|
359
|
+
parent.removeChild(index, sizing);
|
|
360
|
+
if (parent.children.length === 0) {
|
|
361
|
+
return node.view;
|
|
362
|
+
}
|
|
363
|
+
if (parent.children.length > 1) {
|
|
364
|
+
return node.view;
|
|
365
|
+
}
|
|
366
|
+
const sibling = parent.children[0];
|
|
367
|
+
if (pathToParent.length === 0) {
|
|
368
|
+
// parent is root
|
|
369
|
+
if (sibling instanceof LeafNode) {
|
|
370
|
+
return node.view;
|
|
371
|
+
}
|
|
372
|
+
// we must promote sibling to be the new root
|
|
373
|
+
parent.removeChild(0, sizing);
|
|
374
|
+
this.root = sibling;
|
|
375
|
+
return node.view;
|
|
376
|
+
}
|
|
377
|
+
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
378
|
+
const [parentIndex, ...__] = [...rest].reverse();
|
|
379
|
+
const isSiblingVisible = parent.isChildVisible(0);
|
|
380
|
+
parent.removeChild(0, sizing);
|
|
381
|
+
const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
|
|
382
|
+
grandParent.removeChild(parentIndex, sizing);
|
|
383
|
+
if (sibling instanceof BranchNode) {
|
|
384
|
+
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
385
|
+
for (let i = 0; i < sibling.children.length; i++) {
|
|
386
|
+
const child = sibling.children[i];
|
|
387
|
+
grandParent.addChild(child, child.size, parentIndex + i);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
const newSibling = new LeafNode(sibling.view, orthogonal(sibling.orientation), sibling.size);
|
|
392
|
+
const siblingSizing = isSiblingVisible
|
|
393
|
+
? sibling.orthogonalSize
|
|
394
|
+
: Sizing.Invisible(sibling.orthogonalSize);
|
|
395
|
+
grandParent.addChild(newSibling, siblingSizing, parentIndex);
|
|
396
|
+
}
|
|
397
|
+
for (let i = 0; i < sizes.length; i++) {
|
|
398
|
+
grandParent.resizeChild(i, sizes[i]);
|
|
399
|
+
}
|
|
400
|
+
return node.view;
|
|
401
|
+
}
|
|
402
|
+
layout(width, height) {
|
|
403
|
+
const [size, orthogonalSize] = this.root.orientation === Orientation.HORIZONTAL
|
|
404
|
+
? [height, width]
|
|
405
|
+
: [width, height];
|
|
406
|
+
this.root.layout(size, orthogonalSize);
|
|
407
|
+
}
|
|
408
|
+
getNode(location, node = this.root, path = []) {
|
|
409
|
+
if (location.length === 0) {
|
|
410
|
+
return [path, node];
|
|
411
|
+
}
|
|
412
|
+
if (!(node instanceof BranchNode)) {
|
|
413
|
+
throw new Error('Invalid location');
|
|
414
|
+
}
|
|
415
|
+
const [index, ...rest] = location;
|
|
416
|
+
if (index < 0 || index >= node.children.length) {
|
|
417
|
+
throw new Error('Invalid location');
|
|
418
|
+
}
|
|
419
|
+
const child = node.children[index];
|
|
420
|
+
path.push(node);
|
|
421
|
+
return this.getNode(rest, child, path);
|
|
422
|
+
}
|
|
423
|
+
}
|