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