wip
This commit is contained in:
parent
e581039b62
commit
23fcaa9985
13 changed files with 900 additions and 426 deletions
|
|
@ -1,7 +1,8 @@
|
|||
import { ViewConfig, GroupingConfig } from './ViewConfig';
|
||||
import { RenderContext } from './RenderContext';
|
||||
import { RendererRegistry } from './RendererRegistry';
|
||||
import { IGroupingRenderer } from './IGroupingRenderer';
|
||||
import { IGroupingStore } from './IGroupingStore';
|
||||
import { EventRenderer } from '../features/event/EventRenderer';
|
||||
|
||||
interface HierarchyNode {
|
||||
type: string;
|
||||
|
|
@ -18,10 +19,15 @@ interface GroupingData {
|
|||
|
||||
export class CalendarOrchestrator {
|
||||
constructor(
|
||||
private rendererRegistry: RendererRegistry,
|
||||
private stores: IGroupingStore[]
|
||||
private renderers: IGroupingRenderer[],
|
||||
private stores: IGroupingStore[],
|
||||
private eventRenderer: EventRenderer
|
||||
) {}
|
||||
|
||||
private getRenderer(type: string): IGroupingRenderer | undefined {
|
||||
return this.renderers.find(r => r.type === type);
|
||||
}
|
||||
|
||||
private getStore(type: string): IGroupingStore | undefined {
|
||||
return this.stores.find(s => s.type === type);
|
||||
}
|
||||
|
|
@ -47,15 +53,17 @@ export class CalendarOrchestrator {
|
|||
|
||||
this.renderHierarchy(hierarchy, headerContainer, columnContainer);
|
||||
|
||||
const eventRenderer = this.rendererRegistry.get('event');
|
||||
eventRenderer?.render({
|
||||
headerContainer,
|
||||
columnContainer,
|
||||
values: [],
|
||||
headerRow: viewConfig.groupings.length + 1,
|
||||
columnIndex: 1,
|
||||
colspan: 1
|
||||
});
|
||||
// Render events from IndexedDB
|
||||
const visibleDates = this.extractVisibleDates(viewConfig);
|
||||
await this.eventRenderer.render(container, visibleDates);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract visible dates from view config
|
||||
*/
|
||||
private extractVisibleDates(viewConfig: ViewConfig): string[] {
|
||||
const dateGrouping = viewConfig.groupings.find(g => g.type === 'date');
|
||||
return dateGrouping?.values || [];
|
||||
}
|
||||
|
||||
private fetchAllData(groupings: GroupingConfig[]): Map<string, GroupingData> {
|
||||
|
|
@ -132,7 +140,7 @@ export class CalendarOrchestrator {
|
|||
headerRow = 1
|
||||
): void {
|
||||
for (const node of nodes) {
|
||||
const renderer = this.rendererRegistry.get(node.type);
|
||||
const renderer = this.getRenderer(node.type);
|
||||
const colspan = this.countLeaves([node]) || 1;
|
||||
|
||||
renderer?.render({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue