Commit graph

53 commits

Author SHA1 Message Date
Janus C. H. Knudsen
6f79954342 Improves event drag and drop highlighting
Enhances the visual feedback during and after event drag and drop operations in the calendar.

- Preserves the full opacity of the dragged event clone during the drag operation for better visibility.
- Applies a highlight class to the event after it's dropped to visually indicate the new location.
- Adds specific styling for the highlighted state based on event type.
2025-10-09 22:31:49 +02:00
Janus C. H. Knudsen
8b8a1e3127 wip, resize, debugging 2025-10-08 00:58:38 +02:00
Janus C. H. Knudsen
5fae433afb Allows dynamic drag clone replacement
Introduces a polymorphic `createClone` method on base event elements to customize clone generation.
Adds a `replaceClone` delegate to drag event payloads, enabling subscribers to dynamically swap the active dragged clone.
This supports scenarios like converting a standard event clone to an all-day event clone when dragging to the all-day header.
2025-10-04 23:10:09 +02:00
Janus C. H. Knudsen
420036d939 wwip 2025-10-04 16:20:09 +02:00
Janus C. H. Knudsen
9bc082eed4 Improves date handling and event stacking
Enhances date validation and timezone handling using DateService, ensuring data integrity and consistency.

Refactors event rendering and dragging to correctly handle date transformations.

Adds a test plan for event stacking and z-index management.

Fixes edge cases in navigation and date calculations for week/year boundaries and DST transitions.
2025-10-04 00:32:26 +02:00
Janus C. H. Knudsen
4fea01c76b Improves all-day event drag and drop
Addresses issues with all-day event duration calculation and positioning during drag and drop.

- Uses `differenceInCalendarDays` to correctly calculate event duration across timezone and DST boundaries.
- Preserves the original event time when moving events to a different day.
- Snaps dragged event to the top of the target time slot.
2025-10-03 19:09:44 +02:00
Janus C. H. Knudsen
98ad46efab Preserves event duration during drag and drop
Ensures all-day events maintain their original duration
when dragged and dropped to a new date.

Calculates and applies the correct end date based on the
original event's span.
2025-10-03 00:37:37 +02:00
Janus C. H. Knudsen
576367974b Fixes all-day event dragging issues
Addresses issues with dragging all-day events, ensuring correct event placement and layout calculations after a drag and drop operation.
Specifically, ensures the correct event ID is used and updates the event layout when dragging all day events.
2025-10-02 23:58:03 +02:00
Janus C. H. Knudsen
89e8a3f7b2 wip 2025-10-02 23:11:26 +02:00
Janus C. H. Knudsen
88702e574a Improves drag and drop all-day event handling
Refines drag and drop behavior for all-day events.

Removes unnecessary logging and conditional logic in the
AllDayManager.

Simplifies column change handling in the EventRendererManager.
2025-10-02 17:40:58 +02:00
Janus C. H. Knudsen
5cdcd12e0a Updates all-day event overflow indicator
Ensures that the all-day event overflow indicator updates
correctly when the number of events changes, instead of
creating duplicate indicators.
Removes unused event click handling logic.
2025-10-02 17:30:48 +02:00
Janus C. H. Knudsen
496be2f7ce Improves all-day event overflow handling
Ensures correct display of all-day events when collapsed or expanded.

Improves the transition between collapsed and expanded states by
adjusting the overflow event visibility.
2025-10-02 16:57:43 +02:00
Janus C. H. Knudsen
0bf369907b Refactors all-day event overflow toggle.
Simplifies the all-day event overflow toggle logic by using distinct class names and avoiding direct class switching, improving code readability and maintainability.
2025-10-02 16:05:11 +02:00
Janus C. H. Knudsen
13b72b55b2 wip 2025-10-02 16:01:36 +02:00
Janus C. H. Knudsen
54acdb9b41 WIP 2025-10-02 15:57:11 +02:00
Janus C. H. Knudsen
0f2d96f76f Consolidates all-day event row limit
Centralizes the maximum number of displayed all-day event rows into a single constant.

