From 624df90edabbaeeb291d0f793afd64ba30271553 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 20 Dec 2024 12:23:50 +0100 Subject: [PATCH] Type derivedStore --- .../src/components/grid/stores/columns.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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