@super-calendar/native 2.9.0 → 2.9.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.
- package/README.md +7 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +162 -7
- package/dist/index.mjs +163 -8
- package/package.json +2 -2
- package/src/components/Calendar.tsx +6 -0
- package/src/components/MultiDayMovePreview.tsx +164 -0
- package/src/components/TimeGrid.tsx +86 -7
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
|
@@ -274,6 +274,12 @@ type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
|
274
274
|
type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
275
275
|
events: CalendarEvent<T>[];
|
|
276
276
|
mode: CalendarMode;
|
|
277
|
+
/**
|
|
278
|
+
* The controlled anchor date, read in the device's local time zone. Construct
|
|
279
|
+
* it as a local date (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
280
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
281
|
+
* and anchors the previous week.
|
|
282
|
+
*/
|
|
277
283
|
date: Date;
|
|
278
284
|
onChangeDate: (date: Date) => void;
|
|
279
285
|
/** Fired alongside `onChangeDate` with the `[start, end]` of the newly-visible range. */
|
package/dist/index.d.ts
CHANGED
|
@@ -274,6 +274,12 @@ type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewSlot;
|
|
|
274
274
|
type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
275
275
|
events: CalendarEvent<T>[];
|
|
276
276
|
mode: CalendarMode;
|
|
277
|
+
/**
|
|
278
|
+
* The controlled anchor date, read in the device's local time zone. Construct
|
|
279
|
+
* it as a local date (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
280
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
281
|
+
* and anchors the previous week.
|
|
282
|
+
*/
|
|
277
283
|
date: Date;
|
|
278
284
|
onChangeDate: (date: Date) => void;
|
|
279
285
|
/** Fired alongside `onChangeDate` with the `[start, end]` of the newly-visible range. */
|
package/dist/index.js
CHANGED
|
@@ -757,6 +757,93 @@ 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
|
+
const MIN_EVENT_HEIGHT$1 = 32;
|
|
763
|
+
function MultiDayMovePreview(props) {
|
|
764
|
+
const { move, days } = props;
|
|
765
|
+
const dayOffsets = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[move.dayIndex]) * 1440), [days, move]);
|
|
766
|
+
return days.map((day, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PreviewDay, {
|
|
767
|
+
...props,
|
|
768
|
+
dayOffsets,
|
|
769
|
+
index,
|
|
770
|
+
dayStart: (0, date_fns.startOfDay)(day).getTime(),
|
|
771
|
+
dayEnd: (0, date_fns.addDays)((0, date_fns.startOfDay)(day), 1).getTime()
|
|
772
|
+
}, day.toISOString()));
|
|
773
|
+
}
|
|
774
|
+
function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode, renderEvent: RenderEventComponent, dayOffsets, index, dayStart, dayEnd }) {
|
|
775
|
+
const theme = require_MonthList.useCalendarTheme();
|
|
776
|
+
const slot = require_MonthList.useSlots();
|
|
777
|
+
const { offsetX, offsetY, lifted, dayIndex, event } = move;
|
|
778
|
+
const duration = event.end.getTime() - event.start.getTime();
|
|
779
|
+
const startTimestamp = event.start.getTime();
|
|
780
|
+
const segment = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
781
|
+
const columnDelta = dayWidth > 0 ? Math.round(offsetX.value / dayWidth) : 0;
|
|
782
|
+
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayOffsets.length - 1);
|
|
783
|
+
const minuteDelta = cellHeight.value > 0 ? offsetY.value / cellHeight.value * 60 : 0;
|
|
784
|
+
const start = (0, _super_calendar_core.shiftMinutes)(new Date(startTimestamp), dayOffsets[target] + minuteDelta).getTime();
|
|
785
|
+
const end = start + duration;
|
|
786
|
+
const visible = !lifted.value && start < dayEnd && end > dayStart;
|
|
787
|
+
return {
|
|
788
|
+
top: (Math.max(start, dayStart) - dayStart) / 36e5,
|
|
789
|
+
hours: visible ? Math.max((Math.min(end, dayEnd) - Math.max(start, dayStart)) / 36e5, .25) : 0,
|
|
790
|
+
continuesBefore: start < dayStart,
|
|
791
|
+
continuesAfter: end > dayEnd
|
|
792
|
+
};
|
|
793
|
+
}, [
|
|
794
|
+
dayWidth,
|
|
795
|
+
dayIndex,
|
|
796
|
+
dayOffsets,
|
|
797
|
+
startTimestamp,
|
|
798
|
+
duration,
|
|
799
|
+
dayStart,
|
|
800
|
+
dayEnd
|
|
801
|
+
]);
|
|
802
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => segment.value.hours > 0 ? Math.max(segment.value.hours * cellHeight.value, MIN_EVENT_HEIGHT$1) : 0);
|
|
803
|
+
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
804
|
+
top: (segment.value.top - minHour) * cellHeight.value,
|
|
805
|
+
height: boxHeight.value,
|
|
806
|
+
opacity: boxHeight.value > 0 ? 1 : 0
|
|
807
|
+
}), [minHour]);
|
|
808
|
+
const [continuation, setContinuation] = (0, react.useState)(() => ({
|
|
809
|
+
continuesBefore: segment.value.continuesBefore,
|
|
810
|
+
continuesAfter: segment.value.continuesAfter
|
|
811
|
+
}));
|
|
812
|
+
(0, react_native_reanimated.useAnimatedReaction)(() => ({
|
|
813
|
+
continuesBefore: segment.value.continuesBefore,
|
|
814
|
+
continuesAfter: segment.value.continuesAfter
|
|
815
|
+
}), (next, previous) => {
|
|
816
|
+
if (previous && (next.continuesBefore !== previous.continuesBefore || next.continuesAfter !== previous.continuesAfter)) (0, react_native_reanimated.runOnJS)(setContinuation)(next);
|
|
817
|
+
});
|
|
818
|
+
const eventSlot = slot("event", { themed: theme.containers.timeGridEvent });
|
|
819
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
820
|
+
...eventSlot,
|
|
821
|
+
testID: "multi-day-move-preview",
|
|
822
|
+
pointerEvents: "none",
|
|
823
|
+
accessibilityElementsHidden: true,
|
|
824
|
+
importantForAccessibility: "no-hide-descendants",
|
|
825
|
+
style: [
|
|
826
|
+
{
|
|
827
|
+
position: "absolute",
|
|
828
|
+
overflow: "hidden",
|
|
829
|
+
padding: 2,
|
|
830
|
+
left: hourColumnWidth + index * dayWidth,
|
|
831
|
+
width: dayWidth,
|
|
832
|
+
zIndex: 100
|
|
833
|
+
},
|
|
834
|
+
eventSlot.style,
|
|
835
|
+
style
|
|
836
|
+
],
|
|
837
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
838
|
+
event,
|
|
839
|
+
mode,
|
|
840
|
+
boxHeight,
|
|
841
|
+
...continuation,
|
|
842
|
+
onPress: noop$1
|
|
843
|
+
})
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
//#endregion
|
|
760
847
|
//#region src/components/TimeGrid.tsx
|
|
761
848
|
const isWeb$1 = react_native.Platform.OS === "web";
|
|
762
849
|
const MINUTES_PER_HOUR$1 = 60;
|
|
@@ -854,7 +941,7 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
854
941
|
});
|
|
855
942
|
}
|
|
856
943
|
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 }) {
|
|
944
|
+
function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
858
945
|
const RenderEventComponent = renderEvent;
|
|
859
946
|
const theme = require_MonthList.useCalendarTheme();
|
|
860
947
|
const slot = require_MonthList.useSlots();
|
|
@@ -885,6 +972,8 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
885
972
|
const startHours = positioned.startHours;
|
|
886
973
|
const durationHours = positioned.durationHours;
|
|
887
974
|
const ownsStart = !positioned.continuesBefore;
|
|
975
|
+
const multiDay = positioned.continuesBefore || positioned.continuesAfter;
|
|
976
|
+
const hiddenForMove = positioned.event === movingEvent;
|
|
888
977
|
const dragStartSV = (0, react_native_reanimated.useDerivedValue)(() => ({
|
|
889
978
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
890
979
|
ownsStart
|
|
@@ -904,7 +993,7 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
904
993
|
};
|
|
905
994
|
}, [startHours, minHour]);
|
|
906
995
|
const spillHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
907
|
-
if (!moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
996
|
+
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
908
997
|
const overflowHours = startHours + moveOffset.value / cellHeight.value + durationHours - HOURS_PER_DAY;
|
|
909
998
|
if (overflowHours <= 0) return 0;
|
|
910
999
|
const columnDelta = dayWidth > 0 ? Math.round(moveOffsetX.value / dayWidth) : 0;
|
|
@@ -921,7 +1010,8 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
921
1010
|
dayIndex,
|
|
922
1011
|
dayCount,
|
|
923
1012
|
dayOrdinals,
|
|
924
|
-
nextDayDirection
|
|
1013
|
+
nextDayDirection,
|
|
1014
|
+
multiDay
|
|
925
1015
|
]);
|
|
926
1016
|
const [previewMounted, setPreviewMounted] = (0, react.useState)(false);
|
|
927
1017
|
(0, react_native_reanimated.useAnimatedReaction)(() => spillHeight.value > 0, (spilling, previous) => {
|
|
@@ -942,11 +1032,13 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
942
1032
|
]);
|
|
943
1033
|
const latest = (0, react.useRef)({
|
|
944
1034
|
event: positioned.event,
|
|
1035
|
+
eventIndex,
|
|
945
1036
|
onDragEvent,
|
|
946
1037
|
onDragStart
|
|
947
1038
|
});
|
|
948
1039
|
latest.current = {
|
|
949
1040
|
event: positioned.event,
|
|
1041
|
+
eventIndex,
|
|
950
1042
|
onDragEvent,
|
|
951
1043
|
onDragStart
|
|
952
1044
|
};
|
|
@@ -969,11 +1061,41 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
969
1061
|
snapBack();
|
|
970
1062
|
return;
|
|
971
1063
|
}
|
|
972
|
-
if (handler(event, next.start, next.end) === false)
|
|
973
|
-
|
|
1064
|
+
if (handler(event, next.start, next.end) === false) {
|
|
1065
|
+
snapBack();
|
|
1066
|
+
onMovePreview(null);
|
|
1067
|
+
} else if (multiDay && deltaStartMin === deltaEndMin) onMovePreview((move) => move ? {
|
|
1068
|
+
...move,
|
|
1069
|
+
phase: "dropped"
|
|
1070
|
+
} : null);
|
|
1071
|
+
}, [
|
|
1072
|
+
snapMinutes,
|
|
1073
|
+
snapBack,
|
|
1074
|
+
multiDay,
|
|
1075
|
+
onMovePreview
|
|
1076
|
+
]);
|
|
974
1077
|
const notifyDragStart = (0, react.useCallback)(() => {
|
|
975
1078
|
latest.current.onDragStart?.(latest.current.event);
|
|
976
1079
|
}, []);
|
|
1080
|
+
const beginMovePreview = (0, react.useCallback)(() => {
|
|
1081
|
+
if (multiDay) onMovePreview({
|
|
1082
|
+
event: latest.current.event,
|
|
1083
|
+
eventIndex: latest.current.eventIndex,
|
|
1084
|
+
phase: "dragging",
|
|
1085
|
+
dayIndex,
|
|
1086
|
+
offsetX: moveOffsetX,
|
|
1087
|
+
offsetY: moveOffset,
|
|
1088
|
+
lifted
|
|
1089
|
+
});
|
|
1090
|
+
}, [
|
|
1091
|
+
multiDay,
|
|
1092
|
+
onMovePreview,
|
|
1093
|
+
dayIndex,
|
|
1094
|
+
moveOffsetX,
|
|
1095
|
+
moveOffset,
|
|
1096
|
+
lifted
|
|
1097
|
+
]);
|
|
1098
|
+
const endMovePreview = (0, react.useCallback)(() => onMovePreview(null), [onMovePreview]);
|
|
977
1099
|
const dwellTimer = (0, react.useRef)(null);
|
|
978
1100
|
const disarmEdge = (0, react.useCallback)(() => {
|
|
979
1101
|
if (dwellTimer.current) {
|
|
@@ -1024,6 +1146,7 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1024
1146
|
grabY.value = event.y;
|
|
1025
1147
|
liveAbsX.value = event.absoluteX;
|
|
1026
1148
|
liveAbsY.value = event.absoluteY;
|
|
1149
|
+
(0, react_native_reanimated.runOnJS)(beginMovePreview)();
|
|
1027
1150
|
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
1028
1151
|
}).onUpdate((event) => {
|
|
1029
1152
|
liveAbsX.value = event.absoluteX;
|
|
@@ -1058,21 +1181,28 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1058
1181
|
if (minuteDelta === 0 && dayDelta === 0) {
|
|
1059
1182
|
moveOffset.value = 0;
|
|
1060
1183
|
moveOffsetX.value = 0;
|
|
1184
|
+
(0, react_native_reanimated.runOnJS)(endMovePreview)();
|
|
1061
1185
|
return;
|
|
1062
1186
|
}
|
|
1063
1187
|
moveOffset.value = minuteDelta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
1064
1188
|
moveOffsetX.value = dayDelta * dayWidth;
|
|
1065
1189
|
const totalDelta = minuteDelta + (dayOrdinals[targetDay] - dayOrdinals[dayIndex]) * MINUTES_PER_DAY;
|
|
1066
1190
|
(0, react_native_reanimated.runOnJS)(commitDrag)(totalDelta, totalDelta);
|
|
1067
|
-
}).onFinalize(() => {
|
|
1191
|
+
}).onFinalize((_event, success) => {
|
|
1068
1192
|
dragZ.value = 0;
|
|
1069
1193
|
if (lifted.value && ghostXSV && ghostYSV && commitLiftedDrop) {
|
|
1070
1194
|
(0, react_native_reanimated.runOnJS)(commitLiftedDrop)(ghostXSV.value, ghostYSV.value);
|
|
1071
1195
|
moveOffset.value = 0;
|
|
1072
1196
|
moveOffsetX.value = 0;
|
|
1073
1197
|
lifted.value = 0;
|
|
1198
|
+
(0, react_native_reanimated.runOnJS)(endMovePreview)();
|
|
1074
1199
|
}
|
|
1075
1200
|
moving.value = 0;
|
|
1201
|
+
if (multiDay && !success) {
|
|
1202
|
+
moveOffset.value = 0;
|
|
1203
|
+
moveOffsetX.value = 0;
|
|
1204
|
+
(0, react_native_reanimated.runOnJS)(endMovePreview)();
|
|
1205
|
+
}
|
|
1076
1206
|
(0, react_native_reanimated.runOnJS)(releaseEdge)();
|
|
1077
1207
|
});
|
|
1078
1208
|
return isWeb$1 ? pan.activeOffsetX([-8, DRAG_ACTIVATE_PX$1]).activeOffsetY([-8, DRAG_ACTIVATE_PX$1]) : pan.activateAfterLongPress(MOVE_ACTIVATE_MS$1);
|
|
@@ -1104,6 +1234,9 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1104
1234
|
dayCount,
|
|
1105
1235
|
dayOrdinals,
|
|
1106
1236
|
commitDrag,
|
|
1237
|
+
multiDay,
|
|
1238
|
+
beginMovePreview,
|
|
1239
|
+
endMovePreview,
|
|
1107
1240
|
notifyDragStart,
|
|
1108
1241
|
onEdgeAdvance,
|
|
1109
1242
|
armEdge,
|
|
@@ -1217,7 +1350,11 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1217
1350
|
});
|
|
1218
1351
|
const box = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
1219
1352
|
...eventSlot,
|
|
1220
|
-
style: [
|
|
1353
|
+
style: [
|
|
1354
|
+
eventSlot.style,
|
|
1355
|
+
boxStyle,
|
|
1356
|
+
hiddenForMove ? { opacity: 0 } : null
|
|
1357
|
+
],
|
|
1221
1358
|
children: [
|
|
1222
1359
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
1223
1360
|
event: positioned.event,
|
|
@@ -1419,6 +1556,11 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1419
1556
|
const dayLeft = (dayIndex) => hourColumnWidth + dayIndex * dayWidth;
|
|
1420
1557
|
const dayOrdinals = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[0])), [days]);
|
|
1421
1558
|
const dayLayouts = (0, react.useMemo)(() => days.map((day) => (0, _super_calendar_core.layoutDayEvents)(events, day)), [days, events]);
|
|
1559
|
+
const [multiDayMove, setMultiDayMove] = (0, react.useState)(null);
|
|
1560
|
+
const movingEvent = multiDayMove ? events.find((event, index) => keyExtractor(event, index) === keyExtractor(multiDayMove.event, multiDayMove.eventIndex)) ?? null : null;
|
|
1561
|
+
(0, react.useEffect)(() => {
|
|
1562
|
+
if (multiDayMove?.phase === "dropped" && (!movingEvent || movingEvent.start.getTime() !== multiDayMove.event.start.getTime() || movingEvent.end.getTime() !== multiDayMove.event.end.getTime())) setMultiDayMove(null);
|
|
1563
|
+
}, [multiDayMove, movingEvent]);
|
|
1422
1564
|
const cellDateFromTouch = (event) => {
|
|
1423
1565
|
const { locationX, locationY } = event.nativeEvent;
|
|
1424
1566
|
const dayIndex = days.length === 1 ? 0 : Math.floor(locationX / dayWidth);
|
|
@@ -1732,6 +1874,9 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1732
1874
|
const columnWidth = dayWidth / positioned.columns;
|
|
1733
1875
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedEventBox, {
|
|
1734
1876
|
positioned,
|
|
1877
|
+
eventIndex: events.indexOf(positioned.event),
|
|
1878
|
+
movingEvent,
|
|
1879
|
+
onMovePreview: setMultiDayMove,
|
|
1735
1880
|
cellHeight: heightSource,
|
|
1736
1881
|
minHour,
|
|
1737
1882
|
maxHour,
|
|
@@ -1757,6 +1902,16 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1757
1902
|
onEdgeAdvance
|
|
1758
1903
|
}, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
|
|
1759
1904
|
})),
|
|
1905
|
+
multiDayMove ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MultiDayMovePreview, {
|
|
1906
|
+
move: multiDayMove,
|
|
1907
|
+
days,
|
|
1908
|
+
cellHeight: heightSource,
|
|
1909
|
+
dayWidth,
|
|
1910
|
+
hourColumnWidth,
|
|
1911
|
+
minHour,
|
|
1912
|
+
mode,
|
|
1913
|
+
renderEvent
|
|
1914
|
+
}) : null,
|
|
1760
1915
|
showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NowIndicator, {
|
|
1761
1916
|
cellHeight: heightSource,
|
|
1762
1917
|
nowHours,
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { a as withEventAccessibilityLabel, c as createSlots, d as darkTheme, f a
|
|
|
2
2
|
import { addDays, addMonths, addWeeks, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getHours, getISOWeek, getMinutes, isSameDay, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
3
3
|
import { createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import Animated, { runOnJS, scrollTo, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
|
|
5
|
-
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, eventsInTimeZone as eventsInTimeZone$1, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, getWeekDays as getWeekDays$1, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, minutesIntoDay, monthCreateRange, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveDraggedBounds, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, useNow as useNow$1, viewDayCount, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core";
|
|
5
|
+
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, eventsInTimeZone as eventsInTimeZone$1, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, getWeekDays as getWeekDays$1, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, minutesIntoDay, monthCreateRange, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, useNow as useNow$1, viewDayCount, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core";
|
|
6
6
|
import { Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
7
7
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -733,6 +733,93 @@ const styles$2 = StyleSheet.create({
|
|
|
733
733
|
chip: { minHeight: 18 }
|
|
734
734
|
});
|
|
735
735
|
//#endregion
|
|
736
|
+
//#region src/components/MultiDayMovePreview.tsx
|
|
737
|
+
const noop$1 = () => {};
|
|
738
|
+
const MIN_EVENT_HEIGHT$1 = 32;
|
|
739
|
+
function MultiDayMovePreview(props) {
|
|
740
|
+
const { move, days } = props;
|
|
741
|
+
const dayOffsets = useMemo(() => days.map((day) => differenceInCalendarDays(day, days[move.dayIndex]) * 1440), [days, move]);
|
|
742
|
+
return days.map((day, index) => /* @__PURE__ */ jsx(PreviewDay, {
|
|
743
|
+
...props,
|
|
744
|
+
dayOffsets,
|
|
745
|
+
index,
|
|
746
|
+
dayStart: startOfDay(day).getTime(),
|
|
747
|
+
dayEnd: addDays(startOfDay(day), 1).getTime()
|
|
748
|
+
}, day.toISOString()));
|
|
749
|
+
}
|
|
750
|
+
function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode, renderEvent: RenderEventComponent, dayOffsets, index, dayStart, dayEnd }) {
|
|
751
|
+
const theme = useCalendarTheme();
|
|
752
|
+
const slot = useSlots();
|
|
753
|
+
const { offsetX, offsetY, lifted, dayIndex, event } = move;
|
|
754
|
+
const duration = event.end.getTime() - event.start.getTime();
|
|
755
|
+
const startTimestamp = event.start.getTime();
|
|
756
|
+
const segment = useDerivedValue(() => {
|
|
757
|
+
const columnDelta = dayWidth > 0 ? Math.round(offsetX.value / dayWidth) : 0;
|
|
758
|
+
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayOffsets.length - 1);
|
|
759
|
+
const minuteDelta = cellHeight.value > 0 ? offsetY.value / cellHeight.value * 60 : 0;
|
|
760
|
+
const start = shiftMinutes(new Date(startTimestamp), dayOffsets[target] + minuteDelta).getTime();
|
|
761
|
+
const end = start + duration;
|
|
762
|
+
const visible = !lifted.value && start < dayEnd && end > dayStart;
|
|
763
|
+
return {
|
|
764
|
+
top: (Math.max(start, dayStart) - dayStart) / 36e5,
|
|
765
|
+
hours: visible ? Math.max((Math.min(end, dayEnd) - Math.max(start, dayStart)) / 36e5, .25) : 0,
|
|
766
|
+
continuesBefore: start < dayStart,
|
|
767
|
+
continuesAfter: end > dayEnd
|
|
768
|
+
};
|
|
769
|
+
}, [
|
|
770
|
+
dayWidth,
|
|
771
|
+
dayIndex,
|
|
772
|
+
dayOffsets,
|
|
773
|
+
startTimestamp,
|
|
774
|
+
duration,
|
|
775
|
+
dayStart,
|
|
776
|
+
dayEnd
|
|
777
|
+
]);
|
|
778
|
+
const boxHeight = useDerivedValue(() => segment.value.hours > 0 ? Math.max(segment.value.hours * cellHeight.value, MIN_EVENT_HEIGHT$1) : 0);
|
|
779
|
+
const style = useAnimatedStyle(() => ({
|
|
780
|
+
top: (segment.value.top - minHour) * cellHeight.value,
|
|
781
|
+
height: boxHeight.value,
|
|
782
|
+
opacity: boxHeight.value > 0 ? 1 : 0
|
|
783
|
+
}), [minHour]);
|
|
784
|
+
const [continuation, setContinuation] = useState(() => ({
|
|
785
|
+
continuesBefore: segment.value.continuesBefore,
|
|
786
|
+
continuesAfter: segment.value.continuesAfter
|
|
787
|
+
}));
|
|
788
|
+
useAnimatedReaction(() => ({
|
|
789
|
+
continuesBefore: segment.value.continuesBefore,
|
|
790
|
+
continuesAfter: segment.value.continuesAfter
|
|
791
|
+
}), (next, previous) => {
|
|
792
|
+
if (previous && (next.continuesBefore !== previous.continuesBefore || next.continuesAfter !== previous.continuesAfter)) runOnJS(setContinuation)(next);
|
|
793
|
+
});
|
|
794
|
+
const eventSlot = slot("event", { themed: theme.containers.timeGridEvent });
|
|
795
|
+
return /* @__PURE__ */ jsx(Animated.View, {
|
|
796
|
+
...eventSlot,
|
|
797
|
+
testID: "multi-day-move-preview",
|
|
798
|
+
pointerEvents: "none",
|
|
799
|
+
accessibilityElementsHidden: true,
|
|
800
|
+
importantForAccessibility: "no-hide-descendants",
|
|
801
|
+
style: [
|
|
802
|
+
{
|
|
803
|
+
position: "absolute",
|
|
804
|
+
overflow: "hidden",
|
|
805
|
+
padding: 2,
|
|
806
|
+
left: hourColumnWidth + index * dayWidth,
|
|
807
|
+
width: dayWidth,
|
|
808
|
+
zIndex: 100
|
|
809
|
+
},
|
|
810
|
+
eventSlot.style,
|
|
811
|
+
style
|
|
812
|
+
],
|
|
813
|
+
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
814
|
+
event,
|
|
815
|
+
mode,
|
|
816
|
+
boxHeight,
|
|
817
|
+
...continuation,
|
|
818
|
+
onPress: noop$1
|
|
819
|
+
})
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
//#endregion
|
|
736
823
|
//#region src/components/TimeGrid.tsx
|
|
737
824
|
const isWeb$1 = Platform.OS === "web";
|
|
738
825
|
const MINUTES_PER_HOUR$1 = 60;
|
|
@@ -830,7 +917,7 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
830
917
|
});
|
|
831
918
|
}
|
|
832
919
|
const HOUR_LABEL_TOP_INSET = 12;
|
|
833
|
-
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 }) {
|
|
920
|
+
function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
834
921
|
const RenderEventComponent = renderEvent;
|
|
835
922
|
const theme = useCalendarTheme();
|
|
836
923
|
const slot = useSlots();
|
|
@@ -861,6 +948,8 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
861
948
|
const startHours = positioned.startHours;
|
|
862
949
|
const durationHours = positioned.durationHours;
|
|
863
950
|
const ownsStart = !positioned.continuesBefore;
|
|
951
|
+
const multiDay = positioned.continuesBefore || positioned.continuesAfter;
|
|
952
|
+
const hiddenForMove = positioned.event === movingEvent;
|
|
864
953
|
const dragStartSV = useDerivedValue(() => ({
|
|
865
954
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
866
955
|
ownsStart
|
|
@@ -880,7 +969,7 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
880
969
|
};
|
|
881
970
|
}, [startHours, minHour]);
|
|
882
971
|
const spillHeight = useDerivedValue(() => {
|
|
883
|
-
if (!moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
972
|
+
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
884
973
|
const overflowHours = startHours + moveOffset.value / cellHeight.value + durationHours - HOURS_PER_DAY;
|
|
885
974
|
if (overflowHours <= 0) return 0;
|
|
886
975
|
const columnDelta = dayWidth > 0 ? Math.round(moveOffsetX.value / dayWidth) : 0;
|
|
@@ -897,7 +986,8 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
897
986
|
dayIndex,
|
|
898
987
|
dayCount,
|
|
899
988
|
dayOrdinals,
|
|
900
|
-
nextDayDirection
|
|
989
|
+
nextDayDirection,
|
|
990
|
+
multiDay
|
|
901
991
|
]);
|
|
902
992
|
const [previewMounted, setPreviewMounted] = useState(false);
|
|
903
993
|
useAnimatedReaction(() => spillHeight.value > 0, (spilling, previous) => {
|
|
@@ -918,11 +1008,13 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
918
1008
|
]);
|
|
919
1009
|
const latest = useRef({
|
|
920
1010
|
event: positioned.event,
|
|
1011
|
+
eventIndex,
|
|
921
1012
|
onDragEvent,
|
|
922
1013
|
onDragStart
|
|
923
1014
|
});
|
|
924
1015
|
latest.current = {
|
|
925
1016
|
event: positioned.event,
|
|
1017
|
+
eventIndex,
|
|
926
1018
|
onDragEvent,
|
|
927
1019
|
onDragStart
|
|
928
1020
|
};
|
|
@@ -945,11 +1037,41 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
945
1037
|
snapBack();
|
|
946
1038
|
return;
|
|
947
1039
|
}
|
|
948
|
-
if (handler(event, next.start, next.end) === false)
|
|
949
|
-
|
|
1040
|
+
if (handler(event, next.start, next.end) === false) {
|
|
1041
|
+
snapBack();
|
|
1042
|
+
onMovePreview(null);
|
|
1043
|
+
} else if (multiDay && deltaStartMin === deltaEndMin) onMovePreview((move) => move ? {
|
|
1044
|
+
...move,
|
|
1045
|
+
phase: "dropped"
|
|
1046
|
+
} : null);
|
|
1047
|
+
}, [
|
|
1048
|
+
snapMinutes,
|
|
1049
|
+
snapBack,
|
|
1050
|
+
multiDay,
|
|
1051
|
+
onMovePreview
|
|
1052
|
+
]);
|
|
950
1053
|
const notifyDragStart = useCallback(() => {
|
|
951
1054
|
latest.current.onDragStart?.(latest.current.event);
|
|
952
1055
|
}, []);
|
|
1056
|
+
const beginMovePreview = useCallback(() => {
|
|
1057
|
+
if (multiDay) onMovePreview({
|
|
1058
|
+
event: latest.current.event,
|
|
1059
|
+
eventIndex: latest.current.eventIndex,
|
|
1060
|
+
phase: "dragging",
|
|
1061
|
+
dayIndex,
|
|
1062
|
+
offsetX: moveOffsetX,
|
|
1063
|
+
offsetY: moveOffset,
|
|
1064
|
+
lifted
|
|
1065
|
+
});
|
|
1066
|
+
}, [
|
|
1067
|
+
multiDay,
|
|
1068
|
+
onMovePreview,
|
|
1069
|
+
dayIndex,
|
|
1070
|
+
moveOffsetX,
|
|
1071
|
+
moveOffset,
|
|
1072
|
+
lifted
|
|
1073
|
+
]);
|
|
1074
|
+
const endMovePreview = useCallback(() => onMovePreview(null), [onMovePreview]);
|
|
953
1075
|
const dwellTimer = useRef(null);
|
|
954
1076
|
const disarmEdge = useCallback(() => {
|
|
955
1077
|
if (dwellTimer.current) {
|
|
@@ -1000,6 +1122,7 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1000
1122
|
grabY.value = event.y;
|
|
1001
1123
|
liveAbsX.value = event.absoluteX;
|
|
1002
1124
|
liveAbsY.value = event.absoluteY;
|
|
1125
|
+
runOnJS(beginMovePreview)();
|
|
1003
1126
|
runOnJS(notifyDragStart)();
|
|
1004
1127
|
}).onUpdate((event) => {
|
|
1005
1128
|
liveAbsX.value = event.absoluteX;
|
|
@@ -1034,21 +1157,28 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1034
1157
|
if (minuteDelta === 0 && dayDelta === 0) {
|
|
1035
1158
|
moveOffset.value = 0;
|
|
1036
1159
|
moveOffsetX.value = 0;
|
|
1160
|
+
runOnJS(endMovePreview)();
|
|
1037
1161
|
return;
|
|
1038
1162
|
}
|
|
1039
1163
|
moveOffset.value = minuteDelta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
1040
1164
|
moveOffsetX.value = dayDelta * dayWidth;
|
|
1041
1165
|
const totalDelta = minuteDelta + (dayOrdinals[targetDay] - dayOrdinals[dayIndex]) * MINUTES_PER_DAY;
|
|
1042
1166
|
runOnJS(commitDrag)(totalDelta, totalDelta);
|
|
1043
|
-
}).onFinalize(() => {
|
|
1167
|
+
}).onFinalize((_event, success) => {
|
|
1044
1168
|
dragZ.value = 0;
|
|
1045
1169
|
if (lifted.value && ghostXSV && ghostYSV && commitLiftedDrop) {
|
|
1046
1170
|
runOnJS(commitLiftedDrop)(ghostXSV.value, ghostYSV.value);
|
|
1047
1171
|
moveOffset.value = 0;
|
|
1048
1172
|
moveOffsetX.value = 0;
|
|
1049
1173
|
lifted.value = 0;
|
|
1174
|
+
runOnJS(endMovePreview)();
|
|
1050
1175
|
}
|
|
1051
1176
|
moving.value = 0;
|
|
1177
|
+
if (multiDay && !success) {
|
|
1178
|
+
moveOffset.value = 0;
|
|
1179
|
+
moveOffsetX.value = 0;
|
|
1180
|
+
runOnJS(endMovePreview)();
|
|
1181
|
+
}
|
|
1052
1182
|
runOnJS(releaseEdge)();
|
|
1053
1183
|
});
|
|
1054
1184
|
return isWeb$1 ? pan.activeOffsetX([-8, DRAG_ACTIVATE_PX$1]).activeOffsetY([-8, DRAG_ACTIVATE_PX$1]) : pan.activateAfterLongPress(MOVE_ACTIVATE_MS$1);
|
|
@@ -1080,6 +1210,9 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1080
1210
|
dayCount,
|
|
1081
1211
|
dayOrdinals,
|
|
1082
1212
|
commitDrag,
|
|
1213
|
+
multiDay,
|
|
1214
|
+
beginMovePreview,
|
|
1215
|
+
endMovePreview,
|
|
1083
1216
|
notifyDragStart,
|
|
1084
1217
|
onEdgeAdvance,
|
|
1085
1218
|
armEdge,
|
|
@@ -1193,7 +1326,11 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, maxHour, left, widt
|
|
|
1193
1326
|
});
|
|
1194
1327
|
const box = /* @__PURE__ */ jsxs(Animated.View, {
|
|
1195
1328
|
...eventSlot,
|
|
1196
|
-
style: [
|
|
1329
|
+
style: [
|
|
1330
|
+
eventSlot.style,
|
|
1331
|
+
boxStyle,
|
|
1332
|
+
hiddenForMove ? { opacity: 0 } : null
|
|
1333
|
+
],
|
|
1197
1334
|
children: [
|
|
1198
1335
|
/* @__PURE__ */ jsx(RenderEventComponent, {
|
|
1199
1336
|
event: positioned.event,
|
|
@@ -1395,6 +1532,11 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1395
1532
|
const dayLeft = (dayIndex) => hourColumnWidth + dayIndex * dayWidth;
|
|
1396
1533
|
const dayOrdinals = useMemo(() => days.map((day) => differenceInCalendarDays(day, days[0])), [days]);
|
|
1397
1534
|
const dayLayouts = useMemo(() => days.map((day) => layoutDayEvents$1(events, day)), [days, events]);
|
|
1535
|
+
const [multiDayMove, setMultiDayMove] = useState(null);
|
|
1536
|
+
const movingEvent = multiDayMove ? events.find((event, index) => keyExtractor(event, index) === keyExtractor(multiDayMove.event, multiDayMove.eventIndex)) ?? null : null;
|
|
1537
|
+
useEffect(() => {
|
|
1538
|
+
if (multiDayMove?.phase === "dropped" && (!movingEvent || movingEvent.start.getTime() !== multiDayMove.event.start.getTime() || movingEvent.end.getTime() !== multiDayMove.event.end.getTime())) setMultiDayMove(null);
|
|
1539
|
+
}, [multiDayMove, movingEvent]);
|
|
1398
1540
|
const cellDateFromTouch = (event) => {
|
|
1399
1541
|
const { locationX, locationY } = event.nativeEvent;
|
|
1400
1542
|
const dayIndex = days.length === 1 ? 0 : Math.floor(locationX / dayWidth);
|
|
@@ -1708,6 +1850,9 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1708
1850
|
const columnWidth = dayWidth / positioned.columns;
|
|
1709
1851
|
return /* @__PURE__ */ jsx(AnimatedEventBox, {
|
|
1710
1852
|
positioned,
|
|
1853
|
+
eventIndex: events.indexOf(positioned.event),
|
|
1854
|
+
movingEvent,
|
|
1855
|
+
onMovePreview: setMultiDayMove,
|
|
1711
1856
|
cellHeight: heightSource,
|
|
1712
1857
|
minHour,
|
|
1713
1858
|
maxHour,
|
|
@@ -1733,6 +1878,16 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1733
1878
|
onEdgeAdvance
|
|
1734
1879
|
}, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
|
|
1735
1880
|
})),
|
|
1881
|
+
multiDayMove ? /* @__PURE__ */ jsx(MultiDayMovePreview, {
|
|
1882
|
+
move: multiDayMove,
|
|
1883
|
+
days,
|
|
1884
|
+
cellHeight: heightSource,
|
|
1885
|
+
dayWidth,
|
|
1886
|
+
hourColumnWidth,
|
|
1887
|
+
minHour,
|
|
1888
|
+
mode,
|
|
1889
|
+
renderEvent
|
|
1890
|
+
}) : null,
|
|
1736
1891
|
showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ jsx(NowIndicator, {
|
|
1737
1892
|
cellHeight: heightSource,
|
|
1738
1893
|
nowHours,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/native",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "Gesture-driven, virtualized month / week / day calendar and date picker for React Native (and web via react-native-web).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agenda",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@super-calendar/core": "2.9.
|
|
67
|
+
"@super-calendar/core": "2.9.1"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@legendapp/list": ">=3",
|
|
@@ -60,6 +60,12 @@ export type CalendarSlot = MonthViewSlot | TimeGridSlot | AgendaSlot | YearViewS
|
|
|
60
60
|
export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
61
61
|
events: CalendarEvent<T>[];
|
|
62
62
|
mode: CalendarMode;
|
|
63
|
+
/**
|
|
64
|
+
* The controlled anchor date, read in the device's local time zone. Construct
|
|
65
|
+
* it as a local date (`new Date(2026, 7, 24)`), not a UTC instant:
|
|
66
|
+
* `new Date("2026-08-24T00:00:00Z")` is still Aug 23 on devices west of UTC
|
|
67
|
+
* and anchors the previous week.
|
|
68
|
+
*/
|
|
63
69
|
date: Date;
|
|
64
70
|
onChangeDate: (date: Date) => void;
|
|
65
71
|
/** Fired alongside `onChangeDate` with the `[start, end]` of the newly-visible range. */
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { addDays, differenceInCalendarDays, startOfDay } from "date-fns";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import Animated, {
|
|
4
|
+
runOnJS,
|
|
5
|
+
type SharedValue,
|
|
6
|
+
useAnimatedReaction,
|
|
7
|
+
useAnimatedStyle,
|
|
8
|
+
useDerivedValue,
|
|
9
|
+
} from "react-native-reanimated";
|
|
10
|
+
import { shiftMinutes } from "@super-calendar/core";
|
|
11
|
+
import type { CalendarEvent, CalendarMode, RenderEvent } from "../types";
|
|
12
|
+
import { useCalendarTheme } from "../theme";
|
|
13
|
+
import { useSlots } from "../utils/slots";
|
|
14
|
+
import type { TimeGridSlot } from "./TimeGrid";
|
|
15
|
+
|
|
16
|
+
export type MultiDayMove<T> = {
|
|
17
|
+
event: CalendarEvent<T>;
|
|
18
|
+
eventIndex: number;
|
|
19
|
+
phase: "dragging" | "dropped";
|
|
20
|
+
dayIndex: number;
|
|
21
|
+
offsetX: SharedValue<number>;
|
|
22
|
+
offsetY: SharedValue<number>;
|
|
23
|
+
lifted: SharedValue<number>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type PreviewProps<T> = {
|
|
27
|
+
move: MultiDayMove<T>;
|
|
28
|
+
days: Date[];
|
|
29
|
+
cellHeight: SharedValue<number>;
|
|
30
|
+
dayWidth: number;
|
|
31
|
+
hourColumnWidth: number;
|
|
32
|
+
minHour: number;
|
|
33
|
+
mode: CalendarMode;
|
|
34
|
+
renderEvent: RenderEvent<T>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const noop = () => {};
|
|
38
|
+
const MIN_EVENT_HEIGHT = 32;
|
|
39
|
+
|
|
40
|
+
// Mount once on grab. Only numbers and shared values cross to the UI thread;
|
|
41
|
+
// moving the pointer does not rerender the page or rebuild its gestures.
|
|
42
|
+
export function MultiDayMovePreview<T>(props: PreviewProps<T>) {
|
|
43
|
+
const { move, days } = props;
|
|
44
|
+
const dayOffsets = useMemo(
|
|
45
|
+
() => days.map((day) => differenceInCalendarDays(day, days[move.dayIndex]) * 1440),
|
|
46
|
+
[days, move],
|
|
47
|
+
);
|
|
48
|
+
return days.map((day, index) => (
|
|
49
|
+
<PreviewDay
|
|
50
|
+
key={day.toISOString()}
|
|
51
|
+
{...props}
|
|
52
|
+
dayOffsets={dayOffsets}
|
|
53
|
+
index={index}
|
|
54
|
+
dayStart={startOfDay(day).getTime()}
|
|
55
|
+
dayEnd={addDays(startOfDay(day), 1).getTime()}
|
|
56
|
+
/>
|
|
57
|
+
));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function PreviewDay<T>({
|
|
61
|
+
move,
|
|
62
|
+
cellHeight,
|
|
63
|
+
dayWidth,
|
|
64
|
+
hourColumnWidth,
|
|
65
|
+
minHour,
|
|
66
|
+
mode,
|
|
67
|
+
renderEvent: RenderEventComponent,
|
|
68
|
+
dayOffsets,
|
|
69
|
+
index,
|
|
70
|
+
dayStart,
|
|
71
|
+
dayEnd,
|
|
72
|
+
}: PreviewProps<T> & {
|
|
73
|
+
dayOffsets: number[];
|
|
74
|
+
index: number;
|
|
75
|
+
dayStart: number;
|
|
76
|
+
dayEnd: number;
|
|
77
|
+
}) {
|
|
78
|
+
const theme = useCalendarTheme();
|
|
79
|
+
const slot = useSlots<TimeGridSlot>();
|
|
80
|
+
const { offsetX, offsetY, lifted, dayIndex, event } = move;
|
|
81
|
+
const duration = event.end.getTime() - event.start.getTime();
|
|
82
|
+
const startTimestamp = event.start.getTime();
|
|
83
|
+
const segment = useDerivedValue(() => {
|
|
84
|
+
const columnDelta = dayWidth > 0 ? Math.round(offsetX.value / dayWidth) : 0;
|
|
85
|
+
const target = Math.min(Math.max(dayIndex + columnDelta, 0), dayOffsets.length - 1);
|
|
86
|
+
const minuteDelta = cellHeight.value > 0 ? (offsetY.value / cellHeight.value) * 60 : 0;
|
|
87
|
+
const start = shiftMinutes(
|
|
88
|
+
new Date(startTimestamp),
|
|
89
|
+
dayOffsets[target] + minuteDelta,
|
|
90
|
+
).getTime();
|
|
91
|
+
const end = start + duration;
|
|
92
|
+
const visible = !lifted.value && start < dayEnd && end > dayStart;
|
|
93
|
+
return {
|
|
94
|
+
top: (Math.max(start, dayStart) - dayStart) / 3_600_000,
|
|
95
|
+
hours: visible
|
|
96
|
+
? Math.max((Math.min(end, dayEnd) - Math.max(start, dayStart)) / 3_600_000, 0.25)
|
|
97
|
+
: 0,
|
|
98
|
+
continuesBefore: start < dayStart,
|
|
99
|
+
continuesAfter: end > dayEnd,
|
|
100
|
+
};
|
|
101
|
+
}, [dayWidth, dayIndex, dayOffsets, startTimestamp, duration, dayStart, dayEnd]);
|
|
102
|
+
const boxHeight = useDerivedValue(() =>
|
|
103
|
+
segment.value.hours > 0
|
|
104
|
+
? Math.max(segment.value.hours * cellHeight.value, MIN_EVENT_HEIGHT)
|
|
105
|
+
: 0,
|
|
106
|
+
);
|
|
107
|
+
const style = useAnimatedStyle(
|
|
108
|
+
() => ({
|
|
109
|
+
top: (segment.value.top - minHour) * cellHeight.value,
|
|
110
|
+
height: boxHeight.value,
|
|
111
|
+
opacity: boxHeight.value > 0 ? 1 : 0,
|
|
112
|
+
}),
|
|
113
|
+
[minHour],
|
|
114
|
+
);
|
|
115
|
+
const [continuation, setContinuation] = useState(() => ({
|
|
116
|
+
continuesBefore: segment.value.continuesBefore,
|
|
117
|
+
continuesAfter: segment.value.continuesAfter,
|
|
118
|
+
}));
|
|
119
|
+
useAnimatedReaction(
|
|
120
|
+
() => ({
|
|
121
|
+
continuesBefore: segment.value.continuesBefore,
|
|
122
|
+
continuesAfter: segment.value.continuesAfter,
|
|
123
|
+
}),
|
|
124
|
+
(next, previous) => {
|
|
125
|
+
if (
|
|
126
|
+
previous &&
|
|
127
|
+
(next.continuesBefore !== previous.continuesBefore ||
|
|
128
|
+
next.continuesAfter !== previous.continuesAfter)
|
|
129
|
+
) {
|
|
130
|
+
runOnJS(setContinuation)(next);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
);
|
|
134
|
+
const eventSlot = slot("event", { themed: theme.containers.timeGridEvent });
|
|
135
|
+
return (
|
|
136
|
+
<Animated.View
|
|
137
|
+
{...eventSlot}
|
|
138
|
+
testID="multi-day-move-preview"
|
|
139
|
+
pointerEvents="none"
|
|
140
|
+
accessibilityElementsHidden
|
|
141
|
+
importantForAccessibility="no-hide-descendants"
|
|
142
|
+
style={[
|
|
143
|
+
{
|
|
144
|
+
position: "absolute",
|
|
145
|
+
overflow: "hidden",
|
|
146
|
+
padding: 2,
|
|
147
|
+
left: hourColumnWidth + index * dayWidth,
|
|
148
|
+
width: dayWidth,
|
|
149
|
+
zIndex: 100,
|
|
150
|
+
},
|
|
151
|
+
eventSlot.style,
|
|
152
|
+
style,
|
|
153
|
+
]}
|
|
154
|
+
>
|
|
155
|
+
<RenderEventComponent
|
|
156
|
+
event={event}
|
|
157
|
+
mode={mode}
|
|
158
|
+
boxHeight={boxHeight}
|
|
159
|
+
{...continuation}
|
|
160
|
+
onPress={noop}
|
|
161
|
+
/>
|
|
162
|
+
</Animated.View>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
@@ -17,8 +17,10 @@ import {
|
|
|
17
17
|
} from "date-fns";
|
|
18
18
|
import {
|
|
19
19
|
createContext,
|
|
20
|
+
type Dispatch,
|
|
20
21
|
memo,
|
|
21
22
|
type ReactElement,
|
|
23
|
+
type SetStateAction,
|
|
22
24
|
useCallback,
|
|
23
25
|
useContext,
|
|
24
26
|
useEffect,
|
|
@@ -96,6 +98,7 @@ import { useWebGridZoom } from "../utils/useWebGridZoom";
|
|
|
96
98
|
import { useWebPagerKeys } from "../utils/useWebPagerKeys";
|
|
97
99
|
import { withEventAccessibilityLabel } from "../utils/withEventAccessibilityLabel";
|
|
98
100
|
import { AllDayLane } from "./AllDayLane";
|
|
101
|
+
import { type MultiDayMove, MultiDayMovePreview } from "./MultiDayMovePreview";
|
|
99
102
|
|
|
100
103
|
// Horizontal swipe paging doesn't translate to web; there we disable it and page
|
|
101
104
|
// with the arrow keys instead.
|
|
@@ -310,6 +313,9 @@ const HOUR_LABEL_NUDGE = 6;
|
|
|
310
313
|
|
|
311
314
|
type AnimatedEventBoxProps<T> = {
|
|
312
315
|
positioned: PositionedEvent<T>;
|
|
316
|
+
eventIndex: number;
|
|
317
|
+
movingEvent: CalendarEvent<T> | null;
|
|
318
|
+
onMovePreview: Dispatch<SetStateAction<MultiDayMove<T> | null>>;
|
|
313
319
|
cellHeight: SharedValue<number>;
|
|
314
320
|
minHour: number;
|
|
315
321
|
maxHour: number;
|
|
@@ -351,6 +357,9 @@ type AnimatedEventBoxProps<T> = {
|
|
|
351
357
|
|
|
352
358
|
function AnimatedEventBox<T>({
|
|
353
359
|
positioned,
|
|
360
|
+
eventIndex,
|
|
361
|
+
movingEvent,
|
|
362
|
+
onMovePreview,
|
|
354
363
|
cellHeight,
|
|
355
364
|
minHour,
|
|
356
365
|
maxHour,
|
|
@@ -442,6 +451,8 @@ function AnimatedEventBox<T>({
|
|
|
442
451
|
const startHours = positioned.startHours;
|
|
443
452
|
const durationHours = positioned.durationHours;
|
|
444
453
|
const ownsStart = !positioned.continuesBefore;
|
|
454
|
+
const multiDay = positioned.continuesBefore || positioned.continuesAfter;
|
|
455
|
+
const hiddenForMove = positioned.event === movingEvent;
|
|
445
456
|
// Where the move gesture clamps from, mirrored into a shared value so it isn't a
|
|
446
457
|
// gesture dependency. A gesture memoized on a value the dragged event carries
|
|
447
458
|
// would be rebuilt under the finger, and so torn down mid-drag, the moment a
|
|
@@ -503,7 +514,7 @@ function AnimatedEventBox<T>({
|
|
|
503
514
|
// reaching the next day. Bails on the first line for a box that isn't being
|
|
504
515
|
// moved, which is every box but one.
|
|
505
516
|
const spillHeight = useDerivedValue(() => {
|
|
506
|
-
if (!moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
517
|
+
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
507
518
|
const liveStartHours = startHours + moveOffset.value / cellHeight.value;
|
|
508
519
|
const overflowHours = liveStartHours + durationHours - HOURS_PER_DAY;
|
|
509
520
|
if (overflowHours <= 0) return 0;
|
|
@@ -524,6 +535,7 @@ function AnimatedEventBox<T>({
|
|
|
524
535
|
dayCount,
|
|
525
536
|
dayOrdinals,
|
|
526
537
|
nextDayDirection,
|
|
538
|
+
multiDay,
|
|
527
539
|
]);
|
|
528
540
|
|
|
529
541
|
// Mount the spill preview only while a drag is actually spilling, off the UI
|
|
@@ -565,8 +577,8 @@ function AnimatedEventBox<T>({
|
|
|
565
577
|
|
|
566
578
|
// Keep the latest event/handler in a ref so the gestures stay memoized but
|
|
567
579
|
// never call into a stale closure.
|
|
568
|
-
const latest = useRef({ event: positioned.event, onDragEvent, onDragStart });
|
|
569
|
-
latest.current = { event: positioned.event, onDragEvent, onDragStart };
|
|
580
|
+
const latest = useRef({ event: positioned.event, eventIndex, onDragEvent, onDragStart });
|
|
581
|
+
latest.current = { event: positioned.event, eventIndex, onDragEvent, onDragStart };
|
|
570
582
|
|
|
571
583
|
// Snap the box back to where it started (drop rejected or degenerate).
|
|
572
584
|
const snapBack = useCallback(() => {
|
|
@@ -598,9 +610,14 @@ function AnimatedEventBox<T>({
|
|
|
598
610
|
}
|
|
599
611
|
// A handler may return false to reject the drop (e.g. an overlap or an
|
|
600
612
|
// out-of-bounds slot); snap the box back to its original place.
|
|
601
|
-
if (handler(event, next.start, next.end) === false)
|
|
613
|
+
if (handler(event, next.start, next.end) === false) {
|
|
614
|
+
snapBack();
|
|
615
|
+
onMovePreview(null);
|
|
616
|
+
} else if (multiDay && deltaStartMin === deltaEndMin) {
|
|
617
|
+
onMovePreview((move) => (move ? { ...move, phase: "dropped" } : null));
|
|
618
|
+
}
|
|
602
619
|
},
|
|
603
|
-
[snapMinutes, snapBack],
|
|
620
|
+
[snapMinutes, snapBack, multiDay, onMovePreview],
|
|
604
621
|
);
|
|
605
622
|
|
|
606
623
|
// Fired on the JS thread when the gesture grabs the event, so consumers can
|
|
@@ -609,6 +626,21 @@ function AnimatedEventBox<T>({
|
|
|
609
626
|
latest.current.onDragStart?.(latest.current.event);
|
|
610
627
|
}, []);
|
|
611
628
|
|
|
629
|
+
const beginMovePreview = useCallback(() => {
|
|
630
|
+
if (multiDay) {
|
|
631
|
+
onMovePreview({
|
|
632
|
+
event: latest.current.event,
|
|
633
|
+
eventIndex: latest.current.eventIndex,
|
|
634
|
+
phase: "dragging",
|
|
635
|
+
dayIndex,
|
|
636
|
+
offsetX: moveOffsetX,
|
|
637
|
+
offsetY: moveOffset,
|
|
638
|
+
lifted,
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}, [multiDay, onMovePreview, dayIndex, moveOffsetX, moveOffset, lifted]);
|
|
642
|
+
const endMovePreview = useCallback(() => onMovePreview(null), [onMovePreview]);
|
|
643
|
+
|
|
612
644
|
// Edge auto-advance dwell. Dragging the event past the visible columns and
|
|
613
645
|
// holding there pages the view one period and carries the event onto it: same
|
|
614
646
|
// weekday, keeping whatever time the vertical drag has reached. It fires once
|
|
@@ -683,6 +715,7 @@ function AnimatedEventBox<T>({
|
|
|
683
715
|
grabY.value = event.y;
|
|
684
716
|
liveAbsX.value = event.absoluteX;
|
|
685
717
|
liveAbsY.value = event.absoluteY;
|
|
718
|
+
runOnJS(beginMovePreview)();
|
|
686
719
|
runOnJS(notifyDragStart)();
|
|
687
720
|
})
|
|
688
721
|
.onUpdate((event) => {
|
|
@@ -743,6 +776,7 @@ function AnimatedEventBox<T>({
|
|
|
743
776
|
if (minuteDelta === 0 && dayDelta === 0) {
|
|
744
777
|
moveOffset.value = 0;
|
|
745
778
|
moveOffsetX.value = 0;
|
|
779
|
+
runOnJS(endMovePreview)();
|
|
746
780
|
return;
|
|
747
781
|
}
|
|
748
782
|
// Hold the snapped position so the box doesn't flash back to the
|
|
@@ -757,7 +791,7 @@ function AnimatedEventBox<T>({
|
|
|
757
791
|
const totalDelta = minuteDelta + calendarDayDelta * MINUTES_PER_DAY;
|
|
758
792
|
runOnJS(commitDrag)(totalDelta, totalDelta);
|
|
759
793
|
})
|
|
760
|
-
.onFinalize(() => {
|
|
794
|
+
.onFinalize((_event, success) => {
|
|
761
795
|
dragZ.value = 0;
|
|
762
796
|
// Commit the cross-week drop here: onFinalize fires on every gesture end,
|
|
763
797
|
// including the cancel RNGH reports when the source page moves under the
|
|
@@ -768,11 +802,17 @@ function AnimatedEventBox<T>({
|
|
|
768
802
|
moveOffset.value = 0;
|
|
769
803
|
moveOffsetX.value = 0;
|
|
770
804
|
lifted.value = 0;
|
|
805
|
+
runOnJS(endMovePreview)();
|
|
771
806
|
}
|
|
772
807
|
// The preview unmounts from the `spillHeight` reaction once the commit
|
|
773
808
|
// lands and clears `moveOffset`; this is the safety net for a cancel,
|
|
774
809
|
// where `onEnd` never runs.
|
|
775
810
|
moving.value = 0;
|
|
811
|
+
if (multiDay && !success) {
|
|
812
|
+
moveOffset.value = 0;
|
|
813
|
+
moveOffsetX.value = 0;
|
|
814
|
+
runOnJS(endMovePreview)();
|
|
815
|
+
}
|
|
776
816
|
runOnJS(releaseEdge)();
|
|
777
817
|
});
|
|
778
818
|
// Native: long-press to pick up. Web: activate past a small drag in either
|
|
@@ -810,6 +850,9 @@ function AnimatedEventBox<T>({
|
|
|
810
850
|
dayCount,
|
|
811
851
|
dayOrdinals,
|
|
812
852
|
commitDrag,
|
|
853
|
+
multiDay,
|
|
854
|
+
beginMovePreview,
|
|
855
|
+
endMovePreview,
|
|
813
856
|
notifyDragStart,
|
|
814
857
|
onEdgeAdvance,
|
|
815
858
|
armEdge,
|
|
@@ -946,7 +989,10 @@ function AnimatedEventBox<T>({
|
|
|
946
989
|
themed: theme.containers.timeGridEvent,
|
|
947
990
|
});
|
|
948
991
|
const box = (
|
|
949
|
-
<Animated.View
|
|
992
|
+
<Animated.View
|
|
993
|
+
{...eventSlot}
|
|
994
|
+
style={[eventSlot.style, boxStyle, hiddenForMove ? { opacity: 0 } : null]}
|
|
995
|
+
>
|
|
950
996
|
<RenderEventComponent
|
|
951
997
|
event={positioned.event}
|
|
952
998
|
mode={mode}
|
|
@@ -1407,6 +1453,23 @@ function TimetablePageInner<T>({
|
|
|
1407
1453
|
);
|
|
1408
1454
|
|
|
1409
1455
|
const dayLayouts = useMemo(() => days.map((day) => layoutDayEvents(events, day)), [days, events]);
|
|
1456
|
+
const [multiDayMove, setMultiDayMove] = useState<MultiDayMove<T> | null>(null);
|
|
1457
|
+
const movingEvent = multiDayMove
|
|
1458
|
+
? (events.find(
|
|
1459
|
+
(event, index) =>
|
|
1460
|
+
keyExtractor(event, index) === keyExtractor(multiDayMove.event, multiDayMove.eventIndex),
|
|
1461
|
+
) ?? null)
|
|
1462
|
+
: null;
|
|
1463
|
+
useEffect(() => {
|
|
1464
|
+
if (
|
|
1465
|
+
multiDayMove?.phase === "dropped" &&
|
|
1466
|
+
(!movingEvent ||
|
|
1467
|
+
movingEvent.start.getTime() !== multiDayMove.event.start.getTime() ||
|
|
1468
|
+
movingEvent.end.getTime() !== multiDayMove.event.end.getTime())
|
|
1469
|
+
) {
|
|
1470
|
+
setMultiDayMove(null);
|
|
1471
|
+
}
|
|
1472
|
+
}, [multiDayMove, movingEvent]);
|
|
1410
1473
|
|
|
1411
1474
|
// Map a tap on empty grid space back to the date+time it represents. Reads the
|
|
1412
1475
|
// live row height on the JS thread to convert the touch Y into minutes.
|
|
@@ -1819,6 +1882,9 @@ function TimetablePageInner<T>({
|
|
|
1819
1882
|
// flattened list of all days' boxes.
|
|
1820
1883
|
key={`${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`}
|
|
1821
1884
|
positioned={positioned}
|
|
1885
|
+
eventIndex={events.indexOf(positioned.event)}
|
|
1886
|
+
movingEvent={movingEvent}
|
|
1887
|
+
onMovePreview={setMultiDayMove}
|
|
1822
1888
|
cellHeight={heightSource}
|
|
1823
1889
|
minHour={minHour}
|
|
1824
1890
|
maxHour={maxHour}
|
|
@@ -1847,6 +1913,19 @@ function TimetablePageInner<T>({
|
|
|
1847
1913
|
}),
|
|
1848
1914
|
)}
|
|
1849
1915
|
|
|
1916
|
+
{multiDayMove ? (
|
|
1917
|
+
<MultiDayMovePreview
|
|
1918
|
+
move={multiDayMove}
|
|
1919
|
+
days={days}
|
|
1920
|
+
cellHeight={heightSource}
|
|
1921
|
+
dayWidth={dayWidth}
|
|
1922
|
+
hourColumnWidth={hourColumnWidth}
|
|
1923
|
+
minHour={minHour}
|
|
1924
|
+
mode={mode}
|
|
1925
|
+
renderEvent={renderEvent}
|
|
1926
|
+
/>
|
|
1927
|
+
) : null}
|
|
1928
|
+
|
|
1850
1929
|
{showNowIndicator && nowDayIndex >= 0 && nowInWindow ? (
|
|
1851
1930
|
<NowIndicator
|
|
1852
1931
|
cellHeight={heightSource}
|