From f92eb73e11c7a49d43c63a21e010983817d32a15 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 27 Dec 2024 10:34:54 +0100 Subject: [PATCH] Type column actions --- .../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 01cbf3af22..be525e2835 100644 --- a/packages/frontend-core/src/components/grid/stores/columns.ts +++ b/packages/frontend-core/src/components/grid/stores/columns.ts @@ -16,7 +16,16 @@ interface DerivedColumnStore { hasNonAutoColumn: Readable } -export type Store = ColumnStore & DerivedColumnStore +interface ColumnActions { + columns: ColumnStore["columns"] & { + actions: { + changeAllColumnWidths: (width: number) => Promise + isReadonly: (column: UIColumn) => boolean + } + } +} + +export type Store = ColumnStore & DerivedColumnStore & ColumnActions export const createStores = (): ColumnStore => { const columns = writable([]) @@ -95,7 +104,7 @@ export const deriveStores = (context: StoreContext): DerivedColumnStore => { } } -export const createActions = (context: StoreContext) => { +export const createActions = (context: StoreContext): ColumnActions => { const { columns, datasource } = context // Updates the width of all columns