@primeui/scheduler-core 0.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +1 -0
  3. package/dist/calendar/index.d.mts +57 -0
  4. package/dist/calendar/index.mjs +1 -0
  5. package/dist/chunk-2B3YLWHA.mjs +196 -0
  6. package/dist/chunk-2THQAZ26.mjs +1669 -0
  7. package/dist/chunk-5KORIWDT.mjs +41 -0
  8. package/dist/chunk-5N4ZOBJV.mjs +866 -0
  9. package/dist/chunk-6OZAPQZ5.mjs +229 -0
  10. package/dist/chunk-6PK5WSKT.mjs +369 -0
  11. package/dist/chunk-6VYWVIGM.mjs +1170 -0
  12. package/dist/chunk-AAVM7UCG.mjs +100 -0
  13. package/dist/chunk-C7ADJGNV.mjs +157 -0
  14. package/dist/chunk-DYW6WUHE.mjs +277 -0
  15. package/dist/chunk-F5W5HD7S.mjs +285 -0
  16. package/dist/chunk-FIBAZFC4.mjs +871 -0
  17. package/dist/chunk-HPC5B3AR.mjs +558 -0
  18. package/dist/chunk-KQGRXTP5.mjs +650 -0
  19. package/dist/chunk-NMX4BW42.mjs +672 -0
  20. package/dist/chunk-NX46LPLF.mjs +440 -0
  21. package/dist/chunk-NZGJN7HG.mjs +314 -0
  22. package/dist/chunk-QDMZBJDV.mjs +251 -0
  23. package/dist/chunk-QR2SVYAD.mjs +1144 -0
  24. package/dist/chunk-SYJ5O4KH.mjs +136 -0
  25. package/dist/chunk-TNKJPFGI.mjs +569 -0
  26. package/dist/chunk-UMAMDBU4.mjs +1 -0
  27. package/dist/chunk-W2SJW3QQ.mjs +3925 -0
  28. package/dist/chunk-WFUJWDST.mjs +352 -0
  29. package/dist/chunk-XUBQ2IQS.mjs +1 -0
  30. package/dist/chunk-ZUKUKGNK.mjs +613 -0
  31. package/dist/controllers/index.d.mts +384 -0
  32. package/dist/controllers/index.mjs +13 -0
  33. package/dist/date-D_CjQPmM.d.mts +74 -0
  34. package/dist/display-format-CLVvRt4I.d.mts +57 -0
  35. package/dist/event/index.d.mts +267 -0
  36. package/dist/event/index.mjs +8 -0
  37. package/dist/event-surface-_R_LHD95.d.mts +21 -0
  38. package/dist/event.positioning-BdzAVPk7.d.mts +51 -0
  39. package/dist/event.utils-QSNdd-3W.d.mts +35 -0
  40. package/dist/index.d.mts +1128 -0
  41. package/dist/index.mjs +1022 -0
  42. package/dist/interaction/index.d.mts +442 -0
  43. package/dist/interaction/index.mjs +9 -0
  44. package/dist/month/index.d.mts +104 -0
  45. package/dist/month/index.mjs +6 -0
  46. package/dist/overlay-BYM9B6nC.d.mts +64 -0
  47. package/dist/resource/index.d.mts +172 -0
  48. package/dist/resource/index.mjs +1 -0
  49. package/dist/selection-CO_98HdS.d.mts +56 -0
  50. package/dist/time-grid/index.d.mts +92 -0
  51. package/dist/time-grid/index.mjs +13 -0
  52. package/dist/timeline/index.d.mts +165 -0
  53. package/dist/timeline/index.mjs +6 -0
  54. package/dist/touch-BhsMWsjf.d.mts +69 -0
  55. package/dist/utils/index.d.mts +494 -0
  56. package/dist/utils/index.mjs +17 -0
  57. package/dist/views/index.d.mts +51 -0
  58. package/dist/views/index.mjs +8 -0
  59. package/dist/views/timeline/index.d.mts +37 -0
  60. package/dist/views/timeline/index.mjs +4 -0
  61. package/dist/year/index.d.mts +70 -0
  62. package/dist/year/index.mjs +6 -0
  63. package/package.json +58 -0
