@forcecalendar/interface 1.0.20 → 1.0.22
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var W = Object.defineProperty;
|
|
2
|
+
var j = (u, e, t) => e in u ? W(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
3
|
+
var _ = (u, e, t) => j(u, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
class O extends HTMLElement {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(), this.attachShadow({ mode: "open" }), this._listeners = [], this._state = null, this._props = /* @__PURE__ */ new Map(), this._initialized = !1;
|
|
@@ -108,7 +108,7 @@ class O extends HTMLElement {
|
|
|
108
108
|
this.setProp(e, s), this._initialized && this.render();
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
class
|
|
111
|
+
class Z {
|
|
112
112
|
constructor() {
|
|
113
113
|
this.timezones = {
|
|
114
114
|
// UTC
|
|
@@ -691,7 +691,7 @@ class C {
|
|
|
691
691
|
k && k.clearCache(), k = null;
|
|
692
692
|
}
|
|
693
693
|
constructor() {
|
|
694
|
-
this.database = new
|
|
694
|
+
this.database = new Z(), this.offsetCache = /* @__PURE__ */ new Map(), this.dstCache = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e3, this.cacheHits = 0, this.cacheMisses = 0;
|
|
695
695
|
}
|
|
696
696
|
/**
|
|
697
697
|
* Convert date from one timezone to another
|
|
@@ -984,7 +984,7 @@ class w {
|
|
|
984
984
|
*/
|
|
985
985
|
static normalize(e) {
|
|
986
986
|
const t = { ...e };
|
|
987
|
-
return t.start && (t.start = new Date(t.start)), t.end && (t.end = new Date(t.end)), t.end || (t.end = t.start ? new Date(t.start) : null), t.allDay && t.start && (t.start.setHours(0, 0, 0, 0), t.end && t.end.setHours(23, 59, 59, 999)), t.id = String(t.id || "").trim(), t.title = String(t.title || "").trim(), t.description = String(t.description || "").trim(), t.location = String(t.location || "").trim(), t.attendees = Array.isArray(t.attendees) ? t.attendees : [], t.reminders = Array.isArray(t.reminders) ? t.reminders : [], e.category && !e.categories ? t.categories = [e.category] : t.categories ? t.categories = Array.isArray(t.categories) ? t.categories : [] : t.categories = [], t.attachments = Array.isArray(t.attachments) ? t.attachments : [], ["confirmed", "tentative", "cancelled"].includes(t.status) || (t.status = "confirmed"), ["public", "private", "confidential"].includes(t.visibility) || (t.visibility = "public"), t.color && !t.backgroundColor && (t.backgroundColor = t.color), t.color && !t.borderColor && (t.borderColor = t.color), t;
|
|
987
|
+
return t.start && (t.start = new Date(t.start)), t.end && (t.end = new Date(t.end)), t.end || (t.end = t.start ? new Date(t.start) : null), t.allDay && t.start && (t.start.setHours(0, 0, 0, 0), t.end && t.end.setHours(23, 59, 59, 999)), t.id = String(t.id || "").trim(), t.title = String(t.title || "").trim(), t.description = String(t.description || "").trim(), t.location = String(t.location || "").trim(), t.attendees = Array.isArray(t.attendees) ? t.attendees : [], t.reminders = Array.isArray(t.reminders) ? t.reminders : [], e.category && !e.categories ? t.categories = [e.category] : t.categories ? t.categories = Array.isArray(t.categories) ? t.categories : [] : t.categories = [], t.attachments = Array.isArray(t.attachments) ? t.attachments : [], t.recurrence && !t.recurrenceRule && (t.recurrenceRule = t.recurrence), t.recurrenceRule && (t.recurring = !0), ["confirmed", "tentative", "cancelled"].includes(t.status) || (t.status = "confirmed"), ["public", "private", "confidential"].includes(t.visibility) || (t.visibility = "public"), t.color && !t.backgroundColor && (t.backgroundColor = t.color), t.color && !t.borderColor && (t.borderColor = t.color), t;
|
|
988
988
|
}
|
|
989
989
|
/**
|
|
990
990
|
* Validate event data
|
|
@@ -1042,21 +1042,23 @@ class w {
|
|
|
1042
1042
|
textColor: h = null,
|
|
1043
1043
|
recurring: d = !1,
|
|
1044
1044
|
recurrenceRule: p = null,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1045
|
+
recurrence: b = null,
|
|
1046
|
+
// Backward-compatible alias for recurrenceRule
|
|
1047
|
+
timeZone: v = null,
|
|
1048
|
+
endTimeZone: M = null,
|
|
1049
|
+
status: D = "confirmed",
|
|
1050
|
+
visibility: T = "public",
|
|
1051
|
+
organizer: A = null,
|
|
1052
|
+
attendees: I = [],
|
|
1053
|
+
reminders: R = [],
|
|
1054
|
+
category: B,
|
|
1053
1055
|
// Support singular category (no default)
|
|
1054
|
-
categories:
|
|
1056
|
+
categories: U,
|
|
1055
1057
|
// Support plural categories (no default)
|
|
1056
|
-
attachments:
|
|
1057
|
-
conferenceData:
|
|
1058
|
-
metadata:
|
|
1059
|
-
...
|
|
1058
|
+
attachments: Y = [],
|
|
1059
|
+
conferenceData: N = null,
|
|
1060
|
+
metadata: P = {},
|
|
1061
|
+
...V
|
|
1060
1062
|
// Capture any extra properties
|
|
1061
1063
|
}) {
|
|
1062
1064
|
const g = w.normalize({
|
|
@@ -1073,21 +1075,22 @@ class w {
|
|
|
1073
1075
|
textColor: h,
|
|
1074
1076
|
recurring: d,
|
|
1075
1077
|
recurrenceRule: p,
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1078
|
+
recurrence: b,
|
|
1079
|
+
timeZone: v,
|
|
1080
|
+
endTimeZone: M,
|
|
1081
|
+
status: D,
|
|
1082
|
+
visibility: T,
|
|
1083
|
+
organizer: A,
|
|
1084
|
+
attendees: I,
|
|
1085
|
+
reminders: R,
|
|
1086
|
+
category: B,
|
|
1084
1087
|
// Pass category to normalize
|
|
1085
|
-
categories:
|
|
1088
|
+
categories: U,
|
|
1086
1089
|
// Pass categories to normalize
|
|
1087
|
-
attachments:
|
|
1088
|
-
conferenceData:
|
|
1089
|
-
metadata:
|
|
1090
|
-
...
|
|
1090
|
+
attachments: Y,
|
|
1091
|
+
conferenceData: N,
|
|
1092
|
+
metadata: P,
|
|
1093
|
+
...V
|
|
1091
1094
|
// Pass any extra properties
|
|
1092
1095
|
});
|
|
1093
1096
|
w.validate(g), this.id = g.id, this.title = g.title, this._timezoneManager = C.getInstance(), this.timeZone = g.timeZone || this._timezoneManager.getSystemTimezone(), this.endTimeZone = g.endTimeZone || this.timeZone, this.start = g.start, this.end = g.end, this.startUTC = this._timezoneManager.toUTC(this.start, this.timeZone), this.endUTC = this._timezoneManager.toUTC(this.end, this.endTimeZone), this.allDay = g.allDay, this.description = g.description, this.location = g.location, this.color = g.color, this.backgroundColor = g.backgroundColor, this.borderColor = g.borderColor, this.textColor = g.textColor, this.recurring = g.recurring, this.recurrenceRule = g.recurrenceRule, this._originalTimeZone = g.timeZone || null, this.status = g.status, this.visibility = g.visibility, this.organizer = g.organizer, this.attendees = [...g.attendees], this.reminders = [...g.reminders], this.categories = g.categories ? [...g.categories] : [], this.attachments = [...g.attachments], this.conferenceData = g.conferenceData, this.metadata = { ...g.metadata }, this._cache = {}, this._validateAttendees(), this._validateReminders();
|
|
@@ -1157,6 +1160,13 @@ class w {
|
|
|
1157
1160
|
isRecurring() {
|
|
1158
1161
|
return this.recurring && this.recurrenceRule !== null;
|
|
1159
1162
|
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Backward-compatible alias for recurrenceRule
|
|
1165
|
+
* @returns {import('../../types.js').RecurrenceRule|string|null}
|
|
1166
|
+
*/
|
|
1167
|
+
get recurrence() {
|
|
1168
|
+
return this.recurrenceRule;
|
|
1169
|
+
}
|
|
1160
1170
|
/**
|
|
1161
1171
|
* Check if event occurs on a specific date
|
|
1162
1172
|
* @param {Date|string} date - The date to check
|
|
@@ -1214,6 +1224,7 @@ class w {
|
|
|
1214
1224
|
textColor: this.textColor,
|
|
1215
1225
|
recurring: this.recurring,
|
|
1216
1226
|
recurrenceRule: this.recurrenceRule,
|
|
1227
|
+
recurrence: this.recurrenceRule,
|
|
1217
1228
|
timeZone: this.timeZone,
|
|
1218
1229
|
status: this.status,
|
|
1219
1230
|
visibility: this.visibility,
|
|
@@ -1952,7 +1963,7 @@ let f = class y {
|
|
|
1952
1963
|
return new Date(d);
|
|
1953
1964
|
}
|
|
1954
1965
|
};
|
|
1955
|
-
class
|
|
1966
|
+
class q {
|
|
1956
1967
|
/**
|
|
1957
1968
|
* Parse an RRULE string into a structured rule object
|
|
1958
1969
|
* @param {string|Object} rrule - RRULE string or rule object
|
|
@@ -2206,7 +2217,7 @@ class Z {
|
|
|
2206
2217
|
return e.count ? r += `, ${e.count} time${e.count > 1 ? "s" : ""}` : e.until && (r += `, until ${e.until.toLocaleDateString()}`), r;
|
|
2207
2218
|
}
|
|
2208
2219
|
}
|
|
2209
|
-
class
|
|
2220
|
+
class K {
|
|
2210
2221
|
/**
|
|
2211
2222
|
* Expand a recurring event into individual occurrences
|
|
2212
2223
|
* @param {import('./Event.js').Event} event - The recurring event
|
|
@@ -2258,7 +2269,7 @@ class q {
|
|
|
2258
2269
|
* @returns {import('../../types.js').RecurrenceRule} Parsed rule object
|
|
2259
2270
|
*/
|
|
2260
2271
|
static parseRule(e) {
|
|
2261
|
-
return
|
|
2272
|
+
return q.parse(e);
|
|
2262
2273
|
}
|
|
2263
2274
|
/**
|
|
2264
2275
|
* Calculate the next occurrence based on the rule
|
|
@@ -2446,7 +2457,7 @@ class q {
|
|
|
2446
2457
|
return r && (n = `${r === -1 ? "Last" : ["", "1st", "2nd", "3rd", "4th", "5th"][r] || `${r}th`} ${n}`), n;
|
|
2447
2458
|
}
|
|
2448
2459
|
}
|
|
2449
|
-
class
|
|
2460
|
+
class $ {
|
|
2450
2461
|
/**
|
|
2451
2462
|
* Create a new LRU Cache
|
|
2452
2463
|
* @param {number} capacity - Maximum number of items in cache
|
|
@@ -2533,7 +2544,7 @@ class _ {
|
|
|
2533
2544
|
return this.cache.size;
|
|
2534
2545
|
}
|
|
2535
2546
|
}
|
|
2536
|
-
class
|
|
2547
|
+
class G {
|
|
2537
2548
|
constructor(e = {}) {
|
|
2538
2549
|
this.config = {
|
|
2539
2550
|
checkInterval: 3e4,
|
|
@@ -2751,7 +2762,7 @@ class K {
|
|
|
2751
2762
|
this.stopMonitoring(), this.caches.clear();
|
|
2752
2763
|
}
|
|
2753
2764
|
}
|
|
2754
|
-
class
|
|
2765
|
+
class Q {
|
|
2755
2766
|
constructor(e = {}) {
|
|
2756
2767
|
this.config = {
|
|
2757
2768
|
enableCache: !0,
|
|
@@ -2766,7 +2777,7 @@ class G {
|
|
|
2766
2777
|
enableAdaptiveMemory: !0,
|
|
2767
2778
|
// Enable adaptive memory management
|
|
2768
2779
|
...e
|
|
2769
|
-
}, this.eventCache = new
|
|
2780
|
+
}, 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 G({
|
|
2770
2781
|
checkInterval: 3e4,
|
|
2771
2782
|
memoryThreshold: 0.75,
|
|
2772
2783
|
criticalThreshold: 0.9
|
|
@@ -3056,7 +3067,7 @@ class G {
|
|
|
3056
3067
|
this.cleanupTimer && (clearInterval(this.cleanupTimer), this.cleanupTimer = null), this.batchTimer && (clearTimeout(this.batchTimer), this.batchTimer = null), this.eventCache.clear(), this.queryCache.clear(), this.dateRangeCache.clear(), this.lazyIndexes.clear(), this.pendingIndexes.clear();
|
|
3057
3068
|
}
|
|
3058
3069
|
}
|
|
3059
|
-
class
|
|
3070
|
+
class J {
|
|
3060
3071
|
/**
|
|
3061
3072
|
* Create a new ConflictDetector
|
|
3062
3073
|
* @param {import('../events/EventStore.js').EventStore} eventStore - Event store instance
|
|
@@ -3343,7 +3354,7 @@ class Q {
|
|
|
3343
3354
|
return i >= n && r <= a;
|
|
3344
3355
|
}
|
|
3345
3356
|
}
|
|
3346
|
-
class
|
|
3357
|
+
class X {
|
|
3347
3358
|
constructor(e = {}) {
|
|
3348
3359
|
this.events = /* @__PURE__ */ new Map(), this.indices = {
|
|
3349
3360
|
/** @type {Map<string, Set<string>>} UTC Date string -> Set of event IDs */
|
|
@@ -3356,7 +3367,7 @@ class J {
|
|
|
3356
3367
|
byCategory: /* @__PURE__ */ new Map(),
|
|
3357
3368
|
/** @type {Map<string, Set<string>>} Status -> Set of event IDs */
|
|
3358
3369
|
byStatus: /* @__PURE__ */ new Map()
|
|
3359
|
-
}, this.timezoneManager = C.getInstance(), this.defaultTimezone = e.timezone || this.timezoneManager.getSystemTimezone(), this.optimizer = new
|
|
3370
|
+
}, this.timezoneManager = C.getInstance(), this.defaultTimezone = e.timezone || this.timezoneManager.getSystemTimezone(), this.optimizer = new Q(e.performance), this.conflictDetector = new J(this), this.isBatchMode = !1, this.batchNotifications = [], this.batchBackup = null, this._batchLock = null, this._batchLockResolve = null, this.version = 0, this.listeners = /* @__PURE__ */ new Set();
|
|
3360
3371
|
}
|
|
3361
3372
|
/**
|
|
3362
3373
|
* Add an event to the store
|
|
@@ -3629,7 +3640,7 @@ class J {
|
|
|
3629
3640
|
return [e];
|
|
3630
3641
|
i = i || this.defaultTimezone;
|
|
3631
3642
|
const r = e.timeZone || i;
|
|
3632
|
-
return
|
|
3643
|
+
return K.expandEvent(e, t, s).map((a, o) => e.clone({
|
|
3633
3644
|
id: `${e.id}_occurrence_${o}`,
|
|
3634
3645
|
start: a.start,
|
|
3635
3646
|
end: a.end,
|
|
@@ -3735,6 +3746,10 @@ class J {
|
|
|
3735
3746
|
s.delete(e.id), s.size === 0 && this.indices.byDate.delete(t);
|
|
3736
3747
|
for (const [t, s] of this.indices.byMonth)
|
|
3737
3748
|
s.delete(e.id), s.size === 0 && this.indices.byMonth.delete(t);
|
|
3749
|
+
for (const [t, s] of this.indices.byCategory)
|
|
3750
|
+
s.delete(e.id), s.size === 0 && this.indices.byCategory.delete(t);
|
|
3751
|
+
for (const [t, s] of this.indices.byStatus)
|
|
3752
|
+
s.delete(e.id), s.size === 0 && this.indices.byStatus.delete(t);
|
|
3738
3753
|
this.indices.recurring.delete(e.id);
|
|
3739
3754
|
}
|
|
3740
3755
|
/**
|
|
@@ -3813,18 +3828,29 @@ class J {
|
|
|
3813
3828
|
}
|
|
3814
3829
|
/**
|
|
3815
3830
|
* Execute batch operation with automatic rollback on error
|
|
3831
|
+
* Uses a lock to prevent concurrent batch operations from corrupting state
|
|
3816
3832
|
* @param {Function} operation - Operation to execute
|
|
3817
3833
|
* @param {boolean} [enableRollback=true] - Enable automatic rollback on error
|
|
3818
3834
|
* @returns {*} Result of operation
|
|
3819
3835
|
* @throws {Error} If operation fails
|
|
3820
3836
|
*/
|
|
3821
3837
|
async executeBatch(e, t = !0) {
|
|
3822
|
-
this.
|
|
3838
|
+
for (; this._batchLock; )
|
|
3839
|
+
await this._batchLock;
|
|
3840
|
+
this._batchLock = new Promise((s) => {
|
|
3841
|
+
this._batchLockResolve = s;
|
|
3842
|
+
});
|
|
3823
3843
|
try {
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3844
|
+
this.startBatch(t);
|
|
3845
|
+
try {
|
|
3846
|
+
const s = await e();
|
|
3847
|
+
return this.commitBatch(), s;
|
|
3848
|
+
} catch (s) {
|
|
3849
|
+
throw t && this.rollbackBatch(), s;
|
|
3850
|
+
}
|
|
3851
|
+
} finally {
|
|
3852
|
+
const s = this._batchLockResolve;
|
|
3853
|
+
this._batchLock = null, this._batchLockResolve = null, s && s();
|
|
3828
3854
|
}
|
|
3829
3855
|
}
|
|
3830
3856
|
/**
|
|
@@ -4023,7 +4049,7 @@ class J {
|
|
|
4023
4049
|
return t;
|
|
4024
4050
|
}
|
|
4025
4051
|
}
|
|
4026
|
-
let
|
|
4052
|
+
let ee = class {
|
|
4027
4053
|
/**
|
|
4028
4054
|
* Create a new StateManager instance
|
|
4029
4055
|
* @param {Partial<import('../../types.js').CalendarState>} [initialState={}] - Initial state values
|
|
@@ -4404,7 +4430,7 @@ let X = class {
|
|
|
4404
4430
|
}
|
|
4405
4431
|
}
|
|
4406
4432
|
};
|
|
4407
|
-
class
|
|
4433
|
+
class te {
|
|
4408
4434
|
/**
|
|
4409
4435
|
* Create a new Calendar instance
|
|
4410
4436
|
* @param {import('../../types.js').CalendarConfig} [config={}] - Configuration options
|
|
@@ -4425,7 +4451,7 @@ class ee {
|
|
|
4425
4451
|
end: "17:00"
|
|
4426
4452
|
},
|
|
4427
4453
|
...e
|
|
4428
|
-
}, this.eventStore = new
|
|
4454
|
+
}, this.eventStore = new X({ timezone: this.config.timeZone }), this.state = new ee({
|
|
4429
4455
|
view: this.config.view,
|
|
4430
4456
|
currentDate: this.config.date,
|
|
4431
4457
|
weekStartsOn: this.config.weekStartsOn,
|
|
@@ -4925,7 +4951,7 @@ class ee {
|
|
|
4925
4951
|
}), this.plugins.clear(), this.views.clear(), this._emit("destroy");
|
|
4926
4952
|
}
|
|
4927
4953
|
}
|
|
4928
|
-
class
|
|
4954
|
+
class se {
|
|
4929
4955
|
constructor() {
|
|
4930
4956
|
this.events = /* @__PURE__ */ new Map(), this.wildcardHandlers = /* @__PURE__ */ new Set();
|
|
4931
4957
|
}
|
|
@@ -5067,10 +5093,10 @@ class te {
|
|
|
5067
5093
|
return e;
|
|
5068
5094
|
}
|
|
5069
5095
|
}
|
|
5070
|
-
const m = new
|
|
5071
|
-
class
|
|
5096
|
+
const m = new se();
|
|
5097
|
+
class ie {
|
|
5072
5098
|
constructor(e = {}) {
|
|
5073
|
-
this.calendar = new
|
|
5099
|
+
this.calendar = new te({
|
|
5074
5100
|
view: e.view || "month",
|
|
5075
5101
|
date: e.date || /* @__PURE__ */ new Date(),
|
|
5076
5102
|
weekStartsOn: e.weekStartsOn ?? 0,
|
|
@@ -5403,7 +5429,7 @@ class S extends f {
|
|
|
5403
5429
|
return r && (r.toLowerCase() === "pm" && n < 12 ? o = n + 12 : r.toLowerCase() === "am" && n === 12 && (o = 0)), s.setHours(o, a || 0, 0, 0), s;
|
|
5404
5430
|
}
|
|
5405
5431
|
}
|
|
5406
|
-
class
|
|
5432
|
+
class F {
|
|
5407
5433
|
/**
|
|
5408
5434
|
* Create element with attributes and children
|
|
5409
5435
|
*/
|
|
@@ -5935,7 +5961,7 @@ class x {
|
|
|
5935
5961
|
/**
|
|
5936
5962
|
* Default theme colors
|
|
5937
5963
|
*/
|
|
5938
|
-
|
|
5964
|
+
_(x, "colors", {
|
|
5939
5965
|
primary: "#3B82F6",
|
|
5940
5966
|
// Modern Blue
|
|
5941
5967
|
secondary: "#64748B",
|
|
@@ -5968,7 +5994,7 @@ $(x, "colors", {
|
|
|
5968
5994
|
}), /**
|
|
5969
5995
|
* Common CSS variables
|
|
5970
5996
|
*/
|
|
5971
|
-
|
|
5997
|
+
_(x, "cssVariables", {
|
|
5972
5998
|
// "Pro" Palette - Functional & Sharp
|
|
5973
5999
|
"--fc-primary-color": "#2563EB",
|
|
5974
6000
|
// International Blue (Focus)
|
|
@@ -6036,7 +6062,7 @@ $(x, "cssVariables", {
|
|
|
6036
6062
|
}), /**
|
|
6037
6063
|
* Get responsive breakpoints
|
|
6038
6064
|
*/
|
|
6039
|
-
|
|
6065
|
+
_(x, "breakpoints", {
|
|
6040
6066
|
xs: "320px",
|
|
6041
6067
|
sm: "576px",
|
|
6042
6068
|
md: "768px",
|
|
@@ -6083,7 +6109,7 @@ class H {
|
|
|
6083
6109
|
* @returns {string}
|
|
6084
6110
|
*/
|
|
6085
6111
|
escapeHTML(e) {
|
|
6086
|
-
return e == null ? "" :
|
|
6112
|
+
return e == null ? "" : F.escapeHTML(String(e));
|
|
6087
6113
|
}
|
|
6088
6114
|
/**
|
|
6089
6115
|
* Check if a date is today
|
|
@@ -6383,7 +6409,7 @@ class z extends H {
|
|
|
6383
6409
|
e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
6384
6410
|
}
|
|
6385
6411
|
}
|
|
6386
|
-
class
|
|
6412
|
+
class L extends H {
|
|
6387
6413
|
constructor(e, t) {
|
|
6388
6414
|
super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
6389
6415
|
}
|
|
@@ -6516,7 +6542,7 @@ class F extends H {
|
|
|
6516
6542
|
e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
6517
6543
|
}
|
|
6518
6544
|
}
|
|
6519
|
-
class
|
|
6545
|
+
class re extends O {
|
|
6520
6546
|
constructor() {
|
|
6521
6547
|
super(), this._isVisible = !1, this._cleanupFocusTrap = null, this.config = {
|
|
6522
6548
|
title: "New Event",
|
|
@@ -6790,7 +6816,7 @@ class ie extends O {
|
|
|
6790
6816
|
});
|
|
6791
6817
|
}
|
|
6792
6818
|
open(e = /* @__PURE__ */ new Date()) {
|
|
6793
|
-
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 =
|
|
6819
|
+
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 = F.trapFocus(this.modalContent));
|
|
6794
6820
|
}
|
|
6795
6821
|
close() {
|
|
6796
6822
|
this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
|
|
@@ -6819,13 +6845,13 @@ class ie extends O {
|
|
|
6819
6845
|
this._cleanupFocusTrap && this._cleanupFocusTrap(), this._handleKeyDown && (window.removeEventListener("keydown", this._handleKeyDown), this._handleKeyDown = null, this._keydownListenerAdded = !1);
|
|
6820
6846
|
}
|
|
6821
6847
|
}
|
|
6822
|
-
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form",
|
|
6823
|
-
class
|
|
6848
|
+
customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", re);
|
|
6849
|
+
class ne extends O {
|
|
6824
6850
|
static get observedAttributes() {
|
|
6825
6851
|
return ["view", "date", "locale", "timezone", "week-starts-on", "height"];
|
|
6826
6852
|
}
|
|
6827
6853
|
constructor() {
|
|
6828
|
-
super(), this.stateManager = null, this.currentView = null, this._hasRendered = !1, this._cachedStyles = null;
|
|
6854
|
+
super(), this.stateManager = null, this.currentView = null, this._hasRendered = !1, this._cachedStyles = null, this._busUnsubscribers = [];
|
|
6829
6855
|
}
|
|
6830
6856
|
initialize() {
|
|
6831
6857
|
const e = {
|
|
@@ -6835,18 +6861,18 @@ class re extends O {
|
|
|
6835
6861
|
timeZone: this.getAttribute("timezone") || Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
6836
6862
|
weekStartsOn: parseInt(this.getAttribute("week-starts-on") || "0")
|
|
6837
6863
|
};
|
|
6838
|
-
this.stateManager = new
|
|
6864
|
+
this.stateManager = new ie(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
|
|
6839
6865
|
}
|
|
6840
6866
|
setupEventListeners() {
|
|
6841
|
-
m.on("navigation:*", (e, t) => {
|
|
6867
|
+
this._busUnsubscribers.forEach((e) => e()), this._busUnsubscribers = [], this._busUnsubscribers.push(m.on("navigation:*", (e, t) => {
|
|
6842
6868
|
this.emit("calendar-navigate", { action: t.split(":")[1], ...e });
|
|
6843
|
-
}), m.on("view:changed", (e) => {
|
|
6869
|
+
})), this._busUnsubscribers.push(m.on("view:changed", (e) => {
|
|
6844
6870
|
this.emit("calendar-view-change", e);
|
|
6845
|
-
}), m.on("event:*", (e, t) => {
|
|
6871
|
+
})), this._busUnsubscribers.push(m.on("event:*", (e, t) => {
|
|
6846
6872
|
this.emit(`calendar-event-${t.split(":")[1]}`, e);
|
|
6847
|
-
}), m.on("date:selected", (e) => {
|
|
6873
|
+
})), this._busUnsubscribers.push(m.on("date:selected", (e) => {
|
|
6848
6874
|
this.emit("calendar-date-select", e);
|
|
6849
|
-
});
|
|
6875
|
+
}));
|
|
6850
6876
|
}
|
|
6851
6877
|
handleStateChange(e, t) {
|
|
6852
6878
|
var o, c;
|
|
@@ -6890,7 +6916,7 @@ class re extends O {
|
|
|
6890
6916
|
const s = {
|
|
6891
6917
|
month: E,
|
|
6892
6918
|
week: z,
|
|
6893
|
-
day:
|
|
6919
|
+
day: L
|
|
6894
6920
|
}[this.currentView] || E, i = new s(e, this.stateManager);
|
|
6895
6921
|
i._viewType = this.currentView, this._currentViewInstance = i, i.render();
|
|
6896
6922
|
} catch (t) {
|
|
@@ -7305,7 +7331,7 @@ class re extends O {
|
|
|
7305
7331
|
return `
|
|
7306
7332
|
<div class="force-calendar">
|
|
7307
7333
|
<div class="fc-error">
|
|
7308
|
-
<p><strong>Error:</strong> ${
|
|
7334
|
+
<p><strong>Error:</strong> ${F.escapeHTML(r.message || "An error occurred")}</p>
|
|
7309
7335
|
</div>
|
|
7310
7336
|
</div>
|
|
7311
7337
|
`;
|
|
@@ -7374,7 +7400,7 @@ class re extends O {
|
|
|
7374
7400
|
const r = {
|
|
7375
7401
|
month: E,
|
|
7376
7402
|
week: z,
|
|
7377
|
-
day:
|
|
7403
|
+
day: L
|
|
7378
7404
|
}[this.currentView] || E, n = new r(e, this.stateManager);
|
|
7379
7405
|
n._viewType = this.currentView, this._currentViewInstance = n, n.render();
|
|
7380
7406
|
} catch (i) {
|
|
@@ -7409,7 +7435,7 @@ class re extends O {
|
|
|
7409
7435
|
const s = {
|
|
7410
7436
|
month: E,
|
|
7411
7437
|
week: z,
|
|
7412
|
-
day:
|
|
7438
|
+
day: L
|
|
7413
7439
|
}[e] || E;
|
|
7414
7440
|
return new s(null, null);
|
|
7415
7441
|
}
|
|
@@ -7492,21 +7518,21 @@ class re extends O {
|
|
|
7492
7518
|
this.stateManager.today();
|
|
7493
7519
|
}
|
|
7494
7520
|
destroy() {
|
|
7495
|
-
this.stateManager && this.stateManager.destroy(),
|
|
7521
|
+
this._busUnsubscribers.forEach((e) => e()), this._busUnsubscribers = [], this.stateManager && this.stateManager.destroy(), super.cleanup();
|
|
7496
7522
|
}
|
|
7497
7523
|
}
|
|
7498
|
-
customElements.get("forcecal-main") || customElements.define("forcecal-main",
|
|
7524
|
+
customElements.get("forcecal-main") || customElements.define("forcecal-main", ne);
|
|
7499
7525
|
typeof window < "u" && typeof customElements < "u" && console.log("Force Calendar Interface loading...");
|
|
7500
7526
|
export {
|
|
7501
7527
|
O as BaseComponent,
|
|
7502
7528
|
H as BaseViewRenderer,
|
|
7503
|
-
|
|
7529
|
+
F as DOMUtils,
|
|
7504
7530
|
S as DateUtils,
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7531
|
+
L as DayViewRenderer,
|
|
7532
|
+
se as EventBus,
|
|
7533
|
+
ne as ForceCalendar,
|
|
7508
7534
|
E as MonthViewRenderer,
|
|
7509
|
-
|
|
7535
|
+
ie as StateManager,
|
|
7510
7536
|
x as StyleUtils,
|
|
7511
7537
|
z as WeekViewRenderer,
|
|
7512
7538
|
m as eventBus
|