dockview-core 7.0.3 → 8.0.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/LICENCE.md +21 -0
- package/README.md +17 -86
- package/dist/cjs/api/component.api.d.ts +100 -9
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +45 -1
- package/dist/cjs/api/dockviewPanelApi.d.ts +21 -0
- package/dist/cjs/dismissableLayer.d.ts +57 -0
- package/dist/cjs/dnd/backend.d.ts +2 -2
- package/dist/cjs/dnd/dropTargetAnchorContainer.d.ts +12 -0
- package/dist/cjs/dnd/droptarget.d.ts +94 -0
- package/dist/cjs/dnd/ghost.d.ts +1 -0
- package/dist/cjs/dnd/pointer/longPress.d.ts +2 -2
- package/dist/cjs/dnd/pointer/pointerDragController.d.ts +5 -2
- package/dist/cjs/dnd/pointer/pointerDragSource.d.ts +1 -1
- package/dist/cjs/dnd/pointer/pointerDropTarget.d.ts +30 -1
- package/dist/cjs/dnd/pointer/pointerGhost.d.ts +1 -1
- package/dist/cjs/dockview/accessibilityMessages.d.ts +6 -0
- package/dist/cjs/dockview/advancedDnDService.d.ts +46 -0
- package/dist/cjs/dockview/components/panel/content.d.ts +1 -1
- package/dist/cjs/dockview/components/tab/defaultTab.d.ts +2 -0
- package/dist/cjs/dockview/components/tab/tab.d.ts +2 -0
- package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +2 -2
- package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +1 -1
- package/dist/cjs/dockview/components/titlebar/tabGroupChip.d.ts +1 -1
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +73 -2
- package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +1 -1
- package/dist/cjs/dockview/components/titlebar/tabReorderController.d.ts +295 -0
- package/dist/cjs/dockview/components/titlebar/tabs.d.ts +120 -50
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +48 -0
- package/dist/cjs/dockview/dndCapabilities.d.ts +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +303 -19
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +5 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +52 -2
- package/dist/cjs/dockview/dockviewPanel.d.ts +12 -0
- package/dist/cjs/dockview/dockviewShell.d.ts +48 -24
- package/dist/cjs/dockview/edgeGroupService.d.ts +20 -0
- package/dist/cjs/dockview/events.d.ts +6 -0
- package/dist/cjs/dockview/liveRegionService.d.ts +18 -5
- package/dist/cjs/dockview/moduleContracts.d.ts +480 -14
- package/dist/cjs/dockview/modules.d.ts +101 -22
- package/dist/cjs/dockview/options.d.ts +337 -30
- package/dist/cjs/dockview/optionsModules.d.ts +73 -0
- package/dist/cjs/dockview/popoutWindowService.d.ts +15 -10
- package/dist/cjs/dockview/rootDropTargetService.d.ts +11 -0
- package/dist/cjs/dockview/tabGroupAccent.d.ts +1 -1
- package/dist/cjs/dockview/tabGroupChipsService.d.ts +10 -0
- package/dist/cjs/dockview/theme.d.ts +2 -2
- package/dist/cjs/dockview/types.d.ts +3 -0
- package/dist/cjs/dom.d.ts +9 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +2 -2
- package/dist/cjs/gridview/gridview.d.ts +2 -0
- package/dist/cjs/index.d.ts +35 -29
- package/dist/cjs/lifecycle.d.ts +1 -0
- package/dist/cjs/overlay/overlay.d.ts +4 -2
- package/dist/cjs/overlay/overlayRenderContainer.d.ts +8 -0
- package/dist/cjs/paneview/paneview.d.ts +2 -1
- package/dist/cjs/paneview/paneviewComponent.d.ts +3 -0
- package/dist/cjs/paneview/paneviewPanel.d.ts +5 -0
- package/dist/cjs/svg.d.ts +1 -0
- package/dist/cjs/types.d.ts +8 -0
- package/dist/dockview-core.js +18391 -19679
- package/dist/dockview-core.min.js +4138 -6
- package/dist/dockview-core.min.noStyle.js +6 -7
- package/dist/dockview-core.noStyle.js +18390 -19656
- package/dist/package/main.cjs.js +18002 -19268
- package/dist/package/main.cjs.min.js +6 -6
- package/dist/package/main.esm.min.mjs +6 -6
- package/dist/package/main.esm.mjs +17959 -19260
- package/package.json +81 -77
- package/dist/cjs/api/component.api.js +0 -1242
- package/dist/cjs/api/dockviewGroupPanelApi.js +0 -200
- package/dist/cjs/api/dockviewPanelApi.js +0 -172
- package/dist/cjs/api/entryPoints.js +0 -27
- package/dist/cjs/api/gridviewPanelApi.js +0 -45
- package/dist/cjs/api/panelApi.js +0 -133
- package/dist/cjs/api/paneviewPanelApi.js +0 -57
- package/dist/cjs/api/splitviewPanelApi.js +0 -47
- package/dist/cjs/array.js +0 -66
- package/dist/cjs/constants.js +0 -11
- package/dist/cjs/dnd/backend.js +0 -171
- package/dist/cjs/dnd/dataTransfer.js +0 -100
- package/dist/cjs/dnd/dnd.js +0 -74
- package/dist/cjs/dnd/dropOverlay.js +0 -197
- package/dist/cjs/dnd/dropTargetAnchorContainer.js +0 -104
- package/dist/cjs/dnd/droptarget.js +0 -362
- package/dist/cjs/dnd/ghost.js +0 -17
- package/dist/cjs/dnd/pointer/index.js +0 -13
- package/dist/cjs/dnd/pointer/longPress.js +0 -151
- package/dist/cjs/dnd/pointer/pointerDragController.js +0 -243
- package/dist/cjs/dnd/pointer/pointerDragSource.js +0 -197
- package/dist/cjs/dnd/pointer/pointerDropTarget.js +0 -198
- package/dist/cjs/dnd/pointer/pointerGhost.js +0 -44
- package/dist/cjs/dnd/pointer/types.js +0 -2
- package/dist/cjs/dockview/accessibilityMessages.js +0 -51
- package/dist/cjs/dockview/allModules.js +0 -25
- package/dist/cjs/dockview/components/panel/content.js +0 -213
- package/dist/cjs/dockview/components/popupService.js +0 -132
- package/dist/cjs/dockview/components/tab/defaultTab.js +0 -70
- package/dist/cjs/dockview/components/tab/tab.js +0 -281
- package/dist/cjs/dockview/components/titlebar/floatingTitleBar.js +0 -95
- package/dist/cjs/dockview/components/titlebar/groupDragSource.js +0 -218
- package/dist/cjs/dockview/components/titlebar/tabGroupChip.js +0 -104
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +0 -477
- package/dist/cjs/dockview/components/titlebar/tabGroups.js +0 -854
- package/dist/cjs/dockview/components/titlebar/tabOverflowControl.js +0 -19
- package/dist/cjs/dockview/components/titlebar/tabs.js +0 -2016
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +0 -458
- package/dist/cjs/dockview/components/titlebar/voidContainer.js +0 -120
- package/dist/cjs/dockview/components/watermark/watermark.js +0 -40
- package/dist/cjs/dockview/deserializer.js +0 -39
- package/dist/cjs/dockview/dndCapabilities.js +0 -39
- package/dist/cjs/dockview/dockviewComponent.js +0 -3896
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +0 -70
- package/dist/cjs/dockview/dockviewGroupPanel.js +0 -204
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +0 -1514
- package/dist/cjs/dockview/dockviewPanel.js +0 -265
- package/dist/cjs/dockview/dockviewPanelModel.js +0 -105
- package/dist/cjs/dockview/dockviewShell.js +0 -744
- package/dist/cjs/dockview/edgeGroupService.js +0 -128
- package/dist/cjs/dockview/events.js +0 -67
- package/dist/cjs/dockview/floatingGroupService.js +0 -231
- package/dist/cjs/dockview/framework.js +0 -2
- package/dist/cjs/dockview/headerActionsService.js +0 -149
- package/dist/cjs/dockview/liveRegionService.js +0 -185
- package/dist/cjs/dockview/moduleContracts.js +0 -2
- package/dist/cjs/dockview/modules.js +0 -304
- package/dist/cjs/dockview/options.js +0 -103
- package/dist/cjs/dockview/popoutWindowService.js +0 -261
- package/dist/cjs/dockview/rootDropTargetService.js +0 -87
- package/dist/cjs/dockview/strictEventsSequencing.js +0 -63
- package/dist/cjs/dockview/tabGroup.js +0 -219
- package/dist/cjs/dockview/tabGroupAccent.js +0 -126
- package/dist/cjs/dockview/theme.js +0 -139
- package/dist/cjs/dockview/types.js +0 -2
- package/dist/cjs/dockview/validate.js +0 -76
- package/dist/cjs/dockview/watermarkService.js +0 -61
- package/dist/cjs/dom.js +0 -543
- package/dist/cjs/events.js +0 -296
- package/dist/cjs/framwork.js +0 -2
- package/dist/cjs/gridview/baseComponentGridview.js +0 -330
- package/dist/cjs/gridview/basePanelView.js +0 -162
- package/dist/cjs/gridview/branchNode.js +0 -372
- package/dist/cjs/gridview/gridview.js +0 -776
- package/dist/cjs/gridview/gridviewComponent.js +0 -363
- package/dist/cjs/gridview/gridviewPanel.js +0 -249
- package/dist/cjs/gridview/leafNode.js +0 -169
- package/dist/cjs/gridview/options.js +0 -17
- package/dist/cjs/gridview/types.js +0 -2
- package/dist/cjs/index.js +0 -105
- package/dist/cjs/lifecycle.js +0 -80
- package/dist/cjs/math.js +0 -38
- package/dist/cjs/overlay/overlay.js +0 -602
- package/dist/cjs/overlay/overlayRenderContainer.js +0 -309
- package/dist/cjs/panel/types.js +0 -2
- package/dist/cjs/paneview/defaultPaneviewHeader.js +0 -92
- package/dist/cjs/paneview/draggablePaneviewPanel.js +0 -141
- package/dist/cjs/paneview/options.js +0 -44
- package/dist/cjs/paneview/paneview.js +0 -203
- package/dist/cjs/paneview/paneviewComponent.js +0 -430
- package/dist/cjs/paneview/paneviewPanel.js +0 -275
- package/dist/cjs/popoutWindow.js +0 -244
- package/dist/cjs/resizable.js +0 -97
- package/dist/cjs/scrollbar.js +0 -169
- package/dist/cjs/splitview/options.js +0 -19
- package/dist/cjs/splitview/splitview.js +0 -999
- package/dist/cjs/splitview/splitviewComponent.js +0 -401
- package/dist/cjs/splitview/splitviewPanel.js +0 -179
- package/dist/cjs/splitview/viewItem.js +0 -119
- package/dist/cjs/svg.js +0 -43
- package/dist/cjs/types.js +0 -2
- package/dist/dockview-core.min.js.map +0 -1
- package/dist/dockview-core.min.noStyle.js.map +0 -1
- package/dist/esm/api/component.api.d.ts +0 -640
- package/dist/esm/api/component.api.js +0 -887
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +0 -109
- package/dist/esm/api/dockviewGroupPanelApi.js +0 -155
- package/dist/esm/api/dockviewPanelApi.d.ts +0 -84
- package/dist/esm/api/dockviewPanelApi.js +0 -124
- package/dist/esm/api/entryPoints.d.ts +0 -9
- package/dist/esm/api/entryPoints.js +0 -21
- package/dist/esm/api/gridviewPanelApi.d.ts +0 -37
- package/dist/esm/api/gridviewPanelApi.js +0 -23
- package/dist/esm/api/panelApi.d.ts +0 -100
- package/dist/esm/api/panelApi.js +0 -87
- package/dist/esm/api/paneviewPanelApi.d.ts +0 -26
- package/dist/esm/api/paneviewPanelApi.js +0 -27
- package/dist/esm/api/splitviewPanelApi.d.ts +0 -32
- package/dist/esm/api/splitviewPanelApi.js +0 -25
- package/dist/esm/array.d.ts +0 -13
- package/dist/esm/array.js +0 -57
- package/dist/esm/constants.d.ts +0 -8
- package/dist/esm/constants.js +0 -8
- package/dist/esm/dnd/backend.d.ts +0 -70
- package/dist/esm/dnd/backend.js +0 -148
- package/dist/esm/dnd/dataTransfer.d.ts +0 -31
- package/dist/esm/dnd/dataTransfer.js +0 -67
- package/dist/esm/dnd/dnd.d.ts +0 -32
- package/dist/esm/dnd/dnd.js +0 -51
- package/dist/esm/dnd/dropOverlay.d.ts +0 -20
- package/dist/esm/dnd/dropOverlay.js +0 -192
- package/dist/esm/dnd/dropTargetAnchorContainer.d.ts +0 -16
- package/dist/esm/dnd/dropTargetAnchorContainer.js +0 -73
- package/dist/esm/dnd/droptarget.d.ts +0 -116
- package/dist/esm/dnd/droptarget.js +0 -316
- package/dist/esm/dnd/ghost.d.ts +0 -4
- package/dist/esm/dnd/ghost.js +0 -14
- package/dist/esm/dnd/pointer/index.d.ts +0 -11
- package/dist/esm/dnd/pointer/index.js +0 -5
- package/dist/esm/dnd/pointer/longPress.d.ts +0 -32
- package/dist/esm/dnd/pointer/longPress.js +0 -127
- package/dist/esm/dnd/pointer/pointerDragController.d.ts +0 -60
- package/dist/esm/dnd/pointer/pointerDragController.js +0 -193
- package/dist/esm/dnd/pointer/pointerDragSource.d.ts +0 -61
- package/dist/esm/dnd/pointer/pointerDragSource.js +0 -173
- package/dist/esm/dnd/pointer/pointerDropTarget.d.ts +0 -39
- package/dist/esm/dnd/pointer/pointerDropTarget.js +0 -168
- package/dist/esm/dnd/pointer/pointerGhost.d.ts +0 -30
- package/dist/esm/dnd/pointer/pointerGhost.js +0 -39
- package/dist/esm/dnd/pointer/types.d.ts +0 -16
- package/dist/esm/dnd/pointer/types.js +0 -1
- package/dist/esm/dockview/accessibilityMessages.d.ts +0 -32
- package/dist/esm/dockview/accessibilityMessages.js +0 -30
- package/dist/esm/dockview/allModules.d.ts +0 -8
- package/dist/esm/dockview/allModules.js +0 -22
- package/dist/esm/dockview/components/panel/content.d.ts +0 -54
- package/dist/esm/dockview/components/panel/content.js +0 -185
- package/dist/esm/dockview/components/popupService.d.ts +0 -21
- package/dist/esm/dockview/components/popupService.js +0 -108
- package/dist/esm/dockview/components/tab/defaultTab.d.ts +0 -12
- package/dist/esm/dockview/components/tab/defaultTab.js +0 -43
- package/dist/esm/dockview/components/tab/tab.d.ts +0 -44
- package/dist/esm/dockview/components/tab/tab.js +0 -242
- package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +0 -34
- package/dist/esm/dockview/components/titlebar/floatingTitleBar.js +0 -65
- package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +0 -51
- package/dist/esm/dockview/components/titlebar/groupDragSource.js +0 -178
- package/dist/esm/dockview/components/titlebar/tabGroupChip.d.ts +0 -37
- package/dist/esm/dockview/components/titlebar/tabGroupChip.js +0 -77
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +0 -72
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +0 -360
- package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +0 -107
- package/dist/esm/dockview/components/titlebar/tabGroups.js +0 -621
- package/dist/esm/dockview/components/titlebar/tabOverflowControl.d.ts +0 -8
- package/dist/esm/dockview/components/titlebar/tabOverflowControl.js +0 -16
- package/dist/esm/dockview/components/titlebar/tabs.d.ts +0 -167
- package/dist/esm/dockview/components/titlebar/tabs.js +0 -1653
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +0 -104
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +0 -359
- package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +0 -21
- package/dist/esm/dockview/components/titlebar/voidContainer.js +0 -92
- package/dist/esm/dockview/components/watermark/watermark.d.ts +0 -8
- package/dist/esm/dockview/components/watermark/watermark.js +0 -14
- package/dist/esm/dockview/deserializer.d.ts +0 -12
- package/dist/esm/dockview/deserializer.js +0 -34
- package/dist/esm/dockview/dndCapabilities.d.ts +0 -19
- package/dist/esm/dockview/dndCapabilities.js +0 -36
- package/dist/esm/dockview/dockviewComponent.d.ts +0 -626
- package/dist/esm/dockview/dockviewComponent.js +0 -3214
- package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +0 -45
- package/dist/esm/dockview/dockviewFloatingGroupPanel.js +0 -44
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +0 -35
- package/dist/esm/dockview/dockviewGroupPanel.js +0 -142
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +0 -358
- package/dist/esm/dockview/dockviewGroupPanelModel.js +0 -1180
- package/dist/esm/dockview/dockviewPanel.d.ts +0 -69
- package/dist/esm/dockview/dockviewPanel.js +0 -178
- package/dist/esm/dockview/dockviewPanelModel.d.ts +0 -37
- package/dist/esm/dockview/dockviewPanelModel.js +0 -81
- package/dist/esm/dockview/dockviewShell.d.ts +0 -150
- package/dist/esm/dockview/dockviewShell.js +0 -678
- package/dist/esm/dockview/edgeGroupService.d.ts +0 -38
- package/dist/esm/dockview/edgeGroupService.js +0 -63
- package/dist/esm/dockview/events.d.ts +0 -38
- package/dist/esm/dockview/events.js +0 -34
- package/dist/esm/dockview/floatingGroupService.d.ts +0 -37
- package/dist/esm/dockview/floatingGroupService.js +0 -150
- package/dist/esm/dockview/framework.d.ts +0 -65
- package/dist/esm/dockview/framework.js +0 -1
- package/dist/esm/dockview/headerActionsService.d.ts +0 -32
- package/dist/esm/dockview/headerActionsService.js +0 -86
- package/dist/esm/dockview/liveRegionService.d.ts +0 -53
- package/dist/esm/dockview/liveRegionService.js +0 -159
- package/dist/esm/dockview/moduleContracts.d.ts +0 -119
- package/dist/esm/dockview/moduleContracts.js +0 -1
- package/dist/esm/dockview/modules.d.ts +0 -110
- package/dist/esm/dockview/modules.js +0 -170
- package/dist/esm/dockview/options.d.ts +0 -474
- package/dist/esm/dockview/options.js +0 -77
- package/dist/esm/dockview/popoutWindowService.d.ts +0 -95
- package/dist/esm/dockview/popoutWindowService.js +0 -175
- package/dist/esm/dockview/rootDropTargetService.d.ts +0 -35
- package/dist/esm/dockview/rootDropTargetService.js +0 -82
- package/dist/esm/dockview/strictEventsSequencing.d.ts +0 -7
- package/dist/esm/dockview/strictEventsSequencing.js +0 -41
- package/dist/esm/dockview/tabGroup.d.ts +0 -99
- package/dist/esm/dockview/tabGroup.js +0 -144
- package/dist/esm/dockview/tabGroupAccent.d.ts +0 -65
- package/dist/esm/dockview/tabGroupAccent.js +0 -114
- package/dist/esm/dockview/theme.d.ts +0 -86
- package/dist/esm/dockview/theme.js +0 -136
- package/dist/esm/dockview/types.d.ts +0 -53
- package/dist/esm/dockview/types.js +0 -1
- package/dist/esm/dockview/validate.d.ts +0 -0
- package/dist/esm/dockview/validate.js +0 -76
- package/dist/esm/dockview/watermarkService.d.ts +0 -30
- package/dist/esm/dockview/watermarkService.js +0 -56
- package/dist/esm/dom.d.ts +0 -60
- package/dist/esm/dom.js +0 -375
- package/dist/esm/events.d.ts +0 -79
- package/dist/esm/events.js +0 -219
- package/dist/esm/framwork.d.ts +0 -4
- package/dist/esm/framwork.js +0 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts +0 -111
- package/dist/esm/gridview/baseComponentGridview.js +0 -237
- package/dist/esm/gridview/basePanelView.d.ts +0 -40
- package/dist/esm/gridview/basePanelView.js +0 -91
- package/dist/esm/gridview/branchNode.d.ts +0 -57
- package/dist/esm/gridview/branchNode.js +0 -257
- package/dist/esm/gridview/gridview.d.ts +0 -158
- package/dist/esm/gridview/gridview.js +0 -681
- package/dist/esm/gridview/gridviewComponent.d.ts +0 -88
- package/dist/esm/gridview/gridviewComponent.js +0 -265
- package/dist/esm/gridview/gridviewPanel.d.ts +0 -77
- package/dist/esm/gridview/gridviewPanel.js +0 -182
- package/dist/esm/gridview/leafNode.d.ts +0 -34
- package/dist/esm/gridview/leafNode.js +0 -102
- package/dist/esm/gridview/options.d.ts +0 -15
- package/dist/esm/gridview/options.js +0 -14
- package/dist/esm/gridview/types.d.ts +0 -3
- package/dist/esm/gridview/types.js +0 -1
- package/dist/esm/index.d.ts +0 -58
- package/dist/esm/index.js +0 -44
- package/dist/esm/lifecycle.d.ts +0 -25
- package/dist/esm/lifecycle.js +0 -56
- package/dist/esm/math.d.ts +0 -5
- package/dist/esm/math.js +0 -32
- package/dist/esm/overlay/overlay.d.ts +0 -91
- package/dist/esm/overlay/overlay.js +0 -520
- package/dist/esm/overlay/overlayRenderContainer.d.ts +0 -24
- package/dist/esm/overlay/overlayRenderContainer.js +0 -249
- package/dist/esm/panel/types.d.ts +0 -33
- package/dist/esm/panel/types.js +0 -1
- package/dist/esm/paneview/defaultPaneviewHeader.d.ts +0 -21
- package/dist/esm/paneview/defaultPaneviewHeader.js +0 -65
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +0 -38
- package/dist/esm/paneview/draggablePaneviewPanel.js +0 -107
- package/dist/esm/paneview/options.d.ts +0 -30
- package/dist/esm/paneview/options.js +0 -22
- package/dist/esm/paneview/paneview.d.ts +0 -41
- package/dist/esm/paneview/paneview.js +0 -148
- package/dist/esm/paneview/paneviewComponent.d.ts +0 -133
- package/dist/esm/paneview/paneviewComponent.js +0 -306
- package/dist/esm/paneview/paneviewPanel.d.ts +0 -98
- package/dist/esm/paneview/paneviewPanel.js +0 -192
- package/dist/esm/popoutWindow.d.ts +0 -38
- package/dist/esm/popoutWindow.js +0 -170
- package/dist/esm/resizable.d.ts +0 -12
- package/dist/esm/resizable.js +0 -66
- package/dist/esm/scrollbar.d.ts +0 -15
- package/dist/esm/scrollbar.js +0 -139
- package/dist/esm/splitview/options.d.ts +0 -21
- package/dist/esm/splitview/options.js +0 -16
- package/dist/esm/splitview/splitview.d.ts +0 -145
- package/dist/esm/splitview/splitview.js +0 -770
- package/dist/esm/splitview/splitviewComponent.d.ts +0 -101
- package/dist/esm/splitview/splitviewComponent.js +0 -267
- package/dist/esm/splitview/splitviewPanel.d.ts +0 -45
- package/dist/esm/splitview/splitviewPanel.js +0 -108
- package/dist/esm/splitview/viewItem.d.ts +0 -25
- package/dist/esm/splitview/viewItem.js +0 -74
- package/dist/esm/svg.d.ts +0 -3
- package/dist/esm/svg.js +0 -31
- package/dist/esm/types.d.ts +0 -31
- package/dist/esm/types.js +0 -1
- package/dist/styles/dockview.css +0 -3436
|
@@ -1,2016 +0,0 @@
|
|
|
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 __values = (this && this.__values) || function(o) {
|
|
18
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
19
|
-
if (m) return m.call(o);
|
|
20
|
-
if (o && typeof o.length === "number") return {
|
|
21
|
-
next: function () {
|
|
22
|
-
if (o && i >= o.length) o = void 0;
|
|
23
|
-
return { value: o && o[i++], done: !o };
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
27
|
-
};
|
|
28
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
29
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
30
|
-
if (!m) return o;
|
|
31
|
-
var i = m.call(o), r, ar = [], e;
|
|
32
|
-
try {
|
|
33
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
34
|
-
}
|
|
35
|
-
catch (error) { e = { error: error }; }
|
|
36
|
-
finally {
|
|
37
|
-
try {
|
|
38
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
39
|
-
}
|
|
40
|
-
finally { if (e) throw e.error; }
|
|
41
|
-
}
|
|
42
|
-
return ar;
|
|
43
|
-
};
|
|
44
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
45
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
46
|
-
if (ar || !(i in from)) {
|
|
47
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
48
|
-
ar[i] = from[i];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.Tabs = void 0;
|
|
55
|
-
var dataTransfer_1 = require("../../../dnd/dataTransfer");
|
|
56
|
-
var dom_1 = require("../../../dom");
|
|
57
|
-
var events_1 = require("../../../events");
|
|
58
|
-
var lifecycle_1 = require("../../../lifecycle");
|
|
59
|
-
var scrollbar_1 = require("../../../scrollbar");
|
|
60
|
-
var pointerDragController_1 = require("../../../dnd/pointer/pointerDragController");
|
|
61
|
-
var events_2 = require("../../events");
|
|
62
|
-
var tab_1 = require("../tab/tab");
|
|
63
|
-
var tabGroups_1 = require("./tabGroups");
|
|
64
|
-
var Tabs = /** @class */ (function (_super) {
|
|
65
|
-
__extends(Tabs, _super);
|
|
66
|
-
function Tabs(group, accessor, options) {
|
|
67
|
-
var _this = _super.call(this) || this;
|
|
68
|
-
_this.group = group;
|
|
69
|
-
_this.accessor = accessor;
|
|
70
|
-
_this._observerDisposable = new lifecycle_1.MutableDisposable();
|
|
71
|
-
_this._scrollbar = null;
|
|
72
|
-
_this._tabs = [];
|
|
73
|
-
_this._tabMap = new Map();
|
|
74
|
-
_this.selectedIndex = -1;
|
|
75
|
-
_this._showTabsOverflowControl = false;
|
|
76
|
-
_this._direction = 'horizontal';
|
|
77
|
-
_this._animState = null;
|
|
78
|
-
_this._pendingMarginCleanups = new Map();
|
|
79
|
-
_this._pendingCollapse = false;
|
|
80
|
-
_this._flipTransitionCleanup = null;
|
|
81
|
-
_this._voidContainer = null;
|
|
82
|
-
_this._voidContainerListeners = null;
|
|
83
|
-
_this._extendedDropZone = null;
|
|
84
|
-
_this._pointerInsideTabsList = false;
|
|
85
|
-
_this._onTabDragStart = new events_1.Emitter();
|
|
86
|
-
_this.onTabDragStart = _this._onTabDragStart.event;
|
|
87
|
-
_this._onDrop = new events_1.Emitter();
|
|
88
|
-
_this.onDrop = _this._onDrop.event;
|
|
89
|
-
_this._onWillShowOverlay = new events_1.Emitter();
|
|
90
|
-
_this.onWillShowOverlay = _this._onWillShowOverlay.event;
|
|
91
|
-
_this._onOverflowTabsChange = new events_1.Emitter();
|
|
92
|
-
_this.onOverflowTabsChange = _this._onOverflowTabsChange.event;
|
|
93
|
-
_this._tabsList = document.createElement('div');
|
|
94
|
-
_this._tabsList.className = 'dv-tabs-container';
|
|
95
|
-
// WAI-ARIA Tabs pattern: the strip of tabs is the tablist.
|
|
96
|
-
_this._tabsList.setAttribute('role', 'tablist');
|
|
97
|
-
_this._tabsList.setAttribute('aria-orientation', _this._direction === 'vertical' ? 'vertical' : 'horizontal');
|
|
98
|
-
_this.showTabsOverflowControl = options.showTabsOverflowControl;
|
|
99
|
-
if (accessor.options.scrollbars === 'native') {
|
|
100
|
-
_this._element = _this._tabsList;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
_this._scrollbar = new scrollbar_1.Scrollbar(_this._tabsList);
|
|
104
|
-
_this._scrollbar.orientation = _this.direction;
|
|
105
|
-
_this._element = _this._scrollbar.element;
|
|
106
|
-
_this.addDisposables(_this._scrollbar);
|
|
107
|
-
}
|
|
108
|
-
_this._tabGroupManager = new tabGroups_1.TabGroupManager({
|
|
109
|
-
group: _this.group,
|
|
110
|
-
accessor: _this.accessor,
|
|
111
|
-
tabsList: _this._tabsList,
|
|
112
|
-
getTabs: function () { return _this._tabs; },
|
|
113
|
-
getTabMap: function () { return _this._tabMap; },
|
|
114
|
-
getDirection: function () { return _this._direction; },
|
|
115
|
-
}, {
|
|
116
|
-
onChipContextMenu: function (tabGroup, event) {
|
|
117
|
-
var _a;
|
|
118
|
-
(_a = _this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.showForChip(tabGroup, _this.group, event);
|
|
119
|
-
},
|
|
120
|
-
onChipDragStart: function (tabGroup, chip, event) {
|
|
121
|
-
_this._handleChipDragStart(tabGroup, chip, event);
|
|
122
|
-
},
|
|
123
|
-
onChipDragEnd: function () {
|
|
124
|
-
// HTML5 chip dragend (incl. cancels). The Html5DragSource
|
|
125
|
-
// owns the listener on the chip element, so this fires
|
|
126
|
-
// even if the chip was detached cross-group — the
|
|
127
|
-
// element keeps its listeners until the source is
|
|
128
|
-
// disposed. resetDragAnimation is a no-op after a
|
|
129
|
-
// successful drop (anim state already null) thanks to
|
|
130
|
-
// the gating inside it.
|
|
131
|
-
_this.resetDragAnimation();
|
|
132
|
-
},
|
|
133
|
-
onChipDrop: function (tabGroup, event) {
|
|
134
|
-
_this._handleChipDrop(tabGroup, event);
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
_this.addDisposables(_this._onOverflowTabsChange, _this._observerDisposable, _this._onWillShowOverlay, _this._onDrop, _this._onTabDragStart, {
|
|
138
|
-
dispose: function () {
|
|
139
|
-
var _a;
|
|
140
|
-
(_a = _this._flipTransitionCleanup) === null || _a === void 0 ? void 0 : _a.call(_this);
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
// Pointer-side cleanup: when any pointer drag ends, tear
|
|
144
|
-
// down smooth-reorder anim state the dragover bridge may
|
|
145
|
-
// have installed. The chip's pointer drag source handles
|
|
146
|
-
// its own transfer payload + iframe-shield cleanup.
|
|
147
|
-
pointerDragController_1.PointerDragController.getInstance().onDragEnd(function () {
|
|
148
|
-
_this._pointerInsideTabsList = false;
|
|
149
|
-
_this.resetDragAnimation();
|
|
150
|
-
}),
|
|
151
|
-
// Pointer-event mirror of the HTML5 dragover / dragleave handlers
|
|
152
|
-
// below. Drives smooth-reorder for `dndStrategy: 'pointer'` and
|
|
153
|
-
// for touch drags in `'auto'`.
|
|
154
|
-
pointerDragController_1.PointerDragController.getInstance().onDragMove(function (e) {
|
|
155
|
-
_this._handlePointerDragMove(e.clientX, e.clientY);
|
|
156
|
-
}), (0, events_1.addDisposableListener)(_this.element, 'pointerdown', function (event) {
|
|
157
|
-
if (event.defaultPrevented) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
var isLeftClick = event.button === 0;
|
|
161
|
-
if (isLeftClick) {
|
|
162
|
-
_this.accessor.doSetGroupActive(_this.group);
|
|
163
|
-
}
|
|
164
|
-
}),
|
|
165
|
-
// Trackpad / wheel forwarding. The strip scrolls along its own
|
|
166
|
-
// axis (x for horizontal headers, y for vertical), so deltaY
|
|
167
|
-
// from a plain mouse wheel maps onto the strip's axis too —
|
|
168
|
-
// this gives the VS Code-style "scroll over tab bar to page
|
|
169
|
-
// through tabs" feel. We only consume the event when the strip
|
|
170
|
-
// is actually overflowing in the direction the user wheeled in,
|
|
171
|
-
// so a wheel at the edge of a non-overflowing strip still
|
|
172
|
-
// bubbles up and scrolls the page. `{ passive: false }` is
|
|
173
|
-
// required because we call preventDefault().
|
|
174
|
-
(0, events_1.addDisposableListener)(_this._tabsList, 'wheel', function (event) {
|
|
175
|
-
var isVertical = _this._direction === 'vertical';
|
|
176
|
-
var primary = isVertical
|
|
177
|
-
? event.deltaY || event.deltaX
|
|
178
|
-
: event.deltaX || event.deltaY;
|
|
179
|
-
if (primary === 0) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
var max = isVertical
|
|
183
|
-
? _this._tabsList.scrollHeight -
|
|
184
|
-
_this._tabsList.clientHeight
|
|
185
|
-
: _this._tabsList.scrollWidth -
|
|
186
|
-
_this._tabsList.clientWidth;
|
|
187
|
-
if (max <= 0) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
var current = isVertical
|
|
191
|
-
? _this._tabsList.scrollTop
|
|
192
|
-
: _this._tabsList.scrollLeft;
|
|
193
|
-
// At the edge in the wheel direction: let the page
|
|
194
|
-
// scroll instead of trapping the gesture.
|
|
195
|
-
if ((primary < 0 && current <= 0) ||
|
|
196
|
-
(primary > 0 && current >= max)) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
event.preventDefault();
|
|
200
|
-
// Custom-scrollbar mode wraps the tabs list and installs
|
|
201
|
-
// its own wheel listener that rewrites scrollLeft from a
|
|
202
|
-
// deltaY-only tracker. Without stopPropagation that
|
|
203
|
-
// handler would clobber our deltaX-aware update.
|
|
204
|
-
event.stopPropagation();
|
|
205
|
-
if (isVertical) {
|
|
206
|
-
_this._tabsList.scrollTop = current + primary;
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
_this._tabsList.scrollLeft = current + primary;
|
|
210
|
-
}
|
|
211
|
-
}, { passive: false }),
|
|
212
|
-
// WAI-ARIA Tabs keyboard pattern: arrow keys move the roving
|
|
213
|
-
// focus along the strip, Home/End jump to the ends, and
|
|
214
|
-
// Enter/Space activate the focused tab (manual activation, so
|
|
215
|
-
// arrowing through tabs doesn't switch panels until committed).
|
|
216
|
-
(0, events_1.addDisposableListener)(_this._tabsList, 'keydown', function (event) {
|
|
217
|
-
_this._onKeyDown(event);
|
|
218
|
-
}), (0, events_1.addDisposableListener)(_this._tabsList, 'dragover', function (event) {
|
|
219
|
-
if (_this._processDragOver(event.clientX)) {
|
|
220
|
-
// Allow `drop` to fire on the tabs list container.
|
|
221
|
-
event.preventDefault();
|
|
222
|
-
}
|
|
223
|
-
}, true), (0, events_1.addDisposableListener)(_this._tabsList, 'dragleave', function (event) {
|
|
224
|
-
_this._processDragLeave(event.relatedTarget);
|
|
225
|
-
}, true), (0, events_1.addDisposableListener)(_this._tabsList, 'dragend', function () {
|
|
226
|
-
_this.resetDragAnimation();
|
|
227
|
-
}), (0, events_1.addDisposableListener)(_this._tabsList, 'drop', function (event) {
|
|
228
|
-
var _a, _b, _c;
|
|
229
|
-
if (!_this._animState ||
|
|
230
|
-
_this._animState.currentInsertionIndex === null) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
// In non-smooth mode only handle group drags here;
|
|
234
|
-
// individual tab drops are handled by tab Droptargets.
|
|
235
|
-
if (((_a = _this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) !==
|
|
236
|
-
'smooth' &&
|
|
237
|
-
!_this._animState.sourceTabGroupId) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
event.stopPropagation();
|
|
241
|
-
event.preventDefault();
|
|
242
|
-
// The capturing stopPropagation above prevents the
|
|
243
|
-
// individual tab's Droptarget.onDrop from firing, so
|
|
244
|
-
// the anchor overlay won't be cleared by that path.
|
|
245
|
-
// Clear it explicitly here before processing the drop.
|
|
246
|
-
(_c = (_b = _this.group.model.dropTargetContainer) === null || _b === void 0 ? void 0 : _b.model) === null || _c === void 0 ? void 0 : _c.clear();
|
|
247
|
-
var animState = _this._animState;
|
|
248
|
-
_this._animState = null;
|
|
249
|
-
_this._pendingCollapse = false;
|
|
250
|
-
// Handle group drag (entire group repositioned)
|
|
251
|
-
if (animState.sourceTabGroupId) {
|
|
252
|
-
_this._commitGroupMove(animState.sourceTabGroupId, animState.currentInsertionIndex);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
var insertionIndex = animState.currentInsertionIndex;
|
|
256
|
-
var sourceIndex = animState.sourceIndex;
|
|
257
|
-
var adjustedIndex = insertionIndex -
|
|
258
|
-
(sourceIndex !== -1 && sourceIndex < insertionIndex
|
|
259
|
-
? 1
|
|
260
|
-
: 0);
|
|
261
|
-
var sourceCurrentGroup = _this.group.model.getTabGroupForPanel(animState.sourceTabId);
|
|
262
|
-
if (adjustedIndex === sourceIndex &&
|
|
263
|
-
!animState.targetTabGroupId &&
|
|
264
|
-
!sourceCurrentGroup) {
|
|
265
|
-
_this._uncollapsSourceTab(animState.sourceTabId);
|
|
266
|
-
_this.resetTabTransforms();
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
_this._uncollapsSourceTab(animState.sourceTabId);
|
|
270
|
-
var firstPositions = _this.snapshotTabPositions();
|
|
271
|
-
_this.resetTabTransforms();
|
|
272
|
-
_this._onDrop.fire({
|
|
273
|
-
event: event,
|
|
274
|
-
index: adjustedIndex,
|
|
275
|
-
targetTabGroupId: animState.targetTabGroupId,
|
|
276
|
-
});
|
|
277
|
-
_this.runFlipAnimation(firstPositions, animState.sourceTabId, animState.sourceIndex === -1, {
|
|
278
|
-
from: Math.min(sourceIndex, adjustedIndex),
|
|
279
|
-
to: Math.max(sourceIndex, adjustedIndex),
|
|
280
|
-
});
|
|
281
|
-
}, true), lifecycle_1.Disposable.from(function () {
|
|
282
|
-
var e_1, _a;
|
|
283
|
-
var _b;
|
|
284
|
-
(_b = _this._voidContainerListeners) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
285
|
-
_this.resetDragAnimation();
|
|
286
|
-
_this._tabGroupManager.disposeAll();
|
|
287
|
-
try {
|
|
288
|
-
for (var _c = __values(_this._tabs), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
289
|
-
var _e = _d.value, value = _e.value, disposable = _e.disposable;
|
|
290
|
-
disposable.dispose();
|
|
291
|
-
value.dispose();
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
295
|
-
finally {
|
|
296
|
-
try {
|
|
297
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
298
|
-
}
|
|
299
|
-
finally { if (e_1) throw e_1.error; }
|
|
300
|
-
}
|
|
301
|
-
_this._tabs = [];
|
|
302
|
-
_this._tabMap.clear();
|
|
303
|
-
}));
|
|
304
|
-
return _this;
|
|
305
|
-
}
|
|
306
|
-
Object.defineProperty(Tabs.prototype, "showTabsOverflowControl", {
|
|
307
|
-
get: function () {
|
|
308
|
-
return this._showTabsOverflowControl;
|
|
309
|
-
},
|
|
310
|
-
set: function (value) {
|
|
311
|
-
var _this = this;
|
|
312
|
-
if (this._showTabsOverflowControl == value) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
this._showTabsOverflowControl = value;
|
|
316
|
-
if (value) {
|
|
317
|
-
var observer = new dom_1.OverflowObserver(this._tabsList);
|
|
318
|
-
this._observerDisposable.value = new lifecycle_1.CompositeDisposable(observer, observer.onDidChange(function (event) {
|
|
319
|
-
var hasOverflow = event.hasScrollX || event.hasScrollY;
|
|
320
|
-
_this.toggleDropdown({ reset: !hasOverflow });
|
|
321
|
-
if (_this._tabGroupManager.groupUnderlines.size > 0) {
|
|
322
|
-
_this._tabGroupManager.positionUnderlines();
|
|
323
|
-
}
|
|
324
|
-
}), (0, events_1.addDisposableListener)(this._tabsList, 'scroll', function () {
|
|
325
|
-
_this.toggleDropdown({ reset: false });
|
|
326
|
-
if (_this._tabGroupManager.groupUnderlines.size > 0) {
|
|
327
|
-
_this._tabGroupManager.positionUnderlines();
|
|
328
|
-
}
|
|
329
|
-
}));
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
enumerable: false,
|
|
333
|
-
configurable: true
|
|
334
|
-
});
|
|
335
|
-
Object.defineProperty(Tabs.prototype, "element", {
|
|
336
|
-
get: function () {
|
|
337
|
-
return this._element;
|
|
338
|
-
},
|
|
339
|
-
enumerable: false,
|
|
340
|
-
configurable: true
|
|
341
|
-
});
|
|
342
|
-
Object.defineProperty(Tabs.prototype, "voidContainer", {
|
|
343
|
-
set: function (el) {
|
|
344
|
-
var _this = this;
|
|
345
|
-
var _a;
|
|
346
|
-
(_a = this._voidContainerListeners) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
347
|
-
this._voidContainerListeners = null;
|
|
348
|
-
this._voidContainer = el;
|
|
349
|
-
if (el) {
|
|
350
|
-
this._voidContainerListeners = new lifecycle_1.CompositeDisposable((0, events_1.addDisposableListener)(el, 'dragover', function (event) {
|
|
351
|
-
if (_this._animState) {
|
|
352
|
-
event.preventDefault();
|
|
353
|
-
}
|
|
354
|
-
}), (0, events_1.addDisposableListener)(el, 'drop', function (event) {
|
|
355
|
-
var _a;
|
|
356
|
-
if (((_a = _this._animState) === null || _a === void 0 ? void 0 : _a.sourceTabGroupId) &&
|
|
357
|
-
_this._animState.currentInsertionIndex !== null) {
|
|
358
|
-
event.preventDefault();
|
|
359
|
-
event.stopPropagation();
|
|
360
|
-
_this.handleVoidDrop();
|
|
361
|
-
}
|
|
362
|
-
}));
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
enumerable: false,
|
|
366
|
-
configurable: true
|
|
367
|
-
});
|
|
368
|
-
/**
|
|
369
|
-
* Handle a drop that occurred on the void container (empty header
|
|
370
|
-
* space to the right of the tabs). Returns `true` if the drop was
|
|
371
|
-
* consumed by an active group drag, `false` otherwise.
|
|
372
|
-
*/
|
|
373
|
-
Tabs.prototype.handleVoidDrop = function () {
|
|
374
|
-
var _a, _b;
|
|
375
|
-
if (!((_a = this._animState) === null || _a === void 0 ? void 0 : _a.sourceTabGroupId)) {
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
378
|
-
var sourceTabGroupId = this._animState.sourceTabGroupId;
|
|
379
|
-
var insertionIndex = (_b = this._animState.currentInsertionIndex) !== null && _b !== void 0 ? _b : this._tabs.length;
|
|
380
|
-
this._animState = null;
|
|
381
|
-
this._commitGroupMove(sourceTabGroupId, insertionIndex);
|
|
382
|
-
return true;
|
|
383
|
-
};
|
|
384
|
-
Object.defineProperty(Tabs.prototype, "panels", {
|
|
385
|
-
get: function () {
|
|
386
|
-
return this._tabs.map(function (_) { return _.value.panel.id; });
|
|
387
|
-
},
|
|
388
|
-
enumerable: false,
|
|
389
|
-
configurable: true
|
|
390
|
-
});
|
|
391
|
-
Object.defineProperty(Tabs.prototype, "size", {
|
|
392
|
-
get: function () {
|
|
393
|
-
return this._tabs.length;
|
|
394
|
-
},
|
|
395
|
-
enumerable: false,
|
|
396
|
-
configurable: true
|
|
397
|
-
});
|
|
398
|
-
Object.defineProperty(Tabs.prototype, "tabs", {
|
|
399
|
-
get: function () {
|
|
400
|
-
return this._tabs.map(function (_) { return _.value; });
|
|
401
|
-
},
|
|
402
|
-
enumerable: false,
|
|
403
|
-
configurable: true
|
|
404
|
-
});
|
|
405
|
-
Object.defineProperty(Tabs.prototype, "direction", {
|
|
406
|
-
get: function () {
|
|
407
|
-
return this._direction;
|
|
408
|
-
},
|
|
409
|
-
set: function (value) {
|
|
410
|
-
var e_2, _a;
|
|
411
|
-
if (this._direction === value) {
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
this._direction = value;
|
|
415
|
-
this._tabsList.setAttribute('aria-orientation', value === 'vertical' ? 'vertical' : 'horizontal');
|
|
416
|
-
if (this._scrollbar) {
|
|
417
|
-
this._scrollbar.orientation = value;
|
|
418
|
-
}
|
|
419
|
-
(0, dom_1.removeClasses)(this._tabsList, 'dv-horizontal', 'dv-vertical');
|
|
420
|
-
if (value === 'vertical') {
|
|
421
|
-
(0, dom_1.addClasses)(this._tabsList, 'dv-tabs-container-vertical', 'dv-vertical');
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
(0, dom_1.removeClasses)(this._tabsList, 'dv-tabs-container-vertical');
|
|
425
|
-
(0, dom_1.addClasses)(this._tabsList, 'dv-horizontal');
|
|
426
|
-
}
|
|
427
|
-
try {
|
|
428
|
-
for (var _b = __values(this._tabs), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
429
|
-
var tab = _c.value;
|
|
430
|
-
tab.value.setDirection(value);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
434
|
-
finally {
|
|
435
|
-
try {
|
|
436
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
437
|
-
}
|
|
438
|
-
finally { if (e_2) throw e_2.error; }
|
|
439
|
-
}
|
|
440
|
-
this._tabGroupManager.updateDirection();
|
|
441
|
-
},
|
|
442
|
-
enumerable: false,
|
|
443
|
-
configurable: true
|
|
444
|
-
});
|
|
445
|
-
Tabs.prototype.indexOf = function (id) {
|
|
446
|
-
return this._tabs.findIndex(function (tab) { return tab.value.panel.id === id; });
|
|
447
|
-
};
|
|
448
|
-
/** DOM id of the tab element for a panel — for the tabpanel's `aria-labelledby`. */
|
|
449
|
-
Tabs.prototype.getTabId = function (panelId) {
|
|
450
|
-
var _a;
|
|
451
|
-
return (_a = this._tabMap.get(panelId)) === null || _a === void 0 ? void 0 : _a.value.element.id;
|
|
452
|
-
};
|
|
453
|
-
Tabs.prototype.isActive = function (tab) {
|
|
454
|
-
return (this.selectedIndex > -1 &&
|
|
455
|
-
this._tabs[this.selectedIndex].value === tab);
|
|
456
|
-
};
|
|
457
|
-
Tabs.prototype._onKeyDown = function (event) {
|
|
458
|
-
var _this = this;
|
|
459
|
-
// Only handle when a tab element itself is focused — never hijack keys
|
|
460
|
-
// typed inside a custom tab renderer's own controls (inputs etc.).
|
|
461
|
-
var index = this._tabs.findIndex(function (tab) { return tab.value.element === event.target; });
|
|
462
|
-
if (index === -1) {
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
var isVertical = this._direction === 'vertical';
|
|
466
|
-
var nextKey = isVertical ? 'ArrowDown' : 'ArrowRight';
|
|
467
|
-
var prevKey = isVertical ? 'ArrowUp' : 'ArrowLeft';
|
|
468
|
-
var last = this._tabs.length - 1;
|
|
469
|
-
switch (event.key) {
|
|
470
|
-
case nextKey:
|
|
471
|
-
event.preventDefault();
|
|
472
|
-
this._focusTab(Math.min(index + 1, last));
|
|
473
|
-
break;
|
|
474
|
-
case prevKey:
|
|
475
|
-
event.preventDefault();
|
|
476
|
-
this._focusTab(Math.max(index - 1, 0));
|
|
477
|
-
break;
|
|
478
|
-
case 'Home':
|
|
479
|
-
event.preventDefault();
|
|
480
|
-
this._focusTab(0);
|
|
481
|
-
break;
|
|
482
|
-
case 'End':
|
|
483
|
-
event.preventDefault();
|
|
484
|
-
this._focusTab(last);
|
|
485
|
-
break;
|
|
486
|
-
case 'Enter':
|
|
487
|
-
case ' ':
|
|
488
|
-
// Manual activation of the focused tab.
|
|
489
|
-
event.preventDefault();
|
|
490
|
-
this.accessor.withOrigin('user', function () {
|
|
491
|
-
return _this._tabs[index].value.panel.api.setActive();
|
|
492
|
-
});
|
|
493
|
-
break;
|
|
494
|
-
case 'Delete':
|
|
495
|
-
case 'Backspace':
|
|
496
|
-
// Close the focused tab (Backspace covers macOS, where the
|
|
497
|
-
// primary delete key reports as Backspace).
|
|
498
|
-
event.preventDefault();
|
|
499
|
-
this._closeTab(index);
|
|
500
|
-
break;
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
|
-
/**
|
|
504
|
-
* Close the tab at `index` and move roving focus to a neighbouring tab so
|
|
505
|
-
* keyboard focus stays in the tablist.
|
|
506
|
-
*/
|
|
507
|
-
Tabs.prototype._closeTab = function (index) {
|
|
508
|
-
var _a, _b, _c, _d, _e;
|
|
509
|
-
var tab = (_a = this._tabs[index]) === null || _a === void 0 ? void 0 : _a.value;
|
|
510
|
-
if (!tab) {
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
|
-
// Resolve the post-close focus target before closing mutates the list:
|
|
514
|
-
// prefer the next tab, otherwise the previous.
|
|
515
|
-
var neighbourId = (_e = ((_c = (_b = this._tabs[index + 1]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : (_d = this._tabs[index - 1]) === null || _d === void 0 ? void 0 : _d.value)) === null || _e === void 0 ? void 0 : _e.panel.id;
|
|
516
|
-
tab.panel.api.close();
|
|
517
|
-
if (neighbourId !== undefined) {
|
|
518
|
-
var nextIndex = this._tabs.findIndex(function (t) { return t.value.panel.id === neighbourId; });
|
|
519
|
-
if (nextIndex > -1) {
|
|
520
|
-
this._focusTab(nextIndex);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
/** Move the roving focus to the tab at `index` (updates tabindex + DOM focus). */
|
|
525
|
-
Tabs.prototype._focusTab = function (index) {
|
|
526
|
-
for (var i = 0; i < this._tabs.length; i++) {
|
|
527
|
-
this._tabs[i].value.element.tabIndex = i === index ? 0 : -1;
|
|
528
|
-
}
|
|
529
|
-
this._tabs[index].value.element.focus();
|
|
530
|
-
};
|
|
531
|
-
/** Move DOM focus to the active tab — the entry point into the tablist. */
|
|
532
|
-
Tabs.prototype.focusActiveTab = function () {
|
|
533
|
-
var _a;
|
|
534
|
-
if (this._tabs.length === 0) {
|
|
535
|
-
return;
|
|
536
|
-
}
|
|
537
|
-
var activeId = (_a = this.group.activePanel) === null || _a === void 0 ? void 0 : _a.id;
|
|
538
|
-
var activeIndex = activeId
|
|
539
|
-
? this._tabs.findIndex(function (t) { return t.value.panel.id === activeId; })
|
|
540
|
-
: -1;
|
|
541
|
-
this._focusTab(activeIndex > -1 ? activeIndex : 0);
|
|
542
|
-
};
|
|
543
|
-
Tabs.prototype.setActivePanel = function (panel) {
|
|
544
|
-
var e_3, _a;
|
|
545
|
-
var isVertical = this._direction === 'vertical';
|
|
546
|
-
var running = 0;
|
|
547
|
-
try {
|
|
548
|
-
for (var _b = __values(this._tabs), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
549
|
-
var tab = _c.value;
|
|
550
|
-
var isActivePanel = panel.id === tab.value.panel.id;
|
|
551
|
-
tab.value.setActive(isActivePanel);
|
|
552
|
-
if (isActivePanel) {
|
|
553
|
-
var element = tab.value.element;
|
|
554
|
-
var parentElement = element.parentElement;
|
|
555
|
-
if (isVertical) {
|
|
556
|
-
if (running < parentElement.scrollTop ||
|
|
557
|
-
running + element.clientHeight >
|
|
558
|
-
parentElement.scrollTop + parentElement.clientHeight) {
|
|
559
|
-
parentElement.scrollTop = running;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
else if (running < parentElement.scrollLeft ||
|
|
563
|
-
running + element.clientWidth >
|
|
564
|
-
parentElement.scrollLeft + parentElement.clientWidth) {
|
|
565
|
-
parentElement.scrollLeft = running;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
running += isVertical
|
|
569
|
-
? tab.value.element.clientHeight
|
|
570
|
-
: tab.value.element.clientWidth;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
574
|
-
finally {
|
|
575
|
-
try {
|
|
576
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
577
|
-
}
|
|
578
|
-
finally { if (e_3) throw e_3.error; }
|
|
579
|
-
}
|
|
580
|
-
// Reposition underlines so the wrap-around follows the new active tab
|
|
581
|
-
if (this._tabGroupManager.groupUnderlines.size > 0) {
|
|
582
|
-
this._tabGroupManager.positionUnderlines();
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
|
-
Tabs.prototype.openPanel = function (panel, index) {
|
|
586
|
-
var _this = this;
|
|
587
|
-
if (index === void 0) { index = this._tabs.length; }
|
|
588
|
-
if (this._tabMap.has(panel.id)) {
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
var tab = new tab_1.Tab(panel, this.accessor, this.group);
|
|
592
|
-
tab.setContent(panel.view.tab);
|
|
593
|
-
if (this._direction !== 'horizontal') {
|
|
594
|
-
tab.setDirection(this._direction);
|
|
595
|
-
}
|
|
596
|
-
var disposable = new lifecycle_1.CompositeDisposable(tab.onDragStart(function (event) {
|
|
597
|
-
var _a;
|
|
598
|
-
_this._onTabDragStart.fire({ nativeEvent: event, panel: panel });
|
|
599
|
-
// Both HTML5 and pointer drags initialize _animState. Cleanup
|
|
600
|
-
// is wired in both paths: HTML5 via dragend/drop on _tabsList,
|
|
601
|
-
// pointer via PointerDragController.onDragEnd subscriptions.
|
|
602
|
-
if (((_a = _this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {
|
|
603
|
-
var tabWidth = tab.element.getBoundingClientRect().width;
|
|
604
|
-
var sourceIndex_1 = _this._tabs.findIndex(function (x) { return x.value === tab; });
|
|
605
|
-
_this._animState = {
|
|
606
|
-
sourceTabId: panel.id,
|
|
607
|
-
sourceIndex: sourceIndex_1,
|
|
608
|
-
tabPositions: _this.snapshotTabPositions(),
|
|
609
|
-
chipPositions: _this._tabGroupManager.snapshotChipWidths(),
|
|
610
|
-
currentInsertionIndex: null,
|
|
611
|
-
targetTabGroupId: null,
|
|
612
|
-
sourceTabGroupId: null,
|
|
613
|
-
sourceGroupPanelIds: null,
|
|
614
|
-
sourceChipWidth: 0,
|
|
615
|
-
cursorOffsetFromDragLeft: tabWidth / 2,
|
|
616
|
-
sourceGapWidth: tabWidth,
|
|
617
|
-
containerLeft: _this._tabsList.getBoundingClientRect().left,
|
|
618
|
-
};
|
|
619
|
-
// Collapse the source tab after the browser captures the
|
|
620
|
-
// drag image, then open the gap at the source position in
|
|
621
|
-
// the same paint frame — no visual jump.
|
|
622
|
-
// Both collapse and gap must be instant (no transition).
|
|
623
|
-
_this._pendingCollapse = true;
|
|
624
|
-
requestAnimationFrame(function () {
|
|
625
|
-
var _a;
|
|
626
|
-
var _b;
|
|
627
|
-
_this._pendingCollapse = false;
|
|
628
|
-
if (!_this._animState) {
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
// Collapse source tab instantly (no transition)
|
|
632
|
-
tab.element.style.transition = 'none';
|
|
633
|
-
(0, dom_1.toggleClass)(tab.element, 'dv-tab--dragging', true);
|
|
634
|
-
void tab.element.offsetHeight; // force reflow
|
|
635
|
-
(_a = (_b = _this._animState).currentInsertionIndex) !== null && _a !== void 0 ? _a : (_b.currentInsertionIndex = sourceIndex_1);
|
|
636
|
-
// Apply gap with transitions disabled on the target
|
|
637
|
-
_this.applyDragOverTransforms(true);
|
|
638
|
-
// Re-enable transitions for subsequent moves
|
|
639
|
-
tab.element.style.removeProperty('transition');
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
}), tab.onTabClick(function (event) {
|
|
643
|
-
if (event.defaultPrevented) {
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
if (_this.group.api.location.type !== 'edge') {
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
if (_this.group.activePanel === panel) {
|
|
650
|
-
// Clicking the active tab toggles expansion
|
|
651
|
-
if (_this.group.api.isCollapsed()) {
|
|
652
|
-
_this.group.api.expand();
|
|
653
|
-
}
|
|
654
|
-
else {
|
|
655
|
-
_this.group.api.collapse();
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
else {
|
|
659
|
-
// Clicking a non-active tab switches the active tab.
|
|
660
|
-
// If the group is collapsed, also expand it.
|
|
661
|
-
_this.group.model.openPanel(panel);
|
|
662
|
-
if (_this.group.api.isCollapsed()) {
|
|
663
|
-
_this.group.api.expand();
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
}), tab.onPointerDown(function (event) {
|
|
667
|
-
if (event.defaultPrevented) {
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
var isFloatingGroupsEnabled = !_this.accessor.options.disableFloatingGroups;
|
|
671
|
-
var isFloatingWithOnePanel = _this.group.api.location.type === 'floating' &&
|
|
672
|
-
_this.size === 1;
|
|
673
|
-
if (isFloatingGroupsEnabled &&
|
|
674
|
-
!isFloatingWithOnePanel &&
|
|
675
|
-
event.shiftKey) {
|
|
676
|
-
event.preventDefault();
|
|
677
|
-
var panel_1 = _this.accessor.getGroupPanel(tab.panel.id);
|
|
678
|
-
var _a = tab.element.getBoundingClientRect(), top_1 = _a.top, left = _a.left;
|
|
679
|
-
var _b = _this.accessor.element.getBoundingClientRect(), rootTop = _b.top, rootLeft = _b.left;
|
|
680
|
-
_this.accessor.addFloatingGroup(panel_1, {
|
|
681
|
-
x: left - rootLeft,
|
|
682
|
-
y: top_1 - rootTop,
|
|
683
|
-
inDragMode: true,
|
|
684
|
-
});
|
|
685
|
-
return;
|
|
686
|
-
}
|
|
687
|
-
// Edge groups are skipped here: all their tab interaction
|
|
688
|
-
// is handled by onTabClick to avoid race conditions with
|
|
689
|
-
// active panel state.
|
|
690
|
-
if (event.button === 0 &&
|
|
691
|
-
_this.group.api.location.type !== 'edge' &&
|
|
692
|
-
_this.group.activePanel !== panel) {
|
|
693
|
-
_this.group.model.openPanel(panel);
|
|
694
|
-
}
|
|
695
|
-
}), tab.onDrop(function (event) {
|
|
696
|
-
var _a, _b, _c, _d;
|
|
697
|
-
var animState = _this._animState;
|
|
698
|
-
_this._animState = null;
|
|
699
|
-
_this._pendingCollapse = false;
|
|
700
|
-
var tabIndex = _this._tabs.findIndex(function (x) { return x.value === tab; });
|
|
701
|
-
if (animState) {
|
|
702
|
-
var dropIndex = event.position === 'right' ? tabIndex + 1 : tabIndex;
|
|
703
|
-
if (animState.sourceTabGroupId) {
|
|
704
|
-
_this._commitGroupMove(animState.sourceTabGroupId, (_a = animState.currentInsertionIndex) !== null && _a !== void 0 ? _a : dropIndex);
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
_this._uncollapsSourceTab(animState.sourceTabId);
|
|
708
|
-
var firstPositions = _this.snapshotTabPositions();
|
|
709
|
-
_this.resetTabTransforms();
|
|
710
|
-
_this._onDrop.fire({
|
|
711
|
-
event: event.nativeEvent,
|
|
712
|
-
index: dropIndex,
|
|
713
|
-
targetTabGroupId: animState.targetTabGroupId,
|
|
714
|
-
});
|
|
715
|
-
if (((_b = _this.accessor.options.theme) === null || _b === void 0 ? void 0 : _b.tabAnimation) === 'smooth') {
|
|
716
|
-
_this.runFlipAnimation(firstPositions, animState.sourceTabId, animState.sourceIndex === -1, animState.sourceIndex === -1
|
|
717
|
-
? undefined
|
|
718
|
-
: {
|
|
719
|
-
from: Math.min(animState.sourceIndex, dropIndex),
|
|
720
|
-
to: Math.max(animState.sourceIndex, dropIndex),
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
else {
|
|
725
|
-
// Compute insertion index based on which half of the tab
|
|
726
|
-
// the pointer is over, then adjust for same-group removal:
|
|
727
|
-
// when the source tab sits before the insertion point,
|
|
728
|
-
// removing it shifts all subsequent indices down by one.
|
|
729
|
-
var afterPosition = _this._direction === 'vertical' ? 'bottom' : 'right';
|
|
730
|
-
var insertionIndex = event.position === afterPosition
|
|
731
|
-
? tabIndex + 1
|
|
732
|
-
: tabIndex;
|
|
733
|
-
var data_1 = (0, dataTransfer_1.getPanelData)();
|
|
734
|
-
var sourceIndex = data_1
|
|
735
|
-
? _this._tabs.findIndex(function (x) { return x.value.panel.id === data_1.panelId; })
|
|
736
|
-
: -1;
|
|
737
|
-
var adjustedIndex = insertionIndex -
|
|
738
|
-
(sourceIndex !== -1 && sourceIndex < insertionIndex
|
|
739
|
-
? 1
|
|
740
|
-
: 0);
|
|
741
|
-
var targetTabGroupId = (_d = (_c = _this.group.model.getTabGroupForPanel(tab.panel.id)) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : null;
|
|
742
|
-
_this._onDrop.fire({
|
|
743
|
-
event: event.nativeEvent,
|
|
744
|
-
index: adjustedIndex,
|
|
745
|
-
targetTabGroupId: targetTabGroupId,
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
}), tab.onWillShowOverlay(function (event) {
|
|
749
|
-
_this._onWillShowOverlay.fire(new events_2.DockviewWillShowOverlayLocationEvent(event, {
|
|
750
|
-
kind: 'tab',
|
|
751
|
-
panel: _this.group.activePanel,
|
|
752
|
-
api: _this.accessor.api,
|
|
753
|
-
group: _this.group,
|
|
754
|
-
getData: dataTransfer_1.getPanelData,
|
|
755
|
-
}));
|
|
756
|
-
}));
|
|
757
|
-
var value = { value: tab, disposable: disposable };
|
|
758
|
-
this.addTab(value, index);
|
|
759
|
-
// A new tab may have been inserted between a chip and its
|
|
760
|
-
// group's first tab — reposition all chips to stay correct.
|
|
761
|
-
this._tabGroupManager.positionAllChips();
|
|
762
|
-
// If a tab was added during active drag, refresh positions
|
|
763
|
-
if (this._animState) {
|
|
764
|
-
this._animState.tabPositions = this.snapshotTabPositions();
|
|
765
|
-
this._animState.chipPositions =
|
|
766
|
-
this._tabGroupManager.snapshotChipWidths();
|
|
767
|
-
this.applyDragOverTransforms();
|
|
768
|
-
}
|
|
769
|
-
};
|
|
770
|
-
Tabs.prototype.delete = function (id) {
|
|
771
|
-
var _a;
|
|
772
|
-
if (((_a = this._animState) === null || _a === void 0 ? void 0 : _a.sourceTabId) === id) {
|
|
773
|
-
this.resetTabTransforms();
|
|
774
|
-
this._animState = null;
|
|
775
|
-
}
|
|
776
|
-
// Force-clean any pending transitionend listener
|
|
777
|
-
this._tabGroupManager.cleanupTransition(id);
|
|
778
|
-
var index = this.indexOf(id);
|
|
779
|
-
var tabToRemove = this._tabs.splice(index, 1)[0];
|
|
780
|
-
this._tabMap.delete(id);
|
|
781
|
-
if (tabToRemove) {
|
|
782
|
-
var value = tabToRemove.value, disposable = tabToRemove.disposable;
|
|
783
|
-
disposable.dispose();
|
|
784
|
-
value.dispose();
|
|
785
|
-
value.element.remove();
|
|
786
|
-
}
|
|
787
|
-
// If a non-source tab was removed during active drag, refresh positions
|
|
788
|
-
if (this._animState) {
|
|
789
|
-
this._animState.tabPositions = this.snapshotTabPositions();
|
|
790
|
-
this._animState.chipPositions =
|
|
791
|
-
this._tabGroupManager.snapshotChipWidths();
|
|
792
|
-
this.applyDragOverTransforms();
|
|
793
|
-
}
|
|
794
|
-
};
|
|
795
|
-
Tabs.prototype.addTab = function (tab, index) {
|
|
796
|
-
if (index === void 0) { index = this._tabs.length; }
|
|
797
|
-
if (index < 0 || index > this._tabs.length) {
|
|
798
|
-
throw new Error('invalid location');
|
|
799
|
-
}
|
|
800
|
-
// Use the tab element at `index` as the reference node rather than
|
|
801
|
-
// `children[index]`, because `_tabsList` may contain non-tab children
|
|
802
|
-
// (e.g. group chips, underlines) that shift the DOM indices.
|
|
803
|
-
var refNode = index < this._tabs.length ? this._tabs[index].value.element : null;
|
|
804
|
-
this._tabsList.insertBefore(tab.value.element, refNode);
|
|
805
|
-
this._tabs = __spreadArray(__spreadArray(__spreadArray([], __read(this._tabs.slice(0, index)), false), [
|
|
806
|
-
tab
|
|
807
|
-
], false), __read(this._tabs.slice(index)), false);
|
|
808
|
-
this._tabMap.set(tab.value.panel.id, tab);
|
|
809
|
-
if (this.selectedIndex < 0) {
|
|
810
|
-
this.selectedIndex = index;
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
Tabs.prototype.toggleDropdown = function (options) {
|
|
814
|
-
var e_4, _a, e_5, _b;
|
|
815
|
-
var _this = this;
|
|
816
|
-
if (options.reset) {
|
|
817
|
-
this._onOverflowTabsChange.fire({
|
|
818
|
-
tabs: [],
|
|
819
|
-
tabGroups: [],
|
|
820
|
-
reset: true,
|
|
821
|
-
});
|
|
822
|
-
return;
|
|
823
|
-
}
|
|
824
|
-
var tabs = this._tabs
|
|
825
|
-
.filter(function (tab) {
|
|
826
|
-
return !(0, dom_1.isChildEntirelyVisibleWithinParent)(tab.value.element, _this._tabsList);
|
|
827
|
-
})
|
|
828
|
-
.map(function (x) { return x.value.panel.id; });
|
|
829
|
-
// Detect tab groups whose chip is clipped or whose tabs are all
|
|
830
|
-
// in the overflow set (e.g. collapsed groups scrolled out of view).
|
|
831
|
-
var overflowTabSet = new Set(tabs);
|
|
832
|
-
var tabGroups = [];
|
|
833
|
-
try {
|
|
834
|
-
for (var _c = __values(this.group.model.getTabGroups()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
835
|
-
var tg = _d.value;
|
|
836
|
-
var chipEntry = this._tabGroupManager.chipRenderers.get(tg.id);
|
|
837
|
-
var chipClipped = chipEntry &&
|
|
838
|
-
!(0, dom_1.isChildEntirelyVisibleWithinParent)(chipEntry.chip.element, this._tabsList);
|
|
839
|
-
// A group is in overflow if its chip is clipped OR all its
|
|
840
|
-
// visible tabs are in the overflow set.
|
|
841
|
-
var allTabsOverflow = tg.panelIds.length > 0 &&
|
|
842
|
-
tg.panelIds.every(function (pid) { return overflowTabSet.has(pid); });
|
|
843
|
-
if (chipClipped || allTabsOverflow) {
|
|
844
|
-
tabGroups.push(tg.id);
|
|
845
|
-
// For collapsed groups whose chip is clipped, ensure all
|
|
846
|
-
// member tabs are included in the overflow list so they
|
|
847
|
-
// appear in the dropdown.
|
|
848
|
-
if (tg.collapsed) {
|
|
849
|
-
try {
|
|
850
|
-
for (var _e = (e_5 = void 0, __values(tg.panelIds)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
851
|
-
var pid = _f.value;
|
|
852
|
-
if (!overflowTabSet.has(pid)) {
|
|
853
|
-
overflowTabSet.add(pid);
|
|
854
|
-
tabs.push(pid);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
859
|
-
finally {
|
|
860
|
-
try {
|
|
861
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
862
|
-
}
|
|
863
|
-
finally { if (e_5) throw e_5.error; }
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
870
|
-
finally {
|
|
871
|
-
try {
|
|
872
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
873
|
-
}
|
|
874
|
-
finally { if (e_4) throw e_4.error; }
|
|
875
|
-
}
|
|
876
|
-
this._onOverflowTabsChange.fire({ tabs: tabs, tabGroups: tabGroups, reset: false });
|
|
877
|
-
};
|
|
878
|
-
Tabs.prototype.updateDragAndDropState = function () {
|
|
879
|
-
var e_6, _a;
|
|
880
|
-
try {
|
|
881
|
-
for (var _b = __values(this._tabs), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
882
|
-
var tab = _c.value;
|
|
883
|
-
tab.value.updateDragAndDropState();
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
887
|
-
finally {
|
|
888
|
-
try {
|
|
889
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
890
|
-
}
|
|
891
|
-
finally { if (e_6) throw e_6.error; }
|
|
892
|
-
}
|
|
893
|
-
this._tabGroupManager.updateDragAndDropState();
|
|
894
|
-
};
|
|
895
|
-
/**
|
|
896
|
-
* Synchronize chip elements and CSS classes for all tab groups
|
|
897
|
-
* in the parent group model. Call after any tab group mutation.
|
|
898
|
-
*/
|
|
899
|
-
Tabs.prototype.updateTabGroups = function () {
|
|
900
|
-
this._tabGroupManager.update();
|
|
901
|
-
};
|
|
902
|
-
Tabs.prototype.refreshTabGroupAccent = function () {
|
|
903
|
-
this._tabGroupManager.refreshAccents();
|
|
904
|
-
};
|
|
905
|
-
/**
|
|
906
|
-
* Tabs-list-specific side effects of a chip drag start. The chip's
|
|
907
|
-
* drag sources (constructed by `TabGroupManager`) own the transfer
|
|
908
|
-
* payload, iframe shielding, dataTransfer setup, and the HTML5 drag
|
|
909
|
-
* image. This method just sets up the smooth-reorder anim state and
|
|
910
|
-
* collapses the source-group tabs in the tabs list.
|
|
911
|
-
*/
|
|
912
|
-
Tabs.prototype._handleChipDragStart = function (tabGroup, chip, event) {
|
|
913
|
-
var e_7, _a;
|
|
914
|
-
var _this = this;
|
|
915
|
-
var _b;
|
|
916
|
-
var firstPanelId = tabGroup.panelIds[0];
|
|
917
|
-
var firstIdx = firstPanelId
|
|
918
|
-
? this._tabs.findIndex(function (t) { return t.value.panel.id === firstPanelId; })
|
|
919
|
-
: -1;
|
|
920
|
-
var chipRect = chip.element.getBoundingClientRect();
|
|
921
|
-
// Compute total group width (chip + all tabs)
|
|
922
|
-
var groupGapWidth = chipRect.width;
|
|
923
|
-
try {
|
|
924
|
-
for (var _c = __values(tabGroup.panelIds), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
925
|
-
var pid = _d.value;
|
|
926
|
-
var tabEntry = this._tabMap.get(pid);
|
|
927
|
-
if (tabEntry) {
|
|
928
|
-
groupGapWidth +=
|
|
929
|
-
tabEntry.value.element.getBoundingClientRect().width;
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
934
|
-
finally {
|
|
935
|
-
try {
|
|
936
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
937
|
-
}
|
|
938
|
-
finally { if (e_7) throw e_7.error; }
|
|
939
|
-
}
|
|
940
|
-
this._animState = {
|
|
941
|
-
sourceTabId: '',
|
|
942
|
-
sourceIndex: firstIdx,
|
|
943
|
-
tabPositions: this.snapshotTabPositions(),
|
|
944
|
-
chipPositions: this._tabGroupManager.snapshotChipWidths(),
|
|
945
|
-
currentInsertionIndex: null,
|
|
946
|
-
targetTabGroupId: null,
|
|
947
|
-
sourceTabGroupId: tabGroup.id,
|
|
948
|
-
sourceGroupPanelIds: new Set(tabGroup.panelIds),
|
|
949
|
-
sourceChipWidth: chipRect.width,
|
|
950
|
-
cursorOffsetFromDragLeft: event.clientX - chipRect.left,
|
|
951
|
-
sourceGapWidth: groupGapWidth,
|
|
952
|
-
containerLeft: this._tabsList.getBoundingClientRect().left,
|
|
953
|
-
};
|
|
954
|
-
if (((_b = this.accessor.options.theme) === null || _b === void 0 ? void 0 : _b.tabAnimation) !== 'smooth') {
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
|
-
// Collapse group tabs + chip after the browser captures the drag
|
|
958
|
-
// image, then open the gap at the source position — all instant
|
|
959
|
-
// (no transitions).
|
|
960
|
-
var groupPanelIds = new Set(tabGroup.panelIds);
|
|
961
|
-
this._pendingCollapse = true;
|
|
962
|
-
requestAnimationFrame(function () {
|
|
963
|
-
var e_8, _a, e_9, _b;
|
|
964
|
-
var _c;
|
|
965
|
-
var _d;
|
|
966
|
-
_this._pendingCollapse = false;
|
|
967
|
-
if (!_this._animState) {
|
|
968
|
-
return;
|
|
969
|
-
}
|
|
970
|
-
try {
|
|
971
|
-
// Collapse all group tabs instantly
|
|
972
|
-
for (var _e = __values(_this._tabs), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
973
|
-
var t = _f.value;
|
|
974
|
-
if (groupPanelIds.has(t.value.panel.id)) {
|
|
975
|
-
t.value.element.style.transition = 'none';
|
|
976
|
-
(0, dom_1.toggleClass)(t.value.element, 'dv-tab--dragging', true);
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
981
|
-
finally {
|
|
982
|
-
try {
|
|
983
|
-
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
|
|
984
|
-
}
|
|
985
|
-
finally { if (e_8) throw e_8.error; }
|
|
986
|
-
}
|
|
987
|
-
// Collapse the group chip instantly
|
|
988
|
-
var chipEntry = _this._tabGroupManager.chipRenderers.get(tabGroup.id);
|
|
989
|
-
if (chipEntry) {
|
|
990
|
-
chipEntry.chip.element.style.transition = 'none';
|
|
991
|
-
(0, dom_1.toggleClass)(chipEntry.chip.element, 'dv-tab-group-chip--dragging', true);
|
|
992
|
-
}
|
|
993
|
-
// Single reflow for the entire batch
|
|
994
|
-
void _this._tabsList.offsetHeight;
|
|
995
|
-
var underline = _this._tabGroupManager.groupUnderlines.get(tabGroup.id);
|
|
996
|
-
if (underline) {
|
|
997
|
-
underline.style.display = 'none';
|
|
998
|
-
}
|
|
999
|
-
(_c = (_d = _this._animState).currentInsertionIndex) !== null && _c !== void 0 ? _c : (_d.currentInsertionIndex = firstIdx);
|
|
1000
|
-
_this.applyDragOverTransforms(true);
|
|
1001
|
-
try {
|
|
1002
|
-
for (var _g = __values(_this._tabs), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1003
|
-
var t = _h.value;
|
|
1004
|
-
if (groupPanelIds.has(t.value.panel.id)) {
|
|
1005
|
-
t.value.element.style.removeProperty('transition');
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1010
|
-
finally {
|
|
1011
|
-
try {
|
|
1012
|
-
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
1013
|
-
}
|
|
1014
|
-
finally { if (e_9) throw e_9.error; }
|
|
1015
|
-
}
|
|
1016
|
-
if (chipEntry) {
|
|
1017
|
-
chipEntry.chip.element.style.removeProperty('transition');
|
|
1018
|
-
}
|
|
1019
|
-
});
|
|
1020
|
-
};
|
|
1021
|
-
/**
|
|
1022
|
-
* A drop on a tab group chip means "insert before this group". Resolve to
|
|
1023
|
-
* the index of the group's first tab, adjusting for same-group removal
|
|
1024
|
-
* (when the source tab is currently to the left of the target slot, its
|
|
1025
|
-
* removal shifts the insertion index down by one). Always clears
|
|
1026
|
-
* `targetTabGroupId` so the dropped tab lands outside the group.
|
|
1027
|
-
*/
|
|
1028
|
-
Tabs.prototype._handleChipDrop = function (tabGroup, event) {
|
|
1029
|
-
var firstPanelId = tabGroup.panelIds[0];
|
|
1030
|
-
if (!firstPanelId) {
|
|
1031
|
-
return;
|
|
1032
|
-
}
|
|
1033
|
-
var insertionIndex = this._tabs.findIndex(function (x) { return x.value.panel.id === firstPanelId; });
|
|
1034
|
-
if (insertionIndex === -1) {
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
var data = (0, dataTransfer_1.getPanelData)();
|
|
1038
|
-
var sourceIndex = (data === null || data === void 0 ? void 0 : data.groupId) === this.group.id && (data === null || data === void 0 ? void 0 : data.panelId)
|
|
1039
|
-
? this._tabs.findIndex(function (x) { return x.value.panel.id === data.panelId; })
|
|
1040
|
-
: -1;
|
|
1041
|
-
var adjustedIndex = insertionIndex -
|
|
1042
|
-
(sourceIndex !== -1 && sourceIndex < insertionIndex ? 1 : 0);
|
|
1043
|
-
this._onDrop.fire({
|
|
1044
|
-
event: event.nativeEvent,
|
|
1045
|
-
index: adjustedIndex,
|
|
1046
|
-
targetTabGroupId: null,
|
|
1047
|
-
});
|
|
1048
|
-
};
|
|
1049
|
-
/**
|
|
1050
|
-
* Sets the broader container that is part of the same logical drop surface
|
|
1051
|
-
* as this tab list (e.g. the full header element). When a dragleave from
|
|
1052
|
-
* the tabs list lands inside this container, `_animState` is preserved so
|
|
1053
|
-
* that external dragover listeners can continue the animation.
|
|
1054
|
-
*/
|
|
1055
|
-
Tabs.prototype.setExtendedDropZone = function (el) {
|
|
1056
|
-
this._extendedDropZone = el;
|
|
1057
|
-
};
|
|
1058
|
-
/**
|
|
1059
|
-
* Allows external elements (e.g. void container, left actions) to push an
|
|
1060
|
-
* insertion index into the animation while the cursor is outside the tabs
|
|
1061
|
-
* list itself. Pass `null` to clear the indicator.
|
|
1062
|
-
*/
|
|
1063
|
-
Tabs.prototype.setExternalInsertionIndex = function (index) {
|
|
1064
|
-
if (!this._animState) {
|
|
1065
|
-
return;
|
|
1066
|
-
}
|
|
1067
|
-
if (index === this._animState.currentInsertionIndex) {
|
|
1068
|
-
return;
|
|
1069
|
-
}
|
|
1070
|
-
this._animState.currentInsertionIndex = index;
|
|
1071
|
-
this.applyDragOverTransforms();
|
|
1072
|
-
};
|
|
1073
|
-
/**
|
|
1074
|
-
* Called when the drag cursor leaves the entire header area (not just the
|
|
1075
|
-
* tabs list). Clears animation state for cross-group drags, which never
|
|
1076
|
-
* receive a `dragend` event on this tab list.
|
|
1077
|
-
*/
|
|
1078
|
-
Tabs.prototype.clearExternalAnimState = function () {
|
|
1079
|
-
if (!this._animState) {
|
|
1080
|
-
return;
|
|
1081
|
-
}
|
|
1082
|
-
this.resetTabTransforms();
|
|
1083
|
-
if (this._animState.sourceIndex === -1) {
|
|
1084
|
-
this._animState = null;
|
|
1085
|
-
}
|
|
1086
|
-
else {
|
|
1087
|
-
this._animState.currentInsertionIndex = null;
|
|
1088
|
-
}
|
|
1089
|
-
};
|
|
1090
|
-
Tabs.prototype.snapshotTabPositions = function () {
|
|
1091
|
-
var e_10, _a;
|
|
1092
|
-
var positions = new Map();
|
|
1093
|
-
try {
|
|
1094
|
-
for (var _b = __values(this._tabs), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1095
|
-
var tab = _c.value;
|
|
1096
|
-
positions.set(tab.value.panel.id, tab.value.element.getBoundingClientRect());
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1100
|
-
finally {
|
|
1101
|
-
try {
|
|
1102
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1103
|
-
}
|
|
1104
|
-
finally { if (e_10) throw e_10.error; }
|
|
1105
|
-
}
|
|
1106
|
-
return positions;
|
|
1107
|
-
};
|
|
1108
|
-
Tabs.prototype.getAverageTabWidth = function () {
|
|
1109
|
-
var e_11, _a;
|
|
1110
|
-
if (this._tabs.length === 0) {
|
|
1111
|
-
return 0;
|
|
1112
|
-
}
|
|
1113
|
-
var isVertical = this._direction === 'vertical';
|
|
1114
|
-
var total = 0;
|
|
1115
|
-
try {
|
|
1116
|
-
for (var _b = __values(this._tabs), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1117
|
-
var tab = _c.value;
|
|
1118
|
-
var rect = tab.value.element.getBoundingClientRect();
|
|
1119
|
-
total += isVertical ? rect.height : rect.width;
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1123
|
-
finally {
|
|
1124
|
-
try {
|
|
1125
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1126
|
-
}
|
|
1127
|
-
finally { if (e_11) throw e_11.error; }
|
|
1128
|
-
}
|
|
1129
|
-
return total / this._tabs.length;
|
|
1130
|
-
};
|
|
1131
|
-
/**
|
|
1132
|
-
* Pointer-event entry point. The HTML5 path enters via the per-element
|
|
1133
|
-
* `dragover` listener; this one hit-tests the global pointer-drag
|
|
1134
|
-
* position against the tabs list and routes through the same shared
|
|
1135
|
-
* `_processDragOver` / `_processDragLeave` helpers.
|
|
1136
|
-
*/
|
|
1137
|
-
Tabs.prototype._handlePointerDragMove = function (clientX, clientY) {
|
|
1138
|
-
var _a;
|
|
1139
|
-
var sourceDoc = (_a = this._tabsList.ownerDocument) !== null && _a !== void 0 ? _a : document;
|
|
1140
|
-
var elAtPoint = sourceDoc.elementFromPoint(clientX, clientY);
|
|
1141
|
-
var inside = !!elAtPoint &&
|
|
1142
|
-
(this._tabsList.contains(elAtPoint) ||
|
|
1143
|
-
(!!this._extendedDropZone &&
|
|
1144
|
-
this._extendedDropZone.contains(elAtPoint)));
|
|
1145
|
-
if (!inside) {
|
|
1146
|
-
if (this._pointerInsideTabsList) {
|
|
1147
|
-
this._pointerInsideTabsList = false;
|
|
1148
|
-
this._processDragLeave(elAtPoint);
|
|
1149
|
-
}
|
|
1150
|
-
return;
|
|
1151
|
-
}
|
|
1152
|
-
this._pointerInsideTabsList = true;
|
|
1153
|
-
this._processDragOver(clientX);
|
|
1154
|
-
};
|
|
1155
|
-
/**
|
|
1156
|
-
* Shared body of the dragover entry point. Refreshes stale anim state
|
|
1157
|
-
* for a changed drag identity, initializes anim state for incoming
|
|
1158
|
-
* cross-group drags, and dispatches to the gap-following math in
|
|
1159
|
-
* `handleDragOver`. Returns true when this tabs list has taken
|
|
1160
|
-
* ownership of the drag — HTML5 callers use this to gate
|
|
1161
|
-
* `event.preventDefault()`.
|
|
1162
|
-
*/
|
|
1163
|
-
Tabs.prototype._processDragOver = function (clientX) {
|
|
1164
|
-
var _a, _b, _c, _d;
|
|
1165
|
-
if (this.accessor.options.disableDnd) {
|
|
1166
|
-
return false;
|
|
1167
|
-
}
|
|
1168
|
-
// Stale-state guard: if a previous drag's anim state is still here
|
|
1169
|
-
// but the current drag is a different identity, drop the stale one
|
|
1170
|
-
// so the new drag starts from a clean slate.
|
|
1171
|
-
if (this._animState) {
|
|
1172
|
-
var data = (0, dataTransfer_1.getPanelData)();
|
|
1173
|
-
if ((data === null || data === void 0 ? void 0 : data.tabGroupId) &&
|
|
1174
|
-
data.groupId !== this.group.id &&
|
|
1175
|
-
this._animState.sourceTabGroupId !== data.tabGroupId) {
|
|
1176
|
-
this._animState = null;
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
if (!this._animState) {
|
|
1180
|
-
var data_2 = (0, dataTransfer_1.getPanelData)();
|
|
1181
|
-
// In default animation mode, individual tab drops are handled
|
|
1182
|
-
// by per-tab Droptargets; only chip drags need tabs-list-level
|
|
1183
|
-
// handling so drops on void space still work.
|
|
1184
|
-
if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'default' &&
|
|
1185
|
-
!(data_2 === null || data_2 === void 0 ? void 0 : data_2.tabGroupId)) {
|
|
1186
|
-
return false;
|
|
1187
|
-
}
|
|
1188
|
-
if (data_2 &&
|
|
1189
|
-
(data_2.panelId || data_2.tabGroupId) &&
|
|
1190
|
-
data_2.groupId !== this.group.id) {
|
|
1191
|
-
var avgWidth = this.getAverageTabWidth();
|
|
1192
|
-
if (data_2.tabGroupId) {
|
|
1193
|
-
// External group drag — look up the source group to
|
|
1194
|
-
// size the gap.
|
|
1195
|
-
var sourceGroup = this.accessor.getPanel(data_2.groupId);
|
|
1196
|
-
var sourceTg = sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.getTabGroups().find(function (tg) { return tg.id === data_2.tabGroupId; });
|
|
1197
|
-
var panelCount = (_b = sourceTg === null || sourceTg === void 0 ? void 0 : sourceTg.panelIds.length) !== null && _b !== void 0 ? _b : 1;
|
|
1198
|
-
var groupGapWidth = avgWidth * panelCount + avgWidth;
|
|
1199
|
-
this._animState = {
|
|
1200
|
-
sourceTabId: '',
|
|
1201
|
-
sourceIndex: -1,
|
|
1202
|
-
tabPositions: this.snapshotTabPositions(),
|
|
1203
|
-
chipPositions: this._tabGroupManager.snapshotChipWidths(),
|
|
1204
|
-
currentInsertionIndex: null,
|
|
1205
|
-
targetTabGroupId: null,
|
|
1206
|
-
sourceTabGroupId: data_2.tabGroupId,
|
|
1207
|
-
sourceGroupPanelIds: sourceTg
|
|
1208
|
-
? new Set(sourceTg.panelIds)
|
|
1209
|
-
: new Set(),
|
|
1210
|
-
sourceChipWidth: avgWidth,
|
|
1211
|
-
cursorOffsetFromDragLeft: groupGapWidth / 2,
|
|
1212
|
-
sourceGapWidth: groupGapWidth,
|
|
1213
|
-
containerLeft: this._tabsList.getBoundingClientRect().left,
|
|
1214
|
-
};
|
|
1215
|
-
}
|
|
1216
|
-
else {
|
|
1217
|
-
this._animState = {
|
|
1218
|
-
sourceTabId: data_2.panelId,
|
|
1219
|
-
sourceIndex: -1,
|
|
1220
|
-
tabPositions: this.snapshotTabPositions(),
|
|
1221
|
-
chipPositions: this._tabGroupManager.snapshotChipWidths(),
|
|
1222
|
-
currentInsertionIndex: null,
|
|
1223
|
-
targetTabGroupId: null,
|
|
1224
|
-
sourceTabGroupId: null,
|
|
1225
|
-
sourceGroupPanelIds: null,
|
|
1226
|
-
sourceChipWidth: 0,
|
|
1227
|
-
cursorOffsetFromDragLeft: avgWidth / 2,
|
|
1228
|
-
sourceGapWidth: avgWidth,
|
|
1229
|
-
containerLeft: this._tabsList.getBoundingClientRect().left,
|
|
1230
|
-
};
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
else {
|
|
1234
|
-
return false;
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
// For intra-group drag (sourceIndex >= 0) the gap animation is the
|
|
1238
|
-
// sole visual indicator — clear any stale anchor overlay that may
|
|
1239
|
-
// have been set while the cursor was over the panel content area or
|
|
1240
|
-
// another zone. External drags (sourceIndex === -1) leave the
|
|
1241
|
-
// overlay to the individual tab Droptargets so cross-group
|
|
1242
|
-
// animation is not disrupted.
|
|
1243
|
-
if (this._animState.sourceIndex !== -1) {
|
|
1244
|
-
(_d = (_c = this.group.model.dropTargetContainer) === null || _c === void 0 ? void 0 : _c.model) === null || _d === void 0 ? void 0 : _d.clear();
|
|
1245
|
-
}
|
|
1246
|
-
this.handleDragOver({ clientX: clientX });
|
|
1247
|
-
return true;
|
|
1248
|
-
};
|
|
1249
|
-
/**
|
|
1250
|
-
* Shared body of the dragleave entry point. Preserves anim state when
|
|
1251
|
-
* the drag moves between tabs-list children, into the extended drop
|
|
1252
|
-
* zone, or into the void container; tears it down otherwise.
|
|
1253
|
-
*/
|
|
1254
|
-
Tabs.prototype._processDragLeave = function (related) {
|
|
1255
|
-
var _a, _b, _c;
|
|
1256
|
-
if (!this._animState) {
|
|
1257
|
-
return;
|
|
1258
|
-
}
|
|
1259
|
-
// Moves between children of the tabs list aren't real leaves.
|
|
1260
|
-
if (related && this._tabsList.contains(related)) {
|
|
1261
|
-
return;
|
|
1262
|
-
}
|
|
1263
|
-
// Moving into the broader drop zone (e.g. void container, left
|
|
1264
|
-
// actions) — keep anim state alive so external listeners can
|
|
1265
|
-
// continue the gap animation.
|
|
1266
|
-
if (related && ((_a = this._extendedDropZone) === null || _a === void 0 ? void 0 : _a.contains(related))) {
|
|
1267
|
-
this.resetTabTransforms();
|
|
1268
|
-
this._animState.currentInsertionIndex = null;
|
|
1269
|
-
return;
|
|
1270
|
-
}
|
|
1271
|
-
// Leaving toward the void container (empty header space to the
|
|
1272
|
-
// right): keep anim state so a drop can still land at the end.
|
|
1273
|
-
var isVoid = this._voidContainer &&
|
|
1274
|
-
related &&
|
|
1275
|
-
(related === this._voidContainer ||
|
|
1276
|
-
this._voidContainer.contains(related));
|
|
1277
|
-
if (isVoid) {
|
|
1278
|
-
return;
|
|
1279
|
-
}
|
|
1280
|
-
this.resetTabTransforms();
|
|
1281
|
-
if (this._animState.sourceIndex === -1) {
|
|
1282
|
-
(_c = (_b = this.group.model.dropTargetContainer) === null || _b === void 0 ? void 0 : _b.model) === null || _c === void 0 ? void 0 : _c.clear();
|
|
1283
|
-
this._animState = null;
|
|
1284
|
-
}
|
|
1285
|
-
else {
|
|
1286
|
-
this._animState.currentInsertionIndex = null;
|
|
1287
|
-
}
|
|
1288
|
-
};
|
|
1289
|
-
Tabs.prototype.handleDragOver = function (event) {
|
|
1290
|
-
var e_12, _a, e_13, _b;
|
|
1291
|
-
var _this = this;
|
|
1292
|
-
var _c, _d, _e, _f, _g;
|
|
1293
|
-
if (!this._animState) {
|
|
1294
|
-
return;
|
|
1295
|
-
}
|
|
1296
|
-
var mouseX = event.clientX;
|
|
1297
|
-
var insertionIndex = null;
|
|
1298
|
-
var targetTabGroupId = null;
|
|
1299
|
-
var sourceGroupPanelIds = this._animState.sourceGroupPanelIds;
|
|
1300
|
-
// Accumulation approach: compute where the drag image's left edge
|
|
1301
|
-
// would be, then walk tabs left-to-right using their original widths.
|
|
1302
|
-
// A tab fits to the left of the gap if the cumulative width of all
|
|
1303
|
-
// preceding non-source tabs <= available space.
|
|
1304
|
-
var dragLeftEdge = mouseX - this._animState.cursorOffsetFromDragLeft;
|
|
1305
|
-
var availableSpace = dragLeftEdge - this._animState.containerLeft;
|
|
1306
|
-
var accWidth = 0;
|
|
1307
|
-
// Build lookup: first panel ID of each non-source group → group ID
|
|
1308
|
-
// so we can add chip widths when we encounter a group's first tab.
|
|
1309
|
-
var firstPanelToGroup = new Map();
|
|
1310
|
-
if (this._tabGroupManager.chipRenderers.size > 0) {
|
|
1311
|
-
var tabGroups = this.group.model.getTabGroups();
|
|
1312
|
-
try {
|
|
1313
|
-
for (var tabGroups_2 = __values(tabGroups), tabGroups_2_1 = tabGroups_2.next(); !tabGroups_2_1.done; tabGroups_2_1 = tabGroups_2.next()) {
|
|
1314
|
-
var tg = tabGroups_2_1.value;
|
|
1315
|
-
if (tg.id === this._animState.sourceTabGroupId) {
|
|
1316
|
-
continue;
|
|
1317
|
-
}
|
|
1318
|
-
if (tg.panelIds.length > 0) {
|
|
1319
|
-
firstPanelToGroup.set(tg.panelIds[0], tg.id);
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1324
|
-
finally {
|
|
1325
|
-
try {
|
|
1326
|
-
if (tabGroups_2_1 && !tabGroups_2_1.done && (_a = tabGroups_2.return)) _a.call(tabGroups_2);
|
|
1327
|
-
}
|
|
1328
|
-
finally { if (e_12) throw e_12.error; }
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
for (var i = 0; i < this._tabs.length; i++) {
|
|
1332
|
-
var tab = this._tabs[i].value;
|
|
1333
|
-
if (tab.panel.id === this._animState.sourceTabId) {
|
|
1334
|
-
continue;
|
|
1335
|
-
}
|
|
1336
|
-
if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) {
|
|
1337
|
-
continue;
|
|
1338
|
-
}
|
|
1339
|
-
// If this tab is the first of a non-source group, include
|
|
1340
|
-
// the chip width (which sits before it in the DOM).
|
|
1341
|
-
var groupId = firstPanelToGroup.get(tab.panel.id);
|
|
1342
|
-
if (groupId) {
|
|
1343
|
-
var chipWidth = (_c = this._animState.chipPositions.get(groupId)) !== null && _c !== void 0 ? _c : 0;
|
|
1344
|
-
if (accWidth + chipWidth > availableSpace) {
|
|
1345
|
-
// Chip alone overflows — gap goes before this group
|
|
1346
|
-
insertionIndex !== null && insertionIndex !== void 0 ? insertionIndex : (insertionIndex = i);
|
|
1347
|
-
break;
|
|
1348
|
-
}
|
|
1349
|
-
accWidth += chipWidth;
|
|
1350
|
-
}
|
|
1351
|
-
// Use original width (before collapse/transforms)
|
|
1352
|
-
var origRect = this._animState.tabPositions.get(tab.panel.id);
|
|
1353
|
-
var tabWidth = origRect
|
|
1354
|
-
? origRect.width
|
|
1355
|
-
: tab.element.getBoundingClientRect().width;
|
|
1356
|
-
// Shift at the midpoint: a tab moves left once the drag image
|
|
1357
|
-
// covers half of it (like Chrome's tab drag behavior).
|
|
1358
|
-
if (accWidth + tabWidth / 2 <= availableSpace) {
|
|
1359
|
-
accWidth += tabWidth;
|
|
1360
|
-
insertionIndex = i + 1;
|
|
1361
|
-
}
|
|
1362
|
-
else {
|
|
1363
|
-
insertionIndex !== null && insertionIndex !== void 0 ? insertionIndex : (insertionIndex = i);
|
|
1364
|
-
break;
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
// Determine which tab group (if any) the insertion index falls within.
|
|
1368
|
-
//
|
|
1369
|
-
// We use snapshot-based positions (accWidth from the accumulation loop
|
|
1370
|
-
// above) to compute original chip boundaries. This avoids reading
|
|
1371
|
-
// getBoundingClientRect() on chips whose live position is shifted by
|
|
1372
|
-
// the drag gap margin, which caused oscillation / visual jumps.
|
|
1373
|
-
if (insertionIndex !== null &&
|
|
1374
|
-
this._tabGroupManager.chipRenderers.size > 0) {
|
|
1375
|
-
var isGroupDrag = !!this._animState.sourceTabGroupId;
|
|
1376
|
-
var tabGroups = this.group.model.getTabGroups();
|
|
1377
|
-
// Rebuild the accumulated width up to insertionIndex so we know
|
|
1378
|
-
// the original right edge of the chip (if any) that precedes it.
|
|
1379
|
-
// We walk exactly the same way as the accumulation loop above.
|
|
1380
|
-
var accUpTo = 0;
|
|
1381
|
-
for (var i = 0; i < this._tabs.length; i++) {
|
|
1382
|
-
var tab = this._tabs[i].value;
|
|
1383
|
-
if (tab.panel.id === this._animState.sourceTabId) {
|
|
1384
|
-
continue;
|
|
1385
|
-
}
|
|
1386
|
-
if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) {
|
|
1387
|
-
continue;
|
|
1388
|
-
}
|
|
1389
|
-
if (i >= insertionIndex) {
|
|
1390
|
-
break;
|
|
1391
|
-
}
|
|
1392
|
-
var gid = firstPanelToGroup.get(tab.panel.id);
|
|
1393
|
-
if (gid) {
|
|
1394
|
-
accUpTo += (_d = this._animState.chipPositions.get(gid)) !== null && _d !== void 0 ? _d : 0;
|
|
1395
|
-
}
|
|
1396
|
-
var origRect = this._animState.tabPositions.get(tab.panel.id);
|
|
1397
|
-
accUpTo += origRect
|
|
1398
|
-
? origRect.width
|
|
1399
|
-
: tab.element.getBoundingClientRect().width;
|
|
1400
|
-
}
|
|
1401
|
-
var _loop_1 = function (tg) {
|
|
1402
|
-
// Build effective panel list: exclude the source tab
|
|
1403
|
-
// so that dragging a tab out of its own group doesn't
|
|
1404
|
-
// inflate the group's index range.
|
|
1405
|
-
var effectivePanelIds = tg.panelIds.filter(function (pid) {
|
|
1406
|
-
return pid !== _this._animState.sourceTabId &&
|
|
1407
|
-
!(sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(pid));
|
|
1408
|
-
});
|
|
1409
|
-
if (effectivePanelIds.length === 0) {
|
|
1410
|
-
return "continue";
|
|
1411
|
-
}
|
|
1412
|
-
var firstIdx = this_1._tabs.findIndex(function (t) { return t.value.panel.id === effectivePanelIds[0]; });
|
|
1413
|
-
var lastIdx = this_1._tabs.findIndex(function (t) {
|
|
1414
|
-
return t.value.panel.id ===
|
|
1415
|
-
effectivePanelIds[effectivePanelIds.length - 1];
|
|
1416
|
-
});
|
|
1417
|
-
if (firstIdx === -1 || lastIdx === -1) {
|
|
1418
|
-
return "continue";
|
|
1419
|
-
}
|
|
1420
|
-
var isInsideRange = insertionIndex >= firstIdx && insertionIndex <= lastIdx;
|
|
1421
|
-
var isJustBeforeGroup = !isInsideRange && insertionIndex === firstIdx - 1;
|
|
1422
|
-
if (!isInsideRange && !isJustBeforeGroup) {
|
|
1423
|
-
return "continue";
|
|
1424
|
-
}
|
|
1425
|
-
if (isGroupDrag && isInsideRange) {
|
|
1426
|
-
// A group cannot be dropped inside another group.
|
|
1427
|
-
// Snap the insertion index to just before or just
|
|
1428
|
-
// after this group based on cursor position relative
|
|
1429
|
-
// to the group's midpoint. Only applies when the
|
|
1430
|
-
// insertion would land *inside* the group — for
|
|
1431
|
-
// `isJustBeforeGroup`, the index is already outside
|
|
1432
|
-
// (immediately left of the group) and is a valid
|
|
1433
|
-
// drop position, so leave it untouched (issue #1264).
|
|
1434
|
-
var groupMid = (firstIdx + lastIdx + 1) / 2;
|
|
1435
|
-
if (insertionIndex < groupMid) {
|
|
1436
|
-
insertionIndex = firstIdx;
|
|
1437
|
-
}
|
|
1438
|
-
else {
|
|
1439
|
-
insertionIndex = lastIdx + 1;
|
|
1440
|
-
}
|
|
1441
|
-
return "break";
|
|
1442
|
-
}
|
|
1443
|
-
if (isGroupDrag && isJustBeforeGroup) {
|
|
1444
|
-
return "break";
|
|
1445
|
-
}
|
|
1446
|
-
if (isJustBeforeGroup) {
|
|
1447
|
-
// Check whether only the source tab (or source group
|
|
1448
|
-
// tabs) sits between insertionIndex and firstIdx.
|
|
1449
|
-
// If so, the source is being dragged away from that
|
|
1450
|
-
// slot, so we ARE effectively "just before" the group
|
|
1451
|
-
// and should still allow dropping into position 0.
|
|
1452
|
-
var allInBetweenAreSource = true;
|
|
1453
|
-
for (var j = insertionIndex; j < firstIdx; j++) {
|
|
1454
|
-
var pid = this_1._tabs[j].value.panel.id;
|
|
1455
|
-
if (pid !== this_1._animState.sourceTabId &&
|
|
1456
|
-
!(sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(pid))) {
|
|
1457
|
-
allInBetweenAreSource = false;
|
|
1458
|
-
break;
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
if (!allInBetweenAreSource) {
|
|
1462
|
-
return "continue";
|
|
1463
|
-
}
|
|
1464
|
-
var chipWidth = (_e = this_1._animState.chipPositions.get(tg.id)) !== null && _e !== void 0 ? _e : 0;
|
|
1465
|
-
var threshold = tg.collapsed
|
|
1466
|
-
? this_1._animState.containerLeft +
|
|
1467
|
-
accUpTo +
|
|
1468
|
-
chipWidth / 2
|
|
1469
|
-
: this_1._animState.containerLeft + accUpTo + chipWidth;
|
|
1470
|
-
if (mouseX >= threshold) {
|
|
1471
|
-
insertionIndex = firstIdx;
|
|
1472
|
-
targetTabGroupId = tg.id;
|
|
1473
|
-
}
|
|
1474
|
-
return "break";
|
|
1475
|
-
}
|
|
1476
|
-
if (isInsideRange) {
|
|
1477
|
-
var chipWidth = (_f = this_1._animState.chipPositions.get(tg.id)) !== null && _f !== void 0 ? _f : 0;
|
|
1478
|
-
var chipOriginalRight = this_1._animState.containerLeft + accUpTo + chipWidth;
|
|
1479
|
-
if (insertionIndex === firstIdx) {
|
|
1480
|
-
if (mouseX >= chipOriginalRight) {
|
|
1481
|
-
targetTabGroupId = tg.id;
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
else {
|
|
1485
|
-
targetTabGroupId = tg.id;
|
|
1486
|
-
}
|
|
1487
|
-
return "break";
|
|
1488
|
-
}
|
|
1489
|
-
};
|
|
1490
|
-
var this_1 = this;
|
|
1491
|
-
try {
|
|
1492
|
-
for (var tabGroups_3 = __values(tabGroups), tabGroups_3_1 = tabGroups_3.next(); !tabGroups_3_1.done; tabGroups_3_1 = tabGroups_3.next()) {
|
|
1493
|
-
var tg = tabGroups_3_1.value;
|
|
1494
|
-
var state_1 = _loop_1(tg);
|
|
1495
|
-
if (state_1 === "break")
|
|
1496
|
-
break;
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1500
|
-
finally {
|
|
1501
|
-
try {
|
|
1502
|
-
if (tabGroups_3_1 && !tabGroups_3_1.done && (_b = tabGroups_3.return)) _b.call(tabGroups_3);
|
|
1503
|
-
}
|
|
1504
|
-
finally { if (e_13) throw e_13.error; }
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
if (insertionIndex === this._animState.currentInsertionIndex &&
|
|
1508
|
-
targetTabGroupId === this._animState.targetTabGroupId) {
|
|
1509
|
-
return;
|
|
1510
|
-
}
|
|
1511
|
-
this._animState.currentInsertionIndex = insertionIndex;
|
|
1512
|
-
this._animState.targetTabGroupId = targetTabGroupId;
|
|
1513
|
-
if (((_g = this.accessor.options.theme) === null || _g === void 0 ? void 0 : _g.tabAnimation) === 'smooth') {
|
|
1514
|
-
this.applyDragOverTransforms();
|
|
1515
|
-
}
|
|
1516
|
-
};
|
|
1517
|
-
/**
|
|
1518
|
-
* Batch-remove a CSS class from multiple elements instantly,
|
|
1519
|
-
* forcing only a single reflow for the entire batch.
|
|
1520
|
-
*/
|
|
1521
|
-
Tabs.prototype._removeClassInstantlyBatch = function (elements, cls) {
|
|
1522
|
-
var e_14, _a, e_15, _b;
|
|
1523
|
-
var affected = [];
|
|
1524
|
-
try {
|
|
1525
|
-
for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
|
|
1526
|
-
var el = elements_1_1.value;
|
|
1527
|
-
if (el.classList.contains(cls)) {
|
|
1528
|
-
el.style.transition = 'none';
|
|
1529
|
-
(0, dom_1.toggleClass)(el, cls, false);
|
|
1530
|
-
affected.push(el);
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1535
|
-
finally {
|
|
1536
|
-
try {
|
|
1537
|
-
if (elements_1_1 && !elements_1_1.done && (_a = elements_1.return)) _a.call(elements_1);
|
|
1538
|
-
}
|
|
1539
|
-
finally { if (e_14) throw e_14.error; }
|
|
1540
|
-
}
|
|
1541
|
-
if (affected.length > 0) {
|
|
1542
|
-
void affected[0].offsetHeight; // single reflow for entire batch
|
|
1543
|
-
try {
|
|
1544
|
-
for (var affected_1 = __values(affected), affected_1_1 = affected_1.next(); !affected_1_1.done; affected_1_1 = affected_1.next()) {
|
|
1545
|
-
var el = affected_1_1.value;
|
|
1546
|
-
el.style.removeProperty('transition');
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1550
|
-
finally {
|
|
1551
|
-
try {
|
|
1552
|
-
if (affected_1_1 && !affected_1_1.done && (_b = affected_1.return)) _b.call(affected_1);
|
|
1553
|
-
}
|
|
1554
|
-
finally { if (e_15) throw e_15.error; }
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
};
|
|
1558
|
-
/**
|
|
1559
|
-
* Remove `dv-tab--dragging` from the source tab instantly so it
|
|
1560
|
-
* regains its real width before FLIP snapshots.
|
|
1561
|
-
*/
|
|
1562
|
-
Tabs.prototype._uncollapsSourceTab = function (sourceTabId) {
|
|
1563
|
-
var entry = this._tabMap.get(sourceTabId);
|
|
1564
|
-
if (entry) {
|
|
1565
|
-
this._removeClassInstantlyBatch([entry.value.element], 'dv-tab--dragging');
|
|
1566
|
-
}
|
|
1567
|
-
};
|
|
1568
|
-
Tabs.prototype.applyDragOverTransforms = function (skipTransition) {
|
|
1569
|
-
var e_16, _a, e_17, _b;
|
|
1570
|
-
var _this = this;
|
|
1571
|
-
if (skipTransition === void 0) { skipTransition = false; }
|
|
1572
|
-
if (!this._animState ||
|
|
1573
|
-
this._animState.currentInsertionIndex === null) {
|
|
1574
|
-
this.resetTabTransforms();
|
|
1575
|
-
return;
|
|
1576
|
-
}
|
|
1577
|
-
// Don't apply transforms until the source tab has been collapsed
|
|
1578
|
-
// in the rAF callback — otherwise the gap + visible source = jump.
|
|
1579
|
-
if (this._pendingCollapse) {
|
|
1580
|
-
return;
|
|
1581
|
-
}
|
|
1582
|
-
var insertionIndex = this._animState.currentInsertionIndex;
|
|
1583
|
-
// For group drags, gap = sum of all group member widths
|
|
1584
|
-
var gapWidth;
|
|
1585
|
-
var sourceGroupPanelIds = this._animState.sourceGroupPanelIds;
|
|
1586
|
-
if (this._animState.sourceTabGroupId && sourceGroupPanelIds) {
|
|
1587
|
-
gapWidth = this._animState.sourceGapWidth;
|
|
1588
|
-
}
|
|
1589
|
-
else {
|
|
1590
|
-
var sourceRect = this._animState.tabPositions.get(this._animState.sourceTabId);
|
|
1591
|
-
gapWidth = sourceRect
|
|
1592
|
-
? sourceRect.width
|
|
1593
|
-
: this.getAverageTabWidth();
|
|
1594
|
-
}
|
|
1595
|
-
// When the insertion lands at or before a group's first tab, shift
|
|
1596
|
-
// the chip so the gap appears before the entire group.
|
|
1597
|
-
//
|
|
1598
|
-
// Two cases:
|
|
1599
|
-
// 1. targetTabGroupId is null (standalone drop) — always shift chip.
|
|
1600
|
-
// 2. targetTabGroupId is set AND the group is collapsed — shift chip
|
|
1601
|
-
// because the collapsed tabs are invisible, so putting the gap on
|
|
1602
|
-
// them has no visual effect.
|
|
1603
|
-
var chipToShift = null;
|
|
1604
|
-
if (this._tabGroupManager.chipRenderers.size > 0) {
|
|
1605
|
-
var tabGroups = this.group.model.getTabGroups();
|
|
1606
|
-
var _loop_2 = function (tg) {
|
|
1607
|
-
if (tg.id === this_2._animState.sourceTabGroupId)
|
|
1608
|
-
return "continue";
|
|
1609
|
-
// Skip the group that the dragged tab belongs to — the
|
|
1610
|
-
// gap should appear after the chip (where the tab was),
|
|
1611
|
-
// not before it.
|
|
1612
|
-
if (tg.panelIds.includes(this_2._animState.sourceTabId))
|
|
1613
|
-
return "continue";
|
|
1614
|
-
var effectivePids = tg.panelIds.filter(function (pid) {
|
|
1615
|
-
return pid !== _this._animState.sourceTabId &&
|
|
1616
|
-
!(sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(pid));
|
|
1617
|
-
});
|
|
1618
|
-
if (effectivePids.length === 0)
|
|
1619
|
-
return "continue";
|
|
1620
|
-
var firstIdx = this_2._tabs.findIndex(function (t) { return t.value.panel.id === effectivePids[0]; });
|
|
1621
|
-
// Only consider chip-shifting when dropping outside the
|
|
1622
|
-
// group, or when dropping inside a collapsed group (whose
|
|
1623
|
-
// tabs are invisible).
|
|
1624
|
-
var shouldShiftChip = !this_2._animState.targetTabGroupId ||
|
|
1625
|
-
(this_2._animState.targetTabGroupId === tg.id &&
|
|
1626
|
-
tg.collapsed);
|
|
1627
|
-
if (!shouldShiftChip)
|
|
1628
|
-
return "continue";
|
|
1629
|
-
if (firstIdx >= insertionIndex) {
|
|
1630
|
-
var hasTabs = false;
|
|
1631
|
-
for (var j = insertionIndex; j < firstIdx; j++) {
|
|
1632
|
-
var pid = this_2._tabs[j].value.panel.id;
|
|
1633
|
-
if (pid === this_2._animState.sourceTabId)
|
|
1634
|
-
continue;
|
|
1635
|
-
if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(pid))
|
|
1636
|
-
continue;
|
|
1637
|
-
hasTabs = true;
|
|
1638
|
-
break;
|
|
1639
|
-
}
|
|
1640
|
-
if (!hasTabs) {
|
|
1641
|
-
var chipEntry = this_2._tabGroupManager.chipRenderers.get(tg.id);
|
|
1642
|
-
if (chipEntry) {
|
|
1643
|
-
chipToShift = chipEntry.chip.element;
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
return "break";
|
|
1647
|
-
}
|
|
1648
|
-
};
|
|
1649
|
-
var this_2 = this;
|
|
1650
|
-
try {
|
|
1651
|
-
for (var tabGroups_4 = __values(tabGroups), tabGroups_4_1 = tabGroups_4.next(); !tabGroups_4_1.done; tabGroups_4_1 = tabGroups_4.next()) {
|
|
1652
|
-
var tg = tabGroups_4_1.value;
|
|
1653
|
-
var state_2 = _loop_2(tg);
|
|
1654
|
-
if (state_2 === "break")
|
|
1655
|
-
break;
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
1659
|
-
finally {
|
|
1660
|
-
try {
|
|
1661
|
-
if (tabGroups_4_1 && !tabGroups_4_1.done && (_a = tabGroups_4.return)) _a.call(tabGroups_4);
|
|
1662
|
-
}
|
|
1663
|
-
finally { if (e_16) throw e_16.error; }
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
// Helper: pick the correct shifting class for tabs vs chips.
|
|
1667
|
-
var shiftingClass = function (el) {
|
|
1668
|
-
return el.classList.contains('dv-tab-group-chip')
|
|
1669
|
-
? 'dv-tab-group-chip--shifting'
|
|
1670
|
-
: 'dv-tab--shifting';
|
|
1671
|
-
};
|
|
1672
|
-
// Helper: apply a margin-left value to an element, optionally
|
|
1673
|
-
// bypassing CSS transitions for instant positioning.
|
|
1674
|
-
var setMargin = function (el, value) {
|
|
1675
|
-
if (skipTransition) {
|
|
1676
|
-
el.style.transition = 'none';
|
|
1677
|
-
el.style.marginLeft = value;
|
|
1678
|
-
void el.offsetHeight;
|
|
1679
|
-
el.style.removeProperty('transition');
|
|
1680
|
-
}
|
|
1681
|
-
else {
|
|
1682
|
-
el.style.marginLeft = value;
|
|
1683
|
-
}
|
|
1684
|
-
(0, dom_1.toggleClass)(el, shiftingClass(el), true);
|
|
1685
|
-
};
|
|
1686
|
-
var clearMargin = function (el) {
|
|
1687
|
-
var cls = shiftingClass(el);
|
|
1688
|
-
// Remove any previous pending listener for this element
|
|
1689
|
-
var prev = _this._pendingMarginCleanups.get(el);
|
|
1690
|
-
if (prev) {
|
|
1691
|
-
prev();
|
|
1692
|
-
}
|
|
1693
|
-
if (skipTransition || !el.style.marginLeft) {
|
|
1694
|
-
el.style.removeProperty('margin-left');
|
|
1695
|
-
(0, dom_1.toggleClass)(el, cls, false);
|
|
1696
|
-
}
|
|
1697
|
-
else {
|
|
1698
|
-
el.style.marginLeft = '0px';
|
|
1699
|
-
(0, dom_1.toggleClass)(el, cls, true);
|
|
1700
|
-
var onEnd_1 = function () {
|
|
1701
|
-
el.style.removeProperty('margin-left');
|
|
1702
|
-
(0, dom_1.toggleClass)(el, cls, false);
|
|
1703
|
-
el.removeEventListener('transitionend', onEnd_1);
|
|
1704
|
-
clearTimeout(fallbackTimer_1);
|
|
1705
|
-
_this._pendingMarginCleanups.delete(el);
|
|
1706
|
-
};
|
|
1707
|
-
// Fallback in case transitionend never fires
|
|
1708
|
-
// (e.g. element removed from DOM mid-transition)
|
|
1709
|
-
var fallbackTimer_1 = setTimeout(onEnd_1, 300);
|
|
1710
|
-
_this._pendingMarginCleanups.set(el, onEnd_1);
|
|
1711
|
-
el.addEventListener('transitionend', onEnd_1);
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
|
-
var gapApplied = false;
|
|
1715
|
-
try {
|
|
1716
|
-
// Reset all non-source chip margins first
|
|
1717
|
-
for (var _c = __values(this._tabGroupManager.chipRenderers), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1718
|
-
var _e = __read(_d.value, 2), groupId = _e[0], entry = _e[1];
|
|
1719
|
-
if (groupId === this._animState.sourceTabGroupId)
|
|
1720
|
-
continue;
|
|
1721
|
-
clearMargin(entry.chip.element);
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1725
|
-
finally {
|
|
1726
|
-
try {
|
|
1727
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1728
|
-
}
|
|
1729
|
-
finally { if (e_17) throw e_17.error; }
|
|
1730
|
-
}
|
|
1731
|
-
// Apply gap to chip if insertion is before a group
|
|
1732
|
-
if (chipToShift) {
|
|
1733
|
-
setMargin(chipToShift, "".concat(gapWidth, "px"));
|
|
1734
|
-
gapApplied = true;
|
|
1735
|
-
}
|
|
1736
|
-
for (var i = 0; i < this._tabs.length; i++) {
|
|
1737
|
-
var tab = this._tabs[i].value;
|
|
1738
|
-
if (tab.panel.id === this._animState.sourceTabId) {
|
|
1739
|
-
continue;
|
|
1740
|
-
}
|
|
1741
|
-
if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) {
|
|
1742
|
-
continue;
|
|
1743
|
-
}
|
|
1744
|
-
if (!gapApplied && i >= insertionIndex) {
|
|
1745
|
-
setMargin(tab.element, "".concat(gapWidth, "px"));
|
|
1746
|
-
gapApplied = true;
|
|
1747
|
-
}
|
|
1748
|
-
else {
|
|
1749
|
-
clearMargin(tab.element);
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
// Reposition underlines to follow shifted chips/tabs
|
|
1753
|
-
this._tabGroupManager.trackUnderlines();
|
|
1754
|
-
};
|
|
1755
|
-
Tabs.prototype.resetTabTransforms = function () {
|
|
1756
|
-
var e_18, _a, e_19, _b, e_20, _c;
|
|
1757
|
-
try {
|
|
1758
|
-
// Cancel any pending margin transitionend listeners
|
|
1759
|
-
for (var _d = __values(this._pendingMarginCleanups), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1760
|
-
var _f = __read(_e.value, 2), cleanup = _f[1];
|
|
1761
|
-
cleanup();
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1765
|
-
finally {
|
|
1766
|
-
try {
|
|
1767
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1768
|
-
}
|
|
1769
|
-
finally { if (e_18) throw e_18.error; }
|
|
1770
|
-
}
|
|
1771
|
-
this._pendingMarginCleanups.clear();
|
|
1772
|
-
try {
|
|
1773
|
-
for (var _g = __values(this._tabs), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1774
|
-
var tab = _h.value;
|
|
1775
|
-
tab.value.element.style.removeProperty('margin-left');
|
|
1776
|
-
tab.value.element.style.removeProperty('margin-right');
|
|
1777
|
-
tab.value.element.style.removeProperty('margin-top');
|
|
1778
|
-
tab.value.element.style.removeProperty('margin-bottom');
|
|
1779
|
-
tab.value.element.style.removeProperty('transform');
|
|
1780
|
-
(0, dom_1.toggleClass)(tab.value.element, 'dv-tab--shifting', false);
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
1784
|
-
finally {
|
|
1785
|
-
try {
|
|
1786
|
-
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
1787
|
-
}
|
|
1788
|
-
finally { if (e_19) throw e_19.error; }
|
|
1789
|
-
}
|
|
1790
|
-
try {
|
|
1791
|
-
for (var _j = __values(this._tabGroupManager.chipRenderers), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1792
|
-
var _l = __read(_k.value, 2), entry = _l[1];
|
|
1793
|
-
entry.chip.element.style.removeProperty('margin-left');
|
|
1794
|
-
(0, dom_1.toggleClass)(entry.chip.element, 'dv-tab-group-chip--shifting', false);
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
1798
|
-
finally {
|
|
1799
|
-
try {
|
|
1800
|
-
if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
|
|
1801
|
-
}
|
|
1802
|
-
finally { if (e_20) throw e_20.error; }
|
|
1803
|
-
}
|
|
1804
|
-
this._tabGroupManager.positionUnderlines();
|
|
1805
|
-
};
|
|
1806
|
-
/**
|
|
1807
|
-
* Commit a group-drag drop: clear drag classes, move the group
|
|
1808
|
-
* in the model, and run a FLIP animation.
|
|
1809
|
-
*/
|
|
1810
|
-
Tabs.prototype._commitGroupMove = function (sourceTabGroupId, insertionIndex) {
|
|
1811
|
-
var _a, _b;
|
|
1812
|
-
// Read transfer data first.
|
|
1813
|
-
var data = (0, dataTransfer_1.getPanelData)();
|
|
1814
|
-
// Synchronously dispose the source chip's drag sources, which
|
|
1815
|
-
// clears the panelTransfer payload + iframe shield. Cross-group
|
|
1816
|
-
// moves dissolve the source chip on a microtask, which is too
|
|
1817
|
-
// late: a synchronous `getPanelData()` after this method (or any
|
|
1818
|
-
// sibling dragover handler firing in the same tick) would
|
|
1819
|
-
// otherwise see stale data still referencing the old tabGroupId.
|
|
1820
|
-
this._tabGroupManager.disposeChipDrag(sourceTabGroupId);
|
|
1821
|
-
// Check if the tab group exists in this group (within-group reorder)
|
|
1822
|
-
// or in another group (cross-group move).
|
|
1823
|
-
var isLocal = this.group.model
|
|
1824
|
-
.getTabGroups()
|
|
1825
|
-
.some(function (tg) { return tg.id === sourceTabGroupId; });
|
|
1826
|
-
if (isLocal) {
|
|
1827
|
-
if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {
|
|
1828
|
-
this._clearGroupDragClasses(sourceTabGroupId);
|
|
1829
|
-
var firstPositions = this.snapshotTabPositions();
|
|
1830
|
-
this.resetTabTransforms();
|
|
1831
|
-
this.group.model.moveTabGroup(sourceTabGroupId, insertionIndex);
|
|
1832
|
-
this.runFlipAnimation(firstPositions, '', false);
|
|
1833
|
-
}
|
|
1834
|
-
else {
|
|
1835
|
-
this._tabGroupManager.skipNextCollapseAnimation = true;
|
|
1836
|
-
this.group.model.moveTabGroup(sourceTabGroupId, insertionIndex);
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
else if (data) {
|
|
1840
|
-
// Cross-group: delegate to the component-level move which
|
|
1841
|
-
// handles panel transfer and tab group recreation.
|
|
1842
|
-
// Use the REAL tab group ID from transfer data, not the
|
|
1843
|
-
// potentially stale one from _animState.
|
|
1844
|
-
//
|
|
1845
|
-
// Clear any inline gap margin / shifting class applied to
|
|
1846
|
-
// destination tabs during dragover. Cross-group moves don't
|
|
1847
|
-
// run the FLIP path, and `moveGroupOrPanel` only inserts new
|
|
1848
|
-
// panels — it doesn't recreate existing destination tabs, so
|
|
1849
|
-
// their inline `margin-left` would otherwise persist as a
|
|
1850
|
-
// visible gap (issue #1243).
|
|
1851
|
-
this.resetTabTransforms();
|
|
1852
|
-
this.accessor.moveGroupOrPanel({
|
|
1853
|
-
from: {
|
|
1854
|
-
groupId: data.groupId,
|
|
1855
|
-
tabGroupId: (_b = data.tabGroupId) !== null && _b !== void 0 ? _b : sourceTabGroupId,
|
|
1856
|
-
},
|
|
1857
|
-
to: {
|
|
1858
|
-
group: this.group,
|
|
1859
|
-
position: 'center',
|
|
1860
|
-
index: insertionIndex,
|
|
1861
|
-
},
|
|
1862
|
-
});
|
|
1863
|
-
}
|
|
1864
|
-
};
|
|
1865
|
-
Tabs.prototype._clearGroupDragClasses = function (sourceTabGroupId) {
|
|
1866
|
-
var chipEntry = this._tabGroupManager.chipRenderers.get(sourceTabGroupId);
|
|
1867
|
-
if (chipEntry) {
|
|
1868
|
-
this._removeClassInstantlyBatch([chipEntry.chip.element], 'dv-tab-group-chip--dragging');
|
|
1869
|
-
}
|
|
1870
|
-
this._removeClassInstantlyBatch(this._tabs.map(function (t) { return t.value.element; }), 'dv-tab--dragging');
|
|
1871
|
-
// Restore underline
|
|
1872
|
-
var underline = this._tabGroupManager.groupUnderlines.get(sourceTabGroupId);
|
|
1873
|
-
if (underline) {
|
|
1874
|
-
underline.style.removeProperty('display');
|
|
1875
|
-
}
|
|
1876
|
-
// The subsequent moveTabGroup will re-create tabs and call
|
|
1877
|
-
// updateTabGroups → _updateTabGroupClasses. For collapsed groups
|
|
1878
|
-
// the new tabs don't have dv-tab--group-collapsed yet, which
|
|
1879
|
-
// would trigger the collapse animation. Skip it.
|
|
1880
|
-
this._tabGroupManager.skipNextCollapseAnimation = true;
|
|
1881
|
-
};
|
|
1882
|
-
Tabs.prototype.resetDragAnimation = function () {
|
|
1883
|
-
var e_21, _a;
|
|
1884
|
-
this._pendingCollapse = false;
|
|
1885
|
-
// After a drop, `tab.onDrop` consumes _animState (sets it to null)
|
|
1886
|
-
// and immediately calls `runFlipAnimation`, which sets transforms
|
|
1887
|
-
// and queues an rAF to trigger the CSS transition. dragend fires
|
|
1888
|
-
// synchronously on the source element BEFORE that rAF runs — if
|
|
1889
|
-
// we cleared transforms here we'd clobber the in-flight FLIP, so
|
|
1890
|
-
// gate the cleanup on _animState still being set (i.e. drag was
|
|
1891
|
-
// cancelled rather than dropped).
|
|
1892
|
-
if (this._animState) {
|
|
1893
|
-
this.resetTabTransforms();
|
|
1894
|
-
if (this._animState.sourceTabGroupId) {
|
|
1895
|
-
this._clearGroupDragClasses(this._animState.sourceTabGroupId);
|
|
1896
|
-
}
|
|
1897
|
-
else {
|
|
1898
|
-
this._removeClassInstantlyBatch(this._tabs.map(function (t) { return t.value.element; }), 'dv-tab--dragging');
|
|
1899
|
-
}
|
|
1900
|
-
this._animState = null;
|
|
1901
|
-
try {
|
|
1902
|
-
// Restore any hidden underlines from group drags.
|
|
1903
|
-
for (var _b = __values(this._tabGroupManager.groupUnderlines), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1904
|
-
var _d = __read(_c.value, 2), el = _d[1];
|
|
1905
|
-
el.style.removeProperty('display');
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
1909
|
-
finally {
|
|
1910
|
-
try {
|
|
1911
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1912
|
-
}
|
|
1913
|
-
finally { if (e_21) throw e_21.error; }
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
};
|
|
1917
|
-
Tabs.prototype.runFlipAnimation = function (firstPositions, sourceTabId, isCrossGroup, animRange) {
|
|
1918
|
-
var _this = this;
|
|
1919
|
-
if (isCrossGroup === void 0) { isCrossGroup = false; }
|
|
1920
|
-
var isVertical = this._direction === 'vertical';
|
|
1921
|
-
var hasAnimation = false;
|
|
1922
|
-
for (var i = 0; i < this._tabs.length; i++) {
|
|
1923
|
-
var tab = this._tabs[i];
|
|
1924
|
-
var panelId = tab.value.panel.id;
|
|
1925
|
-
if (panelId === sourceTabId) {
|
|
1926
|
-
if (isCrossGroup) {
|
|
1927
|
-
// Newly inserted tab: slide in from the end
|
|
1928
|
-
var rect = tab.value.element.getBoundingClientRect();
|
|
1929
|
-
tab.value.element.style.transform = isVertical
|
|
1930
|
-
? "translateY(".concat(rect.height, "px)")
|
|
1931
|
-
: "translateX(".concat(rect.width, "px)");
|
|
1932
|
-
(0, dom_1.toggleClass)(tab.value.element, 'dv-tab--shifting', true);
|
|
1933
|
-
hasAnimation = true;
|
|
1934
|
-
}
|
|
1935
|
-
continue;
|
|
1936
|
-
}
|
|
1937
|
-
// Skip tabs outside the affected range (they don't logically move)
|
|
1938
|
-
if (animRange !== undefined &&
|
|
1939
|
-
(i < animRange.from || i > animRange.to)) {
|
|
1940
|
-
continue;
|
|
1941
|
-
}
|
|
1942
|
-
var firstRect = firstPositions.get(panelId);
|
|
1943
|
-
if (!firstRect) {
|
|
1944
|
-
continue;
|
|
1945
|
-
}
|
|
1946
|
-
var lastRect = tab.value.element.getBoundingClientRect();
|
|
1947
|
-
var delta = isVertical
|
|
1948
|
-
? firstRect.top - lastRect.top
|
|
1949
|
-
: firstRect.left - lastRect.left;
|
|
1950
|
-
if (Math.abs(delta) < 1) {
|
|
1951
|
-
continue;
|
|
1952
|
-
}
|
|
1953
|
-
tab.value.element.style.transform = isVertical
|
|
1954
|
-
? "translateY(".concat(delta, "px)")
|
|
1955
|
-
: "translateX(".concat(delta, "px)");
|
|
1956
|
-
(0, dom_1.toggleClass)(tab.value.element, 'dv-tab--shifting', true);
|
|
1957
|
-
hasAnimation = true;
|
|
1958
|
-
}
|
|
1959
|
-
if (!hasAnimation) {
|
|
1960
|
-
return;
|
|
1961
|
-
}
|
|
1962
|
-
requestAnimationFrame(function () {
|
|
1963
|
-
var e_22, _a;
|
|
1964
|
-
var _b;
|
|
1965
|
-
try {
|
|
1966
|
-
for (var _c = __values(_this._tabs), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1967
|
-
var tab = _d.value;
|
|
1968
|
-
if (tab.value.element.style.transform) {
|
|
1969
|
-
tab.value.element.style.transform = '';
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1974
|
-
finally {
|
|
1975
|
-
try {
|
|
1976
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1977
|
-
}
|
|
1978
|
-
finally { if (e_22) throw e_22.error; }
|
|
1979
|
-
}
|
|
1980
|
-
// Track underlines during the FLIP transition so they
|
|
1981
|
-
// follow tabs as they slide to their final positions.
|
|
1982
|
-
_this._tabGroupManager.trackUnderlines();
|
|
1983
|
-
// Clean up any previous flip transition listener
|
|
1984
|
-
(_b = _this._flipTransitionCleanup) === null || _b === void 0 ? void 0 : _b.call(_this);
|
|
1985
|
-
var onTransitionEnd = function (event) {
|
|
1986
|
-
var e_23, _a;
|
|
1987
|
-
if (event.propertyName === 'transform') {
|
|
1988
|
-
cleanup();
|
|
1989
|
-
try {
|
|
1990
|
-
for (var _b = __values(_this._tabs), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1991
|
-
var tab = _c.value;
|
|
1992
|
-
(0, dom_1.toggleClass)(tab.value.element, 'dv-tab--shifting', false);
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
1996
|
-
finally {
|
|
1997
|
-
try {
|
|
1998
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1999
|
-
}
|
|
2000
|
-
finally { if (e_23) throw e_23.error; }
|
|
2001
|
-
}
|
|
2002
|
-
// Final reposition after animation settles
|
|
2003
|
-
_this._tabGroupManager.positionUnderlines();
|
|
2004
|
-
}
|
|
2005
|
-
};
|
|
2006
|
-
var cleanup = function () {
|
|
2007
|
-
_this._tabsList.removeEventListener('transitionend', onTransitionEnd);
|
|
2008
|
-
_this._flipTransitionCleanup = null;
|
|
2009
|
-
};
|
|
2010
|
-
_this._flipTransitionCleanup = cleanup;
|
|
2011
|
-
_this._tabsList.addEventListener('transitionend', onTransitionEnd);
|
|
2012
|
-
});
|
|
2013
|
-
};
|
|
2014
|
-
return Tabs;
|
|
2015
|
-
}(lifecycle_1.CompositeDisposable));
|
|
2016
|
-
exports.Tabs = Tabs;
|