@forcecalendar/interface 1.0.33 → 1.0.35
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forcecalendar/interface",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official interface layer for forceCalendar Core - Enterprise calendar components",
|
|
6
6
|
"main": "dist/force-calendar-interface.umd.js",
|
|
@@ -43,10 +43,11 @@
|
|
|
43
43
|
"url": "https://github.com/forceCalendar/interface/issues"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://interface.forcecalendar.org",
|
|
46
|
-
"
|
|
47
|
-
"@forcecalendar/core": "
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@forcecalendar/core": ">=2.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
+
"@forcecalendar/core": "^2.1.18",
|
|
50
51
|
"@babel/core": "^7.28.5",
|
|
51
52
|
"@babel/preset-env": "^7.28.5",
|
|
52
53
|
"babel-jest": "^30.2.0",
|
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
|