@forcecalendar/interface 1.0.32 → 1.0.34
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 +21 -21
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +2 -2
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +5 -3
- package/src/core/StateManager.js +13 -9
package/package.json
CHANGED
|
@@ -91,21 +91,23 @@ export class ForceCalendar extends BaseComponent {
|
|
|
91
91
|
forwardEventAction('remove', data);
|
|
92
92
|
})
|
|
93
93
|
);
|
|
94
|
+
// Specific lifecycle events — do NOT call forwardEventAction here; the
|
|
95
|
+
// canonical event:add/update/remove handlers above already forward the
|
|
96
|
+
// generic CustomEvent. These handlers emit only the specific variant so
|
|
97
|
+
// consumers that care about the distinction can subscribe to it without
|
|
98
|
+
// receiving the generic event a second time.
|
|
94
99
|
this._busUnsubscribers.push(
|
|
95
100
|
eventBus.on('event:added', data => {
|
|
96
|
-
forwardEventAction('add', data);
|
|
97
101
|
this.emit('calendar-event-added', data);
|
|
98
102
|
})
|
|
99
103
|
);
|
|
100
104
|
this._busUnsubscribers.push(
|
|
101
105
|
eventBus.on('event:updated', data => {
|
|
102
|
-
forwardEventAction('update', data);
|
|
103
106
|
this.emit('calendar-event-updated', data);
|
|
104
107
|
})
|
|
105
108
|
);
|
|
106
109
|
this._busUnsubscribers.push(
|
|
107
110
|
eventBus.on('event:deleted', data => {
|
|
108
|
-
forwardEventAction('remove', data);
|
|
109
111
|
this.emit('calendar-event-deleted', data);
|
|
110
112
|
})
|
|
111
113
|
);
|
package/src/core/StateManager.js
CHANGED
|
@@ -304,11 +304,15 @@ class StateManager {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
enrichViewData(viewData) {
|
|
307
|
+
// Shallow-copy the top-level object so we never mutate what Core returned.
|
|
308
|
+
// Core may cache and reuse the same reference across calls; mutating it
|
|
309
|
+
// in-place would corrupt its internal state.
|
|
310
|
+
const enriched = { ...viewData };
|
|
307
311
|
const selectedDateString = this.state.selectedDate?.toDateString();
|
|
308
312
|
|
|
309
313
|
// Strategy 1: Multi-week structure (Month view)
|
|
310
|
-
if (
|
|
311
|
-
|
|
314
|
+
if (enriched.weeks) {
|
|
315
|
+
enriched.weeks = enriched.weeks.map(week => ({
|
|
312
316
|
...week,
|
|
313
317
|
days: week.days.map(day => {
|
|
314
318
|
const dayDate = new Date(day.date);
|
|
@@ -322,8 +326,8 @@ class StateManager {
|
|
|
322
326
|
}
|
|
323
327
|
|
|
324
328
|
// Strategy 2: Flat days structure (Week view or list view)
|
|
325
|
-
if (
|
|
326
|
-
|
|
329
|
+
if (enriched.days) {
|
|
330
|
+
enriched.days = enriched.days.map(day => {
|
|
327
331
|
const dayDate = new Date(day.date);
|
|
328
332
|
return {
|
|
329
333
|
...day,
|
|
@@ -334,13 +338,13 @@ class StateManager {
|
|
|
334
338
|
}
|
|
335
339
|
|
|
336
340
|
// Strategy 3: Single day structure (Day view)
|
|
337
|
-
if (
|
|
338
|
-
const dayDate = new Date(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
+
if (enriched.date && !enriched.days && !enriched.weeks) {
|
|
342
|
+
const dayDate = new Date(enriched.date);
|
|
343
|
+
enriched.isSelected = dayDate.toDateString() === selectedDateString;
|
|
344
|
+
enriched.events = enriched.events || this.getEventsForDate(dayDate);
|
|
341
345
|
}
|
|
342
346
|
|
|
343
|
-
return
|
|
347
|
+
return enriched;
|
|
344
348
|
}
|
|
345
349
|
|
|
346
350
|
// Selection management
|