@bagelink/vue 1.2.39 → 1.2.41

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 (45) hide show
  1. package/dist/components/calendar/CalendarPopover.vue.d.ts +179 -0
  2. package/dist/components/calendar/CalendarPopover.vue.d.ts.map +1 -0
  3. package/dist/components/calendar/CalendarTypes.d.ts +15 -0
  4. package/dist/components/calendar/CalendarTypes.d.ts.map +1 -1
  5. package/dist/components/calendar/Index.vue.d.ts +20 -12
  6. package/dist/components/calendar/Index.vue.d.ts.map +1 -1
  7. package/dist/components/calendar/views/AgendaView.vue.d.ts +8 -0
  8. package/dist/components/calendar/views/AgendaView.vue.d.ts.map +1 -1
  9. package/dist/components/calendar/views/CalendarPopover.vue.d.ts +175 -0
  10. package/dist/components/calendar/views/CalendarPopover.vue.d.ts.map +1 -0
  11. package/dist/components/calendar/views/DayView.vue.d.ts +10 -32
  12. package/dist/components/calendar/views/DayView.vue.d.ts.map +1 -1
  13. package/dist/components/calendar/views/MonthView.vue.d.ts +10 -170
  14. package/dist/components/calendar/views/MonthView.vue.d.ts.map +1 -1
  15. package/dist/components/calendar/views/WeekView.vue.d.ts +12 -168
  16. package/dist/components/calendar/views/WeekView.vue.d.ts.map +1 -1
  17. package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
  18. package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
  19. package/dist/composables/useDevice.d.ts +3 -0
  20. package/dist/composables/useDevice.d.ts.map +1 -1
  21. package/dist/index.cjs +426 -280
  22. package/dist/index.mjs +426 -280
  23. package/dist/style.css +210 -167
  24. package/dist/types/BagelForm.d.ts +14 -11
  25. package/dist/types/BagelForm.d.ts.map +1 -1
  26. package/dist/utils/BagelFormUtils.d.ts +10 -10
  27. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  28. package/dist/utils/calendar/dateUtils.d.ts +7 -7
  29. package/package.json +1 -1
  30. package/src/components/calendar/CalendarPopover.vue +102 -0
  31. package/src/components/calendar/CalendarTypes.ts +14 -0
  32. package/src/components/calendar/Index.vue +75 -34
  33. package/src/components/calendar/views/AgendaView.vue +26 -2
  34. package/src/components/calendar/views/DayView.vue +83 -104
  35. package/src/components/calendar/views/MonthView.vue +21 -49
  36. package/src/components/calendar/views/WeekView.vue +227 -134
  37. package/src/components/form/inputs/DateInput.vue +3 -1
  38. package/src/components/form/inputs/DatePicker.vue +7 -0
  39. package/src/composables/useDevice.ts +13 -2
  40. package/src/styles/layout.css +14 -0
  41. package/src/styles/mobilLayout.css +12 -0
  42. package/src/types/BagelForm.ts +30 -53
  43. package/src/utils/BagelFormUtils.ts +11 -10
  44. package/src/utils/calendar/dateUtils.ts +22 -22
  45. package/src/components/calendar/utils.ts +0 -70
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { defineComponent, reactive, provide, createElementBlock, openBlock, renderSlot, ref, computed, inject, watch, normalizeClass, createElementVNode, createVNode, unref, createCommentVNode, toDisplayString, Transition, withCtx, Fragment, renderList, createBlock, isRef, useSlots, resolveDirective, withDirectives, resolveDynamicComponent, mergeProps, withKeys, withModifiers, createTextVNode, normalizeStyle, onMounted, onUnmounted, nextTick, resolveComponent, isVNode, h as h$2, getCurrentScope, onScopeDispose, toValue, getCurrentInstance, shallowRef, mergeModels, useCssVars, useModel, vModelCheckbox, createApp, pushScopeId, popScopeId, withScopeId, normalizeProps, guardReactiveProps, toRef, createSlots, vModelText, Comment, Text, vModelRadio, TransitionGroup, vModelDynamic, onBeforeUnmount } from "vue";
5
5
  import { RouterLink } from "vue-router";
