@forcecalendar/interface 0.10.0 → 1.0.1
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 +198 -176
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +28 -28
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/views/MonthView.js +24 -5
- package/src/core/EventBus.js +6 -3
- package/src/core/StateManager.js +34 -14
- package/src/utils/DOMUtils.js +11 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
var U = (u, e, t) => e in u ?
|
|
1
|
+
var H = Object.defineProperty;
|
|
2
|
+
var U = (u, e, t) => e in u ? H(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
3
3
|
var C = (u, e, t) => U(u, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
class S extends HTMLElement {
|
|
5
5
|
constructor() {
|
|
@@ -397,7 +397,7 @@ class M {
|
|
|
397
397
|
if (!e) return null;
|
|
398
398
|
if (t === "UTC") return new Date(e);
|
|
399
399
|
const s = this.getTimezoneOffset(e, t);
|
|
400
|
-
return new Date(e.getTime()
|
|
400
|
+
return new Date(e.getTime() + s * 60 * 1e3);
|
|
401
401
|
}
|
|
402
402
|
/**
|
|
403
403
|
* Convert UTC date to timezone
|
|
@@ -409,7 +409,7 @@ class M {
|
|
|
409
409
|
if (!e) return null;
|
|
410
410
|
if (t === "UTC") return new Date(e);
|
|
411
411
|
const s = this.getTimezoneOffset(e, t);
|
|
412
|
-
return new Date(e.getTime()
|
|
412
|
+
return new Date(e.getTime() - s * 60 * 1e3);
|
|
413
413
|
}
|
|
414
414
|
/**
|
|
415
415
|
* Get timezone offset in minutes
|
|
@@ -708,22 +708,22 @@ class x {
|
|
|
708
708
|
borderColor: l = null,
|
|
709
709
|
textColor: d = null,
|
|
710
710
|
recurring: h = !1,
|
|
711
|
-
recurrenceRule:
|
|
712
|
-
timeZone:
|
|
711
|
+
recurrenceRule: y = null,
|
|
712
|
+
timeZone: b = null,
|
|
713
713
|
endTimeZone: D = null,
|
|
714
714
|
status: k = "confirmed",
|
|
715
|
-
visibility:
|
|
715
|
+
visibility: T = "public",
|
|
716
716
|
organizer: A = null,
|
|
717
|
-
attendees:
|
|
717
|
+
attendees: z = [],
|
|
718
718
|
reminders: I = [],
|
|
719
719
|
category: L,
|
|
720
720
|
// Support singular category (no default)
|
|
721
|
-
categories:
|
|
721
|
+
categories: F,
|
|
722
722
|
// Support plural categories (no default)
|
|
723
|
-
attachments:
|
|
723
|
+
attachments: O = [],
|
|
724
724
|
conferenceData: _ = null,
|
|
725
|
-
metadata:
|
|
726
|
-
...
|
|
725
|
+
metadata: R = {},
|
|
726
|
+
...B
|
|
727
727
|
// Capture any extra properties
|
|
728
728
|
}) {
|
|
729
729
|
const m = x.normalize({
|
|
@@ -739,22 +739,22 @@ class x {
|
|
|
739
739
|
borderColor: l,
|
|
740
740
|
textColor: d,
|
|
741
741
|
recurring: h,
|
|
742
|
-
recurrenceRule:
|
|
743
|
-
timeZone:
|
|
742
|
+
recurrenceRule: y,
|
|
743
|
+
timeZone: b,
|
|
744
744
|
endTimeZone: D,
|
|
745
745
|
status: k,
|
|
746
|
-
visibility:
|
|
746
|
+
visibility: T,
|
|
747
747
|
organizer: A,
|
|
748
|
-
attendees:
|
|
748
|
+
attendees: z,
|
|
749
749
|
reminders: I,
|
|
750
750
|
category: L,
|
|
751
751
|
// Pass category to normalize
|
|
752
|
-
categories:
|
|
752
|
+
categories: F,
|
|
753
753
|
// Pass categories to normalize
|
|
754
|
-
attachments:
|
|
754
|
+
attachments: O,
|
|
755
755
|
conferenceData: _,
|
|
756
|
-
metadata:
|
|
757
|
-
...
|
|
756
|
+
metadata: R,
|
|
757
|
+
...B
|
|
758
758
|
// Pass any extra properties
|
|
759
759
|
});
|
|
760
760
|
x.validate(m), this.id = m.id, this.title = m.title, this._timezoneManager = new M(), 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();
|
|
@@ -1202,7 +1202,7 @@ class x {
|
|
|
1202
1202
|
return this.conferenceData !== null;
|
|
1203
1203
|
}
|
|
1204
1204
|
}
|
|
1205
|
-
let f = class
|
|
1205
|
+
let f = class w {
|
|
1206
1206
|
/**
|
|
1207
1207
|
* Get the start of a day
|
|
1208
1208
|
* @param {Date} date - The date
|
|
@@ -1238,7 +1238,7 @@ let f = class b {
|
|
|
1238
1238
|
* @returns {Date}
|
|
1239
1239
|
*/
|
|
1240
1240
|
static endOfWeek(e, t = 0) {
|
|
1241
|
-
const s =
|
|
1241
|
+
const s = w.startOfWeek(e, t);
|
|
1242
1242
|
return s.setTime(s.getTime() + 6 * 24 * 60 * 60 * 1e3), s.setHours(23, 59, 59, 999), s;
|
|
1243
1243
|
}
|
|
1244
1244
|
/**
|
|
@@ -1290,7 +1290,7 @@ let f = class b {
|
|
|
1290
1290
|
* @returns {Date}
|
|
1291
1291
|
*/
|
|
1292
1292
|
static addWeeks(e, t) {
|
|
1293
|
-
return
|
|
1293
|
+
return w.addDays(e, t * 7);
|
|
1294
1294
|
}
|
|
1295
1295
|
/**
|
|
1296
1296
|
* Add months to a date
|
|
@@ -1372,7 +1372,7 @@ let f = class b {
|
|
|
1372
1372
|
* @returns {boolean}
|
|
1373
1373
|
*/
|
|
1374
1374
|
static isSameWeek(e, t, s = 0) {
|
|
1375
|
-
const i =
|
|
1375
|
+
const i = w.startOfWeek(e, s), a = w.startOfWeek(t, s);
|
|
1376
1376
|
return i.toDateString() === a.toDateString();
|
|
1377
1377
|
}
|
|
1378
1378
|
/**
|
|
@@ -1410,7 +1410,7 @@ let f = class b {
|
|
|
1410
1410
|
* @returns {number}
|
|
1411
1411
|
*/
|
|
1412
1412
|
static differenceInWeeks(e, t) {
|
|
1413
|
-
return Math.floor(
|
|
1413
|
+
return Math.floor(w.differenceInDays(e, t) / 7);
|
|
1414
1414
|
}
|
|
1415
1415
|
/**
|
|
1416
1416
|
* Get the difference in months between two dates
|
|
@@ -1466,7 +1466,7 @@ let f = class b {
|
|
|
1466
1466
|
* @returns {string}
|
|
1467
1467
|
*/
|
|
1468
1468
|
static getMonthName(e, t = "en-US", s = "long") {
|
|
1469
|
-
return
|
|
1469
|
+
return w.format(e, t, { month: s });
|
|
1470
1470
|
}
|
|
1471
1471
|
/**
|
|
1472
1472
|
* Get day name
|
|
@@ -1476,7 +1476,7 @@ let f = class b {
|
|
|
1476
1476
|
* @returns {string}
|
|
1477
1477
|
*/
|
|
1478
1478
|
static getDayName(e, t = "en-US", s = "long") {
|
|
1479
|
-
return
|
|
1479
|
+
return w.format(e, t, { weekday: s });
|
|
1480
1480
|
}
|
|
1481
1481
|
/**
|
|
1482
1482
|
* Format time
|
|
@@ -1486,7 +1486,7 @@ let f = class b {
|
|
|
1486
1486
|
* @returns {string}
|
|
1487
1487
|
*/
|
|
1488
1488
|
static formatTime(e, t = "en-US", s = !1) {
|
|
1489
|
-
return
|
|
1489
|
+
return w.format(e, t, {
|
|
1490
1490
|
hour: "numeric",
|
|
1491
1491
|
minute: "2-digit",
|
|
1492
1492
|
hour12: !s
|
|
@@ -1508,7 +1508,7 @@ let f = class b {
|
|
|
1508
1508
|
* @returns {Date}
|
|
1509
1509
|
*/
|
|
1510
1510
|
static setTime(e, t) {
|
|
1511
|
-
const s = new Date(e), { hours: i, minutes: a } =
|
|
1511
|
+
const s = new Date(e), { hours: i, minutes: a } = w.parseTime(t);
|
|
1512
1512
|
return s.setHours(i, a, 0, 0), s;
|
|
1513
1513
|
}
|
|
1514
1514
|
/**
|
|
@@ -1587,7 +1587,7 @@ let f = class b {
|
|
|
1587
1587
|
* @returns {boolean}
|
|
1588
1588
|
*/
|
|
1589
1589
|
static isDST(e, t) {
|
|
1590
|
-
const s = new Date(e.getFullYear(), 0, 1), i = new Date(e.getFullYear(), 6, 1), a =
|
|
1590
|
+
const s = new Date(e.getFullYear(), 0, 1), i = new Date(e.getFullYear(), 6, 1), a = w.getTimezoneOffset(s, t), n = w.getTimezoneOffset(i, t), r = w.getTimezoneOffset(e, t);
|
|
1591
1591
|
return Math.max(a, n) === r;
|
|
1592
1592
|
}
|
|
1593
1593
|
/**
|
|
@@ -1598,9 +1598,9 @@ let f = class b {
|
|
|
1598
1598
|
* @returns {Date}
|
|
1599
1599
|
*/
|
|
1600
1600
|
static addHoursWithDST(e, t, s) {
|
|
1601
|
-
const i = new Date(e), a =
|
|
1601
|
+
const i = new Date(e), a = w.getTimezoneOffset(e, s);
|
|
1602
1602
|
i.setTime(i.getTime() + t * 60 * 60 * 1e3);
|
|
1603
|
-
const n =
|
|
1603
|
+
const n = w.getTimezoneOffset(i, s);
|
|
1604
1604
|
if (a !== n) {
|
|
1605
1605
|
const r = (n - a) * 6e4;
|
|
1606
1606
|
i.setTime(i.getTime() + r);
|
|
@@ -1619,7 +1619,7 @@ let f = class b {
|
|
|
1619
1619
|
* @returns {Date}
|
|
1620
1620
|
*/
|
|
1621
1621
|
static createInTimeZone(e, t, s, i = 0, a = 0, n = 0, r) {
|
|
1622
|
-
const o = `${e}-${String(t + 1).padStart(2, "0")}-${String(s).padStart(2, "0")}`, c = `${String(i).padStart(2, "0")}:${String(a).padStart(2, "0")}:${String(n).padStart(2, "0")}`, l = /* @__PURE__ */ new Date(`${o}T${c}`), d =
|
|
1622
|
+
const o = `${e}-${String(t + 1).padStart(2, "0")}-${String(s).padStart(2, "0")}`, c = `${String(i).padStart(2, "0")}:${String(a).padStart(2, "0")}:${String(n).padStart(2, "0")}`, l = /* @__PURE__ */ new Date(`${o}T${c}`), d = w.getTimezoneOffset(l, r), h = l.getTime() + d * 6e4;
|
|
1623
1623
|
return new Date(h);
|
|
1624
1624
|
}
|
|
1625
1625
|
};
|
|
@@ -1715,18 +1715,16 @@ class Y {
|
|
|
1715
1715
|
}
|
|
1716
1716
|
/**
|
|
1717
1717
|
* Parse BYDAY value
|
|
1718
|
+
* Returns array of strings like ['MO', '2TU', '-1FR'] for compatibility with RecurrenceEngine
|
|
1718
1719
|
* @private
|
|
1719
1720
|
*/
|
|
1720
1721
|
static parseByDay(e) {
|
|
1721
1722
|
const t = e.split(","), s = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"], i = [];
|
|
1722
1723
|
for (const a of t) {
|
|
1723
|
-
const
|
|
1724
|
-
if (
|
|
1725
|
-
const [
|
|
1726
|
-
s.includes(
|
|
1727
|
-
weekday: c,
|
|
1728
|
-
nth: o ? parseInt(o, 10) : null
|
|
1729
|
-
});
|
|
1724
|
+
const r = a.trim().toUpperCase().match(/^([+-]?\d*)([A-Z]{2})$/);
|
|
1725
|
+
if (r) {
|
|
1726
|
+
const [o, c, l] = r;
|
|
1727
|
+
s.includes(l) && i.push(c ? `${c}${l}` : l);
|
|
1730
1728
|
}
|
|
1731
1729
|
}
|
|
1732
1730
|
return i;
|
|
@@ -1877,16 +1875,16 @@ class N {
|
|
|
1877
1875
|
const n = this.parseRule(e.recurrenceRule), r = [], o = e.end - e.start, c = a || e.timeZone || "UTC", l = new M();
|
|
1878
1876
|
let d = new Date(e.start), h = 0;
|
|
1879
1877
|
n.until && n.until < s && (s = n.until);
|
|
1880
|
-
let
|
|
1878
|
+
let y = l.getTimezoneOffset(d, c);
|
|
1881
1879
|
for (; d <= s && h < i; ) {
|
|
1882
1880
|
if (d >= t) {
|
|
1883
|
-
const
|
|
1884
|
-
if (k !==
|
|
1885
|
-
const
|
|
1886
|
-
|
|
1881
|
+
const b = new Date(d), D = new Date(d.getTime() + o), k = l.getTimezoneOffset(b, c);
|
|
1882
|
+
if (k !== y) {
|
|
1883
|
+
const T = y - k;
|
|
1884
|
+
b.setMinutes(b.getMinutes() + T), D.setMinutes(D.getMinutes() + T);
|
|
1887
1885
|
}
|
|
1888
|
-
|
|
1889
|
-
start:
|
|
1886
|
+
y = k, this.isException(b, n, e.id) || r.push({
|
|
1887
|
+
start: b,
|
|
1890
1888
|
end: D,
|
|
1891
1889
|
recurringEventId: e.id,
|
|
1892
1890
|
timezone: c,
|
|
@@ -1920,10 +1918,12 @@ class N {
|
|
|
1920
1918
|
i.setDate(i.getDate() + t.interval);
|
|
1921
1919
|
break;
|
|
1922
1920
|
case "WEEKLY":
|
|
1923
|
-
if (t.byDay && t.byDay.length > 0)
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1921
|
+
if (t.byDay && t.byDay.length > 0) {
|
|
1922
|
+
let n = 0;
|
|
1923
|
+
for (i.setDate(i.getDate() + 1); !this.matchesByDay(i, t.byDay) && n < 8; )
|
|
1924
|
+
i.setDate(i.getDate() + 1), n++;
|
|
1925
|
+
n >= 8 && (console.warn("RecurrenceEngine: Invalid byDay rule, falling back to weekly interval"), i.setDate(i.getDate() + 7 * t.interval - 8));
|
|
1926
|
+
} else
|
|
1927
1927
|
i.setDate(i.getDate() + 7 * t.interval);
|
|
1928
1928
|
break;
|
|
1929
1929
|
case "MONTHLY":
|
|
@@ -2089,7 +2089,7 @@ class N {
|
|
|
2089
2089
|
return a && (n = `${a === -1 ? "Last" : ["", "1st", "2nd", "3rd", "4th", "5th"][a] || `${a}th`} ${n}`), n;
|
|
2090
2090
|
}
|
|
2091
2091
|
}
|
|
2092
|
-
class
|
|
2092
|
+
class $ {
|
|
2093
2093
|
/**
|
|
2094
2094
|
* Create a new LRU Cache
|
|
2095
2095
|
* @param {number} capacity - Maximum number of items in cache
|
|
@@ -2257,7 +2257,7 @@ class W {
|
|
|
2257
2257
|
if (e.jsHeapSizeLimit && e.usedJSHeapSize)
|
|
2258
2258
|
return e.usedJSHeapSize / e.jsHeapSizeLimit;
|
|
2259
2259
|
}
|
|
2260
|
-
if (typeof process < "u" && process.memoryUsage) {
|
|
2260
|
+
if (typeof process < "u" && typeof process.memoryUsage == "function") {
|
|
2261
2261
|
const e = process.memoryUsage();
|
|
2262
2262
|
return e.heapUsed / e.heapTotal;
|
|
2263
2263
|
}
|
|
@@ -2401,7 +2401,7 @@ class V {
|
|
|
2401
2401
|
enableAdaptiveMemory: !0,
|
|
2402
2402
|
// Enable adaptive memory management
|
|
2403
2403
|
...e
|
|
2404
|
-
}, this.eventCache = new
|
|
2404
|
+
}, this.eventCache = new $(this.config.cacheCapacity), this.queryCache = new $(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new $(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new W({
|
|
2405
2405
|
checkInterval: 3e4,
|
|
2406
2406
|
memoryThreshold: 0.75,
|
|
2407
2407
|
criticalThreshold: 0.9
|
|
@@ -3124,24 +3124,29 @@ class Z {
|
|
|
3124
3124
|
*/
|
|
3125
3125
|
getEventsForDate(e, t = null) {
|
|
3126
3126
|
t = t || this.defaultTimezone, f.getLocalDateString(e);
|
|
3127
|
-
const s =
|
|
3128
|
-
for (let
|
|
3129
|
-
const
|
|
3130
|
-
|
|
3131
|
-
const
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3127
|
+
const s = /* @__PURE__ */ new Set(), i = new Date(e);
|
|
3128
|
+
for (let l = -1; l <= 1; l++) {
|
|
3129
|
+
const d = new Date(i);
|
|
3130
|
+
d.setDate(d.getDate() + l);
|
|
3131
|
+
const h = f.getLocalDateString(d), y = this.indices.byDate.get(h);
|
|
3132
|
+
y && y.forEach((b) => s.add(b));
|
|
3133
|
+
}
|
|
3134
|
+
const a = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, n = this.indices.byMonth.get(a);
|
|
3135
|
+
n && n.forEach((l) => s.add(l));
|
|
3136
|
+
const r = [], o = new Date(e);
|
|
3137
|
+
o.setHours(0, 0, 0, 0);
|
|
3138
|
+
const c = new Date(e);
|
|
3139
|
+
c.setHours(23, 59, 59, 999);
|
|
3140
|
+
for (const l of s) {
|
|
3141
|
+
const d = this.events.get(l);
|
|
3142
|
+
if (d) {
|
|
3143
|
+
const h = d.getStartInTimezone(t), y = d.getEndInTimezone(t);
|
|
3144
|
+
h <= c && y >= o && r.push(d);
|
|
3140
3145
|
}
|
|
3141
3146
|
}
|
|
3142
|
-
return
|
|
3143
|
-
const
|
|
3144
|
-
return
|
|
3147
|
+
return r.sort((l, d) => {
|
|
3148
|
+
const h = l.getStartInTimezone(t), y = d.getStartInTimezone(t), b = h - y;
|
|
3149
|
+
return b !== 0 ? b : d.duration - l.duration;
|
|
3145
3150
|
});
|
|
3146
3151
|
}
|
|
3147
3152
|
/**
|
|
@@ -3158,8 +3163,8 @@ class Z {
|
|
|
3158
3163
|
(this.indices.byDate.get(l) || /* @__PURE__ */ new Set()).forEach((h) => {
|
|
3159
3164
|
if (!o.has(h) && h !== s) {
|
|
3160
3165
|
o.add(h);
|
|
3161
|
-
const
|
|
3162
|
-
|
|
3166
|
+
const y = this.events.get(h);
|
|
3167
|
+
y && y.overlaps({ start: e, end: t }) && i.push(y);
|
|
3163
3168
|
}
|
|
3164
3169
|
});
|
|
3165
3170
|
}), i.sort((c, l) => c.start - l.start);
|
|
@@ -4336,22 +4341,22 @@ class K {
|
|
|
4336
4341
|
let l = new Date(o);
|
|
4337
4342
|
const d = a ? 6 : Math.ceil((r.getDate() + f.getDayOfWeek(n, i)) / 7);
|
|
4338
4343
|
for (let h = 0; h < d; h++) {
|
|
4339
|
-
const
|
|
4344
|
+
const y = {
|
|
4340
4345
|
weekNumber: f.getWeekNumber(l),
|
|
4341
4346
|
days: []
|
|
4342
4347
|
};
|
|
4343
|
-
for (let
|
|
4344
|
-
const D = new Date(l), k = D.getMonth() === s,
|
|
4345
|
-
|
|
4348
|
+
for (let b = 0; b < 7; b++) {
|
|
4349
|
+
const D = new Date(l), k = D.getMonth() === s, T = f.isToday(D), A = D.getDay() === 0 || D.getDay() === 6;
|
|
4350
|
+
y.days.push({
|
|
4346
4351
|
date: D,
|
|
4347
4352
|
dayOfMonth: D.getDate(),
|
|
4348
4353
|
isCurrentMonth: k,
|
|
4349
|
-
isToday:
|
|
4354
|
+
isToday: T,
|
|
4350
4355
|
isWeekend: A,
|
|
4351
4356
|
events: this.getEventsForDate(D)
|
|
4352
4357
|
}), l = f.addDays(l, 1);
|
|
4353
4358
|
}
|
|
4354
|
-
c.push(
|
|
4359
|
+
c.push(y);
|
|
4355
4360
|
}
|
|
4356
4361
|
return {
|
|
4357
4362
|
type: "month",
|
|
@@ -4590,30 +4595,31 @@ class G {
|
|
|
4590
4595
|
async emit(e, t) {
|
|
4591
4596
|
const s = [];
|
|
4592
4597
|
if (this.events.has(e)) {
|
|
4593
|
-
const
|
|
4594
|
-
for (const
|
|
4595
|
-
const { handler:
|
|
4596
|
-
|
|
4598
|
+
const a = [...this.events.get(e)];
|
|
4599
|
+
for (const n of a) {
|
|
4600
|
+
const { handler: r, once: o } = n;
|
|
4601
|
+
o && this.off(e, r);
|
|
4597
4602
|
try {
|
|
4598
|
-
const
|
|
4599
|
-
|
|
4600
|
-
} catch (
|
|
4601
|
-
console.error(`Error in event handler for ${e}:`,
|
|
4603
|
+
const c = r(t, e);
|
|
4604
|
+
c instanceof Promise && s.push(c);
|
|
4605
|
+
} catch (c) {
|
|
4606
|
+
console.error(`Error in event handler for ${e}:`, c);
|
|
4602
4607
|
}
|
|
4603
4608
|
}
|
|
4604
4609
|
}
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
n
|
|
4610
|
+
const i = [];
|
|
4611
|
+
for (const a of [...this.wildcardHandlers])
|
|
4612
|
+
if (this.matchesPattern(e, a.pattern)) {
|
|
4613
|
+
const { handler: n, once: r } = a;
|
|
4614
|
+
r && i.push(a);
|
|
4609
4615
|
try {
|
|
4610
|
-
const
|
|
4611
|
-
|
|
4612
|
-
} catch (
|
|
4613
|
-
console.error(`Error in wildcard handler for ${e}:`,
|
|
4616
|
+
const o = n(t, e);
|
|
4617
|
+
o instanceof Promise && s.push(o);
|
|
4618
|
+
} catch (o) {
|
|
4619
|
+
console.error(`Error in wildcard handler for ${e}:`, o);
|
|
4614
4620
|
}
|
|
4615
4621
|
}
|
|
4616
|
-
return Promise.all(s);
|
|
4622
|
+
return i.forEach((a) => this.wildcardHandlers.delete(a)), Promise.all(s);
|
|
4617
4623
|
}
|
|
4618
4624
|
/**
|
|
4619
4625
|
* Check if event name matches a pattern
|
|
@@ -4640,7 +4646,7 @@ class G {
|
|
|
4640
4646
|
return this.events.has(e) ? this.events.get(e).length : 0;
|
|
4641
4647
|
}
|
|
4642
4648
|
}
|
|
4643
|
-
const
|
|
4649
|
+
const g = new G();
|
|
4644
4650
|
class Q {
|
|
4645
4651
|
constructor(e = {}) {
|
|
4646
4652
|
this.calendar = new K({
|
|
@@ -4689,55 +4695,62 @@ class Q {
|
|
|
4689
4695
|
(i) => e[i] !== t[i]
|
|
4690
4696
|
);
|
|
4691
4697
|
s.forEach((i) => {
|
|
4692
|
-
|
|
4698
|
+
g.emit(`state:${i}:changed`, {
|
|
4693
4699
|
oldValue: e[i],
|
|
4694
4700
|
newValue: t[i],
|
|
4695
4701
|
state: t
|
|
4696
4702
|
});
|
|
4697
|
-
}), s.length > 0 &&
|
|
4703
|
+
}), s.length > 0 && g.emit("state:changed", { oldState: e, newState: t, changedKeys: s });
|
|
4698
4704
|
}
|
|
4699
4705
|
// Calendar operations
|
|
4700
4706
|
setView(e) {
|
|
4701
|
-
this.calendar.setView(e), this.setState({ view: e }),
|
|
4707
|
+
this.calendar.setView(e), this.setState({ view: e }), g.emit("view:changed", { view: e });
|
|
4702
4708
|
}
|
|
4703
4709
|
getView() {
|
|
4704
4710
|
return this.state.view;
|
|
4705
4711
|
}
|
|
4706
4712
|
setDate(e) {
|
|
4707
|
-
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4713
|
+
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("date:changed", { date: this.state.currentDate });
|
|
4708
4714
|
}
|
|
4709
4715
|
getCurrentDate() {
|
|
4710
4716
|
return this.state.currentDate;
|
|
4711
4717
|
}
|
|
4712
4718
|
// Navigation
|
|
4713
4719
|
next() {
|
|
4714
|
-
this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4720
|
+
this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:next", { date: this.state.currentDate });
|
|
4715
4721
|
}
|
|
4716
4722
|
previous() {
|
|
4717
|
-
this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4723
|
+
this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:previous", { date: this.state.currentDate });
|
|
4718
4724
|
}
|
|
4719
4725
|
today() {
|
|
4720
|
-
this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4726
|
+
this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:today", { date: this.state.currentDate });
|
|
4721
4727
|
}
|
|
4722
4728
|
goToDate(e) {
|
|
4723
|
-
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4729
|
+
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:goto", { date: this.state.currentDate });
|
|
4724
4730
|
}
|
|
4725
4731
|
// Event management
|
|
4726
4732
|
addEvent(e) {
|
|
4727
4733
|
const t = this.calendar.addEvent(e);
|
|
4728
|
-
|
|
4734
|
+
if (!t)
|
|
4735
|
+
return console.error("Failed to add event to calendar"), g.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null;
|
|
4736
|
+
const s = [...this.state.events, t];
|
|
4737
|
+
return this.setState({ events: s }), g.emit("event:added", { event: t }), t;
|
|
4729
4738
|
}
|
|
4730
4739
|
updateEvent(e, t) {
|
|
4731
4740
|
const s = this.calendar.updateEvent(e, t);
|
|
4732
|
-
if (s)
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4741
|
+
if (!s)
|
|
4742
|
+
return console.error(`Failed to update event: ${e}`), g.emit("event:error", { action: "update", eventId: e, updates: t, error: "Event not found in calendar" }), null;
|
|
4743
|
+
const i = this.state.events.findIndex((n) => n.id === e);
|
|
4744
|
+
if (i === -1)
|
|
4745
|
+
return console.error(`Event ${e} not found in state`), g.emit("event:error", { action: "update", eventId: e, error: "Event not found in state" }), null;
|
|
4746
|
+
const a = [...this.state.events];
|
|
4747
|
+
return a[i] = s, this.setState({ events: a }), g.emit("event:updated", { event: s }), s;
|
|
4737
4748
|
}
|
|
4738
4749
|
deleteEvent(e) {
|
|
4739
|
-
|
|
4740
|
-
|
|
4750
|
+
if (!this.calendar.removeEvent(e))
|
|
4751
|
+
return console.error(`Failed to delete event: ${e}`), g.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1;
|
|
4752
|
+
const s = this.state.events.filter((i) => i.id !== e);
|
|
4753
|
+
return this.setState({ events: s }), g.emit("event:deleted", { eventId: e }), !0;
|
|
4741
4754
|
}
|
|
4742
4755
|
getEvents() {
|
|
4743
4756
|
return this.calendar.getEvents();
|
|
@@ -4781,20 +4794,20 @@ class Q {
|
|
|
4781
4794
|
}
|
|
4782
4795
|
// Selection management
|
|
4783
4796
|
selectEvent(e) {
|
|
4784
|
-
this.setState({ selectedEvent: e }),
|
|
4797
|
+
this.setState({ selectedEvent: e }), g.emit("event:selected", { event: e });
|
|
4785
4798
|
}
|
|
4786
4799
|
selectEventById(e) {
|
|
4787
4800
|
const t = this.state.events.find((s) => s.id === e);
|
|
4788
4801
|
t && this.selectEvent(t);
|
|
4789
4802
|
}
|
|
4790
4803
|
deselectEvent() {
|
|
4791
|
-
this.setState({ selectedEvent: null }),
|
|
4804
|
+
this.setState({ selectedEvent: null }), g.emit("event:deselected", {});
|
|
4792
4805
|
}
|
|
4793
4806
|
selectDate(e) {
|
|
4794
|
-
this.setState({ selectedDate: e }),
|
|
4807
|
+
this.setState({ selectedDate: e }), g.emit("date:selected", { date: e });
|
|
4795
4808
|
}
|
|
4796
4809
|
deselectDate() {
|
|
4797
|
-
this.setState({ selectedDate: null }),
|
|
4810
|
+
this.setState({ selectedDate: null }), g.emit("date:deselected", {});
|
|
4798
4811
|
}
|
|
4799
4812
|
// Utility methods
|
|
4800
4813
|
isToday(e) {
|
|
@@ -4814,7 +4827,7 @@ class Q {
|
|
|
4814
4827
|
}
|
|
4815
4828
|
// Error handling
|
|
4816
4829
|
setError(e) {
|
|
4817
|
-
this.setState({ error: e }), e &&
|
|
4830
|
+
this.setState({ error: e }), e && g.emit("error", { error: e });
|
|
4818
4831
|
}
|
|
4819
4832
|
clearError() {
|
|
4820
4833
|
this.setState({ error: null });
|
|
@@ -4828,7 +4841,7 @@ class Q {
|
|
|
4828
4841
|
this.subscribers.clear(), this.state = null, this.calendar = null;
|
|
4829
4842
|
}
|
|
4830
4843
|
}
|
|
4831
|
-
class
|
|
4844
|
+
class v extends f {
|
|
4832
4845
|
/**
|
|
4833
4846
|
* Format date for display
|
|
4834
4847
|
*/
|
|
@@ -4942,7 +4955,7 @@ class y extends f {
|
|
|
4942
4955
|
return a && (a.toLowerCase() === "pm" && n < 12 ? o = n + 12 : a.toLowerCase() === "am" && n === 12 && (o = 0)), s.setHours(o, r || 0, 0, 0), s;
|
|
4943
4956
|
}
|
|
4944
4957
|
}
|
|
4945
|
-
class
|
|
4958
|
+
class E {
|
|
4946
4959
|
/**
|
|
4947
4960
|
* Create element with attributes and children
|
|
4948
4961
|
*/
|
|
@@ -5128,13 +5141,16 @@ class T {
|
|
|
5128
5141
|
static trapFocus(e) {
|
|
5129
5142
|
const t = e.querySelectorAll(
|
|
5130
5143
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
5131
|
-
)
|
|
5132
|
-
|
|
5144
|
+
);
|
|
5145
|
+
if (t.length === 0)
|
|
5146
|
+
return e.setAttribute("tabindex", "-1"), e.focus(), () => e.removeAttribute("tabindex");
|
|
5147
|
+
const s = t[0], i = t[t.length - 1], a = (n) => {
|
|
5148
|
+
n.key === "Tab" && (n.shiftKey ? document.activeElement === s && (i == null || i.focus(), n.preventDefault()) : document.activeElement === i && (s == null || s.focus(), n.preventDefault()));
|
|
5133
5149
|
};
|
|
5134
5150
|
return e.addEventListener("keydown", a), s == null || s.focus(), () => e.removeEventListener("keydown", a);
|
|
5135
5151
|
}
|
|
5136
5152
|
}
|
|
5137
|
-
class
|
|
5153
|
+
class p {
|
|
5138
5154
|
/**
|
|
5139
5155
|
* Get CSS variable value
|
|
5140
5156
|
*/
|
|
@@ -5471,7 +5487,7 @@ class g {
|
|
|
5471
5487
|
/**
|
|
5472
5488
|
* Default theme colors
|
|
5473
5489
|
*/
|
|
5474
|
-
C(
|
|
5490
|
+
C(p, "colors", {
|
|
5475
5491
|
primary: "#3B82F6",
|
|
5476
5492
|
// Modern Blue
|
|
5477
5493
|
secondary: "#64748B",
|
|
@@ -5504,7 +5520,7 @@ C(g, "colors", {
|
|
|
5504
5520
|
}), /**
|
|
5505
5521
|
* Common CSS variables
|
|
5506
5522
|
*/
|
|
5507
|
-
C(
|
|
5523
|
+
C(p, "cssVariables", {
|
|
5508
5524
|
// "Pro" Palette - Functional & Sharp
|
|
5509
5525
|
"--fc-primary-color": "#2563EB",
|
|
5510
5526
|
// International Blue (Focus)
|
|
@@ -5572,7 +5588,7 @@ C(g, "cssVariables", {
|
|
|
5572
5588
|
}), /**
|
|
5573
5589
|
* Get responsive breakpoints
|
|
5574
5590
|
*/
|
|
5575
|
-
C(
|
|
5591
|
+
C(p, "breakpoints", {
|
|
5576
5592
|
xs: "320px",
|
|
5577
5593
|
sm: "576px",
|
|
5578
5594
|
md: "768px",
|
|
@@ -5641,9 +5657,15 @@ class J extends S {
|
|
|
5641
5657
|
};
|
|
5642
5658
|
}
|
|
5643
5659
|
getContrastingTextColor(e) {
|
|
5644
|
-
if (!e) return "white";
|
|
5645
|
-
const t = e.charAt(0) === "#" ? e.substring(1
|
|
5646
|
-
|
|
5660
|
+
if (!e || typeof e != "string") return "white";
|
|
5661
|
+
const t = e.charAt(0) === "#" ? e.substring(1) : e;
|
|
5662
|
+
if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(t))
|
|
5663
|
+
return "white";
|
|
5664
|
+
const s = t.length === 3 ? t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, i = parseInt(s.substring(0, 2), 16), a = parseInt(s.substring(2, 4), 16), n = parseInt(s.substring(4, 6), 16);
|
|
5665
|
+
if (isNaN(i) || isNaN(a) || isNaN(n))
|
|
5666
|
+
return "white";
|
|
5667
|
+
const o = [i / 255, a / 255, n / 255].map((l) => l <= 0.03928 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4));
|
|
5668
|
+
return 0.2126 * o[0] + 0.7152 * o[1] + 0.0722 * o[2] > 0.179 ? "black" : "white";
|
|
5647
5669
|
}
|
|
5648
5670
|
isSelectedDate(e) {
|
|
5649
5671
|
var s, i;
|
|
@@ -5884,7 +5906,7 @@ class J extends S {
|
|
|
5884
5906
|
renderHeader() {
|
|
5885
5907
|
const { config: e } = this.stateManager.getState(), t = [], s = e.weekStartsOn || 0;
|
|
5886
5908
|
for (let i = 0; i < 7; i++) {
|
|
5887
|
-
const a = (s + i) % 7, n =
|
|
5909
|
+
const a = (s + i) % 7, n = v.getDayAbbreviation(a, e.locale);
|
|
5888
5910
|
t.push(`<div class="month-header-cell">${n}</div>`);
|
|
5889
5911
|
}
|
|
5890
5912
|
return `
|
|
@@ -5919,7 +5941,7 @@ class J extends S {
|
|
|
5919
5941
|
renderDay(e) {
|
|
5920
5942
|
const { date: t, dayOfMonth: s, isOtherMonth: i, isToday: a, isSelected: n, isWeekend: r, events: o = [] } = e, c = s, l = ["month-day"];
|
|
5921
5943
|
i && l.push("other-month"), a && l.push("today"), n && l.push("selected"), r && l.push("weekend");
|
|
5922
|
-
const d = o.slice(0, this.config.maxEventsToShow), h = o.length - this.config.maxEventsToShow,
|
|
5944
|
+
const d = o.slice(0, this.config.maxEventsToShow), h = o.length - this.config.maxEventsToShow, y = d.map((D) => this.renderEvent(D)).join(""), b = h > 0 ? `<div class="more-events">+${h} more</div>` : "";
|
|
5923
5945
|
return `
|
|
5924
5946
|
<div class="${l.join(" ")}"
|
|
5925
5947
|
data-date="${t.toISOString()}"
|
|
@@ -5928,8 +5950,8 @@ class J extends S {
|
|
|
5928
5950
|
<span class="day-number">${c}</span>
|
|
5929
5951
|
</div>
|
|
5930
5952
|
<div class="day-events">
|
|
5931
|
-
${
|
|
5932
|
-
${
|
|
5953
|
+
${y}
|
|
5954
|
+
${b}
|
|
5933
5955
|
</div>
|
|
5934
5956
|
</div>
|
|
5935
5957
|
`;
|
|
@@ -5938,19 +5960,19 @@ class J extends S {
|
|
|
5938
5960
|
const { title: t, start: s, allDay: i, backgroundColor: a, textColor: n } = e;
|
|
5939
5961
|
let r = "";
|
|
5940
5962
|
if (a) {
|
|
5941
|
-
const l =
|
|
5963
|
+
const l = p.sanitizeColor(a), d = p.sanitizeColor(n, "white");
|
|
5942
5964
|
r += `background-color: ${l}; color: ${d};`;
|
|
5943
5965
|
}
|
|
5944
5966
|
let o = "";
|
|
5945
|
-
!i && s && (o =
|
|
5967
|
+
!i && s && (o = v.formatTime(new Date(s), !1, !1));
|
|
5946
5968
|
const c = ["event-item"];
|
|
5947
5969
|
return i && c.push("all-day"), `
|
|
5948
5970
|
<div class="${c.join(" ")}"
|
|
5949
5971
|
style="${r}"
|
|
5950
5972
|
data-event-id="${e.id}"
|
|
5951
|
-
title="${
|
|
5973
|
+
title="${E.escapeHTML(t)}">
|
|
5952
5974
|
${o ? `<span class="event-time">${o}</span>` : ""}
|
|
5953
|
-
<span class="event-title">${
|
|
5975
|
+
<span class="event-title">${E.escapeHTML(t)}</span>
|
|
5954
5976
|
</div>
|
|
5955
5977
|
`;
|
|
5956
5978
|
}
|
|
@@ -6024,7 +6046,7 @@ class X extends S {
|
|
|
6024
6046
|
return {
|
|
6025
6047
|
...s,
|
|
6026
6048
|
date: i,
|
|
6027
|
-
isToday:
|
|
6049
|
+
isToday: v.isToday(i),
|
|
6028
6050
|
timedEvents: (s.events || []).filter((a) => !a.allDay),
|
|
6029
6051
|
allDayEvents: (s.events || []).filter((a) => a.allDay)
|
|
6030
6052
|
};
|
|
@@ -6221,7 +6243,7 @@ class X extends S {
|
|
|
6221
6243
|
<div class="time-gutter-header"></div>
|
|
6222
6244
|
${this.viewData.days.map((e) => `
|
|
6223
6245
|
<div class="day-column-header ${e.isToday ? "is-today" : ""}">
|
|
6224
|
-
<span class="day-name">${
|
|
6246
|
+
<span class="day-name">${v.getDayAbbreviation(e.date.getDay())}</span>
|
|
6225
6247
|
<span class="day-number">${e.date.getDate()}</span>
|
|
6226
6248
|
</div>
|
|
6227
6249
|
`).join("")}
|
|
@@ -6244,7 +6266,7 @@ class X extends S {
|
|
|
6244
6266
|
<div class="time-gutter">
|
|
6245
6267
|
${this.hours.map((e) => `
|
|
6246
6268
|
<div class="time-slot-label">
|
|
6247
|
-
${e === 0 ? "" :
|
|
6269
|
+
${e === 0 ? "" : v.formatTime((/* @__PURE__ */ new Date()).setHours(e, 0), !1)}
|
|
6248
6270
|
</div>
|
|
6249
6271
|
`).join("")}
|
|
6250
6272
|
</div>
|
|
@@ -6260,23 +6282,23 @@ class X extends S {
|
|
|
6260
6282
|
` : '<div class="week-view">Loading...</div>';
|
|
6261
6283
|
}
|
|
6262
6284
|
renderTimedEvent(e) {
|
|
6263
|
-
const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), a = (s - t) / (1e3 * 60), n = i, r = Math.max(a, 20), o =
|
|
6285
|
+
const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), a = (s - t) / (1e3 * 60), n = i, r = Math.max(a, 20), o = p.sanitizeColor(e.backgroundColor), c = p.sanitizeColor(p.getContrastColor(o), "white");
|
|
6264
6286
|
return `
|
|
6265
6287
|
<div class="event-container"
|
|
6266
6288
|
style="top: ${n}px; height: ${r}px; background-color: ${o}; color: ${c};"
|
|
6267
6289
|
data-event-id="${e.id}">
|
|
6268
|
-
<span class="event-title">${
|
|
6269
|
-
<span class="event-time">${
|
|
6290
|
+
<span class="event-title">${E.escapeHTML(e.title)}</span>
|
|
6291
|
+
<span class="event-time">${v.formatTime(t)}</span>
|
|
6270
6292
|
</div>
|
|
6271
6293
|
`;
|
|
6272
6294
|
}
|
|
6273
6295
|
renderAllDayEvent(e) {
|
|
6274
|
-
const t =
|
|
6296
|
+
const t = p.sanitizeColor(e.backgroundColor), s = p.sanitizeColor(p.getContrastColor(t), "white");
|
|
6275
6297
|
return `
|
|
6276
6298
|
<div class="event-item"
|
|
6277
6299
|
style="background-color: ${t}; color: ${s}; font-size: 10px; padding: 2px 4px; border-radius: 2px; cursor: pointer; margin-bottom: 2px;"
|
|
6278
6300
|
data-event-id="${e.id}">
|
|
6279
|
-
${
|
|
6301
|
+
${E.escapeHTML(e.title)}
|
|
6280
6302
|
</div>
|
|
6281
6303
|
`;
|
|
6282
6304
|
}
|
|
@@ -6323,7 +6345,7 @@ class ee extends S {
|
|
|
6323
6345
|
updateSelection(e, t) {
|
|
6324
6346
|
const s = this.shadowRoot.querySelector(".day-column");
|
|
6325
6347
|
if (!s) return;
|
|
6326
|
-
((a) => a &&
|
|
6348
|
+
((a) => a && v.isSameDay(a, new Date(s.dataset.date)))(e) ? s.classList.add("selected") : s.classList.remove("selected");
|
|
6327
6349
|
}
|
|
6328
6350
|
loadViewData() {
|
|
6329
6351
|
if (!this.stateManager) return;
|
|
@@ -6336,10 +6358,10 @@ class ee extends S {
|
|
|
6336
6358
|
let t = null;
|
|
6337
6359
|
const s = (n = this.stateManager) == null ? void 0 : n.getState(), i = (s == null ? void 0 : s.currentDate) || /* @__PURE__ */ new Date();
|
|
6338
6360
|
if (e.days && Array.isArray(e.days) && e.days.length > 0)
|
|
6339
|
-
t = e.days.find((r) =>
|
|
6361
|
+
t = e.days.find((r) => v.isSameDay(new Date(r.date), i)) || e.days[0];
|
|
6340
6362
|
else if (e.weeks && Array.isArray(e.weeks) && e.weeks.length > 0) {
|
|
6341
6363
|
const r = e.weeks.flatMap((o) => o.days || []);
|
|
6342
|
-
t = r.find((o) =>
|
|
6364
|
+
t = r.find((o) => v.isSameDay(new Date(o.date), i)) || r[0];
|
|
6343
6365
|
} else e.date && (t = e);
|
|
6344
6366
|
if (!t) return null;
|
|
6345
6367
|
const a = new Date(t.date);
|
|
@@ -6348,7 +6370,7 @@ class ee extends S {
|
|
|
6348
6370
|
day: {
|
|
6349
6371
|
...t,
|
|
6350
6372
|
date: a,
|
|
6351
|
-
isToday:
|
|
6373
|
+
isToday: v.isToday(a),
|
|
6352
6374
|
timedEvents: (t.events || []).filter((r) => !r.allDay),
|
|
6353
6375
|
allDayEvents: (t.events || []).filter((r) => r.allDay)
|
|
6354
6376
|
}
|
|
@@ -6526,7 +6548,7 @@ class ee extends S {
|
|
|
6526
6548
|
var i, a, n;
|
|
6527
6549
|
if (!this.viewData || !this.viewData.day)
|
|
6528
6550
|
return '<div class="day-view" style="padding: 20px; color: var(--fc-text-light);">No data available.</div>';
|
|
6529
|
-
const { day: e } = this.viewData, t = ((n = (a = (i = this.stateManager) == null ? void 0 : i.state) == null ? void 0 : a.config) == null ? void 0 : n.locale) || "en-US", s =
|
|
6551
|
+
const { day: e } = this.viewData, t = ((n = (a = (i = this.stateManager) == null ? void 0 : i.state) == null ? void 0 : a.config) == null ? void 0 : n.locale) || "en-US", s = v.formatDate(e.date, "day", t).split(" ")[0];
|
|
6530
6552
|
return `
|
|
6531
6553
|
<div class="day-view">
|
|
6532
6554
|
<div class="day-header">
|
|
@@ -6552,7 +6574,7 @@ class ee extends S {
|
|
|
6552
6574
|
<div class="time-gutter">
|
|
6553
6575
|
${this.hours.map((r) => `
|
|
6554
6576
|
<div class="time-slot-label">
|
|
6555
|
-
${r === 0 ? "" :
|
|
6577
|
+
${r === 0 ? "" : v.formatTime((/* @__PURE__ */ new Date()).setHours(r, 0), !1)}
|
|
6556
6578
|
</div>
|
|
6557
6579
|
`).join("")}
|
|
6558
6580
|
</div>
|
|
@@ -6566,23 +6588,23 @@ class ee extends S {
|
|
|
6566
6588
|
`;
|
|
6567
6589
|
}
|
|
6568
6590
|
renderTimedEvent(e) {
|
|
6569
|
-
const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), a = (s - t) / (1e3 * 60), n = i, r = Math.max(a, 30), o =
|
|
6591
|
+
const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), a = (s - t) / (1e3 * 60), n = i, r = Math.max(a, 30), o = p.sanitizeColor(e.backgroundColor), c = p.sanitizeColor(p.getContrastColor(o), "white");
|
|
6570
6592
|
return `
|
|
6571
6593
|
<div class="event-container"
|
|
6572
6594
|
style="top: ${n}px; height: ${r}px; background-color: ${o}; color: ${c};"
|
|
6573
6595
|
data-event-id="${e.id}">
|
|
6574
|
-
<span class="event-title">${
|
|
6575
|
-
<span class="event-time">${
|
|
6596
|
+
<span class="event-title">${E.escapeHTML(e.title)}</span>
|
|
6597
|
+
<span class="event-time">${v.formatTime(t)} - ${v.formatTime(s)}</span>
|
|
6576
6598
|
</div>
|
|
6577
6599
|
`;
|
|
6578
6600
|
}
|
|
6579
6601
|
renderAllDayEvent(e) {
|
|
6580
|
-
const t =
|
|
6602
|
+
const t = p.sanitizeColor(e.backgroundColor), s = p.sanitizeColor(p.getContrastColor(t), "white");
|
|
6581
6603
|
return `
|
|
6582
6604
|
<div class="event-item"
|
|
6583
6605
|
style="background-color: ${t}; color: ${s}; font-size: 12px; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-weight: 500; margin-bottom: 2px;"
|
|
6584
6606
|
data-event-id="${e.id}">
|
|
6585
|
-
${
|
|
6607
|
+
${E.escapeHTML(e.title)}
|
|
6586
6608
|
</div>
|
|
6587
6609
|
`;
|
|
6588
6610
|
}
|
|
@@ -6639,8 +6661,8 @@ class te extends S {
|
|
|
6639
6661
|
}
|
|
6640
6662
|
getStyles() {
|
|
6641
6663
|
return `
|
|
6642
|
-
${
|
|
6643
|
-
${
|
|
6664
|
+
${p.getBaseStyles()}
|
|
6665
|
+
${p.getButtonStyles()}
|
|
6644
6666
|
|
|
6645
6667
|
:host {
|
|
6646
6668
|
display: none;
|
|
@@ -6883,7 +6905,7 @@ class te extends S {
|
|
|
6883
6905
|
});
|
|
6884
6906
|
}
|
|
6885
6907
|
open(e = /* @__PURE__ */ new Date()) {
|
|
6886
|
-
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 =
|
|
6908
|
+
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 = E.trapFocus(this.modalContent));
|
|
6887
6909
|
}
|
|
6888
6910
|
close() {
|
|
6889
6911
|
this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
|
|
@@ -6934,13 +6956,13 @@ class se extends S {
|
|
|
6934
6956
|
this.stateManager = new Q(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
|
|
6935
6957
|
}
|
|
6936
6958
|
setupEventListeners() {
|
|
6937
|
-
|
|
6959
|
+
g.on("navigation:*", (e, t) => {
|
|
6938
6960
|
this.emit("calendar-navigate", { action: t.split(":")[1], ...e });
|
|
6939
|
-
}),
|
|
6961
|
+
}), g.on("view:changed", (e) => {
|
|
6940
6962
|
this.emit("calendar-view-change", e);
|
|
6941
|
-
}),
|
|
6963
|
+
}), g.on("event:*", (e, t) => {
|
|
6942
6964
|
this.emit(`calendar-event-${t.split(":")[1]}`, e);
|
|
6943
|
-
}),
|
|
6965
|
+
}), g.on("date:selected", (e) => {
|
|
6944
6966
|
this.emit("calendar-date-select", e);
|
|
6945
6967
|
});
|
|
6946
6968
|
}
|
|
@@ -6956,10 +6978,10 @@ class se extends S {
|
|
|
6956
6978
|
getStyles() {
|
|
6957
6979
|
const e = this.getAttribute("height") || "800px";
|
|
6958
6980
|
return `
|
|
6959
|
-
${
|
|
6960
|
-
${
|
|
6961
|
-
${
|
|
6962
|
-
${
|
|
6981
|
+
${p.getBaseStyles()}
|
|
6982
|
+
${p.getButtonStyles()}
|
|
6983
|
+
${p.getGridStyles()}
|
|
6984
|
+
${p.getAnimations()}
|
|
6963
6985
|
|
|
6964
6986
|
:host {
|
|
6965
6987
|
--calendar-height: ${e};
|
|
@@ -7310,14 +7332,14 @@ class se extends S {
|
|
|
7310
7332
|
const s = this.stateManager.state.config.locale;
|
|
7311
7333
|
switch (t) {
|
|
7312
7334
|
case "month":
|
|
7313
|
-
return
|
|
7335
|
+
return v.formatDate(e, "month", s);
|
|
7314
7336
|
case "week":
|
|
7315
|
-
const i =
|
|
7316
|
-
return
|
|
7337
|
+
const i = v.startOfWeek(e), a = v.endOfWeek(e);
|
|
7338
|
+
return v.formatDateRange(i, a, s);
|
|
7317
7339
|
case "day":
|
|
7318
|
-
return
|
|
7340
|
+
return v.formatDate(e, "long", s);
|
|
7319
7341
|
default:
|
|
7320
|
-
return
|
|
7342
|
+
return v.formatDate(e, "month", s);
|
|
7321
7343
|
}
|
|
7322
7344
|
}
|
|
7323
7345
|
getIcon(e) {
|
|
@@ -7368,22 +7390,22 @@ class se extends S {
|
|
|
7368
7390
|
this.stateManager.today();
|
|
7369
7391
|
}
|
|
7370
7392
|
destroy() {
|
|
7371
|
-
this.stateManager && this.stateManager.destroy(),
|
|
7393
|
+
this.stateManager && this.stateManager.destroy(), g.clear(), super.cleanup();
|
|
7372
7394
|
}
|
|
7373
7395
|
}
|
|
7374
7396
|
customElements.get("force-calendar") || customElements.define("force-calendar", se);
|
|
7375
7397
|
typeof window < "u" && typeof customElements < "u" && console.log("Force Calendar Interface loading...");
|
|
7376
7398
|
export {
|
|
7377
7399
|
S as BaseComponent,
|
|
7378
|
-
|
|
7379
|
-
|
|
7400
|
+
E as DOMUtils,
|
|
7401
|
+
v as DateUtils,
|
|
7380
7402
|
ee as DayView,
|
|
7381
7403
|
G as EventBus,
|
|
7382
7404
|
se as ForceCalendar,
|
|
7383
7405
|
J as MonthView,
|
|
7384
7406
|
Q as StateManager,
|
|
7385
|
-
|
|
7407
|
+
p as StyleUtils,
|
|
7386
7408
|
X as WeekView,
|
|
7387
|
-
|
|
7409
|
+
g as eventBus
|
|
7388
7410
|
};
|
|
7389
7411
|
//# sourceMappingURL=force-calendar-interface.esm.js.map
|