From e3feea3032f00ba9e2d6d2096c802c9e49ebf078 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 11 Aug 2022 14:32:43 +0530 Subject: [PATCH] rafactor(gui-v2): type correction Signed-off-by: Pranav C --- packages/nc-gui-v2/composables/useViewData.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/nc-gui-v2/composables/useViewData.ts b/packages/nc-gui-v2/composables/useViewData.ts index 5202a9ed83..2bda5cdfe7 100644 --- a/packages/nc-gui-v2/composables/useViewData.ts +++ b/packages/nc-gui-v2/composables/useViewData.ts @@ -1,4 +1,4 @@ -import type { Api, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk' +import type { Api, ColumnType, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk' import type { ComputedRef, Ref } from 'vue' import { notification } from 'ant-design-vue' import { useNuxtApp } from '#app' @@ -18,6 +18,7 @@ export interface Row { oldRow: Record rowMeta: { new?: boolean + selected?: boolean commentCount?: number } } @@ -33,7 +34,7 @@ export function useViewData( const formattedData = ref([]) const paginationData = ref({ page: 1, pageSize: 25 }) - const aggCommentCount = ref>({}) + const aggCommentCount = ref<{ row_id: string; count: number }[]>([]) const galleryData = ref(undefined) const formColumnData = ref(undefined) const formViewData = ref(undefined) @@ -43,10 +44,10 @@ export function useViewData( const selectedAllRecords = computed({ get() { - return formattedData.value.every((row) => row.rowMeta.selected) + return formattedData.value.every((row: Row) => row.rowMeta.selected) }, - set(selected) { - formattedData.value.forEach((row) => (row.rowMeta.selected = selected)) + set(selected: boolean) { + formattedData.value.forEach((row: Row) => (row.rowMeta.selected = selected)) }, }) @@ -208,7 +209,7 @@ export function useViewData( const deleteRowById = async (id: string) => { if (!id) { - throw new Error("Delete not allowed for table which doesn't have primary Key") + throw new Error('Delete not allowed for table which doesn\'t have primary Key') } const res: any = await $api.dbViewRow.delete(