Browse Source

feat(nc-gui): scroll to active date in year view

pull/7731/head
DarkPhoenix2704 6 months ago
parent
commit
7fb7c76e21
  1. 2
      packages/nc-gui/components/nc/DateWeekSelector.vue
  2. 4
      packages/nc-gui/components/smartsheet/calendar/MonthView.vue
  3. 2
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue
  4. 5
      packages/nc-gui/components/smartsheet/calendar/index.vue

2
packages/nc-gui/components/nc/DateWeekSelector.vue

@ -180,7 +180,7 @@ const paginate = (action: 'next' | 'prev') => {
'text-gray-400': !isDateInCurrentMonth(date),
'nc-selected-week-start': isSameDate(date, selectedWeek?.start),
'nc-selected-week-end': isSameDate(date, selectedWeek?.end),
'rounded-md bg-brand-50 text-brand-500': isSameDate(date, dayjs()) && isDateInCurrentMonth(date),
'rounded-md bg-brand-50 nc-calendar-today text-brand-500': isSameDate(date, dayjs()) && isDateInCurrentMonth(date),
}"
class="h-9 w-9 px-1 py-2 relative font-medium flex items-center cursor-pointer justify-center"
data-testid="nc-calendar-date"

4
packages/nc-gui/components/smartsheet/calendar/MonthView.vue

@ -497,7 +497,7 @@ const onResizeEnd = () => {
const onResizeStart = (direction: 'right' | 'left', event: MouseEvent, record: Row) => {
if (!isUIAllowed('dataEdit') || draggingId.value) return
selectedDate.value = null
// selectedDate.value = null
resizeInProgress.value = true
resizeDirection.value = direction
resizeRecord.value = record
@ -556,7 +556,7 @@ const dragStart = (event: MouseEvent, record: Row) => {
})
dragRecord.value = record
selectedDate.value = null
// selectedDate.value = null
isDragging.value = true
dragElement.value = target

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

@ -192,7 +192,7 @@ 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.min(
Math.max(
datesHours.value[dayIndex].findIndex((h) => h.startOf('hour').format('HH:mm') === hourKey),
datesHours.value[dayIndex]?.findIndex((h) => h.startOf('hour').format('HH:mm') === hourKey),
0,
),
23,

5
packages/nc-gui/components/smartsheet/calendar/index.vue

@ -140,6 +140,11 @@ const goToToday = () => {
start: dayjs().startOf('week'),
end: dayjs().endOf('week'),
}
document?.querySelector('.nc-calendar-today')?.scrollIntoView({
behavior: 'smooth',
block: 'center',
})
}
const headerText = computed(() => {

Loading…
Cancel
Save