@mantine-vue/schedule 3.4.0 → 3.5.0

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.
@@ -99,7 +99,8 @@ export interface BaseViewOwnProps {
99
99
  */
100
100
  recurrenceExpansionLimit?: number;
101
101
  /**
102
- * If set, background events can be focused and clicked. Has no effect in static mode.
102
+ * If set, background events can be focused and clicked. Combined with event resize, timed
103
+ * background events can also be resized. Has no effect in static mode.
103
104
  * @default false
104
105
  */
105
106
  withInteractiveBackgroundEvents?: boolean;
@@ -2,13 +2,13 @@ import type { CSSProperties } from 'vue';
2
2
  import type { BoxProps, Factory, ScrollAreaProps } from '@mantine-vue/core';
3
3
  import type { StylesApiProps } from '@mantine-vue/core/styles-api';
4
4
  import type { EventSlots, ForwardedProps, TimeViewEmits, TimeViewOwnProps } from '../../component-props';
5
- import type { DateLabelFormat } from '../../types';
5
+ import type { DateLabelFormat, ScheduleEventOverlapMode } from '../../types';
6
6
  import type { CurrentTimeIndicatorStylesNames } from '../CurrentTimeIndicator/CurrentTimeIndicator.types';
7
7
  import type { MoreEventsEmits, MoreEventsProps, MoreEventsStylesNames } from '../MoreEvents/MoreEvents.types';
8
8
  import type { ScheduleEventStylesNames } from '../ScheduleEvent/ScheduleEvent.types';
9
9
  import type { CombinedScheduleHeaderStylesNames, ScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader.types';
10
10
  import type { MonthYearSelectStylesNames } from '../ScheduleHeader/MonthYearSelect/MonthYearSelect.types';
11
- export type DayViewOwnStylesNames = 'dayView' | 'dayViewInner' | 'dayViewScrollArea' | 'dayViewAllDay' | 'dayViewAllDayEvents' | 'dayViewSlot' | 'dayViewSlots' | 'dayViewTimeSlots' | 'dayViewSlotLabel' | 'dayViewSlotLabels' | 'dayViewBackgroundEvent';
11
+ export type DayViewOwnStylesNames = 'dayView' | 'dayViewInner' | 'dayViewScrollArea' | 'dayViewAllDay' | 'dayViewAllDayEvents' | 'dayViewSlot' | 'dayViewSlots' | 'dayViewTimeSlots' | 'dayViewSlotLabel' | 'dayViewSlotLabels' | 'dayViewBackgroundEvent' | 'dayViewBackgroundEventResizeHandle';
12
12
  /**
13
13
  * `DayView` forwards `classNames` and `styles` to the components it renders, so their
14
14
  * selectors are part of its Styles API. The month/year select is excluded because the day
@@ -16,11 +16,15 @@ export type DayViewOwnStylesNames = 'dayView' | 'dayViewInner' | 'dayViewScrollA
16
16
  */
17
17
  export type DayViewStylesNames = DayViewOwnStylesNames | MoreEventsStylesNames | ScheduleEventStylesNames | Exclude<CombinedScheduleHeaderStylesNames, MonthYearSelectStylesNames> | CurrentTimeIndicatorStylesNames | ScheduleHeaderStylesNames;
18
18
  export type DayViewCssVariables = {
19
- dayView: '--day-view-radius' | '--day-view-slot-height' | '--day-view-all-day-slot-height';
19
+ dayView: '--day-view-radius' | '--day-view-slot-height' | '--day-view-all-day-slot-height' | '--event-raise-delay' | '--event-z-index' | '--event-z-index-raised';
20
20
  };
21
21
  export type DayViewSlots = EventSlots;
22
22
  /** Props declared by `DayView` itself. See `DayViewProps` for the full public type. */
23
23
  export interface DayViewOwnProps extends TimeViewOwnProps, StylesApiProps<DayViewFactory> {
24
+ /** Determines how overlapping events are laid out. @default 'columns' */
25
+ eventOverlapMode?: ScheduleEventOverlapMode;
26
+ /** Time in ms before a hovered cascade event is raised above covering events. @default 600 */
27
+ eventOverlapRaiseDelay?: number;
24
28
  /**
25
29
  * Length of one time slot in minutes.
26
30
  * @default 15
@@ -1,4 +1,4 @@
1
- import { AnyDateValue, DayPositionedEventData, ScheduleEventData } from '../../../types';
1
+ import { AnyDateValue, DayPositionedEventData, ScheduleEventData, ScheduleEventOverlapMode } from '../../../types';
2
2
  interface GetDayPositionedEventsInput {
3
3
  /** Date at which events are positioned, used to check if events are all-day */
4
4
  date: AnyDateValue;
@@ -10,6 +10,8 @@ interface GetDayPositionedEventsInput {
10
10
  endTime?: string;
11
11
  /** Number of minutes per time slot, used to align the canvas to whole slots */
12
12
  intervalMinutes?: number;
13
+ /** Determines how overlapping events are laid out. @default 'columns' */
14
+ eventOverlapMode?: ScheduleEventOverlapMode;
13
15
  }
14
- export declare function getDayPositionedEvents({ events, startTime, endTime, intervalMinutes, date, }: GetDayPositionedEventsInput): DayPositionedEventData[];
16
+ export declare function getDayPositionedEvents({ events, startTime, endTime, intervalMinutes, date, eventOverlapMode, }: GetDayPositionedEventsInput): DayPositionedEventData[];
15
17
  export {};
@@ -1,12 +1,13 @@
1
- import { AnyDateValue, DayPositionedEventData, ScheduleEventData } from '../../../types';
1
+ import { AnyDateValue, DayPositionedEventData, ScheduleEventData, ScheduleEventOverlapMode } from '../../../types';
2
2
  interface GetDayViewEventsInput {
3
3
  events: ScheduleEventData[] | undefined;
4
4
  date: AnyDateValue;
5
5
  startTime?: string;
6
6
  endTime?: string;
7
7
  intervalMinutes?: number;
8
+ eventOverlapMode?: ScheduleEventOverlapMode;
8
9
  }
9
- export declare function getDayViewEvents({ events, date, startTime, endTime, intervalMinutes, }: GetDayViewEventsInput): {
10
+ export declare function getDayViewEvents({ events, date, startTime, endTime, intervalMinutes, eventOverlapMode, }: GetDayViewEventsInput): {
10
11
  allDayEvents: DayPositionedEventData[];
11
12
  regularEvents: DayPositionedEventData[];
12
13
  backgroundTimedEvents: DayPositionedEventData[];
@@ -1,3 +1,2 @@
1
1
  export * from './ResourcesDayView';
2
- export * from './get-overlap-clusters/get-overlap-clusters';
3
2
  export * from './get-resources-day-view-events/get-resources-day-view-events';
@@ -88,7 +88,7 @@ export interface ScheduleOwnProps extends StylesApiProps<ScheduleFactory> {
88
88
  * @default () => true
89
89
  */
90
90
  canResizeEvent?: (event: ScheduleEventData) => boolean;
91
- /** If set, background events can be focused and clicked in day, week and month views. */
91
+ /** If set, background events can be focused and clicked. Combined with event resize, timed background events in day and week views can also be resized. */
92
92
  withInteractiveBackgroundEvents?: boolean;
93
93
  /**
94
94
  * Maximum number of instances generated per recurring series.
@@ -2,6 +2,7 @@ import type { VNodeChild } from 'vue';
2
2
  import type { BoxProps } from '@mantine-vue/core';
3
3
  import type { RenderEvent, RenderEventBody } from '../../component-props';
4
4
  import type { ScheduleEventData } from '../../types';
5
+ export type ScheduleBackgroundEventResizeEdge = 'top' | 'bottom' | 'start' | 'end';
5
6
  export interface ScheduleBackgroundEventOwnProps {
6
7
  /** Background event to display. */
7
8
  event: ScheduleEventData;
@@ -11,11 +12,22 @@ export interface ScheduleBackgroundEventOwnProps {
11
12
  renderEvent?: RenderEvent;
12
13
  /** Function to customize event body. */
13
14
  renderEventBody?: RenderEventBody;
15
+ /** If set, resize handles are rendered on both edges. */
16
+ withResize?: boolean;
17
+ /** Axis along which the event is resized. @default 'vertical' */
18
+ resizeAxis?: 'vertical' | 'horizontal';
19
+ /** Props passed to both resize handles. */
20
+ resizeHandleProps?: Record<string, any>;
21
+ /** Whether this event is currently being resized. */
22
+ isResizing?: boolean;
23
+ /** Edge currently being dragged. */
24
+ activeResizeEdge?: ScheduleBackgroundEventResizeEdge | null;
14
25
  }
15
26
  export interface ScheduleBackgroundEventProps extends Omit<BoxProps, keyof ScheduleBackgroundEventOwnProps>, ScheduleBackgroundEventOwnProps {
16
27
  }
17
28
  export interface ScheduleBackgroundEventEmits {
18
29
  eventClick: [event: ScheduleEventData, nativeEvent: MouseEvent];
30
+ resizeStart: [edge: ScheduleBackgroundEventResizeEdge, nativeEvent: PointerEvent];
19
31
  }
20
32
  export interface ScheduleBackgroundEventSlots {
21
33
  default?: (props: {
@@ -1,8 +1,10 @@
1
1
  import type { ScheduleBackgroundEventOwnProps, ScheduleBackgroundEventSlots } from './ScheduleBackgroundEvent.types';
2
2
  type __VLS_Slots = ScheduleBackgroundEventSlots;
3
3
  declare const __VLS_base: import("vue").DefineComponent<ScheduleBackgroundEventOwnProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
+ resizeStart: (edge: import("./ScheduleBackgroundEvent.types").ScheduleBackgroundEventResizeEdge, nativeEvent: PointerEvent) => any;
4
5
  eventClick: (event: import("../..").ScheduleEventData, nativeEvent: MouseEvent) => any;
5
6
  }, string, import("vue").PublicProps, Readonly<ScheduleBackgroundEventOwnProps> & Readonly<{
7
+ onResizeStart?: ((edge: import("./ScheduleBackgroundEvent.types").ScheduleBackgroundEventResizeEdge, nativeEvent: PointerEvent) => any) | undefined;
6
8
  onEventClick?: ((event: import("../..").ScheduleEventData, nativeEvent: MouseEvent) => any) | undefined;
7
9
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
10
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -2,18 +2,18 @@ import type { CSSProperties, VNodeChild } from 'vue';
2
2
  import type { BoxProps, Factory, ScrollAreaProps } from '@mantine-vue/core';
3
3
  import type { StylesApiProps } from '@mantine-vue/core/styles-api';
4
4
  import type { EventSlots, ForwardedProps, TimeViewEmits, TimeViewOwnProps } from '../../component-props';
5
- import type { DateLabelFormat, DateStringValue, DayOfWeek } from '../../types';
5
+ import type { DateLabelFormat, DateStringValue, DayOfWeek, ScheduleEventOverlapMode } from '../../types';
6
6
  import type { CurrentTimeIndicatorStylesNames } from '../CurrentTimeIndicator/CurrentTimeIndicator.types';
7
7
  import type { ScheduleEventStylesNames } from '../ScheduleEvent/ScheduleEvent.types';
8
8
  import type { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader.types';
9
- export type WeekViewOwnStylesNames = 'weekView' | 'weekViewRoot' | 'weekViewHeader' | 'weekViewInner' | 'weekViewAllDaySlotsEvents' | 'weekViewAllDaySlots' | 'weekViewAllDaySlotsList' | 'weekViewAllDaySlotsLabel' | 'weekViewScrollArea' | 'weekViewCorner' | 'weekViewSlotLabels' | 'weekViewSlotLabel' | 'weekViewDayLabel' | 'weekViewDayWeekday' | 'weekViewDay' | 'weekViewDayNumber' | 'weekViewDaySlot' | 'weekViewDaySlots' | 'weekViewWeekLabel' | 'weekViewWeekNumber' | 'weekViewBackgroundEvent';
9
+ export type WeekViewOwnStylesNames = 'weekView' | 'weekViewRoot' | 'weekViewHeader' | 'weekViewInner' | 'weekViewAllDaySlotsEvents' | 'weekViewAllDaySlots' | 'weekViewAllDaySlotsList' | 'weekViewAllDaySlotsLabel' | 'weekViewScrollArea' | 'weekViewCorner' | 'weekViewSlotLabels' | 'weekViewSlotLabel' | 'weekViewDayLabel' | 'weekViewDayWeekday' | 'weekViewDay' | 'weekViewDayNumber' | 'weekViewDaySlot' | 'weekViewDaySlots' | 'weekViewWeekLabel' | 'weekViewWeekNumber' | 'weekViewBackgroundEvent' | 'weekViewBackgroundEventResizeHandle';
10
10
  /**
11
11
  * `WeekView` forwards `classNames` and `styles` to the components it renders, so their
12
12
  * selectors are part of its Styles API.
13
13
  */
14
14
  export type WeekViewStylesNames = WeekViewOwnStylesNames | ScheduleEventStylesNames | CurrentTimeIndicatorStylesNames | CombinedScheduleHeaderStylesNames;
15
15
  export type WeekViewCssVariables = {
16
- weekView: '--week-view-radius' | '--week-view-slot-height' | '--week-view-all-day-slots-height';
16
+ weekView: '--week-view-radius' | '--week-view-slot-height' | '--week-view-all-day-slots-height' | '--event-raise-delay' | '--event-z-index' | '--event-z-index-raised';
17
17
  };
18
18
  /** Range covered by the label shown in the week header. */
19
19
  export interface WeekLabelPayload {
@@ -31,6 +31,10 @@ export interface WeekViewSlots extends EventSlots {
31
31
  }
32
32
  /** Props declared by `WeekView` itself. See `WeekViewProps` for the full public type. */
33
33
  export interface WeekViewOwnProps extends TimeViewOwnProps, StylesApiProps<WeekViewFactory> {
34
+ /** Determines how overlapping events are laid out. @default 'columns' */
35
+ eventOverlapMode?: ScheduleEventOverlapMode;
36
+ /** Time in ms before a hovered cascade event is raised above covering events. @default 600 */
37
+ eventOverlapRaiseDelay?: number;
34
38
  /**
35
39
  * Length of one time slot in minutes.
36
40
  * @default 60
@@ -1,4 +1,4 @@
1
- import { AnyDateValue, DateStringValue, DayOfWeek, ScheduleEventData, WeekPositionedEventData } from '../../../types';
1
+ import { AnyDateValue, DateStringValue, DayOfWeek, ScheduleEventData, ScheduleEventOverlapMode, WeekPositionedEventData } from '../../../types';
2
2
  export interface GetWeekPositionedEventsInput {
3
3
  /** Date (week start) at which events are positioned, used to check if events are all-day */
4
4
  date: AnyDateValue;
@@ -16,6 +16,8 @@ export interface GetWeekPositionedEventsInput {
16
16
  weekendDays?: DayOfWeek[];
17
17
  /** If set to false, weekend days are hidden @default true */
18
18
  withWeekendDays?: boolean;
19
+ /** Determines how overlapping events are laid out. @default 'columns' */
20
+ eventOverlapMode?: ScheduleEventOverlapMode;
19
21
  }
20
22
  /** Events grouped by week day date (YYYY-MM-DD 00:00:00) and by columns */
21
23
  export interface GroupedWeekEvents {
@@ -23,4 +25,4 @@ export interface GroupedWeekEvents {
23
25
  regularEvents: Record<DateStringValue, WeekPositionedEventData[]>;
24
26
  backgroundEvents: Record<DateStringValue, WeekPositionedEventData[]>;
25
27
  }
26
- export declare function getWeekPositionedEvents({ date, events, startTime, endTime, intervalMinutes, firstDayOfWeek, weekendDays, withWeekendDays, }: GetWeekPositionedEventsInput): GroupedWeekEvents;
28
+ export declare function getWeekPositionedEvents({ date, events, startTime, endTime, intervalMinutes, firstDayOfWeek, weekendDays, withWeekendDays, eventOverlapMode, }: GetWeekPositionedEventsInput): GroupedWeekEvents;
@@ -19,10 +19,13 @@ export interface UseEventResizeInput {
19
19
  resizeIntervalMinutes?: () => number | undefined;
20
20
  onEventResize: (data: EventDropData) => void;
21
21
  canResizeEvent: () => ((event: ScheduleEventData) => boolean) | undefined;
22
+ withBackgroundEvents?: () => boolean;
22
23
  }
23
24
  export declare function useEventResize(input: UseEventResizeInput): {
24
25
  handleResizeStart: ({ event, edge, container, originalTop, originalHeight, eventDate, pointerEvent, }: HandleResizeStartInput) => void;
25
- getResizePosition: (eventId: string | number) => {
26
+ isResizing: import("vue").ComputedRef<boolean>;
27
+ resizingEventId: import("vue").ComputedRef<string | number | null>;
28
+ getResizePosition: (eventId: string | number, eventDate?: string) => {
26
29
  top: number;
27
30
  height: number;
28
31
  } | null;
@@ -24,8 +24,10 @@ export declare function useHorizontalEventResize(input: {
24
24
  resizeIntervalMinutes?: () => number | undefined;
25
25
  onEventResize: (data: EventDropData) => void;
26
26
  canResizeEvent: () => ((event: ScheduleEventData) => boolean) | undefined;
27
+ withBackgroundEvents?: () => boolean;
27
28
  }): {
28
29
  state: import("vue").ShallowRef<ResizeState | null, ResizeState | null>;
30
+ readonly resizingEdge: ResizeEdge | null;
29
31
  handleResizeStart: (params: {
30
32
  event: ScheduleEventData;
31
33
  edge: ResizeEdge;
@@ -37,7 +39,7 @@ export declare function useHorizontalEventResize(input: {
37
39
  dayIndex?: number;
38
40
  dayCount?: number;
39
41
  }) => void;
40
- getResizePosition: (id: string | number) => {
42
+ getResizePosition: (id: string | number, eventDate?: string) => {
41
43
  left: number;
42
44
  width: number;
43
45
  } | null;
package/lib/types.d.ts CHANGED
@@ -97,6 +97,8 @@ interface ScheduleEventRuntimeMeta {
97
97
  }
98
98
  /** Event data object passed to all `@mantine/schedule` components */
99
99
  export type ScheduleEventData<Payload extends EventPayload = EventPayload> = (ScheduleSingleEventData<Payload> & ScheduleEventRuntimeMeta) | (ScheduleRecurringSeriesEventData<Payload> & ScheduleEventRuntimeMeta) | (ScheduleRecurringOverrideEventData<Payload> & ScheduleEventRuntimeMeta);
100
+ /** Controls how events that overlap in time are laid out along the horizontal axis. */
101
+ export type ScheduleEventOverlapMode = 'columns' | 'cascade';
100
102
  export interface DayEventPositionData {
101
103
  /** All day events */
102
104
  allDay: boolean;
@@ -0,0 +1,5 @@
1
+ import type { DayEventPositionData, ScheduleEventData } from '../../types';
2
+ export type CascadePositionedEvent = ScheduleEventData & {
3
+ position: Pick<DayEventPositionData, 'allDay' | 'column' | 'width' | 'offset' | 'overlaps'>;
4
+ };
5
+ export declare function applyCascadeLayout<T extends CascadePositionedEvent>(events: T[]): void;
@@ -0,0 +1,2 @@
1
+ import type { ScheduleEventData } from '../../types';
2
+ export declare function getOverlapClusters<T extends ScheduleEventData>(events: T[]): T[][];
@@ -34,6 +34,8 @@ export { calculateDropTime } from './calculate-drop-time/calculate-drop-time';
34
34
  export { calculateMonthDropDate } from './calculate-month-drop-date/calculate-month-drop-date';
35
35
  export { getBusinessHoursMod } from './get-business-hours-mod/get-business-hours-mod';
36
36
  export { expandRecurringEvents } from './expand-recurring-events/expand-recurring-events';
37
+ export { applyCascadeLayout } from './apply-cascade-layout/apply-cascade-layout';
38
+ export { getOverlapClusters } from './get-overlap-clusters/get-overlap-clusters';
37
39
  export type { DayTimeInterval } from './get-day-time-intervals/get-day-time-intervals';
38
40
  export type { ParsedTime } from './parse-time-string/parse-time-string';
39
41
  export type { CalculateDropTimeInput, CalculateDropTimeResult, } from './calculate-drop-time/calculate-drop-time';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantine-vue/schedule",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Vue schedule and calendar components equivalent to @mantine/schedule",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -44,9 +44,9 @@
44
44
  "vue": "^3.5.0"
45
45
  },
46
46
  "peerDependencies": {
47
- "@mantine-vue/core": "3.4.0",
48
- "@mantine-vue/dates": "3.4.0",
49
- "@mantine-vue/hooks": "3.4.0",
47
+ "@mantine-vue/core": "3.5.0",
48
+ "@mantine-vue/dates": "3.5.0",
49
+ "@mantine-vue/hooks": "3.5.0",
50
50
  "dayjs": ">=1.0.0",
51
51
  "vue": "^3.5.0"
52
52
  }