Improves drag cancellation behavior
Implements drag cancellation when the mouse leaves the calendar container during a drag operation. This prevents orphaned drag clones and restores the original event's state, enhancing user experience. All-day events now correctly recalculate their height upon drag cancellation, ensuring accurate rendering after clone removal. Refactors HeaderManager by removing redundant caching of the calendar header element. Adds new mock event data for September and October 2025 to expand testing and demonstration scenarios.
This commit is contained in:
parent
35651be2f0
commit
134ee29cb1
4 changed files with 531 additions and 16 deletions
|
|
@ -11,7 +11,6 @@ import { DragMouseEnterHeaderEventPayload, DragMouseLeaveHeaderEventPayload } fr
|
|||
* Separates event handling from rendering concerns
|
||||
*/
|
||||
export class HeaderManager {
|
||||
private cachedCalendarHeader: HTMLElement | null = null;
|
||||
|
||||
// Event listeners for drag events
|
||||
private dragMouseEnterHeaderListener: ((event: Event) => void) | null = null;
|
||||
|
|
@ -40,10 +39,7 @@ export class HeaderManager {
|
|||
* Get cached calendar header element
|
||||
*/
|
||||
private getCalendarHeader(): HTMLElement | null {
|
||||
if (!this.cachedCalendarHeader) {
|
||||
this.cachedCalendarHeader = document.querySelector('swp-calendar-header');
|
||||
}
|
||||
return this.cachedCalendarHeader;
|
||||
return document.querySelector('swp-calendar-header');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -196,21 +192,13 @@ export class HeaderManager {
|
|||
calendarHeader = document.createElement('swp-calendar-header');
|
||||
// Insert header as first child
|
||||
gridContainer.insertBefore(calendarHeader, gridContainer.firstChild);
|
||||
this.cachedCalendarHeader = calendarHeader;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return calendarHeader;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear cached header reference
|
||||
*/
|
||||
public clearCache(): void {
|
||||
this.cachedCalendarHeader = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up resources and event listeners
|
||||
*/
|
||||
|
|
@ -228,6 +216,5 @@ export class HeaderManager {
|
|||
this.dragMouseEnterHeaderListener = null;
|
||||
this.dragMouseLeaveHeaderListener = null;
|
||||
|
||||
this.clearCache();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue