mood-ui 0.11.0 → 0.12.0

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.
Files changed (124) hide show
  1. package/dist/components/data-display/calendar/AgendaView.cjs.map +1 -1
  2. package/dist/components/data-display/calendar/AgendaView.mjs.map +1 -1
  3. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs +4 -1
  4. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  5. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs +4 -1
  6. package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  7. package/dist/components/data-display/calendar/DayView.cjs.map +1 -1
  8. package/dist/components/data-display/calendar/DayView.mjs.map +1 -1
  9. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs +7 -4
  10. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  11. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs +7 -4
  12. package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  13. package/dist/components/data-display/calendar/MonthView.cjs +1 -1
  14. package/dist/components/data-display/calendar/MonthView.cjs.map +1 -1
  15. package/dist/components/data-display/calendar/MonthView.mjs +1 -1
  16. package/dist/components/data-display/calendar/MonthView.mjs.map +1 -1
  17. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs +8 -12
  18. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  19. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs +8 -12
  20. package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  21. package/dist/components/data-display/calendar/Scheduler.cjs.map +1 -1
  22. package/dist/components/data-display/calendar/Scheduler.mjs.map +1 -1
  23. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs +7 -4
  24. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  25. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs +7 -4
  26. package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  27. package/dist/components/data-display/calendar/WeekView.cjs.map +1 -1
  28. package/dist/components/data-display/calendar/WeekView.mjs.map +1 -1
  29. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs +7 -4
  30. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  31. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs +7 -4
  32. package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  33. package/dist/components/data-display/date-picker/DateTimePicker.cjs.map +1 -1
  34. package/dist/components/data-display/date-picker/DateTimePicker.mjs.map +1 -1
  35. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.cjs +1 -1
  36. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  37. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs +1 -1
  38. package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  39. package/dist/components/feedback/Drawer.cjs.map +1 -1
  40. package/dist/components/feedback/Drawer.mjs.map +1 -1
  41. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs +4 -9
  42. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  43. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +4 -9
  44. package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  45. package/dist/components/feedback/Modal.cjs.map +1 -1
  46. package/dist/components/feedback/Modal.mjs.map +1 -1
  47. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs +4 -9
  48. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  49. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +4 -9
  50. package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  51. package/dist/components/feedback/Tooltip.cjs.map +1 -1
  52. package/dist/components/feedback/Tooltip.mjs.map +1 -1
  53. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs +44 -17
  54. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  55. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs +44 -17
  56. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  57. package/dist/components/forms/Combobox.cjs.map +1 -1
  58. package/dist/components/forms/Combobox.mjs.map +1 -1
  59. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.cjs +2 -2
  60. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  61. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs +2 -2
  62. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  63. package/dist/components/forms/PhoneInput.cjs.map +1 -1
  64. package/dist/components/forms/PhoneInput.mjs.map +1 -1
  65. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.cjs +6 -1
  66. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  67. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs +6 -1
  68. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  69. package/dist/components/forms/SearchInput.cjs.map +1 -1
  70. package/dist/components/forms/SearchInput.mjs.map +1 -1
  71. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs +8 -6
  72. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  73. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs +8 -6
  74. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  75. package/dist/components/layout/PopoverPanel.cjs +1 -1
  76. package/dist/components/layout/PopoverPanel.cjs.map +1 -1
  77. package/dist/components/layout/PopoverPanel.mjs +1 -1
  78. package/dist/components/layout/PopoverPanel.mjs.map +1 -1
  79. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs +2 -2
  80. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  81. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs +2 -2
  82. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  83. package/dist/components/navigation/Switcher.cjs.map +1 -1
  84. package/dist/components/navigation/Switcher.mjs.map +1 -1
  85. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +38 -40
  86. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  87. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +38 -40
  88. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  89. package/dist/composables/eventColors.cjs +51 -27
  90. package/dist/composables/eventColors.cjs.map +1 -1
  91. package/dist/composables/eventColors.mjs +51 -27
  92. package/dist/composables/eventColors.mjs.map +1 -1
  93. package/dist/composables/useBodyScrollLock.cjs +44 -0
  94. package/dist/composables/useBodyScrollLock.cjs.map +1 -0
  95. package/dist/composables/useBodyScrollLock.mjs +43 -0
  96. package/dist/composables/useBodyScrollLock.mjs.map +1 -0
  97. package/dist/composables/useCalendarTheme.cjs +29 -8
  98. package/dist/composables/useCalendarTheme.cjs.map +1 -1
  99. package/dist/composables/useCalendarTheme.mjs +29 -8
  100. package/dist/composables/useCalendarTheme.mjs.map +1 -1
  101. package/dist/composables/usePopover.cjs +44 -12
  102. package/dist/composables/usePopover.cjs.map +1 -1
  103. package/dist/composables/usePopover.mjs +44 -12
  104. package/dist/composables/usePopover.mjs.map +1 -1
  105. package/dist/mood-ui.css +9 -9
  106. package/dist/types/composables/eventColors.d.ts +2 -2
  107. package/dist/types/composables/useBodyScrollLock.d.ts +19 -0
  108. package/dist/types/composables/useCalendarTheme.d.ts +2 -0
  109. package/dist/types/interfaces/data-display/calendar/AgendaView.interface.d.ts +5 -0
  110. package/dist/types/interfaces/data-display/calendar/DayView.interface.d.ts +5 -0
  111. package/dist/types/interfaces/data-display/calendar/MonthView.interface.d.ts +5 -0
  112. package/dist/types/interfaces/data-display/calendar/Scheduler.interface.d.ts +5 -0
  113. package/dist/types/interfaces/data-display/calendar/WeekView.interface.d.ts +5 -0
  114. package/dist/types/utils/cssLength.d.ts +5 -0
  115. package/dist/types/utils/tooltipArrow.d.ts +34 -0
  116. package/dist/utils/cssLength.cjs +13 -0
  117. package/dist/utils/cssLength.cjs.map +1 -0
  118. package/dist/utils/cssLength.mjs +13 -0
  119. package/dist/utils/cssLength.mjs.map +1 -0
  120. package/dist/utils/tooltipArrow.cjs +37 -0
  121. package/dist/utils/tooltipArrow.cjs.map +1 -0
  122. package/dist/utils/tooltipArrow.mjs +36 -0
  123. package/dist/utils/tooltipArrow.mjs.map +1 -0
  124. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Scheduler.mjs","names":[],"sources":["../../../../src/components/data-display/calendar/Scheduler.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none isolate', containerRadiusClass, bordered ? 'border border-border' : '']\" \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 :weekdayLabel=\"weekdayLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearJump\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n :dayOptions=\"dayOptions\" \n v-model:selectedDay=\"selectedDay\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :isPrevDisabled=\"isPrevDisabled\" \n :isNextDisabled=\"isNextDisabled\" \n prevLabel=\"Previous day\" \n nextLabel=\"Next day\" \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-scroll overflow-x-auto relative\" style=\"scrollbar-gutter: stable;\"> \n <!-- Inner container: width = hour-col + sum(minResourceWidth). Header + all-day + body live here so they share horizontal scroll. --> \n <div \n class=\"relative flex flex-col\" \n :style=\"{ minWidth: `calc(3.5rem + ${resources.length} * ${minResourceWidth}px)` }\" \n > \n <!-- Resource header (sticky vertically). --> \n <div \n v-if=\"showResourceHeader\" \n class=\"flex border-b border-border bg-muted sticky top-0 z-40\" \n > \n <div class=\"w-14 shrink-0 sticky left-0 z-10 bg-muted border-l border-r border-border\"></div> \n <div class=\"flex-1 flex min-w-0\"> \n <div \n v-for=\"r in resources\" \n :key=\"r.id\" \n class=\"flex-1 min-w-0 border-l border-border px-3 py-2 flex items-center gap-2\" \n :style=\"{ minWidth: `${minResourceWidth}px`, height: `${resourceHeaderHeight}px` }\" \n > \n <slot name=\"resource-header\" :resource=\"r\"> \n <Avatar \n :src=\"r.avatar\" \n :initials=\"resourceInitials(r.title)\" \n size=\"small\" \n :color=\"(r.color && !r.colorHex ? resourceAvatarColor(r) : 'default')\" \n :style=\"r.colorHex && !r.avatar ? { backgroundColor: r.colorHex, color: '#fff' } : undefined\" \n /> \n <div class=\"flex flex-col min-w-0 flex-1\"> \n <span class=\"text-sm font-semibold text-foreground truncate leading-tight\">{{ r.title }}</span> \n <span v-if=\"r.subtitle\" class=\"text-[11px] text-muted-foreground truncate leading-tight\">{{ r.subtitle }}</span> \n </div> \n </slot> \n </div> \n </div> \n </div> \n \n <!-- All-day row (sticky vertically below the resource header). --> \n <div \n v-if=\"showAllDayRow && maxAllDayRows > 0\" \n class=\"flex border-b border-border bg-card sticky z-30\" \n :style=\"{ top: showResourceHeader ? `${resourceHeaderHeight}px` : '0' }\" \n > \n <div class=\"w-14 shrink-0 flex items-start justify-end pr-2 pt-1 text-[10px] font-medium text-muted-foreground uppercase tracking-wider sticky left-0 z-20 bg-card border-l border-r border-border\"> \n all-day \n </div> \n <div class=\"flex-1 flex min-w-0\"> \n <div \n v-for=\"r in resources\" \n :key=\"`ad-${r.id}`\" \n class=\"relative flex-1 min-w-0 border-l border-border\" \n :style=\"[ \n { minWidth: `${minResourceWidth}px`, height: `${maxAllDayRows * 22 + 4}px` }, \n isResourceDisabled(r) ? disabledStripePattern : undefined, \n ]\" \n @click=\"handleAllDayCellClick(r, $event)\" \n @dblclick=\"handleAllDayCellDblClick(r, $event)\" \n @dragover.prevent=\"onAllDayDragOver(r, $event)\" \n @drop.prevent=\"onAllDayDrop(r, $event)\" \n :class=\"[ \n 'transition-colors', \n isResourceDisabled(r) ? 'cursor-not-allowed' : 'cursor-pointer hover:bg-muted/60', \n allDayDragOverResourceId === r.id ? 'bg-muted' : '', \n ]\" \n > \n <div \n v-for=\"seg in allDaySegmentsByResource.get(r.id) ?? []\" \n :key=\"seg.key\" \n :data-eid=\"seg.event.id\" \n :data-rid=\"r.id\" \n :draggable=\"draggableEvents && isEventInteractive(seg.event)\" \n @dragstart=\"onDragStart(seg.event, $event)\" \n @dragend=\"onDragEnd\" \n @click.stop=\"handleEventClick(seg.event, $event)\" \n @mouseenter=\"onEventEnter(seg.event, true, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :style=\"[ \n { \n left: '2px', \n right: '2px', \n top: `${seg.lane * 22 + 2}px`, \n height: '20px', \n }, \n eventInlineStyle(seg.event, r), \n ]\" \n :class=\"[\n 'absolute z-10 truncate text-xs px-1.5 flex items-center cursor-pointer transition-all hover:opacity-80 select-none',\n eventRadiusClass,\n draggableEvents ? 'cursor-grab active:cursor-grabbing touch-none' : '',\n seg.event.colorHex || (useResourceColor && r.colorHex) ? '' : eventColorClass(resolveEventColor(seg.event, r)),\n draggingId === seg.event.id ? 'opacity-70 scale-95' : '',\n ]\" \n > \n <slot name=\"event\" :event=\"seg.event\" :resource=\"r\" :allDay=\"true\"> \n <span class=\"truncate font-medium\">{{ seg.event.title }}</span> \n </slot> \n </div> \n </div> \n </div> \n </div> \n \n <!-- Time-grid body. --> \n <div class=\"flex\"> \n <div class=\"w-14 shrink-0 relative sticky left-0 z-[25] bg-card border-l border-r border-border\" :style=\"{ height: `${totalPixels}px` }\"> \n <div \n v-for=\"h in hourLabels\" \n :key=\"h.offset\" \n class=\"absolute right-0 pr-2 text-[10px] font-medium text-muted-foreground tracking-wide -translate-y-1/2\" \n :style=\"{ top: `${h.offset * 60 * (slotHeight / slotMinutes)}px` }\" \n > \n <span v-if=\"h.offset !== 0 && h.offset !== windowHours\">{{ h.label }}</span> \n </div> \n <span \n v-if=\"showCurrentTime && showCurrentTimeLabel && isTodayInView\" \n :class=\"['absolute right-1 -translate-y-1/2 px-1 py-0.5 text-[10px] font-semibold text-white leading-none z-30 pointer-events-none', eventRadiusClass, currentTimeSolidClass]\" \n :style=\"{ top: `${currentTimeTop}px` }\" \n >{{ currentTimeLabel }}</span> \n <span \n v-else-if=\"showCurrentTime && !showCurrentTimeLabel && isTodayInView\" \n :class=\"['absolute right-0 -translate-y-1/2 w-1.5 h-1.5 rounded-full z-30 pointer-events-none', currentTimeSolidClass]\" \n :style=\"{ top: `${currentTimeTop}px` }\" \n ></span> \n </div> \n \n <div class=\"flex-1 flex min-w-0 relative\"> \n <div \n v-for=\"r in resources\" \n :key=\"`col-${r.id}`\" \n :ref=\"(el: unknown) => setColRef(r.id, el as HTMLElement | null)\" \n class=\"relative flex-1 min-w-0 border-l border-border\" \n :style=\"{ minWidth: `${minResourceWidth}px` }\" \n @pointerdown=\"onColPointerDown(r, $event)\" \n @click=\"handleSlotClick(r, $event)\" \n @dblclick=\"handleSlotDblClick(r, $event)\" \n @dragover.prevent=\"onDragOver(r, $event)\" \n @drop.prevent=\"onDrop(r, $event)\" \n > \n <div \n v-for=\"(_, idx) in totalSlots\" \n :key=\"idx\" \n :style=\"[ \n { height: `${slotHeight}px` }, \n isSlotDisabled(r, idx) \n ? disabledStripePattern \n : !isBusinessHourSlot(idx) \n ? { backgroundColor: 'rgba(0,0,0,0.015)' } \n : undefined, \n ]\" \n :class=\"[ \n 'border-t', \n idx === 0 ? 'border-transparent' : idx % slotsPerHour === 0 ? 'border-border' : 'border-dashed border-border/70', \n isSlotDisabled(r, idx) ? 'cursor-not-allowed' : '', \n ]\" \n ></div> \n \n <div \n v-if=\"isResourceDisabled(r)\" \n class=\"absolute inset-0 pointer-events-none\" \n :style=\"disabledStripePattern\" \n ></div> \n \n <div \n v-for=\"seg in timedSegmentsByResource.get(r.id) ?? []\" \n :key=\"seg.key\" \n :data-eid=\"seg.event.id\" \n :data-rid=\"r.id\" \n :draggable=\"draggableEvents && resizingId !== seg.event.id && isEventInteractive(seg.event)\" \n @dragstart.stop=\"onDragStart(seg.event, $event)\" \n @dragend=\"onDragEnd\" \n @click.stop=\"handleEventClick(seg.event, $event)\" \n @pointerdown.stop \n @mouseenter=\"onEventEnter(seg.event, false, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :style=\"[seg.style, eventInlineStyle(seg.event, r)]\" \n :class=\"[\n 'absolute z-10 overflow-hidden transition-all hover:opacity-90 select-none flex flex-col',\n eventRadiusClass,\n isEventInteractive(seg.event) ? 'cursor-pointer' : 'cursor-default',\n draggableEvents && isEventInteractive(seg.event) ? 'cursor-grab active:cursor-grabbing touch-none' : '',\n seg.event.colorHex || (useResourceColor && r.colorHex) ? 'border-l-2' : eventColorClass(resolveEventColor(seg.event, r)),\n draggingId === seg.event.id ? 'opacity-70 scale-95' : '',\n ]\" \n > \n <slot name=\"event\" :event=\"seg.event\" :resource=\"r\" :allDay=\"false\"> \n <div class=\"px-2 py-1 flex-1 min-h-0\"> \n <div class=\"text-[10px] font-semibold leading-tight opacity-80\">{{ formatEventTime(seg.event.start) }}<template v-if=\"seg.event.end\"> – {{ formatEventTime(seg.event.end) }}</template></div> \n <div class=\"text-xs font-medium truncate leading-tight\">{{ seg.event.title }}</div> \n <div v-if=\"seg.event.description\" class=\"text-[11px] opacity-70 truncate leading-tight mt-0.5\">{{ seg.event.description }}</div> \n </div> \n </slot> \n <div \n v-if=\"resizableEvents && isEventInteractive(seg.event)\" \n draggable=\"false\" \n @mousedown.stop.prevent \n @dragstart.stop.prevent \n @pointerdown.stop=\"onResizeStart(seg.event, r, $event)\" \n class=\"absolute bottom-0 left-0 right-0 h-1.5 cursor-ns-resize hover:bg-black/10 touch-none\" \n ></div> \n </div> \n \n <div \n v-if=\"dragOverResourceId === r.id\" \n class=\"absolute inset-0 pointer-events-none z-0 bg-muted/60\" \n ></div> \n \n <div \n v-if=\"rangeSelect && rangeSelect.resourceId === r.id\" \n :class=\"['absolute left-1 right-1 pointer-events-none z-20 border border-dashed', eventRadiusClass, rangeSelectClass]\" \n :style=\"{ top: `${rangeSelect.topPx}px`, height: `${rangeSelect.heightPx}px` }\" \n ></div> \n \n <div \n v-if=\"resizingPreview && resizingPreview.resourceId === r.id\" \n :class=\"['absolute left-1 right-1 pointer-events-none z-20 border border-dashed border-muted-foreground bg-foreground/5', eventRadiusClass]\" \n :style=\"{ top: `${resizingPreview.topPx}px`, height: `${resizingPreview.heightPx}px` }\" \n ></div> \n </div> \n \n <div \n v-if=\"showCurrentTime && isTodayInView\" \n class=\"absolute left-0 right-0 h-px pointer-events-none z-20\" \n :class=\"currentTimeSolidClass\" \n :style=\"{ top: `${currentTimeTop}px` }\" \n ></div> \n </div> \n </div> \n </div> \n </div> \n \n <button \n v-if=\"showNowPill && isTodayInView\" \n type=\"button\" \n @click=\"scrollToCurrentTime\" \n :class=\"['absolute bottom-4 right-6 z-40 px-3 py-1.5 flex items-center gap-1.5 text-xs font-medium shadow-lg bg-card border border-border hover:bg-muted transition-all cursor-pointer', pillRadiusClass]\" \n > \n <span class=\"w-1.5 h-1.5\" :class=\"[pillRadiusClass, currentTimeSolidClass]\"></span> \n <span class=\"text-foreground/80\">Now</span> \n </button> \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, onUnmounted } from 'vue'; \nimport gsap from 'gsap'; \nimport Avatar from '../avatar/Avatar.vue'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport { useAutoScroll } from '../../../composables/useAutoScroll'; \nimport { useCurrentTimeLine } from '../../../composables/useCurrentTimeLine'; \nimport { useTimeGrid, MS_MIN } from '../../../composables/useTimeGrid'; \nimport { eventColorClass, hexToRgba } from '../../../composables/eventColors'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { Scheduler, SchedulerResource, SchedulerEvent } from '../../../interfaces/data-display/calendar/Scheduler.interface'; \nimport type { BusinessHours } from '../../../interfaces/data-display/calendar/WeekView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nconst props = withDefaults(defineProps<Scheduler>(), { \n modelValue: () => new Date(), \n events: () => [], \n resourceIdField: 'resourceId', \n locale: 'default', \n color: 'default', \n bordered: true, \n dayNameFormat: 'long', \n dayNameCase: 'upper', \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n disabledTimeRanges: () => [], \n showHeader: true, \n showTodayButton: true, \n showYearJump: false, \n showMonthYearSelects: false, \n showResourceHeader: true, \n resourceHeaderHeight: 52, \n minResourceWidth: 140, \n hourStart: 0, \n hourEnd: 24, \n slotMinutes: 30, \n slotHeight: 28, \n format: '24h', \n showCurrentTime: true, \n showCurrentTimeLabel: true, \n currentTimeColor: 'red', \n currentTimeUpdateInterval: 60000, \n draggableEvents: true, \n resizableEvents: true, \n allowRangeSelection: true, \n allowCrossResourceDrag: true, \n allowDropOnDisabled: false, \n allowResizeOverDisabled: false, \n readonly: false, \n preventOverlap: false, \n autoScrollOnDrag: true, \n showAllDayRow: true, \n enableKeyboardNavigation: true, \n showNowPill: true, \n useResourceColor: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: SchedulerEvent, nativeEvent: MouseEvent]; \n 'slot-click': [date: Date, resource: SchedulerResource, nativeEvent: MouseEvent]; \n 'create-event': [date: Date, resource: SchedulerResource, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'event-drop': [event: SchedulerEvent, newStart: Date, newEnd: Date | undefined, newResource: SchedulerResource]; \n 'event-resize': [event: SchedulerEvent, newStart: Date, newEnd: Date]; \n 'select-range': [start: Date, end: Date, resource: SchedulerResource]; \n}>(); \n \nconst currentDate = ref(startOfDay(new Date(props.modelValue))); \nwatch(() => props.modelValue, (v) => { if (v) currentDate.value = startOfDay(new Date(v)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst colRefs = new Map<string | number, HTMLElement>(); \nconst setColRef = (id: string | number, el: HTMLElement | null) => { \n if (el) colRefs.set(id, el); \n else colRefs.delete(id); \n}; \nconst now = ref(new Date()); \nconst scrollbarWidth = ref(0); \nlet tickInterval: ReturnType<typeof setInterval> | null = null; \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<SchedulerEvent>(); \n \nconst disabledStripePattern = { \n backgroundImage: 'repeating-linear-gradient(-45deg, transparent 0 5px, rgba(0,0,0,0.035) 5px 6px)', \n}; \n \nconst { handleAutoScroll, stopAutoScroll } = useAutoScroll({ \n scrollRef, \n enabled: () => props.autoScrollOnDrag, \n}); \n \n \nonMounted(() => { \n if (props.currentTimeUpdateInterval > 0) { \n tickInterval = setInterval(() => { now.value = new Date(); }, props.currentTimeUpdateInterval); \n } \n if (scrollRef.value) { \n scrollbarWidth.value = scrollRef.value.offsetWidth - scrollRef.value.clientWidth; \n } \n scrollToCurrentTime(); \n nextTick(() => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-eid]'); \n if (els.length) { \n gsap.fromTo( \n els, \n { opacity: 0, y: 6, scale: 0.96 }, \n { opacity: 1, y: 0, scale: 1, duration: 0.4, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n } \n }); \n}); \nonUnmounted(() => { if (tickInterval) clearInterval(tickInterval); }); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return currentDate.value.toLocaleDateString(locale, { month: 'long', day: 'numeric', year: 'numeric' }); \n}); \nconst weekdayLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return currentDate.value.toLocaleDateString(locale, { weekday: props.dayNameFormat }); \n}); \n \nconst isPrevDisabled = computed(() => { \n if (!props.minDate) return false; \n const prev = new Date(currentDate.value); \n prev.setDate(prev.getDate() - 1); \n return prev < startOfDay(props.minDate); \n}); \nconst isNextDisabled = computed(() => { \n if (!props.maxDate) return false; \n const next = new Date(currentDate.value); \n next.setDate(next.getDate() + 1); \n return next > startOfDay(props.maxDate); \n}); \n \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst dayIsDisabled = computed(() => { \n const d = currentDate.value; \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}); \nconst isResourceDisabled = (r: SchedulerResource) => dayIsDisabled.value || !!r.disabled; \n \nconst parseHM = (s: string) => { \n const [h, m] = s.split(':').map(Number); \n return h * 60 + (m || 0); \n}; \n \nconst splitDayRange = (absStart: number, absEnd: number) => { \n const parts: { dayOffset: number; startMin: number; endMin: number }[] = []; \n let s = absStart; \n while (s < absEnd) { \n const dayOffset = Math.floor(s / 1440); \n const dayStart = dayOffset * 1440; \n const chunkEnd = Math.min(absEnd, dayStart + 1440); \n parts.push({ dayOffset, startMin: s - dayStart, endMin: chunkEnd - dayStart }); \n s = chunkEnd; \n } \n return parts; \n}; \n \nconst rangeMatchesDisabled = (baseDow: number, absStart: number, absEnd: number) => { \n if (!props.disabledTimeRanges.length) return false; \n const parts = splitDayRange(absStart, absEnd); \n return parts.some(p => { \n const dow = (baseDow + p.dayOffset) % 7; \n return props.disabledTimeRanges.some(r => { \n if (r.daysOfWeek && !r.daysOfWeek.includes(dow)) return false; \n const rs = parseHM(r.start); \n const re = parseHM(r.end); \n return p.startMin < re && p.endMin > rs; \n }); \n }); \n}; \n \nconst isSlotDisabled = (r: SchedulerResource, slotIdx: number) => { \n if (isResourceDisabled(r)) return true; \n if (!props.disabledTimeRanges.length) return false; \n const slotStartMin = props.hourStart * 60 + slotIdx * props.slotMinutes; \n const slotEndMin = slotStartMin + props.slotMinutes; \n return rangeMatchesDisabled(currentDate.value.getDay(), slotStartMin, slotEndMin); \n}; \n \nconst rangeHitsDisabled = (r: SchedulerResource, startMinFromHourStart: number, endMinFromHourStart: number) => { \n if (isResourceDisabled(r)) return true; \n if (!props.disabledTimeRanges.length) return false; \n const absStart = props.hourStart * 60 + startMinFromHourStart; \n const absEnd = props.hourStart * 60 + endMinFromHourStart; \n return rangeMatchesDisabled(currentDate.value.getDay(), absStart, absEnd); \n}; \n \nconst eventResourceId = (ev: SchedulerEvent): string | number | undefined => { \n const v = (ev as unknown as Record<string, unknown>)[props.resourceIdField]; \n if (v === undefined || v === null) return undefined; \n return v as string | number; \n}; \n \nconst rangeOverlapsEvent = (resourceId: string | number, startMs: number, endMs: number, ignoreId: CalendarEvent['id']) => { \n return props.events.some(ev => { \n if (ev.id === ignoreId) return false; \n if (ev.allDay) return false; \n if (eventResourceId(ev) !== resourceId) return false; \n if (!isSameDay(ev.start, currentDate.value)) return false; \n const es = ev.start.getTime(); \n const ee = (ev.end ?? ev.start).getTime(); \n return startMs < ee && endMs > es; \n }); \n}; \n \nconst isEventInteractive = (ev: CalendarEvent) => !props.readonly && !ev.readonly; \n \nconst businessHoursList = computed<BusinessHours[]>(() => { \n if (!props.businessHours) return []; \n return Array.isArray(props.businessHours) ? props.businessHours : [props.businessHours]; \n}); \n \nconst isBusinessHourSlot = (slotIdx: number) => { \n if (!businessHoursList.value.length) return true; \n const slotStartMin = props.hourStart * 60 + slotIdx * props.slotMinutes; \n const slotEndMin = slotStartMin + props.slotMinutes; \n const parts = splitDayRange(slotStartMin, slotEndMin); \n const baseDow = currentDate.value.getDay(); \n return parts.some(p => { \n const dow = (baseDow + p.dayOffset) % 7; \n return businessHoursList.value.some(b => { \n if (b.daysOfWeek && !b.daysOfWeek.includes(dow)) return false; \n return p.startMin >= parseHM(b.start) && p.startMin < parseHM(b.end); \n }); \n }); \n}; \n \nconst { \n slotsPerHour, \n windowHours, \n totalSlots, \n windowMinutes, \n totalPixels, \n hourLabels, \n dayStartMs: getDayStartMs, \n dayEndMs: getDayEndMs, \n} = useTimeGrid({ \n hourStart: () => props.hourStart, \n hourEnd: () => props.hourEnd, \n slotMinutes: () => props.slotMinutes, \n slotHeight: () => props.slotHeight, \n format: () => props.format, \n}); \n \nconst dayStartMs = computed(() => getDayStartMs(currentDate.value)); \nconst dayEndMs = computed(() => getDayEndMs(currentDate.value)); \n \ninterface TimedSeg { key: string; event: SchedulerEvent; style: Record<string, string>; } \n \nconst timedSegmentsByResource = computed<Map<string | number, TimedSeg[]>>(() => { \n const map = new Map<string | number, TimedSeg[]>(); \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const dStart = dayStartMs.value; \n const dEnd = dayEndMs.value; \n \n for (const r of props.resources) { \n const dayEvents = props.events \n .filter(ev => !ev.allDay && eventResourceId(ev) === r.id) \n .filter(ev => { \n const es = ev.start.getTime(); \n const ee = (ev.end ?? ev.start).getTime(); \n return !(ee <= dStart || es >= dEnd); \n }) \n .sort((a, b) => a.start.getTime() - b.start.getTime()); \n \n const clusters: SchedulerEvent[][] = []; \n for (const ev of dayEvents) { \n const evStart = Math.max(ev.start.getTime(), dStart); \n let placed = false; \n for (const cluster of clusters) { \n const clusterEnd = Math.max(...cluster.map(e => Math.min((e.end ?? e.start).getTime(), dEnd))); \n if (evStart < clusterEnd) { cluster.push(ev); placed = true; break; } \n } \n if (!placed) clusters.push([ev]); \n } \n \n const segs: TimedSeg[] = []; \n for (const cluster of clusters) { \n const columns: SchedulerEvent[][] = []; \n for (const ev of cluster) { \n const evStart = Math.max(ev.start.getTime(), dStart); \n let placed = false; \n for (const col of columns) { \n const last = col[col.length - 1]; \n const lastEnd = Math.min((last.end ?? last.start).getTime(), dEnd); \n if (lastEnd <= evStart) { col.push(ev); placed = true; break; } \n } \n if (!placed) columns.push([ev]); \n } \n const colCount = columns.length; \n columns.forEach((col, colIdx) => { \n for (const ev of col) { \n const startMs = Math.max(ev.start.getTime(), dStart); \n const endMsRaw = (ev.end ?? new Date(ev.start.getTime() + 30 * MS_MIN)).getTime(); \n const endMs = Math.min(endMsRaw, dEnd); \n const startMin = (startMs - dStart) / MS_MIN; \n const endMin = (endMs - dStart) / MS_MIN; \n const top = startMin * pxPerMin; \n const height = Math.max((endMin - startMin) * pxPerMin - 1, 18); \n const width = 100 / colCount; \n const left = colIdx * width; \n segs.push({ \n key: String(ev.id), \n event: ev, \n style: { \n top: `${top}px`, \n height: `${height}px`, \n left: `calc(${left}% + 2px)`, \n width: `calc(${width}% - 4px)`, \n }, \n }); \n } \n }); \n } \n map.set(r.id, segs); \n } \n return map; \n}); \n \ninterface AllDaySeg { key: string; event: SchedulerEvent; lane: number; } \nconst allDaySegmentsByResource = computed<Map<string | number, AllDaySeg[]>>(() => { \n const map = new Map<string | number, AllDaySeg[]>(); \n const target = startOfDay(currentDate.value).getTime(); \n for (const r of props.resources) { \n const list = props.events \n .filter(ev => eventResourceId(ev) === r.id) \n .filter(ev => ev.allDay || (ev.end && startOfDay(ev.end).getTime() > startOfDay(ev.start).getTime())) \n .filter(ev => { \n const sd = startOfDay(ev.start).getTime(); \n const ed = startOfDay(ev.end ?? ev.start).getTime(); \n return target >= sd && target <= ed; \n }) \n .sort((a, b) => a.start.getTime() - b.start.getTime()); \n map.set(r.id, list.map((ev, i) => ({ key: `ad-${ev.id}`, event: ev, lane: i }))); \n } \n return map; \n}); \nconst maxAllDayRows = computed(() => { \n let max = 0; \n for (const list of allDaySegmentsByResource.value.values()) max = Math.max(max, list.length); \n return max; \n}); \n \nconst isTodayInView = computed(() => { \n const nt = now.value.getTime(); \n return nt >= dayStartMs.value && nt < dayEndMs.value; \n}); \n \nconst currentTimeTop = computed(() => { \n if (!isTodayInView.value) return 0; \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const min = (now.value.getTime() - dayStartMs.value) / MS_MIN; \n return Math.max(0, Math.min(min, windowMinutes.value)) * pxPerMin; \n}); \n \nconst currentTimeLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return now.value.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}); \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 scrollToCurrentTime = () => { \n nextTick(() => { \n if (!scrollRef.value) return; \n let top = 0; \n if (isTodayInView.value) { \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const min = (now.value.getTime() - dayStartMs.value) / MS_MIN; \n top = Math.max(0, Math.min(min, windowMinutes.value)) * pxPerMin; \n } \n const target = Math.max(0, top - scrollRef.value.clientHeight / 3); \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.55, ease: 'power3.inOut' }); \n }); \n}; \n \nconst animate = (dir: 1 | -1) => { \n if (!scrollRef.value) return; \n gsap.fromTo( \n scrollRef.value, \n { opacity: 0, x: 24 * dir }, \n { opacity: 1, x: 0, duration: 0.32, ease: 'power3.out' } \n ); \n nextTick(() => { \n if (!scrollRef.value) return; \n const els = scrollRef.value.querySelectorAll<HTMLElement>('[data-eid]'); \n if (els.length) { \n gsap.fromTo( \n els, \n { opacity: 0, y: 6, scale: 0.96 }, \n { opacity: 1, y: 0, scale: 1, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.18 } } \n ); \n } \n }); \n}; \n \nconst findEventEls = (id: CalendarEvent['id']): HTMLElement[] => { \n if (!rootRef.value) return []; \n return Array.from(rootRef.value.querySelectorAll<HTMLElement>(`[data-eid=\"${id}\"]`)); \n}; \n \nconst dropGrowEvent = (id: CalendarEvent['id']) => { \n nextTick(() => { \n const els = findEventEls(id); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { scale: 0.9, opacity: 0 }, \n { scale: 1, opacity: 1, duration: 0.32, ease: 'power3.out', transformOrigin: 'center center', overwrite: 'auto' } \n ); \n }); \n}; \n \nconst stretchResize = (id: CalendarEvent['id'], oldHeightPx: number) => { \n nextTick(() => { \n const els = findEventEls(id); \n if (!els.length) return; \n els.forEach(el => { \n const newH = el.offsetHeight; \n if (newH <= 0 || oldHeightPx <= 0 || newH === oldHeightPx) return; \n const fromScale = oldHeightPx / newH; \n gsap.fromTo( \n el, \n { scaleY: fromScale }, \n { scaleY: 1, duration: 0.32, ease: 'power3.out', transformOrigin: 'top center', overwrite: 'auto', clearProps: 'transform' } \n ); \n }); \n }); \n}; \n \nconst shiftDay = (days: number) => { \n const d = new Date(currentDate.value); \n d.setDate(d.getDate() + days); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(days > 0 ? 1 : -1)); \n}; \nconst handlePrev = () => shiftDay(-1); \nconst handleNext = () => shiftDay(1); \nconst handlePrevYear = () => { \n const d = new Date(currentDate.value); \n d.setFullYear(d.getFullYear() - 1); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(-1)); \n}; \nconst handleNextYear = () => { \n const d = new Date(currentDate.value); \n d.setFullYear(d.getFullYear() + 1); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(1)); \n}; \nconst handleToday = () => { \n const n = new Date(); \n currentDate.value = startOfDay(n); \n emit('update:modelValue', n); \n nextTick(() => { animate(1); scrollToCurrentTime(); }); \n}; \n \nconst clickTimer = ref<ReturnType<typeof setTimeout> | null>(null); \nconst DOUBLE_CLICK_DELAY = 220; \n \nconst pxToSlotMin = (offsetY: number) => { \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const rawMin = offsetY / pxPerMin; \n return Math.floor(rawMin / props.slotMinutes) * props.slotMinutes; \n}; \nconst slotDateFromOffset = (offsetY: number): Date => { \n const snapped = pxToSlotMin(offsetY); \n const base = new Date(currentDate.value); \n base.setHours(props.hourStart, 0, 0, 0); \n base.setMinutes(base.getMinutes() + snapped); \n return base; \n}; \nconst offsetFromEvent = (el: HTMLElement, clientY: number) => { \n const rect = el.getBoundingClientRect(); \n return Math.max(0, clientY - rect.top); \n}; \n \nconst handleSlotClick = (r: SchedulerResource, e: MouseEvent) => { \n if (rangeJustSelected.value) { rangeJustSelected.value = false; return; } \n if (isResourceDisabled(r)) return; \n const offsetY = offsetFromEvent(e.currentTarget as HTMLElement, e.clientY); \n const dt = slotDateFromOffset(offsetY); \n const slotIdx = Math.floor(((dt.getHours() - props.hourStart) * 60 + dt.getMinutes()) / props.slotMinutes); \n if (isSlotDisabled(r, slotIdx)) return; \n if (clickTimer.value) clearTimeout(clickTimer.value); \n clickTimer.value = setTimeout(() => { \n emit('slot-click', dt, r, e); \n clickTimer.value = null; \n }, DOUBLE_CLICK_DELAY); \n}; \nconst handleSlotDblClick = (r: SchedulerResource, e: MouseEvent) => { \n if (props.readonly) return; \n if (isResourceDisabled(r)) return; \n if (clickTimer.value) { clearTimeout(clickTimer.value); clickTimer.value = null; } \n const offsetY = offsetFromEvent(e.currentTarget as HTMLElement, e.clientY); \n const dt = slotDateFromOffset(offsetY); \n const slotIdx = Math.floor(((dt.getHours() - props.hourStart) * 60 + dt.getMinutes()) / props.slotMinutes); \n if (isSlotDisabled(r, slotIdx)) return; \n emit('create-event', dt, r, false, e); \n}; \n \nconst handleAllDayCellClick = (_r: SchedulerResource, _e: MouseEvent) => {}; \nconst handleAllDayCellDblClick = (r: SchedulerResource, e: MouseEvent) => { \n if (props.readonly) return; \n if (isResourceDisabled(r)) return; \n emit('create-event', startOfDay(currentDate.value), r, true, e); \n}; \n \nconst resizeJustEnded = ref(false); \nconst handleEventClick = (ev: SchedulerEvent, e: MouseEvent) => { \n if (resizeJustEnded.value) { resizeJustEnded.value = false; return; } \n emit('event-click', ev, e); \n}; \n \nconst draggingId = ref<string | number | null>(null); \nconst dragOverResourceId = ref<string | number | null>(null); \nconst allDayDragOverResourceId = ref<string | number | null>(null); \n \nconst onDragStart = (ev: SchedulerEvent, e: DragEvent) => { \n if (!props.draggableEvents || !isEventInteractive(ev)) { e.preventDefault(); return; } \n onEventLeave(); \n draggingId.value = ev.id; \n if (e.dataTransfer) { \n e.dataTransfer.effectAllowed = 'move'; \n e.dataTransfer.setData('text/plain', String(ev.id)); \n const src = e.currentTarget as HTMLElement; \n if (src && typeof e.dataTransfer.setDragImage === 'function') { \n const rect = src.getBoundingClientRect(); \n const w = Math.max(rect.width * 0.7, 90); \n const h = Math.max(rect.height * 0.7, 26); \n const wrap = document.createElement('div'); \n wrap.style.cssText = [ \n 'position:absolute', 'top:-9999px', 'left:-9999px', \n `width:${w}px`, `height:${h}px`, \n 'background:white', 'border-radius:4px', 'overflow:hidden', \n 'box-shadow:0 6px 18px rgba(0,0,0,0.22)', \n 'pointer-events:none', 'margin:0', 'transform:rotate(-1.5deg)', \n ].join(';'); \n const clone = src.cloneNode(true) as HTMLElement; \n clone.style.position = 'static'; \n clone.style.width = '100%'; \n clone.style.height = '100%'; \n clone.style.left = 'auto'; \n clone.style.top = 'auto'; \n clone.style.margin = '0'; \n clone.style.opacity = '1'; \n wrap.appendChild(clone); \n document.body.appendChild(wrap); \n e.dataTransfer.setDragImage(wrap, Math.round(w / 2), 14); \n setTimeout(() => { wrap.parentNode?.removeChild(wrap); }, 0); \n } \n } \n}; \nconst onDragEnd = () => { \n draggingId.value = null; \n dragOverResourceId.value = null; \n allDayDragOverResourceId.value = null; \n stopAutoScroll(); \n}; \n \nconst canDropOnResource = (r: SchedulerResource, ev: SchedulerEvent | undefined) => { \n if (!ev) return false; \n const origin = eventResourceId(ev); \n if (origin !== r.id && !props.allowCrossResourceDrag) return false; \n return true; \n}; \n \nconst onDragOver = (r: SchedulerResource, e: DragEvent) => { \n if (!props.draggableEvents || draggingId.value === null) return; \n const ev = props.events.find(x => x.id === draggingId.value); \n let blocked = false; \n if (!canDropOnResource(r, ev)) blocked = true; \n if (!blocked && !props.allowDropOnDisabled) { \n if (isResourceDisabled(r)) blocked = true; \n else if (ev && !ev.allDay) { \n const offsetY = offsetFromEvent(e.currentTarget as HTMLElement, e.clientY); \n const snappedMin = pxToSlotMin(offsetY); \n const duration = ev.end ? ev.end.getTime() - ev.start.getTime() : 30 * MS_MIN; \n const durationMin = duration / MS_MIN; \n if (rangeHitsDisabled(r, snappedMin, snappedMin + durationMin)) blocked = true; \n } \n } \n if (e.dataTransfer) e.dataTransfer.dropEffect = blocked ? 'none' : 'move'; \n dragOverResourceId.value = blocked ? null : r.id; \n handleAutoScroll(e.clientY); \n}; \nconst onDrop = (r: SchedulerResource, e: DragEvent) => { \n if (!props.draggableEvents || draggingId.value === null) return; \n const ev = props.events.find(x => x.id === draggingId.value); \n if (!ev || !canDropOnResource(r, ev)) { onDragEnd(); return; } \n if (!props.allowDropOnDisabled && isResourceDisabled(r)) { onDragEnd(); return; } \n const offsetY = offsetFromEvent(e.currentTarget as HTMLElement, e.clientY); \n const snappedMin = pxToSlotMin(offsetY); \n const wasAllDay = !!ev.allDay; \n const duration = !wasAllDay && ev.end ? ev.end.getTime() - ev.start.getTime() : 30 * MS_MIN; \n const durationMin = duration / MS_MIN; \n if (!props.allowDropOnDisabled && rangeHitsDisabled(r, snappedMin, snappedMin + durationMin)) { onDragEnd(); return; } \n const newStart = new Date(currentDate.value); \n newStart.setHours(props.hourStart, 0, 0, 0); \n newStart.setMinutes(newStart.getMinutes() + snappedMin); \n const newEnd = new Date(newStart.getTime() + duration); \n if (props.preventOverlap && rangeOverlapsEvent(r.id, newStart.getTime(), newEnd.getTime(), ev.id)) { onDragEnd(); return; } \n const emitEv: SchedulerEvent = wasAllDay \n ? { ...ev, allDay: false, [props.resourceIdField]: r.id } as SchedulerEvent \n : { ...ev, [props.resourceIdField]: r.id } as SchedulerEvent; \n emit('event-drop', emitEv, newStart, newEnd, r); \n dropGrowEvent(ev.id); \n onDragEnd(); \n}; \n \nconst onAllDayDragOver = (r: SchedulerResource, e: DragEvent) => { \n if (!props.draggableEvents || draggingId.value === null) return; \n const ev = props.events.find(x => x.id === draggingId.value); \n let blocked = false; \n if (!canDropOnResource(r, ev)) blocked = true; \n if (!blocked && !props.allowDropOnDisabled && isResourceDisabled(r)) blocked = true; \n if (e.dataTransfer) e.dataTransfer.dropEffect = blocked ? 'none' : 'move'; \n allDayDragOverResourceId.value = blocked ? null : r.id; \n}; \nconst onAllDayDrop = (r: SchedulerResource, _e: DragEvent) => { \n if (!props.draggableEvents || draggingId.value === null) return; \n const ev = props.events.find(x => x.id === draggingId.value); \n if (!ev || !canDropOnResource(r, ev)) { onDragEnd(); return; } \n if (!props.allowDropOnDisabled && isResourceDisabled(r)) { onDragEnd(); return; } \n const wasAllDay = !!ev.allDay; \n const duration = wasAllDay && ev.end ? startOfDay(ev.end).getTime() - startOfDay(ev.start).getTime() : 0; \n const newStart = startOfDay(currentDate.value); \n const newEnd = new Date(newStart.getTime() + duration); \n const emitEv: SchedulerEvent = !wasAllDay \n ? { ...ev, allDay: true, [props.resourceIdField]: r.id } as SchedulerEvent \n : { ...ev, [props.resourceIdField]: r.id } as SchedulerEvent; \n emit('event-drop', emitEv, newStart, wasAllDay ? newEnd : undefined, r); \n dropGrowEvent(ev.id); \n onDragEnd(); \n}; \n \ninterface RangeSelect { resourceId: string | number; startMin: number; endMin: number; topPx: number; heightPx: number; } \nconst rangeSelect = ref<RangeSelect | null>(null); \nconst rangeJustSelected = ref(false); \nlet rangePointerId: number | null = null; \nlet rangeStartColEl: HTMLElement | null = null; \nlet rangeResource: SchedulerResource | null = null; \n \nconst onColPointerDown = (r: SchedulerResource, e: PointerEvent) => { \n if (props.readonly) return; \n if (!props.allowRangeSelection) return; \n if (e.button !== 0) return; \n if (isResourceDisabled(r)) return; \n rangeStartColEl = e.currentTarget as HTMLElement; \n rangeResource = r; \n const offsetY = offsetFromEvent(rangeStartColEl, e.clientY); \n const startMin = pxToSlotMin(offsetY); \n const pxPerMin = props.slotHeight / props.slotMinutes; \n rangeSelect.value = { \n resourceId: r.id, \n startMin, \n endMin: startMin + props.slotMinutes, \n topPx: startMin * pxPerMin, \n heightPx: props.slotMinutes * pxPerMin, \n }; \n rangePointerId = e.pointerId; \n rangeStartColEl.setPointerCapture(e.pointerId); \n rangeStartColEl.addEventListener('pointermove', onRangePointerMove); \n rangeStartColEl.addEventListener('pointerup', onRangePointerUp); \n rangeStartColEl.addEventListener('pointercancel', onRangePointerUp); \n}; \nconst onRangePointerMove = (e: PointerEvent) => { \n if (!rangeSelect.value || !rangeStartColEl) return; \n handleAutoScroll(e.clientY); \n const offsetY = offsetFromEvent(rangeStartColEl, e.clientY); \n const curMin = Math.max(0, Math.min(windowMinutes.value, pxToSlotMin(offsetY) + props.slotMinutes)); \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const s = Math.min(rangeSelect.value.startMin, curMin - props.slotMinutes); \n const e2 = Math.max(rangeSelect.value.startMin + props.slotMinutes, curMin); \n rangeSelect.value = { ...rangeSelect.value, topPx: s * pxPerMin, heightPx: (e2 - s) * pxPerMin, endMin: e2, startMin: s }; \n}; \nconst onRangePointerUp = (_e: PointerEvent) => { \n if (!rangeSelect.value || !rangeStartColEl || !rangeResource) return; \n stopAutoScroll(); \n const { startMin, endMin } = rangeSelect.value; \n const r = rangeResource; \n rangeStartColEl.removeEventListener('pointermove', onRangePointerMove); \n rangeStartColEl.removeEventListener('pointerup', onRangePointerUp); \n rangeStartColEl.removeEventListener('pointercancel', onRangePointerUp); \n if (rangePointerId !== null) rangeStartColEl.releasePointerCapture?.(rangePointerId); \n rangePointerId = null; \n rangeStartColEl = null; \n rangeResource = null; \n \n const durationMin = endMin - startMin; \n if (durationMin > props.slotMinutes) { \n const start = new Date(currentDate.value); \n start.setHours(props.hourStart, 0, 0, 0); \n start.setMinutes(start.getMinutes() + startMin); \n const end = new Date(start.getTime() + durationMin * MS_MIN); \n rangeJustSelected.value = true; \n emit('select-range', start, end, r); \n } \n rangeSelect.value = null; \n}; \n \ninterface ResizePreview { resourceId: string | number; topPx: number; heightPx: number; } \nconst resizingId = ref<string | number | null>(null); \nconst resizingPreview = ref<ResizePreview | null>(null); \nlet resizeStartState: { event: SchedulerEvent; resource: SchedulerResource; startMin: number; minEndMin: number } | null = null; \n \nconst onResizeStart = (ev: SchedulerEvent, r: SchedulerResource, _e: PointerEvent) => { \n if (!props.resizableEvents || !isEventInteractive(ev)) return; \n const startMin = Math.max(0, (ev.start.getTime() - dayStartMs.value) / MS_MIN); \n const minEndMin = startMin + props.slotMinutes; \n resizingId.value = ev.id; \n resizeStartState = { event: ev, resource: r, startMin, minEndMin }; \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const curEndMin = ev.end ? (ev.end.getTime() - dayStartMs.value) / MS_MIN : minEndMin; \n resizingPreview.value = { \n resourceId: r.id, \n topPx: startMin * pxPerMin, \n heightPx: Math.max(curEndMin - startMin, props.slotMinutes) * pxPerMin, \n }; \n window.addEventListener('pointermove', onResizeMove); \n window.addEventListener('pointerup', onResizeEnd); \n window.addEventListener('pointercancel', onResizeEnd); \n}; \nconst onResizeMove = (e: PointerEvent) => { \n if (!resizeStartState || !resizingPreview.value) return; \n const col = colRefs.get(resizeStartState.resource.id); \n if (!col) return; \n handleAutoScroll(e.clientY); \n const rect = col.getBoundingClientRect(); \n const offsetY = Math.max(0, Math.min(totalPixels.value, e.clientY - rect.top)); \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const rawMin = offsetY / pxPerMin; \n const snapped = Math.ceil(rawMin / props.slotMinutes) * props.slotMinutes; \n const endMin = Math.max(resizeStartState.minEndMin, Math.min(windowMinutes.value, snapped)); \n resizingPreview.value = { ...resizingPreview.value, heightPx: (endMin - resizeStartState.startMin) * pxPerMin }; \n}; \nconst onResizeEnd = () => { \n window.removeEventListener('pointermove', onResizeMove); \n window.removeEventListener('pointerup', onResizeEnd); \n window.removeEventListener('pointercancel', onResizeEnd); \n stopAutoScroll(); \n if (resizeStartState && resizingPreview.value) { \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const endMin = resizeStartState.startMin + resizingPreview.value.heightPx / pxPerMin; \n const newStart = new Date(resizeStartState.event.start); \n const newEnd = new Date(currentDate.value); \n newEnd.setHours(props.hourStart, 0, 0, 0); \n newEnd.setMinutes(newEnd.getMinutes() + endMin); \n const hitsDisabled = !props.allowResizeOverDisabled && rangeHitsDisabled(resizeStartState.resource, resizeStartState.startMin, endMin); \n const overlaps = props.preventOverlap && rangeOverlapsEvent(resizeStartState.resource.id, newStart.getTime(), newEnd.getTime(), resizeStartState.event.id); \n if (!hitsDisabled && !overlaps) { \n const ev = resizeStartState.event; \n const oldEndMin = ev.end ? (ev.end.getTime() - dayStartMs.value) / MS_MIN : resizeStartState.minEndMin; \n const oldHeightPx = Math.max((oldEndMin - resizeStartState.startMin) * pxPerMin - 1, 18); \n emit('event-resize', ev, newStart, newEnd); \n stretchResize(ev.id, oldHeightPx); \n } \n resizeJustEnded.value = true; \n setTimeout(() => { resizeJustEnded.value = false; }, 0); \n } \n resizingId.value = null; \n resizingPreview.value = null; \n resizeStartState = null; \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(); shiftDay(-1); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); shiftDay(1); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \ndefineExpose({ scrollToCurrentTime }); \n \nconst resolveEventColor = (ev: SchedulerEvent, r: SchedulerResource): CalendarEvent['color'] => { \n if (ev.color) return ev.color; \n if (props.useResourceColor && r.color) return r.color; \n return props.color; \n}; \n \n \nconst eventInlineStyle = (ev: SchedulerEvent, r: SchedulerResource) => { \n if (ev.colorHex) { \n return { backgroundColor: hexToRgba(ev.colorHex, 0.12), borderLeftColor: ev.colorHex, color: ev.colorHex }; \n } \n if (props.useResourceColor && r.colorHex) { \n return { backgroundColor: hexToRgba(r.colorHex, 0.12), borderLeftColor: r.colorHex, color: r.colorHex }; \n } \n return undefined; \n}; \n \nconst resourceInitials = (title: string) => { \n const parts = title.trim().split(/\\s+/); \n if (!parts.length) return '?'; \n if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase(); \n return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase(); \n}; \n \nconst resourceAvatarColor = (r: SchedulerResource): 'default' | 'primary' | 'danger' | 'success' | 'warning' => { \n const c = r.color ?? 'default'; \n if (c === 'primary' || c === 'danger' || c === 'success' || c === 'warning') return c; \n return 'default'; \n}; \n \nconst { currentTimeSolidClass } = useCurrentTimeLine(() => props.currentTimeColor); \n \nconst { \n todayTextClass, \n rangeSelectClass, \n focusRingColorClass, \n containerRadiusClass, \n eventRadiusClass, \n pillRadiusClass, \n dayNameCaseClass, \n resolvedColor, \n} = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \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() ?? currentDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? currentDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst dayOptions = computed(() => { \n const last = new Date(currentDate.value.getFullYear(), currentDate.value.getMonth() + 1, 0).getDate(); \n return Array.from({ length: last }, (_, i) => i + 1); \n}); \n \nconst selectedDay = computed({ \n get: () => currentDate.value.getDate(), \n set: (dd: number) => { \n const dir = dd > currentDate.value.getDate() ? 1 : -1; \n const d = new Date(currentDate.value); \n d.setDate(dd); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(dir)); \n }, \n}); \n \nconst selectedMonth = computed({ \n get: () => currentDate.value.getMonth(), \n set: (mm: number) => { \n const dir = mm > currentDate.value.getMonth() ? 1 : -1; \n const d = new Date(currentDate.value); \n d.setDate(1); \n d.setMonth(mm); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(dir)); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => currentDate.value.getFullYear(), \n set: (yy: number) => { \n const dir = yy > currentDate.value.getFullYear() ? 1 : -1; \n const d = new Date(currentDate.value); \n d.setFullYear(yy); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(dir)); \n }, \n}); \n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"Scheduler.mjs","names":[],"sources":["../../../../src/components/data-display/calendar/Scheduler.vue"],"sourcesContent":["<template> \n <div \n ref=\"rootRef\" \n tabindex=\"-1\" \n :class=\"['relative flex flex-col bg-card overflow-hidden focus:outline-none isolate', 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 :weekdayLabel=\"weekdayLabel\" \n :showHeader=\"showHeader\" \n :showYearJump=\"showYearJump\" \n :showTodayButton=\"showTodayButton\" \n :showMonthYearSelects=\"showMonthYearSelects\" \n :monthOptions=\"monthOptions\" \n :yearOptions=\"yearOptions\" \n :dayOptions=\"dayOptions\" \n v-model:selectedDay=\"selectedDay\" \n v-model:selectedMonth=\"selectedMonth\" \n v-model:selectedYear=\"selectedYear\" \n :isPrevDisabled=\"isPrevDisabled\" \n :isNextDisabled=\"isNextDisabled\" \n prevLabel=\"Previous day\" \n nextLabel=\"Next day\" \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-scroll overflow-x-auto relative\" style=\"scrollbar-gutter: stable;\"> \n <!-- Inner container: width = hour-col + sum(minResourceWidth). Header + all-day + body live here so they share horizontal scroll. --> \n <div \n class=\"relative flex flex-col\" \n :style=\"{ minWidth: `calc(3.5rem + ${resources.length} * ${minResourceWidth}px)` }\" \n > \n <!-- Resource header (sticky vertically). --> \n <div \n v-if=\"showResourceHeader\" \n class=\"flex border-b border-border bg-muted sticky top-0 z-40\" \n > \n <div class=\"w-14 shrink-0 sticky left-0 z-10 bg-muted border-l border-r border-border\"></div> \n <div class=\"flex-1 flex min-w-0\"> \n <div \n v-for=\"r in resources\" \n :key=\"r.id\" \n class=\"flex-1 min-w-0 border-l border-border px-3 py-2 flex items-center gap-2\" \n :style=\"{ minWidth: `${minResourceWidth}px`, height: `${resourceHeaderHeight}px` }\" \n > \n <slot name=\"resource-header\" :resource=\"r\"> \n <Avatar \n :src=\"r.avatar\" \n :initials=\"resourceInitials(r.title)\" \n size=\"small\" \n :color=\"(r.color && !r.colorHex ? resourceAvatarColor(r) : 'default')\" \n :style=\"r.colorHex && !r.avatar ? { backgroundColor: r.colorHex, color: '#fff' } : undefined\" \n /> \n <div class=\"flex flex-col min-w-0 flex-1\"> \n <span class=\"text-sm font-semibold text-foreground truncate leading-tight\">{{ r.title }}</span> \n <span v-if=\"r.subtitle\" class=\"text-[11px] text-muted-foreground truncate leading-tight\">{{ r.subtitle }}</span> \n </div> \n </slot> \n </div> \n </div> \n </div> \n \n <!-- All-day row (sticky vertically below the resource header). --> \n <div \n v-if=\"showAllDayRow && maxAllDayRows > 0\" \n class=\"flex border-b border-border bg-card sticky z-30\" \n :style=\"{ top: showResourceHeader ? `${resourceHeaderHeight}px` : '0' }\" \n > \n <div class=\"w-14 shrink-0 flex items-start justify-end pr-2 pt-1 text-[10px] font-medium text-muted-foreground uppercase tracking-wider sticky left-0 z-20 bg-card border-l border-r border-border\"> \n all-day \n </div> \n <div class=\"flex-1 flex min-w-0\"> \n <div \n v-for=\"r in resources\" \n :key=\"`ad-${r.id}`\" \n class=\"relative flex-1 min-w-0 border-l border-border\" \n :style=\"[ \n { minWidth: `${minResourceWidth}px`, height: `${maxAllDayRows * 22 + 4}px` }, \n isResourceDisabled(r) ? disabledStripePattern : undefined, \n ]\" \n @click=\"handleAllDayCellClick(r, $event)\" \n @dblclick=\"handleAllDayCellDblClick(r, $event)\" \n @dragover.prevent=\"onAllDayDragOver(r, $event)\" \n @drop.prevent=\"onAllDayDrop(r, $event)\" \n :class=\"[ \n 'transition-colors', \n isResourceDisabled(r) ? 'cursor-not-allowed' : 'cursor-pointer hover:bg-muted/60', \n allDayDragOverResourceId === r.id ? 'bg-muted' : '', \n ]\" \n > \n <div \n v-for=\"seg in allDaySegmentsByResource.get(r.id) ?? []\" \n :key=\"seg.key\" \n :data-eid=\"seg.event.id\" \n :data-rid=\"r.id\" \n :draggable=\"draggableEvents && isEventInteractive(seg.event)\" \n @dragstart=\"onDragStart(seg.event, $event)\" \n @dragend=\"onDragEnd\" \n @click.stop=\"handleEventClick(seg.event, $event)\" \n @mouseenter=\"onEventEnter(seg.event, true, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :style=\"[ \n { \n left: '2px', \n right: '2px', \n top: `${seg.lane * 22 + 2}px`, \n height: '20px', \n }, \n eventInlineStyle(seg.event, r), \n ]\" \n :class=\"[\n 'absolute z-10 truncate text-xs px-1.5 flex items-center cursor-pointer transition-all hover:opacity-80 select-none',\n eventRadiusClass,\n draggableEvents ? 'cursor-grab active:cursor-grabbing touch-none' : '',\n seg.event.colorHex || (useResourceColor && r.colorHex) ? '' : eventColorClass(resolveEventColor(seg.event, r), showEventAccent),\n draggingId === seg.event.id ? 'opacity-70 scale-95' : '',\n ]\" \n > \n <slot name=\"event\" :event=\"seg.event\" :resource=\"r\" :allDay=\"true\"> \n <span class=\"truncate font-medium\">{{ seg.event.title }}</span> \n </slot> \n </div> \n </div> \n </div> \n </div> \n \n <!-- Time-grid body. --> \n <div class=\"flex\"> \n <div class=\"w-14 shrink-0 relative sticky left-0 z-[25] bg-card border-l border-r border-border\" :style=\"{ height: `${totalPixels}px` }\"> \n <div \n v-for=\"h in hourLabels\" \n :key=\"h.offset\" \n class=\"absolute right-0 pr-2 text-[10px] font-medium text-muted-foreground tracking-wide -translate-y-1/2\" \n :style=\"{ top: `${h.offset * 60 * (slotHeight / slotMinutes)}px` }\" \n > \n <span v-if=\"h.offset !== 0 && h.offset !== windowHours\">{{ h.label }}</span> \n </div> \n <span \n v-if=\"showCurrentTime && showCurrentTimeLabel && isTodayInView\" \n :class=\"['absolute right-1 -translate-y-1/2 px-1 py-0.5 text-[10px] font-semibold text-white leading-none z-30 pointer-events-none', eventRadiusClass, currentTimeSolidClass]\" \n :style=\"{ top: `${currentTimeTop}px` }\" \n >{{ currentTimeLabel }}</span> \n <span \n v-else-if=\"showCurrentTime && !showCurrentTimeLabel && isTodayInView\" \n :class=\"['absolute right-0 -translate-y-1/2 w-1.5 h-1.5 rounded-full z-30 pointer-events-none', currentTimeSolidClass]\" \n :style=\"{ top: `${currentTimeTop}px` }\" \n ></span> \n </div> \n \n <div class=\"flex-1 flex min-w-0 relative\"> \n <div \n v-for=\"r in resources\" \n :key=\"`col-${r.id}`\" \n :ref=\"(el: unknown) => setColRef(r.id, el as HTMLElement | null)\" \n class=\"relative flex-1 min-w-0 border-l border-border\" \n :style=\"{ minWidth: `${minResourceWidth}px` }\" \n @pointerdown=\"onColPointerDown(r, $event)\" \n @click=\"handleSlotClick(r, $event)\" \n @dblclick=\"handleSlotDblClick(r, $event)\" \n @dragover.prevent=\"onDragOver(r, $event)\" \n @drop.prevent=\"onDrop(r, $event)\" \n > \n <div \n v-for=\"(_, idx) in totalSlots\" \n :key=\"idx\" \n :style=\"[ \n { height: `${slotHeight}px` }, \n isSlotDisabled(r, idx) \n ? disabledStripePattern \n : !isBusinessHourSlot(idx) \n ? { backgroundColor: 'rgba(0,0,0,0.015)' } \n : undefined, \n ]\" \n :class=\"[ \n 'border-t', \n idx === 0 ? 'border-transparent' : idx % slotsPerHour === 0 ? 'border-border' : 'border-dashed border-border/70', \n isSlotDisabled(r, idx) ? 'cursor-not-allowed' : '', \n ]\" \n ></div> \n \n <div \n v-if=\"isResourceDisabled(r)\" \n class=\"absolute inset-0 pointer-events-none\" \n :style=\"disabledStripePattern\" \n ></div> \n \n <div \n v-for=\"seg in timedSegmentsByResource.get(r.id) ?? []\" \n :key=\"seg.key\" \n :data-eid=\"seg.event.id\" \n :data-rid=\"r.id\" \n :draggable=\"draggableEvents && resizingId !== seg.event.id && isEventInteractive(seg.event)\" \n @dragstart.stop=\"onDragStart(seg.event, $event)\" \n @dragend=\"onDragEnd\" \n @click.stop=\"handleEventClick(seg.event, $event)\" \n @pointerdown.stop \n @mouseenter=\"onEventEnter(seg.event, false, $event)\" \n @mousemove=\"onEventMove\" \n @mouseleave=\"onEventLeave\" \n :style=\"[seg.style, eventInlineStyle(seg.event, r)]\" \n :class=\"[\n 'absolute z-10 overflow-hidden transition-all hover:opacity-90 select-none flex flex-col',\n eventRadiusClass,\n isEventInteractive(seg.event) ? 'cursor-pointer' : 'cursor-default',\n draggableEvents && isEventInteractive(seg.event) ? 'cursor-grab active:cursor-grabbing touch-none' : '',\n seg.event.colorHex || (useResourceColor && r.colorHex) ? (showEventAccent ? 'border-l-2' : '') : eventColorClass(resolveEventColor(seg.event, r), showEventAccent),\n draggingId === seg.event.id ? 'opacity-70 scale-95' : '',\n ]\" \n > \n <slot name=\"event\" :event=\"seg.event\" :resource=\"r\" :allDay=\"false\"> \n <div class=\"px-2 py-1 flex-1 min-h-0\"> \n <div class=\"text-[10px] font-semibold leading-tight opacity-80\">{{ formatEventTime(seg.event.start) }}<template v-if=\"seg.event.end\"> – {{ formatEventTime(seg.event.end) }}</template></div> \n <div class=\"text-xs font-medium truncate leading-tight\">{{ seg.event.title }}</div> \n <div v-if=\"seg.event.description\" class=\"text-[11px] opacity-70 truncate leading-tight mt-0.5\">{{ seg.event.description }}</div> \n </div> \n </slot> \n <div \n v-if=\"resizableEvents && isEventInteractive(seg.event)\" \n draggable=\"false\" \n @mousedown.stop.prevent \n @dragstart.stop.prevent \n @pointerdown.stop=\"onResizeStart(seg.event, r, $event)\" \n class=\"absolute bottom-0 left-0 right-0 h-1.5 cursor-ns-resize hover:bg-black/10 touch-none\" \n ></div> \n </div> \n \n <div \n v-if=\"dragOverResourceId === r.id\" \n class=\"absolute inset-0 pointer-events-none z-0 bg-muted/60\" \n ></div> \n \n <div \n v-if=\"rangeSelect && rangeSelect.resourceId === r.id\" \n :class=\"['absolute left-1 right-1 pointer-events-none z-20 border border-dashed', eventRadiusClass, rangeSelectClass]\" \n :style=\"{ top: `${rangeSelect.topPx}px`, height: `${rangeSelect.heightPx}px` }\" \n ></div> \n \n <div \n v-if=\"resizingPreview && resizingPreview.resourceId === r.id\" \n :class=\"['absolute left-1 right-1 pointer-events-none z-20 border border-dashed border-muted-foreground bg-foreground/5', eventRadiusClass]\" \n :style=\"{ top: `${resizingPreview.topPx}px`, height: `${resizingPreview.heightPx}px` }\" \n ></div> \n </div> \n \n <div \n v-if=\"showCurrentTime && isTodayInView\" \n class=\"absolute left-0 right-0 h-px pointer-events-none z-20\" \n :class=\"currentTimeSolidClass\" \n :style=\"{ top: `${currentTimeTop}px` }\" \n ></div> \n </div> \n </div> \n </div> \n </div> \n \n <button \n v-if=\"showNowPill && isTodayInView\" \n type=\"button\" \n @click=\"scrollToCurrentTime\" \n :class=\"['absolute bottom-4 right-6 z-40 px-3 py-1.5 flex items-center gap-1.5 text-xs font-medium shadow-lg bg-card border border-border hover:bg-muted transition-all cursor-pointer', pillRadiusClass]\" \n > \n <span class=\"w-1.5 h-1.5\" :class=\"[pillRadiusClass, currentTimeSolidClass]\"></span> \n <span class=\"text-foreground/80\">Now</span> \n </button> \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, onUnmounted } from 'vue'; \nimport gsap from 'gsap'; \nimport Avatar from '../avatar/Avatar.vue'; \nimport { isSameDay, startOfDay } from '../../../composables/useCalendar'; \nimport { useCalendarTheme } from '../../../composables/useCalendarTheme'; \nimport { useEventHover } from '../../../composables/useEventHover'; \nimport { useAutoScroll } from '../../../composables/useAutoScroll'; \nimport { useCurrentTimeLine } from '../../../composables/useCurrentTimeLine'; \nimport { useTimeGrid, MS_MIN } from '../../../composables/useTimeGrid'; \nimport { eventColorClass, hexToRgba } from '../../../composables/eventColors'; \nimport CalendarEventTooltip from './CalendarEventTooltip.vue'; \nimport CalendarHeader from './CalendarHeader.vue'; \nimport type { Scheduler, SchedulerResource, SchedulerEvent } from '../../../interfaces/data-display/calendar/Scheduler.interface'; \nimport type { BusinessHours } from '../../../interfaces/data-display/calendar/WeekView.interface'; \nimport type { CalendarEvent } from '../../../interfaces/data-display/calendar/MonthView.interface'; \n \nimport { toCssLength } from '../../../utils/cssLength';\n\nconst props = withDefaults(defineProps<Scheduler>(), { \n modelValue: () => new Date(), \n events: () => [], \n resourceIdField: 'resourceId', \n locale: 'default', \n color: 'default', \n bordered: true, \n dayNameFormat: 'long', \n dayNameCase: 'upper', \n highlightedDates: () => [], \n disabledDates: () => [], \n disabledWeekdays: () => [], \n disabledTimeRanges: () => [], \n showHeader: true, \n showTodayButton: true, \n showYearJump: false, \n showMonthYearSelects: false, \n showResourceHeader: true, \n resourceHeaderHeight: 52, \n minResourceWidth: 140, \n hourStart: 0, \n hourEnd: 24, \n slotMinutes: 30, \n slotHeight: 28, \n format: '24h', \n showCurrentTime: true, \n showCurrentTimeLabel: true, \n currentTimeColor: 'red', \n currentTimeUpdateInterval: 60000, \n draggableEvents: true, \n resizableEvents: true, \n allowRangeSelection: true, \n allowCrossResourceDrag: true, \n allowDropOnDisabled: false, \n allowResizeOverDisabled: false, \n readonly: false, \n preventOverlap: false, \n autoScrollOnDrag: true, \n showAllDayRow: true, \n enableKeyboardNavigation: true, \n showNowPill: true, \n useResourceColor: true, \n}); \n \nconst emit = defineEmits<{ \n 'update:modelValue': [date: Date]; \n 'event-click': [event: SchedulerEvent, nativeEvent: MouseEvent]; \n 'slot-click': [date: Date, resource: SchedulerResource, nativeEvent: MouseEvent]; \n 'create-event': [date: Date, resource: SchedulerResource, allDay: boolean, nativeEvent: MouseEvent | KeyboardEvent]; \n 'event-drop': [event: SchedulerEvent, newStart: Date, newEnd: Date | undefined, newResource: SchedulerResource]; \n 'event-resize': [event: SchedulerEvent, newStart: Date, newEnd: Date]; \n 'select-range': [start: Date, end: Date, resource: SchedulerResource]; \n}>(); \n \nconst currentDate = ref(startOfDay(new Date(props.modelValue))); \nwatch(() => props.modelValue, (v) => { if (v) currentDate.value = startOfDay(new Date(v)); }); \n \nconst rootRef = ref<HTMLElement | null>(null); \nconst scrollRef = ref<HTMLElement | null>(null); \nconst colRefs = new Map<string | number, HTMLElement>(); \nconst setColRef = (id: string | number, el: HTMLElement | null) => { \n if (el) colRefs.set(id, el); \n else colRefs.delete(id); \n}; \nconst now = ref(new Date()); \nconst scrollbarWidth = ref(0); \nlet tickInterval: ReturnType<typeof setInterval> | null = null; \n \nconst { hoverState, onEventEnter, onEventMove, onEventLeave, tooltipStyle } = useEventHover<SchedulerEvent>(); \n \nconst disabledStripePattern = { \n backgroundImage: 'repeating-linear-gradient(-45deg, transparent 0 5px, rgba(0,0,0,0.035) 5px 6px)', \n}; \n \nconst { handleAutoScroll, stopAutoScroll } = useAutoScroll({ \n scrollRef, \n enabled: () => props.autoScrollOnDrag, \n}); \n \n \nonMounted(() => { \n if (props.currentTimeUpdateInterval > 0) { \n tickInterval = setInterval(() => { now.value = new Date(); }, props.currentTimeUpdateInterval); \n } \n if (scrollRef.value) { \n scrollbarWidth.value = scrollRef.value.offsetWidth - scrollRef.value.clientWidth; \n } \n scrollToCurrentTime(); \n nextTick(() => { \n if (!rootRef.value) return; \n const els = rootRef.value.querySelectorAll<HTMLElement>('[data-eid]'); \n if (els.length) { \n gsap.fromTo( \n els, \n { opacity: 0, y: 6, scale: 0.96 }, \n { opacity: 1, y: 0, scale: 1, duration: 0.4, ease: 'power2.out', stagger: { amount: 0.2 } } \n ); \n } \n }); \n}); \nonUnmounted(() => { if (tickInterval) clearInterval(tickInterval); }); \n \nconst headerLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return currentDate.value.toLocaleDateString(locale, { month: 'long', day: 'numeric', year: 'numeric' }); \n}); \nconst weekdayLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return currentDate.value.toLocaleDateString(locale, { weekday: props.dayNameFormat }); \n}); \n \nconst isPrevDisabled = computed(() => { \n if (!props.minDate) return false; \n const prev = new Date(currentDate.value); \n prev.setDate(prev.getDate() - 1); \n return prev < startOfDay(props.minDate); \n}); \nconst isNextDisabled = computed(() => { \n if (!props.maxDate) return false; \n const next = new Date(currentDate.value); \n next.setDate(next.getDate() + 1); \n return next > startOfDay(props.maxDate); \n}); \n \nconst isDisabledDate = (d: Date) => props.disabledDates.some(x => isSameDay(x, d)); \nconst isDisabledWeekday = (d: Date) => props.disabledWeekdays.includes(d.getDay()); \nconst dayIsDisabled = computed(() => { \n const d = currentDate.value; \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}); \nconst isResourceDisabled = (r: SchedulerResource) => dayIsDisabled.value || !!r.disabled; \n \nconst parseHM = (s: string) => { \n const [h, m] = s.split(':').map(Number); \n return h * 60 + (m || 0); \n}; \n \nconst splitDayRange = (absStart: number, absEnd: number) => { \n const parts: { dayOffset: number; startMin: number; endMin: number }[] = []; \n let s = absStart; \n while (s < absEnd) { \n const dayOffset = Math.floor(s / 1440); \n const dayStart = dayOffset * 1440; \n const chunkEnd = Math.min(absEnd, dayStart + 1440); \n parts.push({ dayOffset, startMin: s - dayStart, endMin: chunkEnd - dayStart }); \n s = chunkEnd; \n } \n return parts; \n}; \n \nconst rangeMatchesDisabled = (baseDow: number, absStart: number, absEnd: number) => { \n if (!props.disabledTimeRanges.length) return false; \n const parts = splitDayRange(absStart, absEnd); \n return parts.some(p => { \n const dow = (baseDow + p.dayOffset) % 7; \n return props.disabledTimeRanges.some(r => { \n if (r.daysOfWeek && !r.daysOfWeek.includes(dow)) return false; \n const rs = parseHM(r.start); \n const re = parseHM(r.end); \n return p.startMin < re && p.endMin > rs; \n }); \n }); \n}; \n \nconst isSlotDisabled = (r: SchedulerResource, slotIdx: number) => { \n if (isResourceDisabled(r)) return true; \n if (!props.disabledTimeRanges.length) return false; \n const slotStartMin = props.hourStart * 60 + slotIdx * props.slotMinutes; \n const slotEndMin = slotStartMin + props.slotMinutes; \n return rangeMatchesDisabled(currentDate.value.getDay(), slotStartMin, slotEndMin); \n}; \n \nconst rangeHitsDisabled = (r: SchedulerResource, startMinFromHourStart: number, endMinFromHourStart: number) => { \n if (isResourceDisabled(r)) return true; \n if (!props.disabledTimeRanges.length) return false; \n const absStart = props.hourStart * 60 + startMinFromHourStart; \n const absEnd = props.hourStart * 60 + endMinFromHourStart; \n return rangeMatchesDisabled(currentDate.value.getDay(), absStart, absEnd); \n}; \n \nconst eventResourceId = (ev: SchedulerEvent): string | number | undefined => { \n const v = (ev as unknown as Record<string, unknown>)[props.resourceIdField]; \n if (v === undefined || v === null) return undefined; \n return v as string | number; \n}; \n \nconst rangeOverlapsEvent = (resourceId: string | number, startMs: number, endMs: number, ignoreId: CalendarEvent['id']) => { \n return props.events.some(ev => { \n if (ev.id === ignoreId) return false; \n if (ev.allDay) return false; \n if (eventResourceId(ev) !== resourceId) return false; \n if (!isSameDay(ev.start, currentDate.value)) return false; \n const es = ev.start.getTime(); \n const ee = (ev.end ?? ev.start).getTime(); \n return startMs < ee && endMs > es; \n }); \n}; \n \nconst isEventInteractive = (ev: CalendarEvent) => !props.readonly && !ev.readonly; \n \nconst businessHoursList = computed<BusinessHours[]>(() => { \n if (!props.businessHours) return []; \n return Array.isArray(props.businessHours) ? props.businessHours : [props.businessHours]; \n}); \n \nconst isBusinessHourSlot = (slotIdx: number) => { \n if (!businessHoursList.value.length) return true; \n const slotStartMin = props.hourStart * 60 + slotIdx * props.slotMinutes; \n const slotEndMin = slotStartMin + props.slotMinutes; \n const parts = splitDayRange(slotStartMin, slotEndMin); \n const baseDow = currentDate.value.getDay(); \n return parts.some(p => { \n const dow = (baseDow + p.dayOffset) % 7; \n return businessHoursList.value.some(b => { \n if (b.daysOfWeek && !b.daysOfWeek.includes(dow)) return false; \n return p.startMin >= parseHM(b.start) && p.startMin < parseHM(b.end); \n }); \n }); \n}; \n \nconst { \n slotsPerHour, \n windowHours, \n totalSlots, \n windowMinutes, \n totalPixels, \n hourLabels, \n dayStartMs: getDayStartMs, \n dayEndMs: getDayEndMs, \n} = useTimeGrid({ \n hourStart: () => props.hourStart, \n hourEnd: () => props.hourEnd, \n slotMinutes: () => props.slotMinutes, \n slotHeight: () => props.slotHeight, \n format: () => props.format, \n}); \n \nconst dayStartMs = computed(() => getDayStartMs(currentDate.value)); \nconst dayEndMs = computed(() => getDayEndMs(currentDate.value)); \n \ninterface TimedSeg { key: string; event: SchedulerEvent; style: Record<string, string>; } \n \nconst timedSegmentsByResource = computed<Map<string | number, TimedSeg[]>>(() => { \n const map = new Map<string | number, TimedSeg[]>(); \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const dStart = dayStartMs.value; \n const dEnd = dayEndMs.value; \n \n for (const r of props.resources) { \n const dayEvents = props.events \n .filter(ev => !ev.allDay && eventResourceId(ev) === r.id) \n .filter(ev => { \n const es = ev.start.getTime(); \n const ee = (ev.end ?? ev.start).getTime(); \n return !(ee <= dStart || es >= dEnd); \n }) \n .sort((a, b) => a.start.getTime() - b.start.getTime()); \n \n const clusters: SchedulerEvent[][] = []; \n for (const ev of dayEvents) { \n const evStart = Math.max(ev.start.getTime(), dStart); \n let placed = false; \n for (const cluster of clusters) { \n const clusterEnd = Math.max(...cluster.map(e => Math.min((e.end ?? e.start).getTime(), dEnd))); \n if (evStart < clusterEnd) { cluster.push(ev); placed = true; break; } \n } \n if (!placed) clusters.push([ev]); \n } \n \n const segs: TimedSeg[] = []; \n for (const cluster of clusters) { \n const columns: SchedulerEvent[][] = []; \n for (const ev of cluster) { \n const evStart = Math.max(ev.start.getTime(), dStart); \n let placed = false; \n for (const col of columns) { \n const last = col[col.length - 1]; \n const lastEnd = Math.min((last.end ?? last.start).getTime(), dEnd); \n if (lastEnd <= evStart) { col.push(ev); placed = true; break; } \n } \n if (!placed) columns.push([ev]); \n } \n const colCount = columns.length; \n columns.forEach((col, colIdx) => { \n for (const ev of col) { \n const startMs = Math.max(ev.start.getTime(), dStart); \n const endMsRaw = (ev.end ?? new Date(ev.start.getTime() + 30 * MS_MIN)).getTime(); \n const endMs = Math.min(endMsRaw, dEnd); \n const startMin = (startMs - dStart) / MS_MIN; \n const endMin = (endMs - dStart) / MS_MIN; \n const top = startMin * pxPerMin; \n const height = Math.max((endMin - startMin) * pxPerMin - 1, 18); \n const width = 100 / colCount; \n const left = colIdx * width; \n segs.push({ \n key: String(ev.id), \n event: ev, \n style: { \n top: `${top}px`, \n height: `${height}px`, \n left: `calc(${left}% + 2px)`, \n width: `calc(${width}% - 4px)`, \n }, \n }); \n } \n }); \n } \n map.set(r.id, segs); \n } \n return map; \n}); \n \ninterface AllDaySeg { key: string; event: SchedulerEvent; lane: number; } \nconst allDaySegmentsByResource = computed<Map<string | number, AllDaySeg[]>>(() => { \n const map = new Map<string | number, AllDaySeg[]>(); \n const target = startOfDay(currentDate.value).getTime(); \n for (const r of props.resources) { \n const list = props.events \n .filter(ev => eventResourceId(ev) === r.id) \n .filter(ev => ev.allDay || (ev.end && startOfDay(ev.end).getTime() > startOfDay(ev.start).getTime())) \n .filter(ev => { \n const sd = startOfDay(ev.start).getTime(); \n const ed = startOfDay(ev.end ?? ev.start).getTime(); \n return target >= sd && target <= ed; \n }) \n .sort((a, b) => a.start.getTime() - b.start.getTime()); \n map.set(r.id, list.map((ev, i) => ({ key: `ad-${ev.id}`, event: ev, lane: i }))); \n } \n return map; \n}); \nconst maxAllDayRows = computed(() => { \n let max = 0; \n for (const list of allDaySegmentsByResource.value.values()) max = Math.max(max, list.length); \n return max; \n}); \n \nconst isTodayInView = computed(() => { \n const nt = now.value.getTime(); \n return nt >= dayStartMs.value && nt < dayEndMs.value; \n}); \n \nconst currentTimeTop = computed(() => { \n if (!isTodayInView.value) return 0; \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const min = (now.value.getTime() - dayStartMs.value) / MS_MIN; \n return Math.max(0, Math.min(min, windowMinutes.value)) * pxPerMin; \n}); \n \nconst currentTimeLabel = computed(() => { \n const locale = props.locale === 'default' ? undefined : props.locale; \n return now.value.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: props.format === '12h' }); \n}); \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 scrollToCurrentTime = () => { \n nextTick(() => { \n if (!scrollRef.value) return; \n let top = 0; \n if (isTodayInView.value) { \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const min = (now.value.getTime() - dayStartMs.value) / MS_MIN; \n top = Math.max(0, Math.min(min, windowMinutes.value)) * pxPerMin; \n } \n const target = Math.max(0, top - scrollRef.value.clientHeight / 3); \n gsap.to(scrollRef.value, { scrollTop: target, duration: 0.55, ease: 'power3.inOut' }); \n }); \n}; \n \nconst animate = (dir: 1 | -1) => { \n if (!scrollRef.value) return; \n gsap.fromTo( \n scrollRef.value, \n { opacity: 0, x: 24 * dir }, \n { opacity: 1, x: 0, duration: 0.32, ease: 'power3.out' } \n ); \n nextTick(() => { \n if (!scrollRef.value) return; \n const els = scrollRef.value.querySelectorAll<HTMLElement>('[data-eid]'); \n if (els.length) { \n gsap.fromTo( \n els, \n { opacity: 0, y: 6, scale: 0.96 }, \n { opacity: 1, y: 0, scale: 1, duration: 0.35, ease: 'power2.out', stagger: { amount: 0.18 } } \n ); \n } \n }); \n}; \n \nconst findEventEls = (id: CalendarEvent['id']): HTMLElement[] => { \n if (!rootRef.value) return []; \n return Array.from(rootRef.value.querySelectorAll<HTMLElement>(`[data-eid=\"${id}\"]`)); \n}; \n \nconst dropGrowEvent = (id: CalendarEvent['id']) => { \n nextTick(() => { \n const els = findEventEls(id); \n if (!els.length) return; \n gsap.fromTo( \n els, \n { scale: 0.9, opacity: 0 }, \n { scale: 1, opacity: 1, duration: 0.32, ease: 'power3.out', transformOrigin: 'center center', overwrite: 'auto' } \n ); \n }); \n}; \n \nconst stretchResize = (id: CalendarEvent['id'], oldHeightPx: number) => { \n nextTick(() => { \n const els = findEventEls(id); \n if (!els.length) return; \n els.forEach(el => { \n const newH = el.offsetHeight; \n if (newH <= 0 || oldHeightPx <= 0 || newH === oldHeightPx) return; \n const fromScale = oldHeightPx / newH; \n gsap.fromTo( \n el, \n { scaleY: fromScale }, \n { scaleY: 1, duration: 0.32, ease: 'power3.out', transformOrigin: 'top center', overwrite: 'auto', clearProps: 'transform' } \n ); \n }); \n }); \n}; \n \nconst shiftDay = (days: number) => { \n const d = new Date(currentDate.value); \n d.setDate(d.getDate() + days); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(days > 0 ? 1 : -1)); \n}; \nconst handlePrev = () => shiftDay(-1); \nconst handleNext = () => shiftDay(1); \nconst handlePrevYear = () => { \n const d = new Date(currentDate.value); \n d.setFullYear(d.getFullYear() - 1); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(-1)); \n}; \nconst handleNextYear = () => { \n const d = new Date(currentDate.value); \n d.setFullYear(d.getFullYear() + 1); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(1)); \n}; \nconst handleToday = () => { \n const n = new Date(); \n currentDate.value = startOfDay(n); \n emit('update:modelValue', n); \n nextTick(() => { animate(1); scrollToCurrentTime(); }); \n}; \n \nconst clickTimer = ref<ReturnType<typeof setTimeout> | null>(null); \nconst DOUBLE_CLICK_DELAY = 220; \n \nconst pxToSlotMin = (offsetY: number) => { \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const rawMin = offsetY / pxPerMin; \n return Math.floor(rawMin / props.slotMinutes) * props.slotMinutes; \n}; \nconst slotDateFromOffset = (offsetY: number): Date => { \n const snapped = pxToSlotMin(offsetY); \n const base = new Date(currentDate.value); \n base.setHours(props.hourStart, 0, 0, 0); \n base.setMinutes(base.getMinutes() + snapped); \n return base; \n}; \nconst offsetFromEvent = (el: HTMLElement, clientY: number) => { \n const rect = el.getBoundingClientRect(); \n return Math.max(0, clientY - rect.top); \n}; \n \nconst handleSlotClick = (r: SchedulerResource, e: MouseEvent) => { \n if (rangeJustSelected.value) { rangeJustSelected.value = false; return; } \n if (isResourceDisabled(r)) return; \n const offsetY = offsetFromEvent(e.currentTarget as HTMLElement, e.clientY); \n const dt = slotDateFromOffset(offsetY); \n const slotIdx = Math.floor(((dt.getHours() - props.hourStart) * 60 + dt.getMinutes()) / props.slotMinutes); \n if (isSlotDisabled(r, slotIdx)) return; \n if (clickTimer.value) clearTimeout(clickTimer.value); \n clickTimer.value = setTimeout(() => { \n emit('slot-click', dt, r, e); \n clickTimer.value = null; \n }, DOUBLE_CLICK_DELAY); \n}; \nconst handleSlotDblClick = (r: SchedulerResource, e: MouseEvent) => { \n if (props.readonly) return; \n if (isResourceDisabled(r)) return; \n if (clickTimer.value) { clearTimeout(clickTimer.value); clickTimer.value = null; } \n const offsetY = offsetFromEvent(e.currentTarget as HTMLElement, e.clientY); \n const dt = slotDateFromOffset(offsetY); \n const slotIdx = Math.floor(((dt.getHours() - props.hourStart) * 60 + dt.getMinutes()) / props.slotMinutes); \n if (isSlotDisabled(r, slotIdx)) return; \n emit('create-event', dt, r, false, e); \n}; \n \nconst handleAllDayCellClick = (_r: SchedulerResource, _e: MouseEvent) => {}; \nconst handleAllDayCellDblClick = (r: SchedulerResource, e: MouseEvent) => { \n if (props.readonly) return; \n if (isResourceDisabled(r)) return; \n emit('create-event', startOfDay(currentDate.value), r, true, e); \n}; \n \nconst resizeJustEnded = ref(false); \nconst handleEventClick = (ev: SchedulerEvent, e: MouseEvent) => { \n if (resizeJustEnded.value) { resizeJustEnded.value = false; return; } \n emit('event-click', ev, e); \n}; \n \nconst draggingId = ref<string | number | null>(null); \nconst dragOverResourceId = ref<string | number | null>(null); \nconst allDayDragOverResourceId = ref<string | number | null>(null); \n \nconst onDragStart = (ev: SchedulerEvent, e: DragEvent) => { \n if (!props.draggableEvents || !isEventInteractive(ev)) { e.preventDefault(); return; } \n onEventLeave(); \n draggingId.value = ev.id; \n if (e.dataTransfer) { \n e.dataTransfer.effectAllowed = 'move'; \n e.dataTransfer.setData('text/plain', String(ev.id)); \n const src = e.currentTarget as HTMLElement; \n if (src && typeof e.dataTransfer.setDragImage === 'function') { \n const rect = src.getBoundingClientRect(); \n const w = Math.max(rect.width * 0.7, 90); \n const h = Math.max(rect.height * 0.7, 26); \n const wrap = document.createElement('div'); \n wrap.style.cssText = [ \n 'position:absolute', 'top:-9999px', 'left:-9999px', \n `width:${w}px`, `height:${h}px`, \n 'background:white', 'border-radius:4px', 'overflow:hidden', \n 'box-shadow:0 6px 18px rgba(0,0,0,0.22)', \n 'pointer-events:none', 'margin:0', 'transform:rotate(-1.5deg)', \n ].join(';'); \n const clone = src.cloneNode(true) as HTMLElement; \n clone.style.position = 'static'; \n clone.style.width = '100%'; \n clone.style.height = '100%'; \n clone.style.left = 'auto'; \n clone.style.top = 'auto'; \n clone.style.margin = '0'; \n clone.style.opacity = '1'; \n wrap.appendChild(clone); \n document.body.appendChild(wrap); \n e.dataTransfer.setDragImage(wrap, Math.round(w / 2), 14); \n setTimeout(() => { wrap.parentNode?.removeChild(wrap); }, 0); \n } \n } \n}; \nconst onDragEnd = () => { \n draggingId.value = null; \n dragOverResourceId.value = null; \n allDayDragOverResourceId.value = null; \n stopAutoScroll(); \n}; \n \nconst canDropOnResource = (r: SchedulerResource, ev: SchedulerEvent | undefined) => { \n if (!ev) return false; \n const origin = eventResourceId(ev); \n if (origin !== r.id && !props.allowCrossResourceDrag) return false; \n return true; \n}; \n \nconst onDragOver = (r: SchedulerResource, e: DragEvent) => { \n if (!props.draggableEvents || draggingId.value === null) return; \n const ev = props.events.find(x => x.id === draggingId.value); \n let blocked = false; \n if (!canDropOnResource(r, ev)) blocked = true; \n if (!blocked && !props.allowDropOnDisabled) { \n if (isResourceDisabled(r)) blocked = true; \n else if (ev && !ev.allDay) { \n const offsetY = offsetFromEvent(e.currentTarget as HTMLElement, e.clientY); \n const snappedMin = pxToSlotMin(offsetY); \n const duration = ev.end ? ev.end.getTime() - ev.start.getTime() : 30 * MS_MIN; \n const durationMin = duration / MS_MIN; \n if (rangeHitsDisabled(r, snappedMin, snappedMin + durationMin)) blocked = true; \n } \n } \n if (e.dataTransfer) e.dataTransfer.dropEffect = blocked ? 'none' : 'move'; \n dragOverResourceId.value = blocked ? null : r.id; \n handleAutoScroll(e.clientY); \n}; \nconst onDrop = (r: SchedulerResource, e: DragEvent) => { \n if (!props.draggableEvents || draggingId.value === null) return; \n const ev = props.events.find(x => x.id === draggingId.value); \n if (!ev || !canDropOnResource(r, ev)) { onDragEnd(); return; } \n if (!props.allowDropOnDisabled && isResourceDisabled(r)) { onDragEnd(); return; } \n const offsetY = offsetFromEvent(e.currentTarget as HTMLElement, e.clientY); \n const snappedMin = pxToSlotMin(offsetY); \n const wasAllDay = !!ev.allDay; \n const duration = !wasAllDay && ev.end ? ev.end.getTime() - ev.start.getTime() : 30 * MS_MIN; \n const durationMin = duration / MS_MIN; \n if (!props.allowDropOnDisabled && rangeHitsDisabled(r, snappedMin, snappedMin + durationMin)) { onDragEnd(); return; } \n const newStart = new Date(currentDate.value); \n newStart.setHours(props.hourStart, 0, 0, 0); \n newStart.setMinutes(newStart.getMinutes() + snappedMin); \n const newEnd = new Date(newStart.getTime() + duration); \n if (props.preventOverlap && rangeOverlapsEvent(r.id, newStart.getTime(), newEnd.getTime(), ev.id)) { onDragEnd(); return; } \n const emitEv: SchedulerEvent = wasAllDay \n ? { ...ev, allDay: false, [props.resourceIdField]: r.id } as SchedulerEvent \n : { ...ev, [props.resourceIdField]: r.id } as SchedulerEvent; \n emit('event-drop', emitEv, newStart, newEnd, r); \n dropGrowEvent(ev.id); \n onDragEnd(); \n}; \n \nconst onAllDayDragOver = (r: SchedulerResource, e: DragEvent) => { \n if (!props.draggableEvents || draggingId.value === null) return; \n const ev = props.events.find(x => x.id === draggingId.value); \n let blocked = false; \n if (!canDropOnResource(r, ev)) blocked = true; \n if (!blocked && !props.allowDropOnDisabled && isResourceDisabled(r)) blocked = true; \n if (e.dataTransfer) e.dataTransfer.dropEffect = blocked ? 'none' : 'move'; \n allDayDragOverResourceId.value = blocked ? null : r.id; \n}; \nconst onAllDayDrop = (r: SchedulerResource, _e: DragEvent) => { \n if (!props.draggableEvents || draggingId.value === null) return; \n const ev = props.events.find(x => x.id === draggingId.value); \n if (!ev || !canDropOnResource(r, ev)) { onDragEnd(); return; } \n if (!props.allowDropOnDisabled && isResourceDisabled(r)) { onDragEnd(); return; } \n const wasAllDay = !!ev.allDay; \n const duration = wasAllDay && ev.end ? startOfDay(ev.end).getTime() - startOfDay(ev.start).getTime() : 0; \n const newStart = startOfDay(currentDate.value); \n const newEnd = new Date(newStart.getTime() + duration); \n const emitEv: SchedulerEvent = !wasAllDay \n ? { ...ev, allDay: true, [props.resourceIdField]: r.id } as SchedulerEvent \n : { ...ev, [props.resourceIdField]: r.id } as SchedulerEvent; \n emit('event-drop', emitEv, newStart, wasAllDay ? newEnd : undefined, r); \n dropGrowEvent(ev.id); \n onDragEnd(); \n}; \n \ninterface RangeSelect { resourceId: string | number; startMin: number; endMin: number; topPx: number; heightPx: number; } \nconst rangeSelect = ref<RangeSelect | null>(null); \nconst rangeJustSelected = ref(false); \nlet rangePointerId: number | null = null; \nlet rangeStartColEl: HTMLElement | null = null; \nlet rangeResource: SchedulerResource | null = null; \n \nconst onColPointerDown = (r: SchedulerResource, e: PointerEvent) => { \n if (props.readonly) return; \n if (!props.allowRangeSelection) return; \n if (e.button !== 0) return; \n if (isResourceDisabled(r)) return; \n rangeStartColEl = e.currentTarget as HTMLElement; \n rangeResource = r; \n const offsetY = offsetFromEvent(rangeStartColEl, e.clientY); \n const startMin = pxToSlotMin(offsetY); \n const pxPerMin = props.slotHeight / props.slotMinutes; \n rangeSelect.value = { \n resourceId: r.id, \n startMin, \n endMin: startMin + props.slotMinutes, \n topPx: startMin * pxPerMin, \n heightPx: props.slotMinutes * pxPerMin, \n }; \n rangePointerId = e.pointerId; \n rangeStartColEl.setPointerCapture(e.pointerId); \n rangeStartColEl.addEventListener('pointermove', onRangePointerMove); \n rangeStartColEl.addEventListener('pointerup', onRangePointerUp); \n rangeStartColEl.addEventListener('pointercancel', onRangePointerUp); \n}; \nconst onRangePointerMove = (e: PointerEvent) => { \n if (!rangeSelect.value || !rangeStartColEl) return; \n handleAutoScroll(e.clientY); \n const offsetY = offsetFromEvent(rangeStartColEl, e.clientY); \n const curMin = Math.max(0, Math.min(windowMinutes.value, pxToSlotMin(offsetY) + props.slotMinutes)); \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const s = Math.min(rangeSelect.value.startMin, curMin - props.slotMinutes); \n const e2 = Math.max(rangeSelect.value.startMin + props.slotMinutes, curMin); \n rangeSelect.value = { ...rangeSelect.value, topPx: s * pxPerMin, heightPx: (e2 - s) * pxPerMin, endMin: e2, startMin: s }; \n}; \nconst onRangePointerUp = (_e: PointerEvent) => { \n if (!rangeSelect.value || !rangeStartColEl || !rangeResource) return; \n stopAutoScroll(); \n const { startMin, endMin } = rangeSelect.value; \n const r = rangeResource; \n rangeStartColEl.removeEventListener('pointermove', onRangePointerMove); \n rangeStartColEl.removeEventListener('pointerup', onRangePointerUp); \n rangeStartColEl.removeEventListener('pointercancel', onRangePointerUp); \n if (rangePointerId !== null) rangeStartColEl.releasePointerCapture?.(rangePointerId); \n rangePointerId = null; \n rangeStartColEl = null; \n rangeResource = null; \n \n const durationMin = endMin - startMin; \n if (durationMin > props.slotMinutes) { \n const start = new Date(currentDate.value); \n start.setHours(props.hourStart, 0, 0, 0); \n start.setMinutes(start.getMinutes() + startMin); \n const end = new Date(start.getTime() + durationMin * MS_MIN); \n rangeJustSelected.value = true; \n emit('select-range', start, end, r); \n } \n rangeSelect.value = null; \n}; \n \ninterface ResizePreview { resourceId: string | number; topPx: number; heightPx: number; } \nconst resizingId = ref<string | number | null>(null); \nconst resizingPreview = ref<ResizePreview | null>(null); \nlet resizeStartState: { event: SchedulerEvent; resource: SchedulerResource; startMin: number; minEndMin: number } | null = null; \n \nconst onResizeStart = (ev: SchedulerEvent, r: SchedulerResource, _e: PointerEvent) => { \n if (!props.resizableEvents || !isEventInteractive(ev)) return; \n const startMin = Math.max(0, (ev.start.getTime() - dayStartMs.value) / MS_MIN); \n const minEndMin = startMin + props.slotMinutes; \n resizingId.value = ev.id; \n resizeStartState = { event: ev, resource: r, startMin, minEndMin }; \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const curEndMin = ev.end ? (ev.end.getTime() - dayStartMs.value) / MS_MIN : minEndMin; \n resizingPreview.value = { \n resourceId: r.id, \n topPx: startMin * pxPerMin, \n heightPx: Math.max(curEndMin - startMin, props.slotMinutes) * pxPerMin, \n }; \n window.addEventListener('pointermove', onResizeMove); \n window.addEventListener('pointerup', onResizeEnd); \n window.addEventListener('pointercancel', onResizeEnd); \n}; \nconst onResizeMove = (e: PointerEvent) => { \n if (!resizeStartState || !resizingPreview.value) return; \n const col = colRefs.get(resizeStartState.resource.id); \n if (!col) return; \n handleAutoScroll(e.clientY); \n const rect = col.getBoundingClientRect(); \n const offsetY = Math.max(0, Math.min(totalPixels.value, e.clientY - rect.top)); \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const rawMin = offsetY / pxPerMin; \n const snapped = Math.ceil(rawMin / props.slotMinutes) * props.slotMinutes; \n const endMin = Math.max(resizeStartState.minEndMin, Math.min(windowMinutes.value, snapped)); \n resizingPreview.value = { ...resizingPreview.value, heightPx: (endMin - resizeStartState.startMin) * pxPerMin }; \n}; \nconst onResizeEnd = () => { \n window.removeEventListener('pointermove', onResizeMove); \n window.removeEventListener('pointerup', onResizeEnd); \n window.removeEventListener('pointercancel', onResizeEnd); \n stopAutoScroll(); \n if (resizeStartState && resizingPreview.value) { \n const pxPerMin = props.slotHeight / props.slotMinutes; \n const endMin = resizeStartState.startMin + resizingPreview.value.heightPx / pxPerMin; \n const newStart = new Date(resizeStartState.event.start); \n const newEnd = new Date(currentDate.value); \n newEnd.setHours(props.hourStart, 0, 0, 0); \n newEnd.setMinutes(newEnd.getMinutes() + endMin); \n const hitsDisabled = !props.allowResizeOverDisabled && rangeHitsDisabled(resizeStartState.resource, resizeStartState.startMin, endMin); \n const overlaps = props.preventOverlap && rangeOverlapsEvent(resizeStartState.resource.id, newStart.getTime(), newEnd.getTime(), resizeStartState.event.id); \n if (!hitsDisabled && !overlaps) { \n const ev = resizeStartState.event; \n const oldEndMin = ev.end ? (ev.end.getTime() - dayStartMs.value) / MS_MIN : resizeStartState.minEndMin; \n const oldHeightPx = Math.max((oldEndMin - resizeStartState.startMin) * pxPerMin - 1, 18); \n emit('event-resize', ev, newStart, newEnd); \n stretchResize(ev.id, oldHeightPx); \n } \n resizeJustEnded.value = true; \n setTimeout(() => { resizeJustEnded.value = false; }, 0); \n } \n resizingId.value = null; \n resizingPreview.value = null; \n resizeStartState = null; \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(); shiftDay(-1); } \n else if (e.key === 'ArrowRight' || e.key === 'PageDown') { e.preventDefault(); shiftDay(1); } \n else if (e.key.toLowerCase() === 't') { e.preventDefault(); handleToday(); } \n}; \n \ndefineExpose({ scrollToCurrentTime }); \n \nconst resolveEventColor = (ev: SchedulerEvent, r: SchedulerResource): CalendarEvent['color'] => { \n if (ev.color) return ev.color; \n if (props.useResourceColor && r.color) return r.color; \n return props.color; \n}; \n \n \nconst eventInlineStyle = (ev: SchedulerEvent, r: SchedulerResource) => { \n if (ev.colorHex) { \n return { backgroundColor: hexToRgba(ev.colorHex, 0.12), borderLeftColor: ev.colorHex, color: ev.colorHex }; \n } \n if (props.useResourceColor && r.colorHex) { \n return { backgroundColor: hexToRgba(r.colorHex, 0.12), borderLeftColor: r.colorHex, color: r.colorHex }; \n } \n return undefined; \n}; \n \nconst resourceInitials = (title: string) => { \n const parts = title.trim().split(/\\s+/); \n if (!parts.length) return '?'; \n if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase(); \n return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase(); \n}; \n \nconst resourceAvatarColor = (r: SchedulerResource): 'default' | 'primary' | 'danger' | 'success' | 'warning' => { \n const c = r.color ?? 'default'; \n if (c === 'primary' || c === 'danger' || c === 'success' || c === 'warning') return c; \n return 'default'; \n}; \n \nconst { currentTimeSolidClass } = useCurrentTimeLine(() => props.currentTimeColor); \n \nconst { \n todayTextClass, \n rangeSelectClass, \n focusRingColorClass, \n containerRadiusClass, \n eventRadiusClass, \n showEventAccent, \n pillRadiusClass, \n dayNameCaseClass, \n resolvedColor, \n} = useCalendarTheme({ \n color: () => props.color, \n radius: () => props.radius, \n dayNameCase: () => props.dayNameCase, \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() ?? currentDate.value.getFullYear() - 10; \n const max = props.maxDate?.getFullYear() ?? currentDate.value.getFullYear() + 10; \n const list: number[] = []; \n for (let y = min; y <= max; y++) list.push(y); \n return list; \n}); \n \nconst dayOptions = computed(() => { \n const last = new Date(currentDate.value.getFullYear(), currentDate.value.getMonth() + 1, 0).getDate(); \n return Array.from({ length: last }, (_, i) => i + 1); \n}); \n \nconst selectedDay = computed({ \n get: () => currentDate.value.getDate(), \n set: (dd: number) => { \n const dir = dd > currentDate.value.getDate() ? 1 : -1; \n const d = new Date(currentDate.value); \n d.setDate(dd); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(dir)); \n }, \n}); \n \nconst selectedMonth = computed({ \n get: () => currentDate.value.getMonth(), \n set: (mm: number) => { \n const dir = mm > currentDate.value.getMonth() ? 1 : -1; \n const d = new Date(currentDate.value); \n d.setDate(1); \n d.setMonth(mm); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(dir)); \n }, \n}); \n \nconst selectedYear = computed({ \n get: () => currentDate.value.getFullYear(), \n set: (yy: number) => { \n const dir = yy > currentDate.value.getFullYear() ? 1 : -1; \n const d = new Date(currentDate.value); \n d.setFullYear(yy); \n currentDate.value = d; \n emit('update:modelValue', d); \n nextTick(() => animate(dir)); \n }, \n}); \n</script>\n"],"mappings":""}
