@forcecalendar/core 2.1.41 → 2.1.43
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/core/ics/ICSHandler.js +11 -15
- package/core/search/SearchWorkerManager.js +10 -1
- package/package.json +1 -1
package/core/ics/ICSHandler.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { ICSParser } from './ICSParser.js';
|
|
7
7
|
import { Event } from '../events/Event.js';
|
|
8
|
+
import { RecurrenceEngineV2 } from '../events/RecurrenceEngineV2.js';
|
|
8
9
|
|
|
9
10
|
export class ICSHandler {
|
|
10
11
|
constructor(calendar) {
|
|
@@ -380,6 +381,7 @@ export class ICSHandler {
|
|
|
380
381
|
const expanded = [];
|
|
381
382
|
const rangeStart = dateRange?.start || new Date();
|
|
382
383
|
const rangeEnd = dateRange?.end || new Date(Date.now() + 365 * 24 * 60 * 60 * 1000);
|
|
384
|
+
const recurrenceEngine = new RecurrenceEngineV2();
|
|
383
385
|
|
|
384
386
|
for (const event of events) {
|
|
385
387
|
if (!(event.recurring || event.recurrenceRule || event.recurrence)) {
|
|
@@ -387,26 +389,20 @@ export class ICSHandler {
|
|
|
387
389
|
continue;
|
|
388
390
|
}
|
|
389
391
|
|
|
390
|
-
//
|
|
391
|
-
|
|
392
|
-
const instances = [
|
|
393
|
-
{
|
|
394
|
-
start: event.start,
|
|
395
|
-
end: event.end
|
|
396
|
-
}
|
|
397
|
-
];
|
|
392
|
+
// Use RecurrenceEngineV2 to expand occurrences within the date range
|
|
393
|
+
const occurrences = recurrenceEngine.expandEvent(event, rangeStart, rangeEnd);
|
|
398
394
|
|
|
399
|
-
// Add each
|
|
400
|
-
for (const
|
|
395
|
+
// Add each occurrence as a separate event
|
|
396
|
+
for (const occurrence of occurrences) {
|
|
401
397
|
expanded.push({
|
|
402
398
|
...event,
|
|
403
|
-
id: `${event.id}-${
|
|
404
|
-
start:
|
|
405
|
-
end:
|
|
399
|
+
id: `${event.id}-${occurrence.start.getTime()}`,
|
|
400
|
+
start: occurrence.start,
|
|
401
|
+
end: occurrence.end,
|
|
406
402
|
recurring: false,
|
|
407
403
|
recurrenceRule: null,
|
|
408
|
-
recurrence: null,
|
|
409
|
-
parentId: event.id
|
|
404
|
+
recurrence: null,
|
|
405
|
+
parentId: event.id
|
|
410
406
|
});
|
|
411
407
|
}
|
|
412
408
|
}
|
|
@@ -281,6 +281,8 @@ export class SearchWorkerManager {
|
|
|
281
281
|
|
|
282
282
|
this.pendingSearches.push({
|
|
283
283
|
id: searchId,
|
|
284
|
+
query,
|
|
285
|
+
options,
|
|
284
286
|
resolve
|
|
285
287
|
});
|
|
286
288
|
|
|
@@ -349,7 +351,14 @@ export class SearchWorkerManager {
|
|
|
349
351
|
processPendingSearches() {
|
|
350
352
|
// Re-trigger pending searches after indexing
|
|
351
353
|
for (const search of this.pendingSearches) {
|
|
352
|
-
|
|
354
|
+
this.worker.postMessage({
|
|
355
|
+
type: 'search',
|
|
356
|
+
data: {
|
|
357
|
+
id: search.id,
|
|
358
|
+
query: search.query,
|
|
359
|
+
options: search.options
|
|
360
|
+
}
|
|
361
|
+
});
|
|
353
362
|
}
|
|
354
363
|
}
|
|
355
364
|
|