@mantine/schedule 9.6.0 → 9.6.2

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 (98) hide show
  1. package/cjs/components/DayView/DayView.cjs +48 -20
  2. package/cjs/components/DayView/DayView.cjs.map +1 -1
  3. package/cjs/components/DayView/DayView.module.cjs +3 -2
  4. package/cjs/components/DayView/DayView.module.cjs.map +1 -1
  5. package/cjs/components/DayView/get-day-view-events/get-day-positioned-events.cjs +12 -7
  6. package/cjs/components/DayView/get-day-view-events/get-day-positioned-events.cjs.map +1 -1
  7. package/cjs/components/DayView/get-day-view-events/get-day-view-events.cjs +3 -2
  8. package/cjs/components/DayView/get-day-view-events/get-day-view-events.cjs.map +1 -1
  9. package/cjs/components/MobileMonthView/MobileMonthView.cjs +1 -1
  10. package/cjs/components/MobileMonthView/MobileMonthView.cjs.map +1 -1
  11. package/cjs/components/ResourcesDayView/ResourcesDayView.cjs +40 -15
  12. package/cjs/components/ResourcesDayView/ResourcesDayView.cjs.map +1 -1
  13. package/cjs/components/ResourcesDayView/ResourcesDayView.module.cjs.map +1 -1
  14. package/cjs/components/ResourcesSchedule/ResourcesSchedule.cjs.map +1 -1
  15. package/cjs/components/ResourcesWeekView/ResourcesWeekView.cjs +46 -16
  16. package/cjs/components/ResourcesWeekView/ResourcesWeekView.cjs.map +1 -1
  17. package/cjs/components/ResourcesWeekView/ResourcesWeekView.module.cjs.map +1 -1
  18. package/cjs/components/Schedule/Schedule.cjs.map +1 -1
  19. package/cjs/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.cjs +18 -3
  20. package/cjs/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.cjs.map +1 -1
  21. package/cjs/components/ScheduleEvent/ScheduleEvent.module.cjs.map +1 -1
  22. package/cjs/components/WeekView/WeekView.cjs +47 -17
  23. package/cjs/components/WeekView/WeekView.cjs.map +1 -1
  24. package/cjs/components/WeekView/WeekView.module.cjs +3 -2
  25. package/cjs/components/WeekView/WeekView.module.cjs.map +1 -1
  26. package/cjs/components/WeekView/get-week-view-events/get-week-positioned-events.cjs +4 -2
  27. package/cjs/components/WeekView/get-week-view-events/get-week-positioned-events.cjs.map +1 -1
  28. package/cjs/hooks/use-event-resize.cjs +7 -4
  29. package/cjs/hooks/use-event-resize.cjs.map +1 -1
  30. package/cjs/hooks/use-horizontal-event-resize.cjs +7 -4
  31. package/cjs/hooks/use-horizontal-event-resize.cjs.map +1 -1
  32. package/cjs/index.cjs +4 -0
  33. package/cjs/utils/apply-cascade-layout/apply-cascade-layout.cjs +21 -0
  34. package/cjs/utils/apply-cascade-layout/apply-cascade-layout.cjs.map +1 -0
  35. package/cjs/{components/ResourcesDayView → utils}/get-overlap-clusters/get-overlap-clusters.cjs +2 -2
  36. package/cjs/utils/get-overlap-clusters/get-overlap-clusters.cjs.map +1 -0
  37. package/cjs/utils/is-event-in-time-range/is-event-in-time-range.cjs +2 -1
  38. package/cjs/utils/is-event-in-time-range/is-event-in-time-range.cjs.map +1 -1
  39. package/esm/components/DayView/DayView.mjs +48 -20
  40. package/esm/components/DayView/DayView.mjs.map +1 -1
  41. package/esm/components/DayView/DayView.module.mjs +3 -2
  42. package/esm/components/DayView/DayView.module.mjs.map +1 -1
  43. package/esm/components/DayView/get-day-view-events/get-day-positioned-events.mjs +12 -7
  44. package/esm/components/DayView/get-day-view-events/get-day-positioned-events.mjs.map +1 -1
  45. package/esm/components/DayView/get-day-view-events/get-day-view-events.mjs +3 -2
  46. package/esm/components/DayView/get-day-view-events/get-day-view-events.mjs.map +1 -1
  47. package/esm/components/MobileMonthView/MobileMonthView.mjs +1 -1
  48. package/esm/components/MobileMonthView/MobileMonthView.mjs.map +1 -1
  49. package/esm/components/ResourcesDayView/ResourcesDayView.mjs +40 -15
  50. package/esm/components/ResourcesDayView/ResourcesDayView.mjs.map +1 -1
  51. package/esm/components/ResourcesDayView/ResourcesDayView.module.mjs.map +1 -1
  52. package/esm/components/ResourcesSchedule/ResourcesSchedule.mjs.map +1 -1
  53. package/esm/components/ResourcesWeekView/ResourcesWeekView.mjs +46 -16
  54. package/esm/components/ResourcesWeekView/ResourcesWeekView.mjs.map +1 -1
  55. package/esm/components/ResourcesWeekView/ResourcesWeekView.module.mjs.map +1 -1
  56. package/esm/components/Schedule/Schedule.mjs.map +1 -1
  57. package/esm/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.mjs +19 -4
  58. package/esm/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.mjs.map +1 -1
  59. package/esm/components/ScheduleEvent/ScheduleEvent.module.mjs.map +1 -1
  60. package/esm/components/WeekView/WeekView.mjs +47 -17
  61. package/esm/components/WeekView/WeekView.mjs.map +1 -1
  62. package/esm/components/WeekView/WeekView.module.mjs +3 -2
  63. package/esm/components/WeekView/WeekView.module.mjs.map +1 -1
  64. package/esm/components/WeekView/get-week-view-events/get-week-positioned-events.mjs +4 -2
  65. package/esm/components/WeekView/get-week-view-events/get-week-positioned-events.mjs.map +1 -1
  66. package/esm/hooks/use-event-resize.mjs +7 -4
  67. package/esm/hooks/use-event-resize.mjs.map +1 -1
  68. package/esm/hooks/use-horizontal-event-resize.mjs +7 -4
  69. package/esm/hooks/use-horizontal-event-resize.mjs.map +1 -1
  70. package/esm/index.mjs +3 -1
  71. package/esm/utils/apply-cascade-layout/apply-cascade-layout.mjs +21 -0
  72. package/esm/utils/apply-cascade-layout/apply-cascade-layout.mjs.map +1 -0
  73. package/esm/{components/ResourcesDayView → utils}/get-overlap-clusters/get-overlap-clusters.mjs +2 -2
  74. package/esm/utils/get-overlap-clusters/get-overlap-clusters.mjs.map +1 -0
  75. package/esm/utils/is-event-in-time-range/is-event-in-time-range.mjs +2 -1
  76. package/esm/utils/is-event-in-time-range/is-event-in-time-range.mjs.map +1 -1
  77. package/lib/components/DayView/DayView.d.ts +7 -3
  78. package/lib/components/DayView/get-day-view-events/get-day-positioned-events.d.ts +4 -2
  79. package/lib/components/DayView/get-day-view-events/get-day-view-events.d.ts +3 -2
  80. package/lib/components/ResourcesDayView/ResourcesDayView.d.ts +1 -1
  81. package/lib/components/ResourcesSchedule/ResourcesSchedule.d.ts +1 -1
  82. package/lib/components/ResourcesWeekView/ResourcesWeekView.d.ts +1 -1
  83. package/lib/components/Schedule/Schedule.d.ts +1 -1
  84. package/lib/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.d.ts +15 -2
  85. package/lib/components/WeekView/WeekView.d.ts +7 -3
  86. package/lib/components/WeekView/get-week-view-events/get-week-positioned-events.d.ts +4 -2
  87. package/lib/hooks/use-event-resize.d.ts +3 -2
  88. package/lib/hooks/use-horizontal-event-resize.d.ts +3 -2
  89. package/lib/types.d.ts +2 -0
  90. package/lib/utils/apply-cascade-layout/apply-cascade-layout.d.ts +6 -0
  91. package/lib/utils/get-overlap-clusters/get-overlap-clusters.d.ts +2 -0
  92. package/lib/utils/index.d.ts +3 -0
  93. package/package.json +4 -4
  94. package/styles.css +315 -6
  95. package/styles.layer.css +315 -6
  96. package/cjs/components/ResourcesDayView/get-overlap-clusters/get-overlap-clusters.cjs.map +0 -1
  97. package/esm/components/ResourcesDayView/get-overlap-clusters/get-overlap-clusters.mjs.map +0 -1
  98. package/lib/components/ResourcesDayView/get-overlap-clusters/get-overlap-clusters.d.ts +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"DayView.module.mjs","names":[],"sources":["../../../src/components/DayView/DayView.module.css"],"sourcesContent":[".dayView {\n --slot-height: var(--day-view-slot-height, 64px); /* total height of 1 hour slot */\n --all-day-slot-height: var(--day-view-all-day-slot-height, 44px); /* height of all day slot */\n --day-view-slot-labels-width: 80px;\n --day-view-radius: var(--schedule-radius, var(--mantine-radius-default));\n border-radius: var(--day-view-radius);\n overflow: hidden;\n\n @mixin where-light {\n --day-view-border-color: var(--mantine-color-gray-3);\n --day-view-business-hours-bg: var(--mantine-color-white);\n --day-view-non-business-hours-bg: var(--mantine-color-gray-0);\n }\n\n @mixin where-dark {\n --day-view-border-color: var(--mantine-color-dark-4);\n --day-view-business-hours-bg: var(--mantine-color-dark-7);\n --day-view-non-business-hours-bg: var(--mantine-color-dark-6);\n }\n}\n\n.dayViewHeader {\n text-transform: capitalize;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n}\n\n.dayViewScrollArea {\n border: 1px solid var(--day-view-border-color);\n border-radius: var(--day-view-radius);\n overflow: hidden;\n\n :where(:global(.mantine-ScrollArea-scrollbar)) {\n z-index: 4;\n }\n}\n\n.dayViewInner {\n display: flex;\n}\n\n.dayViewTimeSlots {\n position: relative;\n\n &:where(:first-of-type) .dayViewSlot:where([data-first]) {\n border-top-color: transparent;\n }\n}\n\n.dayViewSlotLabels {\n width: var(--day-view-slot-labels-width);\n}\n\n.dayViewSlotLabel {\n height: var(--slot-height);\n border-top: 1px solid var(--day-view-border-color);\n font-size: var(--mantine-font-size-sm);\n text-align: right;\n padding: 4px 8px;\n font-variant-numeric: tabular-nums;\n\n &:where([data-all-day]) {\n height: var(--all-day-slot-height);\n border-top: 0;\n }\n\n &:where(:first-of-type) {\n border-top: 0;\n }\n\n &:where([data-business-hours]) {\n background-color: var(--day-view-business-hours-bg);\n }\n\n &:where([data-non-business-hours]) {\n background-color: var(--day-view-non-business-hours-bg);\n }\n}\n\n.dayViewSlots {\n flex: 1;\n}\n\n.dayViewSlot {\n display: block;\n width: 100%;\n border-top: 1px dotted var(--day-view-border-color);\n height: calc(var(--slot-height) * var(--slot-size));\n position: relative;\n\n &:where(:focus) {\n z-index: 1;\n }\n\n &:where([data-hour-start]) {\n border-top: 1px solid var(--day-view-border-color);\n }\n\n @mixin hover {\n @mixin where-light {\n background-color: var(--mantine-color-gray-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-5);\n }\n }\n\n &:where([data-all-day]) {\n height: var(--all-day-slot-height);\n border-top: 0;\n }\n\n &:where([data-business-hours]) {\n background-color: var(--day-view-business-hours-bg);\n }\n\n &:where([data-non-business-hours]) {\n background-color: var(--day-view-non-business-hours-bg);\n }\n\n &:where([data-drop-target]) {\n @mixin where-light {\n background-color: var(--mantine-color-blue-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-5);\n }\n\n &::before {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 2;\n border: 1px solid;\n border-radius: 2px;\n\n @mixin where-light {\n border-color: var(--mantine-color-blue-4);\n }\n\n @mixin where-dark {\n border-color: var(--mantine-color-blue-6);\n }\n }\n }\n\n &:where([data-drag-selected]) {\n &,\n &:hover {\n background-color: var(--mantine-primary-color-light);\n }\n\n &::before {\n content: '';\n position: absolute;\n inset: -1px;\n pointer-events: none;\n z-index: 2;\n border: 1px solid;\n\n @mixin where-light {\n border-color: var(--mantine-primary-color-2);\n }\n\n @mixin where-dark {\n border-color: var(--mantine-primary-color-9);\n }\n }\n }\n\n &:where([data-drag-slot-index]) {\n touch-action: none;\n }\n\n &:where([data-static]) {\n cursor: default;\n pointer-events: none;\n }\n}\n\n.dayView:where([data-hide-sub-hour-grid-lines]) .dayViewSlot:not([data-hour-start]) {\n border-top-color: transparent;\n}\n\n.dayView:where([data-event-interaction]) .dayViewSlot:not([data-all-day]) {\n pointer-events: none;\n}\n\n.dayViewBackgroundEvent {\n position: absolute;\n border-radius: 0;\n pointer-events: none;\n z-index: 2;\n background-color: var(--bg-event-bg);\n overflow: hidden;\n font-size: 12px;\n font-weight: var(--mantine-font-weight-medium);\n padding: 3px 4px;\n color: var(--bg-event-color);\n\n &:where([data-interactive]) {\n pointer-events: auto;\n cursor: pointer;\n user-select: none;\n\n @mixin hover {\n background-color: var(--bg-event-hover);\n }\n }\n}\n\n.dayView:where([data-event-interaction], [data-slot-dragging]) .dayViewBackgroundEvent {\n pointer-events: none;\n}\n\n.dayViewAllDay {\n position: relative;\n height: var(--all-day-slot-height);\n}\n\n.dayViewAllDayEvents {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n pointer-events: none;\n z-index: 3;\n}\n\n.dayViewDragPreview {\n pointer-events: none;\n z-index: 3;\n border-radius: var(--day-view-radius);\n border: 1px dashed var(--mantine-color-blue-filled);\n background-color: var(--mantine-color-blue-light);\n opacity: 0.6;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"DayView.module.mjs","names":[],"sources":["../../../src/components/DayView/DayView.module.css"],"sourcesContent":[".dayView {\n --slot-height: var(--day-view-slot-height, 64px); /* total height of 1 hour slot */\n --all-day-slot-height: var(--day-view-all-day-slot-height, 44px); /* height of all day slot */\n --day-view-slot-labels-width: 80px;\n --day-view-radius: var(--schedule-radius, var(--mantine-radius-default));\n border-radius: var(--day-view-radius);\n overflow: hidden;\n\n @mixin where-light {\n --day-view-border-color: var(--mantine-color-gray-3);\n --day-view-business-hours-bg: var(--mantine-color-white);\n --day-view-non-business-hours-bg: var(--mantine-color-gray-0);\n }\n\n @mixin where-dark {\n --day-view-border-color: var(--mantine-color-dark-4);\n --day-view-business-hours-bg: var(--mantine-color-dark-7);\n --day-view-non-business-hours-bg: var(--mantine-color-dark-6);\n }\n}\n\n.dayViewHeader {\n text-transform: capitalize;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n}\n\n.dayViewScrollArea {\n border: 1px solid var(--day-view-border-color);\n border-radius: var(--day-view-radius);\n overflow: hidden;\n\n :where(:global(.mantine-ScrollArea-scrollbar)) {\n z-index: 4;\n }\n}\n\n.dayViewInner {\n display: flex;\n}\n\n.dayViewTimeSlots {\n position: relative;\n\n /* Cascade events stack with an unbounded z-index, keep them out of the sticky header's layer */\n &:where(:has([data-cascade])) {\n isolation: isolate;\n\n /* Drag and resize feedback must stay above every cascade column */\n --event-cascade-interaction-z-index: 999;\n\n .dayViewDragPreview {\n z-index: var(--event-cascade-interaction-z-index);\n }\n }\n\n &:where(:first-of-type) .dayViewSlot:where([data-first]) {\n border-top-color: transparent;\n }\n}\n\n.dayViewSlotLabels {\n width: var(--day-view-slot-labels-width);\n}\n\n.dayViewSlotLabel {\n height: var(--slot-height);\n border-top: 1px solid var(--day-view-border-color);\n font-size: var(--mantine-font-size-sm);\n text-align: right;\n padding: 4px 8px;\n font-variant-numeric: tabular-nums;\n\n &:where([data-all-day]) {\n height: var(--all-day-slot-height);\n border-top: 0;\n }\n\n &:where(:first-of-type) {\n border-top: 0;\n }\n\n &:where([data-business-hours]) {\n background-color: var(--day-view-business-hours-bg);\n }\n\n &:where([data-non-business-hours]) {\n background-color: var(--day-view-non-business-hours-bg);\n }\n}\n\n.dayViewSlots {\n flex: 1;\n}\n\n.dayViewSlot {\n display: block;\n width: 100%;\n border-top: 1px dotted var(--day-view-border-color);\n height: calc(var(--slot-height) * var(--slot-size));\n position: relative;\n\n &:where(:focus) {\n z-index: 1;\n }\n\n &:where([data-hour-start]) {\n border-top: 1px solid var(--day-view-border-color);\n }\n\n @mixin hover {\n @mixin where-light {\n background-color: var(--mantine-color-gray-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-5);\n }\n }\n\n &:where([data-all-day]) {\n height: var(--all-day-slot-height);\n border-top: 0;\n }\n\n &:where([data-business-hours]) {\n background-color: var(--day-view-business-hours-bg);\n }\n\n &:where([data-non-business-hours]) {\n background-color: var(--day-view-non-business-hours-bg);\n }\n\n &:where([data-drop-target]) {\n @mixin where-light {\n background-color: var(--mantine-color-blue-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-5);\n }\n\n &::before {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 2;\n border: 1px solid;\n border-radius: 2px;\n\n @mixin where-light {\n border-color: var(--mantine-color-blue-4);\n }\n\n @mixin where-dark {\n border-color: var(--mantine-color-blue-6);\n }\n }\n }\n\n &:where([data-drag-selected]) {\n &,\n &:hover {\n background-color: var(--mantine-primary-color-light);\n }\n\n &::before {\n content: '';\n position: absolute;\n inset: -1px;\n pointer-events: none;\n z-index: 2;\n border: 1px solid;\n\n @mixin where-light {\n border-color: var(--mantine-primary-color-2);\n }\n\n @mixin where-dark {\n border-color: var(--mantine-primary-color-9);\n }\n }\n }\n\n &:where([data-drag-slot-index]) {\n touch-action: none;\n }\n\n &:where([data-static]) {\n cursor: default;\n pointer-events: none;\n }\n}\n\n.dayView:where([data-hide-sub-hour-grid-lines]) .dayViewSlot:not([data-hour-start]) {\n border-top-color: transparent;\n}\n\n.dayView:where([data-event-interaction]) .dayViewSlot:not([data-all-day]) {\n pointer-events: none;\n}\n\n.dayViewBackgroundEvent {\n position: absolute;\n border-radius: 0;\n pointer-events: none;\n z-index: 2;\n background-color: var(--bg-event-bg);\n overflow: hidden;\n font-size: 12px;\n font-weight: var(--mantine-font-weight-medium);\n padding: 3px 4px;\n color: var(--bg-event-color);\n\n &:where([data-interactive]) {\n pointer-events: auto;\n cursor: pointer;\n user-select: none;\n\n @mixin hover {\n background-color: var(--bg-event-hover);\n }\n }\n\n /* The resized edge repeatedly crosses the pointer, so hover feedback would flicker */\n &:where([data-resizing]) {\n @mixin hover {\n background-color: var(--bg-event-bg);\n }\n }\n}\n\n.dayViewBackgroundEventResizeHandle {\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n width: 40%;\n max-width: 40px;\n height: 4px;\n border-radius: 2px;\n cursor: ns-resize;\n pointer-events: all;\n z-index: 4;\n touch-action: none;\n background-color: var(--bg-event-color);\n opacity: 0;\n transition: opacity 100ms ease;\n\n &::before {\n content: '';\n position: absolute;\n inset: -4px -6px;\n }\n\n &:where([data-edge='top']) {\n top: 0;\n }\n\n &:where([data-edge='bottom']) {\n bottom: 0;\n }\n\n .dayViewBackgroundEvent:where(:hover, [data-resizing]) & {\n opacity: 0.5;\n }\n\n @mixin hover {\n opacity: 0.8;\n }\n}\n\n/* The resizing background event is the one that set `data-event-interaction`, so it must\n keep capturing pointer events. */\n.dayView:where([data-event-interaction], [data-slot-dragging])\n .dayViewBackgroundEvent:not([data-resizing]) {\n pointer-events: none;\n\n & .dayViewBackgroundEventResizeHandle {\n pointer-events: none;\n opacity: 0;\n }\n}\n\n.dayViewAllDay {\n position: relative;\n height: var(--all-day-slot-height);\n}\n\n.dayViewAllDayEvents {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n pointer-events: none;\n z-index: 3;\n}\n\n.dayViewDragPreview {\n pointer-events: none;\n z-index: 3;\n border-radius: var(--day-view-radius);\n border: 1px dashed var(--mantine-color-blue-filled);\n background-color: var(--mantine-color-blue-light);\n opacity: 0.6;\n}\n"],"mappings":""}
@@ -3,6 +3,7 @@ import { isAllDayEvent } from "../../../utils/is-all-day-event/is-all-day-event.
3
3
  import { sortEvents } from "../../../utils/sort-events/sort-events.mjs";
4
4
  import { isEventsOverlap } from "../../../utils/is-events-overlap/is-events-overlap.mjs";
5
5
  import { getDayPosition } from "../../../utils/get-day-position/get-day-position.mjs";
6
+ import { applyCascadeLayout } from "../../../utils/apply-cascade-layout/apply-cascade-layout.mjs";
6
7
  //#region packages/@mantine/schedule/src/components/DayView/get-day-view-events/get-day-positioned-events.ts
7
8
  function columnHasConflict({ columns, columnIndex, event, allDay, date }) {
8
9
  if (!columns[columnIndex]) return false;
@@ -16,7 +17,7 @@ function columnHasConflict({ columns, columnIndex, event, allDay, date }) {
16
17
  return hasTimeConflict;
17
18
  });
18
19
  }
19
- function getDayPositionedEvents({ events, startTime, endTime, intervalMinutes, date }) {
20
+ function getDayPositionedEvents({ events, startTime, endTime, intervalMinutes, date, eventOverlapMode = "columns" }) {
20
21
  const columns = [];
21
22
  const positioned = [];
22
23
  const sorted = sortEvents(events);
@@ -56,14 +57,18 @@ function getDayPositionedEvents({ events, startTime, endTime, intervalMinutes, d
56
57
  }
57
58
  });
58
59
  }
60
+ for (const positionedEvent of positioned) if (positionedEvent.position.allDay) {
61
+ positionedEvent.position.overlaps = 1;
62
+ positionedEvent.position.width = 100;
63
+ positionedEvent.position.offset = 0;
64
+ }
65
+ if (eventOverlapMode === "cascade") {
66
+ applyCascadeLayout(positioned);
67
+ return positioned;
68
+ }
59
69
  for (const positionedEvent of positioned) {
60
70
  const { allDay, column } = positionedEvent.position;
61
- if (allDay) {
62
- positionedEvent.position.overlaps = 1;
63
- positionedEvent.position.width = 100;
64
- positionedEvent.position.offset = 0;
65
- continue;
66
- }
71
+ if (allDay) continue;
67
72
  const directlyOverlapping = [];
68
73
  for (const otherEvent of positioned) {
69
74
  if (otherEvent === positionedEvent || otherEvent.position.allDay) continue;
@@ -1 +1 @@
1
- {"version":3,"file":"get-day-positioned-events.mjs","names":[],"sources":["../../../../src/components/DayView/get-day-view-events/get-day-positioned-events.ts"],"sourcesContent":["import { AnyDateValue, DayPositionedEventData, ScheduleEventData } from '../../../types';\nimport { getDayPosition, isAllDayEvent, isEventsOverlap, sortEvents } from '../../../utils';\n\ninterface ColumnHasConflictOptions {\n columns: ScheduleEventData[][];\n columnIndex: number;\n event: ScheduleEventData;\n allDay: boolean;\n date: AnyDateValue;\n}\n\nfunction columnHasConflict({\n columns,\n columnIndex,\n event,\n allDay,\n date,\n}: ColumnHasConflictOptions): boolean {\n if (!columns[columnIndex]) {\n return false;\n }\n\n return columns[columnIndex].some((e) => {\n const eAllDay = isAllDayEvent({ event: e, date });\n const hasTimeConflict = isEventsOverlap(e, event);\n\n // Don't count all-day events as overlaps\n if (allDay || eAllDay) {\n return false;\n }\n\n return hasTimeConflict;\n });\n}\n\ninterface GetDayPositionedEventsInput {\n /** Date at which events are positioned, used to check if events are all-day */\n date: AnyDateValue;\n\n /** List of all events that belong to the given date, extra events must be filtered out before passing to the function */\n events: ScheduleEventData[];\n\n /** Start time of the day view, used to calculate event positions */\n startTime?: string;\n\n /** End time of the day view, used to calculate event positions */\n endTime?: string;\n\n /** Number of minutes per time slot, used to align the canvas to whole slots */\n intervalMinutes?: number;\n}\n\nexport function getDayPositionedEvents({\n events,\n startTime,\n endTime,\n intervalMinutes,\n date,\n}: GetDayPositionedEventsInput) {\n const columns: ScheduleEventData[][] = [];\n const positioned: DayPositionedEventData[] = [];\n\n const sorted = sortEvents(events);\n\n for (const event of sorted) {\n const allDay = isAllDayEvent({ event, date });\n\n let column = 0;\n\n while (columnHasConflict({ columns, columnIndex: column, event, allDay, date })) {\n column++;\n }\n\n if (!columns[column]) {\n columns[column] = [];\n }\n\n columns[column].push(event);\n\n const verticalPosition = allDay\n ? { top: 0, height: 100 }\n : getDayPosition({ event, startTime, endTime, intervalMinutes });\n\n positioned.push({\n ...event,\n position: {\n ...verticalPosition,\n allDay,\n column,\n\n // set later\n width: 0,\n offset: 0,\n overlaps: 0,\n },\n });\n }\n for (const positionedEvent of positioned) {\n const { allDay, column } = positionedEvent.position;\n\n if (allDay) {\n positionedEvent.position.overlaps = 1;\n positionedEvent.position.width = 100;\n positionedEvent.position.offset = 0;\n continue;\n }\n\n // Find events that directly overlap with this event\n const directlyOverlapping: DayPositionedEventData[] = [];\n\n for (const otherEvent of positioned) {\n if (otherEvent === positionedEvent || otherEvent.position.allDay) {\n continue;\n }\n\n if (isEventsOverlap(otherEvent, positionedEvent)) {\n directlyOverlapping.push(otherEvent);\n }\n }\n\n // Find the max column by also checking overlaps of overlapping events\n // This ensures we account for the full column group\n let maxColumn = column;\n\n for (const overlappingEvent of directlyOverlapping) {\n maxColumn = Math.max(maxColumn, overlappingEvent.position.column);\n\n // Check what overlaps with each overlapping event\n for (const otherEvent of positioned) {\n if (otherEvent === overlappingEvent || otherEvent.position.allDay) {\n continue;\n }\n\n if (isEventsOverlap(otherEvent, overlappingEvent)) {\n maxColumn = Math.max(maxColumn, otherEvent.position.column);\n }\n }\n }\n\n const totalColumns = maxColumn + 1;\n\n // Find the first occupied column to the right of this event\n // Events expand to fill empty columns but stop at the next occupied column\n let nextOccupiedColumn = totalColumns;\n\n for (const other of directlyOverlapping) {\n if (other.position.column > column && other.position.column < nextOccupiedColumn) {\n nextOccupiedColumn = other.position.column;\n }\n }\n\n const columnsSpanned = nextOccupiedColumn - column;\n\n positionedEvent.position.overlaps = totalColumns;\n positionedEvent.position.width = (columnsSpanned / totalColumns) * 100;\n positionedEvent.position.offset = (column * 100) / totalColumns;\n }\n\n return positioned;\n}\n"],"mappings":";;;;;;AAWA,SAAS,kBAAkB,EACzB,SACA,aACA,OACA,QACA,QACoC;CACpC,IAAI,CAAC,QAAQ,cACX,OAAO;CAGT,OAAO,QAAQ,YAAY,CAAC,MAAM,MAAM;EACtC,MAAM,UAAU,cAAc;GAAE,OAAO;GAAG;EAAK,CAAC;EAChD,MAAM,kBAAkB,gBAAgB,GAAG,KAAK;EAGhD,IAAI,UAAU,SACZ,OAAO;EAGT,OAAO;CACT,CAAC;AACH;AAmBA,SAAgB,uBAAuB,EACrC,QACA,WACA,SACA,iBACA,QAC8B;CAC9B,MAAM,UAAiC,CAAC;CACxC,MAAM,aAAuC,CAAC;CAE9C,MAAM,SAAS,WAAW,MAAM;CAEhC,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,SAAS,cAAc;GAAE;GAAO;EAAK,CAAC;EAE5C,IAAI,SAAS;EAEb,OAAO,kBAAkB;GAAE;GAAS,aAAa;GAAQ;GAAO;GAAQ;EAAK,CAAC,GAC5E;EAGF,IAAI,CAAC,QAAQ,SACX,QAAQ,UAAU,CAAC;EAGrB,QAAQ,OAAO,CAAC,KAAK,KAAK;EAE1B,MAAM,mBAAmB,SACrB;GAAE,KAAK;GAAG,QAAQ;EAAI,IACtB,eAAe;GAAE;GAAO;GAAW;GAAS;EAAgB,CAAC;EAEjE,WAAW,KAAK;GACd,GAAG;GACH,UAAU;IACR,GAAG;IACH;IACA;IAGA,OAAO;IACP,QAAQ;IACR,UAAU;GACZ;EACF,CAAC;CACH;CACA,KAAK,MAAM,mBAAmB,YAAY;EACxC,MAAM,EAAE,QAAQ,WAAW,gBAAgB;EAE3C,IAAI,QAAQ;GACV,gBAAgB,SAAS,WAAW;GACpC,gBAAgB,SAAS,QAAQ;GACjC,gBAAgB,SAAS,SAAS;GAClC;EACF;EAGA,MAAM,sBAAgD,CAAC;EAEvD,KAAK,MAAM,cAAc,YAAY;GACnC,IAAI,eAAe,mBAAmB,WAAW,SAAS,QACxD;GAGF,IAAI,gBAAgB,YAAY,eAAe,GAC7C,oBAAoB,KAAK,UAAU;EAEvC;EAIA,IAAI,YAAY;EAEhB,KAAK,MAAM,oBAAoB,qBAAqB;GAClD,YAAY,KAAK,IAAI,WAAW,iBAAiB,SAAS,MAAM;GAGhE,KAAK,MAAM,cAAc,YAAY;IACnC,IAAI,eAAe,oBAAoB,WAAW,SAAS,QACzD;IAGF,IAAI,gBAAgB,YAAY,gBAAgB,GAC9C,YAAY,KAAK,IAAI,WAAW,WAAW,SAAS,MAAM;GAE9D;EACF;EAEA,MAAM,eAAe,YAAY;EAIjC,IAAI,qBAAqB;EAEzB,KAAK,MAAM,SAAS,qBAClB,IAAI,MAAM,SAAS,SAAS,UAAU,MAAM,SAAS,SAAS,oBAC5D,qBAAqB,MAAM,SAAS;EAIxC,MAAM,iBAAiB,qBAAqB;EAE5C,gBAAgB,SAAS,WAAW;EACpC,gBAAgB,SAAS,QAAS,iBAAiB,eAAgB;EACnE,gBAAgB,SAAS,SAAU,SAAS,MAAO;CACrD;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"get-day-positioned-events.mjs","names":[],"sources":["../../../../src/components/DayView/get-day-view-events/get-day-positioned-events.ts"],"sourcesContent":["import {\n AnyDateValue,\n DayPositionedEventData,\n ScheduleEventData,\n ScheduleEventOverlapMode,\n} from '../../../types';\nimport {\n applyCascadeLayout,\n getDayPosition,\n isAllDayEvent,\n isEventsOverlap,\n sortEvents,\n} from '../../../utils';\n\ninterface ColumnHasConflictOptions {\n columns: ScheduleEventData[][];\n columnIndex: number;\n event: ScheduleEventData;\n allDay: boolean;\n date: AnyDateValue;\n}\n\nfunction columnHasConflict({\n columns,\n columnIndex,\n event,\n allDay,\n date,\n}: ColumnHasConflictOptions): boolean {\n if (!columns[columnIndex]) {\n return false;\n }\n\n return columns[columnIndex].some((e) => {\n const eAllDay = isAllDayEvent({ event: e, date });\n const hasTimeConflict = isEventsOverlap(e, event);\n\n // Don't count all-day events as overlaps\n if (allDay || eAllDay) {\n return false;\n }\n\n return hasTimeConflict;\n });\n}\n\ninterface GetDayPositionedEventsInput {\n /** Date at which events are positioned, used to check if events are all-day */\n date: AnyDateValue;\n\n /** List of all events that belong to the given date, extra events must be filtered out before passing to the function */\n events: ScheduleEventData[];\n\n /** Start time of the day view, used to calculate event positions */\n startTime?: string;\n\n /** End time of the day view, used to calculate event positions */\n endTime?: string;\n\n /** Number of minutes per time slot, used to align the canvas to whole slots */\n intervalMinutes?: number;\n\n /** Determines how events that overlap in time are laid out @default 'columns' */\n eventOverlapMode?: ScheduleEventOverlapMode;\n}\n\nexport function getDayPositionedEvents({\n events,\n startTime,\n endTime,\n intervalMinutes,\n date,\n eventOverlapMode = 'columns',\n}: GetDayPositionedEventsInput) {\n const columns: ScheduleEventData[][] = [];\n const positioned: DayPositionedEventData[] = [];\n\n const sorted = sortEvents(events);\n\n for (const event of sorted) {\n const allDay = isAllDayEvent({ event, date });\n\n let column = 0;\n\n while (columnHasConflict({ columns, columnIndex: column, event, allDay, date })) {\n column++;\n }\n\n if (!columns[column]) {\n columns[column] = [];\n }\n\n columns[column].push(event);\n\n const verticalPosition = allDay\n ? { top: 0, height: 100 }\n : getDayPosition({ event, startTime, endTime, intervalMinutes });\n\n positioned.push({\n ...event,\n position: {\n ...verticalPosition,\n allDay,\n column,\n\n // set later\n width: 0,\n offset: 0,\n overlaps: 0,\n },\n });\n }\n for (const positionedEvent of positioned) {\n if (positionedEvent.position.allDay) {\n positionedEvent.position.overlaps = 1;\n positionedEvent.position.width = 100;\n positionedEvent.position.offset = 0;\n }\n }\n\n if (eventOverlapMode === 'cascade') {\n applyCascadeLayout(positioned);\n return positioned;\n }\n\n for (const positionedEvent of positioned) {\n const { allDay, column } = positionedEvent.position;\n\n if (allDay) {\n continue;\n }\n\n // Find events that directly overlap with this event\n const directlyOverlapping: DayPositionedEventData[] = [];\n\n for (const otherEvent of positioned) {\n if (otherEvent === positionedEvent || otherEvent.position.allDay) {\n continue;\n }\n\n if (isEventsOverlap(otherEvent, positionedEvent)) {\n directlyOverlapping.push(otherEvent);\n }\n }\n\n // Find the max column by also checking overlaps of overlapping events\n // This ensures we account for the full column group\n let maxColumn = column;\n\n for (const overlappingEvent of directlyOverlapping) {\n maxColumn = Math.max(maxColumn, overlappingEvent.position.column);\n\n // Check what overlaps with each overlapping event\n for (const otherEvent of positioned) {\n if (otherEvent === overlappingEvent || otherEvent.position.allDay) {\n continue;\n }\n\n if (isEventsOverlap(otherEvent, overlappingEvent)) {\n maxColumn = Math.max(maxColumn, otherEvent.position.column);\n }\n }\n }\n\n const totalColumns = maxColumn + 1;\n\n // Find the first occupied column to the right of this event\n // Events expand to fill empty columns but stop at the next occupied column\n let nextOccupiedColumn = totalColumns;\n\n for (const other of directlyOverlapping) {\n if (other.position.column > column && other.position.column < nextOccupiedColumn) {\n nextOccupiedColumn = other.position.column;\n }\n }\n\n const columnsSpanned = nextOccupiedColumn - column;\n\n positionedEvent.position.overlaps = totalColumns;\n positionedEvent.position.width = (columnsSpanned / totalColumns) * 100;\n positionedEvent.position.offset = (column * 100) / totalColumns;\n }\n\n return positioned;\n}\n"],"mappings":";;;;;;;AAsBA,SAAS,kBAAkB,EACzB,SACA,aACA,OACA,QACA,QACoC;CACpC,IAAI,CAAC,QAAQ,cACX,OAAO;CAGT,OAAO,QAAQ,YAAY,CAAC,MAAM,MAAM;EACtC,MAAM,UAAU,cAAc;GAAE,OAAO;GAAG;EAAK,CAAC;EAChD,MAAM,kBAAkB,gBAAgB,GAAG,KAAK;EAGhD,IAAI,UAAU,SACZ,OAAO;EAGT,OAAO;CACT,CAAC;AACH;AAsBA,SAAgB,uBAAuB,EACrC,QACA,WACA,SACA,iBACA,MACA,mBAAmB,aACW;CAC9B,MAAM,UAAiC,CAAC;CACxC,MAAM,aAAuC,CAAC;CAE9C,MAAM,SAAS,WAAW,MAAM;CAEhC,KA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EAEA,MAAM,eAAe,YAAY;EAIjC,IAAI,qBAAqB;EAEzB,KAAK,MAAM,SAAS,qBAClB,IAAI,MAAM,SAAS,SAAS,UAAU,MAAM,SAAS,SAAS,oBAC5D,qBAAqB,MAAM,SAAS;EAIxC,MAAM,iBAAiB,qBAAqB;EAE5C,gBAAgB,SAAS,WAAW;EACpC,gBAAgB,SAAS,QAAS,iBAAiB,eAAgB;EACnE,gBAAgB,SAAS,SAAU,SAAS,MAAO;CACrD;CAEA,OAAO;AACT"}
@@ -6,7 +6,7 @@ import { getDayPosition } from "../../../utils/get-day-position/get-day-position
6
6
  import { getDayPositionedEvents } from "./get-day-positioned-events.mjs";
7
7
  import dayjs from "dayjs";
8
8
  //#region packages/@mantine/schedule/src/components/DayView/get-day-view-events/get-day-view-events.ts
9
- function getDayViewEvents({ events, date, startTime, endTime, intervalMinutes }) {
9
+ function getDayViewEvents({ events, date, startTime, endTime, intervalMinutes, eventOverlapMode }) {
10
10
  if (events === void 0) return {
11
11
  allDayEvents: [],
12
12
  regularEvents: [],
@@ -41,7 +41,8 @@ function getDayViewEvents({ events, date, startTime, endTime, intervalMinutes })
41
41
  startTime,
42
42
  endTime,
43
43
  intervalMinutes,
44
- date
44
+ date,
45
+ eventOverlapMode
45
46
  });
46
47
  const allDayEvents = [];
47
48
  const regularEvents = [];
@@ -1 +1 @@
1
- {"version":3,"file":"get-day-view-events.mjs","names":[],"sources":["../../../../src/components/DayView/get-day-view-events/get-day-view-events.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport { AnyDateValue, DayPositionedEventData, ScheduleEventData } from '../../../types';\nimport { getDayPosition, isAllDayEvent, isEventInTimeRange, validateEvent } from '../../../utils';\nimport { getDayPositionedEvents } from './get-day-positioned-events';\n\ninterface GetDayViewEventsInput {\n events: ScheduleEventData[] | undefined;\n date: AnyDateValue;\n startTime?: string;\n endTime?: string;\n intervalMinutes?: number;\n}\n\nexport function getDayViewEvents({\n events,\n date,\n startTime,\n endTime,\n intervalMinutes,\n}: GetDayViewEventsInput) {\n if (events === undefined) {\n return {\n allDayEvents: [],\n regularEvents: [],\n backgroundTimedEvents: [],\n backgroundAllDayEvents: [],\n };\n }\n\n const ids = new Set<string | number>();\n const filteredEvents: ScheduleEventData[] = [];\n const backgroundFiltered: ScheduleEventData[] = [];\n const dayStart = dayjs(date).startOf('day');\n const dayEnd = dayjs(date).endOf('day');\n\n for (const event of events) {\n const eventStart = dayjs(event.start);\n const eventEnd = dayjs(event.end);\n const isOnDay = eventStart.isSame(dayStart, 'day');\n const spansIntoDay =\n !isOnDay &&\n event.display === 'background' &&\n eventStart.isBefore(dayEnd) &&\n eventEnd.isAfter(dayStart);\n\n if (isOnDay || spansIntoDay) {\n if (isOnDay && !isEventInTimeRange({ event, startTime, endTime })) {\n continue;\n }\n\n const validated = validateEvent(event);\n\n if (!ids.has(event.id)) {\n ids.add(event.id);\n } else {\n throw new Error(`[@mantine/schedule] DayView: Duplicated event ids found: ${event.id}`);\n }\n\n if (event.display === 'background') {\n backgroundFiltered.push(validated);\n } else {\n filteredEvents.push(validated);\n }\n }\n }\n\n const positionedEvents = getDayPositionedEvents({\n events: filteredEvents,\n startTime,\n endTime,\n intervalMinutes,\n date,\n });\n\n const allDayEvents: DayPositionedEventData[] = [];\n const regularEvents: DayPositionedEventData[] = [];\n\n for (const event of positionedEvents) {\n if (event.position.allDay) {\n allDayEvents.push(event);\n } else {\n regularEvents.push(event);\n }\n }\n\n const backgroundTimedEvents: DayPositionedEventData[] = [];\n const backgroundAllDayEvents: DayPositionedEventData[] = [];\n for (const event of backgroundFiltered) {\n const eventStart = dayjs(event.start);\n const eventEnd = dayjs(event.end);\n const clippedStart = eventStart.isBefore(dayStart) ? dayStart : eventStart;\n const clippedEnd = eventEnd.isAfter(dayEnd) ? dayEnd : eventEnd;\n\n const clippedEvent = {\n ...event,\n start: clippedStart.format('YYYY-MM-DD HH:mm:ss'),\n end: clippedEnd.format('YYYY-MM-DD HH:mm:ss'),\n };\n\n const allDay = isAllDayEvent({ event: clippedEvent, date });\n\n if (allDay) {\n backgroundAllDayEvents.push({\n ...event,\n position: {\n top: 0,\n height: 100,\n allDay: true,\n width: 100,\n offset: 0,\n column: 0,\n overlaps: 1,\n },\n });\n } else {\n const { top, height } = getDayPosition({\n event: clippedEvent,\n startTime,\n endTime,\n intervalMinutes,\n });\n if (height <= 0) {\n continue;\n }\n backgroundTimedEvents.push({\n ...event,\n position: { top, height, allDay: false, width: 100, offset: 0, column: 0, overlaps: 1 },\n });\n }\n }\n\n return { allDayEvents, regularEvents, backgroundTimedEvents, backgroundAllDayEvents };\n}\n"],"mappings":";;;;;;;;AAaA,SAAgB,iBAAiB,EAC/B,QACA,MACA,WACA,SACA,mBACwB;CACxB,IAAI,WAAW,KAAA,GACb,OAAO;EACL,cAAc,CAAC;EACf,eAAe,CAAC;EAChB,uBAAuB,CAAC;EACxB,wBAAwB,CAAC;CAC3B;CAGF,MAAM,sBAAM,IAAI,IAAqB;CACrC,MAAM,iBAAsC,CAAC;CAC7C,MAAM,qBAA0C,CAAC;CACjD,MAAM,WAAW,MAAM,IAAI,CAAC,CAAC,QAAQ,KAAK;CAC1C,MAAM,SAAS,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK;CAEtC,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,aAAa,MAAM,MAAM,KAAK;EACpC,MAAM,WAAW,MAAM,MAAM,GAAG;EAChC,MAAM,UAAU,WAAW,OAAO,UAAU,KAAK;EACjD,MAAM,eACJ,CAAC,WACD,MAAM,YAAY,gBAClB,WAAW,SAAS,MAAM,KAC1B,SAAS,QAAQ,QAAQ;EAE3B,IAAI,WAAW,cAAc;GAC3B,IAAI,WAAW,CAAC,mBAAmB;IAAE;IAAO;IAAW;GAAQ,CAAC,GAC9D;GAGF,MAAM,YAAY,cAAc,KAAK;GAErC,IAAI,CAAC,IAAI,IAAI,MAAM,EAAE,GACnB,IAAI,IAAI,MAAM,EAAE;QAEhB,MAAM,IAAI,MAAM,4D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components/DayView/get-day-view-events/get-day-view-events.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport {\n AnyDateValue,\n DayPositionedEventData,\n ScheduleEventData,\n ScheduleEventOverlapMode,\n} from '../../../types';\nimport { getDayPosition, isAllDayEvent, isEventInTimeRange, validateEvent } from '../../../utils';\nimport { getDayPositionedEvents } from './get-day-positioned-events';\n\ninterface GetDayViewEventsInput {\n events: ScheduleEventData[] | undefined;\n date: AnyDateValue;\n startTime?: string;\n endTime?: string;\n intervalMinutes?: number;\n eventOverlapMode?: ScheduleEventOverlapMode;\n}\n\nexport function getDayViewEvents({\n events,\n date,\n startTime,\n endTime,\n intervalMinutes,\n eventOverlapMode,\n}: GetDayViewEventsInput) {\n if (events === undefined) {\n return {\n allDayEvents: [],\n regularEvents: [],\n backgroundTimedEvents: [],\n backgroundAllDayEvents: [],\n };\n }\n\n const ids = new Set<string | number>();\n const filteredEvents: ScheduleEventData[] = [];\n const backgroundFiltered: ScheduleEventData[] = [];\n const dayStart = dayjs(date).startOf('day');\n const dayEnd = dayjs(date).endOf('day');\n\n for (const event of events) {\n const eventStart = dayjs(event.start);\n const eventEnd = dayjs(event.end);\n const isOnDay = eventStart.isSame(dayStart, 'day');\n const spansIntoDay =\n !isOnDay &&\n event.display === 'background' &&\n eventStart.isBefore(dayEnd) &&\n eventEnd.isAfter(dayStart);\n\n if (isOnDay || spansIntoDay) {\n if (isOnDay && !isEventInTimeRange({ event, startTime, endTime })) {\n continue;\n }\n\n const validated = validateEvent(event);\n\n if (!ids.has(event.id)) {\n ids.add(event.id);\n } else {\n throw new Error(`[@mantine/schedule] DayView: Duplicated event ids found: ${event.id}`);\n }\n\n if (event.display === 'background') {\n backgroundFiltered.push(validated);\n } else {\n filteredEvents.push(validated);\n }\n }\n }\n\n const positionedEvents = getDayPositionedEvents({\n events: filteredEvents,\n startTime,\n endTime,\n intervalMinutes,\n date,\n eventOverlapMode,\n });\n\n const allDayEvents: DayPositionedEventData[] = [];\n const regularEvents: DayPositionedEventData[] = [];\n\n for (const event of positionedEvents) {\n if (event.position.allDay) {\n allDayEvents.push(event);\n } else {\n regularEvents.push(event);\n }\n }\n\n const backgroundTimedEvents: DayPositionedEventData[] = [];\n const backgroundAllDayEvents: DayPositionedEventData[] = [];\n for (const event of backgroundFiltered) {\n const eventStart = dayjs(event.start);\n const eventEnd = dayjs(event.end);\n const clippedStart = eventStart.isBefore(dayStart) ? dayStart : eventStart;\n const clippedEnd = eventEnd.isAfter(dayEnd) ? dayEnd : eventEnd;\n\n const clippedEvent = {\n ...event,\n start: clippedStart.format('YYYY-MM-DD HH:mm:ss'),\n end: clippedEnd.format('YYYY-MM-DD HH:mm:ss'),\n };\n\n const allDay = isAllDayEvent({ event: clippedEvent, date });\n\n if (allDay) {\n backgroundAllDayEvents.push({\n ...event,\n position: {\n top: 0,\n height: 100,\n allDay: true,\n width: 100,\n offset: 0,\n column: 0,\n overlaps: 1,\n },\n });\n } else {\n const { top, height } = getDayPosition({\n event: clippedEvent,\n startTime,\n endTime,\n intervalMinutes,\n });\n if (height <= 0) {\n continue;\n }\n backgroundTimedEvents.push({\n ...event,\n position: { top, height, allDay: false, width: 100, offset: 0, column: 0, overlaps: 1 },\n });\n }\n }\n\n return { allDayEvents, regularEvents, backgroundTimedEvents, backgroundAllDayEvents };\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgB,iBAAiB,EAC/B,QACA,MACA,WACA,SACA,iBACA,oBACwB;CACxB,IAAI,WAAW,KAAA,GACb,OAAO;EACL,cAAc,CAAC;EACf,eAAe,CAAC;EAChB,uBAAuB,CAAC;EACxB,wBAAwB,CAAC;CAC3B;CAGF,MAAM,sBAAM,IAAI,IAAqB;CACrC,MAAM,iBAAsC,CAAC;CAC7C,MAAM,qBAA0C,CAAC;CACjD,MAAM,WAAW,MAAM,IAAI,CAAC,CAAC,QAAQ,KAAK;CAC1C,MAAM,SAAS,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK;CAEtC,KAAK,MAAM,SAAS,QAA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R,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,UAAU;GACZ;EACF,CAAC;OACI;GACL,MAAM,EAAE,KAAK,WAAW,eAAe;IACrC,OAAO;IACP;IACA;IACA;GACF,CAAC;GACD,IAAI,UAAU,GACZ;GAEF,sBAAsB,KAAK;IACzB,GAAG;IACH,UAAU;KAAE;KAAK;KAAQ,QAAQ;KAAO,OAAO;KAAK,QAAQ;KAAG,QAAQ;KAAG,UAAU;IAAE;GACxF,CAAC;EACH;CACF;CAEA,OAAO;EAAE;EAAc;EAAe;EAAuB;CAAuB;AACtF"}
@@ -172,7 +172,7 @@ const MobileMonthView = factory((_props) => {
172
172
  children: event.title
173
173
  }), /* @__PURE__ */ jsx(Text, {
174
174
  ...getStyles("mobileMonthViewEventTime"),
175
- children: isAllDay ? "All day" : `${startTime} – ${endTime}`
175
+ children: isAllDay ? getLabel("allDay", labels) : `${startTime} – ${endTime}`
176
176
  })] })]
177
177
  });
178
178
  const rootProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"MobileMonthView.mjs","names":["classes"],"sources":["../../../src/components/MobileMonthView/MobileMonthView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport React, { useRef } from 'react';\nimport {\n AccordionChevron,\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineRadius,\n StylesApiProps,\n Text,\n UnstyledButton,\n useDirection,\n useMantineTheme,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n} from '../../types';\nimport {\n expandRecurringEvents,\n formatDate,\n getMonthDays,\n getWeekdaysNames,\n getWeekNumber,\n isSameMonth,\n sortEvents,\n toDateString,\n} from '../../utils';\nimport {\n handleMonthViewKeyDown,\n MonthViewControlsRef,\n} from '../MonthView/handle-month-view-key-down';\nimport { RenderEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { getMobileMonthViewEvents } from './get-mobile-month-view-events';\nimport classes from './MobileMonthView.module.css';\n\nexport type MobileMonthViewStylesNames =\n | 'mobileMonthView'\n | 'mobileMonthViewHeader'\n | 'mobileMonthViewHeaderBackButton'\n | 'mobileMonthViewHeaderLabel'\n | 'mobileMonthViewCalendar'\n | 'mobileMonthViewWeekdays'\n | 'mobileMonthViewWeekday'\n | 'mobileMonthViewWeekdaysCorner'\n | 'mobileMonthViewWeek'\n | 'mobileMonthViewWeekNumber'\n | 'mobileMonthViewDay'\n | 'mobileMonthViewDayIndicators'\n | 'mobileMonthViewDayIndicator'\n | 'mobileMonthViewEventsList'\n | 'mobileMonthViewEventsHeader'\n | 'mobileMonthViewEvent'\n | 'mobileMonthViewEventColor'\n | 'mobileMonthViewEventBody'\n | 'mobileMonthViewEventTitle'\n | 'mobileMonthViewEventTime'\n | 'mobileMonthViewNoEvents';\n\nexport type MobileMonthViewCssVariables = {\n mobileMonthView: '--mobile-month-view-radius';\n};\n\nexport interface MobileMonthViewRenderHeaderInput {\n /** Current interaction mode */\n mode: ScheduleMode;\n /** Current date displayed in the view */\n date: Date | string;\n /** Default header element */\n defaultHeader: React.ReactNode;\n}\n\nexport interface MobileMonthViewProps\n extends BoxProps, StylesApiProps<MobileMonthViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Date to display, Date object or date string in `YYYY-MM-DD 00:00:00` format */\n date: Date | string;\n\n /** Called with the new date value when a date is selected */\n onDateChange?: (value: DateStringValue) => void;\n\n /** Currently selected date (controlled) */\n selectedDate?: Date | string | null;\n\n /** Default selected date (uncontrolled) */\n defaultSelectedDate?: Date | string | null;\n\n /** Called when selected date changes */\n onSelectedDateChange?: (value: DateStringValue | null) => void;\n\n /** If set, week numbers are displayed in the first column @default false */\n withWeekNumbers?: boolean;\n\n /** If set, weekdays names are displayed in the first row @default true */\n withWeekDays?: boolean;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** Number 0-6, where 0 – Sunday and 6 – Saturday. @default 1 – Monday */\n firstDayOfWeek?: DayOfWeek;\n\n /** `dayjs` format for weekdays names. By default, the first letter of the weekday. */\n weekdayFormat?: DateLabelFormat;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** Props passed down to the week number button */\n getWeekNumberProps?: (weekStartDate: DateStringValue) => Record<string, any>;\n\n /** Props passed down to the day button */\n getDayProps?: (date: DateStringValue) => Record<string, any>;\n\n /** Called when day is clicked */\n onDayClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called with first day of the week when week number is clicked */\n onWeekNumberClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, always renders 6 weeks in the month view @default true */\n consistentWeeks?: boolean;\n\n /** If set, highlights the current day @default true */\n highlightToday?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set, days from the previous and next months are displayed to fill the weeks @default false */\n withOutsideDays?: boolean;\n\n /** Events to display */\n events?: ScheduleEventData[];\n\n /** Labels override for i18n */\n labels?: ScheduleLabelsOverride;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default 'default' */\n mode?: ScheduleMode;\n\n /** Function to fully customize event rendering, receives all props that would be passed to the root element including children */\n renderEvent?: RenderEvent;\n\n /** Format for the events list header date @default 'dddd, MMMM D' */\n eventsHeaderFormat?: DateLabelFormat;\n\n /** Called when the year back button in the header is clicked */\n onYearClick?: () => void;\n\n /** Called when event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Custom header renderer, receives object with mode, date, and default header element */\n renderHeader?: (input: MobileMonthViewRenderHeaderInput) => React.ReactNode;\n\n /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n}\n\nexport type MobileMonthViewFactory = Factory<{\n props: MobileMonthViewProps;\n ref: HTMLDivElement;\n stylesNames: MobileMonthViewStylesNames;\n vars: MobileMonthViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'MobileMonthView',\n withWeekDays: true,\n consistentWeeks: true,\n highlightToday: true,\n mode: 'default',\n eventsHeaderFormat: 'dddd, MMMM D',\n} satisfies Partial<MobileMonthViewProps>;\n\nconst varsResolver = createVarsResolver<MobileMonthViewFactory>((_theme, { radius }) => ({\n mobileMonthView: {\n '--mobile-month-view-radius': getRadius(radius),\n },\n}));\n\nexport const MobileMonthView = factory<MobileMonthViewFactory>((_props) => {\n const props = useProps('MobileMonthView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n __staticSelector,\n date,\n onDateChange,\n selectedDate,\n defaultSelectedDate,\n onSelectedDateChange,\n withWeekNumbers,\n withWeekDays,\n locale,\n firstDayOfWeek,\n weekdayFormat,\n weekendDays,\n getWeekNumberProps,\n getDayProps,\n onDayClick,\n onWeekNumberClick,\n consistentWeeks,\n highlightToday,\n radius,\n withOutsideDays,\n events,\n labels,\n mode,\n renderEvent,\n eventsHeaderFormat,\n onYearClick,\n onEventClick,\n renderHeader,\n recurrenceExpansionLimit,\n ...others\n } = props;\n\n const ctx = useDatesContext();\n const theme = useMantineTheme();\n const today = dayjs();\n\n const [_selectedDate, _setSelectedDate] = useUncontrolled<Date | string | null>({\n value: selectedDate,\n defaultValue: defaultSelectedDate ?? toDateString(today),\n onChange: (value) => onSelectedDateChange?.(value ? toDateString(dayjs(value)) : null),\n });\n\n const getStyles = useStyles<MobileMonthViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'mobileMonthView',\n });\n\n const daysRef: MonthViewControlsRef = useRef<HTMLButtonElement[][]>([]);\n const firstDayPosition = useRef<{ weekIndex: number; dayIndex: number } | null>(null);\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(date).startOf('month').toDate(),\n rangeEnd: dayjs(date).endOf('month').toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const groupedEvents = getMobileMonthViewEvents({ date, events: expandedEvents });\n\n const weekdays = withWeekDays\n ? getWeekdaysNames({\n locale: ctx.getLocale(locale),\n format: weekdayFormat,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n }).map((day, index) => (\n <div {...getStyles('mobileMonthViewWeekday')} key={index}>\n {day}\n </div>\n ))\n : null;\n\n const weeks = getMonthDays({\n month: dayjs(date).format('YYYY-MM-DD'),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n consistentWeeks,\n }).map((week, weekIndex) => {\n const days = week.map((dayDate, dayIndex) => {\n const outside = !isSameMonth(dayDate, date);\n const weekend = ctx.getWeekendDays(weekendDays).includes(dayjs(dayDate).day());\n const ariaLabel = dayjs(dayDate)\n .locale(locale || ctx.locale)\n .format('MMMM D, YYYY');\n\n const dayProps = getDayProps?.(dayjs(dayDate).format('YYYY-MM-DD')) || {};\n const isToday = dayjs(dayDate).isSame(today, 'day') && highlightToday;\n const isSelected = _selectedDate && dayjs(dayDate).isSame(dayjs(_selectedDate), 'day');\n const dayEvents = groupedEvents[dayjs(dayDate).format('YYYY-MM-DD')] || [];\n\n const shouldRender = withOutsideDays || !outside;\n\n if (shouldRender && firstDayPosition.current === null) {\n firstDayPosition.current = { weekIndex, dayIndex };\n }\n\n const isFirstDay =\n firstDayPosition.current?.weekIndex === weekIndex &&\n firstDayPosition.current?.dayIndex === dayIndex;\n\n const indicators = dayEvents.slice(0, 3).map((event) => (\n <div\n {...getStyles('mobileMonthViewDayIndicator', {\n style: { backgroundColor: getThemeColor(event.color, theme) },\n })}\n key={event.id}\n />\n ));\n\n const handleDayClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n const dateStr = dayjs(dayDate).format('YYYY-MM-DD');\n _setSelectedDate(dateStr);\n onDayClick?.(dateStr, event);\n dayProps.onClick?.(event);\n };\n\n const handleDayKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n handleMonthViewKeyDown({\n controlsRef: daysRef,\n weekIndex,\n dayIndex,\n event,\n });\n };\n\n return (\n <UnstyledButton\n aria-label={ariaLabel}\n aria-selected={isSelected || undefined}\n {...dayProps}\n {...getStyles('mobileMonthViewDay', {\n className: dayProps.className,\n style: dayProps.style,\n })}\n key={dayDate}\n ref={(node) => {\n if (node) {\n if (!daysRef.current[weekIndex]) {\n daysRef.current[weekIndex] = [];\n }\n daysRef.current[weekIndex][dayIndex] = node;\n }\n }}\n mod={[\n {\n outside,\n weekend,\n today: isToday,\n selected: isSelected,\n static: mode === 'static',\n hidden: !shouldRender,\n },\n dayProps.mod,\n ]}\n tabIndex={mode === 'static' || !shouldRender ? -1 : isFirstDay ? 0 : -1}\n onClick={mode === 'static' || !shouldRender ? undefined : handleDayClick}\n onKeyDown={mode === 'static' || !shouldRender ? undefined : handleDayKeyDown}\n >\n {shouldRender ? dayjs(dayDate).format('D') : null}\n {shouldRender && <div {...getStyles('mobileMonthViewDayIndicators')}>{indicators}</div>}\n </UnstyledButton>\n );\n });\n\n const weekNumberProps = getWeekNumberProps?.(dayjs(week[0]).format('YYYY-MM-DD')) || {};\n const weekNumber = getWeekNumber(week);\n\n return (\n <div {...getStyles('mobileMonthViewWeek')} key={weekIndex}>\n {withWeekNumbers && (\n <UnstyledButton\n key={weekNumber}\n aria-label={`Week ${weekNumber}`}\n {...weekNumberProps}\n onClick={\n mode === 'static'\n ? undefined\n : (event) => {\n onWeekNumberClick?.(dayjs(week[0]).format('YYYY-MM-DD'), event);\n weekNumberProps.onClick?.(event);\n }\n }\n mod={{ static: mode === 'static' }}\n tabIndex={mode === 'static' ? -1 : 0}\n {...getStyles('mobileMonthViewWeekNumber', {\n className: weekNumberProps.className,\n style: weekNumberProps.style,\n })}\n >\n {weekNumber}\n </UnstyledButton>\n )}\n {days}\n </div>\n );\n });\n\n const selectedDateEvents = _selectedDate\n ? sortEvents(groupedEvents[dayjs(_selectedDate).format('YYYY-MM-DD')] || [])\n : [];\n\n const eventsList = selectedDateEvents.map((event) => {\n const startTime = dayjs(event.start).format('HH:mm');\n const endTime = dayjs(event.end).format('HH:mm');\n const isAllDay = startTime === '00:00' && endTime === '00:00';\n\n const eventChildren = (\n <Box {...getStyles('mobileMonthViewEventBody')}>\n <div\n {...getStyles('mobileMonthViewEventColor', {\n style: { backgroundColor: getThemeColor(event.color, theme) },\n })}\n />\n <div>\n <Text {...getStyles('mobileMonthViewEventTitle')}>{event.title}</Text>\n <Text {...getStyles('mobileMonthViewEventTime')}>\n {isAllDay ? 'All day' : `${startTime} – ${endTime}`}\n </Text>\n </div>\n </Box>\n );\n\n const rootProps: React.ComponentPropsWithoutRef<'button'> & { children: React.ReactNode } = {\n ...getStyles('mobileMonthViewEvent'),\n onClick:\n mode === 'static'\n ? undefined\n : (e: React.MouseEvent<HTMLButtonElement>) => {\n onEventClick?.(event, e);\n },\n tabIndex: mode === 'static' ? -1 : 0,\n children: eventChildren,\n };\n\n if (typeof renderEvent === 'function') {\n return <React.Fragment key={event.id}>{renderEvent(event, rootProps)}</React.Fragment>;\n }\n\n return <UnstyledButton {...rootProps} key={event.id} />;\n });\n\n const eventsHeader = _selectedDate\n ? formatDate({\n locale: ctx.getLocale(locale),\n date: _selectedDate,\n format: eventsHeaderFormat,\n })\n : '';\n\n const { dir } = useDirection();\n\n const headerLabel = formatDate({ locale: ctx.getLocale(locale), date, format: 'MMMM YYYY' });\n\n const defaultHeader = (\n <>\n <UnstyledButton\n {...getStyles('mobileMonthViewHeaderBackButton')}\n onClick={onYearClick}\n mod={{ static: mode === 'static' }}\n tabIndex={mode === 'static' ? -1 : 0}\n >\n <AccordionChevron\n style={{ transform: `rotate(${dir === 'rtl' ? -90 : 90}deg)` }}\n size={20}\n />\n {dayjs(date).format('YYYY')}\n </UnstyledButton>\n <Text {...getStyles('mobileMonthViewHeaderLabel')}>{headerLabel}</Text>\n </>\n );\n\n return (\n <Box\n {...getStyles('mobileMonthView')}\n mod={{ 'with-week-numbers': withWeekNumbers }}\n {...others}\n >\n <div {...getStyles('mobileMonthViewHeader')}>\n {typeof renderHeader === 'function'\n ? renderHeader({ mode: mode!, date, defaultHeader })\n : defaultHeader}\n </div>\n\n <Box {...getStyles('mobileMonthViewCalendar')} mod={{ 'with-weekdays': withWeekDays }}>\n {weekdays && (\n <div {...getStyles('mobileMonthViewWeekdays')}>\n {withWeekNumbers && <div {...getStyles('mobileMonthViewWeekdaysCorner')} />}\n {weekdays}\n </div>\n )}\n {weeks}\n </Box>\n\n <Box {...getStyles('mobileMonthViewEventsList')}>\n <Text {...getStyles('mobileMonthViewEventsHeader')}>{eventsHeader}</Text>\n\n {eventsList.length > 0 ? (\n eventsList\n ) : (\n <Text {...getStyles('mobileMonthViewNoEvents')}>{getLabel('noEvents', labels)}</Text>\n )}\n </Box>\n </Box>\n );\n});\n\nMobileMonthView.displayName = '@mantine/schedule/MobileMonthView';\nMobileMonthView.classes = classes;\nMobileMonthView.varsResolver = varsResolver;\n\nexport namespace MobileMonthView {\n export type Props = MobileMonthViewProps;\n export type Factory = MobileMonthViewFactory;\n export type StylesNames = MobileMonthViewStylesNames;\n export type CssVariables = MobileMonthViewCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqLA,MAAM,eAAe;CACnB,kBAAkB;CAClB,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,MAAM;CACN,oBAAoB;AACtB;AAEA,MAAM,eAAe,oBAA4C,QAAQ,EAAE,cAAc,EACvF,iBAAiB,EACf,8BAA8B,UAAU,MAAM,EAChD,EACF,EAAE;AAEF,MAAa,kBAAkB,SAAiC,WAAW;CACzE,MAAM,QAAQ,SAAS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AA6B;KAAI,UAAA;IAAmB,CAAA,GAEvE,WAAW,SAAS,IACnB,aAEA,oBAAC,MAAD;KAAM,GAAI,UAAU,yBAAyB;KAAI,UAAA,SAAS,YAAY,MAAM;IAAQ,CAAA,CAEnF;;EACF;;AAET,CAAC;AAED,gBAAgB,cAAc;AAC9B,gBAAgB,UAAUA;AAC1B,gBAAgB,eAAe"}
1
+ {"version":3,"file":"MobileMonthView.mjs","names":["classes"],"sources":["../../../src/components/MobileMonthView/MobileMonthView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport React, { useRef } from 'react';\nimport {\n AccordionChevron,\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n getThemeColor,\n MantineRadius,\n StylesApiProps,\n Text,\n UnstyledButton,\n useDirection,\n useMantineTheme,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n} from '../../types';\nimport {\n expandRecurringEvents,\n formatDate,\n getMonthDays,\n getWeekdaysNames,\n getWeekNumber,\n isSameMonth,\n sortEvents,\n toDateString,\n} from '../../utils';\nimport {\n handleMonthViewKeyDown,\n MonthViewControlsRef,\n} from '../MonthView/handle-month-view-key-down';\nimport { RenderEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { getMobileMonthViewEvents } from './get-mobile-month-view-events';\nimport classes from './MobileMonthView.module.css';\n\nexport type MobileMonthViewStylesNames =\n | 'mobileMonthView'\n | 'mobileMonthViewHeader'\n | 'mobileMonthViewHeaderBackButton'\n | 'mobileMonthViewHeaderLabel'\n | 'mobileMonthViewCalendar'\n | 'mobileMonthViewWeekdays'\n | 'mobileMonthViewWeekday'\n | 'mobileMonthViewWeekdaysCorner'\n | 'mobileMonthViewWeek'\n | 'mobileMonthViewWeekNumber'\n | 'mobileMonthViewDay'\n | 'mobileMonthViewDayIndicators'\n | 'mobileMonthViewDayIndicator'\n | 'mobileMonthViewEventsList'\n | 'mobileMonthViewEventsHeader'\n | 'mobileMonthViewEvent'\n | 'mobileMonthViewEventColor'\n | 'mobileMonthViewEventBody'\n | 'mobileMonthViewEventTitle'\n | 'mobileMonthViewEventTime'\n | 'mobileMonthViewNoEvents';\n\nexport type MobileMonthViewCssVariables = {\n mobileMonthView: '--mobile-month-view-radius';\n};\n\nexport interface MobileMonthViewRenderHeaderInput {\n /** Current interaction mode */\n mode: ScheduleMode;\n /** Current date displayed in the view */\n date: Date | string;\n /** Default header element */\n defaultHeader: React.ReactNode;\n}\n\nexport interface MobileMonthViewProps\n extends BoxProps, StylesApiProps<MobileMonthViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Date to display, Date object or date string in `YYYY-MM-DD 00:00:00` format */\n date: Date | string;\n\n /** Called with the new date value when a date is selected */\n onDateChange?: (value: DateStringValue) => void;\n\n /** Currently selected date (controlled) */\n selectedDate?: Date | string | null;\n\n /** Default selected date (uncontrolled) */\n defaultSelectedDate?: Date | string | null;\n\n /** Called when selected date changes */\n onSelectedDateChange?: (value: DateStringValue | null) => void;\n\n /** If set, week numbers are displayed in the first column @default false */\n withWeekNumbers?: boolean;\n\n /** If set, weekdays names are displayed in the first row @default true */\n withWeekDays?: boolean;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** Number 0-6, where 0 – Sunday and 6 – Saturday. @default 1 – Monday */\n firstDayOfWeek?: DayOfWeek;\n\n /** `dayjs` format for weekdays names. By default, the first letter of the weekday. */\n weekdayFormat?: DateLabelFormat;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** Props passed down to the week number button */\n getWeekNumberProps?: (weekStartDate: DateStringValue) => Record<string, any>;\n\n /** Props passed down to the day button */\n getDayProps?: (date: DateStringValue) => Record<string, any>;\n\n /** Called when day is clicked */\n onDayClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called with first day of the week when week number is clicked */\n onWeekNumberClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, always renders 6 weeks in the month view @default true */\n consistentWeeks?: boolean;\n\n /** If set, highlights the current day @default true */\n highlightToday?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set, days from the previous and next months are displayed to fill the weeks @default false */\n withOutsideDays?: boolean;\n\n /** Events to display */\n events?: ScheduleEventData[];\n\n /** Labels override for i18n */\n labels?: ScheduleLabelsOverride;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default 'default' */\n mode?: ScheduleMode;\n\n /** Function to fully customize event rendering, receives all props that would be passed to the root element including children */\n renderEvent?: RenderEvent;\n\n /** Format for the events list header date @default 'dddd, MMMM D' */\n eventsHeaderFormat?: DateLabelFormat;\n\n /** Called when the year back button in the header is clicked */\n onYearClick?: () => void;\n\n /** Called when event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Custom header renderer, receives object with mode, date, and default header element */\n renderHeader?: (input: MobileMonthViewRenderHeaderInput) => React.ReactNode;\n\n /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n}\n\nexport type MobileMonthViewFactory = Factory<{\n props: MobileMonthViewProps;\n ref: HTMLDivElement;\n stylesNames: MobileMonthViewStylesNames;\n vars: MobileMonthViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'MobileMonthView',\n withWeekDays: true,\n consistentWeeks: true,\n highlightToday: true,\n mode: 'default',\n eventsHeaderFormat: 'dddd, MMMM D',\n} satisfies Partial<MobileMonthViewProps>;\n\nconst varsResolver = createVarsResolver<MobileMonthViewFactory>((_theme, { radius }) => ({\n mobileMonthView: {\n '--mobile-month-view-radius': getRadius(radius),\n },\n}));\n\nexport const MobileMonthView = factory<MobileMonthViewFactory>((_props) => {\n const props = useProps('MobileMonthView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n __staticSelector,\n date,\n onDateChange,\n selectedDate,\n defaultSelectedDate,\n onSelectedDateChange,\n withWeekNumbers,\n withWeekDays,\n locale,\n firstDayOfWeek,\n weekdayFormat,\n weekendDays,\n getWeekNumberProps,\n getDayProps,\n onDayClick,\n onWeekNumberClick,\n consistentWeeks,\n highlightToday,\n radius,\n withOutsideDays,\n events,\n labels,\n mode,\n renderEvent,\n eventsHeaderFormat,\n onYearClick,\n onEventClick,\n renderHeader,\n recurrenceExpansionLimit,\n ...others\n } = props;\n\n const ctx = useDatesContext();\n const theme = useMantineTheme();\n const today = dayjs();\n\n const [_selectedDate, _setSelectedDate] = useUncontrolled<Date | string | null>({\n value: selectedDate,\n defaultValue: defaultSelectedDate ?? toDateString(today),\n onChange: (value) => onSelectedDateChange?.(value ? toDateString(dayjs(value)) : null),\n });\n\n const getStyles = useStyles<MobileMonthViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'mobileMonthView',\n });\n\n const daysRef: MonthViewControlsRef = useRef<HTMLButtonElement[][]>([]);\n const firstDayPosition = useRef<{ weekIndex: number; dayIndex: number } | null>(null);\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(date).startOf('month').toDate(),\n rangeEnd: dayjs(date).endOf('month').toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const groupedEvents = getMobileMonthViewEvents({ date, events: expandedEvents });\n\n const weekdays = withWeekDays\n ? getWeekdaysNames({\n locale: ctx.getLocale(locale),\n format: weekdayFormat,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n }).map((day, index) => (\n <div {...getStyles('mobileMonthViewWeekday')} key={index}>\n {day}\n </div>\n ))\n : null;\n\n const weeks = getMonthDays({\n month: dayjs(date).format('YYYY-MM-DD'),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n consistentWeeks,\n }).map((week, weekIndex) => {\n const days = week.map((dayDate, dayIndex) => {\n const outside = !isSameMonth(dayDate, date);\n const weekend = ctx.getWeekendDays(weekendDays).includes(dayjs(dayDate).day());\n const ariaLabel = dayjs(dayDate)\n .locale(locale || ctx.locale)\n .format('MMMM D, YYYY');\n\n const dayProps = getDayProps?.(dayjs(dayDate).format('YYYY-MM-DD')) || {};\n const isToday = dayjs(dayDate).isSame(today, 'day') && highlightToday;\n const isSelected = _selectedDate && dayjs(dayDate).isSame(dayjs(_selectedDate), 'day');\n const dayEvents = groupedEvents[dayjs(dayDate).format('YYYY-MM-DD')] || [];\n\n const shouldRender = withOutsideDays || !outside;\n\n if (shouldRender && firstDayPosition.current === null) {\n firstDayPosition.current = { weekIndex, dayIndex };\n }\n\n const isFirstDay =\n firstDayPosition.current?.weekIndex === weekIndex &&\n firstDayPosition.current?.dayIndex === dayIndex;\n\n const indicators = dayEvents.slice(0, 3).map((event) => (\n <div\n {...getStyles('mobileMonthViewDayIndicator', {\n style: { backgroundColor: getThemeColor(event.color, theme) },\n })}\n key={event.id}\n />\n ));\n\n const handleDayClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n const dateStr = dayjs(dayDate).format('YYYY-MM-DD');\n _setSelectedDate(dateStr);\n onDayClick?.(dateStr, event);\n dayProps.onClick?.(event);\n };\n\n const handleDayKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n handleMonthViewKeyDown({\n controlsRef: daysRef,\n weekIndex,\n dayIndex,\n event,\n });\n };\n\n return (\n <UnstyledButton\n aria-label={ariaLabel}\n aria-selected={isSelected || undefined}\n {...dayProps}\n {...getStyles('mobileMonthViewDay', {\n className: dayProps.className,\n style: dayProps.style,\n })}\n key={dayDate}\n ref={(node) => {\n if (node) {\n if (!daysRef.current[weekIndex]) {\n daysRef.current[weekIndex] = [];\n }\n daysRef.current[weekIndex][dayIndex] = node;\n }\n }}\n mod={[\n {\n outside,\n weekend,\n today: isToday,\n selected: isSelected,\n static: mode === 'static',\n hidden: !shouldRender,\n },\n dayProps.mod,\n ]}\n tabIndex={mode === 'static' || !shouldRender ? -1 : isFirstDay ? 0 : -1}\n onClick={mode === 'static' || !shouldRender ? undefined : handleDayClick}\n onKeyDown={mode === 'static' || !shouldRender ? undefined : handleDayKeyDown}\n >\n {shouldRender ? dayjs(dayDate).format('D') : null}\n {shouldRender && <div {...getStyles('mobileMonthViewDayIndicators')}>{indicators}</div>}\n </UnstyledButton>\n );\n });\n\n const weekNumberProps = getWeekNumberProps?.(dayjs(week[0]).format('YYYY-MM-DD')) || {};\n const weekNumber = getWeekNumber(week);\n\n return (\n <div {...getStyles('mobileMonthViewWeek')} key={weekIndex}>\n {withWeekNumbers && (\n <UnstyledButton\n key={weekNumber}\n aria-label={`Week ${weekNumber}`}\n {...weekNumberProps}\n onClick={\n mode === 'static'\n ? undefined\n : (event) => {\n onWeekNumberClick?.(dayjs(week[0]).format('YYYY-MM-DD'), event);\n weekNumberProps.onClick?.(event);\n }\n }\n mod={{ static: mode === 'static' }}\n tabIndex={mode === 'static' ? -1 : 0}\n {...getStyles('mobileMonthViewWeekNumber', {\n className: weekNumberProps.className,\n style: weekNumberProps.style,\n })}\n >\n {weekNumber}\n </UnstyledButton>\n )}\n {days}\n </div>\n );\n });\n\n const selectedDateEvents = _selectedDate\n ? sortEvents(groupedEvents[dayjs(_selectedDate).format('YYYY-MM-DD')] || [])\n : [];\n\n const eventsList = selectedDateEvents.map((event) => {\n const startTime = dayjs(event.start).format('HH:mm');\n const endTime = dayjs(event.end).format('HH:mm');\n const isAllDay = startTime === '00:00' && endTime === '00:00';\n\n const eventChildren = (\n <Box {...getStyles('mobileMonthViewEventBody')}>\n <div\n {...getStyles('mobileMonthViewEventColor', {\n style: { backgroundColor: getThemeColor(event.color, theme) },\n })}\n />\n <div>\n <Text {...getStyles('mobileMonthViewEventTitle')}>{event.title}</Text>\n <Text {...getStyles('mobileMonthViewEventTime')}>\n {isAllDay ? getLabel('allDay', labels) : `${startTime} – ${endTime}`}\n </Text>\n </div>\n </Box>\n );\n\n const rootProps: React.ComponentPropsWithoutRef<'button'> & { children: React.ReactNode } = {\n ...getStyles('mobileMonthViewEvent'),\n onClick:\n mode === 'static'\n ? undefined\n : (e: React.MouseEvent<HTMLButtonElement>) => {\n onEventClick?.(event, e);\n },\n tabIndex: mode === 'static' ? -1 : 0,\n children: eventChildren,\n };\n\n if (typeof renderEvent === 'function') {\n return <React.Fragment key={event.id}>{renderEvent(event, rootProps)}</React.Fragment>;\n }\n\n return <UnstyledButton {...rootProps} key={event.id} />;\n });\n\n const eventsHeader = _selectedDate\n ? formatDate({\n locale: ctx.getLocale(locale),\n date: _selectedDate,\n format: eventsHeaderFormat,\n })\n : '';\n\n const { dir } = useDirection();\n\n const headerLabel = formatDate({ locale: ctx.getLocale(locale), date, format: 'MMMM YYYY' });\n\n const defaultHeader = (\n <>\n <UnstyledButton\n {...getStyles('mobileMonthViewHeaderBackButton')}\n onClick={onYearClick}\n mod={{ static: mode === 'static' }}\n tabIndex={mode === 'static' ? -1 : 0}\n >\n <AccordionChevron\n style={{ transform: `rotate(${dir === 'rtl' ? -90 : 90}deg)` }}\n size={20}\n />\n {dayjs(date).format('YYYY')}\n </UnstyledButton>\n <Text {...getStyles('mobileMonthViewHeaderLabel')}>{headerLabel}</Text>\n </>\n );\n\n return (\n <Box\n {...getStyles('mobileMonthView')}\n mod={{ 'with-week-numbers': withWeekNumbers }}\n {...others}\n >\n <div {...getStyles('mobileMonthViewHeader')}>\n {typeof renderHeader === 'function'\n ? renderHeader({ mode: mode!, date, defaultHeader })\n : defaultHeader}\n </div>\n\n <Box {...getStyles('mobileMonthViewCalendar')} mod={{ 'with-weekdays': withWeekDays }}>\n {weekdays && (\n <div {...getStyles('mobileMonthViewWeekdays')}>\n {withWeekNumbers && <div {...getStyles('mobileMonthViewWeekdaysCorner')} />}\n {weekdays}\n </div>\n )}\n {weeks}\n </Box>\n\n <Box {...getStyles('mobileMonthViewEventsList')}>\n <Text {...getStyles('mobileMonthViewEventsHeader')}>{eventsHeader}</Text>\n\n {eventsList.length > 0 ? (\n eventsList\n ) : (\n <Text {...getStyles('mobileMonthViewNoEvents')}>{getLabel('noEvents', labels)}</Text>\n )}\n </Box>\n </Box>\n );\n});\n\nMobileMonthView.displayName = '@mantine/schedule/MobileMonthView';\nMobileMonthView.classes = classes;\nMobileMonthView.varsResolver = varsResolver;\n\nexport namespace MobileMonthView {\n export type Props = MobileMonthViewProps;\n export type Factory = MobileMonthViewFactory;\n export type StylesNames = MobileMonthViewStylesNames;\n export type CssVariables = MobileMonthViewCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqLA,MAAM,eAAe;CACnB,kBAAkB;CAClB,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,MAAM;CACN,oBAAoB;AACtB;AAEA,MAAM,eAAe,oBAA4C,QAAQ,EAAE,cAAc,EACvF,iBAAiB,EACf,8BAA8B,UAAU,MAAM,EAChD,EACF,EAAE;AAEF,MAAa,kBAAkB,SAAiC,WAAW;CACzE,MAAM,QAAQ,SAAS,mBAAmB,cAAc,MAAM;CAC9D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,YACA,kBACA,MACA,cACA,cACA,qBACA,sBACA,iBACA,cACA,QACA,gBACA,eACA,aACA,oBACA,aACA,YACA,mBACA,iBACA,gBACA,QACA,iBACA,QACA,QACA,MACA,aACA,oBACA,aACA,cACA,cACA,0BACA,GAAG,WACD;CAEJ,MAAM,MAAM,gBAAgB;CAC5B,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,QAAQ,MAAM;CAEpB,MAAM,CAAC,eAAe,oBAAoB,gBAAsC;EAC9E,OAAO;EACP,cAAc,uBAAuB,aAAa,KAA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,oBAAC,kBAAD;GACE,OAAO,EAAE,WAAW,UAAU,QAAQ,QAAQ,MAAM,GAAG,MAAM;GAC7D,MAAM;EACP,CAAA,GACA,MAAM,IAAI,CAAC,CAAC,OAAO,MAAM,CACZ;CAChB,CAAA,GAAA,oBAAC,MAAD;EAAM,GAAI,UAAU,4BAA4B;EAAI,UAAA;CAAkB,CAAA,CACtE,EAAA,CAAA;CAGJ,OACE,qBAAC,KAAD;EACE,GAAI,UAAU,iBAAiB;EAC/B,KAAK,EAAE,qBAAqB,gBAAgB;EAC5C,GAAI;EAHN,UAAA;GAKE,oBAAC,OAAD;IAAK,GAAI,UAAU,uBAAuB;IACvC,UAAA,OAAO,iBAAiB,aACrB,aAAa;KAAQ;KAAO;KAAM;IAAc,CAAC,IACjD;GACD,CAAA;GAEL,qBAAC,KAAD;IAAK,GAAI,UAAU,yBAAyB;IAAG,KAAK,EAAE,iBAAiB,aAAa;IAApF,UAAA,CACG,YACC,qBAAC,OAAD;KAAK,GAAI,UAAU,yBAAyB;KAA5C,UAAA,CACG,mBAAmB,oBAAC,OAAD,EAAK,GAAI,UAAU,+BAA+B,EAAI,CAAA,GACzE,QACE;IAEN,CAAA,GAAA,KACE;;GAEL,qBAAC,KAAD;IAAK,GAAI,UAAU,2BAA2B;IAA9C,UAAA,CACE,oBAAC,MAAD;KAAM,GAAI,UAAU,6BAA6B;KAAI,UAAA;IAAmB,CAAA,GAEvE,WAAW,SAAS,IACnB,aAEA,oBAAC,MAAD;KAAM,GAAI,UAAU,yBAAyB;KAAI,UAAA,SAAS,YAAY,MAAM;IAAQ,CAAA,CAEnF;;EACF;;AAET,CAAC;AAED,gBAAgB,cAAc;AAC9B,gBAAgB,UAAUA;AAC1B,gBAAgB,eAAe"}
@@ -15,6 +15,7 @@ import { getOrderedResources } from "../../utils/get-ordered-resources/get-order
15
15
  import { handleResourcesGridKeyDown } from "../../utils/handle-resources-grid-key-down/handle-resources-grid-key-down.mjs";
16
16
  import { getGroupToResourceIdMap } from "../../utils/get-group-to-resource-id-map/get-group-to-resource-id-map.mjs";
17
17
  import { getIndexFromDragPoint } from "../../utils/get-index-from-drag-point/get-index-from-drag-point.mjs";
18
+ import { getOverlapClusters } from "../../utils/get-overlap-clusters/get-overlap-clusters.mjs";
18
19
  import { useDragDropHandlers } from "../../hooks/use-drag-drop-handlers.mjs";
19
20
  import { useSlotDragSelect } from "../../hooks/use-slot-drag-select.mjs";
20
21
  import { DragContext } from "../DragContext/DragContext.mjs";
@@ -23,7 +24,6 @@ import { MoreEvents } from "../MoreEvents/MoreEvents.mjs";
23
24
  import { ScheduleBackgroundEvent } from "../ScheduleBackgroundEvent/ScheduleBackgroundEvent.mjs";
24
25
  import { ScheduleHeaderBase } from "../ScheduleHeader/ScheduleHeaderBase.mjs";
25
26
  import { useHorizontalEventResize } from "../../hooks/use-horizontal-event-resize.mjs";
26
- import { getOverlapClusters } from "./get-overlap-clusters/get-overlap-clusters.mjs";
27
27
  import { getResourcesDayViewEvents } from "./get-resources-day-view-events/get-resources-day-view-events.mjs";
28
28
  import { ResourcesDayViewRow } from "./ResourcesDayViewColumn.mjs";
29
29
  import ResourcesDayView_module_default from "./ResourcesDayView.module.mjs";
@@ -207,7 +207,8 @@ const ResourcesDayView = factory((_props) => {
207
207
  intervalMinutes,
208
208
  resizeIntervalMinutes: eventResizeInterval,
209
209
  onEventResize,
210
- canResizeEvent
210
+ canResizeEvent,
211
+ withBackgroundEvents: withInteractiveBackgroundEvents
211
212
  });
212
213
  const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== "static";
213
214
  const handleTimeSlotClick = (resourceId, slotTime, e) => {
@@ -342,19 +343,43 @@ const ResourcesDayView = factory((_props) => {
342
343
  };
343
344
  const interactiveBackgroundEvents = withInteractiveBackgroundEvents && mode !== "static";
344
345
  const rows = orderedResources.map((resource, resourceIndex) => {
345
- const backgroundEventNodes = [...resourceEvents.backgroundTimedEvents[resource.id] || [], ...resourceEvents.backgroundAllDayEvents[resource.id] || []].map((event) => /* @__PURE__ */ jsx(ScheduleBackgroundEvent, {
346
- event,
347
- renderEvent,
348
- renderEventBody,
349
- interactive: interactiveBackgroundEvents,
350
- onEventClick,
351
- ...getStyles("resourcesDayViewBackgroundEvent", { style: {
352
- left: `${event.position.top}%`,
353
- width: `${event.position.height}%`,
354
- top: 0,
355
- height: "100%"
356
- } })
357
- }, `bg-${event.id}`));
346
+ const renderBackgroundEvent = (event, allDay) => {
347
+ const isResizable = !allDay && eventResize.isResizableEvent(event);
348
+ const resizePosition = eventResize.getResizePosition(event.id);
349
+ return /* @__PURE__ */ jsx(ScheduleBackgroundEvent, {
350
+ event,
351
+ renderEvent,
352
+ renderEventBody,
353
+ interactive: interactiveBackgroundEvents,
354
+ onEventClick: onEventClick ? (clickedEvent, e) => {
355
+ if (!eventResize.wasResizing()) onEventClick(clickedEvent, e);
356
+ } : void 0,
357
+ withResize: isResizable,
358
+ isResizing: resizePosition !== null,
359
+ activeResizeEdge: eventResize.resizingEdge,
360
+ resizeAxis: "horizontal",
361
+ resizeHandleProps: getStyles("resourcesDayViewResizeHandle"),
362
+ onResizeStart: isResizable ? (edge, e) => {
363
+ const container = rowSlotsContainersRef.current[resourceIndex];
364
+ if (container) eventResize.handleResizeStart({
365
+ event,
366
+ edge,
367
+ container,
368
+ originalLeft: event.position.top,
369
+ originalWidth: event.position.height,
370
+ eventDate: dateStr,
371
+ pointerEvent: e
372
+ });
373
+ } : void 0,
374
+ ...getStyles("resourcesDayViewBackgroundEvent", { style: {
375
+ left: `${resizePosition ? resizePosition.left : event.position.top}%`,
376
+ width: `${resizePosition ? resizePosition.width : event.position.height}%`,
377
+ top: 0,
378
+ height: "100%"
379
+ } })
380
+ }, `bg-${event.id}`);
381
+ };
382
+ const backgroundEventNodes = [...(resourceEvents.backgroundTimedEvents[resource.id] || []).map((event) => renderBackgroundEvent(event, false)), ...(resourceEvents.backgroundAllDayEvents[resource.id] || []).map((event) => renderBackgroundEvent(event, true))];
358
383
  const allRegularEvents = (resourceEvents.regularEvents[resource.id] || []).filter((event) => !isAllDayEvent({
359
384
  event,
360
385
  date