{
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, multiTabIndex);
}}
on:dragend={e => {
$draggingDbGroup = null;
$draggingDbGroupTarget = null;
}}
>
{#if $settings?.['tabGroup.showServerName'] && tabGroup.tabDbServer}
{tabGroup.tabDbServer}
{/if}
{tabGroup.tabDbName}
{#if $connectionList?.find(x => x._id == tabGroup.tabs[0]?.props?.conid)?.isReadOnly}
{/if}
{#each tabGroup.tabs as tab}
handleTabClick(e, tab.tabid)}
on:mousedown={e => handleMouseDown(e, tab.tabid)}
on:mouseup={e => handleMouseUp(e, tab.tabid)}
on:dblclick={e => handleDoubleClick(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], multiTabIndex);
}
if ($draggingDbGroup) {
dragDropTabs($draggingDbGroup.tabs, [tab], multiTabIndex);
}
}}
on:dragend={e => {
$draggingTab = null;
$draggingTabTarget = null;
}}
>
{#if tab.tabPreviewMode}
pinTab(tab.tabid)}
title="This tab is in preview mode, it will be replaced eg. when clicking table. Click to switch to normal mode. You could also double-click tab header."
>
{/if}
{tab.title}
{#if $lockedDatabaseMode && tab.props?.conid && tab.props?.conid != $currentDatabase?.connection?._id}
{/if}
closeTab(tab.tabid)} />
{/each}