@super-calendar/native 2.10.0 → 2.11.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/dist/index.d.mts +51 -13
- package/dist/index.d.ts +51 -13
- package/dist/index.js +908 -592
- package/dist/index.mjs +909 -593
- package/package.json +2 -2
- package/src/components/Agenda.tsx +5 -1
- package/src/components/AllDayLane.tsx +36 -53
- package/src/components/Calendar.tsx +39 -4
- package/src/components/MultiDayMovePreview.tsx +1 -3
- package/src/components/TimeGrid.tsx +1366 -878
- package/src/components/YearView.tsx +5 -0
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { a as withEventAccessibilityLabel, c as createSlots, d as darkTheme, f as defaultTheme, i as MonthView, l as useSlots, m as useCalendarTheme, n as DefaultMonthEvent, o as useWebPagerKeys, p as mergeTheme, r as MonthPager, s as SlotStylesProvider, t as MonthList, u as CalendarThemeProvider } from "./MonthList-CjKhzOJX.mjs";
|
|
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
|
-
import Animated, { runOnJS,
|
|
4
|
+
import Animated, { runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
|
|
5
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";
|
|
9
9
|
import { LegendList } from "@legendapp/list/react-native";
|
|
10
|
+
import { AnimatedLegendList } from "@legendapp/list/reanimated";
|
|
10
11
|
//#region src/components/YearView.tsx
|
|
11
12
|
const isWeb$2 = Platform.OS === "web";
|
|
12
13
|
const DRAG_HOLD_MS = 400;
|
|
13
14
|
const FALLBACK_COLUMNS = 3;
|
|
14
|
-
function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, classNames, styles: styleOverrides }) {
|
|
15
|
+
function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, refreshControl, classNames, styles: styleOverrides }) {
|
|
15
16
|
const theme = useCalendarTheme();
|
|
16
17
|
const slot = createSlots({
|
|
17
18
|
classNames,
|
|
@@ -98,6 +99,7 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeD
|
|
|
98
99
|
onLayout: handleLayout,
|
|
99
100
|
showsVerticalScrollIndicator: true,
|
|
100
101
|
scrollEnabled: isWeb$2 || sweep == null,
|
|
102
|
+
refreshControl,
|
|
101
103
|
children: /* @__PURE__ */ jsx(View, {
|
|
102
104
|
...slot("grid", { base: styles$5.grid }),
|
|
103
105
|
children: months.map((month, monthIndex) => {
|
|
@@ -369,7 +371,7 @@ const styles$5 = StyleSheet.create({
|
|
|
369
371
|
* start, grouped under a date header per day. The consumer controls which
|
|
370
372
|
* events (and therefore which date range) are shown.
|
|
371
373
|
*/
|
|
372
|
-
function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
374
|
+
function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, refreshControl, classNames, styles: styleOverrides }) {
|
|
373
375
|
const theme = useCalendarTheme();
|
|
374
376
|
const slot = useMemo(() => createSlots({
|
|
375
377
|
classNames,
|
|
@@ -448,7 +450,8 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
448
450
|
keyExtractor: keyExtractorRow,
|
|
449
451
|
renderItem,
|
|
450
452
|
ItemSeparatorComponent: itemSeparatorComponent ?? void 0,
|
|
451
|
-
recycleItems: false
|
|
453
|
+
recycleItems: false,
|
|
454
|
+
refreshControl
|
|
452
455
|
});
|
|
453
456
|
}
|
|
454
457
|
const styles$4 = StyleSheet.create({
|
|
@@ -665,12 +668,13 @@ function useWebGridZoom(enabled, target, cellHeight, committedCellHeight, minHei
|
|
|
665
668
|
//#endregion
|
|
666
669
|
//#region src/components/AllDayLane.tsx
|
|
667
670
|
/**
|
|
668
|
-
* The all-day lane
|
|
669
|
-
* excluded from the timed columns (see `layoutDayEvents`) and shown
|
|
670
|
-
* stacked under their day(s).
|
|
671
|
-
*
|
|
671
|
+
* The all-day lane of one page, pinned above the scrolling hours. All-day
|
|
672
|
+
* events are excluded from the timed columns (see `layoutDayEvents`) and shown
|
|
673
|
+
* here, stacked under their day(s). Always rendered so every page reports a
|
|
674
|
+
* height, zero when the week has none, which the band above the grid follows
|
|
675
|
+
* live as you swipe; the "all-day" label lives in the hour column.
|
|
672
676
|
*/
|
|
673
|
-
function AllDayLane({ days, events, mode,
|
|
677
|
+
function AllDayLane({ days, events, mode, dayWidth, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onLayout }) {
|
|
674
678
|
const theme = useCalendarTheme();
|
|
675
679
|
const slot = useSlots();
|
|
676
680
|
const RenderEventComponent = renderEvent;
|
|
@@ -680,23 +684,13 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
|
|
|
680
684
|
const next = addDays(start, 1);
|
|
681
685
|
return allDay.filter((event) => event.start < next && event.end > start);
|
|
682
686
|
});
|
|
683
|
-
|
|
684
|
-
return /* @__PURE__ */ jsxs(View, {
|
|
687
|
+
return /* @__PURE__ */ jsx(View, {
|
|
685
688
|
...slot("allDayLane", {
|
|
686
689
|
base: styles$2.lane,
|
|
687
|
-
themed:
|
|
690
|
+
themed: theme.containers.allDayLane
|
|
688
691
|
}),
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
692
|
-
...slot("allDayLabel", {
|
|
693
|
-
base: styles$2.label,
|
|
694
|
-
themed: { color: theme.colors.textMuted }
|
|
695
|
-
}),
|
|
696
|
-
allowFontScaling: false,
|
|
697
|
-
children: "all-day"
|
|
698
|
-
})
|
|
699
|
-
}), days.map((day, dayIndex) => /* @__PURE__ */ jsx(View, {
|
|
692
|
+
onLayout,
|
|
693
|
+
children: perDay.every((list) => list.length === 0) ? null : days.map((day, dayIndex) => /* @__PURE__ */ jsx(View, {
|
|
700
694
|
...slot("allDayColumn", {
|
|
701
695
|
base: [styles$2.column, { width: dayWidth }],
|
|
702
696
|
themed: theme.containers.allDayColumn
|
|
@@ -711,20 +705,11 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
|
|
|
711
705
|
onLongPress: onLongPressEvent ? () => onLongPressEvent(event) : void 0
|
|
712
706
|
})
|
|
713
707
|
}, keyExtractor(event, index)))
|
|
714
|
-
}, day.toISOString()))
|
|
708
|
+
}, day.toISOString()))
|
|
715
709
|
});
|
|
716
710
|
}
|
|
717
711
|
const styles$2 = StyleSheet.create({
|
|
718
|
-
lane: {
|
|
719
|
-
flexDirection: "row",
|
|
720
|
-
borderBottomWidth: StyleSheet.hairlineWidth
|
|
721
|
-
},
|
|
722
|
-
gutter: { justifyContent: "center" },
|
|
723
|
-
label: {
|
|
724
|
-
fontSize: 10,
|
|
725
|
-
textAlign: "right",
|
|
726
|
-
paddingRight: 6
|
|
727
|
-
},
|
|
712
|
+
lane: { flexDirection: "row" },
|
|
728
713
|
column: {
|
|
729
714
|
paddingVertical: 2,
|
|
730
715
|
paddingHorizontal: 1,
|
|
@@ -746,7 +731,7 @@ function MultiDayMovePreview(props) {
|
|
|
746
731
|
dayEnd: addDays(startOfDay(day), 1).getTime()
|
|
747
732
|
}, day.toISOString()));
|
|
748
733
|
}
|
|
749
|
-
function PreviewDay({ move, cellHeight, dayWidth,
|
|
734
|
+
function PreviewDay({ move, cellHeight, dayWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
|
|
750
735
|
const theme = useCalendarTheme();
|
|
751
736
|
const slot = useSlots();
|
|
752
737
|
const { offsetX, offsetY, lifted, dayIndex, event } = move;
|
|
@@ -802,7 +787,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
|
|
|
802
787
|
position: "absolute",
|
|
803
788
|
overflow: "hidden",
|
|
804
789
|
padding: eventGap,
|
|
805
|
-
left:
|
|
790
|
+
left: index * dayWidth,
|
|
806
791
|
width: dayWidth,
|
|
807
792
|
zIndex: 100
|
|
808
793
|
},
|
|
@@ -839,8 +824,9 @@ const DRAG_ACTIVATE_PX$1 = 8;
|
|
|
839
824
|
const RESIZE_HANDLE_HEIGHT = 14;
|
|
840
825
|
const DEFAULT_DRAG_STEP_MINUTES = 15;
|
|
841
826
|
const DRAG_EVENT_Z = 100;
|
|
842
|
-
const EDGE_DWELL_MS =
|
|
843
|
-
const
|
|
827
|
+
const EDGE_DWELL_MS = 600;
|
|
828
|
+
const EDGE_REPEAT_MS = 700;
|
|
829
|
+
const EDGE_ZONE_PX = 24;
|
|
844
830
|
const EdgePagingContext = createContext(null);
|
|
845
831
|
const noop = () => {};
|
|
846
832
|
/**
|
|
@@ -918,7 +904,9 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent, eventGap })
|
|
|
918
904
|
});
|
|
919
905
|
}
|
|
920
906
|
const HOUR_LABEL_TOP_INSET = 12;
|
|
921
|
-
|
|
907
|
+
const LANE_BAND_FLOOR = 1;
|
|
908
|
+
const DAY_HEADER_HEIGHT = 56;
|
|
909
|
+
function AnimatedEventBoxInner({ 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 }) {
|
|
922
910
|
const RenderEventComponent = renderEvent;
|
|
923
911
|
const theme = useCalendarTheme();
|
|
924
912
|
const slot = useSlots();
|
|
@@ -970,9 +958,14 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
970
958
|
top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
971
959
|
height: visibleBoxHeight.value,
|
|
972
960
|
transform: [{ translateX: moveOffsetX.value }],
|
|
973
|
-
zIndex: dragZ.value
|
|
961
|
+
zIndex: dragZ.value,
|
|
962
|
+
opacity: hiddenForMove || lifted.value ? 0 : 1
|
|
974
963
|
};
|
|
975
|
-
}, [
|
|
964
|
+
}, [
|
|
965
|
+
startHours,
|
|
966
|
+
minHour,
|
|
967
|
+
hiddenForMove
|
|
968
|
+
]);
|
|
976
969
|
const spillHeight = useDerivedValue(() => {
|
|
977
970
|
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
978
971
|
const overflowHours = startHours + moveOffset.value / cellHeight.value + durationHours - HOURS_PER_DAY;
|
|
@@ -1015,13 +1008,17 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1015
1008
|
event: positioned.event,
|
|
1016
1009
|
eventIndex,
|
|
1017
1010
|
onDragEvent,
|
|
1018
|
-
onDragStart
|
|
1011
|
+
onDragStart,
|
|
1012
|
+
onPress,
|
|
1013
|
+
onLongPress
|
|
1019
1014
|
});
|
|
1020
1015
|
latest.current = {
|
|
1021
1016
|
event: positioned.event,
|
|
1022
1017
|
eventIndex,
|
|
1023
1018
|
onDragEvent,
|
|
1024
|
-
onDragStart
|
|
1019
|
+
onDragStart,
|
|
1020
|
+
onPress,
|
|
1021
|
+
onLongPress
|
|
1025
1022
|
};
|
|
1026
1023
|
const snapBack = useCallback(() => {
|
|
1027
1024
|
moveOffset.value = 0;
|
|
@@ -1084,16 +1081,12 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1084
1081
|
dwellTimer.current = null;
|
|
1085
1082
|
}
|
|
1086
1083
|
}, []);
|
|
1087
|
-
const releaseEdge =
|
|
1088
|
-
disarmEdge();
|
|
1089
|
-
edgePaging?.lockScroll(false);
|
|
1090
|
-
}, [disarmEdge, edgePaging]);
|
|
1084
|
+
const releaseEdge = disarmEdge;
|
|
1091
1085
|
const armEdge = useCallback((dir) => {
|
|
1092
1086
|
disarmEdge();
|
|
1093
|
-
|
|
1087
|
+
const fire = () => {
|
|
1094
1088
|
dwellTimer.current = null;
|
|
1095
1089
|
if (!edgePaging) return;
|
|
1096
|
-
edgePaging.lockScroll(true);
|
|
1097
1090
|
if (!lifted.value) {
|
|
1098
1091
|
lifted.value = 1;
|
|
1099
1092
|
edgePaging.ghostW.value = width;
|
|
@@ -1104,7 +1097,9 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1104
1097
|
edgePaging.beginLift(latest.current.event);
|
|
1105
1098
|
}
|
|
1106
1099
|
onEdgeAdvance?.(dir);
|
|
1107
|
-
|
|
1100
|
+
dwellTimer.current = setTimeout(fire, EDGE_REPEAT_MS);
|
|
1101
|
+
};
|
|
1102
|
+
dwellTimer.current = setTimeout(fire, EDGE_DWELL_MS);
|
|
1108
1103
|
}, [
|
|
1109
1104
|
disarmEdge,
|
|
1110
1105
|
edgePaging,
|
|
@@ -1224,55 +1219,87 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1224
1219
|
disarmEdge,
|
|
1225
1220
|
releaseEdge
|
|
1226
1221
|
]);
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
})
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1222
|
+
const handlePress = useCallback(() => {
|
|
1223
|
+
const { event, onPress: press } = latest.current;
|
|
1224
|
+
press(event);
|
|
1225
|
+
}, []);
|
|
1226
|
+
const canLongPress = !canMove && onLongPress != null;
|
|
1227
|
+
const handleLongPressFromHandle = useCallback(() => {
|
|
1228
|
+
const { event, onLongPress: press } = latest.current;
|
|
1229
|
+
press?.(event);
|
|
1230
|
+
}, []);
|
|
1231
|
+
const resizeGesture = useMemo(() => {
|
|
1232
|
+
const pan = Gesture.Pan().enabled(resizable).onStart(() => {
|
|
1233
|
+
dragZ.value = DRAG_EVENT_Z;
|
|
1234
|
+
runOnJS(notifyDragStart)();
|
|
1235
|
+
}).onUpdate((event) => {
|
|
1236
|
+
resizeDelta.value = event.translationY;
|
|
1237
|
+
}).onEnd((event) => {
|
|
1238
|
+
const delta = snapDeltaMinutes(event.translationY, cellHeight.value, snapMinutes);
|
|
1239
|
+
if (delta === 0) {
|
|
1240
|
+
resizeDelta.value = 0;
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
1244
|
+
runOnJS(commitDrag)(0, delta);
|
|
1245
|
+
}).onFinalize(() => {
|
|
1246
|
+
dragZ.value = 0;
|
|
1247
|
+
});
|
|
1248
|
+
const tap = Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1249
|
+
if (success) handlePress();
|
|
1250
|
+
});
|
|
1251
|
+
const longPress = Gesture.LongPress().enabled(canLongPress).runOnJS(true).onStart(() => {
|
|
1252
|
+
handleLongPressFromHandle();
|
|
1253
|
+
});
|
|
1254
|
+
return Gesture.Race(pan, tap, longPress);
|
|
1255
|
+
}, [
|
|
1243
1256
|
resizable,
|
|
1244
1257
|
snapMinutes,
|
|
1245
1258
|
cellHeight,
|
|
1246
1259
|
resizeDelta,
|
|
1247
1260
|
dragZ,
|
|
1248
1261
|
commitDrag,
|
|
1249
|
-
notifyDragStart
|
|
1262
|
+
notifyDragStart,
|
|
1263
|
+
handlePress,
|
|
1264
|
+
canLongPress,
|
|
1265
|
+
handleLongPressFromHandle
|
|
1250
1266
|
]);
|
|
1251
|
-
const resizeStartGesture = useMemo(() =>
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
+
const resizeStartGesture = useMemo(() => {
|
|
1268
|
+
const pan = Gesture.Pan().enabled(resizableFromStart).onStart(() => {
|
|
1269
|
+
dragZ.value = DRAG_EVENT_Z;
|
|
1270
|
+
runOnJS(notifyDragStart)();
|
|
1271
|
+
}).onUpdate((event) => {
|
|
1272
|
+
resizeStartDelta.value = event.translationY;
|
|
1273
|
+
}).onEnd((event) => {
|
|
1274
|
+
const delta = snapDeltaMinutes(event.translationY, cellHeight.value, snapMinutes);
|
|
1275
|
+
if (delta === 0) {
|
|
1276
|
+
resizeStartDelta.value = 0;
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
resizeStartDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
1280
|
+
runOnJS(commitDrag)(delta, 0);
|
|
1281
|
+
}).onFinalize(() => {
|
|
1282
|
+
dragZ.value = 0;
|
|
1283
|
+
});
|
|
1284
|
+
const tap = Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1285
|
+
if (success) handlePress();
|
|
1286
|
+
});
|
|
1287
|
+
const longPress = Gesture.LongPress().enabled(canLongPress).runOnJS(true).onStart(() => {
|
|
1288
|
+
handleLongPressFromHandle();
|
|
1289
|
+
});
|
|
1290
|
+
return Gesture.Race(pan, tap, longPress);
|
|
1291
|
+
}, [
|
|
1267
1292
|
resizableFromStart,
|
|
1268
1293
|
snapMinutes,
|
|
1269
1294
|
cellHeight,
|
|
1270
1295
|
resizeStartDelta,
|
|
1271
1296
|
dragZ,
|
|
1272
1297
|
commitDrag,
|
|
1273
|
-
notifyDragStart
|
|
1298
|
+
notifyDragStart,
|
|
1299
|
+
handlePress,
|
|
1300
|
+
canLongPress,
|
|
1301
|
+
handleLongPressFromHandle
|
|
1274
1302
|
]);
|
|
1275
|
-
const handlePress = () => onPress(positioned.event);
|
|
1276
1303
|
const handleLongPress = !canMove && onLongPress ? () => onLongPress(positioned.event) : void 0;
|
|
1277
1304
|
const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
|
|
1278
1305
|
const pageUnit = mode === "week" ? "week" : daysPerPage === 1 ? "day" : `${daysPerPage} day${daysPerPage === 1 ? "" : "s"}`;
|
|
@@ -1332,11 +1359,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1332
1359
|
});
|
|
1333
1360
|
const box = /* @__PURE__ */ jsxs(Animated.View, {
|
|
1334
1361
|
...eventSlot,
|
|
1335
|
-
style: [
|
|
1336
|
-
eventSlot.style,
|
|
1337
|
-
boxStyle,
|
|
1338
|
-
hiddenForMove ? { opacity: 0 } : null
|
|
1339
|
-
],
|
|
1362
|
+
style: [eventSlot.style, boxStyle],
|
|
1340
1363
|
children: [
|
|
1341
1364
|
/* @__PURE__ */ jsx(RenderEventComponent, {
|
|
1342
1365
|
event: positioned.event,
|
|
@@ -1352,6 +1375,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1352
1375
|
resizableFromStart ? /* @__PURE__ */ jsx(GestureDetector, {
|
|
1353
1376
|
gesture: resizeStartGesture,
|
|
1354
1377
|
children: /* @__PURE__ */ jsx(Animated.View, {
|
|
1378
|
+
testID: "resize-handle-top",
|
|
1355
1379
|
style: styles$1.resizeHandleTop,
|
|
1356
1380
|
children: showDragHandle ? /* @__PURE__ */ jsx(View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
1357
1381
|
})
|
|
@@ -1359,6 +1383,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1359
1383
|
resizable ? /* @__PURE__ */ jsx(GestureDetector, {
|
|
1360
1384
|
gesture: resizeGesture,
|
|
1361
1385
|
children: /* @__PURE__ */ jsx(Animated.View, {
|
|
1386
|
+
testID: "resize-handle",
|
|
1362
1387
|
style: styles$1.resizeHandle,
|
|
1363
1388
|
children: showDragHandle ? /* @__PURE__ */ jsx(View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
1364
1389
|
})
|
|
@@ -1384,53 +1409,119 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1384
1409
|
slotProps: slot("event", { themed: theme.containers.timeGridEvent })
|
|
1385
1410
|
}) : null] });
|
|
1386
1411
|
}
|
|
1387
|
-
const
|
|
1412
|
+
const AnimatedEventBox = memo(AnimatedEventBoxInner);
|
|
1413
|
+
const hourRange = (minHour, maxHour) => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index);
|
|
1414
|
+
const HourLabel = ({ hour, width, label, ampm, hourComponent }) => {
|
|
1388
1415
|
const theme = useCalendarTheme();
|
|
1389
1416
|
const slot = useSlots();
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
}) : /* @__PURE__ */ jsx(Text, {
|
|
1401
|
-
...slot("hourLabel", {
|
|
1402
|
-
base: [styles$1.hourLabel, { width: hourColumnWidth }],
|
|
1403
|
-
themed: [theme.text.hourLabel, { color: theme.colors.textMuted }]
|
|
1404
|
-
}),
|
|
1405
|
-
allowFontScaling: false,
|
|
1406
|
-
children: label
|
|
1407
|
-
}), /* @__PURE__ */ jsx(View, { ...slot("gridLines", {
|
|
1408
|
-
base: styles$1.hourLine,
|
|
1409
|
-
themed: { backgroundColor: theme.colors.gridLine }
|
|
1410
|
-
}) })]
|
|
1417
|
+
return hourComponent ? /* @__PURE__ */ jsx(View, {
|
|
1418
|
+
style: { width },
|
|
1419
|
+
children: hourComponent(hour, ampm)
|
|
1420
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
1421
|
+
...slot("hourLabel", {
|
|
1422
|
+
base: [styles$1.hourLabel, { width }],
|
|
1423
|
+
themed: [theme.text.hourLabel, { color: theme.colors.textMuted }]
|
|
1424
|
+
}),
|
|
1425
|
+
allowFontScaling: false,
|
|
1426
|
+
children: label
|
|
1411
1427
|
});
|
|
1412
1428
|
};
|
|
1413
|
-
const
|
|
1429
|
+
const HourLines = memo(function HourLines({ hours, timeslots }) {
|
|
1414
1430
|
const theme = useCalendarTheme();
|
|
1415
1431
|
const slot = useSlots();
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1418
|
-
minHour,
|
|
1419
|
-
fraction
|
|
1420
|
-
]);
|
|
1421
|
-
const lineSlot = slot("gridLines", {
|
|
1422
|
-
base: [
|
|
1423
|
-
styles$1.timeslotLine,
|
|
1424
|
-
styles$1.nonInteractive,
|
|
1425
|
-
{ left: hourColumnWidth }
|
|
1426
|
-
],
|
|
1432
|
+
const hourLineSlot = slot("gridLines", {
|
|
1433
|
+
base: [styles$1.hourLine, styles$1.nonInteractive],
|
|
1427
1434
|
themed: { backgroundColor: theme.colors.gridLine }
|
|
1428
1435
|
});
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1436
|
+
const timeslotLineSlot = slot("gridLines", {
|
|
1437
|
+
base: [styles$1.timeslotLine, styles$1.nonInteractive],
|
|
1438
|
+
themed: { backgroundColor: theme.colors.gridLine }
|
|
1439
|
+
});
|
|
1440
|
+
return /* @__PURE__ */ jsx(View, {
|
|
1441
|
+
style: [styles$1.fill, styles$1.nonInteractive],
|
|
1442
|
+
children: hours.map((hour) => /* @__PURE__ */ jsx(View, {
|
|
1443
|
+
style: styles$1.hourCell,
|
|
1444
|
+
children: Array.from({ length: Math.max(1, timeslots) }, (_, slotIndex) => /* @__PURE__ */ jsx(View, {
|
|
1445
|
+
style: styles$1.hourCell,
|
|
1446
|
+
children: /* @__PURE__ */ jsx(View, { ...slotIndex === 0 ? hourLineSlot : timeslotLineSlot })
|
|
1447
|
+
}, slotIndex))
|
|
1448
|
+
}, hour))
|
|
1449
|
+
});
|
|
1450
|
+
});
|
|
1451
|
+
const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scrollY, showLane, showAllDayLabel, headerHeight, weekNumber, ampm, hourComponent }) => {
|
|
1452
|
+
const theme = useCalendarTheme();
|
|
1453
|
+
const slot = useSlots();
|
|
1454
|
+
const hours = useMemo(() => hourRange(minHour, maxHour), [minHour, maxHour]);
|
|
1455
|
+
const laneCellHeightStyle = useAnimatedStyle(() => ({ height: laneHeight.value }));
|
|
1456
|
+
const pinStyle = useAnimatedStyle(() => ({ transform: [{ translateY: scrollY.value }] }));
|
|
1457
|
+
const rowsStyle = useAnimatedStyle(() => ({
|
|
1458
|
+
top: headerHeight + laneHeight.value + HOUR_LABEL_TOP_INSET,
|
|
1459
|
+
height: (maxHour - minHour) * cellHeight.value
|
|
1460
|
+
}), [
|
|
1461
|
+
minHour,
|
|
1462
|
+
maxHour,
|
|
1463
|
+
headerHeight
|
|
1464
|
+
]);
|
|
1465
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
1466
|
+
testID: "hour-gutter",
|
|
1467
|
+
...slot("hourGutter", { base: [styles$1.hourGutter, { width }] }),
|
|
1468
|
+
children: [
|
|
1469
|
+
headerHeight > 0 ? /* @__PURE__ */ jsx(Animated.View, {
|
|
1470
|
+
style: [
|
|
1471
|
+
styles$1.gutterCorner,
|
|
1472
|
+
{
|
|
1473
|
+
height: headerHeight,
|
|
1474
|
+
backgroundColor: theme.colors.surface,
|
|
1475
|
+
borderBottomColor: theme.colors.gridLine
|
|
1476
|
+
},
|
|
1477
|
+
pinStyle
|
|
1478
|
+
],
|
|
1479
|
+
children: weekNumber ? /* @__PURE__ */ jsx(Text, {
|
|
1480
|
+
...slot("weekNumber", { themed: [theme.text.hourLabel, { color: theme.colors.textMuted }] }),
|
|
1481
|
+
allowFontScaling: false,
|
|
1482
|
+
children: weekNumber
|
|
1483
|
+
}) : null
|
|
1484
|
+
}) : null,
|
|
1485
|
+
showLane ? /* @__PURE__ */ jsx(Animated.View, {
|
|
1486
|
+
style: [
|
|
1487
|
+
styles$1.laneCell,
|
|
1488
|
+
{ top: headerHeight },
|
|
1489
|
+
{
|
|
1490
|
+
backgroundColor: theme.colors.surface,
|
|
1491
|
+
borderBottomColor: theme.colors.gridLine
|
|
1492
|
+
},
|
|
1493
|
+
laneCellHeightStyle,
|
|
1494
|
+
pinStyle
|
|
1495
|
+
],
|
|
1496
|
+
children: showAllDayLabel ? /* @__PURE__ */ jsx(Text, {
|
|
1497
|
+
...slot("allDayLabel", {
|
|
1498
|
+
base: styles$1.allDayLabel,
|
|
1499
|
+
themed: { color: theme.colors.textMuted }
|
|
1500
|
+
}),
|
|
1501
|
+
allowFontScaling: false,
|
|
1502
|
+
children: "all-day"
|
|
1503
|
+
}) : null
|
|
1504
|
+
}) : null,
|
|
1505
|
+
/* @__PURE__ */ jsx(Animated.View, {
|
|
1506
|
+
style: [styles$1.gutterRows, rowsStyle],
|
|
1507
|
+
children: hours.map((hour) => /* @__PURE__ */ jsx(View, {
|
|
1508
|
+
style: styles$1.hourCell,
|
|
1509
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
1510
|
+
style: [styles$1.hourRow, styles$1.nonInteractive],
|
|
1511
|
+
children: /* @__PURE__ */ jsx(HourLabel, {
|
|
1512
|
+
hour,
|
|
1513
|
+
width,
|
|
1514
|
+
label: formatHour(hour, { ampm }),
|
|
1515
|
+
ampm,
|
|
1516
|
+
hourComponent
|
|
1517
|
+
})
|
|
1518
|
+
})
|
|
1519
|
+
}, hour))
|
|
1520
|
+
})
|
|
1521
|
+
]
|
|
1432
1522
|
});
|
|
1433
1523
|
};
|
|
1524
|
+
const HourGutter = memo(HourGutterInner);
|
|
1434
1525
|
const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) => {
|
|
1435
1526
|
const theme = useCalendarTheme();
|
|
1436
1527
|
const slot = useSlots();
|
|
@@ -1451,7 +1542,7 @@ const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) =>
|
|
|
1451
1542
|
style: [lineSlot.style, animatedStyle]
|
|
1452
1543
|
});
|
|
1453
1544
|
};
|
|
1454
|
-
const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color, slotName = "businessHours", testID = "business-hours-shade", children }) => {
|
|
1545
|
+
const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color, slotName = "businessHours", testID = "business-hours-shade", interactive = false, children }) => {
|
|
1455
1546
|
const slot = useSlots();
|
|
1456
1547
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
1457
1548
|
top: (startHour - minHour) * cellHeight.value,
|
|
@@ -1464,7 +1555,7 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
1464
1555
|
const bandSlot = slot(slotName, {
|
|
1465
1556
|
base: [
|
|
1466
1557
|
styles$1.shadeBand,
|
|
1467
|
-
styles$1.nonInteractive,
|
|
1558
|
+
interactive ? styles$1.passThrough : styles$1.nonInteractive,
|
|
1468
1559
|
{
|
|
1469
1560
|
left,
|
|
1470
1561
|
width
|
|
@@ -1474,56 +1565,46 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
1474
1565
|
});
|
|
1475
1566
|
return /* @__PURE__ */ jsx(Animated.View, {
|
|
1476
1567
|
testID,
|
|
1477
|
-
accessibilityElementsHidden:
|
|
1478
|
-
importantForAccessibility: "no-hide-descendants",
|
|
1568
|
+
accessibilityElementsHidden: !interactive,
|
|
1569
|
+
importantForAccessibility: interactive ? "auto" : "no-hide-descendants",
|
|
1479
1570
|
...bandSlot,
|
|
1480
1571
|
style: [bandSlot.style, animatedStyle],
|
|
1481
1572
|
children
|
|
1482
1573
|
});
|
|
1483
1574
|
};
|
|
1484
|
-
function
|
|
1575
|
+
function BackgroundEventBand({ event, cellHeight, startHour, endHour, minHour, left, width, mode, continuesBefore, continuesAfter, render: Render, onPress, onLongPress }) {
|
|
1576
|
+
const boxHeight = useDerivedValue(() => (endHour - startHour) * cellHeight.value, [
|
|
1577
|
+
startHour,
|
|
1578
|
+
endHour,
|
|
1579
|
+
cellHeight
|
|
1580
|
+
]);
|
|
1581
|
+
const handlePress = useCallback(() => onPress(event), [onPress, event]);
|
|
1582
|
+
const handleLongPress = useCallback(() => onLongPress?.(event), [onLongPress, event]);
|
|
1583
|
+
return /* @__PURE__ */ jsx(ShadeBand, {
|
|
1584
|
+
cellHeight,
|
|
1585
|
+
startHour,
|
|
1586
|
+
endHour,
|
|
1587
|
+
minHour,
|
|
1588
|
+
left,
|
|
1589
|
+
width,
|
|
1590
|
+
slotName: "backgroundEvent",
|
|
1591
|
+
testID: "background-event-shade",
|
|
1592
|
+
interactive: true,
|
|
1593
|
+
children: /* @__PURE__ */ jsx(Render, {
|
|
1594
|
+
event,
|
|
1595
|
+
mode,
|
|
1596
|
+
boxHeight,
|
|
1597
|
+
continuesBefore,
|
|
1598
|
+
continuesAfter,
|
|
1599
|
+
onPress: handlePress,
|
|
1600
|
+
onLongPress: onLongPress ? handleLongPress : void 0
|
|
1601
|
+
})
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, committedCellHeight, isActive, weekStartsOn, weekEndsOn, width, minHour, maxHour, timeslots, isRTL, highlightWeekends, calendarCellStyle, showNowIndicator, businessHours, renderBusinessHours, renderBackgroundEvent, renderEvent, keyExtractor, snapMinutes, minEventHeight, eventGap, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, pageIndex, laneHeight, scrollY, showAllDayEventCell, onLaneLayout, height, pagedHeader, weekdayFormat, locale, activeDate, onPressDateHeader }) {
|
|
1485
1605
|
const theme = useCalendarTheme();
|
|
1486
1606
|
const slot = useSlots();
|
|
1487
|
-
const scrollRef = useAnimatedRef();
|
|
1488
|
-
const gridTopRef = useRef(0);
|
|
1489
|
-
useEffect(() => {
|
|
1490
|
-
if (isActive) onGridTop?.(gridTopRef.current);
|
|
1491
|
-
}, [isActive, onGridTop]);
|
|
1492
1607
|
const heightSource = isActive ? cellHeight : committedCellHeight;
|
|
1493
|
-
const isDragging = useSharedValue(false);
|
|
1494
|
-
const isActiveShared = useSharedValue(isActive);
|
|
1495
|
-
useEffect(() => {
|
|
1496
|
-
isActiveShared.value = isActive;
|
|
1497
|
-
}, [isActive, isActiveShared]);
|
|
1498
|
-
const scrollHandler = useAnimatedScrollHandler({
|
|
1499
|
-
onScroll: (event) => {
|
|
1500
|
-
if (isActiveShared.value && isDragging.value) scrollY.value = event.contentOffset.y;
|
|
1501
|
-
},
|
|
1502
|
-
onBeginDrag: () => {
|
|
1503
|
-
isDragging.value = true;
|
|
1504
|
-
},
|
|
1505
|
-
onEndDrag: (event) => {
|
|
1506
|
-
isDragging.value = false;
|
|
1507
|
-
if (!isWeb$1 && isActiveShared.value) {
|
|
1508
|
-
scrollY.value = event.contentOffset.y;
|
|
1509
|
-
runOnJS(onSettleOffset)(event.contentOffset.y);
|
|
1510
|
-
}
|
|
1511
|
-
},
|
|
1512
|
-
onMomentumEnd: (event) => {
|
|
1513
|
-
isDragging.value = false;
|
|
1514
|
-
if (!isWeb$1 && isActiveShared.value) {
|
|
1515
|
-
scrollY.value = event.contentOffset.y;
|
|
1516
|
-
runOnJS(onSettleOffset)(event.contentOffset.y);
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
});
|
|
1520
|
-
useAnimatedReaction(() => scrollY.value, (current, previous) => {
|
|
1521
|
-
if (!isActiveShared.value && current !== previous) scrollTo(scrollRef, 0, current, false);
|
|
1522
|
-
});
|
|
1523
|
-
useAnimatedReaction(() => isActiveShared.value, (active, previous) => {
|
|
1524
|
-
if (isWeb$1 || !active || active === previous) return;
|
|
1525
|
-
scrollTo(scrollRef, 0, scrollY.value, false);
|
|
1526
|
-
});
|
|
1527
1608
|
const days = useMemo(() => getViewDays$1(mode, date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
|
|
1528
1609
|
mode,
|
|
1529
1610
|
date,
|
|
@@ -1535,8 +1616,8 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1535
1616
|
]);
|
|
1536
1617
|
const daysPerPage = pageStepDays(mode, date, weekStartsOn, numberOfDays);
|
|
1537
1618
|
const dayCount = days.length;
|
|
1538
|
-
const dayWidth =
|
|
1539
|
-
const dayLeft = (dayIndex) =>
|
|
1619
|
+
const dayWidth = width / dayCount;
|
|
1620
|
+
const dayLeft = (dayIndex) => dayIndex * dayWidth;
|
|
1540
1621
|
const dayOrdinals = useMemo(() => days.map((day) => differenceInCalendarDays(day, days[0])), [days]);
|
|
1541
1622
|
const dayLayouts = useMemo(() => days.map((day) => layoutDayEvents$1(events, day)), [days, events]);
|
|
1542
1623
|
const [multiDayMove, setMultiDayMove] = useState(null);
|
|
@@ -1563,7 +1644,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1563
1644
|
const date = onLongPressCell && cellDateFromTouch(event);
|
|
1564
1645
|
if (date) onLongPressCell?.(date);
|
|
1565
1646
|
};
|
|
1566
|
-
const hoursRange = useMemo(() =>
|
|
1647
|
+
const hoursRange = useMemo(() => hourRange(minHour, maxHour), [minHour, maxHour]);
|
|
1567
1648
|
const now = useNow$1(showNowIndicator && isActive, {
|
|
1568
1649
|
now: nowProp,
|
|
1569
1650
|
timeZone: nowTimeZone
|
|
@@ -1576,23 +1657,24 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1576
1657
|
maxHour,
|
|
1577
1658
|
heightSource
|
|
1578
1659
|
]);
|
|
1579
|
-
const
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
return Gesture.Simultaneous(pinch, Gesture.Native());
|
|
1589
|
-
}, [
|
|
1590
|
-
cellHeight,
|
|
1591
|
-
committedCellHeight,
|
|
1592
|
-
pinchStartCellHeight,
|
|
1593
|
-
minHourHeight,
|
|
1594
|
-
maxHourHeight
|
|
1660
|
+
const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
|
|
1661
|
+
const gridStyle = useAnimatedStyle(() => ({
|
|
1662
|
+
top: headerOffset + laneHeight.value + HOUR_LABEL_TOP_INSET,
|
|
1663
|
+
height: (maxHour - minHour) * heightSource.value
|
|
1664
|
+
}), [
|
|
1665
|
+
minHour,
|
|
1666
|
+
maxHour,
|
|
1667
|
+
heightSource,
|
|
1668
|
+
headerOffset
|
|
1595
1669
|
]);
|
|
1670
|
+
const laneHeightStyle = useAnimatedStyle(() => ({
|
|
1671
|
+
height: Math.max(LANE_BAND_FLOOR, laneHeight.value),
|
|
1672
|
+
borderBottomWidth: laneHeight.value >= LANE_BAND_FLOOR ? StyleSheet.hairlineWidth : 0
|
|
1673
|
+
}));
|
|
1674
|
+
const pinStyle = useAnimatedStyle(() => ({ transform: [{ translateY: scrollY.value }] }));
|
|
1675
|
+
const reportLaneLayout = useCallback((event) => {
|
|
1676
|
+
onLaneLayout(pageIndex, event.nativeEvent.layout.height);
|
|
1677
|
+
}, [onLaneLayout, pageIndex]);
|
|
1596
1678
|
const createEnabled = onCreateEvent != null;
|
|
1597
1679
|
const createActive = useSharedValue(0);
|
|
1598
1680
|
const createTop = useSharedValue(0);
|
|
@@ -1635,7 +1717,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1635
1717
|
const idx = dayCount === 1 ? 0 : Math.floor(event.x / dayWidth);
|
|
1636
1718
|
createDayIndex.value = idx;
|
|
1637
1719
|
createStartY.value = event.y;
|
|
1638
|
-
createLeft.value =
|
|
1720
|
+
createLeft.value = idx * dayWidth;
|
|
1639
1721
|
createWidth.value = dayWidth;
|
|
1640
1722
|
createTop.value = event.y;
|
|
1641
1723
|
createHeight.value = 0;
|
|
@@ -1660,7 +1742,6 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1660
1742
|
createEnabled,
|
|
1661
1743
|
dayCount,
|
|
1662
1744
|
dayWidth,
|
|
1663
|
-
hourColumnWidth,
|
|
1664
1745
|
heightSource,
|
|
1665
1746
|
snapMinutes,
|
|
1666
1747
|
commitCreate,
|
|
@@ -1722,7 +1803,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1722
1803
|
}
|
|
1723
1804
|
});
|
|
1724
1805
|
const cellLayer = onPressCell || onLongPressCell || createEnabled ? /* @__PURE__ */ jsx(Pressable, {
|
|
1725
|
-
style:
|
|
1806
|
+
style: styles$1.cellPressLayer,
|
|
1726
1807
|
onPress: onPressCell ? handleBackgroundPress : void 0,
|
|
1727
1808
|
onLongPress: !createEnabled && onLongPressCell ? handleBackgroundLongPress : void 0,
|
|
1728
1809
|
tabIndex: -1,
|
|
@@ -1730,201 +1811,234 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1730
1811
|
accessibilityElementsHidden: true
|
|
1731
1812
|
}) : null;
|
|
1732
1813
|
return /* @__PURE__ */ jsxs(View, {
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1814
|
+
testID: "time-grid-page",
|
|
1815
|
+
style: [styles$1.page, {
|
|
1816
|
+
width,
|
|
1817
|
+
height
|
|
1818
|
+
}],
|
|
1819
|
+
accessibilityElementsHidden: !isActive,
|
|
1820
|
+
importantForAccessibility: isActive ? "auto" : "no-hide-descendants",
|
|
1821
|
+
children: [
|
|
1822
|
+
pagedHeader ? /* @__PURE__ */ jsx(Animated.View, {
|
|
1823
|
+
testID: "paged-header",
|
|
1824
|
+
style: [
|
|
1825
|
+
styles$1.pagedHeader,
|
|
1826
|
+
{
|
|
1827
|
+
backgroundColor: theme.colors.surface,
|
|
1828
|
+
borderBottomColor: theme.colors.gridLine
|
|
1829
|
+
},
|
|
1830
|
+
pinStyle
|
|
1831
|
+
],
|
|
1832
|
+
children: /* @__PURE__ */ jsx(DayHeaderRow, {
|
|
1833
|
+
days,
|
|
1834
|
+
mode,
|
|
1835
|
+
dayWidth,
|
|
1836
|
+
weekdayFormat,
|
|
1837
|
+
locale,
|
|
1838
|
+
activeDate,
|
|
1839
|
+
onPressDateHeader
|
|
1840
|
+
})
|
|
1841
|
+
}) : null,
|
|
1842
|
+
showAllDayEventCell ? /* @__PURE__ */ jsx(Animated.View, {
|
|
1843
|
+
testID: "all-day-band",
|
|
1844
|
+
style: [
|
|
1845
|
+
styles$1.laneBand,
|
|
1846
|
+
{
|
|
1847
|
+
top: headerOffset,
|
|
1848
|
+
backgroundColor: theme.colors.surface,
|
|
1849
|
+
borderBottomColor: theme.colors.gridLine
|
|
1850
|
+
},
|
|
1851
|
+
laneHeightStyle,
|
|
1852
|
+
pinStyle
|
|
1853
|
+
],
|
|
1854
|
+
children: /* @__PURE__ */ jsx(AllDayLane, {
|
|
1855
|
+
days,
|
|
1856
|
+
events,
|
|
1857
|
+
mode,
|
|
1858
|
+
dayWidth,
|
|
1859
|
+
renderEvent,
|
|
1860
|
+
keyExtractor,
|
|
1861
|
+
onPressEvent,
|
|
1862
|
+
onLongPressEvent,
|
|
1863
|
+
onLayout: reportLaneLayout
|
|
1864
|
+
})
|
|
1865
|
+
}) : null,
|
|
1866
|
+
/* @__PURE__ */ jsxs(Animated.View, {
|
|
1867
|
+
style: [styles$1.grid, gridStyle],
|
|
1868
|
+
children: [
|
|
1869
|
+
cellLayer && backgroundGesture ? /* @__PURE__ */ jsx(GestureDetector, {
|
|
1870
|
+
gesture: backgroundGesture,
|
|
1871
|
+
children: cellLayer
|
|
1872
|
+
}) : cellLayer,
|
|
1873
|
+
days.map((day, dayIndex) => {
|
|
1874
|
+
if (!highlightWeekends || !isWeekend$1(day)) return null;
|
|
1875
|
+
const shadeSlot = slot("weekendShade", {
|
|
1876
|
+
base: [
|
|
1790
1877
|
styles$1.weekendColumn,
|
|
1791
1878
|
styles$1.nonInteractive,
|
|
1792
1879
|
{
|
|
1793
1880
|
left: dayLeft(dayIndex),
|
|
1794
1881
|
width: dayWidth
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1882
|
+
}
|
|
1883
|
+
],
|
|
1884
|
+
themed: { backgroundColor: theme.colors.weekendBackground }
|
|
1885
|
+
});
|
|
1886
|
+
return /* @__PURE__ */ jsx(Animated.View, {
|
|
1887
|
+
testID: "weekend-shade",
|
|
1888
|
+
...shadeSlot,
|
|
1889
|
+
style: [shadeSlot.style, fullHeightStyle]
|
|
1890
|
+
}, `weekend-${day.toISOString()}`);
|
|
1891
|
+
}),
|
|
1892
|
+
calendarCellStyle ? days.map((day, dayIndex) => {
|
|
1893
|
+
const cellStyle = calendarCellStyle(day);
|
|
1894
|
+
return cellStyle ? /* @__PURE__ */ jsx(Animated.View, { style: [
|
|
1895
|
+
styles$1.weekendColumn,
|
|
1896
|
+
styles$1.nonInteractive,
|
|
1897
|
+
{
|
|
1898
|
+
left: dayLeft(dayIndex),
|
|
1899
|
+
width: dayWidth
|
|
1900
|
+
},
|
|
1901
|
+
cellStyle,
|
|
1902
|
+
fullHeightStyle
|
|
1903
|
+
] }, `cell-${day.toISOString()}`) : null;
|
|
1904
|
+
}) : null,
|
|
1905
|
+
businessHours ? days.flatMap((day, dayIndex) => closedHourBands(day, businessHours, minHour, maxHour).map((band, bandIndex) => /* @__PURE__ */ jsx(ShadeBand, {
|
|
1906
|
+
cellHeight: heightSource,
|
|
1907
|
+
startHour: band.start,
|
|
1908
|
+
endHour: band.end,
|
|
1909
|
+
minHour,
|
|
1910
|
+
left: dayLeft(dayIndex),
|
|
1911
|
+
width: dayWidth,
|
|
1912
|
+
color: renderBusinessHours ? void 0 : theme.colors.outsideHoursBackground,
|
|
1913
|
+
children: renderBusinessHours?.({
|
|
1914
|
+
date: day,
|
|
1915
|
+
start: band.start,
|
|
1916
|
+
end: band.end
|
|
1917
|
+
})
|
|
1918
|
+
}, `closed-${day.toISOString()}-${bandIndex}`))) : null,
|
|
1919
|
+
days.flatMap((day, dayIndex) => {
|
|
1920
|
+
const dayStart = startOfDay(day);
|
|
1921
|
+
const nextDayStart = addDays(dayStart, 1);
|
|
1922
|
+
return backgroundBandsForDay$1(events, day).map((b) => ({
|
|
1815
1923
|
...b,
|
|
1816
1924
|
startHours: Math.max(b.startHours, minHour),
|
|
1817
1925
|
endHours: Math.min(b.endHours, maxHour)
|
|
1818
|
-
})).filter((b) => b.endHours > b.startHours).map((b, bandIndex) =>
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
minHour,
|
|
1823
|
-
left: dayLeft(dayIndex),
|
|
1824
|
-
width: dayWidth,
|
|
1825
|
-
color: theme.colors.backgroundEvent,
|
|
1826
|
-
slotName: "backgroundEvent",
|
|
1827
|
-
testID: "background-event-shade"
|
|
1828
|
-
}, `bg-${day.toISOString()}-${bandIndex}`))),
|
|
1829
|
-
days.map((day, dayIndex) => {
|
|
1830
|
-
const separatorSlot = slot("daySeparator", {
|
|
1831
|
-
base: [
|
|
1832
|
-
styles$1.daySeparator,
|
|
1833
|
-
styles$1.nonInteractive,
|
|
1834
|
-
{ left: dayLeft(dayIndex) }
|
|
1835
|
-
],
|
|
1836
|
-
themed: { backgroundColor: theme.colors.gridLine }
|
|
1837
|
-
});
|
|
1838
|
-
return /* @__PURE__ */ jsx(Animated.View, {
|
|
1839
|
-
...separatorSlot,
|
|
1840
|
-
style: [separatorSlot.style, fullHeightStyle]
|
|
1841
|
-
}, `separator-${day.toISOString()}`);
|
|
1842
|
-
}),
|
|
1843
|
-
hoursRange.map((hour) => /* @__PURE__ */ jsx(HourRow, {
|
|
1844
|
-
hour,
|
|
1845
|
-
minHour,
|
|
1846
|
-
cellHeight: heightSource,
|
|
1847
|
-
hourColumnWidth,
|
|
1848
|
-
label: formatHour(hour, { ampm }),
|
|
1849
|
-
ampm,
|
|
1850
|
-
hourComponent
|
|
1851
|
-
}, hour)),
|
|
1852
|
-
timeslots > 1 ? hoursRange.flatMap((hour) => Array.from({ length: timeslots - 1 }, (_, i) => /* @__PURE__ */ jsx(TimeslotLine, {
|
|
1853
|
-
hour,
|
|
1854
|
-
minHour,
|
|
1855
|
-
fraction: (i + 1) / timeslots,
|
|
1856
|
-
cellHeight: heightSource,
|
|
1857
|
-
hourColumnWidth
|
|
1858
|
-
}, `slot-${hour}-${i}`))) : null,
|
|
1859
|
-
dayLayouts.flatMap((layout, dayIndex) => layout.filter((p) => p.startHours < maxHour && p.startHours + p.durationHours > minHour).map((positioned, eventIndex) => {
|
|
1860
|
-
const columnWidth = dayWidth / positioned.columns;
|
|
1861
|
-
return /* @__PURE__ */ jsx(AnimatedEventBox, {
|
|
1862
|
-
positioned,
|
|
1863
|
-
eventIndex: events.indexOf(positioned.event),
|
|
1864
|
-
movingEvent,
|
|
1865
|
-
onMovePreview: setMultiDayMove,
|
|
1926
|
+
})).filter((b) => b.endHours > b.startHours).map((b, bandIndex) => {
|
|
1927
|
+
const key = `bg-${day.toISOString()}-${keyExtractor(b.event, bandIndex)}`;
|
|
1928
|
+
return renderBackgroundEvent ? /* @__PURE__ */ jsx(BackgroundEventBand, {
|
|
1929
|
+
event: b.event,
|
|
1866
1930
|
cellHeight: heightSource,
|
|
1931
|
+
startHour: b.startHours,
|
|
1932
|
+
endHour: b.endHours,
|
|
1867
1933
|
minHour,
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
width: columnWidth,
|
|
1871
|
-
dayLeftPx: dayLeft(dayIndex),
|
|
1872
|
-
nextDayDirection: isRTL ? -1 : 1,
|
|
1873
|
-
dayWidth,
|
|
1874
|
-
dayIndex,
|
|
1875
|
-
dayCount: days.length,
|
|
1876
|
-
dayOrdinals,
|
|
1934
|
+
left: dayLeft(dayIndex),
|
|
1935
|
+
width: dayWidth,
|
|
1877
1936
|
mode,
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
minEventHeight,
|
|
1882
|
-
eventGap,
|
|
1883
|
-
showDragHandle,
|
|
1884
|
-
eventStartEditable,
|
|
1885
|
-
eventDurationEditable,
|
|
1937
|
+
continuesBefore: b.event.start < dayStart,
|
|
1938
|
+
continuesAfter: b.event.end > nextDayStart,
|
|
1939
|
+
render: renderBackgroundEvent,
|
|
1886
1940
|
onPress: onPressEvent,
|
|
1887
|
-
onLongPress: onLongPressEvent
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1941
|
+
onLongPress: onLongPressEvent
|
|
1942
|
+
}, key) : /* @__PURE__ */ jsx(ShadeBand, {
|
|
1943
|
+
cellHeight: heightSource,
|
|
1944
|
+
startHour: b.startHours,
|
|
1945
|
+
endHour: b.endHours,
|
|
1946
|
+
minHour,
|
|
1947
|
+
left: dayLeft(dayIndex),
|
|
1948
|
+
width: dayWidth,
|
|
1949
|
+
color: theme.colors.backgroundEvent,
|
|
1950
|
+
slotName: "backgroundEvent",
|
|
1951
|
+
testID: "background-event-shade"
|
|
1952
|
+
}, key);
|
|
1953
|
+
});
|
|
1954
|
+
}),
|
|
1955
|
+
days.map((day, dayIndex) => {
|
|
1956
|
+
const separatorSlot = slot("daySeparator", {
|
|
1957
|
+
base: [
|
|
1958
|
+
styles$1.daySeparator,
|
|
1959
|
+
styles$1.nonInteractive,
|
|
1960
|
+
{ left: dayLeft(dayIndex) }
|
|
1961
|
+
],
|
|
1962
|
+
themed: { backgroundColor: theme.colors.gridLine }
|
|
1963
|
+
});
|
|
1964
|
+
return /* @__PURE__ */ jsx(Animated.View, {
|
|
1965
|
+
...separatorSlot,
|
|
1966
|
+
style: [separatorSlot.style, fullHeightStyle]
|
|
1967
|
+
}, `separator-${day.toISOString()}`);
|
|
1968
|
+
}),
|
|
1969
|
+
/* @__PURE__ */ jsx(HourLines, {
|
|
1970
|
+
hours: hoursRange,
|
|
1971
|
+
timeslots
|
|
1972
|
+
}),
|
|
1973
|
+
dayLayouts.flatMap((layout, dayIndex) => layout.filter((p) => p.startHours < maxHour && p.startHours + p.durationHours > minHour).map((positioned, eventIndex) => {
|
|
1974
|
+
const columnWidth = dayWidth / positioned.columns;
|
|
1975
|
+
return /* @__PURE__ */ jsx(AnimatedEventBox, {
|
|
1976
|
+
positioned,
|
|
1977
|
+
eventIndex: events.indexOf(positioned.event),
|
|
1978
|
+
movingEvent,
|
|
1979
|
+
onMovePreview: setMultiDayMove,
|
|
1896
1980
|
cellHeight: heightSource,
|
|
1897
|
-
dayWidth,
|
|
1898
|
-
hourColumnWidth,
|
|
1899
1981
|
minHour,
|
|
1982
|
+
maxHour,
|
|
1983
|
+
left: dayLeft(dayIndex) + positioned.column * columnWidth,
|
|
1984
|
+
width: columnWidth,
|
|
1985
|
+
dayLeftPx: dayLeft(dayIndex),
|
|
1986
|
+
nextDayDirection: isRTL ? -1 : 1,
|
|
1987
|
+
dayWidth,
|
|
1988
|
+
dayIndex,
|
|
1989
|
+
dayCount: days.length,
|
|
1990
|
+
dayOrdinals,
|
|
1900
1991
|
mode,
|
|
1992
|
+
daysPerPage,
|
|
1901
1993
|
renderEvent,
|
|
1994
|
+
snapMinutes,
|
|
1902
1995
|
minEventHeight,
|
|
1903
|
-
eventGap
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1996
|
+
eventGap,
|
|
1997
|
+
showDragHandle,
|
|
1998
|
+
eventStartEditable,
|
|
1999
|
+
eventDurationEditable,
|
|
2000
|
+
onPress: onPressEvent,
|
|
2001
|
+
onLongPress: onLongPressEvent,
|
|
2002
|
+
onDragEvent,
|
|
2003
|
+
onDragStart,
|
|
2004
|
+
onEdgeAdvance
|
|
2005
|
+
}, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
|
|
2006
|
+
})),
|
|
2007
|
+
multiDayMove ? /* @__PURE__ */ jsx(MultiDayMovePreview, {
|
|
2008
|
+
move: multiDayMove,
|
|
2009
|
+
days,
|
|
2010
|
+
cellHeight: heightSource,
|
|
2011
|
+
dayWidth,
|
|
2012
|
+
minHour,
|
|
2013
|
+
mode,
|
|
2014
|
+
renderEvent,
|
|
2015
|
+
minEventHeight,
|
|
2016
|
+
eventGap
|
|
2017
|
+
}) : null,
|
|
2018
|
+
showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ jsx(NowIndicator, {
|
|
2019
|
+
cellHeight: heightSource,
|
|
2020
|
+
nowHours,
|
|
2021
|
+
minHour,
|
|
2022
|
+
left: dayLeft(nowDayIndex),
|
|
2023
|
+
width: dayWidth,
|
|
2024
|
+
color: theme.colors.nowIndicator
|
|
2025
|
+
}) : null,
|
|
2026
|
+
createEnabled ? /* @__PURE__ */ jsx(Animated.View, {
|
|
2027
|
+
...ghostSlot,
|
|
2028
|
+
style: [ghostSlot.style, createGhostStyle]
|
|
2029
|
+
}) : null
|
|
2030
|
+
]
|
|
1919
2031
|
})
|
|
1920
|
-
|
|
2032
|
+
]
|
|
1921
2033
|
});
|
|
1922
2034
|
}
|
|
1923
2035
|
const TimetablePage = memo(TimetablePageInner);
|
|
1924
|
-
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 }) {
|
|
2036
|
+
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, showAllDayLabel = false, refreshControl, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, 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 }) {
|
|
1925
2037
|
const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
|
|
1926
2038
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
1927
2039
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
2040
|
+
const pagedHeader = renderHeader == null;
|
|
2041
|
+
const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
|
|
1928
2042
|
const labeledRenderEvent = useMemo(() => withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, ampm), [
|
|
1929
2043
|
renderEvent,
|
|
1930
2044
|
eventAccessibilityLabel,
|
|
@@ -1938,34 +2052,76 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1938
2052
|
eventOverlap,
|
|
1939
2053
|
events
|
|
1940
2054
|
]);
|
|
1941
|
-
const { width
|
|
2055
|
+
const { width } = useWindowDimensions();
|
|
1942
2056
|
const listRef = useRef(null);
|
|
1943
2057
|
const pagerRef = useRef(null);
|
|
1944
2058
|
const containerRef = useRef(null);
|
|
1945
|
-
const
|
|
1946
|
-
const
|
|
2059
|
+
const viewportRef = useRef(null);
|
|
2060
|
+
const pagerLayoutWidthRef = useRef(-1);
|
|
2061
|
+
const scrollRef = useAnimatedRef();
|
|
1947
2062
|
const [containerWidth, setContainerWidth] = useState(width);
|
|
1948
|
-
const [
|
|
2063
|
+
const [pagerLayoutWidth, setPagerLayoutWidth] = useState(null);
|
|
2064
|
+
const columnsWidth = pagerLayoutWidth ?? containerWidth - hourColumnWidth;
|
|
2065
|
+
const pagerReady = pagerLayoutWidth != null && pagerLayoutWidth > 0;
|
|
2066
|
+
const [tallestLane, setTallestLane] = useState(0);
|
|
1949
2067
|
const weekAnchored = mode === "week" || mode === "custom" && weekEndsOn != null;
|
|
1950
2068
|
const step = weekAnchored ? 7 : viewDayCount(mode, numberOfDays);
|
|
1951
2069
|
const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR$1 - clampedMinHour) * hourHeight;
|
|
1952
2070
|
const scrollY = useSharedValue(seedDefaultY);
|
|
2071
|
+
const scrollHandler = useAnimatedScrollHandler({ onScroll: (event) => {
|
|
2072
|
+
scrollY.value = event.contentOffset.y;
|
|
2073
|
+
} });
|
|
2074
|
+
const webSeededRef = useRef(!isWeb$1);
|
|
2075
|
+
const seedWebScroll = useCallback(() => {
|
|
2076
|
+
if (webSeededRef.current) return;
|
|
2077
|
+
const node = scrollRef.current;
|
|
2078
|
+
if (!node) return;
|
|
2079
|
+
node.scrollTo({
|
|
2080
|
+
y: seedDefaultY,
|
|
2081
|
+
animated: false
|
|
2082
|
+
});
|
|
2083
|
+
const dom = node.getScrollableNode();
|
|
2084
|
+
if (dom && dom.scrollHeight > dom.clientHeight) webSeededRef.current = true;
|
|
2085
|
+
}, [scrollRef, seedDefaultY]);
|
|
2086
|
+
const laneHeights = useSharedValue({});
|
|
2087
|
+
const laneHeightsRef = useRef({});
|
|
2088
|
+
const pagerOffset = useSharedValue(PAGE_WINDOW * columnsWidth);
|
|
2089
|
+
const pagerSharedValues = useMemo(() => ({ scrollOffset: pagerOffset }), [pagerOffset]);
|
|
2090
|
+
const activeIndexShared = useSharedValue(PAGE_WINDOW);
|
|
2091
|
+
const laneHeight = useDerivedValue(() => {
|
|
2092
|
+
if (!showAllDayEventCell || columnsWidth <= 0) return 0;
|
|
2093
|
+
const heights = laneHeights.value;
|
|
2094
|
+
let progress = pagerOffset.value / columnsWidth;
|
|
2095
|
+
if (Math.abs(progress - activeIndexShared.value) > 1.5) progress = activeIndexShared.value;
|
|
2096
|
+
const from = Math.floor(progress);
|
|
2097
|
+
const fraction = progress - from;
|
|
2098
|
+
const start = heights[from] ?? 0;
|
|
2099
|
+
return start + ((heights[from + 1] ?? start) - start) * fraction;
|
|
2100
|
+
}, [showAllDayEventCell, columnsWidth]);
|
|
2101
|
+
const reportLaneHeight = useCallback((index, height) => {
|
|
2102
|
+
setTallestLane((tallest) => height > tallest ? height : tallest);
|
|
2103
|
+
if (laneHeightsRef.current[index] === height) return;
|
|
2104
|
+
laneHeightsRef.current = {
|
|
2105
|
+
...laneHeightsRef.current,
|
|
2106
|
+
[index]: height
|
|
2107
|
+
};
|
|
2108
|
+
laneHeights.value = laneHeightsRef.current;
|
|
2109
|
+
}, [laneHeights]);
|
|
2110
|
+
const viewportTop = useSharedValue(0);
|
|
1953
2111
|
const pagerLeft = useSharedValue(0);
|
|
1954
|
-
const pagerTop = useSharedValue(0);
|
|
1955
2112
|
const pagerWidth = useSharedValue(width);
|
|
1956
|
-
const
|
|
2113
|
+
const pagerTop = useDerivedValue(() => viewportTop.value - scrollY.value);
|
|
1957
2114
|
const ghostX = useSharedValue(0);
|
|
1958
2115
|
const ghostY = useSharedValue(0);
|
|
1959
2116
|
const ghostW = useSharedValue(0);
|
|
1960
2117
|
const ghostH = useSharedValue(0);
|
|
1961
2118
|
const ghostVisible = useSharedValue(0);
|
|
1962
|
-
const gridTop = useSharedValue(0);
|
|
1963
2119
|
const [liftedEvent, setLiftedEvent] = useState(null);
|
|
1964
2120
|
const liftedEventRef = useRef(null);
|
|
1965
2121
|
const dropRef = useRef({
|
|
1966
2122
|
headerDays: [],
|
|
1967
|
-
|
|
1968
|
-
|
|
2123
|
+
columnsWidth,
|
|
2124
|
+
headerOffset,
|
|
1969
2125
|
minHour: clampedMinHour,
|
|
1970
2126
|
maxHour: clampedMaxHour,
|
|
1971
2127
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
@@ -1980,17 +2136,16 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1980
2136
|
ghostVisible.value = 0;
|
|
1981
2137
|
liftedEventRef.current = null;
|
|
1982
2138
|
setLiftedEvent(null);
|
|
1983
|
-
setEdgePagingLock(false);
|
|
1984
2139
|
}, [ghostVisible]);
|
|
1985
2140
|
const commitLiftedDrop = useCallback((ghostLocalX, ghostLocalY) => {
|
|
1986
|
-
const { headerDays: days,
|
|
2141
|
+
const { headerDays: days, columnsWidth: cw, headerOffset: headerH, minHour: min, maxHour: max, snapMinutes: snap, onDragEvent: onDrag, onChangeDate: onDate } = dropRef.current;
|
|
1987
2142
|
const ev = liftedEventRef.current;
|
|
1988
2143
|
const duration = ev ? ev.end.getTime() - ev.start.getTime() : 0;
|
|
1989
2144
|
clearLift();
|
|
1990
2145
|
if (!ev || !onDrag || days.length === 0) return;
|
|
1991
|
-
const dayWidth =
|
|
1992
|
-
const col = Math.min(Math.max(Math.floor(
|
|
1993
|
-
const rawMinutes = (min + (ghostLocalY -
|
|
2146
|
+
const dayWidth = cw / days.length;
|
|
2147
|
+
const col = Math.min(Math.max(Math.floor(ghostLocalX / dayWidth), 0), days.length - 1);
|
|
2148
|
+
const rawMinutes = (min + (ghostLocalY - headerH - laneHeight.value - HOUR_LABEL_TOP_INSET) / cellHeight.value) * MINUTES_PER_HOUR$1;
|
|
1994
2149
|
const minutes = clampMoveStartMinutes(Math.round(rawMinutes / snap) * snap, min, max, snap);
|
|
1995
2150
|
const start = new Date(days[col]);
|
|
1996
2151
|
start.setHours(0, 0, 0, 0);
|
|
@@ -1998,18 +2153,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1998
2153
|
if (onDrag(ev, start, new Date(start.getTime() + duration)) === false) onDate(ev.start);
|
|
1999
2154
|
}, [
|
|
2000
2155
|
clearLift,
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
cellHeight
|
|
2156
|
+
cellHeight,
|
|
2157
|
+
laneHeight
|
|
2004
2158
|
]);
|
|
2005
|
-
const handleGridTop = useCallback((y) => {
|
|
2006
|
-
gridTop.value = y;
|
|
2007
|
-
}, [gridTop]);
|
|
2008
2159
|
const edgePaging = useMemo(() => ({
|
|
2009
2160
|
pagerLeft,
|
|
2010
2161
|
pagerTop,
|
|
2011
2162
|
pagerWidth,
|
|
2012
|
-
lockScroll: setEdgePagingLock,
|
|
2013
2163
|
ghostX,
|
|
2014
2164
|
ghostY,
|
|
2015
2165
|
ghostW,
|
|
@@ -2029,11 +2179,37 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2029
2179
|
beginLift,
|
|
2030
2180
|
commitLiftedDrop
|
|
2031
2181
|
]);
|
|
2032
|
-
const offsetSeedRef = useRef(null);
|
|
2033
|
-
const captureOffsetSeed = useCallback((y) => {
|
|
2034
|
-
offsetSeedRef.current = y;
|
|
2035
|
-
}, []);
|
|
2036
2182
|
const committedCellHeight = useSharedValue(hourHeight);
|
|
2183
|
+
const pinching = useSharedValue(false);
|
|
2184
|
+
useAnimatedReaction(() => cellHeight.value, (value) => {
|
|
2185
|
+
if (!pinching.value) committedCellHeight.value = value;
|
|
2186
|
+
});
|
|
2187
|
+
const pinchStartCellHeight = useSharedValue(hourHeight);
|
|
2188
|
+
const zoomGesture = useMemo(() => {
|
|
2189
|
+
const pinch = Gesture.Pinch().onStart(() => {
|
|
2190
|
+
pinching.value = true;
|
|
2191
|
+
pinchStartCellHeight.value = cellHeight.value;
|
|
2192
|
+
}).onUpdate((event) => {
|
|
2193
|
+
cellHeight.value = Math.min(maxHourHeight, Math.max(minHourHeight, pinchStartCellHeight.value * event.scale));
|
|
2194
|
+
}).onFinalize(() => {
|
|
2195
|
+
pinching.value = false;
|
|
2196
|
+
committedCellHeight.value = cellHeight.value;
|
|
2197
|
+
});
|
|
2198
|
+
return Gesture.Simultaneous(pinch, Gesture.Native());
|
|
2199
|
+
}, [
|
|
2200
|
+
cellHeight,
|
|
2201
|
+
committedCellHeight,
|
|
2202
|
+
pinching,
|
|
2203
|
+
pinchStartCellHeight,
|
|
2204
|
+
minHourHeight,
|
|
2205
|
+
maxHourHeight
|
|
2206
|
+
]);
|
|
2207
|
+
const pagerHeight = headerOffset + HOUR_LABEL_TOP_INSET + (clampedMaxHour - clampedMinHour) * maxHourHeight + tallestLane;
|
|
2208
|
+
const gridHeightStyle = useAnimatedStyle(() => ({ height: headerOffset + laneHeight.value + HOUR_LABEL_TOP_INSET + (clampedMaxHour - clampedMinHour) * cellHeight.value }), [
|
|
2209
|
+
clampedMinHour,
|
|
2210
|
+
clampedMaxHour,
|
|
2211
|
+
headerOffset
|
|
2212
|
+
]);
|
|
2037
2213
|
useWebGridZoom(isWeb$1, containerRef, cellHeight, committedCellHeight, minHourHeight, maxHourHeight);
|
|
2038
2214
|
const [anchorDate] = useState(date);
|
|
2039
2215
|
const anchor = useMemo(() => weekAnchored ? startOfWeek(anchorDate, { weekStartsOn }) : startOfDay(anchorDate), [
|
|
@@ -2051,8 +2227,31 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2051
2227
|
step,
|
|
2052
2228
|
weekStartsOn
|
|
2053
2229
|
])(date);
|
|
2230
|
+
useEffect(() => {
|
|
2231
|
+
activeIndexShared.value = activeIndex;
|
|
2232
|
+
}, [activeIndex, activeIndexShared]);
|
|
2054
2233
|
const viewedIndexRef = useRef(activeIndex);
|
|
2055
2234
|
const pendingScrollIndexRef = useRef(null);
|
|
2235
|
+
const weekNumber = useMemo(() => {
|
|
2236
|
+
if (!pagedHeader || !showWeekNumber || hourColumnWidth === 0) return null;
|
|
2237
|
+
const days = getViewDays$1(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays);
|
|
2238
|
+
const thursday = days.find((d) => d.getDay() === 4) ?? days[0];
|
|
2239
|
+
return thursday ? `${weekNumberPrefix}${getISOWeek(thursday)}` : null;
|
|
2240
|
+
}, [
|
|
2241
|
+
pagedHeader,
|
|
2242
|
+
showWeekNumber,
|
|
2243
|
+
hourColumnWidth,
|
|
2244
|
+
mode,
|
|
2245
|
+
pageDates,
|
|
2246
|
+
activeIndex,
|
|
2247
|
+
date,
|
|
2248
|
+
weekStartsOn,
|
|
2249
|
+
numberOfDays,
|
|
2250
|
+
isRTL,
|
|
2251
|
+
weekEndsOn,
|
|
2252
|
+
hiddenDays,
|
|
2253
|
+
weekNumberPrefix
|
|
2254
|
+
]);
|
|
2056
2255
|
const headerDays = useMemo(() => getViewDays$1(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
|
|
2057
2256
|
mode,
|
|
2058
2257
|
pageDates,
|
|
@@ -2066,8 +2265,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2066
2265
|
]);
|
|
2067
2266
|
dropRef.current = {
|
|
2068
2267
|
headerDays,
|
|
2069
|
-
|
|
2070
|
-
|
|
2268
|
+
columnsWidth,
|
|
2269
|
+
headerOffset,
|
|
2071
2270
|
minHour: clampedMinHour,
|
|
2072
2271
|
maxHour: clampedMaxHour,
|
|
2073
2272
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
@@ -2093,55 +2292,26 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2093
2292
|
if (activeIndex === viewedIndexRef.current) return;
|
|
2094
2293
|
viewedIndexRef.current = activeIndex;
|
|
2095
2294
|
pendingScrollIndexRef.current = activeIndex;
|
|
2295
|
+
pagerOffset.value = activeIndex * columnsWidth;
|
|
2096
2296
|
listRef.current?.scrollToIndex({
|
|
2097
2297
|
index: activeIndex,
|
|
2098
2298
|
animated: false
|
|
2099
2299
|
});
|
|
2100
2300
|
}, [activeIndex]);
|
|
2101
2301
|
useEffect(() => {
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
if (!root) return;
|
|
2105
|
-
const restoreVisiblePage = () => {
|
|
2106
|
-
const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
|
|
2107
|
-
for (const el of root.querySelectorAll("*")) {
|
|
2108
|
-
const style = getComputedStyle(el);
|
|
2109
|
-
if (!((style.overflowY === "scroll" || style.overflowY === "auto") && el.scrollHeight > el.clientHeight + 20 && el.clientHeight > 100)) continue;
|
|
2110
|
-
const rect = el.getBoundingClientRect();
|
|
2111
|
-
if (rect.left > -50 && rect.right <= vw + 50) {
|
|
2112
|
-
el.scrollTop = scrollY.value;
|
|
2113
|
-
break;
|
|
2114
|
-
}
|
|
2115
|
-
}
|
|
2116
|
-
};
|
|
2117
|
-
suppressCaptureUntilRef.current = Date.now() + 400;
|
|
2118
|
-
let raf2 = 0;
|
|
2119
|
-
const raf1 = requestAnimationFrame(() => {
|
|
2120
|
-
restoreVisiblePage();
|
|
2121
|
-
raf2 = requestAnimationFrame(restoreVisiblePage);
|
|
2122
|
-
});
|
|
2123
|
-
return () => {
|
|
2124
|
-
cancelAnimationFrame(raf1);
|
|
2125
|
-
cancelAnimationFrame(raf2);
|
|
2126
|
-
};
|
|
2127
|
-
}, [activeIndex, pageHeight]);
|
|
2302
|
+
pagerOffset.value = activeIndex * columnsWidth;
|
|
2303
|
+
}, [columnsWidth, pagerOffset]);
|
|
2128
2304
|
useEffect(() => {
|
|
2129
2305
|
if (!isWeb$1) return;
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
if (!el || typeof el.scrollTop !== "number" || el.clientHeight <= 100) return;
|
|
2136
|
-
const rect = el.getBoundingClientRect();
|
|
2137
|
-
const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
|
|
2138
|
-
if (rect.left <= -50 || rect.right > vw + 50) return;
|
|
2139
|
-
scrollY.value = el.scrollTop;
|
|
2140
|
-
offsetSeedRef.current = el.scrollTop;
|
|
2306
|
+
let attempts = 0;
|
|
2307
|
+
let frame = 0;
|
|
2308
|
+
const attempt = () => {
|
|
2309
|
+
seedWebScroll();
|
|
2310
|
+
if (!webSeededRef.current && attempts++ < 120) frame = requestAnimationFrame(attempt);
|
|
2141
2311
|
};
|
|
2142
|
-
|
|
2143
|
-
return () =>
|
|
2144
|
-
}, []);
|
|
2312
|
+
frame = requestAnimationFrame(attempt);
|
|
2313
|
+
return () => cancelAnimationFrame(frame);
|
|
2314
|
+
}, [seedWebScroll]);
|
|
2145
2315
|
useEffect(() => {
|
|
2146
2316
|
if (!isWeb$1) return;
|
|
2147
2317
|
const root = containerRef.current;
|
|
@@ -2158,17 +2328,51 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2158
2328
|
};
|
|
2159
2329
|
const raf = requestAnimationFrame(lockHorizontal);
|
|
2160
2330
|
return () => cancelAnimationFrame(raf);
|
|
2161
|
-
}, [
|
|
2331
|
+
}, [columnsWidth]);
|
|
2332
|
+
const reduceMotion = useReducedMotion();
|
|
2162
2333
|
const goToPage = useCallback((delta) => {
|
|
2163
|
-
const
|
|
2164
|
-
|
|
2334
|
+
const index = viewedIndexRef.current + delta;
|
|
2335
|
+
const target = pageDates[index];
|
|
2336
|
+
if (!target) return;
|
|
2337
|
+
viewedIndexRef.current = index;
|
|
2338
|
+
pendingScrollIndexRef.current = index;
|
|
2339
|
+
pagerOffset.value = index * columnsWidth;
|
|
2340
|
+
listRef.current?.scrollToIndex({
|
|
2341
|
+
index,
|
|
2342
|
+
animated: !isWeb$1 && !reduceMotion
|
|
2343
|
+
});
|
|
2344
|
+
onChangeDate(target);
|
|
2165
2345
|
}, [
|
|
2166
2346
|
pageDates,
|
|
2167
|
-
|
|
2168
|
-
onChangeDate
|
|
2347
|
+
reduceMotion,
|
|
2348
|
+
onChangeDate,
|
|
2349
|
+
columnsWidth,
|
|
2350
|
+
pagerOffset
|
|
2169
2351
|
]);
|
|
2170
2352
|
useWebPagerKeys(swipeEnabled, goToPage);
|
|
2171
|
-
const
|
|
2353
|
+
const handlePagerSettled = useCallback((event) => {
|
|
2354
|
+
if (columnsWidth <= 0) return;
|
|
2355
|
+
if (pendingScrollIndexRef.current != null) return;
|
|
2356
|
+
const raw = Math.round(event.nativeEvent.contentOffset.x / columnsWidth);
|
|
2357
|
+
const index = Math.min(Math.max(raw, 0), pageDates.length - 1);
|
|
2358
|
+
if (index !== viewedIndexRef.current) {
|
|
2359
|
+
viewedIndexRef.current = index;
|
|
2360
|
+
const target = pageDates[index];
|
|
2361
|
+
if (target) onChangeDate(target);
|
|
2362
|
+
}
|
|
2363
|
+
pagerOffset.value = index * columnsWidth;
|
|
2364
|
+
requestAnimationFrame(() => {
|
|
2365
|
+
listRef.current?.scrollToIndex({
|
|
2366
|
+
index,
|
|
2367
|
+
animated: false
|
|
2368
|
+
});
|
|
2369
|
+
});
|
|
2370
|
+
}, [
|
|
2371
|
+
columnsWidth,
|
|
2372
|
+
pageDates,
|
|
2373
|
+
onChangeDate,
|
|
2374
|
+
pagerOffset
|
|
2375
|
+
]);
|
|
2172
2376
|
const handlePressCell = useMemo(() => {
|
|
2173
2377
|
if (!onPressCell) return void 0;
|
|
2174
2378
|
if (!resetPageOnPressCell) return onPressCell;
|
|
@@ -2187,96 +2391,87 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2187
2391
|
]);
|
|
2188
2392
|
const snapToIndices = useMemo(() => pageDates.map((_, index) => index), [pageDates]);
|
|
2189
2393
|
const keyExtractorList = useCallback((item) => item.toISOString(), []);
|
|
2190
|
-
const getFixedItemSize = useCallback(() =>
|
|
2191
|
-
const renderItem = useCallback(({ item, index }) => /* @__PURE__ */ jsx(
|
|
2192
|
-
style: {
|
|
2193
|
-
width: containerWidth,
|
|
2194
|
-
height: pageHeight
|
|
2195
|
-
},
|
|
2196
|
-
children: /* @__PURE__ */ jsx(TimetablePage, {
|
|
2197
|
-
mode,
|
|
2198
|
-
numberOfDays,
|
|
2199
|
-
hiddenDays,
|
|
2200
|
-
now,
|
|
2201
|
-
nowTimeZone: timeZone,
|
|
2202
|
-
date: item,
|
|
2203
|
-
width: containerWidth,
|
|
2204
|
-
events,
|
|
2205
|
-
cellHeight,
|
|
2206
|
-
hourHeight,
|
|
2207
|
-
committedCellHeight,
|
|
2208
|
-
scrollY,
|
|
2209
|
-
isActive: index === activeIndex,
|
|
2210
|
-
initialScrollY: offsetSeedRef.current ?? seedDefaultY,
|
|
2211
|
-
onSettleOffset: captureOffsetSeed,
|
|
2212
|
-
weekStartsOn,
|
|
2213
|
-
weekEndsOn,
|
|
2214
|
-
hourColumnWidth,
|
|
2215
|
-
minHour: clampedMinHour,
|
|
2216
|
-
maxHour: clampedMaxHour,
|
|
2217
|
-
ampm,
|
|
2218
|
-
timeslots,
|
|
2219
|
-
isRTL,
|
|
2220
|
-
showAllDayEventCell,
|
|
2221
|
-
highlightWeekends,
|
|
2222
|
-
showVerticalScrollIndicator,
|
|
2223
|
-
verticalScrollEnabled,
|
|
2224
|
-
hourComponent,
|
|
2225
|
-
calendarCellStyle,
|
|
2226
|
-
businessHours,
|
|
2227
|
-
renderBusinessHours,
|
|
2228
|
-
minHourHeight,
|
|
2229
|
-
maxHourHeight,
|
|
2230
|
-
showNowIndicator,
|
|
2231
|
-
renderEvent: labeledRenderEvent,
|
|
2232
|
-
keyExtractor,
|
|
2233
|
-
snapMinutes: Math.max(1, dragStepMinutes),
|
|
2234
|
-
minEventHeight,
|
|
2235
|
-
eventGap,
|
|
2236
|
-
showDragHandle,
|
|
2237
|
-
eventStartEditable,
|
|
2238
|
-
eventDurationEditable,
|
|
2239
|
-
onPressEvent,
|
|
2240
|
-
onLongPressEvent,
|
|
2241
|
-
onDragEvent,
|
|
2242
|
-
onDragStart,
|
|
2243
|
-
onPressCell: handlePressCell,
|
|
2244
|
-
onLongPressCell,
|
|
2245
|
-
onCreateEvent,
|
|
2246
|
-
onEdgeAdvance: goToPage,
|
|
2247
|
-
onGridTop: handleGridTop
|
|
2248
|
-
})
|
|
2249
|
-
}), [
|
|
2250
|
-
containerWidth,
|
|
2251
|
-
pageHeight,
|
|
2252
|
-
handleGridTop,
|
|
2394
|
+
const getFixedItemSize = useCallback(() => columnsWidth, [columnsWidth]);
|
|
2395
|
+
const renderItem = useCallback(({ item, index }) => /* @__PURE__ */ jsx(TimetablePage, {
|
|
2253
2396
|
mode,
|
|
2254
2397
|
numberOfDays,
|
|
2398
|
+
hiddenDays,
|
|
2399
|
+
now,
|
|
2400
|
+
nowTimeZone: timeZone,
|
|
2401
|
+
date: item,
|
|
2402
|
+
width: columnsWidth,
|
|
2255
2403
|
events,
|
|
2256
2404
|
cellHeight,
|
|
2257
|
-
hourHeight,
|
|
2258
2405
|
committedCellHeight,
|
|
2406
|
+
isActive: index === activeIndex,
|
|
2407
|
+
weekStartsOn,
|
|
2408
|
+
weekEndsOn,
|
|
2409
|
+
minHour: clampedMinHour,
|
|
2410
|
+
maxHour: clampedMaxHour,
|
|
2411
|
+
timeslots,
|
|
2412
|
+
isRTL,
|
|
2413
|
+
highlightWeekends,
|
|
2414
|
+
calendarCellStyle,
|
|
2415
|
+
businessHours,
|
|
2416
|
+
renderBusinessHours,
|
|
2417
|
+
renderBackgroundEvent,
|
|
2418
|
+
showNowIndicator,
|
|
2419
|
+
renderEvent: labeledRenderEvent,
|
|
2420
|
+
keyExtractor,
|
|
2421
|
+
snapMinutes: Math.max(1, dragStepMinutes),
|
|
2422
|
+
minEventHeight,
|
|
2423
|
+
eventGap,
|
|
2424
|
+
showDragHandle,
|
|
2425
|
+
eventStartEditable,
|
|
2426
|
+
eventDurationEditable,
|
|
2427
|
+
onPressEvent,
|
|
2428
|
+
onLongPressEvent,
|
|
2429
|
+
onDragEvent,
|
|
2430
|
+
onDragStart,
|
|
2431
|
+
onPressCell: handlePressCell,
|
|
2432
|
+
onLongPressCell,
|
|
2433
|
+
onCreateEvent,
|
|
2434
|
+
onEdgeAdvance: goToPage,
|
|
2435
|
+
pageIndex: index,
|
|
2436
|
+
laneHeight,
|
|
2437
|
+
scrollY,
|
|
2438
|
+
showAllDayEventCell,
|
|
2439
|
+
onLaneLayout: reportLaneHeight,
|
|
2440
|
+
height: pagerHeight,
|
|
2441
|
+
pagedHeader,
|
|
2442
|
+
weekdayFormat,
|
|
2443
|
+
locale,
|
|
2444
|
+
activeDate,
|
|
2445
|
+
onPressDateHeader
|
|
2446
|
+
}), [
|
|
2447
|
+
columnsWidth,
|
|
2448
|
+
pagerHeight,
|
|
2449
|
+
pagedHeader,
|
|
2450
|
+
weekdayFormat,
|
|
2451
|
+
locale,
|
|
2452
|
+
activeDate,
|
|
2453
|
+
onPressDateHeader,
|
|
2454
|
+
laneHeight,
|
|
2259
2455
|
scrollY,
|
|
2456
|
+
showAllDayEventCell,
|
|
2457
|
+
reportLaneHeight,
|
|
2458
|
+
mode,
|
|
2459
|
+
numberOfDays,
|
|
2460
|
+
events,
|
|
2461
|
+
cellHeight,
|
|
2462
|
+
committedCellHeight,
|
|
2260
2463
|
activeIndex,
|
|
2261
|
-
seedDefaultY,
|
|
2262
|
-
captureOffsetSeed,
|
|
2263
2464
|
weekStartsOn,
|
|
2264
2465
|
weekEndsOn,
|
|
2265
|
-
hourColumnWidth,
|
|
2266
2466
|
clampedMinHour,
|
|
2267
2467
|
clampedMaxHour,
|
|
2268
|
-
ampm,
|
|
2269
2468
|
timeslots,
|
|
2270
2469
|
isRTL,
|
|
2271
|
-
showAllDayEventCell,
|
|
2272
2470
|
highlightWeekends,
|
|
2273
|
-
showVerticalScrollIndicator,
|
|
2274
|
-
verticalScrollEnabled,
|
|
2275
|
-
hourComponent,
|
|
2276
2471
|
calendarCellStyle,
|
|
2277
2472
|
businessHours,
|
|
2278
|
-
|
|
2279
|
-
|
|
2473
|
+
renderBusinessHours,
|
|
2474
|
+
renderBackgroundEvent,
|
|
2280
2475
|
showNowIndicator,
|
|
2281
2476
|
labeledRenderEvent,
|
|
2282
2477
|
keyExtractor,
|
|
@@ -2300,8 +2495,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2300
2495
|
]);
|
|
2301
2496
|
const listExtraData = useMemo(() => ({
|
|
2302
2497
|
events,
|
|
2303
|
-
activeIndex
|
|
2304
|
-
|
|
2498
|
+
activeIndex,
|
|
2499
|
+
columnsWidth
|
|
2500
|
+
}), [
|
|
2501
|
+
events,
|
|
2502
|
+
activeIndex,
|
|
2503
|
+
columnsWidth
|
|
2504
|
+
]);
|
|
2305
2505
|
return /* @__PURE__ */ jsx(SlotStylesProvider, {
|
|
2306
2506
|
classNames,
|
|
2307
2507
|
styles: styleOverrides,
|
|
@@ -2310,63 +2510,105 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2310
2510
|
children: /* @__PURE__ */ jsxs(View, {
|
|
2311
2511
|
ref: containerRef,
|
|
2312
2512
|
style: styles$1.container,
|
|
2513
|
+
onLayout: (event) => setContainerWidth(event.nativeEvent.layout.width),
|
|
2313
2514
|
children: [
|
|
2314
|
-
renderHeader ? renderHeader(headerDays) :
|
|
2315
|
-
days: headerDays,
|
|
2316
|
-
mode,
|
|
2317
|
-
width: containerWidth,
|
|
2318
|
-
hourColumnWidth,
|
|
2319
|
-
showWeekNumber,
|
|
2320
|
-
weekNumberPrefix,
|
|
2321
|
-
weekdayFormat,
|
|
2322
|
-
locale,
|
|
2323
|
-
activeDate,
|
|
2324
|
-
onPressDateHeader
|
|
2325
|
-
}),
|
|
2515
|
+
renderHeader ? renderHeader(headerDays) : null,
|
|
2326
2516
|
headerComponent,
|
|
2327
|
-
/* @__PURE__ */
|
|
2328
|
-
ref:
|
|
2329
|
-
style: styles$1.
|
|
2330
|
-
onLayout: (
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
pagerRef.current?.measureInWindow((x, y, w) => {
|
|
2335
|
-
pagerLeft.value = x;
|
|
2336
|
-
pagerTop.value = y;
|
|
2337
|
-
pagerWidth.value = w;
|
|
2517
|
+
/* @__PURE__ */ jsx(View, {
|
|
2518
|
+
ref: viewportRef,
|
|
2519
|
+
style: styles$1.viewport,
|
|
2520
|
+
onLayout: () => {
|
|
2521
|
+
seedWebScroll();
|
|
2522
|
+
viewportRef.current?.measureInWindow((_x, y) => {
|
|
2523
|
+
viewportTop.value = y;
|
|
2338
2524
|
});
|
|
2339
2525
|
},
|
|
2340
|
-
children:
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2526
|
+
children: /* @__PURE__ */ jsx(GestureDetector, {
|
|
2527
|
+
gesture: zoomGesture,
|
|
2528
|
+
children: /* @__PURE__ */ jsx(Animated.ScrollView, {
|
|
2529
|
+
ref: scrollRef,
|
|
2530
|
+
showsVerticalScrollIndicator: showVerticalScrollIndicator,
|
|
2531
|
+
scrollEnabled: verticalScrollEnabled,
|
|
2532
|
+
onScroll: scrollHandler,
|
|
2533
|
+
scrollEventThrottle: 16,
|
|
2534
|
+
refreshControl: verticalScrollEnabled ? refreshControl : void 0,
|
|
2535
|
+
contentOffset: {
|
|
2536
|
+
x: 0,
|
|
2537
|
+
y: seedDefaultY
|
|
2538
|
+
},
|
|
2539
|
+
children: /* @__PURE__ */ jsxs(Animated.View, {
|
|
2540
|
+
testID: "time-grid-hours",
|
|
2541
|
+
style: [styles$1.gridRow, gridHeightStyle],
|
|
2542
|
+
children: [hourColumnWidth > 0 ? /* @__PURE__ */ jsx(HourGutter, {
|
|
2543
|
+
width: hourColumnWidth,
|
|
2544
|
+
minHour: clampedMinHour,
|
|
2545
|
+
maxHour: clampedMaxHour,
|
|
2546
|
+
cellHeight,
|
|
2547
|
+
laneHeight,
|
|
2548
|
+
scrollY,
|
|
2549
|
+
showLane: showAllDayEventCell,
|
|
2550
|
+
showAllDayLabel,
|
|
2551
|
+
headerHeight: headerOffset,
|
|
2552
|
+
weekNumber,
|
|
2553
|
+
ampm,
|
|
2554
|
+
hourComponent
|
|
2555
|
+
}) : null, /* @__PURE__ */ jsxs(View, {
|
|
2556
|
+
ref: pagerRef,
|
|
2557
|
+
testID: "time-grid-pager",
|
|
2558
|
+
style: [styles$1.pager, {
|
|
2559
|
+
left: hourColumnWidth,
|
|
2560
|
+
height: pagerHeight
|
|
2561
|
+
}],
|
|
2562
|
+
onLayout: (event) => {
|
|
2563
|
+
const laidOutWidth = event.nativeEvent.layout.width;
|
|
2564
|
+
if (laidOutWidth === pagerLayoutWidthRef.current) return;
|
|
2565
|
+
pagerLayoutWidthRef.current = laidOutWidth;
|
|
2566
|
+
setPagerLayoutWidth(laidOutWidth);
|
|
2567
|
+
pagerRef.current?.measureInWindow((x, _y, measuredWidth) => {
|
|
2568
|
+
pagerLeft.value = x;
|
|
2569
|
+
pagerWidth.value = measuredWidth;
|
|
2570
|
+
});
|
|
2571
|
+
},
|
|
2572
|
+
children: [pagerReady ? /* @__PURE__ */ jsx(AnimatedLegendList, {
|
|
2573
|
+
ref: listRef,
|
|
2574
|
+
style: isWeb$1 ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
|
|
2575
|
+
data: pageDates,
|
|
2576
|
+
extraData: listExtraData,
|
|
2577
|
+
horizontal: true,
|
|
2578
|
+
recycleItems: false,
|
|
2579
|
+
keyExtractor: keyExtractorList,
|
|
2580
|
+
getFixedItemSize,
|
|
2581
|
+
drawDistance: columnsWidth * 2,
|
|
2582
|
+
sharedValues: pagerSharedValues,
|
|
2583
|
+
...isWeb$1 ? null : {
|
|
2584
|
+
scrollEnabled: swipeEnabled,
|
|
2585
|
+
pagingEnabled: !freeSwipe,
|
|
2586
|
+
snapToIndices: freeSwipe ? snapToIndices : void 0,
|
|
2587
|
+
decelerationRate: freeSwipe ? "normal" : "fast",
|
|
2588
|
+
disableIntervalMomentum: !freeSwipe,
|
|
2589
|
+
scrollEventThrottle: 16,
|
|
2590
|
+
onMomentumScrollEnd: handlePagerSettled
|
|
2591
|
+
},
|
|
2592
|
+
initialScrollIndex: activeIndex,
|
|
2593
|
+
showsHorizontalScrollIndicator: false,
|
|
2594
|
+
viewabilityConfig: PAGE_VIEWABILITY,
|
|
2595
|
+
onViewableItemsChanged: handleViewableItemsChanged,
|
|
2596
|
+
renderItem
|
|
2597
|
+
}, `grid-${columnsWidth}`) : null, liftedEvent ? /* @__PURE__ */ jsx(DragGhost, {
|
|
2598
|
+
x: ghostX,
|
|
2599
|
+
y: ghostY,
|
|
2600
|
+
w: ghostW,
|
|
2601
|
+
h: ghostH,
|
|
2602
|
+
visible: ghostVisible,
|
|
2603
|
+
event: liftedEvent,
|
|
2604
|
+
mode,
|
|
2605
|
+
renderEvent: labeledRenderEvent,
|
|
2606
|
+
eventGap
|
|
2607
|
+
}) : null]
|
|
2608
|
+
})]
|
|
2609
|
+
})
|
|
2610
|
+
})
|
|
2611
|
+
})
|
|
2370
2612
|
})
|
|
2371
2613
|
]
|
|
2372
2614
|
})
|
|
@@ -2393,23 +2635,10 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2393
2635
|
* ```
|
|
2394
2636
|
*/
|
|
2395
2637
|
const TimeGrid = memo(TimeGridInner);
|
|
2396
|
-
const
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
return /* @__PURE__ */ jsxs(View, {
|
|
2401
|
-
...slot("header", {
|
|
2402
|
-
base: styles$1.headerRow,
|
|
2403
|
-
themed: { borderBottomColor: theme.colors.gridLine }
|
|
2404
|
-
}),
|
|
2405
|
-
children: [/* @__PURE__ */ jsx(View, {
|
|
2406
|
-
style: [styles$1.weekNumberGutter, { width: hourColumnWidth }],
|
|
2407
|
-
children: showWeekNumber && hourColumnWidth > 0 && days[0] ? /* @__PURE__ */ jsx(Text, {
|
|
2408
|
-
...slot("weekNumber", { themed: [theme.text.hourLabel, { color: theme.colors.textMuted }] }),
|
|
2409
|
-
allowFontScaling: false,
|
|
2410
|
-
children: `${weekNumberPrefix}${getISOWeek(days.find((d) => d.getDay() === 4) ?? days[0])}`
|
|
2411
|
-
}) : null
|
|
2412
|
-
}), days.map((day) => /* @__PURE__ */ jsx(DayHeader, {
|
|
2638
|
+
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, locale, activeDate, onPressDateHeader }) => {
|
|
2639
|
+
return /* @__PURE__ */ jsx(View, {
|
|
2640
|
+
...useSlots()("header", { base: styles$1.headerRow }),
|
|
2641
|
+
children: days.map((day) => /* @__PURE__ */ jsx(DayHeader, {
|
|
2413
2642
|
day,
|
|
2414
2643
|
mode,
|
|
2415
2644
|
width: dayWidth,
|
|
@@ -2417,7 +2646,7 @@ const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, wee
|
|
|
2417
2646
|
locale,
|
|
2418
2647
|
activeDate,
|
|
2419
2648
|
onPressDateHeader
|
|
2420
|
-
}, day.toISOString()))
|
|
2649
|
+
}, day.toISOString()))
|
|
2421
2650
|
});
|
|
2422
2651
|
};
|
|
2423
2652
|
const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, onPressDateHeader }) => {
|
|
@@ -2461,17 +2690,58 @@ const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, on
|
|
|
2461
2690
|
});
|
|
2462
2691
|
};
|
|
2463
2692
|
const styles$1 = StyleSheet.create({
|
|
2464
|
-
pager: {
|
|
2693
|
+
pager: {
|
|
2694
|
+
position: "absolute",
|
|
2695
|
+
top: 0,
|
|
2696
|
+
right: 0
|
|
2697
|
+
},
|
|
2465
2698
|
pagerList: { flex: 1 },
|
|
2466
2699
|
container: { flex: 1 },
|
|
2700
|
+
viewport: { flex: 1 },
|
|
2701
|
+
gridRow: {
|
|
2702
|
+
position: "relative",
|
|
2703
|
+
overflow: "hidden"
|
|
2704
|
+
},
|
|
2705
|
+
hourGutter: {
|
|
2706
|
+
position: "absolute",
|
|
2707
|
+
top: 0,
|
|
2708
|
+
left: 0,
|
|
2709
|
+
bottom: 0
|
|
2710
|
+
},
|
|
2711
|
+
fill: {
|
|
2712
|
+
position: "absolute",
|
|
2713
|
+
top: 0,
|
|
2714
|
+
left: 0,
|
|
2715
|
+
right: 0,
|
|
2716
|
+
bottom: 0
|
|
2717
|
+
},
|
|
2718
|
+
hourCell: { flex: 1 },
|
|
2467
2719
|
headerRow: {
|
|
2720
|
+
flex: 1,
|
|
2721
|
+
flexDirection: "row",
|
|
2722
|
+
alignItems: "center"
|
|
2723
|
+
},
|
|
2724
|
+
pagedHeader: {
|
|
2725
|
+
position: "absolute",
|
|
2726
|
+
top: 0,
|
|
2727
|
+
left: 0,
|
|
2728
|
+
right: 0,
|
|
2729
|
+
height: DAY_HEADER_HEIGHT,
|
|
2730
|
+
zIndex: 2,
|
|
2468
2731
|
flexDirection: "row",
|
|
2469
2732
|
alignItems: "center",
|
|
2470
2733
|
borderBottomWidth: StyleSheet.hairlineWidth
|
|
2471
2734
|
},
|
|
2472
|
-
|
|
2735
|
+
gutterCorner: {
|
|
2736
|
+
position: "absolute",
|
|
2737
|
+
top: 0,
|
|
2738
|
+
left: 0,
|
|
2739
|
+
right: 0,
|
|
2740
|
+
zIndex: 2,
|
|
2473
2741
|
alignItems: "center",
|
|
2474
|
-
justifyContent: "flex-end"
|
|
2742
|
+
justifyContent: "flex-end",
|
|
2743
|
+
paddingBottom: 6,
|
|
2744
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
2475
2745
|
},
|
|
2476
2746
|
dayHeader: {
|
|
2477
2747
|
alignItems: "center",
|
|
@@ -2485,14 +2755,45 @@ const styles$1 = StyleSheet.create({
|
|
|
2485
2755
|
justifyContent: "center",
|
|
2486
2756
|
alignItems: "center"
|
|
2487
2757
|
},
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
position: "
|
|
2758
|
+
page: { position: "relative" },
|
|
2759
|
+
grid: {
|
|
2760
|
+
position: "absolute",
|
|
2761
|
+
left: 0,
|
|
2762
|
+
right: 0
|
|
2763
|
+
},
|
|
2764
|
+
laneBand: {
|
|
2765
|
+
position: "absolute",
|
|
2766
|
+
top: 0,
|
|
2767
|
+
left: 0,
|
|
2768
|
+
right: 0,
|
|
2769
|
+
overflow: "hidden",
|
|
2770
|
+
zIndex: 2
|
|
2771
|
+
},
|
|
2772
|
+
laneCell: {
|
|
2773
|
+
position: "absolute",
|
|
2774
|
+
top: 0,
|
|
2775
|
+
left: 0,
|
|
2776
|
+
right: 0,
|
|
2777
|
+
zIndex: 2,
|
|
2778
|
+
justifyContent: "center",
|
|
2779
|
+
overflow: "hidden",
|
|
2780
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
2781
|
+
},
|
|
2782
|
+
allDayLabel: {
|
|
2783
|
+
fontSize: 10,
|
|
2784
|
+
textAlign: "right",
|
|
2785
|
+
paddingRight: 6
|
|
2786
|
+
},
|
|
2787
|
+
gutterRows: {
|
|
2788
|
+
position: "absolute",
|
|
2789
|
+
left: 0,
|
|
2790
|
+
right: 0
|
|
2491
2791
|
},
|
|
2492
2792
|
cellPressLayer: {
|
|
2493
2793
|
position: "absolute",
|
|
2494
2794
|
top: 0,
|
|
2495
2795
|
bottom: 0,
|
|
2796
|
+
left: 0,
|
|
2496
2797
|
right: 0
|
|
2497
2798
|
},
|
|
2498
2799
|
createGhost: {
|
|
@@ -2504,7 +2805,10 @@ const styles$1 = StyleSheet.create({
|
|
|
2504
2805
|
position: "absolute",
|
|
2505
2806
|
top: 0
|
|
2506
2807
|
},
|
|
2507
|
-
shadeBand: {
|
|
2808
|
+
shadeBand: {
|
|
2809
|
+
position: "absolute",
|
|
2810
|
+
overflow: "hidden"
|
|
2811
|
+
},
|
|
2508
2812
|
daySeparator: {
|
|
2509
2813
|
position: "absolute",
|
|
2510
2814
|
top: 0,
|
|
@@ -2512,6 +2816,7 @@ const styles$1 = StyleSheet.create({
|
|
|
2512
2816
|
},
|
|
2513
2817
|
hourRow: {
|
|
2514
2818
|
position: "absolute",
|
|
2819
|
+
top: 0,
|
|
2515
2820
|
left: 0,
|
|
2516
2821
|
right: 0,
|
|
2517
2822
|
flexDirection: "row",
|
|
@@ -2523,11 +2828,16 @@ const styles$1 = StyleSheet.create({
|
|
|
2523
2828
|
paddingRight: 6
|
|
2524
2829
|
},
|
|
2525
2830
|
hourLine: {
|
|
2526
|
-
|
|
2831
|
+
position: "absolute",
|
|
2832
|
+
top: 0,
|
|
2833
|
+
left: 0,
|
|
2834
|
+
right: 0,
|
|
2527
2835
|
height: StyleSheet.hairlineWidth
|
|
2528
2836
|
},
|
|
2529
2837
|
timeslotLine: {
|
|
2530
2838
|
position: "absolute",
|
|
2839
|
+
top: 0,
|
|
2840
|
+
left: 0,
|
|
2531
2841
|
right: 0,
|
|
2532
2842
|
height: StyleSheet.hairlineWidth,
|
|
2533
2843
|
opacity: .5
|
|
@@ -2570,6 +2880,7 @@ const styles$1 = StyleSheet.create({
|
|
|
2570
2880
|
height: 2
|
|
2571
2881
|
},
|
|
2572
2882
|
nonInteractive: { pointerEvents: "none" },
|
|
2883
|
+
passThrough: { pointerEvents: "box-none" },
|
|
2573
2884
|
webNoScroll: { overflow: "hidden" }
|
|
2574
2885
|
});
|
|
2575
2886
|
//#endregion
|
|
@@ -2615,7 +2926,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
2615
2926
|
* }
|
|
2616
2927
|
* ```
|
|
2617
2928
|
*/
|
|
2618
|
-
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 }) {
|
|
2929
|
+
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, renderBackgroundEvent, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, 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 }) {
|
|
2619
2930
|
const mergedTheme = useMemo(() => mergeTheme(theme), [theme]);
|
|
2620
2931
|
const internalCellHeight = useSharedValue(hourHeight);
|
|
2621
2932
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -2735,6 +3046,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2735
3046
|
}) : mode === "year" ? /* @__PURE__ */ jsx(YearView, {
|
|
2736
3047
|
date,
|
|
2737
3048
|
events: displayEvents,
|
|
3049
|
+
refreshControl,
|
|
2738
3050
|
weekStartsOn,
|
|
2739
3051
|
hiddenDays,
|
|
2740
3052
|
locale,
|
|
@@ -2760,6 +3072,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2760
3072
|
onPressDay,
|
|
2761
3073
|
activeDate,
|
|
2762
3074
|
itemSeparatorComponent,
|
|
3075
|
+
refreshControl,
|
|
2763
3076
|
classNames,
|
|
2764
3077
|
styles: styleOverrides
|
|
2765
3078
|
}) : /* @__PURE__ */ jsx(TimeGrid, {
|
|
@@ -2782,6 +3095,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2782
3095
|
hideHours,
|
|
2783
3096
|
timeslots,
|
|
2784
3097
|
showAllDayEventCell,
|
|
3098
|
+
showAllDayLabel,
|
|
3099
|
+
refreshControl,
|
|
2785
3100
|
highlightWeekends,
|
|
2786
3101
|
eventStartEditable,
|
|
2787
3102
|
eventDurationEditable,
|
|
@@ -2789,6 +3104,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2789
3104
|
calendarCellStyle,
|
|
2790
3105
|
businessHours,
|
|
2791
3106
|
renderBusinessHours,
|
|
3107
|
+
renderBackgroundEvent,
|
|
2792
3108
|
showWeekNumber,
|
|
2793
3109
|
weekNumberPrefix,
|
|
2794
3110
|
hourComponent,
|