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.
This commit is contained in:
parent
496be2f7ce
commit
5cdcd12e0a
3 changed files with 20 additions and 48 deletions
|
|
@ -569,9 +569,17 @@ export class AllDayManager {
|
|||
let overflowCount = totalEventsInColumn - ALL_DAY_CONSTANTS.MAX_COLLAPSED_ROWS
|
||||
|
||||
if (overflowCount > 0) {
|
||||
// Check if indicator already exists in this column
|
||||
let existingIndicator = container.querySelector(`.max-event-indicator[data-column="${columnBounds.index}"]`) as HTMLElement;
|
||||
|
||||
if (existingIndicator) {
|
||||
// Update existing indicator
|
||||
existingIndicator.innerHTML = `<span>+${overflowCount + 1} more</span>`;
|
||||
} else {
|
||||
// Create new overflow indicator element
|
||||
let overflowElement = document.createElement('swp-event');
|
||||
overflowElement.className = 'max-event-indicator';
|
||||
overflowElement.setAttribute('data-column', columnBounds.index.toString());
|
||||
overflowElement.style.gridRow = ALL_DAY_CONSTANTS.MAX_COLLAPSED_ROWS.toString();
|
||||
overflowElement.style.gridColumn = columnBounds.index.toString();
|
||||
overflowElement.innerHTML = `<span>+${overflowCount + 1} more</span>`;
|
||||
|
|
@ -582,6 +590,7 @@ export class AllDayManager {
|
|||
|
||||
container.appendChild(overflowElement);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -331,33 +331,6 @@ export abstract class BaseEventRenderer implements EventRendererStrategy {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle event click (when drag threshold not reached)
|
||||
*/
|
||||
public handleEventClick(eventId: string, originalElement: HTMLElement): void {
|
||||
console.log('handleEventClick:', eventId);
|
||||
|
||||
// Clean up any drag artifacts from failed drag attempt
|
||||
if (this.draggedClone) {
|
||||
this.draggedClone.classList.remove('dragging');
|
||||
this.draggedClone.remove();
|
||||
this.draggedClone = null;
|
||||
}
|
||||
|
||||
// Restore original element styling if it was modified
|
||||
if (this.originalEvent) {
|
||||
this.originalEvent.style.opacity = '';
|
||||
this.originalEvent.style.userSelect = '';
|
||||
this.originalEvent = null;
|
||||
}
|
||||
|
||||
// Emit a clean click event for other components to handle
|
||||
eventBus.emit('event:clicked', {
|
||||
eventId: eventId,
|
||||
element: originalElement
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle navigation completed event
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -197,16 +197,6 @@ export class EventRenderingService {
|
|||
}
|
||||
});
|
||||
|
||||
// Handle click (when drag threshold not reached)
|
||||
this.eventBus.on('event:click', (event: Event) => {
|
||||
const { draggedElement } = (event as CustomEvent).detail;
|
||||
// Use draggedElement directly - no need for DOM query
|
||||
if (draggedElement && this.strategy.handleEventClick) {
|
||||
const eventId = draggedElement.dataset.eventId || '';
|
||||
this.strategy.handleEventClick(eventId, draggedElement); //TODO: fix this redundant parameters
|
||||
}
|
||||
});
|
||||
|
||||
// Handle column change
|
||||
this.eventBus.on('drag:column-change', (event: Event) => {
|
||||
let columnChangeEvent = (event as CustomEvent<DragColumnChangeEventPayload>).detail;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue