Browse Source

fix: min width for attachment column

pull/8990/head
DarkPhoenix2704 4 months ago
parent
commit
35d26c9b70
No known key found for this signature in database
GPG Key ID: 3F76B10622A07849
  1. 5
      packages/nc-gui/components/cell/attachment/AttachFile.vue
  2. 26
      packages/nc-gui/components/smartsheet/grid/Table.vue

5
packages/nc-gui/components/cell/attachment/AttachFile.vue

@ -51,6 +51,7 @@ watch(activeMenu, (newVal, oldValue) => {
<NcMenu class="!h-full !bg-gray-50"> <NcMenu class="!h-full !bg-gray-50">
<NcMenuItem <NcMenuItem
key="local" key="local"
class="!hover:bg-gray-200 !hover:text-gray-800 rounded-md"
:class="{ :class="{
'active-menu': activeMenu === 'local', 'active-menu': activeMenu === 'local',
}" }"
@ -64,6 +65,7 @@ watch(activeMenu, (newVal, oldValue) => {
<NcMenuItem <NcMenuItem
v-if="!isPublic" v-if="!isPublic"
key="url" key="url"
class="!hover:bg-gray-200 !hover:text-gray-800 rounded-md"
:class="{ :class="{
'active-menu': activeMenu === 'url', 'active-menu': activeMenu === 'url',
}" }"
@ -76,6 +78,7 @@ watch(activeMenu, (newVal, oldValue) => {
</NcMenuItem> </NcMenuItem>
<NcMenuItem <NcMenuItem
key="webcam" key="webcam"
class="!hover:bg-gray-200 !hover:text-gray-800 rounded-md"
:class="{ :class="{
'active-menu': activeMenu === 'webcam', 'active-menu': activeMenu === 'webcam',
}" }"
@ -115,7 +118,7 @@ watch(activeMenu, (newVal, oldValue) => {
<style lang="scss"> <style lang="scss">
.nc-modal-attachment-create { .nc-modal-attachment-create {
.active-menu { .active-menu {
@apply !bg-gray-200 font-sembold text-brand-500 rounded-md; @apply bg-brand-50 font-sembold text-brand-500 rounded-md;
} }
} }

26
packages/nc-gui/components/smartsheet/grid/Table.vue

@ -128,6 +128,7 @@ const {
isViewColumnsLoading: _isViewColumnsLoading, isViewColumnsLoading: _isViewColumnsLoading,
updateGridViewColumn, updateGridViewColumn,
gridViewCols, gridViewCols,
metaColumnById,
resizingColOldWith, resizingColOldWith,
} = useViewColumnsOrThrow() } = useViewColumnsOrThrow()
@ -1102,12 +1103,33 @@ const saveOrUpdateRecords = async (
// #Grid Resize // #Grid Resize
const onresize = (colID: string | undefined, event: any) => { const onresize = (colID: string | undefined, event: any) => {
if (!colID) return if (!colID) return
updateGridViewColumn(colID, { width: event.detail })
// Set 80px minimum width for attachment cells
if (metaColumnById.value[colID].uidt === UITypes.Attachment) {
const size = event.detail.split('px')[0]
if (+size < 80) {
updateGridViewColumn(colID, { width: '80px' })
} else {
updateGridViewColumn(colID, { width: event.detail })
}
} else {
updateGridViewColumn(colID, { width: event.detail })
}
} }
const onXcResizing = (cn: string | undefined, event: any) => { const onXcResizing = (cn: string | undefined, event: any) => {
if (!cn) return if (!cn) return
gridViewCols.value[cn].width = `${event.detail}` // Set 80px minimum width for attachment cells
if (metaColumnById.value[cn].uidt === UITypes.Attachment) {
const size = event.detail.split('px')[0]
if (+size < 80) {
gridViewCols.value[cn].width = '80px'
} else {
gridViewCols.value[cn].width = `${event.detail}`
}
} else {
gridViewCols.value[cn].width = `${event.detail}`
}
} }
const onXcStartResizing = (cn: string | undefined, event: any) => { const onXcStartResizing = (cn: string | undefined, event: any) => {

Loading…
Cancel
Save