From 2a8313759a9c6125369697bbe8cf335214399df5 Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Fri, 22 Dec 2023 10:09:41 +0100 Subject: [PATCH] fix: #379 ContextMenu not closing after using a custom button via onRenderContextMenu --- .../controls/contextmenu/ContextMenu.svelte | 17 ++- .../contextmenu/ContextMenuButton.svelte | 6 +- .../ContextMenuDropDownButton.svelte | 6 +- .../contextmenu/TableContextMenu.svelte | 98 +++------------ .../contextmenu/TreeContextMenu.svelte | 114 +++--------------- 5 files changed, 57 insertions(+), 184 deletions(-) diff --git a/src/lib/components/controls/contextmenu/ContextMenu.svelte b/src/lib/components/controls/contextmenu/ContextMenu.svelte index 8913dee9..02406512 100644 --- a/src/lib/components/controls/contextmenu/ContextMenu.svelte +++ b/src/lib/components/controls/contextmenu/ContextMenu.svelte @@ -19,6 +19,7 @@ import ContextMenuDropDownButton from './ContextMenuDropDownButton.svelte' export let items: ContextMenuItem[] + export let onCloseContextMenu: () => void export let tip: string | undefined let refContextMenu: HTMLDivElement @@ -79,23 +80,27 @@ > {#each items as item} {#if isMenuButton(item)} - + {:else if isMenuDropDownButton(item)} - + {:else if isContextMenuRow(item)}
{#each item.items as rowItem} {#if isMenuButton(rowItem)} - + {:else if isMenuDropDownButton(rowItem)} - + {:else if isContextMenuColumn(rowItem)}
{#each rowItem.items as columnItem} {#if isMenuButton(columnItem)} - + {:else if isMenuDropDownButton(columnItem)} - + {:else if isMenuSeparator(columnItem)}
{:else if isMenuLabel(columnItem)} diff --git a/src/lib/components/controls/contextmenu/ContextMenuButton.svelte b/src/lib/components/controls/contextmenu/ContextMenuButton.svelte index ab21f35f..2cdbe383 100644 --- a/src/lib/components/controls/contextmenu/ContextMenuButton.svelte +++ b/src/lib/components/controls/contextmenu/ContextMenuButton.svelte @@ -5,12 +5,16 @@ export let item: MenuButton export let className: string | undefined = undefined + export let onCloseContextMenu: () => void