This change ensures consistency and simplifies management of the all-day event row limit across the application.

Corrects off-by-one error in overflow count.
2025-10-02 15:37:01 +02:00
Janus C. H. Knudsen
f2ad13776f Improves all-day event row height calculation
Ensures consistent all-day event row height calculation across CSS and TypeScript.

The all-day event row height calculation is adjusted by removing redundant container padding from the TypeScript constant and synchronizing the CSS variable with the event height.

Additionally, the layout engine is directly tested in the test file for better coverage.
2025-10-02 01:03:35 +02:00
Janus C. H. Knudsen
a1e1c5d185 Removes unnecessary destroy methods 2025-10-01 22:38:15 +02:00
Janus C. H. Knudsen
4e5077364e Improves all-day event layout calculation
Refactors all-day event layout calculation to use the header elements directly.

This change improves the accuracy of event positioning
and fixes potential issues with date handling.
2025-10-01 21:47:05 +02:00
Janus C. H. Knudsen
d7867d4a9f Renders all-day events based on header data
Refactors all-day event rendering to use header column data.
This ensures events are rendered based on the actual visible
dates in the header, improving accuracy and responsiveness to view changes.

Removes direct dependency on week dates in `AllDayManager` and
`EventRenderingService`, instead, the all-day manager is instantiated
with event manager.

Updates `HeaderManager` to emit header bounds.
2025-10-01 21:27:13 +02:00
Janus C. H. Knudsen
ae3aab5dd0 Improves all-day event layout and drag behavior
Refactors all-day event layout calculation and rendering for improved accuracy and performance.

Improves drag-and-drop behavior for all-day events, ensuring correct event placement and column detection.

Addresses issues with event overflow display and provides a more responsive user experience.
2025-10-01 18:41:28 +02:00
Janus C. H. Knudsen
6a17bba343 Adds date-based column retrieval
Adds a method to retrieve column bounds based on a given date, enhancing date-specific event placement.

Removes unnecessary data storage for overflow event titles, simplifying overflow event handling.
2025-09-30 23:45:07 +02:00
Janus C. H. Knudsen
67dfb6e894 Adds event counting in columns
Implements a method to count the number of events
within a specific column, used for layout calculations.
2025-09-30 23:00:34 +02:00
Janus C. H. Knudsen
c7b9abde9a Improves all-day event height calculation.
Refactors all-day event height calculation to use the `currentLayouts` array, ensuring more accurate and reliable height adjustments.

This avoids querying the DOM directly and relies on the existing layout data for improved performance and correctness.
2025-09-30 22:49:16 +02:00
Janus C. H. Knudsen
cf463cc691 Refactors all-day event layout calculation
Improves all-day event drag and drop by recalculating layouts and applying differential updates to minimize DOM manipulations.

This change optimizes the update process by comparing current and new layouts, only updating elements with changed grid areas, leading to smoother transitions.
Removes obsolete code.
2025-09-30 22:35:07 +02:00
Janus C. H. Knudsen
6223bcd176 Improves all-day event display in collapsed mode
Enhances the all-day event display when collapsed by showing four rows (three events plus an overflow indicator).

Updates the overflow indicator logic to dynamically display the number of hidden events and allow the user to expand the view.
2025-09-30 15:24:58 +02:00
Janus C. H. Knudsen
c705869c9e Implements all-day event row collapsing
Adds functionality to collapse the all-day event rows when the number of rows exceeds a limit.

This improves the layout by preventing the all-day section from taking up too much space. A chevron button is added to allow users to expand/collapse the section.
2025-09-30 00:34:27 +02:00
Janus C. H. Knudsen
5417a2b6b1 Improves drag and drop functionality
Refactors drag and drop logic to use the dragged clone consistently, fixing issues with event handling and element manipulation during drag operations.
Also includes a fix where the original element is removed after a drag is completed.
Adds column bounds cache update after drag operations for improved column detection.
2025-09-30 00:13:52 +02:00
Janus C. H. Knudsen
83e01f9cb7 Improves all-day event drag and drop
Refactors all-day event conversion during drag and drop to
use the event payload, improving code clarity and reducing
redundancy.

