@forcecalendar/interface 1.0.42 → 1.0.44
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 +57 -77
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +31 -31
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +8 -31
- package/src/core/EventBus.js +4 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var F = (h, e, t) => e in h ?
|
|
3
|
-
var
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var F = (h, e, t) => e in h ? C(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t;
|
|
3
|
+
var g = (h, e, t) => F(h, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { Calendar as H, DateUtils as L } from "@forcecalendar/core";
|
|
5
5
|
class M extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -179,39 +179,35 @@ class T {
|
|
|
179
179
|
t.handler === e && this.wildcardHandlers.delete(t);
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
|
-
* Emit an event
|
|
182
|
+
* Emit an event synchronously
|
|
183
183
|
* @param {string} eventName - Event name
|
|
184
184
|
* @param {*} data - Event data
|
|
185
|
-
* @returns {Promise} Resolves when all handlers complete
|
|
186
185
|
*/
|
|
187
|
-
|
|
188
|
-
const r = [];
|
|
186
|
+
emit(e, t) {
|
|
189
187
|
if (this.events.has(e)) {
|
|
190
|
-
const
|
|
191
|
-
for (const
|
|
192
|
-
const { handler:
|
|
193
|
-
|
|
188
|
+
const s = [...this.events.get(e)];
|
|
189
|
+
for (const i of s) {
|
|
190
|
+
const { handler: n, once: o } = i;
|
|
191
|
+
o && this.off(e, n);
|
|
194
192
|
try {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
console.error(`Error in event handler for ${e}:`, c);
|
|
193
|
+
n(t, e);
|
|
194
|
+
} catch (a) {
|
|
195
|
+
console.error(`Error in event handler for ${e}:`, a);
|
|
199
196
|
}
|
|
200
197
|
}
|
|
201
198
|
}
|
|
202
|
-
const
|
|
203
|
-
for (const
|
|
204
|
-
if (this.matchesPattern(e,
|
|
205
|
-
const { handler:
|
|
206
|
-
|
|
199
|
+
const r = [];
|
|
200
|
+
for (const s of [...this.wildcardHandlers])
|
|
201
|
+
if (this.matchesPattern(e, s.pattern)) {
|
|
202
|
+
const { handler: i, once: n } = s;
|
|
203
|
+
n && r.push(s);
|
|
207
204
|
try {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
console.error(`Error in wildcard handler for ${e}:`, a);
|
|
205
|
+
i(t, e);
|
|
206
|
+
} catch (o) {
|
|
207
|
+
console.error(`Error in wildcard handler for ${e}:`, o);
|
|
212
208
|
}
|
|
213
209
|
}
|
|
214
|
-
|
|
210
|
+
r.forEach((s) => this.wildcardHandlers.delete(s));
|
|
215
211
|
}
|
|
216
212
|
/**
|
|
217
213
|
* Check if event name matches a pattern
|
|
@@ -253,7 +249,7 @@ class T {
|
|
|
253
249
|
return e;
|
|
254
250
|
}
|
|
255
251
|
}
|
|
256
|
-
const
|
|
252
|
+
const j = new T();
|
|
257
253
|
class V {
|
|
258
254
|
constructor(e = {}) {
|
|
259
255
|
this.eventBus = new T(), this.calendar = new H({
|
|
@@ -604,7 +600,7 @@ class p extends L {
|
|
|
604
600
|
return i && (i.toLowerCase() === "pm" && n < 12 ? a = n + 12 : i.toLowerCase() === "am" && n === 12 && (a = 0)), r.setHours(a, o || 0, 0, 0), r;
|
|
605
601
|
}
|
|
606
602
|
}
|
|
607
|
-
class
|
|
603
|
+
class E {
|
|
608
604
|
/**
|
|
609
605
|
* Create element with attributes and children
|
|
610
606
|
*/
|
|
@@ -1136,7 +1132,7 @@ class u {
|
|
|
1136
1132
|
/**
|
|
1137
1133
|
* Default theme colors
|
|
1138
1134
|
*/
|
|
1139
|
-
|
|
1135
|
+
g(u, "colors", {
|
|
1140
1136
|
primary: "#3B82F6",
|
|
1141
1137
|
// Modern Blue
|
|
1142
1138
|
secondary: "#64748B",
|
|
@@ -1169,7 +1165,7 @@ v(u, "colors", {
|
|
|
1169
1165
|
}), /**
|
|
1170
1166
|
* Common CSS variables
|
|
1171
1167
|
*/
|
|
1172
|
-
|
|
1168
|
+
g(u, "cssVariables", {
|
|
1173
1169
|
// "Pro" Palette - Functional & Sharp
|
|
1174
1170
|
"--fc-primary-color": "#2563EB",
|
|
1175
1171
|
// International Blue (Focus)
|
|
@@ -1237,7 +1233,7 @@ v(u, "cssVariables", {
|
|
|
1237
1233
|
}), /**
|
|
1238
1234
|
* Get responsive breakpoints
|
|
1239
1235
|
*/
|
|
1240
|
-
|
|
1236
|
+
g(u, "breakpoints", {
|
|
1241
1237
|
xs: "320px",
|
|
1242
1238
|
sm: "576px",
|
|
1243
1239
|
md: "768px",
|
|
@@ -1245,7 +1241,7 @@ v(u, "breakpoints", {
|
|
|
1245
1241
|
xl: "1200px",
|
|
1246
1242
|
"2xl": "1400px"
|
|
1247
1243
|
});
|
|
1248
|
-
class
|
|
1244
|
+
class k {
|
|
1249
1245
|
/**
|
|
1250
1246
|
* @param {HTMLElement} container - The DOM element to render into
|
|
1251
1247
|
* @param {StateManager} stateManager - The state manager instance
|
|
@@ -1284,7 +1280,7 @@ class E {
|
|
|
1284
1280
|
* @returns {string}
|
|
1285
1281
|
*/
|
|
1286
1282
|
escapeHTML(e) {
|
|
1287
|
-
return e == null ? "" :
|
|
1283
|
+
return e == null ? "" : E.escapeHTML(String(e));
|
|
1288
1284
|
}
|
|
1289
1285
|
/**
|
|
1290
1286
|
* Check if a date is today
|
|
@@ -1395,8 +1391,8 @@ class E {
|
|
|
1395
1391
|
const { compact: r = !0, overlapLayout: s = null } = t, i = new Date(e.start), n = new Date(e.end), o = i.getHours() * 60 + i.getMinutes(), a = Math.max((n - i) / (1e3 * 60), r ? 20 : 30), c = this.getEventColor(e), d = r ? "4px 8px" : "8px 12px", l = r ? "11px" : "13px", f = r ? 2 : 12, m = r ? 2 : 24, b = r ? "4px" : "6px";
|
|
1396
1392
|
let y, x;
|
|
1397
1393
|
if (s && s.has(e.id)) {
|
|
1398
|
-
const { column:
|
|
1399
|
-
y = `calc(${f}px + ${
|
|
1394
|
+
const { column: S, totalColumns: _ } = s.get(e.id), $ = `(100% - ${f + m}px)`;
|
|
1395
|
+
y = `calc(${f}px + ${S} * ${$} / ${_})`, x = `calc(${$} / ${_})`;
|
|
1400
1396
|
} else
|
|
1401
1397
|
y = `${f}px`, x = `calc(100% - ${f + m}px)`;
|
|
1402
1398
|
return `
|
|
@@ -1438,7 +1434,7 @@ class E {
|
|
|
1438
1434
|
});
|
|
1439
1435
|
}
|
|
1440
1436
|
}
|
|
1441
|
-
class
|
|
1437
|
+
class w extends k {
|
|
1442
1438
|
constructor(e, t) {
|
|
1443
1439
|
super(e, t), this.maxEventsToShow = 3;
|
|
1444
1440
|
}
|
|
@@ -1513,7 +1509,7 @@ class g extends E {
|
|
|
1513
1509
|
}), this.attachCommonEventHandlers();
|
|
1514
1510
|
}
|
|
1515
1511
|
}
|
|
1516
|
-
class
|
|
1512
|
+
class I extends k {
|
|
1517
1513
|
constructor(e, t) {
|
|
1518
1514
|
super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1519
1515
|
}
|
|
@@ -1650,7 +1646,7 @@ class w extends E {
|
|
|
1650
1646
|
e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1651
1647
|
}
|
|
1652
1648
|
}
|
|
1653
|
-
class
|
|
1649
|
+
class z extends k {
|
|
1654
1650
|
constructor(e, t) {
|
|
1655
1651
|
super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1656
1652
|
}
|
|
@@ -1794,7 +1790,7 @@ class D extends E {
|
|
|
1794
1790
|
e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1795
1791
|
}
|
|
1796
1792
|
}
|
|
1797
|
-
class
|
|
1793
|
+
class B extends M {
|
|
1798
1794
|
constructor() {
|
|
1799
1795
|
super(), this._isVisible = !1, this._cleanupFocusTrap = null, this.config = {
|
|
1800
1796
|
title: "New Event",
|
|
@@ -2070,7 +2066,7 @@ class I extends M {
|
|
|
2070
2066
|
});
|
|
2071
2067
|
}
|
|
2072
2068
|
open(e = /* @__PURE__ */ new Date()) {
|
|
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 =
|
|
2069
|
+
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));
|
|
2074
2070
|
}
|
|
2075
2071
|
close() {
|
|
2076
2072
|
this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
|
|
@@ -2099,8 +2095,8 @@ class I extends M {
|
|
|
2099
2095
|
this._cleanupFocusTrap && this._cleanupFocusTrap(), this._handleKeyDown && (window.removeEventListener("keydown", this._handleKeyDown), this._handleKeyDown = null, this._keydownListenerAdded = !1);
|
|
2100
2096
|
}
|
|
2101
2097
|
}
|
|
2102
|
-
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form",
|
|
2103
|
-
class
|
|
2098
|
+
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", B);
|
|
2099
|
+
const v = class v extends M {
|
|
2104
2100
|
static get observedAttributes() {
|
|
2105
2101
|
return ["view", "date", "locale", "timezone", "week-starts-on", "height"];
|
|
2106
2102
|
}
|
|
@@ -2205,12 +2201,8 @@ class z extends M {
|
|
|
2205
2201
|
if (e) {
|
|
2206
2202
|
this._currentViewInstance && this._currentViewInstance.cleanup && this._currentViewInstance.cleanup();
|
|
2207
2203
|
try {
|
|
2208
|
-
const r =
|
|
2209
|
-
|
|
2210
|
-
week: w,
|
|
2211
|
-
day: D
|
|
2212
|
-
}[this.currentView] || g, s = new r(e, this.stateManager);
|
|
2213
|
-
s._viewType = this.currentView, this._currentViewInstance = s, s.render();
|
|
2204
|
+
const t = v.RENDERERS[this.currentView] || w, r = new t(e, this.stateManager);
|
|
2205
|
+
r._viewType = this.currentView, this._currentViewInstance = r, r.render();
|
|
2214
2206
|
} catch (t) {
|
|
2215
2207
|
console.error("[ForceCalendar] Error switching view:", t);
|
|
2216
2208
|
}
|
|
@@ -2630,7 +2622,7 @@ class z extends M {
|
|
|
2630
2622
|
return `
|
|
2631
2623
|
<div class="force-calendar">
|
|
2632
2624
|
<div class="fc-error">
|
|
2633
|
-
<p><strong>Error:</strong> ${
|
|
2625
|
+
<p><strong>Error:</strong> ${E.escapeHTML(i.message || "An error occurred")}</p>
|
|
2634
2626
|
</div>
|
|
2635
2627
|
</div>
|
|
2636
2628
|
`;
|
|
@@ -2693,12 +2685,8 @@ class z extends M {
|
|
|
2693
2685
|
return;
|
|
2694
2686
|
this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe && (this._viewUnsubscribe(), this._viewUnsubscribe = null));
|
|
2695
2687
|
try {
|
|
2696
|
-
const i =
|
|
2697
|
-
|
|
2698
|
-
week: w,
|
|
2699
|
-
day: D
|
|
2700
|
-
}[this.currentView] || g, n = new i(e, this.stateManager);
|
|
2701
|
-
n._viewType = this.currentView, this._currentViewInstance = n, n.render();
|
|
2688
|
+
const s = v.RENDERERS[this.currentView] || w, i = new s(e, this.stateManager);
|
|
2689
|
+
i._viewType = this.currentView, this._currentViewInstance = i, i.render();
|
|
2702
2690
|
} catch (s) {
|
|
2703
2691
|
console.error("[ForceCalendar] Error creating/rendering view:", s);
|
|
2704
2692
|
}
|
|
@@ -2721,20 +2709,6 @@ class z extends M {
|
|
|
2721
2709
|
});
|
|
2722
2710
|
}), this._hasRendered = !0;
|
|
2723
2711
|
}
|
|
2724
|
-
/**
|
|
2725
|
-
* Create a view renderer instance for the given view type
|
|
2726
|
-
* Uses pure JavaScript renderer classes for Salesforce Locker Service compatibility
|
|
2727
|
-
* @param {string} viewName - 'month', 'week', or 'day'
|
|
2728
|
-
* @returns {BaseViewRenderer} Renderer instance
|
|
2729
|
-
*/
|
|
2730
|
-
_createViewRenderer(e) {
|
|
2731
|
-
const r = {
|
|
2732
|
-
month: g,
|
|
2733
|
-
week: w,
|
|
2734
|
-
day: D
|
|
2735
|
-
}[e] || g;
|
|
2736
|
-
return new r(null, null);
|
|
2737
|
-
}
|
|
2738
2712
|
handleNavigation(e) {
|
|
2739
2713
|
switch (e.currentTarget.dataset.action) {
|
|
2740
2714
|
case "today":
|
|
@@ -2817,20 +2791,26 @@ class z extends M {
|
|
|
2817
2791
|
destroy() {
|
|
2818
2792
|
this._busUnsubscribers.forEach((e) => e()), this._busUnsubscribers = [], this.stateManager && this.stateManager.destroy(), super.cleanup();
|
|
2819
2793
|
}
|
|
2820
|
-
}
|
|
2821
|
-
|
|
2794
|
+
};
|
|
2795
|
+
g(v, "RENDERERS", {
|
|
2796
|
+
month: w,
|
|
2797
|
+
week: I,
|
|
2798
|
+
day: z
|
|
2799
|
+
});
|
|
2800
|
+
let D = v;
|
|
2801
|
+
customElements.get("forcecal-main") || customElements.define("forcecal-main", D);
|
|
2822
2802
|
export {
|
|
2823
2803
|
M as BaseComponent,
|
|
2824
|
-
|
|
2825
|
-
|
|
2804
|
+
k as BaseViewRenderer,
|
|
2805
|
+
E as DOMUtils,
|
|
2826
2806
|
p as DateUtils,
|
|
2827
|
-
|
|
2807
|
+
z as DayViewRenderer,
|
|
2828
2808
|
T as EventBus,
|
|
2829
|
-
|
|
2830
|
-
|
|
2809
|
+
D as ForceCalendar,
|
|
2810
|
+
w as MonthViewRenderer,
|
|
2831
2811
|
V as StateManager,
|
|
2832
2812
|
u as StyleUtils,
|
|
2833
|
-
|
|
2834
|
-
|
|
2813
|
+
I as WeekViewRenderer,
|
|
2814
|
+
j as eventBus
|
|
2835
2815
|
};
|
|
2836
2816
|
//# sourceMappingURL=force-calendar-interface.esm.js.map
|