diff --git a/src/lib/components/workflow/filter-search/boolean-filter.svelte b/src/lib/components/workflow/filter-search/boolean-filter.svelte
index ee426d772..8adeb3b4c 100644
--- a/src/lib/components/workflow/filter-search/boolean-filter.svelte
+++ b/src/lib/components/workflow/filter-search/boolean-filter.svelte
@@ -8,6 +8,7 @@
MenuItem,
} from '$lib/holocene/menu';
import { translate } from '$lib/i18n/translate';
+ import { isNullConditional } from '$lib/utilities/is';
import { FILTER_CONTEXT, type FilterContext } from './index.svelte';
@@ -15,10 +16,14 @@
const options = [
{ value: 'true', label: translate('common.true') },
{ value: 'false', label: translate('common.false') },
+ { value: 'is', label: translate('common.is-null') },
+ { value: 'is not', label: translate('common.is-not-null') },
];
$: selectedOption =
- options.find((o) => o.value === $filter.value) ?? options[0];
+ options.find(
+ (o) => o.value === $filter.value || o.value === $filter.conditional,
+ ) ?? options[0];
$: selectedLabel = selectedOption?.label;
@@ -34,9 +39,16 @@
{#each options as { value, label }}
diff --git a/src/lib/components/workflow/filter-search/conditional-menu.svelte b/src/lib/components/workflow/filter-search/conditional-menu.svelte
index e9db4e7af..e77ec62d1 100644
--- a/src/lib/components/workflow/filter-search/conditional-menu.svelte
+++ b/src/lib/components/workflow/filter-search/conditional-menu.svelte
@@ -7,10 +7,12 @@
MenuContainer,
MenuItem,
} from '$lib/holocene/menu';
+ import { translate } from '$lib/i18n/translate';
+ import { isNullConditional } from '$lib/utilities/is';
import { FILTER_CONTEXT, type FilterContext } from './index.svelte';
- const { filter, focusedElementId } =
+ const { filter, focusedElementId, handleSubmit } =
getContext(FILTER_CONTEXT);
const defaultConditionOptions = [
{ value: '>' },
@@ -27,17 +29,28 @@
export let noBorderLeft = false;
export let noBorderRight = false;
- $: filterConditionalOption = options.find(
+ let conditionalOptions = [
+ ...options,
+ { value: 'is', label: translate('common.is-null') },
+ { value: 'is not', label: translate('common.is-not-null') },
+ ];
+
+ $: filterConditionalOption = conditionalOptions.find(
(o) => o.value === $filter.conditional,
);
- $: options, updateFilterConditional();
- $: selectedOption = filterConditionalOption ?? options[0];
+ $: filterConditionalOption, updateFilterConditional();
+ $: isNullFilter = isNullConditional($filter.conditional);
+ $: selectedOption = filterConditionalOption ?? conditionalOptions[0];
$: selectedLabel = selectedOption?.label ?? selectedOption?.value;
+ function handleNullFilter() {
+ $filter.value = null;
+ handleSubmit();
+ }
+
function updateFilterConditional() {
- if (!filterConditionalOption) {
- $filter.conditional = options[0].value;
- }
+ if (!filterConditionalOption)
+ $filter.conditional = conditionalOptions[0].value;
}
@@ -45,7 +58,9 @@