wip
This commit is contained in:
parent
59b3c64c55
commit
b111f121ba
9 changed files with 200 additions and 694 deletions
|
|
@ -54,15 +54,11 @@ export class GridManager {
|
|||
|
||||
private findElements(): void {
|
||||
this.grid = document.querySelector('swp-calendar-container');
|
||||
console.log('GridManager: findElements called, found swp-calendar-container:', !!this.grid);
|
||||
}
|
||||
|
||||
private subscribeToEvents(): void {
|
||||
// Listen for state-driven rendering start event
|
||||
eventBus.on(StateEvents.RENDERING_STARTED, (e: Event) => {
|
||||
const detail = (e as CustomEvent).detail;
|
||||
console.log('GridManager: Received RENDERING_STARTED, starting DOM structure setup');
|
||||
this.render();
|
||||
});
|
||||
// State-driven events removed - render() is now called directly by CalendarManager
|
||||
|
||||
// Re-render grid on config changes
|
||||
eventBus.on(EventTypes.CONFIG_UPDATE, (e: Event) => {
|
||||
|
|
@ -119,39 +115,23 @@ export class GridManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Render the complete grid structure
|
||||
* Render the complete grid structure - now returns Promise for direct calls
|
||||
*/
|
||||
render(): void {
|
||||
if (!this.grid) return;
|
||||
async render(): Promise<void> {
|
||||
if (!this.grid) {
|
||||
console.warn('GridManager: render() called but this.grid is null, re-finding elements');
|
||||
this.findElements();
|
||||
if (!this.grid) {
|
||||
throw new Error('GridManager: swp-calendar-container not found, cannot render');
|
||||
}
|
||||
}
|
||||
|
||||
console.log('GridManager: Starting render with grid element:', this.grid);
|
||||
this.updateGridStyles();
|
||||
this.renderGrid();
|
||||
|
||||
// Emit state-driven grid rendered event
|
||||
const columnCount = this.getColumnCount();
|
||||
console.log('GridManager: Emitting GRID_RENDERED event');
|
||||
|
||||
eventBus.emit(StateEvents.GRID_RENDERED, {
|
||||
type: StateEvents.GRID_RENDERED,
|
||||
component: 'GridManager',
|
||||
timestamp: Date.now(),
|
||||
data: {
|
||||
columnCount,
|
||||
gridMode: calendarConfig.getCalendarMode(),
|
||||
domElementsCreated: [
|
||||
'swp-header-spacer',
|
||||
'swp-time-axis',
|
||||
'swp-grid-container',
|
||||
'swp-calendar-header',
|
||||
'swp-scrollable-content'
|
||||
]
|
||||
},
|
||||
metadata: {
|
||||
phase: 'rendering'
|
||||
}
|
||||
});
|
||||
|
||||
console.log('GridManager: GRID_RENDERED event emitted');
|
||||
console.log(`GridManager: Render complete - created ${columnCount} columns`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue