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