6
- const _sfc_main$1d = /* @__PURE__ */ defineComponent({
6
+ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
7
7
  __name: "Accordion",
8
8
  setup(__props) {
9
9
  const state2 = reactive({
@@ -20,7 +20,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
20
20
  const _hoisted_1$11 = ["aria-expanded", "aria-controls"];
21
21
  const _hoisted_2$L = { class: "accordion-label" };
22
22
  const _hoisted_3$E = ["id", "aria-hidden"];
23
- const _sfc_main$1c = /* @__PURE__ */ defineComponent({
23
+ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
24
24
  __name: "AccordionItem",
25
25
  props: {
26
26
  label: {},
@@ -119,9 +119,9 @@ const _export_sfc = (sfc, props2) => {
119
119
  }
120
120
  return target;
121
121
  };
122
- const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__scopeId", "data-v-3334f637"]]);
122
+ const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__scopeId", "data-v-3334f637"]]);
123
123
  const _hoisted_1$10 = { class: "relative" };
124
- const _sfc_main$1b = /* @__PURE__ */ defineComponent({
124
+ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
125
125
  __name: "AddressSearch",
126
126
  emits: ["addressSelected"],
127
127
  setup(__props, { emit: __emit }) {
@@ -183,7 +183,7 @@ const _hoisted_1$$ = {
183
183
  key: 1,
184
184
  class: "bgl_btn-flex"
185
185
  };
186
- const _sfc_main$1a = /* @__PURE__ */ defineComponent({
186
+ const _sfc_main$1b = /* @__PURE__ */ defineComponent({
187
187
  __name: "Btn",
188
188
  props: {
189
189
  disabled: { type: Boolean, default: false },
@@ -276,10 +276,10 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
276
276
  };
277
277
  }
278
278
  });
279
- const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__scopeId", "data-v-99c4aa53"]]);
279
+ const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__scopeId", "data-v-99c4aa53"]]);
280
280
  const _hoisted_1$_ = ["dismissable"];
281
281
  const _hoisted_2$K = { class: "m-0" };
282
- const _sfc_main$19 = /* @__PURE__ */ defineComponent({
282
+ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
283
283
  __name: "Alert",
284
284
  props: {
285
285
  message: {},
@@ -319,9 +319,9 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
319
319
  };
320
320
  }
321
321
  });
322
- const Alert = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__scopeId", "data-v-064bdd20"]]);
322
+ const Alert = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__scopeId", "data-v-064bdd20"]]);
323
323
  const _hoisted_1$Z = ["src", "alt"];
324
- const _sfc_main$18 = /* @__PURE__ */ defineComponent({
324
+ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
325
325
  __name: "Avatar",
326
326
  props: {
327
327
  fallback: {},
@@ -347,8 +347,8 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
347
347
  };
348
348
  }
349
349
  });
350
- const Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__scopeId", "data-v-46ad8c25"]]);
351
- const _sfc_main$17 = /* @__PURE__ */ defineComponent({
350
+ const Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__scopeId", "data-v-46ad8c25"]]);
351
+ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
352
352
  __name: "Badge",
353
353
  props: {
354
354
  color: {},
@@ -377,11 +377,11 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
377
377
  };
378
378
  }
379
379
  });
380
- const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__scopeId", "data-v-689f051f"]]);
380
+ const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__scopeId", "data-v-689f051f"]]);
381
381
  const _hoisted_1$Y = ["src"];
382
382
  const _hoisted_2$J = ["autoplay", "muted", "loop", "controls", "playsinline"];
383
383
  const _hoisted_3$D = ["src", "type"];
384
- const _sfc_main$16 = /* @__PURE__ */ defineComponent({
384
+ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
385
385
  __name: "BglVideo",
386
386
  props: {
387
387
  src: {},
@@ -478,7 +478,73 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
478
478
  };
479
479
  }
480
480
  });
481
- const BglVideo = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__scopeId", "data-v-006552f6"]]);
481
+ const BglVideo = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__scopeId", "data-v-006552f6"]]);
482
+ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
483
+ __name: "CalendarPopover",
484
+ props: {
485
+ event: {},
486
+ targetElement: {},
487
+ position: {},
488
+ show: { type: Boolean },
489
+ hasEventContentSlot: { type: Boolean }
490
+ },
491
+ emits: ["close", "eventClick"],
492
+ setup(__props, { emit: __emit }) {
493
+ const props2 = __props;
494
+ const emit2 = __emit;
495
+ const { scrollY, scrollX, innerHeight, innerWidth } = useDevice();
496
+ const popoverRef = ref();
497
+ const popoverPosition = computed(() => {
498
+ const popoverWidth = 400;
499
+ const margin = 10;
500
+ if (props2.position) {
501
+ let { top: top2, left: left2 } = props2.position;
502
+ top2 -= 80;
503
+ top2 = Math.max(scrollY.value + margin, Math.min(top2, innerHeight.value + scrollY.value - 150 - 10));
504
+ left2 = Math.max(scrollX.value + margin, Math.min(left2, innerWidth.value + scrollX.value - popoverWidth - margin));
505
+ return { top: top2, left: left2, width: popoverWidth, height: 150 };
506
+ } else if (props2.targetElement && props2.show) {
507
+ const target = props2.targetElement;
508
+ const rect = target.getBoundingClientRect();
509
+ let top2 = rect.top + scrollY.value + rect.height / 2 - 150 / 2;
510
+ let left2 = rect.left + scrollX.value + rect.width + margin;
511
+ top2 = Math.max(scrollY.value + margin, Math.min(top2, innerHeight.value + scrollY.value - 150 - 10));
512
+ if (left2 + popoverWidth > innerWidth.value + scrollX.value) {
513
+ left2 = rect.left + scrollX.value - popoverWidth + rect.width - margin;
514
+ }
515
+ if (left2 < scrollX.value) left2 = rect.right + scrollX.value + margin;
516
+ return { top: top2, left: left2, width: popoverWidth, height: 150 };
517
+ }
518
+ return { top: 0, left: 0, width: popoverWidth, height: 150 };
519
+ });
520
+ function closePopover() {
521
+ emit2("close");
522
+ }
523
+ return (_ctx, _cache) => {
524
+ const _directive_click_outside = resolveDirective("click-outside");
525
+ return _ctx.show && _ctx.event ? withDirectives((openBlock(), createBlock(unref(_sfc_main$10), {
526
+ key: 0,
527
+ ref_key: "popoverRef",
528
+ ref: popoverRef,
529
+ thin: "",
530
+ class: "custom-popover",
531
+ style: normalizeStyle({
532
+ top: `${popoverPosition.value.top}px`,
533
+ left: `${popoverPosition.value.left}px`,
534
+ maxWidth: `${popoverPosition.value.width}px`
535
+ })
536
+ }, {
537
+ default: withCtx(() => [
538
+ renderSlot(_ctx.$slots, "eventContent", { event: _ctx.event }, void 0, true)
539
+ ]),
540
+ _: 3
541
+ }, 8, ["style"])), [
542
+ [_directive_click_outside, closePopover]
543
+ ]) : createCommentVNode("", true);
544
+ };
545
+ }
546
+ });
547
+ const CalendarPopover = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__scopeId", "data-v-6f51f6b3"]]);
482
548
  const _hoisted_1$X = { class: "agenda-view" };
483
549
  const _hoisted_2$I = ["data-date", "onClick"];
484
550
  const _hoisted_3$C = { class: "event-content" };
@@ -491,10 +557,11 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
491
557
  events: {},
492
558
  startDate: {}
493
559
  },
494
- emits: ["eventClick", "dateChange"],
560
+ emits: ["eventClick", "dateChange", "openPopover"],
495
561
  setup(__props, { emit: __emit }) {
496
562
  const props2 = __props;
497
563
  const emit2 = __emit;
564
+ const slots = useSlots();
498
565
  const containerRef = ref(null);
499
566
  const currentDate = ref(null);
500
567
  const processedEvents = computed(() => {
@@ -555,6 +622,22 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
555
622
  }
556
623
  }
557
624
  }
625
+ function handleEventSelection(event, domEvent) {
626
+ if (!slots.eventContent) {
627
+ emit2("eventClick", event);
628
+ return;
629
+ }
630
+ if (domEvent) {
631
+ const rect = domEvent.currentTarget.getBoundingClientRect();
632
+ const position = {
633
+ top: rect.top + window.scrollY + rect.height / 2,
634
+ left: rect.left + window.scrollX + rect.width + 10
635
+ };
636
+ emit2("openPopover", event, position);
637
+ } else {
638
+ emit2("openPopover", event);
639
+ }
640
+ }
558
641
  onMounted(() => {
559
642
  if (containerRef.value) {
560
643
  containerRef.value.addEventListener("scroll", handleScroll);
@@ -585,7 +668,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
585
668
  backgroundColor: event.color || "var(--bgl-primary)"
586
669
  }),
587
670
  "data-date": event.start_time,
588
- onClick: withModifiers(($event) => emit2("eventClick", event), ["stop"])
671
+ onClick: withModifiers(($event) => handleEventSelection(event, $event), ["stop"])
589
672
  }, [
590
673
  createElementVNode("div", _hoisted_3$C, [
591
674
  createElementVNode("div", _hoisted_4$p, toDisplayString(unref(formatDate)(event.start_time, { fmt: "HH:mm" })), 1),
@@ -603,34 +686,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
603
686
  };
604
687
  }
605
688
  });
606
- const AgendaView = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-520aee85"]]);
607
- function calculatePopoverPosition(target, popoverWidth = 300, popoverHeight = 150) {
608
- const rect = target.getBoundingClientRect();
609
- const { scrollY, scrollX, innerHeight, innerWidth } = window;
610
- let top2 = rect.top + scrollY + rect.height / 2 - popoverHeight / 2;
611
- let left2 = rect.left + scrollX + rect.width + 10;
612
- top2 = Math.max(scrollY + 10, Math.min(top2, innerHeight + scrollY - popoverHeight - 10));
613
- if (left2 + popoverWidth > innerWidth + scrollX) {
614
- left2 = rect.left + scrollX - popoverWidth - 10;
615
- }
616
- if (left2 < scrollX) {
617
- left2 = rect.right + scrollX + 10;
618
- }
619
- return { top: top2, left: left2, width: popoverWidth, height: popoverHeight };
620
- }
621
- function openPopover(event, e, state2, hasEventContentSlot, emitEventClick) {
622
- if (!hasEventContentSlot) {
623
- emitEventClick(event);
624
- return;
625
- }
626
- state2.activeEvent.value = event;
627
- state2.popoverPosition.value = calculatePopoverPosition(e.currentTarget);
628
- state2.showPopover.value = true;
629
- }
630
- function closePopover(state2) {
631
- state2.showPopover.value = false;
632
- state2.activeEvent.value = null;
633
- }
689
+ const AgendaView = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__scopeId", "data-v-1e2b483b"]]);
634
690
  const _hoisted_1$W = { class: "w-100p overflow-hidden m_overflow h-100p grid" };
635
691
  const _hoisted_2$H = { class: "border-bottom me-1 txt-center p-05 dayGrid" };
636
692
  const _hoisted_3$B = { class: "overflow h-100p pe-05" };
@@ -638,8 +694,9 @@ const _hoisted_4$o = { class: "time-column" };
638
694
  const _hoisted_5$n = { class: "events-column" };
639
695
  const _hoisted_6$k = ["onClick"];
640
696
  const _hoisted_7$g = { class: "event-content" };
641
- const _hoisted_8$8 = { class: "white-space ellipsis-1" };
697
+ const _hoisted_8$9 = { class: "white-space ellipsis-1" };
642
698
  const _hoisted_9$7 = { class: "event-time opacity-8" };
699
+ const _hoisted_10$6 = { class: "color-primary txt-12 p-025" };
643
700
  const slotHeight$1 = 60;
644
701
  const slotDuration$1 = 60;
645
702
  const _sfc_main$14 = /* @__PURE__ */ defineComponent({
@@ -648,7 +705,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
648
705
  events: {},
649
706
  startDate: {}
650
707
  },
651
- emits: ["eventClick", "eventCreate"],
708
+ emits: ["eventClick", "eventCreate", "openPopover"],
652
709
  setup(__props, { emit: __emit }) {
653
710
  const props2 = __props;
654
711
  const emit2 = __emit;
@@ -664,15 +721,6 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
664
721
  const currentTimeTop = ref(0);
665
722
  const isToday = ref(false);
666
723
  const currentTimeInterval = ref(null);
667
- const activeEvent = ref(null);
668
- const showPopover = ref(false);
669
- const popoverPosition = ref({ top: 0, left: 0, width: 0, height: 0 });
670
- const popoverRef = ref(null);
671
- const popoverState = {
672
- activeEvent,
673
- showPopover,
674
- popoverPosition
675
- };
676
724
  const timeSlots = computed(() => {
677
725
  const slots2 = [];
678
726
  for (let hour = timeRange.start; hour < timeRange.end; hour++) {
@@ -744,25 +792,32 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
744
792
  var _a;
745
793
  const rect = (_a = document.querySelector(".time-slots")) == null ? void 0 : _a.getBoundingClientRect();
746
794
  if (!rect) return /* @__PURE__ */ new Date();
747
- const minutes = Math.floor((y2 - rect.top) / slotHeight$1) * slotDuration$1;
795
+ const relativeY = y2 - rect.top;
796
+ const minutesPerSlot = slotDuration$1;
797
+ const slotsFromTop = relativeY / slotHeight$1;
798
+ const minutes = Math.floor(slotsFromTop * minutesPerSlot);
748
799
  const date2 = new Date(props2.startDate);
749
800
  date2.setHours(Math.floor(minutes / 60));
750
801
  date2.setMinutes(minutes % 60);
802
+ date2.setSeconds(0);
803
+ date2.setMilliseconds(0);
751
804
  return date2;
752
805
  }
753
- function openPopover$1(event, e) {
754
- openPopover(
755
- event,
756
- e,
757
- popoverState,
758
- !!slots.eventContent,
759
- (evt) => {
760
- emit2("eventClick", evt);
761
- }
762
- );
763
- }
764
- function closePopover$1() {
765
- closePopover(popoverState);
806
+ function handleEventSelection(event, domEvent) {
807
+ if (!slots.eventContent) {
808
+ emit2("eventClick", event);
809
+ return;
810
+ }
811
+ if (domEvent) {
812
+ const rect = domEvent.currentTarget.getBoundingClientRect();
813
+ const position = {
814
+ top: rect.top + window.scrollY + rect.height / 2,
815
+ left: rect.left + window.scrollX + rect.width + 10
816
+ };
817
+ emit2("openPopover", event, position);
818
+ } else {
819
+ emit2("openPopover", event);
820
+ }
766
821
  }
767
822
  onMounted(() => {
768
823
  document.addEventListener("mousedown", handleMouseDown);
@@ -778,7 +833,6 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
778
833
  }
779
834
  });
780
835
  return (_ctx, _cache) => {
781
- const _directive_click_outside = resolveDirective("click-outside");
782
836
  return openBlock(), createElementBlock("div", _hoisted_1$W, [
783
837
  createElementVNode("div", _hoisted_2$H, [
784
838
  _cache[0] || (_cache[0] = createElementVNode("div", null, null, -1)),
@@ -816,46 +870,35 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
816
870
  height: `${event.height}px`,
817
871
  backgroundColor: event.color || "var(--bgl-primary)"
818
872
  }),
819
- onClick: withModifiers(($event) => unref(slots).eventContent ? openPopover$1(event, $event) : emit2("eventClick", event), ["stop"])
873
+ onClick: withModifiers(($event) => handleEventSelection(event, $event), ["stop"])
820
874
  }, [
821
875
  createElementVNode("div", _hoisted_7$g, [
822
- createElementVNode("div", _hoisted_8$8, toDisplayString(event.title), 1),
823
- createElementVNode("div", _hoisted_9$7, toDisplayString(unref(formatDate)(new Date(event.start_time))), 1)
876
+ createElementVNode("div", _hoisted_8$9, toDisplayString(event.title), 1),
877
+ createElementVNode("div", _hoisted_9$7, toDisplayString(unref(formatDate)(new Date(event.start_time), { fmt: "HH:mm" })) + " - " + toDisplayString(unref(formatDate)(new Date(event.end_time), { fmt: "HH:mm" })), 1)
824
878
  ])
825
879
  ], 12, _hoisted_6$k);
826
880
  }), 128))
827
881
  ]),
828
882
  dragState.value.isDragging && dragState.value.start && dragState.value.end ? (openBlock(), createElementBlock("div", {
829
883
  key: 0,
830
- class: "drag-preview absolute bg-primary pointer-events-none",
884
+ class: "drag-preview absolute bg-primary-tint pointer-events-none z-1",
831
885
  style: normalizeStyle({
832
886
  top: `${Math.min(dragState.value.start.y, dragState.value.end.y)}px`,
833
- height: `${Math.abs(dragState.value.end.y - dragState.value.start.y)}px`
887
+ height: `${Math.abs(dragState.value.end.y - dragState.value.start.y)}px`,
888
+ left: "10px",
889
+ right: "10px"
834
890
  })
835
- }, null, 4)) : createCommentVNode("", true)
891
+ }, [
892
+ createElementVNode("div", _hoisted_10$6, toDisplayString(dragState.value.startTime ? unref(formatDate)(dragState.value.startTime, { fmt: "HH:mm" }) : "") + " - " + toDisplayString(dragState.value.endTime ? unref(formatDate)(dragState.value.endTime, { fmt: "HH:mm" }) : ""), 1)
893
+ ], 4)) : createCommentVNode("", true)
836
894
  ], 32)
