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