@forcecalendar/interface 1.0.22 → 1.0.24
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 +73 -51
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +10 -13
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +56 -17
- package/src/core/StateManager.js +4 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var W = Object.defineProperty;
|
|
2
|
-
var j = (
|
|
3
|
-
var
|
|
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;
|
|
@@ -1049,7 +1049,7 @@ class w {
|
|
|
1049
1049
|
status: D = "confirmed",
|
|
1050
1050
|
visibility: T = "public",
|
|
1051
1051
|
organizer: A = null,
|
|
1052
|
-
attendees:
|
|
1052
|
+
attendees: _ = [],
|
|
1053
1053
|
reminders: R = [],
|
|
1054
1054
|
category: B,
|
|
1055
1055
|
// Support singular category (no default)
|
|
@@ -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,
|
|
@@ -1081,7 +1081,7 @@ class w {
|
|
|
1081
1081
|
status: D,
|
|
1082
1082
|
visibility: T,
|
|
1083
1083
|
organizer: A,
|
|
1084
|
-
attendees:
|
|
1084
|
+
attendees: _,
|
|
1085
1085
|
reminders: R,
|
|
1086
1086
|
category: B,
|
|
1087
1087
|
// Pass category to normalize
|
|
@@ -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
|
|
@@ -2239,8 +2239,8 @@ class K {
|
|
|
2239
2239
|
if (h >= t) {
|
|
2240
2240
|
const D = new Date(h), T = new Date(h.getTime() + o), A = l.getTimezoneOffset(D, c);
|
|
2241
2241
|
if (A !== p) {
|
|
2242
|
-
const
|
|
2243
|
-
D.setMinutes(D.getMinutes() +
|
|
2242
|
+
const _ = p - A;
|
|
2243
|
+
D.setMinutes(D.getMinutes() + _), T.setMinutes(T.getMinutes() + _);
|
|
2244
2244
|
}
|
|
2245
2245
|
p = A, this.isException(D, n, e.id) || a.push({
|
|
2246
2246
|
start: D,
|
|
@@ -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 });
|
|
@@ -5961,7 +5961,7 @@ class x {
|
|
|
5961
5961
|
/**
|
|
5962
5962
|
* Default theme colors
|
|
5963
5963
|
*/
|
|
5964
|
-
|
|
5964
|
+
I(x, "colors", {
|
|
5965
5965
|
primary: "#3B82F6",
|
|
5966
5966
|
// Modern Blue
|
|
5967
5967
|
secondary: "#64748B",
|
|
@@ -5994,7 +5994,7 @@ _(x, "colors", {
|
|
|
5994
5994
|
}), /**
|
|
5995
5995
|
* Common CSS variables
|
|
5996
5996
|
*/
|
|
5997
|
-
|
|
5997
|
+
I(x, "cssVariables", {
|
|
5998
5998
|
// "Pro" Palette - Functional & Sharp
|
|
5999
5999
|
"--fc-primary-color": "#2563EB",
|
|
6000
6000
|
// International Blue (Focus)
|
|
@@ -6062,7 +6062,7 @@ _(x, "cssVariables", {
|
|
|
6062
6062
|
}), /**
|
|
6063
6063
|
* Get responsive breakpoints
|
|
6064
6064
|
*/
|
|
6065
|
-
|
|
6065
|
+
I(x, "breakpoints", {
|
|
6066
6066
|
xs: "320px",
|
|
6067
6067
|
sm: "576px",
|
|
6068
6068
|
md: "768px",
|
|
@@ -6864,25 +6864,43 @@ class ne extends O {
|
|
|
6864
6864
|
this.stateManager = new ie(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
|
|
6865
6865
|
}
|
|
6866
6866
|
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
|
-
|
|
6867
|
+
this._busUnsubscribers.forEach((t) => t()), this._busUnsubscribers = [], this._busUnsubscribers.push(u.on("navigation:*", (t, s) => {
|
|
6868
|
+
this.emit("calendar-navigate", { action: s.split(":")[1], ...t });
|
|
6869
|
+
})), this._busUnsubscribers.push(u.on("view:changed", (t) => {
|
|
6870
|
+
this.emit("calendar-view-change", t);
|
|
6871
|
+
}));
|
|
6872
|
+
const e = (t, s) => {
|
|
6873
|
+
this.emit(`calendar-event-${t}`, s);
|
|
6874
|
+
};
|
|
6875
|
+
this._busUnsubscribers.push(u.on("event:add", (t) => {
|
|
6876
|
+
e("add", t);
|
|
6877
|
+
})), this._busUnsubscribers.push(u.on("event:update", (t) => {
|
|
6878
|
+
e("update", t);
|
|
6879
|
+
})), this._busUnsubscribers.push(u.on("event:remove", (t) => {
|
|
6880
|
+
e("remove", t);
|
|
6881
|
+
})), this._busUnsubscribers.push(u.on("event:added", (t) => {
|
|
6882
|
+
e("add", t), this.emit("calendar-event-added", t);
|
|
6883
|
+
})), this._busUnsubscribers.push(u.on("event:updated", (t) => {
|
|
6884
|
+
e("update", t), this.emit("calendar-event-updated", t);
|
|
6885
|
+
})), this._busUnsubscribers.push(u.on("event:deleted", (t) => {
|
|
6886
|
+
e("remove", t), this.emit("calendar-event-deleted", t);
|
|
6887
|
+
})), this._busUnsubscribers.push(u.on("date:selected", (t) => {
|
|
6888
|
+
this.emit("calendar-date-select", t);
|
|
6875
6889
|
}));
|
|
6876
6890
|
}
|
|
6877
6891
|
handleStateChange(e, t) {
|
|
6878
6892
|
var o, c;
|
|
6879
6893
|
if (!this._hasRendered)
|
|
6880
6894
|
return;
|
|
6881
|
-
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)
|
|
6882
|
-
if (
|
|
6895
|
+
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);
|
|
6896
|
+
if (e.error !== (t == null ? void 0 : t.error)) {
|
|
6883
6897
|
this.render();
|
|
6884
6898
|
return;
|
|
6885
6899
|
}
|
|
6900
|
+
if (n) {
|
|
6901
|
+
this._updateLoadingState(e.loading);
|
|
6902
|
+
return;
|
|
6903
|
+
}
|
|
6886
6904
|
s && (this.currentView = e.view), s ? (this._updateTitle(), this._updateViewButtons(), this._switchView()) : i ? (this._updateTitle(), this._updateViewContent()) : r && this._updateViewContent();
|
|
6887
6905
|
}
|
|
6888
6906
|
/**
|
|
@@ -6930,11 +6948,18 @@ class ne extends O {
|
|
|
6930
6948
|
_updateViewContent() {
|
|
6931
6949
|
this._currentViewInstance && this._currentViewInstance.render && this._currentViewInstance.render();
|
|
6932
6950
|
}
|
|
6951
|
+
/**
|
|
6952
|
+
* Toggle loading overlay without rebuilding the component tree.
|
|
6953
|
+
*/
|
|
6954
|
+
_updateLoadingState(e) {
|
|
6955
|
+
const t = this.$(".fc-loading"), s = this.$(".fc-view-container");
|
|
6956
|
+
t && (t.style.display = e ? "flex" : "none"), s && (s.style.display = e ? "none" : "flex");
|
|
6957
|
+
}
|
|
6933
6958
|
mount() {
|
|
6934
|
-
|
|
6959
|
+
this.currentView = this.stateManager.getView(), super.mount();
|
|
6935
6960
|
}
|
|
6936
6961
|
loadView(e) {
|
|
6937
|
-
this.currentView = e, this.
|
|
6962
|
+
!e || this.currentView === e || (this.currentView = e, this._switchView(), this._updateViewButtons(), this._updateTitle());
|
|
6938
6963
|
}
|
|
6939
6964
|
getStyles() {
|
|
6940
6965
|
const e = this.getAttribute("height") || "800px";
|
|
@@ -7371,16 +7396,13 @@ class ne extends O {
|
|
|
7371
7396
|
</header>
|
|
7372
7397
|
|
|
7373
7398
|
<div class="fc-body">
|
|
7374
|
-
${i ?
|
|
7375
|
-
<div class="fc-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
${this.renderView()}
|
|
7382
|
-
</div>
|
|
7383
|
-
`}
|
|
7399
|
+
<div class="fc-loading" style="display: ${i ? "flex" : "none"};">
|
|
7400
|
+
<div class="fc-spinner"></div>
|
|
7401
|
+
<span>Loading...</span>
|
|
7402
|
+
</div>
|
|
7403
|
+
<div class="fc-view-container" style="display: ${i ? "none" : "flex"};">
|
|
7404
|
+
${this.renderView()}
|
|
7405
|
+
</div>
|
|
7384
7406
|
</div>
|
|
7385
7407
|
|
|
7386
7408
|
<forcecal-event-form id="event-modal"></forcecal-event-form>
|
|
@@ -7535,6 +7557,6 @@ export {
|
|
|
7535
7557
|
ie as StateManager,
|
|
7536
7558
|
x as StyleUtils,
|
|
7537
7559
|
z as WeekViewRenderer,
|
|
7538
|
-
|
|
7560
|
+
u as eventBus
|
|
7539
7561
|
};
|
|
7540
7562
|
//# sourceMappingURL=force-calendar-interface.esm.js.map
|