@forcecalendar/interface 1.0.14 → 1.0.16
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 +126 -66
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +45 -45
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +119 -32
- package/src/core/StateManager.js +48 -18
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var V = Object.defineProperty;
|
|
2
|
+
var P = (p, e, t) => e in p ? V(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t;
|
|
3
|
+
var _ = (p, e, t) => P(p, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
class $ extends HTMLElement {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(), this.attachShadow({ mode: "open" }), this._listeners = [], this._state = null, this._props = /* @__PURE__ */ new Map(), this._initialized = !1;
|
|
@@ -108,7 +108,7 @@ class $ extends HTMLElement {
|
|
|
108
108
|
this.setProp(e, s), this._initialized && this.render();
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
class
|
|
111
|
+
class U {
|
|
112
112
|
constructor() {
|
|
113
113
|
this.timezones = {
|
|
114
114
|
// UTC
|
|
@@ -691,7 +691,7 @@ class S {
|
|
|
691
691
|
E && E.clearCache(), E = null;
|
|
692
692
|
}
|
|
693
693
|
constructor() {
|
|
694
|
-
this.database = new
|
|
694
|
+
this.database = new U(), this.offsetCache = /* @__PURE__ */ new Map(), this.dstCache = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e3, this.cacheHits = 0, this.cacheMisses = 0;
|
|
695
695
|
}
|
|
696
696
|
/**
|
|
697
697
|
* Convert date from one timezone to another
|
|
@@ -976,7 +976,7 @@ class S {
|
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
|
-
class
|
|
979
|
+
class M {
|
|
980
980
|
/**
|
|
981
981
|
* Normalize event data
|
|
982
982
|
* @param {import('../../types.js').EventData} data - Raw event data
|
|
@@ -1046,7 +1046,7 @@ class T {
|
|
|
1046
1046
|
endTimeZone: f = null,
|
|
1047
1047
|
status: k = "confirmed",
|
|
1048
1048
|
visibility: b = "public",
|
|
1049
|
-
organizer:
|
|
1049
|
+
organizer: T = null,
|
|
1050
1050
|
attendees: A = [],
|
|
1051
1051
|
reminders: I = [],
|
|
1052
1052
|
category: L,
|
|
@@ -1059,7 +1059,7 @@ class T {
|
|
|
1059
1059
|
...B
|
|
1060
1060
|
// Capture any extra properties
|
|
1061
1061
|
}) {
|
|
1062
|
-
const m =
|
|
1062
|
+
const m = M.normalize({
|
|
1063
1063
|
id: e,
|
|
1064
1064
|
title: t,
|
|
1065
1065
|
start: s,
|
|
@@ -1077,7 +1077,7 @@ class T {
|
|
|
1077
1077
|
endTimeZone: f,
|
|
1078
1078
|
status: k,
|
|
1079
1079
|
visibility: b,
|
|
1080
|
-
organizer:
|
|
1080
|
+
organizer: T,
|
|
1081
1081
|
attendees: A,
|
|
1082
1082
|
reminders: I,
|
|
1083
1083
|
category: L,
|
|
@@ -1090,7 +1090,7 @@ class T {
|
|
|
1090
1090
|
...B
|
|
1091
1091
|
// Pass any extra properties
|
|
1092
1092
|
});
|
|
1093
|
-
|
|
1093
|
+
M.validate(m), this.id = m.id, this.title = m.title, this._timezoneManager = S.getInstance(), this.timeZone = m.timeZone || this._timezoneManager.getSystemTimezone(), this.endTimeZone = m.endTimeZone || this.timeZone, this.start = m.start, this.end = m.end, this.startUTC = this._timezoneManager.toUTC(this.start, this.timeZone), this.endUTC = this._timezoneManager.toUTC(this.end, this.endTimeZone), this.allDay = m.allDay, this.description = m.description, this.location = m.location, this.color = m.color, this.backgroundColor = m.backgroundColor, this.borderColor = m.borderColor, this.textColor = m.textColor, this.recurring = m.recurring, this.recurrenceRule = m.recurrenceRule, this._originalTimeZone = m.timeZone || null, this.status = m.status, this.visibility = m.visibility, this.organizer = m.organizer, this.attendees = [...m.attendees], this.reminders = [...m.reminders], this.categories = m.categories ? [...m.categories] : [], this.attachments = [...m.attachments], this.conferenceData = m.conferenceData, this.metadata = { ...m.metadata }, this._cache = {}, this._validateAttendees(), this._validateReminders();
|
|
1094
1094
|
}
|
|
1095
1095
|
/**
|
|
1096
1096
|
* Get event duration in milliseconds
|
|
@@ -1180,7 +1180,7 @@ class T {
|
|
|
1180
1180
|
* @throws {Error} If otherEvent is not an Event instance or doesn't have start/end
|
|
1181
1181
|
*/
|
|
1182
1182
|
overlaps(e) {
|
|
1183
|
-
if (e instanceof
|
|
1183
|
+
if (e instanceof M)
|
|
1184
1184
|
return !(this.end <= e.start || this.start >= e.end);
|
|
1185
1185
|
if (e && e.start && e.end)
|
|
1186
1186
|
return !(this.end <= e.start || this.start >= e.end);
|
|
@@ -1200,7 +1200,7 @@ class T {
|
|
|
1200
1200
|
* @returns {Event} New Event instance with updated properties
|
|
1201
1201
|
*/
|
|
1202
1202
|
clone(e = {}) {
|
|
1203
|
-
return new
|
|
1203
|
+
return new M({
|
|
1204
1204
|
id: this.id,
|
|
1205
1205
|
title: this.title,
|
|
1206
1206
|
start: new Date(this.start),
|
|
@@ -1264,7 +1264,7 @@ class T {
|
|
|
1264
1264
|
* @returns {Event} New Event instance
|
|
1265
1265
|
*/
|
|
1266
1266
|
static fromObject(e) {
|
|
1267
|
-
return new
|
|
1267
|
+
return new M(e);
|
|
1268
1268
|
}
|
|
1269
1269
|
/**
|
|
1270
1270
|
* Compare events for equality
|
|
@@ -1272,7 +1272,7 @@ class T {
|
|
|
1272
1272
|
* @returns {boolean} True if events are equal
|
|
1273
1273
|
*/
|
|
1274
1274
|
equals(e) {
|
|
1275
|
-
return e instanceof
|
|
1275
|
+
return e instanceof M ? this.id === e.id && this.title === e.title && this.start.getTime() === e.start.getTime() && this.end.getTime() === e.end.getTime() && this.allDay === e.allDay && this.description === e.description && this.location === e.location && this.recurring === e.recurring && this.recurrenceRule === e.recurrenceRule && this.status === e.status : !1;
|
|
1276
1276
|
}
|
|
1277
1277
|
// ============ Attendee Management Methods ============
|
|
1278
1278
|
/**
|
|
@@ -2226,14 +2226,14 @@ class N {
|
|
|
2226
2226
|
const f = 3;
|
|
2227
2227
|
for (; d <= s && h < i; ) {
|
|
2228
2228
|
if (d >= t) {
|
|
2229
|
-
const b = new Date(d),
|
|
2229
|
+
const b = new Date(d), T = new Date(d.getTime() + o), A = l.getTimezoneOffset(b, c);
|
|
2230
2230
|
if (A !== g) {
|
|
2231
2231
|
const I = g - A;
|
|
2232
|
-
b.setMinutes(b.getMinutes() + I),
|
|
2232
|
+
b.setMinutes(b.getMinutes() + I), T.setMinutes(T.getMinutes() + I);
|
|
2233
2233
|
}
|
|
2234
2234
|
g = A, this.isException(b, n, e.id) || a.push({
|
|
2235
2235
|
start: b,
|
|
2236
|
-
end:
|
|
2236
|
+
end: T,
|
|
2237
2237
|
recurringEventId: e.id,
|
|
2238
2238
|
timezone: c,
|
|
2239
2239
|
originalStart: e.start
|
|
@@ -2446,7 +2446,7 @@ class N {
|
|
|
2446
2446
|
return r && (n = `${r === -1 ? "Last" : ["", "1st", "2nd", "3rd", "4th", "5th"][r] || `${r}th`} ${n}`), n;
|
|
2447
2447
|
}
|
|
2448
2448
|
}
|
|
2449
|
-
class
|
|
2449
|
+
class z {
|
|
2450
2450
|
/**
|
|
2451
2451
|
* Create a new LRU Cache
|
|
2452
2452
|
* @param {number} capacity - Maximum number of items in cache
|
|
@@ -2766,7 +2766,7 @@ class W {
|
|
|
2766
2766
|
enableAdaptiveMemory: !0,
|
|
2767
2767
|
// Enable adaptive memory management
|
|
2768
2768
|
...e
|
|
2769
|
-
}, this.eventCache = new
|
|
2769
|
+
}, this.eventCache = new z(this.config.cacheCapacity), this.queryCache = new z(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new z(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new j({
|
|
2770
2770
|
checkInterval: 3e4,
|
|
2771
2771
|
memoryThreshold: 0.75,
|
|
2772
2772
|
criticalThreshold: 0.9
|
|
@@ -3366,7 +3366,7 @@ class q {
|
|
|
3366
3366
|
*/
|
|
3367
3367
|
addEvent(e) {
|
|
3368
3368
|
return this.optimizer.measure("addEvent", () => {
|
|
3369
|
-
if (e instanceof
|
|
3369
|
+
if (e instanceof M || (e = new M(e)), this.events.has(e.id))
|
|
3370
3370
|
throw new Error(`Event with id ${e.id} already exists`);
|
|
3371
3371
|
return this.events.set(e.id, e), this.optimizer.cache(e.id, e, "event"), this._indexEvent(e), this.isBatchMode ? this.batchNotifications.push({
|
|
3372
3372
|
type: "add",
|
|
@@ -4516,7 +4516,7 @@ class G {
|
|
|
4516
4516
|
* @returns {import('../events/Event.js').Event} The added event
|
|
4517
4517
|
*/
|
|
4518
4518
|
addEvent(e) {
|
|
4519
|
-
!(e instanceof
|
|
4519
|
+
!(e instanceof M) && !e.timeZone && (e = { ...e, timeZone: this.config.timeZone });
|
|
4520
4520
|
const t = this.eventStore.addEvent(e);
|
|
4521
4521
|
return this._emit("eventAdd", { event: t }), t;
|
|
4522
4522
|
}
|
|
@@ -4723,13 +4723,13 @@ class G {
|
|
|
4723
4723
|
days: []
|
|
4724
4724
|
};
|
|
4725
4725
|
for (let w = 0; w < 7; w++) {
|
|
4726
|
-
const f = new Date(l), k = f.getMonth() === s, b = u.isToday(f),
|
|
4726
|
+
const f = new Date(l), k = f.getMonth() === s, b = u.isToday(f), T = f.getDay() === 0 || f.getDay() === 6;
|
|
4727
4727
|
g.days.push({
|
|
4728
4728
|
date: f,
|
|
4729
4729
|
dayOfMonth: f.getDate(),
|
|
4730
4730
|
isCurrentMonth: k,
|
|
4731
4731
|
isToday: b,
|
|
4732
|
-
isWeekend:
|
|
4732
|
+
isWeekend: T,
|
|
4733
4733
|
events: this.getEventsForDate(f)
|
|
4734
4734
|
}), l = u.addDays(l, 1);
|
|
4735
4735
|
}
|
|
@@ -5042,7 +5042,23 @@ class J {
|
|
|
5042
5042
|
loading: !1,
|
|
5043
5043
|
error: null,
|
|
5044
5044
|
config: { ...e }
|
|
5045
|
-
}, this.subscribers = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this), this.unsubscribe = this.unsubscribe.bind(this), this.setState = this.setState.bind(this);
|
|
5045
|
+
}, this.subscribers = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this), this.unsubscribe = this.unsubscribe.bind(this), this.setState = this.setState.bind(this), this._syncEventsFromCore({ silent: !0 });
|
|
5046
|
+
}
|
|
5047
|
+
/**
|
|
5048
|
+
* Sync state.events from Core calendar (single source of truth)
|
|
5049
|
+
* This ensures state.events always matches Core's event store
|
|
5050
|
+
*/
|
|
5051
|
+
_syncEventsFromCore(e = {}) {
|
|
5052
|
+
const t = this.calendar.getEvents() || [];
|
|
5053
|
+
return (this.state.events.length !== t.length || !this._eventsMatch(this.state.events, t)) && this.setState({ events: [...t] }, e), t;
|
|
5054
|
+
}
|
|
5055
|
+
/**
|
|
5056
|
+
* Check if two event arrays have the same events (by id)
|
|
5057
|
+
*/
|
|
5058
|
+
_eventsMatch(e, t) {
|
|
5059
|
+
if (e.length !== t.length) return !1;
|
|
5060
|
+
const s = new Set(e.map((i) => i.id));
|
|
5061
|
+
return t.every((i) => s.has(i.id));
|
|
5046
5062
|
}
|
|
5047
5063
|
// State management
|
|
5048
5064
|
getState() {
|
|
@@ -5108,29 +5124,25 @@ class J {
|
|
|
5108
5124
|
// Event management
|
|
5109
5125
|
addEvent(e) {
|
|
5110
5126
|
const t = this.calendar.addEvent(e);
|
|
5111
|
-
|
|
5112
|
-
return console.error("Failed to add event to calendar"), y.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null;
|
|
5113
|
-
const s = [...this.state.events, t];
|
|
5114
|
-
return this.setState({ events: s }), y.emit("event:added", { event: t }), t;
|
|
5127
|
+
return t ? (this._syncEventsFromCore(), y.emit("event:added", { event: t }), t) : (console.error("Failed to add event to calendar"), y.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null);
|
|
5115
5128
|
}
|
|
5116
5129
|
updateEvent(e, t) {
|
|
5130
|
+
this._syncEventsFromCore({ silent: !0 });
|
|
5117
5131
|
const s = this.calendar.updateEvent(e, t);
|
|
5118
|
-
|
|
5119
|
-
return console.error(`Failed to update event: ${e}`), y.emit("event:error", { action: "update", eventId: e, updates: t, error: "Event not found in calendar" }), null;
|
|
5120
|
-
const i = this.state.events.findIndex((n) => n.id === e);
|
|
5121
|
-
if (i === -1)
|
|
5122
|
-
return console.error(`Event ${e} not found in state`), y.emit("event:error", { action: "update", eventId: e, error: "Event not found in state" }), null;
|
|
5123
|
-
const r = [...this.state.events];
|
|
5124
|
-
return r[i] = s, this.setState({ events: r }), y.emit("event:updated", { event: s }), s;
|
|
5132
|
+
return s ? (this._syncEventsFromCore(), y.emit("event:updated", { event: s }), s) : (console.error(`Failed to update event: ${e}`), y.emit("event:error", { action: "update", eventId: e, updates: t, error: "Event not found in calendar" }), null);
|
|
5125
5133
|
}
|
|
5126
5134
|
deleteEvent(e) {
|
|
5127
|
-
|
|
5128
|
-
return console.error(`Failed to delete event: ${e}`), y.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1;
|
|
5129
|
-
const s = this.state.events.filter((i) => i.id !== e);
|
|
5130
|
-
return this.setState({ events: s }), y.emit("event:deleted", { eventId: e }), !0;
|
|
5135
|
+
return this._syncEventsFromCore({ silent: !0 }), this.calendar.removeEvent(e) ? (this._syncEventsFromCore(), y.emit("event:deleted", { eventId: e }), !0) : (console.error(`Failed to delete event: ${e}`), y.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1);
|
|
5131
5136
|
}
|
|
5132
5137
|
getEvents() {
|
|
5133
|
-
return this.calendar.getEvents();
|
|
5138
|
+
return this.calendar.getEvents() || [];
|
|
5139
|
+
}
|
|
5140
|
+
/**
|
|
5141
|
+
* Force sync state.events from Core calendar
|
|
5142
|
+
* Use this if you've modified events directly on the Core calendar
|
|
5143
|
+
*/
|
|
5144
|
+
syncEvents() {
|
|
5145
|
+
return this._syncEventsFromCore();
|
|
5134
5146
|
}
|
|
5135
5147
|
getEventsForDate(e) {
|
|
5136
5148
|
return this.calendar.getEventsForDate(e);
|
|
@@ -5864,7 +5876,7 @@ class v {
|
|
|
5864
5876
|
/**
|
|
5865
5877
|
* Default theme colors
|
|
5866
5878
|
*/
|
|
5867
|
-
|
|
5879
|
+
_(v, "colors", {
|
|
5868
5880
|
primary: "#3B82F6",
|
|
5869
5881
|
// Modern Blue
|
|
5870
5882
|
secondary: "#64748B",
|
|
@@ -5897,7 +5909,7 @@ z(v, "colors", {
|
|
|
5897
5909
|
}), /**
|
|
5898
5910
|
* Common CSS variables
|
|
5899
5911
|
*/
|
|
5900
|
-
|
|
5912
|
+
_(v, "cssVariables", {
|
|
5901
5913
|
// "Pro" Palette - Functional & Sharp
|
|
5902
5914
|
"--fc-primary-color": "#2563EB",
|
|
5903
5915
|
// International Blue (Focus)
|
|
@@ -5965,7 +5977,7 @@ z(v, "cssVariables", {
|
|
|
5965
5977
|
}), /**
|
|
5966
5978
|
* Get responsive breakpoints
|
|
5967
5979
|
*/
|
|
5968
|
-
|
|
5980
|
+
_(v, "breakpoints", {
|
|
5969
5981
|
xs: "320px",
|
|
5970
5982
|
sm: "576px",
|
|
5971
5983
|
md: "768px",
|
|
@@ -7403,7 +7415,7 @@ class ie extends $ {
|
|
|
7403
7415
|
return ["view", "date", "locale", "timezone", "week-starts-on", "height"];
|
|
7404
7416
|
}
|
|
7405
7417
|
constructor() {
|
|
7406
|
-
super(), this.stateManager = null, this.currentView = null;
|
|
7418
|
+
super(), this.stateManager = null, this.currentView = null, this._hasRendered = !1, this._cachedStyles = null;
|
|
7407
7419
|
}
|
|
7408
7420
|
initialize() {
|
|
7409
7421
|
const e = {
|
|
@@ -7427,7 +7439,56 @@ class ie extends $ {
|
|
|
7427
7439
|
});
|
|
7428
7440
|
}
|
|
7429
7441
|
handleStateChange(e, t) {
|
|
7430
|
-
|
|
7442
|
+
var o, c;
|
|
7443
|
+
if (!this._hasRendered)
|
|
7444
|
+
return;
|
|
7445
|
+
const s = e.view !== (t == null ? void 0 : t.view), i = ((o = e.currentDate) == null ? void 0 : o.getTime()) !== ((c = t == null ? void 0 : t.currentDate) == null ? void 0 : c.getTime()), r = e.events !== (t == null ? void 0 : t.events), n = e.loading !== (t == null ? void 0 : t.loading), a = e.error !== (t == null ? void 0 : t.error);
|
|
7446
|
+
if (n || a) {
|
|
7447
|
+
this.render();
|
|
7448
|
+
return;
|
|
7449
|
+
}
|
|
7450
|
+
s && (this.currentView = e.view), s ? (this._updateTitle(), this._updateViewButtons(), this._switchView()) : i ? (this._updateTitle(), this._updateViewContent()) : r && this._updateViewContent();
|
|
7451
|
+
}
|
|
7452
|
+
/**
|
|
7453
|
+
* Update only the title text (no DOM recreation)
|
|
7454
|
+
*/
|
|
7455
|
+
_updateTitle() {
|
|
7456
|
+
const e = this.$(".fc-title");
|
|
7457
|
+
if (e) {
|
|
7458
|
+
const t = this.stateManager.getState();
|
|
7459
|
+
e.textContent = this.getTitle(t.currentDate, t.view);
|
|
7460
|
+
}
|
|
7461
|
+
}
|
|
7462
|
+
/**
|
|
7463
|
+
* Update view button active states (no DOM recreation)
|
|
7464
|
+
*/
|
|
7465
|
+
_updateViewButtons() {
|
|
7466
|
+
const e = this.stateManager.getState();
|
|
7467
|
+
this.$$("[data-view]").forEach((t) => {
|
|
7468
|
+
const s = t.dataset.view === e.view;
|
|
7469
|
+
t.classList.toggle("active", s);
|
|
7470
|
+
});
|
|
7471
|
+
}
|
|
7472
|
+
/**
|
|
7473
|
+
* Switch to a different view type
|
|
7474
|
+
*/
|
|
7475
|
+
_switchView() {
|
|
7476
|
+
const e = this.$("#calendar-view-container");
|
|
7477
|
+
if (e) {
|
|
7478
|
+
this._currentViewInstance && this._currentViewInstance.cleanup && this._currentViewInstance.cleanup();
|
|
7479
|
+
try {
|
|
7480
|
+
const t = this._createViewRenderer(this.currentView);
|
|
7481
|
+
t && (t._viewType = this.currentView, this._currentViewInstance = t, t.stateManager = this.stateManager, t.container = e, t.render());
|
|
7482
|
+
} catch (t) {
|
|
7483
|
+
console.error("[ForceCalendar] Error switching view:", t);
|
|
7484
|
+
}
|
|
7485
|
+
}
|
|
7486
|
+
}
|
|
7487
|
+
/**
|
|
7488
|
+
* Re-render only the view content (not header)
|
|
7489
|
+
*/
|
|
7490
|
+
_updateViewContent() {
|
|
7491
|
+
this._currentViewInstance && this._currentViewInstance.render && this._currentViewInstance.render();
|
|
7431
7492
|
}
|
|
7432
7493
|
mount() {
|
|
7433
7494
|
super.mount(), this.loadView(this.stateManager.getView());
|
|
@@ -7830,7 +7891,7 @@ class ie extends $ {
|
|
|
7830
7891
|
return `
|
|
7831
7892
|
<div class="force-calendar">
|
|
7832
7893
|
<div class="fc-error">
|
|
7833
|
-
<p><strong>Error:</strong> ${r.message || "An error occurred"}</p>
|
|
7894
|
+
<p><strong>Error:</strong> ${C.escapeHTML(r.message || "An error occurred")}</p>
|
|
7834
7895
|
</div>
|
|
7835
7896
|
</div>
|
|
7836
7897
|
`;
|
|
@@ -7891,17 +7952,13 @@ class ie extends $ {
|
|
|
7891
7952
|
}
|
|
7892
7953
|
afterRender() {
|
|
7893
7954
|
const e = this.$("#calendar-view-container");
|
|
7894
|
-
if (
|
|
7895
|
-
if (this._currentViewInstance && this._currentViewInstance._viewType === this.currentView && e.children.length > 0)
|
|
7896
|
-
console.log("[ForceCalendar] View already exists with content, skipping creation");
|
|
7955
|
+
if (e && this.stateManager && this.currentView) {
|
|
7956
|
+
if (this._currentViewInstance && this._currentViewInstance._viewType === this.currentView && e.children.length > 0)
|
|
7897
7957
|
return;
|
|
7898
|
-
|
|
7899
|
-
this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe && (this._viewUnsubscribe(), this._viewUnsubscribe = null)), console.log("[ForceCalendar] Creating view for:", this.currentView);
|
|
7958
|
+
this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe && (this._viewUnsubscribe(), this._viewUnsubscribe = null));
|
|
7900
7959
|
try {
|
|
7901
7960
|
const i = this._createViewRenderer(this.currentView);
|
|
7902
|
-
i && (i._viewType = this.currentView, this._currentViewInstance = i, i.stateManager = this.stateManager, i.container = e,
|
|
7903
|
-
(r.events !== (n == null ? void 0 : n.events) || r.currentDate !== (n == null ? void 0 : n.currentDate)) && i && i.render && i.render();
|
|
7904
|
-
}));
|
|
7961
|
+
i && (i._viewType = this.currentView, this._currentViewInstance = i, i.stateManager = this.stateManager, i.container = e, i.render());
|
|
7905
7962
|
} catch (i) {
|
|
7906
7963
|
console.error("[ForceCalendar] Error creating/rendering view:", i);
|
|
7907
7964
|
}
|
|
@@ -7922,7 +7979,7 @@ class ie extends $ {
|
|
|
7922
7979
|
id: n,
|
|
7923
7980
|
...r
|
|
7924
7981
|
});
|
|
7925
|
-
});
|
|
7982
|
+
}), this._hasRendered = !0;
|
|
7926
7983
|
}
|
|
7927
7984
|
_createViewRenderer(e) {
|
|
7928
7985
|
const t = e;
|
|
@@ -7931,6 +7988,9 @@ class ie extends $ {
|
|
|
7931
7988
|
container: null,
|
|
7932
7989
|
_listeners: [],
|
|
7933
7990
|
_scrolled: !1,
|
|
7991
|
+
_escapeHTML(s) {
|
|
7992
|
+
return s == null ? "" : C.escapeHTML(String(s));
|
|
7993
|
+
},
|
|
7934
7994
|
cleanup() {
|
|
7935
7995
|
this._listeners.forEach(({ element: s, event: i, handler: r }) => {
|
|
7936
7996
|
s.removeEventListener(i, r);
|
|
@@ -7987,9 +8047,9 @@ class ie extends $ {
|
|
|
7987
8047
|
<div class="fc-month-day" data-date="${c.date}" style="background: ${h}; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 4px; min-height: 80px; cursor: pointer;">
|
|
7988
8048
|
<div class="fc-day-number" style="font-size: 13px; font-weight: 500; color: ${g}; padding: 2px 4px; margin-bottom: 4px; ${w}">${c.dayOfMonth}</div>
|
|
7989
8049
|
<div class="fc-day-events" style="display: flex; flex-direction: column; gap: 2px;">
|
|
7990
|
-
${k.map((
|
|
7991
|
-
<div class="fc-event" data-event-id="${
|
|
7992
|
-
${
|
|
8050
|
+
${k.map((T) => `
|
|
8051
|
+
<div class="fc-event" data-event-id="${this._escapeHTML(T.id)}" style="background-color: ${T.backgroundColor || "#2563eb"}; font-size: 11px; padding: 2px 6px; border-radius: 3px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;">
|
|
8052
|
+
${this._escapeHTML(T.title)}
|
|
7993
8053
|
</div>
|
|
7994
8054
|
`).join("")}
|
|
7995
8055
|
${b > 0 ? `<div class="fc-more-events" style="font-size: 10px; color: #6b7280; padding: 2px 4px; font-weight: 500;">+${b} more</div>` : ""}
|
|
@@ -8035,8 +8095,8 @@ class ie extends $ {
|
|
|
8035
8095
|
${o.map((l) => `
|
|
8036
8096
|
<div style="border-right: 1px solid #e5e7eb; padding: 4px; display: flex; flex-direction: column; gap: 2px;">
|
|
8037
8097
|
${l.allDayEvents.map((d) => `
|
|
8038
|
-
<div class="fc-event" data-event-id="${d.id}" style="background-color: ${d.backgroundColor || "#2563eb"}; font-size: 10px; padding: 2px 4px; border-radius: 2px; color: white; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
|
8039
|
-
${d.title}
|
|
8098
|
+
<div class="fc-event" data-event-id="${this._escapeHTML(d.id)}" style="background-color: ${d.backgroundColor || "#2563eb"}; font-size: 10px; padding: 2px 4px; border-radius: 2px; color: white; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
|
8099
|
+
${this._escapeHTML(d.title)}
|
|
8040
8100
|
</div>
|
|
8041
8101
|
`).join("")}
|
|
8042
8102
|
</div>
|
|
@@ -8111,8 +8171,8 @@ class ie extends $ {
|
|
|
8111
8171
|
<div style="font-size: 9px; color: #6b7280; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e5e7eb; text-transform: uppercase; font-weight: 700;">All day</div>
|
|
8112
8172
|
<div style="padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 4px;">
|
|
8113
8173
|
${c.map((f) => `
|
|
8114
|
-
<div class="fc-event" data-event-id="${f.id}" style="background-color: ${f.backgroundColor || "#2563eb"}; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: white; cursor: pointer; font-weight: 500;">
|
|
8115
|
-
${f.title}
|
|
8174
|
+
<div class="fc-event" data-event-id="${this._escapeHTML(f.id)}" style="background-color: ${f.backgroundColor || "#2563eb"}; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: white; cursor: pointer; font-weight: 500;">
|
|
8175
|
+
${this._escapeHTML(f.title)}
|
|
8116
8176
|
</div>
|
|
8117
8177
|
`).join("")}
|
|
8118
8178
|
</div>
|
|
@@ -8149,12 +8209,12 @@ class ie extends $ {
|
|
|
8149
8209
|
_renderTimedEvent(s) {
|
|
8150
8210
|
const i = new Date(s.start), r = new Date(s.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), 20), o = s.backgroundColor || "#2563eb";
|
|
8151
8211
|
return `
|
|
8152
|
-
<div class="fc-event" data-event-id="${s.id}"
|
|
8212
|
+
<div class="fc-event" data-event-id="${this._escapeHTML(s.id)}"
|
|
8153
8213
|
style="position: absolute; top: ${n}px; height: ${a}px; left: 2px; right: 2px;
|
|
8154
8214
|
background-color: ${o}; border-radius: 4px; padding: 4px 8px; font-size: 11px;
|
|
8155
8215
|
font-weight: 500; color: white; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
|
8156
8216
|
cursor: pointer; z-index: 5;">
|
|
8157
|
-
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${s.title}</div>
|
|
8217
|
+
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${this._escapeHTML(s.title)}</div>
|
|
8158
8218
|
<div style="font-size: 10px; opacity: 0.9;">${this._formatTime(i)}</div>
|
|
8159
8219
|
</div>
|
|
8160
8220
|
`;
|
|
@@ -8162,12 +8222,12 @@ class ie extends $ {
|
|
|
8162
8222
|
_renderTimedEventDay(s) {
|
|
8163
8223
|
const i = new Date(s.start), r = new Date(s.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), 30), o = s.backgroundColor || "#2563eb";
|
|
8164
8224
|
return `
|
|
8165
|
-
<div class="fc-event" data-event-id="${s.id}"
|
|
8225
|
+
<div class="fc-event" data-event-id="${this._escapeHTML(s.id)}"
|
|
8166
8226
|
style="position: absolute; top: ${n}px; height: ${a}px; left: 12px; right: 24px;
|
|
8167
8227
|
background-color: ${o}; border-radius: 6px; padding: 8px 12px; font-size: 13px;
|
|
8168
8228
|
font-weight: 500; color: white; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
8169
8229
|
cursor: pointer; z-index: 5;">
|
|
8170
|
-
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${s.title}</div>
|
|
8230
|
+
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${this._escapeHTML(s.title)}</div>
|
|
8171
8231
|
<div style="font-size: 11px; opacity: 0.9;">${this._formatTime(i)} - ${this._formatTime(r)}</div>
|
|
8172
8232
|
</div>
|
|
8173
8233
|
`;
|