@forcecalendar/core 2.1.6 → 2.1.7
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.
|
@@ -64,7 +64,7 @@ export class EnhancedCalendar extends Calendar {
|
|
|
64
64
|
const recurringEvents = [];
|
|
65
65
|
|
|
66
66
|
// Separate regular and recurring events
|
|
67
|
-
const allEvents = this.eventStore.
|
|
67
|
+
const allEvents = this.eventStore.getEventsInRange(startDate, endDate, false);
|
|
68
68
|
|
|
69
69
|
for (const event of allEvents) {
|
|
70
70
|
if (event.recurring) {
|
|
@@ -107,14 +107,11 @@ export class EnhancedCalendar extends Calendar {
|
|
|
107
107
|
this.recurrenceEngine.addModifiedInstance(eventId, occurrenceDate, modifications);
|
|
108
108
|
|
|
109
109
|
// Emit change event
|
|
110
|
-
this.
|
|
110
|
+
this._emit('occurrenceModified', {
|
|
111
111
|
eventId,
|
|
112
112
|
occurrenceDate,
|
|
113
113
|
modifications
|
|
114
114
|
});
|
|
115
|
-
|
|
116
|
-
// Trigger re-render if in view
|
|
117
|
-
this.refreshView();
|
|
118
115
|
}
|
|
119
116
|
|
|
120
117
|
/**
|
|
@@ -125,14 +122,11 @@ export class EnhancedCalendar extends Calendar {
|
|
|
125
122
|
this.recurrenceEngine.addException(eventId, occurrenceDate, reason);
|
|
126
123
|
|
|
127
124
|
// Emit change event
|
|
128
|
-
this.
|
|
125
|
+
this._emit('occurrenceCancelled', {
|
|
129
126
|
eventId,
|
|
130
127
|
occurrenceDate,
|
|
131
128
|
reason
|
|
132
129
|
});
|
|
133
|
-
|
|
134
|
-
// Trigger re-render
|
|
135
|
-
this.refreshView();
|
|
136
130
|
}
|
|
137
131
|
|
|
138
132
|
/**
|
|
@@ -153,13 +147,11 @@ export class EnhancedCalendar extends Calendar {
|
|
|
153
147
|
}
|
|
154
148
|
|
|
155
149
|
// Emit bulk change event
|
|
156
|
-
this.
|
|
150
|
+
this._emit('occurrencesBulkModified', {
|
|
157
151
|
eventId,
|
|
158
152
|
count: occurrences.length,
|
|
159
153
|
modifications
|
|
160
154
|
});
|
|
161
|
-
|
|
162
|
-
this.refreshView();
|
|
163
155
|
}
|
|
164
156
|
|
|
165
157
|
/**
|
|
@@ -211,28 +203,33 @@ export class EnhancedCalendar extends Calendar {
|
|
|
211
203
|
* Setup real-time indexing for search
|
|
212
204
|
*/
|
|
213
205
|
setupRealtimeIndexing() {
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
this.on('event:updated', event => {
|
|
221
|
-
this.searchManager.indexEvents();
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
// Re-index when events are removed
|
|
225
|
-
this.on('event:removed', eventId => {
|
|
226
|
-
this.searchManager.indexEvents();
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
// Batch re-indexing for bulk operations
|
|
230
|
-
let reindexTimeout;
|
|
231
|
-
this.on('events:bulk-operation', () => {
|
|
232
|
-
clearTimeout(reindexTimeout);
|
|
206
|
+
// Batch re-indexing to avoid rebuilding the index repeatedly for rapid event changes.
|
|
207
|
+
let reindexTimeout = null;
|
|
208
|
+
const scheduleReindex = () => {
|
|
209
|
+
if (reindexTimeout) {
|
|
210
|
+
clearTimeout(reindexTimeout);
|
|
211
|
+
}
|
|
233
212
|
reindexTimeout = setTimeout(() => {
|
|
234
213
|
this.searchManager.indexEvents();
|
|
235
214
|
}, 100);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// Store cleanup handle so timers are cleared on destroy.
|
|
218
|
+
this._clearReindexTimeout = () => {
|
|
219
|
+
if (reindexTimeout) {
|
|
220
|
+
clearTimeout(reindexTimeout);
|
|
221
|
+
reindexTimeout = null;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
this.on('eventAdd', scheduleReindex);
|
|
226
|
+
this.on('eventUpdate', scheduleReindex);
|
|
227
|
+
this.on('eventRemove', scheduleReindex);
|
|
228
|
+
this.on('eventsSet', scheduleReindex);
|
|
229
|
+
this.on('eventStoreChange', change => {
|
|
230
|
+
if (change?.type === 'batch') {
|
|
231
|
+
scheduleReindex();
|
|
232
|
+
}
|
|
236
233
|
});
|
|
237
234
|
}
|
|
238
235
|
|
|
@@ -365,6 +362,11 @@ export class EnhancedCalendar extends Calendar {
|
|
|
365
362
|
* Clean up resources
|
|
366
363
|
*/
|
|
367
364
|
destroy() {
|
|
365
|
+
if (typeof this._clearReindexTimeout === 'function') {
|
|
366
|
+
this._clearReindexTimeout();
|
|
367
|
+
this._clearReindexTimeout = null;
|
|
368
|
+
}
|
|
369
|
+
|
|
368
370
|
// Clean up worker
|
|
369
371
|
if (this.searchManager) {
|
|
370
372
|
this.searchManager.destroy();
|