@forcecalendar/interface 0.10.0 → 1.0.0
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 +112 -95
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +22 -22
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- 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() {
|
|
@@ -712,18 +712,18 @@ class x {
|
|
|
712
712
|
timeZone: w = 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({
|
|
@@ -743,18 +743,18 @@ class x {
|
|
|
743
743
|
timeZone: w,
|
|
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();
|
|
@@ -1882,8 +1882,8 @@ class N {
|
|
|
1882
1882
|
if (d >= t) {
|
|
1883
1883
|
const w = new Date(d), D = new Date(d.getTime() + o), k = l.getTimezoneOffset(w, c);
|
|
1884
1884
|
if (k !== v) {
|
|
1885
|
-
const
|
|
1886
|
-
w.setMinutes(w.getMinutes() +
|
|
1885
|
+
const T = v - k;
|
|
1886
|
+
w.setMinutes(w.getMinutes() + T), D.setMinutes(D.getMinutes() + T);
|
|
1887
1887
|
}
|
|
1888
1888
|
v = k, this.isException(w, n, e.id) || r.push({
|
|
1889
1889
|
start: w,
|
|
@@ -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
|
|
@@ -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
|
|
@@ -4341,12 +4341,12 @@ class K {
|
|
|
4341
4341
|
days: []
|
|
4342
4342
|
};
|
|
4343
4343
|
for (let w = 0; w < 7; w++) {
|
|
4344
|
-
const D = new Date(l), k = D.getMonth() === s,
|
|
4344
|
+
const D = new Date(l), k = D.getMonth() === s, T = f.isToday(D), A = D.getDay() === 0 || D.getDay() === 6;
|
|
4345
4345
|
v.days.push({
|
|
4346
4346
|
date: D,
|
|
4347
4347
|
dayOfMonth: D.getDate(),
|
|
4348
4348
|
isCurrentMonth: k,
|
|
4349
|
-
isToday:
|
|
4349
|
+
isToday: T,
|
|
4350
4350
|
isWeekend: A,
|
|
4351
4351
|
events: this.getEventsForDate(D)
|
|
4352
4352
|
}), l = f.addDays(l, 1);
|
|
@@ -4590,30 +4590,31 @@ class G {
|
|
|
4590
4590
|
async emit(e, t) {
|
|
4591
4591
|
const s = [];
|
|
4592
4592
|
if (this.events.has(e)) {
|
|
4593
|
-
const
|
|
4594
|
-
for (const
|
|
4595
|
-
const { handler:
|
|
4596
|
-
|
|
4593
|
+
const a = [...this.events.get(e)];
|
|
4594
|
+
for (const n of a) {
|
|
4595
|
+
const { handler: r, once: o } = n;
|
|
4596
|
+
o && this.off(e, r);
|
|
4597
4597
|
try {
|
|
4598
|
-
const
|
|
4599
|
-
|
|
4600
|
-
} catch (
|
|
4601
|
-
console.error(`Error in event handler for ${e}:`,
|
|
4598
|
+
const c = r(t, e);
|
|
4599
|
+
c instanceof Promise && s.push(c);
|
|
4600
|
+
} catch (c) {
|
|
4601
|
+
console.error(`Error in event handler for ${e}:`, c);
|
|
4602
4602
|
}
|
|
4603
4603
|
}
|
|
4604
4604
|
}
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
n
|
|
4605
|
+
const i = [];
|
|
4606
|
+
for (const a of [...this.wildcardHandlers])
|
|
4607
|
+
if (this.matchesPattern(e, a.pattern)) {
|
|
4608
|
+
const { handler: n, once: r } = a;
|
|
4609
|
+
r && i.push(a);
|
|
4609
4610
|
try {
|
|
4610
|
-
const
|
|
4611
|
-
|
|
4612
|
-
} catch (
|
|
4613
|
-
console.error(`Error in wildcard handler for ${e}:`,
|
|
4611
|
+
const o = n(t, e);
|
|
4612
|
+
o instanceof Promise && s.push(o);
|
|
4613
|
+
} catch (o) {
|
|
4614
|
+
console.error(`Error in wildcard handler for ${e}:`, o);
|
|
4614
4615
|
}
|
|
4615
4616
|
}
|
|
4616
|
-
return Promise.all(s);
|
|
4617
|
+
return i.forEach((a) => this.wildcardHandlers.delete(a)), Promise.all(s);
|
|
4617
4618
|
}
|
|
4618
4619
|
/**
|
|
4619
4620
|
* Check if event name matches a pattern
|
|
@@ -4640,7 +4641,7 @@ class G {
|
|
|
4640
4641
|
return this.events.has(e) ? this.events.get(e).length : 0;
|
|
4641
4642
|
}
|
|
4642
4643
|
}
|
|
4643
|
-
const
|
|
4644
|
+
const g = new G();
|
|
4644
4645
|
class Q {
|
|
4645
4646
|
constructor(e = {}) {
|
|
4646
4647
|
this.calendar = new K({
|
|
@@ -4689,55 +4690,62 @@ class Q {
|
|
|
4689
4690
|
(i) => e[i] !== t[i]
|
|
4690
4691
|
);
|
|
4691
4692
|
s.forEach((i) => {
|
|
4692
|
-
|
|
4693
|
+
g.emit(`state:${i}:changed`, {
|
|
4693
4694
|
oldValue: e[i],
|
|
4694
4695
|
newValue: t[i],
|
|
4695
4696
|
state: t
|
|
4696
4697
|
});
|
|
4697
|
-
}), s.length > 0 &&
|
|
4698
|
+
}), s.length > 0 && g.emit("state:changed", { oldState: e, newState: t, changedKeys: s });
|
|
4698
4699
|
}
|
|
4699
4700
|
// Calendar operations
|
|
4700
4701
|
setView(e) {
|
|
4701
|
-
this.calendar.setView(e), this.setState({ view: e }),
|
|
4702
|
+
this.calendar.setView(e), this.setState({ view: e }), g.emit("view:changed", { view: e });
|
|
4702
4703
|
}
|
|
4703
4704
|
getView() {
|
|
4704
4705
|
return this.state.view;
|
|
4705
4706
|
}
|
|
4706
4707
|
setDate(e) {
|
|
4707
|
-
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4708
|
+
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("date:changed", { date: this.state.currentDate });
|
|
4708
4709
|
}
|
|
4709
4710
|
getCurrentDate() {
|
|
4710
4711
|
return this.state.currentDate;
|
|
4711
4712
|
}
|
|
4712
4713
|
// Navigation
|
|
4713
4714
|
next() {
|
|
4714
|
-
this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4715
|
+
this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:next", { date: this.state.currentDate });
|
|
4715
4716
|
}
|
|
4716
4717
|
previous() {
|
|
4717
|
-
this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4718
|
+
this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:previous", { date: this.state.currentDate });
|
|
4718
4719
|
}
|
|
4719
4720
|
today() {
|
|
4720
|
-
this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4721
|
+
this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:today", { date: this.state.currentDate });
|
|
4721
4722
|
}
|
|
4722
4723
|
goToDate(e) {
|
|
4723
|
-
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }),
|
|
4724
|
+
this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), g.emit("navigation:goto", { date: this.state.currentDate });
|
|
4724
4725
|
}
|
|
4725
4726
|
// Event management
|
|
4726
4727
|
addEvent(e) {
|
|
4727
4728
|
const t = this.calendar.addEvent(e);
|
|
4728
|
-
|
|
4729
|
+
if (!t)
|
|
4730
|
+
return console.error("Failed to add event to calendar"), g.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null;
|
|
4731
|
+
const s = [...this.state.events, t];
|
|
4732
|
+
return this.setState({ events: s }), g.emit("event:added", { event: t }), t;
|
|
4729
4733
|
}
|
|
4730
4734
|
updateEvent(e, t) {
|
|
4731
4735
|
const s = this.calendar.updateEvent(e, t);
|
|
4732
|
-
if (s)
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4736
|
+
if (!s)
|
|
4737
|
+
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;
|
|
4738
|
+
const i = this.state.events.findIndex((n) => n.id === e);
|
|
4739
|
+
if (i === -1)
|
|
4740
|
+
return console.error(`Event ${e} not found in state`), g.emit("event:error", { action: "update", eventId: e, error: "Event not found in state" }), null;
|
|
4741
|
+
const a = [...this.state.events];
|
|
4742
|
+
return a[i] = s, this.setState({ events: a }), g.emit("event:updated", { event: s }), s;
|
|
4737
4743
|
}
|
|
4738
4744
|
deleteEvent(e) {
|
|
4739
|
-
|
|
4740
|
-
|
|
4745
|
+
if (!this.calendar.removeEvent(e))
|
|
4746
|
+
return console.error(`Failed to delete event: ${e}`), g.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1;
|
|
4747
|
+
const s = this.state.events.filter((i) => i.id !== e);
|
|
4748
|
+
return this.setState({ events: s }), g.emit("event:deleted", { eventId: e }), !0;
|
|
4741
4749
|
}
|
|
4742
4750
|
getEvents() {
|
|
4743
4751
|
return this.calendar.getEvents();
|
|
@@ -4781,20 +4789,20 @@ class Q {
|
|
|
4781
4789
|
}
|
|
4782
4790
|
// Selection management
|
|
4783
4791
|
selectEvent(e) {
|
|
4784
|
-
this.setState({ selectedEvent: e }),
|
|
4792
|
+
this.setState({ selectedEvent: e }), g.emit("event:selected", { event: e });
|
|
4785
4793
|
}
|
|
4786
4794
|
selectEventById(e) {
|
|
4787
4795
|
const t = this.state.events.find((s) => s.id === e);
|
|
4788
4796
|
t && this.selectEvent(t);
|
|
4789
4797
|
}
|
|
4790
4798
|
deselectEvent() {
|
|
4791
|
-
this.setState({ selectedEvent: null }),
|
|
4799
|
+
this.setState({ selectedEvent: null }), g.emit("event:deselected", {});
|
|
4792
4800
|
}
|
|
4793
4801
|
selectDate(e) {
|
|
4794
|
-
this.setState({ selectedDate: e }),
|
|
4802
|
+
this.setState({ selectedDate: e }), g.emit("date:selected", { date: e });
|
|
4795
4803
|
}
|
|
4796
4804
|
deselectDate() {
|
|
4797
|
-
this.setState({ selectedDate: null }),
|
|
4805
|
+
this.setState({ selectedDate: null }), g.emit("date:deselected", {});
|
|
4798
4806
|
}
|
|
4799
4807
|
// Utility methods
|
|
4800
4808
|
isToday(e) {
|
|
@@ -4814,7 +4822,7 @@ class Q {
|
|
|
4814
4822
|
}
|
|
4815
4823
|
// Error handling
|
|
4816
4824
|
setError(e) {
|
|
4817
|
-
this.setState({ error: e }), e &&
|
|
4825
|
+
this.setState({ error: e }), e && g.emit("error", { error: e });
|
|
4818
4826
|
}
|
|
4819
4827
|
clearError() {
|
|
4820
4828
|
this.setState({ error: null });
|
|
@@ -4942,7 +4950,7 @@ class y extends f {
|
|
|
4942
4950
|
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
4951
|
}
|
|
4944
4952
|
}
|
|
4945
|
-
class
|
|
4953
|
+
class E {
|
|
4946
4954
|
/**
|
|
4947
4955
|
* Create element with attributes and children
|
|
4948
4956
|
*/
|
|
@@ -5128,13 +5136,16 @@ class T {
|
|
|
5128
5136
|
static trapFocus(e) {
|
|
5129
5137
|
const t = e.querySelectorAll(
|
|
5130
5138
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
5131
|
-
)
|
|
5132
|
-
|
|
5139
|
+
);
|
|
5140
|
+
if (t.length === 0)
|
|
5141
|
+
return e.setAttribute("tabindex", "-1"), e.focus(), () => e.removeAttribute("tabindex");
|
|
5142
|
+
const s = t[0], i = t[t.length - 1], a = (n) => {
|
|
5143
|
+
n.key === "Tab" && (n.shiftKey ? document.activeElement === s && (i == null || i.focus(), n.preventDefault()) : document.activeElement === i && (s == null || s.focus(), n.preventDefault()));
|
|
5133
5144
|
};
|
|
5134
5145
|
return e.addEventListener("keydown", a), s == null || s.focus(), () => e.removeEventListener("keydown", a);
|
|
5135
5146
|
}
|
|
5136
5147
|
}
|
|
5137
|
-
class
|
|
5148
|
+
class p {
|
|
5138
5149
|
/**
|
|
5139
5150
|
* Get CSS variable value
|
|
5140
5151
|
*/
|
|
@@ -5471,7 +5482,7 @@ class g {
|
|
|
5471
5482
|
/**
|
|
5472
5483
|
* Default theme colors
|
|
5473
5484
|
*/
|
|
5474
|
-
C(
|
|
5485
|
+
C(p, "colors", {
|
|
5475
5486
|
primary: "#3B82F6",
|
|
5476
5487
|
// Modern Blue
|
|
5477
5488
|
secondary: "#64748B",
|
|
@@ -5504,7 +5515,7 @@ C(g, "colors", {
|
|
|
5504
5515
|
}), /**
|
|
5505
5516
|
* Common CSS variables
|
|
5506
5517
|
*/
|
|
5507
|
-
C(
|
|
5518
|
+
C(p, "cssVariables", {
|
|
5508
5519
|
// "Pro" Palette - Functional & Sharp
|
|
5509
5520
|
"--fc-primary-color": "#2563EB",
|
|
5510
5521
|
// International Blue (Focus)
|
|
@@ -5572,7 +5583,7 @@ C(g, "cssVariables", {
|
|
|
5572
5583
|
}), /**
|
|
5573
5584
|
* Get responsive breakpoints
|
|
5574
5585
|
*/
|
|
5575
|
-
C(
|
|
5586
|
+
C(p, "breakpoints", {
|
|
5576
5587
|
xs: "320px",
|
|
5577
5588
|
sm: "576px",
|
|
5578
5589
|
md: "768px",
|
|
@@ -5641,9 +5652,15 @@ class J extends S {
|
|
|
5641
5652
|
};
|
|
5642
5653
|
}
|
|
5643
5654
|
getContrastingTextColor(e) {
|
|
5644
|
-
if (!e) return "white";
|
|
5645
|
-
const t = e.charAt(0) === "#" ? e.substring(1
|
|
5646
|
-
|
|
5655
|
+
if (!e || typeof e != "string") return "white";
|
|
5656
|
+
const t = e.charAt(0) === "#" ? e.substring(1) : e;
|
|
5657
|
+
if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(t))
|
|
5658
|
+
return "white";
|
|
5659
|
+
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);
|
|
5660
|
+
if (isNaN(i) || isNaN(a) || isNaN(n))
|
|
5661
|
+
return "white";
|
|
5662
|
+
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));
|
|
5663
|
+
return 0.2126 * o[0] + 0.7152 * o[1] + 0.0722 * o[2] > 0.179 ? "black" : "white";
|
|
5647
5664
|
}
|
|
5648
5665
|
isSelectedDate(e) {
|
|
5649
5666
|
var s, i;
|
|
@@ -5938,7 +5955,7 @@ class J extends S {
|
|
|
5938
5955
|
const { title: t, start: s, allDay: i, backgroundColor: a, textColor: n } = e;
|
|
5939
5956
|
let r = "";
|
|
5940
5957
|
if (a) {
|
|
5941
|
-
const l =
|
|
5958
|
+
const l = p.sanitizeColor(a), d = p.sanitizeColor(n, "white");
|
|
5942
5959
|
r += `background-color: ${l}; color: ${d};`;
|
|
5943
5960
|
}
|
|
5944
5961
|
let o = "";
|
|
@@ -5948,9 +5965,9 @@ class J extends S {
|
|
|
5948
5965
|
<div class="${c.join(" ")}"
|
|
5949
5966
|
style="${r}"
|
|
5950
5967
|
data-event-id="${e.id}"
|
|
5951
|
-
title="${
|
|
5968
|
+
title="${E.escapeHTML(t)}">
|
|
5952
5969
|
${o ? `<span class="event-time">${o}</span>` : ""}
|
|
5953
|
-
<span class="event-title">${
|
|
5970
|
+
<span class="event-title">${E.escapeHTML(t)}</span>
|
|
5954
5971
|
</div>
|
|
5955
5972
|
`;
|
|
5956
5973
|
}
|
|
@@ -6260,23 +6277,23 @@ class X extends S {
|
|
|
6260
6277
|
` : '<div class="week-view">Loading...</div>';
|
|
6261
6278
|
}
|
|
6262
6279
|
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 =
|
|
6280
|
+
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
6281
|
return `
|
|
6265
6282
|
<div class="event-container"
|
|
6266
6283
|
style="top: ${n}px; height: ${r}px; background-color: ${o}; color: ${c};"
|
|
6267
6284
|
data-event-id="${e.id}">
|
|
6268
|
-
<span class="event-title">${
|
|
6285
|
+
<span class="event-title">${E.escapeHTML(e.title)}</span>
|
|
6269
6286
|
<span class="event-time">${y.formatTime(t)}</span>
|
|
6270
6287
|
</div>
|
|
6271
6288
|
`;
|
|
6272
6289
|
}
|
|
6273
6290
|
renderAllDayEvent(e) {
|
|
6274
|
-
const t =
|
|
6291
|
+
const t = p.sanitizeColor(e.backgroundColor), s = p.sanitizeColor(p.getContrastColor(t), "white");
|
|
6275
6292
|
return `
|
|
6276
6293
|
<div class="event-item"
|
|
6277
6294
|
style="background-color: ${t}; color: ${s}; font-size: 10px; padding: 2px 4px; border-radius: 2px; cursor: pointer; margin-bottom: 2px;"
|
|
6278
6295
|
data-event-id="${e.id}">
|
|
6279
|
-
${
|
|
6296
|
+
${E.escapeHTML(e.title)}
|
|
6280
6297
|
</div>
|
|
6281
6298
|
`;
|
|
6282
6299
|
}
|
|
@@ -6566,23 +6583,23 @@ class ee extends S {
|
|
|
6566
6583
|
`;
|
|
6567
6584
|
}
|
|
6568
6585
|
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 =
|
|
6586
|
+
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
6587
|
return `
|
|
6571
6588
|
<div class="event-container"
|
|
6572
6589
|
style="top: ${n}px; height: ${r}px; background-color: ${o}; color: ${c};"
|
|
6573
6590
|
data-event-id="${e.id}">
|
|
6574
|
-
<span class="event-title">${
|
|
6591
|
+
<span class="event-title">${E.escapeHTML(e.title)}</span>
|
|
6575
6592
|
<span class="event-time">${y.formatTime(t)} - ${y.formatTime(s)}</span>
|
|
6576
6593
|
</div>
|
|
6577
6594
|
`;
|
|
6578
6595
|
}
|
|
6579
6596
|
renderAllDayEvent(e) {
|
|
6580
|
-
const t =
|
|
6597
|
+
const t = p.sanitizeColor(e.backgroundColor), s = p.sanitizeColor(p.getContrastColor(t), "white");
|
|
6581
6598
|
return `
|
|
6582
6599
|
<div class="event-item"
|
|
6583
6600
|
style="background-color: ${t}; color: ${s}; font-size: 12px; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-weight: 500; margin-bottom: 2px;"
|
|
6584
6601
|
data-event-id="${e.id}">
|
|
6585
|
-
${
|
|
6602
|
+
${E.escapeHTML(e.title)}
|
|
6586
6603
|
</div>
|
|
6587
6604
|
`;
|
|
6588
6605
|
}
|
|
@@ -6639,8 +6656,8 @@ class te extends S {
|
|
|
6639
6656
|
}
|
|
6640
6657
|
getStyles() {
|
|
6641
6658
|
return `
|
|
6642
|
-
${
|
|
6643
|
-
${
|
|
6659
|
+
${p.getBaseStyles()}
|
|
6660
|
+
${p.getButtonStyles()}
|
|
6644
6661
|
|
|
6645
6662
|
:host {
|
|
6646
6663
|
display: none;
|
|
@@ -6883,7 +6900,7 @@ class te extends S {
|
|
|
6883
6900
|
});
|
|
6884
6901
|
}
|
|
6885
6902
|
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 =
|
|
6903
|
+
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
6904
|
}
|
|
6888
6905
|
close() {
|
|
6889
6906
|
this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
|
|
@@ -6934,13 +6951,13 @@ class se extends S {
|
|
|
6934
6951
|
this.stateManager = new Q(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
|
|
6935
6952
|
}
|
|
6936
6953
|
setupEventListeners() {
|
|
6937
|
-
|
|
6954
|
+
g.on("navigation:*", (e, t) => {
|
|
6938
6955
|
this.emit("calendar-navigate", { action: t.split(":")[1], ...e });
|
|
6939
|
-
}),
|
|
6956
|
+
}), g.on("view:changed", (e) => {
|
|
6940
6957
|
this.emit("calendar-view-change", e);
|
|
6941
|
-
}),
|
|
6958
|
+
}), g.on("event:*", (e, t) => {
|
|
6942
6959
|
this.emit(`calendar-event-${t.split(":")[1]}`, e);
|
|
6943
|
-
}),
|
|
6960
|
+
}), g.on("date:selected", (e) => {
|
|
6944
6961
|
this.emit("calendar-date-select", e);
|
|
6945
6962
|
});
|
|
6946
6963
|
}
|
|
@@ -6956,10 +6973,10 @@ class se extends S {
|
|
|
6956
6973
|
getStyles() {
|
|
6957
6974
|
const e = this.getAttribute("height") || "800px";
|
|
6958
6975
|
return `
|
|
6959
|
-
${
|
|
6960
|
-
${
|
|
6961
|
-
${
|
|
6962
|
-
${
|
|
6976
|
+
${p.getBaseStyles()}
|
|
6977
|
+
${p.getButtonStyles()}
|
|
6978
|
+
${p.getGridStyles()}
|
|
6979
|
+
${p.getAnimations()}
|
|
6963
6980
|
|
|
6964
6981
|
:host {
|
|
6965
6982
|
--calendar-height: ${e};
|
|
@@ -7368,22 +7385,22 @@ class se extends S {
|
|
|
7368
7385
|
this.stateManager.today();
|
|
7369
7386
|
}
|
|
7370
7387
|
destroy() {
|
|
7371
|
-
this.stateManager && this.stateManager.destroy(),
|
|
7388
|
+
this.stateManager && this.stateManager.destroy(), g.clear(), super.cleanup();
|
|
7372
7389
|
}
|
|
7373
7390
|
}
|
|
7374
7391
|
customElements.get("force-calendar") || customElements.define("force-calendar", se);
|
|
7375
7392
|
typeof window < "u" && typeof customElements < "u" && console.log("Force Calendar Interface loading...");
|
|
7376
7393
|
export {
|
|
7377
7394
|
S as BaseComponent,
|
|
7378
|
-
|
|
7395
|
+
E as DOMUtils,
|
|
7379
7396
|
y as DateUtils,
|
|
7380
7397
|
ee as DayView,
|
|
7381
7398
|
G as EventBus,
|
|
7382
7399
|
se as ForceCalendar,
|
|
7383
7400
|
J as MonthView,
|
|
7384
7401
|
Q as StateManager,
|
|
7385
|
-
|
|
7402
|
+
p as StyleUtils,
|
|
7386
7403
|
X as WeekView,
|
|
7387
|
-
|
|
7404
|
+
g as eventBus
|
|
7388
7405
|
};
|
|
7389
7406
|
//# sourceMappingURL=force-calendar-interface.esm.js.map
|