From e7ba5607eb040d9e0bc6fd6004f6ee30835ca512 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Sun, 15 Dec 2024 20:57:14 +0100 Subject: [PATCH] Lib: Add action field to dropdown component --- src/lib/components/Dropdown.svelte | 50 +++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/src/lib/components/Dropdown.svelte b/src/lib/components/Dropdown.svelte index 3ac03d5..33f28a4 100644 --- a/src/lib/components/Dropdown.svelte +++ b/src/lib/components/Dropdown.svelte @@ -1,9 +1,9 @@
@@ -66,13 +87,26 @@ > {@render children()}
- event.preventDefault()} - value={get_label(input_variable) ?? placeholder} - {...restProps} - /> + {#if action} + event.preventDefault()} + value={get_label(input_variable) ?? placeholder} + {...restProps} + /> + {:else} + event.preventDefault()} + value={get_label(input_variable) ?? placeholder} + {...restProps} + /> + {/if}