Some ignored filles was missing
This commit is contained in:
parent
7db22245e2
commit
fd5ab6bc0d
268 changed files with 31970 additions and 4 deletions
63
wwwroot/js/components/NavigationButtons.d.ts
vendored
Normal file
63
wwwroot/js/components/NavigationButtons.d.ts
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
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;
|
||||
}
|
||||
131
wwwroot/js/components/NavigationButtons.js
Normal file
131
wwwroot/js/components/NavigationButtons.js
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
import { CoreEvents } from '../constants/CoreEvents';
|
||||
/**
|
||||
* 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 class NavigationButtons {
|
||||
constructor(eventBus, dateService, config) {
|
||||
this.buttonListeners = new Map();
|
||||
this.currentDate = new Date();
|
||||
this.currentView = 'week';
|
||||
this.eventBus = eventBus;
|
||||
this.dateService = dateService;
|
||||
this.config = config;
|
||||
this.setupButtonListeners();
|
||||
this.subscribeToEvents();
|
||||
}
|
||||
/**
|
||||
* Subscribe to events
|
||||
*/
|
||||
subscribeToEvents() {
|
||||
// Listen for view changes
|
||||
this.eventBus.on(CoreEvents.VIEW_CHANGED, (e) => {
|
||||
const detail = e.detail;
|
||||
this.currentView = detail.currentView;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Setup click listeners on all navigation buttons
|
||||
*/
|
||||
setupButtonListeners() {
|
||||
const buttons = document.querySelectorAll('swp-nav-button[data-action]');
|
||||
buttons.forEach(button => {
|
||||
const clickHandler = (event) => {
|
||||
event.preventDefault();
|
||||
const action = button.getAttribute('data-action');
|
||||
if (action && this.isValidAction(action)) {
|
||||
this.handleNavigation(action);
|
||||
}
|
||||
};
|
||||
button.addEventListener('click', clickHandler);
|
||||
this.buttonListeners.set(button, clickHandler);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Handle navigation action
|
||||
*/
|
||||
handleNavigation(action) {
|
||||
switch (action) {
|
||||
case 'prev':
|
||||
this.navigatePrevious();
|
||||
break;
|
||||
case 'next':
|
||||
this.navigateNext();
|
||||
break;
|
||||
case 'today':
|
||||
this.navigateToday();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Navigate in specified direction
|
||||
*/
|
||||
navigate(direction) {
|
||||
const offset = direction === 'next' ? 1 : -1;
|
||||
let newDate;
|
||||
switch (this.currentView) {
|
||||
case 'week':
|
||||
newDate = this.dateService.addWeeks(this.currentDate, offset);
|
||||
break;
|
||||
case 'month':
|
||||
newDate = this.dateService.addMonths(this.currentDate, offset);
|
||||
break;
|
||||
case 'day':
|
||||
newDate = this.dateService.addDays(this.currentDate, offset);
|
||||
break;
|
||||
default:
|
||||
newDate = this.dateService.addWeeks(this.currentDate, offset);
|
||||
}
|
||||
this.currentDate = newDate;
|
||||
const payload = {
|
||||
direction: direction,
|
||||
newDate: newDate
|
||||
};
|
||||
this.eventBus.emit(CoreEvents.NAV_BUTTON_CLICKED, payload);
|
||||
}
|
||||
/**
|
||||
* Navigate to next period
|
||||
*/
|
||||
navigateNext() {
|
||||
this.navigate('next');
|
||||
}
|
||||
/**
|
||||
* Navigate to previous period
|
||||
*/
|
||||
navigatePrevious() {
|
||||
this.navigate('previous');
|
||||
}
|
||||
/**
|
||||
* Navigate to today
|
||||
*/
|
||||
navigateToday() {
|
||||
this.currentDate = new Date();
|
||||
const payload = {
|
||||
direction: 'today',
|
||||
newDate: this.currentDate
|
||||
};
|
||||
this.eventBus.emit(CoreEvents.NAV_BUTTON_CLICKED, payload);
|
||||
}
|
||||
/**
|
||||
* Validate if string is a valid navigation action
|
||||
*/
|
||||
isValidAction(action) {
|
||||
return ['prev', 'next', 'today'].includes(action);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=NavigationButtons.js.map
|
||||
1
wwwroot/js/components/NavigationButtons.js.map
Normal file
1
wwwroot/js/components/NavigationButtons.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"NavigationButtons.js","sourceRoot":"","sources":["../../../src/components/NavigationButtons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,iBAAiB;IAQ5B,YACE,QAAmB,EACnB,WAAwB,EACxB,MAAqB;QATf,oBAAe,GAAgC,IAAI,GAAG,EAAE,CAAC;QAGzD,gBAAW,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,gBAAW,GAAiB,MAAM,CAAC;QAOzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACK,iBAAiB;QACvB,0BAA0B;QAC1B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAQ,EAAE,EAAE;YACrD,MAAM,MAAM,GAAI,CAAiB,CAAC,MAAM,CAAC;YACzC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,oBAAoB;QAC1B,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,CAAC;QAEzE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACvB,MAAM,YAAY,GAAG,CAAC,KAAY,EAAE,EAAE;gBACpC,KAAK,CAAC,cAAc,EAA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AAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;gBAC7D,MAAM;YACR;gBACE,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAClE,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAE3B,MAAM,OAAO,GAAkC;YAC7C,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,OAAO;SACjB,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACK,YAAY;QAClB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED;;OAEG;IACK,gBAAgB;QACtB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACK,aAAa;QACnB,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;QAE9B,MAAM,OAAO,GAAkC;YAC7C,SAAS,EAAE,OAAO;YAClB,OAAO,EAAE,IAAI,CAAC,WAAW;SAC1B,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,MAAc;QAClC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;CACF"}
|
||||
70
wwwroot/js/components/ViewSelector.d.ts
vendored
Normal file
70
wwwroot/js/components/ViewSelector.d.ts
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
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;
|
||||
}
|
||||
130
wwwroot/js/components/ViewSelector.js
Normal file
130
wwwroot/js/components/ViewSelector.js
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
import { CoreEvents } from '../constants/CoreEvents';
|
||||
/**
|
||||
* 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 class ViewSelector {
|
||||
constructor(eventBus, config) {
|
||||
this.buttonListeners = new Map();
|
||||
this.eventBus = eventBus;
|
||||
this.config = config;
|
||||
this.setupButtonListeners();
|
||||
this.setupEventListeners();
|
||||
}
|
||||
/**
|
||||
* Setup click listeners on all view selector buttons
|
||||
*/
|
||||
setupButtonListeners() {
|
||||
const buttons = document.querySelectorAll('swp-view-button[data-view]');
|
||||
buttons.forEach(button => {
|
||||
const clickHandler = (event) => {
|
||||
event.preventDefault();
|
||||
const view = button.getAttribute('data-view');
|
||||
if (view && this.isValidView(view)) {
|
||||
this.changeView(view);
|
||||
}
|
||||
};
|
||||
button.addEventListener('click', clickHandler);
|
||||
this.buttonListeners.set(button, clickHandler);
|
||||
});
|
||||
// Initialize button states
|
||||
this.updateButtonStates();
|
||||
}
|
||||
/**
|
||||
* Setup event bus listeners
|
||||
*/
|
||||
setupEventListeners() {
|
||||
this.eventBus.on(CoreEvents.INITIALIZED, () => {
|
||||
this.initializeView();
|
||||
});
|
||||
this.eventBus.on(CoreEvents.DATE_CHANGED, () => {
|
||||
this.refreshCurrentView();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Change the active view
|
||||
*/
|
||||
changeView(newView) {
|
||||
if (newView === this.config.currentView) {
|
||||
return; // No change
|
||||
}
|
||||
const previousView = this.config.currentView;
|
||||
this.config.currentView = newView;
|
||||
// Update button UI states
|
||||
this.updateButtonStates();
|
||||
// Emit event for subscribers
|
||||
this.eventBus.emit(CoreEvents.VIEW_CHANGED, {
|
||||
previousView,
|
||||
currentView: newView
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Update button states (data-active attributes)
|
||||
*/
|
||||
updateButtonStates() {
|
||||
const buttons = document.querySelectorAll('swp-view-button[data-view]');
|
||||
buttons.forEach(button => {
|
||||
const buttonView = button.getAttribute('data-view');
|
||||
if (buttonView === this.config.currentView) {
|
||||
button.setAttribute('data-active', 'true');
|
||||
}
|
||||
else {
|
||||
button.removeAttribute('data-active');
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Initialize view on INITIALIZED event
|
||||
*/
|
||||
initializeView() {
|
||||
this.updateButtonStates();
|
||||
this.emitViewRendered();
|
||||
}
|
||||
/**
|
||||
* Emit VIEW_RENDERED event
|
||||
*/
|
||||
emitViewRendered() {
|
||||
this.eventBus.emit(CoreEvents.VIEW_RENDERED, {
|
||||
view: this.config.currentView
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Refresh current view on DATE_CHANGED event
|
||||
*/
|
||||
refreshCurrentView() {
|
||||
this.emitViewRendered();
|
||||
}
|
||||
/**
|
||||
* Validate if string is a valid CalendarView type
|
||||
*/
|
||||
isValidView(view) {
|
||||
return ['day', 'week', 'month'].includes(view);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=ViewSelector.js.map
|
||||
1
wwwroot/js/components/ViewSelector.js.map
Normal file
1
wwwroot/js/components/ViewSelector.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ViewSelector.js","sourceRoot":"","sources":["../../../src/components/ViewSelector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,YAAY;IAKvB,YAAY,QAAmB,EAAE,MAAqB;QAF9C,oBAAe,GAAgC,IAAI,GAAG,EAAE,CAAC;QAG/D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAED;;OAEG;IACK,oBAAoB;QAC1B,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,4BAA4B,CAAC,CAAC;QAExE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACvB,MAAM,YAAY,GAAG,CAAC,KAAY,EAAE,EAAE;gBACpC,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;gBAC9C,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;oBACnC,IAAI,CAAC,UAAU,CAAC,IAAoB,CAAC,CAAC;gBACxC,CAAC;YACH,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC/C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,2BAA2B;QAC3B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AC,CAAC;YACxC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,cAAc;QACpB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACK,gBAAgB;QACtB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE;YAC3C,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;SAC9B,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,kBAAkB;QACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,IAAY;QAC9B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;CACF"}
|
||||
47
wwwroot/js/components/WorkweekPresets.d.ts
vendored
Normal file
47
wwwroot/js/components/WorkweekPresets.d.ts
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
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;
|
||||
}
|
||||
95
wwwroot/js/components/WorkweekPresets.js
Normal file
95
wwwroot/js/components/WorkweekPresets.js
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
import { CoreEvents } from '../constants/CoreEvents';
|
||||
import { WORK_WEEK_PRESETS } 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 class WorkweekPresets {
|
||||
constructor(eventBus, config) {
|
||||
this.buttonListeners = new Map();
|
||||
this.eventBus = eventBus;
|
||||
this.config = config;
|
||||
this.setupButtonListeners();
|
||||
}
|
||||
/**
|
||||
* Setup click listeners on all workweek preset buttons
|
||||
*/
|
||||
setupButtonListeners() {
|
||||
const buttons = document.querySelectorAll('swp-preset-button[data-workweek]');
|
||||
buttons.forEach(button => {
|
||||
const clickHandler = (event) => {
|
||||
event.preventDefault();
|
||||
const presetId = button.getAttribute('data-workweek');
|
||||
if (presetId) {
|
||||
this.changePreset(presetId);
|
||||
}
|
||||
};
|
||||
button.addEventListener('click', clickHandler);
|
||||
this.buttonListeners.set(button, clickHandler);
|
||||
});
|
||||
// Initialize button states
|
||||
this.updateButtonStates();
|
||||
}
|
||||
/**
|
||||
* Change the active workweek preset
|
||||
*/
|
||||
changePreset(presetId) {
|
||||
if (!WORK_WEEK_PRESETS[presetId]) {
|
||||
console.warn(`Invalid preset ID "${presetId}"`);
|
||||
return;
|
||||
}
|
||||
if (presetId === this.config.currentWorkWeek) {
|
||||
return; // No change
|
||||
}
|
||||
const previousPresetId = this.config.currentWorkWeek;
|
||||
this.config.currentWorkWeek = presetId;
|
||||
const settings = WORK_WEEK_PRESETS[presetId];
|
||||
// Update button UI states
|
||||
this.updateButtonStates();
|
||||
// Emit event for subscribers
|
||||
this.eventBus.emit(CoreEvents.WORKWEEK_CHANGED, {
|
||||
workWeekId: presetId,
|
||||
previousWorkWeekId: previousPresetId,
|
||||
settings: settings
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Update button states (data-active attributes)
|
||||
*/
|
||||
updateButtonStates() {
|
||||
const buttons = document.querySelectorAll('swp-preset-button[data-workweek]');
|
||||
buttons.forEach(button => {
|
||||
const buttonPresetId = button.getAttribute('data-workweek');
|
||||
if (buttonPresetId === this.config.currentWorkWeek) {
|
||||
button.setAttribute('data-active', 'true');
|
||||
}
|
||||
else {
|
||||
button.removeAttribute('data-active');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=WorkweekPresets.js.map
|
||||
1
wwwroot/js/components/WorkweekPresets.js.map
Normal file
1
wwwroot/js/components/WorkweekPresets.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"WorkweekPresets.js","sourceRoot":"","sources":["../../../src/components/WorkweekPresets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAiB,MAAM,kCAAkC,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,eAAe;IAK1B,YAAY,QAAmB,EAAE,MAAqB;QAF9C,oBAAe,GAAgC,IAAI,GAAG,EAAE,CAAC;QAG/D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACK,oBAAoB;QAC1B,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,CAAC;QAE9E,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACvB,MAAM,YAAY,GAAG,CAAC,KAAY,EAAE,EAAE;gBACpC,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;gBACtD,IAAI,QAAQ,EAAE,CAAC;oBACb,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC/C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,2BAA2B;QAC3B,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,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