-
-
Notifications
You must be signed in to change notification settings - Fork 4
Show advanced field filter #1841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d7be353
initial filters
hahn-kev 6591f16
show operation picker
hahn-kev b675778
allow filtering for one or many writing systems
hahn-kev fda93c9
expose gridify filter over miniLcm api
hahn-kev ed9781f
escape filter value
hahn-kev f228c04
resolve issues from feedback
hahn-kev a82287f
fix lint and review issues
hahn-kev a2f549e
set WsSelect value on writing systems change
hahn-kev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script lang="ts" module> | ||
export type Op = 'starts-with' | 'contains' | 'ends-with' | 'equals' | 'not-equals'; | ||
</script> | ||
|
||
<script lang="ts"> | ||
import * as Select from '$lib/components/ui/select'; | ||
import {Icon} from '$lib/components/ui/icon'; | ||
import {t} from 'svelte-i18n-lingui'; | ||
import type {IconClass} from '$lib/icon-class'; | ||
let {value = $bindable()}: {value: string} = $props(); | ||
const ops: {label: string, value: Op, icon: IconClass}[] = $derived([ | ||
{label: $t`Starts with`, value: 'starts-with', icon: 'i-mdi-contain-start'}, | ||
{label: $t`Contains`, value: 'contains', icon: 'i-mdi-contain'}, | ||
{label: $t`Ends with`, value: 'ends-with', icon: 'i-mdi-contain-end'}, | ||
{label: $t`Equals`, value: 'equals', icon: 'i-mdi-equal'}, | ||
{label: $t`Not equal`, value: 'not-equals', icon: 'i-mdi-not-equal-variant'}, | ||
]); | ||
</script> | ||
|
||
<Select.Root type="single" bind:value> | ||
<Select.Trigger class="w-13" downIcon={null}> | ||
<Icon icon={ops.find(o => o.value === value)?.icon ?? 'i-mdi-close'}/> | ||
</Select.Trigger> | ||
<Select.Content> | ||
<Select.Group> | ||
<Select.GroupHeading>Filter By</Select.GroupHeading> | ||
{#each ops as op} | ||
<Select.Item value={op.value}> | ||
<Icon icon={op.icon} class="mr-2"/> | ||
{op.label} | ||
</Select.Item> | ||
{/each} | ||
</Select.Group> | ||
</Select.Content> | ||
</Select.Root> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script lang="ts"> | ||
import * as Select from '$lib/components/ui/select'; | ||
import {useWritingSystemService, type WritingSystemSelection} from '$lib/writing-system-service.svelte'; | ||
import {t} from 'svelte-i18n-lingui'; | ||
|
||
const wsService = useWritingSystemService(); | ||
|
||
let {value = $bindable(), wsType}: { value: string[], wsType: WritingSystemSelection } = $props(); | ||
let writingSystems = $derived(wsService.pickWritingSystems(wsType)); | ||
</script> | ||
<Select.Root type="multiple" bind:value> | ||
<Select.Trigger class="flex-1"> | ||
{#if value.length === 0} | ||
<span class="text-muted-foreground">{$t`Writing System`}</span> | ||
{:else if value.length === writingSystems.length} | ||
<span class="text-muted-foreground"> | ||
{$t`Any Ws`} | ||
</span> | ||
{:else} | ||
{writingSystems.filter(w => value.includes(w.wsId)).map(w => w.abbreviation).join(', ')} | ||
{/if} | ||
</Select.Trigger> | ||
<Select.Content> | ||
<Select.Group> | ||
<Select.GroupHeading>{$t`Writing Systems`}</Select.GroupHeading> | ||
{#each writingSystems as ws} | ||
<Select.Item value={ws.wsId}> | ||
{ws.abbreviation} ({ws.wsId}) | ||
</Select.Item> | ||
{/each} | ||
</Select.Group> | ||
</Select.Content> | ||
</Select.Root> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.