@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.js
CHANGED
|
@@ -31,11 +31,12 @@ let react_native = require("react-native");
|
|
|
31
31
|
let react_native_gesture_handler = require("react-native-gesture-handler");
|
|
32
32
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
33
33
|
let _legendapp_list_react_native = require("@legendapp/list/react-native");
|
|
34
|
+
let _legendapp_list_reanimated = require("@legendapp/list/reanimated");
|
|
34
35
|
//#region src/components/YearView.tsx
|
|
35
36
|
const isWeb$2 = react_native.Platform.OS === "web";
|
|
36
37
|
const DRAG_HOLD_MS = 400;
|
|
37
38
|
const FALLBACK_COLUMNS = 3;
|
|
38
|
-
function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, classNames, styles: styleOverrides }) {
|
|
39
|
+
function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, refreshControl, classNames, styles: styleOverrides }) {
|
|
39
40
|
const theme = require_MonthList.useCalendarTheme();
|
|
40
41
|
const slot = require_MonthList.createSlots({
|
|
41
42
|
classNames,
|
|
@@ -122,6 +123,7 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeD
|
|
|
122
123
|
onLayout: handleLayout,
|
|
123
124
|
showsVerticalScrollIndicator: true,
|
|
124
125
|
scrollEnabled: isWeb$2 || sweep == null,
|
|
126
|
+
refreshControl,
|
|
125
127
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
126
128
|
...slot("grid", { base: styles$5.grid }),
|
|
127
129
|
children: months.map((month, monthIndex) => {
|
|
@@ -393,7 +395,7 @@ const styles$5 = react_native.StyleSheet.create({
|
|
|
393
395
|
* start, grouped under a date header per day. The consumer controls which
|
|
394
396
|
* events (and therefore which date range) are shown.
|
|
395
397
|
*/
|
|
396
|
-
function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
398
|
+
function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, refreshControl, classNames, styles: styleOverrides }) {
|
|
397
399
|
const theme = require_MonthList.useCalendarTheme();
|
|
398
400
|
const slot = (0, react.useMemo)(() => require_MonthList.createSlots({
|
|
399
401
|
classNames,
|
|
@@ -472,7 +474,8 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
472
474
|
keyExtractor: keyExtractorRow,
|
|
473
475
|
renderItem,
|
|
474
476
|
ItemSeparatorComponent: itemSeparatorComponent ?? void 0,
|
|
475
|
-
recycleItems: false
|
|
477
|
+
recycleItems: false,
|
|
478
|
+
refreshControl
|
|
476
479
|
});
|
|
477
480
|
}
|
|
478
481
|
const styles$4 = react_native.StyleSheet.create({
|
|
@@ -689,12 +692,13 @@ function useWebGridZoom(enabled, target, cellHeight, committedCellHeight, minHei
|
|
|
689
692
|
//#endregion
|
|
690
693
|
//#region src/components/AllDayLane.tsx
|
|
691
694
|
/**
|
|
692
|
-
* The all-day lane
|
|
693
|
-
* excluded from the timed columns (see `layoutDayEvents`) and shown
|
|
694
|
-
* stacked under their day(s).
|
|
695
|
-
*
|
|
695
|
+
* The all-day lane of one page, pinned above the scrolling hours. All-day
|
|
696
|
+
* events are excluded from the timed columns (see `layoutDayEvents`) and shown
|
|
697
|
+
* here, stacked under their day(s). Always rendered so every page reports a
|
|
698
|
+
* height, zero when the week has none, which the band above the grid follows
|
|
699
|
+
* live as you swipe; the "all-day" label lives in the hour column.
|
|
696
700
|
*/
|
|
697
|
-
function AllDayLane({ days, events, mode,
|
|
701
|
+
function AllDayLane({ days, events, mode, dayWidth, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onLayout }) {
|
|
698
702
|
const theme = require_MonthList.useCalendarTheme();
|
|
699
703
|
const slot = require_MonthList.useSlots();
|
|
700
704
|
const RenderEventComponent = renderEvent;
|
|
@@ -704,23 +708,13 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
|
|
|
704
708
|
const next = (0, date_fns.addDays)(start, 1);
|
|
705
709
|
return allDay.filter((event) => event.start < next && event.end > start);
|
|
706
710
|
});
|
|
707
|
-
|
|
708
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
711
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
709
712
|
...slot("allDayLane", {
|
|
710
713
|
base: styles$2.lane,
|
|
711
|
-
themed:
|
|
714
|
+
themed: theme.containers.allDayLane
|
|
712
715
|
}),
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
716
|
-
...slot("allDayLabel", {
|
|
717
|
-
base: styles$2.label,
|
|
718
|
-
themed: { color: theme.colors.textMuted }
|
|
719
|
-
}),
|
|
720
|
-
allowFontScaling: false,
|
|
721
|
-
children: "all-day"
|
|
722
|
-
})
|
|
723
|
-
}), days.map((day, dayIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
716
|
+
onLayout,
|
|
717
|
+
children: perDay.every((list) => list.length === 0) ? null : days.map((day, dayIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
724
718
|
...slot("allDayColumn", {
|
|
725
719
|
base: [styles$2.column, { width: dayWidth }],
|
|
726
720
|
themed: theme.containers.allDayColumn
|
|
@@ -735,20 +729,11 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
|
|
|
735
729
|
onLongPress: onLongPressEvent ? () => onLongPressEvent(event) : void 0
|
|
736
730
|
})
|
|
737
731
|
}, keyExtractor(event, index)))
|
|
738
|
-
}, day.toISOString()))
|
|
732
|
+
}, day.toISOString()))
|
|
739
733
|
});
|
|
740
734
|
}
|
|
741
735
|
const styles$2 = react_native.StyleSheet.create({
|
|
742
|
-
lane: {
|
|
743
|
-
flexDirection: "row",
|
|
744
|
-
borderBottomWidth: react_native.StyleSheet.hairlineWidth
|
|
745
|
-
},
|
|
746
|
-
gutter: { justifyContent: "center" },
|
|
747
|
-
label: {
|
|
748
|
-
fontSize: 10,
|
|
749
|
-
textAlign: "right",
|
|
750
|
-
paddingRight: 6
|
|
751
|
-
},
|
|
736
|
+
lane: { flexDirection: "row" },
|
|
752
737
|
column: {
|
|
753
738
|
paddingVertical: 2,
|
|
754
739
|
paddingHorizontal: 1,
|
|
@@ -770,7 +755,7 @@ function MultiDayMovePreview(props) {
|
|
|
770
755
|
dayEnd: (0, date_fns.addDays)((0, date_fns.startOfDay)(day), 1).getTime()
|
|
771
756
|
}, day.toISOString()));
|
|
772
757
|
}
|
|
773
|
-
function PreviewDay({ move, cellHeight, dayWidth,
|
|
758
|
+
function PreviewDay({ move, cellHeight, dayWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
|
|
774
759
|
const theme = require_MonthList.useCalendarTheme();
|
|
775
760
|
const slot = require_MonthList.useSlots();
|
|
776
761
|
const { offsetX, offsetY, lifted, dayIndex, event } = move;
|
|
@@ -826,7 +811,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
|
|
|
826
811
|
position: "absolute",
|
|
827
812
|
overflow: "hidden",
|
|
828
813
|
padding: eventGap,
|
|
829
|
-
left:
|
|
814
|
+
left: index * dayWidth,
|
|
830
815
|
width: dayWidth,
|
|
831
816
|
zIndex: 100
|
|
832
817
|
},
|
|
@@ -863,8 +848,9 @@ const DRAG_ACTIVATE_PX$1 = 8;
|
|
|
863
848
|
const RESIZE_HANDLE_HEIGHT = 14;
|
|
864
849
|
const DEFAULT_DRAG_STEP_MINUTES = 15;
|
|
865
850
|
const DRAG_EVENT_Z = 100;
|
|
866
|
-
const EDGE_DWELL_MS =
|
|
867
|
-
const
|
|
851
|
+
const EDGE_DWELL_MS = 600;
|
|
852
|
+
const EDGE_REPEAT_MS = 700;
|
|
853
|
+
const EDGE_ZONE_PX = 24;
|
|
868
854
|
const EdgePagingContext = (0, react.createContext)(null);
|
|
869
855
|
const noop = () => {};
|
|
870
856
|
/**
|
|
@@ -942,7 +928,9 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent, eventGap })
|
|
|
942
928
|
});
|
|
943
929
|
}
|
|
944
930
|
const HOUR_LABEL_TOP_INSET = 12;
|
|
945
|
-
|
|
931
|
+
const LANE_BAND_FLOOR = 1;
|
|
932
|
+
const DAY_HEADER_HEIGHT = 56;
|
|
933
|
+
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 }) {
|
|
946
934
|
const RenderEventComponent = renderEvent;
|
|
947
935
|
const theme = require_MonthList.useCalendarTheme();
|
|
948
936
|
const slot = require_MonthList.useSlots();
|
|
@@ -994,9 +982,14 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
994
982
|
top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
995
983
|
height: visibleBoxHeight.value,
|
|
996
984
|
transform: [{ translateX: moveOffsetX.value }],
|
|
997
|
-
zIndex: dragZ.value
|
|
985
|
+
zIndex: dragZ.value,
|
|
986
|
+
opacity: hiddenForMove || lifted.value ? 0 : 1
|
|
998
987
|
};
|
|
999
|
-
}, [
|
|
988
|
+
}, [
|
|
989
|
+
startHours,
|
|
990
|
+
minHour,
|
|
991
|
+
hiddenForMove
|
|
992
|
+
]);
|
|
1000
993
|
const spillHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
1001
994
|
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
1002
995
|
const overflowHours = startHours + moveOffset.value / cellHeight.value + durationHours - HOURS_PER_DAY;
|
|
@@ -1039,13 +1032,17 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1039
1032
|
event: positioned.event,
|
|
1040
1033
|
eventIndex,
|
|
1041
1034
|
onDragEvent,
|
|
1042
|
-
onDragStart
|
|
1035
|
+
onDragStart,
|
|
1036
|
+
onPress,
|
|
1037
|
+
onLongPress
|
|
1043
1038
|
});
|
|
1044
1039
|
latest.current = {
|
|
1045
1040
|
event: positioned.event,
|
|
1046
1041
|
eventIndex,
|
|
1047
1042
|
onDragEvent,
|
|
1048
|
-
onDragStart
|
|
1043
|
+
onDragStart,
|
|
1044
|
+
onPress,
|
|
1045
|
+
onLongPress
|
|
1049
1046
|
};
|
|
1050
1047
|
const snapBack = (0, react.useCallback)(() => {
|
|
1051
1048
|
moveOffset.value = 0;
|
|
@@ -1108,16 +1105,12 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1108
1105
|
dwellTimer.current = null;
|
|
1109
1106
|
}
|
|
1110
1107
|
}, []);
|
|
1111
|
-
const releaseEdge =
|
|
1112
|
-
disarmEdge();
|
|
1113
|
-
edgePaging?.lockScroll(false);
|
|
1114
|
-
}, [disarmEdge, edgePaging]);
|
|
1108
|
+
const releaseEdge = disarmEdge;
|
|
1115
1109
|
const armEdge = (0, react.useCallback)((dir) => {
|
|
1116
1110
|
disarmEdge();
|
|
1117
|
-
|
|
1111
|
+
const fire = () => {
|
|
1118
1112
|
dwellTimer.current = null;
|
|
1119
1113
|
if (!edgePaging) return;
|
|
1120
|
-
edgePaging.lockScroll(true);
|
|
1121
1114
|
if (!lifted.value) {
|
|
1122
1115
|
lifted.value = 1;
|
|
1123
1116
|
edgePaging.ghostW.value = width;
|
|
@@ -1128,7 +1121,9 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1128
1121
|
edgePaging.beginLift(latest.current.event);
|
|
1129
1122
|
}
|
|
1130
1123
|
onEdgeAdvance?.(dir);
|
|
1131
|
-
|
|
1124
|
+
dwellTimer.current = setTimeout(fire, EDGE_REPEAT_MS);
|
|
1125
|
+
};
|
|
1126
|
+
dwellTimer.current = setTimeout(fire, EDGE_DWELL_MS);
|
|
1132
1127
|
}, [
|
|
1133
1128
|
disarmEdge,
|
|
1134
1129
|
edgePaging,
|
|
@@ -1248,55 +1243,87 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1248
1243
|
disarmEdge,
|
|
1249
1244
|
releaseEdge
|
|
1250
1245
|
]);
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1253
|
-
(
|
|
1254
|
-
})
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1246
|
+
const handlePress = (0, react.useCallback)(() => {
|
|
1247
|
+
const { event, onPress: press } = latest.current;
|
|
1248
|
+
press(event);
|
|
1249
|
+
}, []);
|
|
1250
|
+
const canLongPress = !canMove && onLongPress != null;
|
|
1251
|
+
const handleLongPressFromHandle = (0, react.useCallback)(() => {
|
|
1252
|
+
const { event, onLongPress: press } = latest.current;
|
|
1253
|
+
press?.(event);
|
|
1254
|
+
}, []);
|
|
1255
|
+
const resizeGesture = (0, react.useMemo)(() => {
|
|
1256
|
+
const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizable).onStart(() => {
|
|
1257
|
+
dragZ.value = DRAG_EVENT_Z;
|
|
1258
|
+
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
1259
|
+
}).onUpdate((event) => {
|
|
1260
|
+
resizeDelta.value = event.translationY;
|
|
1261
|
+
}).onEnd((event) => {
|
|
1262
|
+
const delta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
|
|
1263
|
+
if (delta === 0) {
|
|
1264
|
+
resizeDelta.value = 0;
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
1268
|
+
(0, react_native_reanimated.runOnJS)(commitDrag)(0, delta);
|
|
1269
|
+
}).onFinalize(() => {
|
|
1270
|
+
dragZ.value = 0;
|
|
1271
|
+
});
|
|
1272
|
+
const tap = react_native_gesture_handler.Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1273
|
+
if (success) handlePress();
|
|
1274
|
+
});
|
|
1275
|
+
const longPress = react_native_gesture_handler.Gesture.LongPress().enabled(canLongPress).runOnJS(true).onStart(() => {
|
|
1276
|
+
handleLongPressFromHandle();
|
|
1277
|
+
});
|
|
1278
|
+
return react_native_gesture_handler.Gesture.Race(pan, tap, longPress);
|
|
1279
|
+
}, [
|
|
1267
1280
|
resizable,
|
|
1268
1281
|
snapMinutes,
|
|
1269
1282
|
cellHeight,
|
|
1270
1283
|
resizeDelta,
|
|
1271
1284
|
dragZ,
|
|
1272
1285
|
commitDrag,
|
|
1273
|
-
notifyDragStart
|
|
1286
|
+
notifyDragStart,
|
|
1287
|
+
handlePress,
|
|
1288
|
+
canLongPress,
|
|
1289
|
+
handleLongPressFromHandle
|
|
1274
1290
|
]);
|
|
1275
|
-
const resizeStartGesture = (0, react.useMemo)(() =>
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
+
const resizeStartGesture = (0, react.useMemo)(() => {
|
|
1292
|
+
const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizableFromStart).onStart(() => {
|
|
1293
|
+
dragZ.value = DRAG_EVENT_Z;
|
|
1294
|
+
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
1295
|
+
}).onUpdate((event) => {
|
|
1296
|
+
resizeStartDelta.value = event.translationY;
|
|
1297
|
+
}).onEnd((event) => {
|
|
1298
|
+
const delta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
|
|
1299
|
+
if (delta === 0) {
|
|
1300
|
+
resizeStartDelta.value = 0;
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
resizeStartDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
1304
|
+
(0, react_native_reanimated.runOnJS)(commitDrag)(delta, 0);
|
|
1305
|
+
}).onFinalize(() => {
|
|
1306
|
+
dragZ.value = 0;
|
|
1307
|
+
});
|
|
1308
|
+
const tap = react_native_gesture_handler.Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1309
|
+
if (success) handlePress();
|
|
1310
|
+
});
|
|
1311
|
+
const longPress = react_native_gesture_handler.Gesture.LongPress().enabled(canLongPress).runOnJS(true).onStart(() => {
|
|
1312
|
+
handleLongPressFromHandle();
|
|
1313
|
+
});
|
|
1314
|
+
return react_native_gesture_handler.Gesture.Race(pan, tap, longPress);
|
|
1315
|
+
}, [
|
|
1291
1316
|
resizableFromStart,
|
|
1292
1317
|
snapMinutes,
|
|
1293
1318
|
cellHeight,
|
|
1294
1319
|
resizeStartDelta,
|
|
1295
1320
|
dragZ,
|
|
1296
1321
|
commitDrag,
|
|
1297
|
-
notifyDragStart
|
|
1322
|
+
notifyDragStart,
|
|
1323
|
+
handlePress,
|
|
1324
|
+
canLongPress,
|
|
1325
|
+
handleLongPressFromHandle
|
|
1298
1326
|
]);
|
|
1299
|
-
const handlePress = () => onPress(positioned.event);
|
|
1300
1327
|
const handleLongPress = !canMove && onLongPress ? () => onLongPress(positioned.event) : void 0;
|
|
1301
1328
|
const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
|
|
1302
1329
|
const pageUnit = mode === "week" ? "week" : daysPerPage === 1 ? "day" : `${daysPerPage} day${daysPerPage === 1 ? "" : "s"}`;
|
|
@@ -1356,11 +1383,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1356
1383
|
});
|
|
1357
1384
|
const box = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
1358
1385
|
...eventSlot,
|
|
1359
|
-
style: [
|
|
1360
|
-
eventSlot.style,
|
|
1361
|
-
boxStyle,
|
|
1362
|
-
hiddenForMove ? { opacity: 0 } : null
|
|
1363
|
-
],
|
|
1386
|
+
style: [eventSlot.style, boxStyle],
|
|
1364
1387
|
children: [
|
|
1365
1388
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
1366
1389
|
event: positioned.event,
|
|
@@ -1376,6 +1399,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1376
1399
|
resizableFromStart ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
1377
1400
|
gesture: resizeStartGesture,
|
|
1378
1401
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1402
|
+
testID: "resize-handle-top",
|
|
1379
1403
|
style: styles$1.resizeHandleTop,
|
|
1380
1404
|
children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
1381
1405
|
})
|
|
@@ -1383,6 +1407,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1383
1407
|
resizable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
1384
1408
|
gesture: resizeGesture,
|
|
1385
1409
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1410
|
+
testID: "resize-handle",
|
|
1386
1411
|
style: styles$1.resizeHandle,
|
|
1387
1412
|
children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
1388
1413
|
})
|
|
@@ -1408,53 +1433,119 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1408
1433
|
slotProps: slot("event", { themed: theme.containers.timeGridEvent })
|
|
1409
1434
|
}) : null] });
|
|
1410
1435
|
}
|
|
1411
|
-
const
|
|
1436
|
+
const AnimatedEventBox = (0, react.memo)(AnimatedEventBoxInner);
|
|
1437
|
+
const hourRange = (minHour, maxHour) => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index);
|
|
1438
|
+
const HourLabel = ({ hour, width, label, ampm, hourComponent }) => {
|
|
1412
1439
|
const theme = require_MonthList.useCalendarTheme();
|
|
1413
1440
|
const slot = require_MonthList.useSlots();
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1425
|
-
...slot("hourLabel", {
|
|
1426
|
-
base: [styles$1.hourLabel, { width: hourColumnWidth }],
|
|
1427
|
-
themed: [theme.text.hourLabel, { color: theme.colors.textMuted }]
|
|
1428
|
-
}),
|
|
1429
|
-
allowFontScaling: false,
|
|
1430
|
-
children: label
|
|
1431
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { ...slot("gridLines", {
|
|
1432
|
-
base: styles$1.hourLine,
|
|
1433
|
-
themed: { backgroundColor: theme.colors.gridLine }
|
|
1434
|
-
}) })]
|
|
1441
|
+
return hourComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1442
|
+
style: { width },
|
|
1443
|
+
children: hourComponent(hour, ampm)
|
|
1444
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1445
|
+
...slot("hourLabel", {
|
|
1446
|
+
base: [styles$1.hourLabel, { width }],
|
|
1447
|
+
themed: [theme.text.hourLabel, { color: theme.colors.textMuted }]
|
|
1448
|
+
}),
|
|
1449
|
+
allowFontScaling: false,
|
|
1450
|
+
children: label
|
|
1435
1451
|
});
|
|
1436
1452
|
};
|
|
1437
|
-
const
|
|
1453
|
+
const HourLines = (0, react.memo)(function HourLines({ hours, timeslots }) {
|
|
1438
1454
|
const theme = require_MonthList.useCalendarTheme();
|
|
1439
1455
|
const slot = require_MonthList.useSlots();
|
|
1440
|
-
const
|
|
1441
|
-
|
|
1442
|
-
minHour,
|
|
1443
|
-
fraction
|
|
1444
|
-
]);
|
|
1445
|
-
const lineSlot = slot("gridLines", {
|
|
1446
|
-
base: [
|
|
1447
|
-
styles$1.timeslotLine,
|
|
1448
|
-
styles$1.nonInteractive,
|
|
1449
|
-
{ left: hourColumnWidth }
|
|
1450
|
-
],
|
|
1456
|
+
const hourLineSlot = slot("gridLines", {
|
|
1457
|
+
base: [styles$1.hourLine, styles$1.nonInteractive],
|
|
1451
1458
|
themed: { backgroundColor: theme.colors.gridLine }
|
|
1452
1459
|
});
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1460
|
+
const timeslotLineSlot = slot("gridLines", {
|
|
1461
|
+
base: [styles$1.timeslotLine, styles$1.nonInteractive],
|
|
1462
|
+
themed: { backgroundColor: theme.colors.gridLine }
|
|
1463
|
+
});
|
|
1464
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1465
|
+
style: [styles$1.fill, styles$1.nonInteractive],
|
|
1466
|
+
children: hours.map((hour) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1467
|
+
style: styles$1.hourCell,
|
|
1468
|
+
children: Array.from({ length: Math.max(1, timeslots) }, (_, slotIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1469
|
+
style: styles$1.hourCell,
|
|
1470
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { ...slotIndex === 0 ? hourLineSlot : timeslotLineSlot })
|
|
1471
|
+
}, slotIndex))
|
|
1472
|
+
}, hour))
|
|
1473
|
+
});
|
|
1474
|
+
});
|
|
1475
|
+
const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scrollY, showLane, showAllDayLabel, headerHeight, weekNumber, ampm, hourComponent }) => {
|
|
1476
|
+
const theme = require_MonthList.useCalendarTheme();
|
|
1477
|
+
const slot = require_MonthList.useSlots();
|
|
1478
|
+
const hours = (0, react.useMemo)(() => hourRange(minHour, maxHour), [minHour, maxHour]);
|
|
1479
|
+
const laneCellHeightStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ height: laneHeight.value }));
|
|
1480
|
+
const pinStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ transform: [{ translateY: scrollY.value }] }));
|
|
1481
|
+
const rowsStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
1482
|
+
top: headerHeight + laneHeight.value + HOUR_LABEL_TOP_INSET,
|
|
1483
|
+
height: (maxHour - minHour) * cellHeight.value
|
|
1484
|
+
}), [
|
|
1485
|
+
minHour,
|
|
1486
|
+
maxHour,
|
|
1487
|
+
headerHeight
|
|
1488
|
+
]);
|
|
1489
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1490
|
+
testID: "hour-gutter",
|
|
1491
|
+
...slot("hourGutter", { base: [styles$1.hourGutter, { width }] }),
|
|
1492
|
+
children: [
|
|
1493
|
+
headerHeight > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1494
|
+
style: [
|
|
1495
|
+
styles$1.gutterCorner,
|
|
1496
|
+
{
|
|
1497
|
+
height: headerHeight,
|
|
1498
|
+
backgroundColor: theme.colors.surface,
|
|
1499
|
+
borderBottomColor: theme.colors.gridLine
|
|
1500
|
+
},
|
|
1501
|
+
pinStyle
|
|
1502
|
+
],
|
|
1503
|
+
children: weekNumber ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1504
|
+
...slot("weekNumber", { themed: [theme.text.hourLabel, { color: theme.colors.textMuted }] }),
|
|
1505
|
+
allowFontScaling: false,
|
|
1506
|
+
children: weekNumber
|
|
1507
|
+
}) : null
|
|
1508
|
+
}) : null,
|
|
1509
|
+
showLane ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1510
|
+
style: [
|
|
1511
|
+
styles$1.laneCell,
|
|
1512
|
+
{ top: headerHeight },
|
|
1513
|
+
{
|
|
1514
|
+
backgroundColor: theme.colors.surface,
|
|
1515
|
+
borderBottomColor: theme.colors.gridLine
|
|
1516
|
+
},
|
|
1517
|
+
laneCellHeightStyle,
|
|
1518
|
+
pinStyle
|
|
1519
|
+
],
|
|
1520
|
+
children: showAllDayLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1521
|
+
...slot("allDayLabel", {
|
|
1522
|
+
base: styles$1.allDayLabel,
|
|
1523
|
+
themed: { color: theme.colors.textMuted }
|
|
1524
|
+
}),
|
|
1525
|
+
allowFontScaling: false,
|
|
1526
|
+
children: "all-day"
|
|
1527
|
+
}) : null
|
|
1528
|
+
}) : null,
|
|
1529
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1530
|
+
style: [styles$1.gutterRows, rowsStyle],
|
|
1531
|
+
children: hours.map((hour) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1532
|
+
style: styles$1.hourCell,
|
|
1533
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1534
|
+
style: [styles$1.hourRow, styles$1.nonInteractive],
|
|
1535
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HourLabel, {
|
|
1536
|
+
hour,
|
|
1537
|
+
width,
|
|
1538
|
+
label: (0, _super_calendar_core.formatHour)(hour, { ampm }),
|
|
1539
|
+
ampm,
|
|
1540
|
+
hourComponent
|
|
1541
|
+
})
|
|
1542
|
+
})
|
|
1543
|
+
}, hour))
|
|
1544
|
+
})
|
|
1545
|
+
]
|
|
1456
1546
|
});
|
|
1457
1547
|
};
|
|
1548
|
+
const HourGutter = (0, react.memo)(HourGutterInner);
|
|
1458
1549
|
const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) => {
|
|
1459
1550
|
const theme = require_MonthList.useCalendarTheme();
|
|
1460
1551
|
const slot = require_MonthList.useSlots();
|
|
@@ -1475,7 +1566,7 @@ const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) =>
|
|
|
1475
1566
|
style: [lineSlot.style, animatedStyle]
|
|
1476
1567
|
});
|
|
1477
1568
|
};
|
|
1478
|
-
const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color, slotName = "businessHours", testID = "business-hours-shade", children }) => {
|
|
1569
|
+
const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color, slotName = "businessHours", testID = "business-hours-shade", interactive = false, children }) => {
|
|
1479
1570
|
const slot = require_MonthList.useSlots();
|
|
1480
1571
|
const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
1481
1572
|
top: (startHour - minHour) * cellHeight.value,
|
|
@@ -1488,7 +1579,7 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
1488
1579
|
const bandSlot = slot(slotName, {
|
|
1489
1580
|
base: [
|
|
1490
1581
|
styles$1.shadeBand,
|
|
1491
|
-
styles$1.nonInteractive,
|
|
1582
|
+
interactive ? styles$1.passThrough : styles$1.nonInteractive,
|
|
1492
1583
|
{
|
|
1493
1584
|
left,
|
|
1494
1585
|
width
|
|
@@ -1498,56 +1589,46 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
1498
1589
|
});
|
|
1499
1590
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1500
1591
|
testID,
|
|
1501
|
-
accessibilityElementsHidden:
|
|
1502
|
-
importantForAccessibility: "no-hide-descendants",
|
|
1592
|
+
accessibilityElementsHidden: !interactive,
|
|
1593
|
+
importantForAccessibility: interactive ? "auto" : "no-hide-descendants",
|
|
1503
1594
|
...bandSlot,
|
|
1504
1595
|
style: [bandSlot.style, animatedStyle],
|
|
1505
1596
|
children
|
|
1506
1597
|
});
|
|
1507
1598
|
};
|
|
1508
|
-
function
|
|
1599
|
+
function BackgroundEventBand({ event, cellHeight, startHour, endHour, minHour, left, width, mode, continuesBefore, continuesAfter, render: Render, onPress, onLongPress }) {
|
|
1600
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => (endHour - startHour) * cellHeight.value, [
|
|
1601
|
+
startHour,
|
|
1602
|
+
endHour,
|
|
1603
|
+
cellHeight
|
|
1604
|
+
]);
|
|
1605
|
+
const handlePress = (0, react.useCallback)(() => onPress(event), [onPress, event]);
|
|
1606
|
+
const handleLongPress = (0, react.useCallback)(() => onLongPress?.(event), [onLongPress, event]);
|
|
1607
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShadeBand, {
|
|
1608
|
+
cellHeight,
|
|
1609
|
+
startHour,
|
|
1610
|
+
endHour,
|
|
1611
|
+
minHour,
|
|
1612
|
+
left,
|
|
1613
|
+
width,
|
|
1614
|
+
slotName: "backgroundEvent",
|
|
1615
|
+
testID: "background-event-shade",
|
|
1616
|
+
interactive: true,
|
|
1617
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Render, {
|
|
1618
|
+
event,
|
|
1619
|
+
mode,
|
|
1620
|
+
boxHeight,
|
|
1621
|
+
continuesBefore,
|
|
1622
|
+
continuesAfter,
|
|
1623
|
+
onPress: handlePress,
|
|
1624
|
+
onLongPress: onLongPress ? handleLongPress : void 0
|
|
1625
|
+
})
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
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 }) {
|
|
1509
1629
|
const theme = require_MonthList.useCalendarTheme();
|
|
1510
1630
|
const slot = require_MonthList.useSlots();
|
|
1511
|
-
const scrollRef = (0, react_native_reanimated.useAnimatedRef)();
|
|
1512
|
-
const gridTopRef = (0, react.useRef)(0);
|
|
1513
|
-
(0, react.useEffect)(() => {
|
|
1514
|
-
if (isActive) onGridTop?.(gridTopRef.current);
|
|
1515
|
-
}, [isActive, onGridTop]);
|
|
1516
1631
|
const heightSource = isActive ? cellHeight : committedCellHeight;
|
|
1517
|
-
const isDragging = (0, react_native_reanimated.useSharedValue)(false);
|
|
1518
|
-
const isActiveShared = (0, react_native_reanimated.useSharedValue)(isActive);
|
|
1519
|
-
(0, react.useEffect)(() => {
|
|
1520
|
-
isActiveShared.value = isActive;
|
|
1521
|
-
}, [isActive, isActiveShared]);
|
|
1522
|
-
const scrollHandler = (0, react_native_reanimated.useAnimatedScrollHandler)({
|
|
1523
|
-
onScroll: (event) => {
|
|
1524
|
-
if (isActiveShared.value && isDragging.value) scrollY.value = event.contentOffset.y;
|
|
1525
|
-
},
|
|
1526
|
-
onBeginDrag: () => {
|
|
1527
|
-
isDragging.value = true;
|
|
1528
|
-
},
|
|
1529
|
-
onEndDrag: (event) => {
|
|
1530
|
-
isDragging.value = false;
|
|
1531
|
-
if (!isWeb$1 && isActiveShared.value) {
|
|
1532
|
-
scrollY.value = event.contentOffset.y;
|
|
1533
|
-
(0, react_native_reanimated.runOnJS)(onSettleOffset)(event.contentOffset.y);
|
|
1534
|
-
}
|
|
1535
|
-
},
|
|
1536
|
-
onMomentumEnd: (event) => {
|
|
1537
|
-
isDragging.value = false;
|
|
1538
|
-
if (!isWeb$1 && isActiveShared.value) {
|
|
1539
|
-
scrollY.value = event.contentOffset.y;
|
|
1540
|
-
(0, react_native_reanimated.runOnJS)(onSettleOffset)(event.contentOffset.y);
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
});
|
|
1544
|
-
(0, react_native_reanimated.useAnimatedReaction)(() => scrollY.value, (current, previous) => {
|
|
1545
|
-
if (!isActiveShared.value && current !== previous) (0, react_native_reanimated.scrollTo)(scrollRef, 0, current, false);
|
|
1546
|
-
});
|
|
1547
|
-
(0, react_native_reanimated.useAnimatedReaction)(() => isActiveShared.value, (active, previous) => {
|
|
1548
|
-
if (isWeb$1 || !active || active === previous) return;
|
|
1549
|
-
(0, react_native_reanimated.scrollTo)(scrollRef, 0, scrollY.value, false);
|
|
1550
|
-
});
|
|
1551
1632
|
const days = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
|
|
1552
1633
|
mode,
|
|
1553
1634
|
date,
|
|
@@ -1559,8 +1640,8 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1559
1640
|
]);
|
|
1560
1641
|
const daysPerPage = (0, _super_calendar_core.pageStepDays)(mode, date, weekStartsOn, numberOfDays);
|
|
1561
1642
|
const dayCount = days.length;
|
|
1562
|
-
const dayWidth =
|
|
1563
|
-
const dayLeft = (dayIndex) =>
|
|
1643
|
+
const dayWidth = width / dayCount;
|
|
1644
|
+
const dayLeft = (dayIndex) => dayIndex * dayWidth;
|
|
1564
1645
|
const dayOrdinals = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[0])), [days]);
|
|
1565
1646
|
const dayLayouts = (0, react.useMemo)(() => days.map((day) => (0, _super_calendar_core.layoutDayEvents)(events, day)), [days, events]);
|
|
1566
1647
|
const [multiDayMove, setMultiDayMove] = (0, react.useState)(null);
|
|
@@ -1587,7 +1668,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1587
1668
|
const date = onLongPressCell && cellDateFromTouch(event);
|
|
1588
1669
|
if (date) onLongPressCell?.(date);
|
|
1589
1670
|
};
|
|
1590
|
-
const hoursRange = (0, react.useMemo)(() =>
|
|
1671
|
+
const hoursRange = (0, react.useMemo)(() => hourRange(minHour, maxHour), [minHour, maxHour]);
|
|
1591
1672
|
const now = (0, _super_calendar_core.useNow)(showNowIndicator && isActive, {
|
|
1592
1673
|
now: nowProp,
|
|
1593
1674
|
timeZone: nowTimeZone
|
|
@@ -1600,23 +1681,24 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1600
1681
|
maxHour,
|
|
1601
1682
|
heightSource
|
|
1602
1683
|
]);
|
|
1603
|
-
const
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
return react_native_gesture_handler.Gesture.Simultaneous(pinch, react_native_gesture_handler.Gesture.Native());
|
|
1613
|
-
}, [
|
|
1614
|
-
cellHeight,
|
|
1615
|
-
committedCellHeight,
|
|
1616
|
-
pinchStartCellHeight,
|
|
1617
|
-
minHourHeight,
|
|
1618
|
-
maxHourHeight
|
|
1684
|
+
const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
|
|
1685
|
+
const gridStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
1686
|
+
top: headerOffset + laneHeight.value + HOUR_LABEL_TOP_INSET,
|
|
1687
|
+
height: (maxHour - minHour) * heightSource.value
|
|
1688
|
+
}), [
|
|
1689
|
+
minHour,
|
|
1690
|
+
maxHour,
|
|
1691
|
+
heightSource,
|
|
1692
|
+
headerOffset
|
|
1619
1693
|
]);
|
|
1694
|
+
const laneHeightStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
1695
|
+
height: Math.max(LANE_BAND_FLOOR, laneHeight.value),
|
|
1696
|
+
borderBottomWidth: laneHeight.value >= LANE_BAND_FLOOR ? react_native.StyleSheet.hairlineWidth : 0
|
|
1697
|
+
}));
|
|
1698
|
+
const pinStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ transform: [{ translateY: scrollY.value }] }));
|
|
1699
|
+
const reportLaneLayout = (0, react.useCallback)((event) => {
|
|
1700
|
+
onLaneLayout(pageIndex, event.nativeEvent.layout.height);
|
|
1701
|
+
}, [onLaneLayout, pageIndex]);
|
|
1620
1702
|
const createEnabled = onCreateEvent != null;
|
|
1621
1703
|
const createActive = (0, react_native_reanimated.useSharedValue)(0);
|
|
1622
1704
|
const createTop = (0, react_native_reanimated.useSharedValue)(0);
|
|
@@ -1659,7 +1741,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1659
1741
|
const idx = dayCount === 1 ? 0 : Math.floor(event.x / dayWidth);
|
|
1660
1742
|
createDayIndex.value = idx;
|
|
1661
1743
|
createStartY.value = event.y;
|
|
1662
|
-
createLeft.value =
|
|
1744
|
+
createLeft.value = idx * dayWidth;
|
|
1663
1745
|
createWidth.value = dayWidth;
|
|
1664
1746
|
createTop.value = event.y;
|
|
1665
1747
|
createHeight.value = 0;
|
|
@@ -1684,7 +1766,6 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1684
1766
|
createEnabled,
|
|
1685
1767
|
dayCount,
|
|
1686
1768
|
dayWidth,
|
|
1687
|
-
hourColumnWidth,
|
|
1688
1769
|
heightSource,
|
|
1689
1770
|
snapMinutes,
|
|
1690
1771
|
commitCreate,
|
|
@@ -1746,7 +1827,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1746
1827
|
}
|
|
1747
1828
|
});
|
|
1748
1829
|
const cellLayer = onPressCell || onLongPressCell || createEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
1749
|
-
style:
|
|
1830
|
+
style: styles$1.cellPressLayer,
|
|
1750
1831
|
onPress: onPressCell ? handleBackgroundPress : void 0,
|
|
1751
1832
|
onLongPress: !createEnabled && onLongPressCell ? handleBackgroundLongPress : void 0,
|
|
1752
1833
|
tabIndex: -1,
|
|
@@ -1754,201 +1835,234 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1754
1835
|
accessibilityElementsHidden: true
|
|
1755
1836
|
}) : null;
|
|
1756
1837
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
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
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1838
|
+
testID: "time-grid-page",
|
|
1839
|
+
style: [styles$1.page, {
|
|
1840
|
+
width,
|
|
1841
|
+
height
|
|
1842
|
+
}],
|
|
1843
|
+
accessibilityElementsHidden: !isActive,
|
|
1844
|
+
importantForAccessibility: isActive ? "auto" : "no-hide-descendants",
|
|
1845
|
+
children: [
|
|
1846
|
+
pagedHeader ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1847
|
+
testID: "paged-header",
|
|
1848
|
+
style: [
|
|
1849
|
+
styles$1.pagedHeader,
|
|
1850
|
+
{
|
|
1851
|
+
backgroundColor: theme.colors.surface,
|
|
1852
|
+
borderBottomColor: theme.colors.gridLine
|
|
1853
|
+
},
|
|
1854
|
+
pinStyle
|
|
1855
|
+
],
|
|
1856
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DayHeaderRow, {
|
|
1857
|
+
days,
|
|
1858
|
+
mode,
|
|
1859
|
+
dayWidth,
|
|
1860
|
+
weekdayFormat,
|
|
1861
|
+
locale,
|
|
1862
|
+
activeDate,
|
|
1863
|
+
onPressDateHeader
|
|
1864
|
+
})
|
|
1865
|
+
}) : null,
|
|
1866
|
+
showAllDayEventCell ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1867
|
+
testID: "all-day-band",
|
|
1868
|
+
style: [
|
|
1869
|
+
styles$1.laneBand,
|
|
1870
|
+
{
|
|
1871
|
+
top: headerOffset,
|
|
1872
|
+
backgroundColor: theme.colors.surface,
|
|
1873
|
+
borderBottomColor: theme.colors.gridLine
|
|
1874
|
+
},
|
|
1875
|
+
laneHeightStyle,
|
|
1876
|
+
pinStyle
|
|
1877
|
+
],
|
|
1878
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AllDayLane, {
|
|
1879
|
+
days,
|
|
1880
|
+
events,
|
|
1881
|
+
mode,
|
|
1882
|
+
dayWidth,
|
|
1883
|
+
renderEvent,
|
|
1884
|
+
keyExtractor,
|
|
1885
|
+
onPressEvent,
|
|
1886
|
+
onLongPressEvent,
|
|
1887
|
+
onLayout: reportLaneLayout
|
|
1888
|
+
})
|
|
1889
|
+
}) : null,
|
|
1890
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
1891
|
+
style: [styles$1.grid, gridStyle],
|
|
1892
|
+
children: [
|
|
1893
|
+
cellLayer && backgroundGesture ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
1894
|
+
gesture: backgroundGesture,
|
|
1895
|
+
children: cellLayer
|
|
1896
|
+
}) : cellLayer,
|
|
1897
|
+
days.map((day, dayIndex) => {
|
|
1898
|
+
if (!highlightWeekends || !(0, _super_calendar_core.isWeekend)(day)) return null;
|
|
1899
|
+
const shadeSlot = slot("weekendShade", {
|
|
1900
|
+
base: [
|
|
1814
1901
|
styles$1.weekendColumn,
|
|
1815
1902
|
styles$1.nonInteractive,
|
|
1816
1903
|
{
|
|
1817
1904
|
left: dayLeft(dayIndex),
|
|
1818
1905
|
width: dayWidth
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1906
|
+
}
|
|
1907
|
+
],
|
|
1908
|
+
themed: { backgroundColor: theme.colors.weekendBackground }
|
|
1909
|
+
});
|
|
1910
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1911
|
+
testID: "weekend-shade",
|
|
1912
|
+
...shadeSlot,
|
|
1913
|
+
style: [shadeSlot.style, fullHeightStyle]
|
|
1914
|
+
}, `weekend-${day.toISOString()}`);
|
|
1915
|
+
}),
|
|
1916
|
+
calendarCellStyle ? days.map((day, dayIndex) => {
|
|
1917
|
+
const cellStyle = calendarCellStyle(day);
|
|
1918
|
+
return cellStyle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { style: [
|
|
1919
|
+
styles$1.weekendColumn,
|
|
1920
|
+
styles$1.nonInteractive,
|
|
1921
|
+
{
|
|
1922
|
+
left: dayLeft(dayIndex),
|
|
1923
|
+
width: dayWidth
|
|
1924
|
+
},
|
|
1925
|
+
cellStyle,
|
|
1926
|
+
fullHeightStyle
|
|
1927
|
+
] }, `cell-${day.toISOString()}`) : null;
|
|
1928
|
+
}) : null,
|
|
1929
|
+
businessHours ? days.flatMap((day, dayIndex) => (0, _super_calendar_core.closedHourBands)(day, businessHours, minHour, maxHour).map((band, bandIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShadeBand, {
|
|
1930
|
+
cellHeight: heightSource,
|
|
1931
|
+
startHour: band.start,
|
|
1932
|
+
endHour: band.end,
|
|
1933
|
+
minHour,
|
|
1934
|
+
left: dayLeft(dayIndex),
|
|
1935
|
+
width: dayWidth,
|
|
1936
|
+
color: renderBusinessHours ? void 0 : theme.colors.outsideHoursBackground,
|
|
1937
|
+
children: renderBusinessHours?.({
|
|
1938
|
+
date: day,
|
|
1939
|
+
start: band.start,
|
|
1940
|
+
end: band.end
|
|
1941
|
+
})
|
|
1942
|
+
}, `closed-${day.toISOString()}-${bandIndex}`))) : null,
|
|
1943
|
+
days.flatMap((day, dayIndex) => {
|
|
1944
|
+
const dayStart = (0, date_fns.startOfDay)(day);
|
|
1945
|
+
const nextDayStart = (0, date_fns.addDays)(dayStart, 1);
|
|
1946
|
+
return (0, _super_calendar_core.backgroundBandsForDay)(events, day).map((b) => ({
|
|
1839
1947
|
...b,
|
|
1840
1948
|
startHours: Math.max(b.startHours, minHour),
|
|
1841
1949
|
endHours: Math.min(b.endHours, maxHour)
|
|
1842
|
-
})).filter((b) => b.endHours > b.startHours).map((b, bandIndex) =>
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
minHour,
|
|
1847
|
-
left: dayLeft(dayIndex),
|
|
1848
|
-
width: dayWidth,
|
|
1849
|
-
color: theme.colors.backgroundEvent,
|
|
1850
|
-
slotName: "backgroundEvent",
|
|
1851
|
-
testID: "background-event-shade"
|
|
1852
|
-
}, `bg-${day.toISOString()}-${bandIndex}`))),
|
|
1853
|
-
days.map((day, dayIndex) => {
|
|
1854
|
-
const separatorSlot = slot("daySeparator", {
|
|
1855
|
-
base: [
|
|
1856
|
-
styles$1.daySeparator,
|
|
1857
|
-
styles$1.nonInteractive,
|
|
1858
|
-
{ left: dayLeft(dayIndex) }
|
|
1859
|
-
],
|
|
1860
|
-
themed: { backgroundColor: theme.colors.gridLine }
|
|
1861
|
-
});
|
|
1862
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1863
|
-
...separatorSlot,
|
|
1864
|
-
style: [separatorSlot.style, fullHeightStyle]
|
|
1865
|
-
}, `separator-${day.toISOString()}`);
|
|
1866
|
-
}),
|
|
1867
|
-
hoursRange.map((hour) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HourRow, {
|
|
1868
|
-
hour,
|
|
1869
|
-
minHour,
|
|
1870
|
-
cellHeight: heightSource,
|
|
1871
|
-
hourColumnWidth,
|
|
1872
|
-
label: (0, _super_calendar_core.formatHour)(hour, { ampm }),
|
|
1873
|
-
ampm,
|
|
1874
|
-
hourComponent
|
|
1875
|
-
}, hour)),
|
|
1876
|
-
timeslots > 1 ? hoursRange.flatMap((hour) => Array.from({ length: timeslots - 1 }, (_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeslotLine, {
|
|
1877
|
-
hour,
|
|
1878
|
-
minHour,
|
|
1879
|
-
fraction: (i + 1) / timeslots,
|
|
1880
|
-
cellHeight: heightSource,
|
|
1881
|
-
hourColumnWidth
|
|
1882
|
-
}, `slot-${hour}-${i}`))) : null,
|
|
1883
|
-
dayLayouts.flatMap((layout, dayIndex) => layout.filter((p) => p.startHours < maxHour && p.startHours + p.durationHours > minHour).map((positioned, eventIndex) => {
|
|
1884
|
-
const columnWidth = dayWidth / positioned.columns;
|
|
1885
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedEventBox, {
|
|
1886
|
-
positioned,
|
|
1887
|
-
eventIndex: events.indexOf(positioned.event),
|
|
1888
|
-
movingEvent,
|
|
1889
|
-
onMovePreview: setMultiDayMove,
|
|
1950
|
+
})).filter((b) => b.endHours > b.startHours).map((b, bandIndex) => {
|
|
1951
|
+
const key = `bg-${day.toISOString()}-${keyExtractor(b.event, bandIndex)}`;
|
|
1952
|
+
return renderBackgroundEvent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BackgroundEventBand, {
|
|
1953
|
+
event: b.event,
|
|
1890
1954
|
cellHeight: heightSource,
|
|
1955
|
+
startHour: b.startHours,
|
|
1956
|
+
endHour: b.endHours,
|
|
1891
1957
|
minHour,
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
width: columnWidth,
|
|
1895
|
-
dayLeftPx: dayLeft(dayIndex),
|
|
1896
|
-
nextDayDirection: isRTL ? -1 : 1,
|
|
1897
|
-
dayWidth,
|
|
1898
|
-
dayIndex,
|
|
1899
|
-
dayCount: days.length,
|
|
1900
|
-
dayOrdinals,
|
|
1958
|
+
left: dayLeft(dayIndex),
|
|
1959
|
+
width: dayWidth,
|
|
1901
1960
|
mode,
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
minEventHeight,
|
|
1906
|
-
eventGap,
|
|
1907
|
-
showDragHandle,
|
|
1908
|
-
eventStartEditable,
|
|
1909
|
-
eventDurationEditable,
|
|
1961
|
+
continuesBefore: b.event.start < dayStart,
|
|
1962
|
+
continuesAfter: b.event.end > nextDayStart,
|
|
1963
|
+
render: renderBackgroundEvent,
|
|
1910
1964
|
onPress: onPressEvent,
|
|
1911
|
-
onLongPress: onLongPressEvent
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1965
|
+
onLongPress: onLongPressEvent
|
|
1966
|
+
}, key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShadeBand, {
|
|
1967
|
+
cellHeight: heightSource,
|
|
1968
|
+
startHour: b.startHours,
|
|
1969
|
+
endHour: b.endHours,
|
|
1970
|
+
minHour,
|
|
1971
|
+
left: dayLeft(dayIndex),
|
|
1972
|
+
width: dayWidth,
|
|
1973
|
+
color: theme.colors.backgroundEvent,
|
|
1974
|
+
slotName: "backgroundEvent",
|
|
1975
|
+
testID: "background-event-shade"
|
|
1976
|
+
}, key);
|
|
1977
|
+
});
|
|
1978
|
+
}),
|
|
1979
|
+
days.map((day, dayIndex) => {
|
|
1980
|
+
const separatorSlot = slot("daySeparator", {
|
|
1981
|
+
base: [
|
|
1982
|
+
styles$1.daySeparator,
|
|
1983
|
+
styles$1.nonInteractive,
|
|
1984
|
+
{ left: dayLeft(dayIndex) }
|
|
1985
|
+
],
|
|
1986
|
+
themed: { backgroundColor: theme.colors.gridLine }
|
|
1987
|
+
});
|
|
1988
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1989
|
+
...separatorSlot,
|
|
1990
|
+
style: [separatorSlot.style, fullHeightStyle]
|
|
1991
|
+
}, `separator-${day.toISOString()}`);
|
|
1992
|
+
}),
|
|
1993
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HourLines, {
|
|
1994
|
+
hours: hoursRange,
|
|
1995
|
+
timeslots
|
|
1996
|
+
}),
|
|
1997
|
+
dayLayouts.flatMap((layout, dayIndex) => layout.filter((p) => p.startHours < maxHour && p.startHours + p.durationHours > minHour).map((positioned, eventIndex) => {
|
|
1998
|
+
const columnWidth = dayWidth / positioned.columns;
|
|
1999
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedEventBox, {
|
|
2000
|
+
positioned,
|
|
2001
|
+
eventIndex: events.indexOf(positioned.event),
|
|
2002
|
+
movingEvent,
|
|
2003
|
+
onMovePreview: setMultiDayMove,
|
|
1920
2004
|
cellHeight: heightSource,
|
|
1921
|
-
dayWidth,
|
|
1922
|
-
hourColumnWidth,
|
|
1923
2005
|
minHour,
|
|
2006
|
+
maxHour,
|
|
2007
|
+
left: dayLeft(dayIndex) + positioned.column * columnWidth,
|
|
2008
|
+
width: columnWidth,
|
|
2009
|
+
dayLeftPx: dayLeft(dayIndex),
|
|
2010
|
+
nextDayDirection: isRTL ? -1 : 1,
|
|
2011
|
+
dayWidth,
|
|
2012
|
+
dayIndex,
|
|
2013
|
+
dayCount: days.length,
|
|
2014
|
+
dayOrdinals,
|
|
1924
2015
|
mode,
|
|
2016
|
+
daysPerPage,
|
|
1925
2017
|
renderEvent,
|
|
2018
|
+
snapMinutes,
|
|
1926
2019
|
minEventHeight,
|
|
1927
|
-
eventGap
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
2020
|
+
eventGap,
|
|
2021
|
+
showDragHandle,
|
|
2022
|
+
eventStartEditable,
|
|
2023
|
+
eventDurationEditable,
|
|
2024
|
+
onPress: onPressEvent,
|
|
2025
|
+
onLongPress: onLongPressEvent,
|
|
2026
|
+
onDragEvent,
|
|
2027
|
+
onDragStart,
|
|
2028
|
+
onEdgeAdvance
|
|
2029
|
+
}, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
|
|
2030
|
+
})),
|
|
2031
|
+
multiDayMove ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MultiDayMovePreview, {
|
|
2032
|
+
move: multiDayMove,
|
|
2033
|
+
days,
|
|
2034
|
+
cellHeight: heightSource,
|
|
2035
|
+
dayWidth,
|
|
2036
|
+
minHour,
|
|
2037
|
+
mode,
|
|
2038
|
+
renderEvent,
|
|
2039
|
+
minEventHeight,
|
|
2040
|
+
eventGap
|
|
2041
|
+
}) : null,
|
|
2042
|
+
showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NowIndicator, {
|
|
2043
|
+
cellHeight: heightSource,
|
|
2044
|
+
nowHours,
|
|
2045
|
+
minHour,
|
|
2046
|
+
left: dayLeft(nowDayIndex),
|
|
2047
|
+
width: dayWidth,
|
|
2048
|
+
color: theme.colors.nowIndicator
|
|
2049
|
+
}) : null,
|
|
2050
|
+
createEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
2051
|
+
...ghostSlot,
|
|
2052
|
+
style: [ghostSlot.style, createGhostStyle]
|
|
2053
|
+
}) : null
|
|
2054
|
+
]
|
|
1943
2055
|
})
|
|
1944
|
-
|
|
2056
|
+
]
|
|
1945
2057
|
});
|
|
1946
2058
|
}
|
|
1947
2059
|
const TimetablePage = (0, react.memo)(TimetablePageInner);
|
|
1948
|
-
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
2060
|
+
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 }) {
|
|
1949
2061
|
const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
|
|
1950
2062
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
1951
2063
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
2064
|
+
const pagedHeader = renderHeader == null;
|
|
2065
|
+
const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
|
|
1952
2066
|
const labeledRenderEvent = (0, react.useMemo)(() => require_MonthList.withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, ampm), [
|
|
1953
2067
|
renderEvent,
|
|
1954
2068
|
eventAccessibilityLabel,
|
|
@@ -1962,34 +2076,76 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1962
2076
|
eventOverlap,
|
|
1963
2077
|
events
|
|
1964
2078
|
]);
|
|
1965
|
-
const { width
|
|
2079
|
+
const { width } = (0, react_native.useWindowDimensions)();
|
|
1966
2080
|
const listRef = (0, react.useRef)(null);
|
|
1967
2081
|
const pagerRef = (0, react.useRef)(null);
|
|
1968
2082
|
const containerRef = (0, react.useRef)(null);
|
|
1969
|
-
const
|
|
1970
|
-
const
|
|
2083
|
+
const viewportRef = (0, react.useRef)(null);
|
|
2084
|
+
const pagerLayoutWidthRef = (0, react.useRef)(-1);
|
|
2085
|
+
const scrollRef = (0, react_native_reanimated.useAnimatedRef)();
|
|
1971
2086
|
const [containerWidth, setContainerWidth] = (0, react.useState)(width);
|
|
1972
|
-
const [
|
|
2087
|
+
const [pagerLayoutWidth, setPagerLayoutWidth] = (0, react.useState)(null);
|
|
2088
|
+
const columnsWidth = pagerLayoutWidth ?? containerWidth - hourColumnWidth;
|
|
2089
|
+
const pagerReady = pagerLayoutWidth != null && pagerLayoutWidth > 0;
|
|
2090
|
+
const [tallestLane, setTallestLane] = (0, react.useState)(0);
|
|
1973
2091
|
const weekAnchored = mode === "week" || mode === "custom" && weekEndsOn != null;
|
|
1974
2092
|
const step = weekAnchored ? 7 : (0, _super_calendar_core.viewDayCount)(mode, numberOfDays);
|
|
1975
2093
|
const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR$1 - clampedMinHour) * hourHeight;
|
|
1976
2094
|
const scrollY = (0, react_native_reanimated.useSharedValue)(seedDefaultY);
|
|
2095
|
+
const scrollHandler = (0, react_native_reanimated.useAnimatedScrollHandler)({ onScroll: (event) => {
|
|
2096
|
+
scrollY.value = event.contentOffset.y;
|
|
2097
|
+
} });
|
|
2098
|
+
const webSeededRef = (0, react.useRef)(!isWeb$1);
|
|
2099
|
+
const seedWebScroll = (0, react.useCallback)(() => {
|
|
2100
|
+
if (webSeededRef.current) return;
|
|
2101
|
+
const node = scrollRef.current;
|
|
2102
|
+
if (!node) return;
|
|
2103
|
+
node.scrollTo({
|
|
2104
|
+
y: seedDefaultY,
|
|
2105
|
+
animated: false
|
|
2106
|
+
});
|
|
2107
|
+
const dom = node.getScrollableNode();
|
|
2108
|
+
if (dom && dom.scrollHeight > dom.clientHeight) webSeededRef.current = true;
|
|
2109
|
+
}, [scrollRef, seedDefaultY]);
|
|
2110
|
+
const laneHeights = (0, react_native_reanimated.useSharedValue)({});
|
|
2111
|
+
const laneHeightsRef = (0, react.useRef)({});
|
|
2112
|
+
const pagerOffset = (0, react_native_reanimated.useSharedValue)(PAGE_WINDOW * columnsWidth);
|
|
2113
|
+
const pagerSharedValues = (0, react.useMemo)(() => ({ scrollOffset: pagerOffset }), [pagerOffset]);
|
|
2114
|
+
const activeIndexShared = (0, react_native_reanimated.useSharedValue)(PAGE_WINDOW);
|
|
2115
|
+
const laneHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
2116
|
+
if (!showAllDayEventCell || columnsWidth <= 0) return 0;
|
|
2117
|
+
const heights = laneHeights.value;
|
|
2118
|
+
let progress = pagerOffset.value / columnsWidth;
|
|
2119
|
+
if (Math.abs(progress - activeIndexShared.value) > 1.5) progress = activeIndexShared.value;
|
|
2120
|
+
const from = Math.floor(progress);
|
|
2121
|
+
const fraction = progress - from;
|
|
2122
|
+
const start = heights[from] ?? 0;
|
|
2123
|
+
return start + ((heights[from + 1] ?? start) - start) * fraction;
|
|
2124
|
+
}, [showAllDayEventCell, columnsWidth]);
|
|
2125
|
+
const reportLaneHeight = (0, react.useCallback)((index, height) => {
|
|
2126
|
+
setTallestLane((tallest) => height > tallest ? height : tallest);
|
|
2127
|
+
if (laneHeightsRef.current[index] === height) return;
|
|
2128
|
+
laneHeightsRef.current = {
|
|
2129
|
+
...laneHeightsRef.current,
|
|
2130
|
+
[index]: height
|
|
2131
|
+
};
|
|
2132
|
+
laneHeights.value = laneHeightsRef.current;
|
|
2133
|
+
}, [laneHeights]);
|
|
2134
|
+
const viewportTop = (0, react_native_reanimated.useSharedValue)(0);
|
|
1977
2135
|
const pagerLeft = (0, react_native_reanimated.useSharedValue)(0);
|
|
1978
|
-
const pagerTop = (0, react_native_reanimated.useSharedValue)(0);
|
|
1979
2136
|
const pagerWidth = (0, react_native_reanimated.useSharedValue)(width);
|
|
1980
|
-
const
|
|
2137
|
+
const pagerTop = (0, react_native_reanimated.useDerivedValue)(() => viewportTop.value - scrollY.value);
|
|
1981
2138
|
const ghostX = (0, react_native_reanimated.useSharedValue)(0);
|
|
1982
2139
|
const ghostY = (0, react_native_reanimated.useSharedValue)(0);
|
|
1983
2140
|
const ghostW = (0, react_native_reanimated.useSharedValue)(0);
|
|
1984
2141
|
const ghostH = (0, react_native_reanimated.useSharedValue)(0);
|
|
1985
2142
|
const ghostVisible = (0, react_native_reanimated.useSharedValue)(0);
|
|
1986
|
-
const gridTop = (0, react_native_reanimated.useSharedValue)(0);
|
|
1987
2143
|
const [liftedEvent, setLiftedEvent] = (0, react.useState)(null);
|
|
1988
2144
|
const liftedEventRef = (0, react.useRef)(null);
|
|
1989
2145
|
const dropRef = (0, react.useRef)({
|
|
1990
2146
|
headerDays: [],
|
|
1991
|
-
|
|
1992
|
-
|
|
2147
|
+
columnsWidth,
|
|
2148
|
+
headerOffset,
|
|
1993
2149
|
minHour: clampedMinHour,
|
|
1994
2150
|
maxHour: clampedMaxHour,
|
|
1995
2151
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
@@ -2004,17 +2160,16 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2004
2160
|
ghostVisible.value = 0;
|
|
2005
2161
|
liftedEventRef.current = null;
|
|
2006
2162
|
setLiftedEvent(null);
|
|
2007
|
-
setEdgePagingLock(false);
|
|
2008
2163
|
}, [ghostVisible]);
|
|
2009
2164
|
const commitLiftedDrop = (0, react.useCallback)((ghostLocalX, ghostLocalY) => {
|
|
2010
|
-
const { headerDays: days,
|
|
2165
|
+
const { headerDays: days, columnsWidth: cw, headerOffset: headerH, minHour: min, maxHour: max, snapMinutes: snap, onDragEvent: onDrag, onChangeDate: onDate } = dropRef.current;
|
|
2011
2166
|
const ev = liftedEventRef.current;
|
|
2012
2167
|
const duration = ev ? ev.end.getTime() - ev.start.getTime() : 0;
|
|
2013
2168
|
clearLift();
|
|
2014
2169
|
if (!ev || !onDrag || days.length === 0) return;
|
|
2015
|
-
const dayWidth =
|
|
2016
|
-
const col = Math.min(Math.max(Math.floor(
|
|
2017
|
-
const rawMinutes = (min + (ghostLocalY -
|
|
2170
|
+
const dayWidth = cw / days.length;
|
|
2171
|
+
const col = Math.min(Math.max(Math.floor(ghostLocalX / dayWidth), 0), days.length - 1);
|
|
2172
|
+
const rawMinutes = (min + (ghostLocalY - headerH - laneHeight.value - HOUR_LABEL_TOP_INSET) / cellHeight.value) * MINUTES_PER_HOUR$1;
|
|
2018
2173
|
const minutes = (0, _super_calendar_core.clampMoveStartMinutes)(Math.round(rawMinutes / snap) * snap, min, max, snap);
|
|
2019
2174
|
const start = new Date(days[col]);
|
|
2020
2175
|
start.setHours(0, 0, 0, 0);
|
|
@@ -2022,18 +2177,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2022
2177
|
if (onDrag(ev, start, new Date(start.getTime() + duration)) === false) onDate(ev.start);
|
|
2023
2178
|
}, [
|
|
2024
2179
|
clearLift,
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
cellHeight
|
|
2180
|
+
cellHeight,
|
|
2181
|
+
laneHeight
|
|
2028
2182
|
]);
|
|
2029
|
-
const handleGridTop = (0, react.useCallback)((y) => {
|
|
2030
|
-
gridTop.value = y;
|
|
2031
|
-
}, [gridTop]);
|
|
2032
2183
|
const edgePaging = (0, react.useMemo)(() => ({
|
|
2033
2184
|
pagerLeft,
|
|
2034
2185
|
pagerTop,
|
|
2035
2186
|
pagerWidth,
|
|
2036
|
-
lockScroll: setEdgePagingLock,
|
|
2037
2187
|
ghostX,
|
|
2038
2188
|
ghostY,
|
|
2039
2189
|
ghostW,
|
|
@@ -2053,11 +2203,37 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2053
2203
|
beginLift,
|
|
2054
2204
|
commitLiftedDrop
|
|
2055
2205
|
]);
|
|
2056
|
-
const offsetSeedRef = (0, react.useRef)(null);
|
|
2057
|
-
const captureOffsetSeed = (0, react.useCallback)((y) => {
|
|
2058
|
-
offsetSeedRef.current = y;
|
|
2059
|
-
}, []);
|
|
2060
2206
|
const committedCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
2207
|
+
const pinching = (0, react_native_reanimated.useSharedValue)(false);
|
|
2208
|
+
(0, react_native_reanimated.useAnimatedReaction)(() => cellHeight.value, (value) => {
|
|
2209
|
+
if (!pinching.value) committedCellHeight.value = value;
|
|
2210
|
+
});
|
|
2211
|
+
const pinchStartCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
2212
|
+
const zoomGesture = (0, react.useMemo)(() => {
|
|
2213
|
+
const pinch = react_native_gesture_handler.Gesture.Pinch().onStart(() => {
|
|
2214
|
+
pinching.value = true;
|
|
2215
|
+
pinchStartCellHeight.value = cellHeight.value;
|
|
2216
|
+
}).onUpdate((event) => {
|
|
2217
|
+
cellHeight.value = Math.min(maxHourHeight, Math.max(minHourHeight, pinchStartCellHeight.value * event.scale));
|
|
2218
|
+
}).onFinalize(() => {
|
|
2219
|
+
pinching.value = false;
|
|
2220
|
+
committedCellHeight.value = cellHeight.value;
|
|
2221
|
+
});
|
|
2222
|
+
return react_native_gesture_handler.Gesture.Simultaneous(pinch, react_native_gesture_handler.Gesture.Native());
|
|
2223
|
+
}, [
|
|
2224
|
+
cellHeight,
|
|
2225
|
+
committedCellHeight,
|
|
2226
|
+
pinching,
|
|
2227
|
+
pinchStartCellHeight,
|
|
2228
|
+
minHourHeight,
|
|
2229
|
+
maxHourHeight
|
|
2230
|
+
]);
|
|
2231
|
+
const pagerHeight = headerOffset + HOUR_LABEL_TOP_INSET + (clampedMaxHour - clampedMinHour) * maxHourHeight + tallestLane;
|
|
2232
|
+
const gridHeightStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ height: headerOffset + laneHeight.value + HOUR_LABEL_TOP_INSET + (clampedMaxHour - clampedMinHour) * cellHeight.value }), [
|
|
2233
|
+
clampedMinHour,
|
|
2234
|
+
clampedMaxHour,
|
|
2235
|
+
headerOffset
|
|
2236
|
+
]);
|
|
2061
2237
|
useWebGridZoom(isWeb$1, containerRef, cellHeight, committedCellHeight, minHourHeight, maxHourHeight);
|
|
2062
2238
|
const [anchorDate] = (0, react.useState)(date);
|
|
2063
2239
|
const anchor = (0, react.useMemo)(() => weekAnchored ? (0, date_fns.startOfWeek)(anchorDate, { weekStartsOn }) : (0, date_fns.startOfDay)(anchorDate), [
|
|
@@ -2075,8 +2251,31 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2075
2251
|
step,
|
|
2076
2252
|
weekStartsOn
|
|
2077
2253
|
])(date);
|
|
2254
|
+
(0, react.useEffect)(() => {
|
|
2255
|
+
activeIndexShared.value = activeIndex;
|
|
2256
|
+
}, [activeIndex, activeIndexShared]);
|
|
2078
2257
|
const viewedIndexRef = (0, react.useRef)(activeIndex);
|
|
2079
2258
|
const pendingScrollIndexRef = (0, react.useRef)(null);
|
|
2259
|
+
const weekNumber = (0, react.useMemo)(() => {
|
|
2260
|
+
if (!pagedHeader || !showWeekNumber || hourColumnWidth === 0) return null;
|
|
2261
|
+
const days = (0, _super_calendar_core.getViewDays)(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays);
|
|
2262
|
+
const thursday = days.find((d) => d.getDay() === 4) ?? days[0];
|
|
2263
|
+
return thursday ? `${weekNumberPrefix}${(0, date_fns.getISOWeek)(thursday)}` : null;
|
|
2264
|
+
}, [
|
|
2265
|
+
pagedHeader,
|
|
2266
|
+
showWeekNumber,
|
|
2267
|
+
hourColumnWidth,
|
|
2268
|
+
mode,
|
|
2269
|
+
pageDates,
|
|
2270
|
+
activeIndex,
|
|
2271
|
+
date,
|
|
2272
|
+
weekStartsOn,
|
|
2273
|
+
numberOfDays,
|
|
2274
|
+
isRTL,
|
|
2275
|
+
weekEndsOn,
|
|
2276
|
+
hiddenDays,
|
|
2277
|
+
weekNumberPrefix
|
|
2278
|
+
]);
|
|
2080
2279
|
const headerDays = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
|
|
2081
2280
|
mode,
|
|
2082
2281
|
pageDates,
|
|
@@ -2090,8 +2289,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2090
2289
|
]);
|
|
2091
2290
|
dropRef.current = {
|
|
2092
2291
|
headerDays,
|
|
2093
|
-
|
|
2094
|
-
|
|
2292
|
+
columnsWidth,
|
|
2293
|
+
headerOffset,
|
|
2095
2294
|
minHour: clampedMinHour,
|
|
2096
2295
|
maxHour: clampedMaxHour,
|
|
2097
2296
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
@@ -2117,55 +2316,26 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2117
2316
|
if (activeIndex === viewedIndexRef.current) return;
|
|
2118
2317
|
viewedIndexRef.current = activeIndex;
|
|
2119
2318
|
pendingScrollIndexRef.current = activeIndex;
|
|
2319
|
+
pagerOffset.value = activeIndex * columnsWidth;
|
|
2120
2320
|
listRef.current?.scrollToIndex({
|
|
2121
2321
|
index: activeIndex,
|
|
2122
2322
|
animated: false
|
|
2123
2323
|
});
|
|
2124
2324
|
}, [activeIndex]);
|
|
2125
2325
|
(0, react.useEffect)(() => {
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
if (!root) return;
|
|
2129
|
-
const restoreVisiblePage = () => {
|
|
2130
|
-
const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
|
|
2131
|
-
for (const el of root.querySelectorAll("*")) {
|
|
2132
|
-
const style = getComputedStyle(el);
|
|
2133
|
-
if (!((style.overflowY === "scroll" || style.overflowY === "auto") && el.scrollHeight > el.clientHeight + 20 && el.clientHeight > 100)) continue;
|
|
2134
|
-
const rect = el.getBoundingClientRect();
|
|
2135
|
-
if (rect.left > -50 && rect.right <= vw + 50) {
|
|
2136
|
-
el.scrollTop = scrollY.value;
|
|
2137
|
-
break;
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
};
|
|
2141
|
-
suppressCaptureUntilRef.current = Date.now() + 400;
|
|
2142
|
-
let raf2 = 0;
|
|
2143
|
-
const raf1 = requestAnimationFrame(() => {
|
|
2144
|
-
restoreVisiblePage();
|
|
2145
|
-
raf2 = requestAnimationFrame(restoreVisiblePage);
|
|
2146
|
-
});
|
|
2147
|
-
return () => {
|
|
2148
|
-
cancelAnimationFrame(raf1);
|
|
2149
|
-
cancelAnimationFrame(raf2);
|
|
2150
|
-
};
|
|
2151
|
-
}, [activeIndex, pageHeight]);
|
|
2326
|
+
pagerOffset.value = activeIndex * columnsWidth;
|
|
2327
|
+
}, [columnsWidth, pagerOffset]);
|
|
2152
2328
|
(0, react.useEffect)(() => {
|
|
2153
2329
|
if (!isWeb$1) return;
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
const
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
if (!el || typeof el.scrollTop !== "number" || el.clientHeight <= 100) return;
|
|
2160
|
-
const rect = el.getBoundingClientRect();
|
|
2161
|
-
const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
|
|
2162
|
-
if (rect.left <= -50 || rect.right > vw + 50) return;
|
|
2163
|
-
scrollY.value = el.scrollTop;
|
|
2164
|
-
offsetSeedRef.current = el.scrollTop;
|
|
2330
|
+
let attempts = 0;
|
|
2331
|
+
let frame = 0;
|
|
2332
|
+
const attempt = () => {
|
|
2333
|
+
seedWebScroll();
|
|
2334
|
+
if (!webSeededRef.current && attempts++ < 120) frame = requestAnimationFrame(attempt);
|
|
2165
2335
|
};
|
|
2166
|
-
|
|
2167
|
-
return () =>
|
|
2168
|
-
}, []);
|
|
2336
|
+
frame = requestAnimationFrame(attempt);
|
|
2337
|
+
return () => cancelAnimationFrame(frame);
|
|
2338
|
+
}, [seedWebScroll]);
|
|
2169
2339
|
(0, react.useEffect)(() => {
|
|
2170
2340
|
if (!isWeb$1) return;
|
|
2171
2341
|
const root = containerRef.current;
|
|
@@ -2182,17 +2352,51 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2182
2352
|
};
|
|
2183
2353
|
const raf = requestAnimationFrame(lockHorizontal);
|
|
2184
2354
|
return () => cancelAnimationFrame(raf);
|
|
2185
|
-
}, [
|
|
2355
|
+
}, [columnsWidth]);
|
|
2356
|
+
const reduceMotion = (0, react_native_reanimated.useReducedMotion)();
|
|
2186
2357
|
const goToPage = (0, react.useCallback)((delta) => {
|
|
2187
|
-
const
|
|
2188
|
-
|
|
2358
|
+
const index = viewedIndexRef.current + delta;
|
|
2359
|
+
const target = pageDates[index];
|
|
2360
|
+
if (!target) return;
|
|
2361
|
+
viewedIndexRef.current = index;
|
|
2362
|
+
pendingScrollIndexRef.current = index;
|
|
2363
|
+
pagerOffset.value = index * columnsWidth;
|
|
2364
|
+
listRef.current?.scrollToIndex({
|
|
2365
|
+
index,
|
|
2366
|
+
animated: !isWeb$1 && !reduceMotion
|
|
2367
|
+
});
|
|
2368
|
+
onChangeDate(target);
|
|
2189
2369
|
}, [
|
|
2190
2370
|
pageDates,
|
|
2191
|
-
|
|
2192
|
-
onChangeDate
|
|
2371
|
+
reduceMotion,
|
|
2372
|
+
onChangeDate,
|
|
2373
|
+
columnsWidth,
|
|
2374
|
+
pagerOffset
|
|
2193
2375
|
]);
|
|
2194
2376
|
require_MonthList.useWebPagerKeys(swipeEnabled, goToPage);
|
|
2195
|
-
const
|
|
2377
|
+
const handlePagerSettled = (0, react.useCallback)((event) => {
|
|
2378
|
+
if (columnsWidth <= 0) return;
|
|
2379
|
+
if (pendingScrollIndexRef.current != null) return;
|
|
2380
|
+
const raw = Math.round(event.nativeEvent.contentOffset.x / columnsWidth);
|
|
2381
|
+
const index = Math.min(Math.max(raw, 0), pageDates.length - 1);
|
|
2382
|
+
if (index !== viewedIndexRef.current) {
|
|
2383
|
+
viewedIndexRef.current = index;
|
|
2384
|
+
const target = pageDates[index];
|
|
2385
|
+
if (target) onChangeDate(target);
|
|
2386
|
+
}
|
|
2387
|
+
pagerOffset.value = index * columnsWidth;
|
|
2388
|
+
requestAnimationFrame(() => {
|
|
2389
|
+
listRef.current?.scrollToIndex({
|
|
2390
|
+
index,
|
|
2391
|
+
animated: false
|
|
2392
|
+
});
|
|
2393
|
+
});
|
|
2394
|
+
}, [
|
|
2395
|
+
columnsWidth,
|
|
2396
|
+
pageDates,
|
|
2397
|
+
onChangeDate,
|
|
2398
|
+
pagerOffset
|
|
2399
|
+
]);
|
|
2196
2400
|
const handlePressCell = (0, react.useMemo)(() => {
|
|
2197
2401
|
if (!onPressCell) return void 0;
|
|
2198
2402
|
if (!resetPageOnPressCell) return onPressCell;
|
|
@@ -2211,96 +2415,87 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2211
2415
|
]);
|
|
2212
2416
|
const snapToIndices = (0, react.useMemo)(() => pageDates.map((_, index) => index), [pageDates]);
|
|
2213
2417
|
const keyExtractorList = (0, react.useCallback)((item) => item.toISOString(), []);
|
|
2214
|
-
const getFixedItemSize = (0, react.useCallback)(() =>
|
|
2215
|
-
const renderItem = (0, react.useCallback)(({ item, index }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2216
|
-
style: {
|
|
2217
|
-
width: containerWidth,
|
|
2218
|
-
height: pageHeight
|
|
2219
|
-
},
|
|
2220
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimetablePage, {
|
|
2221
|
-
mode,
|
|
2222
|
-
numberOfDays,
|
|
2223
|
-
hiddenDays,
|
|
2224
|
-
now,
|
|
2225
|
-
nowTimeZone: timeZone,
|
|
2226
|
-
date: item,
|
|
2227
|
-
width: containerWidth,
|
|
2228
|
-
events,
|
|
2229
|
-
cellHeight,
|
|
2230
|
-
hourHeight,
|
|
2231
|
-
committedCellHeight,
|
|
2232
|
-
scrollY,
|
|
2233
|
-
isActive: index === activeIndex,
|
|
2234
|
-
initialScrollY: offsetSeedRef.current ?? seedDefaultY,
|
|
2235
|
-
onSettleOffset: captureOffsetSeed,
|
|
2236
|
-
weekStartsOn,
|
|
2237
|
-
weekEndsOn,
|
|
2238
|
-
hourColumnWidth,
|
|
2239
|
-
minHour: clampedMinHour,
|
|
2240
|
-
maxHour: clampedMaxHour,
|
|
2241
|
-
ampm,
|
|
2242
|
-
timeslots,
|
|
2243
|
-
isRTL,
|
|
2244
|
-
showAllDayEventCell,
|
|
2245
|
-
highlightWeekends,
|
|
2246
|
-
showVerticalScrollIndicator,
|
|
2247
|
-
verticalScrollEnabled,
|
|
2248
|
-
hourComponent,
|
|
2249
|
-
calendarCellStyle,
|
|
2250
|
-
businessHours,
|
|
2251
|
-
renderBusinessHours,
|
|
2252
|
-
minHourHeight,
|
|
2253
|
-
maxHourHeight,
|
|
2254
|
-
showNowIndicator,
|
|
2255
|
-
renderEvent: labeledRenderEvent,
|
|
2256
|
-
keyExtractor,
|
|
2257
|
-
snapMinutes: Math.max(1, dragStepMinutes),
|
|
2258
|
-
minEventHeight,
|
|
2259
|
-
eventGap,
|
|
2260
|
-
showDragHandle,
|
|
2261
|
-
eventStartEditable,
|
|
2262
|
-
eventDurationEditable,
|
|
2263
|
-
onPressEvent,
|
|
2264
|
-
onLongPressEvent,
|
|
2265
|
-
onDragEvent,
|
|
2266
|
-
onDragStart,
|
|
2267
|
-
onPressCell: handlePressCell,
|
|
2268
|
-
onLongPressCell,
|
|
2269
|
-
onCreateEvent,
|
|
2270
|
-
onEdgeAdvance: goToPage,
|
|
2271
|
-
onGridTop: handleGridTop
|
|
2272
|
-
})
|
|
2273
|
-
}), [
|
|
2274
|
-
containerWidth,
|
|
2275
|
-
pageHeight,
|
|
2276
|
-
handleGridTop,
|
|
2418
|
+
const getFixedItemSize = (0, react.useCallback)(() => columnsWidth, [columnsWidth]);
|
|
2419
|
+
const renderItem = (0, react.useCallback)(({ item, index }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimetablePage, {
|
|
2277
2420
|
mode,
|
|
2278
2421
|
numberOfDays,
|
|
2422
|
+
hiddenDays,
|
|
2423
|
+
now,
|
|
2424
|
+
nowTimeZone: timeZone,
|
|
2425
|
+
date: item,
|
|
2426
|
+
width: columnsWidth,
|
|
2279
2427
|
events,
|
|
2280
2428
|
cellHeight,
|
|
2281
|
-
hourHeight,
|
|
2282
2429
|
committedCellHeight,
|
|
2430
|
+
isActive: index === activeIndex,
|
|
2431
|
+
weekStartsOn,
|
|
2432
|
+
weekEndsOn,
|
|
2433
|
+
minHour: clampedMinHour,
|
|
2434
|
+
maxHour: clampedMaxHour,
|
|
2435
|
+
timeslots,
|
|
2436
|
+
isRTL,
|
|
2437
|
+
highlightWeekends,
|
|
2438
|
+
calendarCellStyle,
|
|
2439
|
+
businessHours,
|
|
2440
|
+
renderBusinessHours,
|
|
2441
|
+
renderBackgroundEvent,
|
|
2442
|
+
showNowIndicator,
|
|
2443
|
+
renderEvent: labeledRenderEvent,
|
|
2444
|
+
keyExtractor,
|
|
2445
|
+
snapMinutes: Math.max(1, dragStepMinutes),
|
|
2446
|
+
minEventHeight,
|
|
2447
|
+
eventGap,
|
|
2448
|
+
showDragHandle,
|
|
2449
|
+
eventStartEditable,
|
|
2450
|
+
eventDurationEditable,
|
|
2451
|
+
onPressEvent,
|
|
2452
|
+
onLongPressEvent,
|
|
2453
|
+
onDragEvent,
|
|
2454
|
+
onDragStart,
|
|
2455
|
+
onPressCell: handlePressCell,
|
|
2456
|
+
onLongPressCell,
|
|
2457
|
+
onCreateEvent,
|
|
2458
|
+
onEdgeAdvance: goToPage,
|
|
2459
|
+
pageIndex: index,
|
|
2460
|
+
laneHeight,
|
|
2461
|
+
scrollY,
|
|
2462
|
+
showAllDayEventCell,
|
|
2463
|
+
onLaneLayout: reportLaneHeight,
|
|
2464
|
+
height: pagerHeight,
|
|
2465
|
+
pagedHeader,
|
|
2466
|
+
weekdayFormat,
|
|
2467
|
+
locale,
|
|
2468
|
+
activeDate,
|
|
2469
|
+
onPressDateHeader
|
|
2470
|
+
}), [
|
|
2471
|
+
columnsWidth,
|
|
2472
|
+
pagerHeight,
|
|
2473
|
+
pagedHeader,
|
|
2474
|
+
weekdayFormat,
|
|
2475
|
+
locale,
|
|
2476
|
+
activeDate,
|
|
2477
|
+
onPressDateHeader,
|
|
2478
|
+
laneHeight,
|
|
2283
2479
|
scrollY,
|
|
2480
|
+
showAllDayEventCell,
|
|
2481
|
+
reportLaneHeight,
|
|
2482
|
+
mode,
|
|
2483
|
+
numberOfDays,
|
|
2484
|
+
events,
|
|
2485
|
+
cellHeight,
|
|
2486
|
+
committedCellHeight,
|
|
2284
2487
|
activeIndex,
|
|
2285
|
-
seedDefaultY,
|
|
2286
|
-
captureOffsetSeed,
|
|
2287
2488
|
weekStartsOn,
|
|
2288
2489
|
weekEndsOn,
|
|
2289
|
-
hourColumnWidth,
|
|
2290
2490
|
clampedMinHour,
|
|
2291
2491
|
clampedMaxHour,
|
|
2292
|
-
ampm,
|
|
2293
2492
|
timeslots,
|
|
2294
2493
|
isRTL,
|
|
2295
|
-
showAllDayEventCell,
|
|
2296
2494
|
highlightWeekends,
|
|
2297
|
-
showVerticalScrollIndicator,
|
|
2298
|
-
verticalScrollEnabled,
|
|
2299
|
-
hourComponent,
|
|
2300
2495
|
calendarCellStyle,
|
|
2301
2496
|
businessHours,
|
|
2302
|
-
|
|
2303
|
-
|
|
2497
|
+
renderBusinessHours,
|
|
2498
|
+
renderBackgroundEvent,
|
|
2304
2499
|
showNowIndicator,
|
|
2305
2500
|
labeledRenderEvent,
|
|
2306
2501
|
keyExtractor,
|
|
@@ -2324,8 +2519,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2324
2519
|
]);
|
|
2325
2520
|
const listExtraData = (0, react.useMemo)(() => ({
|
|
2326
2521
|
events,
|
|
2327
|
-
activeIndex
|
|
2328
|
-
|
|
2522
|
+
activeIndex,
|
|
2523
|
+
columnsWidth
|
|
2524
|
+
}), [
|
|
2525
|
+
events,
|
|
2526
|
+
activeIndex,
|
|
2527
|
+
columnsWidth
|
|
2528
|
+
]);
|
|
2329
2529
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.SlotStylesProvider, {
|
|
2330
2530
|
classNames,
|
|
2331
2531
|
styles: styleOverrides,
|
|
@@ -2334,63 +2534,105 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2334
2534
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
2335
2535
|
ref: containerRef,
|
|
2336
2536
|
style: styles$1.container,
|
|
2537
|
+
onLayout: (event) => setContainerWidth(event.nativeEvent.layout.width),
|
|
2337
2538
|
children: [
|
|
2338
|
-
renderHeader ? renderHeader(headerDays) :
|
|
2339
|
-
days: headerDays,
|
|
2340
|
-
mode,
|
|
2341
|
-
width: containerWidth,
|
|
2342
|
-
hourColumnWidth,
|
|
2343
|
-
showWeekNumber,
|
|
2344
|
-
weekNumberPrefix,
|
|
2345
|
-
weekdayFormat,
|
|
2346
|
-
locale,
|
|
2347
|
-
activeDate,
|
|
2348
|
-
onPressDateHeader
|
|
2349
|
-
}),
|
|
2539
|
+
renderHeader ? renderHeader(headerDays) : null,
|
|
2350
2540
|
headerComponent,
|
|
2351
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
2352
|
-
ref:
|
|
2353
|
-
style: styles$1.
|
|
2354
|
-
onLayout: (
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
pagerRef.current?.measureInWindow((x, y, w) => {
|
|
2359
|
-
pagerLeft.value = x;
|
|
2360
|
-
pagerTop.value = y;
|
|
2361
|
-
pagerWidth.value = w;
|
|
2541
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2542
|
+
ref: viewportRef,
|
|
2543
|
+
style: styles$1.viewport,
|
|
2544
|
+
onLayout: () => {
|
|
2545
|
+
seedWebScroll();
|
|
2546
|
+
viewportRef.current?.measureInWindow((_x, y) => {
|
|
2547
|
+
viewportTop.value = y;
|
|
2362
2548
|
});
|
|
2363
2549
|
},
|
|
2364
|
-
children:
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2550
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
2551
|
+
gesture: zoomGesture,
|
|
2552
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.ScrollView, {
|
|
2553
|
+
ref: scrollRef,
|
|
2554
|
+
showsVerticalScrollIndicator: showVerticalScrollIndicator,
|
|
2555
|
+
scrollEnabled: verticalScrollEnabled,
|
|
2556
|
+
onScroll: scrollHandler,
|
|
2557
|
+
scrollEventThrottle: 16,
|
|
2558
|
+
refreshControl: verticalScrollEnabled ? refreshControl : void 0,
|
|
2559
|
+
contentOffset: {
|
|
2560
|
+
x: 0,
|
|
2561
|
+
y: seedDefaultY
|
|
2562
|
+
},
|
|
2563
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
2564
|
+
testID: "time-grid-hours",
|
|
2565
|
+
style: [styles$1.gridRow, gridHeightStyle],
|
|
2566
|
+
children: [hourColumnWidth > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HourGutter, {
|
|
2567
|
+
width: hourColumnWidth,
|
|
2568
|
+
minHour: clampedMinHour,
|
|
2569
|
+
maxHour: clampedMaxHour,
|
|
2570
|
+
cellHeight,
|
|
2571
|
+
laneHeight,
|
|
2572
|
+
scrollY,
|
|
2573
|
+
showLane: showAllDayEventCell,
|
|
2574
|
+
showAllDayLabel,
|
|
2575
|
+
headerHeight: headerOffset,
|
|
2576
|
+
weekNumber,
|
|
2577
|
+
ampm,
|
|
2578
|
+
hourComponent
|
|
2579
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
2580
|
+
ref: pagerRef,
|
|
2581
|
+
testID: "time-grid-pager",
|
|
2582
|
+
style: [styles$1.pager, {
|
|
2583
|
+
left: hourColumnWidth,
|
|
2584
|
+
height: pagerHeight
|
|
2585
|
+
}],
|
|
2586
|
+
onLayout: (event) => {
|
|
2587
|
+
const laidOutWidth = event.nativeEvent.layout.width;
|
|
2588
|
+
if (laidOutWidth === pagerLayoutWidthRef.current) return;
|
|
2589
|
+
pagerLayoutWidthRef.current = laidOutWidth;
|
|
2590
|
+
setPagerLayoutWidth(laidOutWidth);
|
|
2591
|
+
pagerRef.current?.measureInWindow((x, _y, measuredWidth) => {
|
|
2592
|
+
pagerLeft.value = x;
|
|
2593
|
+
pagerWidth.value = measuredWidth;
|
|
2594
|
+
});
|
|
2595
|
+
},
|
|
2596
|
+
children: [pagerReady ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_legendapp_list_reanimated.AnimatedLegendList, {
|
|
2597
|
+
ref: listRef,
|
|
2598
|
+
style: isWeb$1 ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
|
|
2599
|
+
data: pageDates,
|
|
2600
|
+
extraData: listExtraData,
|
|
2601
|
+
horizontal: true,
|
|
2602
|
+
recycleItems: false,
|
|
2603
|
+
keyExtractor: keyExtractorList,
|
|
2604
|
+
getFixedItemSize,
|
|
2605
|
+
drawDistance: columnsWidth * 2,
|
|
2606
|
+
sharedValues: pagerSharedValues,
|
|
2607
|
+
...isWeb$1 ? null : {
|
|
2608
|
+
scrollEnabled: swipeEnabled,
|
|
2609
|
+
pagingEnabled: !freeSwipe,
|
|
2610
|
+
snapToIndices: freeSwipe ? snapToIndices : void 0,
|
|
2611
|
+
decelerationRate: freeSwipe ? "normal" : "fast",
|
|
2612
|
+
disableIntervalMomentum: !freeSwipe,
|
|
2613
|
+
scrollEventThrottle: 16,
|
|
2614
|
+
onMomentumScrollEnd: handlePagerSettled
|
|
2615
|
+
},
|
|
2616
|
+
initialScrollIndex: activeIndex,
|
|
2617
|
+
showsHorizontalScrollIndicator: false,
|
|
2618
|
+
viewabilityConfig: PAGE_VIEWABILITY,
|
|
2619
|
+
onViewableItemsChanged: handleViewableItemsChanged,
|
|
2620
|
+
renderItem
|
|
2621
|
+
}, `grid-${columnsWidth}`) : null, liftedEvent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DragGhost, {
|
|
2622
|
+
x: ghostX,
|
|
2623
|
+
y: ghostY,
|
|
2624
|
+
w: ghostW,
|
|
2625
|
+
h: ghostH,
|
|
2626
|
+
visible: ghostVisible,
|
|
2627
|
+
event: liftedEvent,
|
|
2628
|
+
mode,
|
|
2629
|
+
renderEvent: labeledRenderEvent,
|
|
2630
|
+
eventGap
|
|
2631
|
+
}) : null]
|
|
2632
|
+
})]
|
|
2633
|
+
})
|
|
2634
|
+
})
|
|
2635
|
+
})
|
|
2394
2636
|
})
|
|
2395
2637
|
]
|
|
2396
2638
|
})
|
|
@@ -2417,23 +2659,10 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2417
2659
|
* ```
|
|
2418
2660
|
*/
|
|
2419
2661
|
const TimeGrid = (0, react.memo)(TimeGridInner);
|
|
2420
|
-
const
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
2425
|
-
...slot("header", {
|
|
2426
|
-
base: styles$1.headerRow,
|
|
2427
|
-
themed: { borderBottomColor: theme.colors.gridLine }
|
|
2428
|
-
}),
|
|
2429
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2430
|
-
style: [styles$1.weekNumberGutter, { width: hourColumnWidth }],
|
|
2431
|
-
children: showWeekNumber && hourColumnWidth > 0 && days[0] ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
2432
|
-
...slot("weekNumber", { themed: [theme.text.hourLabel, { color: theme.colors.textMuted }] }),
|
|
2433
|
-
allowFontScaling: false,
|
|
2434
|
-
children: `${weekNumberPrefix}${(0, date_fns.getISOWeek)(days.find((d) => d.getDay() === 4) ?? days[0])}`
|
|
2435
|
-
}) : null
|
|
2436
|
-
}), days.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DayHeader, {
|
|
2662
|
+
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, locale, activeDate, onPressDateHeader }) => {
|
|
2663
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2664
|
+
...require_MonthList.useSlots()("header", { base: styles$1.headerRow }),
|
|
2665
|
+
children: days.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DayHeader, {
|
|
2437
2666
|
day,
|
|
2438
2667
|
mode,
|
|
2439
2668
|
width: dayWidth,
|
|
@@ -2441,7 +2670,7 @@ const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, wee
|
|
|
2441
2670
|
locale,
|
|
2442
2671
|
activeDate,
|
|
2443
2672
|
onPressDateHeader
|
|
2444
|
-
}, day.toISOString()))
|
|
2673
|
+
}, day.toISOString()))
|
|
2445
2674
|
});
|
|
2446
2675
|
};
|
|
2447
2676
|
const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, onPressDateHeader }) => {
|
|
@@ -2485,17 +2714,58 @@ const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, on
|
|
|
2485
2714
|
});
|
|
2486
2715
|
};
|
|
2487
2716
|
const styles$1 = react_native.StyleSheet.create({
|
|
2488
|
-
pager: {
|
|
2717
|
+
pager: {
|
|
2718
|
+
position: "absolute",
|
|
2719
|
+
top: 0,
|
|
2720
|
+
right: 0
|
|
2721
|
+
},
|
|
2489
2722
|
pagerList: { flex: 1 },
|
|
2490
2723
|
container: { flex: 1 },
|
|
2724
|
+
viewport: { flex: 1 },
|
|
2725
|
+
gridRow: {
|
|
2726
|
+
position: "relative",
|
|
2727
|
+
overflow: "hidden"
|
|
2728
|
+
},
|
|
2729
|
+
hourGutter: {
|
|
2730
|
+
position: "absolute",
|
|
2731
|
+
top: 0,
|
|
2732
|
+
left: 0,
|
|
2733
|
+
bottom: 0
|
|
2734
|
+
},
|
|
2735
|
+
fill: {
|
|
2736
|
+
position: "absolute",
|
|
2737
|
+
top: 0,
|
|
2738
|
+
left: 0,
|
|
2739
|
+
right: 0,
|
|
2740
|
+
bottom: 0
|
|
2741
|
+
},
|
|
2742
|
+
hourCell: { flex: 1 },
|
|
2491
2743
|
headerRow: {
|
|
2744
|
+
flex: 1,
|
|
2745
|
+
flexDirection: "row",
|
|
2746
|
+
alignItems: "center"
|
|
2747
|
+
},
|
|
2748
|
+
pagedHeader: {
|
|
2749
|
+
position: "absolute",
|
|
2750
|
+
top: 0,
|
|
2751
|
+
left: 0,
|
|
2752
|
+
right: 0,
|
|
2753
|
+
height: DAY_HEADER_HEIGHT,
|
|
2754
|
+
zIndex: 2,
|
|
2492
2755
|
flexDirection: "row",
|
|
2493
2756
|
alignItems: "center",
|
|
2494
2757
|
borderBottomWidth: react_native.StyleSheet.hairlineWidth
|
|
2495
2758
|
},
|
|
2496
|
-
|
|
2759
|
+
gutterCorner: {
|
|
2760
|
+
position: "absolute",
|
|
2761
|
+
top: 0,
|
|
2762
|
+
left: 0,
|
|
2763
|
+
right: 0,
|
|
2764
|
+
zIndex: 2,
|
|
2497
2765
|
alignItems: "center",
|
|
2498
|
-
justifyContent: "flex-end"
|
|
2766
|
+
justifyContent: "flex-end",
|
|
2767
|
+
paddingBottom: 6,
|
|
2768
|
+
borderBottomWidth: react_native.StyleSheet.hairlineWidth
|
|
2499
2769
|
},
|
|
2500
2770
|
dayHeader: {
|
|
2501
2771
|
alignItems: "center",
|
|
@@ -2509,14 +2779,45 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2509
2779
|
justifyContent: "center",
|
|
2510
2780
|
alignItems: "center"
|
|
2511
2781
|
},
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
position: "
|
|
2782
|
+
page: { position: "relative" },
|
|
2783
|
+
grid: {
|
|
2784
|
+
position: "absolute",
|
|
2785
|
+
left: 0,
|
|
2786
|
+
right: 0
|
|
2787
|
+
},
|
|
2788
|
+
laneBand: {
|
|
2789
|
+
position: "absolute",
|
|
2790
|
+
top: 0,
|
|
2791
|
+
left: 0,
|
|
2792
|
+
right: 0,
|
|
2793
|
+
overflow: "hidden",
|
|
2794
|
+
zIndex: 2
|
|
2795
|
+
},
|
|
2796
|
+
laneCell: {
|
|
2797
|
+
position: "absolute",
|
|
2798
|
+
top: 0,
|
|
2799
|
+
left: 0,
|
|
2800
|
+
right: 0,
|
|
2801
|
+
zIndex: 2,
|
|
2802
|
+
justifyContent: "center",
|
|
2803
|
+
overflow: "hidden",
|
|
2804
|
+
borderBottomWidth: react_native.StyleSheet.hairlineWidth
|
|
2805
|
+
},
|
|
2806
|
+
allDayLabel: {
|
|
2807
|
+
fontSize: 10,
|
|
2808
|
+
textAlign: "right",
|
|
2809
|
+
paddingRight: 6
|
|
2810
|
+
},
|
|
2811
|
+
gutterRows: {
|
|
2812
|
+
position: "absolute",
|
|
2813
|
+
left: 0,
|
|
2814
|
+
right: 0
|
|
2515
2815
|
},
|
|
2516
2816
|
cellPressLayer: {
|
|
2517
2817
|
position: "absolute",
|
|
2518
2818
|
top: 0,
|
|
2519
2819
|
bottom: 0,
|
|
2820
|
+
left: 0,
|
|
2520
2821
|
right: 0
|
|
2521
2822
|
},
|
|
2522
2823
|
createGhost: {
|
|
@@ -2528,7 +2829,10 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2528
2829
|
position: "absolute",
|
|
2529
2830
|
top: 0
|
|
2530
2831
|
},
|
|
2531
|
-
shadeBand: {
|
|
2832
|
+
shadeBand: {
|
|
2833
|
+
position: "absolute",
|
|
2834
|
+
overflow: "hidden"
|
|
2835
|
+
},
|
|
2532
2836
|
daySeparator: {
|
|
2533
2837
|
position: "absolute",
|
|
2534
2838
|
top: 0,
|
|
@@ -2536,6 +2840,7 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2536
2840
|
},
|
|
2537
2841
|
hourRow: {
|
|
2538
2842
|
position: "absolute",
|
|
2843
|
+
top: 0,
|
|
2539
2844
|
left: 0,
|
|
2540
2845
|
right: 0,
|
|
2541
2846
|
flexDirection: "row",
|
|
@@ -2547,11 +2852,16 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2547
2852
|
paddingRight: 6
|
|
2548
2853
|
},
|
|
2549
2854
|
hourLine: {
|
|
2550
|
-
|
|
2855
|
+
position: "absolute",
|
|
2856
|
+
top: 0,
|
|
2857
|
+
left: 0,
|
|
2858
|
+
right: 0,
|
|
2551
2859
|
height: react_native.StyleSheet.hairlineWidth
|
|
2552
2860
|
},
|
|
2553
2861
|
timeslotLine: {
|
|
2554
2862
|
position: "absolute",
|
|
2863
|
+
top: 0,
|
|
2864
|
+
left: 0,
|
|
2555
2865
|
right: 0,
|
|
2556
2866
|
height: react_native.StyleSheet.hairlineWidth,
|
|
2557
2867
|
opacity: .5
|
|
@@ -2594,6 +2904,7 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2594
2904
|
height: 2
|
|
2595
2905
|
},
|
|
2596
2906
|
nonInteractive: { pointerEvents: "none" },
|
|
2907
|
+
passThrough: { pointerEvents: "box-none" },
|
|
2597
2908
|
webNoScroll: { overflow: "hidden" }
|
|
2598
2909
|
});
|
|
2599
2910
|
//#endregion
|
|
@@ -2639,7 +2950,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
2639
2950
|
* }
|
|
2640
2951
|
* ```
|
|
2641
2952
|
*/
|
|
2642
|
-
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2953
|
+
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 }) {
|
|
2643
2954
|
const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
|
|
2644
2955
|
const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
2645
2956
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -2759,6 +3070,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2759
3070
|
}) : mode === "year" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(YearView, {
|
|
2760
3071
|
date,
|
|
2761
3072
|
events: displayEvents,
|
|
3073
|
+
refreshControl,
|
|
2762
3074
|
weekStartsOn,
|
|
2763
3075
|
hiddenDays,
|
|
2764
3076
|
locale,
|
|
@@ -2784,6 +3096,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2784
3096
|
onPressDay,
|
|
2785
3097
|
activeDate,
|
|
2786
3098
|
itemSeparatorComponent,
|
|
3099
|
+
refreshControl,
|
|
2787
3100
|
classNames,
|
|
2788
3101
|
styles: styleOverrides
|
|
2789
3102
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeGrid, {
|
|
@@ -2806,6 +3119,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2806
3119
|
hideHours,
|
|
2807
3120
|
timeslots,
|
|
2808
3121
|
showAllDayEventCell,
|
|
3122
|
+
showAllDayLabel,
|
|
3123
|
+
refreshControl,
|
|
2809
3124
|
highlightWeekends,
|
|
2810
3125
|
eventStartEditable,
|
|
2811
3126
|
eventDurationEditable,
|
|
@@ -2813,6 +3128,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2813
3128
|
calendarCellStyle,
|
|
2814
3129
|
businessHours,
|
|
2815
3130
|
renderBusinessHours,
|
|
3131
|
+
renderBackgroundEvent,
|
|
2816
3132
|
showWeekNumber,
|
|
2817
3133
|
weekNumberPrefix,
|
|
2818
3134
|
hourComponent,
|