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.
Addresses an issue where dragging events that are part of a stack could lead to inconsistencies.
This change ensures that when an event is dragged and dropped, the other events in the stack are also repositioned correctly.
It traverses the stack, removes the related events from their original positions, and re-renders them in the correct column.
It also removes stack link data from the dragged element to prevent unexpected behavior.
Updates event start and end times in the dataset after a successful drag and drop operation. This ensures the event element reflects the new time position.
Also resets the z-index of the dropped element if no overlaps are detected, keeping the element's original appearance.
Ensures dragged event clones maintain correct positioning
by setting `marginLeft` to `0px`. This fixes a potential
visual issue where the clone might not fill the full
column width during dragging.
Replaces the old overlap handling system with a new approach.
The new system recalculates overlaps after a drag-and-drop action and re-renders the affected events, avoiding manual group management. This simplifies the overlap resolution logic and improves performance.
Restructures the project for better maintainability and clarity. Adds a ManagerFactory for dependency injection and reorganizes files.
Updates event rendering logic to correctly handle overlapping events using a stack link system. The EventRendererStrategy now correctly processes and renders event overlaps, ensuring proper display. Introduces processing tracking to avoid double rendering.
Updates documentation to reflect the new structure and build process. Also implements changes to build output and event system for improved clarity.
Fixes#123
Ensures existing events maintain their base positions when a new event is dragged and dropped into an overlapping time slot.
The fix prioritizes existing events in the stack, placing the newly dropped event on top. This ensures correct visual representation and expected behavior during event manipulation.
Ensures event stacking only occurs when events actually overlap in pixel space, preventing visual artifacts. Breaks stacking chains when events no longer overlap due to middle element removal, and correctly resets styling.
Refactors event overlap handling to use a DOM-centric approach with data attributes for stack tracking. This eliminates complex state management, reduces code complexity, and improves maintainability. Removes the previous Map-based linked list implementation.
The new approach offers better debugging, automatic memory management, and eliminates state synchronization bugs.
The solution maintains identical functionality with a significantly simpler implementation, focusing on DOM manipulation for visual stacking and column sharing.
Addresses potential performance concerns of DOM queries by scoping them to specific containers.
Refactors event overlap detection to use pixel-based comparison.
This improves accuracy and addresses issues with incorrect overlap
calculations when events have slight time differences but visually overlap.
It removes dependency on the event manager and the need to convert elements
to calendar events for overlap detection.
Refactors event dropping logic to first check for existing
event groups. If a group exists and the dropped event overlaps
with it, the dropped event is added to the group. Otherwise,
it proceeds with full overlap detection against individual events.
This change prevents unnecessary group creation and optimizes
event arrangement within columns. It also ensures the dragged
event is placed on the rightmost side by adding it to the
overlapping events array last.
Updates the event overlap detection to accurately determine when events overlap in time, fixing incorrect stacking behavior.
Implements column sharing for events starting within 30 minutes of each other.
Applies stacking only when events truly overlap in time but start times differ by more than 30 minutes.
Removes unnecessary data attributes and simplifies styling for stacked events, improving code cleanliness and performance.
Adds logic to handle event overlaps in the calendar view. It introduces two patterns: column sharing for events with the same start time (rendered using flexbox) and stacking for events with a >30 min difference (rendered with reduced width and z-index).
It also introduces deep linking to specific events via URL parameters.
Enhances drag and drop behavior by introducing free positioning during auto-scroll and snapping to grid intervals.
- Introduces a `calculateFreePosition` method to allow events to follow the mouse exactly during auto-scroll.
- Modifies the drag move event to emit the snapped position during normal drag behavior.
- Updates event rendering to use grid settings for snap intervals.
- Updates grid styles to configure CSS variables dynamically.
Refines the drag and drop autoscroll functionality to correctly update the position of the dragged element relative to the scrolling container.
Calculates the snapped position based on the column's bounding rectangle and scroll movement, ensuring accurate placement during autoscroll. This provides a smoother and more responsive user experience when dragging elements near the edges of the scrollable area.
Streamlines calendar configuration by adopting a singleton pattern for consistent access and simplifies event handling.
- Removes direct `CalendarConfig` dependency injection in favor of the `calendarConfig` singleton, reducing code complexity.
- Replaces specific event emissions for grid, date, and resource settings updates with a general `REFRESH_REQUESTED` event.
- Updates event names to be more descriptive and consistent ("NAVIGATION_COMPLETED", "PERIOD_INFO_UPDATE").
- Removes the need to pass the calendar config to renderers since it is now a singleton.
This improves code maintainability and simplifies the event emission process.
Improves drag and drop performance by caching DOM elements and consolidating position calculations.
This reduces redundant DOM queries and optimizes event handling for smoother user interaction.
Also leverages `DateCalculator` for date/time conversions.
Improves calendar rendering performance by centralizing DOM manipulation in a dedicated `GridRenderer` class. This reduces redundant DOM queries and improves overall efficiency.
Introduces `EventManager` for optimized event lifecycle management with caching and optimized data processing.
The `ViewManager` is refactored for optimized view switching and event handling, further streamlining the application's architecture.
This change moves from a strategy-based `GridManager` to a simpler approach leveraging the `GridRenderer` directly for DOM updates. This eliminates unnecessary abstractions and improves code maintainability.
The changes include removing the old `GridManager`, `EventManager` and introducing new versions.
This change refactors the DateCalculator class to be a static class.
This removes the need to instantiate DateCalculator in multiple
managers and renderers, simplifying dependency management and
ensuring consistent date calculations across the application.
The configuration is now initialized once at the application start.