2025-08-24 23:24:01 -07:00
|
|
|
<svelte:options
|
|
|
|
|
customElement={{
|
2026-02-13 22:29:01 +00:00
|
|
|
props: { initialValue: { attribute: "initial-value" } },
|
2025-08-24 23:24:01 -07:00
|
|
|
shadow: "none",
|
|
|
|
|
tag: "filter-menu",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
2025-12-18 12:55:01 -08:00
|
|
|
import BasicDropdown from "./basic-dropdown.webc.svelte";
|
2025-08-24 23:24:01 -07:00
|
|
|
|
|
|
|
|
type Props = {
|
2026-02-13 22:29:01 +00:00
|
|
|
initialValue?: string;
|
2025-08-24 23:24:01 -07:00
|
|
|
};
|
|
|
|
|
|
2026-02-13 22:29:01 +00:00
|
|
|
let { initialValue = "" }: Props = $props();
|
2025-08-24 23:24:01 -07:00
|
|
|
|
2026-02-13 22:29:01 +00:00
|
|
|
let expr = $state(initialValue);
|
2025-08-24 23:24:01 -07:00
|
|
|
</script>
|
|
|
|
|
|
2025-12-18 12:55:01 -08:00
|
|
|
<div class="filter-menu toolbar-item">
|
|
|
|
|
<BasicDropdown>
|
|
|
|
|
<span slot="button-contents">Filter</span>
|
|
|
|
|
<form action="set-filter" class="padded" method="post" slot="popover">
|
2026-02-13 22:29:01 +00:00
|
|
|
<div class="form__label">Filter expression (SQL)</div>
|
|
|
|
|
<textarea
|
|
|
|
|
class="form__input"
|
|
|
|
|
name="filter"
|
|
|
|
|
rows="8"
|
|
|
|
|
cols="60"
|
|
|
|
|
placeholder="For example: LOWER("my_column") = 'hello world'"
|
|
|
|
|
>{expr}</textarea
|
|
|
|
|
>
|
2025-12-18 12:55:01 -08:00
|
|
|
<div class="form__buttons">
|
2025-10-25 05:32:22 +00:00
|
|
|
<input
|
|
|
|
|
name="filter_expression"
|
|
|
|
|
type="hidden"
|
|
|
|
|
value={JSON.stringify(expr)}
|
|
|
|
|
/>
|
2025-12-18 12:55:01 -08:00
|
|
|
<button class="button button--primary" type="submit">Apply</button>
|
2025-10-25 05:32:22 +00:00
|
|
|
</div>
|
|
|
|
|
</form>
|
2025-12-18 12:55:01 -08:00
|
|
|
</BasicDropdown>
|
2025-08-24 23:24:01 -07:00
|
|
|
</div>
|