From 0825788e86809f10bb83d664084328dff0b47146 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 15 Oct 2022 16:40:01 +0800 Subject: feat: Add combobox and textarea --- code/app/src/lib/components/combobox.svelte | 443 ++++++++++++++++++++++++++++ 1 file changed, 443 insertions(+) create mode 100644 code/app/src/lib/components/combobox.svelte (limited to 'code/app/src/lib/components/combobox.svelte') diff --git a/code/app/src/lib/components/combobox.svelte b/code/app/src/lib/components/combobox.svelte new file mode 100644 index 0000000..ee69917 --- /dev/null +++ b/code/app/src/lib/components/combobox.svelte @@ -0,0 +1,443 @@ + + + + + + +
+ {#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