diff --git a/packages/frontend-core/src/components/grid/stores/columns.ts b/packages/frontend-core/src/components/grid/stores/columns.ts index 881c4dff6f..7831305e1b 100644 --- a/packages/frontend-core/src/components/grid/stores/columns.ts +++ b/packages/frontend-core/src/components/grid/stores/columns.ts @@ -1,4 +1,4 @@ -import { derived, get, Writable, writable } from "svelte/store" +import { derived, get, Readable, Writable, writable } from "svelte/store" import { DefaultColumnWidth, GutterWidth } from "../lib/constants" import { CalculationType, FieldSchema } from "@budibase/types" import { StoreContext } from "." @@ -7,6 +7,15 @@ export interface Store { columns: Writable } +export interface DerivedStore { + tableColumns: Readable + displayColumn: Readable + columnLookupMap: Readable> + visibleColumns: Readable + scrollableColumns: Readable + hasNonAutoColumn: Readable +} + type Column = FieldSchema & { label: string readonly: boolean @@ -51,7 +60,7 @@ export const createStores = (): Store => { } } -export const deriveStores = (context: Store) => { +export const deriveStores = (context: Store): DerivedStore => { const { columns } = context // Derive a lookup map for all columns by name