@forcecalendar/interface 1.0.44 → 1.0.45
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 +557 -554
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +12 -12
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +17 -2
- package/src/core/StateManager.js +4 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var C = Object.defineProperty;
|
|
2
|
-
var F = (h,
|
|
3
|
-
var g = (h,
|
|
2
|
+
var F = (h, t, e) => t in h ? C(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
|
+
var g = (h, t, e) => F(h, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { Calendar as H, DateUtils as L } from "@forcecalendar/core";
|
|
5
5
|
class M extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -22,43 +22,43 @@ class M extends HTMLElement {
|
|
|
22
22
|
unmount() {
|
|
23
23
|
}
|
|
24
24
|
cleanup() {
|
|
25
|
-
this._listeners.forEach(({ element:
|
|
26
|
-
|
|
25
|
+
this._listeners.forEach(({ element: t, event: e, handler: r }) => {
|
|
26
|
+
t.removeEventListener(e, r);
|
|
27
27
|
}), this._listeners = [];
|
|
28
28
|
}
|
|
29
29
|
// State management
|
|
30
|
-
setState(
|
|
31
|
-
const
|
|
32
|
-
this._state = { ...this._state, ...
|
|
30
|
+
setState(t) {
|
|
31
|
+
const e = this._state;
|
|
32
|
+
this._state = { ...this._state, ...t }, this.stateChanged(e, this._state), this.render();
|
|
33
33
|
}
|
|
34
34
|
getState() {
|
|
35
35
|
return this._state;
|
|
36
36
|
}
|
|
37
|
-
stateChanged(
|
|
37
|
+
stateChanged(t, e) {
|
|
38
38
|
}
|
|
39
39
|
// Props management
|
|
40
|
-
setProp(
|
|
41
|
-
const r = this._props.get(
|
|
42
|
-
this._props.set(
|
|
40
|
+
setProp(t, e) {
|
|
41
|
+
const r = this._props.get(t);
|
|
42
|
+
this._props.set(t, e), this.propChanged(t, r, e);
|
|
43
43
|
}
|
|
44
|
-
getProp(
|
|
45
|
-
return this._props.get(
|
|
44
|
+
getProp(t) {
|
|
45
|
+
return this._props.get(t);
|
|
46
46
|
}
|
|
47
|
-
propChanged(
|
|
47
|
+
propChanged(t, e, r) {
|
|
48
48
|
}
|
|
49
49
|
// Event handling
|
|
50
|
-
addListener(
|
|
51
|
-
if (!
|
|
52
|
-
console.warn("addListener called with invalid parameters", { element:
|
|
50
|
+
addListener(t, e, r) {
|
|
51
|
+
if (!t || !e || !r) {
|
|
52
|
+
console.warn("addListener called with invalid parameters", { element: t, event: e, handler: r });
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
const s = r.bind(this);
|
|
56
|
-
|
|
56
|
+
t.addEventListener(e, s), this._listeners.push({ element: t, event: e, handler: s });
|
|
57
57
|
}
|
|
58
|
-
emit(
|
|
58
|
+
emit(t, e = {}) {
|
|
59
59
|
this.dispatchEvent(
|
|
60
|
-
new CustomEvent(
|
|
61
|
-
detail:
|
|
60
|
+
new CustomEvent(t, {
|
|
61
|
+
detail: e,
|
|
62
62
|
bubbles: !0,
|
|
63
63
|
composed: !0
|
|
64
64
|
})
|
|
@@ -83,13 +83,13 @@ class M extends HTMLElement {
|
|
|
83
83
|
// Template rendering
|
|
84
84
|
render() {
|
|
85
85
|
this.cleanup();
|
|
86
|
-
const
|
|
86
|
+
const t = `
|
|
87
87
|
<style>
|
|
88
88
|
${this.getBaseStyles()}
|
|
89
89
|
${this.getStyles()}
|
|
90
90
|
</style>
|
|
91
|
-
`,
|
|
92
|
-
this.shadowRoot.innerHTML =
|
|
91
|
+
`, e = this.template();
|
|
92
|
+
this.shadowRoot.innerHTML = t + e, this.afterRender();
|
|
93
93
|
}
|
|
94
94
|
template() {
|
|
95
95
|
return "";
|
|
@@ -97,18 +97,18 @@ class M extends HTMLElement {
|
|
|
97
97
|
afterRender() {
|
|
98
98
|
}
|
|
99
99
|
// Utility methods
|
|
100
|
-
$(
|
|
101
|
-
return this.shadowRoot.querySelector(
|
|
100
|
+
$(t) {
|
|
101
|
+
return this.shadowRoot.querySelector(t);
|
|
102
102
|
}
|
|
103
|
-
$$(
|
|
104
|
-
return this.shadowRoot.querySelectorAll(
|
|
103
|
+
$$(t) {
|
|
104
|
+
return this.shadowRoot.querySelectorAll(t);
|
|
105
105
|
}
|
|
106
106
|
// Attribute observation
|
|
107
107
|
static get observedAttributes() {
|
|
108
108
|
return [];
|
|
109
109
|
}
|
|
110
|
-
attributeChangedCallback(
|
|
111
|
-
this.setProp(
|
|
110
|
+
attributeChangedCallback(t, e, r) {
|
|
111
|
+
this.setProp(t, r), this._initialized && this.render();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
class T {
|
|
@@ -122,14 +122,14 @@ class T {
|
|
|
122
122
|
* @param {Object} options - Subscription options
|
|
123
123
|
* @returns {Function} Unsubscribe function
|
|
124
124
|
*/
|
|
125
|
-
on(
|
|
125
|
+
on(t, e, r = {}) {
|
|
126
126
|
const { once: s = !1, priority: i = 0 } = r;
|
|
127
|
-
if (
|
|
128
|
-
const a = { pattern:
|
|
127
|
+
if (t.includes("*")) {
|
|
128
|
+
const a = { pattern: t, handler: e, once: s, priority: i };
|
|
129
129
|
return this.wildcardHandlers.add(a), () => this.wildcardHandlers.delete(a);
|
|
130
130
|
}
|
|
131
|
-
this.events.has(
|
|
132
|
-
const n = { handler:
|
|
131
|
+
this.events.has(t) || this.events.set(t, []);
|
|
132
|
+
const n = { handler: e, once: s, priority: i }, o = this.events.get(t);
|
|
133
133
|
return o.push(n), o.sort((a, c) => c.priority - a.priority), () => {
|
|
134
134
|
const a = o.indexOf(n);
|
|
135
135
|
a > -1 && o.splice(a, 1);
|
|
@@ -138,73 +138,73 @@ class T {
|
|
|
138
138
|
/**
|
|
139
139
|
* Subscribe to an event that fires only once
|
|
140
140
|
*/
|
|
141
|
-
once(
|
|
142
|
-
return this.on(
|
|
141
|
+
once(t, e, r = {}) {
|
|
142
|
+
return this.on(t, e, { ...r, once: !0 });
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* Unsubscribe from an event
|
|
146
146
|
*/
|
|
147
|
-
off(
|
|
148
|
-
if (
|
|
147
|
+
off(t, e) {
|
|
148
|
+
if (t.includes("*")) {
|
|
149
149
|
for (const i of this.wildcardHandlers)
|
|
150
|
-
if (i.pattern ===
|
|
150
|
+
if (i.pattern === t && i.handler === e) {
|
|
151
151
|
this.wildcardHandlers.delete(i);
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
if (!this.events.has(
|
|
157
|
-
const r = this.events.get(
|
|
158
|
-
s > -1 && r.splice(s, 1), r.length === 0 && this.events.delete(
|
|
156
|
+
if (!this.events.has(t)) return;
|
|
157
|
+
const r = this.events.get(t), s = r.findIndex((i) => i.handler === e);
|
|
158
|
+
s > -1 && r.splice(s, 1), r.length === 0 && this.events.delete(t);
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Remove all wildcard handlers matching a pattern
|
|
162
162
|
* @param {string} pattern - Pattern to match (e.g., 'event:*')
|
|
163
163
|
*/
|
|
164
|
-
offWildcard(
|
|
165
|
-
for (const
|
|
166
|
-
|
|
164
|
+
offWildcard(t) {
|
|
165
|
+
for (const e of [...this.wildcardHandlers])
|
|
166
|
+
e.pattern === t && this.wildcardHandlers.delete(e);
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
169
|
* Remove all handlers (regular and wildcard) for a specific handler function
|
|
170
170
|
* Useful for cleanup when a component is destroyed
|
|
171
171
|
* @param {Function} handler - Handler function to remove
|
|
172
172
|
*/
|
|
173
|
-
offAll(
|
|
174
|
-
for (const [
|
|
175
|
-
const s = r.findIndex((i) => i.handler ===
|
|
176
|
-
s > -1 && r.splice(s, 1), r.length === 0 && this.events.delete(
|
|
173
|
+
offAll(t) {
|
|
174
|
+
for (const [e, r] of this.events) {
|
|
175
|
+
const s = r.findIndex((i) => i.handler === t);
|
|
176
|
+
s > -1 && r.splice(s, 1), r.length === 0 && this.events.delete(e);
|
|
177
177
|
}
|
|
178
|
-
for (const
|
|
179
|
-
|
|
178
|
+
for (const e of [...this.wildcardHandlers])
|
|
179
|
+
e.handler === t && this.wildcardHandlers.delete(e);
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
182
|
* Emit an event synchronously
|
|
183
183
|
* @param {string} eventName - Event name
|
|
184
184
|
* @param {*} data - Event data
|
|
185
185
|
*/
|
|
186
|
-
emit(
|
|
187
|
-
if (this.events.has(
|
|
188
|
-
const s = [...this.events.get(
|
|
186
|
+
emit(t, e) {
|
|
187
|
+
if (this.events.has(t)) {
|
|
188
|
+
const s = [...this.events.get(t)];
|
|
189
189
|
for (const i of s) {
|
|
190
190
|
const { handler: n, once: o } = i;
|
|
191
|
-
o && this.off(
|
|
191
|
+
o && this.off(t, n);
|
|
192
192
|
try {
|
|
193
|
-
n(
|
|
193
|
+
n(e, t);
|
|
194
194
|
} catch (a) {
|
|
195
|
-
console.error(`Error in event handler for ${
|
|
195
|
+
console.error(`Error in event handler for ${t}:`, a);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
const r = [];
|
|
200
200
|
for (const s of [...this.wildcardHandlers])
|
|
201
|
-
if (this.matchesPattern(
|
|
201
|
+
if (this.matchesPattern(t, s.pattern)) {
|
|
202
202
|
const { handler: i, once: n } = s;
|
|
203
203
|
n && r.push(s);
|
|
204
204
|
try {
|
|
205
|
-
i(
|
|
205
|
+
i(e, t);
|
|
206
206
|
} catch (o) {
|
|
207
|
-
console.error(`Error in wildcard handler for ${
|
|
207
|
+
console.error(`Error in wildcard handler for ${t}:`, o);
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
r.forEach((s) => this.wildcardHandlers.delete(s));
|
|
@@ -212,8 +212,8 @@ class T {
|
|
|
212
212
|
/**
|
|
213
213
|
* Check if event name matches a pattern
|
|
214
214
|
*/
|
|
215
|
-
matchesPattern(
|
|
216
|
-
return new RegExp("^" +
|
|
215
|
+
matchesPattern(t, e) {
|
|
216
|
+
return new RegExp("^" + e.replace(/\*/g, ".*") + "$").test(t);
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Clear all event subscriptions
|
|
@@ -230,8 +230,8 @@ class T {
|
|
|
230
230
|
/**
|
|
231
231
|
* Get handler count for an event
|
|
232
232
|
*/
|
|
233
|
-
getHandlerCount(
|
|
234
|
-
return this.events.has(
|
|
233
|
+
getHandlerCount(t) {
|
|
234
|
+
return this.events.has(t) ? this.events.get(t).length : 0;
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
237
|
* Get wildcard handler count
|
|
@@ -243,22 +243,22 @@ class T {
|
|
|
243
243
|
* Get total handler count (for debugging/monitoring)
|
|
244
244
|
*/
|
|
245
245
|
getTotalHandlerCount() {
|
|
246
|
-
let
|
|
247
|
-
for (const
|
|
248
|
-
|
|
249
|
-
return
|
|
246
|
+
let t = this.wildcardHandlers.size;
|
|
247
|
+
for (const e of this.events.values())
|
|
248
|
+
t += e.length;
|
|
249
|
+
return t;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
const j = new T();
|
|
253
253
|
class V {
|
|
254
|
-
constructor(
|
|
254
|
+
constructor(t = {}) {
|
|
255
255
|
this.eventBus = new T(), this.calendar = new H({
|
|
256
|
-
view:
|
|
257
|
-
date:
|
|
258
|
-
weekStartsOn:
|
|
259
|
-
locale:
|
|
260
|
-
timeZone:
|
|
261
|
-
...
|
|
256
|
+
view: t.view || "month",
|
|
257
|
+
date: t.date || /* @__PURE__ */ new Date(),
|
|
258
|
+
weekStartsOn: t.weekStartsOn ?? 0,
|
|
259
|
+
locale: t.locale || "en-US",
|
|
260
|
+
timeZone: t.timeZone || Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
261
|
+
...t
|
|
262
262
|
}), this.state = {
|
|
263
263
|
view: this.calendar.getView(),
|
|
264
264
|
currentDate: this.calendar.getCurrentDate(),
|
|
@@ -267,7 +267,7 @@ class V {
|
|
|
267
267
|
selectedDate: null,
|
|
268
268
|
loading: !1,
|
|
269
269
|
error: null,
|
|
270
|
-
config: { ...
|
|
270
|
+
config: { ...t }
|
|
271
271
|
}, this.subscribers = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this), this.unsubscribe = this.unsubscribe.bind(this), this.setState = this.setState.bind(this), this._syncEventsFromCore({ silent: !0 });
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
@@ -280,19 +280,19 @@ class V {
|
|
|
280
280
|
* (required after updateEvent where IDs
|
|
281
281
|
* are unchanged but content has changed)
|
|
282
282
|
*/
|
|
283
|
-
_syncEventsFromCore(
|
|
284
|
-
const { force:
|
|
285
|
-
return (
|
|
283
|
+
_syncEventsFromCore(t = {}) {
|
|
284
|
+
const { force: e = !1 } = t, r = this.calendar.getEvents() || [];
|
|
285
|
+
return (e || this.state.events.length !== r.length || !this._eventsMatch(this.state.events, r)) && this.setState({ events: [...r] }, t), r;
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
288
|
* Check if two event arrays have the same events by id.
|
|
289
289
|
* Only used for add/delete guards — updateEvent must pass force:true
|
|
290
290
|
* to bypass this check because IDs are unchanged after an update.
|
|
291
291
|
*/
|
|
292
|
-
_eventsMatch(
|
|
293
|
-
if (
|
|
294
|
-
const r = new Set(
|
|
295
|
-
return
|
|
292
|
+
_eventsMatch(t, e) {
|
|
293
|
+
if (t.length !== e.length) return !1;
|
|
294
|
+
const r = new Set(t.map((s) => s.id));
|
|
295
|
+
return e.every((s) => r.has(s.id));
|
|
296
296
|
}
|
|
297
297
|
// State management
|
|
298
298
|
getState() {
|
|
@@ -302,24 +302,24 @@ class V {
|
|
|
302
302
|
events: [...this.state.events]
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
setState(
|
|
306
|
-
const { silent: r = !1 } =
|
|
307
|
-
return this.state = { ...this.state, ...
|
|
305
|
+
setState(t, e = {}) {
|
|
306
|
+
const { silent: r = !1 } = e, s = { ...this.state };
|
|
307
|
+
return this.state = { ...this.state, ...t }, r || (this.notifySubscribers(s, this.state), this.emitStateChange(s, this.state)), this.state;
|
|
308
308
|
}
|
|
309
|
-
subscribe(
|
|
310
|
-
return this.subscribers.add(
|
|
309
|
+
subscribe(t, e = null) {
|
|
310
|
+
return this.subscribers.add(t), e && (this._subscriberIds || (this._subscriberIds = /* @__PURE__ */ new Map()), this._subscriberIds.set(e, t)), () => this.unsubscribe(t, e);
|
|
311
311
|
}
|
|
312
|
-
unsubscribe(
|
|
313
|
-
this.subscribers.delete(
|
|
312
|
+
unsubscribe(t, e = null) {
|
|
313
|
+
this.subscribers.delete(t), e && this._subscriberIds && this._subscriberIds.delete(e);
|
|
314
314
|
}
|
|
315
315
|
/**
|
|
316
316
|
* Unsubscribe by subscriber ID
|
|
317
317
|
* @param {string} subscriberId - ID used when subscribing
|
|
318
318
|
*/
|
|
319
|
-
unsubscribeById(
|
|
319
|
+
unsubscribeById(t) {
|
|
320
320
|
if (!this._subscriberIds) return !1;
|
|
321
|
-
const
|
|
322
|
-
return
|
|
321
|
+
const e = this._subscriberIds.get(t);
|
|
322
|
+
return e ? (this.subscribers.delete(e), this._subscriberIds.delete(t), !0) : !1;
|
|
323
323
|
}
|
|
324
324
|
/**
|
|
325
325
|
* Get subscriber count (for debugging/monitoring)
|
|
@@ -327,34 +327,34 @@ class V {
|
|
|
327
327
|
getSubscriberCount() {
|
|
328
328
|
return this.subscribers.size;
|
|
329
329
|
}
|
|
330
|
-
notifySubscribers(
|
|
330
|
+
notifySubscribers(t, e) {
|
|
331
331
|
this.subscribers.forEach((r) => {
|
|
332
332
|
try {
|
|
333
|
-
r(
|
|
333
|
+
r(e, t);
|
|
334
334
|
} catch (s) {
|
|
335
335
|
console.error("Error in state subscriber:", s);
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
|
-
emitStateChange(
|
|
340
|
-
const r = Object.keys(
|
|
339
|
+
emitStateChange(t, e) {
|
|
340
|
+
const r = Object.keys(e).filter((s) => t[s] !== e[s]);
|
|
341
341
|
r.forEach((s) => {
|
|
342
342
|
this.eventBus.emit(`state:${s}:changed`, {
|
|
343
|
-
oldValue:
|
|
344
|
-
newValue:
|
|
345
|
-
state:
|
|
343
|
+
oldValue: t[s],
|
|
344
|
+
newValue: e[s],
|
|
345
|
+
state: e
|
|
346
346
|
});
|
|
347
|
-
}), r.length > 0 && this.eventBus.emit("state:changed", { oldState:
|
|
347
|
+
}), r.length > 0 && this.eventBus.emit("state:changed", { oldState: t, newState: e, changedKeys: r });
|
|
348
348
|
}
|
|
349
349
|
// Calendar operations
|
|
350
|
-
setView(
|
|
351
|
-
this.calendar.setView(
|
|
350
|
+
setView(t) {
|
|
351
|
+
this.calendar.setView(t), this.setState({ view: t }), this.eventBus.emit("view:changed", { view: t });
|
|
352
352
|
}
|
|
353
353
|
getView() {
|
|
354
354
|
return this.state.view;
|
|
355
355
|
}
|
|
356
|
-
setDate(
|
|
357
|
-
this.calendar.goToDate(
|
|
356
|
+
setDate(t) {
|
|
357
|
+
this.calendar.goToDate(t), this.setState({ currentDate: this.calendar.getCurrentDate() }), this.eventBus.emit("date:changed", { date: this.state.currentDate });
|
|
358
358
|
}
|
|
359
359
|
getCurrentDate() {
|
|
360
360
|
return this.state.currentDate;
|
|
@@ -369,26 +369,26 @@ class V {
|
|
|
369
369
|
today() {
|
|
370
370
|
this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), this.eventBus.emit("navigation:today", { date: this.state.currentDate });
|
|
371
371
|
}
|
|
372
|
-
goToDate(
|
|
373
|
-
this.calendar.goToDate(
|
|
372
|
+
goToDate(t) {
|
|
373
|
+
this.calendar.goToDate(t), this.setState({ currentDate: this.calendar.getCurrentDate() }), this.eventBus.emit("navigation:goto", { date: this.state.currentDate });
|
|
374
374
|
}
|
|
375
375
|
// Event management
|
|
376
|
-
addEvent(
|
|
377
|
-
const
|
|
378
|
-
return
|
|
376
|
+
addEvent(t) {
|
|
377
|
+
const e = this.calendar.addEvent(t);
|
|
378
|
+
return e ? (this._syncEventsFromCore(), this.eventBus.emit("event:add", { event: e }), this.eventBus.emit("event:added", { event: e }), e) : (console.error("Failed to add event to calendar"), this.eventBus.emit("event:error", { action: "add", event: t, error: "Failed to add event" }), null);
|
|
379
379
|
}
|
|
380
|
-
updateEvent(
|
|
380
|
+
updateEvent(t, e) {
|
|
381
381
|
this._syncEventsFromCore({ silent: !0 });
|
|
382
|
-
const r = this.calendar.updateEvent(
|
|
383
|
-
return r ? (this._syncEventsFromCore({ force: !0 }), this.eventBus.emit("event:update", { event: r }), this.eventBus.emit("event:updated", { event: r }), r) : (console.error(`Failed to update event: ${
|
|
382
|
+
const r = this.calendar.updateEvent(t, e);
|
|
383
|
+
return r ? (this._syncEventsFromCore({ force: !0 }), this.eventBus.emit("event:update", { event: r }), this.eventBus.emit("event:updated", { event: r }), r) : (console.error(`Failed to update event: ${t}`), this.eventBus.emit("event:error", {
|
|
384
384
|
action: "update",
|
|
385
|
-
eventId:
|
|
386
|
-
updates:
|
|
385
|
+
eventId: t,
|
|
386
|
+
updates: e,
|
|
387
387
|
error: "Event not found in calendar"
|
|
388
388
|
}), null);
|
|
389
389
|
}
|
|
390
|
-
deleteEvent(
|
|
391
|
-
return this._syncEventsFromCore({ silent: !0 }), this.calendar.removeEvent(
|
|
390
|
+
deleteEvent(t) {
|
|
391
|
+
return this._syncEventsFromCore({ silent: !0 }), this.calendar.removeEvent(t) ? (this._syncEventsFromCore(), this.eventBus.emit("event:remove", { eventId: t }), this.eventBus.emit("event:deleted", { eventId: t }), !0) : (console.error(`Failed to delete event: ${t}`), this.eventBus.emit("event:error", { action: "delete", eventId: t, error: "Event not found" }), !1);
|
|
392
392
|
}
|
|
393
393
|
getEvents() {
|
|
394
394
|
return this.calendar.getEvents() || [];
|
|
@@ -400,21 +400,21 @@ class V {
|
|
|
400
400
|
syncEvents() {
|
|
401
401
|
return this._syncEventsFromCore();
|
|
402
402
|
}
|
|
403
|
-
getEventsForDate(
|
|
404
|
-
return this.calendar.getEventsForDate(
|
|
403
|
+
getEventsForDate(t) {
|
|
404
|
+
return this.calendar.getEventsForDate(t);
|
|
405
405
|
}
|
|
406
|
-
getEventsInRange(
|
|
407
|
-
return this.calendar.getEventsInRange(
|
|
406
|
+
getEventsInRange(t, e) {
|
|
407
|
+
return this.calendar.getEventsInRange(t, e);
|
|
408
408
|
}
|
|
409
409
|
// View data
|
|
410
410
|
getViewData() {
|
|
411
|
-
const
|
|
412
|
-
return this.enrichViewData(
|
|
411
|
+
const t = this.calendar.getViewData();
|
|
412
|
+
return this.enrichViewData(t);
|
|
413
413
|
}
|
|
414
|
-
enrichViewData(
|
|
414
|
+
enrichViewData(t) {
|
|
415
415
|
var s;
|
|
416
|
-
const
|
|
417
|
-
if (
|
|
416
|
+
const e = { ...t }, r = (s = this.state.selectedDate) == null ? void 0 : s.toDateString();
|
|
417
|
+
if (e.weeks && (e.weeks = e.weeks.map((i) => ({
|
|
418
418
|
...i,
|
|
419
419
|
days: i.days.map((n) => {
|
|
420
420
|
const o = new Date(n.date);
|
|
@@ -424,74 +424,74 @@ class V {
|
|
|
424
424
|
events: n.events || this.getEventsForDate(o)
|
|
425
425
|
};
|
|
426
426
|
})
|
|
427
|
-
}))),
|
|
427
|
+
}))), e.days && (e.days = e.days.map((i) => {
|
|
428
428
|
const n = new Date(i.date);
|
|
429
429
|
return {
|
|
430
430
|
...i,
|
|
431
431
|
isSelected: n.toDateString() === r,
|
|
432
432
|
events: i.events || this.getEventsForDate(n)
|
|
433
433
|
};
|
|
434
|
-
})),
|
|
435
|
-
const i = new Date(
|
|
436
|
-
|
|
434
|
+
})), e.date && !e.days && !e.weeks) {
|
|
435
|
+
const i = new Date(e.date);
|
|
436
|
+
e.isSelected = i.toDateString() === r, e.events = e.events || this.getEventsForDate(i);
|
|
437
437
|
}
|
|
438
|
-
return
|
|
438
|
+
return e;
|
|
439
439
|
}
|
|
440
440
|
// Selection management
|
|
441
|
-
selectEvent(
|
|
442
|
-
this.setState({ selectedEvent:
|
|
441
|
+
selectEvent(t) {
|
|
442
|
+
this.setState({ selectedEvent: t }), this.eventBus.emit("event:selected", { event: t });
|
|
443
443
|
}
|
|
444
|
-
selectEventById(
|
|
445
|
-
const
|
|
446
|
-
|
|
444
|
+
selectEventById(t) {
|
|
445
|
+
const e = this.state.events.find((r) => r.id === t);
|
|
446
|
+
e && this.selectEvent(e);
|
|
447
447
|
}
|
|
448
448
|
deselectEvent() {
|
|
449
449
|
this.setState({ selectedEvent: null }), this.eventBus.emit("event:deselected", {});
|
|
450
450
|
}
|
|
451
|
-
selectDate(
|
|
452
|
-
this.setState({ selectedDate:
|
|
451
|
+
selectDate(t) {
|
|
452
|
+
this.setState({ selectedDate: t }), this.eventBus.emit("date:selected", { date: t });
|
|
453
453
|
}
|
|
454
454
|
deselectDate() {
|
|
455
455
|
this.setState({ selectedDate: null }), this.eventBus.emit("date:deselected", {});
|
|
456
456
|
}
|
|
457
457
|
// Utility methods
|
|
458
|
-
isToday(
|
|
459
|
-
const
|
|
460
|
-
return
|
|
458
|
+
isToday(t) {
|
|
459
|
+
const e = /* @__PURE__ */ new Date();
|
|
460
|
+
return t.toDateString() === e.toDateString();
|
|
461
461
|
}
|
|
462
|
-
isSelectedDate(
|
|
463
|
-
return this.state.selectedDate &&
|
|
462
|
+
isSelectedDate(t) {
|
|
463
|
+
return this.state.selectedDate && t.toDateString() === this.state.selectedDate.toDateString();
|
|
464
464
|
}
|
|
465
|
-
isWeekend(
|
|
466
|
-
const
|
|
467
|
-
return
|
|
465
|
+
isWeekend(t) {
|
|
466
|
+
const e = t.getDay();
|
|
467
|
+
return e === 0 || e === 6;
|
|
468
468
|
}
|
|
469
469
|
// Loading state
|
|
470
|
-
setLoading(
|
|
471
|
-
this.setState({ loading:
|
|
470
|
+
setLoading(t) {
|
|
471
|
+
this.setState({ loading: t });
|
|
472
472
|
}
|
|
473
473
|
// Error handling
|
|
474
|
-
setError(
|
|
475
|
-
this.setState({ error:
|
|
474
|
+
setError(t) {
|
|
475
|
+
this.setState({ error: t }), t && this.eventBus.emit("error", { error: t });
|
|
476
476
|
}
|
|
477
477
|
clearError() {
|
|
478
478
|
this.setState({ error: null });
|
|
479
479
|
}
|
|
480
480
|
// Configuration
|
|
481
|
-
updateConfig(
|
|
482
|
-
this.setState({ config: { ...this.state.config, ...
|
|
481
|
+
updateConfig(t) {
|
|
482
|
+
this.setState({ config: { ...this.state.config, ...t } }), t.weekStartsOn !== void 0 && this.calendar.setWeekStartsOn(t.weekStartsOn), t.locale !== void 0 && this.calendar.setLocale(t.locale), t.timeZone !== void 0 && this.calendar.setTimezone(t.timeZone);
|
|
483
483
|
}
|
|
484
484
|
// Destroy
|
|
485
485
|
destroy() {
|
|
486
|
-
this.subscribers.clear(), this._subscriberIds && (this._subscriberIds.clear(), this._subscriberIds = null), this.state = null, this.calendar = null;
|
|
486
|
+
this.subscribers.clear(), this._subscriberIds && (this._subscriberIds.clear(), this._subscriberIds = null), this.eventBus && (this.eventBus.clear(), this.eventBus = null), this.state = null, this.calendar = null;
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
489
|
class p extends L {
|
|
490
490
|
/**
|
|
491
491
|
* Format date for display
|
|
492
492
|
*/
|
|
493
|
-
static formatDate(
|
|
494
|
-
if (!
|
|
493
|
+
static formatDate(t, e = "default", r = "en-US") {
|
|
494
|
+
if (!t) return "";
|
|
495
495
|
const s = {
|
|
496
496
|
default: { year: "numeric", month: "long", day: "numeric" },
|
|
497
497
|
short: { year: "numeric", month: "short", day: "numeric" },
|
|
@@ -509,93 +509,93 @@ class p extends L {
|
|
|
509
509
|
hour: "numeric",
|
|
510
510
|
minute: "2-digit"
|
|
511
511
|
}
|
|
512
|
-
}, i = s[
|
|
513
|
-
return new Intl.DateTimeFormat(r, i).format(
|
|
512
|
+
}, i = s[e] || s.default;
|
|
513
|
+
return new Intl.DateTimeFormat(r, i).format(t);
|
|
514
514
|
}
|
|
515
515
|
/**
|
|
516
516
|
* Format time for display
|
|
517
517
|
*/
|
|
518
|
-
static formatTime(
|
|
519
|
-
if (!
|
|
518
|
+
static formatTime(t, e = !0, r = !1, s = "en-US") {
|
|
519
|
+
if (!t) return "";
|
|
520
520
|
const i = {
|
|
521
521
|
hour: "numeric",
|
|
522
|
-
minute:
|
|
522
|
+
minute: e ? "2-digit" : void 0,
|
|
523
523
|
hour12: !r
|
|
524
524
|
};
|
|
525
|
-
return new Intl.DateTimeFormat(s, i).format(
|
|
525
|
+
return new Intl.DateTimeFormat(s, i).format(t);
|
|
526
526
|
}
|
|
527
527
|
/**
|
|
528
528
|
* Format date range for display
|
|
529
529
|
*/
|
|
530
|
-
static formatDateRange(
|
|
531
|
-
if (!
|
|
532
|
-
if (!
|
|
533
|
-
return this.formatDate(
|
|
534
|
-
const s = this.isSameYear(
|
|
535
|
-
return `${this.formatDate(
|
|
530
|
+
static formatDateRange(t, e, r = "en-US") {
|
|
531
|
+
if (!t) return "";
|
|
532
|
+
if (!e || this.isSameDay(t, e))
|
|
533
|
+
return this.formatDate(t, "default", r);
|
|
534
|
+
const s = this.isSameYear(t, e) ? "short" : "default";
|
|
535
|
+
return `${this.formatDate(t, s, r)} - ${this.formatDate(e, "default", r)}`;
|
|
536
536
|
}
|
|
537
537
|
/**
|
|
538
538
|
* Format time range for display
|
|
539
539
|
*/
|
|
540
|
-
static formatTimeRange(
|
|
541
|
-
if (!
|
|
542
|
-
const s = this.formatTime(
|
|
543
|
-
if (!
|
|
544
|
-
const i = this.formatTime(
|
|
540
|
+
static formatTimeRange(t, e, r = "en-US") {
|
|
541
|
+
if (!t) return "";
|
|
542
|
+
const s = this.formatTime(t, !0, !1, r);
|
|
543
|
+
if (!e) return s;
|
|
544
|
+
const i = this.formatTime(e, !0, !1, r);
|
|
545
545
|
return `${s} - ${i}`;
|
|
546
546
|
}
|
|
547
547
|
/**
|
|
548
548
|
* Get relative time string (e.g., "2 hours ago", "in 3 days")
|
|
549
549
|
*/
|
|
550
|
-
static getRelativeTime(
|
|
551
|
-
const s = new Intl.RelativeTimeFormat(r, { numeric: "auto" }), i =
|
|
552
|
-
return Math.abs(n) < 60 ? s.format(n, "second") : Math.abs(o) < 60 ? s.format(o, "minute") : Math.abs(a) < 24 ? s.format(a, "hour") : Math.abs(c) < 7 ? s.format(c, "day") : Math.abs(d) < 4 ? s.format(d, "week") : Math.abs(l) < 12 ? s.format(l, "month") : s.format(
|
|
550
|
+
static getRelativeTime(t, e = /* @__PURE__ */ new Date(), r = "en-US") {
|
|
551
|
+
const s = new Intl.RelativeTimeFormat(r, { numeric: "auto" }), i = t - e, n = Math.floor(i / 1e3), o = Math.floor(n / 60), a = Math.floor(o / 60), c = Math.floor(a / 24), d = Math.floor(c / 7), l = Math.floor(c / 30), u = Math.floor(c / 365);
|
|
552
|
+
return Math.abs(n) < 60 ? s.format(n, "second") : Math.abs(o) < 60 ? s.format(o, "minute") : Math.abs(a) < 24 ? s.format(a, "hour") : Math.abs(c) < 7 ? s.format(c, "day") : Math.abs(d) < 4 ? s.format(d, "week") : Math.abs(l) < 12 ? s.format(l, "month") : s.format(u, "year");
|
|
553
553
|
}
|
|
554
554
|
/**
|
|
555
555
|
* Check if date is today
|
|
556
556
|
*/
|
|
557
|
-
static isToday(
|
|
558
|
-
const
|
|
559
|
-
return this.isSameDay(
|
|
557
|
+
static isToday(t) {
|
|
558
|
+
const e = /* @__PURE__ */ new Date();
|
|
559
|
+
return this.isSameDay(t, e);
|
|
560
560
|
}
|
|
561
561
|
/**
|
|
562
562
|
* Check if date is in the past
|
|
563
563
|
*/
|
|
564
|
-
static isPast(
|
|
565
|
-
return
|
|
564
|
+
static isPast(t) {
|
|
565
|
+
return t < /* @__PURE__ */ new Date();
|
|
566
566
|
}
|
|
567
567
|
/**
|
|
568
568
|
* Check if date is in the future
|
|
569
569
|
*/
|
|
570
|
-
static isFuture(
|
|
571
|
-
return
|
|
570
|
+
static isFuture(t) {
|
|
571
|
+
return t > /* @__PURE__ */ new Date();
|
|
572
572
|
}
|
|
573
573
|
/**
|
|
574
574
|
* Get calendar week number
|
|
575
575
|
*/
|
|
576
|
-
static getWeekNumber(
|
|
577
|
-
const
|
|
578
|
-
return Math.ceil((r +
|
|
576
|
+
static getWeekNumber(t) {
|
|
577
|
+
const e = new Date(t.getFullYear(), 0, 1), r = (t - e) / 864e5;
|
|
578
|
+
return Math.ceil((r + e.getDay() + 1) / 7);
|
|
579
579
|
}
|
|
580
580
|
/**
|
|
581
581
|
* Get day abbreviation
|
|
582
582
|
*/
|
|
583
|
-
static getDayAbbreviation(
|
|
584
|
-
const r = new Date(2024, 0, 7 +
|
|
585
|
-
return new Intl.DateTimeFormat(
|
|
583
|
+
static getDayAbbreviation(t, e = "en-US") {
|
|
584
|
+
const r = new Date(2024, 0, 7 + t);
|
|
585
|
+
return new Intl.DateTimeFormat(e, { weekday: "short" }).format(r);
|
|
586
586
|
}
|
|
587
587
|
/**
|
|
588
588
|
* Get month name
|
|
589
589
|
*/
|
|
590
|
-
static getMonthName(
|
|
591
|
-
const s = new Date(2024,
|
|
592
|
-
return new Intl.DateTimeFormat(r, { month:
|
|
590
|
+
static getMonthName(t, e = "long", r = "en-US") {
|
|
591
|
+
const s = new Date(2024, t, 1);
|
|
592
|
+
return new Intl.DateTimeFormat(r, { month: e }).format(s);
|
|
593
593
|
}
|
|
594
594
|
/**
|
|
595
595
|
* Parse time string (e.g., "14:30" or "2:30 PM")
|
|
596
596
|
*/
|
|
597
|
-
static parseTimeString(
|
|
598
|
-
const r = new Date(
|
|
597
|
+
static parseTimeString(t, e = /* @__PURE__ */ new Date()) {
|
|
598
|
+
const r = new Date(e), [s, i] = t.split(/\s+/), [n, o] = s.split(":").map(Number);
|
|
599
599
|
let a = n;
|
|
600
600
|
return i && (i.toLowerCase() === "pm" && n < 12 ? a = n + 12 : i.toLowerCase() === "am" && n === 12 && (a = 0)), r.setHours(a, o || 0, 0, 0), r;
|
|
601
601
|
}
|
|
@@ -604,9 +604,9 @@ class E {
|
|
|
604
604
|
/**
|
|
605
605
|
* Create element with attributes and children
|
|
606
606
|
*/
|
|
607
|
-
static createElement(
|
|
608
|
-
const s = document.createElement(
|
|
609
|
-
return Object.entries(
|
|
607
|
+
static createElement(t, e = {}, r = []) {
|
|
608
|
+
const s = document.createElement(t);
|
|
609
|
+
return Object.entries(e).forEach(([i, n]) => {
|
|
610
610
|
if (i === "className")
|
|
611
611
|
s.className = n;
|
|
612
612
|
else if (i === "style" && typeof n == "object")
|
|
@@ -625,189 +625,189 @@ class E {
|
|
|
625
625
|
/**
|
|
626
626
|
* Add multiple event listeners
|
|
627
627
|
*/
|
|
628
|
-
static addEventListeners(
|
|
629
|
-
return Object.entries(
|
|
630
|
-
|
|
628
|
+
static addEventListeners(t, e) {
|
|
629
|
+
return Object.entries(e).forEach(([r, s]) => {
|
|
630
|
+
t.addEventListener(r, s);
|
|
631
631
|
}), () => {
|
|
632
|
-
Object.entries(
|
|
633
|
-
|
|
632
|
+
Object.entries(e).forEach(([r, s]) => {
|
|
633
|
+
t.removeEventListener(r, s);
|
|
634
634
|
});
|
|
635
635
|
};
|
|
636
636
|
}
|
|
637
637
|
/**
|
|
638
638
|
* Delegate event handling
|
|
639
639
|
*/
|
|
640
|
-
static delegate(
|
|
640
|
+
static delegate(t, e, r, s) {
|
|
641
641
|
const i = (n) => {
|
|
642
|
-
const o = n.target.closest(
|
|
643
|
-
o &&
|
|
642
|
+
const o = n.target.closest(e);
|
|
643
|
+
o && t.contains(o) && s.call(o, n);
|
|
644
644
|
};
|
|
645
|
-
return
|
|
645
|
+
return t.addEventListener(r, i), () => t.removeEventListener(r, i);
|
|
646
646
|
}
|
|
647
647
|
/**
|
|
648
648
|
* Get element position relative to viewport
|
|
649
649
|
*/
|
|
650
|
-
static getPosition(
|
|
651
|
-
const
|
|
650
|
+
static getPosition(t) {
|
|
651
|
+
const e = t.getBoundingClientRect();
|
|
652
652
|
return {
|
|
653
|
-
top:
|
|
654
|
-
left:
|
|
655
|
-
bottom:
|
|
656
|
-
right:
|
|
657
|
-
width:
|
|
658
|
-
height:
|
|
653
|
+
top: e.top + window.scrollY,
|
|
654
|
+
left: e.left + window.scrollX,
|
|
655
|
+
bottom: e.bottom + window.scrollY,
|
|
656
|
+
right: e.right + window.scrollX,
|
|
657
|
+
width: e.width,
|
|
658
|
+
height: e.height
|
|
659
659
|
};
|
|
660
660
|
}
|
|
661
661
|
/**
|
|
662
662
|
* Check if element is in viewport
|
|
663
663
|
*/
|
|
664
|
-
static isInViewport(
|
|
665
|
-
const r =
|
|
666
|
-
return r.top >= -
|
|
664
|
+
static isInViewport(t, e = 0) {
|
|
665
|
+
const r = t.getBoundingClientRect();
|
|
666
|
+
return r.top >= -e && r.left >= -e && r.bottom <= (window.innerHeight || document.documentElement.clientHeight) + e && r.right <= (window.innerWidth || document.documentElement.clientWidth) + e;
|
|
667
667
|
}
|
|
668
668
|
/**
|
|
669
669
|
* Smooth scroll to element
|
|
670
670
|
*/
|
|
671
|
-
static scrollToElement(
|
|
672
|
-
const { behavior: r = "smooth", block: s = "start", inline: i = "nearest" } =
|
|
673
|
-
|
|
671
|
+
static scrollToElement(t, e = {}) {
|
|
672
|
+
const { behavior: r = "smooth", block: s = "start", inline: i = "nearest" } = e;
|
|
673
|
+
t.scrollIntoView({ behavior: r, block: s, inline: i });
|
|
674
674
|
}
|
|
675
675
|
/**
|
|
676
676
|
* Get computed style value
|
|
677
677
|
*/
|
|
678
|
-
static getStyle(
|
|
679
|
-
return window.getComputedStyle(
|
|
678
|
+
static getStyle(t, e) {
|
|
679
|
+
return window.getComputedStyle(t).getPropertyValue(e);
|
|
680
680
|
}
|
|
681
681
|
/**
|
|
682
682
|
* Set multiple styles
|
|
683
683
|
*/
|
|
684
|
-
static setStyles(
|
|
685
|
-
Object.assign(
|
|
684
|
+
static setStyles(t, e) {
|
|
685
|
+
Object.assign(t.style, e);
|
|
686
686
|
}
|
|
687
687
|
/**
|
|
688
688
|
* Add/remove classes with animation support
|
|
689
689
|
*/
|
|
690
|
-
static async animateClass(
|
|
691
|
-
|
|
690
|
+
static async animateClass(t, e, r = 300) {
|
|
691
|
+
t.classList.add(e), await this.wait(r), t.classList.remove(e);
|
|
692
692
|
}
|
|
693
693
|
/**
|
|
694
694
|
* Wait for animation/transition to complete
|
|
695
695
|
*/
|
|
696
|
-
static waitForAnimation(
|
|
696
|
+
static waitForAnimation(t, e = "animationend") {
|
|
697
697
|
return new Promise((r) => {
|
|
698
698
|
const s = () => {
|
|
699
|
-
|
|
699
|
+
t.removeEventListener(e, s), r();
|
|
700
700
|
};
|
|
701
|
-
|
|
701
|
+
t.addEventListener(e, s);
|
|
702
702
|
});
|
|
703
703
|
}
|
|
704
704
|
/**
|
|
705
705
|
* Utility wait function
|
|
706
706
|
*/
|
|
707
|
-
static wait(
|
|
708
|
-
return new Promise((
|
|
707
|
+
static wait(t) {
|
|
708
|
+
return new Promise((e) => setTimeout(e, t));
|
|
709
709
|
}
|
|
710
710
|
/**
|
|
711
711
|
* Parse HTML string safely
|
|
712
712
|
*/
|
|
713
|
-
static parseHTML(
|
|
714
|
-
const
|
|
715
|
-
return
|
|
713
|
+
static parseHTML(t) {
|
|
714
|
+
const e = document.createElement("template");
|
|
715
|
+
return e.innerHTML = t.trim(), e.content.firstChild;
|
|
716
716
|
}
|
|
717
717
|
/**
|
|
718
718
|
* Escape HTML to prevent XSS
|
|
719
719
|
*/
|
|
720
|
-
static escapeHTML(
|
|
721
|
-
const
|
|
722
|
-
return
|
|
720
|
+
static escapeHTML(t) {
|
|
721
|
+
const e = document.createElement("div");
|
|
722
|
+
return e.textContent = t, e.innerHTML;
|
|
723
723
|
}
|
|
724
724
|
/**
|
|
725
725
|
* Debounce function calls
|
|
726
726
|
*/
|
|
727
|
-
static debounce(
|
|
727
|
+
static debounce(t, e = 250) {
|
|
728
728
|
let r;
|
|
729
729
|
return function(...i) {
|
|
730
730
|
const n = () => {
|
|
731
|
-
clearTimeout(r),
|
|
731
|
+
clearTimeout(r), t(...i);
|
|
732
732
|
};
|
|
733
|
-
clearTimeout(r), r = setTimeout(n,
|
|
733
|
+
clearTimeout(r), r = setTimeout(n, e);
|
|
734
734
|
};
|
|
735
735
|
}
|
|
736
736
|
/**
|
|
737
737
|
* Throttle function calls
|
|
738
738
|
*/
|
|
739
|
-
static throttle(
|
|
739
|
+
static throttle(t, e = 250) {
|
|
740
740
|
let r;
|
|
741
741
|
return function(...s) {
|
|
742
|
-
r || (
|
|
742
|
+
r || (t.apply(this, s), r = !0, setTimeout(() => r = !1, e));
|
|
743
743
|
};
|
|
744
744
|
}
|
|
745
745
|
/**
|
|
746
746
|
* Get closest parent matching selector
|
|
747
747
|
*/
|
|
748
|
-
static closest(
|
|
749
|
-
return
|
|
748
|
+
static closest(t, e) {
|
|
749
|
+
return t.closest(e);
|
|
750
750
|
}
|
|
751
751
|
/**
|
|
752
752
|
* Get all parents matching selector
|
|
753
753
|
*/
|
|
754
|
-
static parents(
|
|
754
|
+
static parents(t, e) {
|
|
755
755
|
const r = [];
|
|
756
|
-
let s =
|
|
756
|
+
let s = t.parentElement;
|
|
757
757
|
for (; s; )
|
|
758
|
-
s.matches(
|
|
758
|
+
s.matches(e) && r.push(s), s = s.parentElement;
|
|
759
759
|
return r;
|
|
760
760
|
}
|
|
761
761
|
/**
|
|
762
762
|
* Measure element dimensions including margins
|
|
763
763
|
*/
|
|
764
|
-
static getOuterDimensions(
|
|
765
|
-
const
|
|
766
|
-
top: parseInt(
|
|
767
|
-
right: parseInt(
|
|
768
|
-
bottom: parseInt(
|
|
769
|
-
left: parseInt(
|
|
764
|
+
static getOuterDimensions(t) {
|
|
765
|
+
const e = window.getComputedStyle(t), r = {
|
|
766
|
+
top: parseInt(e.marginTop),
|
|
767
|
+
right: parseInt(e.marginRight),
|
|
768
|
+
bottom: parseInt(e.marginBottom),
|
|
769
|
+
left: parseInt(e.marginLeft)
|
|
770
770
|
};
|
|
771
771
|
return {
|
|
772
|
-
width:
|
|
773
|
-
height:
|
|
772
|
+
width: t.offsetWidth + r.left + r.right,
|
|
773
|
+
height: t.offsetHeight + r.top + r.bottom,
|
|
774
774
|
margin: r
|
|
775
775
|
};
|
|
776
776
|
}
|
|
777
777
|
/**
|
|
778
778
|
* Clone element with event listeners
|
|
779
779
|
*/
|
|
780
|
-
static cloneWithEvents(
|
|
781
|
-
return
|
|
780
|
+
static cloneWithEvents(t, e = !0) {
|
|
781
|
+
return t.cloneNode(e);
|
|
782
782
|
}
|
|
783
783
|
/**
|
|
784
784
|
* Focus trap for modals/dialogs
|
|
785
785
|
*/
|
|
786
|
-
static trapFocus(
|
|
787
|
-
const
|
|
786
|
+
static trapFocus(t) {
|
|
787
|
+
const e = t.querySelectorAll(
|
|
788
788
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
789
789
|
);
|
|
790
|
-
if (
|
|
791
|
-
return
|
|
792
|
-
const r =
|
|
790
|
+
if (e.length === 0)
|
|
791
|
+
return t.setAttribute("tabindex", "-1"), t.focus(), () => t.removeAttribute("tabindex");
|
|
792
|
+
const r = e[0], s = e[e.length - 1], i = (n) => {
|
|
793
793
|
n.key === "Tab" && (n.shiftKey ? document.activeElement === r && (s == null || s.focus(), n.preventDefault()) : document.activeElement === s && (r == null || r.focus(), n.preventDefault()));
|
|
794
794
|
};
|
|
795
|
-
return
|
|
795
|
+
return t.addEventListener("keydown", i), r == null || r.focus(), () => t.removeEventListener("keydown", i);
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
class
|
|
798
|
+
class f {
|
|
799
799
|
/**
|
|
800
800
|
* Get CSS variable value
|
|
801
801
|
*/
|
|
802
|
-
static getCSSVariable(
|
|
803
|
-
return getComputedStyle(
|
|
802
|
+
static getCSSVariable(t, e = document.documentElement) {
|
|
803
|
+
return getComputedStyle(e).getPropertyValue(t).trim();
|
|
804
804
|
}
|
|
805
805
|
/**
|
|
806
806
|
* Set CSS variables
|
|
807
807
|
*/
|
|
808
|
-
static setCSSVariables(
|
|
809
|
-
Object.entries(
|
|
810
|
-
|
|
808
|
+
static setCSSVariables(t, e = document.documentElement) {
|
|
809
|
+
Object.entries(t).forEach(([r, s]) => {
|
|
810
|
+
e.style.setProperty(r, s);
|
|
811
811
|
});
|
|
812
812
|
}
|
|
813
813
|
/**
|
|
@@ -817,7 +817,7 @@ class u {
|
|
|
817
817
|
return `
|
|
818
818
|
:host {
|
|
819
819
|
/* Apply CSS variables */
|
|
820
|
-
${Object.entries(this.cssVariables).map(([
|
|
820
|
+
${Object.entries(this.cssVariables).map(([t, e]) => `${t}: ${e};`).join(`
|
|
821
821
|
`)}
|
|
822
822
|
|
|
823
823
|
/* Base styles */
|
|
@@ -962,33 +962,33 @@ class u {
|
|
|
962
962
|
/**
|
|
963
963
|
* Darken color by percentage
|
|
964
964
|
*/
|
|
965
|
-
static darken(
|
|
966
|
-
const r = parseInt(
|
|
965
|
+
static darken(t, e) {
|
|
966
|
+
const r = parseInt(t.replace("#", ""), 16), s = Math.round(2.55 * e), i = (r >> 16) - s, n = (r >> 8 & 255) - s, o = (r & 255) - s;
|
|
967
967
|
return "#" + (16777216 + (i < 255 ? i < 1 ? 0 : i : 255) * 65536 + (n < 255 ? n < 1 ? 0 : n : 255) * 256 + (o < 255 ? o < 1 ? 0 : o : 255)).toString(16).slice(1);
|
|
968
968
|
}
|
|
969
969
|
/**
|
|
970
970
|
* Lighten color by percentage
|
|
971
971
|
*/
|
|
972
|
-
static lighten(
|
|
973
|
-
const r = parseInt(
|
|
972
|
+
static lighten(t, e) {
|
|
973
|
+
const r = parseInt(t.replace("#", ""), 16), s = Math.round(2.55 * e), i = (r >> 16) + s, n = (r >> 8 & 255) + s, o = (r & 255) + s;
|
|
974
974
|
return "#" + (16777216 + (i < 255 ? i < 1 ? 0 : i : 255) * 65536 + (n < 255 ? n < 1 ? 0 : n : 255) * 256 + (o < 255 ? o < 1 ? 0 : o : 255)).toString(16).slice(1);
|
|
975
975
|
}
|
|
976
976
|
/**
|
|
977
977
|
* Get contrast color (black or white) for background
|
|
978
978
|
*/
|
|
979
|
-
static getContrastColor(
|
|
980
|
-
const
|
|
979
|
+
static getContrastColor(t) {
|
|
980
|
+
const e = t.replace("#", ""), r = parseInt(e.substr(0, 2), 16), s = parseInt(e.substr(2, 2), 16), i = parseInt(e.substr(4, 2), 16);
|
|
981
981
|
return (r * 299 + s * 587 + i * 114) / 1e3 >= 128 ? "#000000" : "#FFFFFF";
|
|
982
982
|
}
|
|
983
983
|
/**
|
|
984
984
|
* Sanitize color value to prevent CSS injection
|
|
985
985
|
* Returns the color if valid, or a fallback color if invalid
|
|
986
986
|
*/
|
|
987
|
-
static sanitizeColor(
|
|
988
|
-
if (!
|
|
989
|
-
return
|
|
990
|
-
const r =
|
|
991
|
-
return /[;{}()<>\"\'\\]/.test(r) ?
|
|
987
|
+
static sanitizeColor(t, e = "var(--fc-primary-color)") {
|
|
988
|
+
if (!t || typeof t != "string")
|
|
989
|
+
return e;
|
|
990
|
+
const r = t.trim();
|
|
991
|
+
return /[;{}()<>\"\'\\]/.test(r) ? e : /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(r) || /^var\(--[a-zA-Z0-9-]+\)$/.test(r) || /^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*(0|1|0?\.\d+))?\s*\)$/.test(r) || [
|
|
992
992
|
"transparent",
|
|
993
993
|
"currentColor",
|
|
994
994
|
"inherit",
|
|
@@ -1014,14 +1014,14 @@ class u {
|
|
|
1014
1014
|
"olive",
|
|
1015
1015
|
"silver",
|
|
1016
1016
|
"fuchsia"
|
|
1017
|
-
].includes(r.toLowerCase()) ? r :
|
|
1017
|
+
].includes(r.toLowerCase()) ? r : e;
|
|
1018
1018
|
}
|
|
1019
1019
|
/**
|
|
1020
1020
|
* Convert hex to rgba
|
|
1021
1021
|
*/
|
|
1022
|
-
static hexToRgba(
|
|
1023
|
-
const r =
|
|
1024
|
-
return `rgba(${s}, ${i}, ${n}, ${
|
|
1022
|
+
static hexToRgba(t, e = 1) {
|
|
1023
|
+
const r = t.replace("#", ""), s = parseInt(r.substr(0, 2), 16), i = parseInt(r.substr(2, 2), 16), n = parseInt(r.substr(4, 2), 16);
|
|
1024
|
+
return `rgba(${s}, ${i}, ${n}, ${e})`;
|
|
1025
1025
|
}
|
|
1026
1026
|
/**
|
|
1027
1027
|
* Generate grid styles
|
|
@@ -1063,9 +1063,9 @@ class u {
|
|
|
1063
1063
|
/**
|
|
1064
1064
|
* Generate media query
|
|
1065
1065
|
*/
|
|
1066
|
-
static mediaQuery(
|
|
1067
|
-
const r = this.breakpoints[
|
|
1068
|
-
return r ? `@media (min-width: ${r}) { ${
|
|
1066
|
+
static mediaQuery(t, e) {
|
|
1067
|
+
const r = this.breakpoints[t];
|
|
1068
|
+
return r ? `@media (min-width: ${r}) { ${e} }` : "";
|
|
1069
1069
|
}
|
|
1070
1070
|
/**
|
|
1071
1071
|
* Animation keyframes
|
|
@@ -1132,7 +1132,7 @@ class u {
|
|
|
1132
1132
|
/**
|
|
1133
1133
|
* Default theme colors
|
|
1134
1134
|
*/
|
|
1135
|
-
g(
|
|
1135
|
+
g(f, "colors", {
|
|
1136
1136
|
primary: "#3B82F6",
|
|
1137
1137
|
// Modern Blue
|
|
1138
1138
|
secondary: "#64748B",
|
|
@@ -1165,7 +1165,7 @@ g(u, "colors", {
|
|
|
1165
1165
|
}), /**
|
|
1166
1166
|
* Common CSS variables
|
|
1167
1167
|
*/
|
|
1168
|
-
g(
|
|
1168
|
+
g(f, "cssVariables", {
|
|
1169
1169
|
// "Pro" Palette - Functional & Sharp
|
|
1170
1170
|
"--fc-primary-color": "#2563EB",
|
|
1171
1171
|
// International Blue (Focus)
|
|
@@ -1233,7 +1233,7 @@ g(u, "cssVariables", {
|
|
|
1233
1233
|
}), /**
|
|
1234
1234
|
* Get responsive breakpoints
|
|
1235
1235
|
*/
|
|
1236
|
-
g(
|
|
1236
|
+
g(f, "breakpoints", {
|
|
1237
1237
|
xs: "320px",
|
|
1238
1238
|
sm: "576px",
|
|
1239
1239
|
md: "768px",
|
|
@@ -1246,8 +1246,8 @@ class k {
|
|
|
1246
1246
|
* @param {HTMLElement} container - The DOM element to render into
|
|
1247
1247
|
* @param {StateManager} stateManager - The state manager instance
|
|
1248
1248
|
*/
|
|
1249
|
-
constructor(
|
|
1250
|
-
this.container =
|
|
1249
|
+
constructor(t, e) {
|
|
1250
|
+
this.container = t, this.stateManager = e, this._listeners = [], this._scrolled = !1;
|
|
1251
1251
|
}
|
|
1252
1252
|
/**
|
|
1253
1253
|
* Render the view into the container
|
|
@@ -1260,8 +1260,8 @@ class k {
|
|
|
1260
1260
|
* Clean up event listeners
|
|
1261
1261
|
*/
|
|
1262
1262
|
cleanup() {
|
|
1263
|
-
this._listeners.forEach(({ element:
|
|
1264
|
-
|
|
1263
|
+
this._listeners.forEach(({ element: t, event: e, handler: r }) => {
|
|
1264
|
+
t.removeEventListener(e, r);
|
|
1265
1265
|
}), this._listeners = [];
|
|
1266
1266
|
}
|
|
1267
1267
|
/**
|
|
@@ -1270,26 +1270,26 @@ class k {
|
|
|
1270
1270
|
* @param {string} event
|
|
1271
1271
|
* @param {Function} handler
|
|
1272
1272
|
*/
|
|
1273
|
-
addListener(
|
|
1273
|
+
addListener(t, e, r) {
|
|
1274
1274
|
const s = r.bind(this);
|
|
1275
|
-
|
|
1275
|
+
t.addEventListener(e, s), this._listeners.push({ element: t, event: e, handler: s });
|
|
1276
1276
|
}
|
|
1277
1277
|
/**
|
|
1278
1278
|
* Escape HTML to prevent XSS
|
|
1279
1279
|
* @param {string} str
|
|
1280
1280
|
* @returns {string}
|
|
1281
1281
|
*/
|
|
1282
|
-
escapeHTML(
|
|
1283
|
-
return
|
|
1282
|
+
escapeHTML(t) {
|
|
1283
|
+
return t == null ? "" : E.escapeHTML(String(t));
|
|
1284
1284
|
}
|
|
1285
1285
|
/**
|
|
1286
1286
|
* Check if a date is today
|
|
1287
1287
|
* @param {Date} date
|
|
1288
1288
|
* @returns {boolean}
|
|
1289
1289
|
*/
|
|
1290
|
-
isToday(
|
|
1291
|
-
const
|
|
1292
|
-
return
|
|
1290
|
+
isToday(t) {
|
|
1291
|
+
const e = /* @__PURE__ */ new Date();
|
|
1292
|
+
return t.getDate() === e.getDate() && t.getMonth() === e.getMonth() && t.getFullYear() === e.getFullYear();
|
|
1293
1293
|
}
|
|
1294
1294
|
/**
|
|
1295
1295
|
* Check if two dates are the same day
|
|
@@ -1297,25 +1297,25 @@ class k {
|
|
|
1297
1297
|
* @param {Date} date2
|
|
1298
1298
|
* @returns {boolean}
|
|
1299
1299
|
*/
|
|
1300
|
-
isSameDay(
|
|
1301
|
-
return
|
|
1300
|
+
isSameDay(t, e) {
|
|
1301
|
+
return t.getDate() === e.getDate() && t.getMonth() === e.getMonth() && t.getFullYear() === e.getFullYear();
|
|
1302
1302
|
}
|
|
1303
1303
|
/**
|
|
1304
1304
|
* Format hour for display (e.g., "9 AM", "2 PM")
|
|
1305
1305
|
* @param {number} hour - Hour in 24-hour format (0-23)
|
|
1306
1306
|
* @returns {string}
|
|
1307
1307
|
*/
|
|
1308
|
-
formatHour(
|
|
1309
|
-
const
|
|
1310
|
-
return `${
|
|
1308
|
+
formatHour(t) {
|
|
1309
|
+
const e = t >= 12 ? "PM" : "AM";
|
|
1310
|
+
return `${t % 12 || 12} ${e}`;
|
|
1311
1311
|
}
|
|
1312
1312
|
/**
|
|
1313
1313
|
* Format time for display (e.g., "9 AM", "2:30 PM")
|
|
1314
1314
|
* @param {Date} date
|
|
1315
1315
|
* @returns {string}
|
|
1316
1316
|
*/
|
|
1317
|
-
formatTime(
|
|
1318
|
-
const
|
|
1317
|
+
formatTime(t) {
|
|
1318
|
+
const e = t.getHours(), r = t.getMinutes(), s = e >= 12 ? "PM" : "AM", i = e % 12 || 12;
|
|
1319
1319
|
return r === 0 ? `${i} ${s}` : `${i}:${r.toString().padStart(2, "0")} ${s}`;
|
|
1320
1320
|
}
|
|
1321
1321
|
/**
|
|
@@ -1324,12 +1324,12 @@ class k {
|
|
|
1324
1324
|
* @param {string} bgColor - Hex color string
|
|
1325
1325
|
* @returns {string} 'black' or 'white'
|
|
1326
1326
|
*/
|
|
1327
|
-
getContrastingTextColor(
|
|
1328
|
-
if (!
|
|
1329
|
-
const
|
|
1330
|
-
if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(
|
|
1327
|
+
getContrastingTextColor(t) {
|
|
1328
|
+
if (!t || typeof t != "string") return "white";
|
|
1329
|
+
const e = t.charAt(0) === "#" ? t.substring(1) : t;
|
|
1330
|
+
if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(e))
|
|
1331
1331
|
return "white";
|
|
1332
|
-
const r =
|
|
1332
|
+
const r = e.length === 3 ? e[0] + e[0] + e[1] + e[1] + e[2] + e[2] : e, s = parseInt(r.substring(0, 2), 16), i = parseInt(r.substring(2, 4), 16), n = parseInt(r.substring(4, 6), 16);
|
|
1333
1333
|
if (isNaN(s) || isNaN(i) || isNaN(n))
|
|
1334
1334
|
return "white";
|
|
1335
1335
|
const a = [s / 255, i / 255, n / 255].map((d) => d <= 0.03928 ? d / 12.92 : Math.pow((d + 0.055) / 1.055, 2.4));
|
|
@@ -1340,8 +1340,8 @@ class k {
|
|
|
1340
1340
|
* @returns {string} HTML string
|
|
1341
1341
|
*/
|
|
1342
1342
|
renderNowIndicator() {
|
|
1343
|
-
const
|
|
1344
|
-
return `<div class="fc-now-indicator" style="position: absolute; left: 0; right: 0; top: ${
|
|
1343
|
+
const t = /* @__PURE__ */ new Date();
|
|
1344
|
+
return `<div class="fc-now-indicator" style="position: absolute; left: 0; right: 0; top: ${t.getHours() * 60 + t.getMinutes()}px; height: 2px; background: #dc2626; z-index: 15; pointer-events: none;"></div>`;
|
|
1345
1345
|
}
|
|
1346
1346
|
/**
|
|
1347
1347
|
* Compute overlap layout columns for a list of timed events.
|
|
@@ -1350,15 +1350,15 @@ class k {
|
|
|
1350
1350
|
* @param {Array} events - Array of event objects with start/end dates
|
|
1351
1351
|
* @returns {Map<string, {column: number, totalColumns: number}>}
|
|
1352
1352
|
*/
|
|
1353
|
-
computeOverlapLayout(
|
|
1354
|
-
if (!
|
|
1355
|
-
const
|
|
1356
|
-
const c = new Date(a.start), d = new Date(a.end), l = c.getHours() * 60 + c.getMinutes(),
|
|
1357
|
-
return { id: a.id, startMin: l, endMin:
|
|
1353
|
+
computeOverlapLayout(t) {
|
|
1354
|
+
if (!t || t.length === 0) return /* @__PURE__ */ new Map();
|
|
1355
|
+
const e = t.map((a) => {
|
|
1356
|
+
const c = new Date(a.start), d = new Date(a.end), l = c.getHours() * 60 + c.getMinutes(), u = Math.max(l + 1, d.getHours() * 60 + d.getMinutes());
|
|
1357
|
+
return { id: a.id, startMin: l, endMin: u };
|
|
1358
1358
|
});
|
|
1359
|
-
|
|
1359
|
+
e.sort((a, c) => a.startMin - c.startMin || c.endMin - c.startMin - (a.endMin - a.startMin));
|
|
1360
1360
|
const r = [], s = /* @__PURE__ */ new Map();
|
|
1361
|
-
for (const a of
|
|
1361
|
+
for (const a of e) {
|
|
1362
1362
|
let c = !1;
|
|
1363
1363
|
for (let d = 0; d < r.length; d++)
|
|
1364
1364
|
if (r[d] <= a.startMin) {
|
|
@@ -1369,7 +1369,7 @@ class k {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
const i = [];
|
|
1371
1371
|
let n = [], o = 0;
|
|
1372
|
-
for (const a of
|
|
1372
|
+
for (const a of e)
|
|
1373
1373
|
n.length === 0 || a.startMin < o ? (n.push(a), o = Math.max(o, a.endMin)) : (i.push(n), n = [a], o = a.endMin);
|
|
1374
1374
|
n.length > 0 && i.push(n);
|
|
1375
1375
|
for (const a of i) {
|
|
@@ -1387,16 +1387,16 @@ class k {
|
|
|
1387
1387
|
* @param {Object} options.overlapLayout - Map from computeOverlapLayout()
|
|
1388
1388
|
* @returns {string} HTML string
|
|
1389
1389
|
*/
|
|
1390
|
-
renderTimedEvent(
|
|
1391
|
-
const { compact: r = !0, overlapLayout: s = null } =
|
|
1390
|
+
renderTimedEvent(t, e = {}) {
|
|
1391
|
+
const { compact: r = !0, overlapLayout: s = null } = e, i = new Date(t.start), n = new Date(t.end), o = i.getHours() * 60 + i.getMinutes(), a = Math.max((n - i) / (1e3 * 60), r ? 20 : 30), c = this.getEventColor(t), d = r ? "4px 8px" : "8px 12px", l = r ? "11px" : "13px", u = r ? 2 : 12, m = r ? 2 : 24, b = r ? "4px" : "6px";
|
|
1392
1392
|
let y, x;
|
|
1393
|
-
if (s && s.has(
|
|
1394
|
-
const { column: S, totalColumns: _ } = s.get(
|
|
1395
|
-
y = `calc(${
|
|
1393
|
+
if (s && s.has(t.id)) {
|
|
1394
|
+
const { column: S, totalColumns: _ } = s.get(t.id), $ = `(100% - ${u + m}px)`;
|
|
1395
|
+
y = `calc(${u}px + ${S} * ${$} / ${_})`, x = `calc(${$} / ${_})`;
|
|
1396
1396
|
} else
|
|
1397
|
-
y = `${
|
|
1397
|
+
y = `${u}px`, x = `calc(100% - ${u + m}px)`;
|
|
1398
1398
|
return `
|
|
1399
|
-
<div class="fc-event fc-timed-event" data-event-id="${this.escapeHTML(
|
|
1399
|
+
<div class="fc-event fc-timed-event" data-event-id="${this.escapeHTML(t.id)}"
|
|
1400
1400
|
style="position: absolute; top: ${o}px; height: ${a}px;
|
|
1401
1401
|
left: ${y}; width: ${x};
|
|
1402
1402
|
background-color: ${c}; border-radius: ${b};
|
|
@@ -1405,7 +1405,7 @@ class k {
|
|
|
1405
1405
|
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
|
1406
1406
|
cursor: pointer; z-index: 5;">
|
|
1407
1407
|
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
|
1408
|
-
${this.escapeHTML(
|
|
1408
|
+
${this.escapeHTML(t.title)}
|
|
1409
1409
|
</div>
|
|
1410
1410
|
<div style="font-size: ${r ? "10px" : "11px"}; opacity: 0.9;">
|
|
1411
1411
|
${this.formatTime(i)}${r ? "" : " - " + this.formatTime(n)}
|
|
@@ -1418,39 +1418,39 @@ class k {
|
|
|
1418
1418
|
* @param {Object} event
|
|
1419
1419
|
* @returns {string}
|
|
1420
1420
|
*/
|
|
1421
|
-
getEventColor(
|
|
1422
|
-
return
|
|
1421
|
+
getEventColor(t) {
|
|
1422
|
+
return f.sanitizeColor(t == null ? void 0 : t.backgroundColor, "#2563eb");
|
|
1423
1423
|
}
|
|
1424
1424
|
/**
|
|
1425
1425
|
* Attach common event handlers for day/event clicks
|
|
1426
1426
|
*/
|
|
1427
1427
|
attachCommonEventHandlers() {
|
|
1428
|
-
this.addListener(this.container, "click", (
|
|
1429
|
-
const
|
|
1430
|
-
if (!
|
|
1431
|
-
|
|
1432
|
-
const r =
|
|
1428
|
+
this.addListener(this.container, "click", (t) => {
|
|
1429
|
+
const e = t.target.closest(".fc-event");
|
|
1430
|
+
if (!e || !this.container.contains(e)) return;
|
|
1431
|
+
t.stopPropagation();
|
|
1432
|
+
const r = e.dataset.eventId, s = this.stateManager.getEvents().find((i) => i.id === r);
|
|
1433
1433
|
s && this.stateManager.selectEvent(s);
|
|
1434
1434
|
});
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
1437
|
class w extends k {
|
|
1438
|
-
constructor(
|
|
1439
|
-
super(
|
|
1438
|
+
constructor(t, e) {
|
|
1439
|
+
super(t, e), this.maxEventsToShow = 3;
|
|
1440
1440
|
}
|
|
1441
1441
|
render() {
|
|
1442
1442
|
if (!this.container || !this.stateManager) return;
|
|
1443
|
-
const
|
|
1444
|
-
if (!
|
|
1443
|
+
const t = this.stateManager.getViewData();
|
|
1444
|
+
if (!t || !t.weeks) {
|
|
1445
1445
|
this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">No data available for month view.</div>';
|
|
1446
1446
|
return;
|
|
1447
1447
|
}
|
|
1448
1448
|
this.cleanup();
|
|
1449
|
-
const
|
|
1449
|
+
const e = this.stateManager.getState().config, r = this._renderMonthView(t, e);
|
|
1450
1450
|
this.container.innerHTML = r, this._attachEventHandlers();
|
|
1451
1451
|
}
|
|
1452
|
-
_renderMonthView(
|
|
1453
|
-
const r =
|
|
1452
|
+
_renderMonthView(t, e) {
|
|
1453
|
+
const r = e.weekStartsOn || 0;
|
|
1454
1454
|
let i = `
|
|
1455
1455
|
<div class="fc-month-view" style="display: flex; flex-direction: column; height: 100%; min-height: 400px; background: #fff; border: 1px solid #e5e7eb;">
|
|
1456
1456
|
<div class="fc-month-header" style="display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #f9fafb;">
|
|
@@ -1458,31 +1458,31 @@ class w extends k {
|
|
|
1458
1458
|
</div>
|
|
1459
1459
|
<div class="fc-month-body" style="display: flex; flex-direction: column; flex: 1;">
|
|
1460
1460
|
`;
|
|
1461
|
-
return
|
|
1461
|
+
return t.weeks.forEach((n) => {
|
|
1462
1462
|
i += this._renderWeek(n);
|
|
1463
1463
|
}), i += "</div></div>", i;
|
|
1464
1464
|
}
|
|
1465
|
-
_getDayNames(
|
|
1466
|
-
const
|
|
1465
|
+
_getDayNames(t) {
|
|
1466
|
+
const e = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], r = [];
|
|
1467
1467
|
for (let s = 0; s < 7; s++) {
|
|
1468
|
-
const i = (
|
|
1469
|
-
r.push(
|
|
1468
|
+
const i = (t + s) % 7;
|
|
1469
|
+
r.push(e[i]);
|
|
1470
1470
|
}
|
|
1471
1471
|
return r;
|
|
1472
1472
|
}
|
|
1473
|
-
_renderWeek(
|
|
1474
|
-
let
|
|
1475
|
-
return
|
|
1476
|
-
|
|
1477
|
-
}),
|
|
1473
|
+
_renderWeek(t) {
|
|
1474
|
+
let e = '<div class="fc-month-week" style="display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; min-height: 80px;">';
|
|
1475
|
+
return t.days.forEach((r) => {
|
|
1476
|
+
e += this._renderDay(r);
|
|
1477
|
+
}), e += "</div>", e;
|
|
1478
1478
|
}
|
|
1479
|
-
_renderDay(
|
|
1480
|
-
const
|
|
1479
|
+
_renderDay(t) {
|
|
1480
|
+
const e = !t.isCurrentMonth, r = t.isToday, s = e ? "#f3f4f6" : "#fff", i = e ? "#9ca3af" : "#111827", n = r ? "background: #2563eb; color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;" : "", o = t.events || [], a = o.slice(0, this.maxEventsToShow), c = o.length - this.maxEventsToShow;
|
|
1481
1481
|
return `
|
|
1482
|
-
<div class="fc-month-day" data-date="${
|
|
1482
|
+
<div class="fc-month-day" data-date="${t.date}"
|
|
1483
1483
|
style="background: ${s}; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 4px; min-height: 80px; cursor: pointer; display: flex; flex-direction: column;">
|
|
1484
1484
|
<div class="fc-day-number" style="font-size: 13px; font-weight: 500; color: ${i}; padding: 2px 4px; margin-bottom: 4px; ${n}">
|
|
1485
|
-
${
|
|
1485
|
+
${t.dayOfMonth}
|
|
1486
1486
|
</div>
|
|
1487
1487
|
<div class="fc-day-events" style="display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: hidden;">
|
|
1488
1488
|
${a.map((d) => this._renderEvent(d)).join("")}
|
|
@@ -1491,41 +1491,41 @@ class w extends k {
|
|
|
1491
1491
|
</div>
|
|
1492
1492
|
`;
|
|
1493
1493
|
}
|
|
1494
|
-
_renderEvent(
|
|
1495
|
-
const
|
|
1494
|
+
_renderEvent(t) {
|
|
1495
|
+
const e = this.getEventColor(t);
|
|
1496
1496
|
return `
|
|
1497
|
-
<div class="fc-event" data-event-id="${this.escapeHTML(
|
|
1498
|
-
style="background-color: ${
|
|
1499
|
-
${this.escapeHTML(
|
|
1497
|
+
<div class="fc-event" data-event-id="${this.escapeHTML(t.id)}"
|
|
1498
|
+
style="background-color: ${e}; font-size: 11px; padding: 2px 6px; border-radius: 3px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;">
|
|
1499
|
+
${this.escapeHTML(t.title)}
|
|
1500
1500
|
</div>
|
|
1501
1501
|
`;
|
|
1502
1502
|
}
|
|
1503
1503
|
_attachEventHandlers() {
|
|
1504
|
-
this.addListener(this.container, "click", (
|
|
1505
|
-
const
|
|
1506
|
-
if (!
|
|
1507
|
-
const r = new Date(
|
|
1504
|
+
this.addListener(this.container, "click", (t) => {
|
|
1505
|
+
const e = t.target.closest(".fc-month-day");
|
|
1506
|
+
if (!e || !this.container.contains(e) || t.target.closest(".fc-event")) return;
|
|
1507
|
+
const r = new Date(e.dataset.date);
|
|
1508
1508
|
this.stateManager.selectDate(r);
|
|
1509
1509
|
}), this.attachCommonEventHandlers();
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
1512
|
class I extends k {
|
|
1513
|
-
constructor(
|
|
1514
|
-
super(
|
|
1513
|
+
constructor(t, e) {
|
|
1514
|
+
super(t, e), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1515
1515
|
}
|
|
1516
1516
|
render() {
|
|
1517
1517
|
if (!this.container || !this.stateManager) return;
|
|
1518
|
-
const
|
|
1519
|
-
if (!
|
|
1518
|
+
const t = this.stateManager.getViewData();
|
|
1519
|
+
if (!t || !t.days || t.days.length === 0) {
|
|
1520
1520
|
this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">No data available for week view.</div>';
|
|
1521
1521
|
return;
|
|
1522
1522
|
}
|
|
1523
1523
|
this.cleanup(), this._scrolled = !1;
|
|
1524
|
-
const
|
|
1524
|
+
const e = this.stateManager.getState().config, r = this._renderWeekView(t, e);
|
|
1525
1525
|
this.container.innerHTML = r, this._attachEventHandlers(), this._scrollToCurrentTime();
|
|
1526
1526
|
}
|
|
1527
|
-
_renderWeekView(
|
|
1528
|
-
const r =
|
|
1527
|
+
_renderWeekView(t, e) {
|
|
1528
|
+
const r = t.days, s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], i = Array.from({ length: 24 }, (o, a) => a), n = r.map((o) => {
|
|
1529
1529
|
const a = new Date(o.date), c = o.events || [];
|
|
1530
1530
|
return {
|
|
1531
1531
|
...o,
|
|
@@ -1545,18 +1545,18 @@ class I extends k {
|
|
|
1545
1545
|
</div>
|
|
1546
1546
|
`;
|
|
1547
1547
|
}
|
|
1548
|
-
_renderHeader(
|
|
1548
|
+
_renderHeader(t) {
|
|
1549
1549
|
return `
|
|
1550
1550
|
<div class="fc-week-header" style="display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #f9fafb; flex-shrink: 0;">
|
|
1551
1551
|
<div style="border-right: 1px solid #e5e7eb;"></div>
|
|
1552
|
-
${
|
|
1553
|
-
(
|
|
1552
|
+
${t.map(
|
|
1553
|
+
(e) => `
|
|
1554
1554
|
<div style="padding: 12px 8px; text-align: center; border-right: 1px solid #e5e7eb;">
|
|
1555
1555
|
<div style="font-size: 10px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em;">
|
|
1556
|
-
${
|
|
1556
|
+
${e.dayName}
|
|
1557
1557
|
</div>
|
|
1558
|
-
<div style="font-size: 16px; font-weight: 500; margin-top: 4px; ${
|
|
1559
|
-
${
|
|
1558
|
+
<div style="font-size: 16px; font-weight: 500; margin-top: 4px; ${e.isToday ? "background: #dc2626; color: white; border-radius: 50%; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;" : "color: #111827;"}">
|
|
1559
|
+
${e.dayOfMonth}
|
|
1560
1560
|
</div>
|
|
1561
1561
|
</div>
|
|
1562
1562
|
`
|
|
@@ -1564,16 +1564,16 @@ class I extends k {
|
|
|
1564
1564
|
</div>
|
|
1565
1565
|
`;
|
|
1566
1566
|
}
|
|
1567
|
-
_renderAllDayRow(
|
|
1567
|
+
_renderAllDayRow(t) {
|
|
1568
1568
|
return `
|
|
1569
1569
|
<div class="fc-all-day-row" style="display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #fafafa; min-height: 32px; flex-shrink: 0;">
|
|
1570
1570
|
<div style="font-size: 9px; color: #6b7280; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e5e7eb; text-transform: uppercase; font-weight: 700;">
|
|
1571
1571
|
All day
|
|
1572
1572
|
</div>
|
|
1573
|
-
${
|
|
1574
|
-
(
|
|
1575
|
-
<div class="fc-all-day-cell" data-date="${
|
|
1576
|
-
${
|
|
1573
|
+
${t.map(
|
|
1574
|
+
(e) => `
|
|
1575
|
+
<div class="fc-all-day-cell" data-date="${e.date.toISOString()}" style="border-right: 1px solid #e5e7eb; padding: 4px; display: flex; flex-direction: column; gap: 2px;">
|
|
1576
|
+
${e.allDayEvents.map(
|
|
1577
1577
|
(r) => `
|
|
1578
1578
|
<div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(r.id)}"
|
|
1579
1579
|
style="background-color: ${this.getEventColor(r)}; font-size: 10px; padding: 2px 4px; border-radius: 2px; color: white; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
|
@@ -1587,51 +1587,51 @@ class I extends k {
|
|
|
1587
1587
|
</div>
|
|
1588
1588
|
`;
|
|
1589
1589
|
}
|
|
1590
|
-
_renderTimeGrid(
|
|
1590
|
+
_renderTimeGrid(t, e) {
|
|
1591
1591
|
return `
|
|
1592
1592
|
<div id="week-scroll-container" class="fc-time-grid-container" style="flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;">
|
|
1593
1593
|
<div class="fc-time-grid" style="display: grid; grid-template-columns: 60px repeat(7, 1fr); position: relative; height: ${this.totalHeight}px;">
|
|
1594
|
-
${this._renderTimeGutter(
|
|
1595
|
-
${
|
|
1594
|
+
${this._renderTimeGutter(e)}
|
|
1595
|
+
${t.map((r) => this._renderDayColumn(r, e)).join("")}
|
|
1596
1596
|
</div>
|
|
1597
1597
|
</div>
|
|
1598
1598
|
`;
|
|
1599
1599
|
}
|
|
1600
|
-
_renderTimeGutter(
|
|
1600
|
+
_renderTimeGutter(t) {
|
|
1601
1601
|
return `
|
|
1602
1602
|
<div class="fc-time-gutter" style="border-right: 1px solid #e5e7eb; background: #fafafa;">
|
|
1603
|
-
${
|
|
1604
|
-
(
|
|
1603
|
+
${t.map(
|
|
1604
|
+
(e) => `
|
|
1605
1605
|
<div style="height: ${this.hourHeight}px; font-size: 10px; color: #6b7280; text-align: right; padding-right: 8px; font-weight: 500;">
|
|
1606
|
-
${
|
|
1606
|
+
${e === 0 ? "" : this.formatHour(e)}
|
|
1607
1607
|
</div>
|
|
1608
1608
|
`
|
|
1609
1609
|
).join("")}
|
|
1610
1610
|
</div>
|
|
1611
1611
|
`;
|
|
1612
1612
|
}
|
|
1613
|
-
_renderDayColumn(
|
|
1613
|
+
_renderDayColumn(t, e) {
|
|
1614
1614
|
return `
|
|
1615
|
-
<div class="fc-week-day-column" data-date="${
|
|
1615
|
+
<div class="fc-week-day-column" data-date="${t.date.toISOString()}" style="border-right: 1px solid #e5e7eb; position: relative; cursor: pointer;">
|
|
1616
1616
|
<!-- Hour grid lines -->
|
|
1617
|
-
${
|
|
1617
|
+
${e.map(() => `<div style="height: ${this.hourHeight}px; border-bottom: 1px solid #f3f4f6;"></div>`).join("")}
|
|
1618
1618
|
|
|
1619
1619
|
<!-- Now indicator for today -->
|
|
1620
|
-
${
|
|
1620
|
+
${t.isToday ? this.renderNowIndicator() : ""}
|
|
1621
1621
|
|
|
1622
1622
|
<!-- Timed events -->
|
|
1623
1623
|
${(() => {
|
|
1624
|
-
const r = this.computeOverlapLayout(
|
|
1625
|
-
return
|
|
1624
|
+
const r = this.computeOverlapLayout(t.timedEvents);
|
|
1625
|
+
return t.timedEvents.map((s) => this.renderTimedEvent(s, { compact: !0, overlapLayout: r })).join("");
|
|
1626
1626
|
})()}
|
|
1627
1627
|
</div>
|
|
1628
1628
|
`;
|
|
1629
1629
|
}
|
|
1630
1630
|
_attachEventHandlers() {
|
|
1631
|
-
this.addListener(this.container, "click", (
|
|
1632
|
-
const
|
|
1633
|
-
if (!
|
|
1634
|
-
const r = new Date(
|
|
1631
|
+
this.addListener(this.container, "click", (t) => {
|
|
1632
|
+
const e = t.target.closest(".fc-week-day-column");
|
|
1633
|
+
if (!e || !this.container.contains(e) || t.target.closest(".fc-event")) return;
|
|
1634
|
+
const r = new Date(e.dataset.date), s = this.container.querySelector("#week-scroll-container"), i = e.offsetTop, n = t.clientY - e.getBoundingClientRect().top + (s ? s.scrollTop : 0) - i, o = Math.max(0, Math.min(n + i, this.totalHeight));
|
|
1635
1635
|
r.setHours(
|
|
1636
1636
|
Math.floor(o / this.hourHeight),
|
|
1637
1637
|
Math.floor(o % this.hourHeight / (this.hourHeight / 60)),
|
|
@@ -1642,28 +1642,28 @@ class I extends k {
|
|
|
1642
1642
|
}
|
|
1643
1643
|
_scrollToCurrentTime() {
|
|
1644
1644
|
if (this._scrolled) return;
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1645
|
+
const t = this.container.querySelector("#week-scroll-container");
|
|
1646
|
+
t && (t.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
1649
1649
|
class z extends k {
|
|
1650
|
-
constructor(
|
|
1651
|
-
super(
|
|
1650
|
+
constructor(t, e) {
|
|
1651
|
+
super(t, e), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
|
|
1652
1652
|
}
|
|
1653
1653
|
render() {
|
|
1654
1654
|
if (!this.container || !this.stateManager) return;
|
|
1655
|
-
const
|
|
1656
|
-
if (!
|
|
1655
|
+
const t = this.stateManager.getViewData();
|
|
1656
|
+
if (!t) {
|
|
1657
1657
|
this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">No data available for day view.</div>';
|
|
1658
1658
|
return;
|
|
1659
1659
|
}
|
|
1660
1660
|
this.cleanup(), this._scrolled = !1;
|
|
1661
|
-
const
|
|
1661
|
+
const e = this.stateManager.getState().config, r = this._renderDayView(t, e);
|
|
1662
1662
|
this.container.innerHTML = r, this._attachEventHandlers(), this._scrollToCurrentTime();
|
|
1663
1663
|
}
|
|
1664
|
-
_renderDayView(
|
|
1665
|
-
var l,
|
|
1666
|
-
const r = ((
|
|
1664
|
+
_renderDayView(t, e) {
|
|
1665
|
+
var l, u;
|
|
1666
|
+
const r = ((u = (l = this.stateManager) == null ? void 0 : l.getState()) == null ? void 0 : u.currentDate) || /* @__PURE__ */ new Date(), s = this._extractDayData(t, r);
|
|
1667
1667
|
if (!s)
|
|
1668
1668
|
return '<div style="padding: 20px; text-align: center; color: #666;">No data available for day view.</div>';
|
|
1669
1669
|
const { dayDate: i, dayName: n, isToday: o, allDayEvents: a, timedEvents: c } = s, d = Array.from({ length: 24 }, (m, b) => b);
|
|
@@ -1675,21 +1675,21 @@ class z extends k {
|
|
|
1675
1675
|
</div>
|
|
1676
1676
|
`;
|
|
1677
1677
|
}
|
|
1678
|
-
_extractDayData(
|
|
1678
|
+
_extractDayData(t, e) {
|
|
1679
1679
|
let r, s, i, n, o;
|
|
1680
1680
|
const a = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
1681
|
-
if (
|
|
1682
|
-
if (r = new Date(
|
|
1681
|
+
if (t.type === "day" && t.date)
|
|
1682
|
+
if (r = new Date(t.date), s = t.dayName || a[r.getDay()], i = t.isToday !== void 0 ? t.isToday : this.isToday(r), n = t.allDayEvents || [], t.hours && Array.isArray(t.hours)) {
|
|
1683
1683
|
const c = /* @__PURE__ */ new Map();
|
|
1684
|
-
|
|
1684
|
+
t.hours.forEach((d) => {
|
|
1685
1685
|
(d.events || []).forEach((l) => {
|
|
1686
1686
|
c.has(l.id) || c.set(l.id, l);
|
|
1687
1687
|
});
|
|
1688
1688
|
}), o = Array.from(c.values());
|
|
1689
1689
|
} else
|
|
1690
1690
|
o = [];
|
|
1691
|
-
else if (
|
|
1692
|
-
const c =
|
|
1691
|
+
else if (t.days && t.days.length > 0) {
|
|
1692
|
+
const c = t.days.find((l) => this.isSameDay(new Date(l.date), e)) || t.days[0];
|
|
1693
1693
|
r = new Date(c.date), s = a[r.getDay()], i = this.isToday(r);
|
|
1694
1694
|
const d = c.events || [];
|
|
1695
1695
|
n = d.filter((l) => l.allDay), o = d.filter((l) => !l.allDay);
|
|
@@ -1697,29 +1697,29 @@ class z extends k {
|
|
|
1697
1697
|
return null;
|
|
1698
1698
|
return { dayDate: r, dayName: s, isToday: i, allDayEvents: n, timedEvents: o };
|
|
1699
1699
|
}
|
|
1700
|
-
_renderHeader(
|
|
1700
|
+
_renderHeader(t, e, r) {
|
|
1701
1701
|
return `
|
|
1702
1702
|
<div class="fc-day-header" style="display: grid; grid-template-columns: 60px 1fr; border-bottom: 1px solid #e5e7eb; background: #f9fafb; flex-shrink: 0;">
|
|
1703
1703
|
<div style="border-right: 1px solid #e5e7eb;"></div>
|
|
1704
1704
|
<div style="padding: 16px 24px;">
|
|
1705
1705
|
<div style="font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em;">
|
|
1706
|
-
${
|
|
1706
|
+
${e}
|
|
1707
1707
|
</div>
|
|
1708
1708
|
<div style="font-size: 24px; font-weight: 600; margin-top: 4px; ${r ? "color: #dc2626;" : "color: #111827;"}">
|
|
1709
|
-
${
|
|
1709
|
+
${t.getDate()}
|
|
1710
1710
|
</div>
|
|
1711
1711
|
</div>
|
|
1712
1712
|
</div>
|
|
1713
1713
|
`;
|
|
1714
1714
|
}
|
|
1715
|
-
_renderAllDayRow(
|
|
1715
|
+
_renderAllDayRow(t, e) {
|
|
1716
1716
|
return `
|
|
1717
1717
|
<div class="fc-all-day-row" style="display: grid; grid-template-columns: 60px 1fr; border-bottom: 1px solid #e5e7eb; background: #fafafa; min-height: 36px; flex-shrink: 0;">
|
|
1718
1718
|
<div style="font-size: 9px; color: #6b7280; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e5e7eb; text-transform: uppercase; font-weight: 700;">
|
|
1719
1719
|
All day
|
|
1720
1720
|
</div>
|
|
1721
|
-
<div class="fc-all-day-cell" data-date="${
|
|
1722
|
-
${
|
|
1721
|
+
<div class="fc-all-day-cell" data-date="${e.toISOString()}" style="padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 4px;">
|
|
1722
|
+
${t.map(
|
|
1723
1723
|
(r) => `
|
|
1724
1724
|
<div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(r.id)}"
|
|
1725
1725
|
style="background-color: ${this.getEventColor(r)}; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: white; cursor: pointer; font-weight: 500;">
|
|
@@ -1731,51 +1731,51 @@ class z extends k {
|
|
|
1731
1731
|
</div>
|
|
1732
1732
|
`;
|
|
1733
1733
|
}
|
|
1734
|
-
_renderTimeGrid(
|
|
1734
|
+
_renderTimeGrid(t, e, r, s) {
|
|
1735
1735
|
return `
|
|
1736
1736
|
<div id="day-scroll-container" class="fc-time-grid-container" style="flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;">
|
|
1737
1737
|
<div class="fc-time-grid" style="display: grid; grid-template-columns: 60px 1fr; position: relative; height: ${this.totalHeight}px;">
|
|
1738
1738
|
${this._renderTimeGutter(s)}
|
|
1739
|
-
${this._renderDayColumn(
|
|
1739
|
+
${this._renderDayColumn(t, e, r, s)}
|
|
1740
1740
|
</div>
|
|
1741
1741
|
</div>
|
|
1742
1742
|
`;
|
|
1743
1743
|
}
|
|
1744
|
-
_renderTimeGutter(
|
|
1744
|
+
_renderTimeGutter(t) {
|
|
1745
1745
|
return `
|
|
1746
1746
|
<div class="fc-time-gutter" style="border-right: 1px solid #e5e7eb; background: #fafafa;">
|
|
1747
|
-
${
|
|
1748
|
-
(
|
|
1747
|
+
${t.map(
|
|
1748
|
+
(e) => `
|
|
1749
1749
|
<div style="height: ${this.hourHeight}px; font-size: 11px; color: #6b7280; text-align: right; padding-right: 12px; font-weight: 500;">
|
|
1750
|
-
${
|
|
1750
|
+
${e === 0 ? "" : this.formatHour(e)}
|
|
1751
1751
|
</div>
|
|
1752
1752
|
`
|
|
1753
1753
|
).join("")}
|
|
1754
1754
|
</div>
|
|
1755
1755
|
`;
|
|
1756
1756
|
}
|
|
1757
|
-
_renderDayColumn(
|
|
1757
|
+
_renderDayColumn(t, e, r, s) {
|
|
1758
1758
|
return `
|
|
1759
1759
|
<div class="fc-day-column" data-date="${r.toISOString()}" style="position: relative; cursor: pointer;">
|
|
1760
1760
|
<!-- Hour grid lines -->
|
|
1761
1761
|
${s.map(() => `<div style="height: ${this.hourHeight}px; border-bottom: 1px solid #f3f4f6;"></div>`).join("")}
|
|
1762
1762
|
|
|
1763
1763
|
<!-- Now indicator for today -->
|
|
1764
|
-
${
|
|
1764
|
+
${e ? this.renderNowIndicator() : ""}
|
|
1765
1765
|
|
|
1766
1766
|
<!-- Timed events -->
|
|
1767
1767
|
${(() => {
|
|
1768
|
-
const i = this.computeOverlapLayout(
|
|
1769
|
-
return
|
|
1768
|
+
const i = this.computeOverlapLayout(t);
|
|
1769
|
+
return t.map((n) => this.renderTimedEvent(n, { compact: !1, overlapLayout: i })).join("");
|
|
1770
1770
|
})()}
|
|
1771
1771
|
</div>
|
|
1772
1772
|
`;
|
|
1773
1773
|
}
|
|
1774
1774
|
_attachEventHandlers() {
|
|
1775
|
-
this.addListener(this.container, "click", (
|
|
1776
|
-
const
|
|
1777
|
-
if (!
|
|
1778
|
-
const r = new Date(
|
|
1775
|
+
this.addListener(this.container, "click", (t) => {
|
|
1776
|
+
const e = t.target.closest(".fc-day-column");
|
|
1777
|
+
if (!e || !this.container.contains(e) || t.target.closest(".fc-event")) return;
|
|
1778
|
+
const r = new Date(e.dataset.date), s = this.container.querySelector("#day-scroll-container"), i = e.offsetTop, n = t.clientY - e.getBoundingClientRect().top + (s ? s.scrollTop : 0) - i, o = Math.max(0, Math.min(n + i, this.totalHeight));
|
|
1779
1779
|
r.setHours(
|
|
1780
1780
|
Math.floor(o / this.hourHeight),
|
|
1781
1781
|
Math.floor(o % this.hourHeight / (this.hourHeight / 60)),
|
|
@@ -1786,8 +1786,8 @@ class z extends k {
|
|
|
1786
1786
|
}
|
|
1787
1787
|
_scrollToCurrentTime() {
|
|
1788
1788
|
if (this._scrolled) return;
|
|
1789
|
-
const
|
|
1790
|
-
|
|
1789
|
+
const t = this.container.querySelector("#day-scroll-container");
|
|
1790
|
+
t && (t.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
1793
|
class B extends M {
|
|
@@ -1815,13 +1815,13 @@ class B extends M {
|
|
|
1815
1815
|
static get observedAttributes() {
|
|
1816
1816
|
return ["open"];
|
|
1817
1817
|
}
|
|
1818
|
-
attributeChangedCallback(
|
|
1819
|
-
|
|
1818
|
+
attributeChangedCallback(t, e, r) {
|
|
1819
|
+
t === "open" && (r !== null ? this.open() : this.close());
|
|
1820
1820
|
}
|
|
1821
1821
|
getStyles() {
|
|
1822
1822
|
return `
|
|
1823
|
-
${
|
|
1824
|
-
${
|
|
1823
|
+
${f.getBaseStyles()}
|
|
1824
|
+
${f.getButtonStyles()}
|
|
1825
1825
|
|
|
1826
1826
|
:host {
|
|
1827
1827
|
display: none;
|
|
@@ -2026,14 +2026,14 @@ class B extends M {
|
|
|
2026
2026
|
<label id="color-label">Color</label>
|
|
2027
2027
|
<div class="color-options" id="color-picker" role="radiogroup" aria-labelledby="color-label">
|
|
2028
2028
|
${this.config.colors.map(
|
|
2029
|
-
(
|
|
2029
|
+
(t) => `
|
|
2030
2030
|
<button type="button"
|
|
2031
|
-
class="color-btn ${
|
|
2032
|
-
style="background-color: ${
|
|
2033
|
-
data-color="${
|
|
2034
|
-
title="${
|
|
2035
|
-
aria-label="${
|
|
2036
|
-
aria-checked="${
|
|
2031
|
+
class="color-btn ${t.color === this._formData.color ? "selected" : ""}"
|
|
2032
|
+
style="background-color: ${t.color}"
|
|
2033
|
+
data-color="${t.color}"
|
|
2034
|
+
title="${t.label}"
|
|
2035
|
+
aria-label="${t.label}"
|
|
2036
|
+
aria-checked="${t.color === this._formData.color ? "true" : "false"}"
|
|
2037
2037
|
role="radio"></button>
|
|
2038
2038
|
`
|
|
2039
2039
|
).join("")}
|
|
@@ -2049,46 +2049,46 @@ class B extends M {
|
|
|
2049
2049
|
`;
|
|
2050
2050
|
}
|
|
2051
2051
|
afterRender() {
|
|
2052
|
-
this.modalContent = this.$(".modal-content"), this.titleInput = this.$("#event-title"), this.startInput = this.$("#event-start"), this.endInput = this.$("#event-end"), this.colorContainer = this.$("#color-picker"), this.titleGroup = this.$("#title-group"), this.endGroup = this.$("#end-group"), this.addListener(this.$("#close-x"), "click", () => this.close()), this.addListener(this.$("#cancel-btn"), "click", () => this.close()), this.addListener(this.$("#save-btn"), "click", () => this.save()), this.colorContainer.querySelectorAll(".color-btn").forEach((
|
|
2053
|
-
this.addListener(
|
|
2054
|
-
this._formData.color =
|
|
2052
|
+
this.modalContent = this.$(".modal-content"), this.titleInput = this.$("#event-title"), this.startInput = this.$("#event-start"), this.endInput = this.$("#event-end"), this.colorContainer = this.$("#color-picker"), this.titleGroup = this.$("#title-group"), this.endGroup = this.$("#end-group"), this.addListener(this.$("#close-x"), "click", () => this.close()), this.addListener(this.$("#cancel-btn"), "click", () => this.close()), this.addListener(this.$("#save-btn"), "click", () => this.save()), this.colorContainer.querySelectorAll(".color-btn").forEach((t) => {
|
|
2053
|
+
this.addListener(t, "click", (e) => {
|
|
2054
|
+
this._formData.color = e.currentTarget.dataset.color, this.updateColorSelection();
|
|
2055
2055
|
});
|
|
2056
|
-
}), this.addListener(this, "click", (
|
|
2057
|
-
|
|
2058
|
-
}), this._keydownListenerAdded || (this._handleKeyDown = (
|
|
2059
|
-
|
|
2056
|
+
}), this.addListener(this, "click", (t) => {
|
|
2057
|
+
t.target === this && this.close();
|
|
2058
|
+
}), this._keydownListenerAdded || (this._handleKeyDown = (t) => {
|
|
2059
|
+
t.key === "Escape" && this.hasAttribute("open") && this.close();
|
|
2060
2060
|
}, window.addEventListener("keydown", this._handleKeyDown), this._keydownListenerAdded = !0);
|
|
2061
2061
|
}
|
|
2062
2062
|
updateColorSelection() {
|
|
2063
|
-
this.colorContainer.querySelectorAll(".color-btn").forEach((
|
|
2064
|
-
const r =
|
|
2065
|
-
|
|
2063
|
+
this.colorContainer.querySelectorAll(".color-btn").forEach((e) => {
|
|
2064
|
+
const r = e.dataset.color === this._formData.color;
|
|
2065
|
+
e.classList.toggle("selected", r), e.setAttribute("aria-checked", r ? "true" : "false");
|
|
2066
2066
|
});
|
|
2067
2067
|
}
|
|
2068
|
-
open(
|
|
2069
|
-
this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start =
|
|
2068
|
+
open(t = /* @__PURE__ */ new Date()) {
|
|
2069
|
+
this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = t, this._formData.end = new Date(t.getTime() + this.config.defaultDuration * 60 * 1e3), this._formData.title = "", this._formData.color = this.config.colors[0].color, this.startInput && (this.titleInput.value = "", this.startInput.value = this.formatDateForInput(this._formData.start), this.endInput.value = this.formatDateForInput(this._formData.end), this.updateColorSelection(), this._cleanupFocusTrap && this._cleanupFocusTrap(), this._cleanupFocusTrap = E.trapFocus(this.modalContent));
|
|
2070
2070
|
}
|
|
2071
2071
|
close() {
|
|
2072
2072
|
this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
|
|
2073
2073
|
}
|
|
2074
2074
|
validate() {
|
|
2075
|
-
let
|
|
2076
|
-
this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this.titleInput.value.trim() || (this.titleGroup.classList.add("has-error"),
|
|
2077
|
-
const
|
|
2078
|
-
return new Date(this.endInput.value) <=
|
|
2075
|
+
let t = !0;
|
|
2076
|
+
this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this.titleInput.value.trim() || (this.titleGroup.classList.add("has-error"), t = !1);
|
|
2077
|
+
const e = new Date(this.startInput.value);
|
|
2078
|
+
return new Date(this.endInput.value) <= e && (this.endGroup.classList.add("has-error"), t = !1), t;
|
|
2079
2079
|
}
|
|
2080
2080
|
save() {
|
|
2081
2081
|
if (!this.validate()) return;
|
|
2082
|
-
const
|
|
2082
|
+
const t = {
|
|
2083
2083
|
title: this.titleInput.value.trim(),
|
|
2084
2084
|
start: new Date(this.startInput.value),
|
|
2085
2085
|
end: new Date(this.endInput.value),
|
|
2086
2086
|
backgroundColor: this._formData.color
|
|
2087
2087
|
};
|
|
2088
|
-
this.emit("save",
|
|
2088
|
+
this.emit("save", t), this.close();
|
|
2089
2089
|
}
|
|
2090
|
-
formatDateForInput(
|
|
2091
|
-
const
|
|
2090
|
+
formatDateForInput(t) {
|
|
2091
|
+
const e = (a) => String(a).padStart(2, "0"), r = t.getFullYear(), s = e(t.getMonth() + 1), i = e(t.getDate()), n = e(t.getHours()), o = e(t.getMinutes());
|
|
2092
2092
|
return `${r}-${s}-${i}T${n}:${o}`;
|
|
2093
2093
|
}
|
|
2094
2094
|
unmount() {
|
|
@@ -2104,107 +2104,107 @@ const v = class v extends M {
|
|
|
2104
2104
|
super(), this.stateManager = null, this.currentView = null, this._hasRendered = !1, this._cachedStyles = null, this._busUnsubscribers = [];
|
|
2105
2105
|
}
|
|
2106
2106
|
initialize() {
|
|
2107
|
-
const
|
|
2107
|
+
const t = {
|
|
2108
2108
|
view: this.getAttribute("view") || "month",
|
|
2109
2109
|
date: this.getAttribute("date") ? new Date(this.getAttribute("date")) : /* @__PURE__ */ new Date(),
|
|
2110
2110
|
locale: this.getAttribute("locale") || "en-US",
|
|
2111
2111
|
timeZone: this.getAttribute("timezone") || Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
2112
2112
|
weekStartsOn: parseInt(this.getAttribute("week-starts-on") || "0")
|
|
2113
2113
|
};
|
|
2114
|
-
this.stateManager = new V(
|
|
2114
|
+
this.stateManager = new V(t), this._stateUnsubscribe = this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
|
|
2115
2115
|
}
|
|
2116
2116
|
setupEventListeners() {
|
|
2117
2117
|
this._busUnsubscribers.forEach((r) => r()), this._busUnsubscribers = [];
|
|
2118
|
-
const
|
|
2118
|
+
const t = this.stateManager.eventBus;
|
|
2119
2119
|
this._busUnsubscribers.push(
|
|
2120
|
-
|
|
2120
|
+
t.on("navigation:*", (r, s) => {
|
|
2121
2121
|
this.emit("calendar-navigate", { action: s.split(":")[1], ...r });
|
|
2122
2122
|
})
|
|
2123
2123
|
), this._busUnsubscribers.push(
|
|
2124
|
-
|
|
2124
|
+
t.on("view:changed", (r) => {
|
|
2125
2125
|
this.emit("calendar-view-change", r);
|
|
2126
2126
|
})
|
|
2127
2127
|
);
|
|
2128
|
-
const
|
|
2128
|
+
const e = (r, s) => {
|
|
2129
2129
|
this.emit(`calendar-event-${r}`, s);
|
|
2130
2130
|
};
|
|
2131
2131
|
this._busUnsubscribers.push(
|
|
2132
|
-
|
|
2133
|
-
|
|
2132
|
+
t.on("event:add", (r) => {
|
|
2133
|
+
e("add", r);
|
|
2134
2134
|
})
|
|
2135
2135
|
), this._busUnsubscribers.push(
|
|
2136
|
-
|
|
2137
|
-
|
|
2136
|
+
t.on("event:update", (r) => {
|
|
2137
|
+
e("update", r);
|
|
2138
2138
|
})
|
|
2139
2139
|
), this._busUnsubscribers.push(
|
|
2140
|
-
|
|
2141
|
-
|
|
2140
|
+
t.on("event:remove", (r) => {
|
|
2141
|
+
e("remove", r);
|
|
2142
2142
|
})
|
|
2143
2143
|
), this._busUnsubscribers.push(
|
|
2144
|
-
|
|
2144
|
+
t.on("event:added", (r) => {
|
|
2145
2145
|
this.emit("calendar-event-added", r);
|
|
2146
2146
|
})
|
|
2147
2147
|
), this._busUnsubscribers.push(
|
|
2148
|
-
|
|
2148
|
+
t.on("event:updated", (r) => {
|
|
2149
2149
|
this.emit("calendar-event-updated", r);
|
|
2150
2150
|
})
|
|
2151
2151
|
), this._busUnsubscribers.push(
|
|
2152
|
-
|
|
2152
|
+
t.on("event:deleted", (r) => {
|
|
2153
2153
|
this.emit("calendar-event-deleted", r);
|
|
2154
2154
|
})
|
|
2155
2155
|
), this._busUnsubscribers.push(
|
|
2156
|
-
|
|
2156
|
+
t.on("date:selected", (r) => {
|
|
2157
2157
|
this.emit("calendar-date-select", r);
|
|
2158
2158
|
})
|
|
2159
2159
|
);
|
|
2160
2160
|
}
|
|
2161
|
-
handleStateChange(
|
|
2161
|
+
handleStateChange(t, e) {
|
|
2162
2162
|
var a, c;
|
|
2163
2163
|
if (!this._hasRendered)
|
|
2164
2164
|
return;
|
|
2165
|
-
const r =
|
|
2166
|
-
if (
|
|
2165
|
+
const r = t.view !== (e == null ? void 0 : e.view), s = ((a = t.currentDate) == null ? void 0 : a.getTime()) !== ((c = e == null ? void 0 : e.currentDate) == null ? void 0 : c.getTime()), i = t.events !== (e == null ? void 0 : e.events), n = t.loading !== (e == null ? void 0 : e.loading);
|
|
2166
|
+
if (t.error !== (e == null ? void 0 : e.error)) {
|
|
2167
2167
|
this.render();
|
|
2168
2168
|
return;
|
|
2169
2169
|
}
|
|
2170
2170
|
if (n) {
|
|
2171
|
-
this._updateLoadingState(
|
|
2171
|
+
this._updateLoadingState(t.loading);
|
|
2172
2172
|
return;
|
|
2173
2173
|
}
|
|
2174
|
-
r && (this.currentView =
|
|
2174
|
+
r && (this.currentView = t.view), r ? (this._updateTitle(), this._updateViewButtons(), this._switchView()) : s ? (this._updateTitle(), this._updateViewContent()) : i && this._updateViewContent();
|
|
2175
2175
|
}
|
|
2176
2176
|
/**
|
|
2177
2177
|
* Update only the title text (no DOM recreation)
|
|
2178
2178
|
*/
|
|
2179
2179
|
_updateTitle() {
|
|
2180
|
-
const
|
|
2181
|
-
if (
|
|
2182
|
-
const
|
|
2183
|
-
|
|
2180
|
+
const t = this.$(".fc-title");
|
|
2181
|
+
if (t) {
|
|
2182
|
+
const e = this.stateManager.getState();
|
|
2183
|
+
t.textContent = this.getTitle(e.currentDate, e.view);
|
|
2184
2184
|
}
|
|
2185
2185
|
}
|
|
2186
2186
|
/**
|
|
2187
2187
|
* Update view button active states (no DOM recreation)
|
|
2188
2188
|
*/
|
|
2189
2189
|
_updateViewButtons() {
|
|
2190
|
-
const
|
|
2191
|
-
this.$$("[data-view]").forEach((
|
|
2192
|
-
const r =
|
|
2193
|
-
|
|
2190
|
+
const t = this.stateManager.getState();
|
|
2191
|
+
this.$$("[data-view]").forEach((e) => {
|
|
2192
|
+
const r = e.dataset.view === t.view;
|
|
2193
|
+
e.classList.toggle("active", r);
|
|
2194
2194
|
});
|
|
2195
2195
|
}
|
|
2196
2196
|
/**
|
|
2197
2197
|
* Switch to a different view type
|
|
2198
2198
|
*/
|
|
2199
2199
|
_switchView() {
|
|
2200
|
-
const
|
|
2201
|
-
if (
|
|
2200
|
+
const t = this.$("#calendar-view-container");
|
|
2201
|
+
if (t) {
|
|
2202
2202
|
this._currentViewInstance && this._currentViewInstance.cleanup && this._currentViewInstance.cleanup();
|
|
2203
2203
|
try {
|
|
2204
|
-
const
|
|
2204
|
+
const e = v.RENDERERS[this.currentView] || w, r = new e(t, this.stateManager);
|
|
2205
2205
|
r._viewType = this.currentView, this._currentViewInstance = r, r.render();
|
|
2206
|
-
} catch (
|
|
2207
|
-
console.error("[ForceCalendar] Error switching view:",
|
|
2206
|
+
} catch (e) {
|
|
2207
|
+
console.error("[ForceCalendar] Error switching view:", e);
|
|
2208
2208
|
}
|
|
2209
2209
|
}
|
|
2210
2210
|
}
|
|
@@ -2217,26 +2217,26 @@ const v = class v extends M {
|
|
|
2217
2217
|
/**
|
|
2218
2218
|
* Toggle loading overlay without rebuilding the component tree.
|
|
2219
2219
|
*/
|
|
2220
|
-
_updateLoadingState(
|
|
2221
|
-
const
|
|
2222
|
-
|
|
2220
|
+
_updateLoadingState(t) {
|
|
2221
|
+
const e = this.$(".fc-loading"), r = this.$(".fc-view-container");
|
|
2222
|
+
e && (e.style.display = t ? "flex" : "none"), r && (r.style.display = t ? "none" : "flex");
|
|
2223
2223
|
}
|
|
2224
2224
|
mount() {
|
|
2225
2225
|
this.currentView = this.stateManager.getView(), super.mount();
|
|
2226
2226
|
}
|
|
2227
|
-
loadView(
|
|
2228
|
-
!
|
|
2227
|
+
loadView(t) {
|
|
2228
|
+
!t || this.currentView === t || (this.currentView = t, this._switchView(), this._updateViewButtons(), this._updateTitle());
|
|
2229
2229
|
}
|
|
2230
2230
|
getStyles() {
|
|
2231
|
-
const
|
|
2231
|
+
const t = this.getAttribute("height") || "800px";
|
|
2232
2232
|
return `
|
|
2233
|
-
${
|
|
2234
|
-
${
|
|
2235
|
-
${
|
|
2236
|
-
${
|
|
2233
|
+
${f.getBaseStyles()}
|
|
2234
|
+
${f.getButtonStyles()}
|
|
2235
|
+
${f.getGridStyles()}
|
|
2236
|
+
${f.getAnimations()}
|
|
2237
2237
|
|
|
2238
2238
|
:host {
|
|
2239
|
-
--calendar-height: ${
|
|
2239
|
+
--calendar-height: ${t};
|
|
2240
2240
|
display: block;
|
|
2241
2241
|
font-family: var(--fc-font-family);
|
|
2242
2242
|
}
|
|
@@ -2617,7 +2617,7 @@ const v = class v extends M {
|
|
|
2617
2617
|
`;
|
|
2618
2618
|
}
|
|
2619
2619
|
template() {
|
|
2620
|
-
const
|
|
2620
|
+
const t = this.stateManager.getState(), { currentDate: e, view: r, loading: s, error: i } = t;
|
|
2621
2621
|
if (i)
|
|
2622
2622
|
return `
|
|
2623
2623
|
<div class="force-calendar">
|
|
@@ -2626,7 +2626,7 @@ const v = class v extends M {
|
|
|
2626
2626
|
</div>
|
|
2627
2627
|
</div>
|
|
2628
2628
|
`;
|
|
2629
|
-
const n = this.getTitle(
|
|
2629
|
+
const n = this.getTitle(e, r);
|
|
2630
2630
|
return `
|
|
2631
2631
|
<div class="force-calendar">
|
|
2632
2632
|
<header class="fc-header">
|
|
@@ -2679,13 +2679,13 @@ const v = class v extends M {
|
|
|
2679
2679
|
return '<div id="calendar-view-container"></div>';
|
|
2680
2680
|
}
|
|
2681
2681
|
afterRender() {
|
|
2682
|
-
const
|
|
2683
|
-
if (
|
|
2684
|
-
if (this._currentViewInstance && this._currentViewInstance._viewType === this.currentView &&
|
|
2682
|
+
const t = this.$("#calendar-view-container");
|
|
2683
|
+
if (t && this.stateManager && this.currentView) {
|
|
2684
|
+
if (this._currentViewInstance && this._currentViewInstance._viewType === this.currentView && t.children.length > 0)
|
|
2685
2685
|
return;
|
|
2686
2686
|
this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe && (this._viewUnsubscribe(), this._viewUnsubscribe = null));
|
|
2687
2687
|
try {
|
|
2688
|
-
const s = v.RENDERERS[this.currentView] || w, i = new s(
|
|
2688
|
+
const s = v.RENDERERS[this.currentView] || w, i = new s(t, this.stateManager);
|
|
2689
2689
|
i._viewType = this.currentView, this._currentViewInstance = i, i.render();
|
|
2690
2690
|
} catch (s) {
|
|
2691
2691
|
console.error("[ForceCalendar] Error creating/rendering view:", s);
|
|
@@ -2696,12 +2696,12 @@ const v = class v extends M {
|
|
|
2696
2696
|
}), this.$$("[data-view]").forEach((s) => {
|
|
2697
2697
|
this.addListener(s, "click", this.handleViewChange);
|
|
2698
2698
|
});
|
|
2699
|
-
const
|
|
2700
|
-
r &&
|
|
2701
|
-
|
|
2699
|
+
const e = this.$("#event-modal"), r = this.$("#create-event-btn");
|
|
2700
|
+
r && e && this.addListener(r, "click", () => {
|
|
2701
|
+
e.open(/* @__PURE__ */ new Date());
|
|
2702
2702
|
}), this.addListener(this.shadowRoot, "day-click", (s) => {
|
|
2703
|
-
|
|
2704
|
-
}),
|
|
2703
|
+
e && e.open(s.detail.date);
|
|
2704
|
+
}), e && this.addListener(e, "save", (s) => {
|
|
2705
2705
|
const i = s.detail, n = window.crypto && typeof window.crypto.randomUUID == "function" ? window.crypto.randomUUID() : Math.random().toString(36).substring(2, 15);
|
|
2706
2706
|
this.stateManager.addEvent({
|
|
2707
2707
|
id: n,
|
|
@@ -2709,8 +2709,8 @@ const v = class v extends M {
|
|
|
2709
2709
|
});
|
|
2710
2710
|
}), this._hasRendered = !0;
|
|
2711
2711
|
}
|
|
2712
|
-
handleNavigation(
|
|
2713
|
-
switch (
|
|
2712
|
+
handleNavigation(t) {
|
|
2713
|
+
switch (t.currentTarget.dataset.action) {
|
|
2714
2714
|
case "today":
|
|
2715
2715
|
this.stateManager.today();
|
|
2716
2716
|
break;
|
|
@@ -2722,26 +2722,26 @@ const v = class v extends M {
|
|
|
2722
2722
|
break;
|
|
2723
2723
|
}
|
|
2724
2724
|
}
|
|
2725
|
-
handleViewChange(
|
|
2726
|
-
const
|
|
2727
|
-
this.stateManager.setView(
|
|
2725
|
+
handleViewChange(t) {
|
|
2726
|
+
const e = t.currentTarget.dataset.view;
|
|
2727
|
+
this.stateManager.setView(e);
|
|
2728
2728
|
}
|
|
2729
|
-
getTitle(
|
|
2729
|
+
getTitle(t, e) {
|
|
2730
2730
|
const r = this.stateManager.state.config.locale;
|
|
2731
|
-
switch (
|
|
2731
|
+
switch (e) {
|
|
2732
2732
|
case "month":
|
|
2733
|
-
return p.formatDate(
|
|
2733
|
+
return p.formatDate(t, "month", r);
|
|
2734
2734
|
case "week": {
|
|
2735
|
-
const s = p.startOfWeek(
|
|
2735
|
+
const s = p.startOfWeek(t), i = p.endOfWeek(t);
|
|
2736
2736
|
return p.formatDateRange(s, i, r);
|
|
2737
2737
|
}
|
|
2738
2738
|
case "day":
|
|
2739
|
-
return p.formatDate(
|
|
2739
|
+
return p.formatDate(t, "long", r);
|
|
2740
2740
|
default:
|
|
2741
|
-
return p.formatDate(
|
|
2741
|
+
return p.formatDate(t, "month", r);
|
|
2742
2742
|
}
|
|
2743
2743
|
}
|
|
2744
|
-
getIcon(
|
|
2744
|
+
getIcon(t) {
|
|
2745
2745
|
return {
|
|
2746
2746
|
"chevron-left": `
|
|
2747
2747
|
<svg class="fc-icon" viewBox="0 0 24 24">
|
|
@@ -2758,26 +2758,26 @@ const v = class v extends M {
|
|
|
2758
2758
|
<path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"/>
|
|
2759
2759
|
</svg>
|
|
2760
2760
|
`
|
|
2761
|
-
}[
|
|
2761
|
+
}[t] || "";
|
|
2762
2762
|
}
|
|
2763
2763
|
// Public API methods
|
|
2764
|
-
addEvent(
|
|
2765
|
-
return this.stateManager.addEvent(
|
|
2764
|
+
addEvent(t) {
|
|
2765
|
+
return this.stateManager.addEvent(t);
|
|
2766
2766
|
}
|
|
2767
|
-
updateEvent(
|
|
2768
|
-
return this.stateManager.updateEvent(
|
|
2767
|
+
updateEvent(t, e) {
|
|
2768
|
+
return this.stateManager.updateEvent(t, e);
|
|
2769
2769
|
}
|
|
2770
|
-
deleteEvent(
|
|
2771
|
-
return this.stateManager.deleteEvent(
|
|
2770
|
+
deleteEvent(t) {
|
|
2771
|
+
return this.stateManager.deleteEvent(t);
|
|
2772
2772
|
}
|
|
2773
2773
|
getEvents() {
|
|
2774
2774
|
return this.stateManager.getEvents();
|
|
2775
2775
|
}
|
|
2776
|
-
setView(
|
|
2777
|
-
this.stateManager.setView(
|
|
2776
|
+
setView(t) {
|
|
2777
|
+
this.stateManager.setView(t);
|
|
2778
2778
|
}
|
|
2779
|
-
setDate(
|
|
2780
|
-
this.stateManager.setDate(
|
|
2779
|
+
setDate(t) {
|
|
2780
|
+
this.stateManager.setDate(t);
|
|
2781
2781
|
}
|
|
2782
2782
|
next() {
|
|
2783
2783
|
this.stateManager.next();
|
|
@@ -2788,8 +2788,11 @@ const v = class v extends M {
|
|
|
2788
2788
|
today() {
|
|
2789
2789
|
this.stateManager.today();
|
|
2790
2790
|
}
|
|
2791
|
+
unmount() {
|
|
2792
|
+
this.destroy();
|
|
2793
|
+
}
|
|
2791
2794
|
destroy() {
|
|
2792
|
-
this._busUnsubscribers.forEach((
|
|
2795
|
+
this._busUnsubscribers.forEach((t) => t()), this._busUnsubscribers = [], this._stateUnsubscribe && (this._stateUnsubscribe(), this._stateUnsubscribe = null), this._currentViewInstance && this._currentViewInstance.cleanup && (this._currentViewInstance.cleanup(), this._currentViewInstance = null), this.stateManager && this.stateManager.destroy(), super.cleanup();
|
|
2793
2796
|
}
|
|
2794
2797
|
};
|
|
2795
2798
|
g(v, "RENDERERS", {
|
|
@@ -2809,7 +2812,7 @@ export {
|
|
|
2809
2812
|
D as ForceCalendar,
|
|
2810
2813
|
w as MonthViewRenderer,
|
|
2811
2814
|
V as StateManager,
|
|
2812
|
-
|
|
2815
|
+
f as StyleUtils,
|
|
2813
2816
|
I as WeekViewRenderer,
|
|
2814
2817
|
j as eventBus
|
|
2815
2818
|
};
|