Adds dynamic header hiding for date groupings

Introduces hideHeader option for date grouping configurations
Enables suppressing date headers in specific views like day view
Improves calendar view flexibility by conditionally rendering headers
This commit is contained in:
Janus C. H. Knudsen 2025-12-15 22:53:44 +01:00
parent ad2df353b5
commit ee46593a5a
8 changed files with 126 additions and 10 deletions

View file

@ -43,7 +43,7 @@ export class CalendarOrchestrator {
// Resolve belongsTo relations (e.g., team.resourceIds)
const { parentChildMap, childType } = await this.resolveBelongsTo(viewConfig.groupings, filter);
const context: IRenderContext = { headerContainer, columnContainer, filter, parentChildMap, childType };
const context: IRenderContext = { headerContainer, columnContainer, filter, groupings: viewConfig.groupings, parentChildMap, childType };
// Clear
headerContainer.innerHTML = '';

View file

@ -1,7 +1,10 @@
import { GroupingConfig } from './ViewConfig';
export interface IRenderContext {
headerContainer: HTMLElement;
columnContainer: HTMLElement;
filter: Record<string, string[]>; // { team: ['alpha'], resource: ['alice', 'bob'], date: [...] }
groupings?: GroupingConfig[]; // Full grouping configs (for hideHeader etc.)
parentChildMap?: Record<string, string[]>; // { team1: ['EMP001', 'EMP002'], team2: ['EMP003', 'EMP004'] }
childType?: string; // The type of the child grouping (e.g., 'resource' when team has belongsTo)
}

View file

@ -15,4 +15,5 @@ export interface GroupingConfig {
idProperty?: string; // Property-navn på event (f.eks. 'resourceId') - kun for event matching
derivedFrom?: string; // Hvis feltet udledes fra anden property (f.eks. 'date' fra 'start')
belongsTo?: string; // Parent-child relation (f.eks. 'team.resourceIds')
hideHeader?: boolean; // Skjul header-rækken for denne grouping (f.eks. dato i day-view)
}