From a9072370ca1eb9a5cce928b1d487db0f307edea6 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Tue, 20 Sep 2022 15:24:27 +0800 Subject: feat: Move old apps into it's own directory --- old-apps/web-shared/src/components/dropdown.svelte | 389 +++++++++++++++++++++ 1 file changed, 389 insertions(+) create mode 100644 old-apps/web-shared/src/components/dropdown.svelte (limited to 'old-apps/web-shared/src/components/dropdown.svelte') diff --git a/old-apps/web-shared/src/components/dropdown.svelte b/old-apps/web-shared/src/components/dropdown.svelte new file mode 100644 index 0000000..a28bcd3 --- /dev/null +++ b/old-apps/web-shared/src/components/dropdown.svelte @@ -0,0 +1,389 @@ + + + + +{#if label} + +{/if} + +
+ +
{ + if (!element_has_focus(searchInputNode)) searchInputNode.focus(); + showDropdown = true; + }} + class:multiple={multiple === true} + class:has-selection={hasSelection}> + {#if multiple === true && hasSelection} + {#each entries.filter((c) => c.selected === true) as entry} + methods.deselect_entry(entry.id)} + text={entry.name}/> + {/each} + {/if} + search.do()} + on:click={() => (showDropdown = true)} + on:focus={() => (showDropdown = true)} + on:blur={search.on_input_focusout} + autocomplete="off" + /> +
+ + + Open selection + + + + + +
+
+ + {#if errorText} + {errorText} + {/if} + + +
+
    event.code.startsWith("Arrow") && event.preventDefault()} + tabindex="-1" + class="autocomplete__list"> + {#if searchResults.length > 0} + {#each searchResults.filter((c) => !c.selected) as result} +
  • methods.select_entry(e.target.dataset.id)} + tabindex="-1"> + {@html highlight(result, (open = ''), (close = ""))} +
  • + {/each} + {:else if entries.length > 0} + {#each entries.filter((c) => !c.selected) as entry} +
  • methods.select_entry(e.target.dataset.id)} + tabindex="-1"> + {entry.name} +
  • + {/each} + {:else} +
  • + {noResultsText} +
  • + {/if} +
+ {#if showCreationHint} +
+
+ {/if} +
+
-- cgit v1.3