More typings

This commit is contained in:
Adria Navarro 2024-12-24 14:20:53 +01:00
parent dc0f16747e
commit d176325179
2 changed files with 13 additions and 5 deletions

View File

@ -1,7 +1,8 @@
import { get, derived, Writable } from "svelte/store" import { get, derived, Writable, Readable } from "svelte/store"
import { import {
FieldType, FieldType,
UIColumn, UIColumn,
UIFilter,
UIInlineFilter, UIInlineFilter,
UILogicalOperator, UILogicalOperator,
} from "@budibase/types" } from "@budibase/types"
@ -9,12 +10,12 @@ import { Store as StoreContext } from "."
import { memo } from "../../../utils/memo" import { memo } from "../../../utils/memo"
export interface FilterStore { export interface FilterStore {
filter: Writable<any> filter: Writable<UIFilter>
inlineFilters: Writable<UIInlineFilter[]> inlineFilters: Writable<UIInlineFilter[]>
} }
export interface FilterDerivedStore { export interface FilterDerivedStore {
allFilters: Writable<any> allFilters: Readable<UIFilter>
} }
export type Store = FilterStore & FilterDerivedStore 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 { filter, inlineFilters } = context
const allFilters = derived( const allFilters = derived(
[filter, inlineFilters], [filter, inlineFilters],

View File

@ -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 { export interface UIInlineFilter {
field: string field: string