|
|
@ -1,5 +1,6 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
<script setup lang="ts"> |
|
|
|
import { onKeyDown } from '@vueuse/core' |
|
|
|
import { onKeyDown } from '@vueuse/core' |
|
|
|
|
|
|
|
import { RowHeightInj } from '~/context' |
|
|
|
import { useProvideAttachmentCell } from './utils' |
|
|
|
import { useProvideAttachmentCell } from './utils' |
|
|
|
import { useSortable } from './sort' |
|
|
|
import { useSortable } from './sort' |
|
|
|
import { |
|
|
|
import { |
|
|
@ -129,6 +130,10 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rowHeight = inject(RowHeightInj, ref(1.8)) |
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -153,7 +158,7 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e) => { |
|
|
|
<div |
|
|
|
<div |
|
|
|
v-if="!isReadonly" |
|
|
|
v-if="!isReadonly" |
|
|
|
:class="{ 'mx-auto px-4': !visibleItems.length }" |
|
|
|
:class="{ 'mx-auto px-4': !visibleItems.length }" |
|
|
|
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)" |
|
|
|
class="group cursor-pointer 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)" |
|
|
|
data-testid="attachment-cell-file-picker-button" |
|
|
|
data-testid="attachment-cell-file-picker-button" |
|
|
|
@click.stop="open" |
|
|
|
@click.stop="open" |
|
|
|
> |
|
|
|
> |
|
|
@ -162,7 +167,7 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e) => { |
|
|
|
<a-tooltip v-else placement="bottom"> |
|
|
|
<a-tooltip v-else placement="bottom"> |
|
|
|
<template #title> Click or drop a file into cell</template> |
|
|
|
<template #title> Click or drop a file into cell</template> |
|
|
|
|
|
|
|
|
|
|
|
<div class="flex items-center gap-2"> |
|
|
|
<div class="flex items-center gap-1"> |
|
|
|
<MaterialSymbolsAttachFile |
|
|
|
<MaterialSymbolsAttachFile |
|
|
|
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-accent scale-120) text-gray-500 text-[0.75rem]" |
|
|
|
/> |
|
|
|
/> |
|
|
@ -183,7 +188,10 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e) => { |
|
|
|
<div |
|
|
|
<div |
|
|
|
ref="sortableRef" |
|
|
|
ref="sortableRef" |
|
|
|
:class="{ dragging }" |
|
|
|
:class="{ dragging }" |
|
|
|
class="flex cursor-pointer justify-center items-center flex-wrap gap-2 p-1 scrollbar-thin-dull max-h-[150px] overflow-auto" |
|
|
|
class="flex cursor-pointer justify-center items-center flex-wrap gap-2 py-1.5 scrollbar-thin-dull overflow-hidden mt-0 items-start" |
|
|
|
|
|
|
|
:style="{ |
|
|
|
|
|
|
|
maxHeight: `max(${(rowHeight || 1) * 1.8}rem, 41px)`, |
|
|
|
|
|
|
|
}" |
|
|
|
> |
|
|
|
> |
|
|
|
<template v-for="(item, i) of visibleItems" :key="item.url || item.title"> |
|
|
|
<template v-for="(item, i) of visibleItems" :key="item.url || item.title"> |
|
|
|
<a-tooltip placement="bottom"> |
|
|
|
<a-tooltip placement="bottom"> |
|
|
@ -193,7 +201,7 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e) => { |
|
|
|
<div v-if="isImage(item.title, item.mimetype ?? item.type)"> |
|
|
|
<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" @click.stop="selectedImage = item"> |
|
|
|
<LazyCellAttachmentImage |
|
|
|
<LazyCellAttachmentImage |
|
|
|
class="max-h-full max-w-full" |
|
|
|
class="max-h-[1.8rem] max-w-[1.8rem]" |
|
|
|
:alt="item.title || `#${i}`" |
|
|
|
:alt="item.title || `#${i}`" |
|
|
|
:srcs="getPossibleAttachmentSrc(item)" |
|
|
|
:srcs="getPossibleAttachmentSrc(item)" |
|
|
|
/> |
|
|
|
/> |
|
|
@ -233,7 +241,7 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e) => { |
|
|
|
.nc-cell { |
|
|
|
.nc-cell { |
|
|
|
.nc-attachment-cell { |
|
|
|
.nc-attachment-cell { |
|
|
|
.nc-attachment { |
|
|
|
.nc-attachment { |
|
|
|
@apply w-[50px] h-[50px] min-h-[50px] min-w-[50px] ring-1 ring-gray-300 rounded; |
|
|
|
@apply w-[1.8rem] h-[1.8rem] min-h-[1.8rem] min-w-[1.8rem] ring-1 ring-gray-300 rounded; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.ghost, |
|
|
|
.ghost, |
|
|
|