@bagelink/vue 1.2.33 → 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.
- package/dist/components/calendar/CalendarPopover.vue.d.ts +179 -0
- package/dist/components/calendar/CalendarPopover.vue.d.ts.map +1 -0
- package/dist/components/calendar/CalendarTypes.d.ts +15 -0
- package/dist/components/calendar/CalendarTypes.d.ts.map +1 -1
- package/dist/components/calendar/Index.vue.d.ts +21 -12
- package/dist/components/calendar/Index.vue.d.ts.map +1 -1
- package/dist/components/calendar/views/AgendaView.vue.d.ts +8 -0
- package/dist/components/calendar/views/AgendaView.vue.d.ts.map +1 -1
- package/dist/components/calendar/views/CalendarPopover.vue.d.ts +175 -0
- package/dist/components/calendar/views/CalendarPopover.vue.d.ts.map +1 -0
- package/dist/components/calendar/views/DayView.vue.d.ts +10 -32
- package/dist/components/calendar/views/DayView.vue.d.ts.map +1 -1
- package/dist/components/calendar/views/MonthView.vue.d.ts +10 -170
- package/dist/components/calendar/views/MonthView.vue.d.ts.map +1 -1
- package/dist/components/calendar/views/WeekView.vue.d.ts +12 -168
- package/dist/components/calendar/views/WeekView.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
- package/dist/composables/useDevice.d.ts +3 -0
- package/dist/composables/useDevice.d.ts.map +1 -1
- package/dist/index.cjs +446 -309
- package/dist/index.mjs +446 -309
- package/dist/style.css +231 -179
- package/dist/types/BagelForm.d.ts +14 -11
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/utils/BagelFormUtils.d.ts +10 -10
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/dist/utils/calendar/dateUtils.d.ts +10 -10
- package/dist/utils/calendar/dateUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/calendar/CalendarPopover.vue +102 -0
- package/src/components/calendar/CalendarTypes.ts +14 -0
- package/src/components/calendar/Index.vue +77 -35
- package/src/components/calendar/views/AgendaView.vue +26 -2
- package/src/components/calendar/views/DayView.vue +83 -104
- package/src/components/calendar/views/MonthView.vue +39 -67
- package/src/components/calendar/views/WeekView.vue +229 -136
- package/src/components/form/inputs/DateInput.vue +14 -3
- package/src/components/form/inputs/DatePicker.vue +7 -0
- package/src/composables/useDevice.ts +13 -2
- package/src/styles/layout.css +14 -0
- package/src/styles/mobilLayout.css +12 -0
- package/src/types/BagelForm.ts +30 -53
- package/src/utils/BagelFormUtils.ts +11 -10
- package/src/utils/calendar/dateUtils.ts +42 -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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
353
|
-
const _sfc_main$
|
|
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$
|
|
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$
|
|
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$
|
|
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) =>
|
|
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-
|
|
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$
|
|
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
|
|
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
|
|
756
|
-
|
|
757
|
-
event
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
(
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
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) =>
|
|
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$
|
|
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
|
-
},
|
|
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-
|
|
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$
|
|
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
|
|
940
|
-
|
|
941
|
-
event
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
(
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
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) =>
|
|
1018
|
+
onClick: vue.withModifiers(($event) => handleEventSelection(event, $event), ["stop"])
|
|
984
1019
|
}, [
|
|
985
|
-
vue.createElementVNode("div", _hoisted_8$
|
|
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-
|
|
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: "
|
|
1019
|
-
const _hoisted_3$z =
|
|
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
|
-
const _hoisted_5$l = { class: "overflow-hidden color-
|
|
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
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
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(
|
|
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,14 +1110,14 @@ 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 *
|
|
1097
|
-
const height = Math.max((endMinutes - startMinutes) / slotDuration *
|
|
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,
|
|
1101
1118
|
height,
|
|
1102
1119
|
left: 0,
|
|
1103
|
-
width:
|
|
1120
|
+
width: 100,
|
|
1104
1121
|
overlappingEvents: 0,
|
|
1105
1122
|
position: 0
|
|
1106
1123
|
};
|
|
@@ -1124,45 +1141,111 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1124
1141
|
});
|
|
1125
1142
|
return events;
|
|
1126
1143
|
});
|
|
1127
|
-
function handleMouseDown(e) {
|
|
1128
|
-
|
|
1129
|
-
|
|
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.
|
|
1132
|
-
dragState.value.
|
|
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
|
-
|
|
1139
|
-
|
|
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 (
|
|
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
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
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(
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
const
|
|
1162
|
-
const
|
|
1163
|
-
const
|
|
1164
|
-
date2
|
|
1165
|
-
date2.
|
|
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 *
|
|
1175
|
-
}
|
|
1176
|
-
function
|
|
1177
|
-
|
|
1178
|
-
event
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
(
|
|
1183
|
-
|
|
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
|
|
1188
|
-
|
|
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",
|
|
1207
|
-
|
|
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(
|
|
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(
|
|
1315
|
+
}, vue.toDisplayString(vue.unref(formatDate)(day, { fmt: "DD" })), 3)
|
|
1220
1316
|
]);
|
|
1221
1317
|
}), 128))
|
|
1222
|
-
]),
|
|
1223
|
-
vue.createElementVNode("div",
|
|
1318
|
+
], 512),
|
|
1319
|
+
vue.createElementVNode("div", _hoisted_2$F, [
|
|
1224
1320
|
vue.createElementVNode("div", {
|
|
1225
|
-
|
|
1226
|
-
|
|
1321
|
+
ref_key: "dayColumnsContainer",
|
|
1322
|
+
ref: dayColumnsContainer,
|
|
1323
|
+
class: "weekGrid border-end relative"
|
|
1227
1324
|
}, [
|
|
1228
|
-
vue.createElementVNode("div",
|
|
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[
|
|
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
|
-
|
|
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,53 +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
|
-
|
|
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(
|
|
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
|
-
],
|
|
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
|
-
},
|
|
1281
|
-
|
|
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
|
-
|
|
1284
|
-
key: 0,
|
|
1285
|
-
ref_key: "popoverRef",
|
|
1286
|
-
ref: popoverRef,
|
|
1287
|
-
thin: "",
|
|
1288
|
-
class: "custom-popover fixed z-999 radius-05 bg-white w350",
|
|
1289
|
-
style: vue.normalizeStyle({
|
|
1290
|
-
top: `${popoverPosition.value.top}px`,
|
|
1291
|
-
left: `${popoverPosition.value.left}px`,
|
|
1292
|
-
maxWidth: `${popoverPosition.value.width}px`
|
|
1293
|
-
})
|
|
1294
|
-
}, {
|
|
1295
|
-
default: vue.withCtx(() => [
|
|
1296
|
-
vue.renderSlot(_ctx.$slots, "eventContent", { event: activeEvent.value }, void 0, true)
|
|
1297
|
-
]),
|
|
1298
|
-
_: 3
|
|
1299
|
-
}, 8, ["style"])), [
|
|
1300
|
-
[_directive_click_outside, closePopover$1]
|
|
1301
|
-
]) : vue.createCommentVNode("", true),
|
|
1302
|
-
_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))
|
|
1303
1391
|
]);
|
|
1304
1392
|
};
|
|
1305
1393
|
}
|
|
1306
1394
|
});
|
|
1307
|
-
const WeekView = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-
|
|
1395
|
+
const WeekView = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-1cd041ac"]]);
|
|
1308
1396
|
const _hoisted_1$T = { class: "calendar" };
|
|
1309
1397
|
const _hoisted_2$E = { class: "flex m_block m_pb-1" };
|
|
1310
1398
|
const _hoisted_3$y = { class: "txt-light my-0" };
|
|
@@ -1312,17 +1400,20 @@ const _hoisted_4$l = { class: "ms-auto flex gap-025" };
|
|
|
1312
1400
|
const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
1313
1401
|
__name: "Index",
|
|
1314
1402
|
props: {
|
|
1315
|
-
events: {},
|
|
1403
|
+
events: { default: () => [] },
|
|
1316
1404
|
startDate: { default: () => /* @__PURE__ */ new Date() },
|
|
1317
1405
|
view: { default: "Week" },
|
|
1318
1406
|
weekStart: { default: "Sunday" }
|
|
1319
1407
|
},
|
|
1320
|
-
emits: ["eventClick", "eventCreate", "eventUpdate", "eventDelete", "dateChange", "viewChange"],
|
|
1408
|
+
emits: ["eventClick", "eventCreate", "eventUpdate", "eventDelete", "dateChange", "viewChange", "ready"],
|
|
1321
1409
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1322
1410
|
const props2 = __props;
|
|
1323
1411
|
const emit2 = __emit;
|
|
1324
1412
|
const currentDate = vue.ref(new Date(props2.startDate));
|
|
1325
1413
|
const currentView = vue.ref(props2.view);
|
|
1414
|
+
const activeEvent = vue.ref();
|
|
1415
|
+
const showPopover = vue.ref(false);
|
|
1416
|
+
const popoverPosition = vue.ref();
|
|
1326
1417
|
const views = {
|
|
1327
1418
|
Week: WeekView,
|
|
1328
1419
|
Month: MonthView,
|
|
@@ -1332,21 +1423,39 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1332
1423
|
const visibleDateRange = vue.computed(() => {
|
|
1333
1424
|
const start = new Date(currentDate.value);
|
|
1334
1425
|
let end = new Date(currentDate.value);
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
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}`);
|
|
1347
1442
|
}
|
|
1348
1443
|
return { start, end };
|
|
1349
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
|
+
}
|
|
1350
1459
|
function handleEventClick(event) {
|
|
1351
1460
|
emit2("eventClick", event);
|
|
1352
1461
|
}
|
|
@@ -1359,15 +1468,26 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1359
1468
|
function handleEventDelete(eventId) {
|
|
1360
1469
|
emit2("eventDelete", eventId);
|
|
1361
1470
|
}
|
|
1362
|
-
function
|
|
1363
|
-
|
|
1364
|
-
|
|
1471
|
+
function openPopover(event, position) {
|
|
1472
|
+
activeEvent.value = event;
|
|
1473
|
+
popoverPosition.value = position;
|
|
1474
|
+
showPopover.value = true;
|
|
1365
1475
|
}
|
|
1366
|
-
function
|
|
1367
|
-
|
|
1368
|
-
|
|
1476
|
+
function closePopover() {
|
|
1477
|
+
showPopover.value = false;
|
|
1478
|
+
activeEvent.value = void 0;
|
|
1479
|
+
popoverPosition.value = void 0;
|
|
1369
1480
|
}
|
|
1370
|
-
__expose({
|
|
1481
|
+
__expose({
|
|
1482
|
+
visibleDateRange,
|
|
1483
|
+
currentView,
|
|
1484
|
+
currentDate,
|
|
1485
|
+
openPopover,
|
|
1486
|
+
closePopover
|
|
1487
|
+
});
|
|
1488
|
+
vue.onMounted(() => {
|
|
1489
|
+
emit2("ready", state2.value);
|
|
1490
|
+
});
|
|
1371
1491
|
return (_ctx, _cache) => {
|
|
1372
1492
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$T, [
|
|
1373
1493
|
vue.createElementVNode("div", _hoisted_2$E, [
|
|
@@ -1422,18 +1542,32 @@ const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1422
1542
|
onEventCreate: handleEventCreate,
|
|
1423
1543
|
onEventUpdate: handleEventUpdate,
|
|
1424
1544
|
onEventDelete: handleEventDelete,
|
|
1425
|
-
onDateChange: handleDateChange
|
|
1545
|
+
onDateChange: handleDateChange,
|
|
1546
|
+
onOpenPopover: openPopover
|
|
1426
1547
|
}, {
|
|
1427
1548
|
eventContent: vue.withCtx(({ event }) => [
|
|
1428
1549
|
vue.renderSlot(_ctx.$slots, "eventContent", { event }, void 0, true)
|
|
1429
1550
|
]),
|
|
1430
1551
|
_: 3
|
|
1431
|
-
}, 40, ["events", "start-date", "week-start"]))
|
|
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
|
|
1560
|
+
}, {
|
|
1561
|
+
eventContent: vue.withCtx(({ event }) => [
|
|
1562
|
+
vue.renderSlot(_ctx.$slots, "eventContent", { event }, void 0, true)
|
|
1563
|
+
]),
|
|
1564
|
+
_: 3
|
|
1565
|
+
}, 8, ["event", "position", "show", "has-event-content-slot"])
|
|
1432
1566
|
]);
|
|
1433
1567
|
};
|
|
1434
1568
|
}
|
|
1435
1569
|
});
|
|
1436
|
-
const Index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-
|
|
1570
|
+
const Index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-840b6594"]]);
|
|
1437
1571
|
const _hoisted_1$S = {
|
|
1438
1572
|
key: 0,
|
|
1439
1573
|
class: "card_label"
|
|
@@ -8086,7 +8220,7 @@ ${indent}}`;
|
|
|
8086
8220
|
richtext: RichText,
|
|
8087
8221
|
upload: UploadInput,
|
|
8088
8222
|
file: UploadInput,
|
|
8089
|
-
date:
|
|
8223
|
+
date: _sfc_main$L,
|
|
8090
8224
|
tabs: TabsNav,
|
|
8091
8225
|
form: _sfc_main$T,
|
|
8092
8226
|
range: RangeInput
|
|
@@ -15089,7 +15223,7 @@ const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
|
|
|
15089
15223
|
};
|
|
15090
15224
|
}
|
|
15091
15225
|
});
|
|
15092
|
-
const DatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-
|
|
15226
|
+
const DatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-17319f4d"]]);
|
|
15093
15227
|
const _hoisted_1$E = ["title"];
|
|
15094
15228
|
const _hoisted_2$s = { key: 0 };
|
|
15095
15229
|
const _hoisted_3$o = {
|
|
@@ -15213,7 +15347,6 @@ const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
|
|
|
15213
15347
|
(...args) => vue.unref(handleFocus) && vue.unref(handleFocus)(...args))
|
|
15214
15348
|
}, [
|
|
15215
15349
|
_ctx.label ? (vue.openBlock(), vue.createElementBlock("label", _hoisted_2$s, [
|
|
15216
|
-
vue.createTextVNode(vue.toDisplayString(_ctx.label) + " ", 1),
|
|
15217
15350
|
_ctx.required ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$o, "*")) : vue.createCommentVNode("", true)
|
|
15218
15351
|
])) : vue.createCommentVNode("", true),
|
|
15219
15352
|
vue.createVNode(vue.unref(_sfc_main$W), {
|
|
@@ -15234,7 +15367,7 @@ const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
|
|
|
15234
15367
|
}, [
|
|
15235
15368
|
vue.createVNode(vue.unref(TextInput), {
|
|
15236
15369
|
modelValue: vue.unref(formatDisplayDate)(selectedDate.value),
|
|
15237
|
-
|
|
15370
|
+
iconStart: "calendar",
|
|
15238
15371
|
min: vue.unref(formatDisplayDate)(_ctx.min),
|
|
15239
15372
|
max: vue.unref(formatDisplayDate)(_ctx.max),
|
|
15240
15373
|
required: _ctx.required,
|
|
@@ -15275,7 +15408,6 @@ const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
|
|
|
15275
15408
|
};
|
|
15276
15409
|
}
|
|
15277
15410
|
});
|
|
15278
|
-
const DateInput = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-a0f799e6"]]);
|
|
15279
15411
|
const _hoisted_1$D = { class: "bagel-input" };
|
|
15280
15412
|
const _hoisted_2$r = {
|
|
15281
15413
|
key: 0,
|
|
@@ -34906,19 +35038,30 @@ function useBagelFormState(injectionKey = FORM_STATE_KEY) {
|
|
|
34906
35038
|
function useDevice() {
|
|
34907
35039
|
const innerWidth = vue.ref(window.innerWidth);
|
|
34908
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);
|
|
34909
35044
|
function updateDeviceInfo() {
|
|
34910
35045
|
innerWidth.value = window.innerWidth;
|
|
34911
35046
|
isMobile.value = window.innerWidth < 768;
|
|
35047
|
+
scrollY.value = window.scrollY;
|
|
35048
|
+
scrollX.value = window.scrollX;
|
|
35049
|
+
innerHeight.value = window.innerHeight;
|
|
34912
35050
|
}
|
|
34913
35051
|
vue.onMounted(() => {
|
|
34914
35052
|
window.addEventListener("resize", updateDeviceInfo);
|
|
35053
|
+
window.addEventListener("scroll", updateDeviceInfo);
|
|
34915
35054
|
});
|
|
34916
35055
|
vue.onUnmounted(() => {
|
|
34917
35056
|
window.removeEventListener("resize", updateDeviceInfo);
|
|
35057
|
+
window.removeEventListener("scroll", updateDeviceInfo);
|
|
34918
35058
|
});
|
|
34919
35059
|
return {
|
|
34920
35060
|
innerWidth,
|
|
34921
|
-
isMobile
|
|
35061
|
+
isMobile,
|
|
35062
|
+
scrollY,
|
|
35063
|
+
scrollX,
|
|
35064
|
+
innerHeight
|
|
34922
35065
|
};
|
|
34923
35066
|
}
|
|
34924
35067
|
const SECONDS = 1e3;
|
|
@@ -36232,27 +36375,27 @@ const allCountries = countryArray.map(
|
|
|
36232
36375
|
);
|
|
36233
36376
|
function timeDelta(date2, options) {
|
|
36234
36377
|
date2 = new Date(date2);
|
|
36235
|
-
const {
|
|
36236
|
-
if (
|
|
36237
|
-
date2.setDate(date2.getDate() +
|
|
36378
|
+
const { Day, Hour, Minute, Second, Week, Month, Year } = options;
|
|
36379
|
+
if (Day) {
|
|
36380
|
+
date2.setDate(date2.getDate() + Day);
|
|
36238
36381
|
}
|
|
36239
|
-
if (
|
|
36240
|
-
date2.setHours(date2.getHours() +
|
|
36382
|
+
if (Hour) {
|
|
36383
|
+
date2.setHours(date2.getHours() + Hour);
|
|
36241
36384
|
}
|
|
36242
|
-
if (
|
|
36243
|
-
date2.setMinutes(date2.getMinutes() +
|
|
36385
|
+
if (Minute) {
|
|
36386
|
+
date2.setMinutes(date2.getMinutes() + Minute);
|
|
36244
36387
|
}
|
|
36245
|
-
if (
|
|
36246
|
-
date2.setSeconds(date2.getSeconds() +
|
|
36388
|
+
if (Second) {
|
|
36389
|
+
date2.setSeconds(date2.getSeconds() + Second);
|
|
36247
36390
|
}
|
|
36248
|
-
if (
|
|
36249
|
-
date2.setDate(date2.getDate() +
|
|
36391
|
+
if (Week) {
|
|
36392
|
+
date2.setDate(date2.getDate() + Week * 7);
|
|
36250
36393
|
}
|
|
36251
|
-
if (
|
|
36252
|
-
date2.setMonth(date2.getMonth() +
|
|
36394
|
+
if (Month) {
|
|
36395
|
+
date2.setMonth(date2.getMonth() + Month);
|
|
36253
36396
|
}
|
|
36254
|
-
if (
|
|
36255
|
-
date2.setFullYear(date2.getFullYear() +
|
|
36397
|
+
if (Year) {
|
|
36398
|
+
date2.setFullYear(date2.getFullYear() + Year);
|
|
36256
36399
|
}
|
|
36257
36400
|
return date2;
|
|
36258
36401
|
}
|
|
@@ -36354,23 +36497,14 @@ function getBrowserNavigatorLocale() {
|
|
|
36354
36497
|
if (typeof navigator !== "object") return "en-US";
|
|
36355
36498
|
return navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;
|
|
36356
36499
|
}
|
|
36357
|
-
function handleTimezone(date2,
|
|
36358
|
-
if (timeZone === "UTC") {
|
|
36500
|
+
function handleTimezone(date2, locale2, intFmtOpt) {
|
|
36501
|
+
if (intFmtOpt.timeZone === "UTC") {
|
|
36359
36502
|
const utcDate = new Date(date2.getTime());
|
|
36360
36503
|
utcDate.setMinutes(utcDate.getMinutes() + date2.getTimezoneOffset());
|
|
36361
36504
|
return utcDate;
|
|
36362
36505
|
}
|
|
36363
36506
|
try {
|
|
36364
|
-
const formatter = new Intl.DateTimeFormat(
|
|
36365
|
-
timeZone,
|
|
36366
|
-
timeZoneName: "short",
|
|
36367
|
-
year: "numeric",
|
|
36368
|
-
month: "numeric",
|
|
36369
|
-
day: "numeric",
|
|
36370
|
-
hour: "numeric",
|
|
36371
|
-
minute: "numeric",
|
|
36372
|
-
second: "numeric"
|
|
36373
|
-
});
|
|
36507
|
+
const formatter = new Intl.DateTimeFormat(locale2, intFmtOpt);
|
|
36374
36508
|
const formattedParts = formatter.formatToParts(date2);
|
|
36375
36509
|
const parts = {};
|
|
36376
36510
|
formattedParts.forEach((part) => {
|
|
@@ -36389,12 +36523,12 @@ function handleTimezone(date2, timeZone) {
|
|
|
36389
36523
|
);
|
|
36390
36524
|
return adjustedDate;
|
|
36391
36525
|
} catch (error) {
|
|
36392
|
-
console.warn(`Error handling timezone ${timeZone}:`, error);
|
|
36526
|
+
console.warn(`Error handling timezone ${intFmtOpt.timeZone}:`, error);
|
|
36393
36527
|
return date2;
|
|
36394
36528
|
}
|
|
36395
36529
|
}
|
|
36396
|
-
function getDatePartsMap(date2, locale2,
|
|
36397
|
-
const d2 = timeZone ? handleTimezone(date2,
|
|
36530
|
+
function getDatePartsMap(date2, locale2, intFmtOpt) {
|
|
36531
|
+
const d2 = (intFmtOpt == null ? void 0 : intFmtOpt.timeZone) ? handleTimezone(date2, locale2, intFmtOpt) : date2;
|
|
36398
36532
|
return {
|
|
36399
36533
|
AmPm: d2.toLocaleString(locale2, { hour: "numeric", hour12: true, minute: "numeric" }).split(" ")[1],
|
|
36400
36534
|
DD: String(d2.getDate()).padStart(2, "0"),
|
|
@@ -36415,7 +36549,7 @@ const _datePartsMapNow = getDatePartsMap(/* @__PURE__ */ new Date(), getBrowserN
|
|
|
36415
36549
|
const _orderedDateTokens = Object.keys(_datePartsMapNow).sort((a2, b2) => b2.length - a2.length);
|
|
36416
36550
|
const _tokenRegExPattern = new RegExp(_orderedDateTokens.map((token) => token).join("|"), "g");
|
|
36417
36551
|
function formatDate(date2, opts = {}) {
|
|
36418
|
-
let { fmt: format2, locale: locale2, tz: timeZone } = opts;
|
|
36552
|
+
let { fmt: format2, locale: locale2, tz: timeZone, ...rest } = opts;
|
|
36419
36553
|
if (!date2) return "";
|
|
36420
36554
|
format2 = format2 || "DD.MM.YY";
|
|
36421
36555
|
locale2 = locale2 || getBrowserNavigatorLocale();
|
|
@@ -36425,11 +36559,12 @@ function formatDate(date2, opts = {}) {
|
|
|
36425
36559
|
console.warn("Invalid date provided to formatDate:", date2);
|
|
36426
36560
|
return "";
|
|
36427
36561
|
}
|
|
36428
|
-
const
|
|
36429
|
-
const formatter = new Intl.DateTimeFormat(locale2, {
|
|
36562
|
+
const intFmtOpt = {
|
|
36430
36563
|
day: "numeric",
|
|
36431
36564
|
hour: "2-digit",
|
|
36432
|
-
hour12
|
|
36565
|
+
// Set default hour12 to true if not explicitly set
|
|
36566
|
+
// hour12: true,
|
|
36567
|
+
hour12: rest.hour12 === void 0 ? true : rest.hour12,
|
|
36433
36568
|
minute: "2-digit",
|
|
36434
36569
|
month: "long",
|
|
36435
36570
|
second: "2-digit",
|
|
@@ -36437,7 +36572,9 @@ function formatDate(date2, opts = {}) {
|
|
|
36437
36572
|
// Add timeZone if provided
|
|
36438
36573
|
weekday: "long",
|
|
36439
36574
|
year: "numeric"
|
|
36440
|
-
}
|
|
36575
|
+
};
|
|
36576
|
+
const datePartsMap = getDatePartsMap(d2, locale2, intFmtOpt);
|
|
36577
|
+
const formatter = new Intl.DateTimeFormat(locale2, intFmtOpt);
|
|
36441
36578
|
const formattedParts = formatter.formatToParts(d2);
|
|
36442
36579
|
const partsMap = {};
|
|
36443
36580
|
formattedParts.forEach((part) => {
|
|
@@ -36470,9 +36607,9 @@ const IMAGE_FORMATS = ["jpeg", "png", "webp", "avif", "apng", "gif", "avifs", "s
|
|
|
36470
36607
|
const IMAGE_FORMATS_REGEXP = new RegExp(`(${IMAGE_FORMATS.join("|")})$`, "i");
|
|
36471
36608
|
const VIDEO_FORMATS = ["mp4", "webm", "ogg", "mov", "avi", "flv", "wmv", "mkv", "ts", "m3u8"];
|
|
36472
36609
|
const VIDEO_FORMATS_REGEXP = new RegExp(`(${VIDEO_FORMATS.join("|")})$`, "i");
|
|
36473
|
-
exports.Accordion = _sfc_main$
|
|
36610
|
+
exports.Accordion = _sfc_main$1e;
|
|
36474
36611
|
exports.AccordionItem = AccordionItem;
|
|
36475
|
-
exports.AddressSearch = _sfc_main$
|
|
36612
|
+
exports.AddressSearch = _sfc_main$1c;
|
|
36476
36613
|
exports.Alert = Alert;
|
|
36477
36614
|
exports.Avatar = Avatar;
|
|
36478
36615
|
exports.Badge = Badge;
|
|
@@ -36492,7 +36629,7 @@ exports.CodeEditor = CodeEditor;
|
|
|
36492
36629
|
exports.ColorInput = _sfc_main$N;
|
|
36493
36630
|
exports.DataPreview = DataPreview;
|
|
36494
36631
|
exports.DataTable = DataTable;
|
|
36495
|
-
exports.DateInput =
|
|
36632
|
+
exports.DateInput = _sfc_main$L;
|
|
36496
36633
|
exports.DatePicker = DatePicker;
|
|
36497
36634
|
exports.Draggable = _sfc_main$X;
|
|
36498
36635
|
exports.Dropdown = _sfc_main$W;
|