From 900bb5e845c3ad44defbd427cae3d44a4a43321f Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 25 Feb 2023 13:15:44 +0100 Subject: feat: Initial commit --- code/app/src/components/combobox.svelte | 451 ++++++++++++++++++++++++++++++++ 1 file changed, 451 insertions(+) create mode 100644 code/app/src/components/combobox.svelte (limited to 'code/app/src/components/combobox.svelte') diff --git a/code/app/src/components/combobox.svelte b/code/app/src/components/combobox.svelte new file mode 100644 index 0000000..396c18a --- /dev/null +++ b/code/app/src/components/combobox.svelte @@ -0,0 +1,451 @@ + + + + + + +
+ {#if label} + + {/if} +
+
+ {#if multiple === true && hasSelection} +
+ {#each options.filter((c) => c.selected === true) as option} + methods.deselect_entry(e.detail.id)} + text={option.name} + /> + {/each} +
+ {/if} +
+ search.do()} + on:click={search.on_input_click} + on:focus={search.on_input_focus} + on:blur={search.on_input_focusout} + autocomplete="off" + /> + {#if hasSelection} + + {:else} + + + + {/if} +
+
+ {#if errorText} +

+ {errorText} +

+ {/if} +
+
    + {#if searchResults.length > 0} + {#each searchResults.filter((c) => !c.selected) as result} +
  • + {@html highlight(result, '', "")} +
  • + {/each} + {:else if options.length > 0} + {#each options as option} + +
  • + {option.name} + {#if option.selected} + + + + {/if} +
  • + {/each} + {:else} + +

    {noResultsText}

    + {#if createable && !searchValue} +

    {$LL.combobox.createRecordHelpText()}

    + {/if} +
    + {/if} +
+ {#if showCreationHint} +
+
+ {/if} +
+
+
+ + -- cgit v1.3