diff --git a/packages/web/src/Screen.svelte b/packages/web/src/Screen.svelte index 16db06e1..db4ccb8b 100644 --- a/packages/web/src/Screen.svelte +++ b/packages/web/src/Screen.svelte @@ -25,18 +25,9 @@ import TitleBar from './widgets/TitleBar.svelte'; import { onMount } from 'svelte'; import { getTitleBarVisibility } from './utility/common'; - + $: currentThemeType = $currentThemeDefinition?.themeType == 'dark' ? 'theme-type-dark' : 'theme-type-light'; - let domTabs; - - function handleTabsWheel(e) { - if (!e.shiftKey) { - e.preventDefault(); - domTabs.scrollBy({ top: 0, left: e.deltaY < 0 ? -150 : 150, behavior: 'smooth' }); - } - } - $: themeStyle = ``; @@ -67,7 +58,7 @@ {/if} -
+
@@ -134,7 +125,6 @@ display: flex; } .tabs { - display: flex; position: fixed; top: var(--dim-header-top); left: var(--dim-content-left); @@ -142,8 +132,6 @@ right: 0; background-color: var(--theme-bg-1); border-top: 1px solid var(--theme-border); - - overflow-x: auto; } .tabs::-webkit-scrollbar { height: 7px; diff --git a/packages/web/src/widgets/TabsPanel.svelte b/packages/web/src/widgets/TabsPanel.svelte index 2f0202ce..b9535281 100644 --- a/packages/web/src/widgets/TabsPanel.svelte +++ b/packages/web/src/widgets/TabsPanel.svelte @@ -141,6 +141,7 @@ import FontIcon from '../icons/FontIcon.svelte'; import FavoriteModal from '../modals/FavoriteModal.svelte'; import { showModal } from '../modals/modalTools'; + import newQuery from '../query/newQuery'; import { currentDatabase, getActiveTab, getOpenedTabs, openedTabs, activeTabId, getActiveTabId } from '../stores'; import tabs from '../tabs'; @@ -307,95 +308,142 @@ }) ); } + + let domTabs; + + function handleTabsWheel(e) { + if (!e.shiftKey) { + e.preventDefault(); + domTabs.scrollBy({ top: 0, left: e.deltaY < 0 ? -150 : 150, behavior: 'smooth' }); + } + } -{#each groupedTabs as tabGroup} -
-
handleSetDb(tabGroup.tabs[0].props)} - use:contextMenu={getDatabaseContextMenu(tabGroup.tabs)} - style={$connectionColorFactory( - tabGroup.tabs[0].props, - (draggingDbGroup ? tabGroup.grpid == draggingDbGroupTarget?.grpid : tabGroup.tabDbKey == currentDbKey) ? 2 : 3 - )} - draggable={true} - on:dragstart={e => { - draggingDbGroup = tabGroup; - }} - on:dragenter={e => { - draggingDbGroupTarget = tabGroup; - }} - on:drop={e => { - dragDropTabs(draggingDbGroup.tabs, tabGroup.tabs); - }} - on:dragend={e => { - draggingDbGroup = null; - draggingDbGroupTarget = null; - }} - > - - {tabGroup.tabDbName} - - {#if tabGroup.tabs.length > 1} - closeMultipleTabs(tab => tabGroup.tabs.find(x => x.tabid == tab.tabid))} - > - - - {/if} -
-
- {#each tabGroup.tabs as tab} +
+
+ {#each groupedTabs as tabGroup} +
handleTabClick(e, tab.tabid)} - on:mouseup={e => handleMouseUp(e, tab.tabid)} - use:contextMenu={getContextMenu(tab)} + class="db-name" + class:selected={draggingDbGroup + ? tabGroup.grpid == draggingDbGroupTarget?.grpid + : tabGroup.tabDbKey == currentDbKey} + on:click={() => handleSetDb(tabGroup.tabs[0].props)} + use:contextMenu={getDatabaseContextMenu(tabGroup.tabs)} + style={$connectionColorFactory( + tabGroup.tabs[0].props, + (draggingDbGroup ? tabGroup.grpid == draggingDbGroupTarget?.grpid : tabGroup.tabDbKey == currentDbKey) + ? 2 + : 3 + )} draggable={true} - on:dragstart={async e => { - draggingTab = tab; - await tick(); - setSelectedTab(tab.tabid); - // console.log('START', tab.tabid); - // e.dataTransfer.setData('tab_drag_data', tab.tabid); + on:dragstart={e => { + draggingDbGroup = tabGroup; }} on:dragenter={e => { - draggingTabTarget = tab; + draggingDbGroupTarget = tabGroup; }} on:drop={e => { - if (draggingTab) { - dragDropTabs([draggingTab], [tab]); - } - if (draggingDbGroup) { - dragDropTabs(draggingDbGroup.tabs, [tab]); - } + dragDropTabs(draggingDbGroup.tabs, tabGroup.tabs); }} on:dragend={e => { - draggingTab = null; - draggingTabTarget = null; + draggingDbGroup = null; + draggingDbGroupTarget = null; }} > - - - {tab.title} - - closeTab(tab.tabid)}> - - + + {tabGroup.tabDbName} + + {#if tabGroup.tabs.length > 1} + closeMultipleTabs(tab => tabGroup.tabs.find(x => x.tabid == tab.tabid))} + > + + + {/if}
- {/each} -
+
+ {#each tabGroup.tabs as tab} +
handleTabClick(e, tab.tabid)} + on:mouseup={e => handleMouseUp(e, tab.tabid)} + use:contextMenu={getContextMenu(tab)} + draggable={true} + on:dragstart={async e => { + draggingTab = tab; + await tick(); + setSelectedTab(tab.tabid); + // console.log('START', tab.tabid); + // e.dataTransfer.setData('tab_drag_data', tab.tabid); + }} + on:dragenter={e => { + draggingTabTarget = tab; + }} + on:drop={e => { + if (draggingTab) { + dragDropTabs([draggingTab], [tab]); + } + if (draggingDbGroup) { + dragDropTabs(draggingDbGroup.tabs, [tab]); + } + }} + on:dragend={e => { + draggingTab = null; + draggingTabTarget = null; + }} + > + + + {tab.title} + + closeTab(tab.tabid)}> + + +
+ {/each} +
+
+ {/each}
-{/each} +
newQuery({})} title="New query">
+