Browse Source

Merge branch 'develop' into fix/gui-v2-misc

pull/3051/head
Wing-Kam Wong 2 years ago
parent
commit
b996f3c7c8
  1. 11
      packages/nc-gui-v2/composables/useViewData.ts

11
packages/nc-gui-v2/composables/useViewData.ts

@ -18,6 +18,7 @@ export interface Row {
oldRow: Record<string, any> oldRow: Record<string, any>
rowMeta: { rowMeta: {
new?: boolean new?: boolean
selected?: boolean
commentCount?: number commentCount?: number
} }
} }
@ -33,7 +34,7 @@ export function useViewData(
const formattedData = ref<Row[]>([]) const formattedData = ref<Row[]>([])
const paginationData = ref<PaginatedType>({ page: 1, pageSize: 25 }) const paginationData = ref<PaginatedType>({ page: 1, pageSize: 25 })
const aggCommentCount = ref<Record<string, number>[]>([]) const aggCommentCount = ref<{ row_id: string; count: number }[]>([])
const galleryData = ref<GalleryType | undefined>(undefined) const galleryData = ref<GalleryType | undefined>(undefined)
const formColumnData = ref<FormType | undefined>(undefined) const formColumnData = ref<FormType | undefined>(undefined)
const formViewData = ref<FormType | undefined>(undefined) const formViewData = ref<FormType | undefined>(undefined)
@ -43,10 +44,10 @@ export function useViewData(
const selectedAllRecords = computed({ const selectedAllRecords = computed({
get() { get() {
return formattedData.value.every((row: Record<string, any>) => row.rowMeta.selected) return formattedData.value.every((row: Row) => row.rowMeta.selected)
}, },
set(selected) { set(selected: boolean) {
formattedData.value.forEach((row: Record<string, any>) => (row.rowMeta.selected = selected)) formattedData.value.forEach((row: Row) => (row.rowMeta.selected = selected))
}, },
}) })
@ -208,7 +209,7 @@ export function useViewData(
const deleteRowById = async (id: string) => { const deleteRowById = async (id: string) => {
if (!id) { 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( const res: any = await $api.dbViewRow.delete(

Loading…
Cancel
Save