From 8958b8d14c924b9d3884e41d41f7e06f2c38413a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 27 Dec 2024 10:26:09 +0100 Subject: [PATCH] Type UIRow --- .../src/components/grid/stores/datasource.ts | 4 ++-- .../src/components/grid/stores/datasources/index.ts | 10 +++++----- packages/types/src/ui/stores/grid/index.ts | 1 + packages/types/src/ui/stores/grid/rows.ts | 3 +++ 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 packages/types/src/ui/stores/grid/rows.ts diff --git a/packages/frontend-core/src/components/grid/stores/datasource.ts b/packages/frontend-core/src/components/grid/stores/datasource.ts index ce9f2837bb..b532a4cf8b 100644 --- a/packages/frontend-core/src/components/grid/stores/datasource.ts +++ b/packages/frontend-core/src/components/grid/stores/datasource.ts @@ -3,12 +3,12 @@ import { getDatasourceDefinition, getDatasourceSchema } from "../../../fetch" import { enrichSchemaWithRelColumns, memo } from "../../../utils" import { cloneDeep } from "lodash" import { - Row, SaveRowRequest, SaveTableRequest, UIDatasource, UIFieldMutation, UIFieldSchema, + UIRow, UpdateViewRequest, ViewV2Type, } from "@budibase/types" @@ -331,7 +331,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => { } // Deletes rows from the datasource - const deleteRows = async (rows: Row[]) => { + const deleteRows = async (rows: UIRow[]) => { return await getAPI()?.actions.deleteRows(rows) } diff --git a/packages/frontend-core/src/components/grid/stores/datasources/index.ts b/packages/frontend-core/src/components/grid/stores/datasources/index.ts index c58aef37e9..05e2bd0188 100644 --- a/packages/frontend-core/src/components/grid/stores/datasources/index.ts +++ b/packages/frontend-core/src/components/grid/stores/datasources/index.ts @@ -1,8 +1,8 @@ import { - Row, SaveRowRequest, SaveTableRequest, UIDatasource, + UIRow, UpdateViewRequest, } from "@budibase/types" @@ -10,10 +10,10 @@ interface DatasourceBaseActions< TSaveDefinitionRequest = UpdateViewRequest | SaveTableRequest > { saveDefinition: (newDefinition: TSaveDefinitionRequest) => Promise - addRow: (row: SaveRowRequest) => Promise - updateRow: (row: SaveRowRequest) => Promise - deleteRows: (rows: Row[]) => Promise - getRow: (id: string) => Promise + addRow: (row: SaveRowRequest) => Promise + updateRow: (row: SaveRowRequest) => Promise + deleteRows: (rows: UIRow[]) => Promise + getRow: (id: string) => Promise isDatasourceValid: (datasource: UIDatasource) => boolean | void canUseColumn: (name: string) => boolean | void } diff --git a/packages/types/src/ui/stores/grid/index.ts b/packages/types/src/ui/stores/grid/index.ts index aa68c3f207..880c3834c1 100644 --- a/packages/types/src/ui/stores/grid/index.ts +++ b/packages/types/src/ui/stores/grid/index.ts @@ -4,3 +4,4 @@ export * from "./table" export * from "./view" export * from "./user" export * from "./filters" +export * from "./rows" diff --git a/packages/types/src/ui/stores/grid/rows.ts b/packages/types/src/ui/stores/grid/rows.ts new file mode 100644 index 0000000000..82065675d0 --- /dev/null +++ b/packages/types/src/ui/stores/grid/rows.ts @@ -0,0 +1,3 @@ +import { Row } from "@budibase/types" + +export type UIRow = Row & { _id: string }