837
895
  ]),
838
- showPopover.value && activeEvent.value ? withDirectives((openBlock(), createElementBlock("div", {
839
- key: 0,
840
- ref_key: "popoverRef",
841
- ref: popoverRef,
842
- class: "custom-popover",
843
- style: normalizeStyle({
844
- top: `${popoverPosition.value.top}px`,
845
- left: `${popoverPosition.value.left}px`,
846
- maxWidth: `${popoverPosition.value.width}px`
847
- })
848
- }, [
849
- renderSlot(_ctx.$slots, "eventContent", { event: activeEvent.value }, void 0, true)
850
- ], 4)), [
851
- [_directive_click_outside, closePopover$1]
852
- ]) : createCommentVNode("", true),
853
896
  _cache[2] || (_cache[2] = createElementVNode("div", { class: "border-bottom me-1" }, null, -1))
854
897
  ]);
855
898
  };
856
899
  }
857
900
  });
858
- const DayView = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__scopeId", "data-v-bc647d79"]]);
901
+ const DayView = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__scopeId", "data-v-8b1a770f"]]);
859
902
  const _hoisted_1$V = { class: "month-view" };
860
903
  const _hoisted_2$G = { class: "month-header" };
861
904
  const _hoisted_3$A = { class: "month-grid" };
@@ -866,7 +909,7 @@ const _hoisted_6$j = {
866
909
  class: "event-dot"
867
910
  };
