dropdown menu implementation

This commit is contained in:
Jan Prochazka
2021-02-28 10:17:52 +01:00
parent e9430988f4
commit 2cc74b594e
7 changed files with 122 additions and 1 deletions

View File

@@ -25,6 +25,7 @@
import { currentDatabase, openedTabs } from '../stores';
import { setSelectedTab } from '../utility/common';
import contextMenu from '../utility/contextMenu';
$: currentDbKey =
$currentDatabase && $currentDatabase.name && $currentDatabase.connection
@@ -100,6 +101,13 @@
closeTab(tabid);
}
};
const tabContextMenu = tabid => () => [
{
text: 'Close',
onClick: () => closeTab(tabid),
},
];
</script>
{#each dbKeys as dbKey}
@@ -115,6 +123,7 @@
class:selected={tab.selected}
on:click={e => handleTabClick(e, tab.tabid)}
on:mouseup={e => handleMouseUp(e, tab.tabid)}
use:contextMenu={tabContextMenu(tab.tabid)}
>
<FontIcon icon={tab.busy ? 'icon loading' : tab.icon} />
<span class="file-name">