Browse Source

feat(nc-gui): introduce no image option in cover image fields menu

pull/4003/head
Wing-Kam Wong 2 years ago
parent
commit
b6d0f29d0d
  1. 2
      packages/nc-gui/components/smartsheet/Gallery.vue
  2. 19
      packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

2
packages/nc-gui/components/smartsheet/Gallery.vue

@ -177,7 +177,7 @@ watch(view, async (nextView) => {
class="!rounded-lg h-full overflow-hidden break-all max-w-[450px]" class="!rounded-lg h-full overflow-hidden break-all max-w-[450px]"
@click="expandFormClick($event, record)" @click="expandFormClick($event, record)"
> >
<template #cover> <template v-if="galleryData.fk_cover_image_col_id" #cover>
<a-carousel v-if="!reloadAttachments && attachments(record).length" autoplay class="gallery-carousel" arrows> <a-carousel v-if="!reloadAttachments && attachments(record).length" autoplay class="gallery-carousel" arrows>
<template #customPaging> <template #customPaging>
<a> <a>

19
packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

@ -80,7 +80,6 @@ const coverImageColumnId = computed({
: undefined, : undefined,
set: async (val) => { set: async (val) => {
if ( if (
val &&
(activeView.value?.type === ViewTypes.GALLERY || activeView.value?.type === ViewTypes.KANBAN) && (activeView.value?.type === ViewTypes.GALLERY || activeView.value?.type === ViewTypes.KANBAN) &&
activeView.value?.id && activeView.value?.id &&
activeView.value?.view activeView.value?.view
@ -104,14 +103,16 @@ const coverImageColumnId = computed({
}) })
const coverOptions = computed<SelectProps['options']>(() => { const coverOptions = computed<SelectProps['options']>(() => {
return fields.value const filterFields =
?.filter((el) => el.fk_column_id && metaColumnById.value[el.fk_column_id].uidt === UITypes.Attachment) fields.value
.map((field) => { ?.filter((el) => el.fk_column_id && metaColumnById.value[el.fk_column_id].uidt === UITypes.Attachment)
return { .map((field) => {
value: field.fk_column_id, return {
label: field.title, value: field.fk_column_id,
} label: field.title,
}) }
}) ?? []
return [{ value: null, label: 'No Image' }, ...filterFields]
}) })
const getIcon = (c: ColumnType) => const getIcon = (c: ColumnType) =>

Loading…
Cancel
Save