Updates the all-day event layout engine for better event
rendering, especially when dealing with partial week views.
The layout engine now correctly clips events that start
before or end after the visible date range, ensuring that
only relevant portions of events are displayed.
It also fixes event ordering.
Includes new unit tests to validate date range filtering and
clipping logic.
Adds comprehensive tests for the AllDayManager, covering various overlap scenarios.
Tests ensure correct row and column assignments for all-day events based on date ranges and overlaps.
Replaces individual event layout calculation with batch calculation for improved performance and test coverage.
Refactors all-day event rendering to use a layout engine
for overlap detection and positioning, ensuring events
are placed in available rows and columns.
Removes deprecated method and adds unit tests.
Ensures all-day container is created as part of the standard header structure, rather than on-demand.
Removes the request listener and logic for ensuring all-day container existence.
Improves the calculation of the all-day event container's
height by finding the highest row number in use, ensuring
the container accurately reflects the space occupied by events.
Updates debug logging for clarity.
Ensures navigation grid uses the same creation method
as the initial load.
This ensures workweek and resource settings are respected,
creating a more consistent experience.
Centralizes grid creation logic within the GridRenderer
for better code organization and reusability. This change
moves the grid rendering functionality from
NavigationRenderer to GridRenderer and updates the
NavigationManager to use the new GridRenderer.
Enables dynamic event types by reading the 'type' field from raw event data instead of using a hardcoded value.
Removes DOM element caching for calendar and grid containers in the navigation manager, opting for direct DOM queries. Eliminates associated cache clearing and post-animation header event emission.
Decouples all-day event rendering, making it reactive to header readiness with period data.
Eliminates explicit DOM element caching, simplifying element access.
Enhances the `header:ready` event payload with `startDate` and `endDate`.
Improves all-day row height animation and calculation.
Event rendering strategies now exclusively handle timed events, while all-day events are managed by a dedicated renderer.
Centralizes calendar header creation within `GridRenderer`, ensuring the header element is always present from initial DOM construction. `HeaderManager` and `ScrollManager` now react to a `header:ready` event, which signifies the header is fully initialized.
Synchronizes all-day event rendering with header readiness, temporarily queuing events until the header is prepared. Emits an `allday:checkHeight` event to prompt all-day container height adjustments after rendering.
Deletes a large set of architectural plans, code reviews, and implementation documents. This content is no longer relevant as the described features and refactorings are complete.
Streamlines the event renderer by removing legacy drag event listener setup and outdated comments, reflecting improved separation of concerns and rendering strategies.
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.
Reorders operations to calculate grid position for all-day events before appending them to the DOM. This prevents the element from being incorrectly counted during position calculations, improving placement accuracy.
Replaces date expansion logic with direct inspection of CSS grid row styles. This improves accuracy and performance by reflecting the actual rendered layout for determining `maxRows`.
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.
Removes the `swp-allday-event` custom element, using `swp-event` for all-day events instead. All-day events are now distinguished by their parent `swp-allday-container`. Simplifies element management and CSS selectors.
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.
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.
Implements comprehensive drag and drop for all-day events, allowing movement within the header and conversion to timed events when dragged into the calendar grid.
Optimizes column detection with a cached bounding box strategy, improving performance and accuracy. Refactors event conversion logic and renames related event bus events for clarity.
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.
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.
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.
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.
Refactors drag and drop logic for better event handling and code clarity.
- Moves drag styling to CSS class for cleaner code.
- Emits a 'drag:convert-from-allday' event to handle the conversion of all-day events back to day events.
- Adds logging for debugging purposes.
Hides the drag clone when moving events to the all-day area and shows it again when the mouse leaves the header to prevent visual inconsistencies.
Ensures only the correct all-day event is removed by specifying the container in the selector.
Ensures that when dragging an event from the all-day section and the mouse leaves the header, the original all-day event is removed, allowing the cloned event in the day columns to take over seamlessly. This prevents duplicate events from appearing.
This commit streamlines the codebase by removing the unnecessary `new_` prefixes from the event handling functions, resulting in cleaner and more consistent naming conventions. The functions were likely renamed at some point and the old names were kept around for a while.
Ensures that all-day events are placed in the first available row within their column to avoid overlapping.
It achieves this by querying existing all-day events, determining occupied rows based on their grid-row-start style, and then assigning the new event to the next available row.
Refactors drag and drop logic to dynamically find the dragged element, ensuring correct behavior even when the DOM changes during the drag operation.
Creates all-day container if it doesn't exist.
This resolves issues where drag and drop operations would fail if the original element was no longer present in the DOM or if the container didn't exist.
Centralizes event position calculations into `PositionUtils` for consistency and reusability across managers and renderers.
Improves drag-and-drop functionality by emitting events for all-day event conversion and streamlining position calculations during drag operations.
Introduces `AllDayManager` and `AllDayEventRenderer` to manage and render all-day events in the calendar header. This allows dragging events to the header to convert them to all-day events.
Addresses inconsistent time formatting and lack of timezone
handling throughout the application by introducing a
`TimeFormatter` utility.
This class centralizes time formatting logic, providing
timezone conversion (defaults to Europe/Copenhagen) and
support for both 12-hour and 24-hour formats, configurable
via `CalendarConfig`.
It also updates event rendering to utilize the new
`TimeFormatter` for consistent time displays.
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.
Introduces the ability to convert all-day events to timed events by dragging them out of the header.
Leverages a factory method to create timed events from all-day elements, ensuring proper data conversion and styling.
Improves user experience by allowing more flexible event scheduling.
Creates `SwpEventElement` and `SwpAllDayEventElement` classes for handling event rendering.
Refactors event creation logic in `EventRenderer` to utilize these classes, improving code organization and reusability.
Adds factory methods for creating event elements from `CalendarEvent` objects, simplifying event instantiation and data management.
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.
Updates event creation to correctly use the date from the calendar column, removing unnecessary time manipulation.
Simplifies duration handling by directly using the dataset value.
Removes unused all-day event drag and drop conversion functions.
Modifies event rendering to correctly handle dates that use a 1970 reference point during drag and drop operations.
This ensures that events maintain their correct date when moved between columns, resolving an issue where dragged events would revert to the 1970 reference date.
Introduces event resizing feature, allowing users to dynamically adjust event durations by dragging handles on the top or bottom of events.
Moves resize logic into a dedicated ResizeManager class for better code organization and separation of concerns.