mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
refactor: operators are now writable
This commit is contained in:
@@ -24,14 +24,14 @@
|
||||
|
||||
$: column = $columns.find((c) => c.id === columnId) as Column;
|
||||
|
||||
$: operatorsForColumn = Object.entries(operators)
|
||||
$: operatorsForColumn = Object.entries($operators)
|
||||
.filter(([, v]) => v.types.includes(column?.type))
|
||||
.map(([k]) => ({
|
||||
label: k,
|
||||
value: k
|
||||
}));
|
||||
|
||||
$: operator = operatorKey ? operators[operatorKey] : null;
|
||||
$: operator = operatorKey ? $operators[operatorKey] : null;
|
||||
$: {
|
||||
columnId;
|
||||
operatorKey = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import { derived, get, writable } from 'svelte/store';
|
||||
import { derived, get, writable, type Writable } from 'svelte/store';
|
||||
import { page } from '$app/stores';
|
||||
import deepEqual from 'deep-equal';
|
||||
import type { Column, ColumnType } from '$lib/helpers/types';
|
||||
@@ -105,7 +105,7 @@ export function addFilter(
|
||||
}
|
||||
}
|
||||
|
||||
export const operators: Record<string, Operator> = {
|
||||
export const operators: Writable<Record<string, Operator>> = writable({
|
||||
'starts with': {
|
||||
toQuery: Query.startsWith,
|
||||
toTag: (attribute, input) => `**${attribute}** starts with **${input}**`,
|
||||
@@ -172,7 +172,7 @@ export const operators: Record<string, Operator> = {
|
||||
},
|
||||
types: ['string', 'integer', 'double', 'boolean', 'datetime', 'enum']
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
function formatArray(array: string[]) {
|
||||
if (!array?.length) return;
|
||||
|
||||
Reference in New Issue
Block a user