@@ -0,0 +1,613 @@
1
+ import { buildMonthGridViewModel } from './chunk-6PK5WSKT.mjs';
2
+ import { buildYearGridViewModel } from './chunk-6OZAPQZ5.mjs';
3
+ import { timelineMonthView, timelineWeekView, timelineDayView, timelineYearView } from './chunk-NMX4BW42.mjs';
4
+ import { getDatePartsInTimezone } from './chunk-QDMZBJDV.mjs';
5
+ import { startOfDay, addDays, isToday, formatWeekdayName, toDateString, isSameDay, addWeeks, startOfWeek, formatMonthYearTitle, isWeekend, getWeekdayNames, timeStringToMinutes, addMonths, addYears, formatGregorianYear, formatGregorianMonthTitle } from './chunk-WFUJWDST.mjs';
6
+ import { createSchedulerDateFormatter, formatTimeRange, formatTime, formatSlotTime } from './chunk-TNKJPFGI.mjs';
7
+ import { getSchedulerCalendarAdapter } from './chunk-DYW6WUHE.mjs';
8
+
9
+ // src/views/agenda.view.ts
10
+ var agendaView = {
11
+ name: "agenda",
12
+ getTitle(date, locale) {
13
+ const options = {
14
+ month: "long",
15
+ year: "numeric"
16
+ };
17
+ return createSchedulerDateFormatter({ locale }).format(date, options);
18
+ },
19
+ getDateRange(date) {
20
+ const start = startOfDay(date);
21
+ const end = addDays(start, 30);
22
+ return { start, end };
23
+ },
24
+ navigate(date, direction) {
25
+ return addDays(date, direction * 30);
26
+ },
27
+ navigateToDate(target) {
28
+ return startOfDay(target);
29
+ }
30
+ };
31
+ function getAgendaViewData(date, options) {
32
+ const { locale, events, agendaDays = 30, showEmptyDays = false, calendar, numberingSystem } = options;
33
+ const displayConfig = { calendar, numberingSystem };
34
+ const startDate = startOfDay(date);
35
+ const endDate = addDays(startDate, agendaDays - 1);
36
+ const days = [];
37
+ let currentDate = new Date(startDate);
38
+ for (let i = 0; i < agendaDays; i++) {
39
+ const dayEvents = getEventsForDay(currentDate, events);
40
+ if (showEmptyDays || dayEvents.length > 0) {
41
+ days.push({
42
+ date: new Date(currentDate),
43
+ dateStr: toDateString(currentDate),
44
+ dayName: formatWeekdayName(currentDate, locale, "long", displayConfig),
45
+ isToday: isToday(currentDate),
46
+ events: sortEventsByTime(dayEvents)
47
+ });
48
+ }
49
+ currentDate = addDays(currentDate, 1);
50
+ }
51
+ return {
52
+ days,
53
+ startDate,
54
+ endDate
55
+ };
56
+ }
57
+ function getEventsForDay(date, events) {
58
+ return events.filter((event) => {
59
+ const eventStart = typeof event.start === "string" ? new Date(event.start) : event.start;
60
+ return isSameDay(eventStart, date);
61
+ });
62
+ }
63
+ function sortEventsByTime(events) {
64
+ return [...events].sort((a, b) => {
65
+ if (a.allDay && !b.allDay) return -1;
66
+ if (!a.allDay && b.allDay) return 1;
67
+ const startA = typeof a.start === "string" ? new Date(a.start) : a.start;
68
+ const startB = typeof b.start === "string" ? new Date(b.start) : b.start;
69
+ return startA.getTime() - startB.getTime();
70
+ });
71
+ }
72
+ function formatEventTime(event, locale, options, timeZone) {
73
+ if (event.allDay) {
74
+ return "All day";
75
+ }
76
+ const start = typeof event.start === "string" ? new Date(event.start) : event.start;
77
+ if (event.end) {
78
+ const end = typeof event.end === "string" ? new Date(event.end) : event.end;
79
+ return formatTimeRange(start, end, locale, options, timeZone);
80
+ }
81
+ return formatTime(start, locale, options, timeZone);
82
+ }
83
+
84
+ // src/views/week.view.ts
85
+ var weekView = {
86
+ name: "week",
87
+ getTitle(date, locale) {
88
+ const weekStart = startOfWeek(date, 0);
89
+ const weekEnd = addDays(weekStart, 6);
90
+ if (weekStart.getMonth() === weekEnd.getMonth()) {
91
+ return formatMonthYearTitle(weekStart, locale);
92
+ }
93
+ const formatter = createSchedulerDateFormatter({ locale });
94
+ const startMonth = formatter.formatMonth(weekStart, "short");
95
+ const endMonth = formatter.format(weekEnd, { month: "short", year: "numeric" });
96
+ return `${startMonth} - ${endMonth}`;
97
+ },
98
+ getDateRange(date, options) {
99
+ const weekStart = startOfWeek(date, options.firstDayOfWeek);
100
+ const weekEnd = addDays(weekStart, 6);
101
+ return { start: weekStart, end: weekEnd };
102
+ },
103
+ navigate(date, direction) {
104
+ return addWeeks(date, direction);
105
+ },
106
+ navigateToDate(target) {
107
+ return new Date(target);
108
+ }
109
+ };
110
+ function getWeekViewData(date, options) {
111
+ const { locale, firstDayOfWeek, slotDuration, slotMinTime, slotMaxTime, events, daysOfWeek, numberOfDays, timeFormat, dateDisplay, timezone, calendar, numberingSystem } = options;
112
+ const displayConfig = { calendar, numberingSystem };
113
+ const weekdayFormat = dateDisplay?.weekdayFormat || "short";
114
+ const totalDays = numberOfDays ?? 7;
115
+ const startDate = numberOfDays ? date : startOfWeek(date, firstDayOfWeek);
116
+ const activeDays = daysOfWeek ?? [0, 1, 2, 3, 4, 5, 6];
117
+ const columns = [];
118
+ const allDayEvents = [];
119
+ for (let i = 0; i < totalDays; i++) {
120
+ const columnDate = addDays(startDate, i);
121
+ const dayOfWeek = columnDate.getDay();
122
+ if (!activeDays.includes(dayOfWeek)) continue;
123
+ const dayEvents = getEventsForDay2(columnDate, events);
124
+ const dayAllDayEvents = dayEvents.filter((e) => e.allDay);
125
+ const timedEvents = dayEvents.filter((e) => !e.allDay);
126
+ columns.push({
127
+ date: columnDate,
128
+ dayName: formatWeekdayName(columnDate, locale, weekdayFormat, displayConfig),
129
+ dayNumber: columnDate.getDate(),
130
+ isToday: isToday(columnDate),
131
+ isWeekend: isWeekend(columnDate),
132
+ events: timedEvents,
133
+ allDayEvents: dayAllDayEvents
134
+ });
135
+ allDayEvents.push(...dayAllDayEvents.filter((e) => !allDayEvents.some((existing) => existing.id === e.id)));
136
+ }
137
+ const timeSlots = generateTimeSlots(slotMinTime, slotMaxTime, slotDuration, date, locale, timeFormat, timezone);
138
+ const visibleWeekdayNames = numberOfDays || activeDays.length !== 7 ? columns.map((col) => col.dayName) : getWeekdayNames(locale, weekdayFormat, firstDayOfWeek, displayConfig);
139
+ return {
140
+ columns,
141
+ timeSlots,
142
+ allDayEvents,
143
+ weekdayNames: visibleWeekdayNames
144
+ };
145
+ }
146
+ function getCustomRangeTitle(date, numberOfDays, locale, displayConfig) {
147
+ const startDate = date;
148
+ const endDate = addDays(date, numberOfDays - 1);
149
+ const formatter = createSchedulerDateFormatter({ ...displayConfig, locale });
150
+ const formatOptions = { month: "short", day: "numeric" };
151
+ if (startDate.getMonth() === endDate.getMonth()) {
152
+ const monthYear = formatter.format(startDate, { month: "short", year: "numeric" });
153
+ return `${formatter.formatDayNumber(startDate)}-${formatter.formatDayNumber(endDate)} ${monthYear}`;
154
+ }
155
+ if (startDate.getFullYear() === endDate.getFullYear()) {
156
+ const start2 = formatter.format(startDate, formatOptions);
157
+ const end2 = formatter.format(endDate, { ...formatOptions, year: "numeric" });
158
+ return `${start2} - ${end2}`;
159
+ }
160
+ const start = formatter.format(startDate, { ...formatOptions, year: "numeric" });
161
+ const end = formatter.format(endDate, { ...formatOptions, year: "numeric" });
162
+ return `${start} - ${end}`;
163
+ }
164
+ function generateTimeSlots(minTime, maxTime, slotDuration, date, locale, timeFormat, timeZone) {
165
+ const slots = [];
166
+ const minMinutes = timeStringToMinutes(minTime);
167
+ const maxMinutes = timeStringToMinutes(maxTime);
168
+ const year = date.getFullYear();
169
+ const month = date.getMonth();
170
+ const day = date.getDate();
171
+ for (let minutes = minMinutes; minutes < maxMinutes; minutes += slotDuration) {
172
+ const hours = Math.floor(minutes / 60);
173
+ const mins = minutes % 60;
174
+ const slotDate = new Date(year, month, day, hours, mins);
175
+ const isHourStart = mins === 0;
176
+ const isHourEnd = (minutes + slotDuration) % 60 === 0;
177
+ slots.push({
178
+ time: slotDate,
179
+ timeString: `${String(hours).padStart(2, "0")}:${String(mins).padStart(2, "0")}`,
180
+ label: isHourStart ? formatSlotTime(slotDate, locale, timeFormat, timeZone) : "",
181
+ minutes,
182
+ isHour: isHourEnd
183
+ });
184
+ }
185
+ return slots;
186
+ }
187
+ function getNowIndicatorPosition(slotMinTime, slotMaxTime, slotDuration, slotHeight, timezone) {
188
+ const now = /* @__PURE__ */ new Date();
189
+ let currentMinutes;
190
+ if (timezone) {
191
+ const parts = getDatePartsInTimezone(now, timezone);
192
+ currentMinutes = parts.hour * 60 + parts.minute;
193
+ } else {
194
+ currentMinutes = now.getHours() * 60 + now.getMinutes();
195
+ }
196
+ const minMinutes = timeStringToMinutes(slotMinTime);
197
+ const maxMinutes = timeStringToMinutes(slotMaxTime);
198
+ if (currentMinutes < minMinutes || currentMinutes >= maxMinutes) {
199
+ return { top: 0, visible: false };
200
+ }
201
+ const totalSlots = (maxMinutes - minMinutes) / slotDuration;
202
+ const currentSlot = (currentMinutes - minMinutes) / slotDuration;
203
+ const top = currentSlot / totalSlots * totalSlots * slotHeight;
204
+ const visualSlots = Math.floor((maxMinutes - minMinutes) / slotDuration);
205
+ const maxTop = visualSlots * slotHeight - 2;
206
+ const clampedTop = Math.min(top, maxTop);
207
+ return { top: clampedTop, visible: true };
208
+ }
209
+ function getEventTopPosition(event, slotMinTime, slotDuration, slotHeight) {
210
+ const eventStart = typeof event.start === "string" ? new Date(event.start) : event.start;
211
+ const eventMinutes = eventStart.getHours() * 60 + eventStart.getMinutes();
212
+ const minMinutes = timeStringToMinutes(slotMinTime);
213
+ const offsetMinutes = eventMinutes - minMinutes;
214
+ return offsetMinutes / slotDuration * slotHeight;
215
+ }
216
+ function getEventHeight(event, slotDuration, slotHeight) {
217
+ const eventStart = typeof event.start === "string" ? new Date(event.start) : event.start;
218
+ const eventEnd = event.end ? typeof event.end === "string" ? new Date(event.end) : event.end : new Date(eventStart.getTime() + 60 * 60 * 1e3);
219
+ const durationMinutes = (eventEnd.getTime() - eventStart.getTime()) / (1e3 * 60);
220
+ return Math.max(durationMinutes / slotDuration * slotHeight, slotHeight / 2);
221
+ }
222
+ function getEventsForDay2(date, events) {
223
+ return events.filter((event) => {
224
+ const eventStart = typeof event.start === "string" ? new Date(event.start) : event.start;
225
+ const eventEnd = event.end ? typeof event.end === "string" ? new Date(event.end) : event.end : eventStart;
226
+ if (event.allDay) {
227
+ const dayStart = new Date(date);
228
+ dayStart.setHours(0, 0, 0, 0);
229
+ const dayEnd = new Date(date);
230
+ dayEnd.setHours(23, 59, 59, 999);
231
+ return eventStart <= dayEnd && eventEnd >= dayStart;
232
+ }
233
+ return isSameDay(eventStart, date);
234
+ });
235
+ }
236
+
237
+ // src/views/day.view.ts
238
+ var dayView = {
239
+ name: "day",
240
+ getTitle(date, locale) {
241
+ const options = {
242
+ weekday: "long",
243
+ month: "long",
244
+ day: "numeric",
245
+ year: "numeric"
246
+ };
247
+ return createSchedulerDateFormatter({ locale }).format(date, options);
248
+ },
249
+ getDateRange(date) {
250
+ const dayStart = new Date(date);
251
+ dayStart.setHours(0, 0, 0, 0);
252
+ const dayEnd = new Date(date);
253
+ dayEnd.setHours(23, 59, 59, 999);
254
+ return { start: dayStart, end: dayEnd };
255
+ },
256
+ navigate(date, direction) {
257
+ return addDays(date, direction);
258
+ },
259
+ navigateToDate(target) {
260
+ return new Date(target);
261
+ }
262
+ };
263
+ function getDayViewData(date, options) {
264
+ const { locale, slotDuration, slotMinTime, slotMaxTime, events, timeFormat, dateDisplay, timezone, calendar, numberingSystem } = options;
265
+ const displayConfig = { calendar, numberingSystem };
266
+ const weekdayFormat = dateDisplay?.weekdayFormat || "long";
267
+ const dayEvents = getEventsForDay3(date, events);
268
+ const allDayEvents = dayEvents.filter((e) => e.allDay);
269
+ const timedEvents = dayEvents.filter((e) => !e.allDay);
270
+ const timeSlots = generateTimeSlots(slotMinTime, slotMaxTime, slotDuration, date, locale, timeFormat, timezone);
271
+ return {
272
+ date,
273
+ dayName: formatWeekdayName(date, locale, weekdayFormat, displayConfig),
274
+ dayNumber: date.getDate(),
275
+ isToday: isToday(date),
276
+ timeSlots,
277
+ events: timedEvents,
278
+ allDayEvents
279
+ };
280
+ }
281
+ function getEventsForDay3(date, events) {
282
+ return events.filter((event) => {
283
+ const eventStart = typeof event.start === "string" ? new Date(event.start) : event.start;
284
+ const eventEnd = event.end ? typeof event.end === "string" ? new Date(event.end) : event.end : eventStart;
285
+ if (event.allDay) {
286
+ const dayStart = new Date(date);
287
+ dayStart.setHours(0, 0, 0, 0);
288
+ const dayEnd = new Date(date);
289
+ dayEnd.setHours(23, 59, 59, 999);
290
+ return eventStart <= dayEnd && eventEnd >= dayStart;
291
+ }
292
+ return isSameDay(eventStart, date);
293
+ });
294
+ }
295
+
296
+ // src/views/month.view.ts
297
+ var monthView = {
298
+ name: "month",
299
+ getTitle(date, locale) {
300
+ return formatMonthYearTitle(date, locale);
301
+ },
302
+ getDateRange(date, options) {
303
+ const calendarAdapter = getSchedulerCalendarAdapter(options.calendar, { locale: options.locale });
304
+ const monthStart = calendarAdapter.startOfMonth(calendarAdapter.fromDate(date));
305
+ const gridStart = calendarAdapter.startOfWeek(monthStart, options.firstDayOfWeek);
306
+ const gridEnd = calendarAdapter.add(gridStart, { days: 41 });
307
+ return { start: calendarAdapter.toDate(gridStart), end: calendarAdapter.toDate(gridEnd) };
308
+ },
309
+ navigate(date, direction) {
310
+ return addMonths(date, direction);
311
+ },
312
+ navigateToDate(target) {
313
+ return new Date(target);
314
+ }
315
+ };
316
+ function getMonthViewData(date, options) {
317
+ const { locale, firstDayOfWeek, minDate, maxDate, events, weekNumbering, calendar, numberingSystem } = options;
318
+ const displayConfig = { calendar, numberingSystem };
319
+ const model = buildMonthGridViewModel({
320
+ currentDate: date,
321
+ firstDayOfWeek,
322
+ events,
323
+ locale,
324
+ calendar,
325
+ numberingSystem,
326
+ weekNumbering,
327
+ minDate,
328
+ maxDate,
329
+ maxVisibleRows: Number.MAX_SAFE_INTEGER
330
+ });
331
+ const weeks = model.weeks.map((week) => ({
332
+ weekNumber: week.weekNumber,
333
+ days: week.days.map(
334
+ (day) => ({
335
+ date: day.date,
336
+ dayOfMonth: day.dayOfMonth,
337
+ dayOfMonthLabel: day.dayOfMonthLabel,
338
+ dayNumberLabel: day.dayNumberLabel,
339
+ isCurrentMonth: day.isCurrentMonth,
340
+ isToday: day.isToday,
341
+ isWeekend: day.isWeekend,
342
+ isDisabled: day.isDisabled,
343
+ events: day.events
344
+ })
345
+ )
346
+ }));
347
+ return {
348
+ weeks,
349
+ weekdayNames: getWeekdayNames(locale, "short", firstDayOfWeek, displayConfig)
350
+ };
351
+ }
352
+
353
+ // src/views/year.view.ts
354
+ var yearView = {
355
+ name: "year",
356
+ getTitle(date, locale) {
357
+ return formatGregorianYear(date, locale);
358
+ },
359
+ getDateRange(date, options) {
360
+ const calendarAdapter = getSchedulerCalendarAdapter(options.calendar, { locale: options.locale });
361
+ const calendarDate = calendarAdapter.fromDate(date);
362
+ const yearStart = calendarAdapter.toDate(calendarAdapter.startOfMonth({ ...calendarDate, month: 1 }));
363
+ const yearEnd = calendarAdapter.toDate(calendarAdapter.endOfMonth({ ...calendarDate, month: calendarAdapter.getMonthsInYear(calendarDate), day: 1 }));
364
+ return { start: yearStart, end: yearEnd };
365
+ },
366
+ navigate(date, direction) {
367
+ return addYears(date, direction);
368
+ },
369
+ navigateToDate(target) {
370
+ return new Date(target.getFullYear(), 0, 1);
371
+ }
372
+ };
373
+ function getYearViewData(date, options) {
374
+ const { locale, firstDayOfWeek, minDate, maxDate, events, calendar, numberingSystem } = options;
375
+ const model = buildYearGridViewModel({
376
+ currentDate: date,
377
+ firstDayOfWeek,
378
+ events,
379
+ locale,
380
+ calendar,
381
+ numberingSystem,
382
+ minDate,
383
+ maxDate
384
+ });
385
+ const months = model.months.map((month) => ({
386
+ date: month.date,
387
+ name: month.name,
388
+ shortName: formatGregorianMonthTitle(month.date, locale, { month: "short", year: void 0 }, { calendar, numberingSystem }),
389
+ monthIndex: month.monthIndex,
390
+ weeks: month.weeks.map((week) => ({
391
+ days: week.days.map(
392
+ (day) => ({
393
+ date: day.date,
394
+ dayOfMonth: day.dayOfMonth,
395
+ dayOfMonthLabel: day.dayOfMonthLabel,
396
+ dayNumberLabel: day.dayNumberLabel,
397
+ isCurrentMonth: day.isCurrentMonth,
398
+ isToday: day.isToday,
399
+ isWeekend: day.isWeekend,
400
+ hasEvents: day.hasEvents,
401
+ eventCount: day.eventCount,
402
+ isDisabled: day.isDisabled
403
+ })
404
+ )
405
+ }))
406
+ }));
407
+ return {
408
+ year: model.year,
409
+ yearLabel: model.yearLabel,
410
+ months
411
+ };
412
+ }
413
+ function getYearViewWeekdayNames(locale, firstDayOfWeek, displayConfig) {
414
+ return getWeekdayNames(locale, "narrow", firstDayOfWeek, displayConfig);
415
+ }
416
+
417
+ // src/views/resource-day.view.ts
418
+ var resourceDayView = {
419
+ name: "resourceDay",
420
+ getTitle(date, locale) {
421
+ const options = {
422
+ weekday: "long",
423
+ month: "long",
424
+ day: "numeric",
425
+ year: "numeric"
426
+ };
427
+ return createSchedulerDateFormatter({ locale }).format(date, options);
428
+ },
429
+ getDateRange(date) {
430
+ const dayStart = new Date(date);
431
+ dayStart.setHours(0, 0, 0, 0);
432
+ const dayEnd = new Date(date);
433
+ dayEnd.setHours(23, 59, 59, 999);
434
+ return { start: dayStart, end: dayEnd };
435
+ },
436
+ navigate(date, direction) {
437
+ return addDays(date, direction);
438
+ },
439
+ navigateToDate(target) {
440
+ return new Date(target);
441
+ }
442
+ };
443
+ function getResourceDayViewData(date, options) {
444
+ const { locale, slotDuration, slotMinTime, slotMaxTime, events, resources, timeFormat, timezone, calendar, numberingSystem } = options;
445
+ const displayConfig = { calendar, numberingSystem };
446
+ const timeSlots = generateTimeSlots(slotMinTime, slotMaxTime, slotDuration, date, locale, timeFormat, timezone);
447
+ const resourceColumns = [];
448
+ for (const resource of resources) {
449
+ const resourceEvents = getEventsForResourceAndDay(date, resource.id, events);
450
+ const allDayEvents = resourceEvents.filter((e) => e.allDay);
451
+ const timedEvents = resourceEvents.filter((e) => !e.allDay);
452
+ resourceColumns.push({
453
+ resourceId: resource.id,
454
+ resourceTitle: resource.title,
455
+ resourceColor: resource.eventColor,
456
+ date,
457
+ dayName: formatWeekdayName(date, locale, "long", displayConfig),
458
+ dayNumber: date.getDate(),
459
+ isToday: isToday(date),
460
+ events: timedEvents,
461
+ allDayEvents
462
+ });
463
+ }
464
+ return {
465
+ date,
466
+ dayName: formatWeekdayName(date, locale, "long", displayConfig),
467
+ dayNumber: date.getDate(),
468
+ isToday: isToday(date),
469
+ resources: resourceColumns,
470
+ timeSlots
471
+ };
472
+ }
473
+ function getEventsForResourceAndDay(date, resourceId, events) {
474
+ return events.filter((event) => {
475
+ const eventResourceId = event.resourceId;
476
+ const eventResourceIds = event.resourceIds;
477
+ const matchesResource = eventResourceId === resourceId || eventResourceIds && eventResourceIds.includes(resourceId);
478
+ if (!matchesResource) {
479
+ return false;
480
+ }
481
+ const eventStart = typeof event.start === "string" ? new Date(event.start) : event.start;
482
+ const eventEnd = event.end ? typeof event.end === "string" ? new Date(event.end) : event.end : eventStart;
483
+ if (event.allDay) {
484
+ const dayStart = new Date(date);
485
+ dayStart.setHours(0, 0, 0, 0);
486
+ const dayEnd = new Date(date);
487
+ dayEnd.setHours(23, 59, 59, 999);
488
+ return eventStart <= dayEnd && eventEnd >= dayStart;
489
+ }
490
+ return isSameDay(eventStart, date);
491
+ });
492
+ }
493
+
494
+ // src/views/resource-week.view.ts
495
+ var resourceWeekView = {
496
+ name: "resourceWeek",
497
+ getTitle(date, locale) {
498
+ const weekStart = startOfWeek(date, 0);
499
+ const weekEnd = addDays(weekStart, 6);
500
+ if (weekStart.getMonth() === weekEnd.getMonth()) {
501
+ return formatMonthYearTitle(weekStart, locale);
502
+ }
503
+ const formatter = createSchedulerDateFormatter({ locale });
504
+ const startMonth = formatter.formatMonth(weekStart, "short");
505
+ const endMonth = formatter.format(weekEnd, { month: "short", year: "numeric" });
506
+ return `${startMonth} - ${endMonth}`;
507
+ },
508
+ getDateRange(date, options) {
509
+ const weekStart = startOfWeek(date, options.firstDayOfWeek);
510
+ const weekEnd = addDays(weekStart, 6);
511
+ return { start: weekStart, end: weekEnd };
512
+ },
513
+ navigate(date, direction) {
514
+ return addWeeks(date, direction);
515
+ },
516
+ navigateToDate(target) {
517
+ return new Date(target);
518
+ }
519
+ };
520
+ function getResourceWeekViewData(date, options) {
521
+ const { locale, firstDayOfWeek, slotDuration, slotMinTime, slotMaxTime, events, resources, daysOfWeek, timeFormat, timezone, calendar, numberingSystem } = options;
522
+ const displayConfig = { calendar, numberingSystem };
523
+ const weekStart = startOfWeek(date, firstDayOfWeek);
524
+ const activeDays = daysOfWeek ?? [0, 1, 2, 3, 4, 5, 6];
525
+ const timeSlots = generateTimeSlots(slotMinTime, slotMaxTime, slotDuration, date, locale, timeFormat, timezone);
526
+ const resourceColumns = [];
527
+ for (const resource of resources) {
528
+ const days = [];
529
+ for (let i = 0; i < 7; i++) {
530
+ const columnDate = addDays(weekStart, i);
531
+ const dayOfWeek = columnDate.getDay();
532
+ if (!activeDays.includes(dayOfWeek)) continue;
533
+ const dayEvents = getEventsForResourceAndDay2(columnDate, resource.id, events);
534
+ const dayAllDayEvents = dayEvents.filter((e) => e.allDay);
535
+ const timedEvents = dayEvents.filter((e) => !e.allDay);
536
+ days.push({
537
+ date: columnDate,
538
+ dayName: formatWeekdayName(columnDate, locale, "short", displayConfig),
539
+ dayNumber: columnDate.getDate(),
540
+ isToday: isToday(columnDate),
541
+ isWeekend: isWeekend(columnDate),
542
+ events: timedEvents,
543
+ allDayEvents: dayAllDayEvents
544
+ });
545
+ }
546
+ resourceColumns.push({
547
+ resourceId: resource.id,
548
+ resourceTitle: resource.title,
549
+ resourceColor: resource.eventColor,
550
+ days
551
+ });
552
+ }
553
+ const visibleWeekdayNames = activeDays.length === 7 ? getWeekdayNames(locale, "short", firstDayOfWeek, displayConfig) : resourceColumns[0]?.days.map((d) => d.dayName) ?? [];
554
+ return {
555
+ resources: resourceColumns,
556
+ timeSlots,
557
+ weekdayNames: visibleWeekdayNames
558
+ };
559
+ }
560
+ function getEventsForResourceAndDay2(date, resourceId, events) {
561
+ return events.filter((event) => {
562
+ const eventResourceId = event.resourceId;
563
+ const eventResourceIds = event.resourceIds;
564
+ const matchesResource = eventResourceId === resourceId || eventResourceIds && eventResourceIds.includes(resourceId);
565
+ if (!matchesResource) {
566
+ return false;
567
+ }
568
+ const eventStart = typeof event.start === "string" ? new Date(event.start) : event.start;
569
+ const eventEnd = event.end ? typeof event.end === "string" ? new Date(event.end) : event.end : eventStart;
570
+ if (event.allDay) {
571
+ const dayStart = new Date(date);
572
+ dayStart.setHours(0, 0, 0, 0);
573
+ const dayEnd = new Date(date);
574
+ dayEnd.setHours(23, 59, 59, 999);
575
+ return eventStart <= dayEnd && eventEnd >= dayStart;
576
+ }
577
+ return isSameDay(eventStart, date);
578
+ });
579
+ }
580
+
581
+ // src/views/index.ts
582
+ var viewRegistry = {
583
+ month: monthView,
584
+ week: weekView,
585
+ day: dayView,
586
+ year: yearView,
587
+ agenda: agendaView,
588
+ timelineDay: timelineDayView,
589
+ timelineWeek: timelineWeekView,
590
+ timelineMonth: timelineMonthView,
591
+ timelineYear: timelineYearView,
592
+ resourceTimelineDay: timelineDayView,
593
+ resourceTimelineWeek: timelineWeekView,
594
+ resourceTimelineMonth: timelineMonthView,
595
+ resourceDay: resourceDayView,
596
+ resourceWeek: resourceWeekView,
597
+ resourceMonth: monthView,
598
+ dateDay: dayView,
599
+ dateWeek: weekView,
600
+ dateMonth: monthView
601
+ };
602
+ function getView(viewType) {
603
+ const view = viewRegistry[viewType];
604
+ if (!view) {
605
+ throw new Error(`Unknown view type: ${viewType}`);
606
+ }
607
+ return view;
608
+ }
609
+ function getAvailableViews() {
610
+ return Object.keys(viewRegistry);
611
+ }
612
+
613
+ export { agendaView, dayView, formatEventTime, generateTimeSlots, getAgendaViewData, getAvailableViews, getCustomRangeTitle, getDayViewData, getEventHeight, getEventTopPosition, getMonthViewData, getNowIndicatorPosition, getResourceDayViewData, getResourceWeekViewData, getView, getWeekViewData, getYearViewData, getYearViewWeekdayNames, monthView, resourceDayView, resourceWeekView, viewRegistry, weekView, yearView };