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