diff --git a/packages/nc-gui-v2/components/smartsheet/Gallery.vue b/packages/nc-gui-v2/components/smartsheet/Gallery.vue index d896964a9d..3139c37452 100644 --- a/packages/nc-gui-v2/components/smartsheet/Gallery.vue +++ b/packages/nc-gui-v2/components/smartsheet/Gallery.vue @@ -4,6 +4,10 @@ import { inject, provide, useViewData } from '#imports' import { ActiveViewInj, ChangePageInj, FieldsInj, IsFormInj, IsGridInj, MetaInj, PaginationDataInj, ReadonlyInj } from '~/context' import ImageIcon from '~icons/mdi/file-image-box' +interface Attachment { + url: string +} + const meta = inject(MetaInj) const view = inject(ActiveViewInj) @@ -25,14 +29,6 @@ const fields = inject(FieldsInj, ref([])) const coverImageColumn = $(computed(() => fields.value.find((col) => col.id === galleryData.value?.fk_cover_image_col_id))) -const coverUrl = (record: any) => { - try { - return JSON.parse(record.row[coverImageColumn?.title])[0].url - } catch (e) { - return null - } -} - watch( [meta, view], async () => { @@ -50,6 +46,14 @@ const isRowEmpty = (record: any, col: any) => { return Array.isArray(val) && val.length === 0 } + +const attachments = (record: any): Array => { + try { + return JSON.parse(record.row[coverImageColumn?.title]) ?? [] + } catch (e) { + return [] + } +} @@ -59,7 +63,14 @@ const isRowEmpty = (record: any, col: any) => {