Refactor calendar datasource and event management
Enhances calendar flexibility by introducing group-based column spanning and improving cross-mode event handling Adds support for: - Dynamic column grouping in date and resource modes - Consistent event drag-and-drop across different calendar views - More robust all-day event layout calculations Improves event management logic to handle resource and date mode transitions more elegantly
This commit is contained in:
parent
17909696ed
commit
d8b9f6dabd
16 changed files with 192 additions and 79 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { WorkHoursManager } from '../managers/WorkHoursManager';
|
||||
import { IColumnRenderer, IColumnRenderContext } from './ColumnRenderer';
|
||||
import { DateService } from '../utils/DateService';
|
||||
|
||||
/**
|
||||
* Resource-based column renderer
|
||||
|
|
@ -10,13 +11,19 @@ import { IColumnRenderer, IColumnRenderContext } from './ColumnRenderer';
|
|||
*/
|
||||
export class ResourceColumnRenderer implements IColumnRenderer {
|
||||
private workHoursManager: WorkHoursManager;
|
||||
private dateService: DateService;
|
||||
|
||||
constructor(workHoursManager: WorkHoursManager) {
|
||||
constructor(workHoursManager: WorkHoursManager, dateService: DateService) {
|
||||
this.workHoursManager = workHoursManager;
|
||||
this.dateService = dateService;
|
||||
}
|
||||
|
||||
render(columnContainer: HTMLElement, context: IColumnRenderContext): void {
|
||||
const { columns } = context;
|
||||
const { columns, currentDate } = context;
|
||||
|
||||
if (!currentDate) {
|
||||
throw new Error('ResourceColumnRenderer requires currentDate in context');
|
||||
}
|
||||
|
||||
// Hardcoded work hours for all resources: 09:00 - 18:00
|
||||
const workHours = { start: 9, end: 18 };
|
||||
|
|
@ -25,6 +32,7 @@ export class ResourceColumnRenderer implements IColumnRenderer {
|
|||
const column = document.createElement('swp-day-column');
|
||||
|
||||
column.dataset.columnId = columnInfo.identifier;
|
||||
column.dataset.date = this.dateService.formatISODate(currentDate);
|
||||
|
||||
// Apply hardcoded work hours to all resource columns
|
||||
this.applyWorkHoursToColumn(column, workHours);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue