vue-cal 5.0.1-rc.6 → 5.0.1-rc.8
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/vue-cal.es.js +1214 -1233
- package/dist/vue-cal.umd.js +4 -4
- package/package.json +1 -1
package/dist/vue-cal.es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { computed as T, reactive as $e, watch as me, toRefs as
|
|
1
|
+
import { computed as T, reactive as $e, watch as me, toRefs as rt, ref as ie, onBeforeUnmount as Xe, inject as Ne, createElementBlock as j, openBlock as Y, renderSlot as F, createCommentVNode as Z, unref as O, Fragment as te, renderList as we, normalizeClass as _e, createElementVNode as ge, createVNode as Oe, Transition as Ge, withCtx as J, createBlock as Se, resolveDynamicComponent as Ke, mergeProps as De, toHandlers as Ie, normalizeProps as se, guardReactiveProps as ne, toDisplayString as le, onMounted as Ze, withModifiers as Qe, nextTick as Ue, normalizeStyle as Te, createTextVNode as xe, TransitionGroup as et, createSlots as je, useTemplateRef as ot, useId as it, useAttrs as ut, provide as ct } from "vue";
|
|
2
|
+
import st from "./i18n/en-us.json";
|
|
2
3
|
/**
|
|
3
|
-
* vue-cal v5.0.1-rc.
|
|
4
|
+
* vue-cal v5.0.1-rc.8
|
|
4
5
|
* (c) 2024-2025 Antoni Andre <antoniandre.web@gmail.com>
|
|
5
6
|
* @license MIT
|
|
6
7
|
*/
|
|
@@ -33,352 +34,358 @@ const fe = {
|
|
|
33
34
|
years: { cols: 5, rows: 5 }
|
|
34
35
|
// Arbitrary range of quarters of century (25y).
|
|
35
36
|
}
|
|
36
|
-
},
|
|
37
|
-
const { dateUtils:
|
|
38
|
-
if (
|
|
37
|
+
}, dt = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], Re = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], vt = Re.reduce((D, s, r) => (D[s] = r || 7, D), {}), mt = (D, s, r) => {
|
|
38
|
+
const { dateUtils: g } = D, p = !1, b = T(() => {
|
|
39
|
+
if (W.value[s.view]) return s.view;
|
|
39
40
|
{
|
|
40
|
-
const
|
|
41
|
-
return
|
|
42
|
-
`Vue Cal: the provided or default view \`${
|
|
43
|
-
), Object.keys(
|
|
41
|
+
const n = s.datePicker ? "month" : "week", l = s.view || n;
|
|
42
|
+
return W.value[l] ? l : (console.warn(
|
|
43
|
+
`Vue Cal: the provided or default view \`${l}\` is either invalid or not in the list of available views. The first available view will be chosen: \`${Object.keys(W.value)[0]}\`.`
|
|
44
|
+
), Object.keys(W.value)[0]);
|
|
44
45
|
}
|
|
45
|
-
}),
|
|
46
|
-
const
|
|
46
|
+
}), L = T(() => s.sm && !s.xs), v = T(() => s.xs || s.datePicker), C = T(() => s.clickToNavigate || s.datePicker && s.clickToNavigate !== !1), o = T(() => {
|
|
47
|
+
const n = {
|
|
47
48
|
cell: {},
|
|
48
49
|
// All possible event listeners to attach to cells.
|
|
49
50
|
event: {}
|
|
50
51
|
// All possible event listeners to attach to calendar events.
|
|
51
|
-
},
|
|
52
|
-
return Object.entries(
|
|
53
|
-
const [
|
|
54
|
-
|
|
55
|
-
}),
|
|
56
|
-
}),
|
|
57
|
-
var
|
|
58
|
-
const
|
|
59
|
-
return s.hideWeekends && (
|
|
60
|
-
}),
|
|
61
|
-
const
|
|
62
|
-
let
|
|
52
|
+
}, l = (k) => k.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
53
|
+
return Object.entries(r).forEach(([k, t]) => {
|
|
54
|
+
const [V, H, U] = k.match(/^on(Cell|Event)(.+)$/) || [];
|
|
55
|
+
V && (n[H.toLowerCase()][l(U).replace(/^-+|-+$/g, "")] = t);
|
|
56
|
+
}), n;
|
|
57
|
+
}), m = T(() => {
|
|
58
|
+
var l;
|
|
59
|
+
const n = {};
|
|
60
|
+
return s.hideWeekends && (n[6] = !0) && (n[7] = !0), (l = s.hideWeekdays) != null && l.length && s.hideWeekdays.forEach((k) => n[vt[k]] = !0), n;
|
|
61
|
+
}), $ = T(() => s.hideWeekends || m.value[6] && m.value[7]), W = T(() => {
|
|
62
|
+
const n = s.datePicker;
|
|
63
|
+
let l = 0, k = {};
|
|
63
64
|
const t = s.views;
|
|
64
|
-
return
|
|
65
|
+
return n && !t ? {
|
|
65
66
|
month: { ...fe.availableViews.month },
|
|
66
67
|
year: { ...fe.availableViews.year },
|
|
67
68
|
years: { ...fe.availableViews.years }
|
|
68
|
-
} : (t ? (Array.isArray(t) ? k = t.reduce((
|
|
69
|
-
const { cols: K, rows:
|
|
70
|
-
return
|
|
71
|
-
}, {})),
|
|
72
|
-
}), G = T(() => s.datePicker ? "month" :
|
|
73
|
-
if (typeof s.selectedDate == "string") return
|
|
69
|
+
} : (t ? (Array.isArray(t) ? k = t.reduce((V, H) => (typeof H == "string" && fe.availableViews[H] ? V[H] = fe.availableViews[H] : l++, V), {}) : typeof t == "object" && (k = Object.entries(t).reduce((V, [H, U]) => {
|
|
70
|
+
const { cols: K, rows: ue } = fe.availableViews[H];
|
|
71
|
+
return V[H] = { cols: U.cols || K, rows: U.rows || ue }, V;
|
|
72
|
+
}, {})), l && console.warn("Vue Cal: the provided `views` prop contains invalid views that will be ignored."), Object.keys(k).length || (console.warn("Vue Cal: No valid view in the provided `views` prop. Falling back to default views."), k = { ...fe.availableViews })) : k = { ...fe.availableViews }, k);
|
|
73
|
+
}), G = T(() => s.datePicker ? "month" : W.value.week ? "week" : Object.keys(W.value)[0]), i = T(() => {
|
|
74
|
+
if (typeof s.selectedDate == "string") return g.stringToDate(s.selectedDate);
|
|
74
75
|
if (s.selectedDate instanceof Date) return s.selectedDate;
|
|
75
76
|
s.selectedDate ? console.warn("Vue Cal: The provided selected date is invalid:", s.selectedDate) : console.log("Vue Cal: Info - The provided selected date is undefined.");
|
|
76
|
-
}),
|
|
77
|
+
}), u = T(() => {
|
|
77
78
|
if (!s.disableDays) return [];
|
|
78
|
-
const
|
|
79
|
-
return Array.isArray(s.disableDays) ? s.disableDays.forEach((
|
|
80
|
-
let k =
|
|
81
|
-
if (typeof
|
|
82
|
-
|
|
79
|
+
const n = [];
|
|
80
|
+
return Array.isArray(s.disableDays) ? s.disableDays.forEach((l) => {
|
|
81
|
+
let k = l;
|
|
82
|
+
if (typeof l == "string" ? k = g.stringToDate(l) : l instanceof Date && (l = g.formatDate(l, "YYYY-MM-DD")), k instanceof Date && !isNaN(k.getTime())) {
|
|
83
|
+
n.push(l);
|
|
83
84
|
return;
|
|
84
|
-
} else console.warn("Vue Cal: The provided `disableDays` prop contains an invalid date:",
|
|
85
|
-
}) : console.warn("Vue Cal: The provided `disableDays` prop is invalid:", s.disableDays),
|
|
85
|
+
} else console.warn("Vue Cal: The provided `disableDays` prop contains an invalid date:", l);
|
|
86
|
+
}) : console.warn("Vue Cal: The provided `disableDays` prop is invalid:", s.disableDays), n;
|
|
86
87
|
}), e = T(() => {
|
|
87
|
-
let
|
|
88
|
-
return s.minDate && typeof s.minDate == "string" ?
|
|
89
|
-
}),
|
|
90
|
-
let
|
|
91
|
-
return s.maxDate && typeof s.maxDate == "string" ?
|
|
92
|
-
}),
|
|
88
|
+
let n = null;
|
|
89
|
+
return s.minDate && typeof s.minDate == "string" ? n = g.stringToDate(s.minDate) : s.minDate && s.minDate instanceof Date && (n = s.minDate), (n == null ? void 0 : n.getTime()) || null;
|
|
90
|
+
}), d = T(() => {
|
|
91
|
+
let n = null;
|
|
92
|
+
return s.maxDate && typeof s.maxDate == "string" ? n = g.stringToDate(s.maxDate) : s.maxDate && s.maxDate instanceof Date && (n = s.maxDate), (n == null ? void 0 : n.getTime()) || null;
|
|
93
|
+
}), h = T(() => {
|
|
93
94
|
var k;
|
|
94
|
-
const { view:
|
|
95
|
-
return s.schedules.length && (
|
|
96
|
-
}),
|
|
97
|
-
const
|
|
95
|
+
const { view: n } = D;
|
|
96
|
+
return s.schedules.length && (n.isDay || n.isDays || n.isWeek) && ((k = s.schedules) == null ? void 0 : k.map((t, V) => ({ ...t, id: t.id ?? V + 1 }))) || void 0;
|
|
97
|
+
}), E = T(() => {
|
|
98
|
+
const n = {
|
|
98
99
|
drag: !0,
|
|
99
100
|
resize: !0,
|
|
100
101
|
delete: !0,
|
|
101
102
|
create: !0
|
|
102
103
|
};
|
|
103
|
-
return s.editableEvents === !0 ?
|
|
104
|
-
}),
|
|
104
|
+
return s.editableEvents === !0 ? n : s.editableEvents === !1 ? Object.keys(n).map((l) => n[l] = !1) : { ...n, ...s.editableEvents };
|
|
105
|
+
}), P = async (n) => {
|
|
105
106
|
var k;
|
|
106
|
-
let
|
|
107
|
+
let l = /* @__PURE__ */ Object.assign({ "../i18n/ar.json": () => import("./i18n/ar.json").then((t) => t.default), "../i18n/bg.json": () => import("./i18n/bg.json").then((t) => t.default), "../i18n/bn.json": () => import("./i18n/bn.json").then((t) => t.default), "../i18n/bs.json": () => import("./i18n/bs.json").then((t) => t.default), "../i18n/ca.json": () => import("./i18n/ca.json").then((t) => t.default), "../i18n/cs.json": () => import("./i18n/cs.json").then((t) => t.default), "../i18n/da.json": () => import("./i18n/da.json").then((t) => t.default), "../i18n/de.json": () => import("./i18n/de.json").then((t) => t.default), "../i18n/el.json": () => import("./i18n/el.json").then((t) => t.default), "../i18n/en-gb.json": () => import("./i18n/en-gb.json").then((t) => t.default), "../i18n/en-us.json": () => import("./i18n/en-us.json").then((t) => t.default), "../i18n/es.json": () => import("./i18n/es.json").then((t) => t.default), "../i18n/et.json": () => import("./i18n/et.json").then((t) => t.default), "../i18n/fa.json": () => import("./i18n/fa.json").then((t) => t.default), "../i18n/fi.json": () => import("./i18n/fi.json").then((t) => t.default), "../i18n/fr.json": () => import("./i18n/fr.json").then((t) => t.default), "../i18n/he.json": () => import("./i18n/he.json").then((t) => t.default), "../i18n/hr.json": () => import("./i18n/hr.json").then((t) => t.default), "../i18n/hu.json": () => import("./i18n/hu.json").then((t) => t.default), "../i18n/id.json": () => import("./i18n/id.json").then((t) => t.default), "../i18n/is.json": () => import("./i18n/is.json").then((t) => t.default), "../i18n/it.json": () => import("./i18n/it.json").then((t) => t.default), "../i18n/ja.json": () => import("./i18n/ja.json").then((t) => t.default), "../i18n/ka.json": () => import("./i18n/ka.json").then((t) => t.default), "../i18n/ko.json": () => import("./i18n/ko.json").then((t) => t.default), "../i18n/lt.json": () => import("./i18n/lt.json").then((t) => t.default), "../i18n/mn.json": () => import("./i18n/mn.json").then((t) => t.default), "../i18n/nl.json": () => import("./i18n/nl.json").then((t) => t.default), "../i18n/no.json": () => import("./i18n/no.json").then((t) => t.default), "../i18n/pl.json": () => import("./i18n/pl.json").then((t) => t.default), "../i18n/pt-br.json": () => import("./i18n/pt-br.json").then((t) => t.default), "../i18n/pt-pt.json": () => import("./i18n/pt-pt.json").then((t) => t.default), "../i18n/ro.json": () => import("./i18n/ro.json").then((t) => t.default), "../i18n/ru.json": () => import("./i18n/ru.json").then((t) => t.default), "../i18n/sk.json": () => import("./i18n/sk.json").then((t) => t.default), "../i18n/sl.json": () => import("./i18n/sl.json").then((t) => t.default), "../i18n/sq.json": () => import("./i18n/sq.json").then((t) => t.default), "../i18n/sr.json": () => import("./i18n/sr.json").then((t) => t.default), "../i18n/sv.json": () => import("./i18n/sv.json").then((t) => t.default), "../i18n/tr.json": () => import("./i18n/tr.json").then((t) => t.default), "../i18n/uk.json": () => import("./i18n/uk.json").then((t) => t.default), "../i18n/vi.json": () => import("./i18n/vi.json").then((t) => t.default), "../i18n/zh-cn.json": () => import("./i18n/zh-cn.json").then((t) => t.default), "../i18n/zh-hk.json": () => import("./i18n/zh-hk.json").then((t) => t.default) });
|
|
107
108
|
{
|
|
108
|
-
if (!
|
|
109
|
-
console.warn(`Vue Cal: the locale \`${
|
|
109
|
+
if (!l[`../i18n/${n}.json`]) {
|
|
110
|
+
console.warn(`Vue Cal: the locale \`${n}\` does not exist. Falling back to \`en-us\`.`), n = "en-us";
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
+
l = await ((k = l[`../i18n/${n}.json`]) == null ? void 0 : k.call(l));
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
events: B,
|
|
115
|
+
D.texts = Object.assign(D.texts, Object.assign({ ...fe.texts }, l)), g.updateTexts(D.texts);
|
|
116
|
+
}, A = $e(s.events || []);
|
|
117
|
+
return me(() => s.events, (n) => A.splice(0, A.length, ...n)), me(() => s.locale, (n) => P(n || "en-us")), (s.locale || !D.texts.today) && P(s.locale || "en-us"), {
|
|
118
|
+
...rt(s),
|
|
119
|
+
events: A,
|
|
120
120
|
// All the events listeners for cells and events that the end user may have attached to vue-cal.
|
|
121
121
|
eventListeners: o,
|
|
122
122
|
defaultView: G,
|
|
123
|
-
availableViews:
|
|
124
|
-
disableDays:
|
|
125
|
-
ready:
|
|
126
|
-
sm:
|
|
127
|
-
xs:
|
|
128
|
-
clickToNavigate:
|
|
129
|
-
hideWeekdays:
|
|
130
|
-
hideWeekends:
|
|
123
|
+
availableViews: W,
|
|
124
|
+
disableDays: u,
|
|
125
|
+
ready: p,
|
|
126
|
+
sm: L,
|
|
127
|
+
xs: v,
|
|
128
|
+
clickToNavigate: C,
|
|
129
|
+
hideWeekdays: m,
|
|
130
|
+
hideWeekends: $,
|
|
131
131
|
minTimestamp: e,
|
|
132
|
-
maxTimestamp:
|
|
133
|
-
schedules:
|
|
134
|
-
selectedDate:
|
|
135
|
-
editableEvents:
|
|
136
|
-
view:
|
|
132
|
+
maxTimestamp: d,
|
|
133
|
+
schedules: h,
|
|
134
|
+
selectedDate: i,
|
|
135
|
+
editableEvents: E,
|
|
136
|
+
view: b,
|
|
137
137
|
// Getters.
|
|
138
138
|
get hasHiddenDays() {
|
|
139
|
-
return Object.keys(
|
|
139
|
+
return Object.keys(m.value).length;
|
|
140
140
|
},
|
|
141
141
|
get size() {
|
|
142
|
-
return
|
|
142
|
+
return v.value ? "xs" : L.value ? "sm" : "lg";
|
|
143
143
|
},
|
|
144
|
-
loadTexts:
|
|
144
|
+
loadTexts: P
|
|
145
145
|
};
|
|
146
|
-
}, Ve = (
|
|
147
|
-
const
|
|
148
|
-
return (
|
|
149
|
-
}, Pe = (
|
|
150
|
-
const
|
|
151
|
-
return ~~(
|
|
152
|
-
}, Je = (
|
|
153
|
-
const
|
|
154
|
-
return
|
|
146
|
+
}, Ve = (D, s) => {
|
|
147
|
+
const r = s.timeTo - s.timeFrom;
|
|
148
|
+
return (D - s.timeFrom) * 100 / r;
|
|
149
|
+
}, Pe = (D, s) => {
|
|
150
|
+
const r = s.timeTo - s.timeFrom;
|
|
151
|
+
return ~~(D * r / 100 + s.timeFrom);
|
|
152
|
+
}, Je = (D, s) => {
|
|
153
|
+
const r = s.clientHeight;
|
|
154
|
+
return D * 100 / r;
|
|
155
155
|
}, Ae = $e({ id: null, date: null });
|
|
156
156
|
let tt = !1, qe = !0;
|
|
157
|
-
const
|
|
157
|
+
const pe = $e({ el: null, cell: null, timeout: null }), be = $e({
|
|
158
158
|
eventId: null,
|
|
159
159
|
fromVueCal: null,
|
|
160
160
|
toVueCal: null
|
|
161
161
|
});
|
|
162
|
-
function
|
|
163
|
-
const { config: s, view:
|
|
164
|
-
var
|
|
165
|
-
const { timeStep:
|
|
166
|
-
return Pe(Je(
|
|
167
|
-
},
|
|
168
|
-
const
|
|
169
|
-
let
|
|
162
|
+
function ft(D) {
|
|
163
|
+
const { config: s, view: r, eventsManager: g, emit: p, uid: b, dateUtils: L } = D, v = (e) => {
|
|
164
|
+
var l;
|
|
165
|
+
const { timeStep: d, timeCellHeight: h, timeFrom: E } = s, P = (((l = e.touches) == null ? void 0 : l[0]) || e).clientY, { top: A } = e.currentTarget.getBoundingClientRect(), n = P - A - ~~e.dataTransfer.getData("cursor-grab-at");
|
|
166
|
+
return Pe(Je(n, e.currentTarget), s);
|
|
167
|
+
}, C = (e, d, h) => {
|
|
168
|
+
const E = d.duration || o(d.start, d.end) || s.timeStep;
|
|
169
|
+
let P = Math.max(v(e), 0);
|
|
170
170
|
if (s.snapToInterval) {
|
|
171
|
-
const k =
|
|
172
|
-
|
|
171
|
+
const k = P + s.snapToInterval / 2;
|
|
172
|
+
P = k - k % s.snapToInterval;
|
|
173
173
|
}
|
|
174
|
-
const
|
|
175
|
-
return { start:
|
|
176
|
-
}, o = (e,
|
|
174
|
+
const A = new Date(new Date(h).setMinutes(P)), n = Math.min(P + E, 24 * 60), l = new Date(new Date(h).setMinutes(n));
|
|
175
|
+
return { start: A, end: l };
|
|
176
|
+
}, o = (e, d) => Math.round((d - e) / 6e4);
|
|
177
177
|
return {
|
|
178
|
-
eventDragStart: (e,
|
|
179
|
-
if (e.target.nodeType === 3 ||
|
|
180
|
-
e.dataTransfer.dropEffect = "move";
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
178
|
+
eventDragStart: (e, d) => {
|
|
179
|
+
if (e.target.nodeType === 3 || D.touch.isResizingEvent) return e.preventDefault();
|
|
180
|
+
e.dataTransfer.effectAllowed = "move", e.dataTransfer.dropEffect = "move";
|
|
181
|
+
const h = { ...d, _: { id: d._.id, duration: o(d.start, d.end) } };
|
|
182
|
+
try {
|
|
183
|
+
e.dataTransfer.setData("text/plain", ""), e.dataTransfer.setData("event", JSON.stringify(h)), e.dataTransfer.setData("cursor-grab-at", e.offsetY);
|
|
184
|
+
} catch (P) {
|
|
185
|
+
return console.warn("Vue Cal: Failed to set drag data:", P), e.preventDefault();
|
|
186
|
+
}
|
|
187
|
+
be.eventId = d._.id, be.fromVueCal = b;
|
|
188
|
+
const E = e.target.closest(".vuecal__event");
|
|
189
|
+
E.classList.add("vuecal__event--dragging-ghost"), setTimeout(() => {
|
|
190
|
+
E.classList.add("vuecal__event--dragging-original"), E.classList.remove("vuecal__event--dragging-ghost");
|
|
191
|
+
}, 0), tt = !1, Object.assign(Ae, { id: r.id, date: r.firstCellDate }), qe = !0, D.touch.isDraggingEvent = !0;
|
|
187
192
|
},
|
|
188
|
-
eventDragEnd: (e,
|
|
193
|
+
eventDragEnd: (e, d) => {
|
|
189
194
|
be.eventId = null, e.target.closest(".vuecal__event").classList.remove("vuecal__event--dragging-original");
|
|
190
|
-
const { fromVueCal:
|
|
191
|
-
|
|
195
|
+
const { fromVueCal: h, toVueCal: E } = be;
|
|
196
|
+
E && h !== E && g.deleteEvent(d._.id, 3), be.fromVueCal = null, be.toVueCal = null, tt && qe && Ae.id && r.switchView(Ae.id, Ae.date, !0), D.touch.isDraggingEvent = !1;
|
|
192
197
|
},
|
|
193
|
-
cellDragEnter: (e,
|
|
194
|
-
const { start:
|
|
198
|
+
cellDragEnter: (e, d) => {
|
|
199
|
+
const { start: h } = d, E = e.currentTarget;
|
|
195
200
|
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
196
|
-
if (
|
|
197
|
-
|
|
201
|
+
if (E === pe.el || !E.className.includes("vuecal__cell-content")) return !1;
|
|
202
|
+
pe.el && (pe.cell.highlighted = !1), Object.assign(pe, { el: E, cell: d, timeout: clearTimeout(pe.timeout) }), d.highlighted = !0, ["years", "year", "month"].includes(r.id) && (pe.timeout = setTimeout(() => D.switchToNarrowerView(h), 2e3));
|
|
198
203
|
}
|
|
199
204
|
},
|
|
200
|
-
cellDragOver: (e,
|
|
201
|
-
const { start:
|
|
202
|
-
e.preventDefault(),
|
|
205
|
+
cellDragOver: (e, d) => {
|
|
206
|
+
const { start: h, schedule: E } = d;
|
|
207
|
+
e.preventDefault(), d.highlighted = !0, (E || E === 0) && (d.highlightedSchedule = E);
|
|
203
208
|
},
|
|
204
|
-
cellDragLeave: (e,
|
|
205
|
-
e.preventDefault(), !e.currentTarget.contains(e.relatedTarget) && (
|
|
209
|
+
cellDragLeave: (e, d) => {
|
|
210
|
+
e.preventDefault(), !e.currentTarget.contains(e.relatedTarget) && (d.highlightedSchedule = !1, pe.cell === d && (clearTimeout(pe.timeout), Object.assign(pe, { el: null, cell: null, timeout: null }), d.highlighted = !1));
|
|
206
211
|
},
|
|
207
|
-
cellDragDrop: async (e,
|
|
208
|
-
var
|
|
209
|
-
e.preventDefault(), clearTimeout(
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
let
|
|
213
|
-
const { start:
|
|
214
|
-
let
|
|
212
|
+
cellDragDrop: async (e, d) => {
|
|
213
|
+
var V, H, U;
|
|
214
|
+
e.preventDefault(), clearTimeout(pe.timeout), Object.assign(pe, { el: null, cell: null, timeout: null });
|
|
215
|
+
const h = JSON.parse(e.dataTransfer.getData("event") || "{}");
|
|
216
|
+
h.start && (h.start = new Date(h.start)), h.end && (h.end = new Date(h.end));
|
|
217
|
+
let E;
|
|
218
|
+
const { start: P, end: A } = C(e, h, d.start), { schedule: n } = ((V = e.target.closest("[data-schedule]")) == null ? void 0 : V.dataset) || {};
|
|
219
|
+
let l = () => {
|
|
215
220
|
};
|
|
216
|
-
be.fromVueCal ===
|
|
217
|
-
|
|
218
|
-
})) : (
|
|
219
|
-
...
|
|
220
|
-
start:
|
|
221
|
-
end:
|
|
222
|
-
...
|
|
223
|
-
_: { id: ((
|
|
224
|
-
getOverlappingEvents: () =>
|
|
225
|
-
|
|
226
|
-
{ start:
|
|
227
|
-
{ schedule: ~~
|
|
221
|
+
be.fromVueCal === b ? (E = g.getEvent(h._.id), E && (E._.dragging = !1, l = () => {
|
|
222
|
+
E.start = P, E.end = A, n !== void 0 && (E.schedule = ~~n);
|
|
223
|
+
})) : (E = {
|
|
224
|
+
...h,
|
|
225
|
+
start: P,
|
|
226
|
+
end: A,
|
|
227
|
+
...n !== void 0 && { schedule: ~~n },
|
|
228
|
+
_: { id: ((H = h._) == null ? void 0 : H.id) || h.id, duration: o(P, A) },
|
|
229
|
+
getOverlappingEvents: () => g.getEventsInRange(
|
|
230
|
+
g.getEventsByDate(L.formatDate(P), !0),
|
|
231
|
+
{ start: P, end: A },
|
|
232
|
+
{ schedule: ~~n }
|
|
228
233
|
)
|
|
229
|
-
},
|
|
230
|
-
|
|
234
|
+
}, l = () => {
|
|
235
|
+
E = g.createEvent(E);
|
|
231
236
|
});
|
|
232
237
|
let k = !0;
|
|
233
|
-
const { drop: t } = (
|
|
238
|
+
const { drop: t } = (U = s.eventListeners) == null ? void 0 : U.event;
|
|
234
239
|
t && (k = await t({
|
|
235
240
|
e,
|
|
236
|
-
event: { ...
|
|
237
|
-
overlaps:
|
|
238
|
-
cell:
|
|
239
|
-
external: be.fromVueCal !==
|
|
240
|
-
})), k !== !1 &&
|
|
241
|
+
event: { ...E, start: P, end: A, schedule: ~~n },
|
|
242
|
+
overlaps: E.getOverlappingEvents({ start: P, end: A, schedule: ~~n }),
|
|
243
|
+
cell: d,
|
|
244
|
+
external: be.fromVueCal !== b
|
|
245
|
+
})), k !== !1 && l(), d.highlighted = !1, d.highlightedSchedule = null, qe = !1, be.toVueCal = b, p("event-dropped", {
|
|
241
246
|
e,
|
|
242
|
-
cell:
|
|
243
|
-
event:
|
|
244
|
-
originalEvent:
|
|
245
|
-
external: be.fromVueCal !==
|
|
247
|
+
cell: d,
|
|
248
|
+
event: E,
|
|
249
|
+
originalEvent: h,
|
|
250
|
+
external: be.fromVueCal !== b
|
|
246
251
|
});
|
|
247
252
|
}
|
|
248
253
|
};
|
|
249
254
|
}
|
|
250
|
-
const
|
|
251
|
-
let
|
|
252
|
-
const
|
|
253
|
-
Date.prototype.addDays = function(a) {
|
|
254
|
-
return
|
|
255
|
+
const nt = (D, s) => {
|
|
256
|
+
let r, g, p, b = {}, L = {};
|
|
257
|
+
const v = ie(D), C = () => {
|
|
258
|
+
v.value.today || (v.value = s), Date.prototype.addDays = function(a) {
|
|
259
|
+
return W(this, a || 0);
|
|
255
260
|
}, Date.prototype.subtractDays = function(a) {
|
|
256
|
-
return N(this, a || 0);
|
|
257
|
-
}, Date.prototype.addHours = function(a) {
|
|
258
261
|
return G(this, a || 0);
|
|
262
|
+
}, Date.prototype.addHours = function(a) {
|
|
263
|
+
return i(this, a || 0);
|
|
259
264
|
}, Date.prototype.subtractHours = function(a) {
|
|
260
265
|
return u(this, a || 0);
|
|
261
266
|
}, Date.prototype.addMinutes = function(a) {
|
|
262
|
-
return d(this, a || 0);
|
|
263
|
-
}, Date.prototype.subtractMinutes = function(a) {
|
|
264
267
|
return e(this, a || 0);
|
|
268
|
+
}, Date.prototype.subtractMinutes = function(a) {
|
|
269
|
+
return d(this, a || 0);
|
|
265
270
|
}, Date.prototype.getWeek = function() {
|
|
266
|
-
return
|
|
271
|
+
return E(this);
|
|
267
272
|
}, Date.prototype.isToday = function() {
|
|
268
|
-
return
|
|
273
|
+
return P(this);
|
|
269
274
|
}, Date.prototype.isLeapYear = function() {
|
|
270
275
|
return l(this);
|
|
271
276
|
}, Date.prototype.format = function(a = "YYYY-MM-DD") {
|
|
272
|
-
return
|
|
277
|
+
return ue(this, a);
|
|
273
278
|
}, Date.prototype.formatTime = function(a = "HH:mm") {
|
|
274
|
-
return
|
|
279
|
+
return re(this, a);
|
|
275
280
|
};
|
|
276
|
-
},
|
|
281
|
+
}, o = () => {
|
|
277
282
|
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;
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
283
|
+
}, m = (a) => {
|
|
284
|
+
v.value = a, Date.prototype.subtractDays && C();
|
|
285
|
+
}, $ = () => (g !== (/* @__PURE__ */ new Date()).getDate() && (r = /* @__PURE__ */ new Date(), g = r.getDate(), p = `${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`), p), W = (a, _) => {
|
|
286
|
+
const y = new Date(a.valueOf());
|
|
287
|
+
return y.setDate(y.getDate() + _), y;
|
|
288
|
+
}, G = (a, _) => {
|
|
289
|
+
const y = new Date(a.valueOf());
|
|
290
|
+
return y.setDate(y.getDate() - _), y;
|
|
291
|
+
}, i = (a, _) => {
|
|
292
|
+
const y = new Date(a.valueOf());
|
|
293
|
+
return y.setHours(y.getHours() + _), y;
|
|
294
|
+
}, u = (a, _) => {
|
|
295
|
+
const y = new Date(a.valueOf());
|
|
296
|
+
return y.setHours(y.getHours() - _), y;
|
|
297
|
+
}, e = (a, _) => {
|
|
298
|
+
const y = new Date(a.valueOf());
|
|
299
|
+
return y.setMinutes(y.getMinutes() + _), y;
|
|
300
|
+
}, d = (a, _) => {
|
|
301
|
+
const y = new Date(a.valueOf());
|
|
302
|
+
return y.setMinutes(y.getMinutes() - _), y;
|
|
303
|
+
}, h = (a, _) => {
|
|
304
|
+
const y = (B) => {
|
|
305
|
+
const Q = B % _;
|
|
306
|
+
return Q !== 0 && (B += Q >= _ / 2 ? _ - Q : -Q), B;
|
|
300
307
|
};
|
|
301
|
-
if (typeof a == "number") return
|
|
308
|
+
if (typeof a == "number") return y(a);
|
|
302
309
|
if (a instanceof Date) {
|
|
303
|
-
let
|
|
304
|
-
|
|
310
|
+
let B = y(a.getMinutes());
|
|
311
|
+
B >= 60 && (a.setHours(a.getHours() + 1), B = 0), a.setMinutes(B, 0, 0);
|
|
305
312
|
}
|
|
306
|
-
},
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
return Math.ceil(((
|
|
311
|
-
},
|
|
312
|
-
if (!a || !
|
|
313
|
-
if (
|
|
314
|
-
if (!
|
|
313
|
+
}, E = (a, _ = !1) => {
|
|
314
|
+
const y = new Date(Date.UTC(a.getFullYear(), a.getMonth(), a.getDate())), B = y.getUTCDay() || 7;
|
|
315
|
+
y.setUTCDate(y.getUTCDate() + 4 - B);
|
|
316
|
+
const Q = new Date(Date.UTC(y.getUTCFullYear(), 0, 1));
|
|
317
|
+
return Math.ceil(((y - Q) / 864e5 + 1) / 7) + (_ ? 1 : 0);
|
|
318
|
+
}, P = (a) => `${a.getFullYear()}-${a.getMonth()}-${a.getDate()}` === $(), A = (a, _) => {
|
|
319
|
+
if (!a || !_) return console.warn(`Vue Cal: missing date${a ? "2" : "1"} parameter for comparison with \`isSameDate(date1, date2)\`.`);
|
|
320
|
+
if (K(a)) {
|
|
321
|
+
if (!K(_)) return console.warn(`Vue Cal: invalid date2 provided for comparison with \`isSameDate(date1, date2)\`: \`${_}\`.`);
|
|
315
322
|
} else return console.warn(`Vue Cal: invalid date1 provided for comparison with \`isSameDate(date1, date2)\`: \`${a}\`.`);
|
|
316
|
-
return a.getFullYear() ===
|
|
317
|
-
},
|
|
318
|
-
const
|
|
319
|
-
return !(
|
|
320
|
-
},
|
|
321
|
-
const
|
|
322
|
-
return
|
|
323
|
-
},
|
|
324
|
-
typeof a == "string" && (a = a.replace(/-/g, "/")), typeof
|
|
325
|
-
const
|
|
326
|
-
return Math.ceil((
|
|
327
|
-
},
|
|
328
|
-
if (
|
|
329
|
-
|
|
330
|
-
const
|
|
331
|
-
YYYY: () =>
|
|
332
|
-
YY: () =>
|
|
333
|
-
M: () =>
|
|
334
|
-
MM: () =>
|
|
335
|
-
MMM: () =>
|
|
336
|
-
MMMM: () =>
|
|
337
|
-
MMMMG: () =>
|
|
338
|
-
D: () =>
|
|
339
|
-
DD: () =>
|
|
340
|
-
S: () =>
|
|
341
|
-
d: () =>
|
|
342
|
-
dd: () =>
|
|
343
|
-
ddd: () =>
|
|
344
|
-
dddd: () =>
|
|
345
|
-
HH: () =>
|
|
346
|
-
H: () =>
|
|
347
|
-
hh: () =>
|
|
348
|
-
h: () =>
|
|
349
|
-
am: () =>
|
|
350
|
-
AM: () =>
|
|
351
|
-
mm: () =>
|
|
352
|
-
m: () =>
|
|
353
|
-
s: () =>
|
|
323
|
+
return a.getFullYear() === _.getFullYear() && a.getMonth() === _.getMonth() && a.getDate() === _.getDate();
|
|
324
|
+
}, n = (a, _, y) => K(a) ? a.getTime() >= _ && a.getTime() <= y : console.warn(`Vue Cal: invalid date provided to \`isInRange(date, rangeStart, rangeEnd)\`: \`${a}\`.`), l = (a) => {
|
|
325
|
+
const _ = a.getFullYear();
|
|
326
|
+
return !(_ % 400) || _ % 100 && !(_ % 4);
|
|
327
|
+
}, k = (a = null, _) => {
|
|
328
|
+
const y = a && new Date(a.valueOf()) || /* @__PURE__ */ new Date(), B = _ ? 7 : 6;
|
|
329
|
+
return y.setDate(y.getDate() - (y.getDay() + B) % 7), y;
|
|
330
|
+
}, t = (a) => a instanceof Date ? a : (a.length === 10 && (a += " 00:00"), new Date(a.replace(/-/g, "/"))), V = (a) => a.getHours() * 60 + a.getMinutes(), H = (a, _) => {
|
|
331
|
+
typeof a == "string" && (a = a.replace(/-/g, "/")), typeof _ == "string" && (_ = _.replace(/-/g, "/")), a = new Date(a).setHours(0, 0, 0, 0), _ = new Date(_).setHours(0, 0, 1, 0);
|
|
332
|
+
const y = (new Date(_).getTimezoneOffset() - new Date(a).getTimezoneOffset()) * 60 * 1e3;
|
|
333
|
+
return Math.ceil((_ - a - y) / (24 * 3600 * 1e3));
|
|
334
|
+
}, U = (a, _, y) => Math.abs(a.getTime() - _.getTime()) <= y * 60 * 1e3, K = (a) => a && a instanceof Date && !isNaN(a), ue = (a, _ = "YYYY-MM-DD", y = null) => {
|
|
335
|
+
if (y || (y = v.value), _ || (_ = "YYYY-MM-DD"), _ === "YYYY-MM-DD") return ae(a);
|
|
336
|
+
b = {}, L = {};
|
|
337
|
+
const B = {
|
|
338
|
+
YYYY: () => ee(a, y).YYYY,
|
|
339
|
+
YY: () => ee(a, y).YY(),
|
|
340
|
+
M: () => ee(a, y).M,
|
|
341
|
+
MM: () => ee(a, y).MM(),
|
|
342
|
+
MMM: () => ee(a, y).MMM(),
|
|
343
|
+
MMMM: () => ee(a, y).MMMM(),
|
|
344
|
+
MMMMG: () => ee(a, y).MMMMG(),
|
|
345
|
+
D: () => ee(a, y).D,
|
|
346
|
+
DD: () => ee(a, y).DD(),
|
|
347
|
+
S: () => ee(a, y).S(),
|
|
348
|
+
d: () => ee(a, y).d,
|
|
349
|
+
dd: () => ee(a, y).dd(),
|
|
350
|
+
ddd: () => ee(a, y).ddd(),
|
|
351
|
+
dddd: () => ee(a, y).dddd(),
|
|
352
|
+
HH: () => oe(a, y).HH,
|
|
353
|
+
H: () => oe(a, y).H,
|
|
354
|
+
hh: () => oe(a, y).hh,
|
|
355
|
+
h: () => oe(a, y).h,
|
|
356
|
+
am: () => oe(a, y).am,
|
|
357
|
+
AM: () => oe(a, y).AM,
|
|
358
|
+
mm: () => oe(a, y).mm,
|
|
359
|
+
m: () => oe(a, y).m,
|
|
360
|
+
s: () => oe(a, y).s
|
|
354
361
|
};
|
|
355
|
-
return
|
|
356
|
-
const
|
|
357
|
-
return
|
|
362
|
+
return _.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (Q, c) => {
|
|
363
|
+
const w = B[c.replace(/\{|\}/g, "")];
|
|
364
|
+
return w !== void 0 ? w() : c;
|
|
358
365
|
});
|
|
359
|
-
},
|
|
360
|
-
const
|
|
361
|
-
return `${a.getFullYear()}-${
|
|
362
|
-
},
|
|
363
|
-
let
|
|
364
|
-
if (
|
|
365
|
-
const [
|
|
366
|
-
|
|
366
|
+
}, ae = (a) => {
|
|
367
|
+
const _ = a.getMonth() + 1, y = a.getDate();
|
|
368
|
+
return `${a.getFullYear()}-${_ < 10 ? "0" : ""}${_}-${y < 10 ? "0" : ""}${y}`;
|
|
369
|
+
}, re = (a, _ = "HH:mm", y = null, B = !1) => {
|
|
370
|
+
let Q = !1;
|
|
371
|
+
if (B) {
|
|
372
|
+
const [S, M, N] = [a.getHours(), a.getMinutes(), a.getSeconds()];
|
|
373
|
+
S + M + N === 141 && (Q = !0);
|
|
367
374
|
}
|
|
368
|
-
if (a instanceof Date &&
|
|
369
|
-
|
|
370
|
-
const
|
|
371
|
-
const
|
|
372
|
-
return
|
|
375
|
+
if (a instanceof Date && _ === "HH:mm") return Q ? "24:00" : he(a);
|
|
376
|
+
L = {}, y || (y = v.value);
|
|
377
|
+
const c = oe(a, y), w = _.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (S, M) => {
|
|
378
|
+
const N = c[M.replace(/\{|\}/g, "")];
|
|
379
|
+
return N !== void 0 ? N : M;
|
|
373
380
|
});
|
|
374
|
-
return
|
|
375
|
-
},
|
|
376
|
-
const
|
|
377
|
-
return `${(
|
|
378
|
-
},
|
|
379
|
-
const
|
|
380
|
-
return `${
|
|
381
|
-
},
|
|
381
|
+
return Q ? w.replace("23:59", "24:00") : w;
|
|
382
|
+
}, he = (a) => {
|
|
383
|
+
const _ = a.getHours(), y = a.getMinutes();
|
|
384
|
+
return `${(_ < 10 ? "0" : "") + _}:${(y < 10 ? "0" : "") + y}`;
|
|
385
|
+
}, q = (a) => {
|
|
386
|
+
const _ = Math.floor(a / 60).toString().padStart(2, 0), y = (a % 60).toString().padStart(2, 0);
|
|
387
|
+
return `${_}:${y}`;
|
|
388
|
+
}, ce = (a) => {
|
|
382
389
|
if (a > 3 && a < 21) return "th";
|
|
383
390
|
switch (a % 10) {
|
|
384
391
|
case 1:
|
|
@@ -390,94 +397,94 @@ const st = (c) => {
|
|
|
390
397
|
default:
|
|
391
398
|
return "th";
|
|
392
399
|
}
|
|
393
|
-
},
|
|
394
|
-
if (
|
|
395
|
-
const
|
|
396
|
-
return
|
|
400
|
+
}, ee = (a, _) => {
|
|
401
|
+
if (b.D) return b;
|
|
402
|
+
const y = a.getFullYear(), B = a.getMonth() + 1, Q = a.getDate(), w = (a.getDay() - 1 + 7) % 7;
|
|
403
|
+
return b = {
|
|
397
404
|
// Year.
|
|
398
|
-
YYYY:
|
|
405
|
+
YYYY: y,
|
|
399
406
|
// 2024.
|
|
400
|
-
YY: () =>
|
|
407
|
+
YY: () => y.toString().substring(2),
|
|
401
408
|
// 24.
|
|
402
409
|
// Month.
|
|
403
|
-
M:
|
|
410
|
+
M: B,
|
|
404
411
|
// 1 to 12.
|
|
405
|
-
MM: () =>
|
|
412
|
+
MM: () => B.toString().padStart(2, 0),
|
|
406
413
|
// 01 to 12.
|
|
407
|
-
MMM: () =>
|
|
414
|
+
MMM: () => _.months[B - 1].substring(0, 3),
|
|
408
415
|
// Jan to Dec.
|
|
409
|
-
MMMM: () =>
|
|
416
|
+
MMMM: () => _.months[B - 1],
|
|
410
417
|
// January to December.
|
|
411
|
-
MMMMG: () => (
|
|
418
|
+
MMMMG: () => (_.monthsGenitive || _.months)[B - 1],
|
|
412
419
|
// January to December in genitive form (Greek...)
|
|
413
420
|
// Day.
|
|
414
|
-
D:
|
|
421
|
+
D: Q,
|
|
415
422
|
// 1 to 31.
|
|
416
|
-
DD: () =>
|
|
423
|
+
DD: () => Q.toString().padStart(2, 0),
|
|
417
424
|
// 01 to 31.
|
|
418
|
-
S: () =>
|
|
425
|
+
S: () => ce(Q),
|
|
419
426
|
// st, nd, rd, th.
|
|
420
427
|
// Day of the week.
|
|
421
|
-
d:
|
|
428
|
+
d: w + 1,
|
|
422
429
|
// 1 to 7 with 7 = Sunday.
|
|
423
430
|
// Some locales have same start for all the days, so they have specific abbrev in weekDaysShort.
|
|
424
|
-
dd: () =>
|
|
431
|
+
dd: () => _.weekDaysShort.length ? _.weekDaysShort[w] : _.weekDays[w][0],
|
|
425
432
|
// M to S.
|
|
426
|
-
ddd: () =>
|
|
433
|
+
ddd: () => _.weekDaysShort.length ? _.weekDaysShort[w] : _.weekDays[w].substr(0, 3),
|
|
427
434
|
// Mon to Sun.
|
|
428
|
-
dddd: () =>
|
|
435
|
+
dddd: () => _.weekDays[w]
|
|
429
436
|
// Monday to Sunday.
|
|
430
|
-
},
|
|
431
|
-
},
|
|
432
|
-
if (
|
|
433
|
-
let
|
|
434
|
-
a instanceof Date ? (
|
|
435
|
-
const
|
|
436
|
-
return
|
|
437
|
-
H:
|
|
438
|
-
h:
|
|
439
|
-
HH:
|
|
440
|
-
hh:
|
|
441
|
-
am:
|
|
442
|
-
AM:
|
|
443
|
-
m:
|
|
444
|
-
mm:
|
|
445
|
-
s:
|
|
446
|
-
},
|
|
437
|
+
}, b;
|
|
438
|
+
}, oe = (a, _) => {
|
|
439
|
+
if (L.am) return L;
|
|
440
|
+
let y, B, Q;
|
|
441
|
+
a instanceof Date ? (y = a.getHours(), B = a.getMinutes(), Q = a.getSeconds()) : (y = Math.floor(a / 60), B = Math.floor(a % 60));
|
|
442
|
+
const c = y % 12 ? y % 12 : 12, w = (_ || { am: "am", pm: "pm" })[y === 24 || y < 12 ? "am" : "pm"];
|
|
443
|
+
return L = {
|
|
444
|
+
H: y,
|
|
445
|
+
h: c,
|
|
446
|
+
HH: y.toString().padStart(2, 0),
|
|
447
|
+
hh: c.toString().padStart(2, 0),
|
|
448
|
+
am: w,
|
|
449
|
+
AM: w.toUpperCase(),
|
|
450
|
+
m: B,
|
|
451
|
+
mm: B.toString().padStart(2, 0),
|
|
452
|
+
s: Q
|
|
453
|
+
}, L;
|
|
447
454
|
};
|
|
448
455
|
return {
|
|
449
|
-
addDatePrototypes:
|
|
450
|
-
removeDatePrototypes:
|
|
451
|
-
updateTexts:
|
|
452
|
-
addDays:
|
|
453
|
-
subtractDays:
|
|
454
|
-
addHours:
|
|
456
|
+
addDatePrototypes: C,
|
|
457
|
+
removeDatePrototypes: o,
|
|
458
|
+
updateTexts: m,
|
|
459
|
+
addDays: W,
|
|
460
|
+
subtractDays: G,
|
|
461
|
+
addHours: i,
|
|
455
462
|
subtractHours: u,
|
|
456
|
-
addMinutes:
|
|
457
|
-
subtractMinutes:
|
|
458
|
-
snapToInterval:
|
|
459
|
-
getWeek:
|
|
460
|
-
isToday:
|
|
461
|
-
isSameDate:
|
|
462
|
-
isInRange:
|
|
463
|
+
addMinutes: e,
|
|
464
|
+
subtractMinutes: d,
|
|
465
|
+
snapToInterval: h,
|
|
466
|
+
getWeek: E,
|
|
467
|
+
isToday: P,
|
|
468
|
+
isSameDate: A,
|
|
469
|
+
isInRange: n,
|
|
463
470
|
isLeapYear: l,
|
|
464
|
-
getPreviousFirstDayOfWeek:
|
|
465
|
-
stringToDate:
|
|
466
|
-
dateToMinutes:
|
|
467
|
-
countDays:
|
|
468
|
-
datesInSameTimeStep:
|
|
469
|
-
isValid:
|
|
470
|
-
formatDate:
|
|
471
|
-
formatDateLite:
|
|
472
|
-
formatTime:
|
|
473
|
-
formatTimeLite:
|
|
474
|
-
formatMinutes:
|
|
471
|
+
getPreviousFirstDayOfWeek: k,
|
|
472
|
+
stringToDate: t,
|
|
473
|
+
dateToMinutes: V,
|
|
474
|
+
countDays: H,
|
|
475
|
+
datesInSameTimeStep: U,
|
|
476
|
+
isValid: K,
|
|
477
|
+
formatDate: ue,
|
|
478
|
+
formatDateLite: ae,
|
|
479
|
+
formatTime: re,
|
|
480
|
+
formatTimeLite: he,
|
|
481
|
+
formatMinutes: q
|
|
475
482
|
};
|
|
476
|
-
},
|
|
477
|
-
const { dateUtils: s, config:
|
|
478
|
-
let
|
|
479
|
-
const
|
|
480
|
-
const
|
|
483
|
+
}, gt = (D) => {
|
|
484
|
+
const { dateUtils: s, config: r } = D;
|
|
485
|
+
let g = 0;
|
|
486
|
+
const p = T(() => {
|
|
487
|
+
const i = {
|
|
481
488
|
byDate: {},
|
|
482
489
|
// A map of single-day events indexed by date.
|
|
483
490
|
recurring: [],
|
|
@@ -487,434 +494,434 @@ const st = (c) => {
|
|
|
487
494
|
byId: {}
|
|
488
495
|
// A map of all the events indexed by ID for fast lookup.
|
|
489
496
|
};
|
|
490
|
-
return
|
|
491
|
-
|
|
492
|
-
var
|
|
493
|
-
return
|
|
494
|
-
|
|
495
|
-
{ start: (
|
|
496
|
-
{ excludeIds: [e._.id], schedule: (
|
|
497
|
+
return r.events.sort((e, d) => e.start - d.start < 0 ? -1 : 1).forEach((e) => {
|
|
498
|
+
b(e), e._ || (e._ = {}), e._.id = e._.id || ++g, e.delete || (e.delete = (d) => m(e._.id, d)), e._.deleting = !1, e._.deleted = !1, e.isOverlapping = (d = null) => e.getOverlappingEvents(d).length, e.getOverlappingEvents = (d = null) => {
|
|
499
|
+
var h;
|
|
500
|
+
return W(
|
|
501
|
+
v(s.formatDate((d == null ? void 0 : d.start) || e.start), !0),
|
|
502
|
+
{ start: (d == null ? void 0 : d.start) || e.start, end: (d == null ? void 0 : d.end) || e.end },
|
|
503
|
+
{ excludeIds: [e._.id], schedule: (h = r.schedules) != null && h.length ? ~~((d == null ? void 0 : d.schedule) || e.schedule) : null }
|
|
497
504
|
);
|
|
498
|
-
}, e._.register = (
|
|
499
|
-
e._.$el =
|
|
505
|
+
}, e._.register = (d) => {
|
|
506
|
+
e._.$el = d, e._.fireCreated && (D.emit("event-created", e), delete e._.fireCreated);
|
|
500
507
|
}, e._.unregister = () => {
|
|
501
508
|
e._.$el = null, e._.register = null, e.isOverlapping = null, e.getOverlappingEvents = null, e.delete = null;
|
|
502
|
-
},
|
|
503
|
-
}),
|
|
504
|
-
}),
|
|
505
|
-
if (typeof
|
|
506
|
-
isNaN(
|
|
509
|
+
}, i.byId[e._.id] = e, e.recurring ? i.recurring.push(e._.id) : e._.multiday ? (i.multiday.push(e._.id), i.byDate[e._.startFormatted] || (i.byDate[e._.startFormatted] = []), i.byDate[e._.startFormatted].push(e._.id)) : (i.byDate[e._.startFormatted] || (i.byDate[e._.startFormatted] = []), i.byDate[e._.startFormatted].push(e._.id));
|
|
510
|
+
}), i;
|
|
511
|
+
}), b = (i) => {
|
|
512
|
+
if (typeof i.start == "string" && (i.start = s.stringToDate(i.start)), typeof i.end == "string" && (i.end = s.stringToDate(i.end)), i.start.setSeconds(0, 0), i.end.setSeconds(0, 0), isNaN(i.start) || isNaN(i.end)) {
|
|
513
|
+
isNaN(i.start) ? console.error(`Vue Cal: invalid start date for event "${i.title}".`, i.start) : console.error(`Vue Cal: invalid end date for event "${i.title}".`, i.end);
|
|
507
514
|
return;
|
|
508
|
-
} else
|
|
509
|
-
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
},
|
|
513
|
-
let
|
|
514
|
-
return
|
|
515
|
-
},
|
|
516
|
-
const
|
|
517
|
-
return
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
}),
|
|
522
|
-
}, o = (
|
|
523
|
-
if (!
|
|
515
|
+
} else i.end.getTime() < i.start.getTime() && console.error(`Vue Cal: invalid event dates for event "${i.title}". The event ends before it starts.`, i.start, i.end);
|
|
516
|
+
i._ || (i._ = {}), i._.multiday = !s.isSameDate(i.start, new Date(i.end.getTime() - 1)), i._.startFormatted = s.formatDate(i.start), i._.startMinutes = ~~s.dateToMinutes(i.start), i._.endMinutes = ~~s.dateToMinutes(i.end);
|
|
517
|
+
const u = i.start.getHours(), e = i.start.getMinutes().toString().padStart(2, 0), d = i.end.getHours(), h = i.end.getMinutes().toString().padStart(2, 0);
|
|
518
|
+
i._.startTimeFormatted24 = `${u.toString().padStart(2, 0)}:${e}`, i._.startTimeFormatted12 = `${u % 12 || 12}${e ? `:${e}` : ""} ${u < 12 ? "AM" : "PM"}`, i._.endTimeFormatted24 = `${d.toString().padStart(2, 0)}:${h}`, i._.endTimeFormatted12 = `${d % 12 || 12}${h ? `:${h}` : ""} ${d < 12 ? "AM" : "PM"}`, i._.duration = Math.abs(~~((i.end - i.start) / 6e4));
|
|
519
|
+
}, L = (i) => p.value.byId[i], v = (i, u = !1, e = !1) => {
|
|
520
|
+
let d = p.value.byDate[i] || [];
|
|
521
|
+
return d = u || e ? d.map(L) : d, e || (d = d.filter((h) => !h.background), u || (d = d.map((h) => h._.id))), d;
|
|
522
|
+
}, C = (i) => {
|
|
523
|
+
const u = {};
|
|
524
|
+
return i.forEach(({ startFormatted: e }) => {
|
|
525
|
+
u[e] = [];
|
|
526
|
+
const d = v(e, !1, !0);
|
|
527
|
+
d.length && u[e].push(...d);
|
|
528
|
+
}), u;
|
|
529
|
+
}, o = (i) => {
|
|
530
|
+
if (!i.start || !i.end) {
|
|
524
531
|
console.error("Vue Cal: Cannot create an event without valid start and end dates.");
|
|
525
532
|
return;
|
|
526
533
|
}
|
|
527
|
-
return
|
|
528
|
-
},
|
|
529
|
-
var
|
|
530
|
-
if (!
|
|
534
|
+
return r.snapToInterval && (s.snapToInterval(i.start, r.snapToInterval), s.snapToInterval(i.end, r.snapToInterval)), i = { ...i }, i._ || (i._ = {}), i._.id = ++g, i._.fireCreated = !0, r.events.push(i), i;
|
|
535
|
+
}, m = (i, u = 0) => {
|
|
536
|
+
var h;
|
|
537
|
+
if (!r.editableEvents.delete)
|
|
531
538
|
return console.info("Vue Cal: Event deletion is disabled. Enable it with the `editable-events` props.");
|
|
532
|
-
if (!
|
|
533
|
-
const e =
|
|
534
|
-
if (e === -1) return console.warn(`Vue Cal: Cannot delete unknown event \`${
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
switch (
|
|
539
|
+
if (!i) return console.warn("Vue Cal: Cannot delete event without its ID.");
|
|
540
|
+
const e = r.events.findIndex((E) => E._.id === i);
|
|
541
|
+
if (e === -1) return console.warn(`Vue Cal: Cannot delete unknown event \`${i}\`.`);
|
|
542
|
+
const d = r.events[e];
|
|
543
|
+
if (d.deletable === !1) return console.warn(`Vue Cal: Can't delete event \`${i}\` since it was explicitely set to \`delete: false\`.`);
|
|
544
|
+
switch (u) {
|
|
538
545
|
case 0:
|
|
539
|
-
|
|
546
|
+
d._.deleting ? r.events.splice(e, 1) : d._.deleting = !0;
|
|
540
547
|
break;
|
|
541
548
|
// Display the delete button.
|
|
542
549
|
case 1:
|
|
543
|
-
|
|
550
|
+
d._.deleting = !0;
|
|
544
551
|
break;
|
|
545
552
|
// Visual deletion + external DOM event firing.
|
|
546
553
|
// When explicitly using this stage, the event will be visually deleted but still present in the
|
|
547
554
|
// source of truth until the cell is unmounted (by navigating away).
|
|
548
555
|
case 2:
|
|
549
|
-
|
|
556
|
+
d._.deleted = !0, r.events[e]._.deleted = !0, (h = d._.$el) == null || h.dispatchEvent(new CustomEvent("event-deleted", { detail: d._.id }));
|
|
550
557
|
break;
|
|
551
558
|
// Effective deletion from the source of truth (by default, when unmounting the cell).
|
|
552
559
|
case 3:
|
|
553
|
-
|
|
560
|
+
r.events.splice(e, 1), D.emit("update:events", r.events), D.emit("event-delete", d);
|
|
554
561
|
break;
|
|
555
562
|
}
|
|
556
563
|
return !0;
|
|
557
|
-
},
|
|
558
|
-
const
|
|
559
|
-
if (!
|
|
560
|
-
let e = {},
|
|
561
|
-
|
|
562
|
-
for (const
|
|
563
|
-
const
|
|
564
|
-
e[
|
|
565
|
-
let
|
|
566
|
-
var
|
|
567
|
-
return (!((
|
|
568
|
-
}),
|
|
569
|
-
var
|
|
570
|
-
return ((
|
|
571
|
-
})),
|
|
572
|
-
for (;
|
|
573
|
-
e[
|
|
574
|
-
let k = Math.max(1, ...
|
|
575
|
-
var
|
|
576
|
-
return ((
|
|
564
|
+
}, $ = (i) => {
|
|
565
|
+
const u = v(i, !0);
|
|
566
|
+
if (!u.length) return { cellOverlaps: {}, longestStreak: 0 };
|
|
567
|
+
let e = {}, d = [], h = 0;
|
|
568
|
+
u.sort((E, P) => E.start - P.start || E.end - E.start - (P.end - P.start));
|
|
569
|
+
for (const E of u) {
|
|
570
|
+
const P = E._.id;
|
|
571
|
+
e[P] || (e[P] = { overlaps: /* @__PURE__ */ new Set(), maxConcurrent: 1, position: 0 }), d = d.filter((t) => t.end > E.start);
|
|
572
|
+
let A = d.filter((t) => {
|
|
573
|
+
var H;
|
|
574
|
+
return (!((H = r.schedules) != null && H.length) || E.schedule === t.schedule) && t.start < E.end;
|
|
575
|
+
}), n = new Set(A.map((t) => {
|
|
576
|
+
var V;
|
|
577
|
+
return ((V = e[t._.id]) == null ? void 0 : V.position) ?? 0;
|
|
578
|
+
})), l = 0;
|
|
579
|
+
for (; n.has(l); ) l++;
|
|
580
|
+
e[P].position = l, d.push(E);
|
|
581
|
+
let k = Math.max(1, ...A.map((t) => {
|
|
582
|
+
var V;
|
|
583
|
+
return ((V = e[t._.id]) == null ? void 0 : V.maxConcurrent) ?? 1;
|
|
577
584
|
}));
|
|
578
|
-
e[
|
|
579
|
-
for (const t of
|
|
580
|
-
e[t._.id].overlaps.add(
|
|
581
|
-
|
|
585
|
+
e[P].maxConcurrent = Math.max(A.length + 1, k);
|
|
586
|
+
for (const t of A)
|
|
587
|
+
e[t._.id].overlaps.add(P), e[P].overlaps.add(t._.id), e[t._.id].maxConcurrent = e[P].maxConcurrent;
|
|
588
|
+
h = Math.max(h, e[P].maxConcurrent);
|
|
582
589
|
}
|
|
583
|
-
for (const
|
|
584
|
-
return { cellOverlaps: e, longestStreak:
|
|
585
|
-
},
|
|
586
|
-
var
|
|
587
|
-
const
|
|
588
|
-
for (const
|
|
589
|
-
!
|
|
590
|
-
return
|
|
591
|
-
}, G = (
|
|
592
|
-
const
|
|
593
|
-
return
|
|
590
|
+
for (const E in e) e[E].overlaps = [...e[E].overlaps];
|
|
591
|
+
return { cellOverlaps: e, longestStreak: h };
|
|
592
|
+
}, W = (i = [], { start: u, end: e }, { excludeIds: d = [], schedule: h = null }) => {
|
|
593
|
+
var A;
|
|
594
|
+
const E = new Set(d), P = [];
|
|
595
|
+
for (const n of i)
|
|
596
|
+
!E.has((A = n._) == null ? void 0 : A.id) && (h === null || h === n.schedule) && G(n, u, e) && P.push(n);
|
|
597
|
+
return P;
|
|
598
|
+
}, G = (i, u, e) => {
|
|
599
|
+
const d = i.allDay || !r.time, h = d ? new Date(i.start).setHours(0, 0, 0, 0) : i.start.getTime(), E = d ? new Date(i.end).setHours(23, 59, 59, 999) : i.end.getTime(), P = d ? new Date(u).setHours(0, 0, 0, 0) : u.getTime(), A = d ? new Date(e).setHours(23, 59, 59, 999) : e.getTime();
|
|
600
|
+
return E > P && h < A;
|
|
594
601
|
};
|
|
595
602
|
return {
|
|
596
|
-
events:
|
|
597
|
-
getEvent:
|
|
598
|
-
getEventsByDate:
|
|
599
|
-
getViewEvents:
|
|
600
|
-
getCellOverlappingEvents:
|
|
601
|
-
getEventsInRange:
|
|
603
|
+
events: p,
|
|
604
|
+
getEvent: L,
|
|
605
|
+
getEventsByDate: v,
|
|
606
|
+
getViewEvents: C,
|
|
607
|
+
getCellOverlappingEvents: $,
|
|
608
|
+
getEventsInRange: W,
|
|
602
609
|
createEvent: o,
|
|
603
|
-
deleteEvent:
|
|
610
|
+
deleteEvent: m,
|
|
604
611
|
isEventInRange: G
|
|
605
612
|
};
|
|
606
|
-
},
|
|
607
|
-
const { availableViews:
|
|
613
|
+
}, ht = ({ config: D, dateUtils: s, emit: r, texts: g, eventsManager: p }, b) => {
|
|
614
|
+
const { availableViews: L } = D, v = ie(D.view && L[D.view] ? D.view : D.defaultView), C = ie(D.selectedDate || null);
|
|
608
615
|
let o = ie(/* @__PURE__ */ new Date());
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
const
|
|
612
|
-
let
|
|
613
|
-
const G = T(() =>
|
|
614
|
-
if (
|
|
615
|
-
const
|
|
616
|
-
return
|
|
617
|
-
} else if (
|
|
618
|
-
return
|
|
619
|
-
}),
|
|
620
|
-
const
|
|
621
|
-
if (
|
|
622
|
-
return
|
|
623
|
-
const
|
|
624
|
-
return
|
|
616
|
+
const m = ie(new Date(D.viewDate || o.value));
|
|
617
|
+
m.value.setHours(0, 0, 0, 0);
|
|
618
|
+
const $ = ie(new Date(m));
|
|
619
|
+
let W = null;
|
|
620
|
+
const G = T(() => v.value === "month" ? $.value : l.value), i = T(() => v.value === "month" ? new Date($.value.getFullYear(), $.value.getMonth() + 1, 0, 23, 59, 59, 999) : t.value), u = T(() => v.value === "week" ? s.getPreviousFirstDayOfWeek(l.value, D.startWeekOnSunday) : v.value === "month" ? l.value : G.value), e = T(() => {
|
|
621
|
+
if (v.value === "week") {
|
|
622
|
+
const f = s.addDays(u.value, 7);
|
|
623
|
+
return f.setMilliseconds(-1), f;
|
|
624
|
+
} else if (v.value === "month") return t.value;
|
|
625
|
+
return i.value;
|
|
626
|
+
}), d = T(() => {
|
|
627
|
+
const f = o.value.getTime();
|
|
628
|
+
if (v.value === "week")
|
|
629
|
+
return u.value.getTime() <= f && f <= e.value.getTime();
|
|
630
|
+
const z = l.value.getTime(), R = t.value.getTime();
|
|
631
|
+
return z <= f && f <= R;
|
|
625
632
|
});
|
|
626
|
-
function
|
|
627
|
-
o.value = /* @__PURE__ */ new Date(),
|
|
633
|
+
function h() {
|
|
634
|
+
o.value = /* @__PURE__ */ new Date(), W = setTimeout(h, 60 * 1e3);
|
|
628
635
|
}
|
|
629
|
-
function
|
|
630
|
-
|
|
636
|
+
function E() {
|
|
637
|
+
W = setTimeout(h, (60 - (/* @__PURE__ */ new Date()).getSeconds()) * 1e3), h();
|
|
631
638
|
}
|
|
632
|
-
const
|
|
633
|
-
if (!
|
|
634
|
-
let
|
|
635
|
-
return
|
|
636
|
-
}),
|
|
637
|
-
var
|
|
638
|
-
return ((
|
|
639
|
-
}),
|
|
640
|
-
if (
|
|
641
|
-
let
|
|
642
|
-
return
|
|
643
|
-
} else if (
|
|
644
|
-
const
|
|
645
|
-
let
|
|
646
|
-
return
|
|
647
|
-
} else return
|
|
639
|
+
const P = T(() => {
|
|
640
|
+
if (!D.availableViews[v.value]) return 1;
|
|
641
|
+
let f = D.availableViews[v.value].cols;
|
|
642
|
+
return D.hasHiddenDays && ["week", "month"].includes(v.value) && (f -= D.hasHiddenDays), f;
|
|
643
|
+
}), A = T(() => {
|
|
644
|
+
var f;
|
|
645
|
+
return ((f = D.availableViews[v.value]) == null ? void 0 : f.rows) || 1;
|
|
646
|
+
}), n = T(() => P.value * A.value), l = T(() => {
|
|
647
|
+
if (v.value === "month") {
|
|
648
|
+
let f = $.value.getDay() || 7;
|
|
649
|
+
return D.startWeekOnSunday && !D.hideWeekdays[7] && (f += 1), D.viewDayOffset && (f -= D.viewDayOffset), s.subtractDays($.value, f - 1);
|
|
650
|
+
} else if (v.value === "week") {
|
|
651
|
+
const f = "1234567".split("").filter((R) => !Object.keys(D.hideWeekdays).includes(R));
|
|
652
|
+
let z = Math.min(...f);
|
|
653
|
+
return D.startWeekOnSunday && !D.hideWeekdays[7] && (z = 1), D.viewDayOffset && (z += D.viewDayOffset), s.addDays($.value, z - 1);
|
|
654
|
+
} else return $.value;
|
|
648
655
|
}), k = T(() => {
|
|
649
|
-
const
|
|
656
|
+
const f = [], z = ["days", "week", "month"].includes(v.value);
|
|
650
657
|
let R = 0;
|
|
651
|
-
for (let X = 0; X <
|
|
652
|
-
switch (
|
|
658
|
+
for (let X = 0; X < n.value + R; X++)
|
|
659
|
+
switch (v.value) {
|
|
653
660
|
case "day":
|
|
654
661
|
case "days":
|
|
655
662
|
case "week":
|
|
656
663
|
case "month": {
|
|
657
|
-
const ve = s.addDays(
|
|
658
|
-
if (
|
|
664
|
+
const ve = s.addDays(l.value, X), We = ve.getDay() || 7;
|
|
665
|
+
if (z && D.hasHiddenDays && D.hideWeekdays[We]) {
|
|
659
666
|
R++;
|
|
660
667
|
continue;
|
|
661
668
|
}
|
|
662
669
|
const Ce = new Date(ve);
|
|
663
|
-
Ce.setHours(23, 59, 59, 999),
|
|
670
|
+
Ce.setHours(23, 59, 59, 999), f.push({ start: ve, startFormatted: s.formatDate(ve), end: Ce });
|
|
664
671
|
break;
|
|
665
672
|
}
|
|
666
673
|
case "year":
|
|
667
|
-
|
|
668
|
-
start: new Date(
|
|
669
|
-
end: new Date(
|
|
674
|
+
f.push({
|
|
675
|
+
start: new Date(l.value.getFullYear(), X, 1, 0, 0, 0, 0),
|
|
676
|
+
end: new Date(l.value.getFullYear(), X + 1, 0, 23, 59, 59, 999)
|
|
670
677
|
});
|
|
671
678
|
break;
|
|
672
679
|
case "years":
|
|
673
|
-
|
|
674
|
-
start: new Date(
|
|
675
|
-
end: new Date(
|
|
680
|
+
f.push({
|
|
681
|
+
start: new Date(l.value.getFullYear() + X, 0, 1, 0, 0, 0, 0),
|
|
682
|
+
end: new Date(l.value.getFullYear() + X + 1, 0, 0, 23, 59, 59, 999)
|
|
676
683
|
});
|
|
677
684
|
break;
|
|
678
685
|
}
|
|
679
|
-
return
|
|
680
|
-
}), t = T(() => k.value[k.value.length - 1].end),
|
|
681
|
-
const
|
|
682
|
-
return
|
|
683
|
-
}),
|
|
684
|
-
const
|
|
685
|
-
return
|
|
686
|
+
return f;
|
|
687
|
+
}), t = T(() => k.value[k.value.length - 1].end), V = ie("right"), H = T(() => {
|
|
688
|
+
const f = Object.keys(D.availableViews);
|
|
689
|
+
return f[f.indexOf(v.value) + 1];
|
|
690
|
+
}), U = T(() => {
|
|
691
|
+
const f = Object.keys(D.availableViews);
|
|
692
|
+
return f[f.indexOf(v.value) - 1];
|
|
686
693
|
});
|
|
687
|
-
function K(
|
|
688
|
-
if (!
|
|
689
|
-
const X =
|
|
694
|
+
function K(f, z, R = !1) {
|
|
695
|
+
if (!z || !z[f]) return f + 1;
|
|
696
|
+
const X = z[f];
|
|
690
697
|
return R && typeof X == "string" ? X.substring(0, 3) : X;
|
|
691
698
|
}
|
|
692
|
-
function
|
|
693
|
-
const { monthsArray: X, monthBeforeDay: ve, canTruncate: We, xs: Ce } = R, Me =
|
|
694
|
-
return
|
|
699
|
+
function ue(f, z, R) {
|
|
700
|
+
const { monthsArray: X, monthBeforeDay: ve, canTruncate: We, xs: Ce } = R, Me = f.getMonth(), Ee = f.getFullYear(), Ye = z.getMonth(), He = z.getFullYear(), Be = Me !== Ye, lt = Ee !== He, ke = We && (Ce || Be), Le = f.getDate(), ze = z.getDate();
|
|
701
|
+
return lt ? ve ? `${K(Me, X, ke)} ${Le}, ${Ee} - ${K(Ye, X, ke)} ${ze}, ${He}` : `${Le} ${K(Me, X, ke)} ${Ee} - ${ze} ${K(Ye, X, ke)} ${He}` : Be ? ve ? `${K(Me, X, ke)} ${Le} - ${K(Ye, X, ke)} ${ze}, ${Ee}` : `${Le} ${K(Me, X, ke)} - ${ze} ${K(Ye, X, ke)} ${Ee}` : ve ? `${K(Me, X, ke)} ${Le}-${ze}, ${Ee}` : `${Le}-${ze} ${K(Me, X, ke)} ${Ee}`;
|
|
695
702
|
}
|
|
696
703
|
const ae = T(() => {
|
|
697
|
-
const { dateFormat:
|
|
698
|
-
switch (
|
|
704
|
+
const { dateFormat: f, months: z, monthsGenitive: R, week: X, truncations: ve } = g, We = D.locale, Ce = ve !== !1, Me = f.indexOf("M") < f.indexOf("D"), Ee = R && We === "el" ? R : z;
|
|
705
|
+
switch (v.value) {
|
|
699
706
|
case "day":
|
|
700
|
-
return s.formatDate(
|
|
707
|
+
return s.formatDate(l.value, f);
|
|
701
708
|
case "days":
|
|
702
709
|
case "week": {
|
|
703
|
-
const
|
|
704
|
-
monthsArray:
|
|
710
|
+
const Ye = {
|
|
711
|
+
monthsArray: Ee,
|
|
705
712
|
monthBeforeDay: Me,
|
|
706
713
|
canTruncate: Ce,
|
|
707
|
-
xs:
|
|
714
|
+
xs: D.xs
|
|
708
715
|
};
|
|
709
|
-
let He =
|
|
710
|
-
if (
|
|
716
|
+
let He = ue(l.value, t.value, Ye);
|
|
717
|
+
if (v.value === "week") {
|
|
711
718
|
const Be = s.getWeek(
|
|
712
|
-
|
|
713
|
-
|
|
719
|
+
l.value,
|
|
720
|
+
D.startWeekOnSunday && !D.hideWeekdays[7]
|
|
714
721
|
);
|
|
715
722
|
He += ` <small>${X} ${Be}</small>`;
|
|
716
723
|
}
|
|
717
724
|
return He;
|
|
718
725
|
}
|
|
719
726
|
case "month": {
|
|
720
|
-
const
|
|
721
|
-
return s.formatDate(G.value,
|
|
727
|
+
const Ye = `${D.xs && Ce ? "MMM" : "MMMM"} YYYY`;
|
|
728
|
+
return s.formatDate(G.value, Ye);
|
|
722
729
|
}
|
|
723
730
|
case "year":
|
|
724
|
-
return
|
|
731
|
+
return l.value.getFullYear();
|
|
725
732
|
case "years":
|
|
726
|
-
return `${
|
|
733
|
+
return `${l.value.getFullYear()} - ${i.value.getFullYear()}`;
|
|
727
734
|
}
|
|
728
735
|
});
|
|
729
736
|
function re() {
|
|
730
|
-
switch (
|
|
737
|
+
switch ($.value = new Date(m.value || o.value), $.value.setHours(0, 0, 0, 0), v.value) {
|
|
731
738
|
case "day":
|
|
732
739
|
break;
|
|
733
740
|
case "days":
|
|
734
741
|
break;
|
|
735
742
|
case "week":
|
|
736
|
-
|
|
743
|
+
$.value = s.getPreviousFirstDayOfWeek($.value, D.startWeekOnSunday && !D.hideWeekdays[7]);
|
|
737
744
|
break;
|
|
738
745
|
case "month":
|
|
739
|
-
|
|
746
|
+
$.value = new Date($.value.getFullYear(), $.value.getMonth(), 1, 0, 0, 0, 0);
|
|
740
747
|
break;
|
|
741
748
|
case "year":
|
|
742
|
-
|
|
749
|
+
$.value = new Date($.value.getFullYear(), 0, 1, 0, 0, 0, 0);
|
|
743
750
|
break;
|
|
744
751
|
case "years":
|
|
745
|
-
|
|
752
|
+
$.value = new Date($.value.getFullYear() - $.value.getFullYear() % n.value, 0, 1, 0, 0, 0, 0);
|
|
746
753
|
break;
|
|
747
754
|
}
|
|
748
|
-
|
|
749
|
-
id:
|
|
755
|
+
D.ready && r("view-change", {
|
|
756
|
+
id: v.value,
|
|
750
757
|
title: ae.value,
|
|
751
758
|
start: G.value,
|
|
752
|
-
end:
|
|
753
|
-
extendedStart:
|
|
759
|
+
end: i.value,
|
|
760
|
+
extendedStart: u.value,
|
|
754
761
|
extendedEnd: e.value,
|
|
755
762
|
cellDates: k.value,
|
|
756
|
-
containsToday:
|
|
757
|
-
events:
|
|
763
|
+
containsToday: d.value,
|
|
764
|
+
events: x.value
|
|
758
765
|
}), o.value = /* @__PURE__ */ new Date();
|
|
759
766
|
}
|
|
760
|
-
function
|
|
761
|
-
const
|
|
762
|
-
|
|
767
|
+
function he(f) {
|
|
768
|
+
const z = v.value, R = D.availableViews[z];
|
|
769
|
+
f[z] && JSON.stringify(f[z]) === JSON.stringify(R) || re();
|
|
763
770
|
}
|
|
764
|
-
function
|
|
765
|
-
const R = Object.keys(
|
|
766
|
-
|
|
771
|
+
function q(f, z = !0) {
|
|
772
|
+
const R = Object.keys(D.availableViews);
|
|
773
|
+
v.value !== f && (R.includes(f) ? (V.value = R.indexOf(f) < R.indexOf(v.value) ? "left" : "right", v.value = f, r("update:view", f), re()) : console.warn(`Vue Cal: the \`${f}\` view is not available.`));
|
|
767
774
|
}
|
|
768
|
-
function
|
|
769
|
-
|
|
775
|
+
function ce() {
|
|
776
|
+
H.value ? q(H.value) : console.warn("Vue Cal: no broader view is available.");
|
|
770
777
|
}
|
|
771
|
-
function
|
|
772
|
-
|
|
778
|
+
function ee() {
|
|
779
|
+
U.value ? q(U.value) : console.warn("Vue Cal: no narrower view is available.");
|
|
773
780
|
}
|
|
774
|
-
function
|
|
775
|
-
|
|
781
|
+
function oe() {
|
|
782
|
+
_(!1);
|
|
776
783
|
}
|
|
777
|
-
function
|
|
778
|
-
|
|
784
|
+
function a() {
|
|
785
|
+
_(!0);
|
|
779
786
|
}
|
|
780
|
-
function
|
|
781
|
-
let
|
|
782
|
-
switch (
|
|
787
|
+
function _(f = !0) {
|
|
788
|
+
let z = new Date(m.value);
|
|
789
|
+
switch (v.value) {
|
|
783
790
|
case "day":
|
|
784
791
|
case "days":
|
|
785
|
-
|
|
792
|
+
f ? z = s.addDays(t.value, 1) : z = s.subtractDays(l.value, n.value);
|
|
786
793
|
break;
|
|
787
794
|
case "week": {
|
|
788
|
-
|
|
795
|
+
f ? (z = s.addDays(e.value, 1), z.setHours(0, 0, 0, 0)) : z = s.subtractDays(u.value, n.value);
|
|
789
796
|
break;
|
|
790
797
|
}
|
|
791
798
|
case "month": {
|
|
792
|
-
const R =
|
|
793
|
-
|
|
799
|
+
const R = f ? 1 : -1;
|
|
800
|
+
z = new Date(z.getFullYear(), z.getMonth() + R, 1, 0, 0, 0, 0);
|
|
794
801
|
break;
|
|
795
802
|
}
|
|
796
803
|
case "year": {
|
|
797
|
-
const R =
|
|
798
|
-
|
|
804
|
+
const R = f ? 1 : -1;
|
|
805
|
+
z = new Date(z.getFullYear() + R, 1, 1, 0, 0, 0, 0);
|
|
799
806
|
break;
|
|
800
807
|
}
|
|
801
808
|
case "years": {
|
|
802
|
-
const R =
|
|
803
|
-
|
|
809
|
+
const R = f ? n.value : -n.value;
|
|
810
|
+
z = new Date(z.getFullYear() + R, 1, 1, 0, 0, 0, 0);
|
|
804
811
|
break;
|
|
805
812
|
}
|
|
806
813
|
}
|
|
807
|
-
|
|
814
|
+
B(z);
|
|
808
815
|
}
|
|
809
|
-
function
|
|
810
|
-
const
|
|
811
|
-
|
|
816
|
+
function y() {
|
|
817
|
+
const f = /* @__PURE__ */ new Date();
|
|
818
|
+
f.setHours(0, 0, 0, 0), B(f);
|
|
812
819
|
}
|
|
813
|
-
function
|
|
814
|
-
if (!s.isValid(
|
|
815
|
-
let [X, ve] = [
|
|
816
|
-
|
|
820
|
+
function B(f, z = !0, R = !1) {
|
|
821
|
+
if (!s.isValid(f)) return console.warn("Vue Cal: can't navigate to the given date: invalid date provided to `updateViewDate(date)`.");
|
|
822
|
+
let [X, ve] = [l.value, t.value];
|
|
823
|
+
v.value === "month" && ([X, ve] = [G.value, i.value]), (!s.isInRange(f, X, ve) || R) && (f.setHours(0, 0, 0, 0), V.value = f.getTime() < X.getTime() ? "left" : "right", m.value = f, z && r("update:viewDate", f), re());
|
|
817
824
|
}
|
|
818
|
-
function
|
|
819
|
-
if (s.isValid(
|
|
825
|
+
function Q(f, z = !0) {
|
|
826
|
+
if (s.isValid(f)) {
|
|
820
827
|
const { isValid: R, isSameDate: X } = s;
|
|
821
|
-
(!
|
|
828
|
+
(!C.value || !R(C.value) || !X(f, C.value)) && (f.setHours(0, 0, 0, 0), C.value = f, z && r("update:selectedDate", f));
|
|
822
829
|
} else
|
|
823
830
|
return console.warn("Vue Cal: can't update the selected date: invalid date provided to `updateSelectedDate(date)`.");
|
|
824
831
|
}
|
|
825
|
-
function
|
|
826
|
-
!
|
|
832
|
+
function c(f) {
|
|
833
|
+
!f && !$.value.getDay() ? B(s.addDays($.value, 1), !0, !0) : (V.value = "left", re());
|
|
827
834
|
}
|
|
828
|
-
function
|
|
829
|
-
|
|
835
|
+
function w(f) {
|
|
836
|
+
f && D.startWeekOnSunday && !$.value.getDay() ? B(s.addDays($.value, 1), !0, !0) : !f && D.startWeekOnSunday && $.value.getDay() === 1 && B(s.subtractDays($.value, 1), !0, !0);
|
|
830
837
|
}
|
|
831
838
|
function S() {
|
|
832
|
-
console.log("toggling weekdays",
|
|
839
|
+
console.log("toggling weekdays", D.hideWeekdays);
|
|
833
840
|
}
|
|
834
|
-
function M(
|
|
841
|
+
function M(f) {
|
|
835
842
|
var X;
|
|
836
|
-
const
|
|
837
|
-
|
|
843
|
+
const z = (X = b.value) == null ? void 0 : X.querySelector(".vuecal__scrollable"), R = f ? f * D.timeCellHeight / D.timeStep : 0;
|
|
844
|
+
z == null || z.scrollTo({ top: R, behavior: "smooth" });
|
|
838
845
|
}
|
|
839
|
-
function
|
|
840
|
-
const
|
|
841
|
-
M(
|
|
846
|
+
function N() {
|
|
847
|
+
const f = /* @__PURE__ */ new Date();
|
|
848
|
+
M(f.getHours() * 60 + f.getMinutes());
|
|
842
849
|
}
|
|
843
|
-
function
|
|
850
|
+
function I() {
|
|
844
851
|
M(0);
|
|
845
852
|
}
|
|
846
|
-
const
|
|
847
|
-
return me(() =>
|
|
848
|
-
|
|
849
|
-
}), me(() =>
|
|
850
|
-
|
|
851
|
-
}), re(),
|
|
853
|
+
const x = T(() => p.getViewEvents(k.value)), de = p.createEvent, ye = p.deleteEvent;
|
|
854
|
+
return me(() => D.view, (f) => q(f, !1)), me(() => D.availableViews, he), me(() => D.datePicker, () => q("month", !1)), me(() => D.viewDate, (f) => B(f, !1)), me(() => D.selectedDate, (f) => Q(f, !1)), me(() => D.startWeekOnSunday, (f) => c(f)), me(() => D.hideWeekends, (f) => w(f)), me(() => D.hideWeekdays, S), me(() => n.value, () => {
|
|
855
|
+
n.value > 90 && console.warn("Vue Cal: high cell count detected. Performance may degrade when interactions are enabled.");
|
|
856
|
+
}), me(() => D.watchRealTime, (f) => {
|
|
857
|
+
f && D.time ? E() : W = clearTimeout(W);
|
|
858
|
+
}), re(), D.time && D.watchRealTime && E(), Xe(() => W = clearTimeout(W)), {
|
|
852
859
|
now: o,
|
|
853
|
-
id:
|
|
854
|
-
broaderView:
|
|
855
|
-
narrowerView:
|
|
860
|
+
id: v,
|
|
861
|
+
broaderView: H,
|
|
862
|
+
narrowerView: U,
|
|
856
863
|
title: ae,
|
|
857
|
-
viewDate:
|
|
864
|
+
viewDate: m,
|
|
858
865
|
start: G,
|
|
859
|
-
end:
|
|
860
|
-
extendedStart:
|
|
866
|
+
end: i,
|
|
867
|
+
extendedStart: u,
|
|
861
868
|
// Full range, including out of scope month days, and hidden leading/trailing days.
|
|
862
869
|
extendedEnd: e,
|
|
863
870
|
// Full range, including out of scope month days, and hidden leading/trailing days.
|
|
864
|
-
firstCellDate:
|
|
871
|
+
firstCellDate: l,
|
|
865
872
|
lastCellDate: t,
|
|
866
|
-
containsToday:
|
|
867
|
-
selectedDate:
|
|
873
|
+
containsToday: d,
|
|
874
|
+
selectedDate: C,
|
|
868
875
|
cellDates: k,
|
|
869
|
-
cols:
|
|
870
|
-
rows:
|
|
876
|
+
cols: P,
|
|
877
|
+
rows: A,
|
|
871
878
|
// All the events are stored and indexed in the events object of the eventsManager.
|
|
872
879
|
// The following events array is only a subset of visible ones, plus any potential recurring
|
|
873
880
|
// and multi-day events.
|
|
874
|
-
events:
|
|
875
|
-
transitionDirection:
|
|
876
|
-
switch:
|
|
877
|
-
broader:
|
|
878
|
-
narrower:
|
|
879
|
-
previous:
|
|
880
|
-
next:
|
|
881
|
-
navigate:
|
|
882
|
-
goToToday:
|
|
883
|
-
updateViewDate:
|
|
884
|
-
updateSelectedDate:
|
|
885
|
-
scrollToCurrentTime:
|
|
881
|
+
events: x,
|
|
882
|
+
transitionDirection: V,
|
|
883
|
+
switch: q,
|
|
884
|
+
broader: ce,
|
|
885
|
+
narrower: ee,
|
|
886
|
+
previous: oe,
|
|
887
|
+
next: a,
|
|
888
|
+
navigate: _,
|
|
889
|
+
goToToday: y,
|
|
890
|
+
updateViewDate: B,
|
|
891
|
+
updateSelectedDate: Q,
|
|
892
|
+
scrollToCurrentTime: N,
|
|
886
893
|
scrollToTime: M,
|
|
887
|
-
scrollTop:
|
|
894
|
+
scrollTop: I,
|
|
888
895
|
createEvent: de,
|
|
889
|
-
deleteEvent:
|
|
896
|
+
deleteEvent: ye,
|
|
890
897
|
// Getters.
|
|
891
898
|
get isDay() {
|
|
892
|
-
return
|
|
899
|
+
return v.value === "day";
|
|
893
900
|
},
|
|
894
901
|
get isDays() {
|
|
895
|
-
return
|
|
902
|
+
return v.value === "days";
|
|
896
903
|
},
|
|
897
904
|
get isWeek() {
|
|
898
|
-
return
|
|
905
|
+
return v.value === "week";
|
|
899
906
|
},
|
|
900
907
|
get isMonth() {
|
|
901
|
-
return
|
|
908
|
+
return v.value === "month";
|
|
902
909
|
},
|
|
903
910
|
get isYear() {
|
|
904
|
-
return
|
|
911
|
+
return v.value === "year";
|
|
905
912
|
},
|
|
906
913
|
get isYears() {
|
|
907
|
-
return
|
|
914
|
+
return v.value === "years";
|
|
908
915
|
}
|
|
909
916
|
};
|
|
910
917
|
}, Fe = $e({
|
|
911
918
|
texts: { ...fe.texts },
|
|
912
919
|
// Make texts reactive before a locale is loaded.
|
|
913
|
-
dateUtils:
|
|
920
|
+
dateUtils: nt(fe.texts, st)
|
|
914
921
|
// Some Date utils functions need localized texts.
|
|
915
|
-
}),
|
|
916
|
-
const
|
|
917
|
-
uid:
|
|
922
|
+
}), yt = ({ props: D, emit: s, attrs: r, vuecalEl: g, uid: p }) => {
|
|
923
|
+
const b = $e({
|
|
924
|
+
uid: p,
|
|
918
925
|
// The Vuecal instance unique ID, used for dnd source-target identification.
|
|
919
926
|
emit: s,
|
|
920
927
|
texts: { ...Fe.texts },
|
|
@@ -937,8 +944,8 @@ const st = (c) => {
|
|
|
937
944
|
isResizingEvent: !1
|
|
938
945
|
}
|
|
939
946
|
});
|
|
940
|
-
return
|
|
941
|
-
},
|
|
947
|
+
return b.dateUtils = nt(Object.assign(fe.texts, b.texts), st), b.config = mt(b, D, r), b.eventsManager = gt(b), b.view = ht(b, g), b.dnd = ft(b), b;
|
|
948
|
+
}, Dt = 24 * 60, pt = {
|
|
942
949
|
allDayEvents: { type: [Boolean, String], default: !1 },
|
|
943
950
|
// Coming soon.
|
|
944
951
|
// avoidEventOverlap: { type: Boolean, default: undefined }, // Coming soon.
|
|
@@ -1002,7 +1009,7 @@ const st = (c) => {
|
|
|
1002
1009
|
// Start time of the time column, in minutes.
|
|
1003
1010
|
timeStep: { type: Number, default: 60 },
|
|
1004
1011
|
// Step amount for the time in the time column, in minutes.
|
|
1005
|
-
timeTo: { type: Number, default:
|
|
1012
|
+
timeTo: { type: Number, default: Dt },
|
|
1006
1013
|
// End time of the time column, in minutes.
|
|
1007
1014
|
titleBar: { type: Boolean, default: !0 },
|
|
1008
1015
|
// Show or hide the header title bar.
|
|
@@ -1034,206 +1041,206 @@ const st = (c) => {
|
|
|
1034
1041
|
// minScheduleWidth: { type: Number, default: 0 },
|
|
1035
1042
|
// overlapsPerTimeStep: { type: Boolean, default: false },
|
|
1036
1043
|
// resizeX: { type: Boolean, default: false },
|
|
1037
|
-
}, wt = { class: "vuecal__header" },
|
|
1044
|
+
}, wt = { class: "vuecal__header" }, _t = {
|
|
1038
1045
|
key: 0,
|
|
1039
1046
|
class: "vuecal__views-bar"
|
|
1040
|
-
}, kt = ["onClick", "innerHTML"],
|
|
1047
|
+
}, kt = ["onClick", "innerHTML"], bt = {
|
|
1041
1048
|
key: 1,
|
|
1042
1049
|
class: "vuecal__title-bar"
|
|
1043
|
-
},
|
|
1050
|
+
}, Tt = { class: "vuecal__transition-wrap" }, $t = ["disabled", "innerHTML"], Mt = {
|
|
1044
1051
|
__name: "header",
|
|
1045
|
-
setup(
|
|
1046
|
-
const s = Ne("vuecal"), { view:
|
|
1047
|
-
|
|
1048
|
-
},
|
|
1049
|
-
return (
|
|
1050
|
-
F(
|
|
1051
|
-
view:
|
|
1052
|
-
availableViews:
|
|
1053
|
-
vuecal:
|
|
1052
|
+
setup(D) {
|
|
1053
|
+
const s = Ne("vuecal"), { view: r, config: g } = s, p = () => {
|
|
1054
|
+
g.clickToNavigate && r.broader();
|
|
1055
|
+
}, b = T(() => g.clickToNavigate ? { click: p } : {});
|
|
1056
|
+
return (L, v) => (Y(), j("div", wt, [
|
|
1057
|
+
F(L.$slots, "header", {
|
|
1058
|
+
view: O(r),
|
|
1059
|
+
availableViews: O(g).availableViews,
|
|
1060
|
+
vuecal: O(s)
|
|
1054
1061
|
}),
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
(
|
|
1058
|
-
class:
|
|
1059
|
-
onClick: (
|
|
1060
|
-
innerHTML:
|
|
1062
|
+
L.$slots.header ? Z("", !0) : (Y(), j(te, { key: 0 }, [
|
|
1063
|
+
O(g).viewsBar ? (Y(), j("div", _t, [
|
|
1064
|
+
(Y(!0), j(te, null, we(O(g).availableViews, (C, o) => (Y(), j("button", {
|
|
1065
|
+
class: _e(["vuecal__view-button", { "vuecal__view-button--active": O(r).id === o }]),
|
|
1066
|
+
onClick: (m) => O(r).switch(o),
|
|
1067
|
+
innerHTML: O(s).texts[o],
|
|
1061
1068
|
type: "button"
|
|
1062
1069
|
}, null, 10, kt))), 256))
|
|
1063
|
-
])) :
|
|
1064
|
-
|
|
1070
|
+
])) : Z("", !0),
|
|
1071
|
+
O(g).titleBar ? (Y(), j("nav", bt, [
|
|
1065
1072
|
ge("button", {
|
|
1066
|
-
class:
|
|
1067
|
-
onClick:
|
|
1073
|
+
class: _e(["vuecal__nav vuecal__nav--prev", { "vuecal__nav--default": !L.$slots["previous-button"] }]),
|
|
1074
|
+
onClick: v[0] || (v[0] = (...C) => O(r).previous && O(r).previous(...C)),
|
|
1068
1075
|
type: "button"
|
|
1069
1076
|
}, [
|
|
1070
|
-
F(
|
|
1077
|
+
F(L.$slots, "previous-button")
|
|
1071
1078
|
], 2),
|
|
1072
|
-
ge("div",
|
|
1079
|
+
ge("div", Tt, [
|
|
1073
1080
|
Oe(Ge, {
|
|
1074
|
-
name: `vuecal-slide-fade--${
|
|
1081
|
+
name: `vuecal-slide-fade--${O(r).transitionDirection}`
|
|
1075
1082
|
}, {
|
|
1076
|
-
default:
|
|
1077
|
-
(
|
|
1078
|
-
key:
|
|
1083
|
+
default: J(() => [
|
|
1084
|
+
(Y(), j("div", {
|
|
1085
|
+
key: O(r).id + O(r).start.getTime()
|
|
1079
1086
|
}, [
|
|
1080
|
-
|
|
1087
|
+
L.$slots.title ? (Y(), Se(Ke(O(g).clickToNavigate && O(r).broaderView ? "button" : "div"), De({
|
|
1081
1088
|
key: 0,
|
|
1082
1089
|
class: "vuecal__title"
|
|
1083
|
-
}, Ie(
|
|
1084
|
-
default:
|
|
1085
|
-
F(
|
|
1090
|
+
}, Ie(b.value)), {
|
|
1091
|
+
default: J(() => [
|
|
1092
|
+
F(L.$slots, "title", se(ne(O(r))))
|
|
1086
1093
|
]),
|
|
1087
1094
|
_: 3
|
|
1088
|
-
}, 16)) : (
|
|
1095
|
+
}, 16)) : (Y(), Se(Ke(O(g).clickToNavigate && O(r).broaderView ? "button" : "div"), De({
|
|
1089
1096
|
key: 1,
|
|
1090
1097
|
class: "vuecal__title"
|
|
1091
|
-
}, Ie(
|
|
1092
|
-
innerHTML:
|
|
1098
|
+
}, Ie(b.value), {
|
|
1099
|
+
innerHTML: O(r).title
|
|
1093
1100
|
}), null, 16, ["innerHTML"]))
|
|
1094
1101
|
]))
|
|
1095
1102
|
]),
|
|
1096
1103
|
_: 3
|
|
1097
1104
|
}, 8, ["name"])
|
|
1098
1105
|
]),
|
|
1099
|
-
|
|
1100
|
-
|
|
1106
|
+
O(g).todayButton ? (Y(), j(te, { key: 0 }, [
|
|
1107
|
+
L.$slots["today-button"] ? F(L.$slots, "today-button", {
|
|
1101
1108
|
key: 0,
|
|
1102
|
-
navigate: () => !
|
|
1103
|
-
active:
|
|
1104
|
-
}) : (
|
|
1109
|
+
navigate: () => !O(r).containsToday && O(r).goToToday(),
|
|
1110
|
+
active: O(r).containsToday
|
|
1111
|
+
}) : (Y(), j("button", {
|
|
1105
1112
|
key: 1,
|
|
1106
|
-
class:
|
|
1107
|
-
onClick:
|
|
1108
|
-
disabled: !!
|
|
1113
|
+
class: _e(["vuecal__nav vuecal__nav--today vuecal__nav--default", { "vuecal__nav--active": O(r).containsToday }]),
|
|
1114
|
+
onClick: v[1] || (v[1] = (C) => !O(r).containsToday && O(r).goToToday()),
|
|
1115
|
+
disabled: !!O(r).containsToday,
|
|
1109
1116
|
type: "button",
|
|
1110
|
-
innerHTML:
|
|
1111
|
-
}, null, 10,
|
|
1112
|
-
], 64)) :
|
|
1117
|
+
innerHTML: O(s).texts.today
|
|
1118
|
+
}, null, 10, $t))
|
|
1119
|
+
], 64)) : Z("", !0),
|
|
1113
1120
|
ge("button", {
|
|
1114
|
-
class:
|
|
1115
|
-
onClick:
|
|
1121
|
+
class: _e(["vuecal__nav vuecal__nav--next", { "vuecal__nav--default": !L.$slots["next-button"] }]),
|
|
1122
|
+
onClick: v[2] || (v[2] = (...C) => O(r).next && O(r).next(...C)),
|
|
1116
1123
|
type: "button"
|
|
1117
1124
|
}, [
|
|
1118
|
-
F(
|
|
1125
|
+
F(L.$slots, "next-button")
|
|
1119
1126
|
], 2)
|
|
1120
|
-
])) :
|
|
1127
|
+
])) : Z("", !0)
|
|
1121
1128
|
], 64))
|
|
1122
1129
|
]));
|
|
1123
1130
|
}
|
|
1124
|
-
},
|
|
1131
|
+
}, Et = {
|
|
1125
1132
|
key: 0,
|
|
1126
1133
|
class: "vuecal__headings"
|
|
1127
1134
|
}, Yt = {
|
|
1128
1135
|
key: 0,
|
|
1129
1136
|
class: "vuecal__weekdays-headings"
|
|
1130
|
-
},
|
|
1137
|
+
}, St = ["onClick"], Ct = { class: "vuecal__weekday-day" }, Vt = {
|
|
1131
1138
|
key: 0,
|
|
1132
1139
|
class: "vuecal__weekday-date"
|
|
1133
|
-
},
|
|
1140
|
+
}, Ot = {
|
|
1134
1141
|
key: 1,
|
|
1135
1142
|
class: "vuecal__schedules-headings w-flex grow"
|
|
1136
|
-
},
|
|
1143
|
+
}, jt = ["innerHTML"], Pt = {
|
|
1137
1144
|
__name: "headings-bar",
|
|
1138
|
-
setup(
|
|
1139
|
-
const s = Ne("vuecal"), { view:
|
|
1145
|
+
setup(D) {
|
|
1146
|
+
const s = Ne("vuecal"), { view: r, config: g, dateUtils: p } = s, b = T(() => g.xs ? "day-xs" : g.sm || r.isDays || r.isMonth ? "day-sm" : "day"), L = T(() => (r.isDay || r.isDays || r.isWeek || r.isMonth) && !(r.isDay && !g.schedules)), v = T(() => r.cellDates.slice(0, r.cols).map(({ start: o }) => ({
|
|
1140
1147
|
id: Re[o.getDay()],
|
|
1141
1148
|
date: o,
|
|
1142
1149
|
dateNumber: o.getDate(),
|
|
1143
|
-
day:
|
|
1144
|
-
"day-sm":
|
|
1145
|
-
"day-xs":
|
|
1146
|
-
isToday:
|
|
1147
|
-
}))),
|
|
1150
|
+
day: p.formatDate(o, "dddd"),
|
|
1151
|
+
"day-sm": p.formatDate(o, "ddd"),
|
|
1152
|
+
"day-xs": p.formatDate(o, "dd"),
|
|
1153
|
+
isToday: p.isToday(o)
|
|
1154
|
+
}))), C = {
|
|
1148
1155
|
click: (o) => {
|
|
1149
|
-
(
|
|
1156
|
+
(r.isDays || r.isWeek) && r.updateSelectedDate(o);
|
|
1150
1157
|
}
|
|
1151
1158
|
};
|
|
1152
|
-
return (o,
|
|
1153
|
-
|
|
1154
|
-
(
|
|
1155
|
-
class:
|
|
1156
|
-
key:
|
|
1157
|
-
onClick: (G) =>
|
|
1159
|
+
return (o, m) => L.value ? (Y(), j("div", Et, [
|
|
1160
|
+
O(r).isDay ? Z("", !0) : (Y(), j("div", Yt, [
|
|
1161
|
+
(Y(!0), j(te, null, we(v.value, ($, W) => (Y(), j("div", {
|
|
1162
|
+
class: _e(["vuecal__weekday", { "vuecal__weekday--today": $.isToday }]),
|
|
1163
|
+
key: W,
|
|
1164
|
+
onClick: (G) => C.click($.date)
|
|
1158
1165
|
}, [
|
|
1159
1166
|
F(o.$slots, "weekday-heading", {
|
|
1160
|
-
label: b
|
|
1161
|
-
id:
|
|
1162
|
-
date:
|
|
1167
|
+
label: $[b.value],
|
|
1168
|
+
id: $.id,
|
|
1169
|
+
date: $.date
|
|
1163
1170
|
}, () => [
|
|
1164
|
-
ge("span",
|
|
1165
|
-
|
|
1171
|
+
ge("span", Ct, le($[b.value]), 1),
|
|
1172
|
+
O(r).isMonth ? Z("", !0) : (Y(), j("strong", Vt, le($.dateNumber), 1))
|
|
1166
1173
|
])
|
|
1167
|
-
], 10,
|
|
1174
|
+
], 10, St))), 128))
|
|
1168
1175
|
])),
|
|
1169
|
-
|
|
1170
|
-
(
|
|
1171
|
-
(
|
|
1172
|
-
o.$slots["schedule-heading"] ? (
|
|
1176
|
+
O(g).schedules ? (Y(), j("div", Ot, [
|
|
1177
|
+
(Y(!0), j(te, null, we(v.value, ($, W) => (Y(), j(te, { key: W }, [
|
|
1178
|
+
(Y(!0), j(te, null, we(O(g).schedules, (G, i) => (Y(), j(te, { key: i }, [
|
|
1179
|
+
o.$slots["schedule-heading"] ? (Y(), j("div", {
|
|
1173
1180
|
key: 0,
|
|
1174
|
-
class:
|
|
1181
|
+
class: _e(["vuecal__schedule vuecal__schedule--heading", G.class])
|
|
1175
1182
|
}, [
|
|
1176
1183
|
F(o.$slots, "schedule-heading", {
|
|
1177
1184
|
schedule: G,
|
|
1178
|
-
view:
|
|
1185
|
+
view: O(r)
|
|
1179
1186
|
})
|
|
1180
|
-
], 2)) : (
|
|
1187
|
+
], 2)) : (Y(), j("div", {
|
|
1181
1188
|
key: 1,
|
|
1182
|
-
class:
|
|
1189
|
+
class: _e(["vuecal__schedule vuecal__schedule--heading", G.class]),
|
|
1183
1190
|
innerHTML: G.label
|
|
1184
|
-
}, null, 10,
|
|
1191
|
+
}, null, 10, jt))
|
|
1185
1192
|
], 64))), 128))
|
|
1186
1193
|
], 64))), 128))
|
|
1187
|
-
])) :
|
|
1188
|
-
])) :
|
|
1194
|
+
])) : Z("", !0)
|
|
1195
|
+
])) : Z("", !0);
|
|
1189
1196
|
}
|
|
1190
|
-
},
|
|
1197
|
+
}, Ht = { class: "vuecal__time-column" }, Lt = {
|
|
1191
1198
|
__name: "time-column",
|
|
1192
|
-
setup(
|
|
1193
|
-
const s = Ne("vuecal"), { config:
|
|
1194
|
-
const
|
|
1195
|
-
for (let
|
|
1196
|
-
const
|
|
1197
|
-
|
|
1198
|
-
minutesSum:
|
|
1199
|
+
setup(D) {
|
|
1200
|
+
const s = Ne("vuecal"), { config: r, texts: g } = s, p = T(() => {
|
|
1201
|
+
const b = [];
|
|
1202
|
+
for (let v = r.timeFrom; v < r.timeTo; v += r.timeStep) {
|
|
1203
|
+
const C = ~~(v / 60), o = v % 60, m = g[v < 720 ? "am" : "pm"];
|
|
1204
|
+
b.push({
|
|
1205
|
+
minutesSum: v,
|
|
1199
1206
|
// The sum of hours + minutes in minutes.
|
|
1200
|
-
hours:
|
|
1207
|
+
hours: C,
|
|
1201
1208
|
minutes: o,
|
|
1202
|
-
formatted12: `${
|
|
1203
|
-
formatted24: `${
|
|
1209
|
+
formatted12: `${C % 12 ? C % 12 : 12}${o ? ":" + o.toString().padStart(2, 0) : ""}${m}`,
|
|
1210
|
+
formatted24: `${C.toString().padStart(2, 0)}:${o.toString().padStart(2, 0)}`
|
|
1204
1211
|
});
|
|
1205
1212
|
}
|
|
1206
|
-
return
|
|
1213
|
+
return b;
|
|
1207
1214
|
});
|
|
1208
|
-
return (
|
|
1209
|
-
(
|
|
1215
|
+
return (b, L) => (Y(), j("div", Ht, [
|
|
1216
|
+
(Y(!0), j(te, null, we(p.value, (v, C) => (Y(), j("div", {
|
|
1210
1217
|
class: "vuecal__time-cell",
|
|
1211
|
-
key:
|
|
1218
|
+
key: C
|
|
1212
1219
|
}, [
|
|
1213
|
-
F(
|
|
1214
|
-
index:
|
|
1215
|
-
minutes:
|
|
1216
|
-
hours:
|
|
1217
|
-
minutesSum:
|
|
1218
|
-
format12:
|
|
1219
|
-
format24:
|
|
1220
|
+
F(b.$slots, "time-cell", {
|
|
1221
|
+
index: C,
|
|
1222
|
+
minutes: v.minutes,
|
|
1223
|
+
hours: v.hours,
|
|
1224
|
+
minutesSum: v.minutesSum,
|
|
1225
|
+
format12: v.formatted12,
|
|
1226
|
+
format24: v.formatted24
|
|
1220
1227
|
}, () => [
|
|
1221
|
-
ge("label", null, le(
|
|
1228
|
+
ge("label", null, le(O(r).twelveHour ? v.formatted12 : v.formatted24), 1)
|
|
1222
1229
|
])
|
|
1223
1230
|
]))), 128))
|
|
1224
1231
|
]));
|
|
1225
1232
|
}
|
|
1226
|
-
},
|
|
1233
|
+
}, zt = ["draggable"], Ft = { class: "vuecal__event-details" }, Nt = { class: "vuecal__event-title" }, Wt = {
|
|
1227
1234
|
key: 0,
|
|
1228
1235
|
class: "vuecal__event-time"
|
|
1229
|
-
},
|
|
1236
|
+
}, Bt = ["innerHTML"], at = {
|
|
1230
1237
|
__name: "event",
|
|
1231
1238
|
props: {
|
|
1232
1239
|
event: { type: Object, required: !0 }
|
|
1233
1240
|
},
|
|
1234
1241
|
emits: ["event-drag-start", "event-drag-end", "event-resize-start", "event-resize-end"],
|
|
1235
|
-
setup(
|
|
1236
|
-
const { config:
|
|
1242
|
+
setup(D, { emit: s }) {
|
|
1243
|
+
const { config: r, view: g, dnd: p, touch: b, dateUtils: L } = Ne("vuecal"), v = D, C = ie(null), o = $e(v.event), m = $e({
|
|
1237
1244
|
dragging: !1,
|
|
1238
1245
|
resizing: !1,
|
|
1239
1246
|
fromResizer: !1,
|
|
@@ -1267,18 +1274,18 @@ const st = (c) => {
|
|
|
1267
1274
|
cellEl: null,
|
|
1268
1275
|
// Store the cell DOM node for a more efficient resizing calc in mousemove/touchmove.
|
|
1269
1276
|
schedule: null
|
|
1270
|
-
}),
|
|
1271
|
-
T(() =>
|
|
1277
|
+
}), $ = T(() => r.editableEvents.drag && o.draggable !== !1 && !o.background), W = T(() => r.time && r.editableEvents.resize && o.resizable !== !1 && !o.background);
|
|
1278
|
+
T(() => r.editableEvents.delete && o.deletable !== !1 && !o.background);
|
|
1272
1279
|
const G = T(() => {
|
|
1273
|
-
var
|
|
1280
|
+
var n, l, k;
|
|
1274
1281
|
return {
|
|
1275
1282
|
[`vuecal__event--${o._.id}`]: !0,
|
|
1276
1283
|
[o.class]: !!o.class,
|
|
1277
1284
|
"vuecal__event--recurring": !!o.recurring,
|
|
1278
1285
|
"vuecal__event--background": !!o.background,
|
|
1279
|
-
"vuecal__event--multiday": !!((
|
|
1280
|
-
"vuecal__event--cut-top": ((
|
|
1281
|
-
"vuecal__event--cut-bottom": ((k = o._) == null ? void 0 : k.endMinutes) >
|
|
1286
|
+
"vuecal__event--multiday": !!((n = o._) != null && n.multiday),
|
|
1287
|
+
"vuecal__event--cut-top": ((l = o._) == null ? void 0 : l.startMinutes) < r.timeFrom,
|
|
1288
|
+
"vuecal__event--cut-bottom": ((k = o._) == null ? void 0 : k.endMinutes) > r.timeTo || o.end.getDate() !== o.start.getDate(),
|
|
1282
1289
|
// Only apply the dragging class on the event copy that is being dragged.
|
|
1283
1290
|
"vuecal__event--dragging": !o._.draggingGhost && o._.dragging,
|
|
1284
1291
|
// Only apply the dragging-ghost class on the event original that remains fixed while a copy is being
|
|
@@ -1288,165 +1295,165 @@ const st = (c) => {
|
|
|
1288
1295
|
// after event deletion (event._.dragging is already false) so the event ghost does not flash in before
|
|
1289
1296
|
// deletion.
|
|
1290
1297
|
"vuecal__event--dragging-ghost": o._.draggingGhost,
|
|
1291
|
-
"vuecal__event--resizing":
|
|
1298
|
+
"vuecal__event--resizing": m.resizing
|
|
1292
1299
|
};
|
|
1293
|
-
}),
|
|
1294
|
-
const
|
|
1295
|
-
if (!
|
|
1296
|
-
const
|
|
1300
|
+
}), i = T(() => {
|
|
1301
|
+
const n = (g.isDay || g.isDays || g.isWeek) && r.time;
|
|
1302
|
+
if (!n && !o.backgroundColor && !o.color) return !1;
|
|
1303
|
+
const l = {
|
|
1297
1304
|
backgroundColor: o.backgroundColor || null,
|
|
1298
1305
|
color: o.color || null
|
|
1299
1306
|
};
|
|
1300
|
-
if (
|
|
1301
|
-
const k = Math.max(
|
|
1302
|
-
|
|
1307
|
+
if (n) {
|
|
1308
|
+
const k = Math.max(r.timeFrom, o._.startMinutes), t = Math.min(r.timeTo, o._.endMinutes), V = Ve(k, r), H = Ve(t, r) - V;
|
|
1309
|
+
l.top = `${V}%`, l.height = `${H}%`;
|
|
1303
1310
|
}
|
|
1304
|
-
return
|
|
1305
|
-
}),
|
|
1306
|
-
const
|
|
1307
|
-
Object.entries(
|
|
1308
|
-
["resize-end"].includes(t) || (
|
|
1309
|
-
|
|
1311
|
+
return l;
|
|
1312
|
+
}), u = T(() => {
|
|
1313
|
+
const n = { ...r.eventListeners.event };
|
|
1314
|
+
Object.entries(n).forEach(([t, V]) => {
|
|
1315
|
+
["resize-end"].includes(t) || (n[t] = (H) => {
|
|
1316
|
+
H.type !== "drop" && V(H.type ? { e: H, event: o } : H);
|
|
1310
1317
|
});
|
|
1311
1318
|
});
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1314
|
-
var
|
|
1315
|
-
t.stopPropagation(), e(t), (
|
|
1316
|
-
},
|
|
1317
|
-
var
|
|
1318
|
-
t.stopPropagation(), e(t), (
|
|
1319
|
+
const l = { ...n };
|
|
1320
|
+
n.touchstart = (t) => {
|
|
1321
|
+
var V;
|
|
1322
|
+
t.stopPropagation(), e(t), (V = l.touchstart) == null || V.call(l, { e: t, event: o });
|
|
1323
|
+
}, n.mousedown = (t) => {
|
|
1324
|
+
var V;
|
|
1325
|
+
t.stopPropagation(), e(t), (V = l.mousedown) == null || V.call(l, { e: t, event: o });
|
|
1319
1326
|
};
|
|
1320
1327
|
let k = null;
|
|
1321
|
-
return
|
|
1322
|
-
var
|
|
1323
|
-
(
|
|
1324
|
-
var
|
|
1325
|
-
k = null, (
|
|
1328
|
+
return n.click = (t) => {
|
|
1329
|
+
var V;
|
|
1330
|
+
(V = l.click) == null || V.call(l, { e: t, event: o }), k ? k = clearTimeout(k) : k = setTimeout(() => {
|
|
1331
|
+
var H;
|
|
1332
|
+
k = null, (H = l["delayed-click"]) == null || H.call(l, { e: t, event: o });
|
|
1326
1333
|
}, 400);
|
|
1327
|
-
},
|
|
1328
|
-
|
|
1329
|
-
},
|
|
1330
|
-
}), e = (
|
|
1331
|
-
var t,
|
|
1332
|
-
const
|
|
1333
|
-
|
|
1334
|
-
const k =
|
|
1335
|
-
|
|
1336
|
-
var
|
|
1337
|
-
|
|
1334
|
+
}, n.dblclick = (t) => {
|
|
1335
|
+
l.dblclick ? l.dblclick({ e: t, event: o }) : o.delete(1);
|
|
1336
|
+
}, n;
|
|
1337
|
+
}), e = (n) => {
|
|
1338
|
+
var t, V, H;
|
|
1339
|
+
const l = ((t = n.touches) == null ? void 0 : t[0]) || n;
|
|
1340
|
+
m.fromResizer = l.target.matches(".vuecal__event-resizer, .vuecal__event-resizer *");
|
|
1341
|
+
const k = C.value.getBoundingClientRect();
|
|
1342
|
+
m.startX = (((V = n.touches) == null ? void 0 : V[0]) || n).clientX - k.left, m.startY = (((H = n.touches) == null ? void 0 : H[0]) || n).clientY - k.top, m.startPercentageX = m.startX * 100 / k.width, m.startPercentageY = m.startY * 100 / k.height, m.cellEl = C.value.closest(".vuecal__cell"), m.resizeStartDate = o.start, A(n.type === "touchstart" ? "touchmove" : "mousemove", d), A(n.type === "touchstart" ? "touchend" : "mouseup", h, { once: !0 }), m.holdTimer = setTimeout(() => {
|
|
1343
|
+
var U, K;
|
|
1344
|
+
m.holding = !0, (K = (U = u.value).hold) == null || K.call(U, { e: n, event: o });
|
|
1338
1345
|
}, 1e3);
|
|
1339
|
-
},
|
|
1340
|
-
var k, t,
|
|
1341
|
-
const
|
|
1342
|
-
if (
|
|
1343
|
-
const { top:
|
|
1344
|
-
|
|
1346
|
+
}, d = async (n) => {
|
|
1347
|
+
var k, t, V, H;
|
|
1348
|
+
const l = ((k = n.touches) == null ? void 0 : k[0]) || n;
|
|
1349
|
+
if (m.fromResizer && !m.resizing && (m.resizing = !0, m.resizingOriginalEvent = { ...o, _: { ...o._ } }, b.isResizingEvent = !0, (V = (t = u.value).resizeStart) == null || V.call(t, { e: n, event: o })), m.holdTimer = clearTimeout(m.holdTimer), m.holding = !1, m.cellEl) {
|
|
1350
|
+
const { top: U, left: K, width: ue, height: ae } = m.cellEl.getBoundingClientRect();
|
|
1351
|
+
m.moveX = l.clientX - K, m.moveY = l.clientY - U, m.movePercentageX = m.moveX * 100 / ue, m.movePercentageY = m.moveY * 100 / ae;
|
|
1345
1352
|
}
|
|
1346
|
-
if (
|
|
1347
|
-
const { newStart:
|
|
1348
|
-
let
|
|
1349
|
-
const { resize: ae } = (
|
|
1350
|
-
ae && (
|
|
1351
|
-
e:
|
|
1352
|
-
event: { ...o, start:
|
|
1353
|
-
overlaps: o.getOverlappingEvents({ start:
|
|
1354
|
-
})),
|
|
1353
|
+
if (m.fromResizer) {
|
|
1354
|
+
const { newStart: U, newEnd: K } = E(o);
|
|
1355
|
+
let ue = !0;
|
|
1356
|
+
const { resize: ae } = (H = r.eventListeners) == null ? void 0 : H.event;
|
|
1357
|
+
ae && (ue = await ae({
|
|
1358
|
+
e: n,
|
|
1359
|
+
event: { ...o, start: U, end: K },
|
|
1360
|
+
overlaps: o.getOverlappingEvents({ start: U, end: K })
|
|
1361
|
+
})), ue !== !1 ? (o.start = U, o.end = K, m.resizingLastAcceptedEvent && (m.resizingLastAcceptedEvent = null)) : ae && (m.resizingLastAcceptedEvent = { ...o, _: { ...o._ } });
|
|
1355
1362
|
}
|
|
1356
|
-
},
|
|
1357
|
-
var
|
|
1358
|
-
if (
|
|
1359
|
-
const { newStart: t, newEnd:
|
|
1360
|
-
let
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1363
|
-
e:
|
|
1363
|
+
}, h = async (n) => {
|
|
1364
|
+
var l, k;
|
|
1365
|
+
if (m.holdTimer = clearTimeout(m.holdTimer), m.holding = !1, m.resizing) {
|
|
1366
|
+
const { newStart: t, newEnd: V } = E(o);
|
|
1367
|
+
let H = !0;
|
|
1368
|
+
const U = u.value["resize-end"];
|
|
1369
|
+
U && (H = await U({
|
|
1370
|
+
e: n,
|
|
1364
1371
|
event: o,
|
|
1365
|
-
original:
|
|
1372
|
+
original: m.resizingOriginalEvent,
|
|
1366
1373
|
// Original event details before resizing.
|
|
1367
|
-
overlaps: o.getOverlappingEvents({ start: t, end:
|
|
1368
|
-
})), o.start =
|
|
1374
|
+
overlaps: o.getOverlappingEvents({ start: t, end: V })
|
|
1375
|
+
})), o.start = H === !1 ? (m.resizingLastAcceptedEvent || m.resizingOriginalEvent).start : ((l = m.resizingLastAcceptedEvent) == null ? void 0 : l.start) || t, o.end = H === !1 ? (m.resizingLastAcceptedEvent || m.resizingOriginalEvent).end : ((k = m.resizingLastAcceptedEvent) == null ? void 0 : k.end) || V, o._.duration < 1 && (o.start = m.resizingOriginalEvent.start, o.end = m.resizingOriginalEvent.end), b.isResizingEvent = !1;
|
|
1369
1376
|
}
|
|
1370
|
-
document.removeEventListener(
|
|
1371
|
-
},
|
|
1372
|
-
const
|
|
1373
|
-
new Date(
|
|
1374
|
-
let t = Pe(
|
|
1375
|
-
if (t = Math.max(0, Math.min(t, 24 * 60)),
|
|
1376
|
-
const
|
|
1377
|
-
t =
|
|
1377
|
+
document.removeEventListener(n.type === "touchend" ? "touchmove" : "mousemove", d), m.resizing = !1, m.fromResizer = !1, m.dragging = !1, m.startX = 0, m.startY = 0, m.moveX = 0, m.moveY = 0, m.startPercentageX = 0, m.startPercentageY = 0, m.movePercentageX = 0, m.movePercentageY = 0, m.cellEl = null, m.resizeStartDate = null, m.resizingOriginalEvent = null, m.resizingLastAcceptedEvent = null, m.schedule = null;
|
|
1378
|
+
}, E = (n) => {
|
|
1379
|
+
const l = new Date(n.start.getFullYear(), n.start.getMonth(), n.start.getDate());
|
|
1380
|
+
new Date(l).setDate(l.getDate() + 1);
|
|
1381
|
+
let t = Pe(m.movePercentageY, r);
|
|
1382
|
+
if (t = Math.max(0, Math.min(t, 24 * 60)), r.snapToInterval) {
|
|
1383
|
+
const U = t + r.snapToInterval / 2;
|
|
1384
|
+
t = U - U % r.snapToInterval;
|
|
1378
1385
|
}
|
|
1379
|
-
let
|
|
1380
|
-
return
|
|
1386
|
+
let V = n.start, H = new Date(l.getTime() + t * 6e4);
|
|
1387
|
+
return H < m.resizeStartDate && (V = H, H = m.resizeStartDate), { newStart: V, newEnd: H };
|
|
1381
1388
|
};
|
|
1382
|
-
Ze(() => o._.register(
|
|
1383
|
-
const
|
|
1384
|
-
document.addEventListener(
|
|
1389
|
+
Ze(() => o._.register(C.value));
|
|
1390
|
+
const P = [], A = (n, l, k) => {
|
|
1391
|
+
document.addEventListener(n, l, k), P.push({ event: n, handler: l, options: k });
|
|
1385
1392
|
};
|
|
1386
1393
|
return Xe(() => {
|
|
1387
|
-
o._.unregister(),
|
|
1388
|
-
document.removeEventListener(
|
|
1394
|
+
o._.unregister(), P.forEach(({ event: n, handler: l, options: k }) => {
|
|
1395
|
+
document.removeEventListener(n, l, k);
|
|
1389
1396
|
});
|
|
1390
|
-
}), (
|
|
1397
|
+
}), (n, l) => (Y(), j("div", De({ class: "vuecal__event" }, Ie(u.value, !0), {
|
|
1391
1398
|
ref_key: "eventEl",
|
|
1392
|
-
ref:
|
|
1399
|
+
ref: C,
|
|
1393
1400
|
class: G.value,
|
|
1394
|
-
style:
|
|
1395
|
-
draggable:
|
|
1396
|
-
onDragstart:
|
|
1397
|
-
onDragend:
|
|
1401
|
+
style: i.value,
|
|
1402
|
+
draggable: $.value ? "true" : void 0,
|
|
1403
|
+
onDragstart: l[2] || (l[2] = (k) => $.value && O(p).eventDragStart(k, o)),
|
|
1404
|
+
onDragend: l[3] || (l[3] = (k) => $.value && O(p).eventDragEnd(k, o))
|
|
1398
1405
|
}), [
|
|
1399
|
-
ge("div",
|
|
1400
|
-
F(
|
|
1401
|
-
ge("div",
|
|
1402
|
-
|
|
1403
|
-
- ` + le(o._[`endTimeFormatted${
|
|
1406
|
+
ge("div", Ft, [
|
|
1407
|
+
F(n.$slots, "event", { event: o }, () => [
|
|
1408
|
+
ge("div", Nt, le(o.title), 1),
|
|
1409
|
+
O(r).time ? (Y(), j("div", Wt, le(o._[`startTimeFormatted${O(r).twelveHour ? 12 : 24}`]) + `
|
|
1410
|
+
- ` + le(o._[`endTimeFormatted${O(r).twelveHour ? 12 : 24}`]), 1)) : Z("", !0),
|
|
1404
1411
|
ge("div", {
|
|
1405
1412
|
class: "vuecal__event-content",
|
|
1406
1413
|
innerHTML: o.content
|
|
1407
|
-
}, null, 8,
|
|
1414
|
+
}, null, 8, Bt)
|
|
1408
1415
|
])
|
|
1409
1416
|
]),
|
|
1410
|
-
|
|
1417
|
+
W.value ? (Y(), j("div", {
|
|
1411
1418
|
key: 0,
|
|
1412
1419
|
class: "vuecal__event-resizer",
|
|
1413
|
-
onDragstart:
|
|
1420
|
+
onDragstart: l[0] || (l[0] = Qe(() => {
|
|
1414
1421
|
}, ["prevent", "stop"]))
|
|
1415
|
-
}, null, 32)) :
|
|
1422
|
+
}, null, 32)) : Z("", !0),
|
|
1416
1423
|
Oe(Ge, { name: "vuecal-delete-btn" }, {
|
|
1417
|
-
default:
|
|
1418
|
-
o._.deleting ? (
|
|
1424
|
+
default: J(() => [
|
|
1425
|
+
o._.deleting ? (Y(), j("div", {
|
|
1419
1426
|
key: 0,
|
|
1420
1427
|
class: "vuecal__event-delete",
|
|
1421
|
-
onClick:
|
|
1422
|
-
}, "Delete")) :
|
|
1428
|
+
onClick: l[1] || (l[1] = Qe((k) => o.delete(3), ["stop"]))
|
|
1429
|
+
}, "Delete")) : Z("", !0)
|
|
1423
1430
|
]),
|
|
1424
1431
|
_: 1
|
|
1425
1432
|
})
|
|
1426
|
-
], 16,
|
|
1433
|
+
], 16, zt));
|
|
1427
1434
|
}
|
|
1428
|
-
},
|
|
1435
|
+
}, At = ["innerHTML"], It = ["data-schedule"], Rt = {
|
|
1429
1436
|
key: 1,
|
|
1430
1437
|
class: "vuecal__cell-date"
|
|
1431
|
-
},
|
|
1438
|
+
}, Xt = {
|
|
1432
1439
|
key: 2,
|
|
1433
1440
|
class: "vuecal__cell-content"
|
|
1434
|
-
},
|
|
1441
|
+
}, Gt = {
|
|
1435
1442
|
key: 3,
|
|
1436
1443
|
class: "vuecal__cell-events"
|
|
1437
|
-
},
|
|
1444
|
+
}, qt = {
|
|
1438
1445
|
key: 1,
|
|
1439
1446
|
class: "vuecal__cell-date"
|
|
1440
|
-
},
|
|
1447
|
+
}, Ut = {
|
|
1441
1448
|
key: 2,
|
|
1442
1449
|
class: "vuecal__cell-content"
|
|
1443
|
-
},
|
|
1450
|
+
}, Zt = {
|
|
1444
1451
|
key: 3,
|
|
1445
1452
|
class: "vuecal__cell-events"
|
|
1446
|
-
},
|
|
1453
|
+
}, Jt = {
|
|
1447
1454
|
key: 5,
|
|
1448
1455
|
class: "vuecal__cell-events-count"
|
|
1449
|
-
},
|
|
1456
|
+
}, Kt = ["title"], Qt = {
|
|
1450
1457
|
__name: "cell",
|
|
1451
1458
|
props: {
|
|
1452
1459
|
// Even with time=false, the date of the cell will still be provided in order to attach
|
|
@@ -1455,10 +1462,10 @@ const st = (c) => {
|
|
|
1455
1462
|
end: { type: Date, required: !0 },
|
|
1456
1463
|
index: { type: Number, required: !0 }
|
|
1457
1464
|
},
|
|
1458
|
-
setup(
|
|
1459
|
-
const s =
|
|
1460
|
-
|
|
1461
|
-
},
|
|
1465
|
+
setup(D) {
|
|
1466
|
+
const s = D, r = Ne("vuecal"), { view: g, config: p, dateUtils: b, eventsManager: L, dnd: v, touch: C } = r, o = T(() => b.isToday(s.start)), m = ie(null), $ = ie([]), W = ie(!1), G = (c) => {
|
|
1467
|
+
$.value.push(c.detail), W.value = !0;
|
|
1468
|
+
}, i = () => setTimeout(() => W.value = !1, 300), u = $e({
|
|
1462
1469
|
dragging: !1,
|
|
1463
1470
|
holding: !1,
|
|
1464
1471
|
// When the cell is clicked and hold for a certain amount of time.
|
|
@@ -1479,443 +1486,419 @@ const st = (c) => {
|
|
|
1479
1486
|
movePercentageX: 0,
|
|
1480
1487
|
movePercentageY: 0,
|
|
1481
1488
|
schedule: null
|
|
1482
|
-
}), e = ie(!1),
|
|
1483
|
-
let
|
|
1484
|
-
return
|
|
1489
|
+
}), e = ie(!1), d = ie({ cellOverlaps: {}, longestStreak: 0 }), h = T(() => {
|
|
1490
|
+
let c = Math.min(u.startPercentageY, u.movePercentageY), w = Math.max(u.startPercentageY, u.movePercentageY), S = Pe(c, p), M = Pe(w, p);
|
|
1491
|
+
return p.snapToInterval && (S = b.snapToInterval(S, p.snapToInterval), M = b.snapToInterval(M, p.snapToInterval), c = Ve(S, p), w = Ve(M, p)), {
|
|
1485
1492
|
style: {
|
|
1486
|
-
top:
|
|
1487
|
-
height: Math.abs(
|
|
1493
|
+
top: c + "%",
|
|
1494
|
+
height: Math.abs(w - c) + "%"
|
|
1488
1495
|
},
|
|
1489
1496
|
startMinutes: S,
|
|
1490
1497
|
endMinutes: M,
|
|
1491
|
-
start:
|
|
1492
|
-
end:
|
|
1493
|
-
...
|
|
1498
|
+
start: b.formatMinutes(S),
|
|
1499
|
+
end: b.formatMinutes(M),
|
|
1500
|
+
...u.schedule ? { schedule: u.schedule } : {}
|
|
1494
1501
|
};
|
|
1495
|
-
}),
|
|
1496
|
-
const
|
|
1497
|
-
return
|
|
1498
|
-
}),
|
|
1499
|
-
var
|
|
1500
|
-
const
|
|
1502
|
+
}), E = T(() => {
|
|
1503
|
+
const c = p.editableEvents.create && (u.dragging || e.value), w = p.eventCreateMinDrag && u.thresholdPassed || !p.eventCreateMinDrag;
|
|
1504
|
+
return c && w;
|
|
1505
|
+
}), P = T(() => {
|
|
1506
|
+
var x;
|
|
1507
|
+
const c = /* @__PURE__ */ new Date(), w = g.start.getFullYear(), S = g.start.getMonth(), M = s.start.getFullYear(), N = s.start.getMonth();
|
|
1501
1508
|
return {
|
|
1502
|
-
[`vuecal__cell--${Re[s.start.getDay()]}`]:
|
|
1503
|
-
[`vuecal__cell--${
|
|
1504
|
-
[`vuecal__cell--${M}`]:
|
|
1509
|
+
[`vuecal__cell--${Re[s.start.getDay()]}`]: g.isDay || g.isDays || g.isWeek || g.isMonth,
|
|
1510
|
+
[`vuecal__cell--${dt[N]}`]: g.isYear,
|
|
1511
|
+
[`vuecal__cell--${M}`]: g.isYears,
|
|
1505
1512
|
"vuecal__cell--today": o.value,
|
|
1506
|
-
"vuecal__cell--current-month":
|
|
1507
|
-
"vuecal__cell--current-year":
|
|
1508
|
-
"vuecal__cell--out-of-range":
|
|
1513
|
+
"vuecal__cell--current-month": g.isYear && M === c.getFullYear() && N === c.getMonth(),
|
|
1514
|
+
"vuecal__cell--current-year": g.isYears && M === c.getFullYear(),
|
|
1515
|
+
"vuecal__cell--out-of-range": g.isMonth && (M !== w || N !== S),
|
|
1509
1516
|
"vuecal__cell--before-min": ae.value && K.value,
|
|
1510
|
-
"vuecal__cell--after-max": ae.value &&
|
|
1517
|
+
"vuecal__cell--after-max": ae.value && ue.value,
|
|
1511
1518
|
"vuecal__cell--disabled": ae.value,
|
|
1512
|
-
"vuecal__cell--selected":
|
|
1513
|
-
"vuecal__cell--has-schedules": (
|
|
1514
|
-
"vuecal__cell--dragging":
|
|
1515
|
-
"vuecal__cell--has-events":
|
|
1519
|
+
"vuecal__cell--selected": g.selectedDate && g.selectedDate.getTime() >= s.start.getTime() && g.selectedDate.getTime() <= s.end.getTime(),
|
|
1520
|
+
"vuecal__cell--has-schedules": (x = p.schedules) == null ? void 0 : x.length,
|
|
1521
|
+
"vuecal__cell--dragging": u.dragging,
|
|
1522
|
+
"vuecal__cell--has-events": l.value.length
|
|
1516
1523
|
};
|
|
1517
|
-
}),
|
|
1518
|
-
switch (
|
|
1524
|
+
}), A = T(() => b.formatDate(s.start)), n = T(() => {
|
|
1525
|
+
switch (g.id) {
|
|
1519
1526
|
case "day":
|
|
1520
1527
|
return "";
|
|
1521
1528
|
case "days":
|
|
1522
|
-
return
|
|
1529
|
+
return p.availableViews.days.rows > 1 && b.formatDate(s.start, "D"), "";
|
|
1523
1530
|
case "week":
|
|
1524
1531
|
return "";
|
|
1525
1532
|
case "month":
|
|
1526
|
-
return
|
|
1533
|
+
return b.formatDate(s.start, "D");
|
|
1527
1534
|
case "year":
|
|
1528
|
-
return
|
|
1535
|
+
return b.formatDate(s.start, p.xs ? "MMM" : "MMMM");
|
|
1529
1536
|
case "years":
|
|
1530
|
-
return
|
|
1537
|
+
return b.formatDate(s.start, "YYYY");
|
|
1531
1538
|
}
|
|
1532
|
-
}),
|
|
1533
|
-
var
|
|
1534
|
-
return (
|
|
1535
|
-
}),
|
|
1536
|
-
const
|
|
1537
|
-
for (const
|
|
1538
|
-
const S =
|
|
1539
|
-
|
|
1539
|
+
}), l = T(() => p.datePicker ? [] : L.getEventsByDate(A.value, !0, !0).filter((c) => !$.value.includes(c._.id))), k = T(() => l.value.filter((c) => !c.background)), t = T(() => {
|
|
1540
|
+
var c;
|
|
1541
|
+
return (c = p.schedules) == null ? void 0 : c.reduce((w, S) => (w[S.id] = l.value.filter((M) => M.schedule === S.id), w), {});
|
|
1542
|
+
}), V = T(() => {
|
|
1543
|
+
const c = {};
|
|
1544
|
+
for (const w of l.value) {
|
|
1545
|
+
const S = w._.id, { maxConcurrent: M = 1, position: N = 0 } = d.value.cellOverlaps[S] || {};
|
|
1546
|
+
c[S] = {
|
|
1540
1547
|
width: `${100 / M}%`,
|
|
1541
|
-
left: `${100 / M *
|
|
1548
|
+
left: `${100 / M * N}%`
|
|
1542
1549
|
};
|
|
1543
1550
|
}
|
|
1544
|
-
return
|
|
1545
|
-
}),
|
|
1551
|
+
return c;
|
|
1552
|
+
}), H = T(() => g.isMonth && p.eventCount && !p.eventsOnMonthView && k.value.length), U = T(() => {
|
|
1546
1553
|
var S;
|
|
1547
|
-
if (!
|
|
1548
|
-
const
|
|
1549
|
-
let
|
|
1550
|
-
if (
|
|
1551
|
-
return Array.isArray(
|
|
1552
|
-
let { from:
|
|
1553
|
-
if (isNaN(
|
|
1554
|
-
|
|
1555
|
-
const
|
|
1554
|
+
if (!p.specialHours || g.isMonth || g.isYear || g.isYears) return;
|
|
1555
|
+
const c = Re[s.start.getDay()];
|
|
1556
|
+
let w = (S = p.specialHours) == null ? void 0 : S[c];
|
|
1557
|
+
if (w)
|
|
1558
|
+
return Array.isArray(w) || (w = [w]), w.map((M) => {
|
|
1559
|
+
let { from: N, to: I, class: x, label: de } = M;
|
|
1560
|
+
if (isNaN(N) || isNaN(I) || p.timeFrom >= I || p.timeTo <= N) return;
|
|
1561
|
+
N = Math.max(p.timeFrom, N), I = Math.min(p.timeTo, I);
|
|
1562
|
+
const ye = Ve(N, p), f = Ve(I, p) - ye;
|
|
1556
1563
|
return {
|
|
1557
|
-
style: { top: `${
|
|
1564
|
+
style: { top: `${ye}%`, height: `${f}%` },
|
|
1558
1565
|
label: de,
|
|
1559
|
-
class:
|
|
1566
|
+
class: x
|
|
1560
1567
|
};
|
|
1561
1568
|
}).filter((M) => !!M);
|
|
1562
|
-
}), K = T(() =>
|
|
1563
|
-
const { disableDays:
|
|
1564
|
-
return
|
|
1569
|
+
}), K = T(() => p.minTimestamp !== null && p.minTimestamp > s.end.getTime()), ue = T(() => p.maxTimestamp && p.maxTimestamp < s.start.getTime()), ae = T(() => {
|
|
1570
|
+
const { disableDays: c } = p, w = g.isYear || g.isYears;
|
|
1571
|
+
return c.length && c.includes(b.formatDate(s.start)) && !w ? !0 : K.value || ue.value;
|
|
1565
1572
|
}), re = $e({
|
|
1566
1573
|
show: T(() => {
|
|
1567
|
-
if (!(!
|
|
1574
|
+
if (!(!g.isDay && !g.isDays && !g.isWeek) && !(!o.value || !p.time) && !(p.timeFrom > b.dateToMinutes(g.now)) && !(b.dateToMinutes(g.now) > p.timeTo))
|
|
1568
1575
|
return !0;
|
|
1569
1576
|
}),
|
|
1570
|
-
nowInMinutes: T(() =>
|
|
1571
|
-
todaysTimePosition: T(() => Ve(re.nowInMinutes,
|
|
1577
|
+
nowInMinutes: T(() => b.dateToMinutes(g.now)),
|
|
1578
|
+
todaysTimePosition: T(() => Ve(re.nowInMinutes, p)),
|
|
1572
1579
|
style: T(() => `top: ${re.todaysTimePosition}%`),
|
|
1573
|
-
currentTime: T(() =>
|
|
1574
|
-
}),
|
|
1580
|
+
currentTime: T(() => b.formatTime(g.now))
|
|
1581
|
+
}), he = T(() => {
|
|
1575
1582
|
if (ae.value) return {};
|
|
1576
|
-
const
|
|
1577
|
-
Object.entries(
|
|
1578
|
-
|
|
1579
|
-
var
|
|
1580
|
-
(
|
|
1583
|
+
const c = { ...p.eventListeners.cell };
|
|
1584
|
+
Object.entries(c).forEach(([M, N]) => {
|
|
1585
|
+
c[M] = (I) => {
|
|
1586
|
+
var x, de, ye;
|
|
1587
|
+
(ye = (de = I.target || ((x = I.e) == null ? void 0 : x.target)).closest) != null && ye.call(de, ".vuecal__event") || N(I.type ? { e: I, cell: q.value, cursor: ce.value } : I);
|
|
1581
1588
|
};
|
|
1582
1589
|
});
|
|
1583
|
-
const
|
|
1590
|
+
const w = { ...c };
|
|
1584
1591
|
let S = null;
|
|
1585
|
-
return
|
|
1586
|
-
var
|
|
1587
|
-
|
|
1588
|
-
var
|
|
1589
|
-
S = null, (
|
|
1592
|
+
return c.click = (M) => {
|
|
1593
|
+
var N;
|
|
1594
|
+
ee(), (N = w.click) == null || N.call(w, { e: M, cell: q.value, cursor: ce.value }), S ? S = clearTimeout(S) : S = setTimeout(() => {
|
|
1595
|
+
var I;
|
|
1596
|
+
S = null, (I = w["delayed-click"]) == null || I.call(w, { e: M, cell: q.value, cursor: ce.value });
|
|
1590
1597
|
}, 400);
|
|
1591
|
-
}, (
|
|
1592
|
-
var
|
|
1593
|
-
|
|
1594
|
-
},
|
|
1595
|
-
var
|
|
1596
|
-
|
|
1597
|
-
}),
|
|
1598
|
-
var
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1601
|
-
const
|
|
1602
|
-
y:
|
|
1603
|
-
date:
|
|
1598
|
+
}, (p.time && g.isDay || g.isDays || g.isWeek) && (c.touchstart = (M) => {
|
|
1599
|
+
var N;
|
|
1600
|
+
oe(M.e || M), (N = w.touchstart) == null || N.call(w, { e: M, cell: q.value, cursor: ce.value });
|
|
1601
|
+
}, c.mousedown = (M) => {
|
|
1602
|
+
var N;
|
|
1603
|
+
oe(M.e || M), (N = w.mousedown) == null || N.call(w, { e: M, cell: q.value, cursor: ce.value });
|
|
1604
|
+
}), w.dblclick && (c.dblclick = (M) => {
|
|
1605
|
+
var z, R;
|
|
1606
|
+
const N = (((z = M.touches) == null ? void 0 : z[0]) || M).clientY, { top: I } = m.value.getBoundingClientRect(), x = Je(N - I, m.value), de = Pe(x, p), ye = new Date(s.start);
|
|
1607
|
+
ye.setMinutes(de);
|
|
1608
|
+
const f = {
|
|
1609
|
+
y: x,
|
|
1610
|
+
date: ye
|
|
1604
1611
|
};
|
|
1605
|
-
(R =
|
|
1606
|
-
}),
|
|
1607
|
-
M.preventDefault(),
|
|
1608
|
-
},
|
|
1609
|
-
}),
|
|
1612
|
+
(R = w.dblclick) == null || R.call(w, { e: M, cell: q.value, cursor: f });
|
|
1613
|
+
}), p.editableEvents.drag && (c.dragenter = (M) => v.cellDragEnter(M, q.value), c.dragover = (M) => {
|
|
1614
|
+
M.preventDefault(), v.cellDragOver(M, q.value);
|
|
1615
|
+
}, c.dragleave = (M) => v.cellDragLeave(M, q.value), c.drop = (M) => v.cellDragDrop(M, q.value)), c;
|
|
1616
|
+
}), q = T(() => ({
|
|
1610
1617
|
start: s.start,
|
|
1611
1618
|
end: s.end,
|
|
1612
|
-
events:
|
|
1613
|
-
...
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1619
|
+
events: l,
|
|
1620
|
+
...u.schedule ? { schedule: u.schedule } : {},
|
|
1621
|
+
goNarrower: () => g.narrower(),
|
|
1622
|
+
goBroader: () => g.broader(),
|
|
1623
|
+
broader: g.broaderView,
|
|
1624
|
+
narrower: g.narrowerView
|
|
1625
|
+
})), ce = T(() => {
|
|
1626
|
+
const c = Pe(u.movePercentageY || u.startPercentageY, p), w = new Date(s.start);
|
|
1627
|
+
return w.setMinutes(c), {
|
|
1628
|
+
x: u.movePercentageX || u.startPercentageX,
|
|
1629
|
+
y: u.movePercentageY || u.startPercentageY,
|
|
1630
|
+
date: w
|
|
1620
1631
|
};
|
|
1621
|
-
}),
|
|
1622
|
-
|
|
1623
|
-
},
|
|
1632
|
+
}), ee = () => {
|
|
1633
|
+
g.updateSelectedDate(s.start), p.clickToNavigate && ((g.isMonth || g.isDays || g.isWeek) && p.availableViews.day ? g.switch("day") : g.isYear && p.availableViews.month ? g.switch("month") : g.isYears && p.availableViews.year && g.switch("year")), g.updateViewDate(s.start);
|
|
1634
|
+
}, oe = (c) => {
|
|
1624
1635
|
var S, M;
|
|
1625
|
-
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1628
|
-
var
|
|
1629
|
-
|
|
1636
|
+
u.schedule = ~~c.target.dataset.schedule;
|
|
1637
|
+
const w = m.value.getBoundingClientRect();
|
|
1638
|
+
u.startX = (((S = c.touches) == null ? void 0 : S[0]) || c).clientX - w.left, u.startY = (((M = c.touches) == null ? void 0 : M[0]) || c).clientY - w.top, u.startPercentageX = u.startX * 100 / w.width, u.startPercentageY = u.startY * 100 / w.height, u.thresholdPassed = !1, document.addEventListener(c.type === "touchstart" ? "touchmove" : "mousemove", a), document.addEventListener(c.type === "touchstart" ? "touchend" : "mouseup", _, { once: !0 }), u.holdTimer = setTimeout(() => {
|
|
1639
|
+
var N, I;
|
|
1640
|
+
u.holding = !0, (I = (N = he.value).hold) == null || I.call(N, { e: c, cell: q.value, cursor: ce.value });
|
|
1630
1641
|
}, 1e3);
|
|
1631
|
-
},
|
|
1632
|
-
var S, M,
|
|
1633
|
-
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
},
|
|
1637
|
-
var
|
|
1638
|
-
document.removeEventListener(
|
|
1639
|
-
},
|
|
1640
|
-
if (!
|
|
1641
|
-
let { start:
|
|
1642
|
-
|
|
1643
|
-
let
|
|
1644
|
-
const { create:
|
|
1645
|
-
if (typeof
|
|
1646
|
-
const de =
|
|
1647
|
-
|
|
1648
|
-
} else
|
|
1649
|
-
},
|
|
1650
|
-
Object.keys(
|
|
1651
|
-
var
|
|
1652
|
-
(
|
|
1642
|
+
}, a = (c) => {
|
|
1643
|
+
var S, M, N, I, x, de;
|
|
1644
|
+
u.dragging || (C.isDraggingCell = !0, (M = (S = he.value).dragStart) == null || M.call(S, { e: c, cell: q.value, cursor: ce.value })), u.dragging = !0, u.holdTimer = clearTimeout(u.holdTimer), u.holding = !1;
|
|
1645
|
+
const w = m.value.getBoundingClientRect();
|
|
1646
|
+
u.moveX = (((N = c.touches) == null ? void 0 : N[0]) || c).clientX - w.left, u.moveY = (((I = c.touches) == null ? void 0 : I[0]) || c).clientY - w.top, u.movePercentageX = u.moveX * 100 / w.width, u.movePercentageY = u.moveY * 100 / w.height, p.eventCreateMinDrag && Math.abs(u.startY - u.moveY) > p.eventCreateMinDrag && (u.thresholdPassed = !0), (de = (x = he.value).drag) == null || de.call(x, { e: c, cell: q.value, cursor: ce.value });
|
|
1647
|
+
}, _ = async (c) => {
|
|
1648
|
+
var w, S;
|
|
1649
|
+
document.removeEventListener(c.type === "touchend" ? "touchmove" : "mousemove", a, { passive: !1 }), u.dragging && ((S = (w = he.value).dragEnd) == null || S.call(w, { e: c, cell: q.value, cursor: ce.value }), C.isDraggingCell = !1, p.editableEvents.create && (e.value = !0, await y(c), e.value = !1)), u.holdTimer = clearTimeout(u.holdTimer), u.holding = !1, u.dragging = !1, u.startX = 0, u.startY = 0, u.moveX = 0, u.moveY = 0, u.startPercentageX = 0, u.startPercentageY = 0, u.movePercentageX = 0, u.movePercentageY = 0, u.thresholdPassed = !1, u.schedule = null;
|
|
1650
|
+
}, y = async (c) => {
|
|
1651
|
+
if (!E.value) return;
|
|
1652
|
+
let { start: w, end: S, startMinutes: M, endMinutes: N } = h.value;
|
|
1653
|
+
w = new Date(s.start), w.setMinutes(M), S = new Date(s.start), S.setMinutes(N);
|
|
1654
|
+
let I = { ...h.value, start: w, end: S };
|
|
1655
|
+
const { create: x } = p.eventListeners.event;
|
|
1656
|
+
if (typeof x == "function") {
|
|
1657
|
+
const de = I;
|
|
1658
|
+
I = await new Promise((ye) => x({ e: c, event: I, cell: q.value, resolve: ye, cursor: ce.value })), I && typeof I == "object" && g.createEvent(I), I && typeof I == "boolean" && g.createEvent(de);
|
|
1659
|
+
} else g.createEvent(I);
|
|
1660
|
+
}, B = () => {
|
|
1661
|
+
Object.keys(he.value).forEach((c) => {
|
|
1662
|
+
var w;
|
|
1663
|
+
(w = m.value) == null || w.removeEventListener(c, he.value[c]);
|
|
1653
1664
|
});
|
|
1654
|
-
},
|
|
1655
|
-
|
|
1665
|
+
}, Q = () => {
|
|
1666
|
+
d.value = L.getCellOverlappingEvents(A.value);
|
|
1656
1667
|
};
|
|
1657
1668
|
return me(
|
|
1658
1669
|
// Watch event IDs and start/end dates (only) to detect event resizing/dnd.
|
|
1659
|
-
() => k.value.map((
|
|
1670
|
+
() => k.value.map((c) => `${c._.id}${c.start.getTime()}${c.end.getTime()}`).join(),
|
|
1660
1671
|
async () => {
|
|
1661
|
-
await Ue(),
|
|
1672
|
+
await Ue(), Q();
|
|
1662
1673
|
},
|
|
1663
1674
|
{ immediate: !0, flush: "post" }
|
|
1664
1675
|
// Use flush: 'post' to prevent infinite updates.
|
|
1665
1676
|
), Xe(async () => {
|
|
1666
|
-
|
|
1667
|
-
}), (
|
|
1668
|
-
class: ["vuecal__cell",
|
|
1677
|
+
$.value.forEach((c) => L.deleteEvent(c, 3)), B(), await Ue();
|
|
1678
|
+
}), (c, w) => (Y(), j("div", De({
|
|
1679
|
+
class: ["vuecal__cell", P.value],
|
|
1669
1680
|
ref_key: "cellEl",
|
|
1670
|
-
ref:
|
|
1671
|
-
}, Ie(
|
|
1672
|
-
|
|
1681
|
+
ref: m
|
|
1682
|
+
}, Ie(he.value, !0)), [
|
|
1683
|
+
c.$slots.cell ? F(c.$slots, "cell", {
|
|
1673
1684
|
key: 0,
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
}) : U("", !0),
|
|
1679
|
-
I.value ? (E(!0), j(te, { key: 1 }, pe(I.value, (S, M) => (E(), j("div", {
|
|
1680
|
-
class: ke(["vuecal__special-hours", S.class]),
|
|
1685
|
+
cell: q.value
|
|
1686
|
+
}) : Z("", !0),
|
|
1687
|
+
U.value ? (Y(!0), j(te, { key: 1 }, we(U.value, (S, M) => (Y(), j("div", {
|
|
1688
|
+
class: _e(["vuecal__special-hours", S.class]),
|
|
1681
1689
|
style: Te(S.style),
|
|
1682
1690
|
innerHTML: S.label || ""
|
|
1683
|
-
}, null, 14,
|
|
1684
|
-
!
|
|
1685
|
-
class:
|
|
1691
|
+
}, null, 14, At))), 256)) : Z("", !0),
|
|
1692
|
+
!c.$slots.cell && O(p).schedules ? (Y(!0), j(te, { key: 2 }, we(O(p).schedules, (S) => (Y(), j("div", {
|
|
1693
|
+
class: _e(["vuecal__schedule vuecal__schedule--cell", S.class]),
|
|
1686
1694
|
key: S.id,
|
|
1687
1695
|
style: Te(S.style || null),
|
|
1688
1696
|
"data-schedule": S.id
|
|
1689
1697
|
}, [
|
|
1690
|
-
|
|
1698
|
+
c.$slots["cell-events"] ? F(c.$slots, "cell-events", {
|
|
1691
1699
|
key: 0,
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
F(r.$slots, "cell-date", {
|
|
1698
|
-
start: c.start,
|
|
1699
|
-
end: c.end,
|
|
1700
|
-
events: n.value
|
|
1701
|
-
}, () => [
|
|
1702
|
-
xe(le(l.value), 1)
|
|
1700
|
+
cell: q.value
|
|
1701
|
+
}) : Z("", !0),
|
|
1702
|
+
n.value || c.$slots["cell-date"] ? (Y(), j("div", Rt, [
|
|
1703
|
+
F(c.$slots, "cell-date", { cell: q.value }, () => [
|
|
1704
|
+
xe(le(n.value), 1)
|
|
1703
1705
|
])
|
|
1704
|
-
])) :
|
|
1705
|
-
|
|
1706
|
-
F(
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
])) : U("", !0),
|
|
1712
|
-
r.$slots["cell-events"] && n.value.length ? (E(), j("div", Xt, [
|
|
1713
|
-
F(r.$slots, "cell-events", {
|
|
1714
|
-
start: c.start,
|
|
1715
|
-
end: c.end,
|
|
1716
|
-
events: n.value
|
|
1717
|
-
})
|
|
1718
|
-
])) : n.value.length || N.value ? (E(), Se(et, {
|
|
1706
|
+
])) : Z("", !0),
|
|
1707
|
+
c.$slots["cell-content"] ? (Y(), j("div", Xt, [
|
|
1708
|
+
F(c.$slots, "cell-content", { cell: q.value })
|
|
1709
|
+
])) : Z("", !0),
|
|
1710
|
+
c.$slots["cell-events"] && l.value.length ? (Y(), j("div", Gt, [
|
|
1711
|
+
F(c.$slots, "cell-events", { cell: q.value })
|
|
1712
|
+
])) : l.value.length || W.value ? (Y(), Se(et, {
|
|
1719
1713
|
key: 4,
|
|
1720
1714
|
class: "vuecal__cell-events",
|
|
1721
1715
|
name: "vuecal-event-delete",
|
|
1722
|
-
onBeforeLeave:
|
|
1723
|
-
onAfterLeave:
|
|
1716
|
+
onBeforeLeave: w[0] || (w[0] = (M) => W.value = !0),
|
|
1717
|
+
onAfterLeave: i,
|
|
1724
1718
|
tag: "div"
|
|
1725
1719
|
}, {
|
|
1726
|
-
default:
|
|
1727
|
-
(
|
|
1720
|
+
default: J(() => [
|
|
1721
|
+
(Y(!0), j(te, null, we(t.value[S.id], (M) => (Y(), Se(at, {
|
|
1728
1722
|
key: M._.id,
|
|
1729
1723
|
event: M,
|
|
1730
1724
|
onEventDeleted: G,
|
|
1731
|
-
style: Te(
|
|
1725
|
+
style: Te(V.value[M._.id])
|
|
1732
1726
|
}, je({ _: 2 }, [
|
|
1733
|
-
|
|
1727
|
+
c.$slots.event ? {
|
|
1734
1728
|
name: "event",
|
|
1735
|
-
fn:
|
|
1736
|
-
F(
|
|
1729
|
+
fn: J((N) => [
|
|
1730
|
+
F(c.$slots, "event", De({ ref_for: !0 }, N))
|
|
1737
1731
|
]),
|
|
1738
1732
|
key: "0"
|
|
1739
1733
|
} : void 0
|
|
1740
1734
|
]), 1032, ["event", "style"]))), 128))
|
|
1741
1735
|
]),
|
|
1742
1736
|
_: 2
|
|
1743
|
-
}, 1024)) :
|
|
1744
|
-
|
|
1737
|
+
}, 1024)) : Z("", !0),
|
|
1738
|
+
E.value && u.schedule === S.id ? (Y(), j("div", {
|
|
1745
1739
|
key: 5,
|
|
1746
1740
|
class: "vuecal__event-placeholder",
|
|
1747
|
-
style: Te(
|
|
1748
|
-
}, le(
|
|
1749
|
-
], 14,
|
|
1750
|
-
!
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
xe(le(l.value), 1)
|
|
1741
|
+
style: Te(h.value.style)
|
|
1742
|
+
}, le(h.value.start) + " - " + le(h.value.end), 5)) : Z("", !0)
|
|
1743
|
+
], 14, It))), 128)) : Z("", !0),
|
|
1744
|
+
!c.$slots.cell && !O(p).schedules ? (Y(), j(te, { key: 3 }, [
|
|
1745
|
+
c.$slots["cell-events"] ? F(c.$slots, "cell-events", {
|
|
1746
|
+
key: 0,
|
|
1747
|
+
cell: q.value
|
|
1748
|
+
}) : Z("", !0),
|
|
1749
|
+
n.value || c.$slots["cell-date"] ? (Y(), j("div", qt, [
|
|
1750
|
+
F(c.$slots, "cell-date", { cell: q.value }, () => [
|
|
1751
|
+
xe(le(n.value), 1)
|
|
1759
1752
|
])
|
|
1760
|
-
])) :
|
|
1761
|
-
|
|
1762
|
-
F(
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
])) : U("", !0),
|
|
1768
|
-
r.$slots["cell-events"] && n.value.length ? (E(), j("div", Ut, [
|
|
1769
|
-
F(r.$slots, "cell-events", {
|
|
1770
|
-
start: c.start,
|
|
1771
|
-
end: c.end,
|
|
1772
|
-
events: n.value
|
|
1773
|
-
})
|
|
1774
|
-
])) : (n.value.length || N.value) && !(C(D).isMonth && !C(w).eventsOnMonthView) ? (E(), Se(et, {
|
|
1753
|
+
])) : Z("", !0),
|
|
1754
|
+
c.$slots["cell-content"] ? (Y(), j("div", Ut, [
|
|
1755
|
+
F(c.$slots, "cell-content", { cell: q.value })
|
|
1756
|
+
])) : Z("", !0),
|
|
1757
|
+
c.$slots["cell-events"] && l.value.length ? (Y(), j("div", Zt, [
|
|
1758
|
+
F(c.$slots, "cell-events", { cell: q.value })
|
|
1759
|
+
])) : (l.value.length || W.value) && !(O(g).isMonth && !O(p).eventsOnMonthView) ? (Y(), Se(et, {
|
|
1775
1760
|
key: 4,
|
|
1776
1761
|
class: "vuecal__cell-events",
|
|
1777
1762
|
name: "vuecal-event-delete",
|
|
1778
|
-
onBeforeLeave:
|
|
1779
|
-
onAfterLeave:
|
|
1763
|
+
onBeforeLeave: w[1] || (w[1] = (S) => W.value = !0),
|
|
1764
|
+
onAfterLeave: i,
|
|
1780
1765
|
tag: "div"
|
|
1781
1766
|
}, {
|
|
1782
|
-
default:
|
|
1783
|
-
(
|
|
1767
|
+
default: J(() => [
|
|
1768
|
+
(Y(!0), j(te, null, we(l.value, (S) => (Y(), Se(at, {
|
|
1784
1769
|
key: S._.id,
|
|
1785
1770
|
event: S,
|
|
1786
1771
|
onEventDeleted: G,
|
|
1787
|
-
style: Te(
|
|
1772
|
+
style: Te(V.value[S._.id])
|
|
1788
1773
|
}, je({ _: 2 }, [
|
|
1789
|
-
|
|
1774
|
+
c.$slots.event ? {
|
|
1790
1775
|
name: "event",
|
|
1791
|
-
fn:
|
|
1792
|
-
F(
|
|
1776
|
+
fn: J((M) => [
|
|
1777
|
+
F(c.$slots, "event", De({ ref_for: !0 }, M))
|
|
1793
1778
|
]),
|
|
1794
1779
|
key: "0"
|
|
1795
1780
|
} : void 0
|
|
1796
1781
|
]), 1032, ["event", "style"]))), 128))
|
|
1797
1782
|
]),
|
|
1798
1783
|
_: 3
|
|
1799
|
-
})) :
|
|
1800
|
-
|
|
1784
|
+
})) : Z("", !0),
|
|
1785
|
+
E.value ? (Y(), j("div", {
|
|
1801
1786
|
key: 5,
|
|
1802
1787
|
class: "vuecal__event-placeholder",
|
|
1803
|
-
style: Te(
|
|
1804
|
-
}, le(
|
|
1805
|
-
], 64)) :
|
|
1806
|
-
|
|
1788
|
+
style: Te(h.value.style)
|
|
1789
|
+
}, le(h.value.start) + " - " + le(h.value.end), 5)) : Z("", !0)
|
|
1790
|
+
], 64)) : Z("", !0),
|
|
1791
|
+
c.$slots["event-count"] ? F(c.$slots, "event-count", {
|
|
1807
1792
|
key: 4,
|
|
1808
1793
|
events: k.value
|
|
1809
|
-
}) :
|
|
1810
|
-
re.show ? (
|
|
1794
|
+
}) : H.value ? (Y(), j("div", Jt, le(k.value.length), 1)) : Z("", !0),
|
|
1795
|
+
re.show ? (Y(), j("div", {
|
|
1811
1796
|
key: 6,
|
|
1812
1797
|
class: "vuecal__now-line",
|
|
1813
1798
|
style: Te(re.style),
|
|
1814
1799
|
title: re.currentTime
|
|
1815
1800
|
}, [
|
|
1816
1801
|
ge("span", null, le(re.currentTime), 1)
|
|
1817
|
-
], 12,
|
|
1802
|
+
], 12, Kt)) : Z("", !0)
|
|
1818
1803
|
], 16));
|
|
1819
1804
|
}
|
|
1820
|
-
},
|
|
1805
|
+
}, xt = {
|
|
1821
1806
|
__name: "body",
|
|
1822
|
-
setup(
|
|
1823
|
-
const s = Ne("vuecal")
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
})), V = T(() => {
|
|
1829
|
-
const b = w.formatTime(Pe(z.value, D));
|
|
1807
|
+
setup(D) {
|
|
1808
|
+
const s = Ne("vuecal"), { view: r, config: g, dateUtils: p } = s, b = ie(null), L = ie(null), v = T(() => ({
|
|
1809
|
+
"--vuecal-grid-columns": r.cols,
|
|
1810
|
+
"--vuecal-grid-rows": r.rows
|
|
1811
|
+
})), C = T(() => {
|
|
1812
|
+
const $ = p.formatTime(Pe(L.value, g));
|
|
1830
1813
|
return {
|
|
1831
|
-
style: { top:
|
|
1832
|
-
time:
|
|
1814
|
+
style: { top: `${L.value}%` },
|
|
1815
|
+
time: $
|
|
1833
1816
|
};
|
|
1834
|
-
}), o = (
|
|
1835
|
-
var
|
|
1836
|
-
if (
|
|
1837
|
-
const
|
|
1838
|
-
|
|
1839
|
-
},
|
|
1840
|
-
|
|
1817
|
+
}), o = ($) => {
|
|
1818
|
+
var i;
|
|
1819
|
+
if (r.isMonth || r.isYear || r.isYears) return;
|
|
1820
|
+
const W = (((i = $.touches) == null ? void 0 : i[0]) || $).clientY, { top: G } = b.value.getBoundingClientRect();
|
|
1821
|
+
L.value = Je(W - G, b.value);
|
|
1822
|
+
}, m = () => {
|
|
1823
|
+
L.value = null;
|
|
1841
1824
|
};
|
|
1842
1825
|
return Ze(() => {
|
|
1843
|
-
|
|
1826
|
+
b.value.addEventListener("mousemove", o), b.value.addEventListener("touchmove", o), b.value.addEventListener("mouseleave", m), b.value.addEventListener("touchend", m);
|
|
1844
1827
|
}), Xe(() => {
|
|
1845
|
-
|
|
1846
|
-
}), (
|
|
1828
|
+
b.value && (b.value.removeEventListener("mousemove", o), b.value.removeEventListener("touchmove", o), b.value.removeEventListener("mouseleave", m), b.value.removeEventListener("touchend", m));
|
|
1829
|
+
}), ($, W) => (Y(), j("div", {
|
|
1847
1830
|
class: "vuecal__body",
|
|
1848
1831
|
ref_key: "bodyEl",
|
|
1849
|
-
ref:
|
|
1850
|
-
style: Te(
|
|
1832
|
+
ref: b,
|
|
1833
|
+
style: Te(v.value)
|
|
1851
1834
|
}, [
|
|
1852
1835
|
Oe(Ge, { name: "vuecal-shrink" }, {
|
|
1853
|
-
default:
|
|
1854
|
-
|
|
1836
|
+
default: J(() => [
|
|
1837
|
+
O(g).timeAtCursor && L.value !== null ? (Y(), j("div", {
|
|
1855
1838
|
key: 0,
|
|
1856
1839
|
class: "vuecal__time-at-cursor",
|
|
1857
|
-
style: Te(
|
|
1840
|
+
style: Te(C.value.style)
|
|
1858
1841
|
}, [
|
|
1859
|
-
ge("label", null, le(
|
|
1860
|
-
], 4)) :
|
|
1842
|
+
ge("label", null, le(C.value.time), 1)
|
|
1843
|
+
], 4)) : Z("", !0)
|
|
1861
1844
|
]),
|
|
1862
1845
|
_: 1
|
|
1863
1846
|
}),
|
|
1864
|
-
(
|
|
1865
|
-
key:
|
|
1847
|
+
(Y(!0), j(te, null, we(O(r).cellDates, (G, i) => (Y(), Se(Qt, {
|
|
1848
|
+
key: i,
|
|
1866
1849
|
start: G.start,
|
|
1867
1850
|
end: G.end,
|
|
1868
|
-
index:
|
|
1851
|
+
index: i
|
|
1869
1852
|
}, je({ _: 2 }, [
|
|
1870
|
-
|
|
1853
|
+
$.$slots.cell ? {
|
|
1871
1854
|
name: "cell",
|
|
1872
|
-
fn:
|
|
1873
|
-
F(
|
|
1855
|
+
fn: J((u) => [
|
|
1856
|
+
F($.$slots, "cell", De({ ref_for: !0 }, u))
|
|
1874
1857
|
]),
|
|
1875
1858
|
key: "0"
|
|
1876
1859
|
} : void 0,
|
|
1877
|
-
|
|
1860
|
+
$.$slots["cell-date"] ? {
|
|
1878
1861
|
name: "cell-date",
|
|
1879
|
-
fn:
|
|
1880
|
-
F(
|
|
1862
|
+
fn: J((u) => [
|
|
1863
|
+
F($.$slots, "cell-date", De({ ref_for: !0 }, u))
|
|
1881
1864
|
]),
|
|
1882
1865
|
key: "1"
|
|
1883
1866
|
} : void 0,
|
|
1884
|
-
|
|
1867
|
+
$.$slots["cell-content"] ? {
|
|
1885
1868
|
name: "cell-content",
|
|
1886
|
-
fn:
|
|
1887
|
-
F(
|
|
1869
|
+
fn: J((u) => [
|
|
1870
|
+
F($.$slots, "cell-content", De({ ref_for: !0 }, u))
|
|
1888
1871
|
]),
|
|
1889
1872
|
key: "2"
|
|
1890
1873
|
} : void 0,
|
|
1891
|
-
|
|
1874
|
+
$.$slots["cell-events"] ? {
|
|
1892
1875
|
name: "cell-events",
|
|
1893
|
-
fn:
|
|
1894
|
-
F(
|
|
1876
|
+
fn: J((u) => [
|
|
1877
|
+
F($.$slots, "cell-events", De({ ref_for: !0 }, u))
|
|
1895
1878
|
]),
|
|
1896
1879
|
key: "3"
|
|
1897
|
-
} :
|
|
1880
|
+
} : $.$slots.event ? {
|
|
1898
1881
|
name: "event",
|
|
1899
|
-
fn:
|
|
1900
|
-
F(
|
|
1882
|
+
fn: J((u) => [
|
|
1883
|
+
F($.$slots, "event", De({ ref_for: !0 }, u))
|
|
1901
1884
|
]),
|
|
1902
1885
|
key: "4"
|
|
1903
|
-
} :
|
|
1886
|
+
} : $.$slots["event-count"] ? {
|
|
1904
1887
|
name: "event-count",
|
|
1905
|
-
fn:
|
|
1906
|
-
F(
|
|
1888
|
+
fn: J((u) => [
|
|
1889
|
+
F($.$slots, "event-count", De({ ref_for: !0 }, u))
|
|
1907
1890
|
]),
|
|
1908
1891
|
key: "5"
|
|
1909
1892
|
} : void 0
|
|
1910
1893
|
]), 1032, ["start", "end", "index"]))), 128))
|
|
1911
1894
|
], 4));
|
|
1912
1895
|
}
|
|
1913
|
-
},
|
|
1896
|
+
}, ea = ["data-locale"], ta = { class: "vuecal__scrollable-wrap" }, aa = {
|
|
1914
1897
|
key: 1,
|
|
1915
1898
|
class: "vuecal__week-numbers"
|
|
1916
|
-
},
|
|
1899
|
+
}, sa = { class: "vuecal__week-number" }, na = { class: "vuecal__body-wrap" }, oa = {
|
|
1917
1900
|
__name: "index",
|
|
1918
|
-
props:
|
|
1901
|
+
props: pt,
|
|
1919
1902
|
emits: [
|
|
1920
1903
|
"ready",
|
|
1921
1904
|
"view-change",
|
|
@@ -1927,176 +1910,174 @@ const st = (c) => {
|
|
|
1927
1910
|
"event-created",
|
|
1928
1911
|
"event-dropped"
|
|
1929
1912
|
],
|
|
1930
|
-
setup(
|
|
1931
|
-
const
|
|
1913
|
+
setup(D, { expose: s, emit: r }) {
|
|
1914
|
+
const g = D, p = r, b = ot("vuecal-el"), L = yt({ props: g, emit: p, attrs: ut(), vuecalEl: b, uid: it() }), { config: v, view: C, dateUtils: o, touch: m } = L, $ = T(() => v.time && (C.isDay || C.isDays || C.isWeek)), W = T(() => Array(C.rows).fill().map((e, d) => o.getWeek(o.addDays(C.firstCellDate, 7 * d)))), G = T(() => {
|
|
1932
1915
|
var e;
|
|
1933
1916
|
return {
|
|
1934
|
-
"vuecal--ready":
|
|
1935
|
-
[`vuecal--${
|
|
1936
|
-
[`vuecal--${
|
|
1937
|
-
"vuecal--date-picker":
|
|
1938
|
-
"vuecal--dark":
|
|
1939
|
-
"vuecal--light": !
|
|
1940
|
-
[`vuecal--${
|
|
1941
|
-
"vuecal--view-has-time":
|
|
1942
|
-
"vuecal--timeless": !
|
|
1943
|
-
"vuecal--dragging-cell":
|
|
1944
|
-
"vuecal--dragging-event":
|
|
1945
|
-
"vuecal--resizing-event":
|
|
1946
|
-
"vuecal--has-schedules": (e =
|
|
1917
|
+
"vuecal--ready": v.ready,
|
|
1918
|
+
[`vuecal--${v.theme}-theme`]: v.theme,
|
|
1919
|
+
[`vuecal--${v.size}`]: !0,
|
|
1920
|
+
"vuecal--date-picker": v.datePicker,
|
|
1921
|
+
"vuecal--dark": v.dark,
|
|
1922
|
+
"vuecal--light": !v.dark,
|
|
1923
|
+
[`vuecal--${C.id}-view`]: !0,
|
|
1924
|
+
"vuecal--view-has-time": $.value,
|
|
1925
|
+
"vuecal--timeless": !v.time,
|
|
1926
|
+
"vuecal--dragging-cell": m.isDraggingCell,
|
|
1927
|
+
"vuecal--dragging-event": m.isDraggingEvent,
|
|
1928
|
+
"vuecal--resizing-event": m.isResizingEvent,
|
|
1929
|
+
"vuecal--has-schedules": (e = v.schedules) == null ? void 0 : e.length
|
|
1947
1930
|
};
|
|
1948
|
-
}),
|
|
1949
|
-
"--vuecal-time-cell-height":
|
|
1950
|
-
})),
|
|
1951
|
-
var e,
|
|
1931
|
+
}), i = T(() => ({
|
|
1932
|
+
"--vuecal-time-cell-height": v.timeCellHeight && `${v.timeCellHeight}px`
|
|
1933
|
+
})), u = T(() => {
|
|
1934
|
+
var e, d;
|
|
1952
1935
|
return {
|
|
1953
|
-
"vuecal__scrollable--row":
|
|
1936
|
+
"vuecal__scrollable--row": $.value || v.weekNumbers && C.isMonth,
|
|
1954
1937
|
// Keep the states inside the Vue transition wrapper for smooth CSS transitions.
|
|
1955
|
-
[`vuecal__scrollable--${
|
|
1956
|
-
"vuecal__scrollable--has-schedules": (e =
|
|
1957
|
-
"vuecal__scrollable--no-schedules": !((
|
|
1938
|
+
[`vuecal__scrollable--${C.id}-view`]: !0,
|
|
1939
|
+
"vuecal__scrollable--has-schedules": (e = v.schedules) == null ? void 0 : e.length,
|
|
1940
|
+
"vuecal__scrollable--no-schedules": !((d = v.schedules) != null && d.length)
|
|
1958
1941
|
};
|
|
1959
1942
|
});
|
|
1960
1943
|
return Ze(async () => {
|
|
1961
|
-
await Ue(),
|
|
1962
|
-
}),
|
|
1963
|
-
class:
|
|
1944
|
+
await Ue(), v.ready = !0, p("ready", { config: v, view: C });
|
|
1945
|
+
}), ct("vuecal", L), s({ view: L.view }), (e, d) => (Y(), j("div", {
|
|
1946
|
+
class: _e(["vuecal", G.value]),
|
|
1964
1947
|
ref: "vuecal-el",
|
|
1965
1948
|
"data-locale": e.locale,
|
|
1966
|
-
style: Te(
|
|
1949
|
+
style: Te(i.value)
|
|
1967
1950
|
}, [
|
|
1968
1951
|
e.$slots.diy ? F(e.$slots, "diy", {
|
|
1969
1952
|
key: 0,
|
|
1970
|
-
vuecal:
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
}) : (E(), j(te, { key: 1 }, [
|
|
1974
|
-
Oe($t, null, je({ _: 2 }, [
|
|
1953
|
+
vuecal: O(L)
|
|
1954
|
+
}) : (Y(), j(te, { key: 1 }, [
|
|
1955
|
+
Oe(Mt, null, je({ _: 2 }, [
|
|
1975
1956
|
e.$slots.header ? {
|
|
1976
1957
|
name: "header",
|
|
1977
|
-
fn:
|
|
1978
|
-
F(e.$slots, "header", se(ne(
|
|
1958
|
+
fn: J((h) => [
|
|
1959
|
+
F(e.$slots, "header", se(ne(h)))
|
|
1979
1960
|
]),
|
|
1980
1961
|
key: "0"
|
|
1981
1962
|
} : void 0,
|
|
1982
1963
|
!e.$slots.header && e.$slots["previous-button"] ? {
|
|
1983
1964
|
name: "previous-button",
|
|
1984
|
-
fn:
|
|
1985
|
-
F(e.$slots, "previous-button", se(ne(
|
|
1965
|
+
fn: J((h) => [
|
|
1966
|
+
F(e.$slots, "previous-button", se(ne(h)))
|
|
1986
1967
|
]),
|
|
1987
1968
|
key: "1"
|
|
1988
1969
|
} : void 0,
|
|
1989
1970
|
!e.$slots.header && e.$slots["next-button"] ? {
|
|
1990
1971
|
name: "next-button",
|
|
1991
|
-
fn:
|
|
1992
|
-
F(e.$slots, "next-button", se(ne(
|
|
1972
|
+
fn: J((h) => [
|
|
1973
|
+
F(e.$slots, "next-button", se(ne(h)))
|
|
1993
1974
|
]),
|
|
1994
1975
|
key: "2"
|
|
1995
1976
|
} : void 0,
|
|
1996
1977
|
!e.$slots.header && e.$slots["today-button"] ? {
|
|
1997
1978
|
name: "today-button",
|
|
1998
|
-
fn:
|
|
1999
|
-
F(e.$slots, "today-button", se(ne(
|
|
1979
|
+
fn: J((h) => [
|
|
1980
|
+
F(e.$slots, "today-button", se(ne(h)))
|
|
2000
1981
|
]),
|
|
2001
1982
|
key: "3"
|
|
2002
1983
|
} : void 0,
|
|
2003
1984
|
!e.$slots.header && e.$slots.title ? {
|
|
2004
1985
|
name: "title",
|
|
2005
|
-
fn:
|
|
2006
|
-
F(e.$slots, "title", se(ne(
|
|
1986
|
+
fn: J((h) => [
|
|
1987
|
+
F(e.$slots, "title", se(ne(h)))
|
|
2007
1988
|
]),
|
|
2008
1989
|
key: "4"
|
|
2009
1990
|
} : void 0,
|
|
2010
1991
|
!e.$slots.header && e.$slots["schedule-heading"] ? {
|
|
2011
1992
|
name: "schedule-heading",
|
|
2012
|
-
fn:
|
|
2013
|
-
F(e.$slots, "schedule-heading", se(ne(
|
|
1993
|
+
fn: J((h) => [
|
|
1994
|
+
F(e.$slots, "schedule-heading", se(ne(h)))
|
|
2014
1995
|
]),
|
|
2015
1996
|
key: "5"
|
|
2016
1997
|
} : void 0
|
|
2017
1998
|
]), 1024),
|
|
2018
|
-
ge("div",
|
|
1999
|
+
ge("div", ta, [
|
|
2019
2000
|
Oe(Ge, {
|
|
2020
|
-
name: `vuecal-slide-fade--${C
|
|
2001
|
+
name: `vuecal-slide-fade--${O(C).transitionDirection}`
|
|
2021
2002
|
}, {
|
|
2022
|
-
default:
|
|
2023
|
-
(
|
|
2024
|
-
class:
|
|
2025
|
-
key: C
|
|
2003
|
+
default: J(() => [
|
|
2004
|
+
(Y(), j("div", {
|
|
2005
|
+
class: _e(["vuecal__scrollable", u.value]),
|
|
2006
|
+
key: O(C).id + O(C).start.getTime()
|
|
2026
2007
|
}, [
|
|
2027
|
-
|
|
2008
|
+
$.value ? (Y(), Se(Lt, { key: 0 }, je({ _: 2 }, [
|
|
2028
2009
|
e.$slots["time-cell"] ? {
|
|
2029
2010
|
name: "time-cell",
|
|
2030
|
-
fn:
|
|
2031
|
-
F(e.$slots, "time-cell", se(ne(
|
|
2011
|
+
fn: J((h) => [
|
|
2012
|
+
F(e.$slots, "time-cell", se(ne(h)))
|
|
2032
2013
|
]),
|
|
2033
2014
|
key: "0"
|
|
2034
2015
|
} : void 0
|
|
2035
|
-
]), 1024)) :
|
|
2036
|
-
|
|
2037
|
-
(
|
|
2016
|
+
]), 1024)) : Z("", !0),
|
|
2017
|
+
O(v).weekNumbers && O(C).isMonth ? (Y(), j("div", aa, [
|
|
2018
|
+
(Y(!0), j(te, null, we(W.value, (h) => (Y(), j("div", sa, [
|
|
2038
2019
|
F(e.$slots, "week-number", {}, () => [
|
|
2039
|
-
ge("small", null, le(
|
|
2020
|
+
ge("small", null, le(h), 1)
|
|
2040
2021
|
])
|
|
2041
2022
|
]))), 256))
|
|
2042
|
-
])) :
|
|
2043
|
-
ge("div",
|
|
2044
|
-
Oe(
|
|
2023
|
+
])) : Z("", !0),
|
|
2024
|
+
ge("div", na, [
|
|
2025
|
+
Oe(Pt, null, je({ _: 2 }, [
|
|
2045
2026
|
e.$slots["weekday-heading"] ? {
|
|
2046
2027
|
name: "weekday-heading",
|
|
2047
|
-
fn:
|
|
2048
|
-
F(e.$slots, "weekday-heading", se(ne(
|
|
2028
|
+
fn: J((h) => [
|
|
2029
|
+
F(e.$slots, "weekday-heading", se(ne(h)))
|
|
2049
2030
|
]),
|
|
2050
2031
|
key: "0"
|
|
2051
2032
|
} : void 0,
|
|
2052
2033
|
e.$slots["schedule-heading"] ? {
|
|
2053
2034
|
name: "schedule-heading",
|
|
2054
|
-
fn:
|
|
2055
|
-
F(e.$slots, "schedule-heading", se(ne(
|
|
2035
|
+
fn: J((h) => [
|
|
2036
|
+
F(e.$slots, "schedule-heading", se(ne(h)))
|
|
2056
2037
|
]),
|
|
2057
2038
|
key: "1"
|
|
2058
2039
|
} : void 0
|
|
2059
2040
|
]), 1024),
|
|
2060
|
-
Oe(
|
|
2041
|
+
Oe(xt, null, je({ _: 2 }, [
|
|
2061
2042
|
e.$slots.cell ? {
|
|
2062
2043
|
name: "cell",
|
|
2063
|
-
fn:
|
|
2064
|
-
F(e.$slots, "cell", se(ne(
|
|
2044
|
+
fn: J((h) => [
|
|
2045
|
+
F(e.$slots, "cell", se(ne(h)))
|
|
2065
2046
|
]),
|
|
2066
2047
|
key: "0"
|
|
2067
2048
|
} : void 0,
|
|
2068
2049
|
!e.$slots.cell && e.$slots["cell-date"] ? {
|
|
2069
2050
|
name: "cell-date",
|
|
2070
|
-
fn:
|
|
2071
|
-
F(e.$slots, "cell-date", se(ne(
|
|
2051
|
+
fn: J((h) => [
|
|
2052
|
+
F(e.$slots, "cell-date", se(ne(h)))
|
|
2072
2053
|
]),
|
|
2073
2054
|
key: "1"
|
|
2074
2055
|
} : void 0,
|
|
2075
2056
|
!e.$slots.cell && e.$slots["cell-content"] ? {
|
|
2076
2057
|
name: "cell-content",
|
|
2077
|
-
fn:
|
|
2078
|
-
F(e.$slots, "cell-content", se(ne(
|
|
2058
|
+
fn: J((h) => [
|
|
2059
|
+
F(e.$slots, "cell-content", se(ne(h)))
|
|
2079
2060
|
]),
|
|
2080
2061
|
key: "2"
|
|
2081
2062
|
} : void 0,
|
|
2082
2063
|
!e.$slots.cell && e.$slots["cell-events"] ? {
|
|
2083
2064
|
name: "cell-events",
|
|
2084
|
-
fn:
|
|
2085
|
-
F(e.$slots, "cell-events", se(ne(
|
|
2065
|
+
fn: J((h) => [
|
|
2066
|
+
F(e.$slots, "cell-events", se(ne(h)))
|
|
2086
2067
|
]),
|
|
2087
2068
|
key: "3"
|
|
2088
2069
|
} : void 0,
|
|
2089
2070
|
!e.$slots.cell && e.$slots.event ? {
|
|
2090
2071
|
name: "event",
|
|
2091
|
-
fn:
|
|
2092
|
-
F(e.$slots, "event", se(ne(
|
|
2072
|
+
fn: J((h) => [
|
|
2073
|
+
F(e.$slots, "event", se(ne(h)))
|
|
2093
2074
|
]),
|
|
2094
2075
|
key: "4"
|
|
2095
2076
|
} : void 0,
|
|
2096
2077
|
!e.$slots.cell && e.$slots["event-count"] ? {
|
|
2097
2078
|
name: "event-count",
|
|
2098
|
-
fn:
|
|
2099
|
-
F(e.$slots, "event-count", se(ne(
|
|
2079
|
+
fn: J((h) => [
|
|
2080
|
+
F(e.$slots, "event-count", se(ne(h)))
|
|
2100
2081
|
]),
|
|
2101
2082
|
key: "5"
|
|
2102
2083
|
} : void 0
|
|
@@ -2108,63 +2089,63 @@ const st = (c) => {
|
|
|
2108
2089
|
}, 8, ["name"])
|
|
2109
2090
|
])
|
|
2110
2091
|
], 64))
|
|
2111
|
-
], 14,
|
|
2092
|
+
], 14, ea));
|
|
2112
2093
|
}
|
|
2113
|
-
},
|
|
2114
|
-
Fe.texts = { ...fe.texts, ...
|
|
2094
|
+
}, ia = (D) => {
|
|
2095
|
+
Fe.texts = { ...fe.texts, ...D }, Fe.dateUtils.updateTexts(Fe.texts);
|
|
2115
2096
|
}, {
|
|
2116
|
-
addDatePrototypes:
|
|
2117
|
-
removeDatePrototypes:
|
|
2118
|
-
updateTexts:
|
|
2119
|
-
addDays:
|
|
2120
|
-
subtractDays:
|
|
2121
|
-
addHours:
|
|
2122
|
-
subtractHours:
|
|
2123
|
-
addMinutes:
|
|
2124
|
-
subtractMinutes:
|
|
2125
|
-
getWeek:
|
|
2126
|
-
isToday:
|
|
2127
|
-
isSameDate:
|
|
2128
|
-
isInRange:
|
|
2129
|
-
isLeapYear:
|
|
2130
|
-
getPreviousFirstDayOfWeek:
|
|
2131
|
-
stringToDate:
|
|
2132
|
-
dateToMinutes:
|
|
2133
|
-
countDays:
|
|
2134
|
-
datesInSameTimeStep:
|
|
2135
|
-
isValid:
|
|
2136
|
-
formatDate:
|
|
2137
|
-
formatDateLite:
|
|
2138
|
-
formatTime:
|
|
2139
|
-
formatTimeLite:
|
|
2140
|
-
formatMinutes:
|
|
2097
|
+
addDatePrototypes: ua,
|
|
2098
|
+
removeDatePrototypes: ca,
|
|
2099
|
+
updateTexts: da,
|
|
2100
|
+
addDays: va,
|
|
2101
|
+
subtractDays: ma,
|
|
2102
|
+
addHours: fa,
|
|
2103
|
+
subtractHours: ga,
|
|
2104
|
+
addMinutes: ha,
|
|
2105
|
+
subtractMinutes: ya,
|
|
2106
|
+
getWeek: Da,
|
|
2107
|
+
isToday: pa,
|
|
2108
|
+
isSameDate: wa,
|
|
2109
|
+
isInRange: _a,
|
|
2110
|
+
isLeapYear: ka,
|
|
2111
|
+
getPreviousFirstDayOfWeek: ba,
|
|
2112
|
+
stringToDate: Ta,
|
|
2113
|
+
dateToMinutes: $a,
|
|
2114
|
+
countDays: Ma,
|
|
2115
|
+
datesInSameTimeStep: Ea,
|
|
2116
|
+
isValid: Ya,
|
|
2117
|
+
formatDate: Sa,
|
|
2118
|
+
formatDateLite: Ca,
|
|
2119
|
+
formatTime: Va,
|
|
2120
|
+
formatTimeLite: Oa,
|
|
2121
|
+
formatMinutes: ja
|
|
2141
2122
|
} = Fe.dateUtils;
|
|
2142
2123
|
export {
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2124
|
+
oa as VueCal,
|
|
2125
|
+
ua as addDatePrototypes,
|
|
2126
|
+
va as addDays,
|
|
2127
|
+
fa as addHours,
|
|
2128
|
+
ha as addMinutes,
|
|
2129
|
+
Ma as countDays,
|
|
2130
|
+
$a as dateToMinutes,
|
|
2131
|
+
Ea as datesInSameTimeStep,
|
|
2132
|
+
Sa as formatDate,
|
|
2133
|
+
Ca as formatDateLite,
|
|
2134
|
+
ja as formatMinutes,
|
|
2135
|
+
Va as formatTime,
|
|
2136
|
+
Oa as formatTimeLite,
|
|
2137
|
+
ba as getPreviousFirstDayOfWeek,
|
|
2138
|
+
Da as getWeek,
|
|
2139
|
+
_a as isInRange,
|
|
2140
|
+
ka as isLeapYear,
|
|
2141
|
+
wa as isSameDate,
|
|
2142
|
+
pa as isToday,
|
|
2143
|
+
Ya as isValidDate,
|
|
2144
|
+
ca as removeDatePrototypes,
|
|
2145
|
+
Ta as stringToDate,
|
|
2146
|
+
ma as subtractDays,
|
|
2147
|
+
ga as subtractHours,
|
|
2148
|
+
ya as subtractMinutes,
|
|
2149
|
+
da as updateTexts,
|
|
2150
|
+
ia as useLocale
|
|
2170
2151
|
};
|