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