@mantine/schedule 9.4.0 → 9.4.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 (27) hide show
  1. package/cjs/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.cjs +17 -3
  2. package/cjs/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.cjs.map +1 -1
  3. package/cjs/components/ResourcesSchedule/ResourcesSchedule.cjs +3 -0
  4. package/cjs/components/ResourcesSchedule/ResourcesSchedule.cjs.map +1 -1
  5. package/cjs/components/ResourcesWeekView/ResourcesWeekView.cjs +74 -8
  6. package/cjs/components/ResourcesWeekView/ResourcesWeekView.cjs.map +1 -1
  7. package/cjs/hooks/use-horizontal-event-resize.cjs +12 -4
  8. package/cjs/hooks/use-horizontal-event-resize.cjs.map +1 -1
  9. package/cjs/index.cjs +2 -0
  10. package/cjs/utils/get-day-relative-percent/get-day-relative-percent.cjs +18 -0
  11. package/cjs/utils/get-day-relative-percent/get-day-relative-percent.cjs.map +1 -0
  12. package/esm/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.mjs +17 -3
  13. package/esm/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.mjs.map +1 -1
  14. package/esm/components/ResourcesSchedule/ResourcesSchedule.mjs +3 -0
  15. package/esm/components/ResourcesSchedule/ResourcesSchedule.mjs.map +1 -1
  16. package/esm/components/ResourcesWeekView/ResourcesWeekView.mjs +75 -9
  17. package/esm/components/ResourcesWeekView/ResourcesWeekView.mjs.map +1 -1
  18. package/esm/hooks/use-horizontal-event-resize.mjs +12 -4
  19. package/esm/hooks/use-horizontal-event-resize.mjs.map +1 -1
  20. package/esm/index.mjs +2 -1
  21. package/esm/utils/get-day-relative-percent/get-day-relative-percent.mjs +18 -0
  22. package/esm/utils/get-day-relative-percent/get-day-relative-percent.mjs.map +1 -0
  23. package/lib/components/ResourcesWeekView/ResourcesWeekView.d.ts +11 -0
  24. package/lib/hooks/use-horizontal-event-resize.d.ts +3 -1
  25. package/lib/utils/get-day-relative-percent/get-day-relative-percent.d.ts +15 -0
  26. package/lib/utils/index.d.ts +1 -0
  27. package/package.json +4 -4
@@ -37,8 +37,8 @@ function getResourcesDayViewEvents({ events, resources, date, startTime, endTime
37
37
  const eventStart = (0, dayjs.default)(event.start);
38
38
  const eventEnd = (0, dayjs.default)(event.end);
39
39
  const isOnDay = eventStart.isSame(dayStart, "day");
40
- const spansIntoDay = !isOnDay && event.display === "background" && eventStart.isBefore(dayEnd) && eventEnd.isAfter(dayStart);
41
- if (isOnDay || spansIntoDay) {
40
+ const overlapsDay = eventStart.isBefore(dayEnd) && eventEnd.isAfter(dayStart);
41
+ if (isOnDay || overlapsDay) {
42
42
  if (isOnDay && !require_is_event_in_time_range.isEventInTimeRange({
43
43
  event,
44
44
  startTime,
@@ -48,7 +48,21 @@ function getResourcesDayViewEvents({ events, resources, date, startTime, endTime
48
48
  if (!ids.has(event.id)) ids.add(event.id);
49
49
  else throw new Error(`[@mantine/schedule] ResourcesDayView: Duplicated event ids found: ${event.id}`);
50
50
  if (event.display === "background") backgroundByResource[event.resourceId].push(validated);
51
- else eventsByResource[event.resourceId].push(validated);
51
+ else if (isOnDay) eventsByResource[event.resourceId].push(validated);
52
+ else {
53
+ const clippedStart = eventStart.isBefore(dayStart) ? dayStart : eventStart;
54
+ const clippedEnd = eventEnd.isAfter(dayEnd) ? dayEnd : eventEnd;
55
+ const clippedEvent = {
56
+ ...validated,
57
+ start: clippedStart.format("YYYY-MM-DD HH:mm:ss"),
58
+ end: clippedEnd.format("YYYY-MM-DD HH:mm:ss")
59
+ };
60
+ if (require_is_event_in_time_range.isEventInTimeRange({
61
+ event: clippedEvent,
62
+ startTime,
63
+ endTime
64
+ })) eventsByResource[event.resourceId].push(clippedEvent);
65
+ }
52
66
  }
53
67
  }
54
68
  for (const resource of resources) {
@@ -1 +1 @@
1
- {"version":3,"file":"get-resources-day-view-events.cjs","names":["isEventInTimeRange","validateEvent","getDayPositionedEvents","isAllDayEvent","getDayPosition"],"sources":["../../../../src/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport {\n AnyDateValue,\n DayPositionedEventData,\n ScheduleEventData,\n ScheduleResourceData,\n} from '../../../types';\nimport { getDayPosition, isAllDayEvent, isEventInTimeRange, validateEvent } from '../../../utils';\nimport { getDayPositionedEvents } from '../../DayView/get-day-view-events/get-day-positioned-events';\n\ninterface GetResourcesDayViewEventsInput {\n events: ScheduleEventData[] | undefined;\n resources: ScheduleResourceData[];\n date: AnyDateValue;\n startTime?: string;\n endTime?: string;\n}\n\nexport interface ResourcesDayViewEventsResult {\n regularEvents: Record<string | number, DayPositionedEventData[]>;\n allDayEvents: Record<string | number, DayPositionedEventData[]>;\n backgroundTimedEvents: Record<string | number, DayPositionedEventData[]>;\n backgroundAllDayEvents: Record<string | number, DayPositionedEventData[]>;\n}\n\nexport function getResourcesDayViewEvents({\n events,\n resources,\n date,\n startTime,\n endTime,\n}: GetResourcesDayViewEventsInput): ResourcesDayViewEventsResult {\n const result: ResourcesDayViewEventsResult = {\n regularEvents: {},\n allDayEvents: {},\n backgroundTimedEvents: {},\n backgroundAllDayEvents: {},\n };\n\n for (const resource of resources) {\n result.regularEvents[resource.id] = [];\n result.allDayEvents[resource.id] = [];\n result.backgroundTimedEvents[resource.id] = [];\n result.backgroundAllDayEvents[resource.id] = [];\n }\n\n if (events === undefined) {\n return result;\n }\n\n const dayStart = dayjs(date).startOf('day');\n const dayEnd = dayjs(date).endOf('day');\n\n const eventsByResource: Record<string | number, ScheduleEventData[]> = {};\n const backgroundByResource: Record<string | number, ScheduleEventData[]> = {};\n\n for (const resource of resources) {\n eventsByResource[resource.id] = [];\n backgroundByResource[resource.id] = [];\n }\n\n const ids = new Set<string | number>();\n\n for (const event of events) {\n if (event.resourceId === undefined) {\n continue;\n }\n\n if (!(event.resourceId in eventsByResource)) {\n continue;\n }\n\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(\n `[@mantine/schedule] ResourcesDayView: Duplicated event ids found: ${event.id}`\n );\n }\n\n if (event.display === 'background') {\n backgroundByResource[event.resourceId].push(validated);\n } else {\n eventsByResource[event.resourceId].push(validated);\n }\n }\n }\n\n for (const resource of resources) {\n const positioned = getDayPositionedEvents({\n events: eventsByResource[resource.id],\n startTime,\n endTime,\n date,\n });\n\n for (const event of positioned) {\n if (event.position.allDay) {\n result.allDayEvents[resource.id].push(event);\n } else {\n result.regularEvents[resource.id].push(event);\n }\n }\n\n for (const event of backgroundByResource[resource.id]) {\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 result.backgroundAllDayEvents[resource.id].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({ event: clippedEvent, startTime, endTime });\n if (height <= 0) {\n continue;\n }\n result.backgroundTimedEvents[resource.id].push({\n ...event,\n position: { top, height, allDay: false, width: 100, offset: 0, column: 0, overlaps: 1 },\n });\n }\n }\n }\n\n return result;\n}\n"],"mapp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AC,KAAK;KAC7C,GAAG;KACH,UAAU;MAAE;MAAK;MAAQ,QAAQ;MAAO,OAAO;MAAK,QAAQ;MAAG,QAAQ;MAAG,UAAU;KAAE;IACxF,CAAC;GACH;EACF;CACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"get-resources-day-view-events.cjs","names":["isEventInTimeRange","validateEvent","getDayPositionedEvents","isAllDayEvent","getDayPosition"],"sources":["../../../../src/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport {\n AnyDateValue,\n DayPositionedEventData,\n ScheduleEventData,\n ScheduleResourceData,\n} from '../../../types';\nimport { getDayPosition, isAllDayEvent, isEventInTimeRange, validateEvent } from '../../../utils';\nimport { getDayPositionedEvents } from '../../DayView/get-day-view-events/get-day-positioned-events';\n\ninterface GetResourcesDayViewEventsInput {\n events: ScheduleEventData[] | undefined;\n resources: ScheduleResourceData[];\n date: AnyDateValue;\n startTime?: string;\n endTime?: string;\n}\n\nexport interface ResourcesDayViewEventsResult {\n regularEvents: Record<string | number, DayPositionedEventData[]>;\n allDayEvents: Record<string | number, DayPositionedEventData[]>;\n backgroundTimedEvents: Record<string | number, DayPositionedEventData[]>;\n backgroundAllDayEvents: Record<string | number, DayPositionedEventData[]>;\n}\n\nexport function getResourcesDayViewEvents({\n events,\n resources,\n date,\n startTime,\n endTime,\n}: GetResourcesDayViewEventsInput): ResourcesDayViewEventsResult {\n const result: ResourcesDayViewEventsResult = {\n regularEvents: {},\n allDayEvents: {},\n backgroundTimedEvents: {},\n backgroundAllDayEvents: {},\n };\n\n for (const resource of resources) {\n result.regularEvents[resource.id] = [];\n result.allDayEvents[resource.id] = [];\n result.backgroundTimedEvents[resource.id] = [];\n result.backgroundAllDayEvents[resource.id] = [];\n }\n\n if (events === undefined) {\n return result;\n }\n\n const dayStart = dayjs(date).startOf('day');\n const dayEnd = dayjs(date).endOf('day');\n\n const eventsByResource: Record<string | number, ScheduleEventData[]> = {};\n const backgroundByResource: Record<string | number, ScheduleEventData[]> = {};\n\n for (const resource of resources) {\n eventsByResource[resource.id] = [];\n backgroundByResource[resource.id] = [];\n }\n\n const ids = new Set<string | number>();\n\n for (const event of events) {\n if (event.resourceId === undefined) {\n continue;\n }\n\n if (!(event.resourceId in eventsByResource)) {\n continue;\n }\n\n const eventStart = dayjs(event.start);\n const eventEnd = dayjs(event.end);\n\n const isOnDay = eventStart.isSame(dayStart, 'day');\n const overlapsDay = eventStart.isBefore(dayEnd) && eventEnd.isAfter(dayStart);\n\n if (isOnDay || overlapsDay) {\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(\n `[@mantine/schedule] ResourcesDayView: Duplicated event ids found: ${event.id}`\n );\n }\n\n if (event.display === 'background') {\n backgroundByResource[event.resourceId].push(validated);\n } else if (isOnDay) {\n eventsByResource[event.resourceId].push(validated);\n } else {\n const clippedStart = eventStart.isBefore(dayStart) ? dayStart : eventStart;\n const clippedEnd = eventEnd.isAfter(dayEnd) ? dayEnd : eventEnd;\n\n const clippedEvent = {\n ...validated,\n start: clippedStart.format('YYYY-MM-DD HH:mm:ss'),\n end: clippedEnd.format('YYYY-MM-DD HH:mm:ss'),\n };\n\n if (isEventInTimeRange({ event: clippedEvent, startTime, endTime })) {\n eventsByResource[event.resourceId].push(clippedEvent);\n }\n }\n }\n }\n\n for (const resource of resources) {\n const positioned = getDayPositionedEvents({\n events: eventsByResource[resource.id],\n startTime,\n endTime,\n date,\n });\n\n for (const event of positioned) {\n if (event.position.allDay) {\n result.allDayEvents[resource.id].push(event);\n } else {\n result.regularEvents[resource.id].push(event);\n }\n }\n\n for (const event of backgroundByResource[resource.id]) {\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 result.backgroundAllDayEvents[resource.id].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({ event: clippedEvent, startTime, endTime });\n if (height <= 0) {\n continue;\n }\n result.backgroundTimedEvents[resource.id].push({\n ...event,\n position: { top, height, allDay: false, width: 100, offset: 0, column: 0, overlaps: 1 },\n });\n }\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,0BAA0B,EACxC,QACA,WACA,MACA,WACA,WAC+D;CAC/D,MAAM,SAAuC;EAC3C,eAAe,CAAC;EAChB,cAAc,CAAC;EACf,uBAAuB,CAAC;EACxB,wBAAwB,CAAC;CAC3B;CAEA,KAAK,MAAM,YAAY,WAAW;EAChC,OAAO,cAAc,SAAS,MAAM,CAAC;EACrC,OAAO,aAAa,SAAS,MAAM,CAAC;EACpC,OAAO,sBAAsB,SAAS,MAAM,CAAC;EAC7C,OAAO,uBAAuB,SAAS,MAAM,CAAC;CAChD;CAEA,IAAI,WAAW,KAAA,GACb,OAAO;CAGT,MAAM,YAAA,GAAA,MAAA,QAAA,CAAiB,IAAI,CAAC,CAAC,QAAQ,KAAK;CAC1C,MAAM,UAAA,GAAA,MAAA,QAAA,CAAe,IAAI,CAAC,CAAC,MAAM,KAAK;CAEtC,MAAM,mBAAiE,CAAC;CACxE,MAAM,uBAAqE,CAAC;CAE5E,KAAK,MAAM,YAAY,WAAW;EAChC,iBAAiB,SAAS,MAAM,CAAC;EACjC,qBAAqB,SAAS,MAAM,CAAC;CACvC;CAEA,MAAM,sBAAM,IAAI,IAAqB;CAErC,KAAK,MAAM,SAAS,QAAQ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E3C,OAAO,cAAc,SAAS,GAAG,CAAC,KAAK,KAAK;EAIhD,KAAK,MAAM,SAAS,qBAAqB,SAAS,KAAK;GACrD,MAAM,cAAA,GAAA,MAAA,QAAA,CAAmB,MAAM,KAAK;GACpC,MAAM,YAAA,GAAA,MAAA,QAAA,CAAiB,MAAM,GAAG;GAChC,MAAM,eAAe,WAAW,SAAS,QAAQ,IAAI,WAAW;GAChE,MAAM,aAAa,SAAS,QAAQ,MAAM,IAAI,SAAS;GAEvD,MAAM,eAAe;IACnB,GAAG;IACH,OAAO,aAAa,OAAO,qBAAqB;IAChD,KAAK,WAAW,OAAO,qBAAqB;GAC9C;GAIA,IAFeC,yBAAAA,cAAc;IAAE,OAAO;IAAc;GAAK,CAEhD,GACP,OAAO,uBAAuB,SAAS,GAAG,CAAC,KAAK;IAC9C,GAAG;IACH,UAAU;KACR,KAAK;KACL,QAAQ;KACR,QAAQ;KACR,OAAO;KACP,QAAQ;KACR,QAAQ;KACR,UAAU;IACZ;GACF,CAAC;QACI;IACL,MAAM,EAAE,KAAK,WAAWC,yBAAAA,eAAe;KAAE,OAAO;KAAc;KAAW;IAAQ,CAAC;IAClF,IAAI,UAAU,GACZ;IAEF,OAAO,sBAAsB,SAAS,GAAG,CAAC,KAAK;KAC7C,GAAG;KACH,UAAU;MAAE;MAAK;MAAQ,QAAQ;MAAO,OAAO;MAAK,QAAQ;MAAG,QAAQ;MAAG,UAAU;KAAE;IACxF,CAAC;GACH;EACF;CACF;CAEA,OAAO;AACT"}
@@ -77,6 +77,9 @@ const ResourcesSchedule = (0, _mantine_core.factory)((_props) => {
77
77
  case "week": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ResourcesWeekView.ResourcesWeekView, {
78
78
  ...commonProps,
79
79
  onTimeSlotClick,
80
+ withEventResize: mode === "static" ? false : withEventResize,
81
+ onEventResize,
82
+ canResizeEvent,
80
83
  ...weekViewProps
81
84
  });
82
85
  case "month": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ResourcesMonthView.ResourcesMonthView, {
@@ -1 +1 @@
1
- {"version":3,"file":"ResourcesSchedule.cjs","names":["ResourcesDayView","ResourcesWeekView","ResourcesMonthView","Box","classes"],"sources":["../../../src/components/ResourcesSchedule/ResourcesSchedule.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n ElementProps,\n factory,\n Factory,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { ScheduleLabelsOverride } from '../../labels';\nimport {\n DateStringValue,\n DateTimeStringValue,\n ScheduleEventData,\n ScheduleMode,\n ScheduleResourceData,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n ResourcesDayView,\n ResourcesDayViewProps,\n ResourcesDayViewStylesNames,\n} from '../ResourcesDayView/ResourcesDayView';\nimport {\n ResourcesMonthView,\n ResourcesMonthViewProps,\n ResourcesMonthViewStylesNames,\n} from '../ResourcesMonthView/ResourcesMonthView';\nimport {\n ResourcesWeekView,\n ResourcesWeekViewProps,\n ResourcesWeekViewStylesNames,\n} from '../ResourcesWeekView/ResourcesWeekView';\nimport { RenderEventBody } from '../ScheduleEvent/ScheduleEvent';\nimport classes from './ResourcesSchedule.module.css';\n\nexport type ResourcesScheduleStylesNames =\n | 'root'\n | ResourcesDayViewStylesNames\n | ResourcesWeekViewStylesNames\n | ResourcesMonthViewStylesNames;\n\nexport type ResourcesScheduleViewLevel = 'day' | 'week' | 'month';\n\ntype ResourcesScheduleCommonProps =\n | 'date'\n | 'onDateChange'\n | 'resources'\n | 'events'\n | 'locale'\n | 'radius'\n | 'labels'\n | 'renderEventBody'\n | 'renderResourceLabel'\n | 'withEventsDragAndDrop'\n | 'onEventDrop'\n | 'canDragEvent'\n | 'onEventDragStart'\n | 'onEventDragEnd'\n | 'onTimeSlotClick'\n | 'onEventClick'\n | 'onDayClick'\n | 'withDragSlotSelect'\n | 'onSlotDragEnd'\n | 'view'\n | 'onViewChange'\n | 'mode'\n | 'onExternalEventDrop'\n | 'withEventResize'\n | 'onEventResize'\n | 'canResizeEvent'\n | 'recurrenceExpansionLimit';\n\ntype ResourcesScheduleViewProps<T> = Partial<Omit<T, ResourcesScheduleCommonProps>>;\n\nexport interface ResourcesScheduleProps\n extends BoxProps, StylesApiProps<ResourcesScheduleFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** List of resources to display */\n resources: ScheduleResourceData[];\n\n /** Current date to display (controlled) */\n date?: Date | DateStringValue;\n\n /** Default date (uncontrolled) */\n defaultDate?: Date | DateStringValue;\n\n /** Called when date changes via navigation */\n onDateChange?: (date: DateStringValue) => void;\n\n /** Current view level (controlled) */\n view?: ResourcesScheduleViewLevel;\n\n /** Default view level (uncontrolled) @default 'day' */\n defaultView?: ResourcesScheduleViewLevel;\n\n /** Called when view level changes */\n onViewChange?: (view: ResourcesScheduleViewLevel) => void;\n\n /** Events to display across all views */\n events?: ScheduleEventData[];\n\n /** Locale for date formatting */\n locale?: string;\n\n /** Key of theme.radius or any valid CSS value to set border-radius */\n radius?: MantineRadius;\n\n /** Labels override for i18n */\n labels?: ScheduleLabelsOverride;\n\n /** Custom event body renderer */\n renderEventBody?: RenderEventBody;\n\n /** Custom resource label renderer */\n renderResourceLabel?: (resource: ScheduleResourceData) => React.ReactNode;\n\n /** Enable drag and drop for events @default false */\n withEventsDragAndDrop?: boolean;\n\n /** Called when event is dropped */\n onEventDrop?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n resourceId?: string | number;\n }) => void;\n\n /** Function to determine if event can be dragged */\n canDragEvent?: (event: ScheduleEventData) => boolean;\n\n /** Called when any event drag starts */\n onEventDragStart?: (event: ScheduleEventData) => void;\n\n /** Called when any event drag ends */\n onEventDragEnd?: () => void;\n\n /** Called when time slot is clicked */\n onTimeSlotClick?: (data: {\n slotStart: DateTimeStringValue;\n slotEnd: DateTimeStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n resourceId?: string | number;\n }) => void;\n\n /** Called when day is clicked in month view */\n onDayClick?: (data: {\n date: DateStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n resourceId?: string | number;\n }) => void;\n\n /** Called when event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select slot ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a slot range is selected by dragging */\n onSlotDragEnd?: (data: {\n rangeStart: DateTimeStringValue;\n rangeEnd: DateTimeStringValue;\n resourceId?: string | number;\n }) => void;\n\n /** Interaction mode @default default */\n mode?: ScheduleMode;\n\n /** Called when an external item is dropped onto the schedule */\n onExternalEventDrop?: (data: {\n dataTransfer: DataTransfer;\n dropDateTime: DateTimeStringValue;\n resourceId?: string | number;\n }) => void;\n\n /** If true, events can be resized @default false */\n withEventResize?: boolean;\n\n /** Called when event is resized */\n onEventResize?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be resized */\n canResizeEvent?: (event: ScheduleEventData) => boolean;\n\n /** Max number of generated recurring instances @default 2000 */\n recurrenceExpansionLimit?: number;\n\n /** Props specific to ResourcesDayView */\n dayViewProps?: ResourcesScheduleViewProps<ResourcesDayViewProps>;\n\n /** Props specific to ResourcesWeekView */\n weekViewProps?: ResourcesScheduleViewProps<ResourcesWeekViewProps>;\n\n /** Props specific to ResourcesMonthView */\n monthViewProps?: ResourcesScheduleViewProps<ResourcesMonthViewProps>;\n}\n\nexport type ResourcesScheduleFactory = Factory<{\n props: ResourcesScheduleProps;\n ref: HTMLDivElement;\n stylesNames: ResourcesScheduleStylesNames;\n}>;\n\nconst defaultProps: Partial<ResourcesScheduleProps> = {\n defaultView: 'day',\n mode: 'default',\n};\n\nexport const ResourcesSchedule = factory<ResourcesScheduleFactory>((_props) => {\n const props = useProps('ResourcesSchedule', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n resources,\n date,\n defaultDate,\n onDateChange,\n view,\n defaultView,\n onViewChange,\n events,\n locale,\n radius,\n labels,\n renderEventBody,\n renderResourceLabel,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onDayClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n mode,\n dayViewProps,\n weekViewProps,\n monthViewProps,\n __staticSelector,\n mod,\n ...others\n } = props;\n\n const getStyles = useStyles<ResourcesScheduleFactory>({\n name: __staticSelector || 'ResourcesSchedule',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n });\n\n const [_view, _setView] = useUncontrolled<ResourcesScheduleViewLevel>({\n value: view,\n defaultValue: defaultView,\n onChange: onViewChange,\n });\n\n const [_date, _setDate] = useUncontrolled<Date | DateStringValue>({\n value: date,\n defaultValue: defaultDate ?? new Date(),\n });\n\n const handleDateChange = (newDate: DateStringValue) => {\n _setDate(newDate);\n onDateChange?.(newDate);\n };\n\n const handleViewChange = (newView: ScheduleViewLevel) => {\n if (newView === 'day' || newView === 'week' || newView === 'month') {\n _setView(newView);\n }\n };\n\n const commonProps = {\n resources,\n date: _date,\n onDateChange: handleDateChange,\n onViewChange: handleViewChange,\n events,\n locale,\n radius,\n labels,\n renderEventBody,\n renderResourceLabel,\n withEventsDragAndDrop: mode === 'static' ? false : withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n onExternalEventDrop,\n recurrenceExpansionLimit,\n mode,\n };\n\n const content = (() => {\n switch (_view) {\n case 'day':\n return (\n <ResourcesDayView\n {...commonProps}\n onTimeSlotClick={onTimeSlotClick}\n withEventResize={mode === 'static' ? false : withEventResize}\n onEventResize={onEventResize}\n canResizeEvent={canResizeEvent}\n {...dayViewProps}\n />\n );\n case 'week':\n return (\n <ResourcesWeekView\n {...commonProps}\n onTimeSlotClick={onTimeSlotClick}\n {...weekViewProps}\n />\n );\n case 'month':\n return <ResourcesMonthView {...commonProps} onDayClick={onDayClick} {...monthViewProps} />;\n default:\n return null;\n }\n })();\n\n return (\n <Box {...getStyles('root')} mod={mod} {...others}>\n {content}\n </Box>\n );\n});\n\nResourcesSchedule.displayName = '@mantine/schedule/ResourcesSchedule';\nResourcesSchedule.classes = classes;\n\nexport namespace ResourcesSchedule {\n export type Props = ResourcesScheduleProps;\n export type StylesNames = ResourcesScheduleStylesNames;\n export type Factory = ResourcesScheduleFactory;\n export type ViewLevel = ResourcesScheduleViewLevel;\n}\n"],"mappings":";;;;;;;;;AAqNA,MAAM,eAAgD;CACpD,aAAa;CACb,MAAM;AACR;AAEA,MAAa,qBAAA,GAAA,cAAA,QAAA,EAAuD,WAAW;CAC7E,MAAM,SAAA,GAAA,cAAA,SAAA,CAAiB,qBAAqB,cAAc,MAAM;CAChE,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,WACA,MACA,aACA,cACA,MACA,aACA,cACA,QACA,QACA,QACA,QACA,iBACA,qBACA,uBACA,aACA,cACA,kBACA,gBACA,iBACA,YACA,cACA,oBACA,eACA,qBACA,iBACA,eACA,gBACA,0BACA,MACA,cACA,eACA,gBACA,kBACA,KACA,GAAG,WACD;CAEJ,MAAM,aAAA,GAAA,cAAA,UAAA,CAAgD;EACpD,MAAM,oBAAoB;EAC1B,SAAA,iCAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,CAAC,OAAO,aAAA,GAAA,eAAA,gBAAA,CAAwD;EACpE,OAAO;EACP,cAAc;EACd,UAAU;CACZ,CAAC;CAED,MAAM,CAAC,OAAO,aAAA,GAAA,eAAA,gBAAA,CAAoD;EAChE,OAAO;EACP,cAAc,+BAAe,IAAI,KAAK;CACxC,CAAC;CAED,MAAM,oBAAoB,YAA6B;EACrD,SAAS,OAAO;EAChB,eAAe,OAAO;CACxB;CAEA,MAAM,oBAAoB,YAA+B;EACvD,IAAI,YAAY,SAAS,YAAY,UAAU,YAAY,SACzD,SAAS,OAAO;CAEpB;CAEA,MAAM,cAAc;EAClB;EACA,MAAM;EACN,cAAc;EACd,cAAc;EACd;EACA;EACA;EACA;EACA;EACA;EACA,uBAAuB,SAAS,WAAW,QAAQ;EACnD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,MAAM,iBAAiB;EACrB,QAAQ,OAAR;GACE,KAAK,OACH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,yBAAAA,kBAAD;IACE,GAAI;IACa;IACjB,iBAAiB,SAAS,WAAW,QAAQ;IAC9B;IACC;IAChB,GAAI;GACL,CAAA;GAEL,KAAK,QACH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,0BAAAA,mBAAD;IACE,GAAI;IACa;IACjB,GAAI;GACL,CAAA;GAEL,KAAK,SACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,2BAAAA,oBAAD;IAAoB,GAAI;IAAyB;IAAY,GAAI;GAAiB,CAAA;GAC3F,SACE,OAAO;EACX;CACF,EAAA,CAAG;CAEH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,KAAD;EAAK,GAAI,UAAU,MAAM;EAAQ;EAAK,GAAI;YACvC;CACE,CAAA;AAET,CAAC;AAED,kBAAkB,cAAc;AAChC,kBAAkB,UAAUC,iCAAAA"}
1
+ {"version":3,"file":"ResourcesSchedule.cjs","names":["ResourcesDayView","ResourcesWeekView","ResourcesMonthView","Box","classes"],"sources":["../../../src/components/ResourcesSchedule/ResourcesSchedule.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n ElementProps,\n factory,\n Factory,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { ScheduleLabelsOverride } from '../../labels';\nimport {\n DateStringValue,\n DateTimeStringValue,\n ScheduleEventData,\n ScheduleMode,\n ScheduleResourceData,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n ResourcesDayView,\n ResourcesDayViewProps,\n ResourcesDayViewStylesNames,\n} from '../ResourcesDayView/ResourcesDayView';\nimport {\n ResourcesMonthView,\n ResourcesMonthViewProps,\n ResourcesMonthViewStylesNames,\n} from '../ResourcesMonthView/ResourcesMonthView';\nimport {\n ResourcesWeekView,\n ResourcesWeekViewProps,\n ResourcesWeekViewStylesNames,\n} from '../ResourcesWeekView/ResourcesWeekView';\nimport { RenderEventBody } from '../ScheduleEvent/ScheduleEvent';\nimport classes from './ResourcesSchedule.module.css';\n\nexport type ResourcesScheduleStylesNames =\n | 'root'\n | ResourcesDayViewStylesNames\n | ResourcesWeekViewStylesNames\n | ResourcesMonthViewStylesNames;\n\nexport type ResourcesScheduleViewLevel = 'day' | 'week' | 'month';\n\ntype ResourcesScheduleCommonProps =\n | 'date'\n | 'onDateChange'\n | 'resources'\n | 'events'\n | 'locale'\n | 'radius'\n | 'labels'\n | 'renderEventBody'\n | 'renderResourceLabel'\n | 'withEventsDragAndDrop'\n | 'onEventDrop'\n | 'canDragEvent'\n | 'onEventDragStart'\n | 'onEventDragEnd'\n | 'onTimeSlotClick'\n | 'onEventClick'\n | 'onDayClick'\n | 'withDragSlotSelect'\n | 'onSlotDragEnd'\n | 'view'\n | 'onViewChange'\n | 'mode'\n | 'onExternalEventDrop'\n | 'withEventResize'\n | 'onEventResize'\n | 'canResizeEvent'\n | 'recurrenceExpansionLimit';\n\ntype ResourcesScheduleViewProps<T> = Partial<Omit<T, ResourcesScheduleCommonProps>>;\n\nexport interface ResourcesScheduleProps\n extends BoxProps, StylesApiProps<ResourcesScheduleFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** List of resources to display */\n resources: ScheduleResourceData[];\n\n /** Current date to display (controlled) */\n date?: Date | DateStringValue;\n\n /** Default date (uncontrolled) */\n defaultDate?: Date | DateStringValue;\n\n /** Called when date changes via navigation */\n onDateChange?: (date: DateStringValue) => void;\n\n /** Current view level (controlled) */\n view?: ResourcesScheduleViewLevel;\n\n /** Default view level (uncontrolled) @default 'day' */\n defaultView?: ResourcesScheduleViewLevel;\n\n /** Called when view level changes */\n onViewChange?: (view: ResourcesScheduleViewLevel) => void;\n\n /** Events to display across all views */\n events?: ScheduleEventData[];\n\n /** Locale for date formatting */\n locale?: string;\n\n /** Key of theme.radius or any valid CSS value to set border-radius */\n radius?: MantineRadius;\n\n /** Labels override for i18n */\n labels?: ScheduleLabelsOverride;\n\n /** Custom event body renderer */\n renderEventBody?: RenderEventBody;\n\n /** Custom resource label renderer */\n renderResourceLabel?: (resource: ScheduleResourceData) => React.ReactNode;\n\n /** Enable drag and drop for events @default false */\n withEventsDragAndDrop?: boolean;\n\n /** Called when event is dropped */\n onEventDrop?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n resourceId?: string | number;\n }) => void;\n\n /** Function to determine if event can be dragged */\n canDragEvent?: (event: ScheduleEventData) => boolean;\n\n /** Called when any event drag starts */\n onEventDragStart?: (event: ScheduleEventData) => void;\n\n /** Called when any event drag ends */\n onEventDragEnd?: () => void;\n\n /** Called when time slot is clicked */\n onTimeSlotClick?: (data: {\n slotStart: DateTimeStringValue;\n slotEnd: DateTimeStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n resourceId?: string | number;\n }) => void;\n\n /** Called when day is clicked in month view */\n onDayClick?: (data: {\n date: DateStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n resourceId?: string | number;\n }) => void;\n\n /** Called when event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select slot ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a slot range is selected by dragging */\n onSlotDragEnd?: (data: {\n rangeStart: DateTimeStringValue;\n rangeEnd: DateTimeStringValue;\n resourceId?: string | number;\n }) => void;\n\n /** Interaction mode @default default */\n mode?: ScheduleMode;\n\n /** Called when an external item is dropped onto the schedule */\n onExternalEventDrop?: (data: {\n dataTransfer: DataTransfer;\n dropDateTime: DateTimeStringValue;\n resourceId?: string | number;\n }) => void;\n\n /** If true, events can be resized @default false */\n withEventResize?: boolean;\n\n /** Called when event is resized */\n onEventResize?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be resized */\n canResizeEvent?: (event: ScheduleEventData) => boolean;\n\n /** Max number of generated recurring instances @default 2000 */\n recurrenceExpansionLimit?: number;\n\n /** Props specific to ResourcesDayView */\n dayViewProps?: ResourcesScheduleViewProps<ResourcesDayViewProps>;\n\n /** Props specific to ResourcesWeekView */\n weekViewProps?: ResourcesScheduleViewProps<ResourcesWeekViewProps>;\n\n /** Props specific to ResourcesMonthView */\n monthViewProps?: ResourcesScheduleViewProps<ResourcesMonthViewProps>;\n}\n\nexport type ResourcesScheduleFactory = Factory<{\n props: ResourcesScheduleProps;\n ref: HTMLDivElement;\n stylesNames: ResourcesScheduleStylesNames;\n}>;\n\nconst defaultProps: Partial<ResourcesScheduleProps> = {\n defaultView: 'day',\n mode: 'default',\n};\n\nexport const ResourcesSchedule = factory<ResourcesScheduleFactory>((_props) => {\n const props = useProps('ResourcesSchedule', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n resources,\n date,\n defaultDate,\n onDateChange,\n view,\n defaultView,\n onViewChange,\n events,\n locale,\n radius,\n labels,\n renderEventBody,\n renderResourceLabel,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onDayClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n mode,\n dayViewProps,\n weekViewProps,\n monthViewProps,\n __staticSelector,\n mod,\n ...others\n } = props;\n\n const getStyles = useStyles<ResourcesScheduleFactory>({\n name: __staticSelector || 'ResourcesSchedule',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n });\n\n const [_view, _setView] = useUncontrolled<ResourcesScheduleViewLevel>({\n value: view,\n defaultValue: defaultView,\n onChange: onViewChange,\n });\n\n const [_date, _setDate] = useUncontrolled<Date | DateStringValue>({\n value: date,\n defaultValue: defaultDate ?? new Date(),\n });\n\n const handleDateChange = (newDate: DateStringValue) => {\n _setDate(newDate);\n onDateChange?.(newDate);\n };\n\n const handleViewChange = (newView: ScheduleViewLevel) => {\n if (newView === 'day' || newView === 'week' || newView === 'month') {\n _setView(newView);\n }\n };\n\n const commonProps = {\n resources,\n date: _date,\n onDateChange: handleDateChange,\n onViewChange: handleViewChange,\n events,\n locale,\n radius,\n labels,\n renderEventBody,\n renderResourceLabel,\n withEventsDragAndDrop: mode === 'static' ? false : withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n onExternalEventDrop,\n recurrenceExpansionLimit,\n mode,\n };\n\n const content = (() => {\n switch (_view) {\n case 'day':\n return (\n <ResourcesDayView\n {...commonProps}\n onTimeSlotClick={onTimeSlotClick}\n withEventResize={mode === 'static' ? false : withEventResize}\n onEventResize={onEventResize}\n canResizeEvent={canResizeEvent}\n {...dayViewProps}\n />\n );\n case 'week':\n return (\n <ResourcesWeekView\n {...commonProps}\n onTimeSlotClick={onTimeSlotClick}\n withEventResize={mode === 'static' ? false : withEventResize}\n onEventResize={onEventResize}\n canResizeEvent={canResizeEvent}\n {...weekViewProps}\n />\n );\n case 'month':\n return <ResourcesMonthView {...commonProps} onDayClick={onDayClick} {...monthViewProps} />;\n default:\n return null;\n }\n })();\n\n return (\n <Box {...getStyles('root')} mod={mod} {...others}>\n {content}\n </Box>\n );\n});\n\nResourcesSchedule.displayName = '@mantine/schedule/ResourcesSchedule';\nResourcesSchedule.classes = classes;\n\nexport namespace ResourcesSchedule {\n export type Props = ResourcesScheduleProps;\n export type StylesNames = ResourcesScheduleStylesNames;\n export type Factory = ResourcesScheduleFactory;\n export type ViewLevel = ResourcesScheduleViewLevel;\n}\n"],"mappings":";;;;;;;;;AAqNA,MAAM,eAAgD;CACpD,aAAa;CACb,MAAM;AACR;AAEA,MAAa,qBAAA,GAAA,cAAA,QAAA,EAAuD,WAAW;CAC7E,MAAM,SAAA,GAAA,cAAA,SAAA,CAAiB,qBAAqB,cAAc,MAAM;CAChE,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,WACA,MACA,aACA,cACA,MACA,aACA,cACA,QACA,QACA,QACA,QACA,iBACA,qBACA,uBACA,aACA,cACA,kBACA,gBACA,iBACA,YACA,cACA,oBACA,eACA,qBACA,iBACA,eACA,gBACA,0BACA,MACA,cACA,eACA,gBACA,kBACA,KACA,GAAG,WACD;CAEJ,MAAM,aAAA,GAAA,cAAA,UAAA,CAAgD;EACpD,MAAM,oBAAoB;EAC1B,SAAA,iCAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,CAAC,OAAO,aAAA,GAAA,eAAA,gBAAA,CAAwD;EACpE,OAAO;EACP,cAAc;EACd,UAAU;CACZ,CAAC;CAED,MAAM,CAAC,OAAO,aAAA,GAAA,eAAA,gBAAA,CAAoD;EAChE,OAAO;EACP,cAAc,+BAAe,IAAI,KAAK;CACxC,CAAC;CAED,MAAM,oBAAoB,YAA6B;EACrD,SAAS,OAAO;EAChB,eAAe,OAAO;CACxB;CAEA,MAAM,oBAAoB,YAA+B;EACvD,IAAI,YAAY,SAAS,YAAY,UAAU,YAAY,SACzD,SAAS,OAAO;CAEpB;CAEA,MAAM,cAAc;EAClB;EACA,MAAM;EACN,cAAc;EACd,cAAc;EACd;EACA;EACA;EACA;EACA;EACA;EACA,uBAAuB,SAAS,WAAW,QAAQ;EACnD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,MAAM,iBAAiB;EACrB,QAAQ,OAAR;GACE,KAAK,OACH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,yBAAAA,kBAAD;IACE,GAAI;IACa;IACjB,iBAAiB,SAAS,WAAW,QAAQ;IAC9B;IACC;IAChB,GAAI;GACL,CAAA;GAEL,KAAK,QACH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,0BAAAA,mBAAD;IACE,GAAI;IACa;IACjB,iBAAiB,SAAS,WAAW,QAAQ;IAC9B;IACC;IAChB,GAAI;GACL,CAAA;GAEL,KAAK,SACH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,2BAAAA,oBAAD;IAAoB,GAAI;IAAyB;IAAY,GAAI;GAAiB,CAAA;GAC3F,SACE,OAAO;EACX;CACF,EAAA,CAAG;CAEH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,KAAD;EAAK,GAAI,UAAU,MAAM;EAAQ;EAAK,GAAI;YACvC;CACE,CAAA;AAET,CAAC;AAED,kBAAkB,cAAc;AAChC,kBAAkB,UAAUC,iCAAAA"}
@@ -23,6 +23,7 @@ const require_ScheduleEvent = require("../ScheduleEvent/ScheduleEvent.cjs");
23
23
  const require_MoreEvents = require("../MoreEvents/MoreEvents.cjs");
24
24
  const require_ScheduleHeaderBase = require("../ScheduleHeader/ScheduleHeaderBase.cjs");
25
25
  const require_get_week_label = require("../WeekView/get-week-label/get-week-label.cjs");
26
+ const require_use_horizontal_event_resize = require("../../hooks/use-horizontal-event-resize.cjs");
26
27
  const require_get_overlap_clusters = require("../ResourcesDayView/get-overlap-clusters/get-overlap-clusters.cjs");
27
28
  const require_get_resources_week_view_events = require("./get-resources-week-view-events/get-resources-week-view-events.cjs");
28
29
  const require_ResourcesWeekViewRow = require("./ResourcesWeekViewRow.cjs");
@@ -47,6 +48,7 @@ const defaultProps = {
47
48
  highlightBusinessHours: false,
48
49
  businessHours: ["09:00:00", "17:00:00"],
49
50
  withEventsDragAndDrop: false,
51
+ withEventResize: false,
50
52
  withDragSlotSelect: false,
51
53
  withWeekendDays: true,
52
54
  withCurrentTimeBubble: true,
@@ -62,7 +64,7 @@ const varsResolver = (0, _mantine_core.createVarsResolver)((_theme, { radius, sl
62
64
  } }));
63
65
  const ResourcesWeekView = (0, _mantine_core.factory)((_props) => {
64
66
  const props = (0, _mantine_core.useProps)("ResourcesWeekView", defaultProps, _props);
65
- const { classNames, className, style, styles, unstyled, attributes, vars, startTime, endTime, date, onDateChange, resources, intervalMinutes, slotLabelFormat, radius, startScrollDateTime, scrollAreaProps, locale, withCurrentTimeIndicator: _withCurrentTimeIndicator, withCurrentTimeBubble, __staticSelector, withHeader, onViewChange, previousControlProps, nextControlProps, todayControlProps, viewSelectProps, weekLabelFormat, renderWeekLabel, events, slotWidth, rowHeight, labels, highlightBusinessHours, businessHours, renderEventBody, renderEvent, renderResourceLabel, groups, renderGroupLabel, groupLabelWidth, withEventsDragAndDrop, onEventDrop, canDragEvent, onEventDragStart, onEventDragEnd, onTimeSlotClick, onEventClick, withDragSlotSelect, onSlotDragEnd, mode, onExternalEventDrop, recurrenceExpansionLimit, maxEventsPerTimeSlot: _maxEventsPerTimeSlot, moreEventsProps, firstDayOfWeek, weekendDays, withWeekendDays, weekdayFormat, highlightToday, ...others } = props;
67
+ const { classNames, className, style, styles, unstyled, attributes, vars, startTime, endTime, date, onDateChange, resources, intervalMinutes, slotLabelFormat, radius, startScrollDateTime, scrollAreaProps, locale, withCurrentTimeIndicator: _withCurrentTimeIndicator, withCurrentTimeBubble, __staticSelector, withHeader, onViewChange, previousControlProps, nextControlProps, todayControlProps, viewSelectProps, weekLabelFormat, renderWeekLabel, events, slotWidth, rowHeight, labels, highlightBusinessHours, businessHours, renderEventBody, renderEvent, renderResourceLabel, groups, renderGroupLabel, groupLabelWidth, withEventsDragAndDrop, onEventDrop, canDragEvent, onEventDragStart, onEventDragEnd, withEventResize, onEventResize, canResizeEvent, onTimeSlotClick, onEventClick, withDragSlotSelect, onSlotDragEnd, mode, onExternalEventDrop, recurrenceExpansionLimit, maxEventsPerTimeSlot: _maxEventsPerTimeSlot, moreEventsProps, firstDayOfWeek, weekendDays, withWeekendDays, weekdayFormat, highlightToday, ...others } = props;
66
68
  const maxEventsPerTimeSlot = _maxEventsPerTimeSlot !== void 0 ? Math.max(1, _maxEventsPerTimeSlot) : void 0;
67
69
  const getStyles = (0, _mantine_core.useStyles)({
68
70
  name: __staticSelector,
@@ -197,6 +199,15 @@ const ResourcesWeekView = (0, _mantine_core.factory)((_props) => {
197
199
  });
198
200
  }
199
201
  });
202
+ const eventResize = require_use_horizontal_event_resize.useHorizontalEventResize({
203
+ enabled: withEventResize,
204
+ mode,
205
+ startTime,
206
+ endTime,
207
+ intervalMinutes,
208
+ onEventResize,
209
+ canResizeEvent
210
+ });
200
211
  const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== "static";
201
212
  const handleTimeSlotClick = (resourceId, day, slotTime, e) => {
202
213
  if (!onTimeSlotClick) return;
@@ -347,32 +358,86 @@ const ResourcesWeekView = (0, _mantine_core.factory)((_props) => {
347
358
  const visibleEvents = maxEventsPerTimeSlot !== void 0 ? allRegularEvents.filter((event) => event.position.column < maxEventsPerTimeSlot) : allRegularEvents;
348
359
  for (const event of visibleEvents) {
349
360
  const isDraggable = dragDrop.isDraggableEvent(event);
350
- const eventLeft = dayOffsetPercent + event.position.top / 100 * dayWidthPercent;
351
- const eventWidth = event.position.height / 100 * dayWidthPercent;
361
+ const isResizable = eventResize.isResizableEvent(event);
362
+ const resizePosition = eventResize.getResizePosition(event.id);
363
+ const isThisEventResizing = resizePosition !== null;
364
+ const activeEdge = isThisEventResizing && eventResize.resizingEdge ? eventResize.resizingEdge : null;
365
+ const effectiveTop = resizePosition ? resizePosition.left : event.position.top;
366
+ const effectiveHeight = resizePosition ? resizePosition.width : event.position.height;
367
+ const eventLeft = dayOffsetPercent + effectiveTop / 100 * dayWidthPercent;
368
+ const eventWidth = effectiveHeight / 100 * dayWidthPercent;
369
+ const eventColors = isResizable ? theme.variantColorResolver({
370
+ color: event.color || theme.primaryColor,
371
+ theme,
372
+ variant: event.variant || "light",
373
+ autoContrast: true
374
+ }) : null;
352
375
  const adjustPosition = maxEventsPerTimeSlot !== void 0 && event.position.overlaps > maxEventsPerTimeSlot;
353
- eventNodes.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
376
+ const eventDate = (0, dayjs.default)(day).format("YYYY-MM-DD");
377
+ eventNodes.push(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Box, {
354
378
  ...getStyles("resourcesWeekViewEventWrapper"),
379
+ __vars: eventColors ? { "--event-color": eventColors.color } : void 0,
380
+ "data-resizing": isThisEventResizing || void 0,
355
381
  style: {
356
382
  left: `calc(${eventLeft}% + 1px)`,
357
383
  top: adjustPosition ? `calc((100% - 22px) * ${event.position.column} / ${maxEventsPerTimeSlot})` : `${event.position.offset}%`,
358
384
  width: `calc(${eventWidth}% - 2px)`,
359
385
  height: adjustPosition ? `calc((100% - 22px) / ${maxEventsPerTimeSlot})` : `${event.position.width}%`
360
386
  },
361
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScheduleEvent.ScheduleEvent, {
387
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScheduleEvent.ScheduleEvent, {
362
388
  event,
363
389
  autoSize: true,
364
390
  nowrap: true,
365
391
  draggable: isDraggable,
392
+ isResizing: isThisEventResizing,
366
393
  renderEventBody,
367
394
  renderEvent,
368
395
  radius,
369
396
  mode,
370
- onClick: onEventClick ? (e) => onEventClick(event, e) : void 0,
397
+ onClick: onEventClick ? (e) => {
398
+ if (!eventResize.wasResizing()) onEventClick(event, e);
399
+ } : void 0,
371
400
  style: {
372
401
  width: "100%",
373
402
  height: "100%"
374
403
  }
375
- })
404
+ }), isResizable && mode !== "static" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
405
+ ...getStyles("resourcesWeekViewResizeHandle"),
406
+ "data-edge": "start",
407
+ "data-active": activeEdge === "start" || void 0,
408
+ onPointerDown: (e) => {
409
+ const container = rowSlotsContainersRef.current[resourceIndex];
410
+ if (container) eventResize.handleResizeStart({
411
+ event,
412
+ edge: "start",
413
+ container,
414
+ originalLeft: event.position.top,
415
+ originalWidth: event.position.height,
416
+ eventDate,
417
+ dayIndex,
418
+ dayCount: weekdays.length,
419
+ pointerEvent: e
420
+ });
421
+ }
422
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
423
+ ...getStyles("resourcesWeekViewResizeHandle"),
424
+ "data-edge": "end",
425
+ "data-active": activeEdge === "end" || void 0,
426
+ onPointerDown: (e) => {
427
+ const container = rowSlotsContainersRef.current[resourceIndex];
428
+ if (container) eventResize.handleResizeStart({
429
+ event,
430
+ edge: "end",
431
+ container,
432
+ originalLeft: event.position.top,
433
+ originalWidth: event.position.height,
434
+ eventDate,
435
+ dayIndex,
436
+ dayCount: weekdays.length,
437
+ pointerEvent: e
438
+ });
439
+ }
440
+ })] })]
376
441
  }, `${event.id}-${day}`));
377
442
  }
378
443
  if (maxEventsPerTimeSlot !== void 0) {
@@ -505,7 +570,8 @@ const ResourcesWeekView = (0, _mantine_core.factory)((_props) => {
505
570
  mod: {
506
571
  static: mode === "static",
507
572
  "slot-dragging": slotDragSelect.isDragging,
508
- "event-interaction": dragDrop.dragContextValue.isDragging
573
+ resizing: eventResize.isResizing,
574
+ "event-interaction": eventResize.isResizing || dragDrop.dragContextValue.isDragging
509
575
  },
510
576
  ...others,
511
577
  children: [withHeader && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScheduleHeaderBase.ScheduleHeaderBase, {
@@ -1 +1 @@
1
- {"version":3,"file":"ResourcesWeekView.cjs","names":["getDayTimeIntervals","getOrderedResources","getWeekDays","getCurrentTimePosition","isInTimeRange","formatDate","useDragDropHandlers","calculateDropTime","getGroupToResourceIdMap","useSlotDragSelect","getResourcesWeekViewEvents","Box","getBusinessHoursMod","classes","getIndexFromDragPoint","isAllDayEvent","ScheduleEvent","getOverlapClusters","MoreEvents","ResourcesWeekViewRow","getWeekLabel","ScheduleHeaderBase","previousWeek","nextWeek","toDateString","ScrollArea","getLabel","DragContext"],"sources":["../../../src/components/ResourcesWeekView/ResourcesWeekView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n rem,\n ScrollArea,\n ScrollAreaProps,\n StylesApiProps,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useInterval, useIsomorphicEffect, useMergedRef } from '@mantine/hooks';\nimport { useDragDropHandlers } from '../../hooks/use-drag-drop-handlers';\nimport { useSlotDragSelect } from '../../hooks/use-slot-drag-select';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DateTimeStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n ScheduleResourceData,\n ScheduleResourceGroup,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n calculateDropTime,\n formatDate,\n getBusinessHoursMod,\n getCurrentTimePosition,\n getDayTimeIntervals,\n getGroupToResourceIdMap,\n getIndexFromDragPoint,\n getOrderedResources,\n getWeekDays,\n handleResourcesGridKeyDown,\n isAllDayEvent,\n isInTimeRange,\n nextWeek,\n previousWeek,\n ResourcesGridControlsRef,\n toDateString,\n} from '../../utils';\nimport { DragContext, DragContextValue } from '../DragContext/DragContext';\nimport { MoreEvents, MoreEventsProps, MoreEventsStylesNames } from '../MoreEvents/MoreEvents';\nimport { getOverlapClusters } from '../ResourcesDayView/get-overlap-clusters/get-overlap-clusters';\nimport { RenderEvent, RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getWeekLabel } from '../WeekView/get-week-label/get-week-label';\nimport { getResourcesWeekViewEvents } from './get-resources-week-view-events/get-resources-week-view-events';\nimport { ResourcesWeekViewRow } from './ResourcesWeekViewRow';\nimport classes from './ResourcesWeekView.module.css';\n\nexport type ResourcesWeekViewStylesNames =\n | 'resourcesWeekView'\n | 'resourcesWeekViewRoot'\n | 'resourcesWeekViewInner'\n | 'resourcesWeekViewHeaderRows'\n | 'resourcesWeekViewHeaderContent'\n | 'resourcesWeekViewDayLabelsRow'\n | 'resourcesWeekViewDayLabel'\n | 'resourcesWeekViewTimeLabelsRow'\n | 'resourcesWeekViewScrollArea'\n | 'resourcesWeekViewCorner'\n | 'resourcesWeekViewTimeLabel'\n | 'resourcesWeekViewResourceLabel'\n | 'resourcesWeekViewRow'\n | 'resourcesWeekViewRowSlot'\n | 'resourcesWeekViewRowSlots'\n | 'resourcesWeekViewBackgroundEvent'\n | 'resourcesWeekViewAllDayEvent'\n | 'resourcesWeekViewCurrentTimeIndicator'\n | 'resourcesWeekViewCurrentTimeIndicatorLine'\n | 'resourcesWeekViewCurrentTimeIndicatorThumb'\n | 'resourcesWeekViewCurrentTimeIndicatorTimeBubble'\n | 'resourcesWeekViewEventWrapper'\n | 'resourcesWeekViewResizeHandle'\n | 'resourcesWeekViewGroupColumn'\n | 'resourcesWeekViewGroupColumnEmpty'\n | MoreEventsStylesNames\n | CombinedScheduleHeaderStylesNames;\n\nexport type ResourcesWeekViewCssVariables = {\n resourcesWeekView:\n | '--resources-week-view-radius'\n | '--resources-week-view-slot-width'\n | '--resources-week-view-row-height'\n | '--resources-week-view-group-label-width';\n};\n\nexport interface ResourcesWeekViewProps\n extends BoxProps, StylesApiProps<ResourcesWeekViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n date: Date | string;\n onDateChange?: (value: DateStringValue) => void;\n resources: ScheduleResourceData[];\n startTime?: string;\n endTime?: string;\n intervalMinutes?: number;\n slotLabelFormat?: DateLabelFormat;\n radius?: MantineRadius;\n /** Date and time to scroll to on initial render, in `YYYY-MM-DD HH:mm:ss` format */\n startScrollDateTime?: string;\n scrollAreaProps?: Partial<ScrollAreaProps> & DataAttributes;\n locale?: string;\n withCurrentTimeIndicator?: boolean;\n withCurrentTimeBubble?: boolean;\n withHeader?: boolean;\n onViewChange?: (view: ScheduleViewLevel) => void;\n previousControlProps?: React.ComponentProps<'button'> & DataAttributes;\n nextControlProps?: React.ComponentProps<'button'> & DataAttributes;\n todayControlProps?: React.ComponentProps<'button'> & DataAttributes;\n viewSelectProps?: Partial<ViewSelectProps> & DataAttributes;\n weekLabelFormat?: DateLabelFormat;\n renderWeekLabel?: (params: {\n weekStart: DateStringValue;\n weekEnd: DateStringValue;\n }) => React.ReactNode;\n events?: ScheduleEventData[];\n slotWidth?: React.CSSProperties['width'];\n rowHeight?: React.CSSProperties['height'];\n labels?: ScheduleLabelsOverride;\n highlightBusinessHours?: boolean;\n businessHours?: [string, string];\n renderEventBody?: RenderEventBody;\n renderEvent?: RenderEvent;\n renderResourceLabel?: (resource: ScheduleResourceData) => React.ReactNode;\n\n /** List of resource groups to display as a column to the left of resource labels */\n groups?: ScheduleResourceGroup[];\n\n /** Function to customize group label rendering */\n renderGroupLabel?: (group: ScheduleResourceGroup) => React.ReactNode;\n\n /** Width of the group label column @default 80px */\n groupLabelWidth?: React.CSSProperties['width'];\n\n withEventsDragAndDrop?: boolean;\n onEventDrop?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n resourceId?: string | number;\n }) => void;\n canDragEvent?: (event: ScheduleEventData) => boolean;\n onEventDragStart?: (event: ScheduleEventData) => void;\n onEventDragEnd?: () => void;\n onTimeSlotClick?: (data: {\n slotStart: DateTimeStringValue;\n slotEnd: DateTimeStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n resourceId?: string | number;\n }) => void;\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n withDragSlotSelect?: boolean;\n onSlotDragEnd?: (data: {\n rangeStart: DateTimeStringValue;\n rangeEnd: DateTimeStringValue;\n resourceId?: string | number;\n }) => void;\n mode?: ScheduleMode;\n onExternalEventDrop?: (data: {\n dataTransfer: DataTransfer;\n dropDateTime: DateTimeStringValue;\n resourceId?: string | number;\n }) => void;\n recurrenceExpansionLimit?: number;\n\n /** Maximum number of events visible per time slot before \"+more\" indicator shows, minimum value is 1 @default 2 */\n maxEventsPerTimeSlot?: number;\n\n /** Props passed down to `MoreEvents` component */\n moreEventsProps?: Partial<MoreEventsProps>;\n\n firstDayOfWeek?: DayOfWeek;\n weekendDays?: DayOfWeek[];\n withWeekendDays?: boolean;\n weekdayFormat?: DateLabelFormat;\n highlightToday?: boolean;\n}\n\nexport type ResourcesWeekViewFactory = Factory<{\n props: ResourcesWeekViewProps;\n ref: HTMLDivElement;\n stylesNames: ResourcesWeekViewStylesNames;\n vars: ResourcesWeekViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'ResourcesWeekView',\n startTime: '00:00:00',\n endTime: '23:59:59',\n slotLabelFormat: 'HH:mm',\n intervalMinutes: 60,\n withHeader: true,\n weekLabelFormat: 'MMM DD',\n weekdayFormat: 'ddd D',\n highlightBusinessHours: false,\n businessHours: ['09:00:00', '17:00:00'],\n withEventsDragAndDrop: false,\n withDragSlotSelect: false,\n withWeekendDays: true,\n withCurrentTimeBubble: true,\n highlightToday: true,\n mode: 'default',\n maxEventsPerTimeSlot: 2,\n} satisfies Partial<ResourcesWeekViewProps>;\n\nconst varsResolver = createVarsResolver<ResourcesWeekViewFactory>(\n (_theme, { radius, slotWidth, rowHeight, groupLabelWidth }) => ({\n resourcesWeekView: {\n '--resources-week-view-radius': radius ? getRadius(radius) : undefined,\n '--resources-week-view-slot-width': rem(slotWidth),\n '--resources-week-view-row-height': rem(rowHeight),\n '--resources-week-view-group-label-width': rem(groupLabelWidth),\n },\n })\n);\n\nexport const ResourcesWeekView = factory<ResourcesWeekViewFactory>((_props) => {\n const props = useProps('ResourcesWeekView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n startTime,\n endTime,\n date,\n onDateChange,\n resources,\n intervalMinutes,\n slotLabelFormat,\n radius,\n startScrollDateTime,\n scrollAreaProps,\n locale,\n withCurrentTimeIndicator: _withCurrentTimeIndicator,\n withCurrentTimeBubble,\n __staticSelector,\n withHeader,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n weekLabelFormat,\n renderWeekLabel,\n events,\n slotWidth,\n rowHeight,\n labels,\n highlightBusinessHours,\n businessHours,\n renderEventBody,\n renderEvent,\n renderResourceLabel,\n groups,\n renderGroupLabel,\n groupLabelWidth,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n mode,\n onExternalEventDrop,\n recurrenceExpansionLimit,\n maxEventsPerTimeSlot: _maxEventsPerTimeSlot,\n moreEventsProps,\n firstDayOfWeek,\n weekendDays,\n withWeekendDays,\n weekdayFormat,\n highlightToday,\n ...others\n } = props;\n\n const maxEventsPerTimeSlot =\n _maxEventsPerTimeSlot !== undefined ? Math.max(1, _maxEventsPerTimeSlot) : undefined;\n\n const getStyles = useStyles<ResourcesWeekViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n attributes,\n rootSelector: 'resourcesWeekView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<ResourcesWeekViewFactory>({\n classNames,\n styles,\n props,\n });\n\n const stylesApiProps = {\n classNames: resolvedClassNames,\n styles: resolvedStyles,\n attributes,\n __staticSelector,\n radius,\n };\n\n const theme = useMantineTheme();\n const [scrolled, setScrolled] = useState(false);\n const [scrolledX, setScrolledX] = useState(false);\n const ctx = useDatesContext();\n const slots = getDayTimeIntervals({ startTime, endTime, intervalMinutes });\n const { orderedResources, groupRanges, resourceGroupMap } = useMemo(\n () => getOrderedResources(resources, groups),\n [resources, groups]\n );\n const hasGroups = groupRanges.length > 0;\n\n const weekdays = useMemo(\n () =>\n getWeekDays({\n week: date,\n withWeekendDays,\n weekendDays: ctx.getWeekendDays(weekendDays),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n }),\n [date, withWeekendDays, weekendDays, firstDayOfWeek, ctx]\n );\n\n const totalSlotsPerDay = slots.length;\n\n const isToday = weekdays.some((day) => dayjs(day).isSame(dayjs(), 'day'));\n const withCurrentTimeIndicator = _withCurrentTimeIndicator ?? isToday;\n\n const [timeIndicatorOffset, setTimeIndicatorOffset] = useState(\n getCurrentTimePosition({ startTime, endTime, intervalMinutes })\n );\n useInterval(\n () => setTimeIndicatorOffset(getCurrentTimePosition({ startTime, endTime, intervalMinutes })),\n 60000,\n { autoInvoke: true }\n );\n\n const todayDayIndex = weekdays.findIndex((day) => dayjs(day).isSame(dayjs(), 'day'));\n const showTimeIndicator =\n withCurrentTimeIndicator &&\n todayDayIndex >= 0 &&\n isInTimeRange({ date: dayjs().toDate(), startTime, endTime });\n const formattedCurrentTime = withCurrentTimeBubble\n ? formatDate({ locale: ctx.getLocale(locale), date: dayjs(), format: slotLabelFormat })\n : '';\n\n type DropTargetSlot = { resourceId: string | number; slotIndex: number };\n\n const handleExternalDrop = useCallback(\n (e: React.DragEvent, target: DropTargetSlot) => {\n if (!onExternalEventDrop) {\n return;\n }\n const dayIndex = Math.floor(target.slotIndex / totalSlotsPerDay);\n const slotInDay = target.slotIndex % totalSlotsPerDay;\n const slotDay = weekdays[dayIndex];\n if (slotDay) {\n onExternalEventDrop({\n dataTransfer: e.dataTransfer,\n dropDateTime: `${dayjs(slotDay).format('YYYY-MM-DD')} ${slots[slotInDay].startTime}`,\n resourceId: target.resourceId,\n });\n }\n },\n [onExternalEventDrop, slots, weekdays, totalSlotsPerDay]\n );\n\n const lastDropResourceId = useRef<string | number | undefined>(undefined);\n\n const handleInternalEventDrop = useCallback(\n (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => {\n onEventDrop?.({ ...data, resourceId: lastDropResourceId.current });\n },\n [onEventDrop]\n );\n\n const dragDrop = useDragDropHandlers<DropTargetSlot>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop: handleInternalEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (target: DropTargetSlot, draggedEvent: ScheduleEventData) => {\n lastDropResourceId.current = target.resourceId;\n const dayIndex = Math.floor(target.slotIndex / totalSlotsPerDay);\n const slotInDay = target.slotIndex % totalSlotsPerDay;\n const slotTime = slots[slotInDay].startTime;\n const targetDay = weekdays[dayIndex] || weekdays[0];\n return calculateDropTime({\n draggedEvent,\n targetDate: targetDay,\n targetSlotTime: slotTime,\n intervalMinutes,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\n });\n\n const groupToResourceId = useMemo(() => getGroupToResourceIdMap(resources), [resources]);\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex, group) => {\n if (!onSlotDragEnd) {\n return;\n }\n const startDayIndex = Math.floor(startIndex / totalSlotsPerDay);\n const startSlotInDay = startIndex % totalSlotsPerDay;\n const endDayIndex = Math.floor(endIndex / totalSlotsPerDay);\n const endSlotInDay = endIndex % totalSlotsPerDay;\n const startDay = weekdays[startDayIndex];\n const endDay = weekdays[endDayIndex];\n if (startDay && endDay) {\n onSlotDragEnd({\n rangeStart: `${dayjs(startDay).format('YYYY-MM-DD')} ${slots[startSlotInDay].startTime}`,\n rangeEnd: `${dayjs(endDay).format('YYYY-MM-DD')} ${slots[endSlotInDay].endTime}`,\n resourceId: groupToResourceId.get(group) ?? group,\n });\n }\n },\n });\n\n const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static';\n\n const handleTimeSlotClick = (\n resourceId: string | number,\n day: string,\n slotTime: string,\n e: React.MouseEvent<HTMLButtonElement>\n ) => {\n if (!onTimeSlotClick) {\n return;\n }\n const slotIndex = slots.findIndex((s) => s.startTime === slotTime);\n if (slotIndex === -1) {\n return;\n }\n const slot = slots[slotIndex];\n const dayStr = dayjs(day).format('YYYY-MM-DD');\n onTimeSlotClick({\n slotStart: `${dayStr} ${slot.startTime}`,\n slotEnd: `${dayStr} ${slot.endTime}`,\n nativeEvent: e,\n resourceId,\n });\n };\n\n const weekViewEvents = useMemo(\n () =>\n getResourcesWeekViewEvents({\n events,\n resources,\n weekdays,\n startTime,\n endTime,\n expansionLimit: recurrenceExpansionLimit,\n }),\n [events, resources, weekdays, startTime, endTime, recurrenceExpansionLimit]\n );\n\n const dayLabels = weekdays.map((day) => {\n const d = dayjs(day);\n const today = d.isSame(dayjs(), 'day') && highlightToday;\n const weekend = ctx.getWeekendDays(weekendDays).includes(d.day() as DayOfWeek);\n\n return (\n <Box\n {...getStyles('resourcesWeekViewDayLabel')}\n key={day}\n mod={{ today, weekend }}\n style={{ width: `calc(var(--resources-week-view-slot-width) * ${totalSlotsPerDay})` }}\n >\n {formatDate({ date: d, locale: ctx.getLocale(locale), format: weekdayFormat })}\n </Box>\n );\n });\n\n const timeLabels = weekdays.flatMap((day) =>\n slots.map((interval) => {\n const dayStr = dayjs(day).format('YYYY-MM-DD');\n const intervalTime = dayjs(`${dayStr} ${interval.startTime}`);\n const label = formatDate({\n date: intervalTime,\n locale: ctx.getLocale(locale),\n format: slotLabelFormat,\n });\n\n return (\n <Box\n {...getStyles('resourcesWeekViewTimeLabel')}\n key={`${day}-${interval.startTime}`}\n mod={{\n 'hour-start': interval.isHourStart,\n ...getBusinessHoursMod({\n time: interval.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n }}\n >\n {label}\n </Box>\n );\n })\n );\n\n const slotsRef: ResourcesGridControlsRef = useRef<HTMLButtonElement[][]>([]);\n const rowSlotsContainersRef = useRef<(HTMLDivElement | null)[]>([]);\n const viewportRef = useRef<HTMLDivElement>(null);\n const mergedViewportRef = useMergedRef(viewportRef, scrollAreaProps?.viewportRef);\n\n const firstSlotIndex = { resourceIndex: 0, slotIndex: 0 };\n\n useIsomorphicEffect(() => {\n if (!startScrollDateTime || !viewportRef.current) {\n return;\n }\n const parsed = dayjs(startScrollDateTime);\n const targetDayStr = parsed.format('YYYY-MM-DD 00:00:00');\n const targetTime = parsed.format('HH:mm:ss');\n const dayIndex = weekdays.indexOf(targetDayStr);\n if (dayIndex < 0) {\n return;\n }\n const slotInDay = slots.findIndex((s) => s.startTime >= targetTime);\n if (slotInDay < 0) {\n return;\n }\n const flatIndex = dayIndex * totalSlotsPerDay + slotInDay;\n const firstResourceSlots = slotsRef.current[0];\n if (!firstResourceSlots || firstResourceSlots.length === 0) {\n return;\n }\n const targetSlot = firstResourceSlots[flatIndex];\n if (!targetSlot) {\n return;\n }\n const slotRect = targetSlot.getBoundingClientRect();\n const viewportRect = viewportRef.current.getBoundingClientRect();\n const cornerEl = viewportRef.current.querySelector(`.${classes.resourcesWeekViewCorner}`);\n const labelWidth = cornerEl ? cornerEl.getBoundingClientRect().width : 0;\n viewportRef.current.scrollTo({\n left: slotRect.left - viewportRect.left - labelWidth,\n top: 0,\n });\n }, []);\n\n const getSlotIndexFromDragPoint = useCallback((event: React.DragEvent, resourceIndex: number) => {\n return getIndexFromDragPoint(slotsRef.current[resourceIndex] ?? [], event.clientX);\n }, []);\n\n const handleSlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n resourceIndex: number,\n slotIndex: number\n ) => {\n handleResourcesGridKeyDown({\n controlsRef: slotsRef,\n resourceIndex,\n slotIndex,\n event,\n });\n };\n\n const dayWidthPercent = 100 / weekdays.length;\n\n const rows = orderedResources.map((resource, resourceIndex) => {\n const eventNodes: React.ReactNode[] = [];\n const resourceAllDayBars = weekViewEvents.allDayBars[resource.id] ?? [];\n const maxAllDayCount = resourceAllDayBars.reduce((max, bar) => Math.max(max, bar.row + 1), 0);\n\n weekdays.forEach((day, dayIndex) => {\n const dayEvents = weekViewEvents.byDay[day];\n if (!dayEvents) {\n return;\n }\n\n const dayOffsetPercent = (dayIndex / weekdays.length) * 100;\n\n const bgEvents = [\n ...(dayEvents.backgroundTimedEvents[resource.id] || []),\n ...(dayEvents.backgroundAllDayEvents[resource.id] || []),\n ];\n for (const event of bgEvents) {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-${event.id}-${day}`,\n ...getStyles('resourcesWeekViewBackgroundEvent', {\n style: {\n left: `${dayOffsetPercent + (event.position.top / 100) * dayWidthPercent}%`,\n width: `${(event.position.height / 100) * dayWidthPercent}%`,\n top: 0,\n height: '100%',\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n eventNodes.push(renderEvent(event, bgEventProps as any));\n } else {\n eventNodes.push(<Box {...bgEventProps} />);\n }\n }\n\n const allRegularEvents = (dayEvents.regularEvents[resource.id] || []).filter(\n (event) => !isAllDayEvent({ event, date: day })\n );\n\n const visibleEvents =\n maxEventsPerTimeSlot !== undefined\n ? allRegularEvents.filter((event) => event.position.column < maxEventsPerTimeSlot)\n : allRegularEvents;\n\n for (const event of visibleEvents) {\n const isDraggable = dragDrop.isDraggableEvent(event);\n\n const eventLeft = dayOffsetPercent + (event.position.top / 100) * dayWidthPercent;\n const eventWidth = (event.position.height / 100) * dayWidthPercent;\n\n const adjustPosition =\n maxEventsPerTimeSlot !== undefined && event.position.overlaps > maxEventsPerTimeSlot;\n\n eventNodes.push(\n <div\n key={`${event.id}-${day}`}\n {...getStyles('resourcesWeekViewEventWrapper')}\n style={{\n left: `calc(${eventLeft}% + 1px)`,\n top: adjustPosition\n ? `calc((100% - 22px) * ${event.position.column} / ${maxEventsPerTimeSlot})`\n : `${event.position.offset}%`,\n width: `calc(${eventWidth}% - 2px)`,\n height: adjustPosition\n ? `calc((100% - 22px) / ${maxEventsPerTimeSlot})`\n : `${event.position.width}%`,\n }}\n >\n <ScheduleEvent\n event={event}\n autoSize\n nowrap\n draggable={isDraggable}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n style={{ width: '100%', height: '100%' }}\n />\n </div>\n );\n }\n\n if (maxEventsPerTimeSlot !== undefined) {\n const clusters = getOverlapClusters(allRegularEvents);\n for (const cluster of clusters) {\n const hiddenCount = cluster.filter(\n (e) => e.position.column >= maxEventsPerTimeSlot\n ).length;\n\n if (hiddenCount > 0 && mode !== 'static') {\n const leftPercent =\n dayOffsetPercent +\n (Math.min(...cluster.map((e) => e.position.top)) / 100) * dayWidthPercent;\n const rightPercent =\n dayOffsetPercent +\n (Math.max(...cluster.map((e) => e.position.top + e.position.height)) / 100) *\n dayWidthPercent;\n\n eventNodes.push(\n <MoreEvents\n key={`more-${resource.id}-${day}-${cluster[0].id}`}\n events={cluster}\n moreEventsCount={hiddenCount}\n mode={mode}\n labels={labels}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n onEventClick={onEventClick}\n style={{\n position: 'absolute',\n left: `calc(${leftPercent}% + 1px)`,\n width: `calc(${rightPercent - leftPercent}% - 2px)`,\n bottom: 0,\n height: '22px',\n paddingInline: 4,\n zIndex: 4,\n }}\n {...stylesApiProps}\n {...moreEventsProps}\n />\n );\n }\n }\n }\n });\n\n const stickyLabelOffset = hasGroups\n ? 'calc(var(--resources-week-view-group-label-width) + var(--resources-week-view-resource-label-width) + 5px)'\n : 'calc(var(--resources-week-view-resource-label-width) + 5px)';\n\n resourceAllDayBars.forEach((bar) => {\n const leftPercent = bar.startDayIndex * dayWidthPercent;\n const widthPercent = (bar.endDayIndex - bar.startDayIndex + 1) * dayWidthPercent;\n\n eventNodes.push(\n <div\n key={`all-day-${bar.event.id}-${bar.startDayIndex}`}\n {...getStyles('resourcesWeekViewAllDayEvent', {\n style: {\n left: `calc(${leftPercent}% + 1px)`,\n width: `calc(${widthPercent}% - 2px)`,\n top: `calc(${bar.row} * (var(--resources-week-view-all-day-height) + 2px) + 2px)`,\n },\n })}\n >\n <ScheduleEvent\n event={bar.event}\n autoSize\n nowrap\n renderEventBody={(barEvent) => (\n <span\n style={{\n position: 'sticky',\n insetInlineStart: stickyLabelOffset,\n display: 'inline-block',\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {renderEventBody ? renderEventBody(barEvent) : barEvent.title}\n </span>\n )}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(bar.event, e) : undefined}\n style={{ width: '100%', height: '100%', overflow: 'visible' }}\n styles={{\n eventInner: {\n display: 'block',\n overflow: 'visible',\n lineHeight: 'var(--resources-week-view-all-day-height)',\n },\n }}\n />\n </div>\n );\n });\n\n return (\n <ResourcesWeekViewRow\n key={resource.id}\n resource={resource}\n resourceIndex={resourceIndex}\n weekdays={weekdays}\n slots={slots}\n getStyles={getStyles}\n labels={labels}\n highlightBusinessHours={highlightBusinessHours}\n businessHours={businessHours}\n withEventsDragAndDrop={withDragHandlers}\n mode={mode}\n slotsRef={slotsRef}\n firstSlotIndex={firstSlotIndex}\n onSlotKeyDown={handleSlotKeyDown}\n onSlotClick={handleTimeSlotClick}\n onRowSlotsDragOver={(event, resourceId, resIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, resIdx);\n if (slotIndex !== null) {\n dragDrop.handleDragOver(event, { resourceId, slotIndex });\n }\n }}\n onRowSlotsDragLeave={dragDrop.handleDragLeave}\n onRowSlotsDrop={(event, resourceId, resIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, resIdx);\n if (slotIndex !== null) {\n dragDrop.handleDrop(event, { resourceId, slotIndex });\n }\n }}\n dropTargetSlotIndex={\n dragDrop.dropTarget?.resourceId === resource.id\n ? dragDrop.dropTarget.slotIndex\n : undefined\n }\n withDragSlotSelect={withDragSlotSelect}\n onSlotPointerDown={slotDragSelect.handleSlotPointerDown}\n isSlotDragSelected={slotDragSelect.isSlotSelected}\n rowSlotsContainerRef={(node) => {\n rowSlotsContainersRef.current[resourceIndex] = node;\n }}\n renderResourceLabel={renderResourceLabel}\n renderGroupLabel={renderGroupLabel}\n scrolledX={scrolledX}\n groupInfo={hasGroups ? resourceGroupMap[resourceIndex] : undefined}\n allDayCount={maxAllDayCount}\n >\n {eventNodes}\n </ResourcesWeekViewRow>\n );\n });\n\n const headerLabel = getWeekLabel({\n weekdays,\n locale: ctx.getLocale(locale),\n weekLabelFormat: weekLabelFormat!,\n renderWeekLabel,\n });\n\n const indicatorLeftPercent =\n todayDayIndex >= 0 ? ((todayDayIndex + timeIndicatorOffset / 100) / weekdays.length) * 100 : 0;\n\n const content = (\n <Box\n {...getStyles('resourcesWeekView')}\n mod={{\n static: mode === 'static',\n 'slot-dragging': slotDragSelect.isDragging,\n 'event-interaction': dragDrop.dragContextValue.isDragging,\n }}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"week\"\n navigationHandlers={{\n previous: () => previousWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n next: () => nextWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n today: () => toDateString(dayjs()),\n }}\n control={{\n miw: 180,\n title: headerLabel,\n }}\n labels={labels}\n onDateChange={onDateChange}\n onViewChange={onViewChange}\n previousControlProps={previousControlProps}\n nextControlProps={nextControlProps}\n todayControlProps={todayControlProps}\n viewSelectProps={{ views: ['day', 'week', 'month'] as const, ...viewSelectProps }}\n stylesApiProps={stylesApiProps}\n />\n )}\n\n <Box {...getStyles('resourcesWeekViewRoot')}>\n <ScrollArea\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('resourcesWeekViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n onScrollPositionChange={(position) => {\n scrollAreaProps?.onScrollPositionChange?.(position);\n setScrolled(position.y !== 0);\n setScrolledX(position.x !== 0);\n }}\n viewportRef={mergedViewportRef}\n >\n <div {...getStyles('resourcesWeekViewInner')}>\n <div {...getStyles('resourcesWeekViewHeaderRows')}>\n <div\n {...getStyles('resourcesWeekViewCorner')}\n key=\"corner\"\n style={\n hasGroups\n ? {\n flexBasis:\n 'calc(var(--resources-week-view-resource-label-width) + var(--resources-week-view-group-label-width))',\n minWidth:\n 'calc(var(--resources-week-view-resource-label-width) + var(--resources-week-view-group-label-width))',\n }\n : undefined\n }\n >\n {getLabel('resources', labels)}\n </div>\n <div {...getStyles('resourcesWeekViewHeaderContent')}>\n <div {...getStyles('resourcesWeekViewDayLabelsRow')}>{dayLabels}</div>\n <Box {...getStyles('resourcesWeekViewTimeLabelsRow')} mod={{ scrolled }}>\n {timeLabels}\n </Box>\n </div>\n </div>\n\n {rows}\n\n {showTimeIndicator && (\n <Box\n {...getStyles('resourcesWeekViewCurrentTimeIndicator')}\n __vars={{\n '--indicator-left-offset': hasGroups\n ? `calc(var(--resources-week-view-resource-label-width) + var(--resources-week-view-group-label-width) + (100% - var(--resources-week-view-resource-label-width) - var(--resources-week-view-group-label-width)) * ${indicatorLeftPercent} / 100)`\n : `calc(var(--resources-week-view-resource-label-width) + (100% - var(--resources-week-view-resource-label-width)) * ${indicatorLeftPercent} / 100)`,\n '--_time-bubble-width': formattedCurrentTime\n ?.toString()\n .toLowerCase()\n .includes('m')\n ? '64px'\n : '46px',\n }}\n >\n {withCurrentTimeBubble && (\n <div {...getStyles('resourcesWeekViewCurrentTimeIndicatorTimeBubble')}>\n {formattedCurrentTime}\n </div>\n )}\n {!withCurrentTimeBubble && (\n <div {...getStyles('resourcesWeekViewCurrentTimeIndicatorThumb')} />\n )}\n <div {...getStyles('resourcesWeekViewCurrentTimeIndicatorLine')} />\n </Box>\n )}\n </div>\n </ScrollArea>\n </Box>\n </Box>\n );\n\n const dragContextValue = useMemo<DragContextValue>(\n () => dragDrop.dragContextValue,\n [dragDrop.dragContextValue]\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={dragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nResourcesWeekView.displayName = '@mantine/schedule/ResourcesWeekView';\nResourcesWeekView.classes = classes;\nResourcesWeekView.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2MA,MAAM,eAAe;CACnB,kBAAkB;CAClB,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,iBAAiB;CACjB,YAAY;CACZ,iBAAiB;CACjB,eAAe;CACf,wBAAwB;CACxB,eAAe,CAAC,YAAY,UAAU;CACtC,uBAAuB;CACvB,oBAAoB;CACpB,iBAAiB;CACjB,uBAAuB;CACvB,gBAAgB;CAChB,MAAM;CACN,sBAAsB;AACxB;AAEA,MAAM,gBAAA,GAAA,cAAA,mBAAA,EACH,QAAQ,EAAE,QAAQ,WAAW,WAAW,uBAAuB,EAC9D,mBAAmB;CACjB,gCAAgC,UAAA,GAAA,cAAA,UAAA,CAAmB,MAAM,IAAI,KAAA;CAC7D,qCAAA,GAAA,cAAA,IAAA,CAAwC,SAAS;CACjD,qCAAA,GAAA,cAAA,IAAA,CAAwC,SAAS;CACjD,4CAAA,GAAA,cA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A,KAAA,CAACA,cAAAA,KAAD;OACE,GAAI,UAAU,uCAAuC;OACrD,QAAQ;QACN,2BAA2B,YACvB,mNAAmN,qBAAqB,WACxO,qHAAqH,qBAAqB;QAC9I,wBAAwB,sBACpB,SAAS,CAAC,CACX,YAAY,CAAC,CACb,SAAS,GAAG,IACX,SACA;OACN;iBAZF;QAcG,yBACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;SAAK,GAAI,UAAU,iDAAiD;mBACjE;QACE,CAAA;QAEN,CAAC,yBACA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAK,GAAI,UAAU,4CAA4C,EAAI,CAAA;QAErE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAK,GAAI,UAAU,2CAA2C,EAAI,CAAA;OAC/D;;KAEJ;;GACK,CAAA;EACT,CAAA,CACF;;CAGP,MAAM,oBAAA,GAAA,MAAA,QAAA,OACE,SAAS,kBACf,CAAC,SAAS,gBAAgB,CAC5B;CAEA,IAAI,uBACF,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACgB,oBAAAA,YAAY,UAAb;EAAsB,OAAO;YAAmB;CAA8B,CAAA;CAGvF,OAAO;AACT,CAAC;AAED,kBAAkB,cAAc;AAChC,kBAAkB,UAAUd,iCAAAA;AAC5B,kBAAkB,eAAe"}
1
+ {"version":3,"file":"ResourcesWeekView.cjs","names":["getDayTimeIntervals","getOrderedResources","getWeekDays","getCurrentTimePosition","isInTimeRange","formatDate","useDragDropHandlers","calculateDropTime","getGroupToResourceIdMap","useSlotDragSelect","useHorizontalEventResize","getResourcesWeekViewEvents","Box","getBusinessHoursMod","classes","getIndexFromDragPoint","isAllDayEvent","ScheduleEvent","getOverlapClusters","MoreEvents","ResourcesWeekViewRow","getWeekLabel","ScheduleHeaderBase","previousWeek","nextWeek","toDateString","ScrollArea","getLabel","DragContext"],"sources":["../../../src/components/ResourcesWeekView/ResourcesWeekView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n rem,\n ScrollArea,\n ScrollAreaProps,\n StylesApiProps,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useInterval, useIsomorphicEffect, useMergedRef } from '@mantine/hooks';\nimport { useDragDropHandlers } from '../../hooks/use-drag-drop-handlers';\nimport { useHorizontalEventResize } from '../../hooks/use-horizontal-event-resize';\nimport { useSlotDragSelect } from '../../hooks/use-slot-drag-select';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DateTimeStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n ScheduleResourceData,\n ScheduleResourceGroup,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n calculateDropTime,\n formatDate,\n getBusinessHoursMod,\n getCurrentTimePosition,\n getDayTimeIntervals,\n getGroupToResourceIdMap,\n getIndexFromDragPoint,\n getOrderedResources,\n getWeekDays,\n handleResourcesGridKeyDown,\n isAllDayEvent,\n isInTimeRange,\n nextWeek,\n previousWeek,\n ResourcesGridControlsRef,\n toDateString,\n} from '../../utils';\nimport { DragContext, DragContextValue } from '../DragContext/DragContext';\nimport { MoreEvents, MoreEventsProps, MoreEventsStylesNames } from '../MoreEvents/MoreEvents';\nimport { getOverlapClusters } from '../ResourcesDayView/get-overlap-clusters/get-overlap-clusters';\nimport { RenderEvent, RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getWeekLabel } from '../WeekView/get-week-label/get-week-label';\nimport { getResourcesWeekViewEvents } from './get-resources-week-view-events/get-resources-week-view-events';\nimport { ResourcesWeekViewRow } from './ResourcesWeekViewRow';\nimport classes from './ResourcesWeekView.module.css';\n\nexport type ResourcesWeekViewStylesNames =\n | 'resourcesWeekView'\n | 'resourcesWeekViewRoot'\n | 'resourcesWeekViewInner'\n | 'resourcesWeekViewHeaderRows'\n | 'resourcesWeekViewHeaderContent'\n | 'resourcesWeekViewDayLabelsRow'\n | 'resourcesWeekViewDayLabel'\n | 'resourcesWeekViewTimeLabelsRow'\n | 'resourcesWeekViewScrollArea'\n | 'resourcesWeekViewCorner'\n | 'resourcesWeekViewTimeLabel'\n | 'resourcesWeekViewResourceLabel'\n | 'resourcesWeekViewRow'\n | 'resourcesWeekViewRowSlot'\n | 'resourcesWeekViewRowSlots'\n | 'resourcesWeekViewBackgroundEvent'\n | 'resourcesWeekViewAllDayEvent'\n | 'resourcesWeekViewCurrentTimeIndicator'\n | 'resourcesWeekViewCurrentTimeIndicatorLine'\n | 'resourcesWeekViewCurrentTimeIndicatorThumb'\n | 'resourcesWeekViewCurrentTimeIndicatorTimeBubble'\n | 'resourcesWeekViewEventWrapper'\n | 'resourcesWeekViewResizeHandle'\n | 'resourcesWeekViewGroupColumn'\n | 'resourcesWeekViewGroupColumnEmpty'\n | MoreEventsStylesNames\n | CombinedScheduleHeaderStylesNames;\n\nexport type ResourcesWeekViewCssVariables = {\n resourcesWeekView:\n | '--resources-week-view-radius'\n | '--resources-week-view-slot-width'\n | '--resources-week-view-row-height'\n | '--resources-week-view-group-label-width';\n};\n\nexport interface ResourcesWeekViewProps\n extends BoxProps, StylesApiProps<ResourcesWeekViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n date: Date | string;\n onDateChange?: (value: DateStringValue) => void;\n resources: ScheduleResourceData[];\n startTime?: string;\n endTime?: string;\n intervalMinutes?: number;\n slotLabelFormat?: DateLabelFormat;\n radius?: MantineRadius;\n /** Date and time to scroll to on initial render, in `YYYY-MM-DD HH:mm:ss` format */\n startScrollDateTime?: string;\n scrollAreaProps?: Partial<ScrollAreaProps> & DataAttributes;\n locale?: string;\n withCurrentTimeIndicator?: boolean;\n withCurrentTimeBubble?: boolean;\n withHeader?: boolean;\n onViewChange?: (view: ScheduleViewLevel) => void;\n previousControlProps?: React.ComponentProps<'button'> & DataAttributes;\n nextControlProps?: React.ComponentProps<'button'> & DataAttributes;\n todayControlProps?: React.ComponentProps<'button'> & DataAttributes;\n viewSelectProps?: Partial<ViewSelectProps> & DataAttributes;\n weekLabelFormat?: DateLabelFormat;\n renderWeekLabel?: (params: {\n weekStart: DateStringValue;\n weekEnd: DateStringValue;\n }) => React.ReactNode;\n events?: ScheduleEventData[];\n slotWidth?: React.CSSProperties['width'];\n rowHeight?: React.CSSProperties['height'];\n labels?: ScheduleLabelsOverride;\n highlightBusinessHours?: boolean;\n businessHours?: [string, string];\n renderEventBody?: RenderEventBody;\n renderEvent?: RenderEvent;\n renderResourceLabel?: (resource: ScheduleResourceData) => React.ReactNode;\n\n /** List of resource groups to display as a column to the left of resource labels */\n groups?: ScheduleResourceGroup[];\n\n /** Function to customize group label rendering */\n renderGroupLabel?: (group: ScheduleResourceGroup) => React.ReactNode;\n\n /** Width of the group label column @default 80px */\n groupLabelWidth?: React.CSSProperties['width'];\n\n withEventsDragAndDrop?: boolean;\n onEventDrop?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n resourceId?: string | number;\n }) => void;\n canDragEvent?: (event: ScheduleEventData) => boolean;\n onEventDragStart?: (event: ScheduleEventData) => void;\n onEventDragEnd?: () => void;\n onTimeSlotClick?: (data: {\n slotStart: DateTimeStringValue;\n slotEnd: DateTimeStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n resourceId?: string | number;\n }) => void;\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n withDragSlotSelect?: boolean;\n onSlotDragEnd?: (data: {\n rangeStart: DateTimeStringValue;\n rangeEnd: DateTimeStringValue;\n resourceId?: string | number;\n }) => void;\n mode?: ScheduleMode;\n onExternalEventDrop?: (data: {\n dataTransfer: DataTransfer;\n dropDateTime: DateTimeStringValue;\n resourceId?: string | number;\n }) => void;\n\n /** If true, events can be resized by dragging their left/right edges @default false */\n withEventResize?: boolean;\n\n /** Called when event is resized */\n onEventResize?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be resized */\n canResizeEvent?: (event: ScheduleEventData) => boolean;\n\n recurrenceExpansionLimit?: number;\n\n /** Maximum number of events visible per time slot before \"+more\" indicator shows, minimum value is 1 @default 2 */\n maxEventsPerTimeSlot?: number;\n\n /** Props passed down to `MoreEvents` component */\n moreEventsProps?: Partial<MoreEventsProps>;\n\n firstDayOfWeek?: DayOfWeek;\n weekendDays?: DayOfWeek[];\n withWeekendDays?: boolean;\n weekdayFormat?: DateLabelFormat;\n highlightToday?: boolean;\n}\n\nexport type ResourcesWeekViewFactory = Factory<{\n props: ResourcesWeekViewProps;\n ref: HTMLDivElement;\n stylesNames: ResourcesWeekViewStylesNames;\n vars: ResourcesWeekViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'ResourcesWeekView',\n startTime: '00:00:00',\n endTime: '23:59:59',\n slotLabelFormat: 'HH:mm',\n intervalMinutes: 60,\n withHeader: true,\n weekLabelFormat: 'MMM DD',\n weekdayFormat: 'ddd D',\n highlightBusinessHours: false,\n businessHours: ['09:00:00', '17:00:00'],\n withEventsDragAndDrop: false,\n withEventResize: false,\n withDragSlotSelect: false,\n withWeekendDays: true,\n withCurrentTimeBubble: true,\n highlightToday: true,\n mode: 'default',\n maxEventsPerTimeSlot: 2,\n} satisfies Partial<ResourcesWeekViewProps>;\n\nconst varsResolver = createVarsResolver<ResourcesWeekViewFactory>(\n (_theme, { radius, slotWidth, rowHeight, groupLabelWidth }) => ({\n resourcesWeekView: {\n '--resources-week-view-radius': radius ? getRadius(radius) : undefined,\n '--resources-week-view-slot-width': rem(slotWidth),\n '--resources-week-view-row-height': rem(rowHeight),\n '--resources-week-view-group-label-width': rem(groupLabelWidth),\n },\n })\n);\n\nexport const ResourcesWeekView = factory<ResourcesWeekViewFactory>((_props) => {\n const props = useProps('ResourcesWeekView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n startTime,\n endTime,\n date,\n onDateChange,\n resources,\n intervalMinutes,\n slotLabelFormat,\n radius,\n startScrollDateTime,\n scrollAreaProps,\n locale,\n withCurrentTimeIndicator: _withCurrentTimeIndicator,\n withCurrentTimeBubble,\n __staticSelector,\n withHeader,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n weekLabelFormat,\n renderWeekLabel,\n events,\n slotWidth,\n rowHeight,\n labels,\n highlightBusinessHours,\n businessHours,\n renderEventBody,\n renderEvent,\n renderResourceLabel,\n groups,\n renderGroupLabel,\n groupLabelWidth,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n withEventResize,\n onEventResize,\n canResizeEvent,\n onTimeSlotClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n mode,\n onExternalEventDrop,\n recurrenceExpansionLimit,\n maxEventsPerTimeSlot: _maxEventsPerTimeSlot,\n moreEventsProps,\n firstDayOfWeek,\n weekendDays,\n withWeekendDays,\n weekdayFormat,\n highlightToday,\n ...others\n } = props;\n\n const maxEventsPerTimeSlot =\n _maxEventsPerTimeSlot !== undefined ? Math.max(1, _maxEventsPerTimeSlot) : undefined;\n\n const getStyles = useStyles<ResourcesWeekViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n attributes,\n rootSelector: 'resourcesWeekView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<ResourcesWeekViewFactory>({\n classNames,\n styles,\n props,\n });\n\n const stylesApiProps = {\n classNames: resolvedClassNames,\n styles: resolvedStyles,\n attributes,\n __staticSelector,\n radius,\n };\n\n const theme = useMantineTheme();\n const [scrolled, setScrolled] = useState(false);\n const [scrolledX, setScrolledX] = useState(false);\n const ctx = useDatesContext();\n const slots = getDayTimeIntervals({ startTime, endTime, intervalMinutes });\n const { orderedResources, groupRanges, resourceGroupMap } = useMemo(\n () => getOrderedResources(resources, groups),\n [resources, groups]\n );\n const hasGroups = groupRanges.length > 0;\n\n const weekdays = useMemo(\n () =>\n getWeekDays({\n week: date,\n withWeekendDays,\n weekendDays: ctx.getWeekendDays(weekendDays),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n }),\n [date, withWeekendDays, weekendDays, firstDayOfWeek, ctx]\n );\n\n const totalSlotsPerDay = slots.length;\n\n const isToday = weekdays.some((day) => dayjs(day).isSame(dayjs(), 'day'));\n const withCurrentTimeIndicator = _withCurrentTimeIndicator ?? isToday;\n\n const [timeIndicatorOffset, setTimeIndicatorOffset] = useState(\n getCurrentTimePosition({ startTime, endTime, intervalMinutes })\n );\n useInterval(\n () => setTimeIndicatorOffset(getCurrentTimePosition({ startTime, endTime, intervalMinutes })),\n 60000,\n { autoInvoke: true }\n );\n\n const todayDayIndex = weekdays.findIndex((day) => dayjs(day).isSame(dayjs(), 'day'));\n const showTimeIndicator =\n withCurrentTimeIndicator &&\n todayDayIndex >= 0 &&\n isInTimeRange({ date: dayjs().toDate(), startTime, endTime });\n const formattedCurrentTime = withCurrentTimeBubble\n ? formatDate({ locale: ctx.getLocale(locale), date: dayjs(), format: slotLabelFormat })\n : '';\n\n type DropTargetSlot = { resourceId: string | number; slotIndex: number };\n\n const handleExternalDrop = useCallback(\n (e: React.DragEvent, target: DropTargetSlot) => {\n if (!onExternalEventDrop) {\n return;\n }\n const dayIndex = Math.floor(target.slotIndex / totalSlotsPerDay);\n const slotInDay = target.slotIndex % totalSlotsPerDay;\n const slotDay = weekdays[dayIndex];\n if (slotDay) {\n onExternalEventDrop({\n dataTransfer: e.dataTransfer,\n dropDateTime: `${dayjs(slotDay).format('YYYY-MM-DD')} ${slots[slotInDay].startTime}`,\n resourceId: target.resourceId,\n });\n }\n },\n [onExternalEventDrop, slots, weekdays, totalSlotsPerDay]\n );\n\n const lastDropResourceId = useRef<string | number | undefined>(undefined);\n\n const handleInternalEventDrop = useCallback(\n (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => {\n onEventDrop?.({ ...data, resourceId: lastDropResourceId.current });\n },\n [onEventDrop]\n );\n\n const dragDrop = useDragDropHandlers<DropTargetSlot>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop: handleInternalEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (target: DropTargetSlot, draggedEvent: ScheduleEventData) => {\n lastDropResourceId.current = target.resourceId;\n const dayIndex = Math.floor(target.slotIndex / totalSlotsPerDay);\n const slotInDay = target.slotIndex % totalSlotsPerDay;\n const slotTime = slots[slotInDay].startTime;\n const targetDay = weekdays[dayIndex] || weekdays[0];\n return calculateDropTime({\n draggedEvent,\n targetDate: targetDay,\n targetSlotTime: slotTime,\n intervalMinutes,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\n });\n\n const groupToResourceId = useMemo(() => getGroupToResourceIdMap(resources), [resources]);\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex, group) => {\n if (!onSlotDragEnd) {\n return;\n }\n const startDayIndex = Math.floor(startIndex / totalSlotsPerDay);\n const startSlotInDay = startIndex % totalSlotsPerDay;\n const endDayIndex = Math.floor(endIndex / totalSlotsPerDay);\n const endSlotInDay = endIndex % totalSlotsPerDay;\n const startDay = weekdays[startDayIndex];\n const endDay = weekdays[endDayIndex];\n if (startDay && endDay) {\n onSlotDragEnd({\n rangeStart: `${dayjs(startDay).format('YYYY-MM-DD')} ${slots[startSlotInDay].startTime}`,\n rangeEnd: `${dayjs(endDay).format('YYYY-MM-DD')} ${slots[endSlotInDay].endTime}`,\n resourceId: groupToResourceId.get(group) ?? group,\n });\n }\n },\n });\n\n const eventResize = useHorizontalEventResize({\n enabled: withEventResize,\n mode,\n startTime,\n endTime,\n intervalMinutes,\n onEventResize,\n canResizeEvent,\n });\n\n const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static';\n\n const handleTimeSlotClick = (\n resourceId: string | number,\n day: string,\n slotTime: string,\n e: React.MouseEvent<HTMLButtonElement>\n ) => {\n if (!onTimeSlotClick) {\n return;\n }\n const slotIndex = slots.findIndex((s) => s.startTime === slotTime);\n if (slotIndex === -1) {\n return;\n }\n const slot = slots[slotIndex];\n const dayStr = dayjs(day).format('YYYY-MM-DD');\n onTimeSlotClick({\n slotStart: `${dayStr} ${slot.startTime}`,\n slotEnd: `${dayStr} ${slot.endTime}`,\n nativeEvent: e,\n resourceId,\n });\n };\n\n const weekViewEvents = useMemo(\n () =>\n getResourcesWeekViewEvents({\n events,\n resources,\n weekdays,\n startTime,\n endTime,\n expansionLimit: recurrenceExpansionLimit,\n }),\n [events, resources, weekdays, startTime, endTime, recurrenceExpansionLimit]\n );\n\n const dayLabels = weekdays.map((day) => {\n const d = dayjs(day);\n const today = d.isSame(dayjs(), 'day') && highlightToday;\n const weekend = ctx.getWeekendDays(weekendDays).includes(d.day() as DayOfWeek);\n\n return (\n <Box\n {...getStyles('resourcesWeekViewDayLabel')}\n key={day}\n mod={{ today, weekend }}\n style={{ width: `calc(var(--resources-week-view-slot-width) * ${totalSlotsPerDay})` }}\n >\n {formatDate({ date: d, locale: ctx.getLocale(locale), format: weekdayFormat })}\n </Box>\n );\n });\n\n const timeLabels = weekdays.flatMap((day) =>\n slots.map((interval) => {\n const dayStr = dayjs(day).format('YYYY-MM-DD');\n const intervalTime = dayjs(`${dayStr} ${interval.startTime}`);\n const label = formatDate({\n date: intervalTime,\n locale: ctx.getLocale(locale),\n format: slotLabelFormat,\n });\n\n return (\n <Box\n {...getStyles('resourcesWeekViewTimeLabel')}\n key={`${day}-${interval.startTime}`}\n mod={{\n 'hour-start': interval.isHourStart,\n ...getBusinessHoursMod({\n time: interval.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n }}\n >\n {label}\n </Box>\n );\n })\n );\n\n const slotsRef: ResourcesGridControlsRef = useRef<HTMLButtonElement[][]>([]);\n const rowSlotsContainersRef = useRef<(HTMLDivElement | null)[]>([]);\n const viewportRef = useRef<HTMLDivElement>(null);\n const mergedViewportRef = useMergedRef(viewportRef, scrollAreaProps?.viewportRef);\n\n const firstSlotIndex = { resourceIndex: 0, slotIndex: 0 };\n\n useIsomorphicEffect(() => {\n if (!startScrollDateTime || !viewportRef.current) {\n return;\n }\n const parsed = dayjs(startScrollDateTime);\n const targetDayStr = parsed.format('YYYY-MM-DD 00:00:00');\n const targetTime = parsed.format('HH:mm:ss');\n const dayIndex = weekdays.indexOf(targetDayStr);\n if (dayIndex < 0) {\n return;\n }\n const slotInDay = slots.findIndex((s) => s.startTime >= targetTime);\n if (slotInDay < 0) {\n return;\n }\n const flatIndex = dayIndex * totalSlotsPerDay + slotInDay;\n const firstResourceSlots = slotsRef.current[0];\n if (!firstResourceSlots || firstResourceSlots.length === 0) {\n return;\n }\n const targetSlot = firstResourceSlots[flatIndex];\n if (!targetSlot) {\n return;\n }\n const slotRect = targetSlot.getBoundingClientRect();\n const viewportRect = viewportRef.current.getBoundingClientRect();\n const cornerEl = viewportRef.current.querySelector(`.${classes.resourcesWeekViewCorner}`);\n const labelWidth = cornerEl ? cornerEl.getBoundingClientRect().width : 0;\n viewportRef.current.scrollTo({\n left: slotRect.left - viewportRect.left - labelWidth,\n top: 0,\n });\n }, []);\n\n const getSlotIndexFromDragPoint = useCallback((event: React.DragEvent, resourceIndex: number) => {\n return getIndexFromDragPoint(slotsRef.current[resourceIndex] ?? [], event.clientX);\n }, []);\n\n const handleSlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n resourceIndex: number,\n slotIndex: number\n ) => {\n handleResourcesGridKeyDown({\n controlsRef: slotsRef,\n resourceIndex,\n slotIndex,\n event,\n });\n };\n\n const dayWidthPercent = 100 / weekdays.length;\n\n const rows = orderedResources.map((resource, resourceIndex) => {\n const eventNodes: React.ReactNode[] = [];\n const resourceAllDayBars = weekViewEvents.allDayBars[resource.id] ?? [];\n const maxAllDayCount = resourceAllDayBars.reduce((max, bar) => Math.max(max, bar.row + 1), 0);\n\n weekdays.forEach((day, dayIndex) => {\n const dayEvents = weekViewEvents.byDay[day];\n if (!dayEvents) {\n return;\n }\n\n const dayOffsetPercent = (dayIndex / weekdays.length) * 100;\n\n const bgEvents = [\n ...(dayEvents.backgroundTimedEvents[resource.id] || []),\n ...(dayEvents.backgroundAllDayEvents[resource.id] || []),\n ];\n for (const event of bgEvents) {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-${event.id}-${day}`,\n ...getStyles('resourcesWeekViewBackgroundEvent', {\n style: {\n left: `${dayOffsetPercent + (event.position.top / 100) * dayWidthPercent}%`,\n width: `${(event.position.height / 100) * dayWidthPercent}%`,\n top: 0,\n height: '100%',\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n eventNodes.push(renderEvent(event, bgEventProps as any));\n } else {\n eventNodes.push(<Box {...bgEventProps} />);\n }\n }\n\n const allRegularEvents = (dayEvents.regularEvents[resource.id] || []).filter(\n (event) => !isAllDayEvent({ event, date: day })\n );\n\n const visibleEvents =\n maxEventsPerTimeSlot !== undefined\n ? allRegularEvents.filter((event) => event.position.column < maxEventsPerTimeSlot)\n : allRegularEvents;\n\n for (const event of visibleEvents) {\n const isDraggable = dragDrop.isDraggableEvent(event);\n const isResizable = eventResize.isResizableEvent(event);\n const resizePosition = eventResize.getResizePosition(event.id);\n const isThisEventResizing = resizePosition !== null;\n const activeEdge =\n isThisEventResizing && eventResize.resizingEdge ? eventResize.resizingEdge : null;\n\n const effectiveTop = resizePosition ? resizePosition.left : event.position.top;\n const effectiveHeight = resizePosition ? resizePosition.width : event.position.height;\n const eventLeft = dayOffsetPercent + (effectiveTop / 100) * dayWidthPercent;\n const eventWidth = (effectiveHeight / 100) * dayWidthPercent;\n\n const eventColors = isResizable\n ? theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: event.variant || 'light',\n autoContrast: true,\n })\n : null;\n\n const adjustPosition =\n maxEventsPerTimeSlot !== undefined && event.position.overlaps > maxEventsPerTimeSlot;\n\n const eventDate = dayjs(day).format('YYYY-MM-DD');\n\n eventNodes.push(\n <Box\n key={`${event.id}-${day}`}\n {...getStyles('resourcesWeekViewEventWrapper')}\n __vars={eventColors ? { '--event-color': eventColors.color } : undefined}\n data-resizing={isThisEventResizing || undefined}\n style={{\n left: `calc(${eventLeft}% + 1px)`,\n top: adjustPosition\n ? `calc((100% - 22px) * ${event.position.column} / ${maxEventsPerTimeSlot})`\n : `${event.position.offset}%`,\n width: `calc(${eventWidth}% - 2px)`,\n height: adjustPosition\n ? `calc((100% - 22px) / ${maxEventsPerTimeSlot})`\n : `${event.position.width}%`,\n }}\n >\n <ScheduleEvent\n event={event}\n autoSize\n nowrap\n draggable={isDraggable}\n isResizing={isThisEventResizing}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={\n onEventClick\n ? (e) => {\n if (!eventResize.wasResizing()) {\n onEventClick(event, e);\n }\n }\n : undefined\n }\n style={{ width: '100%', height: '100%' }}\n />\n {isResizable && mode !== 'static' && (\n <>\n <div\n {...getStyles('resourcesWeekViewResizeHandle')}\n data-edge=\"start\"\n data-active={activeEdge === 'start' || undefined}\n onPointerDown={(e) => {\n const container = rowSlotsContainersRef.current[resourceIndex];\n if (container) {\n eventResize.handleResizeStart({\n event,\n edge: 'start',\n container,\n originalLeft: event.position.top,\n originalWidth: event.position.height,\n eventDate,\n dayIndex,\n dayCount: weekdays.length,\n pointerEvent: e,\n });\n }\n }}\n />\n <div\n {...getStyles('resourcesWeekViewResizeHandle')}\n data-edge=\"end\"\n data-active={activeEdge === 'end' || undefined}\n onPointerDown={(e) => {\n const container = rowSlotsContainersRef.current[resourceIndex];\n if (container) {\n eventResize.handleResizeStart({\n event,\n edge: 'end',\n container,\n originalLeft: event.position.top,\n originalWidth: event.position.height,\n eventDate,\n dayIndex,\n dayCount: weekdays.length,\n pointerEvent: e,\n });\n }\n }}\n />\n </>\n )}\n </Box>\n );\n }\n\n if (maxEventsPerTimeSlot !== undefined) {\n const clusters = getOverlapClusters(allRegularEvents);\n for (const cluster of clusters) {\n const hiddenCount = cluster.filter(\n (e) => e.position.column >= maxEventsPerTimeSlot\n ).length;\n\n if (hiddenCount > 0 && mode !== 'static') {\n const leftPercent =\n dayOffsetPercent +\n (Math.min(...cluster.map((e) => e.position.top)) / 100) * dayWidthPercent;\n const rightPercent =\n dayOffsetPercent +\n (Math.max(...cluster.map((e) => e.position.top + e.position.height)) / 100) *\n dayWidthPercent;\n\n eventNodes.push(\n <MoreEvents\n key={`more-${resource.id}-${day}-${cluster[0].id}`}\n events={cluster}\n moreEventsCount={hiddenCount}\n mode={mode}\n labels={labels}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n onEventClick={onEventClick}\n style={{\n position: 'absolute',\n left: `calc(${leftPercent}% + 1px)`,\n width: `calc(${rightPercent - leftPercent}% - 2px)`,\n bottom: 0,\n height: '22px',\n paddingInline: 4,\n zIndex: 4,\n }}\n {...stylesApiProps}\n {...moreEventsProps}\n />\n );\n }\n }\n }\n });\n\n const stickyLabelOffset = hasGroups\n ? 'calc(var(--resources-week-view-group-label-width) + var(--resources-week-view-resource-label-width) + 5px)'\n : 'calc(var(--resources-week-view-resource-label-width) + 5px)';\n\n resourceAllDayBars.forEach((bar) => {\n const leftPercent = bar.startDayIndex * dayWidthPercent;\n const widthPercent = (bar.endDayIndex - bar.startDayIndex + 1) * dayWidthPercent;\n\n eventNodes.push(\n <div\n key={`all-day-${bar.event.id}-${bar.startDayIndex}`}\n {...getStyles('resourcesWeekViewAllDayEvent', {\n style: {\n left: `calc(${leftPercent}% + 1px)`,\n width: `calc(${widthPercent}% - 2px)`,\n top: `calc(${bar.row} * (var(--resources-week-view-all-day-height) + 2px) + 2px)`,\n },\n })}\n >\n <ScheduleEvent\n event={bar.event}\n autoSize\n nowrap\n renderEventBody={(barEvent) => (\n <span\n style={{\n position: 'sticky',\n insetInlineStart: stickyLabelOffset,\n display: 'inline-block',\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {renderEventBody ? renderEventBody(barEvent) : barEvent.title}\n </span>\n )}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(bar.event, e) : undefined}\n style={{ width: '100%', height: '100%', overflow: 'visible' }}\n styles={{\n eventInner: {\n display: 'block',\n overflow: 'visible',\n lineHeight: 'var(--resources-week-view-all-day-height)',\n },\n }}\n />\n </div>\n );\n });\n\n return (\n <ResourcesWeekViewRow\n key={resource.id}\n resource={resource}\n resourceIndex={resourceIndex}\n weekdays={weekdays}\n slots={slots}\n getStyles={getStyles}\n labels={labels}\n highlightBusinessHours={highlightBusinessHours}\n businessHours={businessHours}\n withEventsDragAndDrop={withDragHandlers}\n mode={mode}\n slotsRef={slotsRef}\n firstSlotIndex={firstSlotIndex}\n onSlotKeyDown={handleSlotKeyDown}\n onSlotClick={handleTimeSlotClick}\n onRowSlotsDragOver={(event, resourceId, resIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, resIdx);\n if (slotIndex !== null) {\n dragDrop.handleDragOver(event, { resourceId, slotIndex });\n }\n }}\n onRowSlotsDragLeave={dragDrop.handleDragLeave}\n onRowSlotsDrop={(event, resourceId, resIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, resIdx);\n if (slotIndex !== null) {\n dragDrop.handleDrop(event, { resourceId, slotIndex });\n }\n }}\n dropTargetSlotIndex={\n dragDrop.dropTarget?.resourceId === resource.id\n ? dragDrop.dropTarget.slotIndex\n : undefined\n }\n withDragSlotSelect={withDragSlotSelect}\n onSlotPointerDown={slotDragSelect.handleSlotPointerDown}\n isSlotDragSelected={slotDragSelect.isSlotSelected}\n rowSlotsContainerRef={(node) => {\n rowSlotsContainersRef.current[resourceIndex] = node;\n }}\n renderResourceLabel={renderResourceLabel}\n renderGroupLabel={renderGroupLabel}\n scrolledX={scrolledX}\n groupInfo={hasGroups ? resourceGroupMap[resourceIndex] : undefined}\n allDayCount={maxAllDayCount}\n >\n {eventNodes}\n </ResourcesWeekViewRow>\n );\n });\n\n const headerLabel = getWeekLabel({\n weekdays,\n locale: ctx.getLocale(locale),\n weekLabelFormat: weekLabelFormat!,\n renderWeekLabel,\n });\n\n const indicatorLeftPercent =\n todayDayIndex >= 0 ? ((todayDayIndex + timeIndicatorOffset / 100) / weekdays.length) * 100 : 0;\n\n const content = (\n <Box\n {...getStyles('resourcesWeekView')}\n mod={{\n static: mode === 'static',\n 'slot-dragging': slotDragSelect.isDragging,\n resizing: eventResize.isResizing,\n 'event-interaction': eventResize.isResizing || dragDrop.dragContextValue.isDragging,\n }}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"week\"\n navigationHandlers={{\n previous: () => previousWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n next: () => nextWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n today: () => toDateString(dayjs()),\n }}\n control={{\n miw: 180,\n title: headerLabel,\n }}\n labels={labels}\n onDateChange={onDateChange}\n onViewChange={onViewChange}\n previousControlProps={previousControlProps}\n nextControlProps={nextControlProps}\n todayControlProps={todayControlProps}\n viewSelectProps={{ views: ['day', 'week', 'month'] as const, ...viewSelectProps }}\n stylesApiProps={stylesApiProps}\n />\n )}\n\n <Box {...getStyles('resourcesWeekViewRoot')}>\n <ScrollArea\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('resourcesWeekViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n onScrollPositionChange={(position) => {\n scrollAreaProps?.onScrollPositionChange?.(position);\n setScrolled(position.y !== 0);\n setScrolledX(position.x !== 0);\n }}\n viewportRef={mergedViewportRef}\n >\n <div {...getStyles('resourcesWeekViewInner')}>\n <div {...getStyles('resourcesWeekViewHeaderRows')}>\n <div\n {...getStyles('resourcesWeekViewCorner')}\n key=\"corner\"\n style={\n hasGroups\n ? {\n flexBasis:\n 'calc(var(--resources-week-view-resource-label-width) + var(--resources-week-view-group-label-width))',\n minWidth:\n 'calc(var(--resources-week-view-resource-label-width) + var(--resources-week-view-group-label-width))',\n }\n : undefined\n }\n >\n {getLabel('resources', labels)}\n </div>\n <div {...getStyles('resourcesWeekViewHeaderContent')}>\n <div {...getStyles('resourcesWeekViewDayLabelsRow')}>{dayLabels}</div>\n <Box {...getStyles('resourcesWeekViewTimeLabelsRow')} mod={{ scrolled }}>\n {timeLabels}\n </Box>\n </div>\n </div>\n\n {rows}\n\n {showTimeIndicator && (\n <Box\n {...getStyles('resourcesWeekViewCurrentTimeIndicator')}\n __vars={{\n '--indicator-left-offset': hasGroups\n ? `calc(var(--resources-week-view-resource-label-width) + var(--resources-week-view-group-label-width) + (100% - var(--resources-week-view-resource-label-width) - var(--resources-week-view-group-label-width)) * ${indicatorLeftPercent} / 100)`\n : `calc(var(--resources-week-view-resource-label-width) + (100% - var(--resources-week-view-resource-label-width)) * ${indicatorLeftPercent} / 100)`,\n '--_time-bubble-width': formattedCurrentTime\n ?.toString()\n .toLowerCase()\n .includes('m')\n ? '64px'\n : '46px',\n }}\n >\n {withCurrentTimeBubble && (\n <div {...getStyles('resourcesWeekViewCurrentTimeIndicatorTimeBubble')}>\n {formattedCurrentTime}\n </div>\n )}\n {!withCurrentTimeBubble && (\n <div {...getStyles('resourcesWeekViewCurrentTimeIndicatorThumb')} />\n )}\n <div {...getStyles('resourcesWeekViewCurrentTimeIndicatorLine')} />\n </Box>\n )}\n </div>\n </ScrollArea>\n </Box>\n </Box>\n );\n\n const dragContextValue = useMemo<DragContextValue>(\n () => dragDrop.dragContextValue,\n [dragDrop.dragContextValue]\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={dragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nResourcesWeekView.displayName = '@mantine/schedule/ResourcesWeekView';\nResourcesWeekView.classes = classes;\nResourcesWeekView.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2NA,MAAM,eAAe;CACnB,kBAAkB;CAClB,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,iBAAiB;CACjB,YAAY;CACZ,iBAAiB;CACjB,eAAe;CACf,wBAAwB;CACxB,eAAe,CAAC,YAAY,UAAU;CACtC,uBAAuB;CACvB,iBAAiB;CACjB,oBAAoB;CACpB,iBAAiB;CACjB,uBAAuB;CACvB,gBAAgB;CAChB,MAAM;CACN,sBAAsB;AACxB;AAEA,MAAM,gBAAA,GAAA,cAAA,mBAAA,EACH,QAAQ,EAAE,QAAQ,WAAW,WAAW,uBAAuB,EAC9D,mBAAmB;CACjB,gCAAgC,UAAA,GAAA,cAAA,UAAA,CAAmB,MAAM,IAAI,KAAA;CAC7D,qCAAA,GAAA,cAAA,IAAA,CAAwC,SAAS;CACjD,qCAAA,GAAA,cAAA,IAAA,CAAwC,SAAS;CACjD,4CAAA,GAAA,cAAA,IAAA,CAA+C,eAAe;AAChE,EACF,EACF;AAEA,MAAa,qBAAA,GAAA,cAAA,QAAA,EAAuD,WAAW;CAC7E,MAAM,SAAA,GAAA,cAAA,SAAA,CAAiB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AA,kBAAA,IAAA,CAACf,cAAAA,KAAD;SAAK,GAAI,UAAU,gCAAgC;SAAG,KAAK,EAAE,SAAS;mBACnE;QACE,CAAA,CACF;SACF;;MAEJ;MAEA,qBACC,iBAAA,GAAA,kBAAA,KAAA,CAACA,cAAAA,KAAD;OACE,GAAI,UAAU,uCAAuC;OACrD,QAAQ;QACN,2BAA2B,YACvB,mNAAmN,qBAAqB,WACxO,qHAAqH,qBAAqB;QAC9I,wBAAwB,sBACpB,SAAS,CAAC,CACX,YAAY,CAAC,CACb,SAAS,GAAG,IACX,SACA;OACN;iBAZF;QAcG,yBACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;SAAK,GAAI,UAAU,iDAAiD;mBACjE;QACE,CAAA;QAEN,CAAC,yBACA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAK,GAAI,UAAU,4CAA4C,EAAI,CAAA;QAErE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAK,GAAI,UAAU,2CAA2C,EAAI,CAAA;OAC/D;;KAEJ;;GACK,CAAA;EACT,CAAA,CACF;;CAGP,MAAM,oBAAA,GAAA,MAAA,QAAA,OACE,SAAS,kBACf,CAAC,SAAS,gBAAgB,CAC5B;CAEA,IAAI,uBACF,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACgB,oBAAAA,YAAY,UAAb;EAAsB,OAAO;YAAmB;CAA8B,CAAA;CAGvF,OAAO;AACT,CAAC;AAED,kBAAkB,cAAc;AAChC,kBAAkB,UAAUd,iCAAAA;AAC5B,kBAAkB,eAAe"}
@@ -2,6 +2,7 @@
2
2
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
3
3
  const require_clamp_interval_minutes = require("../utils/clamp-interval-minutes/clamp-interval-minutes.cjs");
4
4
  const require_parse_time_string = require("../utils/parse-time-string/parse-time-string.cjs");
5
+ const require_get_day_relative_percent = require("../utils/get-day-relative-percent/get-day-relative-percent.cjs");
5
6
  let dayjs = require("dayjs");
6
7
  dayjs = require_runtime.__toESM(dayjs);
7
8
  let react = require("react");
@@ -36,7 +37,7 @@ function useHorizontalEventResize({ enabled = false, mode = "default", startTime
36
37
  const snapPercent = (0, react.useCallback)((percent) => {
37
38
  return clampAndSnap(percent / 100 * totalMinutes) / totalMinutes * 100;
38
39
  }, [totalMinutes, clampAndSnap]);
39
- const handleResizeStart = (0, react.useCallback)(({ event, edge, container, originalLeft, originalWidth, eventDate, pointerEvent }) => {
40
+ const handleResizeStart = (0, react.useCallback)(({ event, edge, container, originalLeft, originalWidth, eventDate, dayIndex = 0, dayCount = 1, pointerEvent }) => {
40
41
  if (!enabled || mode === "static") return;
41
42
  pointerEvent.preventDefault();
42
43
  pointerEvent.stopPropagation();
@@ -51,7 +52,9 @@ function useHorizontalEventResize({ enabled = false, mode = "default", startTime
51
52
  currentWidth: originalWidth,
52
53
  eventDate,
53
54
  originalStart: (0, dayjs.default)(event.start).format("YYYY-MM-DD HH:mm:ss"),
54
- originalEnd: (0, dayjs.default)(event.end).format("YYYY-MM-DD HH:mm:ss")
55
+ originalEnd: (0, dayjs.default)(event.end).format("YYYY-MM-DD HH:mm:ss"),
56
+ dayIndex,
57
+ dayCount
55
58
  };
56
59
  resizeRef.current = state;
57
60
  setResizeState(state);
@@ -67,8 +70,13 @@ function useHorizontalEventResize({ enabled = false, mode = "default", startTime
67
70
  const state = resizeRef.current;
68
71
  if (!state) return;
69
72
  const containerRect = state.container.getBoundingClientRect();
70
- const relativeX = e.clientX - containerRect.left;
71
- const snappedPercent = snapPercent(Math.max(0, Math.min(100, relativeX / containerRect.width * 100)));
73
+ const snappedPercent = snapPercent(require_get_day_relative_percent.getDayRelativePercent({
74
+ clientX: e.clientX,
75
+ containerLeft: containerRect.left,
76
+ containerWidth: containerRect.width,
77
+ dayIndex: state.dayIndex,
78
+ dayCount: state.dayCount
79
+ }));
72
80
  let newLeft = state.originalLeft;
73
81
  let newWidth = state.originalWidth;
74
82
  if (state.edge === "end") newWidth = Math.max(minWidthPercent, snappedPercent - state.originalLeft);