Commit graph

12 commits

Author SHA1 Message Date
Janus C. H. Knudsen
92463ef173 Removes redundant header cache invalidation
Clearing the header manager's cache on `workweek:header-update` is no longer needed, streamlining updates.
2025-09-22 19:07:46 +02:00
Janus C. H. Knudsen
134ee29cb1 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.
2025-09-22 17:51:24 +02:00
Janus C. H. Knudsen
c682c30e23 Improves all-day drag-and-drop conversion
Refactors drag-to-all-day functionality to apply CSS styling and reposition the existing drag clone within the all-day container, rather than creating a new event element.

Centralizes all-day container creation in HeaderManager. Introduces `drag:mouseleave-header` to handle transitions from all-day back to timed events.

Ensures consistent styling and robust cleanup of drag clones for a smoother user experience.
2025-09-21 21:30:51 +02:00
Janus C. H. Knudsen
c7dcfbbaed Improves drag-drop event system with type safety
Introduces dedicated TypeScript interfaces for all drag-and-drop event payloads, enhancing type safety and developer experience.

Centralizes drag event detection and emission within `DragDropManager`. Refactors `AllDayManager`, `HeaderManager`, and `EventRendererManager` to subscribe to these typed events, improving decoupling and clarifying responsibilities.

Resolves known inconsistencies in drag event payloads, especially for all-day event conversions. Adds a comprehensive analysis document (`docs/EventSystem-Analysis.md`) detailing the event system and planned improvements.
2025-09-21 15:48:13 +02:00
Janus C. H. Knudsen
b4f5b29da3 Refactors event drag-drop and cloning logic
Centralizes drag event listener setup in `EventRendererManager` for better separation of concerns.

Introduces factory and cloning methods in `SwpEventElement` to simplify event cloning and data extraction from DOM elements during drag operations.

Enhances `DragDropManager` to pass the actual dragged element for conversion and accurately detect the drop target (day column or header).

Updates `EventRenderer` to expose drag-handling methods publicly, allowing the `EventRendererManager` to delegate event-specific drag operations based on drop target.
2025-09-20 09:40:56 +02:00
Janus C. H. Knudsen
1538e8c460 Optimizes header event handling and all-day display
Improves performance by early-exiting header event processing when no drag operation is active.
Ensures the all-day container height is re-evaluated after the mouse leaves the header area, maintaining correct layout.
2025-09-18 19:26:00 +02:00
fb40279009 Refactors header drag interaction to eliminate ghost columns
Updates the `HeaderManager` to utilize `mouseenter` and `mouseleave` events on the calendar header for improved performance and accuracy.
Calculates the target date based on the mouse's X-coordinate within the header.

Removes the need for 'ghost columns' by simplifying the logic. This significantly reduces complexity.
The `AllDayEventRenderer` is modified to reflect this change, omitting ghost column creation.

Updates `DragDropManager` to accommodate the new interaction model.
Various console logs are added for debugging purposes.
2025-09-18 17:55:52 +02:00
Janus Knudsen
18e80bbce2 WIP 2025-09-18 14:52:38 +02:00
Janus Knudsen
46b8bf9fb5 Fixes drag and drop to header issues
Addresses two key issues related to dragging events to the header: the premature removal of the original event element and the creation of duplicate all-day events.

The original event is no longer removed when dragging to the header; it is now only removed upon a successful drop.

Also, it prevents the creation of duplicate all-day events by checking for existing all-day events before creating new ones, using DOM queries to ensure accurate state.
2025-09-17 23:39:29 +02:00
Janus Knudsen
b4af5a9211 Improves all-day event hover detection
Enhances the all-day event selection by creating transparent, full-height columns for each day, which enables more accurate and reliable hover detection across all-day events.

Now selects all-day events by hovering on the entire column, not just day headers.
2025-09-17 22:08:27 +02:00
Janus Knudsen
c07d83d86f Refactors calendar event rendering and management
Improves code organization and maintainability by separating concerns related to all-day event rendering, header management, and event resizing.

Moves all-day event rendering logic into a dedicated `AllDayEventRenderer` class, utilizing the factory pattern for event element creation.

Refactors `AllDayManager` to handle all-day row height animations, separated from `HeaderManager`.

Removes the `ResizeManager` and related functionality.

These changes aim to reduce code duplication, improve testability, and enhance the overall architecture of the calendar component.
2025-09-12 00:36:02 +02:00
Janus Knudsen
3bd74d6f4e Enhances drag and drop functionality
Improves drag and drop event handling, including conversion between all-day and timed events.

Introduces HeaderManager to handle header-related event logic and
centralizes header event handling for better code organization and
separation of concerns.

Optimizes event listeners and throttles events for improved performance.
Removes redundant code and improves the overall drag and drop
experience.
2025-09-10 22:07:40 +02:00