{#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, multiTabIndex);
}}
on:dragend={e => {
$draggingDbGroup = null;
$draggingDbGroupTarget = null;
}}
>
{tabGroup.tabDbName}
{#if $connectionList?.find(x => x._id == tabGroup.tabs[0]?.props?.conid)?.isReadOnly}
{/if}
{/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], multiTabIndex);
}
if ($draggingDbGroup) {
dragDropTabs($draggingDbGroup.tabs, [tab], multiTabIndex);
}
}}
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}