vue-cal 4.2.0 → 4.3.2
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/README.md +3 -3
- package/dist/drag-and-drop.amd.js +5 -0
- package/dist/drag-and-drop.cjs.js +5 -0
- package/dist/drag-and-drop.es.js +94 -0
- package/dist/i18n/ar.amd.js +5 -0
- package/dist/i18n/ar.cjs.js +5 -0
- package/dist/i18n/ar.es.js +8 -0
- package/dist/i18n/bg.amd.js +5 -0
- package/dist/i18n/bg.cjs.js +5 -0
- package/dist/i18n/bg.es.js +8 -0
- package/dist/i18n/bn.amd.js +5 -0
- package/dist/i18n/bn.cjs.js +5 -0
- package/dist/i18n/bn.es.js +8 -0
- package/dist/i18n/bs.amd.js +5 -0
- package/dist/i18n/bs.cjs.js +5 -0
- package/dist/i18n/bs.es.js +8 -0
- package/dist/i18n/ca.amd.js +5 -0
- package/dist/i18n/ca.cjs.js +5 -0
- package/dist/i18n/ca.es.js +8 -0
- package/dist/i18n/cs.amd.js +5 -0
- package/dist/i18n/cs.cjs.js +5 -0
- package/dist/i18n/cs.es.js +8 -0
- package/dist/i18n/da.amd.js +5 -0
- package/dist/i18n/da.cjs.js +5 -0
- package/dist/i18n/da.es.js +8 -0
- package/dist/i18n/de.amd.js +5 -0
- package/dist/i18n/de.cjs.js +5 -0
- package/dist/i18n/de.es.js +8 -0
- package/dist/i18n/el.amd.js +5 -0
- package/dist/i18n/el.cjs.js +5 -0
- package/dist/i18n/el.es.js +8 -0
- package/dist/i18n/en.amd.js +5 -0
- package/dist/i18n/en.cjs.js +5 -0
- package/dist/i18n/en.es.js +8 -0
- package/dist/i18n/es.amd.js +5 -0
- package/dist/i18n/es.cjs.js +5 -0
- package/dist/i18n/es.es.js +8 -0
- package/dist/i18n/fa.amd.js +5 -0
- package/dist/i18n/fa.cjs.js +5 -0
- package/dist/i18n/fa.es.js +8 -0
- package/dist/i18n/fr.amd.js +5 -0
- package/dist/i18n/fr.cjs.js +5 -0
- package/dist/i18n/fr.es.js +8 -0
- package/dist/i18n/he.amd.js +5 -0
- package/dist/i18n/he.cjs.js +5 -0
- package/dist/i18n/he.es.js +8 -0
- package/dist/i18n/hr.amd.js +5 -0
- package/dist/i18n/hr.cjs.js +5 -0
- package/dist/i18n/hr.es.js +8 -0
- package/dist/i18n/hu.amd.js +5 -0
- package/dist/i18n/hu.cjs.js +5 -0
- package/dist/i18n/hu.es.js +8 -0
- package/dist/i18n/id.amd.js +5 -0
- package/dist/i18n/id.cjs.js +5 -0
- package/dist/i18n/id.es.js +8 -0
- package/dist/i18n/is.amd.js +5 -0
- package/dist/i18n/is.cjs.js +5 -0
- package/dist/i18n/is.es.js +8 -0
- package/dist/i18n/it.amd.js +5 -0
- package/dist/i18n/it.cjs.js +5 -0
- package/dist/i18n/it.es.js +8 -0
- package/dist/i18n/ja.amd.js +5 -0
- package/dist/i18n/ja.cjs.js +5 -0
- package/dist/i18n/ja.es.js +8 -0
- package/dist/i18n/ka.amd.js +5 -0
- package/dist/i18n/ka.cjs.js +5 -0
- package/dist/i18n/ka.es.js +8 -0
- package/dist/i18n/ko.amd.js +5 -0
- package/dist/i18n/ko.cjs.js +5 -0
- package/dist/i18n/ko.es.js +8 -0
- package/dist/i18n/lt.amd.js +5 -0
- package/dist/i18n/lt.cjs.js +5 -0
- package/dist/i18n/lt.es.js +8 -0
- package/dist/i18n/mn.amd.js +5 -0
- package/dist/i18n/mn.cjs.js +5 -0
- package/dist/i18n/mn.es.js +8 -0
- package/dist/i18n/nl.amd.js +5 -0
- package/dist/i18n/nl.cjs.js +5 -0
- package/dist/i18n/nl.es.js +8 -0
- package/dist/i18n/no.amd.js +5 -0
- package/dist/i18n/no.cjs.js +5 -0
- package/dist/i18n/no.es.js +8 -0
- package/dist/i18n/pl.amd.js +5 -0
- package/dist/i18n/pl.cjs.js +5 -0
- package/dist/i18n/pl.es.js +8 -0
- package/dist/i18n/pt-br.amd.js +5 -0
- package/dist/i18n/pt-br.cjs.js +5 -0
- package/dist/i18n/pt-br.es.js +8 -0
- package/dist/i18n/ro.amd.js +5 -0
- package/dist/i18n/ro.cjs.js +5 -0
- package/dist/i18n/ro.es.js +8 -0
- package/dist/i18n/ru.amd.js +5 -0
- package/dist/i18n/ru.cjs.js +5 -0
- package/dist/i18n/ru.es.js +8 -0
- package/dist/i18n/sk.amd.js +5 -0
- package/dist/i18n/sk.cjs.js +5 -0
- package/dist/i18n/sk.es.js +8 -0
- package/dist/i18n/sl.amd.js +5 -0
- package/dist/i18n/sl.cjs.js +5 -0
- package/dist/i18n/sl.es.js +8 -0
- package/dist/i18n/sq.amd.js +5 -0
- package/dist/i18n/sq.cjs.js +5 -0
- package/dist/i18n/sq.es.js +8 -0
- package/dist/i18n/sr.amd.js +5 -0
- package/dist/i18n/sr.cjs.js +5 -0
- package/dist/i18n/sr.es.js +8 -0
- package/dist/i18n/sv.amd.js +5 -0
- package/dist/i18n/sv.cjs.js +5 -0
- package/dist/i18n/sv.es.js +8 -0
- package/dist/i18n/tr.amd.js +5 -0
- package/dist/i18n/tr.cjs.js +5 -0
- package/dist/i18n/tr.es.js +8 -0
- package/dist/i18n/uk.amd.js +5 -0
- package/dist/i18n/uk.cjs.js +5 -0
- package/dist/i18n/uk.es.js +8 -0
- package/dist/i18n/vi.amd.js +5 -0
- package/dist/i18n/vi.cjs.js +5 -0
- package/dist/i18n/vi.es.js +8 -0
- package/dist/i18n/zh-cn.amd.js +5 -0
- package/dist/i18n/zh-cn.cjs.js +5 -0
- package/dist/i18n/zh-cn.es.js +8 -0
- package/dist/i18n/zh-hk.amd.js +5 -0
- package/dist/i18n/zh-hk.cjs.js +5 -0
- package/dist/i18n/zh-hk.es.js +8 -0
- package/dist/vue-cal.amd.js +6 -0
- package/dist/vue-cal.cjs.js +6 -0
- package/dist/vue-cal.es.js +1058 -0
- package/dist/vue-cal.iife.js +6 -0
- package/dist/vuecal.css +1 -1
- package/package.json +50 -41
- package/dist/drag-and-drop.js +0 -1
- package/dist/i18n/ar.js +0 -1
- package/dist/i18n/bg.js +0 -1
- package/dist/i18n/bn.js +0 -1
- package/dist/i18n/bs.js +0 -1
- package/dist/i18n/ca.js +0 -1
- package/dist/i18n/cs.js +0 -1
- package/dist/i18n/da.js +0 -1
- package/dist/i18n/de.js +0 -1
- package/dist/i18n/el.js +0 -1
- package/dist/i18n/es.js +0 -1
- package/dist/i18n/fa.js +0 -1
- package/dist/i18n/fr.js +0 -1
- package/dist/i18n/he.js +0 -1
- package/dist/i18n/hr.js +0 -1
- package/dist/i18n/hu.js +0 -1
- package/dist/i18n/id.js +0 -1
- package/dist/i18n/is.js +0 -1
- package/dist/i18n/it.js +0 -1
- package/dist/i18n/ja.js +0 -1
- package/dist/i18n/ka.js +0 -1
- package/dist/i18n/ko.js +0 -1
- package/dist/i18n/lt.js +0 -1
- package/dist/i18n/mn.js +0 -1
- package/dist/i18n/nl.js +0 -1
- package/dist/i18n/no.js +0 -1
- package/dist/i18n/pl.js +0 -1
- package/dist/i18n/pt-br.js +0 -1
- package/dist/i18n/ro.js +0 -1
- package/dist/i18n/ru.js +0 -1
- package/dist/i18n/sk.js +0 -1
- package/dist/i18n/sl.js +0 -1
- package/dist/i18n/sq.js +0 -1
- package/dist/i18n/sr.js +0 -1
- package/dist/i18n/sv.js +0 -1
- package/dist/i18n/tr.js +0 -1
- package/dist/i18n/uk.js +0 -1
- package/dist/i18n/vi.js +0 -1
- package/dist/i18n/zh-cn.js +0 -1
- package/dist/i18n/zh-hk.js +0 -1
- package/dist/vuecal.common.js +0 -11662
- package/dist/vuecal.umd.js +0 -11672
- package/dist/vuecal.umd.min.js +0 -1
|
@@ -0,0 +1,1058 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
/*!
|
|
8
|
+
* vue-cal v4.3.2
|
|
9
|
+
* (c) 2022 Antoni Andre <antoniandre.web@gmail.com>
|
|
10
|
+
* @license MIT
|
|
11
|
+
*/
|
|
12
|
+
import { openBlock as e, createElementBlock as t, Fragment as s, renderList as i, normalizeClass as n, normalizeStyle as a, createVNode as l, Transition as r, withCtx as o, createElementVNode as d, renderSlot as u, toDisplayString as h, createCommentVNode as c, createTextVNode as v, resolveComponent as p, createBlock as m, resolveDynamicComponent as w, createSlots as y, withKeys as D, withModifiers as g, TransitionGroup as f, normalizeProps as _, mergeProps as b } from "vue";
|
|
13
|
+
let k, M, T, E, C = {}, S = {};
|
|
14
|
+
class O {
|
|
15
|
+
constructor(e2) {
|
|
16
|
+
__publicField(this, "_vuecal", null);
|
|
17
|
+
__publicField(this, "selectCell", (e2 = false, t2, s2) => {
|
|
18
|
+
this._vuecal.$emit("cell-click", s2 ? { date: t2, split: s2 } : t2), this._vuecal.clickToNavigate || e2 ? this._vuecal.switchToNarrowerView() : this._vuecal.dblclickToNavigate && "ontouchstart" in window && (this._vuecal.domEvents.dblTapACell.taps++, setTimeout(() => this._vuecal.domEvents.dblTapACell.taps = 0, this._vuecal.domEvents.dblTapACell.timeout), this._vuecal.domEvents.dblTapACell.taps >= 2 && (this._vuecal.domEvents.dblTapACell.taps = 0, this._vuecal.switchToNarrowerView(), this._vuecal.$emit("cell-dblclick", s2 ? { date: t2, split: s2 } : t2)));
|
|
19
|
+
});
|
|
20
|
+
__publicField(this, "keyPressEnterCell", (e2, t2) => {
|
|
21
|
+
this._vuecal.$emit("cell-keypress-enter", t2 ? { date: e2, split: t2 } : e2), this._vuecal.switchToNarrowerView();
|
|
22
|
+
});
|
|
23
|
+
__publicField(this, "getPosition", (e2) => {
|
|
24
|
+
const { left: t2, top: s2 } = this._vuecal.cellsEl.getBoundingClientRect(), { clientX: i2, clientY: n2 } = "ontouchstart" in window && e2.touches ? e2.touches[0] : e2;
|
|
25
|
+
return { x: i2 - t2, y: n2 - s2 };
|
|
26
|
+
});
|
|
27
|
+
__publicField(this, "minutesAtCursor", (e2) => {
|
|
28
|
+
let t2 = 0, s2 = { x: 0, y: 0 };
|
|
29
|
+
const { timeStep: i2, timeCellHeight: n2, timeFrom: a2 } = this._vuecal.$props;
|
|
30
|
+
return "number" == typeof e2 ? t2 = e2 : "object" == typeof e2 && (s2 = this.getPosition(e2), t2 = Math.round(s2.y * i2 / parseInt(n2) + a2)), { minutes: Math.max(Math.min(t2, 1440), 0), cursorCoords: s2 };
|
|
31
|
+
});
|
|
32
|
+
this._vuecal = e2;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
let $, x, H;
|
|
36
|
+
class W {
|
|
37
|
+
constructor(e2, t2) {
|
|
38
|
+
__publicField(this, "_vuecal", null);
|
|
39
|
+
__publicField(this, "eventDefaults", { _eid: null, start: "", startTimeMinutes: 0, end: "", endTimeMinutes: 0, title: "", content: "", background: false, allDay: false, segments: null, repeat: null, daysCount: 1, deletable: true, deleting: false, titleEditable: true, resizable: true, resizing: false, draggable: true, dragging: false, draggingStatic: false, focused: false, class: "" });
|
|
40
|
+
this._vuecal = e2, $ = t2;
|
|
41
|
+
}
|
|
42
|
+
createAnEvent(e2, t2, s2) {
|
|
43
|
+
if ("string" == typeof e2 && (e2 = $.stringToDate(e2)), !(e2 instanceof Date))
|
|
44
|
+
return false;
|
|
45
|
+
const i2 = $.dateToMinutes(e2), n2 = i2 + (t2 = 1 * t2 || 120), a2 = $.addMinutes(new Date(e2), t2);
|
|
46
|
+
s2.end && ("string" == typeof s2.end && (s2.end = $.stringToDate(s2.end)), s2.endTimeMinutes = $.dateToMinutes(s2.end));
|
|
47
|
+
const l2 = { ...this.eventDefaults, _eid: `${this._vuecal._.uid}_${this._vuecal.eventIdIncrement++}`, start: e2, startTimeMinutes: i2, end: a2, endTimeMinutes: n2, segments: null, ...s2 };
|
|
48
|
+
return "function" != typeof this._vuecal.onEventCreate || this._vuecal.onEventCreate(l2, () => this.deleteAnEvent(l2)) ? (l2.startDateF !== l2.endDateF && (l2.daysCount = $.countDays(l2.start, l2.end)), this._vuecal.mutableEvents.push(l2), this._vuecal.addEventsToView([l2]), this._vuecal.emitWithEvent("event-create", l2), this._vuecal.$emit("event-change", { event: this._vuecal.cleanupEvent(l2), originalEvent: null }), l2) : void 0;
|
|
49
|
+
}
|
|
50
|
+
addEventSegment(e2) {
|
|
51
|
+
e2.segments || (e2.segments = {}, e2.segments[$.formatDateLite(e2.start)] = { start: e2.start, startTimeMinutes: e2.startTimeMinutes, endTimeMinutes: 1440, isFirstDay: true, isLastDay: false });
|
|
52
|
+
const t2 = e2.segments[$.formatDateLite(e2.end)];
|
|
53
|
+
t2 && (t2.isLastDay = false, t2.endTimeMinutes = 1440);
|
|
54
|
+
const s2 = $.addDays(e2.end, 1), i2 = $.formatDateLite(s2);
|
|
55
|
+
return s2.setHours(0, 0, 0, 0), e2.segments[i2] = { start: s2, startTimeMinutes: 0, endTimeMinutes: e2.endTimeMinutes, isFirstDay: false, isLastDay: true }, e2.end = $.addMinutes(s2, e2.endTimeMinutes), e2.daysCount = Object.keys(e2.segments).length, i2;
|
|
56
|
+
}
|
|
57
|
+
removeEventSegment(e2) {
|
|
58
|
+
let t2 = Object.keys(e2.segments).length;
|
|
59
|
+
if (t2 <= 1)
|
|
60
|
+
return $.formatDateLite(e2.end);
|
|
61
|
+
delete e2.segments[$.formatDateLite(e2.end)], t2--;
|
|
62
|
+
const s2 = $.subtractDays(e2.end, 1), i2 = $.formatDateLite(s2), n2 = e2.segments[i2];
|
|
63
|
+
return t2 ? n2 && (n2.isLastDay = true, n2.endTimeMinutes = e2.endTimeMinutes) : e2.segments = null, e2.daysCount = t2 || 1, e2.end = s2, i2;
|
|
64
|
+
}
|
|
65
|
+
createEventSegments(e2, t2, s2) {
|
|
66
|
+
const i2 = t2.getTime(), n2 = s2.getTime();
|
|
67
|
+
let a2, l2, r2, o2 = e2.start.getTime(), d2 = e2.end.getTime(), u2 = false;
|
|
68
|
+
for (e2.end.getHours() || e2.end.getMinutes() || (d2 -= 1e3), e2.segments = {}, e2.repeat ? (a2 = i2, l2 = Math.min(n2, e2.repeat.until ? $.stringToDate(e2.repeat.until).getTime() : n2)) : (a2 = Math.max(i2, o2), l2 = Math.min(n2, d2)); a2 <= l2; ) {
|
|
69
|
+
let t3 = false;
|
|
70
|
+
const s3 = $.addDays(new Date(a2), 1).setHours(0, 0, 0, 0);
|
|
71
|
+
let i3, n3, h2, c2;
|
|
72
|
+
if (e2.repeat) {
|
|
73
|
+
const s4 = new Date(a2), l3 = $.formatDateLite(s4);
|
|
74
|
+
(u2 || e2.occurrences && e2.occurrences[l3]) && (u2 || (o2 = e2.occurrences[l3].start, r2 = new Date(o2).setHours(0, 0, 0, 0), d2 = e2.occurrences[l3].end), u2 = true, t3 = true), i3 = a2 === r2, n3 = l3 === $.formatDateLite(new Date(d2)), h2 = new Date(i3 ? o2 : a2), c2 = $.formatDateLite(h2), n3 && (u2 = false);
|
|
75
|
+
} else
|
|
76
|
+
t3 = true, i3 = a2 === o2, n3 = l2 === d2 && s3 > l2, h2 = i3 ? e2.start : new Date(a2), c2 = $.formatDateLite(i3 ? e2.start : h2);
|
|
77
|
+
t3 && (e2.segments[c2] = { start: h2, startTimeMinutes: i3 ? e2.startTimeMinutes : 0, endTimeMinutes: n3 ? e2.endTimeMinutes : 1440, isFirstDay: i3, isLastDay: n3 }), a2 = s3;
|
|
78
|
+
}
|
|
79
|
+
return e2;
|
|
80
|
+
}
|
|
81
|
+
deleteAnEvent(e2) {
|
|
82
|
+
this._vuecal.emitWithEvent("event-delete", e2), this._vuecal.mutableEvents = this._vuecal.mutableEvents.filter((t2) => t2._eid !== e2._eid), this._vuecal.view.events = this._vuecal.view.events.filter((t2) => t2._eid !== e2._eid);
|
|
83
|
+
}
|
|
84
|
+
checkCellOverlappingEvents(e2, t2) {
|
|
85
|
+
H = e2.slice(0), x = {}, e2.forEach((e3) => {
|
|
86
|
+
H.shift(), x[e3._eid] || (x[e3._eid] = { overlaps: [], start: e3.start, position: 0 }), x[e3._eid].position = 0, H.forEach((s3) => {
|
|
87
|
+
x[s3._eid] || (x[s3._eid] = { overlaps: [], start: s3.start, position: 0 });
|
|
88
|
+
const i2 = this.eventInRange(s3, e3.start, e3.end), n2 = t2.overlapsPerTimeStep ? $.datesInSameTimeStep(e3.start, s3.start, t2.timeStep) : 1;
|
|
89
|
+
if (e3.background || e3.allDay || s3.background || s3.allDay || !i2 || !n2) {
|
|
90
|
+
let t3, i3;
|
|
91
|
+
(t3 = (x[e3._eid] || { overlaps: [] }).overlaps.indexOf(s3._eid)) > -1 && x[e3._eid].overlaps.splice(t3, 1), (i3 = (x[s3._eid] || { overlaps: [] }).overlaps.indexOf(e3._eid)) > -1 && x[s3._eid].overlaps.splice(i3, 1), x[s3._eid].position--;
|
|
92
|
+
} else
|
|
93
|
+
x[e3._eid].overlaps.push(s3._eid), x[e3._eid].overlaps = [...new Set(x[e3._eid].overlaps)], x[s3._eid].overlaps.push(e3._eid), x[s3._eid].overlaps = [...new Set(x[s3._eid].overlaps)], x[s3._eid].position++;
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
let s2 = 0;
|
|
97
|
+
for (const e3 in x) {
|
|
98
|
+
const t3 = x[e3], i2 = t3.overlaps.map((e4) => ({ id: e4, start: x[e4].start }));
|
|
99
|
+
i2.push({ id: e3, start: t3.start }), i2.sort((e4, t4) => e4.start < t4.start ? -1 : e4.start > t4.start ? 1 : e4.id > t4.id ? -1 : 1), t3.position = i2.findIndex((t4) => t4.id === e3), s2 = Math.max(this.getOverlapsStreak(t3, x), s2);
|
|
100
|
+
}
|
|
101
|
+
return [x, s2];
|
|
102
|
+
}
|
|
103
|
+
getOverlapsStreak(e2, t2 = {}) {
|
|
104
|
+
let s2 = e2.overlaps.length + 1, i2 = [];
|
|
105
|
+
return e2.overlaps.forEach((s3) => {
|
|
106
|
+
if (!i2.includes(s3)) {
|
|
107
|
+
e2.overlaps.filter((e3) => e3 !== s3).forEach((e3) => {
|
|
108
|
+
t2[e3].overlaps.includes(s3) || i2.push(e3);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}), i2 = [...new Set(i2)], s2 -= i2.length, s2;
|
|
112
|
+
}
|
|
113
|
+
eventInRange(e2, t2, s2) {
|
|
114
|
+
if (e2.allDay || !this._vuecal.time) {
|
|
115
|
+
const i3 = new Date(e2.start).setHours(0, 0, 0, 0);
|
|
116
|
+
return new Date(e2.end).setHours(23, 59, 0, 0) >= new Date(t2).setHours(0, 0, 0, 0) && i3 <= new Date(s2).setHours(0, 0, 0, 0);
|
|
117
|
+
}
|
|
118
|
+
const i2 = e2.start.getTime(), n2 = e2.end.getTime();
|
|
119
|
+
return i2 < s2.getTime() && n2 > t2.getTime();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const j = { class: "vuecal__flex vuecal__weekdays-headings" }, A = ["onClick"], V = { class: "vuecal__flex weekday-label", grow: "" }, Y = { class: "full" }, L = { class: "small" }, F = { class: "xsmall" }, B = { key: 0 }, N = { key: 0, class: "vuecal__flex vuecal__split-days-headers", grow: "" };
|
|
123
|
+
var z = (e2, t2) => {
|
|
124
|
+
const s2 = e2.__vccOpts || e2;
|
|
125
|
+
for (const [e3, i2] of t2)
|
|
126
|
+
s2[e3] = i2;
|
|
127
|
+
return s2;
|
|
128
|
+
};
|
|
129
|
+
var I = z({ inject: ["vuecal", "utils", "view"], props: { transitionDirection: { type: String, default: "right" }, weekDays: { type: Array, default: () => [] }, switchToNarrowerView: { type: Function, default: () => {
|
|
130
|
+
} } }, methods: { selectCell(e2, t2) {
|
|
131
|
+
e2.getTime() !== this.view.selectedDate.getTime() && (this.view.selectedDate = e2), this.utils.cell.selectCell(false, e2, t2);
|
|
132
|
+
}, cleanupHeading: (e2) => ({ label: e2.full, date: e2.date, ...e2.today ? { today: e2.today } : {} }) }, computed: { headings() {
|
|
133
|
+
if (!["month", "week"].includes(this.view.id))
|
|
134
|
+
return [];
|
|
135
|
+
let e2 = false;
|
|
136
|
+
return this.weekDays.map((t2, s2) => {
|
|
137
|
+
const i2 = this.utils.date.addDays(this.view.startDate, s2);
|
|
138
|
+
return { hide: t2.hide, full: t2.label, small: t2.short || t2.label.substr(0, 3), xsmall: t2.short || t2.label.substr(0, 1), ..."week" === this.view.id ? { dayOfMonth: i2.getDate(), date: i2, today: !e2 && this.utils.date.isToday(i2) && !e2++ } : {} };
|
|
139
|
+
});
|
|
140
|
+
}, cellWidth() {
|
|
141
|
+
return 100 / (7 - this.weekDays.reduce((e2, t2) => e2 + t2.hide, 0));
|
|
142
|
+
}, weekdayCellStyles() {
|
|
143
|
+
return { ...this.vuecal.hideWeekdays.length ? { width: `${this.cellWidth}%` } : {} };
|
|
144
|
+
}, cellHeadingsClickable() {
|
|
145
|
+
return "week" === this.view.id && (this.vuecal.clickToNavigate || this.vuecal.dblclickToNavigate);
|
|
146
|
+
} } }, [["render", function(p2, m2, w2, y2, D2, g2) {
|
|
147
|
+
return e(), t("div", j, [(e(true), t(s, null, i(g2.headings, (y3, D3) => (e(), t(s, { key: D3 }, [y3.hide ? c("", true) : (e(), t("div", { key: 0, class: n(["vuecal__flex vuecal__heading", { today: y3.today, clickable: g2.cellHeadingsClickable }]), style: a(g2.weekdayCellStyles), onClick: (e2) => "week" === g2.view.id && g2.selectCell(y3.date, e2), onDblclick: m2[0] || (m2[0] = (e2) => "week" === g2.view.id && g2.vuecal.dblclickToNavigate && w2.switchToNarrowerView()) }, [l(r, { name: `slide-fade--${w2.transitionDirection}`, appear: g2.vuecal.transitions }, { default: o(() => [(e(), t("div", { class: "vuecal__flex", column: "", key: !!g2.vuecal.transitions && `${D3}-${y3.dayOfMonth}` }, [d("div", V, [u(p2.$slots, "weekday-heading", { heading: g2.cleanupHeading(y3), view: g2.view }, () => [d("span", Y, h(y3.full), 1), d("span", L, h(y3.small), 1), d("span", F, h(y3.xsmall), 1), y3.dayOfMonth ? (e(), t("span", B, "\xA0" + h(y3.dayOfMonth), 1)) : c("", true)])]), g2.vuecal.hasSplits && g2.vuecal.stickySplitLabels ? (e(), t("div", N, [(e(true), t(s, null, i(g2.vuecal.daySplits, (s2, i2) => (e(), t("div", { class: n(["day-split-header", s2.class || false]), key: i2 }, [u(p2.$slots, "split-label", { split: s2, view: g2.view }, () => [v(h(s2.label), 1)])], 2))), 128))])) : c("", true)]))]), _: 2 }, 1032, ["name", "appear"])], 46, A))], 64))), 128))]);
|
|
148
|
+
}]]);
|
|
149
|
+
const P = { class: "vuecal__header" }, U = { key: 0, class: "vuecal__flex vuecal__menu", role: "tablist", "aria-label": "Calendar views navigation" }, R = ["onDragenter", "onDragleave", "onClick", "aria-label"], q = { key: 1, class: "vuecal__title-bar" }, K = ["aria-label"], X = { class: "vuecal__flex vuecal__title", grow: "" }, G = ["aria-label"], Z = { key: 0, class: "vuecal__flex vuecal__split-days-headers" };
|
|
150
|
+
var J = z({ inject: ["vuecal", "previous", "next", "switchView", "updateSelectedDate", "modules", "view"], components: { WeekdaysHeadings: I }, props: { options: { type: Object, default: () => ({}) }, editEvents: { type: Object, required: true }, hasSplits: { type: [Boolean, Number], default: false }, daySplits: { type: Array, default: () => [] }, viewProps: { type: Object, default: () => ({}) }, weekDays: { type: Array, default: () => [] }, switchToNarrowerView: { type: Function, default: () => {
|
|
151
|
+
} } }, data: () => ({ highlightedControl: null }), methods: { goToToday() {
|
|
152
|
+
this.updateSelectedDate(new Date(new Date().setHours(0, 0, 0, 0)));
|
|
153
|
+
}, switchToBroaderView() {
|
|
154
|
+
this.transitionDirection = "left", this.broaderView && this.switchView(this.broaderView);
|
|
155
|
+
} }, computed: { transitionDirection: { get() {
|
|
156
|
+
return this.vuecal.transitionDirection;
|
|
157
|
+
}, set(e2) {
|
|
158
|
+
this.vuecal.transitionDirection = e2;
|
|
159
|
+
} }, broaderView() {
|
|
160
|
+
const { enabledViews: e2 } = this.vuecal;
|
|
161
|
+
return e2[e2.indexOf(this.view.id) - 1];
|
|
162
|
+
}, showDaySplits() {
|
|
163
|
+
return "day" === this.view.id && this.hasSplits && this.options.stickySplitLabels && !this.options.minSplitWidth;
|
|
164
|
+
}, dnd() {
|
|
165
|
+
return this.modules.dnd;
|
|
166
|
+
} } }, [["render", function(a2, D2, g2, f2, _2, b2) {
|
|
167
|
+
const k2 = p("weekdays-headings");
|
|
168
|
+
return e(), t("div", P, [g2.options.hideViewSelector ? c("", true) : (e(), t("div", U, [(e(true), t(s, null, i(g2.viewProps.views, (i2, l2) => (e(), t(s, { key: l2 }, [i2.enabled ? (e(), t("button", { key: 0, class: n(["vuecal__view-btn", { "vuecal__view-btn--active": b2.view.id === l2, "vuecal__view-btn--highlighted": a2.highlightedControl === l2 }]), type: "button", onDragenter: (e2) => g2.editEvents.drag && b2.dnd && b2.dnd.viewSelectorDragEnter(e2, l2, a2.$data), onDragleave: (e2) => g2.editEvents.drag && b2.dnd && b2.dnd.viewSelectorDragLeave(e2, l2, a2.$data), onClick: (e2) => b2.switchView(l2, null, true), "aria-label": `${i2.label} view` }, h(i2.label), 43, R)) : c("", true)], 64))), 128))])), g2.options.hideTitleBar ? c("", true) : (e(), t("div", q, [d("button", { class: n(["vuecal__arrow vuecal__arrow--prev", { "vuecal__arrow--highlighted": "previous" === a2.highlightedControl }]), type: "button", onClick: D2[0] || (D2[0] = (...e2) => b2.previous && b2.previous(...e2)), onDragenter: D2[1] || (D2[1] = (e2) => g2.editEvents.drag && b2.dnd && b2.dnd.viewSelectorDragEnter(e2, "previous", a2.$data)), onDragleave: D2[2] || (D2[2] = (e2) => g2.editEvents.drag && b2.dnd && b2.dnd.viewSelectorDragLeave(e2, "previous", a2.$data)), "aria-label": `Previous ${b2.view.id}` }, [u(a2.$slots, "arrow-prev")], 42, K), d("div", X, [l(r, { name: g2.options.transitions ? `slide-fade--${b2.transitionDirection}` : "" }, { default: o(() => [(e(), m(w(b2.broaderView ? "button" : "span"), { type: !!b2.broaderView && "button", key: `${b2.view.id}${b2.view.startDate.toString()}`, onClick: D2[3] || (D2[3] = (e2) => !!b2.broaderView && b2.switchToBroaderView()), "aria-label": !!b2.broaderView && `Go to ${b2.broaderView} view` }, { default: o(() => [u(a2.$slots, "title")]), _: 3 }, 8, ["type", "aria-label"]))]), _: 3 }, 8, ["name"])]), g2.options.todayButton ? (e(), t("button", { key: 0, class: n(["vuecal__today-btn", { "vuecal__today-btn--highlighted": "today" === a2.highlightedControl }]), type: "button", onClick: D2[4] || (D2[4] = (...e2) => b2.goToToday && b2.goToToday(...e2)), onDragenter: D2[5] || (D2[5] = (e2) => g2.editEvents.drag && b2.dnd && b2.dnd.viewSelectorDragEnter(e2, "today", a2.$data)), onDragleave: D2[6] || (D2[6] = (e2) => g2.editEvents.drag && b2.dnd && b2.dnd.viewSelectorDragLeave(e2, "today", a2.$data)), "aria-label": "Today" }, [u(a2.$slots, "today-button")], 34)) : c("", true), d("button", { class: n(["vuecal__arrow vuecal__arrow--next", { "vuecal__arrow--highlighted": "next" === a2.highlightedControl }]), type: "button", onClick: D2[7] || (D2[7] = (...e2) => b2.next && b2.next(...e2)), onDragenter: D2[8] || (D2[8] = (e2) => g2.editEvents.drag && b2.dnd && b2.dnd.viewSelectorDragEnter(e2, "next", a2.$data)), onDragleave: D2[9] || (D2[9] = (e2) => g2.editEvents.drag && b2.dnd && b2.dnd.viewSelectorDragLeave(e2, "next", a2.$data)), "aria-label": `Next ${b2.view.id}` }, [u(a2.$slots, "arrow-next")], 42, G)])), g2.viewProps.weekDaysInHeader ? (e(), m(k2, { key: 2, "week-days": g2.weekDays, "transition-direction": b2.transitionDirection, "switch-to-narrower-view": g2.switchToNarrowerView }, y({ _: 2 }, [a2.$slots["weekday-heading"] ? { name: "weekday-heading", fn: o(({ heading: e2, view: t2 }) => [u(a2.$slots, "weekday-heading", { heading: e2, view: t2 })]) } : void 0, a2.$slots["split-label"] ? { name: "split-label", fn: o(({ split: e2 }) => [u(a2.$slots, "split-label", { split: e2, view: b2.view })]) } : void 0]), 1032, ["week-days", "transition-direction", "switch-to-narrower-view"])) : c("", true), l(r, { name: `slide-fade--${b2.transitionDirection}` }, { default: o(() => [b2.showDaySplits ? (e(), t("div", Z, [(e(true), t(s, null, i(g2.daySplits, (s2, i2) => (e(), t("div", { class: n(["day-split-header", s2.class || false]), key: i2 }, [u(a2.$slots, "split-label", { split: s2, view: b2.view.id }, () => [v(h(s2.label), 1)])], 2))), 128))])) : c("", true)]), _: 3 }, 8, ["name"])]);
|
|
169
|
+
}]]);
|
|
170
|
+
const Q = ["draggable"];
|
|
171
|
+
const ee = { inject: ["vuecal", "utils", "modules", "view", "domEvents", "editEvents"], props: { cellFormattedDate: { type: String, default: "" }, event: { type: Object, default: () => ({}) }, cellEvents: { type: Array, default: () => [] }, overlaps: { type: Array, default: () => [] }, eventPosition: { type: Number, default: 0 }, overlapsStreak: { type: Number, default: 0 }, allDay: { type: Boolean, default: false } }, data: () => ({ touch: { dragThreshold: 30, startX: 0, startY: 0, dragged: false } }), methods: { onMouseDown(e2, t2 = false) {
|
|
172
|
+
if ("ontouchstart" in window && !t2)
|
|
173
|
+
return false;
|
|
174
|
+
const { clickHoldAnEvent: s2, focusAnEvent: i2, resizeAnEvent: n2, dragAnEvent: a2 } = this.domEvents;
|
|
175
|
+
if (i2._eid === this.event._eid && s2._eid === this.event._eid)
|
|
176
|
+
return true;
|
|
177
|
+
this.focusEvent(), s2._eid = null, this.vuecal.editEvents.delete && this.event.deletable && (s2.timeoutId = setTimeout(() => {
|
|
178
|
+
n2._eid || a2._eid || (s2._eid = this.event._eid, this.event.deleting = true);
|
|
179
|
+
}, s2.timeout));
|
|
180
|
+
}, onMouseUp(e2) {
|
|
181
|
+
this.domEvents.focusAnEvent._eid !== this.event._eid || this.touch.dragged || (this.domEvents.focusAnEvent.mousedUp = true), this.touch.dragged = false;
|
|
182
|
+
}, onMouseEnter(e2) {
|
|
183
|
+
e2.preventDefault(), this.vuecal.emitWithEvent("event-mouse-enter", this.event);
|
|
184
|
+
}, onMouseLeave(e2) {
|
|
185
|
+
e2.preventDefault(), this.vuecal.emitWithEvent("event-mouse-leave", this.event);
|
|
186
|
+
}, onTouchMove(e2) {
|
|
187
|
+
if ("function" != typeof this.vuecal.onEventClick)
|
|
188
|
+
return;
|
|
189
|
+
const { clientX: t2, clientY: s2 } = e2.touches[0], { startX: i2, startY: n2, dragThreshold: a2 } = this.touch;
|
|
190
|
+
(Math.abs(t2 - i2) > a2 || Math.abs(s2 - n2) > a2) && (this.touch.dragged = true);
|
|
191
|
+
}, onTouchStart(e2) {
|
|
192
|
+
this.touch.startX = e2.touches[0].clientX, this.touch.startY = e2.touches[0].clientY, this.onMouseDown(e2, true);
|
|
193
|
+
}, onEnterKeypress(e2) {
|
|
194
|
+
if ("function" == typeof this.vuecal.onEventClick)
|
|
195
|
+
return this.vuecal.onEventClick(this.event, e2);
|
|
196
|
+
}, onDblClick(e2) {
|
|
197
|
+
if ("function" == typeof this.vuecal.onEventDblclick)
|
|
198
|
+
return this.vuecal.onEventDblclick(this.event, e2);
|
|
199
|
+
}, onDragStart(e2) {
|
|
200
|
+
this.dnd && this.dnd.eventDragStart(e2, this.event);
|
|
201
|
+
}, onDragEnd() {
|
|
202
|
+
this.dnd && this.dnd.eventDragEnd(this.event);
|
|
203
|
+
}, onResizeHandleMouseDown() {
|
|
204
|
+
this.focusEvent(), this.domEvents.dragAnEvent._eid = null, this.domEvents.resizeAnEvent = Object.assign(this.domEvents.resizeAnEvent, { _eid: this.event._eid, start: (this.segment || this.event).start, split: this.event.split || null, segment: !!this.segment && this.utils.date.formatDateLite(this.segment.start), originalEnd: new Date((this.segment || this.event).end), originalEndTimeMinutes: this.event.endTimeMinutes }), this.event.resizing = true;
|
|
205
|
+
}, deleteEvent(e2 = false) {
|
|
206
|
+
if ("ontouchstart" in window && !e2)
|
|
207
|
+
return false;
|
|
208
|
+
this.utils.event.deleteAnEvent(this.event);
|
|
209
|
+
}, touchDeleteEvent(e2) {
|
|
210
|
+
this.deleteEvent(true);
|
|
211
|
+
}, cancelDeleteEvent() {
|
|
212
|
+
this.event.deleting = false;
|
|
213
|
+
}, focusEvent() {
|
|
214
|
+
const { focusAnEvent: e2 } = this.domEvents, t2 = e2._eid;
|
|
215
|
+
if (t2 !== this.event._eid) {
|
|
216
|
+
if (t2) {
|
|
217
|
+
const e3 = this.view.events.find((e4) => e4._eid === t2);
|
|
218
|
+
e3 && (e3.focused = false);
|
|
219
|
+
}
|
|
220
|
+
this.vuecal.cancelDelete(), this.vuecal.emitWithEvent("event-focus", this.event), e2._eid = this.event._eid, this.event.focused = true;
|
|
221
|
+
}
|
|
222
|
+
} }, computed: { eventDimensions() {
|
|
223
|
+
const { startTimeMinutes: e2, endTimeMinutes: t2 } = this.segment || this.event;
|
|
224
|
+
let s2 = e2 - this.vuecal.timeFrom;
|
|
225
|
+
const i2 = Math.max(Math.round(s2 * this.vuecal.timeCellHeight / this.vuecal.timeStep), 0);
|
|
226
|
+
s2 = Math.min(t2, this.vuecal.timeTo) - this.vuecal.timeFrom;
|
|
227
|
+
const n2 = Math.round(s2 * this.vuecal.timeCellHeight / this.vuecal.timeStep);
|
|
228
|
+
return { top: i2, height: Math.max(n2 - i2, 5) };
|
|
229
|
+
}, eventStyles() {
|
|
230
|
+
if (this.event.allDay || !this.vuecal.time || !this.event.endTimeMinutes || "month" === this.view.id || this.allDay)
|
|
231
|
+
return {};
|
|
232
|
+
let e2 = 100 / Math.min(this.overlaps.length + 1, this.overlapsStreak), t2 = 100 / (this.overlaps.length + 1) * this.eventPosition;
|
|
233
|
+
this.vuecal.minEventWidth && e2 < this.vuecal.minEventWidth && (e2 = this.vuecal.minEventWidth, t2 = (100 - this.vuecal.minEventWidth) / this.overlaps.length * this.eventPosition);
|
|
234
|
+
const { top: s2, height: i2 } = this.eventDimensions;
|
|
235
|
+
return { top: `${s2}px`, height: `${i2}px`, width: `${e2}%`, left: this.event.left && `${this.event.left}px` || `${t2}%` };
|
|
236
|
+
}, eventClasses() {
|
|
237
|
+
const { isFirstDay: e2, isLastDay: t2 } = this.segment || {};
|
|
238
|
+
return { [this.event.class]: !!this.event.class, "vuecal__event--focus": this.event.focused, "vuecal__event--resizing": this.event.resizing, "vuecal__event--background": this.event.background, "vuecal__event--deletable": this.event.deleting, "vuecal__event--all-day": this.event.allDay, "vuecal__event--dragging": !this.event.draggingStatic && this.event.dragging, "vuecal__event--static": this.event.dragging && this.event.draggingStatic, "vuecal__event--multiple-days": !!this.segment, "event-start": this.segment && e2 && !t2, "event-middle": this.segment && !e2 && !t2, "event-end": this.segment && t2 && !e2 };
|
|
239
|
+
}, segment() {
|
|
240
|
+
return this.event.segments && this.event.segments[this.cellFormattedDate] || null;
|
|
241
|
+
}, draggable() {
|
|
242
|
+
const { draggable: e2, background: t2, daysCount: s2 } = this.event;
|
|
243
|
+
return this.vuecal.editEvents.drag && e2 && !t2 && 1 === s2;
|
|
244
|
+
}, resizable() {
|
|
245
|
+
const { editEvents: e2, time: t2 } = this.vuecal;
|
|
246
|
+
return e2.resize && this.event.resizable && t2 && !this.allDay && (!this.segment || this.segment && this.segment.isLastDay) && "month" !== this.view.id;
|
|
247
|
+
}, dnd() {
|
|
248
|
+
return this.modules.dnd;
|
|
249
|
+
} } };
|
|
250
|
+
const te = ["data-split", "aria-label", "onTouchstart", "onMousedown", "onDragover", "onDrop"], se = { key: 1, class: "vuecal__cell-events" }, ie = ["title"];
|
|
251
|
+
var ne = z({ inject: ["vuecal", "utils", "modules", "view", "domEvents"], components: { Event: z(ee, [["render", function(s2, i2, l2, r2, o2, d2) {
|
|
252
|
+
return e(), t("div", { class: n(["vuecal__event", d2.eventClasses]), style: a(d2.eventStyles), tabindex: "0", onFocus: i2[4] || (i2[4] = (...e2) => d2.focusEvent && d2.focusEvent(...e2)), onKeypress: i2[5] || (i2[5] = D(g((...e2) => d2.onEnterKeypress && d2.onEnterKeypress(...e2), ["stop"]), ["enter"])), onMouseenter: i2[6] || (i2[6] = (...e2) => d2.onMouseEnter && d2.onMouseEnter(...e2)), onMouseleave: i2[7] || (i2[7] = (...e2) => d2.onMouseLeave && d2.onMouseLeave(...e2)), onTouchstart: i2[8] || (i2[8] = g((...e2) => d2.onTouchStart && d2.onTouchStart(...e2), ["stop"])), onMousedown: i2[9] || (i2[9] = (e2) => d2.onMouseDown(e2)), onMouseup: i2[10] || (i2[10] = (...e2) => d2.onMouseUp && d2.onMouseUp(...e2)), onTouchend: i2[11] || (i2[11] = (...e2) => d2.onMouseUp && d2.onMouseUp(...e2)), onTouchmove: i2[12] || (i2[12] = (...e2) => d2.onTouchMove && d2.onTouchMove(...e2)), onDblclick: i2[13] || (i2[13] = (...e2) => d2.onDblClick && d2.onDblClick(...e2)), draggable: d2.draggable, onDragstart: i2[14] || (i2[14] = (e2) => d2.draggable && d2.onDragStart(e2)), onDragend: i2[15] || (i2[15] = (e2) => d2.draggable && d2.onDragEnd()) }, [d2.vuecal.editEvents.delete && l2.event.deletable ? (e(), t("div", { key: 0, class: "vuecal__event-delete", onClick: i2[0] || (i2[0] = g((...e2) => d2.deleteEvent && d2.deleteEvent(...e2), ["stop"])), onTouchstart: i2[1] || (i2[1] = g((...e2) => d2.touchDeleteEvent && d2.touchDeleteEvent(...e2), ["stop"])) }, h(d2.vuecal.texts.deleteEvent), 33)) : c("", true), u(s2.$slots, "event", { event: l2.event, view: d2.view.id }), d2.resizable ? (e(), t("div", { key: 1, class: "vuecal__event-resize-handle", contenteditable: "false", onMousedown: i2[2] || (i2[2] = g((...e2) => d2.onResizeHandleMouseDown && d2.onResizeHandleMouseDown(...e2), ["stop", "prevent"])), onTouchstart: i2[3] || (i2[3] = g((...e2) => d2.onResizeHandleMouseDown && d2.onResizeHandleMouseDown(...e2), ["stop", "prevent"])) }, null, 32)) : c("", true)], 46, Q);
|
|
253
|
+
}]]) }, props: { options: { type: Object, default: () => ({}) }, editEvents: { type: Object, required: true }, data: { type: Object, required: true }, cellSplits: { type: Array, default: () => [] }, minTimestamp: { type: [Number, null], default: null }, maxTimestamp: { type: [Number, null], default: null }, cellWidth: { type: [Number, Boolean], default: false }, allDay: { type: Boolean, default: false } }, data: () => ({ cellOverlaps: {}, cellOverlapsStreak: 1, timeAtCursor: null, highlighted: false, highlightedSplit: null }), methods: { getSplitAtCursor({ target: e2 }) {
|
|
254
|
+
let t2 = e2.classList.contains("vuecal__cell-split") ? e2 : this.vuecal.findAncestor(e2, "vuecal__cell-split");
|
|
255
|
+
return t2 && (t2 = t2.attributes["data-split"].value, parseInt(t2).toString() === t2.toString() && (t2 = parseInt(t2))), t2 || null;
|
|
256
|
+
}, splitClasses(e2) {
|
|
257
|
+
return { "vuecal__cell-split": true, "vuecal__cell-split--highlighted": this.highlightedSplit === e2.id, [e2.class]: !!e2.class };
|
|
258
|
+
}, checkCellOverlappingEvents() {
|
|
259
|
+
this.options.time && this.eventsCount && !this.splitsCount && (1 === this.eventsCount ? (this.cellOverlaps = [], this.cellOverlapsStreak = 1) : [this.cellOverlaps, this.cellOverlapsStreak] = this.utils.event.checkCellOverlappingEvents(this.events, this.options));
|
|
260
|
+
}, isDOMElementAnEvent(e2) {
|
|
261
|
+
return this.vuecal.isDOMElementAnEvent(e2);
|
|
262
|
+
}, selectCell(e2, t2 = false) {
|
|
263
|
+
const s2 = this.splitsCount ? this.getSplitAtCursor(e2) : null;
|
|
264
|
+
this.utils.cell.selectCell(t2, this.timeAtCursor, s2), this.timeAtCursor = null;
|
|
265
|
+
}, onCellkeyPressEnter(e2) {
|
|
266
|
+
this.isSelected || this.onCellFocus(e2);
|
|
267
|
+
const t2 = this.splitsCount ? this.getSplitAtCursor(e2) : null;
|
|
268
|
+
this.utils.cell.keyPressEnterCell(this.timeAtCursor, t2), this.timeAtCursor = null;
|
|
269
|
+
}, onCellFocus(e2) {
|
|
270
|
+
if (!this.isSelected && !this.isDisabled) {
|
|
271
|
+
this.isSelected = this.data.startDate;
|
|
272
|
+
const t2 = this.splitsCount ? this.getSplitAtCursor(e2) : null, s2 = this.timeAtCursor || this.data.startDate;
|
|
273
|
+
this.vuecal.$emit("cell-focus", t2 ? { date: s2, split: t2 } : s2);
|
|
274
|
+
}
|
|
275
|
+
}, onCellMouseDown(e2, t2 = null, s2 = false) {
|
|
276
|
+
if ("ontouchstart" in window && !s2)
|
|
277
|
+
return false;
|
|
278
|
+
this.isSelected || this.onCellFocus(e2);
|
|
279
|
+
const { clickHoldACell: i2, focusAnEvent: n2 } = this.domEvents;
|
|
280
|
+
this.domEvents.cancelClickEventCreation = false, i2.eventCreated = false, this.timeAtCursor = new Date(this.data.startDate);
|
|
281
|
+
const { minutes: a2, cursorCoords: { y: l2 } } = this.vuecal.minutesAtCursor(e2);
|
|
282
|
+
this.timeAtCursor.setMinutes(a2);
|
|
283
|
+
const r2 = this.isDOMElementAnEvent(e2.target);
|
|
284
|
+
!r2 && n2._eid && ((this.view.events.find((e3) => e3._eid === n2._eid) || {}).focused = false), this.editEvents.create && !r2 && this.setUpEventCreation(e2, l2);
|
|
285
|
+
}, setUpEventCreation(e2, t2) {
|
|
286
|
+
if (this.options.dragToCreateEvent && ["week", "day"].includes(this.view.id)) {
|
|
287
|
+
const { dragCreateAnEvent: s2 } = this.domEvents;
|
|
288
|
+
if (s2.startCursorY = t2, s2.split = this.splitsCount ? this.getSplitAtCursor(e2) : null, s2.start = this.timeAtCursor, this.options.snapToTime) {
|
|
289
|
+
let e3 = 60 * this.timeAtCursor.getHours() + this.timeAtCursor.getMinutes();
|
|
290
|
+
const t3 = e3 + this.options.snapToTime / 2;
|
|
291
|
+
e3 = t3 - t3 % this.options.snapToTime, s2.start.setHours(0, e3, 0, 0);
|
|
292
|
+
}
|
|
293
|
+
} else
|
|
294
|
+
this.options.cellClickHold && ["month", "week", "day"].includes(this.view.id) && this.setUpCellHoldTimer(e2);
|
|
295
|
+
}, setUpCellHoldTimer(e2) {
|
|
296
|
+
const { clickHoldACell: t2 } = this.domEvents;
|
|
297
|
+
t2.cellId = `${this.vuecal._.uid}_${this.data.formattedDate}`, t2.split = this.splitsCount ? this.getSplitAtCursor(e2) : null, t2.timeoutId = setTimeout(() => {
|
|
298
|
+
if (t2.cellId && !this.domEvents.cancelClickEventCreation) {
|
|
299
|
+
const { _eid: e3 } = this.utils.event.createAnEvent(this.timeAtCursor, null, t2.split ? { split: t2.split } : {});
|
|
300
|
+
t2.eventCreated = e3;
|
|
301
|
+
}
|
|
302
|
+
}, t2.timeout);
|
|
303
|
+
}, onCellTouchStart(e2, t2 = null) {
|
|
304
|
+
this.onCellMouseDown(e2, t2, true);
|
|
305
|
+
}, onCellClick(e2) {
|
|
306
|
+
this.isDOMElementAnEvent(e2.target) || this.selectCell(e2);
|
|
307
|
+
}, onCellDblClick(e2) {
|
|
308
|
+
const t2 = new Date(this.data.startDate);
|
|
309
|
+
t2.setMinutes(this.vuecal.minutesAtCursor(e2).minutes);
|
|
310
|
+
const s2 = this.splitsCount ? this.getSplitAtCursor(e2) : null;
|
|
311
|
+
this.vuecal.$emit("cell-dblclick", s2 ? { date: t2, split: s2 } : t2), this.options.dblclickToNavigate && this.vuecal.switchToNarrowerView();
|
|
312
|
+
}, onCellContextMenu(e2) {
|
|
313
|
+
e2.stopPropagation(), e2.preventDefault();
|
|
314
|
+
const t2 = new Date(this.data.startDate), { cursorCoords: s2, minutes: i2 } = this.vuecal.minutesAtCursor(e2);
|
|
315
|
+
t2.setMinutes(i2);
|
|
316
|
+
const n2 = this.splitsCount ? this.getSplitAtCursor(e2) : null;
|
|
317
|
+
this.vuecal.$emit("cell-contextmenu", { date: t2, ...s2, ...n2 || {}, e: e2 });
|
|
318
|
+
} }, computed: { dnd() {
|
|
319
|
+
return this.modules.dnd;
|
|
320
|
+
}, nowInMinutes() {
|
|
321
|
+
return this.utils.date.dateToMinutes(this.vuecal.now);
|
|
322
|
+
}, isBeforeMinDate() {
|
|
323
|
+
return null !== this.minTimestamp && this.minTimestamp > this.data.endDate.getTime();
|
|
324
|
+
}, isAfterMaxDate() {
|
|
325
|
+
return this.maxTimestamp && this.maxTimestamp < this.data.startDate.getTime();
|
|
326
|
+
}, isDisabled() {
|
|
327
|
+
const { disableDays: e2 } = this.options, { isYearsOrYearView: t2 } = this.vuecal;
|
|
328
|
+
return !(!e2.length || !e2.includes(this.data.formattedDate) || t2) || (this.isBeforeMinDate || this.isAfterMaxDate);
|
|
329
|
+
}, isSelected: { get() {
|
|
330
|
+
let e2 = false;
|
|
331
|
+
const { selectedDate: t2 } = this.view;
|
|
332
|
+
return e2 = "years" === this.view.id ? t2.getFullYear() === this.data.startDate.getFullYear() : "year" === this.view.id ? t2.getFullYear() === this.data.startDate.getFullYear() && t2.getMonth() === this.data.startDate.getMonth() : t2.getTime() === this.data.startDate.getTime(), e2;
|
|
333
|
+
}, set(e2) {
|
|
334
|
+
this.view.selectedDate = e2;
|
|
335
|
+
} }, isWeekOrDayView() {
|
|
336
|
+
return ["week", "day"].includes(this.view.id);
|
|
337
|
+
}, transitionDirection() {
|
|
338
|
+
return this.vuecal.transitionDirection;
|
|
339
|
+
}, specialHours() {
|
|
340
|
+
return this.data.specialHours.map((e2) => {
|
|
341
|
+
let { from: t2, to: s2 } = e2;
|
|
342
|
+
return t2 = Math.max(t2, this.options.timeFrom), s2 = Math.min(s2, this.options.timeTo), { ...e2, height: (s2 - t2) * this.timeScale, top: (t2 - this.options.timeFrom) * this.timeScale };
|
|
343
|
+
});
|
|
344
|
+
}, events() {
|
|
345
|
+
const { startDate: e2, endDate: t2 } = this.data;
|
|
346
|
+
let s2 = [];
|
|
347
|
+
if (!["years", "year"].includes(this.view.id) || this.options.eventsCountOnYearView) {
|
|
348
|
+
if (s2 = this.view.events.slice(0), "month" === this.view.id && s2.push(...this.view.outOfScopeEvents), s2 = s2.filter((s3) => this.utils.event.eventInRange(s3, e2, t2)), this.options.showAllDayEvents && "month" !== this.view.id && (s2 = s2.filter((e3) => !!e3.allDay === this.allDay)), this.options.time && this.isWeekOrDayView && !this.allDay) {
|
|
349
|
+
const { timeFrom: e3, timeTo: t3 } = this.options;
|
|
350
|
+
s2 = s2.filter((s3) => {
|
|
351
|
+
const i2 = s3.daysCount > 1 && s3.segments[this.data.formattedDate] || {}, n2 = 1 === s3.daysCount && s3.startTimeMinutes < t3 && s3.endTimeMinutes > e3, a2 = s3.daysCount > 1 && i2.startTimeMinutes < t3 && i2.endTimeMinutes > e3;
|
|
352
|
+
return s3.allDay || n2 || a2 || false;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
!this.options.time || !this.isWeekOrDayView || this.options.showAllDayEvents && this.allDay || s2.sort((e3, t3) => e3.start < t3.start ? -1 : 1), this.cellSplits.length || this.$nextTick(this.checkCellOverlappingEvents);
|
|
356
|
+
}
|
|
357
|
+
return s2;
|
|
358
|
+
}, eventsCount() {
|
|
359
|
+
return this.events.length;
|
|
360
|
+
}, splits() {
|
|
361
|
+
return this.cellSplits.map((e2, t2) => {
|
|
362
|
+
const s2 = this.events.filter((t3) => t3.split === e2.id), [i2, n2] = this.utils.event.checkCellOverlappingEvents(s2.filter((e3) => !e3.background && !e3.allDay), this.options);
|
|
363
|
+
return { ...e2, overlaps: i2, overlapsStreak: n2, events: s2 };
|
|
364
|
+
});
|
|
365
|
+
}, splitsCount() {
|
|
366
|
+
return this.splits.length;
|
|
367
|
+
}, cellClasses() {
|
|
368
|
+
return { [this.data.class]: !!this.data.class, "vuecal__cell--current": this.data.current, "vuecal__cell--today": this.data.today, "vuecal__cell--out-of-scope": this.data.outOfScope, "vuecal__cell--before-min": this.isDisabled && this.isBeforeMinDate, "vuecal__cell--after-max": this.isDisabled && this.isAfterMaxDate, "vuecal__cell--disabled": this.isDisabled, "vuecal__cell--selected": this.isSelected, "vuecal__cell--highlighted": this.highlighted, "vuecal__cell--has-splits": this.splitsCount, "vuecal__cell--has-events": this.eventsCount };
|
|
369
|
+
}, cellStyles() {
|
|
370
|
+
return { ...this.cellWidth ? { width: `${this.cellWidth}%` } : {} };
|
|
371
|
+
}, timelineVisible() {
|
|
372
|
+
const { time: e2, timeTo: t2 } = this.options;
|
|
373
|
+
return this.data.today && this.isWeekOrDayView && e2 && !this.allDay && this.nowInMinutes <= t2;
|
|
374
|
+
}, todaysTimePosition() {
|
|
375
|
+
if (!this.data.today || !this.options.time)
|
|
376
|
+
return;
|
|
377
|
+
const e2 = this.nowInMinutes - this.options.timeFrom;
|
|
378
|
+
return Math.round(e2 * this.timeScale);
|
|
379
|
+
}, timeScale() {
|
|
380
|
+
return this.options.timeCellHeight / this.options.timeStep;
|
|
381
|
+
} } }, [["render", function(l2, r2, d2, h2, v2, w2) {
|
|
382
|
+
const y2 = p("event");
|
|
383
|
+
return e(), m(f, { class: n(["vuecal__cell", w2.cellClasses]), name: `slide-fade--${w2.transitionDirection}`, tag: "div", appear: d2.options.transitions, style: a(w2.cellStyles) }, { default: o(() => [(e(true), t(s, null, i(w2.splitsCount ? w2.splits : 1, (h3, v3) => (e(), t("div", { class: n(["vuecal__flex vuecal__cell-content", w2.splitsCount && w2.splitClasses(h3)]), key: d2.options.transitions ? `${w2.view.id}-${d2.data.content}-${v3}` : v3, "data-split": !!w2.splitsCount && h3.id, column: "", tabindex: "0", "aria-label": d2.data.content, onFocus: r2[0] || (r2[0] = (e2) => w2.onCellFocus(e2)), onKeypress: r2[1] || (r2[1] = D((e2) => w2.onCellkeyPressEnter(e2), ["enter"])), onTouchstart: (e2) => !w2.isDisabled && w2.onCellTouchStart(e2, w2.splitsCount ? h3.id : null), onMousedown: (e2) => !w2.isDisabled && w2.onCellMouseDown(e2, w2.splitsCount ? h3.id : null), onClick: r2[2] || (r2[2] = (e2) => !w2.isDisabled && w2.onCellClick(e2)), onDblclick: r2[3] || (r2[3] = (e2) => !w2.isDisabled && w2.onCellDblClick(e2)), onContextmenu: r2[4] || (r2[4] = (e2) => !w2.isDisabled && d2.options.cellContextmenu && w2.onCellContextMenu(e2)), onDragenter: r2[5] || (r2[5] = (e2) => !w2.isDisabled && d2.editEvents.drag && w2.dnd && w2.dnd.cellDragEnter(e2, l2.$data, d2.data.startDate)), onDragover: (e2) => !w2.isDisabled && d2.editEvents.drag && w2.dnd && w2.dnd.cellDragOver(e2, l2.$data, d2.data.startDate, w2.splitsCount ? h3.id : null), onDragleave: r2[6] || (r2[6] = (e2) => !w2.isDisabled && d2.editEvents.drag && w2.dnd && w2.dnd.cellDragLeave(e2, l2.$data, d2.data.startDate)), onDrop: (e2) => !w2.isDisabled && d2.editEvents.drag && w2.dnd && w2.dnd.cellDragDrop(e2, l2.$data, d2.data.startDate, w2.splitsCount ? h3.id : null) }, [w2.isWeekOrDayView && !d2.allDay && w2.specialHours.length ? (e(true), t(s, { key: 0 }, i(w2.specialHours, (s2, i2) => (e(), t("div", { class: n(["vuecal__special-hours", `vuecal__special-hours--day${s2.day} ${s2.class}`]), style: a(`height: ${s2.height}px;top: ${s2.top}px`) }, null, 6))), 256)) : c("", true), u(l2.$slots, "cell-content", { events: w2.events, selectCell: (e2) => w2.selectCell(e2, true), split: !!w2.splitsCount && h3 }), w2.eventsCount && (w2.isWeekOrDayView || "month" === w2.view.id && d2.options.eventsOnMonthView) ? (e(), t("div", se, [(e(true), t(s, null, i(w2.splitsCount ? h3.events : w2.events, (t2, s2) => (e(), m(y2, { key: s2, "cell-formatted-date": d2.data.formattedDate, event: t2, "all-day": d2.allDay, "cell-events": w2.splitsCount ? h3.events : w2.events, overlaps: ((w2.splitsCount ? h3.overlaps[t2._eid] : l2.cellOverlaps[t2._eid]) || []).overlaps, "event-position": ((w2.splitsCount ? h3.overlaps[t2._eid] : l2.cellOverlaps[t2._eid]) || []).position, "overlaps-streak": w2.splitsCount ? h3.overlapsStreak : l2.cellOverlapsStreak }, { event: o(({ event: e2, view: t3 }) => [u(l2.$slots, "event", { view: t3, event: e2 })]), _: 2 }, 1032, ["cell-formatted-date", "event", "all-day", "cell-events", "overlaps", "event-position", "overlaps-streak"]))), 128))])) : c("", true)], 42, te))), 128)), w2.timelineVisible ? (e(), t("div", { class: "vuecal__now-line", style: a(`top: ${w2.todaysTimePosition}px`), key: d2.options.transitions ? `${w2.view.id}-now-line` : "now-line", title: w2.utils.date.formatTime(w2.vuecal.now) }, null, 12, ie)) : c("", true)]), _: 3 }, 8, ["class", "name", "appear", "style"]);
|
|
384
|
+
}]]);
|
|
385
|
+
const ae = { key: 0, class: "vuecal__all-day-text", style: { width: "3em" } };
|
|
386
|
+
var le = z({ inject: ["vuecal", "view", "editEvents"], components: { "vuecal-cell": ne }, props: { options: { type: Object, required: true }, cells: { type: Array, required: true }, label: { type: String, required: true }, daySplits: { type: Array, default: () => [] }, shortEvents: { type: Boolean, default: true }, height: { type: String, default: "" }, cellOrSplitMinWidth: { type: Number, default: null } }, computed: { hasCellOrSplitWidth() {
|
|
387
|
+
return !!(this.options.minCellWidth || this.daySplits.length && this.options.minSplitWidth);
|
|
388
|
+
} } }, [["render", function(l2, r2, v2, w2, y2, D2) {
|
|
389
|
+
const g2 = p("vuecal-cell");
|
|
390
|
+
return e(), t("div", { class: "vuecal__flex vuecal__all-day", style: a(v2.cellOrSplitMinWidth && { height: v2.height }) }, [v2.cellOrSplitMinWidth ? c("", true) : (e(), t("div", ae, [d("span", null, h(v2.label), 1)])), d("div", { class: n(["vuecal__flex vuecal__cells", `${D2.view.id}-view`]), grow: "", style: a(v2.cellOrSplitMinWidth ? `min-width: ${v2.cellOrSplitMinWidth}px` : "") }, [(e(true), t(s, null, i(v2.cells, (t2, s2) => (e(), m(g2, { key: s2, options: v2.options, "edit-events": D2.editEvents, data: t2, "all-day": true, "cell-width": v2.options.hideWeekdays.length && (D2.vuecal.isWeekView || D2.vuecal.isMonthView) && D2.vuecal.cellWidth, "min-timestamp": v2.options.minTimestamp, "max-timestamp": v2.options.maxTimestamp, "cell-splits": v2.daySplits }, { event: o(({ event: e2, view: t3 }) => [u(l2.$slots, "event", { view: t3, event: e2 })]), _: 2 }, 1032, ["options", "edit-events", "data", "cell-width", "min-timestamp", "max-timestamp", "cell-splits"]))), 128))], 6)], 4);
|
|
391
|
+
}]]);
|
|
392
|
+
const re = ["lang"], oe = v("\xA0"), de = d("i", { class: "angle" }, null, -1), ue = v("\xA0"), he = v("\xA0"), ce = d("i", { class: "angle" }, null, -1), ve = v("\xA0"), pe = { class: "default" }, me = { key: 0, class: "vuecal__flex vuecal__body", grow: "" }, we = ["onBlur", "innerHTML"], ye = ["innerHTML"], De = ["innerHTML"], ge = { class: "vuecal__flex", row: "", grow: "" }, fe = { key: 0, class: "vuecal__time-column" }, _e = d("span", { class: "vuecal__time-cell-line" }, null, -1), be = { class: "vuecal__time-cell-label" }, ke = { key: 1, class: "vuecal__flex vuecal__week-numbers", column: "" }, Me = ["wrap", "column"], Te = ["onBlur", "innerHTML"], Ee = ["innerHTML"], Ce = ["innerHTML"], Se = ["wrap"], Oe = ["innerHTML"], $e = ["innerHTML"], xe = { key: 2, class: "vuecal__cell-events-count" }, He = { key: 3, class: "vuecal__no-event" }, We = ["onBlur", "innerHTML"], je = ["innerHTML"], Ae = { key: 2, class: "vuecal__event-time" }, Ve = { key: 0 }, Ye = { key: 1, class: "days-to-end" }, Le = ["innerHTML"], Fe = { key: 0, class: "vuecal__scrollbar-check" }, Be = [d("div", null, null, -1)];
|
|
393
|
+
const Ne = { weekDays: Array(7).fill(""), weekDaysShort: [], months: Array(12).fill(""), years: "", year: "", month: "", week: "", day: "", today: "", noEvent: "", allDay: "", deleteEvent: "", createEvent: "", dateFormat: "dddd MMMM D, YYYY", am: "am", pm: "pm" }, ze = ["years", "year", "month", "week", "day"], Ie = new class {
|
|
394
|
+
constructor(e2, t2 = false) {
|
|
395
|
+
__publicField(this, "texts", {});
|
|
396
|
+
__publicField(this, "dateToMinutes", (e2) => 60 * e2.getHours() + e2.getMinutes());
|
|
397
|
+
E = this, this._texts = e2, t2 || !Date || Date.prototype.addDays || this._initDatePrototypes();
|
|
398
|
+
}
|
|
399
|
+
_initDatePrototypes() {
|
|
400
|
+
Date.prototype.addDays = function(e2) {
|
|
401
|
+
return E.addDays(this, e2);
|
|
402
|
+
}, Date.prototype.subtractDays = function(e2) {
|
|
403
|
+
return E.subtractDays(this, e2);
|
|
404
|
+
}, Date.prototype.addHours = function(e2) {
|
|
405
|
+
return E.addHours(this, e2);
|
|
406
|
+
}, Date.prototype.subtractHours = function(e2) {
|
|
407
|
+
return E.subtractHours(this, e2);
|
|
408
|
+
}, Date.prototype.addMinutes = function(e2) {
|
|
409
|
+
return E.addMinutes(this, e2);
|
|
410
|
+
}, Date.prototype.subtractMinutes = function(e2) {
|
|
411
|
+
return E.subtractMinutes(this, e2);
|
|
412
|
+
}, Date.prototype.getWeek = function() {
|
|
413
|
+
return E.getWeek(this);
|
|
414
|
+
}, Date.prototype.isToday = function() {
|
|
415
|
+
return E.isToday(this);
|
|
416
|
+
}, Date.prototype.isLeapYear = function() {
|
|
417
|
+
return E.isLeapYear(this);
|
|
418
|
+
}, Date.prototype.format = function(e2 = "YYYY-MM-DD") {
|
|
419
|
+
return E.formatDate(this, e2);
|
|
420
|
+
}, Date.prototype.formatTime = function(e2 = "HH:mm") {
|
|
421
|
+
return E.formatTime(this, e2);
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
removePrototypes() {
|
|
425
|
+
delete Date.prototype.addDays, delete Date.prototype.subtractDays, delete Date.prototype.addHours, delete Date.prototype.subtractHours, delete Date.prototype.addMinutes, delete Date.prototype.subtractMinutes, delete Date.prototype.getWeek, delete Date.prototype.isToday, delete Date.prototype.isLeapYear, delete Date.prototype.format, delete Date.prototype.formatTime;
|
|
426
|
+
}
|
|
427
|
+
updateTexts(e2) {
|
|
428
|
+
this._texts = e2;
|
|
429
|
+
}
|
|
430
|
+
_todayFormatted() {
|
|
431
|
+
return M !== new Date().getDate() && (k = new Date(), M = k.getDate(), T = `${k.getFullYear()}-${k.getMonth()}-${k.getDate()}`), T;
|
|
432
|
+
}
|
|
433
|
+
addDays(e2, t2) {
|
|
434
|
+
const s2 = new Date(e2.valueOf());
|
|
435
|
+
return s2.setDate(s2.getDate() + t2), s2;
|
|
436
|
+
}
|
|
437
|
+
subtractDays(e2, t2) {
|
|
438
|
+
const s2 = new Date(e2.valueOf());
|
|
439
|
+
return s2.setDate(s2.getDate() - t2), s2;
|
|
440
|
+
}
|
|
441
|
+
addHours(e2, t2) {
|
|
442
|
+
const s2 = new Date(e2.valueOf());
|
|
443
|
+
return s2.setHours(s2.getHours() + t2), s2;
|
|
444
|
+
}
|
|
445
|
+
subtractHours(e2, t2) {
|
|
446
|
+
const s2 = new Date(e2.valueOf());
|
|
447
|
+
return s2.setHours(s2.getHours() - t2), s2;
|
|
448
|
+
}
|
|
449
|
+
addMinutes(e2, t2) {
|
|
450
|
+
const s2 = new Date(e2.valueOf());
|
|
451
|
+
return s2.setMinutes(s2.getMinutes() + t2), s2;
|
|
452
|
+
}
|
|
453
|
+
subtractMinutes(e2, t2) {
|
|
454
|
+
const s2 = new Date(e2.valueOf());
|
|
455
|
+
return s2.setMinutes(s2.getMinutes() - t2), s2;
|
|
456
|
+
}
|
|
457
|
+
getWeek(e2) {
|
|
458
|
+
const t2 = new Date(Date.UTC(e2.getFullYear(), e2.getMonth(), e2.getDate())), s2 = t2.getUTCDay() || 7;
|
|
459
|
+
t2.setUTCDate(t2.getUTCDate() + 4 - s2);
|
|
460
|
+
const i2 = new Date(Date.UTC(t2.getUTCFullYear(), 0, 1));
|
|
461
|
+
return Math.ceil(((t2 - i2) / 864e5 + 1) / 7);
|
|
462
|
+
}
|
|
463
|
+
isToday(e2) {
|
|
464
|
+
return `${e2.getFullYear()}-${e2.getMonth()}-${e2.getDate()}` === this._todayFormatted();
|
|
465
|
+
}
|
|
466
|
+
isLeapYear(e2) {
|
|
467
|
+
const t2 = e2.getFullYear();
|
|
468
|
+
return !(t2 % 400) || t2 % 100 && !(t2 % 4);
|
|
469
|
+
}
|
|
470
|
+
getPreviousFirstDayOfWeek(e2 = null, t2) {
|
|
471
|
+
const s2 = e2 && new Date(e2.valueOf()) || new Date(), i2 = t2 ? 7 : 6;
|
|
472
|
+
return s2.setDate(s2.getDate() - (s2.getDay() + i2) % 7), s2;
|
|
473
|
+
}
|
|
474
|
+
stringToDate(e2) {
|
|
475
|
+
return e2 instanceof Date ? e2 : (10 === e2.length && (e2 += " 00:00"), new Date(e2.replace(/-/g, "/")));
|
|
476
|
+
}
|
|
477
|
+
countDays(e2, t2) {
|
|
478
|
+
"string" == typeof e2 && (e2 = e2.replace(/-/g, "/")), "string" == typeof t2 && (t2 = t2.replace(/-/g, "/")), e2 = new Date(e2).setHours(0, 0, 0, 0), t2 = new Date(t2).setHours(0, 0, 1, 0);
|
|
479
|
+
const s2 = 60 * (new Date(t2).getTimezoneOffset() - new Date(e2).getTimezoneOffset()) * 1e3;
|
|
480
|
+
return Math.ceil((t2 - e2 - s2) / 864e5);
|
|
481
|
+
}
|
|
482
|
+
datesInSameTimeStep(e2, t2, s2) {
|
|
483
|
+
return Math.abs(e2.getTime() - t2.getTime()) <= 60 * s2 * 1e3;
|
|
484
|
+
}
|
|
485
|
+
formatDate(e2, t2 = "YYYY-MM-DD", s2 = null) {
|
|
486
|
+
if (s2 || (s2 = this._texts), t2 || (t2 = "YYYY-MM-DD"), "YYYY-MM-DD" === t2)
|
|
487
|
+
return this.formatDateLite(e2);
|
|
488
|
+
C = {}, S = {};
|
|
489
|
+
const i2 = { YYYY: () => this._hydrateDateObject(e2, s2).YYYY, YY: () => this._hydrateDateObject(e2, s2).YY(), M: () => this._hydrateDateObject(e2, s2).M, MM: () => this._hydrateDateObject(e2, s2).MM(), MMM: () => this._hydrateDateObject(e2, s2).MMM(), MMMM: () => this._hydrateDateObject(e2, s2).MMMM(), MMMMG: () => this._hydrateDateObject(e2, s2).MMMMG(), D: () => this._hydrateDateObject(e2, s2).D, DD: () => this._hydrateDateObject(e2, s2).DD(), S: () => this._hydrateDateObject(e2, s2).S(), d: () => this._hydrateDateObject(e2, s2).d, dd: () => this._hydrateDateObject(e2, s2).dd(), ddd: () => this._hydrateDateObject(e2, s2).ddd(), dddd: () => this._hydrateDateObject(e2, s2).dddd(), HH: () => this._hydrateTimeObject(e2, s2).HH, H: () => this._hydrateTimeObject(e2, s2).H, hh: () => this._hydrateTimeObject(e2, s2).hh, h: () => this._hydrateTimeObject(e2, s2).h, am: () => this._hydrateTimeObject(e2, s2).am, AM: () => this._hydrateTimeObject(e2, s2).AM, mm: () => this._hydrateTimeObject(e2, s2).mm, m: () => this._hydrateTimeObject(e2, s2).m };
|
|
490
|
+
return t2.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (e3, t3) => {
|
|
491
|
+
const s3 = i2[t3.replace(/\{|\}/g, "")];
|
|
492
|
+
return void 0 !== s3 ? s3() : t3;
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
formatDateLite(e2) {
|
|
496
|
+
const t2 = e2.getMonth() + 1, s2 = e2.getDate();
|
|
497
|
+
return `${e2.getFullYear()}-${t2 < 10 ? "0" : ""}${t2}-${s2 < 10 ? "0" : ""}${s2}`;
|
|
498
|
+
}
|
|
499
|
+
formatTime(e2, t2 = "HH:mm", s2 = null, i2 = false) {
|
|
500
|
+
let n2 = false;
|
|
501
|
+
if (i2) {
|
|
502
|
+
const [t3, s3, i3] = [e2.getHours(), e2.getMinutes(), e2.getSeconds()];
|
|
503
|
+
t3 + s3 + i3 === 141 && (n2 = true);
|
|
504
|
+
}
|
|
505
|
+
if (e2 instanceof Date && "HH:mm" === t2)
|
|
506
|
+
return n2 ? "24:00" : this.formatTimeLite(e2);
|
|
507
|
+
S = {}, s2 || (s2 = this._texts);
|
|
508
|
+
const a2 = this._hydrateTimeObject(e2, s2), l2 = t2.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (e3, t3) => {
|
|
509
|
+
const s3 = a2[t3.replace(/\{|\}/g, "")];
|
|
510
|
+
return void 0 !== s3 ? s3 : t3;
|
|
511
|
+
});
|
|
512
|
+
return n2 ? l2.replace("23:59", "24:00") : l2;
|
|
513
|
+
}
|
|
514
|
+
formatTimeLite(e2) {
|
|
515
|
+
const t2 = e2.getHours(), s2 = e2.getMinutes();
|
|
516
|
+
return `${(t2 < 10 ? "0" : "") + t2}:${(s2 < 10 ? "0" : "") + s2}`;
|
|
517
|
+
}
|
|
518
|
+
_nth(e2) {
|
|
519
|
+
if (e2 > 3 && e2 < 21)
|
|
520
|
+
return "th";
|
|
521
|
+
switch (e2 % 10) {
|
|
522
|
+
case 1:
|
|
523
|
+
return "st";
|
|
524
|
+
case 2:
|
|
525
|
+
return "nd";
|
|
526
|
+
case 3:
|
|
527
|
+
return "rd";
|
|
528
|
+
default:
|
|
529
|
+
return "th";
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
_hydrateDateObject(e2, t2) {
|
|
533
|
+
if (C.D)
|
|
534
|
+
return C;
|
|
535
|
+
const s2 = e2.getFullYear(), i2 = e2.getMonth() + 1, n2 = e2.getDate(), a2 = (e2.getDay() - 1 + 7) % 7;
|
|
536
|
+
return C = { YYYY: s2, YY: () => s2.toString().substring(2), M: i2, MM: () => (i2 < 10 ? "0" : "") + i2, MMM: () => t2.months[i2 - 1].substring(0, 3), MMMM: () => t2.months[i2 - 1], MMMMG: () => (t2.monthsGenitive || t2.months)[i2 - 1], D: n2, DD: () => (n2 < 10 ? "0" : "") + n2, S: () => this._nth(n2), d: a2 + 1, dd: () => t2.weekDays[a2][0], ddd: () => t2.weekDays[a2].substr(0, 3), dddd: () => t2.weekDays[a2] }, C;
|
|
537
|
+
}
|
|
538
|
+
_hydrateTimeObject(e2, t2) {
|
|
539
|
+
if (S.am)
|
|
540
|
+
return S;
|
|
541
|
+
let s2, i2;
|
|
542
|
+
e2 instanceof Date ? (s2 = e2.getHours(), i2 = e2.getMinutes()) : (s2 = Math.floor(e2 / 60), i2 = Math.floor(e2 % 60));
|
|
543
|
+
const n2 = s2 % 12 ? s2 % 12 : 12, a2 = (t2 || { am: "am", pm: "pm" })[24 === s2 || s2 < 12 ? "am" : "pm"];
|
|
544
|
+
return S = { H: s2, h: n2, HH: (s2 < 10 ? "0" : "") + s2, hh: (n2 < 10 ? "0" : "") + n2, am: a2, AM: a2.toUpperCase(), m: i2, mm: (i2 < 10 ? "0" : "") + i2 }, S;
|
|
545
|
+
}
|
|
546
|
+
}(Ne), Pe = { name: "vue-cal", components: { "vuecal-cell": ne, "vuecal-header": J, WeekdaysHeadings: I, AllDayBar: le }, provide() {
|
|
547
|
+
return { vuecal: this, utils: this.utils, modules: this.modules, previous: this.previous, next: this.next, switchView: this.switchView, updateSelectedDate: this.updateSelectedDate, editEvents: this.editEvents, view: this.view, domEvents: this.domEvents };
|
|
548
|
+
}, props: { activeView: { type: String, default: "week" }, allDayBarHeight: { type: [String, Number], default: "25px" }, cellClickHold: { type: Boolean, default: true }, cellContextmenu: { type: Boolean, default: false }, clickToNavigate: { type: Boolean, default: false }, dblclickToNavigate: { type: Boolean, default: true }, disableDatePrototypes: { type: Boolean, default: false }, disableDays: { type: Array, default: () => [] }, disableViews: { type: Array, default: () => [] }, dragToCreateEvent: { type: Boolean, default: true }, dragToCreateThreshold: { type: Number, default: 15 }, editableEvents: { type: [Boolean, Object], default: false }, events: { type: Array, default: () => [] }, eventsCountOnYearView: { type: Boolean, default: false }, eventsOnMonthView: { type: [Boolean, String], default: false }, hideBody: { type: Boolean, default: false }, hideTitleBar: { type: Boolean, default: false }, hideViewSelector: { type: Boolean, default: false }, hideWeekdays: { type: Array, default: () => [] }, hideWeekends: { type: Boolean, default: false }, locale: { type: [String, Object], default: "en" }, maxDate: { type: [String, Date], default: "" }, minCellWidth: { type: Number, default: 0 }, minDate: { type: [String, Date], default: "" }, minEventWidth: { type: Number, default: 0 }, minSplitWidth: { type: Number, default: 0 }, onEventClick: { type: [Function, null], default: null }, onEventCreate: { type: [Function, null], default: null }, onEventDblclick: { type: [Function, null], default: null }, overlapsPerTimeStep: { type: Boolean, default: false }, resizeX: { type: Boolean, default: false }, selectedDate: { type: [String, Date], default: "" }, showAllDayEvents: { type: [Boolean, String], default: false }, showWeekNumbers: { type: [Boolean, String], default: false }, snapToTime: { type: Number, default: 0 }, small: { type: Boolean, default: false }, specialHours: { type: Object, default: () => ({}) }, splitDays: { type: Array, default: () => [] }, startWeekOnSunday: { type: Boolean, default: false }, stickySplitLabels: { type: Boolean, default: false }, time: { type: Boolean, default: true }, timeCellHeight: { type: Number, default: 40 }, timeFormat: { type: String, default: "" }, timeFrom: { type: Number, default: 0 }, timeStep: { type: Number, default: 60 }, timeTo: { type: Number, default: 1440 }, todayButton: { type: Boolean, default: false }, transitions: { type: Boolean, default: true }, twelveHour: { type: Boolean, default: false }, watchRealTime: { type: Boolean, default: false }, xsmall: { type: Boolean, default: false } }, data() {
|
|
549
|
+
return { ready: false, texts: { ...Ne }, utils: { date: !!this.disableDatePrototypes && Ie.removePrototypes() || Ie, cell: null, event: null }, modules: { dnd: null }, cellsEl: null, view: { id: "", title: "", startDate: null, endDate: null, firstCellDate: null, lastCellDate: null, selectedDate: null, events: [] }, eventIdIncrement: 1, now: new Date(), timeTickerIds: [null, null], domEvents: { resizeAnEvent: { _eid: null, start: null, split: null, segment: null, originalEndTimeMinutes: 0, originalEnd: null, end: null, startCell: null, endCell: null }, dragAnEvent: { _eid: null }, dragCreateAnEvent: { startCursorY: null, start: null, split: null, event: null }, focusAnEvent: { _eid: null, mousedUp: false }, clickHoldAnEvent: { _eid: null, timeout: 1200, timeoutId: null }, dblTapACell: { taps: 0, timeout: 500 }, clickHoldACell: { cellId: null, split: null, timeout: 1200, timeoutId: null, eventCreated: false }, cancelClickEventCreation: false }, mutableEvents: [], transitionDirection: "right" };
|
|
550
|
+
}, methods: { async loadLocale(e2) {
|
|
551
|
+
if ("object" == typeof this.locale)
|
|
552
|
+
return this.texts = Object.assign({}, Ne, e2), void this.utils.date.updateTexts(this.texts);
|
|
553
|
+
if ("en" === this.locale) {
|
|
554
|
+
const e3 = await import("./i18n/en.es.js");
|
|
555
|
+
this.texts = Object.assign({}, Ne, e3);
|
|
556
|
+
} else
|
|
557
|
+
(function(e3) {
|
|
558
|
+
switch (e3) {
|
|
559
|
+
case "./i18n/ar.json":
|
|
560
|
+
return import("./i18n/ar.es.js");
|
|
561
|
+
case "./i18n/bg.json":
|
|
562
|
+
return import("./i18n/bg.es.js");
|
|
563
|
+
case "./i18n/bn.json":
|
|
564
|
+
return import("./i18n/bn.es.js");
|
|
565
|
+
case "./i18n/bs.json":
|
|
566
|
+
return import("./i18n/bs.es.js");
|
|
567
|
+
case "./i18n/ca.json":
|
|
568
|
+
return import("./i18n/ca.es.js");
|
|
569
|
+
case "./i18n/cs.json":
|
|
570
|
+
return import("./i18n/cs.es.js");
|
|
571
|
+
case "./i18n/da.json":
|
|
572
|
+
return import("./i18n/da.es.js");
|
|
573
|
+
case "./i18n/de.json":
|
|
574
|
+
return import("./i18n/de.es.js");
|
|
575
|
+
case "./i18n/el.json":
|
|
576
|
+
return import("./i18n/el.es.js");
|
|
577
|
+
case "./i18n/en.json":
|
|
578
|
+
return import("./i18n/en.es.js");
|
|
579
|
+
case "./i18n/es.json":
|
|
580
|
+
return import("./i18n/es.es.js");
|
|
581
|
+
case "./i18n/fa.json":
|
|
582
|
+
return import("./i18n/fa.es.js");
|
|
583
|
+
case "./i18n/fr.json":
|
|
584
|
+
return import("./i18n/fr.es.js");
|
|
585
|
+
case "./i18n/he.json":
|
|
586
|
+
return import("./i18n/he.es.js");
|
|
587
|
+
case "./i18n/hr.json":
|
|
588
|
+
return import("./i18n/hr.es.js");
|
|
589
|
+
case "./i18n/hu.json":
|
|
590
|
+
return import("./i18n/hu.es.js");
|
|
591
|
+
case "./i18n/id.json":
|
|
592
|
+
return import("./i18n/id.es.js");
|
|
593
|
+
case "./i18n/is.json":
|
|
594
|
+
return import("./i18n/is.es.js");
|
|
595
|
+
case "./i18n/it.json":
|
|
596
|
+
return import("./i18n/it.es.js");
|
|
597
|
+
case "./i18n/ja.json":
|
|
598
|
+
return import("./i18n/ja.es.js");
|
|
599
|
+
case "./i18n/ka.json":
|
|
600
|
+
return import("./i18n/ka.es.js");
|
|
601
|
+
case "./i18n/ko.json":
|
|
602
|
+
return import("./i18n/ko.es.js");
|
|
603
|
+
case "./i18n/lt.json":
|
|
604
|
+
return import("./i18n/lt.es.js");
|
|
605
|
+
case "./i18n/mn.json":
|
|
606
|
+
return import("./i18n/mn.es.js");
|
|
607
|
+
case "./i18n/nl.json":
|
|
608
|
+
return import("./i18n/nl.es.js");
|
|
609
|
+
case "./i18n/no.json":
|
|
610
|
+
return import("./i18n/no.es.js");
|
|
611
|
+
case "./i18n/pl.json":
|
|
612
|
+
return import("./i18n/pl.es.js");
|
|
613
|
+
case "./i18n/pt-br.json":
|
|
614
|
+
return import("./i18n/pt-br.es.js");
|
|
615
|
+
case "./i18n/ro.json":
|
|
616
|
+
return import("./i18n/ro.es.js");
|
|
617
|
+
case "./i18n/ru.json":
|
|
618
|
+
return import("./i18n/ru.es.js");
|
|
619
|
+
case "./i18n/sk.json":
|
|
620
|
+
return import("./i18n/sk.es.js");
|
|
621
|
+
case "./i18n/sl.json":
|
|
622
|
+
return import("./i18n/sl.es.js");
|
|
623
|
+
case "./i18n/sq.json":
|
|
624
|
+
return import("./i18n/sq.es.js");
|
|
625
|
+
case "./i18n/sr.json":
|
|
626
|
+
return import("./i18n/sr.es.js");
|
|
627
|
+
case "./i18n/sv.json":
|
|
628
|
+
return import("./i18n/sv.es.js");
|
|
629
|
+
case "./i18n/tr.json":
|
|
630
|
+
return import("./i18n/tr.es.js");
|
|
631
|
+
case "./i18n/uk.json":
|
|
632
|
+
return import("./i18n/uk.es.js");
|
|
633
|
+
case "./i18n/vi.json":
|
|
634
|
+
return import("./i18n/vi.es.js");
|
|
635
|
+
case "./i18n/zh-cn.json":
|
|
636
|
+
return import("./i18n/zh-cn.es.js");
|
|
637
|
+
case "./i18n/zh-hk.json":
|
|
638
|
+
return import("./i18n/zh-hk.es.js");
|
|
639
|
+
default:
|
|
640
|
+
return new Promise(function(t2, s2) {
|
|
641
|
+
("function" == typeof queueMicrotask ? queueMicrotask : setTimeout)(s2.bind(null, new Error("Unknown variable dynamic import: " + e3)));
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
})(`./i18n/${e2}.json`).then((e3) => {
|
|
645
|
+
this.texts = Object.assign({}, Ne, e3.default), this.utils.date.updateTexts(this.texts);
|
|
646
|
+
});
|
|
647
|
+
}, loadDragAndDrop() {
|
|
648
|
+
import("./drag-and-drop.es.js").then((e2) => {
|
|
649
|
+
const { DragAndDrop: t2 } = e2;
|
|
650
|
+
this.modules.dnd = new t2(this);
|
|
651
|
+
}).catch(() => console.warn("Vue Cal: Missing drag & drop module."));
|
|
652
|
+
}, validateView(e2) {
|
|
653
|
+
return ze.includes(e2) || (console.error(`Vue Cal: invalid active-view parameter provided: "${e2}".
|
|
654
|
+
A valid view must be one of: ${ze.join(", ")}.`), e2 = "week"), this.enabledViews.includes(e2) || (console.warn(`Vue Cal: the provided active-view "${e2}" is disabled. Using the "${this.enabledViews[0]}" view instead.`), e2 = this.enabledViews[0]), e2;
|
|
655
|
+
}, switchToNarrowerView(e2 = null) {
|
|
656
|
+
this.transitionDirection = "right";
|
|
657
|
+
const t2 = this.enabledViews[this.enabledViews.indexOf(this.view.id) + 1];
|
|
658
|
+
t2 && this.switchView(t2, e2);
|
|
659
|
+
}, switchView(e2, t2 = null, s2 = false) {
|
|
660
|
+
e2 = this.validateView(e2);
|
|
661
|
+
const i2 = this.utils.date, n2 = this.view.startDate && this.view.startDate.getTime();
|
|
662
|
+
if (this.transitions && s2) {
|
|
663
|
+
if (this.view.id === e2)
|
|
664
|
+
return;
|
|
665
|
+
const t3 = this.enabledViews;
|
|
666
|
+
this.transitionDirection = t3.indexOf(this.view.id) > t3.indexOf(e2) ? "left" : "right";
|
|
667
|
+
}
|
|
668
|
+
const a2 = this.view.id;
|
|
669
|
+
switch (this.view.events = [], this.view.id = e2, this.view.firstCellDate = null, this.view.lastCellDate = null, t2 || (t2 = this.view.selectedDate || this.view.startDate), e2) {
|
|
670
|
+
case "years":
|
|
671
|
+
this.view.startDate = new Date(25 * Math.floor(t2.getFullYear() / 25) || 2e3, 0, 1), this.view.endDate = new Date(this.view.startDate.getFullYear() + 25, 0, 1), this.view.endDate.setSeconds(-1);
|
|
672
|
+
break;
|
|
673
|
+
case "year":
|
|
674
|
+
this.view.startDate = new Date(t2.getFullYear(), 0, 1), this.view.endDate = new Date(t2.getFullYear() + 1, 0, 1), this.view.endDate.setSeconds(-1);
|
|
675
|
+
break;
|
|
676
|
+
case "month": {
|
|
677
|
+
this.view.startDate = new Date(t2.getFullYear(), t2.getMonth(), 1), this.view.endDate = new Date(t2.getFullYear(), t2.getMonth() + 1, 1), this.view.endDate.setSeconds(-1);
|
|
678
|
+
let e3 = new Date(this.view.startDate);
|
|
679
|
+
if (e3.getDay() !== (this.startWeekOnSunday ? 0 : 1) && (e3 = i2.getPreviousFirstDayOfWeek(e3, this.startWeekOnSunday)), this.view.firstCellDate = e3, this.view.lastCellDate = i2.addDays(e3, 41), this.view.lastCellDate.setHours(23, 59, 59, 0), this.hideWeekends) {
|
|
680
|
+
if ([0, 6].includes(this.view.firstCellDate.getDay())) {
|
|
681
|
+
const e4 = 6 !== this.view.firstCellDate.getDay() || this.startWeekOnSunday ? 1 : 2;
|
|
682
|
+
this.view.firstCellDate = i2.addDays(this.view.firstCellDate, e4);
|
|
683
|
+
}
|
|
684
|
+
if ([0, 6].includes(this.view.startDate.getDay())) {
|
|
685
|
+
const e4 = 6 === this.view.startDate.getDay() ? 2 : 1;
|
|
686
|
+
this.view.startDate = i2.addDays(this.view.startDate, e4);
|
|
687
|
+
}
|
|
688
|
+
if ([0, 6].includes(this.view.lastCellDate.getDay())) {
|
|
689
|
+
const e4 = 0 !== this.view.lastCellDate.getDay() || this.startWeekOnSunday ? 1 : 2;
|
|
690
|
+
this.view.lastCellDate = i2.subtractDays(this.view.lastCellDate, e4);
|
|
691
|
+
}
|
|
692
|
+
if ([0, 6].includes(this.view.endDate.getDay())) {
|
|
693
|
+
const e4 = 0 === this.view.endDate.getDay() ? 2 : 1;
|
|
694
|
+
this.view.endDate = i2.subtractDays(this.view.endDate, e4);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
case "week": {
|
|
700
|
+
t2 = i2.getPreviousFirstDayOfWeek(t2, this.startWeekOnSunday);
|
|
701
|
+
const e3 = this.hideWeekends ? 5 : 7;
|
|
702
|
+
this.view.startDate = this.hideWeekends && this.startWeekOnSunday ? i2.addDays(t2, 1) : t2, this.view.startDate.setHours(0, 0, 0, 0), this.view.endDate = i2.addDays(t2, e3), this.view.endDate.setSeconds(-1);
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
case "day":
|
|
706
|
+
this.view.startDate = t2, this.view.startDate.setHours(0, 0, 0, 0), this.view.endDate = new Date(t2), this.view.endDate.setHours(23, 59, 59, 0);
|
|
707
|
+
}
|
|
708
|
+
this.addEventsToView();
|
|
709
|
+
const l2 = this.view.startDate && this.view.startDate.getTime();
|
|
710
|
+
if ((a2 !== e2 || l2 !== n2) && (this.$emit("update:activeView", e2), this.ready)) {
|
|
711
|
+
const t3 = this.view.startDate, s3 = { view: e2, startDate: t3, endDate: this.view.endDate, ...this.isMonthView ? { firstCellDate: this.view.firstCellDate, lastCellDate: this.view.lastCellDate, outOfScopeEvents: this.view.outOfScopeEvents.map(this.cleanupEvent) } : {}, events: this.view.events.map(this.cleanupEvent), ...this.isWeekView ? { week: i2.getWeek(this.startWeekOnSunday ? i2.addDays(t3, 1) : t3) } : {} };
|
|
712
|
+
this.$emit("view-change", s3);
|
|
713
|
+
}
|
|
714
|
+
}, previous() {
|
|
715
|
+
this.previousNext(false);
|
|
716
|
+
}, next() {
|
|
717
|
+
this.previousNext();
|
|
718
|
+
}, previousNext(e2 = true) {
|
|
719
|
+
const t2 = this.utils.date;
|
|
720
|
+
this.transitionDirection = e2 ? "right" : "left";
|
|
721
|
+
const s2 = e2 ? 1 : -1;
|
|
722
|
+
let i2 = null;
|
|
723
|
+
const { startDate: n2, id: a2 } = this.view;
|
|
724
|
+
switch (a2) {
|
|
725
|
+
case "years":
|
|
726
|
+
i2 = new Date(n2.getFullYear() + 25 * s2, 0, 1);
|
|
727
|
+
break;
|
|
728
|
+
case "year":
|
|
729
|
+
i2 = new Date(n2.getFullYear() + 1 * s2, 1, 1);
|
|
730
|
+
break;
|
|
731
|
+
case "month":
|
|
732
|
+
i2 = new Date(n2.getFullYear(), n2.getMonth() + 1 * s2, 1);
|
|
733
|
+
break;
|
|
734
|
+
case "week":
|
|
735
|
+
i2 = t2[e2 ? "addDays" : "subtractDays"](t2.getPreviousFirstDayOfWeek(n2, this.startWeekOnSunday), 7);
|
|
736
|
+
break;
|
|
737
|
+
case "day":
|
|
738
|
+
i2 = t2[e2 ? "addDays" : "subtractDays"](n2, 1);
|
|
739
|
+
}
|
|
740
|
+
i2 && this.switchView(a2, i2);
|
|
741
|
+
}, addEventsToView(e2 = []) {
|
|
742
|
+
const t2 = this.utils.event, { startDate: s2, endDate: i2, firstCellDate: n2, lastCellDate: a2 } = this.view;
|
|
743
|
+
if (e2.length || (this.view.events = []), !(e2 = e2.length ? e2 : [...this.mutableEvents]) || this.isYearsOrYearView && !this.eventsCountOnYearView)
|
|
744
|
+
return;
|
|
745
|
+
let l2 = e2.filter((e3) => t2.eventInRange(e3, s2, i2));
|
|
746
|
+
this.isYearsOrYearView || this.isMonthView && !this.eventsOnMonthView || (l2 = l2.map((e3) => e3.daysCount > 1 ? t2.createEventSegments(e3, n2 || s2, a2 || i2) : e3)), this.view.events.push(...l2), this.isMonthView && (this.view.outOfScopeEvents = [], e2.forEach((e3) => {
|
|
747
|
+
(t2.eventInRange(e3, n2, s2) || t2.eventInRange(e3, i2, a2)) && (this.view.events.some((t3) => t3._eid === e3._eid) || this.view.outOfScopeEvents.push(e3));
|
|
748
|
+
}));
|
|
749
|
+
}, findAncestor(e2, t2) {
|
|
750
|
+
for (; (e2 = e2.parentElement) && !e2.classList.contains(t2); )
|
|
751
|
+
;
|
|
752
|
+
return e2;
|
|
753
|
+
}, isDOMElementAnEvent(e2) {
|
|
754
|
+
return e2.classList.contains("vuecal__event") || this.findAncestor(e2, "vuecal__event");
|
|
755
|
+
}, onMouseMove(e2) {
|
|
756
|
+
const { resizeAnEvent: t2, dragAnEvent: s2, dragCreateAnEvent: i2 } = this.domEvents;
|
|
757
|
+
(null !== t2._eid || null !== s2._eid || i2.start) && (e2.preventDefault(), t2._eid ? this.eventResizing(e2) : this.dragToCreateEvent && i2.start && this.eventDragCreation(e2));
|
|
758
|
+
}, onMouseUp(e2) {
|
|
759
|
+
const { focusAnEvent: t2, resizeAnEvent: s2, clickHoldAnEvent: i2, clickHoldACell: n2, dragCreateAnEvent: a2 } = this.domEvents, { _eid: l2 } = i2, { _eid: r2 } = s2;
|
|
760
|
+
let o2 = false;
|
|
761
|
+
const { event: d2, start: u2 } = a2, h2 = this.isDOMElementAnEvent(e2.target), c2 = t2.mousedUp;
|
|
762
|
+
if (t2.mousedUp = false, h2 && (this.domEvents.cancelClickEventCreation = true), n2.eventCreated)
|
|
763
|
+
return;
|
|
764
|
+
if (r2) {
|
|
765
|
+
const { originalEnd: e3, originalEndTimeMinutes: t3, endTimeMinutes: i3 } = s2, n3 = this.view.events.find((e4) => e4._eid === s2._eid);
|
|
766
|
+
if (o2 = i3 && i3 !== t3, n3 && n3.end.getTime() !== e3.getTime()) {
|
|
767
|
+
const t4 = this.mutableEvents.find((e4) => e4._eid === s2._eid);
|
|
768
|
+
t4.endTimeMinutes = n3.endTimeMinutes, t4.end = n3.end;
|
|
769
|
+
const i4 = this.cleanupEvent(n3), a3 = { ...this.cleanupEvent(n3), end: e3, endTimeMinutes: n3.originalEndTimeMinutes };
|
|
770
|
+
this.$emit("event-duration-change", { event: i4, oldDate: s2.originalEnd, originalEvent: a3 }), this.$emit("event-change", { event: i4, originalEvent: a3 });
|
|
771
|
+
}
|
|
772
|
+
n3 && (n3.resizing = false), s2._eid = null, s2.start = null, s2.split = null, s2.segment = null, s2.originalEndTimeMinutes = null, s2.originalEnd = null, s2.endTimeMinutes = null, s2.startCell = null, s2.endCell = null;
|
|
773
|
+
} else
|
|
774
|
+
u2 && (d2 && (this.emitWithEvent("event-drag-create", d2), a2.event.resizing = false), a2.start = null, a2.split = null, a2.event = null);
|
|
775
|
+
h2 || r2 || this.unfocusEvent(), i2.timeoutId && !l2 && (clearTimeout(i2.timeoutId), i2.timeoutId = null), n2.timeoutId && (clearTimeout(n2.timeoutId), n2.timeoutId = null);
|
|
776
|
+
const v2 = "function" == typeof this.onEventClick;
|
|
777
|
+
if (c2 && !o2 && !l2 && !d2 && v2) {
|
|
778
|
+
let s3 = this.view.events.find((e3) => e3._eid === t2._eid);
|
|
779
|
+
return !s3 && this.isMonthView && (s3 = this.view.outOfScopeEvents.find((e3) => e3._eid === t2._eid)), s3 && this.onEventClick(s3, e2);
|
|
780
|
+
}
|
|
781
|
+
}, onKeyUp(e2) {
|
|
782
|
+
27 === e2.keyCode && this.cancelDelete();
|
|
783
|
+
}, eventResizing(e2) {
|
|
784
|
+
const { resizeAnEvent: t2 } = this.domEvents, s2 = this.view.events.find((e3) => e3._eid === t2._eid) || { segments: {} }, { minutes: i2, cursorCoords: n2 } = this.minutesAtCursor(e2), a2 = s2.segments && s2.segments[t2.segment], { date: l2, event: r2 } = this.utils, o2 = Math.max(i2, this.timeFrom + 1, (a2 || s2).startTimeMinutes + 1);
|
|
785
|
+
if (s2.endTimeMinutes = t2.endTimeMinutes = o2, this.snapToTime) {
|
|
786
|
+
const e3 = s2.endTimeMinutes + this.snapToTime / 2;
|
|
787
|
+
s2.endTimeMinutes = e3 - e3 % this.snapToTime;
|
|
788
|
+
}
|
|
789
|
+
if (a2 && (a2.endTimeMinutes = s2.endTimeMinutes), s2.end.setHours(0, s2.endTimeMinutes, 1440 === s2.endTimeMinutes ? -1 : 0, 0), this.resizeX && this.isWeekView) {
|
|
790
|
+
s2.daysCount = l2.countDays(s2.start, s2.end);
|
|
791
|
+
const e3 = this.cellsEl, i3 = e3.offsetWidth / e3.childElementCount, a3 = Math.floor(n2.x / i3);
|
|
792
|
+
if (null === t2.startCell && (t2.startCell = a3 - (s2.daysCount - 1)), t2.endCell !== a3) {
|
|
793
|
+
t2.endCell = a3;
|
|
794
|
+
const e4 = l2.addDays(s2.start, a3 - t2.startCell), i4 = Math.max(l2.countDays(s2.start, e4), 1);
|
|
795
|
+
if (i4 !== s2.daysCount) {
|
|
796
|
+
let e5 = null;
|
|
797
|
+
e5 = i4 > s2.daysCount ? r2.addEventSegment(s2) : r2.removeEventSegment(s2), t2.segment = e5, s2.endTimeMinutes += 1e-3;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
this.$emit("event-resizing", { _eid: s2._eid, end: s2.end, endTimeMinutes: s2.endTimeMinutes });
|
|
802
|
+
}, eventDragCreation(e2) {
|
|
803
|
+
const { dragCreateAnEvent: t2 } = this.domEvents, { start: s2, startCursorY: i2, split: n2 } = t2, a2 = new Date(s2), { minutes: l2, cursorCoords: { y: r2 } } = this.minutesAtCursor(e2);
|
|
804
|
+
if (t2.event || !(Math.abs(i2 - r2) < this.dragToCreateThreshold))
|
|
805
|
+
if (t2.event) {
|
|
806
|
+
if (a2.setHours(0, l2, 1440 === l2 ? -1 : 0, 0), this.snapToTime) {
|
|
807
|
+
let e4 = 60 * a2.getHours() + a2.getMinutes();
|
|
808
|
+
const t3 = e4 + this.snapToTime / 2;
|
|
809
|
+
e4 = t3 - t3 % this.snapToTime, a2.setHours(0, e4, 0, 0);
|
|
810
|
+
}
|
|
811
|
+
const e3 = s2 < a2, { event: i3 } = t2;
|
|
812
|
+
i3.start = e3 ? s2 : a2, i3.end = e3 ? a2 : s2, i3.startTimeMinutes = 60 * i3.start.getHours() + i3.start.getMinutes(), i3.endTimeMinutes = 60 * i3.end.getHours() + i3.end.getMinutes();
|
|
813
|
+
} else {
|
|
814
|
+
if (t2.event = this.utils.event.createAnEvent(s2, 1, { split: n2 }), !t2.event)
|
|
815
|
+
return t2.start = null, t2.split = null, void (t2.event = null);
|
|
816
|
+
t2.event.resizing = true;
|
|
817
|
+
}
|
|
818
|
+
}, unfocusEvent() {
|
|
819
|
+
const { focusAnEvent: e2, clickHoldAnEvent: t2 } = this.domEvents, s2 = this.view.events.find((s3) => s3._eid === (e2._eid || t2._eid));
|
|
820
|
+
e2._eid = null, t2._eid = null, s2 && (s2.focused = false, s2.deleting = false);
|
|
821
|
+
}, cancelDelete() {
|
|
822
|
+
const { clickHoldAnEvent: e2 } = this.domEvents;
|
|
823
|
+
if (e2._eid) {
|
|
824
|
+
const t2 = this.view.events.find((t3) => t3._eid === e2._eid);
|
|
825
|
+
t2 && (t2.deleting = false), e2._eid = null, e2.timeoutId = null;
|
|
826
|
+
}
|
|
827
|
+
}, onEventTitleBlur(e2, t2) {
|
|
828
|
+
if (t2.title === e2.target.innerHTML)
|
|
829
|
+
return;
|
|
830
|
+
const s2 = t2.title;
|
|
831
|
+
t2.title = e2.target.innerHTML;
|
|
832
|
+
const i2 = this.cleanupEvent(t2);
|
|
833
|
+
this.$emit("event-title-change", { event: i2, oldTitle: s2 }), this.$emit("event-change", { event: i2, originalEvent: { ...i2, title: s2 } });
|
|
834
|
+
}, updateMutableEvents() {
|
|
835
|
+
const e2 = this.utils.date;
|
|
836
|
+
this.mutableEvents = [], this.events.forEach((t2) => {
|
|
837
|
+
const s2 = "string" == typeof t2.start ? e2.stringToDate(t2.start) : t2.start, i2 = e2.formatDateLite(s2), n2 = e2.dateToMinutes(s2);
|
|
838
|
+
let a2 = null;
|
|
839
|
+
"string" == typeof t2.end && t2.end.includes("24:00") ? (a2 = new Date(t2.end.replace(" 24:00", "")), a2.setHours(23, 59, 59, 0)) : a2 = "string" == typeof t2.end ? e2.stringToDate(t2.end) : t2.end;
|
|
840
|
+
let l2 = e2.formatDateLite(a2), r2 = e2.dateToMinutes(a2);
|
|
841
|
+
r2 && 1440 !== r2 || (!this.time || "string" == typeof t2.end && 10 === t2.end.length ? a2.setHours(23, 59, 59, 0) : a2.setSeconds(a2.getSeconds() - 1), l2 = e2.formatDateLite(a2), r2 = 1440);
|
|
842
|
+
const o2 = i2 !== l2;
|
|
843
|
+
t2 = Object.assign({ ...this.utils.event.eventDefaults }, t2, { _eid: `${this._.uid}_${this.eventIdIncrement++}`, segments: o2 ? {} : null, start: s2, startTimeMinutes: n2, end: a2, endTimeMinutes: r2, daysCount: o2 ? e2.countDays(s2, a2) : 1, class: t2.class }), this.mutableEvents.push(t2);
|
|
844
|
+
});
|
|
845
|
+
}, minutesAtCursor(e2) {
|
|
846
|
+
return this.utils.cell.minutesAtCursor(e2);
|
|
847
|
+
}, createEvent(e2, t2, s2 = {}) {
|
|
848
|
+
return this.utils.event.createAnEvent(e2, t2, s2);
|
|
849
|
+
}, cleanupEvent(e2) {
|
|
850
|
+
e2 = { ...e2 };
|
|
851
|
+
return ["segments", "deletable", "deleting", "titleEditable", "resizable", "resizing", "draggable", "dragging", "draggingStatic", "focused"].forEach((t2) => {
|
|
852
|
+
t2 in e2 && delete e2[t2];
|
|
853
|
+
}), e2.repeat || delete e2.repeat, e2;
|
|
854
|
+
}, emitWithEvent(e2, t2) {
|
|
855
|
+
this.$emit(e2, this.cleanupEvent(t2));
|
|
856
|
+
}, updateSelectedDate(e2) {
|
|
857
|
+
if ((e2 = e2 && "string" == typeof e2 ? this.utils.date.stringToDate(e2) : new Date(e2)) && e2 instanceof Date) {
|
|
858
|
+
const { selectedDate: t2 } = this.view;
|
|
859
|
+
t2 && (this.transitionDirection = t2.getTime() > e2.getTime() ? "left" : "right"), e2.setHours(0, 0, 0, 0), t2 && t2.getTime() === e2.getTime() || (this.view.selectedDate = e2), this.switchView(this.view.id);
|
|
860
|
+
}
|
|
861
|
+
}, getWeekNumber(e2) {
|
|
862
|
+
const t2 = this.utils.date, s2 = this.firstCellDateWeekNumber + e2, i2 = this.startWeekOnSunday ? 1 : 0;
|
|
863
|
+
return s2 > 52 ? t2.getWeek(t2.addDays(this.view.firstCellDate, 7 * e2 + i2)) : s2;
|
|
864
|
+
}, timeTick() {
|
|
865
|
+
this.now = new Date(), this.timeTickerIds[1] = setTimeout(this.timeTick, 6e4);
|
|
866
|
+
}, updateDateTexts() {
|
|
867
|
+
this.utils.date.updateTexts(this.texts);
|
|
868
|
+
}, alignWithScrollbar() {
|
|
869
|
+
if (document.getElementById("vuecal-align-with-scrollbar"))
|
|
870
|
+
return;
|
|
871
|
+
const e2 = this.$refs.vuecal.getElementsByClassName("vuecal__scrollbar-check")[0], t2 = e2.offsetWidth - e2.children[0].offsetWidth;
|
|
872
|
+
if (t2) {
|
|
873
|
+
const e3 = document.createElement("style");
|
|
874
|
+
e3.id = "vuecal-align-with-scrollbar", e3.type = "text/css", e3.innerHTML = `.vuecal__weekdays-headings,.vuecal__all-day {padding-right: ${t2}px}`, document.head.appendChild(e3);
|
|
875
|
+
}
|
|
876
|
+
}, cellOrSplitHasEvents: (e2, t2 = null) => e2.length && (!t2 && e2.length || t2 && e2.some((e3) => e3.split === t2.id)) }, created() {
|
|
877
|
+
this.utils.cell = new O(this), this.utils.event = new W(this, this.utils.date), this.loadLocale(this.locale), this.editEvents.drag && this.loadDragAndDrop(), this.updateMutableEvents(this.events), this.view.id = this.currentView, this.selectedDate ? this.updateSelectedDate(this.selectedDate) : (this.view.selectedDate = new Date(), this.switchView(this.currentView)), this.time && this.watchRealTime && (this.timeTickerIds[0] = setTimeout(this.timeTick, 1e3 * (60 - this.now.getSeconds())));
|
|
878
|
+
}, mounted() {
|
|
879
|
+
const e2 = this.utils.date, t2 = "ontouchstart" in window, { resize: s2, drag: i2, create: n2, delete: a2, title: l2 } = this.editEvents, r2 = this.onEventClick && "function" == typeof this.onEventClick;
|
|
880
|
+
(s2 || i2 || n2 || a2 || l2 || r2) && window.addEventListener(t2 ? "touchend" : "mouseup", this.onMouseUp), (s2 || i2 || n2 && this.dragToCreateEvent) && window.addEventListener(t2 ? "touchmove" : "mousemove", this.onMouseMove, { passive: false }), l2 && window.addEventListener("keyup", this.onKeyUp), t2 && (this.$refs.vuecal.oncontextmenu = function(e3) {
|
|
881
|
+
e3.preventDefault(), e3.stopPropagation();
|
|
882
|
+
}), this.hideBody || this.alignWithScrollbar();
|
|
883
|
+
const o2 = this.view.startDate, d2 = { view: this.view.id, startDate: o2, endDate: this.view.endDate, ...this.isMonthView ? { firstCellDate: this.view.firstCellDate, lastCellDate: this.view.lastCellDate } : {}, events: this.view.events.map(this.cleanupEvent), ...this.isWeekView ? { week: e2.getWeek(this.startWeekOnSunday ? e2.addDays(o2, 1) : o2) } : {} };
|
|
884
|
+
this.$emit("ready", d2), this.ready = true;
|
|
885
|
+
}, beforeUnmount() {
|
|
886
|
+
const e2 = "ontouchstart" in window;
|
|
887
|
+
window.removeEventListener(e2 ? "touchmove" : "mousemove", this.onMouseMove, { passive: false }), window.removeEventListener(e2 ? "touchend" : "mouseup", this.onMouseUp), window.removeEventListener("keyup", this.onKeyUp), this.timeTickerIds[0] && clearTimeout(this.timeTickerIds[0]), this.timeTickerIds[1] && clearTimeout(this.timeTickerIds[1]), this.timeTickerIds = [null, null];
|
|
888
|
+
}, computed: { editEvents() {
|
|
889
|
+
return this.editableEvents && "object" == typeof this.editableEvents ? { title: !!this.editableEvents.title, drag: !!this.editableEvents.drag, resize: !!this.editableEvents.resize, create: !!this.editableEvents.create, delete: !!this.editableEvents.delete } : { title: !!this.editableEvents, drag: !!this.editableEvents, resize: !!this.editableEvents, create: !!this.editableEvents, delete: !!this.editableEvents };
|
|
890
|
+
}, views() {
|
|
891
|
+
return { years: { label: this.texts.years, enabled: !this.disableViews.includes("years") }, year: { label: this.texts.year, enabled: !this.disableViews.includes("year") }, month: { label: this.texts.month, enabled: !this.disableViews.includes("month") }, week: { label: this.texts.week, enabled: !this.disableViews.includes("week") }, day: { label: this.texts.day, enabled: !this.disableViews.includes("day") } };
|
|
892
|
+
}, currentView() {
|
|
893
|
+
return this.validateView(this.activeView);
|
|
894
|
+
}, enabledViews() {
|
|
895
|
+
return Object.keys(this.views).filter((e2) => this.views[e2].enabled);
|
|
896
|
+
}, hasTimeColumn() {
|
|
897
|
+
return this.time && this.isWeekOrDayView;
|
|
898
|
+
}, isShortMonthView() {
|
|
899
|
+
return this.isMonthView && "short" === this.eventsOnMonthView;
|
|
900
|
+
}, firstCellDateWeekNumber() {
|
|
901
|
+
const e2 = this.utils.date, t2 = this.view.firstCellDate;
|
|
902
|
+
return e2.getWeek(this.startWeekOnSunday ? e2.addDays(t2, 1) : t2);
|
|
903
|
+
}, timeCells() {
|
|
904
|
+
const e2 = [];
|
|
905
|
+
for (let t2 = this.timeFrom, s2 = this.timeTo; t2 < s2; t2 += this.timeStep)
|
|
906
|
+
e2.push({ hours: Math.floor(t2 / 60), minutes: t2 % 60, label: this.utils.date.formatTime(t2, this.TimeFormat), value: t2 });
|
|
907
|
+
return e2;
|
|
908
|
+
}, TimeFormat() {
|
|
909
|
+
return this.timeFormat || (this.twelveHour ? "h:mm{am}" : "HH:mm");
|
|
910
|
+
}, daySplits() {
|
|
911
|
+
return (this.splitDays.filter((e2) => !e2.hide) || []).map((e2, t2) => ({ ...e2, id: e2.id || t2 + 1 }));
|
|
912
|
+
}, hasSplits() {
|
|
913
|
+
return this.daySplits.length && this.isWeekOrDayView;
|
|
914
|
+
}, hasShortEvents() {
|
|
915
|
+
return "short" === this.showAllDayEvents;
|
|
916
|
+
}, cellOrSplitMinWidth() {
|
|
917
|
+
let e2 = null;
|
|
918
|
+
return this.hasSplits && this.minSplitWidth ? e2 = this.visibleDaysCount * this.minSplitWidth * this.daySplits.length : this.minCellWidth && this.isWeekView && (e2 = this.visibleDaysCount * this.minCellWidth), e2;
|
|
919
|
+
}, allDayBar() {
|
|
920
|
+
let e2 = this.allDayBarHeight || null;
|
|
921
|
+
return e2 && !isNaN(e2) && (e2 += "px"), { cells: this.viewCells, options: this.$props, label: this.texts.allDay, shortEvents: this.hasShortEvents, daySplits: this.hasSplits && this.daySplits || [], cellOrSplitMinWidth: this.cellOrSplitMinWidth, height: e2 };
|
|
922
|
+
}, minTimestamp() {
|
|
923
|
+
let e2 = null;
|
|
924
|
+
return this.minDate && "string" == typeof this.minDate ? e2 = this.utils.date.stringToDate(this.minDate) : this.minDate && this.minDate instanceof Date && (e2 = this.minDate), e2 ? e2.getTime() : null;
|
|
925
|
+
}, maxTimestamp() {
|
|
926
|
+
let e2 = null;
|
|
927
|
+
return this.maxDate && "string" == typeof this.maxDate ? e2 = this.utils.date.stringToDate(this.maxDate) : this.maxDate && this.minDate instanceof Date && (e2 = this.maxDate), e2 ? e2.getTime() : null;
|
|
928
|
+
}, weekDays() {
|
|
929
|
+
let { weekDays: e2, weekDaysShort: t2 = [] } = this.texts;
|
|
930
|
+
return e2 = e2.slice(0).map((e3, s2) => ({ label: e3, ...t2.length ? { short: t2[s2] } : {}, hide: this.hideWeekends && s2 >= 5 || this.hideWeekdays.length && this.hideWeekdays.includes(s2 + 1) })), this.startWeekOnSunday && e2.unshift(e2.pop()), e2;
|
|
931
|
+
}, weekDaysInHeader() {
|
|
932
|
+
return this.isMonthView || this.isWeekView && !this.minCellWidth && !(this.hasSplits && this.minSplitWidth);
|
|
933
|
+
}, months() {
|
|
934
|
+
return this.texts.months.map((e2) => ({ label: e2 }));
|
|
935
|
+
}, specialDayHours() {
|
|
936
|
+
return this.specialHours && Object.keys(this.specialHours).length ? Array(7).fill("").map((e2, t2) => {
|
|
937
|
+
let s2 = this.specialHours[t2 + 1] || [];
|
|
938
|
+
return Array.isArray(s2) || (s2 = [s2]), e2 = [], s2.forEach(({ from: s3, to: i2, class: n2 }, a2) => {
|
|
939
|
+
e2[a2] = { day: t2 + 1, from: [null, void 0].includes(s3) ? null : 1 * s3, to: [null, void 0].includes(i2) ? null : 1 * i2, class: n2 || "" };
|
|
940
|
+
}), e2;
|
|
941
|
+
}) : {};
|
|
942
|
+
}, viewTitle() {
|
|
943
|
+
const e2 = this.utils.date;
|
|
944
|
+
let t2 = "";
|
|
945
|
+
const s2 = this.view.startDate, i2 = s2.getFullYear(), n2 = s2.getMonth();
|
|
946
|
+
switch (this.view.id) {
|
|
947
|
+
case "years":
|
|
948
|
+
t2 = this.texts.years;
|
|
949
|
+
break;
|
|
950
|
+
case "year":
|
|
951
|
+
t2 = i2;
|
|
952
|
+
break;
|
|
953
|
+
case "month":
|
|
954
|
+
t2 = `${this.months[n2].label} ${i2}`;
|
|
955
|
+
break;
|
|
956
|
+
case "week": {
|
|
957
|
+
const i3 = this.view.endDate, n3 = s2.getFullYear();
|
|
958
|
+
let a2 = this.texts.months[s2.getMonth()];
|
|
959
|
+
this.xsmall && (a2 = a2.substring(0, 3));
|
|
960
|
+
let l2 = `${a2} ${n3}`;
|
|
961
|
+
if (i3.getMonth() !== s2.getMonth()) {
|
|
962
|
+
const e3 = i3.getFullYear();
|
|
963
|
+
let t3 = this.texts.months[i3.getMonth()];
|
|
964
|
+
this.xsmall && (t3 = t3.substring(0, 3)), l2 = n3 === e3 ? `${a2} - ${t3} ${n3}` : this.small ? `${a2.substring(0, 3)} ${n3} - ${t3.substring(0, 3)} ${e3}` : `${a2} ${n3} - ${t3} ${e3}`;
|
|
965
|
+
}
|
|
966
|
+
t2 = `${this.texts.week} ${e2.getWeek(this.startWeekOnSunday ? e2.addDays(s2, 1) : s2)} (${l2})`;
|
|
967
|
+
break;
|
|
968
|
+
}
|
|
969
|
+
case "day":
|
|
970
|
+
t2 = this.utils.date.formatDate(s2, this.texts.dateFormat, this.texts);
|
|
971
|
+
}
|
|
972
|
+
return t2;
|
|
973
|
+
}, viewCells() {
|
|
974
|
+
const e2 = this.utils.date;
|
|
975
|
+
let t2 = [], s2 = null, i2 = false;
|
|
976
|
+
this.watchRealTime || (this.now = new Date());
|
|
977
|
+
const n2 = this.now;
|
|
978
|
+
switch (this.view.id) {
|
|
979
|
+
case "years":
|
|
980
|
+
s2 = this.view.startDate.getFullYear(), t2 = Array.apply(null, Array(25)).map((t3, i3) => {
|
|
981
|
+
const a2 = new Date(s2 + i3, 0, 1), l2 = new Date(s2 + i3 + 1, 0, 1);
|
|
982
|
+
return l2.setSeconds(-1), { startDate: a2, formattedDate: e2.formatDateLite(a2), endDate: l2, content: s2 + i3, current: s2 + i3 === n2.getFullYear() };
|
|
983
|
+
});
|
|
984
|
+
break;
|
|
985
|
+
case "year":
|
|
986
|
+
s2 = this.view.startDate.getFullYear(), t2 = Array.apply(null, Array(12)).map((t3, i3) => {
|
|
987
|
+
const a2 = new Date(s2, i3, 1), l2 = new Date(s2, i3 + 1, 1);
|
|
988
|
+
return l2.setSeconds(-1), { startDate: a2, formattedDate: e2.formatDateLite(a2), endDate: l2, content: this.xsmall ? this.months[i3].label.substr(0, 3) : this.months[i3].label, current: i3 === n2.getMonth() && s2 === n2.getFullYear() };
|
|
989
|
+
});
|
|
990
|
+
break;
|
|
991
|
+
case "month": {
|
|
992
|
+
const s3 = this.view.startDate.getMonth(), n3 = new Date(this.view.firstCellDate);
|
|
993
|
+
i2 = false, t2 = Array.apply(null, Array(42)).map((t3, a2) => {
|
|
994
|
+
const l2 = e2.addDays(n3, a2), r2 = new Date(l2);
|
|
995
|
+
r2.setHours(23, 59, 59, 0);
|
|
996
|
+
const o2 = !i2 && e2.isToday(l2) && !i2++;
|
|
997
|
+
return { startDate: l2, formattedDate: e2.formatDateLite(l2), endDate: r2, content: l2.getDate(), today: o2, outOfScope: l2.getMonth() !== s3, class: `vuecal__cell--day${l2.getDay() || 7}` };
|
|
998
|
+
}), (this.hideWeekends || this.hideWeekdays.length) && (t2 = t2.filter((e3) => {
|
|
999
|
+
const t3 = e3.startDate.getDay() || 7;
|
|
1000
|
+
return !(this.hideWeekends && t3 >= 6 || this.hideWeekdays.length && this.hideWeekdays.includes(t3));
|
|
1001
|
+
}));
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
case "week": {
|
|
1005
|
+
i2 = false;
|
|
1006
|
+
const s3 = this.view.startDate, n3 = this.weekDays;
|
|
1007
|
+
t2 = n3.map((t3, n4) => {
|
|
1008
|
+
const a2 = e2.addDays(s3, n4), l2 = new Date(a2);
|
|
1009
|
+
l2.setHours(23, 59, 59, 0);
|
|
1010
|
+
const r2 = (a2.getDay() || 7) - 1;
|
|
1011
|
+
return { startDate: a2, formattedDate: e2.formatDateLite(a2), endDate: l2, today: !i2 && e2.isToday(a2) && !i2++, specialHours: this.specialDayHours[r2] || [] };
|
|
1012
|
+
}).filter((e3, t3) => !n3[t3].hide);
|
|
1013
|
+
break;
|
|
1014
|
+
}
|
|
1015
|
+
case "day": {
|
|
1016
|
+
const s3 = this.view.startDate, i3 = new Date(this.view.startDate);
|
|
1017
|
+
i3.setHours(23, 59, 59, 0);
|
|
1018
|
+
const n3 = (s3.getDay() || 7) - 1;
|
|
1019
|
+
t2 = [{ startDate: s3, formattedDate: e2.formatDateLite(s3), endDate: i3, today: e2.isToday(s3), specialHours: this.specialDayHours[n3] || [] }];
|
|
1020
|
+
break;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
return t2;
|
|
1024
|
+
}, visibleDaysCount() {
|
|
1025
|
+
return this.isDayView ? 1 : 7 - this.weekDays.reduce((e2, t2) => e2 + t2.hide, 0);
|
|
1026
|
+
}, cellWidth() {
|
|
1027
|
+
return 100 / this.visibleDaysCount;
|
|
1028
|
+
}, cssClasses() {
|
|
1029
|
+
const { resizeAnEvent: e2, dragAnEvent: t2, dragCreateAnEvent: s2 } = this.domEvents;
|
|
1030
|
+
return { [`vuecal--${this.view.id}-view`]: true, [`vuecal--${this.locale}`]: this.locale, "vuecal--no-time": !this.time, "vuecal--view-with-time": this.hasTimeColumn, "vuecal--week-numbers": this.showWeekNumbers && this.isMonthView, "vuecal--twelve-hour": this.twelveHour, "vuecal--click-to-navigate": this.clickToNavigate, "vuecal--hide-weekends": this.hideWeekends, "vuecal--split-days": this.hasSplits, "vuecal--sticky-split-labels": this.hasSplits && this.stickySplitLabels, "vuecal--overflow-x": this.minCellWidth && this.isWeekView || this.hasSplits && this.minSplitWidth, "vuecal--small": this.small, "vuecal--xsmall": this.xsmall, "vuecal--resizing-event": e2._eid, "vuecal--drag-creating-event": s2.event, "vuecal--dragging-event": t2._eid, "vuecal--events-on-month-view": this.eventsOnMonthView, "vuecal--short-events": this.isMonthView && "short" === this.eventsOnMonthView, "vuecal--has-touch": "undefined" != typeof window && "ontouchstart" in window };
|
|
1031
|
+
}, isYearsOrYearView() {
|
|
1032
|
+
return ["years", "year"].includes(this.view.id);
|
|
1033
|
+
}, isYearsView() {
|
|
1034
|
+
return "years" === this.view.id;
|
|
1035
|
+
}, isYearView() {
|
|
1036
|
+
return "year" === this.view.id;
|
|
1037
|
+
}, isMonthView() {
|
|
1038
|
+
return "month" === this.view.id;
|
|
1039
|
+
}, isWeekOrDayView() {
|
|
1040
|
+
return ["week", "day"].includes(this.view.id);
|
|
1041
|
+
}, isWeekView() {
|
|
1042
|
+
return "week" === this.view.id;
|
|
1043
|
+
}, isDayView() {
|
|
1044
|
+
return "day" === this.view.id;
|
|
1045
|
+
} }, watch: { events: { handler(e2, t2) {
|
|
1046
|
+
this.updateMutableEvents(e2), this.addEventsToView();
|
|
1047
|
+
}, deep: true }, locale(e2) {
|
|
1048
|
+
this.loadLocale(e2);
|
|
1049
|
+
}, selectedDate(e2) {
|
|
1050
|
+
this.updateSelectedDate(e2);
|
|
1051
|
+
}, activeView(e2) {
|
|
1052
|
+
this.switchView(e2);
|
|
1053
|
+
} } };
|
|
1054
|
+
var Ue = z(Pe, [["render", function(w2, D2, g2, f2, k2, M2) {
|
|
1055
|
+
const T2 = p("vuecal-header"), E2 = p("all-day-bar"), C2 = p("weekdays-headings"), S2 = p("vuecal-cell");
|
|
1056
|
+
return e(), t("div", { class: n(["vuecal__flex vuecal", M2.cssClasses]), column: "", ref: "vuecal", lang: g2.locale }, [l(T2, { options: w2.$props, "edit-events": M2.editEvents, "view-props": { views: M2.views, weekDaysInHeader: M2.weekDaysInHeader }, "week-days": M2.weekDays, "has-splits": M2.hasSplits, "day-splits": M2.daySplits, "switch-to-narrower-view": M2.switchToNarrowerView }, y({ "arrow-prev": o(() => [u(w2.$slots, "arrow-prev", {}, () => [oe, de, ue])]), "arrow-next": o(() => [u(w2.$slots, "arrow-next", {}, () => [he, ce, ve])]), "today-button": o(() => [u(w2.$slots, "today-button", {}, () => [d("span", pe, h(k2.texts.today), 1)])]), title: o(() => [u(w2.$slots, "title", { title: M2.viewTitle, view: k2.view }, () => [v(h(M2.viewTitle), 1)])]), _: 2 }, [w2.$slots["weekday-heading"] ? { name: "weekday-heading", fn: o(({ heading: e2, view: t2 }) => [u(w2.$slots, "weekday-heading", { heading: e2, view: t2 })]) } : void 0, w2.$slots["split-label"] ? { name: "split-label", fn: o(({ split: e2 }) => [u(w2.$slots, "split-label", { split: e2, view: k2.view.id })]) } : void 0]), 1032, ["options", "edit-events", "view-props", "week-days", "has-splits", "day-splits", "switch-to-narrower-view"]), g2.hideBody ? c("", true) : (e(), t("div", me, [l(r, { name: `slide-fade--${k2.transitionDirection}`, appear: g2.transitions }, { default: o(() => [(e(), t("div", { class: "vuecal__flex", style: { "min-width": "100%" }, key: !!g2.transitions && k2.view.id, column: "" }, [g2.showAllDayEvents && M2.hasTimeColumn && (!M2.cellOrSplitMinWidth || M2.isDayView && !g2.minSplitWidth) ? (e(), m(E2, _(b({ key: 0 }, M2.allDayBar)), { event: o(({ event: s2, view: i2 }) => [u(w2.$slots, "event", { view: i2, event: s2 }, () => [M2.editEvents.title && s2.titleEditable ? (e(), t("div", { key: 0, class: "vuecal__event-title vuecal__event-title--edit", contenteditable: "", onBlur: (e2) => M2.onEventTitleBlur(e2, s2), innerHTML: s2.title }, null, 40, we)) : s2.title ? (e(), t("div", { key: 1, class: "vuecal__event-title", innerHTML: s2.title }, null, 8, ye)) : c("", true), !s2.content || M2.hasShortEvents || M2.isShortMonthView ? c("", true) : (e(), t("div", { key: 2, class: "vuecal__event-content", innerHTML: s2.content }, null, 8, De))])]), _: 3 }, 16)) : c("", true), d("div", { class: n(["vuecal__bg", { vuecal__flex: !M2.hasTimeColumn }]), column: "" }, [d("div", ge, [M2.hasTimeColumn ? (e(), t("div", fe, [g2.showAllDayEvents && M2.cellOrSplitMinWidth && (!M2.isDayView || g2.minSplitWidth) ? (e(), t("div", { key: 0, class: "vuecal__all-day-text", style: a({ height: M2.allDayBar.height }) }, [d("span", null, h(k2.texts.allDay), 1)], 4)) : c("", true), (e(true), t(s, null, i(M2.timeCells, (s2, i2) => (e(), t("div", { class: "vuecal__time-cell", key: i2, style: a(`height: ${g2.timeCellHeight}px`) }, [u(w2.$slots, "time-cell", { hours: s2.hours, minutes: s2.minutes }, () => [_e, d("span", be, h(s2.label), 1)])], 4))), 128))])) : c("", true), g2.showWeekNumbers && M2.isMonthView ? (e(), t("div", ke, [(e(), t(s, null, i(6, (e2) => d("div", { class: "vuecal__flex vuecal__week-number-cell", key: e2, grow: "" }, [u(w2.$slots, "week-number-cell", { week: M2.getWeekNumber(e2 - 1) }, () => [v(h(M2.getWeekNumber(e2 - 1)), 1)])])), 64))])) : c("", true), d("div", { class: n(["vuecal__flex vuecal__cells", `${k2.view.id}-view`]), grow: "", wrap: !M2.cellOrSplitMinWidth || !M2.isWeekView, column: !!M2.cellOrSplitMinWidth }, [M2.cellOrSplitMinWidth && M2.isWeekView ? (e(), m(C2, { key: 0, "transition-direction": k2.transitionDirection, "week-days": M2.weekDays, "switch-to-narrower-view": M2.switchToNarrowerView, style: a(M2.cellOrSplitMinWidth ? `min-width: ${M2.cellOrSplitMinWidth}px` : "") }, y({ _: 2 }, [w2.$slots["weekday-heading"] ? { name: "weekday-heading", fn: o(({ heading: e2, view: t2 }) => [u(w2.$slots, "weekday-heading", { heading: e2, view: t2 })]) } : void 0, w2.$slots["split-label"] ? { name: "split-label", fn: o(({ split: e2 }) => [u(w2.$slots, "split-label", { split: e2, view: k2.view.id })]) } : void 0]), 1032, ["transition-direction", "week-days", "switch-to-narrower-view", "style"])) : M2.hasSplits && g2.stickySplitLabels && g2.minSplitWidth ? (e(), t("div", { key: 1, class: "vuecal__flex vuecal__split-days-headers", style: a(M2.cellOrSplitMinWidth ? `min-width: ${M2.cellOrSplitMinWidth}px` : "") }, [(e(true), t(s, null, i(M2.daySplits, (s2, i2) => (e(), t("div", { class: n(["day-split-header", s2.class || false]), key: i2 }, [u(w2.$slots, "split-label", { split: s2, view: k2.view.id }, () => [v(h(s2.label), 1)])], 2))), 128))], 4)) : c("", true), g2.showAllDayEvents && M2.hasTimeColumn && (M2.isWeekView && M2.cellOrSplitMinWidth || M2.isDayView && M2.hasSplits && g2.minSplitWidth) ? (e(), m(E2, _(b({ key: 2 }, M2.allDayBar)), { event: o(({ event: s2, view: i2 }) => [u(w2.$slots, "event", { view: i2, event: s2 }, () => [M2.editEvents.title && s2.titleEditable ? (e(), t("div", { key: 0, class: "vuecal__event-title vuecal__event-title--edit", contenteditable: "", onBlur: (e2) => M2.onEventTitleBlur(e2, s2), innerHTML: s2.title }, null, 40, Te)) : s2.title ? (e(), t("div", { key: 1, class: "vuecal__event-title", innerHTML: s2.title }, null, 8, Ee)) : c("", true), !s2.content || M2.hasShortEvents || M2.isShortMonthView ? c("", true) : (e(), t("div", { key: 2, class: "vuecal__event-content", innerHTML: s2.content }, null, 8, Ce))])]), _: 3 }, 16)) : c("", true), d("div", { class: "vuecal__flex", ref: (e2) => k2.cellsEl = e2, grow: "", wrap: !M2.cellOrSplitMinWidth || !M2.isWeekView, style: a(M2.cellOrSplitMinWidth ? `min-width: ${M2.cellOrSplitMinWidth}px` : "") }, [(e(true), t(s, null, i(M2.viewCells, (s2, i2) => (e(), m(S2, { key: i2, options: w2.$props, "edit-events": M2.editEvents, data: s2, "cell-width": g2.hideWeekdays.length && (M2.isWeekView || M2.isMonthView) && M2.cellWidth, "min-timestamp": M2.minTimestamp, "max-timestamp": M2.maxTimestamp, "cell-splits": M2.hasSplits && M2.daySplits || [] }, { "cell-content": o(({ events: i3, split: n2, selectCell: a2 }) => [u(w2.$slots, "cell-content", { cell: s2, view: k2.view, goNarrower: a2, events: i3 }, () => [n2 && !g2.stickySplitLabels ? (e(), t("div", { key: 0, class: "split-label", innerHTML: n2.label }, null, 8, Oe)) : c("", true), s2.content ? (e(), t("div", { key: 1, class: "vuecal__cell-date", innerHTML: s2.content }, null, 8, $e)) : c("", true), (M2.isMonthView && !g2.eventsOnMonthView || M2.isYearsOrYearView && g2.eventsCountOnYearView) && i3.length ? (e(), t("div", xe, [u(w2.$slots, "events-count", { view: k2.view, events: i3 }, () => [v(h(i3.length), 1)])])) : c("", true), !M2.cellOrSplitHasEvents(i3, n2) && M2.isWeekOrDayView ? (e(), t("div", He, [u(w2.$slots, "no-event", {}, () => [v(h(k2.texts.noEvent), 1)])])) : c("", true)])]), event: o(({ event: i3, view: n2 }) => [u(w2.$slots, "event", { view: n2, event: i3 }, () => [M2.editEvents.title && i3.titleEditable ? (e(), t("div", { key: 0, class: "vuecal__event-title vuecal__event-title--edit", contenteditable: "", onBlur: (e2) => M2.onEventTitleBlur(e2, i3), innerHTML: i3.title }, null, 40, We)) : i3.title ? (e(), t("div", { key: 1, class: "vuecal__event-title", innerHTML: i3.title }, null, 8, je)) : c("", true), !g2.time || i3.allDay || M2.isMonthView && (i3.allDay || "short" === g2.showAllDayEvents) || M2.isShortMonthView ? c("", true) : (e(), t("div", Ae, [v(h(k2.utils.date.formatTime(i3.start, M2.TimeFormat)), 1), i3.endTimeMinutes ? (e(), t("span", Ve, "\xA0- " + h(k2.utils.date.formatTime(i3.end, M2.TimeFormat, null, true)), 1)) : c("", true), i3.daysCount > 1 && (i3.segments[s2.formattedDate] || {}).isFirstDay ? (e(), t("small", Ye, "\xA0+" + h(i3.daysCount - 1) + h((k2.texts.day[0] || "").toLowerCase()), 1)) : c("", true)])), !i3.content || M2.isMonthView && i3.allDay && "short" === g2.showAllDayEvents || M2.isShortMonthView ? c("", true) : (e(), t("div", { key: 3, class: "vuecal__event-content", innerHTML: i3.content }, null, 8, Le))])]), "no-event": o(() => [u(w2.$slots, "no-event", {}, () => [v(h(k2.texts.noEvent), 1)])]), _: 2 }, 1032, ["options", "edit-events", "data", "cell-width", "min-timestamp", "max-timestamp", "cell-splits"]))), 128))], 12, Se)], 10, Me)])], 2)]))]), _: 3 }, 8, ["name", "appear"]), k2.ready ? c("", true) : (e(), t("div", Fe, Be))]))], 10, re);
|
|
1057
|
+
}]]);
|
|
1058
|
+
export { Ue as default };
|