More typings
This commit is contained in:
parent
dc0f16747e
commit
d176325179
|
@ -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],
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue