diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/filters.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/filters.svelte index 60812ec33..63dd4a7a2 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/filters.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/filters.svelte @@ -157,22 +157,19 @@ operatorKey = null; } - let valueStr: string | null = null; - let valueNum: number | null = null; - $: value = column?.type === 'integer' || column?.type === 'double' ? valueNum : valueStr; + // We cast to any to not cause type errors in the input components + let value: any = null; $: { columnId; - valueStr = null; - valueNum = null; + value = null; } // This Map is keyed by tags, and has a query as the value function addFilter() { if (column && operator) { queries.addFilter({ column, operator, value }); - valueStr = null; - valueNum = null; + value = null; } } @@ -180,7 +177,7 @@ node.innerHTML = node.innerHTML.replace(/\*\*(.*?)\*\*/g, '$1'); } - let applied = 0; + let applied = $queries.size; function apply() { queries.apply(); @@ -196,7 +193,7 @@ } $: isDisabled = (function getDisabled() { - return !operator || (column?.type === 'string' && !value); + return !operator || (!operator?.hideInput && !value); })(); @@ -211,35 +208,39 @@ {/if}
-

Apply filter rules to refine the table view

-
- ({ - label: c.title, - value: c.id - }))} - placeholder="Select column" - bind:value={columnId} /> - -
- {#if column && operator && !operator?.hideInput} -
- {#if column.type === 'integer' || column.type === 'double'} - - {:else} - - {/if} +
+

Apply filter rules to refine the table view

+
+ ({ + label: c.title, + value: c.id + }))} + placeholder="Select column" + bind:value={columnId} /> +
- {/if} - + {#if column && operator && !operator?.hideInput} +
+ {#if column.type === 'integer' || column.type === 'double'} + + {:else} + + {/if} +
+ {/if} + + +
    {#each $tags as tag (tag)}