48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
|
|
import { IEventBus } from '../types/CalendarTypes';
|
||
|
|
import { Configuration } from '../configurations/CalendarConfig';
|
||
|
|
/**
|
||
|
|
* WorkweekPresetsManager - Manages workweek preset UI and state
|
||
|
|
*
|
||
|
|
* RESPONSIBILITY:
|
||
|
|
* ===============
|
||
|
|
* This manager owns all logic related to the <swp-workweek-presets> UI element.
|
||
|
|
* It follows the principle that each functional UI element has its own manager.
|
||
|
|
*
|
||
|
|
* RESPONSIBILITIES:
|
||
|
|
* - Owns WORK_WEEK_PRESETS data
|
||
|
|
* - Handles button clicks on swp-preset-button elements
|
||
|
|
* - Manages current workweek preset state
|
||
|
|
* - Validates preset IDs
|
||
|
|
* - Emits WORKWEEK_CHANGED events
|
||
|
|
* - Updates button UI states (data-active attributes)
|
||
|
|
*
|
||
|
|
* EVENT FLOW:
|
||
|
|
* ===========
|
||
|
|
* User clicks button → changePreset() → validate → update state → emit event → update UI
|
||
|
|
*
|
||
|
|
* SUBSCRIBERS:
|
||
|
|
* ============
|
||
|
|
* - ConfigManager: Updates CSS variables (--grid-columns)
|
||
|
|
* - GridManager: Re-renders grid with new column count
|
||
|
|
* - CalendarManager: Relays to header update (via workweek:header-update)
|
||
|
|
* - HeaderManager: Updates date headers
|
||
|
|
*/
|
||
|
|
export declare class WorkweekPresets {
|
||
|
|
private eventBus;
|
||
|
|
private config;
|
||
|
|
private buttonListeners;
|
||
|
|
constructor(eventBus: IEventBus, config: Configuration);
|
||
|
|
/**
|
||
|
|
* Setup click listeners on all workweek preset buttons
|
||
|
|
*/
|
||
|
|
private setupButtonListeners;
|
||
|
|
/**
|
||
|
|
* Change the active workweek preset
|
||
|
|
*/
|
||
|
|
private changePreset;
|
||
|
|
/**
|
||
|
|
* Update button states (data-active attributes)
|
||
|
|
*/
|
||
|
|
private updateButtonStates;
|
||
|
|
}
|