868
911
  const _hoisted_7$f = ["onClick"];
869
- const _hoisted_8$7 = { class: "event-title" };
912
+ const _hoisted_8$8 = { class: "event-title" };
870
913
  const _hoisted_9$6 = { class: "event-time" };
871
914
  const _sfc_main$13 = /* @__PURE__ */ defineComponent({
872
915
  __name: "MonthView",
@@ -874,21 +917,12 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
874
917
  events: {},
875
918
  startDate: {}
876
919
  },
877
- emits: ["eventClick"],
920
+ emits: ["eventClick", "openPopover"],
878
921
  setup(__props, { emit: __emit }) {
879
922
  const props2 = __props;
880
923
  const emit2 = __emit;
881
924
  const slots = useSlots();
882
925
  const isMobile = computed(() => window.innerWidth < 768);
883
- const activeEvent = ref(null);
884
- const showPopover = ref(false);
885
- const popoverPosition = ref({ top: 0, left: 0, width: 0, height: 0 });
886
- const popoverRef = ref(null);
887
- const popoverState = {
888
- activeEvent,
889
- showPopover,
890
- popoverPosition
891
- };
892
926
  const weekDays = computed(() => ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]);
893
927
  const currentMonth = computed(() => {
894
928
  const year = props2.startDate.getFullYear();
@@ -934,22 +968,23 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
934
968
  }
935
969
  return days;
936
970
  });
937
- function openPopover$1(event, e) {
938
- openPopover(
939
- event,
940
- e,
941
- popoverState,
942
- !!slots.eventContent,
943
- (evt) => {
944
- emit2("eventClick", evt);
945
- }
946
- );
947
- }
948
- function closePopover$1() {
949
- closePopover(popoverState);
971
+ function handleEventSelection(event, domEvent) {
972
+ if (!slots.eventContent) {
973
+ emit2("eventClick", event);
974
+ return;
975
+ }
976
+ if (domEvent) {
977
+ const rect = domEvent.currentTarget.getBoundingClientRect();
978
+ const position = {
979
+ top: rect.top + window.scrollY + rect.height / 2,
980
+ left: rect.left + window.scrollX + rect.width + 10
981
+ };
982
+ emit2("openPopover", event, position);
983
+ } else {
984
+ emit2("openPopover", event);
985
+ }
950
986
  }
951
987
  return (_ctx, _cache) => {
952
- const _directive_click_outside = resolveDirective("click-outside");
953
988
  return openBlock(), createElementBlock("div", _hoisted_1$V, [
954
989
  createElementVNode("div", _hoisted_2$G, [
955
990
  (openBlock(true), createElementBlock(Fragment, null, renderList(weekDays.value, (day) => {
@@ -978,47 +1013,29 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
978
1013
  key: event.id,
979
1014
  class: "event-item",
980
1015
  style: normalizeStyle({ backgroundColor: event.color || "var(--bgl-primary)" }),
981
- onClick: withModifiers(($event) => unref(slots).eventContent ? openPopover$1(event, $event) : emit2("eventClick", event), ["stop"])
1016
+ onClick: withModifiers(($event) => handleEventSelection(event, $event), ["stop"])
982
1017
  }, [
983
- createElementVNode("div", _hoisted_8$7, toDisplayString(event.title), 1),
1018
+ createElementVNode("div", _hoisted_8$8, toDisplayString(event.title), 1),
984
1019
  createElementVNode("div", _hoisted_9$6, toDisplayString(unref(fmtDate)(event.start_time, { fmt: "HH:mm" })), 1)
985
1020
  ], 12, _hoisted_7$f);
986
1021
  }), 128))
987
1022
  ])
988
1023
  ], 2);
989
1024
  }), 128))
990
- ]),
991
- showPopover.value && activeEvent.value ? withDirectives((openBlock(), createBlock(unref(_sfc_main$10), {
992
- key: 0,
993
- ref_key: "popoverRef",
994
- ref: popoverRef,
995
- thin: "",
996
- class: "custom-popover",
997
- style: normalizeStyle({
998
- top: `${popoverPosition.value.top}px`,
999
- left: `${popoverPosition.value.left}px`,
1000
- maxWidth: `${popoverPosition.value.width}px`
1001
- })
1002
- }, {
1003
- default: withCtx(() => [
1004
- renderSlot(_ctx.$slots, "eventContent", { event: activeEvent.value }, void 0, true)
1005
- ]),
1006
- _: 3
1007
- }, 8, ["style"])), [
1008
- [_directive_click_outside, closePopover$1]
1009
- ]) : createCommentVNode("", true)
1025
+ ])
1010
1026
  ]);
1011
1027
  };
1012
1028
  }
1013
1029
  });
1014
- const MonthView = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__scopeId", "data-v-eeb8abde"]]);
1030
+ const MonthView = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__scopeId", "data-v-0b1117c4"]]);
1015
1031
  const _hoisted_1$U = { class: "w-100p overflow-hidden m_overflow h-100p grid" };
1016
- const _hoisted_2$F = { class: "weekGrid border-bottom me-1" };
1017
- const _hoisted_3$z = { class: "overflow h-100p pe-05" };
1032
+ const _hoisted_2$F = { class: "overflow h-100p pe-05" };
1033
+ const _hoisted_3$z = ["onMousedown"];
1018
1034
  const _hoisted_4$m = ["onClick"];
1019
1035
  const _hoisted_5$l = { class: "overflow-hidden color-white p-025 txt12 h-100p" };
1020
1036
  const _hoisted_6$i = { class: "white-space ellipsis-1" };
1021
1037
  const _hoisted_7$e = { class: "txt10 opacity-8" };
1038
+ const _hoisted_8$7 = { class: "color-primary txt-12 p-025" };
1022
1039
  const slotHeight = 60;
1023
1040
  const slotDuration = 60;
1024
1041
  const _sfc_main$12 = /* @__PURE__ */ defineComponent({
@@ -1028,7 +1045,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1028
1045
  startDate: { default: () => /* @__PURE__ */ new Date() },
1029
1046
  weekStart: { default: "Sunday" }
1030
1047
  },
1031
- emits: ["eventClick", "eventCreate"],
1048
+ emits: ["eventClick", "eventCreate", "openPopover"],
1032
1049
  setup(__props, { emit: __emit }) {
1033
1050
  const props2 = __props;
1034
1051
  const emit2 = __emit;
@@ -1036,29 +1053,29 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1036
1053
  const timeRange = { start: 0, end: 24 };
1037
1054
  const dragState = ref({
1038
1055
  isDragging: false,
1039
- start: null,
1040
- end: null,
1041
- startTime: null,
1042
- endTime: null
1056
+ startDay: -1,
1057
+ // Index of the starting day
1058
+ endDay: -1,
1059
+ // Index of the ending day
1060
+ start: void 0,
1061
+ end: void 0,
1062
+ startTime: void 0,
1063
+ endTime: void 0
1043
1064
  });
1044
- const activeEvent = ref(null);
1045
- const showPopover = ref(false);
1046
- const popoverPosition = ref({ top: 0, left: 0, width: 0, height: 0 });
1047
- const popoverRef = ref(null);
1048
- const popoverState = {
1049
- activeEvent,
1050
- showPopover,
1051
- popoverPosition
1052
- };
1053
1065
  const currentTimeTop = ref(0);
1054
1066
  const isToday = ref(false);
1055
- const currentTimeInterval = ref(null);
1067
+ const currentTimeInterval = ref();
1068
+ const timeSlotsContainer = ref();
1069
+ const calendarGrid = ref();
1070
+ const dayColumns = ref([]);
1071
+ const dayColumnsContainer = ref();
1056
1072
  const weekDays = computed(() => {
1057
1073
  const days = [];
1058
1074
  const start = new Date(props2.startDate);
1059
1075
  const weekStartOffset = props2.weekStart === "Sunday" ? 0 : 1;
1060
1076
  const dayOfWeek = start.getDay();
1061
1077
  start.setDate(start.getDate() - dayOfWeek + weekStartOffset);
1078
+ start.setHours(0, 0, 0, 0);
1062
1079
  for (let i2 = 0; i2 < 7; i2++) {
1063
1080
  const date2 = new Date(start);
1064
1081
  date2.setDate(start.getDate() + i2);
@@ -1091,8 +1108,8 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1091
1108
  if (dayIndex === -1) return;
1092
1109
  const startMinutes = startDate.getHours() * 60 + startDate.getMinutes();
1093
1110
  const endMinutes = endDate.getHours() * 60 + endDate.getMinutes();
1094
- const top2 = startMinutes / slotDuration * (slotHeight / 2);
1095
- const height = Math.max((endMinutes - startMinutes) / slotDuration * (slotHeight / 2), 30);
1111
+ const top2 = startMinutes / slotDuration * slotHeight;
1112
+ const height = Math.max((endMinutes - startMinutes) / slotDuration * slotHeight, 30);
1096
1113
  const weekEvent = {
1097
1114
  ...event,
1098
1115
  top: top2,
@@ -1122,45 +1139,111 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1122
1139
  });
1123
1140
  return events;
1124
1141
  });
1125
- function handleMouseDown(e) {
1126
- const target = e.target;
1127
- if (!target.closest(".time-slot")) return;
1142
+ function handleMouseDown(e, day) {
1143
+ if (!calendarGrid.value || !dayColumnsContainer.value) return;
1144
+ let clickedDayIndex = -1;
1145
+ for (let i2 = 0; i2 < dayColumns.value.length; i2++) {
1146
+ const columnEl = dayColumns.value[i2];
1147
+ if (!columnEl) continue;
1148
+ const rect = columnEl.getBoundingClientRect();
1149
+ if (e.clientX >= rect.left && e.clientX <= rect.right) {
1150
+ clickedDayIndex = i2;
1151
+ break;
1152
+ }
1153
+ }
1154
+ if (clickedDayIndex === -1) return;
1155
+ const dayColumnRect = dayColumns.value[clickedDayIndex].getBoundingClientRect();
1156
+ const dayColumnsRect = dayColumnsContainer.value.getBoundingClientRect();
1128
1157
  dragState.value.isDragging = true;
1129
- dragState.value.start = { x: e.clientX, y: e.clientY };
1130
- dragState.value.startTime = getTimeFromPosition(e.clientX, e.clientY);
1158
+ dragState.value.startDay = clickedDayIndex;
1159
+ dragState.value.endDay = clickedDayIndex;
1160
+ dragState.value.start = {
1161
+ x: dayColumnRect.left - dayColumnsRect.left,
1162
+ // Left edge of the day column
1163
+ y: e.clientY - dayColumnsRect.top
1164
+ };
1165
+ dragState.value.end = {
1166
+ x: dayColumnRect.right - dayColumnsRect.left,
1167
+ // Right edge of the day column
1168
+ y: e.clientY - dayColumnsRect.top
1169
+ };
1170
+ const cleanDay = new Date(day);
1171
+ cleanDay.setHours(0, 0, 0, 0);
1172
+ const startTime = getTimeFromPosition(e.clientY, cleanDay);
1173
+ dragState.value.startTime = startTime;
1131
1174
  document.addEventListener("mousemove", handleMouseMove);
1132
1175
  document.addEventListener("mouseup", handleMouseUp);
1133
1176
  }
1134
1177
  function handleMouseMove(e) {
1135
- if (!dragState.value.isDragging) return;
1136
- dragState.value.end = { x: e.clientX, y: e.clientY };
1137
- dragState.value.endTime = getTimeFromPosition(e.clientX, e.clientY);
1178
+ if (!dragState.value.isDragging || !dragState.value.start || !dayColumns.value.length || !calendarGrid.value || !dayColumnsContainer.value) return;
1179
+ let targetDayIndex = -1;
1180
+ for (let i2 = 0; i2 < dayColumns.value.length; i2++) {
1181
+ const columnEl = dayColumns.value[i2];
1182
+ if (!columnEl) continue;
1183
+ const rect = columnEl.getBoundingClientRect();
1184
+ if (e.clientX >= rect.left && e.clientX <= rect.right) {
1185
+ targetDayIndex = i2;
1186
+ break;
1187
+ }
1188
+ }
1189
+ if (targetDayIndex === -1) return;
1190
+ const dayColumnsRect = dayColumnsContainer.value.getBoundingClientRect();
1191
+ const minDayIndex = Math.min(dragState.value.startDay, targetDayIndex);
1192
+ const maxDayIndex = Math.max(dragState.value.startDay, targetDayIndex);
1193
+ const leftDayEl = dayColumns.value[minDayIndex];
1194
+ if (!leftDayEl) return;
1195
+ const leftDayRect = leftDayEl.getBoundingClientRect();
1196
+ const leftEdge = leftDayRect.left - dayColumnsRect.left;
1197
+ const rightDayEl = dayColumns.value[maxDayIndex];
1198
+ if (!rightDayEl) return;
1199
+ const rightDayRect = rightDayEl.getBoundingClientRect();
1200
+ const rightEdge = rightDayRect.right - dayColumnsRect.left;
1201
+ dragState.value.endDay = targetDayIndex;
1202
+ dragState.value.end = {
1203
+ x: rightEdge,
1204
+ y: e.clientY - dayColumnsRect.top
1205
+ };
1206
+ dragState.value.start.x = leftEdge;
1207
+ if (targetDayIndex >= 0 && targetDayIndex < weekDays.value.length) {
1208
+ const targetDay = new Date(weekDays.value[targetDayIndex]);
1209
+ targetDay.setHours(0, 0, 0, 0);
1210
+ const endTime = getTimeFromPosition(e.clientY, targetDay);
1211
+ dragState.value.endTime = endTime;
1212
+ }
1138
1213
  }
1139
1214
  function handleMouseUp() {
1140
1215
  if (!dragState.value.isDragging || !dragState.value.startTime || !dragState.value.endTime) return;
1141
1216
  let start = new Date(dragState.value.startTime);
1142
1217
  let end = new Date(dragState.value.endTime);
1143
- if (end < start) [start, end] = [end, start];
1218
+ if (dragState.value.startDay > dragState.value.endDay || dragState.value.startDay === dragState.value.endDay && end < start) {
1219
+ [start, end] = [end, start];
1220
+ }
1144
1221
  emit2("eventCreate", { start_time: start, end_time: end });
1145
1222
  dragState.value = {
1146
1223
  isDragging: false,
1147
- start: null,
1148
- end: null,
1149
- startTime: null,
1150
- endTime: null
1224
+ startDay: -1,
1225
+ endDay: -1,
1226
+ start: void 0,
1227
+ end: void 0,
1228
+ startTime: void 0,
1229
+ endTime: void 0
1151
1230
  };
1152
1231
  document.removeEventListener("mousemove", handleMouseMove);
1153
1232
  document.removeEventListener("mouseup", handleMouseUp);
1154
1233
  }
1155
- function getTimeFromPosition(x2, y2) {
1156
- var _a;
1157
- const rect = (_a = document.querySelector(".time-slots")) == null ? void 0 : _a.getBoundingClientRect();
1158
- if (!rect) return /* @__PURE__ */ new Date();
1159
- const dayIndex = Math.floor((x2 - rect.left) / (rect.width / 7));
1160
- const minutes = Math.floor((y2 - rect.top) / (slotHeight / 2)) * slotDuration;
1161
- const date2 = new Date(weekDays.value[dayIndex]);
1162
- date2.setHours(Math.floor(minutes / 60));
1163
- date2.setMinutes(minutes % 60);
1234
+ function getTimeFromPosition(y2, day) {
1235
+ if (!calendarGrid.value || !timeSlotsContainer.value) return new Date(day);
1236
+ const gridRect = calendarGrid.value.getBoundingClientRect();
1237
+ const relativeY = y2 - gridRect.top;
1238
+ const minutesPerSlot = slotDuration;
1239
+ const slotsFromTop = relativeY / slotHeight;
1240
+ const minutes = Math.floor(slotsFromTop * minutesPerSlot);
1241
+ const date2 = new Date(day);
1242
+ date2.setHours(Math.floor(minutes / 60) - 1);
1243
+ const roundedMinutes = Math.round(minutes % 60 / 5) * 5;
1244
+ date2.setMinutes(roundedMinutes);
1245
+ date2.setSeconds(0);
1246
+ date2.setMilliseconds(0);
1164
1247
  return date2;
1165
1248
  }
1166
1249
  function updateCurrentTimeIndicator() {
@@ -1169,29 +1252,39 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1169
1252
  (day) => day.getDate() === now.getDate() && day.getMonth() === now.getMonth() && day.getFullYear() === now.getFullYear()
1170
1253
  );
1171
1254
  const minutes = now.getHours() * 60 + now.getMinutes();
1172
- currentTimeTop.value = minutes / slotDuration * (slotHeight / 2);
1173
- }
1174
- function openPopover$1(event, e) {
1175
- openPopover(
1176
- event,
1177
- e,
1178
- popoverState,
1179
- !!slots.eventContent,
1180
- (evt) => {
1181
- emit2("eventClick", evt);
1182
- }
1183
- );
1255
+ currentTimeTop.value = minutes / slotDuration * slotHeight;
1256
+ }
1257
+ function handleEventSelection(event, domEvent) {
1258
+ if (!slots.eventContent) {
1259
+ emit2("eventClick", event);
1260
+ return;
1261
+ }
1262
+ if (domEvent) {
1263
+ const rect = domEvent.currentTarget.getBoundingClientRect();
1264
+ const position = {
1265
+ top: rect.top + window.scrollY + rect.height / 2,
1266
+ left: rect.left + window.scrollX + rect.width + 10
1267
+ };
1268
+ emit2("openPopover", event, position);
1269
+ } else {
1270
+ emit2("openPopover", event);
1271
+ }
1184
1272
  }
1185
- function closePopover$1() {
1186
- closePopover(popoverState);
1273
+ function setDayColumnRef(el, index2) {
1274
+ while (dayColumns.value.length <= index2) {
1275
+ dayColumns.value.push(null);
1276
+ }
1277
+ if (el) {
1278
+ dayColumns.value[index2] = el instanceof Element ? el : el.$el;
1279
+ } else {
1280
+ dayColumns.value[index2] = null;
1281
+ }
1187
1282
  }
1188
1283
  onMounted(() => {
1189
- document.addEventListener("mousedown", handleMouseDown);
1190
1284
  updateCurrentTimeIndicator();
1191
1285
  currentTimeInterval.value = setInterval(updateCurrentTimeIndicator, 6e4);
1192
1286
  });
1193
1287
  onUnmounted(() => {
1194
- document.removeEventListener("mousedown", handleMouseDown);
1195
1288
  document.removeEventListener("mousemove", handleMouseMove);
1196
1289
  document.removeEventListener("mouseup", handleMouseUp);
1197
1290
  if (currentTimeInterval.value) {
@@ -1199,31 +1292,38 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1199
1292
  }
1200
1293
  });
1201
1294
  return (_ctx, _cache) => {
1202
- const _directive_click_outside = resolveDirective("click-outside");
1203
1295
  return openBlock(), createElementBlock("div", _hoisted_1$U, [
1204
- createElementVNode("div", _hoisted_2$F, [
1205
- _cache[0] || (_cache[0] = createElementVNode("div", null, null, -1)),
1296
+ createElementVNode("div", {
1297
+ ref_key: "calendarGrid",
1298
+ ref: calendarGrid,
1299
+ class: "weekGrid border-bottom me-1"
1300
+ }, [
1301
+ _cache[1] || (_cache[1] = createElementVNode("div", null, null, -1)),
1206
1302
  (openBlock(true), createElementBlock(Fragment, null, renderList(weekDays.value, (day) => {
1207
1303
  return openBlock(), createElementBlock("div", {
1208
1304
  key: day.toISOString(),
1209
1305
  class: "day-header p-05 txt-center"
1210
1306
  }, [
1211
- createTextVNode(toDisplayString(unref(fmtDate)(day, { fmt: "DDD" })) + " ", 1),
1307
+ createTextVNode(toDisplayString(unref(formatDate)(day, { fmt: "DDD" })) + " ", 1),
1212
1308
  createElementVNode("span", {
1213
1309
  class: normalizeClass(["txt-12 round p-025", {
1214
1310
  "color-gray": day.toDateString() !== (/* @__PURE__ */ new Date()).toDateString(),
1215
1311
  "bg-primary color-white": day.toDateString() === (/* @__PURE__ */ new Date()).toDateString()
1216
1312
  }])
1217
- }, toDisplayString(unref(fmtDate)(day, { fmt: "DD" })), 3)
1313
+ }, toDisplayString(unref(formatDate)(day, { fmt: "DD" })), 3)
1218
1314
  ]);
1219
1315
  }), 128))
1220
- ]),
1221
- createElementVNode("div", _hoisted_3$z, [
1316
+ ], 512),
1317
+ createElementVNode("div", _hoisted_2$F, [
1222
1318
  createElementVNode("div", {
1223
- class: "weekGrid border-end relative",
1224
- onMousedown: handleMouseDown
1319
+ ref_key: "dayColumnsContainer",
1320
+ ref: dayColumnsContainer,
1321
+ class: "weekGrid border-end relative"
1225
1322
  }, [
1226
- createElementVNode("div", null, [
1323
+ createElementVNode("div", {
1324
+ ref_key: "timeSlotsContainer",
1325
+ ref: timeSlotsContainer
1326
+ }, [
1227
1327
  (openBlock(true), createElementBlock(Fragment, null, renderList(timeSlots.value, (slot) => {
1228
1328
  return openBlock(), createElementBlock("div", {
1229
1329
  key: slot.time,
@@ -1231,19 +1331,22 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1231
1331
  style: normalizeStyle({ height: `${slotHeight}px` })
1232
1332
  }, toDisplayString(slot.time), 5);
1233
1333
  }), 128))
1234
- ]),
1334
+ ], 512),
1235
1335
  isToday.value ? (openBlock(), createElementBlock("div", {
1236
1336
  key: 0,
1237
1337
  class: "absolute end w-100p z-2 flex pointer-events-none ps-4-5",
1238
1338
  style: normalizeStyle({ top: `${currentTimeTop.value}px` })
1239
- }, _cache[1] || (_cache[1] = [
1339
+ }, _cache[2] || (_cache[2] = [
1240
1340
  createElementVNode("div", { class: "current-time-dot h-10px aspect-ratio-1 round bg-primary" }, null, -1),
1241
1341
  createElementVNode("div", { class: "current-time-line w-100p bg-primary" }, null, -1)
1242
1342
  ]), 4)) : createCommentVNode("", true),
1243
- (openBlock(true), createElementBlock(Fragment, null, renderList(weekDays.value, (day) => {
1343
+ (openBlock(true), createElementBlock(Fragment, null, renderList(weekDays.value, (day, index2) => {
1244
1344
  return openBlock(), createElementBlock("div", {
1245
1345
  key: day.toISOString(),
1246
- class: "day-column top bottom border-start relative"
1346
+ ref_for: true,
1347
+ ref: (el) => setDayColumnRef(el, index2),
1348
+ class: "day-column top bottom border-start relative",
1349
+ onMousedown: ($event) => handleMouseDown($event, day)
1247
1350
  }, [
1248
1351
  (openBlock(true), createElementBlock(Fragment, null, renderList(processedEvents.value.filter((e) => new Date(e.start_time).toDateString() === day.toDateString()), (event) => {
1249
1352
  return openBlock(), createElementBlock("div", {
@@ -1256,52 +1359,38 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
1256
1359
  width: `${event.width}%`,
1257
1360
  backgroundColor: event.color || "var(--bgl-primary)"
1258
1361
  }),
1259
- onClick: withModifiers(($event) => unref(slots).eventContent ? openPopover$1(event, $event) : emit2("eventClick", event), ["stop"])
1362
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
1363
+ }, ["stop"])),
1364
+ onClick: withModifiers(($event) => handleEventSelection(event, $event), ["stop"])
1260
1365
  }, [
1261
1366
  createElementVNode("div", _hoisted_5$l, [
1262
1367
  createElementVNode("div", _hoisted_6$i, toDisplayString(event.title), 1),
1263
- createElementVNode("div", _hoisted_7$e, toDisplayString(unref(fmtDate)(event.start_time, { fmt: "HH:mm" })), 1)
1368
+ createElementVNode("div", _hoisted_7$e, toDisplayString(unref(formatDate)(event.start_time, { fmt: "HH:mm" })) + " - " + toDisplayString(unref(formatDate)(event.end_time, { fmt: "HH:mm" })), 1)
1264
1369
  ])
1265
- ], 12, _hoisted_4$m);
1370
+ ], 44, _hoisted_4$m);
1266
1371
  }), 128))
1267
- ]);
1372
+ ], 40, _hoisted_3$z);
1268
1373
  }), 128)),
1269
1374
  dragState.value.isDragging && dragState.value.start && dragState.value.end ? (openBlock(), createElementBlock("div", {
1270
1375
  key: 1,
1271
- class: "drag-preview absolute bg-primary pointer-events-none",
1376
+ class: "drag-preview absolute bg-primary-tint pointer-events-none overflow-hidden opacity-7 z-1",
1272
1377
  style: normalizeStyle({
1273
1378
  left: `${Math.min(dragState.value.start.x, dragState.value.end.x)}px`,
1274
1379
  top: `${Math.min(dragState.value.start.y, dragState.value.end.y)}px`,
1275
1380
  width: `${Math.abs(dragState.value.end.x - dragState.value.start.x)}px`,
1276
1381
  height: `${Math.abs(dragState.value.end.y - dragState.value.start.y)}px`
1277
1382
  })
1278
- }, null, 4)) : createCommentVNode("", true)
1279
- ], 32)
1383
+ }, [
1384
+ createElementVNode("div", _hoisted_8$7, toDisplayString(dragState.value.startTime ? unref(formatDate)(dragState.value.startTime, { fmt: "HH:mm" }) : "") + " - " + toDisplayString(dragState.value.endTime ? unref(formatDate)(dragState.value.endTime, { fmt: "HH:mm" }) : ""), 1)
1385
+ ], 4)) : createCommentVNode("", true)
1386
+ ], 512)
1280
1387
  ]),
1281
- showPopover.value && activeEvent.value ? withDirectives((openBlock(), createBlock(unref(_sfc_main$10), {
1282
- key: 0,
1283
- ref_key: "popoverRef",
1284
- ref: popoverRef,
1285
- thin: "",
1286
- class: "custom-popover fixed z-999 radius-1 bg-white",
1287
- style: normalizeStyle({
1288
- top: `${popoverPosition.value.top}px`,
1289
- left: `${popoverPosition.value.left}px`
1290
- })
1291
- }, {
1292
- default: withCtx(() => [
1293
- renderSlot(_ctx.$slots, "eventContent", { event: activeEvent.value }, void 0, true)
1294
- ]),
1295
- _: 3
1296
- }, 8, ["style"])), [
1297
- [_directive_click_outside, closePopover$1]
1298
- ]) : createCommentVNode("", true),
1299
- _cache[2] || (_cache[2] = createElementVNode("div", { class: "border-bottom me-1" }, null, -1))
1388
+ _cache[3] || (_cache[3] = createElementVNode("div", { class: "border-bottom me-1" }, null, -1))
1300
1389
  ]);
1301
1390
  };
1302
1391
  }
1303
1392
  });
1304
- const WeekView = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-b897fbe8"]]);
1393
+ const WeekView = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-1cd041ac"]]);
1305
1394
  const _hoisted_1$T = { class: "calendar" };
