Browse Source

fix(nc-gui): auto scroll down to record in week and day view

pull/7997/head
DarkPhoenix2704 8 months ago
parent
commit
533e775e69
  1. 11
      packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue
  2. 9
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue

11
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 },
)
</script>
<template>

9
packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue

@ -717,6 +717,15 @@ const addRecord = (date: dayjs.Dayjs) => {
}
emits('newRecord', newRecord)
}
watch(
() => recordsAcrossAllRange.value,
() => {
if (dragRecord.value) return
document.querySelectorAll('.draggable-record').item(0)?.scrollIntoView({ behavior: 'smooth', block: 'center' })
},
{ immediate: true },
)
</script>
<template>

Loading…
Cancel
Save