@forcecalendar/interface 1.0.39 → 1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/force-calendar-interface.esm.js +208 -158
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +33 -33
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/renderers/BaseViewRenderer.js +88 -4
- package/src/renderers/DayViewRenderer.js +5 -1
- package/src/renderers/WeekViewRenderer.js +5 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var v = (
|
|
4
|
-
import { Calendar as
|
|
5
|
-
class
|
|
1
|
+
var S = Object.defineProperty;
|
|
2
|
+
var F = (f, e, t) => e in f ? S(f, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[e] = t;
|
|
3
|
+
var v = (f, e, t) => F(f, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Calendar as H, DateUtils as L } from "@forcecalendar/core";
|
|
5
|
+
class T extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(), this.attachShadow({ mode: "open" }), this._listeners = [], this._state = null, this._props = /* @__PURE__ */ new Map(), this._initialized = !1;
|
|
8
8
|
}
|
|
@@ -111,7 +111,7 @@ class k extends HTMLElement {
|
|
|
111
111
|
this.setProp(e, r), this._initialized && this.render();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class
|
|
114
|
+
class V {
|
|
115
115
|
constructor() {
|
|
116
116
|
this.events = /* @__PURE__ */ new Map(), this.wildcardHandlers = /* @__PURE__ */ new Set();
|
|
117
117
|
}
|
|
@@ -125,14 +125,14 @@ class S {
|
|
|
125
125
|
on(e, t, r = {}) {
|
|
126
126
|
const { once: i = !1, priority: s = 0 } = r;
|
|
127
127
|
if (e.includes("*")) {
|
|
128
|
-
const
|
|
129
|
-
return this.wildcardHandlers.add(
|
|
128
|
+
const a = { pattern: e, handler: t, once: i, priority: s };
|
|
129
|
+
return this.wildcardHandlers.add(a), () => this.wildcardHandlers.delete(a);
|
|
130
130
|
}
|
|
131
131
|
this.events.has(e) || this.events.set(e, []);
|
|
132
|
-
const n = { handler: t, once: i, priority: s },
|
|
133
|
-
return
|
|
134
|
-
const
|
|
135
|
-
|
|
132
|
+
const n = { handler: t, once: i, priority: s }, o = this.events.get(e);
|
|
133
|
+
return o.push(n), o.sort((a, c) => c.priority - a.priority), () => {
|
|
134
|
+
const a = o.indexOf(n);
|
|
135
|
+
a > -1 && o.splice(a, 1);
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
@@ -189,10 +189,10 @@ class S {
|
|
|
189
189
|
if (this.events.has(e)) {
|
|
190
190
|
const s = [...this.events.get(e)];
|
|
191
191
|
for (const n of s) {
|
|
192
|
-
const { handler:
|
|
193
|
-
|
|
192
|
+
const { handler: o, once: a } = n;
|
|
193
|
+
a && this.off(e, o);
|
|
194
194
|
try {
|
|
195
|
-
const c =
|
|
195
|
+
const c = o(t, e);
|
|
196
196
|
c instanceof Promise && r.push(c);
|
|
197
197
|
} catch (c) {
|
|
198
198
|
console.error(`Error in event handler for ${e}:`, c);
|
|
@@ -202,13 +202,13 @@ class S {
|
|
|
202
202
|
const i = [];
|
|
203
203
|
for (const s of [...this.wildcardHandlers])
|
|
204
204
|
if (this.matchesPattern(e, s.pattern)) {
|
|
205
|
-
const { handler: n, once:
|
|
206
|
-
|
|
205
|
+
const { handler: n, once: o } = s;
|
|
206
|
+
o && i.push(s);
|
|
207
207
|
try {
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
} catch (
|
|
211
|
-
console.error(`Error in wildcard handler for ${e}:`,
|
|
208
|
+
const a = n(t, e);
|
|
209
|
+
a instanceof Promise && r.push(a);
|
|
210
|
+
} catch (a) {
|
|
211
|
+
console.error(`Error in wildcard handler for ${e}:`, a);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
return i.forEach((s) => this.wildcardHandlers.delete(s)), Promise.all(r);
|
|
@@ -253,10 +253,10 @@ class S {
|
|
|
253
253
|
return e;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
const
|
|
257
|
-
class
|
|
256
|
+
const l = new V();
|
|
257
|
+
class I {
|
|
258
258
|
constructor(e = {}) {
|
|
259
|
-
this.calendar = new
|
|
259
|
+
this.calendar = new H({
|
|
260
260
|
view: e.view || "month",
|
|
261
261
|
date: e.date || /* @__PURE__ */ new Date(),
|
|
262
262
|
weekStartsOn: e.weekStartsOn ?? 0,
|
|
@@ -343,48 +343,48 @@ class C {
|
|
|
343
343
|
emitStateChange(e, t) {
|
|
344
344
|
const r = Object.keys(t).filter((i) => e[i] !== t[i]);
|
|
345
345
|
r.forEach((i) => {
|
|
346
|
-
|
|
346
|
+
l.emit(`state:${i}:changed`, {
|
|
347
347
|
oldValue: e[i],
|
|
348
348
|
newValue: t[i],
|
|
349
349
|
state: t
|
|
350
350
|
});
|
|
351
|
-
}), r.length > 0 &&
|
|
351
|
+
}), r.length > 0 && l.emit("state:changed", { oldState: e, newState: t, changedKeys: r });
|
|
352
352
|
}
|
|
353
353
|
// Calendar operations
|
|
354
354
|
setView(e) {
|
|
355
|
-
this.calendar.setView(e), this.setState({ view: e }),
|
|
355
|
+
this.calendar.setView(e), this.setState({ view: e }), l.emit("view:changed", { view: e });
|
|
356
356
|
}
|
|
357
357
|
getView() {
|
|
358
358
|
return this.state.view;
|
|
359
359
|
}
|
|
360
360
|
setDate(e) {
|
|
361
|
-
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
361
|
+
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), l.emit("date:changed", { date: this.state.currentDate });
|
|
362
362
|
}
|
|
363
363
|
getCurrentDate() {
|
|
364
364
|
return this.state.currentDate;
|
|
365
365
|
}
|
|
366
366
|
// Navigation
|
|
367
367
|
next() {
|
|
368
|
-
this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
368
|
+
this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }), l.emit("navigation:next", { date: this.state.currentDate });
|
|
369
369
|
}
|
|
370
370
|
previous() {
|
|
371
|
-
this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
371
|
+
this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), l.emit("navigation:previous", { date: this.state.currentDate });
|
|
372
372
|
}
|
|
373
373
|
today() {
|
|
374
|
-
this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
374
|
+
this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), l.emit("navigation:today", { date: this.state.currentDate });
|
|
375
375
|
}
|
|
376
376
|
goToDate(e) {
|
|
377
|
-
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
377
|
+
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), l.emit("navigation:goto", { date: this.state.currentDate });
|
|
378
378
|
}
|
|
379
379
|
// Event management
|
|
380
380
|
addEvent(e) {
|
|
381
381
|
const t = this.calendar.addEvent(e);
|
|
382
|
-
return t ? (this._syncEventsFromCore(),
|
|
382
|
+
return t ? (this._syncEventsFromCore(), l.emit("event:add", { event: t }), l.emit("event:added", { event: t }), t) : (console.error("Failed to add event to calendar"), l.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null);
|
|
383
383
|
}
|
|
384
384
|
updateEvent(e, t) {
|
|
385
385
|
this._syncEventsFromCore({ silent: !0 });
|
|
386
386
|
const r = this.calendar.updateEvent(e, t);
|
|
387
|
-
return r ? (this._syncEventsFromCore({ force: !0 }),
|
|
387
|
+
return r ? (this._syncEventsFromCore({ force: !0 }), l.emit("event:update", { event: r }), l.emit("event:updated", { event: r }), r) : (console.error(`Failed to update event: ${e}`), l.emit("event:error", {
|
|
388
388
|
action: "update",
|
|
389
389
|
eventId: e,
|
|
390
390
|
updates: t,
|
|
@@ -392,7 +392,7 @@ class C {
|
|
|
392
392
|
}), null);
|
|
393
393
|
}
|
|
394
394
|
deleteEvent(e) {
|
|
395
|
-
return this._syncEventsFromCore({ silent: !0 }), this.calendar.removeEvent(e) ? (this._syncEventsFromCore(),
|
|
395
|
+
return this._syncEventsFromCore({ silent: !0 }), this.calendar.removeEvent(e) ? (this._syncEventsFromCore(), l.emit("event:remove", { eventId: e }), l.emit("event:deleted", { eventId: e }), !0) : (console.error(`Failed to delete event: ${e}`), l.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1);
|
|
396
396
|
}
|
|
397
397
|
getEvents() {
|
|
398
398
|
return this.calendar.getEvents() || [];
|
|
@@ -421,11 +421,11 @@ class C {
|
|
|
421
421
|
if (t.weeks && (t.weeks = t.weeks.map((s) => ({
|
|
422
422
|
...s,
|
|
423
423
|
days: s.days.map((n) => {
|
|
424
|
-
const
|
|
424
|
+
const o = new Date(n.date);
|
|
425
425
|
return {
|
|
426
426
|
...n,
|
|
427
|
-
isSelected:
|
|
428
|
-
events: n.events || this.getEventsForDate(
|
|
427
|
+
isSelected: o.toDateString() === r,
|
|
428
|
+
events: n.events || this.getEventsForDate(o)
|
|
429
429
|
};
|
|
430
430
|
})
|
|
431
431
|
}))), t.days && (t.days = t.days.map((s) => {
|
|
@@ -443,20 +443,20 @@ class C {
|
|
|
443
443
|
}
|
|
444
444
|
// Selection management
|
|
445
445
|
selectEvent(e) {
|
|
446
|
-
this.setState({ selectedEvent: e }),
|
|
446
|
+
this.setState({ selectedEvent: e }), l.emit("event:selected", { event: e });
|
|
447
447
|
}
|
|
448
448
|
selectEventById(e) {
|
|
449
449
|
const t = this.state.events.find((r) => r.id === e);
|
|
450
450
|
t && this.selectEvent(t);
|
|
451
451
|
}
|
|
452
452
|
deselectEvent() {
|
|
453
|
-
this.setState({ selectedEvent: null }),
|
|
453
|
+
this.setState({ selectedEvent: null }), l.emit("event:deselected", {});
|
|
454
454
|
}
|
|
455
455
|
selectDate(e) {
|
|
456
|
-
this.setState({ selectedDate: e }),
|
|
456
|
+
this.setState({ selectedDate: e }), l.emit("date:selected", { date: e });
|
|
457
457
|
}
|
|
458
458
|
deselectDate() {
|
|
459
|
-
this.setState({ selectedDate: null }),
|
|
459
|
+
this.setState({ selectedDate: null }), l.emit("date:deselected", {});
|
|
460
460
|
}
|
|
461
461
|
// Utility methods
|
|
462
462
|
isToday(e) {
|
|
@@ -476,7 +476,7 @@ class C {
|
|
|
476
476
|
}
|
|
477
477
|
// Error handling
|
|
478
478
|
setError(e) {
|
|
479
|
-
this.setState({ error: e }), e &&
|
|
479
|
+
this.setState({ error: e }), e && l.emit("error", { error: e });
|
|
480
480
|
}
|
|
481
481
|
clearError() {
|
|
482
482
|
this.setState({ error: null });
|
|
@@ -490,7 +490,7 @@ class C {
|
|
|
490
490
|
this.subscribers.clear(), this._subscriberIds && (this._subscriberIds.clear(), this._subscriberIds = null), this.state = null, this.calendar = null;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
class g extends
|
|
493
|
+
class g extends L {
|
|
494
494
|
/**
|
|
495
495
|
* Format date for display
|
|
496
496
|
*/
|
|
@@ -552,8 +552,8 @@ class g extends T {
|
|
|
552
552
|
* Get relative time string (e.g., "2 hours ago", "in 3 days")
|
|
553
553
|
*/
|
|
554
554
|
static getRelativeTime(e, t = /* @__PURE__ */ new Date(), r = "en-US") {
|
|
555
|
-
const i = new Intl.RelativeTimeFormat(r, { numeric: "auto" }), s = e - t, n = Math.floor(s / 1e3),
|
|
556
|
-
return Math.abs(n) < 60 ? i.format(n, "second") : Math.abs(
|
|
555
|
+
const i = new Intl.RelativeTimeFormat(r, { numeric: "auto" }), s = e - t, n = Math.floor(s / 1e3), o = Math.floor(n / 60), a = Math.floor(o / 60), c = Math.floor(a / 24), d = Math.floor(c / 7), h = Math.floor(c / 30), u = Math.floor(c / 365);
|
|
556
|
+
return Math.abs(n) < 60 ? i.format(n, "second") : Math.abs(o) < 60 ? i.format(o, "minute") : Math.abs(a) < 24 ? i.format(a, "hour") : Math.abs(c) < 7 ? i.format(c, "day") : Math.abs(d) < 4 ? i.format(d, "week") : Math.abs(h) < 12 ? i.format(h, "month") : i.format(u, "year");
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
559
559
|
* Check if date is today
|
|
@@ -599,12 +599,12 @@ class g extends T {
|
|
|
599
599
|
* Parse time string (e.g., "14:30" or "2:30 PM")
|
|
600
600
|
*/
|
|
601
601
|
static parseTimeString(e, t = /* @__PURE__ */ new Date()) {
|
|
602
|
-
const r = new Date(t), [i, s] = e.split(/\s+/), [n,
|
|
603
|
-
let
|
|
604
|
-
return s && (s.toLowerCase() === "pm" && n < 12 ?
|
|
602
|
+
const r = new Date(t), [i, s] = e.split(/\s+/), [n, o] = i.split(":").map(Number);
|
|
603
|
+
let a = n;
|
|
604
|
+
return s && (s.toLowerCase() === "pm" && n < 12 ? a = n + 12 : s.toLowerCase() === "am" && n === 12 && (a = 0)), r.setHours(a, o || 0, 0, 0), r;
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
-
class
|
|
607
|
+
class E {
|
|
608
608
|
/**
|
|
609
609
|
* Create element with attributes and children
|
|
610
610
|
*/
|
|
@@ -618,8 +618,8 @@ class x {
|
|
|
618
618
|
else if (s.startsWith("data-"))
|
|
619
619
|
i.setAttribute(s, n);
|
|
620
620
|
else if (s.startsWith("on") && typeof n == "function") {
|
|
621
|
-
const
|
|
622
|
-
i.addEventListener(
|
|
621
|
+
const o = s.slice(2).toLowerCase();
|
|
622
|
+
i.addEventListener(o, n);
|
|
623
623
|
} else
|
|
624
624
|
i[s] = n;
|
|
625
625
|
}), r.forEach((s) => {
|
|
@@ -643,8 +643,8 @@ class x {
|
|
|
643
643
|
*/
|
|
644
644
|
static delegate(e, t, r, i) {
|
|
645
645
|
const s = (n) => {
|
|
646
|
-
const
|
|
647
|
-
|
|
646
|
+
const o = n.target.closest(t);
|
|
647
|
+
o && e.contains(o) && i.call(o, n);
|
|
648
648
|
};
|
|
649
649
|
return e.addEventListener(r, s), () => e.removeEventListener(r, s);
|
|
650
650
|
}
|
|
@@ -799,7 +799,7 @@ class x {
|
|
|
799
799
|
return e.addEventListener("keydown", s), r == null || r.focus(), () => e.removeEventListener("keydown", s);
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
|
-
class
|
|
802
|
+
class p {
|
|
803
803
|
/**
|
|
804
804
|
* Get CSS variable value
|
|
805
805
|
*/
|
|
@@ -967,15 +967,15 @@ class u {
|
|
|
967
967
|
* Darken color by percentage
|
|
968
968
|
*/
|
|
969
969
|
static darken(e, t) {
|
|
970
|
-
const r = parseInt(e.replace("#", ""), 16), i = Math.round(2.55 * t), s = (r >> 16) - i, n = (r >> 8 & 255) - i,
|
|
971
|
-
return "#" + (16777216 + (s < 255 ? s < 1 ? 0 : s : 255) * 65536 + (n < 255 ? n < 1 ? 0 : n : 255) * 256 + (
|
|
970
|
+
const r = parseInt(e.replace("#", ""), 16), i = Math.round(2.55 * t), s = (r >> 16) - i, n = (r >> 8 & 255) - i, o = (r & 255) - i;
|
|
971
|
+
return "#" + (16777216 + (s < 255 ? s < 1 ? 0 : s : 255) * 65536 + (n < 255 ? n < 1 ? 0 : n : 255) * 256 + (o < 255 ? o < 1 ? 0 : o : 255)).toString(16).slice(1);
|
|
972
972
|
}
|
|
973
973
|
/**
|
|
974
974
|
* Lighten color by percentage
|
|
975
975
|
*/
|
|
976
976
|
static lighten(e, t) {
|
|
977
|
-
const r = parseInt(e.replace("#", ""), 16), i = Math.round(2.55 * t), s = (r >> 16) + i, n = (r >> 8 & 255) + i,
|
|
978
|
-
return "#" + (16777216 + (s < 255 ? s < 1 ? 0 : s : 255) * 65536 + (n < 255 ? n < 1 ? 0 : n : 255) * 256 + (
|
|
977
|
+
const r = parseInt(e.replace("#", ""), 16), i = Math.round(2.55 * t), s = (r >> 16) + i, n = (r >> 8 & 255) + i, o = (r & 255) + i;
|
|
978
|
+
return "#" + (16777216 + (s < 255 ? s < 1 ? 0 : s : 255) * 65536 + (n < 255 ? n < 1 ? 0 : n : 255) * 256 + (o < 255 ? o < 1 ? 0 : o : 255)).toString(16).slice(1);
|
|
979
979
|
}
|
|
980
980
|
/**
|
|
981
981
|
* Get contrast color (black or white) for background
|
|
@@ -1136,7 +1136,7 @@ class u {
|
|
|
1136
1136
|
/**
|
|
1137
1137
|
* Default theme colors
|
|
1138
1138
|
*/
|
|
1139
|
-
v(
|
|
1139
|
+
v(p, "colors", {
|
|
1140
1140
|
primary: "#3B82F6",
|
|
1141
1141
|
// Modern Blue
|
|
1142
1142
|
secondary: "#64748B",
|
|
@@ -1169,7 +1169,7 @@ v(u, "colors", {
|
|
|
1169
1169
|
}), /**
|
|
1170
1170
|
* Common CSS variables
|
|
1171
1171
|
*/
|
|
1172
|
-
v(
|
|
1172
|
+
v(p, "cssVariables", {
|
|
1173
1173
|
// "Pro" Palette - Functional & Sharp
|
|
1174
1174
|
"--fc-primary-color": "#2563EB",
|
|
1175
1175
|
// International Blue (Focus)
|
|
@@ -1237,7 +1237,7 @@ v(u, "cssVariables", {
|
|
|
1237
1237
|
}), /**
|
|
1238
1238
|
* Get responsive breakpoints
|
|
1239
1239
|
*/
|
|
1240
|
-
v(
|
|
1240
|
+
v(p, "breakpoints", {
|
|
1241
1241
|
xs: "320px",
|
|
1242
1242
|
sm: "576px",
|
|
1243
1243
|
md: "768px",
|
|
@@ -1245,7 +1245,7 @@ v(u, "breakpoints", {
|
|
|
1245
1245
|
xl: "1200px",
|
|
1246
1246
|
"2xl": "1400px"
|
|
1247
1247
|
});
|
|
1248
|
-
class
|
|
1248
|
+
class _ {
|
|
1249
1249
|
/**
|
|
1250
1250
|
* @param {HTMLElement} container - The DOM element to render into
|
|
1251
1251
|
* @param {StateManager} stateManager - The state manager instance
|
|
@@ -1284,7 +1284,7 @@ class w {
|
|
|
1284
1284
|
* @returns {string}
|
|
1285
1285
|
*/
|
|
1286
1286
|
escapeHTML(e) {
|
|
1287
|
-
return e == null ? "" :
|
|
1287
|
+
return e == null ? "" : E.escapeHTML(String(e));
|
|
1288
1288
|
}
|
|
1289
1289
|
/**
|
|
1290
1290
|
* Check if a date is today
|
|
@@ -1336,8 +1336,8 @@ class w {
|
|
|
1336
1336
|
const r = t.length === 3 ? t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, i = parseInt(r.substring(0, 2), 16), s = parseInt(r.substring(2, 4), 16), n = parseInt(r.substring(4, 6), 16);
|
|
1337
1337
|
if (isNaN(i) || isNaN(s) || isNaN(n))
|
|
1338
1338
|
return "white";
|
|
1339
|
-
const
|
|
1340
|
-
return 0.2126 *
|
|
1339
|
+
const a = [i / 255, s / 255, n / 255].map((d) => d <= 0.03928 ? d / 12.92 : Math.pow((d + 0.055) / 1.055, 2.4));
|
|
1340
|
+
return 0.2126 * a[0] + 0.7152 * a[1] + 0.0722 * a[2] > 0.179 ? "black" : "white";
|
|
1341
1341
|
}
|
|
1342
1342
|
/**
|
|
1343
1343
|
* Render the "now" indicator line for time-based views
|
|
@@ -1347,20 +1347,64 @@ class w {
|
|
|
1347
1347
|
const e = /* @__PURE__ */ new Date();
|
|
1348
1348
|
return `<div class="fc-now-indicator" style="position: absolute; left: 0; right: 0; top: ${e.getHours() * 60 + e.getMinutes()}px; height: 2px; background: #dc2626; z-index: 15; pointer-events: none;"></div>`;
|
|
1349
1349
|
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Compute overlap layout columns for a list of timed events.
|
|
1352
|
+
* Returns a Map of event.id -> { column, totalColumns }.
|
|
1353
|
+
* Uses a greedy left-to-right column packing algorithm.
|
|
1354
|
+
* @param {Array} events - Array of event objects with start/end dates
|
|
1355
|
+
* @returns {Map<string, {column: number, totalColumns: number}>}
|
|
1356
|
+
*/
|
|
1357
|
+
computeOverlapLayout(e) {
|
|
1358
|
+
if (!e || e.length === 0) return /* @__PURE__ */ new Map();
|
|
1359
|
+
const t = e.map((a) => {
|
|
1360
|
+
const c = new Date(a.start), d = new Date(a.end), h = c.getHours() * 60 + c.getMinutes(), u = Math.max(h + 1, d.getHours() * 60 + d.getMinutes());
|
|
1361
|
+
return { id: a.id, startMin: h, endMin: u };
|
|
1362
|
+
});
|
|
1363
|
+
t.sort((a, c) => a.startMin - c.startMin || c.endMin - c.startMin - (a.endMin - a.startMin));
|
|
1364
|
+
const r = [], i = /* @__PURE__ */ new Map();
|
|
1365
|
+
for (const a of t) {
|
|
1366
|
+
let c = !1;
|
|
1367
|
+
for (let d = 0; d < r.length; d++)
|
|
1368
|
+
if (r[d] <= a.startMin) {
|
|
1369
|
+
r[d] = a.endMin, i.set(a.id, { column: d, totalColumns: 0 }), c = !0;
|
|
1370
|
+
break;
|
|
1371
|
+
}
|
|
1372
|
+
c || (i.set(a.id, { column: r.length, totalColumns: 0 }), r.push(a.endMin));
|
|
1373
|
+
}
|
|
1374
|
+
const s = [];
|
|
1375
|
+
let n = [], o = 0;
|
|
1376
|
+
for (const a of t)
|
|
1377
|
+
n.length === 0 || a.startMin < o ? (n.push(a), o = Math.max(o, a.endMin)) : (s.push(n), n = [a], o = a.endMin);
|
|
1378
|
+
n.length > 0 && s.push(n);
|
|
1379
|
+
for (const a of s) {
|
|
1380
|
+
const c = Math.max(...a.map((d) => i.get(d.id).column)) + 1;
|
|
1381
|
+
for (const d of a)
|
|
1382
|
+
i.get(d.id).totalColumns = c;
|
|
1383
|
+
}
|
|
1384
|
+
return i;
|
|
1385
|
+
}
|
|
1350
1386
|
/**
|
|
1351
1387
|
* Render a timed event block
|
|
1352
1388
|
* @param {Object} event - Event object
|
|
1353
1389
|
* @param {Object} options - Rendering options
|
|
1390
|
+
* @param {Object} options.compact - Use compact layout
|
|
1391
|
+
* @param {Object} options.overlapLayout - Map from computeOverlapLayout()
|
|
1354
1392
|
* @returns {string} HTML string
|
|
1355
1393
|
*/
|
|
1356
1394
|
renderTimedEvent(e, t = {}) {
|
|
1357
|
-
const { compact: r = !0 } = t,
|
|
1395
|
+
const { compact: r = !0, overlapLayout: i = null } = t, s = new Date(e.start), n = new Date(e.end), o = s.getHours() * 60 + s.getMinutes(), a = Math.max((n - s) / (1e3 * 60), r ? 20 : 30), c = this.getEventColor(e), d = r ? "4px 8px" : "8px 12px", h = r ? "11px" : "13px", u = r ? 2 : 12, b = r ? 2 : 24, y = r ? "4px" : "6px";
|
|
1396
|
+
let x, w;
|
|
1397
|
+
if (i && i.has(e.id)) {
|
|
1398
|
+
const { column: C, totalColumns: $ } = i.get(e.id), M = `(100% - ${u + b}px)`;
|
|
1399
|
+
x = `calc(${u}px + ${C} * ${M} / ${$})`, w = `calc(${M} / ${$})`;
|
|
1400
|
+
} else
|
|
1401
|
+
x = `${u}px`, w = `calc(100% - ${u + b}px)`;
|
|
1358
1402
|
return `
|
|
1359
1403
|
<div class="fc-event fc-timed-event" data-event-id="${this.escapeHTML(e.id)}"
|
|
1360
|
-
style="position: absolute; top: ${
|
|
1361
|
-
left: ${
|
|
1362
|
-
background-color: ${
|
|
1363
|
-
padding: ${
|
|
1404
|
+
style="position: absolute; top: ${o}px; height: ${a}px;
|
|
1405
|
+
left: ${x}; width: ${w};
|
|
1406
|
+
background-color: ${c}; border-radius: ${y};
|
|
1407
|
+
padding: ${d}; font-size: ${h};
|
|
1364
1408
|
font-weight: 500; color: white; overflow: hidden;
|
|
1365
1409
|
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
|
1366
1410
|
cursor: pointer; z-index: 5;">
|
|
@@ -1368,7 +1412,7 @@ class w {
|
|
|
1368
1412
|
${this.escapeHTML(e.title)}
|
|
1369
1413
|
</div>
|
|
1370
1414
|
<div style="font-size: ${r ? "10px" : "11px"}; opacity: 0.9;">
|
|
1371
|
-
${this.formatTime(
|
|
1415
|
+
${this.formatTime(s)}${r ? "" : " - " + this.formatTime(n)}
|
|
1372
1416
|
</div>
|
|
1373
1417
|
</div>
|
|
1374
1418
|
`;
|
|
@@ -1379,7 +1423,7 @@ class w {
|
|
|
1379
1423
|
* @returns {string}
|
|
1380
1424
|
*/
|
|
1381
1425
|
getEventColor(e) {
|
|
1382
|
-
return
|
|
1426
|
+
return p.sanitizeColor(e == null ? void 0 : e.backgroundColor, "#2563eb");
|
|
1383
1427
|
}
|
|
1384
1428
|
/**
|
|
1385
1429
|
* Attach common event handlers for day/event clicks
|
|
@@ -1394,7 +1438,7 @@ class w {
|
|
|
1394
1438
|
});
|
|
1395
1439
|
}
|
|
1396
1440
|
}
|
|
1397
|
-
class m extends
|
|
1441
|
+
class m extends _ {
|
|
1398
1442
|
constructor(e, t) {
|
|
1399
1443
|
super(e, t), this.maxEventsToShow = 3;
|
|
1400
1444
|
}
|
|
@@ -1437,7 +1481,7 @@ class m extends w {
|
|
|
1437
1481
|
}), t += "</div>", t;
|
|
1438
1482
|
}
|
|
1439
1483
|
_renderDay(e) {
|
|
1440
|
-
const t = !e.isCurrentMonth, r = e.isToday, i = t ? "#f3f4f6" : "#fff", s = t ? "#9ca3af" : "#111827", n = r ? "background: #2563eb; color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;" : "",
|
|
1484
|
+
const t = !e.isCurrentMonth, r = e.isToday, i = t ? "#f3f4f6" : "#fff", s = t ? "#9ca3af" : "#111827", n = r ? "background: #2563eb; color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;" : "", o = e.events || [], a = o.slice(0, this.maxEventsToShow), c = o.length - this.maxEventsToShow;
|
|
1441
1485
|
return `
|
|
1442
1486
|
<div class="fc-month-day" data-date="${e.date}"
|
|
1443
1487
|
style="background: ${i}; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 4px; min-height: 80px; cursor: pointer; display: flex; flex-direction: column;">
|
|
@@ -1445,7 +1489,7 @@ class m extends w {
|
|
|
1445
1489
|
${e.dayOfMonth}
|
|
1446
1490
|
</div>
|
|
1447
1491
|
<div class="fc-day-events" style="display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: hidden;">
|
|
1448
|
-
${
|
|
1492
|
+
${a.map((d) => this._renderEvent(d)).join("")}
|
|
1449
1493
|
${c > 0 ? `<div class="fc-more-events" style="font-size: 10px; color: #6b7280; padding: 2px 4px; font-weight: 500;">+${c} more</div>` : ""}
|
|
1450
1494
|
</div>
|
|
1451
1495
|
</div>
|
|
@@ -1469,7 +1513,7 @@ class m extends w {
|
|
|
1469
1513
|
}), this.attachCommonEventHandlers();
|
|
1470
1514
|
}
|
|
1471
1515
|
}
|
|
1472
|
-
class
|
|
1516
|
+
class D extends _ {
|
|
1473
1517
|
constructor(e, t) {
|
|
1474
1518
|
super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1475
1519
|
}
|
|
@@ -1480,21 +1524,21 @@ class b extends w {
|
|
|
1480
1524
|
this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">No data available for week view.</div>';
|
|
1481
1525
|
return;
|
|
1482
1526
|
}
|
|
1483
|
-
this.cleanup();
|
|
1527
|
+
this.cleanup(), this._scrolled = !1;
|
|
1484
1528
|
const t = this.stateManager.getState().config, r = this._renderWeekView(e, t);
|
|
1485
1529
|
this.container.innerHTML = r, this._attachEventHandlers(), this._scrollToCurrentTime();
|
|
1486
1530
|
}
|
|
1487
1531
|
_renderWeekView(e, t) {
|
|
1488
|
-
const r = e.days, i = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], s = Array.from({ length: 24 }, (
|
|
1489
|
-
const
|
|
1532
|
+
const r = e.days, i = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], s = Array.from({ length: 24 }, (o, a) => a), n = r.map((o) => {
|
|
1533
|
+
const a = new Date(o.date), c = o.events || [];
|
|
1490
1534
|
return {
|
|
1491
|
-
...
|
|
1492
|
-
date:
|
|
1493
|
-
dayName: i[
|
|
1494
|
-
dayOfMonth:
|
|
1495
|
-
isToday: this.isToday(
|
|
1496
|
-
timedEvents: c.filter((
|
|
1497
|
-
allDayEvents: c.filter((
|
|
1535
|
+
...o,
|
|
1536
|
+
date: a,
|
|
1537
|
+
dayName: i[a.getDay()],
|
|
1538
|
+
dayOfMonth: a.getDate(),
|
|
1539
|
+
isToday: this.isToday(a),
|
|
1540
|
+
timedEvents: c.filter((d) => !d.allDay),
|
|
1541
|
+
allDayEvents: c.filter((d) => d.allDay)
|
|
1498
1542
|
};
|
|
1499
1543
|
});
|
|
1500
1544
|
return `
|
|
@@ -1580,7 +1624,10 @@ class b extends w {
|
|
|
1580
1624
|
${e.isToday ? this.renderNowIndicator() : ""}
|
|
1581
1625
|
|
|
1582
1626
|
<!-- Timed events -->
|
|
1583
|
-
${
|
|
1627
|
+
${(() => {
|
|
1628
|
+
const r = this.computeOverlapLayout(e.timedEvents);
|
|
1629
|
+
return e.timedEvents.map((i) => this.renderTimedEvent(i, { compact: !0, overlapLayout: r })).join("");
|
|
1630
|
+
})()}
|
|
1584
1631
|
</div>
|
|
1585
1632
|
`;
|
|
1586
1633
|
}
|
|
@@ -1588,10 +1635,10 @@ class b extends w {
|
|
|
1588
1635
|
this.addListener(this.container, "click", (e) => {
|
|
1589
1636
|
const t = e.target.closest(".fc-week-day-column");
|
|
1590
1637
|
if (!t || !this.container.contains(t) || e.target.closest(".fc-event")) return;
|
|
1591
|
-
const r = new Date(t.dataset.date), i = this.container.querySelector("#week-scroll-container"), s = t.offsetTop, n = e.clientY - t.getBoundingClientRect().top + (i ? i.scrollTop : 0) - s,
|
|
1638
|
+
const r = new Date(t.dataset.date), i = this.container.querySelector("#week-scroll-container"), s = t.offsetTop, n = e.clientY - t.getBoundingClientRect().top + (i ? i.scrollTop : 0) - s, o = Math.max(0, Math.min(n + s, this.totalHeight));
|
|
1592
1639
|
r.setHours(
|
|
1593
|
-
Math.floor(
|
|
1594
|
-
Math.floor(
|
|
1640
|
+
Math.floor(o / this.hourHeight),
|
|
1641
|
+
Math.floor(o % this.hourHeight / (this.hourHeight / 60)),
|
|
1595
1642
|
0,
|
|
1596
1643
|
0
|
|
1597
1644
|
), this.stateManager.selectDate(r);
|
|
@@ -1603,7 +1650,7 @@ class b extends w {
|
|
|
1603
1650
|
e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1604
1651
|
}
|
|
1605
1652
|
}
|
|
1606
|
-
class
|
|
1653
|
+
class k extends _ {
|
|
1607
1654
|
constructor(e, t) {
|
|
1608
1655
|
super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1609
1656
|
}
|
|
@@ -1614,45 +1661,45 @@ class y extends w {
|
|
|
1614
1661
|
this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">No data available for day view.</div>';
|
|
1615
1662
|
return;
|
|
1616
1663
|
}
|
|
1617
|
-
this.cleanup();
|
|
1664
|
+
this.cleanup(), this._scrolled = !1;
|
|
1618
1665
|
const t = this.stateManager.getState().config, r = this._renderDayView(e, t);
|
|
1619
1666
|
this.container.innerHTML = r, this._attachEventHandlers(), this._scrollToCurrentTime();
|
|
1620
1667
|
}
|
|
1621
1668
|
_renderDayView(e, t) {
|
|
1622
|
-
var
|
|
1623
|
-
const r = ((
|
|
1669
|
+
var h, u;
|
|
1670
|
+
const r = ((u = (h = this.stateManager) == null ? void 0 : h.getState()) == null ? void 0 : u.currentDate) || /* @__PURE__ */ new Date(), i = this._extractDayData(e, r);
|
|
1624
1671
|
if (!i)
|
|
1625
1672
|
return '<div style="padding: 20px; text-align: center; color: #666;">No data available for day view.</div>';
|
|
1626
|
-
const { dayDate: s, dayName: n, isToday:
|
|
1673
|
+
const { dayDate: s, dayName: n, isToday: o, allDayEvents: a, timedEvents: c } = i, d = Array.from({ length: 24 }, (b, y) => y);
|
|
1627
1674
|
return `
|
|
1628
1675
|
<div class="fc-day-view" style="display: flex; flex-direction: column; height: 100%; background: #fff; overflow: hidden;">
|
|
1629
|
-
${this._renderHeader(s, n,
|
|
1630
|
-
${this._renderAllDayRow(
|
|
1631
|
-
${this._renderTimeGrid(c,
|
|
1676
|
+
${this._renderHeader(s, n, o)}
|
|
1677
|
+
${this._renderAllDayRow(a, s)}
|
|
1678
|
+
${this._renderTimeGrid(c, o, s, d)}
|
|
1632
1679
|
</div>
|
|
1633
1680
|
`;
|
|
1634
1681
|
}
|
|
1635
1682
|
_extractDayData(e, t) {
|
|
1636
|
-
let r, i, s, n,
|
|
1637
|
-
const
|
|
1683
|
+
let r, i, s, n, o;
|
|
1684
|
+
const a = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
1638
1685
|
if (e.type === "day" && e.date)
|
|
1639
|
-
if (r = new Date(e.date), i = e.dayName ||
|
|
1686
|
+
if (r = new Date(e.date), i = e.dayName || a[r.getDay()], s = e.isToday !== void 0 ? e.isToday : this.isToday(r), n = e.allDayEvents || [], e.hours && Array.isArray(e.hours)) {
|
|
1640
1687
|
const c = /* @__PURE__ */ new Map();
|
|
1641
|
-
e.hours.forEach((
|
|
1642
|
-
(
|
|
1643
|
-
c.has(
|
|
1688
|
+
e.hours.forEach((d) => {
|
|
1689
|
+
(d.events || []).forEach((h) => {
|
|
1690
|
+
c.has(h.id) || c.set(h.id, h);
|
|
1644
1691
|
});
|
|
1645
|
-
}),
|
|
1692
|
+
}), o = Array.from(c.values());
|
|
1646
1693
|
} else
|
|
1647
|
-
|
|
1694
|
+
o = [];
|
|
1648
1695
|
else if (e.days && e.days.length > 0) {
|
|
1649
|
-
const c = e.days.find((
|
|
1650
|
-
r = new Date(c.date), i =
|
|
1651
|
-
const
|
|
1652
|
-
n =
|
|
1696
|
+
const c = e.days.find((h) => this.isSameDay(new Date(h.date), t)) || e.days[0];
|
|
1697
|
+
r = new Date(c.date), i = a[r.getDay()], s = this.isToday(r);
|
|
1698
|
+
const d = c.events || [];
|
|
1699
|
+
n = d.filter((h) => h.allDay), o = d.filter((h) => !h.allDay);
|
|
1653
1700
|
} else
|
|
1654
1701
|
return null;
|
|
1655
|
-
return { dayDate: r, dayName: i, isToday: s, allDayEvents: n, timedEvents:
|
|
1702
|
+
return { dayDate: r, dayName: i, isToday: s, allDayEvents: n, timedEvents: o };
|
|
1656
1703
|
}
|
|
1657
1704
|
_renderHeader(e, t, r) {
|
|
1658
1705
|
return `
|
|
@@ -1721,7 +1768,10 @@ class y extends w {
|
|
|
1721
1768
|
${t ? this.renderNowIndicator() : ""}
|
|
1722
1769
|
|
|
1723
1770
|
<!-- Timed events -->
|
|
1724
|
-
${
|
|
1771
|
+
${(() => {
|
|
1772
|
+
const s = this.computeOverlapLayout(e);
|
|
1773
|
+
return e.map((n) => this.renderTimedEvent(n, { compact: !1, overlapLayout: s })).join("");
|
|
1774
|
+
})()}
|
|
1725
1775
|
</div>
|
|
1726
1776
|
`;
|
|
1727
1777
|
}
|
|
@@ -1729,10 +1779,10 @@ class y extends w {
|
|
|
1729
1779
|
this.addListener(this.container, "click", (e) => {
|
|
1730
1780
|
const t = e.target.closest(".fc-day-column");
|
|
1731
1781
|
if (!t || !this.container.contains(t) || e.target.closest(".fc-event")) return;
|
|
1732
|
-
const r = new Date(t.dataset.date), i = this.container.querySelector("#day-scroll-container"), s = t.offsetTop, n = e.clientY - t.getBoundingClientRect().top + (i ? i.scrollTop : 0) - s,
|
|
1782
|
+
const r = new Date(t.dataset.date), i = this.container.querySelector("#day-scroll-container"), s = t.offsetTop, n = e.clientY - t.getBoundingClientRect().top + (i ? i.scrollTop : 0) - s, o = Math.max(0, Math.min(n + s, this.totalHeight));
|
|
1733
1783
|
r.setHours(
|
|
1734
|
-
Math.floor(
|
|
1735
|
-
Math.floor(
|
|
1784
|
+
Math.floor(o / this.hourHeight),
|
|
1785
|
+
Math.floor(o % this.hourHeight / (this.hourHeight / 60)),
|
|
1736
1786
|
0,
|
|
1737
1787
|
0
|
|
1738
1788
|
), this.stateManager.selectDate(r);
|
|
@@ -1744,7 +1794,7 @@ class y extends w {
|
|
|
1744
1794
|
e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1745
1795
|
}
|
|
1746
1796
|
}
|
|
1747
|
-
class
|
|
1797
|
+
class z extends T {
|
|
1748
1798
|
constructor() {
|
|
1749
1799
|
super(), this._isVisible = !1, this._cleanupFocusTrap = null, this.config = {
|
|
1750
1800
|
title: "New Event",
|
|
@@ -1774,8 +1824,8 @@ class F extends k {
|
|
|
1774
1824
|
}
|
|
1775
1825
|
getStyles() {
|
|
1776
1826
|
return `
|
|
1777
|
-
${
|
|
1778
|
-
${
|
|
1827
|
+
${p.getBaseStyles()}
|
|
1828
|
+
${p.getButtonStyles()}
|
|
1779
1829
|
|
|
1780
1830
|
:host {
|
|
1781
1831
|
display: none;
|
|
@@ -2020,7 +2070,7 @@ class F extends k {
|
|
|
2020
2070
|
});
|
|
2021
2071
|
}
|
|
2022
2072
|
open(e = /* @__PURE__ */ new Date()) {
|
|
2023
|
-
this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = e, this._formData.end = new Date(e.getTime() + this.config.defaultDuration * 60 * 1e3), this._formData.title = "", this._formData.color = this.config.colors[0].color, this.startInput && (this.titleInput.value = "", this.startInput.value = this.formatDateForInput(this._formData.start), this.endInput.value = this.formatDateForInput(this._formData.end), this.updateColorSelection(), this._cleanupFocusTrap && this._cleanupFocusTrap(), this._cleanupFocusTrap =
|
|
2073
|
+
this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = e, this._formData.end = new Date(e.getTime() + this.config.defaultDuration * 60 * 1e3), this._formData.title = "", this._formData.color = this.config.colors[0].color, this.startInput && (this.titleInput.value = "", this.startInput.value = this.formatDateForInput(this._formData.start), this.endInput.value = this.formatDateForInput(this._formData.end), this.updateColorSelection(), this._cleanupFocusTrap && this._cleanupFocusTrap(), this._cleanupFocusTrap = E.trapFocus(this.modalContent));
|
|
2024
2074
|
}
|
|
2025
2075
|
close() {
|
|
2026
2076
|
this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
|
|
@@ -2042,15 +2092,15 @@ class F extends k {
|
|
|
2042
2092
|
this.emit("save", e), this.close();
|
|
2043
2093
|
}
|
|
2044
2094
|
formatDateForInput(e) {
|
|
2045
|
-
const t = (
|
|
2046
|
-
return `${r}-${i}-${s}T${n}:${
|
|
2095
|
+
const t = (a) => String(a).padStart(2, "0"), r = e.getFullYear(), i = t(e.getMonth() + 1), s = t(e.getDate()), n = t(e.getHours()), o = t(e.getMinutes());
|
|
2096
|
+
return `${r}-${i}-${s}T${n}:${o}`;
|
|
2047
2097
|
}
|
|
2048
2098
|
unmount() {
|
|
2049
2099
|
this._cleanupFocusTrap && this._cleanupFocusTrap(), this._handleKeyDown && (window.removeEventListener("keydown", this._handleKeyDown), this._handleKeyDown = null, this._keydownListenerAdded = !1);
|
|
2050
2100
|
}
|
|
2051
2101
|
}
|
|
2052
|
-
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form",
|
|
2053
|
-
class
|
|
2102
|
+
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", z);
|
|
2103
|
+
class A extends T {
|
|
2054
2104
|
static get observedAttributes() {
|
|
2055
2105
|
return ["view", "date", "locale", "timezone", "week-starts-on", "height"];
|
|
2056
2106
|
}
|
|
@@ -2065,15 +2115,15 @@ class H extends k {
|
|
|
2065
2115
|
timeZone: this.getAttribute("timezone") || Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
2066
2116
|
weekStartsOn: parseInt(this.getAttribute("week-starts-on") || "0")
|
|
2067
2117
|
};
|
|
2068
|
-
this.stateManager = new
|
|
2118
|
+
this.stateManager = new I(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
|
|
2069
2119
|
}
|
|
2070
2120
|
setupEventListeners() {
|
|
2071
2121
|
this._busUnsubscribers.forEach((t) => t()), this._busUnsubscribers = [], this._busUnsubscribers.push(
|
|
2072
|
-
|
|
2122
|
+
l.on("navigation:*", (t, r) => {
|
|
2073
2123
|
this.emit("calendar-navigate", { action: r.split(":")[1], ...t });
|
|
2074
2124
|
})
|
|
2075
2125
|
), this._busUnsubscribers.push(
|
|
2076
|
-
|
|
2126
|
+
l.on("view:changed", (t) => {
|
|
2077
2127
|
this.emit("calendar-view-change", t);
|
|
2078
2128
|
})
|
|
2079
2129
|
);
|
|
@@ -2081,40 +2131,40 @@ class H extends k {
|
|
|
2081
2131
|
this.emit(`calendar-event-${t}`, r);
|
|
2082
2132
|
};
|
|
2083
2133
|
this._busUnsubscribers.push(
|
|
2084
|
-
|
|
2134
|
+
l.on("event:add", (t) => {
|
|
2085
2135
|
e("add", t);
|
|
2086
2136
|
})
|
|
2087
2137
|
), this._busUnsubscribers.push(
|
|
2088
|
-
|
|
2138
|
+
l.on("event:update", (t) => {
|
|
2089
2139
|
e("update", t);
|
|
2090
2140
|
})
|
|
2091
2141
|
), this._busUnsubscribers.push(
|
|
2092
|
-
|
|
2142
|
+
l.on("event:remove", (t) => {
|
|
2093
2143
|
e("remove", t);
|
|
2094
2144
|
})
|
|
2095
2145
|
), this._busUnsubscribers.push(
|
|
2096
|
-
|
|
2146
|
+
l.on("event:added", (t) => {
|
|
2097
2147
|
this.emit("calendar-event-added", t);
|
|
2098
2148
|
})
|
|
2099
2149
|
), this._busUnsubscribers.push(
|
|
2100
|
-
|
|
2150
|
+
l.on("event:updated", (t) => {
|
|
2101
2151
|
this.emit("calendar-event-updated", t);
|
|
2102
2152
|
})
|
|
2103
2153
|
), this._busUnsubscribers.push(
|
|
2104
|
-
|
|
2154
|
+
l.on("event:deleted", (t) => {
|
|
2105
2155
|
this.emit("calendar-event-deleted", t);
|
|
2106
2156
|
})
|
|
2107
2157
|
), this._busUnsubscribers.push(
|
|
2108
|
-
|
|
2158
|
+
l.on("date:selected", (t) => {
|
|
2109
2159
|
this.emit("calendar-date-select", t);
|
|
2110
2160
|
})
|
|
2111
2161
|
);
|
|
2112
2162
|
}
|
|
2113
2163
|
handleStateChange(e, t) {
|
|
2114
|
-
var
|
|
2164
|
+
var a, c;
|
|
2115
2165
|
if (!this._hasRendered)
|
|
2116
2166
|
return;
|
|
2117
|
-
const r = e.view !== (t == null ? void 0 : t.view), i = ((
|
|
2167
|
+
const r = e.view !== (t == null ? void 0 : t.view), i = ((a = e.currentDate) == null ? void 0 : a.getTime()) !== ((c = t == null ? void 0 : t.currentDate) == null ? void 0 : c.getTime()), s = e.events !== (t == null ? void 0 : t.events), n = e.loading !== (t == null ? void 0 : t.loading);
|
|
2118
2168
|
if (e.error !== (t == null ? void 0 : t.error)) {
|
|
2119
2169
|
this.render();
|
|
2120
2170
|
return;
|
|
@@ -2155,8 +2205,8 @@ class H extends k {
|
|
|
2155
2205
|
try {
|
|
2156
2206
|
const r = {
|
|
2157
2207
|
month: m,
|
|
2158
|
-
week:
|
|
2159
|
-
day:
|
|
2208
|
+
week: D,
|
|
2209
|
+
day: k
|
|
2160
2210
|
}[this.currentView] || m, i = new r(e, this.stateManager);
|
|
2161
2211
|
i._viewType = this.currentView, this._currentViewInstance = i, i.render();
|
|
2162
2212
|
} catch (t) {
|
|
@@ -2186,10 +2236,10 @@ class H extends k {
|
|
|
2186
2236
|
getStyles() {
|
|
2187
2237
|
const e = this.getAttribute("height") || "800px";
|
|
2188
2238
|
return `
|
|
2189
|
-
${
|
|
2190
|
-
${
|
|
2191
|
-
${
|
|
2192
|
-
${
|
|
2239
|
+
${p.getBaseStyles()}
|
|
2240
|
+
${p.getButtonStyles()}
|
|
2241
|
+
${p.getGridStyles()}
|
|
2242
|
+
${p.getAnimations()}
|
|
2193
2243
|
|
|
2194
2244
|
:host {
|
|
2195
2245
|
--calendar-height: ${e};
|
|
@@ -2578,7 +2628,7 @@ class H extends k {
|
|
|
2578
2628
|
return `
|
|
2579
2629
|
<div class="force-calendar">
|
|
2580
2630
|
<div class="fc-error">
|
|
2581
|
-
<p><strong>Error:</strong> ${
|
|
2631
|
+
<p><strong>Error:</strong> ${E.escapeHTML(s.message || "An error occurred")}</p>
|
|
2582
2632
|
</div>
|
|
2583
2633
|
</div>
|
|
2584
2634
|
`;
|
|
@@ -2643,8 +2693,8 @@ class H extends k {
|
|
|
2643
2693
|
try {
|
|
2644
2694
|
const s = {
|
|
2645
2695
|
month: m,
|
|
2646
|
-
week:
|
|
2647
|
-
day:
|
|
2696
|
+
week: D,
|
|
2697
|
+
day: k
|
|
2648
2698
|
}[this.currentView] || m, n = new s(e, this.stateManager);
|
|
2649
2699
|
n._viewType = this.currentView, this._currentViewInstance = n, n.render();
|
|
2650
2700
|
} catch (i) {
|
|
@@ -2678,8 +2728,8 @@ class H extends k {
|
|
|
2678
2728
|
_createViewRenderer(e) {
|
|
2679
2729
|
const r = {
|
|
2680
2730
|
month: m,
|
|
2681
|
-
week:
|
|
2682
|
-
day:
|
|
2731
|
+
week: D,
|
|
2732
|
+
day: k
|
|
2683
2733
|
}[e] || m;
|
|
2684
2734
|
return new r(null, null);
|
|
2685
2735
|
}
|
|
@@ -2766,19 +2816,19 @@ class H extends k {
|
|
|
2766
2816
|
this._busUnsubscribers.forEach((e) => e()), this._busUnsubscribers = [], this.stateManager && this.stateManager.destroy(), super.cleanup();
|
|
2767
2817
|
}
|
|
2768
2818
|
}
|
|
2769
|
-
customElements.get("forcecal-main") || customElements.define("forcecal-main",
|
|
2819
|
+
customElements.get("forcecal-main") || customElements.define("forcecal-main", A);
|
|
2770
2820
|
export {
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2821
|
+
T as BaseComponent,
|
|
2822
|
+
_ as BaseViewRenderer,
|
|
2823
|
+
E as DOMUtils,
|
|
2774
2824
|
g as DateUtils,
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2825
|
+
k as DayViewRenderer,
|
|
2826
|
+
V as EventBus,
|
|
2827
|
+
A as ForceCalendar,
|
|
2778
2828
|
m as MonthViewRenderer,
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2829
|
+
I as StateManager,
|
|
2830
|
+
p as StyleUtils,
|
|
2831
|
+
D as WeekViewRenderer,
|
|
2832
|
+
l as eventBus
|
|
2783
2833
|
};
|
|
2784
2834
|
//# sourceMappingURL=force-calendar-interface.esm.js.map
|