mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 13:26:00 +00:00
dropdown for default database
This commit is contained in:
@@ -7,21 +7,32 @@
|
||||
|
||||
export let icon = 'icon chevron-down';
|
||||
export let menu;
|
||||
export let asyncMenu = undefined;
|
||||
export let narrow = false;
|
||||
export let square = true;
|
||||
export let disabled = false;
|
||||
let domButton;
|
||||
|
||||
function handleClick() {
|
||||
let domButton;
|
||||
let isLoading = false;
|
||||
|
||||
async function handleClick() {
|
||||
if (disabled) return;
|
||||
|
||||
let items = menu;
|
||||
|
||||
if (asyncMenu) {
|
||||
isLoading = true;
|
||||
items = await asyncMenu();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
const rect = domButton.getBoundingClientRect();
|
||||
const left = rect.left;
|
||||
const top = rect.bottom;
|
||||
currentDropDownMenu.set({ left, top, items: menu });
|
||||
currentDropDownMenu.set({ left, top, items });
|
||||
}
|
||||
</script>
|
||||
|
||||
<InlineButton {square} {narrow} on:click={handleClick} bind:this={domButton} {disabled}>
|
||||
<FontIcon {icon} />
|
||||
<FontIcon icon={isLoading ? 'icon loading' : icon} />
|
||||
</InlineButton>
|
||||
|
||||
Reference in New Issue
Block a user