From d3a33ef4b374c98f4f35ef64f28d8511d07627fb Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Wed, 28 Feb 2024 10:11:39 +0000 Subject: [PATCH] feat(nc-gui): week view include granularity --- packages/nc-gui/components/smartsheet/calendar/Cell.vue | 1 - .../smartsheet/calendar/DayView/DateTimeField.vue | 2 +- .../nc-gui/components/smartsheet/calendar/MonthView.vue | 4 ---- .../smartsheet/calendar/WeekView/DateTimeField.vue | 6 +++--- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/calendar/Cell.vue b/packages/nc-gui/components/smartsheet/calendar/Cell.vue index 2f22680777..8a9c6a1db3 100644 --- a/packages/nc-gui/components/smartsheet/calendar/Cell.vue +++ b/packages/nc-gui/components/smartsheet/calendar/Cell.vue @@ -260,7 +260,6 @@ const getLookupValue = (modelValue: string | null | number | Array, col: Co } const getAttachmentValue = (modelValue: string | null | number | Array) => { - console.log(modelValue) if (Array.isArray(modelValue)) { return modelValue.map((v) => `${v.title} (${getPossibleAttachmentSrc(v).join(', ')})`).join(', ') } diff --git a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue index 4c9f56c872..16668fb226 100644 --- a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue @@ -336,7 +336,7 @@ const calculateNewRow = (event: MouseEvent) => { // We calculate the hour based on the percentage of the mouse position in the scroll container // It can be between 0 and 23 (inclusive) const hour = Math.max(Math.floor(percentY * 23), 0) - const minutes = Math.floor(((percentY * 22 - hour) * 60) / 15) * 15 + const minutes = Math.max(0, Math.min(59, Math.floor(((percentY * 22 - hour) * 60) / 15) * 15)) // We calculate the new startDate by adding the hour to the start of the selected date const newStartDate = dayjs(selectedDate.value).startOf('day').add(hour, 'hour').add(minutes, 'minute') diff --git a/packages/nc-gui/components/smartsheet/calendar/MonthView.vue b/packages/nc-gui/components/smartsheet/calendar/MonthView.vue index 9b90d7e51b..ffd9fa2adc 100644 --- a/packages/nc-gui/components/smartsheet/calendar/MonthView.vue +++ b/packages/nc-gui/components/smartsheet/calendar/MonthView.vue @@ -508,12 +508,8 @@ const onResizeStart = (direction: 'right' | 'left', event: MouseEvent, record: R const stopDrag = (event: MouseEvent) => { clearTimeout(dragTimeout.value) - - console.log('stopDrag') - console.log('stopDrag', dragRecord.value, isDragging.value) if (!isUIAllowed('dataEdit') || !dragRecord.value || !isDragging.value) return - console.log('stopDrag') event.preventDefault() dragElement.value!.style.boxShadow = 'none' diff --git a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue index b2ee6aaf4e..b1803ac78a 100644 --- a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue @@ -528,7 +528,7 @@ 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))) - const minutes = Math.floor(((percentY * 22 - hour) * 60) / 15) * 15 + const minutes = Math.max(0, Math.min(59, Math.floor(((percentY * 22 - hour) * 60) / 15) * 15)) const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day').add(hour, 'hour').add(minutes, 'minute') if (!newStartDate) return { newRow: null, updatedProperty: [] } @@ -589,9 +589,9 @@ const onDrag = (event: MouseEvent) => { const scrollBottomThreshold = 20 if (event.clientY > containerRect.bottom - scrollBottomThreshold) { - scrollContainer.value.scrollTop += 10 + scrollContainer.value.scrollTop += 20 } else if (event.clientY < containerRect.top + scrollBottomThreshold) { - scrollContainer.value.scrollTop -= 10 + scrollContainer.value.scrollTop -= 20 } calculateNewRow(event)