Browse Source

feat: within cell show full image with fixed height and in expanded keep height fixed and crop rest if overflows

pull/8426/head
Pranav C 2 months ago
parent
commit
254078e9b6
  1. 2
      packages/nc-gui/components/cell/attachment/Image.vue
  2. 13
      packages/nc-gui/components/cell/attachment/index.vue

2
packages/nc-gui/components/cell/attachment/Image.vue

@ -16,7 +16,7 @@ const onError = () => index.value++
<template> <template>
<LazyNuxtImg <LazyNuxtImg
v-if="index < props.srcs.length" v-if="index < props.srcs.length"
class="m-auto object-cover" class="m-auto h-full w-auto"
:src="props.srcs[index]" :src="props.srcs[index]"
:alt="props?.alt || ''" :alt="props?.alt || ''"
placeholder placeholder

13
packages/nc-gui/components/cell/attachment/index.vue

@ -282,8 +282,8 @@ const keydownSpace = (e: KeyboardEvent) => {
</template> </template>
<div v-if="isImage(item.title, item.mimetype ?? item.type)"> <div v-if="isImage(item.title, item.mimetype ?? item.type)">
<div <div
class="nc-attachment flex items-center flex-col flex-wrap justify-center" class="nc-attachment flex items-center flex-col flex-wrap justify-center flex-auto"
:class="{ 'ml-2': active }" :class="{ 'ml-2': active, '!w-30': isForm || isExpandedForm }"
@click="() => onImageClick(item)" @click="() => onImageClick(item)"
> >
<LazyCellAttachmentImage <LazyCellAttachmentImage
@ -292,10 +292,9 @@ const keydownSpace = (e: KeyboardEvent) => {
:class="{ :class="{
'h-5.5': !isGrid && (!rowHeight || rowHeight === 1), 'h-5.5': !isGrid && (!rowHeight || rowHeight === 1),
'h-4.5': isGrid && (!rowHeight || rowHeight === 1), 'h-4.5': isGrid && (!rowHeight || rowHeight === 1),
'w-8.8': rowHeight === 1, 'h-8': rowHeight === 2,
'h-8 w-12.8': rowHeight === 2, 'h-16.8': rowHeight === 4,
'h-16.8 w-20.8': rowHeight === 4, 'h-20.8': rowHeight === 6 || isForm || isExpandedForm,
'h-20.8 !w-30': isForm || isExpandedForm || rowHeight === 6,
}" }"
:srcs="getPossibleAttachmentSrc(item)" :srcs="getPossibleAttachmentSrc(item)"
/> />
@ -341,7 +340,7 @@ const keydownSpace = (e: KeyboardEvent) => {
.nc-cell { .nc-cell {
.nc-attachment-cell { .nc-attachment-cell {
.nc-attachment { .nc-attachment {
@apply min-h-5.5 min-w-[1.8rem] !ring-1 !ring-gray-300 !rounded; @apply min-h-5.5 !ring-1 !ring-gray-300 !rounded;
} }
.ghost, .ghost,

Loading…
Cancel
Save