|
|
|
@ -64,6 +64,8 @@ const {
|
|
|
|
|
|
|
|
|
|
const { dragging } = useSortable(sortableRef, visibleItems, updateModelValue, _isReadonly) |
|
|
|
|
|
|
|
|
|
const active = inject(ActiveCellInj, ref(false)) |
|
|
|
|
|
|
|
|
|
const isReadonly = computed(() => { |
|
|
|
|
return isLockedMode.value || _isReadonly.value |
|
|
|
|
}) |
|
|
|
@ -147,7 +149,8 @@ const rowHeight = inject(RowHeightInj, ref(1.8))
|
|
|
|
|
:style="{ |
|
|
|
|
height: isForm ? undefined : `max(${(rowHeight || 1) * 1.8}rem, 41px)`, |
|
|
|
|
}" |
|
|
|
|
class="nc-attachment-cell relative flex-1 color-transition flex items-center justify-between gap-1" |
|
|
|
|
class="nc-attachment-cell relative flex color-transition flex items-center" |
|
|
|
|
:class="{'justify-center': !active, 'justify-between': active}" |
|
|
|
|
> |
|
|
|
|
<LazyCellAttachmentCarousel /> |
|
|
|
|
|
|
|
|
@ -166,20 +169,19 @@ const rowHeight = inject(RowHeightInj, ref(1.8))
|
|
|
|
|
<div |
|
|
|
|
v-if="!isReadonly" |
|
|
|
|
:class="{ 'mx-auto px-4': !visibleItems.length }" |
|
|
|
|
class="group cursor-pointer py-1 flex gap-1 items-center active:(ring ring-accent ring-opacity-100) rounded border-1 shadow-sm hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500)" |
|
|
|
|
class="group cursor-pointer py-1 flex gap-1 items-center active:(ring ring-accent ring-opacity-100) rounded border-none shadow-sm hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500)" |
|
|
|
|
data-testid="attachment-cell-file-picker-button" |
|
|
|
|
@click.stop="open" |
|
|
|
|
> |
|
|
|
|
<component :is="iconMap.reload" v-if="isLoading" :class="{ 'animate-infinite animate-spin': isLoading }" /> |
|
|
|
|
|
|
|
|
|
<a-tooltip v-else placement="bottom"> |
|
|
|
|
<NcTooltip placement="bottom"> |
|
|
|
|
<template #title> Click or drop a file into cell</template> |
|
|
|
|
|
|
|
|
|
<div class="flex items-center gap-1"> |
|
|
|
|
<div v-if="active || !visibleItems.length" class="flex items-center gap-1"> |
|
|
|
|
<MaterialSymbolsAttachFile |
|
|
|
|
class="transform dark:(!text-white) group-hover:(!text-accent scale-120) text-gray-500 text-[0.75rem]" |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<div |
|
|
|
|
v-if="!visibleItems.length" |
|
|
|
|
class="group-hover:text-primary text-gray-500 dark:text-gray-200 dark:group-hover:!text-white text-xs" |
|
|
|
@ -187,7 +189,7 @@ const rowHeight = inject(RowHeightInj, ref(1.8))
|
|
|
|
|
Add file(s) |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</a-tooltip> |
|
|
|
|
</NcTooltip> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div v-else class="flex" /> |
|
|
|
@ -202,12 +204,12 @@ const rowHeight = inject(RowHeightInj, ref(1.8))
|
|
|
|
|
}" |
|
|
|
|
> |
|
|
|
|
<template v-for="(item, i) of visibleItems" :key="item.url || item.title"> |
|
|
|
|
<a-tooltip placement="bottom"> |
|
|
|
|
<NcTooltip placement="bottom"> |
|
|
|
|
<template #title> |
|
|
|
|
<div class="text-center w-full">{{ item.title }}</div> |
|
|
|
|
</template> |
|
|
|
|
<div v-if="isImage(item.title, item.mimetype ?? item.type)"> |
|
|
|
|
<div class="nc-attachment flex items-center justify-center" @click.stop="selectedImage = item"> |
|
|
|
|
<div class="nc-attachment flex items-center justify-center" :class="{'ml-2':active}" @click.stop="selectedImage = item"> |
|
|
|
|
<LazyCellAttachmentImage |
|
|
|
|
class="max-h-[1.8rem] max-w-[1.8rem]" |
|
|
|
|
:alt="item.title || `#${i}`" |
|
|
|
@ -215,29 +217,30 @@ const rowHeight = inject(RowHeightInj, ref(1.8))
|
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div v-else class="nc-attachment flex items-center justify-center" @click="openAttachment(item)"> |
|
|
|
|
<div v-else class="nc-attachment flex items-center justify-center" :class="{'ml-2':active}" @click="openAttachment(item)"> |
|
|
|
|
<component :is="FileIcon(item.icon)" v-if="item.icon" /> |
|
|
|
|
|
|
|
|
|
<IcOutlineInsertDriveFile v-else /> |
|
|
|
|
</div> |
|
|
|
|
</a-tooltip> |
|
|
|
|
</NcTooltip> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div |
|
|
|
|
class="group cursor-pointer flex gap-1 items-center active:(ring ring-accent ring-opacity-100) rounded border-1 p-1 shadow-sm hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500)" |
|
|
|
|
v-if="active" |
|
|
|
|
class="h-6 w-5 group cursor-pointer flex gap-1 items-center active:(ring ring-accent ring-opacity-100) rounded border-none p-1 hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500)" |
|
|
|
|
> |
|
|
|
|
<component :is="iconMap.reload" v-if="isLoading" :class="{ 'animate-infinite animate-spin': isLoading }" /> |
|
|
|
|
|
|
|
|
|
<a-tooltip v-else placement="bottom"> |
|
|
|
|
<NcTooltip v-else placement="bottom"> |
|
|
|
|
<template #title> View attachments</template> |
|
|
|
|
|
|
|
|
|
<component |
|
|
|
|
:is="iconMap.expand" |
|
|
|
|
class="transform dark:(!text-white) group-hover:(!text-accent scale-120) text-gray-500 text-[0.75rem]" |
|
|
|
|
class="transform dark:(!text-white) group-hover:(!text-grey-800 scale-120) text-gray-500 text-[0.75rem]" |
|
|
|
|
@click.stop="modalVisible = true" |
|
|
|
|
/> |
|
|
|
|
</a-tooltip> |
|
|
|
|
</NcTooltip> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|