Some ignored filles was missing
This commit is contained in:
parent
7db22245e2
commit
fd5ab6bc0d
268 changed files with 31970 additions and 4 deletions
94
wwwroot/js/datasources/DateColumnDataSource.js
Normal file
94
wwwroot/js/datasources/DateColumnDataSource.js
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* DateColumnDataSource - Provides date-based columns
|
||||
*
|
||||
* Calculates which dates to display based on:
|
||||
* - Current date
|
||||
* - Current view (day/week/month)
|
||||
* - Workweek settings
|
||||
*/
|
||||
export class DateColumnDataSource {
|
||||
constructor(dateService, config, currentDate, currentView) {
|
||||
this.dateService = dateService;
|
||||
this.config = config;
|
||||
this.currentDate = currentDate;
|
||||
this.currentView = currentView;
|
||||
}
|
||||
/**
|
||||
* Get columns (dates) to display
|
||||
*/
|
||||
getColumns() {
|
||||
switch (this.currentView) {
|
||||
case 'week':
|
||||
return this.getWeekDates();
|
||||
case 'month':
|
||||
return this.getMonthDates();
|
||||
case 'day':
|
||||
return [this.currentDate];
|
||||
default:
|
||||
return this.getWeekDates();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get type of datasource
|
||||
*/
|
||||
getType() {
|
||||
return 'date';
|
||||
}
|
||||
/**
|
||||
* Update current date
|
||||
*/
|
||||
setCurrentDate(date) {
|
||||
this.currentDate = date;
|
||||
}
|
||||
/**
|
||||
* Update current view
|
||||
*/
|
||||
setCurrentView(view) {
|
||||
this.currentView = view;
|
||||
}
|
||||
/**
|
||||
* Get dates for week view based on workweek settings
|
||||
*/
|
||||
getWeekDates() {
|
||||
const weekStart = this.getISOWeekStart(this.currentDate);
|
||||
const workWeekSettings = this.config.getWorkWeekSettings();
|
||||
return this.dateService.getWorkWeekDates(weekStart, workWeekSettings.workDays);
|
||||
}
|
||||
/**
|
||||
* Get all dates in current month
|
||||
*/
|
||||
getMonthDates() {
|
||||
const dates = [];
|
||||
const monthStart = this.getMonthStart(this.currentDate);
|
||||
const monthEnd = this.getMonthEnd(this.currentDate);
|
||||
const totalDays = Math.ceil((monthEnd.getTime() - monthStart.getTime()) / (1000 * 60 * 60 * 24)) + 1;
|
||||
for (let i = 0; i < totalDays; i++) {
|
||||
dates.push(this.dateService.addDays(monthStart, i));
|
||||
}
|
||||
return dates;
|
||||
}
|
||||
/**
|
||||
* Get ISO week start (Monday)
|
||||
*/
|
||||
getISOWeekStart(date) {
|
||||
const weekBounds = this.dateService.getWeekBounds(date);
|
||||
return this.dateService.startOfDay(weekBounds.start);
|
||||
}
|
||||
/**
|
||||
* Get month start
|
||||
*/
|
||||
getMonthStart(date) {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth();
|
||||
return this.dateService.startOfDay(new Date(year, month, 1));
|
||||
}
|
||||
/**
|
||||
* Get month end
|
||||
*/
|
||||
getMonthEnd(date) {
|
||||
const nextMonth = this.dateService.addMonths(date, 1);
|
||||
const firstOfNextMonth = this.getMonthStart(nextMonth);
|
||||
return this.dateService.endOfDay(this.dateService.addDays(firstOfNextMonth, -1));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=DateColumnDataSource.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue