From 5c22465a64995e1be1a914abc78e2563e9c8aa41 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Tue, 20 Feb 2024 07:16:15 +0000 Subject: [PATCH] fix(nc-gui): max drag to end of week --- packages/nc-gui/components/nc/DateWeekSelector.vue | 6 +++--- .../components/smartsheet/calendar/WeekView/DateField.vue | 4 ++-- packages/nc-gui/components/smartsheet/calendar/index.vue | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/nc/DateWeekSelector.vue b/packages/nc-gui/components/nc/DateWeekSelector.vue index f335719218..d9bc66ab5b 100644 --- a/packages/nc-gui/components/nc/DateWeekSelector.vue +++ b/packages/nc-gui/components/nc/DateWeekSelector.vue @@ -198,18 +198,18 @@ const paginate = (action: 'next' | 'prev') => { } .nc-selected-week:before { - @apply absolute top-0 left-0 w-full h-full border-y-2 bg-brand-50 border-brand-500; + @apply absolute top-0 left-0 w-full h-full border-y-1 bg-brand-50 border-brand-500; content: ''; width: 124%; height: 100%; } .nc-selected-week-start:before { - @apply !border-l-2 !rounded-l-lg; + @apply !border-l-1 !rounded-l-lg; } .nc-selected-week-end:before { width: 100%; - @apply !border-r-2 !rounded-r-lg; + @apply !border-r-1 !rounded-r-lg; } diff --git a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue index 3431ab17c3..988b3c8f2f 100644 --- a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue @@ -231,7 +231,7 @@ const onResize = (event: MouseEvent) => { const ogEndDate = dayjs(resizeRecord.value.row[toCol.title!]) const ogStartDate = dayjs(resizeRecord.value.row[fromCol.title!]) - const day = Math.floor(percentX * 7) + const day = Math.min(Math.floor(percentX * 7), 6) if (resizeDirection.value === 'right') { let newEndDate = dayjs(selectedDateRange.value.start).add(day, 'day') @@ -318,7 +318,7 @@ const onDrag = (event: MouseEvent) => { if (!fromCol) return - const day = Math.floor(percentX * 7) + const day = Math.min(Math.floor(percentX * 7), 6) const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day') if (!newStartDate) return diff --git a/packages/nc-gui/components/smartsheet/calendar/index.vue b/packages/nc-gui/components/smartsheet/calendar/index.vue index eab740b996..3c6c3fef11 100644 --- a/packages/nc-gui/components/smartsheet/calendar/index.vue +++ b/packages/nc-gui/components/smartsheet/calendar/index.vue @@ -160,6 +160,7 @@ const headerText = computed(() => { 'w-36': activeCalendarView === 'month', 'w-40': activeCalendarView === 'day', 'w-20': activeCalendarView === 'year', + 'w-50': activeCalendarView === 'week', }" size="small" type="secondary"