{#each groupedTabs as tabGroup}
{#if !$lockedDatabaseMode}
{ if (e.button == 1) { closeMultipleTabs(tab => tabGroup.tabs.find(x => x.tabid == tab.tabid)); } else { 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 $connectionList?.find(x => x._id == tabGroup.tabs[0]?.props?.conid)?.isReadOnly} {/if}
closeMultipleTabs(tab => tabGroup.tabs.find(x => x.tabid == tab.tabid))} >
{/if}
{#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} {#if $lockedDatabaseMode && tab.props?.conid && tab.props?.conid != $currentDatabase?.connection?._id} {/if} closeTab(tab.tabid)} />
{/each}
{/each}
{#if allowSplitTab}
splitTab(multiTabIndex)} title="Split window">
{/if}
newQuery({})} title="New query">