64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
|
|
import { IEventBus } from '../types/CalendarTypes';
|
||
|
|
import { DateService } from '../utils/DateService';
|
||
|
|
import { Configuration } from '../configurations/CalendarConfig';
|
||
|
|
/**
|
||
|
|
* NavigationButtons - Manages navigation button UI and navigation logic
|
||
|
|
*
|
||
|
|
* RESPONSIBILITY:
|
||
|
|
* ===============
|
||
|
|
* This manager owns all logic related to the <swp-nav-group> UI element
|
||
|
|
* and performs the actual navigation calculations.
|
||
|
|
*
|
||
|
|
* RESPONSIBILITIES:
|
||
|
|
* - Handles button clicks on swp-nav-button elements
|
||
|
|
* - Validates navigation actions (prev, next, today)
|
||
|
|
* - Calculates next/previous dates based on current view
|
||
|
|
* - Emits NAVIGATION_COMPLETED events with new date
|
||
|
|
* - Manages button UI listeners
|
||
|
|
*
|
||
|
|
* EVENT FLOW:
|
||
|
|
* ===========
|
||
|
|
* User clicks button → calculateNewDate() → emit NAVIGATION_COMPLETED → GridManager re-renders
|
||
|
|
*/
|
||
|
|
export declare class NavigationButtons {
|
||
|
|
private eventBus;
|
||
|
|
private buttonListeners;
|
||
|
|
private dateService;
|
||
|
|
private config;
|
||
|
|
private currentDate;
|
||
|
|
private currentView;
|
||
|
|
constructor(eventBus: IEventBus, dateService: DateService, config: Configuration);
|
||
|
|
/**
|
||
|
|
* Subscribe to events
|
||
|
|
*/
|
||
|
|
private subscribeToEvents;
|
||
|
|
/**
|
||
|
|
* Setup click listeners on all navigation buttons
|
||
|
|
*/
|
||
|
|
private setupButtonListeners;
|
||
|
|
/**
|
||
|
|
* Handle navigation action
|
||
|
|
*/
|
||
|
|
private handleNavigation;
|
||
|
|
/**
|
||
|
|
* Navigate in specified direction
|
||
|
|
*/
|
||
|
|
private navigate;
|
||
|
|
/**
|
||
|
|
* Navigate to next period
|
||
|
|
*/
|
||
|
|
private navigateNext;
|
||
|
|
/**
|
||
|
|
* Navigate to previous period
|
||
|
|
*/
|
||
|
|
private navigatePrevious;
|
||
|
|
/**
|
||
|
|
* Navigate to today
|
||
|
|
*/
|
||
|
|
private navigateToday;
|
||
|
|
/**
|
||
|
|
* Validate if string is a valid navigation action
|
||
|
|
*/
|
||
|
|
private isValidAction;
|
||
|
|
}
|