@forcecalendar/interface 1.0.30 → 1.0.32
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 +28 -16
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +2 -2
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/EventForm.js +4 -1
- package/src/core/StateManager.js +22 -6
|
@@ -5176,14 +5176,22 @@ class ie {
|
|
|
5176
5176
|
}
|
|
5177
5177
|
/**
|
|
5178
5178
|
* Sync state.events from Core calendar (single source of truth)
|
|
5179
|
-
* This ensures state.events always matches Core's event store
|
|
5179
|
+
* This ensures state.events always matches Core's event store.
|
|
5180
|
+
*
|
|
5181
|
+
* @param {object} options
|
|
5182
|
+
* @param {boolean} options.silent - suppress subscriber notifications
|
|
5183
|
+
* @param {boolean} options.force - always update even when IDs match
|
|
5184
|
+
* (required after updateEvent where IDs
|
|
5185
|
+
* are unchanged but content has changed)
|
|
5180
5186
|
*/
|
|
5181
5187
|
_syncEventsFromCore(e = {}) {
|
|
5182
|
-
const t = this.calendar.getEvents() || [];
|
|
5183
|
-
return (this.state.events.length !==
|
|
5188
|
+
const { force: t = !1 } = e, s = this.calendar.getEvents() || [];
|
|
5189
|
+
return (t || this.state.events.length !== s.length || !this._eventsMatch(this.state.events, s)) && this.setState({ events: [...s] }, e), s;
|
|
5184
5190
|
}
|
|
5185
5191
|
/**
|
|
5186
|
-
* Check if two event arrays have the same events
|
|
5192
|
+
* Check if two event arrays have the same events by id.
|
|
5193
|
+
* Only used for add/delete guards — updateEvent must pass force:true
|
|
5194
|
+
* to bypass this check because IDs are unchanged after an update.
|
|
5187
5195
|
*/
|
|
5188
5196
|
_eventsMatch(e, t) {
|
|
5189
5197
|
if (e.length !== t.length) return !1;
|
|
@@ -5192,7 +5200,11 @@ class ie {
|
|
|
5192
5200
|
}
|
|
5193
5201
|
// State management
|
|
5194
5202
|
getState() {
|
|
5195
|
-
return {
|
|
5203
|
+
return {
|
|
5204
|
+
...this.state,
|
|
5205
|
+
config: { ...this.state.config },
|
|
5206
|
+
events: [...this.state.events]
|
|
5207
|
+
};
|
|
5196
5208
|
}
|
|
5197
5209
|
setState(e, t = {}) {
|
|
5198
5210
|
const { silent: s = !1 } = t, i = { ...this.state };
|
|
@@ -5272,7 +5284,7 @@ class ie {
|
|
|
5272
5284
|
updateEvent(e, t) {
|
|
5273
5285
|
this._syncEventsFromCore({ silent: !0 });
|
|
5274
5286
|
const s = this.calendar.updateEvent(e, t);
|
|
5275
|
-
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", {
|
|
5287
|
+
return s ? (this._syncEventsFromCore({ force: !0 }), u.emit("event:update", { event: s }), u.emit("event:updated", { event: s }), s) : (console.error(`Failed to update event: ${e}`), u.emit("event:error", {
|
|
5276
5288
|
action: "update",
|
|
5277
5289
|
eventId: e,
|
|
5278
5290
|
updates: t,
|
|
@@ -5492,7 +5504,7 @@ class E extends f {
|
|
|
5492
5504
|
return r && (r.toLowerCase() === "pm" && n < 12 ? o = n + 12 : r.toLowerCase() === "am" && n === 12 && (o = 0)), s.setHours(o, a || 0, 0, 0), s;
|
|
5493
5505
|
}
|
|
5494
5506
|
}
|
|
5495
|
-
class
|
|
5507
|
+
class F {
|
|
5496
5508
|
/**
|
|
5497
5509
|
* Create element with attributes and children
|
|
5498
5510
|
*/
|
|
@@ -6133,7 +6145,7 @@ I(D, "breakpoints", {
|
|
|
6133
6145
|
xl: "1200px",
|
|
6134
6146
|
"2xl": "1400px"
|
|
6135
6147
|
});
|
|
6136
|
-
class
|
|
6148
|
+
class H {
|
|
6137
6149
|
/**
|
|
6138
6150
|
* @param {HTMLElement} container - The DOM element to render into
|
|
6139
6151
|
* @param {StateManager} stateManager - The state manager instance
|
|
@@ -6172,7 +6184,7 @@ class F {
|
|
|
6172
6184
|
* @returns {string}
|
|
6173
6185
|
*/
|
|
6174
6186
|
escapeHTML(e) {
|
|
6175
|
-
return e == null ? "" :
|
|
6187
|
+
return e == null ? "" : F.escapeHTML(String(e));
|
|
6176
6188
|
}
|
|
6177
6189
|
/**
|
|
6178
6190
|
* Check if a date is today
|
|
@@ -6282,7 +6294,7 @@ class F {
|
|
|
6282
6294
|
});
|
|
6283
6295
|
}
|
|
6284
6296
|
}
|
|
6285
|
-
class S extends
|
|
6297
|
+
class S extends H {
|
|
6286
6298
|
constructor(e, t) {
|
|
6287
6299
|
super(e, t), this.maxEventsToShow = 3;
|
|
6288
6300
|
}
|
|
@@ -6357,7 +6369,7 @@ class S extends F {
|
|
|
6357
6369
|
}), this.attachCommonEventHandlers();
|
|
6358
6370
|
}
|
|
6359
6371
|
}
|
|
6360
|
-
class z extends
|
|
6372
|
+
class z extends H {
|
|
6361
6373
|
constructor(e, t) {
|
|
6362
6374
|
super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
6363
6375
|
}
|
|
@@ -6493,7 +6505,7 @@ class z extends F {
|
|
|
6493
6505
|
e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
6494
6506
|
}
|
|
6495
6507
|
}
|
|
6496
|
-
class L extends
|
|
6508
|
+
class L extends H {
|
|
6497
6509
|
constructor(e, t) {
|
|
6498
6510
|
super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
6499
6511
|
}
|
|
@@ -6912,7 +6924,7 @@ class re extends O {
|
|
|
6912
6924
|
});
|
|
6913
6925
|
}
|
|
6914
6926
|
open(e = /* @__PURE__ */ new Date()) {
|
|
6915
|
-
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 =
|
|
6927
|
+
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 = F.trapFocus(this.modalContent));
|
|
6916
6928
|
}
|
|
6917
6929
|
close() {
|
|
6918
6930
|
this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
|
|
@@ -7470,7 +7482,7 @@ class ne extends O {
|
|
|
7470
7482
|
return `
|
|
7471
7483
|
<div class="force-calendar">
|
|
7472
7484
|
<div class="fc-error">
|
|
7473
|
-
<p><strong>Error:</strong> ${
|
|
7485
|
+
<p><strong>Error:</strong> ${F.escapeHTML(r.message || "An error occurred")}</p>
|
|
7474
7486
|
</div>
|
|
7475
7487
|
</div>
|
|
7476
7488
|
`;
|
|
@@ -7661,8 +7673,8 @@ customElements.get("forcecal-main") || customElements.define("forcecal-main", ne
|
|
|
7661
7673
|
typeof window < "u" && typeof customElements < "u" && console.log("Force Calendar Interface loading...");
|
|
7662
7674
|
export {
|
|
7663
7675
|
O as BaseComponent,
|
|
7664
|
-
|
|
7665
|
-
|
|
7676
|
+
H as BaseViewRenderer,
|
|
7677
|
+
F as DOMUtils,
|
|
7666
7678
|
E as DateUtils,
|
|
7667
7679
|
L as DayViewRenderer,
|
|
7668
7680
|
se as EventBus,
|