1306
1395
  const _hoisted_2$E = { class: "flex m_block m_pb-1" };
1307
1396
  const _hoisted_3$y = { class: "txt-light my-0" };
@@ -1314,12 +1403,15 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
1314
1403
  view: { default: "Week" },
1315
1404
  weekStart: { default: "Sunday" }
1316
1405
  },
1317
- emits: ["eventClick", "eventCreate", "eventUpdate", "eventDelete", "dateChange", "viewChange"],
1406
+ emits: ["eventClick", "eventCreate", "eventUpdate", "eventDelete", "dateChange", "viewChange", "ready"],
1318
1407
  setup(__props, { expose: __expose, emit: __emit }) {
1319
1408
  const props2 = __props;
1320
1409
  const emit2 = __emit;
1321
1410
  const currentDate = ref(new Date(props2.startDate));
1322
1411
  const currentView = ref(props2.view);
1412
+ const activeEvent = ref();
1413
+ const showPopover = ref(false);
1414
+ const popoverPosition = ref();
1323
1415
  const views = {
1324
1416
  Week: WeekView,
1325
1417
  Month: MonthView,
@@ -1329,21 +1421,39 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
1329
1421
  const visibleDateRange = computed(() => {
1330
1422
  const start = new Date(currentDate.value);
1331
1423
  let end = new Date(currentDate.value);
1332
- if (currentView.value === "Week") {
1333
- const dayOfWeek = start.getDay();
1334
- const weekStartOffset = props2.weekStart === "Sunday" ? 0 : 1;
1335
- start.setDate(start.getDate() - dayOfWeek + weekStartOffset);
1336
- end = new Date(start);
1337
- end.setDate(end.getDate() + 6);
1338
- } else if (["Month", "Agenda"].includes(currentView.value)) {
1339
- start.setDate(1);
1340
- start.setDate(start.getDate() - 7);
1341
- end = new Date(start.getFullYear(), start.getMonth() + 2, 7);
1342
- } else if (currentView.value === "Day") {
1343
- end.setDate(end.getDate() + 1);
1424
+ const addSunday = props2.weekStart === "Sunday" ? 0 : 1;
1425
+ switch (currentView.value) {
1426
+ case "Week":
1427
+ start.setDate(start.getDate() - start.getDay() + addSunday);
1428
+ end.setDate(start.getDate() + 6);
1429
+ break;
1430
+ case "Month":
1431
+ case "Agenda":
1432
+ start.setDate(-6);
1433
+ end = new Date(start.getFullYear(), start.getMonth() + 2, 7);
1434
+ break;
1435
+ case "Day":
1436
+ end.setDate(end.getDate() + 1);
1437
+ break;
1438
+ default:
1439
+ console.error(`Invalid view: ${currentView.value}`);
1344
1440
  }
1345
1441
  return { start, end };
1346
1442
  });
1443
+ const state2 = computed(() => ({
1444
+ visibleDateRange: visibleDateRange.value,
1445
+ currentDate: currentDate.value,
1446
+ currentView: currentView.value
1447
+ }));
1448
+ function handleDateChange(date2) {
1449
+ console.log("handleDateChange", date2);
1450
+ currentDate.value = new Date(date2);
1451
+ emit2("dateChange", state2.value);
1452
+ }
1453
+ function handleViewChange(view) {
1454
+ currentView.value = view;
1455
+ emit2("viewChange", state2.value);
1456
+ }
1347
1457
  function handleEventClick(event) {
1348
1458
  emit2("eventClick", event);
1349
1459
  }
@@ -1356,15 +1466,26 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
1356
1466
  function handleEventDelete(eventId) {
1357
1467
  emit2("eventDelete", eventId);
1358
1468
  }
1359
- function handleDateChange(date2) {
1360
- currentDate.value = new Date(date2);
1361
- emit2("dateChange", currentDate.value);
1469
+ function openPopover(event, position) {
1470
+ activeEvent.value = event;
1471
+ popoverPosition.value = position;
1472
+ showPopover.value = true;
1362
1473
  }
1363
- function handleViewChange(view) {
1364
- currentView.value = view;
1365
- emit2("viewChange", view);
1474
+ function closePopover() {
1475
+ showPopover.value = false;
1476
+ activeEvent.value = void 0;
1477
+ popoverPosition.value = void 0;
1366
1478
  }
1367
- __expose({ visibleDateRange });
1479
+ __expose({
1480
+ visibleDateRange,
1481
+ currentView,
1482
+ currentDate,
1483
+ openPopover,
1484
+ closePopover
1485
+ });
1486
+ onMounted(() => {
1487
+ emit2("ready", state2.value);
1488
+ });
1368
1489
  return (_ctx, _cache) => {
1369
1490
  return openBlock(), createElementBlock("div", _hoisted_1$T, [
1370
1491
  createElementVNode("div", _hoisted_2$E, [
@@ -1419,18 +1540,32 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
1419
1540
  onEventCreate: handleEventCreate,
1420
1541
  onEventUpdate: handleEventUpdate,
1421
1542
  onEventDelete: handleEventDelete,
1422
- onDateChange: handleDateChange
1543
+ onDateChange: handleDateChange,
1544
+ onOpenPopover: openPopover
1545
+ }, {
1546
+ eventContent: withCtx(({ event }) => [
1547
+ renderSlot(_ctx.$slots, "eventContent", { event }, void 0, true)
1548
+ ]),
1549
+ _: 3
1550
+ }, 40, ["events", "start-date", "week-start"])),
1551
+ createVNode(CalendarPopover, {
1552
+ event: activeEvent.value,
1553
+ position: popoverPosition.value,
1554
+ show: showPopover.value,
1555
+ "has-event-content-slot": !!_ctx.$slots.eventContent,
1556
+ onClose: closePopover,
1557
+ onEventClick: handleEventClick
1423
1558
  }, {
1424
1559
  eventContent: withCtx(({ event }) => [
1425
1560
  renderSlot(_ctx.$slots, "eventContent", { event }, void 0, true)
1426
1561
  ]),
1427
1562
  _: 3
1428
- }, 40, ["events", "start-date", "week-start"]))
1563
+ }, 8, ["event", "position", "show", "has-event-content-slot"])
1429
1564
  ]);
1430
1565
  };
1431
1566
  }
