@forcecalendar/interface 1.0.48 → 1.0.50
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 +52 -52
- 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 +0 -1
- package/src/renderers/BaseViewRenderer.js +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Calendar as
|
|
1
|
+
var F = Object.defineProperty;
|
|
2
|
+
var H = (h, t, e) => t in h ? F(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
|
+
var v = (h, t, e) => H(h, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { Calendar as L, DateUtils as V } from "@forcecalendar/core";
|
|
5
5
|
class M extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(), this.attachShadow({ mode: "open" }), this._listeners = [], this._state = null, this._props = /* @__PURE__ */ new Map(), this._initialized = !1;
|
|
@@ -249,10 +249,10 @@ class T {
|
|
|
249
249
|
return t;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const
|
|
253
|
-
class
|
|
252
|
+
const U = new T();
|
|
253
|
+
class I {
|
|
254
254
|
constructor(t = {}) {
|
|
255
|
-
this.eventBus = new T(), this.calendar = new
|
|
255
|
+
this.eventBus = new T(), this.calendar = new L({
|
|
256
256
|
view: t.view || "month",
|
|
257
257
|
date: t.date || /* @__PURE__ */ new Date(),
|
|
258
258
|
weekStartsOn: t.weekStartsOn ?? 0,
|
|
@@ -486,7 +486,7 @@ class V {
|
|
|
486
486
|
this.subscribers.clear(), this._subscriberIds && (this._subscriberIds.clear(), this._subscriberIds = null), this.eventBus && (this.eventBus.clear(), this.eventBus = null), this.state = null, this.calendar = null;
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
class p extends
|
|
489
|
+
class p extends V {
|
|
490
490
|
/**
|
|
491
491
|
* Format date for display
|
|
492
492
|
*/
|
|
@@ -548,8 +548,8 @@ class p extends L {
|
|
|
548
548
|
* Get relative time string (e.g., "2 hours ago", "in 3 days")
|
|
549
549
|
*/
|
|
550
550
|
static getRelativeTime(t, e = /* @__PURE__ */ new Date(), r = "en-US") {
|
|
551
|
-
const i = new Intl.RelativeTimeFormat(r, { numeric: "auto" }), s = t - e, n = Math.floor(s / 1e3), a = Math.floor(n / 60), o = Math.floor(a / 60), c = Math.floor(o / 24), d = Math.floor(c / 7), l = Math.floor(c / 30),
|
|
552
|
-
return Math.abs(n) < 60 ? i.format(n, "second") : Math.abs(a) < 60 ? i.format(a, "minute") : Math.abs(o) < 24 ? i.format(o, "hour") : Math.abs(c) < 7 ? i.format(c, "day") : Math.abs(d) < 4 ? i.format(d, "week") : Math.abs(l) < 12 ? i.format(l, "month") : i.format(
|
|
551
|
+
const i = new Intl.RelativeTimeFormat(r, { numeric: "auto" }), s = t - e, n = Math.floor(s / 1e3), a = Math.floor(n / 60), o = Math.floor(a / 60), c = Math.floor(o / 24), d = Math.floor(c / 7), l = Math.floor(c / 30), f = Math.floor(c / 365);
|
|
552
|
+
return Math.abs(n) < 60 ? i.format(n, "second") : Math.abs(a) < 60 ? i.format(a, "minute") : Math.abs(o) < 24 ? i.format(o, "hour") : Math.abs(c) < 7 ? i.format(c, "day") : Math.abs(d) < 4 ? i.format(d, "week") : Math.abs(l) < 12 ? i.format(l, "month") : i.format(f, "year");
|
|
553
553
|
}
|
|
554
554
|
/**
|
|
555
555
|
* Check if date is today
|
|
@@ -795,7 +795,7 @@ class D {
|
|
|
795
795
|
return t.addEventListener("keydown", s), r == null || r.focus(), () => t.removeEventListener("keydown", s);
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
class
|
|
798
|
+
class u {
|
|
799
799
|
/**
|
|
800
800
|
* Get CSS variable value
|
|
801
801
|
*/
|
|
@@ -1132,7 +1132,7 @@ class f {
|
|
|
1132
1132
|
/**
|
|
1133
1133
|
* Default theme colors
|
|
1134
1134
|
*/
|
|
1135
|
-
|
|
1135
|
+
v(u, "colors", {
|
|
1136
1136
|
primary: "#3B82F6",
|
|
1137
1137
|
// Modern Blue
|
|
1138
1138
|
secondary: "#64748B",
|
|
@@ -1165,7 +1165,7 @@ g(f, "colors", {
|
|
|
1165
1165
|
}), /**
|
|
1166
1166
|
* Common CSS variables
|
|
1167
1167
|
*/
|
|
1168
|
-
|
|
1168
|
+
v(u, "cssVariables", {
|
|
1169
1169
|
// "Pro" Palette - Functional & Sharp
|
|
1170
1170
|
"--fc-primary-color": "#2563EB",
|
|
1171
1171
|
// International Blue (Focus)
|
|
@@ -1233,7 +1233,7 @@ g(f, "cssVariables", {
|
|
|
1233
1233
|
}), /**
|
|
1234
1234
|
* Get responsive breakpoints
|
|
1235
1235
|
*/
|
|
1236
|
-
|
|
1236
|
+
v(u, "breakpoints", {
|
|
1237
1237
|
xs: "320px",
|
|
1238
1238
|
sm: "576px",
|
|
1239
1239
|
md: "768px",
|
|
@@ -1325,7 +1325,7 @@ class E {
|
|
|
1325
1325
|
* @returns {string} '#000000' or '#FFFFFF'
|
|
1326
1326
|
*/
|
|
1327
1327
|
getContrastingTextColor(t) {
|
|
1328
|
-
return !t || typeof t != "string" || t.charAt(0) !== "#" ? "white" :
|
|
1328
|
+
return !t || typeof t != "string" || t.charAt(0) !== "#" ? "white" : u.getContrastColor(t);
|
|
1329
1329
|
}
|
|
1330
1330
|
/**
|
|
1331
1331
|
* Render the "now" indicator line for time-based views
|
|
@@ -1345,8 +1345,8 @@ class E {
|
|
|
1345
1345
|
computeOverlapLayout(t) {
|
|
1346
1346
|
if (!t || t.length === 0) return /* @__PURE__ */ new Map();
|
|
1347
1347
|
const e = t.map((o) => {
|
|
1348
|
-
const c = new Date(o.start), d = new Date(o.end), l = c.getHours() * 60 + c.getMinutes(),
|
|
1349
|
-
return { id: o.id, startMin: l, endMin:
|
|
1348
|
+
const c = new Date(o.start), d = new Date(o.end), l = c.getHours() * 60 + c.getMinutes(), f = Math.max(l + 1, d.getHours() * 60 + d.getMinutes());
|
|
1349
|
+
return { id: o.id, startMin: l, endMin: f };
|
|
1350
1350
|
});
|
|
1351
1351
|
e.sort((o, c) => o.startMin - c.startMin || c.endMin - c.startMin - (o.endMin - o.startMin));
|
|
1352
1352
|
const r = [], i = /* @__PURE__ */ new Map();
|
|
@@ -1380,20 +1380,20 @@ class E {
|
|
|
1380
1380
|
* @returns {string} HTML string
|
|
1381
1381
|
*/
|
|
1382
1382
|
renderTimedEvent(t, e = {}) {
|
|
1383
|
-
const { compact: r = !0, overlapLayout: i = null } = e, s = new Date(t.start), n = new Date(t.end), a = s.getHours() * 60 + s.getMinutes(), o = Math.max((n - s) / (1e3 * 60), r ? 20 : 30), c = this.getEventColor(t), d = r ? "4px 8px" : "8px 12px",
|
|
1383
|
+
const { compact: r = !0, overlapLayout: i = null } = e, s = new Date(t.start), n = new Date(t.end), a = s.getHours() * 60 + s.getMinutes(), o = Math.max((n - s) / (1e3 * 60), r ? 20 : 30), c = this.getEventColor(t), d = this.getContrastingTextColor(c), l = r ? "4px 8px" : "8px 12px", f = r ? "11px" : "13px", g = r ? 2 : 12, b = r ? 2 : 24, C = r ? "4px" : "6px";
|
|
1384
1384
|
let y, x;
|
|
1385
1385
|
if (i && i.has(t.id)) {
|
|
1386
|
-
const { column: S, totalColumns: _ } = i.get(t.id), $ = `(100% - ${
|
|
1387
|
-
y = `calc(${
|
|
1386
|
+
const { column: S, totalColumns: _ } = i.get(t.id), $ = `(100% - ${g + b}px)`;
|
|
1387
|
+
y = `calc(${g}px + ${S} * ${$} / ${_})`, x = `calc(${$} / ${_})`;
|
|
1388
1388
|
} else
|
|
1389
|
-
y = `${
|
|
1389
|
+
y = `${g}px`, x = `calc(100% - ${g + b}px)`;
|
|
1390
1390
|
return `
|
|
1391
1391
|
<div class="fc-event fc-timed-event" data-event-id="${this.escapeHTML(t.id)}"
|
|
1392
1392
|
style="position: absolute; top: ${a}px; height: ${o}px;
|
|
1393
1393
|
left: ${y}; width: ${x};
|
|
1394
|
-
background-color: ${c}; border-radius: ${
|
|
1395
|
-
padding: ${
|
|
1396
|
-
font-weight: 500; color:
|
|
1394
|
+
background-color: ${c}; border-radius: ${C};
|
|
1395
|
+
padding: ${l}; font-size: ${f};
|
|
1396
|
+
font-weight: 500; color: ${d}; overflow: hidden;
|
|
1397
1397
|
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
|
1398
1398
|
cursor: pointer; z-index: 5;">
|
|
1399
1399
|
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
|
@@ -1411,7 +1411,7 @@ class E {
|
|
|
1411
1411
|
* @returns {string}
|
|
1412
1412
|
*/
|
|
1413
1413
|
getEventColor(t) {
|
|
1414
|
-
return
|
|
1414
|
+
return u.sanitizeColor(t == null ? void 0 : t.backgroundColor, "#2563eb");
|
|
1415
1415
|
}
|
|
1416
1416
|
/**
|
|
1417
1417
|
* Attach common event handlers for day/event clicks
|
|
@@ -1501,7 +1501,7 @@ class w extends E {
|
|
|
1501
1501
|
}), this.attachCommonEventHandlers();
|
|
1502
1502
|
}
|
|
1503
1503
|
}
|
|
1504
|
-
class
|
|
1504
|
+
class z extends E {
|
|
1505
1505
|
constructor(t, e) {
|
|
1506
1506
|
super(t, e), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1507
1507
|
}
|
|
@@ -1638,7 +1638,7 @@ class I extends E {
|
|
|
1638
1638
|
t && (t.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1639
1639
|
}
|
|
1640
1640
|
}
|
|
1641
|
-
class
|
|
1641
|
+
class B extends E {
|
|
1642
1642
|
constructor(t, e) {
|
|
1643
1643
|
super(t, e), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1644
1644
|
}
|
|
@@ -1654,11 +1654,11 @@ class z extends E {
|
|
|
1654
1654
|
this.container.innerHTML = r, this._attachEventHandlers(), this._scrollToCurrentTime();
|
|
1655
1655
|
}
|
|
1656
1656
|
_renderDayView(t, e) {
|
|
1657
|
-
var l,
|
|
1658
|
-
const r = ((
|
|
1657
|
+
var l, f;
|
|
1658
|
+
const r = ((f = (l = this.stateManager) == null ? void 0 : l.getState()) == null ? void 0 : f.currentDate) || /* @__PURE__ */ new Date(), i = this._extractDayData(t, r);
|
|
1659
1659
|
if (!i)
|
|
1660
1660
|
return '<div style="padding: 20px; text-align: center; color: var(--fc-text-secondary);">No data available for day view.</div>';
|
|
1661
|
-
const { dayDate: s, dayName: n, isToday: a, allDayEvents: o, timedEvents: c } = i, d = Array.from({ length: 24 }, (
|
|
1661
|
+
const { dayDate: s, dayName: n, isToday: a, allDayEvents: o, timedEvents: c } = i, d = Array.from({ length: 24 }, (g, b) => b);
|
|
1662
1662
|
return `
|
|
1663
1663
|
<div class="fc-day-view" style="display: flex; flex-direction: column; height: 100%; background: var(--fc-background); overflow: hidden;">
|
|
1664
1664
|
${this._renderHeader(s, n, a)}
|
|
@@ -1782,7 +1782,7 @@ class z extends E {
|
|
|
1782
1782
|
t && (t.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1783
1783
|
}
|
|
1784
1784
|
}
|
|
1785
|
-
class
|
|
1785
|
+
class A extends M {
|
|
1786
1786
|
constructor() {
|
|
1787
1787
|
super(), this._isVisible = !1, this._cleanupFocusTrap = null, this.config = {
|
|
1788
1788
|
title: "New Event",
|
|
@@ -1812,8 +1812,8 @@ class B extends M {
|
|
|
1812
1812
|
}
|
|
1813
1813
|
getStyles() {
|
|
1814
1814
|
return `
|
|
1815
|
-
${
|
|
1816
|
-
${
|
|
1815
|
+
${u.getBaseStyles()}
|
|
1816
|
+
${u.getButtonStyles()}
|
|
1817
1817
|
|
|
1818
1818
|
:host {
|
|
1819
1819
|
display: none;
|
|
@@ -2087,13 +2087,13 @@ class B extends M {
|
|
|
2087
2087
|
this._cleanupFocusTrap && this._cleanupFocusTrap(), this._handleKeyDown && (window.removeEventListener("keydown", this._handleKeyDown), this._handleKeyDown = null, this._keydownListenerAdded = !1);
|
|
2088
2088
|
}
|
|
2089
2089
|
}
|
|
2090
|
-
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form",
|
|
2091
|
-
const
|
|
2090
|
+
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", A);
|
|
2091
|
+
const m = class m extends M {
|
|
2092
2092
|
static get observedAttributes() {
|
|
2093
2093
|
return ["view", "date", "locale", "timezone", "week-starts-on", "height"];
|
|
2094
2094
|
}
|
|
2095
2095
|
constructor() {
|
|
2096
|
-
super(), this.stateManager = null, this.currentView = null, this._hasRendered = !1, this.
|
|
2096
|
+
super(), this.stateManager = null, this.currentView = null, this._hasRendered = !1, this._busUnsubscribers = [];
|
|
2097
2097
|
}
|
|
2098
2098
|
initialize() {
|
|
2099
2099
|
const t = {
|
|
@@ -2103,7 +2103,7 @@ const v = class v extends M {
|
|
|
2103
2103
|
timeZone: this.getAttribute("timezone") || Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
2104
2104
|
weekStartsOn: parseInt(this.getAttribute("week-starts-on") || "0")
|
|
2105
2105
|
};
|
|
2106
|
-
this.stateManager = new
|
|
2106
|
+
this.stateManager = new I(t), this._stateUnsubscribe = this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
|
|
2107
2107
|
}
|
|
2108
2108
|
setupEventListeners() {
|
|
2109
2109
|
this._busUnsubscribers.forEach((r) => r()), this._busUnsubscribers = [];
|
|
@@ -2193,7 +2193,7 @@ const v = class v extends M {
|
|
|
2193
2193
|
if (t) {
|
|
2194
2194
|
this._currentViewInstance && this._currentViewInstance.cleanup && this._currentViewInstance.cleanup();
|
|
2195
2195
|
try {
|
|
2196
|
-
const e =
|
|
2196
|
+
const e = m.RENDERERS[this.currentView] || w, r = new e(t, this.stateManager);
|
|
2197
2197
|
r._viewType = this.currentView, this._currentViewInstance = r, r.render();
|
|
2198
2198
|
} catch (e) {
|
|
2199
2199
|
console.error("[ForceCalendar] Error switching view:", e);
|
|
@@ -2222,10 +2222,10 @@ const v = class v extends M {
|
|
|
2222
2222
|
getStyles() {
|
|
2223
2223
|
const t = this.getAttribute("height") || "800px";
|
|
2224
2224
|
return `
|
|
2225
|
-
${
|
|
2226
|
-
${
|
|
2227
|
-
${
|
|
2228
|
-
${
|
|
2225
|
+
${u.getBaseStyles()}
|
|
2226
|
+
${u.getButtonStyles()}
|
|
2227
|
+
${u.getGridStyles()}
|
|
2228
|
+
${u.getAnimations()}
|
|
2229
2229
|
|
|
2230
2230
|
:host {
|
|
2231
2231
|
--calendar-height: ${t};
|
|
@@ -2677,7 +2677,7 @@ const v = class v extends M {
|
|
|
2677
2677
|
return;
|
|
2678
2678
|
this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe && (this._viewUnsubscribe(), this._viewUnsubscribe = null));
|
|
2679
2679
|
try {
|
|
2680
|
-
const i =
|
|
2680
|
+
const i = m.RENDERERS[this.currentView] || w, s = new i(t, this.stateManager);
|
|
2681
2681
|
s._viewType = this.currentView, this._currentViewInstance = s, s.render();
|
|
2682
2682
|
} catch (i) {
|
|
2683
2683
|
console.error("[ForceCalendar] Error creating/rendering view:", i);
|
|
@@ -2787,25 +2787,25 @@ const v = class v extends M {
|
|
|
2787
2787
|
this._busUnsubscribers.forEach((t) => t()), this._busUnsubscribers = [], this._stateUnsubscribe && (this._stateUnsubscribe(), this._stateUnsubscribe = null), this._currentViewInstance && this._currentViewInstance.cleanup && (this._currentViewInstance.cleanup(), this._currentViewInstance = null), this.stateManager && this.stateManager.destroy(), super.cleanup();
|
|
2788
2788
|
}
|
|
2789
2789
|
};
|
|
2790
|
-
|
|
2790
|
+
v(m, "RENDERERS", {
|
|
2791
2791
|
month: w,
|
|
2792
|
-
week:
|
|
2793
|
-
day:
|
|
2792
|
+
week: z,
|
|
2793
|
+
day: B
|
|
2794
2794
|
});
|
|
2795
|
-
let k =
|
|
2795
|
+
let k = m;
|
|
2796
2796
|
customElements.get("forcecal-main") || customElements.define("forcecal-main", k);
|
|
2797
2797
|
export {
|
|
2798
2798
|
M as BaseComponent,
|
|
2799
2799
|
E as BaseViewRenderer,
|
|
2800
2800
|
D as DOMUtils,
|
|
2801
2801
|
p as DateUtils,
|
|
2802
|
-
|
|
2802
|
+
B as DayViewRenderer,
|
|
2803
2803
|
T as EventBus,
|
|
2804
2804
|
k as ForceCalendar,
|
|
2805
2805
|
w as MonthViewRenderer,
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2806
|
+
I as StateManager,
|
|
2807
|
+
u as StyleUtils,
|
|
2808
|
+
z as WeekViewRenderer,
|
|
2809
|
+
U as eventBus
|
|
2810
2810
|
};
|
|
2811
2811
|
//# sourceMappingURL=force-calendar-interface.esm.js.map
|