This commit is contained in:
Adria Navarro 2023-09-22 13:07:02 +02:00
parent 1272414a57
commit 7ad05930e1
5 changed files with 6 additions and 12 deletions

View File

@ -14,7 +14,6 @@
export let autocomplete = false export let autocomplete = false
export let sort = false export let sort = false
export let autoWidth = false export let autoWidth = false
export let fetchTerm = null
export let searchTerm = null export let searchTerm = null
export let useFetch = false export let useFetch = false
export let customPopoverHeight export let customPopoverHeight
@ -91,7 +90,6 @@
{options} {options}
isPlaceholder={!arrayValue.length} isPlaceholder={!arrayValue.length}
{autocomplete} {autocomplete}
bind:fetchTerm
bind:searchTerm bind:searchTerm
bind:open bind:open
{useFetch} {useFetch}

View File

@ -35,7 +35,6 @@
export let autoWidth = false export let autoWidth = false
export let autocomplete = false export let autocomplete = false
export let sort = false export let sort = false
export let fetchTerm = null
export let searchTerm = null export let searchTerm = null
export let useFetch = false export let useFetch = false
export let customPopoverHeight export let customPopoverHeight
@ -82,7 +81,7 @@
} }
const getFilteredOptions = (options, term, getLabel) => { const getFilteredOptions = (options, term, getLabel) => {
if (autocomplete && term && !fetchTerm) { if (autocomplete && term && !useFetch) {
const lowerCaseTerm = term.toLowerCase() const lowerCaseTerm = term.toLowerCase()
return options.filter(option => { return options.filter(option => {
return `${getLabel(option)}`.toLowerCase().includes(lowerCaseTerm) return `${getLabel(option)}`.toLowerCase().includes(lowerCaseTerm)
@ -163,9 +162,8 @@
> >
{#if autocomplete} {#if autocomplete}
<Search <Search
value={useFetch ? fetchTerm : searchTerm} value={searchTerm}
on:change={event => on:change={event => (searchTerm = event.detail)}
useFetch ? (fetchTerm = event.detail) : (searchTerm = event.detail)}
{disabled} {disabled}
placeholder="Search" placeholder="Search"
/> />

View File

@ -25,7 +25,6 @@
export let tag = null export let tag = null
export let customPopoverOffsetBelow export let customPopoverOffsetBelow
export let customPopoverMaxHeight export let customPopoverMaxHeight
export let fetchTerm = null
export let searchTerm = null export let searchTerm = null
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
@ -67,7 +66,6 @@
<Picker <Picker
on:click on:click
bind:open bind:open
bind:fetchTerm
bind:searchTerm bind:searchTerm
{quiet} {quiet}
{id} {id}

View File

@ -16,7 +16,7 @@
export let sort = false export let sort = false
export let autoWidth = false export let autoWidth = false
export let autocomplete = false export let autocomplete = false
export let fetchTerm = null export let searchTerm = null
export let useFetch = false export let useFetch = false
export let customPopoverHeight export let customPopoverHeight
@ -41,7 +41,7 @@
{autoWidth} {autoWidth}
{autocomplete} {autocomplete}
{customPopoverHeight} {customPopoverHeight}
bind:fetchTerm bind:searchTerm
{useFetch} {useFetch}
on:change={onChange} on:change={onChange}
on:click on:click

View File

@ -256,7 +256,7 @@
<div class="controls"> <div class="controls">
<div class="select"> <div class="select">
<Multiselect <Multiselect
bind:fetchTerm={userSearchTerm} bind:searchTerm={userSearchTerm}
useFetch useFetch
placeholder="All users" placeholder="All users"
label="Users" label="Users"