fix: filters logic

This commit is contained in:
Arman
2024-07-03 18:11:08 +02:00
parent ef58c90b4a
commit a2bcd5c127
2 changed files with 18 additions and 3 deletions
+4 -1
View File
@@ -10,7 +10,7 @@
InputDateTime
} from '$lib/elements/forms';
import { createEventDispatcher, onMount } from 'svelte';
import { tags, operators, addFilter } from './store';
import { tags, operators, addFilter, queries } from './store';
import type { Column } from '$lib/helpers/types';
import type { Writable } from 'svelte/store';
import { TagList } from '.';
@@ -55,6 +55,9 @@
operatorKey = null;
value = null;
arrayValues = [];
if (singleCondition) {
queries.apply();
}
}
const dispatch = createEventDispatcher<{
+14 -2
View File
@@ -50,6 +50,18 @@
queries.apply();
}
function afterApply(
e: CustomEvent<{
applied: number;
}>
) {
applied = e.detail.applied;
if (singleCondition) {
showFiltersDesktop = false;
showFiltersMobile = false;
}
}
$: if (!showFiltersDesktop && !showFiltersMobile) {
selectedColumn = null;
value = null;
@@ -92,7 +104,7 @@
bind:arrayValues
{columns}
{singleCondition}
on:apply={(e) => (applied = e.detail.applied)}
on:apply={afterApply}
on:clear={() => (applied = 0)} />
<hr />
<div class="u-flex u-margin-block-start-16 u-main-end u-gap-8">
@@ -136,7 +148,7 @@
bind:value
bind:arrayValues
{singleCondition}
on:apply={(e) => (applied = e.detail.applied)}
on:apply={afterApply}
on:clear={() => (applied = 0)} />
<svelte:fragment slot="footer">
{#if singleCondition}