fix(nc-gui): date, year cell content truncate issue

This commit is contained in:
Ramesh Mane
2025-01-28 13:18:32 +00:00
parent ccb52c14be
commit 39e6f9b832
6 changed files with 24 additions and 42 deletions

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import dayjs from 'dayjs'
import { dateFormats, isSystemColumn, timeFormats } from 'nocodb-sdk'
import { timeCellMaxWidthMap } from './utils'
interface Props {
modelValue?: string | null
@@ -436,20 +437,7 @@ function handleSelectTime(value: dayjs.Dayjs) {
}
const timeCellMaxWidth = computed(() => {
return {
[timeFormats[0]]: {
12: 'max-w-[85px]',
24: 'max-w-[65px]',
},
[timeFormats[1]]: {
12: 'max-w-[100px]',
24: 'max-w-[80px]',
},
[timeFormats[2]]: {
12: 'max-w-[130px]',
24: 'max-w-[110px]',
},
}[timeFormat.value][parseProp(column.value.meta).is12hrFormat ? 12 : 24]
return timeCellMaxWidthMap?.[timeFormat.value]?.[parseProp(column.value.meta).is12hrFormat ? 12 : 24]
})
const cellValue = computed(
@@ -585,8 +573,6 @@ const currentDate = ($event) => {
@click.stop="handleSelectDate()"
/>
</div>
<div v-if="!editable && isGrid" class="absolute inset-0 z-90 cursor-pointer"></div>
</template>
<style scoped>

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { dateFormats, timeFormats } from 'nocodb-sdk'
import dayjs from 'dayjs'
import { timeCellMaxWidthMap } from './utils'
interface Props {
modelValue?: string | null
@@ -47,20 +48,7 @@ const cellValue = computed(
)
const timeCellMaxWidth = computed(() => {
return {
[timeFormats[0]]: {
12: 'max-w-[85px]',
24: 'max-w-[65px]',
},
[timeFormats[1]]: {
12: 'max-w-[100px]',
24: 'max-w-[80px]',
},
[timeFormats[2]]: {
12: 'max-w-[130px]',
24: 'max-w-[110px]',
},
}[timeFormat.value][parseProp(column.value.meta).is12hrFormat ? 12 : 24]
return timeCellMaxWidthMap?.[timeFormat.value]?.[parseProp(column.value.meta).is12hrFormat ? 12 : 24]
})
</script>
@@ -75,10 +63,3 @@ const timeCellMaxWidth = computed(() => {
</div>
</div>
</template>
<style scoped lang="scss">
.nc-cell-picker-datetime {
@apply text-[13px] leading-4;
font-weight: 500;
}
</style>

View File

@@ -0,0 +1,16 @@
import { timeFormats } from 'nocodb-sdk'
export const timeCellMaxWidthMap = {
[timeFormats[0]]: {
12: 'max-w-[85px]',
24: 'max-w-[65px]',
},
[timeFormats[1]]: {
12: 'max-w-[100px]',
24: 'max-w-[80px]',
},
[timeFormats[2]]: {
12: 'max-w-[130px]',
24: 'max-w-[110px]',
},
}