70 lines
2 KiB
TypeScript
70 lines
2 KiB
TypeScript
import { IEventBus } from '../types/CalendarTypes';
|
|
import { Configuration } from '../configurations/CalendarConfig';
|
|
/**
|
|
* ViewSelectorManager - Manages view selector UI and state
|
|
*
|
|
* RESPONSIBILITY:
|
|
* ===============
|
|
* This manager owns all logic related to the <swp-view-selector> UI element.
|
|
* It follows the principle that each functional UI element has its own manager.
|
|
*
|
|
* RESPONSIBILITIES:
|
|
* - Handles button clicks on swp-view-button elements
|
|
* - Manages current view state (day/week/month)
|
|
* - Validates view values
|
|
* - Emits VIEW_CHANGED and VIEW_RENDERED events
|
|
* - Updates button UI states (data-active attributes)
|
|
*
|
|
* EVENT FLOW:
|
|
* ===========
|
|
* User clicks button → changeView() → validate → update state → emit event → update UI
|
|
*
|
|
* IMPLEMENTATION STATUS:
|
|
* ======================
|
|
* - Week view: FULLY IMPLEMENTED
|
|
* - Day view: NOT IMPLEMENTED (button exists but no rendering)
|
|
* - Month view: NOT IMPLEMENTED (button exists but no rendering)
|
|
*
|
|
* SUBSCRIBERS:
|
|
* ============
|
|
* - GridRenderer: Uses view parameter (currently only supports 'week')
|
|
* - Future: DayRenderer, MonthRenderer when implemented
|
|
*/
|
|
export declare class ViewSelector {
|
|
private eventBus;
|
|
private config;
|
|
private buttonListeners;
|
|
constructor(eventBus: IEventBus, config: Configuration);
|
|
/**
|
|
* Setup click listeners on all view selector buttons
|
|
*/
|
|
private setupButtonListeners;
|
|
/**
|
|
* Setup event bus listeners
|
|
*/
|
|
private setupEventListeners;
|
|
/**
|
|
* Change the active view
|
|
*/
|
|
private changeView;
|
|
/**
|
|
* Update button states (data-active attributes)
|
|
*/
|
|
private updateButtonStates;
|
|
/**
|
|
* Initialize view on INITIALIZED event
|
|
*/
|
|
private initializeView;
|
|
/**
|
|
* Emit VIEW_RENDERED event
|
|
*/
|
|
private emitViewRendered;
|
|
/**
|
|
* Refresh current view on DATE_CHANGED event
|
|
*/
|
|
private refreshCurrentView;
|
|
/**
|
|
* Validate if string is a valid CalendarView type
|
|
*/
|
|
private isValidView;
|
|
}
|