@forcecalendar/interface 1.0.23 → 1.0.25
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 +75 -53
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +14 -14
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +25 -3
- package/src/core/StateManager.js +4 -1
- package/src/renderers/BaseViewRenderer.js +10 -1
- package/src/renderers/DayViewRenderer.js +1 -1
- package/src/renderers/MonthViewRenderer.js +1 -1
- package/src/renderers/WeekViewRenderer.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var W = Object.defineProperty;
|
|
2
|
-
var j = (
|
|
3
|
-
var I = (
|
|
2
|
+
var j = (g, e, t) => e in g ? W(g, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[e] = t;
|
|
3
|
+
var I = (g, e, t) => j(g, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
class O 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;
|
|
@@ -1046,7 +1046,7 @@ class w {
|
|
|
1046
1046
|
// Backward-compatible alias for recurrenceRule
|
|
1047
1047
|
timeZone: v = null,
|
|
1048
1048
|
endTimeZone: M = null,
|
|
1049
|
-
status:
|
|
1049
|
+
status: x = "confirmed",
|
|
1050
1050
|
visibility: T = "public",
|
|
1051
1051
|
organizer: A = null,
|
|
1052
1052
|
attendees: _ = [],
|
|
@@ -1061,7 +1061,7 @@ class w {
|
|
|
1061
1061
|
...V
|
|
1062
1062
|
// Capture any extra properties
|
|
1063
1063
|
}) {
|
|
1064
|
-
const
|
|
1064
|
+
const m = w.normalize({
|
|
1065
1065
|
id: e,
|
|
1066
1066
|
title: t,
|
|
1067
1067
|
start: s,
|
|
@@ -1078,7 +1078,7 @@ class w {
|
|
|
1078
1078
|
recurrence: b,
|
|
1079
1079
|
timeZone: v,
|
|
1080
1080
|
endTimeZone: M,
|
|
1081
|
-
status:
|
|
1081
|
+
status: x,
|
|
1082
1082
|
visibility: T,
|
|
1083
1083
|
organizer: A,
|
|
1084
1084
|
attendees: _,
|
|
@@ -1093,7 +1093,7 @@ class w {
|
|
|
1093
1093
|
...V
|
|
1094
1094
|
// Pass any extra properties
|
|
1095
1095
|
});
|
|
1096
|
-
w.validate(
|
|
1096
|
+
w.validate(m), this.id = m.id, this.title = m.title, this._timezoneManager = C.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();
|
|
1097
1097
|
}
|
|
1098
1098
|
/**
|
|
1099
1099
|
* Get event duration in milliseconds
|
|
@@ -2237,13 +2237,13 @@ class K {
|
|
|
2237
2237
|
const v = 3;
|
|
2238
2238
|
for (; h <= s && d < i; ) {
|
|
2239
2239
|
if (h >= t) {
|
|
2240
|
-
const
|
|
2240
|
+
const x = new Date(h), T = new Date(h.getTime() + o), A = l.getTimezoneOffset(x, c);
|
|
2241
2241
|
if (A !== p) {
|
|
2242
2242
|
const _ = p - A;
|
|
2243
|
-
|
|
2243
|
+
x.setMinutes(x.getMinutes() + _), T.setMinutes(T.getMinutes() + _);
|
|
2244
2244
|
}
|
|
2245
|
-
p = A, this.isException(
|
|
2246
|
-
start:
|
|
2245
|
+
p = A, this.isException(x, n, e.id) || a.push({
|
|
2246
|
+
start: x,
|
|
2247
2247
|
end: T,
|
|
2248
2248
|
recurringEventId: e.id,
|
|
2249
2249
|
timezone: c,
|
|
@@ -4749,12 +4749,12 @@ class te {
|
|
|
4749
4749
|
days: []
|
|
4750
4750
|
};
|
|
4751
4751
|
for (let b = 0; b < 7; b++) {
|
|
4752
|
-
const v = new Date(l), M = v.getMonth() === s,
|
|
4752
|
+
const v = new Date(l), M = v.getMonth() === s, x = f.isToday(v), T = v.getDay() === 0 || v.getDay() === 6;
|
|
4753
4753
|
p.days.push({
|
|
4754
4754
|
date: v,
|
|
4755
4755
|
dayOfMonth: v.getDate(),
|
|
4756
4756
|
isCurrentMonth: M,
|
|
4757
|
-
isToday:
|
|
4757
|
+
isToday: x,
|
|
4758
4758
|
isWeekend: T,
|
|
4759
4759
|
events: this.getEventsForDate(v)
|
|
4760
4760
|
}), l = f.addDays(l, 1);
|
|
@@ -5093,7 +5093,7 @@ class se {
|
|
|
5093
5093
|
return e;
|
|
5094
5094
|
}
|
|
5095
5095
|
}
|
|
5096
|
-
const
|
|
5096
|
+
const u = new se();
|
|
5097
5097
|
class ie {
|
|
5098
5098
|
constructor(e = {}) {
|
|
5099
5099
|
this.calendar = new te({
|
|
@@ -5173,51 +5173,51 @@ class ie {
|
|
|
5173
5173
|
(i) => e[i] !== t[i]
|
|
5174
5174
|
);
|
|
5175
5175
|
s.forEach((i) => {
|
|
5176
|
-
|
|
5176
|
+
u.emit(`state:${i}:changed`, {
|
|
5177
5177
|
oldValue: e[i],
|
|
5178
5178
|
newValue: t[i],
|
|
5179
5179
|
state: t
|
|
5180
5180
|
});
|
|
5181
|
-
}), s.length > 0 &&
|
|
5181
|
+
}), s.length > 0 && u.emit("state:changed", { oldState: e, newState: t, changedKeys: s });
|
|
5182
5182
|
}
|
|
5183
5183
|
// Calendar operations
|
|
5184
5184
|
setView(e) {
|
|
5185
|
-
this.calendar.setView(e), this.setState({ view: e }),
|
|
5185
|
+
this.calendar.setView(e), this.setState({ view: e }), u.emit("view:changed", { view: e });
|
|
5186
5186
|
}
|
|
5187
5187
|
getView() {
|
|
5188
5188
|
return this.state.view;
|
|
5189
5189
|
}
|
|
5190
5190
|
setDate(e) {
|
|
5191
|
-
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
5191
|
+
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), u.emit("date:changed", { date: this.state.currentDate });
|
|
5192
5192
|
}
|
|
5193
5193
|
getCurrentDate() {
|
|
5194
5194
|
return this.state.currentDate;
|
|
5195
5195
|
}
|
|
5196
5196
|
// Navigation
|
|
5197
5197
|
next() {
|
|
5198
|
-
this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
5198
|
+
this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }), u.emit("navigation:next", { date: this.state.currentDate });
|
|
5199
5199
|
}
|
|
5200
5200
|
previous() {
|
|
5201
|
-
this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
5201
|
+
this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), u.emit("navigation:previous", { date: this.state.currentDate });
|
|
5202
5202
|
}
|
|
5203
5203
|
today() {
|
|
5204
|
-
this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
5204
|
+
this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), u.emit("navigation:today", { date: this.state.currentDate });
|
|
5205
5205
|
}
|
|
5206
5206
|
goToDate(e) {
|
|
5207
|
-
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
5207
|
+
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), u.emit("navigation:goto", { date: this.state.currentDate });
|
|
5208
5208
|
}
|
|
5209
5209
|
// Event management
|
|
5210
5210
|
addEvent(e) {
|
|
5211
5211
|
const t = this.calendar.addEvent(e);
|
|
5212
|
-
return t ? (this._syncEventsFromCore(),
|
|
5212
|
+
return t ? (this._syncEventsFromCore(), u.emit("event:add", { event: t }), u.emit("event:added", { event: t }), t) : (console.error("Failed to add event to calendar"), u.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null);
|
|
5213
5213
|
}
|
|
5214
5214
|
updateEvent(e, t) {
|
|
5215
5215
|
this._syncEventsFromCore({ silent: !0 });
|
|
5216
5216
|
const s = this.calendar.updateEvent(e, t);
|
|
5217
|
-
return s ? (this._syncEventsFromCore(),
|
|
5217
|
+
return s ? (this._syncEventsFromCore(), u.emit("event:update", { event: s }), u.emit("event:updated", { event: s }), s) : (console.error(`Failed to update event: ${e}`), u.emit("event:error", { action: "update", eventId: e, updates: t, error: "Event not found in calendar" }), null);
|
|
5218
5218
|
}
|
|
5219
5219
|
deleteEvent(e) {
|
|
5220
|
-
return this._syncEventsFromCore({ silent: !0 }), this.calendar.removeEvent(e) ? (this._syncEventsFromCore(),
|
|
5220
|
+
return this._syncEventsFromCore({ silent: !0 }), this.calendar.removeEvent(e) ? (this._syncEventsFromCore(), u.emit("event:remove", { eventId: e }), u.emit("event:deleted", { eventId: e }), !0) : (console.error(`Failed to delete event: ${e}`), u.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1);
|
|
5221
5221
|
}
|
|
5222
5222
|
getEvents() {
|
|
5223
5223
|
return this.calendar.getEvents() || [];
|
|
@@ -5268,20 +5268,20 @@ class ie {
|
|
|
5268
5268
|
}
|
|
5269
5269
|
// Selection management
|
|
5270
5270
|
selectEvent(e) {
|
|
5271
|
-
this.setState({ selectedEvent: e }),
|
|
5271
|
+
this.setState({ selectedEvent: e }), u.emit("event:selected", { event: e });
|
|
5272
5272
|
}
|
|
5273
5273
|
selectEventById(e) {
|
|
5274
5274
|
const t = this.state.events.find((s) => s.id === e);
|
|
5275
5275
|
t && this.selectEvent(t);
|
|
5276
5276
|
}
|
|
5277
5277
|
deselectEvent() {
|
|
5278
|
-
this.setState({ selectedEvent: null }),
|
|
5278
|
+
this.setState({ selectedEvent: null }), u.emit("event:deselected", {});
|
|
5279
5279
|
}
|
|
5280
5280
|
selectDate(e) {
|
|
5281
|
-
this.setState({ selectedDate: e }),
|
|
5281
|
+
this.setState({ selectedDate: e }), u.emit("date:selected", { date: e });
|
|
5282
5282
|
}
|
|
5283
5283
|
deselectDate() {
|
|
5284
|
-
this.setState({ selectedDate: null }),
|
|
5284
|
+
this.setState({ selectedDate: null }), u.emit("date:deselected", {});
|
|
5285
5285
|
}
|
|
5286
5286
|
// Utility methods
|
|
5287
5287
|
isToday(e) {
|
|
@@ -5301,7 +5301,7 @@ class ie {
|
|
|
5301
5301
|
}
|
|
5302
5302
|
// Error handling
|
|
5303
5303
|
setError(e) {
|
|
5304
|
-
this.setState({ error: e }), e &&
|
|
5304
|
+
this.setState({ error: e }), e && u.emit("error", { error: e });
|
|
5305
5305
|
}
|
|
5306
5306
|
clearError() {
|
|
5307
5307
|
this.setState({ error: null });
|
|
@@ -5624,7 +5624,7 @@ class F {
|
|
|
5624
5624
|
return e.addEventListener("keydown", r), s == null || s.focus(), () => e.removeEventListener("keydown", r);
|
|
5625
5625
|
}
|
|
5626
5626
|
}
|
|
5627
|
-
class
|
|
5627
|
+
class D {
|
|
5628
5628
|
/**
|
|
5629
5629
|
* Get CSS variable value
|
|
5630
5630
|
*/
|
|
@@ -5961,7 +5961,7 @@ class x {
|
|
|
5961
5961
|
/**
|
|
5962
5962
|
* Default theme colors
|
|
5963
5963
|
*/
|
|
5964
|
-
I(
|
|
5964
|
+
I(D, "colors", {
|
|
5965
5965
|
primary: "#3B82F6",
|
|
5966
5966
|
// Modern Blue
|
|
5967
5967
|
secondary: "#64748B",
|
|
@@ -5994,7 +5994,7 @@ I(x, "colors", {
|
|
|
5994
5994
|
}), /**
|
|
5995
5995
|
* Common CSS variables
|
|
5996
5996
|
*/
|
|
5997
|
-
I(
|
|
5997
|
+
I(D, "cssVariables", {
|
|
5998
5998
|
// "Pro" Palette - Functional & Sharp
|
|
5999
5999
|
"--fc-primary-color": "#2563EB",
|
|
6000
6000
|
// International Blue (Focus)
|
|
@@ -6062,7 +6062,7 @@ I(x, "cssVariables", {
|
|
|
6062
6062
|
}), /**
|
|
6063
6063
|
* Get responsive breakpoints
|
|
6064
6064
|
*/
|
|
6065
|
-
I(
|
|
6065
|
+
I(D, "breakpoints", {
|
|
6066
6066
|
xs: "320px",
|
|
6067
6067
|
sm: "576px",
|
|
6068
6068
|
md: "768px",
|
|
@@ -6179,7 +6179,7 @@ class H {
|
|
|
6179
6179
|
* @returns {string} HTML string
|
|
6180
6180
|
*/
|
|
6181
6181
|
renderTimedEvent(e, t = {}) {
|
|
6182
|
-
const { compact: s = !0 } = t, i = new Date(e.start), r = new Date(e.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), s ? 20 : 30), o = e
|
|
6182
|
+
const { compact: s = !0 } = t, i = new Date(e.start), r = new Date(e.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), s ? 20 : 30), o = this.getEventColor(e), c = s ? "4px 8px" : "8px 12px", l = s ? "11px" : "13px", h = s ? "2px" : "12px", d = s ? "2px" : "24px", p = s ? "4px" : "6px";
|
|
6183
6183
|
return `
|
|
6184
6184
|
<div class="fc-event fc-timed-event" data-event-id="${this.escapeHTML(e.id)}"
|
|
6185
6185
|
style="position: absolute; top: ${n}px; height: ${a}px;
|
|
@@ -6198,6 +6198,14 @@ class H {
|
|
|
6198
6198
|
</div>
|
|
6199
6199
|
`;
|
|
6200
6200
|
}
|
|
6201
|
+
/**
|
|
6202
|
+
* Get a safe, sanitized event color value.
|
|
6203
|
+
* @param {Object} event
|
|
6204
|
+
* @returns {string}
|
|
6205
|
+
*/
|
|
6206
|
+
getEventColor(e) {
|
|
6207
|
+
return D.sanitizeColor(e == null ? void 0 : e.backgroundColor, "#2563eb");
|
|
6208
|
+
}
|
|
6201
6209
|
/**
|
|
6202
6210
|
* Attach common event handlers for day/event clicks
|
|
6203
6211
|
*/
|
|
@@ -6269,7 +6277,7 @@ class E extends H {
|
|
|
6269
6277
|
`;
|
|
6270
6278
|
}
|
|
6271
6279
|
_renderEvent(e) {
|
|
6272
|
-
const t = e
|
|
6280
|
+
const t = this.getEventColor(e);
|
|
6273
6281
|
return `
|
|
6274
6282
|
<div class="fc-event" data-event-id="${this.escapeHTML(e.id)}"
|
|
6275
6283
|
style="background-color: ${t}; font-size: 11px; padding: 2px 6px; border-radius: 3px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;">
|
|
@@ -6350,7 +6358,7 @@ class z extends H {
|
|
|
6350
6358
|
<div class="fc-all-day-cell" data-date="${t.date.toISOString()}" style="border-right: 1px solid #e5e7eb; padding: 4px; display: flex; flex-direction: column; gap: 2px;">
|
|
6351
6359
|
${t.allDayEvents.map((s) => `
|
|
6352
6360
|
<div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(s.id)}"
|
|
6353
|
-
style="background-color: ${s
|
|
6361
|
+
style="background-color: ${this.getEventColor(s)}; font-size: 10px; padding: 2px 4px; border-radius: 2px; color: white; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
|
6354
6362
|
${this.escapeHTML(s.title)}
|
|
6355
6363
|
</div>
|
|
6356
6364
|
`).join("")}
|
|
@@ -6484,7 +6492,7 @@ class L extends H {
|
|
|
6484
6492
|
<div class="fc-all-day-cell" data-date="${t.toISOString()}" style="padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 4px;">
|
|
6485
6493
|
${e.map((s) => `
|
|
6486
6494
|
<div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(s.id)}"
|
|
6487
|
-
style="background-color: ${s
|
|
6495
|
+
style="background-color: ${this.getEventColor(s)}; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: white; cursor: pointer; font-weight: 500;">
|
|
6488
6496
|
${this.escapeHTML(s.title)}
|
|
6489
6497
|
</div>
|
|
6490
6498
|
`).join("")}
|
|
@@ -6572,8 +6580,8 @@ class re extends O {
|
|
|
6572
6580
|
}
|
|
6573
6581
|
getStyles() {
|
|
6574
6582
|
return `
|
|
6575
|
-
${
|
|
6576
|
-
${
|
|
6583
|
+
${D.getBaseStyles()}
|
|
6584
|
+
${D.getButtonStyles()}
|
|
6577
6585
|
|
|
6578
6586
|
:host {
|
|
6579
6587
|
display: none;
|
|
@@ -6864,14 +6872,28 @@ class ne extends O {
|
|
|
6864
6872
|
this.stateManager = new ie(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
|
|
6865
6873
|
}
|
|
6866
6874
|
setupEventListeners() {
|
|
6867
|
-
this._busUnsubscribers.forEach((
|
|
6868
|
-
this.emit("calendar-navigate", { action:
|
|
6869
|
-
})), this._busUnsubscribers.push(
|
|
6870
|
-
this.emit("calendar-view-change",
|
|
6871
|
-
}))
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
+
this._busUnsubscribers.forEach((t) => t()), this._busUnsubscribers = [], this._busUnsubscribers.push(u.on("navigation:*", (t, s) => {
|
|
6876
|
+
this.emit("calendar-navigate", { action: s.split(":")[1], ...t });
|
|
6877
|
+
})), this._busUnsubscribers.push(u.on("view:changed", (t) => {
|
|
6878
|
+
this.emit("calendar-view-change", t);
|
|
6879
|
+
}));
|
|
6880
|
+
const e = (t, s) => {
|
|
6881
|
+
this.emit(`calendar-event-${t}`, s);
|
|
6882
|
+
};
|
|
6883
|
+
this._busUnsubscribers.push(u.on("event:add", (t) => {
|
|
6884
|
+
e("add", t);
|
|
6885
|
+
})), this._busUnsubscribers.push(u.on("event:update", (t) => {
|
|
6886
|
+
e("update", t);
|
|
6887
|
+
})), this._busUnsubscribers.push(u.on("event:remove", (t) => {
|
|
6888
|
+
e("remove", t);
|
|
6889
|
+
})), this._busUnsubscribers.push(u.on("event:added", (t) => {
|
|
6890
|
+
e("add", t), this.emit("calendar-event-added", t);
|
|
6891
|
+
})), this._busUnsubscribers.push(u.on("event:updated", (t) => {
|
|
6892
|
+
e("update", t), this.emit("calendar-event-updated", t);
|
|
6893
|
+
})), this._busUnsubscribers.push(u.on("event:deleted", (t) => {
|
|
6894
|
+
e("remove", t), this.emit("calendar-event-deleted", t);
|
|
6895
|
+
})), this._busUnsubscribers.push(u.on("date:selected", (t) => {
|
|
6896
|
+
this.emit("calendar-date-select", t);
|
|
6875
6897
|
}));
|
|
6876
6898
|
}
|
|
6877
6899
|
handleStateChange(e, t) {
|
|
@@ -6950,10 +6972,10 @@ class ne extends O {
|
|
|
6950
6972
|
getStyles() {
|
|
6951
6973
|
const e = this.getAttribute("height") || "800px";
|
|
6952
6974
|
return `
|
|
6953
|
-
${
|
|
6954
|
-
${
|
|
6955
|
-
${
|
|
6956
|
-
${
|
|
6975
|
+
${D.getBaseStyles()}
|
|
6976
|
+
${D.getButtonStyles()}
|
|
6977
|
+
${D.getGridStyles()}
|
|
6978
|
+
${D.getAnimations()}
|
|
6957
6979
|
|
|
6958
6980
|
:host {
|
|
6959
6981
|
--calendar-height: ${e};
|
|
@@ -7541,8 +7563,8 @@ export {
|
|
|
7541
7563
|
ne as ForceCalendar,
|
|
7542
7564
|
E as MonthViewRenderer,
|
|
7543
7565
|
ie as StateManager,
|
|
7544
|
-
|
|
7566
|
+
D as StyleUtils,
|
|
7545
7567
|
z as WeekViewRenderer,
|
|
7546
|
-
|
|
7568
|
+
u as eventBus
|
|
7547
7569
|
};
|
|
7548
7570
|
//# sourceMappingURL=force-calendar-interface.esm.js.map
|