@forcecalendar/interface 1.0.50 → 1.0.52
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 +93 -73
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +34 -34
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/renderers/BaseViewRenderer.js +22 -0
- package/src/renderers/DayViewRenderer.js +5 -3
- package/src/renderers/MonthViewRenderer.js +3 -2
- package/src/renderers/WeekViewRenderer.js +4 -2
- package/src/utils/DateUtils.js +8 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var F = Object.defineProperty;
|
|
2
2
|
var H = (h, t, e) => t in h ? F(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
3
|
var v = (h, t, e) => H(h, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { Calendar as
|
|
4
|
+
import { Calendar as I, DateUtils as L } 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;
|
|
@@ -250,9 +250,9 @@ class T {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
const U = new T();
|
|
253
|
-
class
|
|
253
|
+
class V {
|
|
254
254
|
constructor(t = {}) {
|
|
255
|
-
this.eventBus = new T(), this.calendar = new
|
|
255
|
+
this.eventBus = new T(), this.calendar = new I({
|
|
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 I {
|
|
|
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
|
|
489
|
+
class u extends L {
|
|
490
490
|
/**
|
|
491
491
|
* Format date for display
|
|
492
492
|
*/
|
|
@@ -548,8 +548,8 @@ class p extends V {
|
|
|
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),
|
|
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(
|
|
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), l = Math.floor(c / 7), d = Math.floor(c / 30), p = 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(l) < 4 ? i.format(l, "week") : Math.abs(d) < 12 ? i.format(d, "month") : i.format(p, "year");
|
|
553
553
|
}
|
|
554
554
|
/**
|
|
555
555
|
* Check if date is today
|
|
@@ -584,6 +584,13 @@ class p extends V {
|
|
|
584
584
|
const r = new Date(2024, 0, 7 + t);
|
|
585
585
|
return new Intl.DateTimeFormat(e, { weekday: "short" }).format(r);
|
|
586
586
|
}
|
|
587
|
+
/**
|
|
588
|
+
* Get full day name
|
|
589
|
+
*/
|
|
590
|
+
static getDayName(t, e = "en-US") {
|
|
591
|
+
const r = new Date(2024, 0, 7 + t);
|
|
592
|
+
return new Intl.DateTimeFormat(e, { weekday: "long" }).format(r);
|
|
593
|
+
}
|
|
587
594
|
/**
|
|
588
595
|
* Get month name
|
|
589
596
|
*/
|
|
@@ -600,7 +607,7 @@ class p extends V {
|
|
|
600
607
|
return s && (s.toLowerCase() === "pm" && n < 12 ? o = n + 12 : s.toLowerCase() === "am" && n === 12 && (o = 0)), r.setHours(o, a || 0, 0, 0), r;
|
|
601
608
|
}
|
|
602
609
|
}
|
|
603
|
-
class
|
|
610
|
+
class k {
|
|
604
611
|
/**
|
|
605
612
|
* Create element with attributes and children
|
|
606
613
|
*/
|
|
@@ -795,7 +802,7 @@ class D {
|
|
|
795
802
|
return t.addEventListener("keydown", s), r == null || r.focus(), () => t.removeEventListener("keydown", s);
|
|
796
803
|
}
|
|
797
804
|
}
|
|
798
|
-
class
|
|
805
|
+
class f {
|
|
799
806
|
/**
|
|
800
807
|
* Get CSS variable value
|
|
801
808
|
*/
|
|
@@ -1132,7 +1139,7 @@ class u {
|
|
|
1132
1139
|
/**
|
|
1133
1140
|
* Default theme colors
|
|
1134
1141
|
*/
|
|
1135
|
-
v(
|
|
1142
|
+
v(f, "colors", {
|
|
1136
1143
|
primary: "#3B82F6",
|
|
1137
1144
|
// Modern Blue
|
|
1138
1145
|
secondary: "#64748B",
|
|
@@ -1165,7 +1172,7 @@ v(u, "colors", {
|
|
|
1165
1172
|
}), /**
|
|
1166
1173
|
* Common CSS variables
|
|
1167
1174
|
*/
|
|
1168
|
-
v(
|
|
1175
|
+
v(f, "cssVariables", {
|
|
1169
1176
|
// "Pro" Palette - Functional & Sharp
|
|
1170
1177
|
"--fc-primary-color": "#2563EB",
|
|
1171
1178
|
// International Blue (Focus)
|
|
@@ -1233,7 +1240,7 @@ v(u, "cssVariables", {
|
|
|
1233
1240
|
}), /**
|
|
1234
1241
|
* Get responsive breakpoints
|
|
1235
1242
|
*/
|
|
1236
|
-
v(
|
|
1243
|
+
v(f, "breakpoints", {
|
|
1237
1244
|
xs: "320px",
|
|
1238
1245
|
sm: "576px",
|
|
1239
1246
|
md: "768px",
|
|
@@ -1247,7 +1254,7 @@ class E {
|
|
|
1247
1254
|
* @param {StateManager} stateManager - The state manager instance
|
|
1248
1255
|
*/
|
|
1249
1256
|
constructor(t, e) {
|
|
1250
|
-
this.container = t, this.stateManager = e, this._listeners = [], this._scrolled = !1;
|
|
1257
|
+
this.container = t, this.stateManager = e, this._listeners = [], this._scrolled = !1, this._nowIndicatorTimer = null;
|
|
1251
1258
|
}
|
|
1252
1259
|
/**
|
|
1253
1260
|
* Render the view into the container
|
|
@@ -1262,7 +1269,7 @@ class E {
|
|
|
1262
1269
|
cleanup() {
|
|
1263
1270
|
this._listeners.forEach(({ element: t, event: e, handler: r }) => {
|
|
1264
1271
|
t.removeEventListener(e, r);
|
|
1265
|
-
}), this._listeners = [];
|
|
1272
|
+
}), this._listeners = [], this._nowIndicatorTimer && (clearInterval(this._nowIndicatorTimer), this._nowIndicatorTimer = null);
|
|
1266
1273
|
}
|
|
1267
1274
|
/**
|
|
1268
1275
|
* Add an event listener with automatic cleanup tracking
|
|
@@ -1280,7 +1287,7 @@ class E {
|
|
|
1280
1287
|
* @returns {string}
|
|
1281
1288
|
*/
|
|
1282
1289
|
escapeHTML(t) {
|
|
1283
|
-
return t == null ? "" :
|
|
1290
|
+
return t == null ? "" : k.escapeHTML(String(t));
|
|
1284
1291
|
}
|
|
1285
1292
|
/**
|
|
1286
1293
|
* Check if a date is today
|
|
@@ -1325,7 +1332,7 @@ class E {
|
|
|
1325
1332
|
* @returns {string} '#000000' or '#FFFFFF'
|
|
1326
1333
|
*/
|
|
1327
1334
|
getContrastingTextColor(t) {
|
|
1328
|
-
return !t || typeof t != "string" || t.charAt(0) !== "#" ? "white" :
|
|
1335
|
+
return !t || typeof t != "string" || t.charAt(0) !== "#" ? "white" : f.getContrastColor(t);
|
|
1329
1336
|
}
|
|
1330
1337
|
/**
|
|
1331
1338
|
* Render the "now" indicator line for time-based views
|
|
@@ -1335,6 +1342,19 @@ class E {
|
|
|
1335
1342
|
const t = /* @__PURE__ */ new Date();
|
|
1336
1343
|
return `<div class="fc-now-indicator" style="position: absolute; left: 0; right: 0; top: ${t.getHours() * 60 + t.getMinutes()}px; height: 2px; background: var(--fc-danger-color); z-index: 15; pointer-events: none;"></div>`;
|
|
1337
1344
|
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Start a timer that updates the now indicator position every 60 seconds.
|
|
1347
|
+
* Call this after render() in day/week views that show a now indicator.
|
|
1348
|
+
*/
|
|
1349
|
+
startNowIndicatorTimer() {
|
|
1350
|
+
this._nowIndicatorTimer && clearInterval(this._nowIndicatorTimer), this._nowIndicatorTimer = setInterval(() => {
|
|
1351
|
+
const t = this.container.querySelector(".fc-now-indicator");
|
|
1352
|
+
if (t) {
|
|
1353
|
+
const e = /* @__PURE__ */ new Date();
|
|
1354
|
+
t.style.top = `${e.getHours() * 60 + e.getMinutes()}px`;
|
|
1355
|
+
}
|
|
1356
|
+
}, 6e4);
|
|
1357
|
+
}
|
|
1338
1358
|
/**
|
|
1339
1359
|
* Compute overlap layout columns for a list of timed events.
|
|
1340
1360
|
* Returns a Map of event.id -> { column, totalColumns }.
|
|
@@ -1345,16 +1365,16 @@ class E {
|
|
|
1345
1365
|
computeOverlapLayout(t) {
|
|
1346
1366
|
if (!t || t.length === 0) return /* @__PURE__ */ new Map();
|
|
1347
1367
|
const e = t.map((o) => {
|
|
1348
|
-
const c = new Date(o.start),
|
|
1349
|
-
return { id: o.id, startMin:
|
|
1368
|
+
const c = new Date(o.start), l = new Date(o.end), d = c.getHours() * 60 + c.getMinutes(), p = Math.max(d + 1, l.getHours() * 60 + l.getMinutes());
|
|
1369
|
+
return { id: o.id, startMin: d, endMin: p };
|
|
1350
1370
|
});
|
|
1351
1371
|
e.sort((o, c) => o.startMin - c.startMin || c.endMin - c.startMin - (o.endMin - o.startMin));
|
|
1352
1372
|
const r = [], i = /* @__PURE__ */ new Map();
|
|
1353
1373
|
for (const o of e) {
|
|
1354
1374
|
let c = !1;
|
|
1355
|
-
for (let
|
|
1356
|
-
if (r[
|
|
1357
|
-
r[
|
|
1375
|
+
for (let l = 0; l < r.length; l++)
|
|
1376
|
+
if (r[l] <= o.startMin) {
|
|
1377
|
+
r[l] = o.endMin, i.set(o.id, { column: l, totalColumns: 0 }), c = !0;
|
|
1358
1378
|
break;
|
|
1359
1379
|
}
|
|
1360
1380
|
c || (i.set(o.id, { column: r.length, totalColumns: 0 }), r.push(o.endMin));
|
|
@@ -1365,9 +1385,9 @@ class E {
|
|
|
1365
1385
|
n.length === 0 || o.startMin < a ? (n.push(o), a = Math.max(a, o.endMin)) : (s.push(n), n = [o], a = o.endMin);
|
|
1366
1386
|
n.length > 0 && s.push(n);
|
|
1367
1387
|
for (const o of s) {
|
|
1368
|
-
const c = Math.max(...o.map((
|
|
1369
|
-
for (const
|
|
1370
|
-
i.get(
|
|
1388
|
+
const c = Math.max(...o.map((l) => i.get(l.id).column)) + 1;
|
|
1389
|
+
for (const l of o)
|
|
1390
|
+
i.get(l.id).totalColumns = c;
|
|
1371
1391
|
}
|
|
1372
1392
|
return i;
|
|
1373
1393
|
}
|
|
@@ -1380,20 +1400,20 @@ class E {
|
|
|
1380
1400
|
* @returns {string} HTML string
|
|
1381
1401
|
*/
|
|
1382
1402
|
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),
|
|
1403
|
+
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), l = this.getContrastingTextColor(c), d = r ? "4px 8px" : "8px 12px", p = r ? "11px" : "13px", g = r ? 2 : 12, b = r ? 2 : 24, S = r ? "4px" : "6px";
|
|
1384
1404
|
let y, x;
|
|
1385
1405
|
if (i && i.has(t.id)) {
|
|
1386
|
-
const { column:
|
|
1387
|
-
y = `calc(${g}px + ${
|
|
1406
|
+
const { column: C, totalColumns: _ } = i.get(t.id), $ = `(100% - ${g + b}px)`;
|
|
1407
|
+
y = `calc(${g}px + ${C} * ${$} / ${_})`, x = `calc(${$} / ${_})`;
|
|
1388
1408
|
} else
|
|
1389
1409
|
y = `${g}px`, x = `calc(100% - ${g + b}px)`;
|
|
1390
1410
|
return `
|
|
1391
1411
|
<div class="fc-event fc-timed-event" data-event-id="${this.escapeHTML(t.id)}"
|
|
1392
1412
|
style="position: absolute; top: ${a}px; height: ${o}px;
|
|
1393
1413
|
left: ${y}; width: ${x};
|
|
1394
|
-
background-color: ${c}; border-radius: ${
|
|
1395
|
-
padding: ${
|
|
1396
|
-
font-weight: 500; color: ${
|
|
1414
|
+
background-color: ${c}; border-radius: ${S};
|
|
1415
|
+
padding: ${d}; font-size: ${p};
|
|
1416
|
+
font-weight: 500; color: ${l}; overflow: hidden;
|
|
1397
1417
|
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
|
1398
1418
|
cursor: pointer; z-index: 5;">
|
|
1399
1419
|
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
|
@@ -1411,7 +1431,7 @@ class E {
|
|
|
1411
1431
|
* @returns {string}
|
|
1412
1432
|
*/
|
|
1413
1433
|
getEventColor(t) {
|
|
1414
|
-
return
|
|
1434
|
+
return f.sanitizeColor(t == null ? void 0 : t.backgroundColor, "#2563eb");
|
|
1415
1435
|
}
|
|
1416
1436
|
/**
|
|
1417
1437
|
* Attach common event handlers for day/event clicks
|
|
@@ -1455,10 +1475,10 @@ class w extends E {
|
|
|
1455
1475
|
}), s += "</div></div>", s;
|
|
1456
1476
|
}
|
|
1457
1477
|
_getDayNames(t) {
|
|
1458
|
-
const e =
|
|
1478
|
+
const e = this.stateManager.getState().config.locale || "en-US", r = [];
|
|
1459
1479
|
for (let i = 0; i < 7; i++) {
|
|
1460
1480
|
const s = (t + i) % 7;
|
|
1461
|
-
r.push(e
|
|
1481
|
+
r.push(u.getDayAbbreviation(s, e));
|
|
1462
1482
|
}
|
|
1463
1483
|
return r;
|
|
1464
1484
|
}
|
|
@@ -1477,7 +1497,7 @@ class w extends E {
|
|
|
1477
1497
|
${t.dayOfMonth}
|
|
1478
1498
|
</div>
|
|
1479
1499
|
<div class="fc-day-events" style="display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: hidden;">
|
|
1480
|
-
${o.map((
|
|
1500
|
+
${o.map((l) => this._renderEvent(l)).join("")}
|
|
1481
1501
|
${c > 0 ? `<div class="fc-more-events" style="font-size: 10px; color: var(--fc-text-light); padding: 2px 4px; font-weight: 500;">+${c} more</div>` : ""}
|
|
1482
1502
|
</div>
|
|
1483
1503
|
</div>
|
|
@@ -1514,19 +1534,19 @@ class z extends E {
|
|
|
1514
1534
|
}
|
|
1515
1535
|
this.cleanup(), this._scrolled = !1;
|
|
1516
1536
|
const e = this.stateManager.getState().config, r = this._renderWeekView(t, e);
|
|
1517
|
-
this.container.innerHTML = r, this._attachEventHandlers(), this._scrollToCurrentTime();
|
|
1537
|
+
this.container.innerHTML = r, this._attachEventHandlers(), this._scrollToCurrentTime(), this.startNowIndicatorTimer();
|
|
1518
1538
|
}
|
|
1519
1539
|
_renderWeekView(t, e) {
|
|
1520
|
-
const r = t.days, i =
|
|
1540
|
+
const r = t.days, i = this.stateManager.getState().config.locale || "en-US", s = Array.from({ length: 24 }, (a, o) => o), n = r.map((a) => {
|
|
1521
1541
|
const o = new Date(a.date), c = a.events || [];
|
|
1522
1542
|
return {
|
|
1523
1543
|
...a,
|
|
1524
1544
|
date: o,
|
|
1525
|
-
dayName:
|
|
1545
|
+
dayName: u.getDayAbbreviation(o.getDay(), i),
|
|
1526
1546
|
dayOfMonth: o.getDate(),
|
|
1527
1547
|
isToday: this.isToday(o),
|
|
1528
|
-
timedEvents: c.filter((
|
|
1529
|
-
allDayEvents: c.filter((
|
|
1548
|
+
timedEvents: c.filter((l) => !l.allDay),
|
|
1549
|
+
allDayEvents: c.filter((l) => l.allDay)
|
|
1530
1550
|
};
|
|
1531
1551
|
});
|
|
1532
1552
|
return `
|
|
@@ -1651,40 +1671,40 @@ class B extends E {
|
|
|
1651
1671
|
}
|
|
1652
1672
|
this.cleanup(), this._scrolled = !1;
|
|
1653
1673
|
const e = this.stateManager.getState().config, r = this._renderDayView(t, e);
|
|
1654
|
-
this.container.innerHTML = r, this._attachEventHandlers(), this._scrollToCurrentTime();
|
|
1674
|
+
this.container.innerHTML = r, this._attachEventHandlers(), this._scrollToCurrentTime(), this.startNowIndicatorTimer();
|
|
1655
1675
|
}
|
|
1656
1676
|
_renderDayView(t, e) {
|
|
1657
|
-
var
|
|
1658
|
-
const r = ((
|
|
1677
|
+
var d, p;
|
|
1678
|
+
const r = ((p = (d = this.stateManager) == null ? void 0 : d.getState()) == null ? void 0 : p.currentDate) || /* @__PURE__ */ new Date(), i = this._extractDayData(t, r);
|
|
1659
1679
|
if (!i)
|
|
1660
1680
|
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,
|
|
1681
|
+
const { dayDate: s, dayName: n, isToday: a, allDayEvents: o, timedEvents: c } = i, l = Array.from({ length: 24 }, (g, b) => b);
|
|
1662
1682
|
return `
|
|
1663
1683
|
<div class="fc-day-view" style="display: flex; flex-direction: column; height: 100%; background: var(--fc-background); overflow: hidden;">
|
|
1664
1684
|
${this._renderHeader(s, n, a)}
|
|
1665
1685
|
${this._renderAllDayRow(o, s)}
|
|
1666
|
-
${this._renderTimeGrid(c, a, s,
|
|
1686
|
+
${this._renderTimeGrid(c, a, s, l)}
|
|
1667
1687
|
</div>
|
|
1668
1688
|
`;
|
|
1669
1689
|
}
|
|
1670
1690
|
_extractDayData(t, e) {
|
|
1671
1691
|
let r, i, s, n, a;
|
|
1672
|
-
const o =
|
|
1692
|
+
const o = this.stateManager.getState().config.locale || "en-US";
|
|
1673
1693
|
if (t.type === "day" && t.date)
|
|
1674
|
-
if (r = new Date(t.date), i = t.dayName ||
|
|
1694
|
+
if (r = new Date(t.date), i = t.dayName || u.getDayName(r.getDay(), o), s = t.isToday !== void 0 ? t.isToday : this.isToday(r), n = t.allDayEvents || [], t.hours && Array.isArray(t.hours)) {
|
|
1675
1695
|
const c = /* @__PURE__ */ new Map();
|
|
1676
|
-
t.hours.forEach((
|
|
1677
|
-
(
|
|
1678
|
-
c.has(
|
|
1696
|
+
t.hours.forEach((l) => {
|
|
1697
|
+
(l.events || []).forEach((d) => {
|
|
1698
|
+
c.has(d.id) || c.set(d.id, d);
|
|
1679
1699
|
});
|
|
1680
1700
|
}), a = Array.from(c.values());
|
|
1681
1701
|
} else
|
|
1682
1702
|
a = [];
|
|
1683
1703
|
else if (t.days && t.days.length > 0) {
|
|
1684
|
-
const c = t.days.find((
|
|
1685
|
-
r = new Date(c.date), i =
|
|
1686
|
-
const
|
|
1687
|
-
n =
|
|
1704
|
+
const c = t.days.find((d) => this.isSameDay(new Date(d.date), e)) || t.days[0];
|
|
1705
|
+
r = new Date(c.date), i = u.getDayName(r.getDay(), o), s = this.isToday(r);
|
|
1706
|
+
const l = c.events || [];
|
|
1707
|
+
n = l.filter((d) => d.allDay), a = l.filter((d) => !d.allDay);
|
|
1688
1708
|
} else
|
|
1689
1709
|
return null;
|
|
1690
1710
|
return { dayDate: r, dayName: i, isToday: s, allDayEvents: n, timedEvents: a };
|
|
@@ -1812,8 +1832,8 @@ class A extends M {
|
|
|
1812
1832
|
}
|
|
1813
1833
|
getStyles() {
|
|
1814
1834
|
return `
|
|
1815
|
-
${
|
|
1816
|
-
${
|
|
1835
|
+
${f.getBaseStyles()}
|
|
1836
|
+
${f.getButtonStyles()}
|
|
1817
1837
|
|
|
1818
1838
|
:host {
|
|
1819
1839
|
display: none;
|
|
@@ -2058,7 +2078,7 @@ class A extends M {
|
|
|
2058
2078
|
});
|
|
2059
2079
|
}
|
|
2060
2080
|
open(t = /* @__PURE__ */ new Date()) {
|
|
2061
|
-
this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = t, this._formData.end = new Date(t.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 =
|
|
2081
|
+
this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = t, this._formData.end = new Date(t.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 = k.trapFocus(this.modalContent));
|
|
2062
2082
|
}
|
|
2063
2083
|
close() {
|
|
2064
2084
|
this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
|
|
@@ -2103,7 +2123,7 @@ const m = class m extends M {
|
|
|
2103
2123
|
timeZone: this.getAttribute("timezone") || Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
2104
2124
|
weekStartsOn: parseInt(this.getAttribute("week-starts-on") || "0")
|
|
2105
2125
|
};
|
|
2106
|
-
this.stateManager = new
|
|
2126
|
+
this.stateManager = new V(t), this._stateUnsubscribe = this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
|
|
2107
2127
|
}
|
|
2108
2128
|
setupEventListeners() {
|
|
2109
2129
|
this._busUnsubscribers.forEach((r) => r()), this._busUnsubscribers = [];
|
|
@@ -2222,10 +2242,10 @@ const m = class m extends M {
|
|
|
2222
2242
|
getStyles() {
|
|
2223
2243
|
const t = this.getAttribute("height") || "800px";
|
|
2224
2244
|
return `
|
|
2225
|
-
${
|
|
2226
|
-
${
|
|
2227
|
-
${
|
|
2228
|
-
${
|
|
2245
|
+
${f.getBaseStyles()}
|
|
2246
|
+
${f.getButtonStyles()}
|
|
2247
|
+
${f.getGridStyles()}
|
|
2248
|
+
${f.getAnimations()}
|
|
2229
2249
|
|
|
2230
2250
|
:host {
|
|
2231
2251
|
--calendar-height: ${t};
|
|
@@ -2614,7 +2634,7 @@ const m = class m extends M {
|
|
|
2614
2634
|
return `
|
|
2615
2635
|
<div class="force-calendar">
|
|
2616
2636
|
<div class="fc-error">
|
|
2617
|
-
<p><strong>Error:</strong> ${
|
|
2637
|
+
<p><strong>Error:</strong> ${k.escapeHTML(s.message || "An error occurred")}</p>
|
|
2618
2638
|
</div>
|
|
2619
2639
|
</div>
|
|
2620
2640
|
`;
|
|
@@ -2722,15 +2742,15 @@ const m = class m extends M {
|
|
|
2722
2742
|
const r = this.stateManager.getState().config.locale;
|
|
2723
2743
|
switch (e) {
|
|
2724
2744
|
case "month":
|
|
2725
|
-
return
|
|
2745
|
+
return u.formatDate(t, "month", r);
|
|
2726
2746
|
case "week": {
|
|
2727
|
-
const i =
|
|
2728
|
-
return
|
|
2747
|
+
const i = u.startOfWeek(t), s = u.endOfWeek(t);
|
|
2748
|
+
return u.formatDateRange(i, s, r);
|
|
2729
2749
|
}
|
|
2730
2750
|
case "day":
|
|
2731
|
-
return
|
|
2751
|
+
return u.formatDate(t, "long", r);
|
|
2732
2752
|
default:
|
|
2733
|
-
return
|
|
2753
|
+
return u.formatDate(t, "month", r);
|
|
2734
2754
|
}
|
|
2735
2755
|
}
|
|
2736
2756
|
getIcon(t) {
|
|
@@ -2792,19 +2812,19 @@ v(m, "RENDERERS", {
|
|
|
2792
2812
|
week: z,
|
|
2793
2813
|
day: B
|
|
2794
2814
|
});
|
|
2795
|
-
let
|
|
2796
|
-
customElements.get("forcecal-main") || customElements.define("forcecal-main",
|
|
2815
|
+
let D = m;
|
|
2816
|
+
customElements.get("forcecal-main") || customElements.define("forcecal-main", D);
|
|
2797
2817
|
export {
|
|
2798
2818
|
M as BaseComponent,
|
|
2799
2819
|
E as BaseViewRenderer,
|
|
2800
|
-
|
|
2801
|
-
|
|
2820
|
+
k as DOMUtils,
|
|
2821
|
+
u as DateUtils,
|
|
2802
2822
|
B as DayViewRenderer,
|
|
2803
2823
|
T as EventBus,
|
|
2804
|
-
|
|
2824
|
+
D as ForceCalendar,
|
|
2805
2825
|
w as MonthViewRenderer,
|
|
2806
|
-
|
|
2807
|
-
|
|
2826
|
+
V as StateManager,
|
|
2827
|
+
f as StyleUtils,
|
|
2808
2828
|
z as WeekViewRenderer,
|
|
2809
2829
|
U as eventBus
|
|
2810
2830
|
};
|