diff --git a/packages/frontend-core/src/components/grid/stores/filter.ts b/packages/frontend-core/src/components/grid/stores/filter.ts index b9f54fefb8..3df28d22e1 100644 --- a/packages/frontend-core/src/components/grid/stores/filter.ts +++ b/packages/frontend-core/src/components/grid/stores/filter.ts @@ -1,7 +1,8 @@ -import { get, derived, Writable } from "svelte/store" +import { get, derived, Writable, Readable } from "svelte/store" import { FieldType, UIColumn, + UIFilter, UIInlineFilter, UILogicalOperator, } from "@budibase/types" @@ -9,12 +10,12 @@ import { Store as StoreContext } from "." import { memo } from "../../../utils/memo" export interface FilterStore { - filter: Writable + filter: Writable inlineFilters: Writable } export interface FilterDerivedStore { - allFilters: Writable + allFilters: Readable } export type Store = FilterStore & FilterDerivedStore @@ -32,7 +33,7 @@ export const createStores = (context: StoreContext): FilterStore => { } } -export const deriveStores = (context: StoreContext) => { +export const deriveStores = (context: StoreContext): FilterDerivedStore => { const { filter, inlineFilters } = context const allFilters = derived( [filter, inlineFilters], diff --git a/packages/types/src/ui/stores/grid/filters.ts b/packages/types/src/ui/stores/grid/filters.ts index 3912a40f87..cde922adc9 100644 --- a/packages/types/src/ui/stores/grid/filters.ts +++ b/packages/types/src/ui/stores/grid/filters.ts @@ -1,4 +1,11 @@ -import { FieldType } from "@budibase/types" +import { FieldType, UILogicalOperator } from "@budibase/types" + +export interface UIFilter { + groups: { + logicalOperator: UILogicalOperator + filters: UIInlineFilter[] + }[] +} export interface UIInlineFilter { field: string