From 3899c59f3f679efb42b6c8b194f7b79dacad3e48 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Tue, 20 Feb 2024 07:16:22 +0000 Subject: [PATCH] fix(nc-gui): overflow & fill cell --- .../calendar/WeekView/DateTimeField.vue | 208 +++++++++--------- 1 file changed, 105 insertions(+), 103 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue index 85e116ed34..8f099c3fb8 100644 --- a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue @@ -159,15 +159,18 @@ const recordsAcrossAllRange = computed<{ } // We calculate the index of the hour in the day and set the top and height of the record - const hourIndex = Math.max( - datesHours.value[dayIndex].findIndex((h) => h.startOf('hour').format('HH:mm') === hourKey), - 0, + const hourIndex = Math.min( + Math.max( + datesHours.value[dayIndex].findIndex((h) => h.startOf('hour').format('HH:mm') === hourKey), + 0, + ), + 23, ) style = { ...style, - top: `${hourIndex * perHeight - hourIndex + 6}px`, - height: `${perHeight - 10}px`, + top: `${hourIndex * perHeight - hourIndex - hourIndex * 0.15}px`, + height: `${perHeight - 2}px`, } recordsToDisplay.push({ @@ -489,8 +492,6 @@ const calculateNewRow = ( const day = Math.max(0, Math.min(6, Math.floor(percentX * 7))) const hour = Math.max(0, Math.min(23, Math.floor(percentY * 24))) - console.log('day', day, 'hour', hour) - const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day').add(hour, 'hour') if (!newStartDate) return { newRow: null, updatedProperty: [] } @@ -658,110 +659,115 @@ const viewMore = (hour: dayjs.Dayjs) => { + + @@ -769,10 +775,6 @@ const viewMore = (hour: dayjs.Dayjs) => {