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