@super-calendar/native 2.9.0 → 2.10.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.
- package/README.md +7 -0
- package/dist/index.d.mts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +199 -25
- package/dist/index.mjs +200 -26
- package/package.json +2 -2
- package/src/components/Calendar.tsx +21 -0
- package/src/components/MultiDayMovePreview.tsx +169 -0
- package/src/components/TimeGrid.tsx +143 -23
package/README.md
CHANGED
|
@@ -63,6 +63,13 @@ export function MyCalendar() {
|
|
|
63
63
|
}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
## Moving events
|
|
67
|
+
|
|
68
|
+
Pass `onDragEvent` and update your event state with the returned `start` and `end`.
|
|
69
|
+
On the time grid, dragging any segment of a multi-day event previews the whole
|
|
70
|
+
range moving together and preserves its duration. Drag a resize grip to change
|
|
71
|
+
only the start or end. See the [dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
72
|
+
|
|
66
73
|
## Styling with Tailwind
|
|
67
74
|
|
|
68
75
|
Every styleable part is a named slot that accepts a class (resolved by a Tailwind runtime such as [uniwind](https://docs.uniwind.dev) or NativeWind) and/or a style override. A classed slot drops its built-in themed styles, so your classes own the look:
|
package/dist/index.d.mts
CHANGED
|
@@ -192,6 +192,18 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
192
192
|
isRTL?: boolean;
|
|
193
193
|
minHourHeight?: number;
|
|
194
194
|
maxHourHeight?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Minimum pixel height of a timed event box, so short events stay legible and
|
|
197
|
+
* tappable. Also the floor of the `boxHeight` handed to `renderEvent`. Default
|
|
198
|
+
* 32; pass 0 to size every box strictly by its duration.
|
|
199
|
+
*/
|
|
200
|
+
minEventHeight?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Inset in pixels between a timed event box and its slot (each side), so
|
|
203
|
+
* adjacent boxes and column edges get some breathing room. Default 2; pass 0
|
|
204
|
+
* to let events fill their slot.
|
|
205
|
+
*/
|
|
206
|
+
eventGap?: number;
|
|
195
207
|
showNowIndicator?: boolean;
|
|
196
208
|
locale?: Locale;
|
|
197
209
|
freeSwipe?: boolean;
|
|
@@ -241,7 +253,7 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
241
253
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
242
254
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
243
255
|
};
|
|
244
|
-
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
256
|
+
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, minEventHeight, eventGap, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
245
257
|
/**
|
|
246
258
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
247
259
|
* hour-by-hour grid with positioned event boxes, an all-day lane, pinch-to-zoom
|
|
@@ -274,6 +286,12 @@ type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
|
274
286
|
type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
275
287
|
events: CalendarEvent<T>[];
|
|
276
288
|
mode: CalendarMode;
|
|
289
|
+
/**
|
|
290
|
+
* The controlled anchor date, read in the device's local time zone. Construct
|
|
291
|
+
* it as a local date (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
292
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
293
|
+
* and anchors the previous week.
|
|
294
|
+
*/
|
|
277
295
|
date: Date;
|
|
278
296
|
onChangeDate: (date: Date) => void;
|
|
279
297
|
/** Fired alongside `onChangeDate` with the `[start, end]` of the newly-visible range. */
|
|
@@ -425,6 +443,17 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
425
443
|
hourHeight?: number;
|
|
426
444
|
minHourHeight?: number;
|
|
427
445
|
maxHourHeight?: number;
|
|
446
|
+
/**
|
|
447
|
+
* Minimum pixel height of a timed event box on the week/day grid, so short
|
|
448
|
+
* events stay legible and tappable. Also the floor of the `boxHeight` handed to
|
|
449
|
+
* `renderEvent`. Default 32; pass 0 to size every box strictly by its duration.
|
|
450
|
+
*/
|
|
451
|
+
minEventHeight?: number;
|
|
452
|
+
/**
|
|
453
|
+
* Inset in pixels between a timed event box and its slot on the week/day grid
|
|
454
|
+
* (each side). Default 2; pass 0 to let events fill their slot.
|
|
455
|
+
*/
|
|
456
|
+
eventGap?: number;
|
|
428
457
|
hourColumnWidth?: number;
|
|
429
458
|
/** Hide the left hour-axis column on the week/day grid. Default false. */
|
|
430
459
|
hideHours?: boolean;
|
|
@@ -542,7 +571,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
542
571
|
* }
|
|
543
572
|
* ```
|
|
544
573
|
*/
|
|
545
|
-
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
574
|
+
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
546
575
|
//#endregion
|
|
547
576
|
//#region src/components/DefaultEvent.d.ts
|
|
548
577
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -192,6 +192,18 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
192
192
|
isRTL?: boolean;
|
|
193
193
|
minHourHeight?: number;
|
|
194
194
|
maxHourHeight?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Minimum pixel height of a timed event box, so short events stay legible and
|
|
197
|
+
* tappable. Also the floor of the `boxHeight` handed to `renderEvent`. Default
|
|
198
|
+
* 32; pass 0 to size every box strictly by its duration.
|
|
199
|
+
*/
|
|
200
|
+
minEventHeight?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Inset in pixels between a timed event box and its slot (each side), so
|
|
203
|
+
* adjacent boxes and column edges get some breathing room. Default 2; pass 0
|
|
204
|
+
* to let events fill their slot.
|
|
205
|
+
*/
|
|
206
|
+
eventGap?: number;
|
|
195
207
|
showNowIndicator?: boolean;
|
|
196
208
|
locale?: Locale;
|
|
197
209
|
freeSwipe?: boolean;
|
|
@@ -241,7 +253,7 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
241
253
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
242
254
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
243
255
|
};
|
|
244
|
-
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
256
|
+
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, minEventHeight, eventGap, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
245
257
|
/**
|
|
246
258
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
247
259
|
* hour-by-hour grid with positioned event boxes, an all-day lane, pinch-to-zoom
|
|
@@ -274,6 +286,12 @@ type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
|
274
286
|
type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
275
287
|
events: CalendarEvent<T>[];
|
|
276
288
|
mode: CalendarMode;
|
|
289
|
+
/**
|
|
290
|
+
* The controlled anchor date, read in the device's local time zone. Construct
|
|
291
|
+
* it as a local date (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
292
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
293
|
+
* and anchors the previous week.
|
|
294
|
+
*/
|
|
277
295
|
date: Date;
|
|
278
296
|
onChangeDate: (date: Date) => void;
|
|
279
297
|
/** Fired alongside `onChangeDate` with the `[start, end]` of the newly-visible range. */
|
|
@@ -425,6 +443,17 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
425
443
|
hourHeight?: number;
|
|
426
444
|
minHourHeight?: number;
|
|
427
445
|
maxHourHeight?: number;
|
|
446
|
+
/**
|
|
447
|
+
* Minimum pixel height of a timed event box on the week/day grid, so short
|
|
448
|
+
* events stay legible and tappable. Also the floor of the `boxHeight` handed to
|
|
449
|
+
* `renderEvent`. Default 32; pass 0 to size every box strictly by its duration.
|
|
450
|
+
*/
|
|
451
|
+
minEventHeight?: number;
|
|
452
|
+
/**
|
|
453
|
+
* Inset in pixels between a timed event box and its slot on the week/day grid
|
|
454
|
+
* (each side). Default 2; pass 0 to let events fill their slot.
|
|
455
|
+
*/
|
|
456
|
+
eventGap?: number;
|
|
428
457
|
hourColumnWidth?: number;
|
|
429
458
|
/** Hide the left hour-axis column on the week/day grid. Default false. */
|
|
430
459
|
hideHours?: boolean;
|
|
@@ -542,7 +571,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
542
571
|
* }
|
|
543
572
|
* ```
|
|
544
573
|
*/
|
|
545
|
-
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
574
|
+
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
546
575
|
//#endregion
|
|
547
576
|
//#region src/components/DefaultEvent.d.ts
|
|
548
577
|
/**
|
package/dist/index.js
CHANGED
|
@@ -757,6 +757,92 @@ const styles$2 = react_native.StyleSheet.create({
|
|
|
757
757
|
chip: { minHeight: 18 }
|
|
758
758
|
});
|
|
759
759
|
//#endregion
|
|
760
|
+
//#region src/components/MultiDayMovePreview.tsx
|
|
761
|
+
const noop$1 = () => {};
|
|
762
|
+
function MultiDayMovePreview(props) {
|
|
763
|
+
const { move, days } = props;
|
|
764
|
+
const dayOffsets = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[move.dayIndex]) * 1440), [days, move]);
|
|
765
|
+
return days.map((day, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PreviewDay, {
|
|
766
|
+
...props,
|
|
767
|
+
dayOffsets,
|
|
768
|
+
index,
|
|
769
|
+
dayStart: (0, date_fns.startOfDay)(day).getTime(),
|
|
770
|
+
dayEnd: (0, date_fns.addDays)((0, date_fns.startOfDay)(day), 1).getTime()
|
|
771
|
+
}, day.toISOString()));
|
|
772
|
+
}
|
|
773
|
+
function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
|
|
774
|
+
const theme = require_MonthList.useCalendarTheme();
|
|
775
|
+
const slot = require_MonthList.useSlots();
|
|
776
|
+
const { offsetX, offsetY, lifted, dayIndex, event } = move;
|
|
777
|
+
const duration = event.end.getTime() - event.start.getTime();
|
|
778
|
+
const startTimestamp = event.start.getTime();
|
|
779
|
+
const segment = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
780
|
+
const columnDelta = dayWidth > 0 ? Math.round(offsetX.value / dayWidth) : 0;
|
|
781
|
+
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayOffsets.length - 1);
|
|
782
|
+
const minuteDelta = cellHeight.value > 0 ? offsetY.value / cellHeight.value * 60 : 0;
|
|
783
|
+
const start = (0, _super_calendar_core.shiftMinutes)(new Date(startTimestamp), dayOffsets[target] + minuteDelta).getTime();
|
|
784
|
+
const end = start + duration;
|
|
785
|
+
const visible = !lifted.value && start < dayEnd && end > dayStart;
|
|
786
|
+
return {
|
|
787
|
+
top: (Math.max(start, dayStart) - dayStart) / 36e5,
|
|
788
|
+
hours: visible ? Math.max((Math.min(end, dayEnd) - Math.max(start, dayStart)) / 36e5, .25) : 0,
|
|
789
|
+
continuesBefore: start < dayStart,
|
|
790
|
+
continuesAfter: end > dayEnd
|
|
791
|
+
};
|
|
792
|
+
}, [
|
|
793
|
+
dayWidth,
|
|
794
|
+
dayIndex,
|
|
795
|
+
dayOffsets,
|
|
796
|
+
startTimestamp,
|
|
797
|
+
duration,
|
|
798
|
+
dayStart,
|
|
799
|
+
dayEnd
|
|
800
|
+
]);
|
|
801
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => segment.value.hours > 0 ? Math.max(segment.value.hours * cellHeight.value, minEventHeight) : 0, [minEventHeight]);
|
|
802
|
+
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
803
|
+
top: (segment.value.top - minHour) * cellHeight.value,
|
|
804
|
+
height: boxHeight.value,
|
|
805
|
+
opacity: boxHeight.value > 0 ? 1 : 0
|
|
806
|
+
}), [minHour]);
|
|
807
|
+
const [continuation, setContinuation] = (0, react.useState)(() => ({
|
|
808
|
+
continuesBefore: segment.value.continuesBefore,
|
|
809
|
+
continuesAfter: segment.value.continuesAfter
|
|
810
|
+
}));
|
|
811
|
+
(0, react_native_reanimated.useAnimatedReaction)(() => ({
|
|
812
|
+
continuesBefore: segment.value.continuesBefore,
|
|
813
|
+
continuesAfter: segment.value.continuesAfter
|
|
814
|
+
}), (next, previous) => {
|
|
815
|
+
if (previous && (next.continuesBefore !== previous.continuesBefore || next.continuesAfter !== previous.continuesAfter)) (0, react_native_reanimated.runOnJS)(setContinuation)(next);
|
|
816
|
+
});
|
|
817
|
+
const eventSlot = slot("event", { themed: theme.containers.timeGridEvent });
|
|
818
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
819
|
+
...eventSlot,
|
|
820
|
+
testID: "multi-day-move-preview",
|
|
821
|
+
pointerEvents: "none",
|
|
822
|
+
accessibilityElementsHidden: true,
|
|
823
|
+
importantForAccessibility: "no-hide-descendants",
|
|
824
|
+
style: [
|
|
825
|
+
{
|
|
826
|
+
position: "absolute",
|
|
827
|
+
overflow: "hidden",
|
|
828
|
+
padding: eventGap,
|
|
829
|
+
left: hourColumnWidth + index * dayWidth,
|
|
830
|
+
width: dayWidth,
|
|
831
|
+
zIndex: 100
|
|
832
|
+
},
|
|
833
|
+
eventSlot.style,
|
|
834
|
+
style
|
|
835
|
+
],
|
|
836
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
837
|
+
event,
|
|
838
|
+
mode,
|
|
839
|
+
boxHeight,
|
|
840
|
+
...continuation,
|
|
841
|
+
onPress: noop$1
|
|
842
|
+
})
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
//#endregion
|
|
760
846
|
//#region src/components/TimeGrid.tsx
|
|
761
847
|
const isWeb$1 = react_native.Platform.OS === "web";
|
|
762
848
|
const MINUTES_PER_HOUR$1 = 60;
|
|
@@ -769,8 +855,8 @@ const DEFAULT_HOUR_HEIGHT = 48;
|
|
|
769
855
|
const DEFAULT_MIN_HOUR_HEIGHT = 32;
|
|
770
856
|
const DEFAULT_MAX_HOUR_HEIGHT = 160;
|
|
771
857
|
const DEFAULT_HOUR_COLUMN_WIDTH = 56;
|
|
772
|
-
const
|
|
773
|
-
const
|
|
858
|
+
const DEFAULT_MIN_EVENT_HEIGHT = 32;
|
|
859
|
+
const DEFAULT_EVENT_GAP = 2;
|
|
774
860
|
const DRAG_ACTIVATE_MS = 300;
|
|
775
861
|
const MOVE_ACTIVATE_MS$1 = 500;
|
|
776
862
|
const DRAG_ACTIVATE_PX$1 = 8;
|
|
@@ -787,7 +873,7 @@ const noop = () => {};
|
|
|
787
873
|
* while a drag is actually spilling (see `spillHeight`), so an idle grid pays
|
|
788
874
|
* nothing for it; its geometry is driven on the UI thread from there.
|
|
789
875
|
*/
|
|
790
|
-
function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, dayWidth, nextDayDirection, minHour, event, mode, renderEvent, slotProps }) {
|
|
876
|
+
function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, dayWidth, nextDayDirection, minHour, event, mode, renderEvent, eventGap, slotProps }) {
|
|
791
877
|
const RenderEventComponent = renderEvent;
|
|
792
878
|
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
793
879
|
height: spillHeight.value,
|
|
@@ -809,7 +895,8 @@ function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, day
|
|
|
809
895
|
{
|
|
810
896
|
left: dayLeftPx,
|
|
811
897
|
width: dayWidth,
|
|
812
|
-
top: 0
|
|
898
|
+
top: 0,
|
|
899
|
+
padding: eventGap
|
|
813
900
|
},
|
|
814
901
|
slotProps.style,
|
|
815
902
|
style
|
|
@@ -830,7 +917,7 @@ function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, day
|
|
|
830
917
|
* visibility are driven on the UI thread by the shared values so it tracks the
|
|
831
918
|
* finger without a React re-render.
|
|
832
919
|
*/
|
|
833
|
-
function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
920
|
+
function DragGhost({ x, y, w, h, visible, event, mode, renderEvent, eventGap }) {
|
|
834
921
|
const RenderEventComponent = renderEvent;
|
|
835
922
|
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
836
923
|
transform: [{ translateX: x.value }, { translateY: y.value }],
|
|
@@ -842,6 +929,7 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
842
929
|
style: [
|
|
843
930
|
styles$1.eventBox,
|
|
844
931
|
styles$1.dragGhost,
|
|
932
|
+
{ padding: eventGap },
|
|
845
933
|
style
|
|
846
934
|
],
|
|
847
935
|
pointerEvents: "none",
|
|
@@ -854,7 +942,7 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
854
942
|
});
|
|
855
943
|
}
|
|
856
944
|
const HOUR_LABEL_TOP_INSET = 12;
|
|
857
|
-
function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
945
|
+
function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, minEventHeight, eventGap, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
858
946
|
const RenderEventComponent = renderEvent;
|
|
859
947
|
const theme = require_MonthList.useCalendarTheme();
|
|
860
948
|
const slot = require_MonthList.useSlots();
|
|
@@ -885,16 +973,22 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
885
973
|
const startHours = positioned.startHours;
|
|
886
974
|
const durationHours = positioned.durationHours;
|
|
887
975
|
const ownsStart = !positioned.continuesBefore;
|
|
976
|
+
const multiDay = positioned.continuesBefore || positioned.continuesAfter;
|
|
977
|
+
const hiddenForMove = positioned.event === movingEvent;
|
|
888
978
|
const dragStartSV = (0, react_native_reanimated.useDerivedValue)(() => ({
|
|
889
979
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
890
980
|
ownsStart
|
|
891
981
|
}), [startHours, ownsStart]);
|
|
892
|
-
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => Math.max(durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value,
|
|
982
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => Math.max(durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value, minEventHeight), [durationHours, minEventHeight]);
|
|
893
983
|
const visibleBoxHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
894
984
|
const top = (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
895
985
|
const dayEnd = (HOURS_PER_DAY - minHour) * cellHeight.value;
|
|
896
|
-
return Math.max(Math.min(boxHeight.value, dayEnd - top),
|
|
897
|
-
}, [
|
|
986
|
+
return Math.max(Math.min(boxHeight.value, dayEnd - top), minEventHeight);
|
|
987
|
+
}, [
|
|
988
|
+
startHours,
|
|
989
|
+
minHour,
|
|
990
|
+
minEventHeight
|
|
991
|
+
]);
|
|
898
992
|
const boxStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
899
993
|
return {
|
|
900
994
|
top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
@@ -904,7 +998,7 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
904
998
|
};
|
|
905
999
|
}, [startHours, minHour]);
|
|
906
1000
|
const spillHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
907
|
-
if (!moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
1001
|
+
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
908
1002
|
const overflowHours = startHours + moveOffset.value / cellHeight.value + durationHours - HOURS_PER_DAY;
|
|
909
1003
|
if (overflowHours <= 0) return 0;
|
|
910
1004
|
const columnDelta = dayWidth > 0 ? Math.round(moveOffsetX.value / dayWidth) : 0;
|
|
@@ -921,7 +1015,8 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
921
1015
|
dayIndex,
|
|
922
1016
|
dayCount,
|
|
923
1017
|
dayOrdinals,
|
|
924
|
-
nextDayDirection
|
|
1018
|
+
nextDayDirection,
|
|
1019
|
+
multiDay
|
|
925
1020
|
]);
|
|
926
1021
|
const [previewMounted, setPreviewMounted] = (0, react.useState)(false);
|
|
927
1022
|
(0, react_native_reanimated.useAnimatedReaction)(() => spillHeight.value > 0, (spilling, previous) => {
|
|
@@ -942,11 +1037,13 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
942
1037
|
]);
|
|
943
1038
|
const latest = (0, react.useRef)({
|
|
944
1039
|
event: positioned.event,
|
|
1040
|
+
eventIndex,
|
|
945
1041
|
onDragEvent,
|
|
946
1042
|
onDragStart
|
|
947
1043
|
});
|
|
948
1044
|
latest.current = {
|
|
949
1045
|
event: positioned.event,
|
|
1046
|
+
eventIndex,
|
|
950
1047
|
onDragEvent,
|
|
951
1048
|
onDragStart
|
|
952
1049
|
};
|
|
@@ -969,11 +1066,41 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
969
1066
|
snapBack();
|
|
970
1067
|
return;
|
|
971
1068
|
}
|
|
972
|
-
if (handler(event, next.start, next.end) === false)
|
|
973
|
-
|
|
1069
|
+
if (handler(event, next.start, next.end) === false) {
|
|
1070
|
+
snapBack();
|
|
1071
|
+
onMovePreview(null);
|
|
1072
|
+
} else if (multiDay && deltaStartMin === deltaEndMin) onMovePreview((move) => move ? {
|
|
1073
|
+
...move,
|
|
1074
|
+
phase: "dropped"
|
|
1075
|
+
} : null);
|
|
1076
|
+
}, [
|
|
1077
|
+
snapMinutes,
|
|
1078
|
+
snapBack,
|
|
1079
|
+
multiDay,
|
|
1080
|
+
onMovePreview
|
|
1081
|
+
]);
|
|
974
1082
|
const notifyDragStart = (0, react.useCallback)(() => {
|
|
975
1083
|
latest.current.onDragStart?.(latest.current.event);
|
|
976
1084
|
}, []);
|
|
1085
|
+
const beginMovePreview = (0, react.useCallback)(() => {
|
|
1086
|
+
if (multiDay) onMovePreview({
|
|
1087
|
+
event: latest.current.event,
|
|
1088
|
+
eventIndex: latest.current.eventIndex,
|
|
1089
|
+
phase: "dragging",
|
|
1090
|
+
dayIndex,
|
|
1091
|
+
offsetX: moveOffsetX,
|
|
1092
|
+
offsetY: moveOffset,
|
|
1093
|
+
lifted
|
|
1094
|
+
});
|
|
1095
|
+
}, [
|
|
1096
|
+
multiDay,
|
|
1097
|
+
onMovePreview,
|
|
1098
|
+
dayIndex,
|
|
1099
|
+
moveOffsetX,
|
|
1100
|
+
moveOffset,
|
|
1101
|
+
lifted
|
|
1102
|
+
]);
|
|
1103
|
+
const endMovePreview = (0, react.useCallback)(() => onMovePreview(null), [onMovePreview]);
|
|
977
1104
|
const dwellTimer = (0, react.useRef)(null);
|
|
978
1105
|
const disarmEdge = (0, react.useCallback)(() => {
|
|
979
1106
|
if (dwellTimer.current) {
|
|
@@ -1024,6 +1151,7 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1024
1151
|
grabY.value = event.y;
|
|
1025
1152
|
liveAbsX.value = event.absoluteX;
|
|
1026
1153
|
liveAbsY.value = event.absoluteY;
|
|
1154
|
+
(0, react_native_reanimated.runOnJS)(beginMovePreview)();
|
|
1027
1155
|
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
1028
1156
|
}).onUpdate((event) => {
|
|
1029
1157
|
liveAbsX.value = event.absoluteX;
|
|
@@ -1058,21 +1186,28 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1058
1186
|
if (minuteDelta === 0 && dayDelta === 0) {
|
|
1059
1187
|
moveOffset.value = 0;
|
|
1060
1188
|
moveOffsetX.value = 0;
|
|
1189
|
+
(0, react_native_reanimated.runOnJS)(endMovePreview)();
|
|
1061
1190
|
return;
|
|
1062
1191
|
}
|
|
1063
1192
|
moveOffset.value = minuteDelta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
1064
1193
|
moveOffsetX.value = dayDelta * dayWidth;
|
|
1065
1194
|
const totalDelta = minuteDelta + (dayOrdinals[targetDay] - dayOrdinals[dayIndex]) * MINUTES_PER_DAY;
|
|
1066
1195
|
(0, react_native_reanimated.runOnJS)(commitDrag)(totalDelta, totalDelta);
|
|
1067
|
-
}).onFinalize(() => {
|
|
1196
|
+
}).onFinalize((_event, success) => {
|
|
1068
1197
|
dragZ.value = 0;
|
|
1069
1198
|
if (lifted.value && ghostXSV && ghostYSV && commitLiftedDrop) {
|
|
1070
1199
|
(0, react_native_reanimated.runOnJS)(commitLiftedDrop)(ghostXSV.value, ghostYSV.value);
|
|
1071
1200
|
moveOffset.value = 0;
|
|
1072
1201
|
moveOffsetX.value = 0;
|
|
1073
1202
|
lifted.value = 0;
|
|
1203
|
+
(0, react_native_reanimated.runOnJS)(endMovePreview)();
|
|
1074
1204
|
}
|
|
1075
1205
|
moving.value = 0;
|
|
1206
|
+
if (multiDay && !success) {
|
|
1207
|
+
moveOffset.value = 0;
|
|
1208
|
+
moveOffsetX.value = 0;
|
|
1209
|
+
(0, react_native_reanimated.runOnJS)(endMovePreview)();
|
|
1210
|
+
}
|
|
1076
1211
|
(0, react_native_reanimated.runOnJS)(releaseEdge)();
|
|
1077
1212
|
});
|
|
1078
1213
|
return isWeb$1 ? pan.activeOffsetX([-8, DRAG_ACTIVATE_PX$1]).activeOffsetY([-8, DRAG_ACTIVATE_PX$1]) : pan.activateAfterLongPress(MOVE_ACTIVATE_MS$1);
|
|
@@ -1104,6 +1239,9 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1104
1239
|
dayCount,
|
|
1105
1240
|
dayOrdinals,
|
|
1106
1241
|
commitDrag,
|
|
1242
|
+
multiDay,
|
|
1243
|
+
beginMovePreview,
|
|
1244
|
+
endMovePreview,
|
|
1107
1245
|
notifyDragStart,
|
|
1108
1246
|
onEdgeAdvance,
|
|
1109
1247
|
armEdge,
|
|
@@ -1211,13 +1349,18 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1211
1349
|
const eventSlot = slot("event", {
|
|
1212
1350
|
base: [styles$1.eventBox, {
|
|
1213
1351
|
left,
|
|
1214
|
-
width
|
|
1352
|
+
width,
|
|
1353
|
+
padding: eventGap
|
|
1215
1354
|
}],
|
|
1216
1355
|
themed: theme.containers.timeGridEvent
|
|
1217
1356
|
});
|
|
1218
1357
|
const box = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
1219
1358
|
...eventSlot,
|
|
1220
|
-
style: [
|
|
1359
|
+
style: [
|
|
1360
|
+
eventSlot.style,
|
|
1361
|
+
boxStyle,
|
|
1362
|
+
hiddenForMove ? { opacity: 0 } : null
|
|
1363
|
+
],
|
|
1221
1364
|
children: [
|
|
1222
1365
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
1223
1366
|
event: positioned.event,
|
|
@@ -1261,6 +1404,7 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1261
1404
|
event: positioned.event,
|
|
1262
1405
|
mode,
|
|
1263
1406
|
renderEvent,
|
|
1407
|
+
eventGap,
|
|
1264
1408
|
slotProps: slot("event", { themed: theme.containers.timeGridEvent })
|
|
1265
1409
|
}) : null] });
|
|
1266
1410
|
}
|
|
@@ -1361,7 +1505,7 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
1361
1505
|
children
|
|
1362
1506
|
});
|
|
1363
1507
|
};
|
|
1364
|
-
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, hourHeight, committedCellHeight, scrollY, isActive, initialScrollY, onSettleOffset, weekStartsOn, weekEndsOn, width, hourColumnWidth, minHour, maxHour, ampm, timeslots, isRTL, showAllDayEventCell, highlightWeekends, showVerticalScrollIndicator, verticalScrollEnabled, hourComponent, calendarCellStyle, minHourHeight, maxHourHeight, showNowIndicator, businessHours, renderBusinessHours, renderEvent, keyExtractor, snapMinutes, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, onGridTop }) {
|
|
1508
|
+
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, hourHeight, committedCellHeight, scrollY, isActive, initialScrollY, onSettleOffset, weekStartsOn, weekEndsOn, width, hourColumnWidth, minHour, maxHour, ampm, timeslots, isRTL, showAllDayEventCell, highlightWeekends, showVerticalScrollIndicator, verticalScrollEnabled, hourComponent, calendarCellStyle, minHourHeight, maxHourHeight, showNowIndicator, businessHours, renderBusinessHours, renderEvent, keyExtractor, snapMinutes, minEventHeight, eventGap, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, onGridTop }) {
|
|
1365
1509
|
const theme = require_MonthList.useCalendarTheme();
|
|
1366
1510
|
const slot = require_MonthList.useSlots();
|
|
1367
1511
|
const scrollRef = (0, react_native_reanimated.useAnimatedRef)();
|
|
@@ -1419,6 +1563,11 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1419
1563
|
const dayLeft = (dayIndex) => hourColumnWidth + dayIndex * dayWidth;
|
|
1420
1564
|
const dayOrdinals = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[0])), [days]);
|
|
1421
1565
|
const dayLayouts = (0, react.useMemo)(() => days.map((day) => (0, _super_calendar_core.layoutDayEvents)(events, day)), [days, events]);
|
|
1566
|
+
const [multiDayMove, setMultiDayMove] = (0, react.useState)(null);
|
|
1567
|
+
const movingEvent = multiDayMove ? events.find((event, index) => keyExtractor(event, index) === keyExtractor(multiDayMove.event, multiDayMove.eventIndex)) ?? null : null;
|
|
1568
|
+
(0, react.useEffect)(() => {
|
|
1569
|
+
if (multiDayMove?.phase === "dropped" && (!movingEvent || movingEvent.start.getTime() !== multiDayMove.event.start.getTime() || movingEvent.end.getTime() !== multiDayMove.event.end.getTime())) setMultiDayMove(null);
|
|
1570
|
+
}, [multiDayMove, movingEvent]);
|
|
1422
1571
|
const cellDateFromTouch = (event) => {
|
|
1423
1572
|
const { locationX, locationY } = event.nativeEvent;
|
|
1424
1573
|
const dayIndex = days.length === 1 ? 0 : Math.floor(locationX / dayWidth);
|
|
@@ -1587,7 +1736,10 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1587
1736
|
opacity: createActive.value
|
|
1588
1737
|
}));
|
|
1589
1738
|
const ghostSlot = slot("createGhost", {
|
|
1590
|
-
base: [styles$1.createGhost, {
|
|
1739
|
+
base: [styles$1.createGhost, {
|
|
1740
|
+
marginHorizontal: eventGap,
|
|
1741
|
+
pointerEvents: "none"
|
|
1742
|
+
}],
|
|
1591
1743
|
themed: {
|
|
1592
1744
|
backgroundColor: theme.colors.eventBackground,
|
|
1593
1745
|
borderColor: theme.colors.todayBackground
|
|
@@ -1732,6 +1884,9 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1732
1884
|
const columnWidth = dayWidth / positioned.columns;
|
|
1733
1885
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedEventBox, {
|
|
1734
1886
|
positioned,
|
|
1887
|
+
eventIndex: events.indexOf(positioned.event),
|
|
1888
|
+
movingEvent,
|
|
1889
|
+
onMovePreview: setMultiDayMove,
|
|
1735
1890
|
cellHeight: heightSource,
|
|
1736
1891
|
minHour,
|
|
1737
1892
|
maxHour,
|
|
@@ -1747,6 +1902,8 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1747
1902
|
daysPerPage,
|
|
1748
1903
|
renderEvent,
|
|
1749
1904
|
snapMinutes,
|
|
1905
|
+
minEventHeight,
|
|
1906
|
+
eventGap,
|
|
1750
1907
|
showDragHandle,
|
|
1751
1908
|
eventStartEditable,
|
|
1752
1909
|
eventDurationEditable,
|
|
@@ -1757,6 +1914,18 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1757
1914
|
onEdgeAdvance
|
|
1758
1915
|
}, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
|
|
1759
1916
|
})),
|
|
1917
|
+
multiDayMove ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MultiDayMovePreview, {
|
|
1918
|
+
move: multiDayMove,
|
|
1919
|
+
days,
|
|
1920
|
+
cellHeight: heightSource,
|
|
1921
|
+
dayWidth,
|
|
1922
|
+
hourColumnWidth,
|
|
1923
|
+
minHour,
|
|
1924
|
+
mode,
|
|
1925
|
+
renderEvent,
|
|
1926
|
+
minEventHeight,
|
|
1927
|
+
eventGap
|
|
1928
|
+
}) : null,
|
|
1760
1929
|
showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NowIndicator, {
|
|
1761
1930
|
cellHeight: heightSource,
|
|
1762
1931
|
nowHours,
|
|
@@ -1776,7 +1945,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1776
1945
|
});
|
|
1777
1946
|
}
|
|
1778
1947
|
const TimetablePage = (0, react.memo)(TimetablePageInner);
|
|
1779
|
-
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
1948
|
+
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
1780
1949
|
const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
|
|
1781
1950
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
1782
1951
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
@@ -2086,6 +2255,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2086
2255
|
renderEvent: labeledRenderEvent,
|
|
2087
2256
|
keyExtractor,
|
|
2088
2257
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
2258
|
+
minEventHeight,
|
|
2259
|
+
eventGap,
|
|
2089
2260
|
showDragHandle,
|
|
2090
2261
|
eventStartEditable,
|
|
2091
2262
|
eventDurationEditable,
|
|
@@ -2134,6 +2305,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2134
2305
|
labeledRenderEvent,
|
|
2135
2306
|
keyExtractor,
|
|
2136
2307
|
dragStepMinutes,
|
|
2308
|
+
minEventHeight,
|
|
2309
|
+
eventGap,
|
|
2137
2310
|
showDragHandle,
|
|
2138
2311
|
eventStartEditable,
|
|
2139
2312
|
eventDurationEditable,
|
|
@@ -2215,7 +2388,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2215
2388
|
visible: ghostVisible,
|
|
2216
2389
|
event: liftedEvent,
|
|
2217
2390
|
mode,
|
|
2218
|
-
renderEvent: labeledRenderEvent
|
|
2391
|
+
renderEvent: labeledRenderEvent,
|
|
2392
|
+
eventGap
|
|
2219
2393
|
}) : null]
|
|
2220
2394
|
})
|
|
2221
2395
|
]
|
|
@@ -2348,8 +2522,7 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2348
2522
|
createGhost: {
|
|
2349
2523
|
position: "absolute",
|
|
2350
2524
|
borderRadius: 6,
|
|
2351
|
-
borderWidth: react_native.StyleSheet.hairlineWidth
|
|
2352
|
-
marginHorizontal: EVENT_GAP
|
|
2525
|
+
borderWidth: react_native.StyleSheet.hairlineWidth
|
|
2353
2526
|
},
|
|
2354
2527
|
weekendColumn: {
|
|
2355
2528
|
position: "absolute",
|
|
@@ -2409,8 +2582,7 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2409
2582
|
},
|
|
2410
2583
|
eventBox: {
|
|
2411
2584
|
position: "absolute",
|
|
2412
|
-
overflow: "hidden"
|
|
2413
|
-
padding: EVENT_GAP
|
|
2585
|
+
overflow: "hidden"
|
|
2414
2586
|
},
|
|
2415
2587
|
dragGhost: {
|
|
2416
2588
|
top: 0,
|
|
@@ -2467,7 +2639,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
2467
2639
|
* }
|
|
2468
2640
|
* ```
|
|
2469
2641
|
*/
|
|
2470
|
-
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2642
|
+
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2471
2643
|
const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
|
|
2472
2644
|
const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
2473
2645
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -2652,6 +2824,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2652
2824
|
ampm,
|
|
2653
2825
|
minHourHeight,
|
|
2654
2826
|
maxHourHeight,
|
|
2827
|
+
minEventHeight,
|
|
2828
|
+
eventGap,
|
|
2655
2829
|
showNowIndicator,
|
|
2656
2830
|
locale,
|
|
2657
2831
|
activeDate,
|