1432
1567
  });
1433
- const Index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-36ea5622"]]);
1568
+ const Index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-840b6594"]]);
1434
1569
  const _hoisted_1$S = {
1435
1570
  key: 0,
1436
1571
  class: "card_label"
@@ -15086,7 +15221,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
15086
15221
  };
15087
15222
  }
15088
15223
  });
15089
- const DatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-9c8816c6"]]);
15224
+ const DatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-17319f4d"]]);
15090
15225
  const _hoisted_1$E = ["title"];
15091
15226
  const _hoisted_2$s = { key: 0 };
15092
15227
  const _hoisted_3$o = {
@@ -34901,19 +35036,30 @@ function useBagelFormState(injectionKey = FORM_STATE_KEY) {
34901
35036
  function useDevice() {
34902
35037
  const innerWidth = ref(window.innerWidth);
34903
35038
  const isMobile = ref(window.innerWidth < 768);
35039
+ const scrollY = ref(window.scrollY);
35040
+ const scrollX = ref(window.scrollX);
35041
+ const innerHeight = ref(window.innerHeight);
34904
35042
  function updateDeviceInfo() {
34905
35043
  innerWidth.value = window.innerWidth;
34906
35044
  isMobile.value = window.innerWidth < 768;
35045
+ scrollY.value = window.scrollY;
35046
+ scrollX.value = window.scrollX;
35047
+ innerHeight.value = window.innerHeight;
34907
35048
  }
34908
35049
  onMounted(() => {
34909
35050
  window.addEventListener("resize", updateDeviceInfo);
35051
+ window.addEventListener("scroll", updateDeviceInfo);
34910
35052
  });
34911
35053
  onUnmounted(() => {
34912
35054
  window.removeEventListener("resize", updateDeviceInfo);
35055
+ window.removeEventListener("scroll", updateDeviceInfo);
34913
35056
  });
34914
35057
  return {
34915
35058
  innerWidth,
34916
- isMobile
35059
+ isMobile,
35060
+ scrollY,
35061
+ scrollX,
35062
+ innerHeight
34917
35063
  };
34918
35064
  }
34919
35065
  const SECONDS = 1e3;
@@ -36227,27 +36373,27 @@ const allCountries = countryArray.map(
36227
36373
  );
36228
36374
  function timeDelta(date2, options) {
36229
36375
  date2 = new Date(date2);
36230
- const { day, hour, minute, second, week, month, year } = options;
36231
- if (day) {
36232
- date2.setDate(date2.getDate() + day);
36376
+ const { Day, Hour, Minute, Second, Week, Month, Year } = options;
36377
+ if (Day) {
36378
+ date2.setDate(date2.getDate() + Day);
36233
36379
  }
36234
- if (hour) {
36235
- date2.setHours(date2.getHours() + hour);
36380
+ if (Hour) {
36381
+ date2.setHours(date2.getHours() + Hour);
36236
36382
  }
36237
- if (minute) {
36238
- date2.setMinutes(date2.getMinutes() + minute);
36383
+ if (Minute) {
36384
+ date2.setMinutes(date2.getMinutes() + Minute);
36239
36385
  }
36240
- if (second) {
36241
- date2.setSeconds(date2.getSeconds() + second);
36386
+ if (Second) {
36387
+ date2.setSeconds(date2.getSeconds() + Second);
36242
36388
  }
36243
- if (week) {
36244
- date2.setDate(date2.getDate() + week * 7);
36389
+ if (Week) {
36390
+ date2.setDate(date2.getDate() + Week * 7);
36245
36391
  }
36246
- if (month) {
36247
- date2.setMonth(date2.getMonth() + month);
36392
+ if (Month) {
36393
+ date2.setMonth(date2.getMonth() + Month);
36248
36394
  }
36249
- if (year) {
36250
- date2.setFullYear(date2.getFullYear() + year);
36395
+ if (Year) {
36396
+ date2.setFullYear(date2.getFullYear() + Year);
36251
36397
  }
36252
36398
  return date2;
36253
36399
  }
@@ -36460,9 +36606,9 @@ const IMAGE_FORMATS_REGEXP = new RegExp(`(${IMAGE_FORMATS.join("|")})$`, "i");
36460
36606
  const VIDEO_FORMATS = ["mp4", "webm", "ogg", "mov", "avi", "flv", "wmv", "mkv", "ts", "m3u8"];
36461
36607
  const VIDEO_FORMATS_REGEXP = new RegExp(`(${VIDEO_FORMATS.join("|")})$`, "i");
36462
36608
  export {
36463
- _sfc_main$1d as Accordion,
36609
+ _sfc_main$1e as Accordion,
36464
36610
  AccordionItem,
36465
- _sfc_main$1b as AddressSearch,
36611
+ _sfc_main$1c as AddressSearch,
36466
36612
  Alert,
36467
36613
  Avatar,
36468
36614
  Badge,