vue-cal 5.0.1-rc.16 → 5.0.1-rc.18
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/i18n/ar.js +1 -1
- package/dist/i18n/bg.js +1 -1
- package/dist/i18n/bn.js +1 -1
- package/dist/i18n/bs.js +1 -1
- package/dist/i18n/ca.js +1 -1
- package/dist/i18n/cs.js +1 -1
- package/dist/i18n/da.js +1 -1
- package/dist/i18n/de.js +1 -1
- package/dist/i18n/el.js +1 -1
- package/dist/i18n/en-gb.js +1 -1
- package/dist/i18n/es.js +1 -1
- package/dist/i18n/et.js +1 -1
- package/dist/i18n/fa.js +1 -1
- package/dist/i18n/fi.js +1 -1
- package/dist/i18n/fr.js +1 -1
- package/dist/i18n/he.js +1 -1
- package/dist/i18n/hr.js +1 -1
- package/dist/i18n/hu.js +1 -1
- package/dist/i18n/id.js +1 -1
- package/dist/i18n/is.js +1 -1
- package/dist/i18n/it.js +1 -1
- package/dist/i18n/ja.js +1 -1
- package/dist/i18n/ka.js +1 -1
- package/dist/i18n/ko.js +1 -1
- package/dist/i18n/lt.js +1 -1
- package/dist/i18n/mn.js +1 -1
- package/dist/i18n/nl.js +1 -1
- package/dist/i18n/no.js +1 -1
- package/dist/i18n/pl.js +1 -1
- package/dist/i18n/pt-br.js +1 -1
- package/dist/i18n/pt-pt.js +1 -1
- package/dist/i18n/ro.js +1 -1
- package/dist/i18n/ru.js +1 -1
- package/dist/i18n/sk.js +1 -1
- package/dist/i18n/sl.js +1 -1
- package/dist/i18n/sq.js +1 -1
- package/dist/i18n/sr.js +1 -1
- package/dist/i18n/sv.js +1 -1
- package/dist/i18n/tr.js +1 -1
- package/dist/i18n/uk.js +1 -1
- package/dist/i18n/vi.js +1 -1
- package/dist/i18n/zh-cn.js +1 -1
- package/dist/i18n/zh-hk.js +1 -1
- package/dist/vue-cal.es.js +242 -233
- package/dist/vue-cal.umd.js +3 -3
- package/package.json +1 -1
package/dist/vue-cal.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { computed as $, reactive as $e, watch as me, toRefs as wt, ref as ie, onBeforeUnmount as Xe, inject as Ne, createElementBlock as O, openBlock as S, renderSlot as N, createCommentVNode as U, unref as V, Fragment as ne, renderList as
|
|
1
|
+
import { computed as $, reactive as $e, watch as me, toRefs as wt, ref as ie, onBeforeUnmount as Xe, inject as Ne, createElementBlock as O, openBlock as S, renderSlot as N, createCommentVNode as U, unref as V, Fragment as ne, renderList as be, normalizeClass as De, createElementVNode as ge, createVNode as Oe, Transition as Ge, withCtx as q, createBlock as Se, resolveDynamicComponent as Qe, mergeProps as ye, toHandlers as Ie, normalizeProps as se, guardReactiveProps as le, toDisplayString as re, normalizeStyle as ke, onMounted as qe, withModifiers as xe, nextTick as Ue, createTextVNode as et, TransitionGroup as tt, createSlots as je, useTemplateRef as _t, useId as kt, useAttrs as bt, provide as Tt } from "vue";
|
|
2
2
|
/**
|
|
3
|
-
* vue-cal v5.0.1-rc.
|
|
3
|
+
* vue-cal v5.0.1-rc.18
|
|
4
4
|
* (c) 2024-2025 Antoni Andre <antoniandre.web@gmail.com>
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -40,7 +40,7 @@ const fe = {
|
|
|
40
40
|
return W.value[l] ? l : (console.warn(
|
|
41
41
|
`Vue Cal: the provided or default view \`${l}\` is either invalid or not in the list of available views. The first available view will be chosen: \`${Object.keys(W.value)[0]}\`.`
|
|
42
42
|
), Object.keys(W.value)[0]);
|
|
43
|
-
}), H = $(() => n.sm && !n.xs),
|
|
43
|
+
}), H = $(() => n.sm && !n.xs), m = $(() => n.xs || n.datePicker), j = $(() => n.clickToNavigate || n.datePicker && n.clickToNavigate !== !1), i = $(() => {
|
|
44
44
|
const s = {
|
|
45
45
|
cell: {},
|
|
46
46
|
// All possible event listeners to attach to cells.
|
|
@@ -85,7 +85,7 @@ const fe = {
|
|
|
85
85
|
}), e = $(() => {
|
|
86
86
|
let s = null;
|
|
87
87
|
return n.minDate && typeof n.minDate == "string" ? s = h.stringToDate(n.minDate) : n.minDate && n.minDate instanceof Date && (s = n.minDate), (s == null ? void 0 : s.getTime()) || null;
|
|
88
|
-
}),
|
|
88
|
+
}), d = $(() => {
|
|
89
89
|
let s = null;
|
|
90
90
|
return n.maxDate && typeof n.maxDate == "string" ? s = h.stringToDate(n.maxDate) : n.maxDate && n.maxDate instanceof Date && (s = n.maxDate), (s == null ? void 0 : s.getTime()) || null;
|
|
91
91
|
}), g = $(() => {
|
|
@@ -122,12 +122,12 @@ const fe = {
|
|
|
122
122
|
disableDays: c,
|
|
123
123
|
ready: p,
|
|
124
124
|
sm: H,
|
|
125
|
-
xs:
|
|
125
|
+
xs: m,
|
|
126
126
|
clickToNavigate: j,
|
|
127
127
|
hideWeekdays: f,
|
|
128
128
|
hideWeekends: T,
|
|
129
129
|
minTimestamp: e,
|
|
130
|
-
maxTimestamp:
|
|
130
|
+
maxTimestamp: d,
|
|
131
131
|
schedules: g,
|
|
132
132
|
selectedDate: o,
|
|
133
133
|
editableEvents: M,
|
|
@@ -137,7 +137,7 @@ const fe = {
|
|
|
137
137
|
return Object.keys(f.value).length;
|
|
138
138
|
},
|
|
139
139
|
get size() {
|
|
140
|
-
return
|
|
140
|
+
return m.value ? "xs" : H.value ? "sm" : "lg";
|
|
141
141
|
},
|
|
142
142
|
loadTexts: P
|
|
143
143
|
};
|
|
@@ -152,71 +152,78 @@ const fe = {
|
|
|
152
152
|
return D * 100 / r;
|
|
153
153
|
}, Be = $e({ id: null, date: null });
|
|
154
154
|
let at = !1, Je = !0;
|
|
155
|
-
const we = $e({ el: null, cell: null, timeout: null }),
|
|
155
|
+
const we = $e({ el: null, cell: null, timeout: null }), _e = $e({
|
|
156
156
|
eventId: null,
|
|
157
157
|
fromVueCal: null,
|
|
158
158
|
toVueCal: null
|
|
159
159
|
});
|
|
160
160
|
function Et(D) {
|
|
161
|
-
const { config: n, view: r, eventsManager: h, emit: p, uid: b, dateUtils: H } = D,
|
|
161
|
+
const { config: n, view: r, eventsManager: h, emit: p, uid: b, dateUtils: H } = D, m = (e) => {
|
|
162
162
|
var l;
|
|
163
|
-
const { timeStep:
|
|
163
|
+
const { timeStep: d, timeCellHeight: g, timeFrom: M } = n, P = (((l = e.touches) == null ? void 0 : l[0]) || e).clientY, { top: A } = e.currentTarget.getBoundingClientRect(), s = P - A - ~~e.dataTransfer.getData("cursor-grab-at");
|
|
164
164
|
return Pe(Ze(s, e.currentTarget), n);
|
|
165
|
-
}, j = (e,
|
|
166
|
-
const M =
|
|
167
|
-
let P = Math.max(
|
|
165
|
+
}, j = (e, d, g) => {
|
|
166
|
+
const M = d.duration || i(d.start, d.end) || n.timeStep;
|
|
167
|
+
let P = Math.max(m(e), 0);
|
|
168
168
|
if (n.snapToInterval) {
|
|
169
169
|
const _ = P + n.snapToInterval / 2;
|
|
170
170
|
P = _ - _ % n.snapToInterval;
|
|
171
171
|
}
|
|
172
172
|
const A = new Date(new Date(g).setMinutes(P)), s = Math.min(P + M, 24 * 60), l = new Date(new Date(g).setMinutes(s));
|
|
173
173
|
return { start: A, end: l };
|
|
174
|
-
}, i = (e,
|
|
174
|
+
}, i = (e, d) => Math.round((d - e) / 6e4);
|
|
175
175
|
return {
|
|
176
|
-
eventDragStart: (e,
|
|
176
|
+
eventDragStart: (e, d) => {
|
|
177
177
|
if (e.target.nodeType === 3 || D.touch.isResizingEvent) return e.preventDefault();
|
|
178
178
|
e.dataTransfer.effectAllowed = "move", e.dataTransfer.dropEffect = "move";
|
|
179
|
-
const g = { ...
|
|
179
|
+
const g = { ...d, _: { id: d._.id, duration: i(d.start, d.end) } };
|
|
180
180
|
try {
|
|
181
181
|
e.dataTransfer.setData("text/plain", ""), e.dataTransfer.setData("event", JSON.stringify(g)), e.dataTransfer.setData("cursor-grab-at", e.offsetY);
|
|
182
182
|
} catch (P) {
|
|
183
183
|
return console.warn("Vue Cal: Failed to set drag data:", P), e.preventDefault();
|
|
184
184
|
}
|
|
185
|
-
|
|
185
|
+
_e.eventId = d._.id, _e.fromVueCal = b, p("event-drag-start", {
|
|
186
|
+
e,
|
|
187
|
+
event: d
|
|
188
|
+
});
|
|
186
189
|
const M = e.target.closest(".vuecal__event");
|
|
187
190
|
M.classList.add("vuecal__event--dragging-ghost"), setTimeout(() => {
|
|
188
191
|
M.classList.add("vuecal__event--dragging-original"), M.classList.remove("vuecal__event--dragging-ghost");
|
|
189
192
|
}, 0), at = !1, Object.assign(Be, { id: r.id, date: r.firstCellDate }), Je = !0, D.touch.isDraggingEvent = !0;
|
|
190
193
|
},
|
|
191
|
-
eventDragEnd: (e,
|
|
192
|
-
|
|
193
|
-
const { fromVueCal: g, toVueCal: M } =
|
|
194
|
-
M && g !== M && h.deleteEvent(
|
|
194
|
+
eventDragEnd: (e, d) => {
|
|
195
|
+
_e.eventId = null, e.target.closest(".vuecal__event").classList.remove("vuecal__event--dragging-original");
|
|
196
|
+
const { fromVueCal: g, toVueCal: M } = _e;
|
|
197
|
+
M && g !== M && h.deleteEvent(d._.id, 3), at && Je && Be.id && r.switchView(Be.id, Be.date, !0), p("event-drag-end", {
|
|
198
|
+
e,
|
|
199
|
+
event: d,
|
|
200
|
+
external: _e.fromVueCal !== b
|
|
201
|
+
}), _e.fromVueCal = null, _e.toVueCal = null, D.touch.isDraggingEvent = !1;
|
|
195
202
|
},
|
|
196
|
-
cellDragEnter: (e,
|
|
197
|
-
const { start: g } =
|
|
203
|
+
cellDragEnter: (e, d) => {
|
|
204
|
+
const { start: g } = d, M = e.currentTarget;
|
|
198
205
|
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
199
206
|
if (M === we.el || !M.className.includes("vuecal__cell-content")) return !1;
|
|
200
|
-
we.el && (we.cell.highlighted = !1), Object.assign(we, { el: M, cell:
|
|
207
|
+
we.el && (we.cell.highlighted = !1), Object.assign(we, { el: M, cell: d, timeout: clearTimeout(we.timeout) }), d.highlighted = !0, ["years", "year", "month"].includes(r.id) && (we.timeout = setTimeout(() => D.switchToNarrowerView(g), 2e3));
|
|
201
208
|
}
|
|
202
209
|
},
|
|
203
|
-
cellDragOver: (e,
|
|
204
|
-
const { start: g, schedule: M } =
|
|
205
|
-
e.preventDefault(),
|
|
210
|
+
cellDragOver: (e, d) => {
|
|
211
|
+
const { start: g, schedule: M } = d;
|
|
212
|
+
e.preventDefault(), d.highlighted = !0, (M || M === 0) && (d.highlightedSchedule = M);
|
|
206
213
|
},
|
|
207
|
-
cellDragLeave: (e,
|
|
208
|
-
e.preventDefault(), !e.currentTarget.contains(e.relatedTarget) && (
|
|
214
|
+
cellDragLeave: (e, d) => {
|
|
215
|
+
e.preventDefault(), !e.currentTarget.contains(e.relatedTarget) && (d.highlightedSchedule = !1, we.cell === d && (clearTimeout(we.timeout), Object.assign(we, { el: null, cell: null, timeout: null }), d.highlighted = !1));
|
|
209
216
|
},
|
|
210
|
-
cellDragDrop: async (e,
|
|
217
|
+
cellDragDrop: async (e, d) => {
|
|
211
218
|
var C, L, J;
|
|
212
219
|
e.preventDefault(), clearTimeout(we.timeout), Object.assign(we, { el: null, cell: null, timeout: null });
|
|
213
220
|
const g = JSON.parse(e.dataTransfer.getData("event") || "{}");
|
|
214
221
|
g.start && (g.start = new Date(g.start)), g.end && (g.end = new Date(g.end));
|
|
215
222
|
let M;
|
|
216
|
-
const { start: P, end: A } = j(e, g,
|
|
223
|
+
const { start: P, end: A } = j(e, g, d.start), { schedule: s } = ((C = e.target.closest("[data-schedule]")) == null ? void 0 : C.dataset) || {};
|
|
217
224
|
let l = () => {
|
|
218
225
|
};
|
|
219
|
-
|
|
226
|
+
_e.fromVueCal === b ? (M = h.getEvent(g._.id), M && (M._.dragging = !1, l = () => {
|
|
220
227
|
M.start = P, M.end = A, s !== void 0 && (M.schedule = ~~s);
|
|
221
228
|
})) : (M = {
|
|
222
229
|
...g,
|
|
@@ -238,22 +245,22 @@ function Et(D) {
|
|
|
238
245
|
e,
|
|
239
246
|
event: { ...M, start: P, end: A, schedule: ~~s },
|
|
240
247
|
overlaps: M.getOverlappingEvents({ start: P, end: A, schedule: ~~s }),
|
|
241
|
-
cell:
|
|
242
|
-
external:
|
|
243
|
-
})), _ !== !1 && l(),
|
|
248
|
+
cell: d,
|
|
249
|
+
external: _e.fromVueCal !== b
|
|
250
|
+
})), _ !== !1 && l(), d.highlighted = !1, d.highlightedSchedule = null, Je = !1, _e.toVueCal = b, p("event-dropped", {
|
|
244
251
|
e,
|
|
245
|
-
cell:
|
|
252
|
+
cell: d,
|
|
246
253
|
event: M,
|
|
247
254
|
originalEvent: g,
|
|
248
|
-
external:
|
|
255
|
+
external: _e.fromVueCal !== b
|
|
249
256
|
});
|
|
250
257
|
}
|
|
251
258
|
};
|
|
252
259
|
}
|
|
253
260
|
const st = (D, n) => {
|
|
254
261
|
let r, h, p, b = {}, H = {};
|
|
255
|
-
const
|
|
256
|
-
|
|
262
|
+
const m = ie(D), j = () => {
|
|
263
|
+
m.value.today || (m.value = n), Date.prototype.addDays = function(a) {
|
|
257
264
|
return W(this, a || 0);
|
|
258
265
|
}, Date.prototype.subtractDays = function(a) {
|
|
259
266
|
return R(this, a || 0);
|
|
@@ -264,7 +271,7 @@ const st = (D, n) => {
|
|
|
264
271
|
}, Date.prototype.addMinutes = function(a) {
|
|
265
272
|
return e(this, a || 0);
|
|
266
273
|
}, Date.prototype.subtractMinutes = function(a) {
|
|
267
|
-
return
|
|
274
|
+
return d(this, a || 0);
|
|
268
275
|
}, Date.prototype.getWeek = function() {
|
|
269
276
|
return M(this);
|
|
270
277
|
}, Date.prototype.isToday = function() {
|
|
@@ -279,7 +286,7 @@ const st = (D, n) => {
|
|
|
279
286
|
}, i = () => {
|
|
280
287
|
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;
|
|
281
288
|
}, f = (a) => {
|
|
282
|
-
|
|
289
|
+
m.value = a, Date.prototype.subtractDays && j();
|
|
283
290
|
}, T = () => (h !== (/* @__PURE__ */ new Date()).getDate() && (r = /* @__PURE__ */ new Date(), h = r.getDate(), p = `${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`), p), W = (a, w) => {
|
|
284
291
|
const y = new Date(a.valueOf());
|
|
285
292
|
return y.setDate(y.getDate() + w), y;
|
|
@@ -295,7 +302,7 @@ const st = (D, n) => {
|
|
|
295
302
|
}, e = (a, w) => {
|
|
296
303
|
const y = new Date(a.valueOf());
|
|
297
304
|
return y.setMinutes(y.getMinutes() + w), y;
|
|
298
|
-
},
|
|
305
|
+
}, d = (a, w) => {
|
|
299
306
|
const y = new Date(a.valueOf());
|
|
300
307
|
return y.setMinutes(y.getMinutes() - w), y;
|
|
301
308
|
}, g = (a, w) => {
|
|
@@ -330,7 +337,7 @@ const st = (D, n) => {
|
|
|
330
337
|
const y = (new Date(w).getTimezoneOffset() - new Date(a).getTimezoneOffset()) * 60 * 1e3;
|
|
331
338
|
return Math.ceil((w - a - y) / (24 * 3600 * 1e3));
|
|
332
339
|
}, J = (a, w, y) => Math.abs(a.getTime() - w.getTime()) <= y * 60 * 1e3, Z = (a) => a && a instanceof Date && !isNaN(a), ue = (a, w = "YYYY-MM-DD", y = null) => {
|
|
333
|
-
if (y || (y =
|
|
340
|
+
if (y || (y = m.value), w || (w = "YYYY-MM-DD"), w === "YYYY-MM-DD") return ce(a);
|
|
334
341
|
b = {}, H = {};
|
|
335
342
|
const B = {
|
|
336
343
|
YYYY: () => ee(a, y).YYYY,
|
|
@@ -371,7 +378,7 @@ const st = (D, n) => {
|
|
|
371
378
|
u + k + E === 141 && (Q = !0);
|
|
372
379
|
}
|
|
373
380
|
if (a instanceof Date && w === "HH:mm") return Q ? "24:00" : pe(a);
|
|
374
|
-
H = {}, y || (y =
|
|
381
|
+
H = {}, y || (y = m.value);
|
|
375
382
|
const he = x(a, y), te = w.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (u, k) => {
|
|
376
383
|
const E = he[k.replace(/\{|\}/g, "")];
|
|
377
384
|
return E !== void 0 ? E : k;
|
|
@@ -459,7 +466,7 @@ const st = (D, n) => {
|
|
|
459
466
|
addHours: o,
|
|
460
467
|
subtractHours: c,
|
|
461
468
|
addMinutes: e,
|
|
462
|
-
subtractMinutes:
|
|
469
|
+
subtractMinutes: d,
|
|
463
470
|
snapToInterval: g,
|
|
464
471
|
getWeek: M,
|
|
465
472
|
isToday: P,
|
|
@@ -491,17 +498,17 @@ const st = (D, n) => {
|
|
|
491
498
|
// An array of events IDs that are multiday.
|
|
492
499
|
byId: {}
|
|
493
500
|
// A map of all the events indexed by ID for fast lookup.
|
|
494
|
-
}, c = r.events.sort((e,
|
|
501
|
+
}, c = r.events.sort((e, d) => e.start - d.start < 0 ? -1 : 1);
|
|
495
502
|
for (const e of c)
|
|
496
|
-
b(e), e._ || (e._ = {}), e._.id = e._.id || ++h, e.delete || (e.delete = (
|
|
503
|
+
b(e), e._ || (e._ = {}), e._.id = e._.id || ++h, e.delete || (e.delete = (d) => f(e._.id, d)), e._.deleting = !1, e._.deleted = !1, e.isOverlapping = (d = null) => e.getOverlappingEvents(d).length, e.getOverlappingEvents = (d = null) => {
|
|
497
504
|
var g;
|
|
498
505
|
return W(
|
|
499
|
-
|
|
500
|
-
{ start: (
|
|
501
|
-
{ excludeIds: [e._.id], schedule: (g = r.schedules) != null && g.length ? ~~((
|
|
506
|
+
m(n.formatDate((d == null ? void 0 : d.start) || e.start), !0),
|
|
507
|
+
{ start: (d == null ? void 0 : d.start) || e.start, end: (d == null ? void 0 : d.end) || e.end },
|
|
508
|
+
{ excludeIds: [e._.id], schedule: (g = r.schedules) != null && g.length ? ~~((d == null ? void 0 : d.schedule) || e.schedule) : null }
|
|
502
509
|
);
|
|
503
|
-
}, e._.register = (
|
|
504
|
-
e._.$el =
|
|
510
|
+
}, e._.register = (d) => {
|
|
511
|
+
e._.$el = d, e._.fireCreated && (D.emit("event-created", e), delete e._.fireCreated);
|
|
505
512
|
}, e._.unregister = () => {
|
|
506
513
|
e._.$el = null, e._.register = null, e.isOverlapping = null, e.getOverlappingEvents = null, e.delete = null;
|
|
507
514
|
}, o.byId[e._.id] = e, e.recurring ? o.recurring.push(e._.id) : e._.multiday ? (o.multiday.push(e._.id), o.byDate[e._.startFormatted] || (o.byDate[e._.startFormatted] = []), o.byDate[e._.startFormatted].push(e._.id)) : (o.byDate[e._.startFormatted] || (o.byDate[e._.startFormatted] = []), o.byDate[e._.startFormatted].push(e._.id));
|
|
@@ -512,17 +519,17 @@ const st = (D, n) => {
|
|
|
512
519
|
return;
|
|
513
520
|
} else o.end.getTime() < o.start.getTime() && console.error(`Vue Cal: invalid event dates for event "${o.title}". The event ends before it starts.`, o.start, o.end);
|
|
514
521
|
o._ || (o._ = {}), o._.multiday = !n.isSameDate(o.start, new Date(o.end.getTime() - 1)), o._.startFormatted = n.formatDate(o.start), o._.startMinutes = ~~n.dateToMinutes(o.start), o._.endMinutes = ~~n.dateToMinutes(o.end);
|
|
515
|
-
const c = o.start.getHours(), e = o.start.getMinutes().toString().padStart(2, 0),
|
|
516
|
-
o._.startTimeFormatted24 = `${c.toString().padStart(2, 0)}:${e}`, o._.startTimeFormatted12 = `${c % 12 || 12}${e ? `:${e}` : ""} ${c < 12 ? "AM" : "PM"}`, o._.endTimeFormatted24 = `${
|
|
517
|
-
}, H = (o) => p.value.byId[o],
|
|
518
|
-
let
|
|
519
|
-
return
|
|
522
|
+
const c = o.start.getHours(), e = o.start.getMinutes().toString().padStart(2, 0), d = o.end.getHours(), g = o.end.getMinutes().toString().padStart(2, 0);
|
|
523
|
+
o._.startTimeFormatted24 = `${c.toString().padStart(2, 0)}:${e}`, o._.startTimeFormatted12 = `${c % 12 || 12}${e ? `:${e}` : ""} ${c < 12 ? "AM" : "PM"}`, o._.endTimeFormatted24 = `${d.toString().padStart(2, 0)}:${g}`, o._.endTimeFormatted12 = `${d % 12 || 12}${g ? `:${g}` : ""} ${d < 12 ? "AM" : "PM"}`, o._.duration = Math.abs(~~((o.end - o.start) / 6e4));
|
|
524
|
+
}, H = (o) => p.value.byId[o], m = (o, c = !1, e = !1) => {
|
|
525
|
+
let d = p.value.byDate[o] || [];
|
|
526
|
+
return d = c || e ? d.map(H) : d, e || (d = d.filter((g) => !g.background && !g._.deleted), c || (d = d.map((g) => g._.id))), d;
|
|
520
527
|
}, j = (o) => {
|
|
521
528
|
const c = {};
|
|
522
529
|
for (const { startFormatted: e } of o) {
|
|
523
530
|
c[e] = [];
|
|
524
|
-
const
|
|
525
|
-
|
|
531
|
+
const d = m(e, !1, !0);
|
|
532
|
+
d.length && c[e].push(...d);
|
|
526
533
|
}
|
|
527
534
|
return c;
|
|
528
535
|
}, i = (o) => {
|
|
@@ -535,9 +542,9 @@ const st = (D, n) => {
|
|
|
535
542
|
var P, A;
|
|
536
543
|
if (!o) return console.warn("Vue Cal: Cannot delete event without its ID or criteria.");
|
|
537
544
|
let e = typeof o == "string" || !isNaN(o) ? o : null;
|
|
538
|
-
const
|
|
539
|
-
if (
|
|
540
|
-
const [s, l] =
|
|
545
|
+
const d = typeof o == "object" ? Object.entries(o) : null;
|
|
546
|
+
if (d) {
|
|
547
|
+
const [s, l] = d[0];
|
|
541
548
|
e = (P = r.events.find((_) => _[s] === l)) == null ? void 0 : P._.id;
|
|
542
549
|
}
|
|
543
550
|
if (!r.editableEvents.delete)
|
|
@@ -568,15 +575,15 @@ const st = (D, n) => {
|
|
|
568
575
|
}
|
|
569
576
|
return !0;
|
|
570
577
|
}, T = (o) => {
|
|
571
|
-
const c =
|
|
578
|
+
const c = m(o, !0);
|
|
572
579
|
if (!c.length) return { cellOverlaps: {}, longestStreak: 0 };
|
|
573
580
|
const e = {};
|
|
574
|
-
let
|
|
581
|
+
let d = [], g = 0;
|
|
575
582
|
c.sort((M, P) => M.start - P.start || M.end - M.start - (P.end - P.start));
|
|
576
583
|
for (const M of c) {
|
|
577
584
|
const P = M._.id;
|
|
578
|
-
e[P] || (e[P] = { overlaps: /* @__PURE__ */ new Set(), maxConcurrent: 1, position: 0 }),
|
|
579
|
-
const A =
|
|
585
|
+
e[P] || (e[P] = { overlaps: /* @__PURE__ */ new Set(), maxConcurrent: 1, position: 0 }), d = d.filter((t) => t.end > M.start);
|
|
586
|
+
const A = d.filter((t) => {
|
|
580
587
|
var L;
|
|
581
588
|
return (!((L = r.schedules) != null && L.length) || M.schedule === t.schedule) && t.start < M.end;
|
|
582
589
|
}), s = new Set(A.map((t) => {
|
|
@@ -585,7 +592,7 @@ const st = (D, n) => {
|
|
|
585
592
|
}));
|
|
586
593
|
let l = 0;
|
|
587
594
|
for (; s.has(l); ) l++;
|
|
588
|
-
e[P].position = l,
|
|
595
|
+
e[P].position = l, d.push(M);
|
|
589
596
|
const _ = Math.max(1, ...A.map((t) => {
|
|
590
597
|
var C;
|
|
591
598
|
return ((C = e[t._.id]) == null ? void 0 : C.maxConcurrent) ?? 1;
|
|
@@ -597,20 +604,20 @@ const st = (D, n) => {
|
|
|
597
604
|
}
|
|
598
605
|
for (const M in e) e[M].overlaps = [...e[M].overlaps];
|
|
599
606
|
return { cellOverlaps: e, longestStreak: g };
|
|
600
|
-
}, W = (o = [], { start: c, end: e }, { excludeIds:
|
|
607
|
+
}, W = (o = [], { start: c, end: e }, { excludeIds: d = [], schedule: g = null }) => {
|
|
601
608
|
var A;
|
|
602
|
-
const M = new Set(
|
|
609
|
+
const M = new Set(d), P = [];
|
|
603
610
|
for (const s of o)
|
|
604
611
|
!M.has((A = s._) == null ? void 0 : A.id) && (g === null || g === s.schedule) && R(s, c, e) && P.push(s);
|
|
605
612
|
return P;
|
|
606
613
|
}, R = (o, c, e) => {
|
|
607
|
-
const
|
|
614
|
+
const d = o.allDay || !r.time, g = d ? new Date(o.start).setHours(0, 0, 0, 0) : o.start.getTime(), M = d ? new Date(o.end).setHours(23, 59, 59, 999) : o.end.getTime(), P = d ? new Date(c).setHours(0, 0, 0, 0) : c.getTime(), A = d ? new Date(e).setHours(23, 59, 59, 999) : e.getTime();
|
|
608
615
|
return M > P && g < A;
|
|
609
616
|
};
|
|
610
617
|
return {
|
|
611
618
|
events: p,
|
|
612
619
|
getEvent: H,
|
|
613
|
-
getEventsByDate:
|
|
620
|
+
getEventsByDate: m,
|
|
614
621
|
getViewEvents: j,
|
|
615
622
|
getCellOverlappingEvents: T,
|
|
616
623
|
getEventsInRange: W,
|
|
@@ -619,22 +626,22 @@ const st = (D, n) => {
|
|
|
619
626
|
isEventInRange: R
|
|
620
627
|
};
|
|
621
628
|
}, Ct = ({ config: D, dateUtils: n, emit: r, texts: h, eventsManager: p }, b) => {
|
|
622
|
-
const { availableViews: H } = D,
|
|
629
|
+
const { availableViews: H } = D, m = ie(D.view && H[D.view] ? D.view : D.defaultView), j = ie(D.selectedDate || null), i = ie(/* @__PURE__ */ new Date()), f = ie(new Date(D.viewDate || i.value));
|
|
623
630
|
f.value.setHours(0, 0, 0, 0);
|
|
624
631
|
const T = ie(new Date(f));
|
|
625
632
|
let W = null;
|
|
626
|
-
const R = $(() =>
|
|
627
|
-
if (
|
|
628
|
-
const
|
|
629
|
-
return
|
|
633
|
+
const R = $(() => m.value === "month" ? T.value : l.value), o = $(() => m.value === "month" ? new Date(T.value.getFullYear(), T.value.getMonth() + 1, 0, 23, 59, 59, 999) : t.value), c = $(() => m.value === "week" ? n.getPreviousFirstDayOfWeek(l.value, D.startWeekOnSunday) : m.value === "month" ? l.value : R.value), e = $(() => {
|
|
634
|
+
if (m.value === "week") {
|
|
635
|
+
const v = n.addDays(c.value, 7);
|
|
636
|
+
return v.setMilliseconds(-1), v;
|
|
630
637
|
}
|
|
631
|
-
return
|
|
632
|
-
}),
|
|
633
|
-
const
|
|
634
|
-
if (
|
|
635
|
-
return c.value.getTime() <=
|
|
638
|
+
return m.value === "month" ? t.value : o.value;
|
|
639
|
+
}), d = $(() => {
|
|
640
|
+
const v = i.value.getTime();
|
|
641
|
+
if (m.value === "week")
|
|
642
|
+
return c.value.getTime() <= v && v <= e.value.getTime();
|
|
636
643
|
const F = l.value.getTime(), X = t.value.getTime();
|
|
637
|
-
return F <=
|
|
644
|
+
return F <= v && v <= X;
|
|
638
645
|
});
|
|
639
646
|
function g() {
|
|
640
647
|
i.value = /* @__PURE__ */ new Date(), W = setTimeout(g, 60 * 1e3);
|
|
@@ -643,28 +650,28 @@ const st = (D, n) => {
|
|
|
643
650
|
W = setTimeout(g, (60 - (/* @__PURE__ */ new Date()).getSeconds()) * 1e3), g();
|
|
644
651
|
}
|
|
645
652
|
const P = $(() => {
|
|
646
|
-
if (!D.availableViews[
|
|
647
|
-
let
|
|
648
|
-
return D.hasHiddenDays && ["week", "month"].includes(
|
|
653
|
+
if (!D.availableViews[m.value]) return 1;
|
|
654
|
+
let v = D.availableViews[m.value].cols;
|
|
655
|
+
return D.hasHiddenDays && ["week", "month"].includes(m.value) && (v -= D.hasHiddenDays), v;
|
|
649
656
|
}), A = $(() => {
|
|
650
|
-
var
|
|
651
|
-
return ((
|
|
657
|
+
var v;
|
|
658
|
+
return ((v = D.availableViews[m.value]) == null ? void 0 : v.rows) || 1;
|
|
652
659
|
}), s = $(() => P.value * A.value), l = $(() => {
|
|
653
|
-
if (
|
|
654
|
-
let
|
|
655
|
-
return D.startWeekOnSunday && !D.hideWeekdays[7] && (
|
|
660
|
+
if (m.value === "month") {
|
|
661
|
+
let v = T.value.getDay() || 7;
|
|
662
|
+
return D.startWeekOnSunday && !D.hideWeekdays[7] && (v += 1), D.viewDayOffset && (v -= D.viewDayOffset), n.subtractDays(T.value, v - 1);
|
|
656
663
|
}
|
|
657
|
-
if (
|
|
658
|
-
const
|
|
659
|
-
let F = Math.min(...
|
|
664
|
+
if (m.value === "week") {
|
|
665
|
+
const v = "1234567".split("").filter((X) => !Object.keys(D.hideWeekdays).includes(X));
|
|
666
|
+
let F = Math.min(...v);
|
|
660
667
|
return D.startWeekOnSunday && !D.hideWeekdays[7] && (F = 1), D.viewDayOffset && (F += D.viewDayOffset), n.addDays(T.value, F - 1);
|
|
661
668
|
}
|
|
662
669
|
return T.value;
|
|
663
670
|
}), _ = $(() => {
|
|
664
|
-
const
|
|
671
|
+
const v = [], F = ["days", "week", "month"].includes(m.value);
|
|
665
672
|
let X = 0;
|
|
666
673
|
for (let G = 0; G < s.value + X; G++)
|
|
667
|
-
switch (
|
|
674
|
+
switch (m.value) {
|
|
668
675
|
case "day":
|
|
669
676
|
case "days":
|
|
670
677
|
case "week":
|
|
@@ -675,44 +682,44 @@ const st = (D, n) => {
|
|
|
675
682
|
continue;
|
|
676
683
|
}
|
|
677
684
|
const Ce = new Date(ve);
|
|
678
|
-
Ce.setHours(23, 59, 59, 999),
|
|
685
|
+
Ce.setHours(23, 59, 59, 999), v.push({ start: ve, startFormatted: n.formatDate(ve), end: Ce });
|
|
679
686
|
break;
|
|
680
687
|
}
|
|
681
688
|
case "year":
|
|
682
|
-
|
|
689
|
+
v.push({
|
|
683
690
|
start: new Date(l.value.getFullYear(), G, 1, 0, 0, 0, 0),
|
|
684
691
|
end: new Date(l.value.getFullYear(), G + 1, 0, 23, 59, 59, 999)
|
|
685
692
|
});
|
|
686
693
|
break;
|
|
687
694
|
case "years":
|
|
688
|
-
|
|
695
|
+
v.push({
|
|
689
696
|
start: new Date(l.value.getFullYear() + G, 0, 1, 0, 0, 0, 0),
|
|
690
697
|
end: new Date(l.value.getFullYear() + G + 1, 0, 0, 23, 59, 59, 999)
|
|
691
698
|
});
|
|
692
699
|
break;
|
|
693
700
|
}
|
|
694
|
-
return
|
|
701
|
+
return v;
|
|
695
702
|
}), t = $(() => _.value[_.value.length - 1].end), C = ie("right"), L = $(() => {
|
|
696
|
-
const
|
|
697
|
-
return
|
|
703
|
+
const v = Object.keys(D.availableViews);
|
|
704
|
+
return v[v.indexOf(m.value) + 1];
|
|
698
705
|
}), J = $(() => {
|
|
699
|
-
const
|
|
700
|
-
return
|
|
706
|
+
const v = Object.keys(D.availableViews);
|
|
707
|
+
return v[v.indexOf(m.value) - 1];
|
|
701
708
|
});
|
|
702
|
-
function Z(
|
|
703
|
-
if (!F || !F[
|
|
704
|
-
const G = F[
|
|
709
|
+
function Z(v, F, X = !1) {
|
|
710
|
+
if (!F || !F[v]) return v + 1;
|
|
711
|
+
const G = F[v];
|
|
705
712
|
return X && typeof G == "string" ? G.substring(0, 3) : G;
|
|
706
713
|
}
|
|
707
|
-
function ue(
|
|
708
|
-
const { monthsArray: G, monthBeforeDay: ve, canTruncate: We, xs: Ce } = X, Me =
|
|
709
|
-
return pt ? ve ? `${Z(Me, G,
|
|
714
|
+
function ue(v, F, X) {
|
|
715
|
+
const { monthsArray: G, monthBeforeDay: ve, canTruncate: We, xs: Ce } = X, Me = v.getMonth(), Ye = v.getFullYear(), Ee = F.getMonth(), Fe = F.getFullYear(), Ae = Me !== Ee, pt = Ye !== Fe, Te = We && (Ce || Ae), Le = v.getDate(), He = F.getDate();
|
|
716
|
+
return pt ? ve ? `${Z(Me, G, Te)} ${Le}, ${Ye} - ${Z(Ee, G, Te)} ${He}, ${Fe}` : `${Le} ${Z(Me, G, Te)} ${Ye} - ${He} ${Z(Ee, G, Te)} ${Fe}` : Ae ? ve ? `${Z(Me, G, Te)} ${Le} - ${Z(Ee, G, Te)} ${He}, ${Ye}` : `${Le} ${Z(Me, G, Te)} - ${He} ${Z(Ee, G, Te)} ${Ye}` : ve ? `${Z(Me, G, Te)} ${Le}-${He}, ${Ye}` : `${Le}-${He} ${Z(Me, G, Te)} ${Ye}`;
|
|
710
717
|
}
|
|
711
718
|
const ce = $(() => {
|
|
712
|
-
const { dateFormat:
|
|
713
|
-
switch (
|
|
719
|
+
const { dateFormat: v, months: F, monthsGenitive: X, week: G, truncations: ve } = h, We = D.locale, Ce = ve !== !1, Me = v.indexOf("M") < v.indexOf("D"), Ye = X && We === "el" ? X : F;
|
|
720
|
+
switch (m.value) {
|
|
714
721
|
case "day":
|
|
715
|
-
return n.formatDate(l.value,
|
|
722
|
+
return n.formatDate(l.value, v);
|
|
716
723
|
case "days":
|
|
717
724
|
case "week": {
|
|
718
725
|
const Ee = {
|
|
@@ -722,7 +729,7 @@ const st = (D, n) => {
|
|
|
722
729
|
xs: D.xs
|
|
723
730
|
};
|
|
724
731
|
let Fe = ue(l.value, t.value, Ee);
|
|
725
|
-
if (
|
|
732
|
+
if (m.value === "week") {
|
|
726
733
|
const Ae = n.getWeek(
|
|
727
734
|
l.value,
|
|
728
735
|
D.startWeekOnSunday && !D.hideWeekdays[7]
|
|
@@ -742,7 +749,7 @@ const st = (D, n) => {
|
|
|
742
749
|
}
|
|
743
750
|
});
|
|
744
751
|
function de() {
|
|
745
|
-
switch (T.value = new Date(f.value || i.value), T.value.setHours(0, 0, 0, 0),
|
|
752
|
+
switch (T.value = new Date(f.value || i.value), T.value.setHours(0, 0, 0, 0), m.value) {
|
|
746
753
|
case "day":
|
|
747
754
|
break;
|
|
748
755
|
case "days":
|
|
@@ -761,24 +768,24 @@ const st = (D, n) => {
|
|
|
761
768
|
break;
|
|
762
769
|
}
|
|
763
770
|
D.ready && r("view-change", {
|
|
764
|
-
id:
|
|
771
|
+
id: m.value,
|
|
765
772
|
title: ce.value,
|
|
766
773
|
start: R.value,
|
|
767
774
|
end: o.value,
|
|
768
775
|
extendedStart: c.value,
|
|
769
776
|
extendedEnd: e.value,
|
|
770
777
|
cellDates: _.value,
|
|
771
|
-
containsToday:
|
|
778
|
+
containsToday: d.value,
|
|
772
779
|
events: z.value
|
|
773
780
|
}), i.value = /* @__PURE__ */ new Date();
|
|
774
781
|
}
|
|
775
|
-
function pe(
|
|
776
|
-
const F =
|
|
777
|
-
|
|
782
|
+
function pe(v) {
|
|
783
|
+
const F = m.value, X = D.availableViews[F];
|
|
784
|
+
v[F] && JSON.stringify(v[F]) === JSON.stringify(X) || de();
|
|
778
785
|
}
|
|
779
|
-
function oe(
|
|
786
|
+
function oe(v, F = !0) {
|
|
780
787
|
const X = Object.keys(D.availableViews);
|
|
781
|
-
|
|
788
|
+
m.value !== v && (X.includes(v) ? (C.value = X.indexOf(v) < X.indexOf(m.value) ? "left" : "right", m.value = v, r("update:view", v), de()) : console.warn(`Vue Cal: the \`${v}\` view is not available.`));
|
|
782
789
|
}
|
|
783
790
|
function K() {
|
|
784
791
|
L.value ? oe(L.value) : console.warn("Vue Cal: no broader view is available.");
|
|
@@ -792,29 +799,29 @@ const st = (D, n) => {
|
|
|
792
799
|
function a() {
|
|
793
800
|
w(!0);
|
|
794
801
|
}
|
|
795
|
-
function w(
|
|
802
|
+
function w(v = !0) {
|
|
796
803
|
let F = new Date(f.value);
|
|
797
|
-
switch (
|
|
804
|
+
switch (m.value) {
|
|
798
805
|
case "day":
|
|
799
806
|
case "days":
|
|
800
|
-
|
|
807
|
+
v ? F = n.addDays(t.value, 1) : F = n.subtractDays(l.value, s.value);
|
|
801
808
|
break;
|
|
802
809
|
case "week": {
|
|
803
|
-
|
|
810
|
+
v ? (F = n.addDays(e.value, 1), F.setHours(0, 0, 0, 0)) : F = n.subtractDays(c.value, s.value);
|
|
804
811
|
break;
|
|
805
812
|
}
|
|
806
813
|
case "month": {
|
|
807
|
-
const X =
|
|
814
|
+
const X = v ? 1 : -1;
|
|
808
815
|
F = new Date(F.getFullYear(), F.getMonth() + X, 1, 0, 0, 0, 0);
|
|
809
816
|
break;
|
|
810
817
|
}
|
|
811
818
|
case "year": {
|
|
812
|
-
const X =
|
|
819
|
+
const X = v ? 1 : -1;
|
|
813
820
|
F = new Date(F.getFullYear() + X, 1, 1, 0, 0, 0, 0);
|
|
814
821
|
break;
|
|
815
822
|
}
|
|
816
823
|
case "years": {
|
|
817
|
-
const X =
|
|
824
|
+
const X = v ? s.value : -s.value;
|
|
818
825
|
F = new Date(F.getFullYear() + X, 1, 1, 0, 0, 0, 0);
|
|
819
826
|
break;
|
|
820
827
|
}
|
|
@@ -822,48 +829,48 @@ const st = (D, n) => {
|
|
|
822
829
|
B(F);
|
|
823
830
|
}
|
|
824
831
|
function y() {
|
|
825
|
-
const
|
|
826
|
-
|
|
832
|
+
const v = /* @__PURE__ */ new Date();
|
|
833
|
+
v.setHours(0, 0, 0, 0), B(v);
|
|
827
834
|
}
|
|
828
|
-
function B(
|
|
829
|
-
if (!n.isValid(
|
|
835
|
+
function B(v, F = !0, X = !1) {
|
|
836
|
+
if (!n.isValid(v)) return console.warn("Vue Cal: can't navigate to the given date: invalid date provided to `updateViewDate(date)`.");
|
|
830
837
|
let [G, ve] = [l.value, t.value];
|
|
831
|
-
|
|
838
|
+
m.value === "month" && ([G, ve] = [R.value, o.value]), (!n.isInRange(v, G, ve) || X) && (v.setHours(0, 0, 0, 0), C.value = v.getTime() < G.getTime() ? "left" : "right", f.value = v, F && r("update:viewDate", v), de());
|
|
832
839
|
}
|
|
833
|
-
function Q(
|
|
834
|
-
if (!n.isValid(
|
|
840
|
+
function Q(v, F = !0) {
|
|
841
|
+
if (!n.isValid(v)) return console.warn("Vue Cal: can't update the selected date: invalid date provided to `updateSelectedDate(date)`.");
|
|
835
842
|
const { isValid: X, isSameDate: G } = n;
|
|
836
|
-
(!j.value || !X(j.value) || !G(
|
|
843
|
+
(!j.value || !X(j.value) || !G(v, j.value)) && (v.setHours(0, 0, 0, 0), j.value = v, F && r("update:selectedDate", v));
|
|
837
844
|
}
|
|
838
|
-
function he(
|
|
839
|
-
!
|
|
845
|
+
function he(v) {
|
|
846
|
+
!v && !T.value.getDay() ? B(n.addDays(T.value, 1), !0, !0) : (C.value = "left", de());
|
|
840
847
|
}
|
|
841
|
-
function te(
|
|
842
|
-
|
|
848
|
+
function te(v) {
|
|
849
|
+
v && D.startWeekOnSunday && !T.value.getDay() ? B(n.addDays(T.value, 1), !0, !0) : !v && D.startWeekOnSunday && T.value.getDay() === 1 && B(n.subtractDays(T.value, 1), !0, !0);
|
|
843
850
|
}
|
|
844
851
|
function u() {
|
|
845
852
|
console.log("toggling weekdays", D.hideWeekdays);
|
|
846
853
|
}
|
|
847
|
-
function k(
|
|
854
|
+
function k(v) {
|
|
848
855
|
var G;
|
|
849
|
-
const F = (G = b.value) == null ? void 0 : G.querySelector(".vuecal__scrollable"), X =
|
|
856
|
+
const F = (G = b.value) == null ? void 0 : G.querySelector(".vuecal__scrollable"), X = v ? v * D.timeCellHeight / D.timeStep : 0;
|
|
850
857
|
F == null || F.scrollTo({ top: X, behavior: "smooth" });
|
|
851
858
|
}
|
|
852
859
|
function E() {
|
|
853
|
-
const
|
|
854
|
-
k(
|
|
860
|
+
const v = /* @__PURE__ */ new Date();
|
|
861
|
+
k(v.getHours() * 60 + v.getMinutes());
|
|
855
862
|
}
|
|
856
863
|
function Y() {
|
|
857
864
|
k(0);
|
|
858
865
|
}
|
|
859
866
|
const z = $(() => p.getViewEvents(_.value)), I = p.createEvent, ae = p.deleteEvent;
|
|
860
|
-
return me(() => D.view, (
|
|
867
|
+
return me(() => D.view, (v) => oe(v, !1)), me(() => D.availableViews, pe), me(() => D.datePicker, () => oe("month", !1)), me(() => D.viewDate, (v) => B(v, !1)), me(() => D.selectedDate, (v) => Q(v, !1)), me(() => D.startWeekOnSunday, (v) => he(v)), me(() => D.hideWeekends, (v) => te(v)), me(() => D.hideWeekdays, u), me(() => s.value, () => {
|
|
861
868
|
s.value > 90 && console.warn("Vue Cal: high cell count detected. Performance may degrade when interactions are enabled.");
|
|
862
|
-
}), me(() => D.watchRealTime, (
|
|
863
|
-
|
|
869
|
+
}), me(() => D.watchRealTime, (v) => {
|
|
870
|
+
v && D.time ? M() : W = clearTimeout(W);
|
|
864
871
|
}), de(), D.time && D.watchRealTime && M(), Xe(() => W = clearTimeout(W)), {
|
|
865
872
|
now: i,
|
|
866
|
-
id:
|
|
873
|
+
id: m,
|
|
867
874
|
broaderView: L,
|
|
868
875
|
narrowerView: J,
|
|
869
876
|
title: ce,
|
|
@@ -876,7 +883,7 @@ const st = (D, n) => {
|
|
|
876
883
|
// Full range, including out of scope month days, and hidden leading/trailing days.
|
|
877
884
|
firstCellDate: l,
|
|
878
885
|
lastCellDate: t,
|
|
879
|
-
containsToday:
|
|
886
|
+
containsToday: d,
|
|
880
887
|
selectedDate: j,
|
|
881
888
|
cellDates: _,
|
|
882
889
|
cols: P,
|
|
@@ -902,22 +909,22 @@ const st = (D, n) => {
|
|
|
902
909
|
deleteEvent: ae,
|
|
903
910
|
// Getters.
|
|
904
911
|
get isDay() {
|
|
905
|
-
return
|
|
912
|
+
return m.value === "day";
|
|
906
913
|
},
|
|
907
914
|
get isDays() {
|
|
908
|
-
return
|
|
915
|
+
return m.value === "days";
|
|
909
916
|
},
|
|
910
917
|
get isWeek() {
|
|
911
|
-
return
|
|
918
|
+
return m.value === "week";
|
|
912
919
|
},
|
|
913
920
|
get isMonth() {
|
|
914
|
-
return
|
|
921
|
+
return m.value === "month";
|
|
915
922
|
},
|
|
916
923
|
get isYear() {
|
|
917
|
-
return
|
|
924
|
+
return m.value === "year";
|
|
918
925
|
},
|
|
919
926
|
get isYears() {
|
|
920
|
-
return
|
|
927
|
+
return m.value === "years";
|
|
921
928
|
}
|
|
922
929
|
};
|
|
923
930
|
}, lt = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], rt = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], ot = "Years", it = "Year", ut = "Month", ct = "Week", dt = "Days", vt = "Day", mt = "Today", ft = "No Event", gt = "All day", ht = "Delete", yt = "Create an event", Dt = "dddd, MMMM D, YYYY", Ke = {
|
|
@@ -1091,7 +1098,7 @@ const st = (D, n) => {
|
|
|
1091
1098
|
const n = Ne("vuecal"), { view: r, config: h } = n, p = () => {
|
|
1092
1099
|
h.clickToNavigate && r.broader();
|
|
1093
1100
|
}, b = $(() => h.clickToNavigate ? { click: p } : {});
|
|
1094
|
-
return (H,
|
|
1101
|
+
return (H, m) => (S(), O("div", Ft, [
|
|
1095
1102
|
N(H.$slots, "header", {
|
|
1096
1103
|
view: V(r),
|
|
1097
1104
|
availableViews: V(h).availableViews,
|
|
@@ -1099,7 +1106,7 @@ const st = (D, n) => {
|
|
|
1099
1106
|
}),
|
|
1100
1107
|
H.$slots.header ? U("", !0) : (S(), O(ne, { key: 0 }, [
|
|
1101
1108
|
V(h).viewsBar ? (S(), O("div", Lt, [
|
|
1102
|
-
(S(!0), O(ne, null,
|
|
1109
|
+
(S(!0), O(ne, null, be(V(h).availableViews, (j, i) => (S(), O("button", {
|
|
1103
1110
|
class: De(["vuecal__view-button", { "vuecal__view-button--active": V(r).id === i }]),
|
|
1104
1111
|
onClick: (f) => V(r).switch(i),
|
|
1105
1112
|
innerHTML: V(n).texts[i],
|
|
@@ -1109,7 +1116,7 @@ const st = (D, n) => {
|
|
|
1109
1116
|
V(h).titleBar ? (S(), O("nav", zt, [
|
|
1110
1117
|
ge("button", {
|
|
1111
1118
|
class: De(["vuecal__nav vuecal__nav--prev", { "vuecal__nav--default": !H.$slots["previous-button"] }]),
|
|
1112
|
-
onClick:
|
|
1119
|
+
onClick: m[0] || (m[0] = (...j) => V(r).previous && V(r).previous(...j)),
|
|
1113
1120
|
type: "button"
|
|
1114
1121
|
}, [
|
|
1115
1122
|
N(H.$slots, "previous-button")
|
|
@@ -1149,7 +1156,7 @@ const st = (D, n) => {
|
|
|
1149
1156
|
}) : (S(), O("button", {
|
|
1150
1157
|
key: 1,
|
|
1151
1158
|
class: De(["vuecal__nav vuecal__nav--today vuecal__nav--default", { "vuecal__nav--active": V(r).containsToday }]),
|
|
1152
|
-
onClick:
|
|
1159
|
+
onClick: m[1] || (m[1] = (j) => !V(r).containsToday && V(r).goToToday()),
|
|
1153
1160
|
disabled: !!V(r).containsToday,
|
|
1154
1161
|
type: "button",
|
|
1155
1162
|
innerHTML: V(n).texts.today
|
|
@@ -1157,7 +1164,7 @@ const st = (D, n) => {
|
|
|
1157
1164
|
], 64)) : U("", !0),
|
|
1158
1165
|
ge("button", {
|
|
1159
1166
|
class: De(["vuecal__nav vuecal__nav--next", { "vuecal__nav--default": !H.$slots["next-button"] }]),
|
|
1160
|
-
onClick:
|
|
1167
|
+
onClick: m[2] || (m[2] = (...j) => V(r).next && V(r).next(...j)),
|
|
1161
1168
|
type: "button"
|
|
1162
1169
|
}, [
|
|
1163
1170
|
N(H.$slots, "next-button")
|
|
@@ -1181,7 +1188,7 @@ const st = (D, n) => {
|
|
|
1181
1188
|
}, Ut = ["innerHTML"], qt = {
|
|
1182
1189
|
__name: "headings-bar",
|
|
1183
1190
|
setup(D) {
|
|
1184
|
-
const n = Ne("vuecal"), { view: r, config: h, dateUtils: p } = n, b = $(() => h.xs ? "day-xs" : h.sm || r.isDays || r.isMonth ? "day-sm" : "day"), H = $(() => (r.isDay || r.isDays || r.isWeek || r.isMonth) && !(r.isDay && !h.schedules)),
|
|
1191
|
+
const n = Ne("vuecal"), { view: r, config: h, dateUtils: p } = n, b = $(() => h.xs ? "day-xs" : h.sm || r.isDays || r.isMonth ? "day-sm" : "day"), H = $(() => (r.isDay || r.isDays || r.isWeek || r.isMonth) && !(r.isDay && !h.schedules)), m = $(() => r.cellDates.slice(0, r.cols).map(({ start: i }) => ({
|
|
1185
1192
|
id: Re[i.getDay()],
|
|
1186
1193
|
date: i,
|
|
1187
1194
|
dateNumber: i.getDate(),
|
|
@@ -1196,7 +1203,7 @@ const st = (D, n) => {
|
|
|
1196
1203
|
};
|
|
1197
1204
|
return (i, f) => H.value ? (S(), O("div", Bt, [
|
|
1198
1205
|
V(r).isDay ? U("", !0) : (S(), O("div", It, [
|
|
1199
|
-
(S(!0), O(ne, null,
|
|
1206
|
+
(S(!0), O(ne, null, be(m.value, (T, W) => (S(), O("div", {
|
|
1200
1207
|
class: De(["vuecal__weekday", { "vuecal__weekday--today": T.isToday }]),
|
|
1201
1208
|
key: W,
|
|
1202
1209
|
onClick: (R) => j.click(T.date)
|
|
@@ -1212,8 +1219,8 @@ const st = (D, n) => {
|
|
|
1212
1219
|
], 10, Rt))), 128))
|
|
1213
1220
|
])),
|
|
1214
1221
|
V(h).schedules ? (S(), O("div", Jt, [
|
|
1215
|
-
(S(!0), O(ne, null,
|
|
1216
|
-
(S(!0), O(ne, null,
|
|
1222
|
+
(S(!0), O(ne, null, be(m.value, (T, W) => (S(), O(ne, { key: W }, [
|
|
1223
|
+
(S(!0), O(ne, null, be(V(h).schedules, (R, o) => (S(), O(ne, { key: o }, [
|
|
1217
1224
|
i.$slots["schedule-heading"] ? (S(), O("div", {
|
|
1218
1225
|
key: 0,
|
|
1219
1226
|
class: De(["vuecal__schedule vuecal__schedule--heading", R.class])
|
|
@@ -1237,11 +1244,11 @@ const st = (D, n) => {
|
|
|
1237
1244
|
setup(D) {
|
|
1238
1245
|
const n = Ne("vuecal"), { config: r, texts: h } = n, p = $(() => {
|
|
1239
1246
|
const b = [];
|
|
1240
|
-
for (let
|
|
1241
|
-
const j =
|
|
1247
|
+
for (let m = r.timeFrom; m < r.timeTo; m += r.timeStep) {
|
|
1248
|
+
const j = m + r.timeStep > r.timeTo, i = ~~(m / 60), f = m % 60, T = h[m < 720 ? "am" : "pm"];
|
|
1242
1249
|
let W = null;
|
|
1243
|
-
j && (W = `calc(var(--vuecal-time-cell-height) * ${(r.timeTo -
|
|
1244
|
-
minutesSum:
|
|
1250
|
+
j && (W = `calc(var(--vuecal-time-cell-height) * ${(r.timeTo - m) / r.timeStep})`), b.push({
|
|
1251
|
+
minutesSum: m,
|
|
1245
1252
|
// The sum of hours + minutes in minutes.
|
|
1246
1253
|
hours: i,
|
|
1247
1254
|
minutes: f,
|
|
@@ -1253,20 +1260,20 @@ const st = (D, n) => {
|
|
|
1253
1260
|
return b;
|
|
1254
1261
|
});
|
|
1255
1262
|
return (b, H) => (S(), O("div", Zt, [
|
|
1256
|
-
(S(!0), O(ne, null,
|
|
1263
|
+
(S(!0), O(ne, null, be(p.value, (m, j) => (S(), O("div", {
|
|
1257
1264
|
class: "vuecal__time-cell",
|
|
1258
1265
|
key: j,
|
|
1259
|
-
style:
|
|
1266
|
+
style: ke({ height: m.height || null })
|
|
1260
1267
|
}, [
|
|
1261
1268
|
N(b.$slots, "time-cell", {
|
|
1262
1269
|
index: j,
|
|
1263
|
-
minutes:
|
|
1264
|
-
hours:
|
|
1265
|
-
minutesSum:
|
|
1266
|
-
format12:
|
|
1267
|
-
format24:
|
|
1270
|
+
minutes: m.minutes,
|
|
1271
|
+
hours: m.hours,
|
|
1272
|
+
minutesSum: m.minutesSum,
|
|
1273
|
+
format12: m.formatted12,
|
|
1274
|
+
format24: m.formatted24
|
|
1268
1275
|
}, () => [
|
|
1269
|
-
ge("label", null, re(V(r).twelveHour ?
|
|
1276
|
+
ge("label", null, re(V(r).twelveHour ? m.formatted12 : m.formatted24), 1)
|
|
1270
1277
|
])
|
|
1271
1278
|
], 4))), 128))
|
|
1272
1279
|
]));
|
|
@@ -1281,7 +1288,7 @@ const st = (D, n) => {
|
|
|
1281
1288
|
},
|
|
1282
1289
|
emits: ["event-drag-start", "event-drag-end", "event-resize-start", "event-resize-end"],
|
|
1283
1290
|
setup(D, { emit: n }) {
|
|
1284
|
-
const { config: r, view: h, dnd: p, touch: b, dateUtils: H } = Ne("vuecal"),
|
|
1291
|
+
const { config: r, view: h, dnd: p, touch: b, dateUtils: H } = Ne("vuecal"), m = D, j = ie(null), i = $e(m.event), f = $e({
|
|
1285
1292
|
dragging: !1,
|
|
1286
1293
|
resizing: !1,
|
|
1287
1294
|
fromResizer: !1,
|
|
@@ -1379,11 +1386,11 @@ const st = (D, n) => {
|
|
|
1379
1386
|
const l = ((t = s.touches) == null ? void 0 : t[0]) || s;
|
|
1380
1387
|
f.fromResizer = l.target.matches(".vuecal__event-resizer, .vuecal__event-resizer *");
|
|
1381
1388
|
const _ = j.value.getBoundingClientRect();
|
|
1382
|
-
f.startX = (((C = s.touches) == null ? void 0 : C[0]) || s).clientX - _.left, f.startY = (((L = s.touches) == null ? void 0 : L[0]) || s).clientY - _.top, f.startPercentageX = f.startX * 100 / _.width, f.startPercentageY = f.startY * 100 / _.height, f.cellEl = j.value.closest(".vuecal__cell"), f.resizeStartDate = i.start, A(s.type === "touchstart" ? "touchmove" : "mousemove",
|
|
1389
|
+
f.startX = (((C = s.touches) == null ? void 0 : C[0]) || s).clientX - _.left, f.startY = (((L = s.touches) == null ? void 0 : L[0]) || s).clientY - _.top, f.startPercentageX = f.startX * 100 / _.width, f.startPercentageY = f.startY * 100 / _.height, f.cellEl = j.value.closest(".vuecal__cell"), f.resizeStartDate = i.start, A(s.type === "touchstart" ? "touchmove" : "mousemove", d), A(s.type === "touchstart" ? "touchend" : "mouseup", g, { once: !0 }), f.holdTimer = setTimeout(() => {
|
|
1383
1390
|
var J, Z;
|
|
1384
1391
|
f.holding = !0, (Z = (J = c.value).hold) == null || Z.call(J, { e: s, event: i });
|
|
1385
1392
|
}, 1e3);
|
|
1386
|
-
},
|
|
1393
|
+
}, d = async (s) => {
|
|
1387
1394
|
var _, t, C, L;
|
|
1388
1395
|
const l = ((_ = s.touches) == null ? void 0 : _[0]) || s;
|
|
1389
1396
|
if (f.fromResizer && !f.resizing && (f.resizing = !0, f.resizingOriginalEvent = { ...i, _: { ...i._ } }, b.isResizingEvent = !0, (C = (t = c.value).resizeStart) == null || C.call(t, { e: s, event: i })), f.holdTimer = clearTimeout(f.holdTimer), f.holding = !1, f.cellEl) {
|
|
@@ -1414,7 +1421,7 @@ const st = (D, n) => {
|
|
|
1414
1421
|
overlaps: i.getOverlappingEvents({ start: t, end: C })
|
|
1415
1422
|
})), i.start = L === !1 ? (f.resizingLastAcceptedEvent || f.resizingOriginalEvent).start : ((l = f.resizingLastAcceptedEvent) == null ? void 0 : l.start) || t, i.end = L === !1 ? (f.resizingLastAcceptedEvent || f.resizingOriginalEvent).end : ((_ = f.resizingLastAcceptedEvent) == null ? void 0 : _.end) || C, i._.duration < 1 && (i.start = f.resizingOriginalEvent.start, i.end = f.resizingOriginalEvent.end), b.isResizingEvent = !1;
|
|
1416
1423
|
}
|
|
1417
|
-
document.removeEventListener(s.type === "touchend" ? "touchmove" : "mousemove",
|
|
1424
|
+
document.removeEventListener(s.type === "touchend" ? "touchmove" : "mousemove", d), 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;
|
|
1418
1425
|
}, M = (s) => {
|
|
1419
1426
|
const l = new Date(s.start.getFullYear(), s.start.getMonth(), s.start.getDate());
|
|
1420
1427
|
new Date(l).setDate(l.getDate() + 1);
|
|
@@ -1503,7 +1510,7 @@ const st = (D, n) => {
|
|
|
1503
1510
|
index: { type: Number, required: !0 }
|
|
1504
1511
|
},
|
|
1505
1512
|
setup(D) {
|
|
1506
|
-
const n = D, r = Ne("vuecal"), { view: h, config: p, dateUtils: b, eventsManager: H, dnd:
|
|
1513
|
+
const n = D, r = Ne("vuecal"), { view: h, config: p, dateUtils: b, eventsManager: H, dnd: m, touch: j } = r, i = $(() => b.isToday(n.start)), f = ie(null), T = ie([]), W = ie(!1), R = (u) => {
|
|
1507
1514
|
T.value.push(u.detail), W.value = !0;
|
|
1508
1515
|
}, o = () => setTimeout(() => W.value = !1, 300), c = $e({
|
|
1509
1516
|
dragging: !1,
|
|
@@ -1526,7 +1533,7 @@ const st = (D, n) => {
|
|
|
1526
1533
|
movePercentageX: 0,
|
|
1527
1534
|
movePercentageY: 0,
|
|
1528
1535
|
schedule: null
|
|
1529
|
-
}), e = ie(!1),
|
|
1536
|
+
}), e = ie(!1), d = ie({ cellOverlaps: {}, longestStreak: 0 }), g = $(() => {
|
|
1530
1537
|
let u = Math.min(c.startPercentageY, c.movePercentageY), k = Math.max(c.startPercentageY, c.movePercentageY), E = Pe(u, p), Y = Pe(k, p);
|
|
1531
1538
|
return p.snapToInterval && (E = b.snapToInterval(E, p.snapToInterval), Y = b.snapToInterval(Y, p.snapToInterval), u = Ve(E, p), k = Ve(Y, p)), {
|
|
1532
1539
|
style: {
|
|
@@ -1582,14 +1589,14 @@ const st = (D, n) => {
|
|
|
1582
1589
|
}), C = $(() => {
|
|
1583
1590
|
const u = {};
|
|
1584
1591
|
for (const k of l.value) {
|
|
1585
|
-
const E = k._.id, { maxConcurrent: Y = 1, position: z = 0 } =
|
|
1592
|
+
const E = k._.id, { maxConcurrent: Y = 1, position: z = 0 } = d.value.cellOverlaps[E] || {};
|
|
1586
1593
|
u[E] = { left: `${100 / Y * z}%` }, p.stackEvents ? u[E].width = `${100 / Y + (z === Y - 1 ? 0 : 15)}%` : u[E].width = `${100 / Y}%`;
|
|
1587
1594
|
}
|
|
1588
1595
|
return u;
|
|
1589
1596
|
}), L = $(() => {
|
|
1590
1597
|
const u = {};
|
|
1591
1598
|
for (const k of l.value) {
|
|
1592
|
-
const E = k._.id, { maxConcurrent: Y = 1, position: z = 0 } =
|
|
1599
|
+
const E = k._.id, { maxConcurrent: Y = 1, position: z = 0 } = d.value.cellOverlaps[E] || {};
|
|
1593
1600
|
u[E] = `vuecal__event--stack-${z + 1}-${Y}`;
|
|
1594
1601
|
}
|
|
1595
1602
|
return u;
|
|
@@ -1600,13 +1607,13 @@ const st = (D, n) => {
|
|
|
1600
1607
|
let k = (E = p.specialHours) == null ? void 0 : E[u];
|
|
1601
1608
|
if (k)
|
|
1602
1609
|
return Array.isArray(k) || (k = [k]), k.map((Y) => {
|
|
1603
|
-
let { from: z, to: I, class: ae, label:
|
|
1610
|
+
let { from: z, to: I, class: ae, label: v } = Y;
|
|
1604
1611
|
if (isNaN(z) || isNaN(I) || p.timeFrom >= I || p.timeTo <= z) return;
|
|
1605
1612
|
z = Math.max(p.timeFrom, z), I = Math.min(p.timeTo, I);
|
|
1606
1613
|
const F = Ve(z, p), X = Ve(I, p) - F;
|
|
1607
1614
|
return {
|
|
1608
1615
|
style: { top: `${F}%`, height: `${X}%` },
|
|
1609
|
-
label:
|
|
1616
|
+
label: v,
|
|
1610
1617
|
class: ae
|
|
1611
1618
|
};
|
|
1612
1619
|
}).filter((Y) => !!Y);
|
|
@@ -1627,8 +1634,8 @@ const st = (D, n) => {
|
|
|
1627
1634
|
const u = { ...p.eventListeners.cell };
|
|
1628
1635
|
for (const [Y, z] of Object.entries(u))
|
|
1629
1636
|
u[Y] = (I) => {
|
|
1630
|
-
var ae,
|
|
1631
|
-
(F = (
|
|
1637
|
+
var ae, v, F;
|
|
1638
|
+
(F = (v = I.target || ((ae = I.e) == null ? void 0 : ae.target)).closest) != null && F.call(v, ".vuecal__event") || z(I.type ? { e: I, cell: K.value, cursor: x.value } : I);
|
|
1632
1639
|
};
|
|
1633
1640
|
const k = { ...u };
|
|
1634
1641
|
let E = null;
|
|
@@ -1649,9 +1656,9 @@ const st = (D, n) => {
|
|
|
1649
1656
|
}), k.dblclick && (u.dblclick = (Y) => {
|
|
1650
1657
|
var z;
|
|
1651
1658
|
(z = k.dblclick) == null || z.call(k, { e: Y, cell: K.value, cursor: ee(Y) });
|
|
1652
|
-
}), p.editableEvents.drag && (u.dragenter = (Y) =>
|
|
1653
|
-
Y.preventDefault(),
|
|
1654
|
-
}, u.dragleave = (Y) =>
|
|
1659
|
+
}), p.editableEvents.drag && (u.dragenter = (Y) => m.cellDragEnter(Y, K.value), u.dragover = (Y) => {
|
|
1660
|
+
Y.preventDefault(), m.cellDragOver(Y, K.value);
|
|
1661
|
+
}, u.dragleave = (Y) => m.cellDragLeave(Y, K.value), u.drop = (Y) => m.cellDragDrop(Y, K.value)), u;
|
|
1655
1662
|
}), K = $(() => ({
|
|
1656
1663
|
start: n.start,
|
|
1657
1664
|
end: n.end,
|
|
@@ -1683,13 +1690,13 @@ const st = (D, n) => {
|
|
|
1683
1690
|
c.holding = !0, (I = (z = oe.value).hold) == null || I.call(z, { e: u, cell: K.value, cursor: x.value });
|
|
1684
1691
|
}, 1e3);
|
|
1685
1692
|
}, y = (u) => {
|
|
1686
|
-
var E, Y, z, I, ae,
|
|
1687
|
-
c.dragging || (j.isDraggingCell = !0, (Y = (E = oe.value)
|
|
1693
|
+
var E, Y, z, I, ae, v;
|
|
1694
|
+
c.dragging || (j.isDraggingCell = !0, (Y = (E = oe.value)["drag-start"]) == null || Y.call(E, { e: u, cell: K.value, cursor: x.value })), c.dragging = !0, c.holdTimer = clearTimeout(c.holdTimer), c.holding = !1;
|
|
1688
1695
|
const k = f.value.getBoundingClientRect();
|
|
1689
|
-
c.moveX = (((z = u.touches) == null ? void 0 : z[0]) || u).clientX - k.left, c.moveY = (((I = u.touches) == null ? void 0 : I[0]) || u).clientY - k.top, c.movePercentageX = c.moveX * 100 / k.width, c.movePercentageY = c.moveY * 100 / k.height, p.eventCreateMinDrag && Math.abs(c.startY - c.moveY) > p.eventCreateMinDrag && (c.thresholdPassed = !0), (
|
|
1696
|
+
c.moveX = (((z = u.touches) == null ? void 0 : z[0]) || u).clientX - k.left, c.moveY = (((I = u.touches) == null ? void 0 : I[0]) || u).clientY - k.top, c.movePercentageX = c.moveX * 100 / k.width, c.movePercentageY = c.moveY * 100 / k.height, p.eventCreateMinDrag && Math.abs(c.startY - c.moveY) > p.eventCreateMinDrag && (c.thresholdPassed = !0), (v = (ae = oe.value).drag) == null || v.call(ae, { e: u, cell: K.value, cursor: x.value });
|
|
1690
1697
|
}, B = async (u) => {
|
|
1691
1698
|
var k, E;
|
|
1692
|
-
document.removeEventListener(u.type === "touchend" ? "touchmove" : "mousemove", y, { passive: !1 }), c.dragging && ((E = (k = oe.value)
|
|
1699
|
+
document.removeEventListener(u.type === "touchend" ? "touchmove" : "mousemove", y, { passive: !1 }), c.dragging && ((E = (k = oe.value)["drag-end"]) == null || E.call(k, { e: u, cell: K.value, cursor: x.value }), j.isDraggingCell = !1, p.editableEvents.create && (e.value = !0, await Q(u), e.value = !1)), c.holdTimer = clearTimeout(c.holdTimer), c.holding = !1, c.dragging = !1, c.startX = 0, c.startY = 0, c.moveX = 0, c.moveY = 0, c.startPercentageX = 0, c.startPercentageY = 0, c.movePercentageX = 0, c.movePercentageY = 0, c.thresholdPassed = !1, c.schedule = null;
|
|
1693
1700
|
}, Q = async (u) => {
|
|
1694
1701
|
if (!M.value) return;
|
|
1695
1702
|
let { start: k, end: E, startMinutes: Y, endMinutes: z } = g.value;
|
|
@@ -1697,15 +1704,15 @@ const st = (D, n) => {
|
|
|
1697
1704
|
let I = { ...g.value, start: k, end: E };
|
|
1698
1705
|
const { create: ae } = p.eventListeners.event;
|
|
1699
1706
|
if (typeof ae == "function") {
|
|
1700
|
-
const
|
|
1701
|
-
I = await new Promise((F) => ae({ e: u, event: I, cell: K.value, resolve: F, cursor: x.value })), I && typeof I == "object" && h.createEvent(I), I && typeof I == "boolean" && h.createEvent(
|
|
1707
|
+
const v = I;
|
|
1708
|
+
I = await new Promise((F) => ae({ e: u, event: I, cell: K.value, resolve: F, cursor: x.value })), I && typeof I == "object" && h.createEvent(I), I && typeof I == "boolean" && h.createEvent(v);
|
|
1702
1709
|
} else h.createEvent(I);
|
|
1703
1710
|
}, he = () => {
|
|
1704
1711
|
var u;
|
|
1705
1712
|
for (const k of Object.keys(oe.value))
|
|
1706
1713
|
(u = f.value) == null || u.removeEventListener(k, oe.value[k]);
|
|
1707
1714
|
}, te = () => {
|
|
1708
|
-
|
|
1715
|
+
d.value = H.getCellOverlappingEvents(A.value);
|
|
1709
1716
|
};
|
|
1710
1717
|
return me(
|
|
1711
1718
|
// Watch event IDs and start/end dates (only) to detect event resizing/dnd.
|
|
@@ -1727,15 +1734,15 @@ const st = (D, n) => {
|
|
|
1727
1734
|
key: 0,
|
|
1728
1735
|
cell: K.value
|
|
1729
1736
|
}) : U("", !0),
|
|
1730
|
-
Z.value ? (S(!0), O(ne, { key: 1 },
|
|
1737
|
+
Z.value ? (S(!0), O(ne, { key: 1 }, be(Z.value, (E, Y) => (S(), O("div", {
|
|
1731
1738
|
class: De(["vuecal__special-hours", E.class]),
|
|
1732
|
-
style:
|
|
1739
|
+
style: ke(E.style),
|
|
1733
1740
|
innerHTML: E.label || ""
|
|
1734
1741
|
}, null, 14, na))), 256)) : U("", !0),
|
|
1735
|
-
!u.$slots.cell && V(p).schedules ? (S(!0), O(ne, { key: 2 },
|
|
1742
|
+
!u.$slots.cell && V(p).schedules ? (S(!0), O(ne, { key: 2 }, be(V(p).schedules, (E) => (S(), O("div", {
|
|
1736
1743
|
class: De(["vuecal__schedule vuecal__schedule--cell", E.class]),
|
|
1737
1744
|
key: E.id,
|
|
1738
|
-
style:
|
|
1745
|
+
style: ke(E.style || null),
|
|
1739
1746
|
"data-schedule": E.id
|
|
1740
1747
|
}, [
|
|
1741
1748
|
u.$slots["cell-events"] ? N(u.$slots, "cell-events", {
|
|
@@ -1761,11 +1768,11 @@ const st = (D, n) => {
|
|
|
1761
1768
|
tag: "div"
|
|
1762
1769
|
}, {
|
|
1763
1770
|
default: q(() => [
|
|
1764
|
-
(S(!0), O(ne, null,
|
|
1771
|
+
(S(!0), O(ne, null, be(t.value[E.id], (Y) => (S(), Se(nt, {
|
|
1765
1772
|
key: Y._.id,
|
|
1766
1773
|
event: Y,
|
|
1767
1774
|
onEventDeleted: R,
|
|
1768
|
-
style:
|
|
1775
|
+
style: ke(C.value[Y._.id])
|
|
1769
1776
|
}, je({ _: 2 }, [
|
|
1770
1777
|
u.$slots.event ? {
|
|
1771
1778
|
name: "event",
|
|
@@ -1781,7 +1788,7 @@ const st = (D, n) => {
|
|
|
1781
1788
|
M.value && c.schedule === E.id ? (S(), O("div", {
|
|
1782
1789
|
key: 5,
|
|
1783
1790
|
class: "vuecal__event-placeholder",
|
|
1784
|
-
style:
|
|
1791
|
+
style: ke(g.value.style)
|
|
1785
1792
|
}, re(g.value.start) + " - " + re(g.value.end), 5)) : U("", !0)
|
|
1786
1793
|
], 14, sa))), 128)) : U("", !0),
|
|
1787
1794
|
!u.$slots.cell && !V(p).schedules ? (S(), O(ne, { key: 3 }, [
|
|
@@ -1808,12 +1815,12 @@ const st = (D, n) => {
|
|
|
1808
1815
|
tag: "div"
|
|
1809
1816
|
}, {
|
|
1810
1817
|
default: q(() => [
|
|
1811
|
-
(S(!0), O(ne, null,
|
|
1818
|
+
(S(!0), O(ne, null, be(l.value, (E) => (S(), Se(nt, {
|
|
1812
1819
|
key: E._.id,
|
|
1813
1820
|
event: E,
|
|
1814
1821
|
onEventDeleted: R,
|
|
1815
1822
|
class: De(L.value[E._.id]),
|
|
1816
|
-
style:
|
|
1823
|
+
style: ke(C.value[E._.id])
|
|
1817
1824
|
}, je({ _: 2 }, [
|
|
1818
1825
|
u.$slots.event ? {
|
|
1819
1826
|
name: "event",
|
|
@@ -1829,7 +1836,7 @@ const st = (D, n) => {
|
|
|
1829
1836
|
M.value ? (S(), O("div", {
|
|
1830
1837
|
key: 5,
|
|
1831
1838
|
class: "vuecal__event-placeholder",
|
|
1832
|
-
style:
|
|
1839
|
+
style: ke(g.value.style)
|
|
1833
1840
|
}, re(g.value.start) + " - " + re(g.value.end), 5)) : U("", !0)
|
|
1834
1841
|
], 64)) : U("", !0),
|
|
1835
1842
|
u.$slots["event-count"] ? N(u.$slots, "event-count", {
|
|
@@ -1839,7 +1846,7 @@ const st = (D, n) => {
|
|
|
1839
1846
|
pe.show ? (S(), O("div", {
|
|
1840
1847
|
key: 6,
|
|
1841
1848
|
class: "vuecal__now-line",
|
|
1842
|
-
style:
|
|
1849
|
+
style: ke(pe.style),
|
|
1843
1850
|
title: pe.currentTime
|
|
1844
1851
|
}, [
|
|
1845
1852
|
ge("span", null, re(pe.currentTime), 1)
|
|
@@ -1849,7 +1856,7 @@ const st = (D, n) => {
|
|
|
1849
1856
|
}, fa = {
|
|
1850
1857
|
__name: "body",
|
|
1851
1858
|
setup(D) {
|
|
1852
|
-
const n = Ne("vuecal"), { view: r, config: h, dateUtils: p } = n, b = ie(null), H = ie(null),
|
|
1859
|
+
const n = Ne("vuecal"), { view: r, config: h, dateUtils: p } = n, b = ie(null), H = ie(null), m = $(() => ({
|
|
1853
1860
|
"--vuecal-grid-columns": r.cols,
|
|
1854
1861
|
"--vuecal-grid-rows": r.rows
|
|
1855
1862
|
})), j = $(() => {
|
|
@@ -1874,21 +1881,21 @@ const st = (D, n) => {
|
|
|
1874
1881
|
class: "vuecal__body",
|
|
1875
1882
|
ref_key: "bodyEl",
|
|
1876
1883
|
ref: b,
|
|
1877
|
-
style:
|
|
1884
|
+
style: ke(m.value)
|
|
1878
1885
|
}, [
|
|
1879
1886
|
Oe(Ge, { name: "vuecal-shrink" }, {
|
|
1880
1887
|
default: q(() => [
|
|
1881
1888
|
V(h).timeAtCursor && H.value !== null ? (S(), O("div", {
|
|
1882
1889
|
key: 0,
|
|
1883
1890
|
class: "vuecal__time-at-cursor",
|
|
1884
|
-
style:
|
|
1891
|
+
style: ke(j.value.style)
|
|
1885
1892
|
}, [
|
|
1886
1893
|
ge("label", null, re(j.value.time), 1)
|
|
1887
1894
|
], 4)) : U("", !0)
|
|
1888
1895
|
]),
|
|
1889
1896
|
_: 1
|
|
1890
1897
|
}),
|
|
1891
|
-
(S(!0), O(ne, null,
|
|
1898
|
+
(S(!0), O(ne, null, be(V(r).cellDates, (R, o) => (S(), Se(ma, {
|
|
1892
1899
|
key: o,
|
|
1893
1900
|
start: R.start,
|
|
1894
1901
|
end: R.end,
|
|
@@ -1952,45 +1959,47 @@ const st = (D, n) => {
|
|
|
1952
1959
|
"update:events",
|
|
1953
1960
|
"event-delete",
|
|
1954
1961
|
"event-created",
|
|
1955
|
-
"event-dropped"
|
|
1962
|
+
"event-dropped",
|
|
1963
|
+
"event-drag-start",
|
|
1964
|
+
"event-drag-end"
|
|
1956
1965
|
],
|
|
1957
1966
|
setup(D, { expose: n, emit: r }) {
|
|
1958
|
-
const h = D, p = r, b = _t("vuecal-el"), H = Ot({ props: h, emit: p, attrs: bt(), vuecalEl: b, uid: kt() }), { config:
|
|
1967
|
+
const h = D, p = r, b = _t("vuecal-el"), H = Ot({ props: h, emit: p, attrs: bt(), vuecalEl: b, uid: kt() }), { config: m, view: j, dateUtils: i, touch: f } = H, T = $(() => m.time && (j.isDay || j.isDays || j.isWeek)), W = $(() => Array(j.rows).fill().map((e, d) => i.getWeek(i.addDays(j.firstCellDate, 7 * d)))), R = $(() => {
|
|
1959
1968
|
var e;
|
|
1960
1969
|
return {
|
|
1961
|
-
"vuecal--ready":
|
|
1962
|
-
[`vuecal--${
|
|
1963
|
-
[`vuecal--${
|
|
1964
|
-
"vuecal--date-picker":
|
|
1965
|
-
"vuecal--dark":
|
|
1966
|
-
"vuecal--light": !
|
|
1970
|
+
"vuecal--ready": m.ready,
|
|
1971
|
+
[`vuecal--${m.theme}-theme`]: m.theme,
|
|
1972
|
+
[`vuecal--${m.size}`]: !0,
|
|
1973
|
+
"vuecal--date-picker": m.datePicker,
|
|
1974
|
+
"vuecal--dark": m.dark,
|
|
1975
|
+
"vuecal--light": !m.dark,
|
|
1967
1976
|
[`vuecal--${j.id}-view`]: !0,
|
|
1968
1977
|
"vuecal--view-has-time": T.value,
|
|
1969
|
-
"vuecal--timeless": !
|
|
1978
|
+
"vuecal--timeless": !m.time,
|
|
1970
1979
|
"vuecal--dragging-cell": f.isDraggingCell,
|
|
1971
1980
|
"vuecal--dragging-event": f.isDraggingEvent,
|
|
1972
1981
|
"vuecal--resizing-event": f.isResizingEvent,
|
|
1973
|
-
"vuecal--has-schedules": (e =
|
|
1982
|
+
"vuecal--has-schedules": (e = m.schedules) == null ? void 0 : e.length
|
|
1974
1983
|
};
|
|
1975
1984
|
}), o = $(() => ({
|
|
1976
|
-
"--vuecal-time-cell-height":
|
|
1985
|
+
"--vuecal-time-cell-height": m.timeCellHeight && `${m.timeCellHeight}px`
|
|
1977
1986
|
})), c = $(() => {
|
|
1978
|
-
var e,
|
|
1987
|
+
var e, d;
|
|
1979
1988
|
return {
|
|
1980
|
-
"vuecal__scrollable--row": T.value ||
|
|
1989
|
+
"vuecal__scrollable--row": T.value || m.weekNumbers && j.isMonth,
|
|
1981
1990
|
// Keep the states inside the Vue transition wrapper for smooth CSS transitions.
|
|
1982
1991
|
[`vuecal__scrollable--${j.id}-view`]: !0,
|
|
1983
|
-
"vuecal__scrollable--has-schedules": (e =
|
|
1984
|
-
"vuecal__scrollable--no-schedules": !((
|
|
1992
|
+
"vuecal__scrollable--has-schedules": (e = m.schedules) == null ? void 0 : e.length,
|
|
1993
|
+
"vuecal__scrollable--no-schedules": !((d = m.schedules) != null && d.length)
|
|
1985
1994
|
};
|
|
1986
1995
|
});
|
|
1987
1996
|
return qe(async () => {
|
|
1988
|
-
await Ue(),
|
|
1989
|
-
}), Tt("vuecal", H), n({ view: H.view }), (e,
|
|
1997
|
+
await Ue(), m.ready = !0, p("ready", { config: m, view: j });
|
|
1998
|
+
}), Tt("vuecal", H), n({ view: H.view }), (e, d) => (S(), O("div", {
|
|
1990
1999
|
class: De(["vuecal", R.value]),
|
|
1991
2000
|
ref: "vuecal-el",
|
|
1992
2001
|
"data-locale": e.locale,
|
|
1993
|
-
style:
|
|
2002
|
+
style: ke(o.value)
|
|
1994
2003
|
}, [
|
|
1995
2004
|
e.$slots.diy ? N(e.$slots, "diy", {
|
|
1996
2005
|
key: 0,
|
|
@@ -2058,8 +2067,8 @@ const st = (D, n) => {
|
|
|
2058
2067
|
key: "0"
|
|
2059
2068
|
} : void 0
|
|
2060
2069
|
]), 1024)) : U("", !0),
|
|
2061
|
-
V(
|
|
2062
|
-
(S(!0), O(ne, null,
|
|
2070
|
+
V(m).weekNumbers && V(j).isMonth ? (S(), O("div", ya, [
|
|
2071
|
+
(S(!0), O(ne, null, be(W.value, (g) => (S(), O("div", Da, [
|
|
2063
2072
|
N(e.$slots, "week-number", {}, () => [
|
|
2064
2073
|
ge("small", null, re(g), 1)
|
|
2065
2074
|
])
|