mood-ui 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data-display/calendar/AgendaView.cjs.map +1 -1
- package/dist/components/data-display/calendar/AgendaView.mjs.map +1 -1
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs +7 -5
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs +14 -12
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.cjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.mjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs +7 -5
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs +15 -13
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.cjs +1 -1
- package/dist/components/data-display/calendar/MonthView.cjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.mjs +1 -1
- package/dist/components/data-display/calendar/MonthView.mjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs +7 -5
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs +10 -8
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.cjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.mjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs +7 -5
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs +15 -13
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.cjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.mjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs +7 -5
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs +15 -13
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs +3 -3
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +5 -5
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +5 -5
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/mood-ui.css +1 -1
- package/dist/types/utils/calendarTooltip.d.ts +13 -0
- package/dist/utils/calendarTooltip.cjs +18 -0
- package/dist/utils/calendarTooltip.cjs.map +1 -0
- package/dist/utils/calendarTooltip.mjs +18 -0
- package/dist/utils/calendarTooltip.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgendaView.cjs","names":[],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n :style=\"{ maxHeight: toCssLength(maxHeight) }\"\n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <template #default=\"{ event, allDay }\"> \n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" /> \n </template> \n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nimport { toCssLength } from '../../../utils/cssLength';\n\nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n</script>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"AgendaView.cjs","names":[],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n :style=\"{ maxHeight: toCssLength(maxHeight) }\"\n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <!--\n A provided slot replaces the built-in card, so it gets the surface\n here; with no slot the fallback content keeps rendering its own.\n -->\n <template v-if=\"$slots['event-tooltip']\" #default=\"{ event, allDay }\">\n <div :class=\"CALENDAR_TOOLTIP_SURFACE\">\n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" />\n </div>\n </template>\n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nimport { toCssLength } from '../../../utils/cssLength';\n\nimport { CALENDAR_TOOLTIP_SURFACE } from '../../../utils/calendarTooltip';\n\nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n</script>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgendaView.mjs","names":[],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n :style=\"{ maxHeight: toCssLength(maxHeight) }\"\n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <template #default=\"{ event, allDay }\"> \n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" /> \n </template> \n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nimport { toCssLength } from '../../../utils/cssLength';\n\nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n</script>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"AgendaView.mjs","names":[],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n :style=\"{ maxHeight: toCssLength(maxHeight) }\"\n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <!--\n A provided slot replaces the built-in card, so it gets the surface\n here; with no slot the fallback content keeps rendering its own.\n -->\n <template v-if=\"$slots['event-tooltip']\" #default=\"{ event, allDay }\">\n <div :class=\"CALENDAR_TOOLTIP_SURFACE\">\n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" />\n </div>\n </template>\n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nimport { toCssLength } from '../../../utils/cssLength';\n\nimport { CALENDAR_TOOLTIP_SURFACE } from '../../../utils/calendarTooltip';\n\nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n</script>\n"],"mappings":""}
|
package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const require_useEventHover = require("../../../composables/useEventHover.cjs");
|
|
|
6
6
|
const require_CalendarEventTooltip = require("./CalendarEventTooltip.cjs");
|
|
7
7
|
const require_CalendarHeader = require("./CalendarHeader.cjs");
|
|
8
8
|
const require_cssLength = require("../../../utils/cssLength.cjs");
|
|
9
|
+
const require_calendarTooltip = require("../../../utils/calendarTooltip.cjs");
|
|
9
10
|
let vue = require("vue");
|
|
10
11
|
let gsap = require("gsap");
|
|
11
12
|
gsap = require_runtime.__toESM(gsap, 1);
|
|
@@ -601,13 +602,14 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
601
602
|
state: (0, vue.unref)(hoverState),
|
|
602
603
|
style: (0, vue.normalizeStyle)((0, vue.unref)(tooltipStyle)),
|
|
603
604
|
formatTime: formatEventTime
|
|
604
|
-
}, {
|
|
605
|
-
|
|
605
|
+
}, (0, vue.createSlots)({ _: 2 }, [_ctx.$slots["event-tooltip"] ? {
|
|
606
|
+
name: "default",
|
|
607
|
+
fn: (0, vue.withCtx)(({ event, allDay }) => [(0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)((0, vue.unref)(require_calendarTooltip.CALENDAR_TOOLTIP_SURFACE)) }, [(0, vue.renderSlot)(_ctx.$slots, "event-tooltip", {
|
|
606
608
|
event,
|
|
607
609
|
allDay
|
|
608
|
-
})]),
|
|
609
|
-
|
|
610
|
-
},
|
|
610
|
+
})], 2)]),
|
|
611
|
+
key: "0"
|
|
612
|
+
} : void 0]), 1032, ["state", "style"])
|
|
611
613
|
], 38);
|
|
612
614
|
};
|
|
613
615
|
}
|
package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgendaView.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n :style=\"{ maxHeight: toCssLength(maxHeight) }\"\n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <template #default=\"{ event, allDay }\"> \n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" /> \n </template> \n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nimport { toCssLength } from '../../../utils/cssLength';\n\nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8HA,MAAM,MAAM,sBAAA,eAAe;EAS3B,MAAM,QAAQ;EA0Bd,MAAM,OAAO;EAQb,MAAM,gBAAgB,MAAY,IAAI,KAAK,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,EAAE;EAC5E,MAAM,eAAe,MAAY,IAAI,KAAK,EAAE,aAAa,EAAE,EAAE,UAAU,GAAG,GAAG,EAAE,CAAC,SAAS;EAEzF,MAAM,cAAA,GAAA,IAAA,KAAiB,aAAa,IAAI,KAAK,MAAM,WAAW,CAAC,C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A,IAAA,iBAA2F,GAAG,YAAW,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;;QAGrG,GAAG,aAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAA2I,QAA1J,aAA6I,SAAM,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;;;MAKxJ,OAAO,OAAA,MAAO,SAAM,MAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAAwB,OAAvD,YAAuD,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;;;yBAQxC,6BAAA,SAAA;KAJA,QAAA,GAAA,IAAA,OAAO,WAAU;KAAG,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,aAAY,CAAA;KAAG,YAAY;;KAC9D,UAAA,GAAA,IAAA,UACsD,EAD3C,OAAO,aAAM,EAAA,GAAA,IAAA,YAC8B,KAAA,QAAA,iBAAA;MAA1B;MAAgB"}
|
|
1
|
+
{"version":3,"file":"AgendaView.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../../src/components/data-display/calendar/AgendaView.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none', containerRadiusClass, bordered ? 'border border-border' : '']\" \n :style=\"{ maxHeight: toCssLength(maxHeight) }\"\n @keydown=\"handleKeydown\" \n > \n <slot name=\"header\" :label=\"headerLabel\" :goToToday=\"handleToday\" :prev=\"handlePrev\" :next=\"handleNext\" :prevYear=\"handlePrevYear\" :nextYear=\"handleNextYear\"> \n <CalendarHeader \n :label=\"headerLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearNavigation\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :color=\"resolvedColor\" \n :focusRingColorClass=\"focusRingColorClass\" \n :todayTextClass=\"todayTextClass\" \n :todayRadiusClass=\"pillRadiusClass\" \n :dayNameCaseClass=\"dayNameCaseClass\" \n @prev=\"handlePrev\" \n @next=\"handleNext\" \n @prevYear=\"handlePrevYear\" \n @nextYear=\"handleNextYear\" \n @today=\"handleToday\" \n /> \n </slot> \n \n <div ref=\"scrollRef\" class=\"flex-1 overflow-y-auto\" @scroll=\"onScroll\"> \n <div v-if=\"!groups.length\" class=\"flex-1 flex items-center justify-center py-12 text-sm text-muted-foreground\"> \n <slot name=\"empty\">{{ emptyText ?? loc.agenda.empty }}</slot> \n </div> \n \n <template v-for=\"(g, gi) in groups\" :key=\"g.key\"> \n <div \n v-if=\"showMonthSeparator && g.showMonthHeader\" \n class=\"sticky top-0 z-20 bg-card/95 backdrop-blur px-4 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border\" \n > \n {{ g.monthLabel }} \n </div> \n \n <div \n :data-dkey=\"g.key\" \n :class=\"[ \n 'grid border-b border-border transition-colors', \n g.isToday ? 'bg-muted/40' : '', \n g.disabled ? 'opacity-60' : '', \n ]\" \n style=\"grid-template-columns: 5rem 1fr;\" \n > \n <div class=\"flex flex-col items-center justify-start py-4 border-r border-border\"> \n <slot name=\"day-header\" :date=\"g.date\" :isToday=\"g.isToday\" :events=\"g.events\"> \n <span :class=\"['text-[10px] font-medium tracking-wider text-muted-foreground', dayNameCaseClass]\">{{ g.weekdayLabel }}</span> \n <span \n :class=\"[ \n 'mt-1 inline-flex items-center justify-center text-base font-semibold w-9 h-9', \n pillRadiusClass, \n g.isToday ? [todayBgClass] : 'text-foreground', \n ]\" \n >{{ g.day }}</span> \n <span v-if=\"isHighlightedDate(g.date)\" :class=\"['mt-1 w-1 h-1 rounded-full', highlightDotClass]\"></span> \n </slot> \n </div> \n \n <div class=\"py-2 px-3\"> \n <div v-if=\"!g.events.length\" class=\"py-2 text-xs text-muted-foreground/60 italic\"> \n No events \n </div> \n <div v-else class=\"flex flex-col\"> \n <button \n v-for=\"ev in g.events\" \n :key=\"`${g.key}-${ev.id}`\" \n :data-eid=\"ev.id\" \n type=\"button\" \n @click=\"handleEventClick(ev, $event)\" \n @mouseenter=\"onEventEnter(ev, !!ev.allDay, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :class=\"['group flex items-start gap-3 py-2 px-2 -mx-2 cursor-pointer transition-colors hover:bg-muted/70 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring', eventRadiusClass]\" \n > \n <span class=\"shrink-0 w-16 pt-0.5 text-[11px] font-medium text-muted-foreground tabular-nums\"> \n <template v-if=\"ev.allDay\">All day</template> \n <template v-else>{{ formatEventTime(ev.start) }}</template> \n </span> \n <span \n class=\"shrink-0 mt-1.5 w-2 h-2\" \n :style=\"ev.colorHex ? { backgroundColor: ev.colorHex } : undefined\" \n :class=\"[pillRadiusClass, !ev.colorHex ? dotColorClass(ev.color) : '']\" \n ></span> \n <span class=\"flex-1 min-w-0\"> \n <slot name=\"event\" :event=\"ev\"> \n <span class=\"block text-sm font-medium text-foreground truncate\">{{ ev.title }}</span> \n <span v-if=\"!ev.allDay && ev.end\" class=\"block text-[11px] text-muted-foreground\"> \n {{ formatEventTime(ev.start) }} – {{ formatEventTime(ev.end) }} \n </span> \n <span v-if=\"ev.description\" class=\"block text-xs text-muted-foreground truncate mt-0.5\">{{ ev.description }}</span> \n </slot> \n </span> \n <span v-if=\"ev.readonly\" class=\"shrink-0 mt-0.5 text-[9px] uppercase tracking-wider text-muted-foreground border border-border px-1 rounded\">Locked</span> \n </button> \n </div> \n </div> \n </div> \n <div v-if=\"gi === groups.length - 1\" class=\"h-1\"></div> \n </template> \n </div> \n \n <CalendarEventTooltip :state=\"hoverState\" :style=\"tooltipStyle\" :formatTime=\"formatEventTime\"> \n <!--\n A provided slot replaces the built-in card, so it gets the surface\n here; with no slot the fallback content keeps rendering its own.\n -->\n <template v-if=\"$slots['event-tooltip']\" #default=\"{ event, allDay }\">\n <div :class=\"CALENDAR_TOOLTIP_SURFACE\">\n <slot name=\"event-tooltip\" :event=\"event\" :allDay=\"allDay\" />\n </div>\n </template>\n </CalendarEventTooltip> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { ref, computed, watch, nextTick, onMounted } from 'vue'; \nimport gsap from 'gsap'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useModoLocale } from '../../../composables/useModoConfig'; \n \nconst loc = useModoLocale(); \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { AgendaView } from '../../../interfaces/data-display/calendar/AgendaView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nimport { toCssLength } from '../../../utils/cssLength';\n\nimport { CALENDAR_TOOLTIP_SURFACE } from '../../../utils/calendarTooltip';\n\nconst props = withDefaults(defineProps<AgendaView>(), { \n modelValue: () => new Date(), \n events: () => [], \n locale: 'default', \n color: 'default', \n bordered: true, \n daysToShow: 30, \n daysBefore: 0, \n showEmptyDays: false, \n showHeader: true, \n showMonthSeparator: true, \n showYearNavigation: false, \n showMonthYearSelects: false, \n showTodayButton: true, \n dayNameFormat: 'short', \n dayNameCase: 'upper', \n format: '24h', \n readonly: false, \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n // emptyText resolves against locale when not provided. \n loadMoreChunk: 30, \n enableKeyboardNavigation: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: CalendarEvent, nativeEvent: MouseEvent]; \n 'day-click': [date: Date, events: CalendarEvent[], nativeEvent: MouseEvent]; \n 'create-event': [date: Date, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'load-more': [direction: 'forward' | 'backward']; \n}>(); \n \nconst firstOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1); \nconst daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate(); \n \nconst anchorDate = ref(firstOfMonth(new Date(props.modelValue))); \nconst daysForwardShown = ref(Math.max(props.daysToShow, daysInMonth(anchorDate.value))); \n \nwatch(() => props.modelValue, (v) => { \n if (!v) return; \n const f = firstOfMonth(new Date(v)); \n if (f.getTime() === anchorDate.value.getTime()) return; \n anchorDate.value = f; \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(f)); \n}); \nwatch(() => props.daysToShow, (n) => { daysForwardShown.value = Math.max(n, daysInMonth(anchorDate.value)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst today = new Date(); \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<CalendarEvent>(); \n \nconst formatEventTime = (d: Date) => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return d.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}; \n \nconst isHighlightedDate = (d: Date) => props.highlightedDates.some(h => isSameDay(h, d)); \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst isDayDisabled = (d: Date) => { \n if (props.minDate && startOfDay(d) < startOfDay(props.minDate)) return true; \n if (props.maxDate && startOfDay(d) > startOfDay(props.maxDate)) return true; \n return isDisabledDate(d) || isDisabledWeekday(d); \n}; \n \ninterface DayGroup { \n key: string; \n date: Date; \n day: number; \n weekdayLabel: string; \n monthLabel: string; \n showMonthHeader: boolean; \n isToday: boolean; \n disabled: boolean; \n events: CalendarEvent[]; \n} \n \nconst rangeDates = computed<Date[]>(() => { \n const anchor = anchorDate.value; \n const list: Date[] = []; \n for (let i = 0; i < daysForwardShown.value; i++) { \n const d = new Date(anchor); \n d.setDate(d.getDate() + i); \n const sod = startOfDay(d); \n if (props.minDate && sod < startOfDay(props.minDate)) continue; \n if (props.maxDate && sod > startOfDay(props.maxDate)) continue; \n list.push(sod); \n } \n return list; \n}); \n \nconst eventsByDay = computed<Map<string, CalendarEvent[]>>(() => { \n const map = new Map<string, CalendarEvent[]>(); \n for (const ev of props.events) { \n const s = startOfDay(ev.start); \n const e = startOfDay(ev.end ?? ev.start); \n const d = new Date(s); \n while (d.getTime() <= e.getTime()) { \n const k = d.toDateString(); \n if (!map.has(k)) map.set(k, []); \n map.get(k)!.push(ev); \n d.setDate(d.getDate() + 1); \n } \n } \n for (const list of map.values()) { \n list.sort((a, b) => { \n if (a.allDay && !b.allDay) return -1; \n if (!a.allDay && b.allDay) return 1; \n return a.start.getTime() - b.start.getTime(); \n }); \n } \n return map; \n}); \n \nconst isoKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; \nconst parseIsoKey = (s: string): Date | null => { \n const m = s.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/); \n if (!m) return null; \n return new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])); \n}; \n \nconst groups = computed<DayGroup[]>(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const result: DayGroup[] = []; \n let lastMonthKey = ''; \n for (const date of rangeDates.value) { \n const key = isoKey(date); \n const evts = eventsByDay.value.get(date.toDateString()) ?? []; \n if (!props.showEmptyDays && !evts.length) continue; \n const monthKey = `${date.getFullYear()}-${date.getMonth()}`; \n const showMonthHeader = monthKey !== lastMonthKey; \n lastMonthKey = monthKey; \n result.push({ \n key, \n date, \n day: date.getDate(), \n weekdayLabel: date.toLocaleDateString(locale, { weekday: props.dayNameFormat }), \n monthLabel: date.toLocaleDateString(locale, { month: 'long', year: 'numeric' }), \n showMonthHeader, \n isToday: isSameDay(date, today), \n disabled: isDayDisabled(date), \n events: evts, \n }); \n } \n return result; \n}); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n const d = visibleDate.value ?? anchorDate.value; \n return d.toLocaleDateString(locale, { month: 'long', year: 'numeric' }); \n}); \n \nconst handleEventClick = (ev: CalendarEvent, e: MouseEvent) => { \n emit('event-click', ev, e); \n}; \n \nconst afterNavigate = (scrollTarget?: Date, animateScroll = false) => { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) { animateIn(); return; } \n const scEl = scrollRef.value; \n let target = 0; \n if (scrollTarget) { \n const key = isoKey(startOfDay(scrollTarget)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n } \n } \n if (animateScroll && target > 0) { \n scEl.scrollTop = 0; \n animateIn(); \n gsap.to(scEl, { scrollTop: target, duration: 0.7, ease: 'power3.inOut', delay: 0.15 }); \n } else { \n scEl.scrollTop = target; \n animateIn(); \n } \n visibleDate.value = anchorDate.value; \n }); \n}; \nconst handlePrev = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNext = () => { \n const d = new Date(anchorDate.value); \n d.setMonth(d.getMonth() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleToday = () => { \n const n = new Date(); \n const wasCurrentMonth = firstOfMonth(n).getTime() === anchorDate.value.getTime(); \n anchorDate.value = firstOfMonth(n); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(n, !wasCurrentMonth); \n if (wasCurrentMonth && scrollRef.value && rootRef.value) { \n nextTick(() => { \n const key = isoKey(startOfDay(n)); \n const el = rootRef.value!.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value!.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value!.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value!, { scrollTop: target, duration: 0.6, ease: 'power3.inOut' }); \n }); \n } \n}; \nconst handlePrevYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() - 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \nconst handleNextYear = () => { \n const d = new Date(anchorDate.value); \n d.setFullYear(d.getFullYear() + 1); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n}; \n \nconst animateIn = () => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { opacity: 0, y: 8 }, \n { opacity: 1, y: 0, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n}; \n \nlet loadingMore = false; \nconst visibleDate = ref<Date | null>(null); \nconst canExtend = () => { \n if (!props.maxDate) return true; \n const last = rangeDates.value[rangeDates.value.length - 1]; \n return !(last && startOfDay(last) >= startOfDay(props.maxDate)); \n}; \nconst onScroll = () => { \n if (!scrollRef.value) return; \n const el = scrollRef.value; \n if (rootRef.value) { \n const scRect = el.getBoundingClientRect(); \n const headers = rootRef.value.querySelectorAll<HTMLElement>('[data-dkey]'); \n let pick: Date | null = null; \n for (const h of headers) { \n const r = h.getBoundingClientRect(); \n if (r.bottom > scRect.top + 8) { \n const k = h.getAttribute('data-dkey'); \n if (k) pick = parseIsoKey(k); \n break; \n } \n } \n if (pick) visibleDate.value = pick; \n } \n if (loadingMore) return; \n const remaining = el.scrollHeight - (el.scrollTop + el.clientHeight); \n if (remaining < 120) { \n if (!canExtend()) return; \n loadingMore = true; \n daysForwardShown.value += props.loadMoreChunk; \n emit('load-more', 'forward'); \n setTimeout(() => { loadingMore = false; }, 120); \n } \n}; \n \nconst handleKeydown = (e: KeyboardEvent) => { \n if (!props.enableKeyboardNavigation) return; \n const target = e.target as HTMLElement; \n if (target.tagName === 'SELECT' || target.tagName === 'INPUT') return; \n if (e.key === 'ArrowLeft' || e.key === 'PageUp') { e.preventDefault(); handlePrev(); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); handleNext(); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \nonMounted(() => { \n nextTick(() => { \n visibleDate.value = anchorDate.value; \n animateIn(); \n if (scrollRef.value && rootRef.value) { \n const todayMonth = firstOfMonth(today); \n if (todayMonth.getTime() === anchorDate.value.getTime()) { \n const key = isoKey(startOfDay(today)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (el) { \n const scEl = scrollRef.value; \n const scRect = scEl.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scEl.scrollTop + (elRect.top - scRect.top) - 12; \n if (target > 0) { \n gsap.to(scEl, { scrollTop: target, duration: 0.9, ease: 'power3.inOut', delay: 0.25 }); \n } \n } \n } \n } \n }); \n}); \n \ndefineExpose({ \n scrollToDate(date: Date) { \n nextTick(() => { \n if (!scrollRef.value || !rootRef.value) return; \n const key = isoKey(startOfDay(date)); \n const el = rootRef.value.querySelector<HTMLElement>(`[data-dkey=\"${key}\"]`); \n if (!el) return; \n const scRect = scrollRef.value.getBoundingClientRect(); \n const elRect = el.getBoundingClientRect(); \n const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12; \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.45, ease: 'power3.inOut' }); \n }); \n }, \n}); \n \nconst { todayTextClass, dayNameCaseClass, focusRingColorClass, highlightDotClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, todayBgClass, resolvedColor } = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \n}); \n \nconst DOT_THEMED: Record<string, string> = { \n default: 'bg-muted-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \nconst DOT_SEMANTIC: Record<string, string> = { \n info: 'bg-info', \n purple: 'bg-purple', \n pink: 'bg-pink', \n}; \nconst dotColorClass = (c?: CalendarEvent['color']) => { \n if (!c) return DOT_THEMED.default; \n return DOT_THEMED[c] ?? DOT_SEMANTIC[c] ?? DOT_THEMED.default; \n}; \n \nconst localeValue = computed(() => (props.locale === 'default' ? undefined : props.locale)); \n \nconst monthOptions = computed(() => { \n const base = new Date(2024, 0, 1); \n return Array.from({ length: 12 }, (_, i) => { \n const d = new Date(base); \n d.setMonth(i); \n return d.toLocaleString(localeValue.value, { month: 'long' }); \n }); \n}); \n \nconst yearOptions = computed(() => { \n const min = props.minDate?.getFullYear() ?? anchorDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? anchorDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst selectedMonth = computed({ \n get: () => anchorDate.value.getMonth(), \n set: (mm: number) => { \n const d = new Date(anchorDate.value); \n d.setDate(1); \n d.setMonth(mm); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math.max(props.daysToShow, daysInMonth(anchorDate.value)); \n emit('update:modelValue', anchorDate.value); \n afterNavigate(); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => anchorDate.value.getFullYear(), \n set: (yy: number) => { \n const d = new Date(anchorDate.value); \n d.setFullYear(yy); \n anchorDate.value = firstOfMonth(d); \n daysForwardShown.value = Math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IAAA,YAC4B,KAAA,QAAA,iBAAA;MAA1B;MAAgB"}
|
package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs
CHANGED
|
@@ -5,8 +5,9 @@ import { useEventHover } from "../../../composables/useEventHover.mjs";
|
|
|
5
5
|
import CalendarEventTooltip_default from "./CalendarEventTooltip.mjs";
|
|
6
6
|
import CalendarHeader_default from "./CalendarHeader.mjs";
|
|
7
7
|
import { toCssLength } from "../../../utils/cssLength.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
8
|
+
import { CALENDAR_TOOLTIP_SURFACE } from "../../../utils/calendarTooltip.mjs";
|
|
9
|
+
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, normalizeStyle, onMounted, openBlock, ref, renderList, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
|
|
10
|
+
import gsap$1 from "gsap";
|
|
10
11
|
//#region src/components/data-display/calendar/AgendaView.vue?vue&type=script&setup=true&lang.ts
|
|
11
12
|
var _hoisted_1 = {
|
|
12
13
|
key: 0,
|
|
@@ -251,7 +252,7 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
251
252
|
if (animateScroll && target > 0) {
|
|
252
253
|
scEl.scrollTop = 0;
|
|
253
254
|
animateIn();
|
|
254
|
-
gsap.to(scEl, {
|
|
255
|
+
gsap$1.to(scEl, {
|
|
255
256
|
scrollTop: target,
|
|
256
257
|
duration: .7,
|
|
257
258
|
ease: "power3.inOut",
|
|
@@ -294,7 +295,7 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
294
295
|
const scRect = scrollRef.value.getBoundingClientRect();
|
|
295
296
|
const elRect = el.getBoundingClientRect();
|
|
296
297
|
const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12;
|
|
297
|
-
gsap.to(scrollRef.value, {
|
|
298
|
+
gsap$1.to(scrollRef.value, {
|
|
298
299
|
scrollTop: target,
|
|
299
300
|
duration: .6,
|
|
300
301
|
ease: "power3.inOut"
|
|
@@ -321,7 +322,7 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
321
322
|
if (!rootRef.value) return;
|
|
322
323
|
const els = rootRef.value.querySelectorAll("[data-dkey]");
|
|
323
324
|
if (!els.length) return;
|
|
324
|
-
gsap.fromTo(els, {
|
|
325
|
+
gsap$1.fromTo(els, {
|
|
325
326
|
opacity: 0,
|
|
326
327
|
y: 8
|
|
327
328
|
}, {
|
|
@@ -392,7 +393,7 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
392
393
|
const scRect = scEl.getBoundingClientRect();
|
|
393
394
|
const elRect = el.getBoundingClientRect();
|
|
394
395
|
const target = scEl.scrollTop + (elRect.top - scRect.top) - 12;
|
|
395
|
-
if (target > 0) gsap.to(scEl, {
|
|
396
|
+
if (target > 0) gsap$1.to(scEl, {
|
|
396
397
|
scrollTop: target,
|
|
397
398
|
duration: .9,
|
|
398
399
|
ease: "power3.inOut",
|
|
@@ -412,7 +413,7 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
412
413
|
const scRect = scrollRef.value.getBoundingClientRect();
|
|
413
414
|
const elRect = el.getBoundingClientRect();
|
|
414
415
|
const target = scrollRef.value.scrollTop + (elRect.top - scRect.top) - 12;
|
|
415
|
-
gsap.to(scrollRef.value, {
|
|
416
|
+
gsap$1.to(scrollRef.value, {
|
|
416
417
|
scrollTop: target,
|
|
417
418
|
duration: .45,
|
|
418
419
|
ease: "power3.inOut"
|
|
@@ -599,13 +600,14 @@ var AgendaView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
599
600
|
state: unref(hoverState),
|
|
600
601
|
style: normalizeStyle(unref(tooltipStyle)),
|
|
601
602
|
formatTime: formatEventTime
|
|
602
|
-
}, {
|
|
603
|
-
|
|
603
|
+
}, createSlots({ _: 2 }, [_ctx.$slots["event-tooltip"] ? {
|
|
604
|
+
name: "default",
|
|
605
|
+
fn: withCtx(({ event, allDay }) => [createElementVNode("div", { class: normalizeClass(unref(CALENDAR_TOOLTIP_SURFACE)) }, [renderSlot(_ctx.$slots, "event-tooltip", {
|
|
604
606
|
event,
|
|
605
607
|
allDay
|
|
606
|
-
})]),
|
|
607
|
-
|
|
608
|
-
},
|
|
608
|
+
})], 2)]),
|
|
609
|
+
key: "0"
|
|
610
|
+
} : void 0]), 1032, ["state", "style"])
|
|
609
611
|
], 38);
|
|
610
612
|
};
|
|
611
613
|
}
|