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