@@ -7,6 +7,7 @@ const require_useCalendarTheme = require("../../../composables/useCalendarTheme.
7
7
  const require_useEventHover = require("../../../composables/useEventHover.cjs");
8
8
  const require_CalendarEventTooltip = require("./CalendarEventTooltip.cjs");
9
9
  const require_CalendarHeader = require("./CalendarHeader.cjs");
10
+ const require_cssLength = require("../../../utils/cssLength.cjs");
10
11
  const require_useCurrentTimeLine = require("../../../composables/useCurrentTimeLine.cjs");
11
12
  const require_useTimeGrid = require("../../../composables/useTimeGrid.cjs");
12
13
  let vue = require("vue");
@@ -85,6 +86,7 @@ var Scheduler_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
85
86
  type: Boolean,
86
87
  default: true
87
88
  },
89
+ maxHeight: {},
88
90
  minDate: {},
89
91
  maxDate: {},
90
92
  dayNameFormat: { default: "long" },
@@ -980,7 +982,7 @@ var Scheduler_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
980
982
  return "default";
981
983
  };
982
984
  const { currentTimeSolidClass } = require_useCurrentTimeLine.useCurrentTimeLine(() => props.currentTimeColor);
983
- const { todayTextClass, rangeSelectClass, focusRingColorClass, containerRadiusClass, eventRadiusClass, pillRadiusClass, dayNameCaseClass, resolvedColor } = require_useCalendarTheme.useCalendarTheme({
985
+ const { todayTextClass, rangeSelectClass, focusRingColorClass, containerRadiusClass, eventRadiusClass, showEventAccent, pillRadiusClass, dayNameCaseClass, resolvedColor } = require_useCalendarTheme.useCalendarTheme({
984
986
  color: () => props.color,
985
987
  radius: () => props.radius,
986
988
  dayNameCase: () => props.dayNameCase
@@ -1049,6 +1051,7 @@ var Scheduler_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
1049
1051
  (0, vue.unref)(containerRadiusClass),
1050
1052
  __props.bordered ? "border border-border" : ""
1051
1053
  ]),
1054
+ style: (0, vue.normalizeStyle)({ maxHeight: (0, vue.unref)(require_cssLength.toCssLength)(__props.maxHeight) }),
1052
1055
  onKeydown: handleKeydown
1053
1056
  }, [
1054
1057
  (0, vue.renderSlot)(_ctx.$slots, "header", {
@@ -1184,7 +1187,7 @@ var Scheduler_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
1184
1187
  "absolute z-10 truncate text-xs px-1.5 flex items-center cursor-pointer transition-all hover:opacity-80 select-none",
1185
1188
  (0, vue.unref)(eventRadiusClass),
1186
1189
  __props.draggableEvents ? "cursor-grab active:cursor-grabbing touch-none" : "",
1187
- seg.event.colorHex || __props.useResourceColor && r.colorHex ? "" : (0, vue.unref)(require_eventColors.eventColorClass)(resolveEventColor(seg.event, r)),
1190
+ seg.event.colorHex || __props.useResourceColor && r.colorHex ? "" : (0, vue.unref)(require_eventColors.eventColorClass)(resolveEventColor(seg.event, r), (0, vue.unref)(showEventAccent)),
1188
1191
  draggingId.value === seg.event.id ? "opacity-70 scale-95" : ""
1189
1192
  ])
1190
1193
  }, [(0, vue.renderSlot)(_ctx.$slots, "event", {
@@ -1263,7 +1266,7 @@ var Scheduler_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
1263
1266
  (0, vue.unref)(eventRadiusClass),
1264
1267
  isEventInteractive(seg.event) ? "cursor-pointer" : "cursor-default",
1265
1268
  __props.draggableEvents && isEventInteractive(seg.event) ? "cursor-grab active:cursor-grabbing touch-none" : "",
1266
- seg.event.colorHex || __props.useResourceColor && r.colorHex ? "border-l-2" : (0, vue.unref)(require_eventColors.eventColorClass)(resolveEventColor(seg.event, r)),
1269
+ seg.event.colorHex || __props.useResourceColor && r.colorHex ? (0, vue.unref)(showEventAccent) ? "border-l-2" : "" : (0, vue.unref)(require_eventColors.eventColorClass)(resolveEventColor(seg.event, r), (0, vue.unref)(showEventAccent)),
1267
1270
  draggingId.value === seg.event.id ? "opacity-70 scale-95" : ""
1268
1271
  ])
1269
1272
  }, [(0, vue.renderSlot)(_ctx.$slots, "event", {
@@ -1328,7 +1331,7 @@ var Scheduler_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
1328
1331
  })]),
1329
1332
  _: 3
1330
1333
  }, 8, ["state", "style"])
1331
- ], 34);
1334
+ ], 38);
1332
1335
  };
1333
1336
  }
1334
1337
  });