Refactors event system to use CoreEvents
Migrates the application to use a new CoreEvents system. This change removes the legacy EventTypes constant file and updates all managers, renderers, and core components to use the CoreEvents constant file for event emission and subscription. This improves code maintainability and promotes a consistent eventing strategy across the application. Adds validation to EventBus emit and extractCategory functions.
This commit is contained in:
parent
414ef1caaf
commit
4b4dbdc0d6
11 changed files with 76 additions and 228 deletions
|
|
@ -1,119 +0,0 @@
|
|||
// Legacy Calendar event type constants
|
||||
|
||||
/**
|
||||
* Legacy event type constants for DOM CustomEvents
|
||||
*
|
||||
* IMPORTANT: This file contains events for specific UI interactions and config updates.
|
||||
* For initialization and coordination events, use StateEvents from ../types/CalendarState.ts
|
||||
*
|
||||
* This file has been cleaned up to remove redundant/unused events.
|
||||
*/
|
||||
export const EventTypes = {
|
||||
// Configuration events
|
||||
CONFIG_UPDATE: 'calendar:configupdate',
|
||||
CALENDAR_TYPE_CHANGED: 'calendar:calendartypechanged',
|
||||
SELECTED_DATE_CHANGED: 'calendar:selecteddatechanged',
|
||||
WORKWEEK_CHANGED: 'calendar:workweekchanged',
|
||||
|
||||
// View change events
|
||||
VIEW_CHANGE: 'calendar:viewchange',
|
||||
VIEW_CHANGED: 'calendar:viewchanged',
|
||||
VIEW_CHANGE_REQUESTED: 'calendar:viewchangerequested',
|
||||
VIEW_RENDERED: 'calendar:viewrendered',
|
||||
PERIOD_CHANGE: 'calendar:periodchange',
|
||||
|
||||
// Navigation events
|
||||
WEEK_CHANGED: 'calendar:weekchanged',
|
||||
WEEK_INFO_UPDATED: 'calendar:weekinfoupdated',
|
||||
WEEK_CONTENT_RENDERED: 'calendar:weekcontentrendered',
|
||||
NAVIGATION_ANIMATION_COMPLETE: 'calendar:navigationanimationcomplete',
|
||||
NAV_PREV: 'calendar:navprev',
|
||||
NAV_NEXT: 'calendar:navnext',
|
||||
NAV_TODAY: 'calendar:navtoday',
|
||||
NAVIGATE_TO_DATE: 'calendar:navigatetodate',
|
||||
NAVIGATE_TO_TODAY: 'calendar:navigatetotoday',
|
||||
NAVIGATE_NEXT: 'calendar:navigatenext',
|
||||
NAVIGATE_PREVIOUS: 'calendar:navigateprevious',
|
||||
|
||||
// Event CRUD (still used for UI layer)
|
||||
EVENT_CREATE: 'calendar:eventcreate',
|
||||
EVENT_CREATED: 'calendar:eventcreated',
|
||||
EVENT_UPDATE: 'calendar:eventupdate',
|
||||
EVENT_UPDATED: 'calendar:eventupdated',
|
||||
EVENT_DELETE: 'calendar:eventdelete',
|
||||
EVENT_DELETED: 'calendar:eventdeleted',
|
||||
EVENT_RENDERED: 'calendar:eventrendered',
|
||||
EVENT_SELECTED: 'calendar:eventselected',
|
||||
EVENTS_LOADED: 'calendar:eventsloaded',
|
||||
|
||||
// User interaction events
|
||||
GRID_CLICK: 'calendar:gridclick',
|
||||
GRID_DBLCLICK: 'calendar:griddblclick',
|
||||
|
||||
// Drag and drop events
|
||||
DRAG_START: 'calendar:dragstart',
|
||||
DRAG_MOVE: 'calendar:dragmove',
|
||||
DRAG_END: 'calendar:dragend',
|
||||
DRAG_CANCEL: 'calendar:dragcancel',
|
||||
|
||||
RESIZE_START: 'calendar:resizestart',
|
||||
RESIZE_MOVE: 'calendar:resizemove',
|
||||
RESIZE_END: 'calendar:resizeend',
|
||||
RESIZE_CANCEL: 'calendar:resizecancel',
|
||||
|
||||
// UI events
|
||||
POPUP_SHOW: 'calendar:popupshow',
|
||||
POPUP_HIDE: 'calendar:popuphide',
|
||||
|
||||
SEARCH_START: 'calendar:searchstart',
|
||||
SEARCH_UPDATE: 'calendar:searchupdate',
|
||||
SEARCH_CLEAR: 'calendar:searchclear',
|
||||
|
||||
// Data events (legacy - prefer StateEvents)
|
||||
DATE_CHANGED: 'calendar:datechanged',
|
||||
DATA_FETCH_START: 'calendar:datafetchstart',
|
||||
DATA_FETCH_SUCCESS: 'calendar:datafetchsuccess',
|
||||
DATA_FETCH_ERROR: 'calendar:datafetcherror',
|
||||
DATA_SYNC_START: 'calendar:datasyncstart',
|
||||
DATA_SYNC_SUCCESS: 'calendar:datasyncsuccess',
|
||||
DATA_SYNC_ERROR: 'calendar:datasyncerror',
|
||||
|
||||
// Initialization events (legacy - prefer StateEvents)
|
||||
CALENDAR_INITIALIZED: 'calendar:initialized',
|
||||
CALENDAR_DATA_LOADED: 'calendar:calendardataloaded',
|
||||
GRID_RENDERED: 'calendar:gridrendered',
|
||||
CONTAINER_READY_FOR_EVENTS: 'calendar:containerreadyforevents',
|
||||
|
||||
// Management events (legacy - prefer StateEvents)
|
||||
REFRESH_REQUESTED: 'calendar:refreshrequested',
|
||||
RESET_REQUESTED: 'calendar:resetrequested',
|
||||
CALENDAR_REFRESH_REQUESTED: 'calendar:calendarrefreshrequested',
|
||||
CALENDAR_RESET: 'calendar:reset',
|
||||
|
||||
// System events
|
||||
ERROR: 'calendar:error',
|
||||
|
||||
// Time events
|
||||
TIME_UPDATE: 'calendar:timeupdate',
|
||||
|
||||
// Loading events
|
||||
LOADING_START: 'calendar:loadingstart',
|
||||
LOADING_END: 'calendar:loadingend'
|
||||
} as const;
|
||||
|
||||
// Type for event bus event type values
|
||||
export type EventBusType = typeof EventTypes[keyof typeof EventTypes];
|
||||
|
||||
/**
|
||||
* REMOVED EVENTS (now handled by StateEvents):
|
||||
* - CALENDAR_INITIALIZING: Use StateEvents.CALENDAR_STATE_CHANGED
|
||||
* - CALENDAR_INITIALIZED: Use StateEvents.CALENDAR_STATE_CHANGED
|
||||
* - CALENDAR_DATA_LOADED: Use StateEvents.DATA_LOADED
|
||||
* - GRID_RENDERED: Use StateEvents.GRID_RENDERED
|
||||
* - VIEW_CHANGE_REQUESTED: Use StateEvents.VIEW_CHANGE_REQUESTED
|
||||
* - VIEW_CHANGED: Use StateEvents.VIEW_CHANGED
|
||||
* - DATA_FETCH_*: Use StateEvents.DATA_LOADING_STARTED/DATA_LOADED/DATA_FAILED
|
||||
* - DATA_SYNC_*: Use StateEvents for better coordination
|
||||
* - CALENDAR_READY: Use StateEvents.CALENDAR_READY
|
||||
* - RENDERING_*: Use StateEvents.RENDERING_STARTED/RENDERING_COMPLETE
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue