From 533e775e69ddd3054a1c367c3fe3c53a6ac6fc56 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Fri, 29 Mar 2024 05:23:04 +0000 Subject: [PATCH] fix(nc-gui): auto scroll down to record in week and day view --- .../smartsheet/calendar/DayView/DateTimeField.vue | 11 +++++++++++ .../smartsheet/calendar/WeekView/DateTimeField.vue | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue index 2a89b42318..2c4c025d6c 100644 --- a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue @@ -842,6 +842,17 @@ const newRecord = (hour: dayjs.Dayjs) => { } emit('newRecord', record) } + +watch( + () => recordsAcrossAllRange.value, + () => { + setTimeout(() => { + if (isDragging.value) return + document.querySelectorAll('.draggable-record').item(0)?.scrollIntoView({ behavior: 'smooth', block: 'center' }) + }, 100) + }, + { immediate: true }, +)