Removes unnecessary style settings and fixes column detection
logic. Addresses an issue where event removal occurred before
successful placement.
2025-09-29 20:50:52 +02:00
Janus C. H. Knudsen
6ccc071587 Refactors drag and drop column detection
Improves drag and drop functionality by refactoring column detection to use column bounds instead of dates.
This change enhances the accuracy and efficiency of determining the target column during drag operations.
It also removes redundant code and simplifies the logic in both the DragDropManager and AllDayManager.
2025-09-28 13:25:09 +02:00
Janus C. H. Knudsen
4141bffca4 Refactors all-day event layout calculation
Simplifies all-day event rendering by streamlining the layout
calculation and event placement process, using the AllDayLayoutEngine
to determine the grid positions. This removes deprecated methods
and improves overall code clarity.
2025-09-27 15:01:22 +02:00
Janus C. H. Knudsen
9dfd4574d8 Improves drag and drop for timed and all-day events
Refactors drag and drop handling to use a cloned event element,
ensuring correct positioning and styling during drag operations
for both regular timed events and all-day events.

This change streamlines the drag and drop process by:
- Creating a clone of the dragged event at the start of the drag.
- Passing the clone through the drag events.
- Handling all-day events with the AllDayManager
- Handling regular timed events with the EventRendererManager

This resolves issues with event positioning and styling during
drag, especially when moving events across columns or between
all-day and timed sections.
2025-09-26 22:53:49 +02:00
Janus C. H. Knudsen
0553089085 Improves all-day event drag and drop
Refactors all-day event drag and drop handling for improved accuracy and performance.

Introduces a shared `ColumnDetectionUtils` for consistent column detection.

Simplifies all-day conversion during drag, placing events in row 1 and calculating the column from the target date.

Implements differential updates during drag end, updating only changed events for smoother transitions.
2025-09-26 22:11:57 +02:00
Janus C. H. Knudsen
a624394ffb Improves all-day event layout calculation
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.
2025-09-25 23:38:17 +02:00
Janus C. H. Knudsen
4daf1f6975 Calculates all-day event container height correctly
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.
2025-09-25 18:17:37 +02:00
Janus C. H. Knudsen
48d1fd681c Major refactor into type safe TS
With a risk oof rolling it all back
2025-09-23 20:44:15 +02:00
Janus C. H. Knudsen
c08fa02c29 Disables fill: forwards for spacer height animation
Removes the `fill: 'forwards'` property to ensure CSS `calc()` takes over the header spacer's height after the animation concludes.
2025-09-23 16:30:30 +02:00
Janus C. H. Knudsen
ffa0bcafc3 Optimizes animation speed and event flow
Reduces the duration of a UI height animation for a snappier feel.
Disables a specific `header:ready` event emission during navigation rendering.
2025-09-23 09:46:47 +02:00
Janus C. H. Knudsen
6498b0ba8e Refactors all-day event rendering and DOM access
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.
2025-09-22 23:37:43 +02:00
Janus C. H. Knudsen
f5e9909935 Separates all-day event rendering; handles header lifecycle
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.
2025-09-22 21:53:18 +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
35651be2f0 Ensures accurate all-day event placement
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.
2025-09-21 22:17:24 +02:00
Janus C. H. Knudsen
c9b9ac4cae Simplifies all-day event row calculation
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`.
2025-09-21 22:13:31 +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
2cdbc8f1a3 Unifies all-day event element tag
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.
2025-09-21 16:03:34 +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
0b7499521e Enables all-day event drag and drop
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.
2025-09-19 00:20:30 +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