Initial conversion

This commit is contained in:
Adria Navarro 2024-12-30 12:56:25 +01:00
parent d2d19291ef
commit ed30e51733
2 changed files with 17 additions and 5 deletions

View File

@ -1,15 +1,26 @@
import { writable, get } from "svelte/store"
import { writable, get, Writable, Readable } from "svelte/store"
import { derivedMemo, QueryUtils } from "../../../utils"
import { FieldType, EmptyFilterOption } from "@budibase/types"
import { Store as StoreContext } from "."
export const createStores = () => {
interface ConditionStore {
metadata: Writable<any>
}
interface ConditionDerivedStore {
conditions: Readable<any>
}
export type Store = ConditionStore & ConditionDerivedStore
export const createStores = (): ConditionStore => {
const metadata = writable({})
return {
metadata,
}
}
export const deriveStores = context => {
export const deriveStores = (context: StoreContext): ConditionDerivedStore => {
const { columns } = context
// Derive and memoize the cell conditions present in our columns so that we
@ -33,7 +44,7 @@ export const deriveStores = context => {
}
}
export const initialise = context => {
export const initialise = (context: StoreContext) => {
const { metadata, conditions, rows } = context
// Recompute all metadata if conditions change

View File

@ -105,7 +105,8 @@ export type Store = BaseStore &
} & Rows.Store &
Reorder.Store &
Resize.Store &
Config.Store
Config.Store &
Conditions.Store
export const attachStores = (context: Store): Store => {
// Atomic store creation