Refactors date handling with DateService
Replaces DateCalculator with DateService for improved date and time operations, including timezone handling. This change enhances the calendar's accuracy and flexibility in managing dates, especially concerning timezone configurations. It also corrects a typo in the `allDay` dataset attribute.
This commit is contained in:
parent
4859f42450
commit
6bbf2d8adb
17 changed files with 159 additions and 749 deletions
|
|
@ -42,9 +42,6 @@ export class DragDropManager {
|
|||
private currentColumnBounds: ColumnBounds | null = null;
|
||||
private isDragStarted = false;
|
||||
|
||||
// Header tracking state
|
||||
private isInHeader = false;
|
||||
|
||||
// Movement threshold to distinguish click from drag
|
||||
private readonly dragThreshold = 5; // pixels
|
||||
|
||||
|
|
@ -460,7 +457,6 @@ export class DragDropManager {
|
|||
this.draggedElement = null;
|
||||
this.draggedClone = null;
|
||||
this.isDragStarted = false;
|
||||
this.isInHeader = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -492,15 +488,11 @@ export class DragDropManager {
|
|||
const elementAtPosition = document.elementFromPoint(event.clientX, event.clientY);
|
||||
if (!elementAtPosition) return;
|
||||
|
||||
// Check if we're in a header area
|
||||
const headerElement = elementAtPosition.closest('swp-day-header, swp-calendar-header');
|
||||
const isCurrentlyInHeader = !!headerElement;
|
||||
|
||||
// Detect header enter
|
||||
if (!this.isInHeader && isCurrentlyInHeader && this.draggedClone) {
|
||||
this.isInHeader = true;
|
||||
if (isCurrentlyInHeader && !this.draggedClone?.hasAttribute("data-allday")) {
|
||||
|
||||
// Calculate target date using existing method
|
||||
const targetColumn = ColumnDetectionUtils.getColumnBounds(position);
|
||||
|
||||
if (targetColumn) {
|
||||
|
|
@ -510,15 +502,14 @@ export class DragDropManager {
|
|||
targetColumn: targetColumn,
|
||||
mousePosition: { x: event.clientX, y: event.clientY },
|
||||
originalElement: this.draggedElement,
|
||||
draggedClone: this.draggedClone
|
||||
draggedClone: this.draggedClone!!
|
||||
};
|
||||
this.eventBus.emit('drag:mouseenter-header', dragMouseEnterPayload);
|
||||
}
|
||||
}
|
||||
|
||||
// Detect header leave
|
||||
if (this.isInHeader && !isCurrentlyInHeader) {
|
||||
this.isInHeader = false;
|
||||
if (isCurrentlyInHeader && this.draggedClone?.hasAttribute("data-allday")) {
|
||||
|
||||
console.log('🚪 DragDropManager: Emitting drag:mouseleave-header');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue