Fix drawer

This commit is contained in:
Adria Navarro 2024-04-12 09:50:11 +02:00
parent 8c954135c4
commit 4b38220048
1 changed files with 7 additions and 3 deletions

View File

@ -29,6 +29,10 @@
$: onEmptyFilter = $: onEmptyFilter =
filters?.find(filter => filter.onEmptyFilter)?.onEmptyFilter ?? "all" filters?.find(filter => filter.onEmptyFilter)?.onEmptyFilter ?? "all"
$: fieldFilters = filters.filter(
filter => filter.operator !== "allOr" && !filter.onEmptyFilter
)
const behaviourOptions = [ const behaviourOptions = [
{ value: "and", label: "Match all filters" }, { value: "and", label: "Match all filters" },
{ value: "or", label: "Match any filter" }, { value: "or", label: "Match any filter" },
@ -177,7 +181,7 @@
<Layout noPadding> <Layout noPadding>
{#if fieldOptions?.length} {#if fieldOptions?.length}
<Body size="S"> <Body size="S">
{#if !filters?.length} {#if !fieldFilters?.length}
Add your first filter expression. Add your first filter expression.
{:else} {:else}
<slot name="filteringHeroContent" /> <slot name="filteringHeroContent" />
@ -207,13 +211,13 @@
{/if} {/if}
{/if} {/if}
</Body> </Body>
{#if filters?.length} {#if fieldFilters?.length}
<div> <div>
<div class="filter-label"> <div class="filter-label">
<Label>Filters</Label> <Label>Filters</Label>
</div> </div>
<div class="fields" class:with-bindings={allowBindings}> <div class="fields" class:with-bindings={allowBindings}>
{#each filters.filter(filter => filter.operator !== "allOr" && !filter.onEmptyFilter) as filter} {#each fieldFilters as filter}
<Select <Select
bind:value={filter.field} bind:value={filter.field}
options={fieldOptions} options={fieldOptions}