@super-calendar/native 2.9.1 → 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 +74 -13
- package/dist/index.d.ts +74 -13
- package/dist/index.js +939 -604
- package/dist/index.mjs +940 -605
- package/package.json +2 -2
- package/src/components/Agenda.tsx +5 -1
- package/src/components/AllDayLane.tsx +36 -53
- package/src/components/Calendar.tsx +54 -4
- package/src/components/MultiDayMovePreview.tsx +12 -9
- package/src/components/TimeGrid.tsx +1416 -887
- 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,
|
|
@@ -759,7 +744,6 @@ const styles$2 = react_native.StyleSheet.create({
|
|
|
759
744
|
//#endregion
|
|
760
745
|
//#region src/components/MultiDayMovePreview.tsx
|
|
761
746
|
const noop$1 = () => {};
|
|
762
|
-
const MIN_EVENT_HEIGHT$1 = 32;
|
|
763
747
|
function MultiDayMovePreview(props) {
|
|
764
748
|
const { move, days } = props;
|
|
765
749
|
const dayOffsets = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[move.dayIndex]) * 1440), [days, move]);
|
|
@@ -771,7 +755,7 @@ function MultiDayMovePreview(props) {
|
|
|
771
755
|
dayEnd: (0, date_fns.addDays)((0, date_fns.startOfDay)(day), 1).getTime()
|
|
772
756
|
}, day.toISOString()));
|
|
773
757
|
}
|
|
774
|
-
function PreviewDay({ move, cellHeight, dayWidth,
|
|
758
|
+
function PreviewDay({ move, cellHeight, dayWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
|
|
775
759
|
const theme = require_MonthList.useCalendarTheme();
|
|
776
760
|
const slot = require_MonthList.useSlots();
|
|
777
761
|
const { offsetX, offsetY, lifted, dayIndex, event } = move;
|
|
@@ -799,7 +783,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
|
|
|
799
783
|
dayStart,
|
|
800
784
|
dayEnd
|
|
801
785
|
]);
|
|
802
|
-
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => segment.value.hours > 0 ? Math.max(segment.value.hours * cellHeight.value,
|
|
786
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => segment.value.hours > 0 ? Math.max(segment.value.hours * cellHeight.value, minEventHeight) : 0, [minEventHeight]);
|
|
803
787
|
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
804
788
|
top: (segment.value.top - minHour) * cellHeight.value,
|
|
805
789
|
height: boxHeight.value,
|
|
@@ -826,8 +810,8 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
|
|
|
826
810
|
{
|
|
827
811
|
position: "absolute",
|
|
828
812
|
overflow: "hidden",
|
|
829
|
-
padding:
|
|
830
|
-
left:
|
|
813
|
+
padding: eventGap,
|
|
814
|
+
left: index * dayWidth,
|
|
831
815
|
width: dayWidth,
|
|
832
816
|
zIndex: 100
|
|
833
817
|
},
|
|
@@ -856,16 +840,17 @@ const DEFAULT_HOUR_HEIGHT = 48;
|
|
|
856
840
|
const DEFAULT_MIN_HOUR_HEIGHT = 32;
|
|
857
841
|
const DEFAULT_MAX_HOUR_HEIGHT = 160;
|
|
858
842
|
const DEFAULT_HOUR_COLUMN_WIDTH = 56;
|
|
859
|
-
const
|
|
860
|
-
const
|
|
843
|
+
const DEFAULT_MIN_EVENT_HEIGHT = 32;
|
|
844
|
+
const DEFAULT_EVENT_GAP = 2;
|
|
861
845
|
const DRAG_ACTIVATE_MS = 300;
|
|
862
846
|
const MOVE_ACTIVATE_MS$1 = 500;
|
|
863
847
|
const DRAG_ACTIVATE_PX$1 = 8;
|
|
864
848
|
const RESIZE_HANDLE_HEIGHT = 14;
|
|
865
849
|
const DEFAULT_DRAG_STEP_MINUTES = 15;
|
|
866
850
|
const DRAG_EVENT_Z = 100;
|
|
867
|
-
const EDGE_DWELL_MS =
|
|
868
|
-
const
|
|
851
|
+
const EDGE_DWELL_MS = 600;
|
|
852
|
+
const EDGE_REPEAT_MS = 700;
|
|
853
|
+
const EDGE_ZONE_PX = 24;
|
|
869
854
|
const EdgePagingContext = (0, react.createContext)(null);
|
|
870
855
|
const noop = () => {};
|
|
871
856
|
/**
|
|
@@ -874,7 +859,7 @@ const noop = () => {};
|
|
|
874
859
|
* while a drag is actually spilling (see `spillHeight`), so an idle grid pays
|
|
875
860
|
* nothing for it; its geometry is driven on the UI thread from there.
|
|
876
861
|
*/
|
|
877
|
-
function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, dayWidth, nextDayDirection, minHour, event, mode, renderEvent, slotProps }) {
|
|
862
|
+
function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, dayWidth, nextDayDirection, minHour, event, mode, renderEvent, eventGap, slotProps }) {
|
|
878
863
|
const RenderEventComponent = renderEvent;
|
|
879
864
|
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
880
865
|
height: spillHeight.value,
|
|
@@ -896,7 +881,8 @@ function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, day
|
|
|
896
881
|
{
|
|
897
882
|
left: dayLeftPx,
|
|
898
883
|
width: dayWidth,
|
|
899
|
-
top: 0
|
|
884
|
+
top: 0,
|
|
885
|
+
padding: eventGap
|
|
900
886
|
},
|
|
901
887
|
slotProps.style,
|
|
902
888
|
style
|
|
@@ -917,7 +903,7 @@ function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, day
|
|
|
917
903
|
* visibility are driven on the UI thread by the shared values so it tracks the
|
|
918
904
|
* finger without a React re-render.
|
|
919
905
|
*/
|
|
920
|
-
function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
906
|
+
function DragGhost({ x, y, w, h, visible, event, mode, renderEvent, eventGap }) {
|
|
921
907
|
const RenderEventComponent = renderEvent;
|
|
922
908
|
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
923
909
|
transform: [{ translateX: x.value }, { translateY: y.value }],
|
|
@@ -929,6 +915,7 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
929
915
|
style: [
|
|
930
916
|
styles$1.eventBox,
|
|
931
917
|
styles$1.dragGhost,
|
|
918
|
+
{ padding: eventGap },
|
|
932
919
|
style
|
|
933
920
|
],
|
|
934
921
|
pointerEvents: "none",
|
|
@@ -941,7 +928,9 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
941
928
|
});
|
|
942
929
|
}
|
|
943
930
|
const HOUR_LABEL_TOP_INSET = 12;
|
|
944
|
-
|
|
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 }) {
|
|
945
934
|
const RenderEventComponent = renderEvent;
|
|
946
935
|
const theme = require_MonthList.useCalendarTheme();
|
|
947
936
|
const slot = require_MonthList.useSlots();
|
|
@@ -978,20 +967,29 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
978
967
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
979
968
|
ownsStart
|
|
980
969
|
}), [startHours, ownsStart]);
|
|
981
|
-
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => Math.max(durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value,
|
|
970
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => Math.max(durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value, minEventHeight), [durationHours, minEventHeight]);
|
|
982
971
|
const visibleBoxHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
983
972
|
const top = (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
984
973
|
const dayEnd = (HOURS_PER_DAY - minHour) * cellHeight.value;
|
|
985
|
-
return Math.max(Math.min(boxHeight.value, dayEnd - top),
|
|
986
|
-
}, [
|
|
974
|
+
return Math.max(Math.min(boxHeight.value, dayEnd - top), minEventHeight);
|
|
975
|
+
}, [
|
|
976
|
+
startHours,
|
|
977
|
+
minHour,
|
|
978
|
+
minEventHeight
|
|
979
|
+
]);
|
|
987
980
|
const boxStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
988
981
|
return {
|
|
989
982
|
top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
990
983
|
height: visibleBoxHeight.value,
|
|
991
984
|
transform: [{ translateX: moveOffsetX.value }],
|
|
992
|
-
zIndex: dragZ.value
|
|
985
|
+
zIndex: dragZ.value,
|
|
986
|
+
opacity: hiddenForMove || lifted.value ? 0 : 1
|
|
993
987
|
};
|
|
994
|
-
}, [
|
|
988
|
+
}, [
|
|
989
|
+
startHours,
|
|
990
|
+
minHour,
|
|
991
|
+
hiddenForMove
|
|
992
|
+
]);
|
|
995
993
|
const spillHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
996
994
|
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
997
995
|
const overflowHours = startHours + moveOffset.value / cellHeight.value + durationHours - HOURS_PER_DAY;
|
|
@@ -1034,13 +1032,17 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1034
1032
|
event: positioned.event,
|
|
1035
1033
|
eventIndex,
|
|
1036
1034
|
onDragEvent,
|
|
1037
|
-
onDragStart
|
|
1035
|
+
onDragStart,
|
|
1036
|
+
onPress,
|
|
1037
|
+
onLongPress
|
|
1038
1038
|
});
|
|
1039
1039
|
latest.current = {
|
|
1040
1040
|
event: positioned.event,
|
|
1041
1041
|
eventIndex,
|
|
1042
1042
|
onDragEvent,
|
|
1043
|
-
onDragStart
|
|
1043
|
+
onDragStart,
|
|
1044
|
+
onPress,
|
|
1045
|
+
onLongPress
|
|
1044
1046
|
};
|
|
1045
1047
|
const snapBack = (0, react.useCallback)(() => {
|
|
1046
1048
|
moveOffset.value = 0;
|
|
@@ -1103,16 +1105,12 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1103
1105
|
dwellTimer.current = null;
|
|
1104
1106
|
}
|
|
1105
1107
|
}, []);
|
|
1106
|
-
const releaseEdge =
|
|
1107
|
-
disarmEdge();
|
|
1108
|
-
edgePaging?.lockScroll(false);
|
|
1109
|
-
}, [disarmEdge, edgePaging]);
|
|
1108
|
+
const releaseEdge = disarmEdge;
|
|
1110
1109
|
const armEdge = (0, react.useCallback)((dir) => {
|
|
1111
1110
|
disarmEdge();
|
|
1112
|
-
|
|
1111
|
+
const fire = () => {
|
|
1113
1112
|
dwellTimer.current = null;
|
|
1114
1113
|
if (!edgePaging) return;
|
|
1115
|
-
edgePaging.lockScroll(true);
|
|
1116
1114
|
if (!lifted.value) {
|
|
1117
1115
|
lifted.value = 1;
|
|
1118
1116
|
edgePaging.ghostW.value = width;
|
|
@@ -1123,7 +1121,9 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1123
1121
|
edgePaging.beginLift(latest.current.event);
|
|
1124
1122
|
}
|
|
1125
1123
|
onEdgeAdvance?.(dir);
|
|
1126
|
-
|
|
1124
|
+
dwellTimer.current = setTimeout(fire, EDGE_REPEAT_MS);
|
|
1125
|
+
};
|
|
1126
|
+
dwellTimer.current = setTimeout(fire, EDGE_DWELL_MS);
|
|
1127
1127
|
}, [
|
|
1128
1128
|
disarmEdge,
|
|
1129
1129
|
edgePaging,
|
|
@@ -1243,55 +1243,87 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1243
1243
|
disarmEdge,
|
|
1244
1244
|
releaseEdge
|
|
1245
1245
|
]);
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1248
|
-
(
|
|
1249
|
-
})
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
const
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
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
|
+
}, [
|
|
1262
1280
|
resizable,
|
|
1263
1281
|
snapMinutes,
|
|
1264
1282
|
cellHeight,
|
|
1265
1283
|
resizeDelta,
|
|
1266
1284
|
dragZ,
|
|
1267
1285
|
commitDrag,
|
|
1268
|
-
notifyDragStart
|
|
1286
|
+
notifyDragStart,
|
|
1287
|
+
handlePress,
|
|
1288
|
+
canLongPress,
|
|
1289
|
+
handleLongPressFromHandle
|
|
1269
1290
|
]);
|
|
1270
|
-
const resizeStartGesture = (0, react.useMemo)(() =>
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
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
|
+
}, [
|
|
1286
1316
|
resizableFromStart,
|
|
1287
1317
|
snapMinutes,
|
|
1288
1318
|
cellHeight,
|
|
1289
1319
|
resizeStartDelta,
|
|
1290
1320
|
dragZ,
|
|
1291
1321
|
commitDrag,
|
|
1292
|
-
notifyDragStart
|
|
1322
|
+
notifyDragStart,
|
|
1323
|
+
handlePress,
|
|
1324
|
+
canLongPress,
|
|
1325
|
+
handleLongPressFromHandle
|
|
1293
1326
|
]);
|
|
1294
|
-
const handlePress = () => onPress(positioned.event);
|
|
1295
1327
|
const handleLongPress = !canMove && onLongPress ? () => onLongPress(positioned.event) : void 0;
|
|
1296
1328
|
const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
|
|
1297
1329
|
const pageUnit = mode === "week" ? "week" : daysPerPage === 1 ? "day" : `${daysPerPage} day${daysPerPage === 1 ? "" : "s"}`;
|
|
@@ -1344,17 +1376,14 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1344
1376
|
const eventSlot = slot("event", {
|
|
1345
1377
|
base: [styles$1.eventBox, {
|
|
1346
1378
|
left,
|
|
1347
|
-
width
|
|
1379
|
+
width,
|
|
1380
|
+
padding: eventGap
|
|
1348
1381
|
}],
|
|
1349
1382
|
themed: theme.containers.timeGridEvent
|
|
1350
1383
|
});
|
|
1351
1384
|
const box = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
1352
1385
|
...eventSlot,
|
|
1353
|
-
style: [
|
|
1354
|
-
eventSlot.style,
|
|
1355
|
-
boxStyle,
|
|
1356
|
-
hiddenForMove ? { opacity: 0 } : null
|
|
1357
|
-
],
|
|
1386
|
+
style: [eventSlot.style, boxStyle],
|
|
1358
1387
|
children: [
|
|
1359
1388
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
1360
1389
|
event: positioned.event,
|
|
@@ -1370,6 +1399,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1370
1399
|
resizableFromStart ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
1371
1400
|
gesture: resizeStartGesture,
|
|
1372
1401
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1402
|
+
testID: "resize-handle-top",
|
|
1373
1403
|
style: styles$1.resizeHandleTop,
|
|
1374
1404
|
children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
1375
1405
|
})
|
|
@@ -1377,6 +1407,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1377
1407
|
resizable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
1378
1408
|
gesture: resizeGesture,
|
|
1379
1409
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1410
|
+
testID: "resize-handle",
|
|
1380
1411
|
style: styles$1.resizeHandle,
|
|
1381
1412
|
children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
1382
1413
|
})
|
|
@@ -1398,56 +1429,123 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1398
1429
|
event: positioned.event,
|
|
1399
1430
|
mode,
|
|
1400
1431
|
renderEvent,
|
|
1432
|
+
eventGap,
|
|
1401
1433
|
slotProps: slot("event", { themed: theme.containers.timeGridEvent })
|
|
1402
1434
|
}) : null] });
|
|
1403
1435
|
}
|
|
1404
|
-
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 }) => {
|
|
1405
1439
|
const theme = require_MonthList.useCalendarTheme();
|
|
1406
1440
|
const slot = require_MonthList.useSlots();
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1418
|
-
...slot("hourLabel", {
|
|
1419
|
-
base: [styles$1.hourLabel, { width: hourColumnWidth }],
|
|
1420
|
-
themed: [theme.text.hourLabel, { color: theme.colors.textMuted }]
|
|
1421
|
-
}),
|
|
1422
|
-
allowFontScaling: false,
|
|
1423
|
-
children: label
|
|
1424
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { ...slot("gridLines", {
|
|
1425
|
-
base: styles$1.hourLine,
|
|
1426
|
-
themed: { backgroundColor: theme.colors.gridLine }
|
|
1427
|
-
}) })]
|
|
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
|
|
1428
1451
|
});
|
|
1429
1452
|
};
|
|
1430
|
-
const
|
|
1453
|
+
const HourLines = (0, react.memo)(function HourLines({ hours, timeslots }) {
|
|
1431
1454
|
const theme = require_MonthList.useCalendarTheme();
|
|
1432
1455
|
const slot = require_MonthList.useSlots();
|
|
1433
|
-
const
|
|
1434
|
-
|
|
1435
|
-
minHour,
|
|
1436
|
-
fraction
|
|
1437
|
-
]);
|
|
1438
|
-
const lineSlot = slot("gridLines", {
|
|
1439
|
-
base: [
|
|
1440
|
-
styles$1.timeslotLine,
|
|
1441
|
-
styles$1.nonInteractive,
|
|
1442
|
-
{ left: hourColumnWidth }
|
|
1443
|
-
],
|
|
1456
|
+
const hourLineSlot = slot("gridLines", {
|
|
1457
|
+
base: [styles$1.hourLine, styles$1.nonInteractive],
|
|
1444
1458
|
themed: { backgroundColor: theme.colors.gridLine }
|
|
1445
1459
|
});
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
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
|
+
]
|
|
1449
1546
|
});
|
|
1450
1547
|
};
|
|
1548
|
+
const HourGutter = (0, react.memo)(HourGutterInner);
|
|
1451
1549
|
const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) => {
|
|
1452
1550
|
const theme = require_MonthList.useCalendarTheme();
|
|
1453
1551
|
const slot = require_MonthList.useSlots();
|
|
@@ -1468,7 +1566,7 @@ const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) =>
|
|
|
1468
1566
|
style: [lineSlot.style, animatedStyle]
|
|
1469
1567
|
});
|
|
1470
1568
|
};
|
|
1471
|
-
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 }) => {
|
|
1472
1570
|
const slot = require_MonthList.useSlots();
|
|
1473
1571
|
const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
1474
1572
|
top: (startHour - minHour) * cellHeight.value,
|
|
@@ -1481,7 +1579,7 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
1481
1579
|
const bandSlot = slot(slotName, {
|
|
1482
1580
|
base: [
|
|
1483
1581
|
styles$1.shadeBand,
|
|
1484
|
-
styles$1.nonInteractive,
|
|
1582
|
+
interactive ? styles$1.passThrough : styles$1.nonInteractive,
|
|
1485
1583
|
{
|
|
1486
1584
|
left,
|
|
1487
1585
|
width
|
|
@@ -1491,56 +1589,46 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
1491
1589
|
});
|
|
1492
1590
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1493
1591
|
testID,
|
|
1494
|
-
accessibilityElementsHidden:
|
|
1495
|
-
importantForAccessibility: "no-hide-descendants",
|
|
1592
|
+
accessibilityElementsHidden: !interactive,
|
|
1593
|
+
importantForAccessibility: interactive ? "auto" : "no-hide-descendants",
|
|
1496
1594
|
...bandSlot,
|
|
1497
1595
|
style: [bandSlot.style, animatedStyle],
|
|
1498
1596
|
children
|
|
1499
1597
|
});
|
|
1500
1598
|
};
|
|
1501
|
-
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 }) {
|
|
1502
1629
|
const theme = require_MonthList.useCalendarTheme();
|
|
1503
1630
|
const slot = require_MonthList.useSlots();
|
|
1504
|
-
const scrollRef = (0, react_native_reanimated.useAnimatedRef)();
|
|
1505
|
-
const gridTopRef = (0, react.useRef)(0);
|
|
1506
|
-
(0, react.useEffect)(() => {
|
|
1507
|
-
if (isActive) onGridTop?.(gridTopRef.current);
|
|
1508
|
-
}, [isActive, onGridTop]);
|
|
1509
1631
|
const heightSource = isActive ? cellHeight : committedCellHeight;
|
|
1510
|
-
const isDragging = (0, react_native_reanimated.useSharedValue)(false);
|
|
1511
|
-
const isActiveShared = (0, react_native_reanimated.useSharedValue)(isActive);
|
|
1512
|
-
(0, react.useEffect)(() => {
|
|
1513
|
-
isActiveShared.value = isActive;
|
|
1514
|
-
}, [isActive, isActiveShared]);
|
|
1515
|
-
const scrollHandler = (0, react_native_reanimated.useAnimatedScrollHandler)({
|
|
1516
|
-
onScroll: (event) => {
|
|
1517
|
-
if (isActiveShared.value && isDragging.value) scrollY.value = event.contentOffset.y;
|
|
1518
|
-
},
|
|
1519
|
-
onBeginDrag: () => {
|
|
1520
|
-
isDragging.value = true;
|
|
1521
|
-
},
|
|
1522
|
-
onEndDrag: (event) => {
|
|
1523
|
-
isDragging.value = false;
|
|
1524
|
-
if (!isWeb$1 && isActiveShared.value) {
|
|
1525
|
-
scrollY.value = event.contentOffset.y;
|
|
1526
|
-
(0, react_native_reanimated.runOnJS)(onSettleOffset)(event.contentOffset.y);
|
|
1527
|
-
}
|
|
1528
|
-
},
|
|
1529
|
-
onMomentumEnd: (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
|
-
});
|
|
1537
|
-
(0, react_native_reanimated.useAnimatedReaction)(() => scrollY.value, (current, previous) => {
|
|
1538
|
-
if (!isActiveShared.value && current !== previous) (0, react_native_reanimated.scrollTo)(scrollRef, 0, current, false);
|
|
1539
|
-
});
|
|
1540
|
-
(0, react_native_reanimated.useAnimatedReaction)(() => isActiveShared.value, (active, previous) => {
|
|
1541
|
-
if (isWeb$1 || !active || active === previous) return;
|
|
1542
|
-
(0, react_native_reanimated.scrollTo)(scrollRef, 0, scrollY.value, false);
|
|
1543
|
-
});
|
|
1544
1632
|
const days = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
|
|
1545
1633
|
mode,
|
|
1546
1634
|
date,
|
|
@@ -1552,8 +1640,8 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1552
1640
|
]);
|
|
1553
1641
|
const daysPerPage = (0, _super_calendar_core.pageStepDays)(mode, date, weekStartsOn, numberOfDays);
|
|
1554
1642
|
const dayCount = days.length;
|
|
1555
|
-
const dayWidth =
|
|
1556
|
-
const dayLeft = (dayIndex) =>
|
|
1643
|
+
const dayWidth = width / dayCount;
|
|
1644
|
+
const dayLeft = (dayIndex) => dayIndex * dayWidth;
|
|
1557
1645
|
const dayOrdinals = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[0])), [days]);
|
|
1558
1646
|
const dayLayouts = (0, react.useMemo)(() => days.map((day) => (0, _super_calendar_core.layoutDayEvents)(events, day)), [days, events]);
|
|
1559
1647
|
const [multiDayMove, setMultiDayMove] = (0, react.useState)(null);
|
|
@@ -1580,7 +1668,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1580
1668
|
const date = onLongPressCell && cellDateFromTouch(event);
|
|
1581
1669
|
if (date) onLongPressCell?.(date);
|
|
1582
1670
|
};
|
|
1583
|
-
const hoursRange = (0, react.useMemo)(() =>
|
|
1671
|
+
const hoursRange = (0, react.useMemo)(() => hourRange(minHour, maxHour), [minHour, maxHour]);
|
|
1584
1672
|
const now = (0, _super_calendar_core.useNow)(showNowIndicator && isActive, {
|
|
1585
1673
|
now: nowProp,
|
|
1586
1674
|
timeZone: nowTimeZone
|
|
@@ -1593,23 +1681,24 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1593
1681
|
maxHour,
|
|
1594
1682
|
heightSource
|
|
1595
1683
|
]);
|
|
1596
|
-
const
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
return react_native_gesture_handler.Gesture.Simultaneous(pinch, react_native_gesture_handler.Gesture.Native());
|
|
1606
|
-
}, [
|
|
1607
|
-
cellHeight,
|
|
1608
|
-
committedCellHeight,
|
|
1609
|
-
pinchStartCellHeight,
|
|
1610
|
-
minHourHeight,
|
|
1611
|
-
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
|
|
1612
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]);
|
|
1613
1702
|
const createEnabled = onCreateEvent != null;
|
|
1614
1703
|
const createActive = (0, react_native_reanimated.useSharedValue)(0);
|
|
1615
1704
|
const createTop = (0, react_native_reanimated.useSharedValue)(0);
|
|
@@ -1652,7 +1741,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1652
1741
|
const idx = dayCount === 1 ? 0 : Math.floor(event.x / dayWidth);
|
|
1653
1742
|
createDayIndex.value = idx;
|
|
1654
1743
|
createStartY.value = event.y;
|
|
1655
|
-
createLeft.value =
|
|
1744
|
+
createLeft.value = idx * dayWidth;
|
|
1656
1745
|
createWidth.value = dayWidth;
|
|
1657
1746
|
createTop.value = event.y;
|
|
1658
1747
|
createHeight.value = 0;
|
|
@@ -1677,7 +1766,6 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1677
1766
|
createEnabled,
|
|
1678
1767
|
dayCount,
|
|
1679
1768
|
dayWidth,
|
|
1680
|
-
hourColumnWidth,
|
|
1681
1769
|
heightSource,
|
|
1682
1770
|
snapMinutes,
|
|
1683
1771
|
commitCreate,
|
|
@@ -1729,14 +1817,17 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1729
1817
|
opacity: createActive.value
|
|
1730
1818
|
}));
|
|
1731
1819
|
const ghostSlot = slot("createGhost", {
|
|
1732
|
-
base: [styles$1.createGhost, {
|
|
1820
|
+
base: [styles$1.createGhost, {
|
|
1821
|
+
marginHorizontal: eventGap,
|
|
1822
|
+
pointerEvents: "none"
|
|
1823
|
+
}],
|
|
1733
1824
|
themed: {
|
|
1734
1825
|
backgroundColor: theme.colors.eventBackground,
|
|
1735
1826
|
borderColor: theme.colors.todayBackground
|
|
1736
1827
|
}
|
|
1737
1828
|
});
|
|
1738
1829
|
const cellLayer = onPressCell || onLongPressCell || createEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
1739
|
-
style:
|
|
1830
|
+
style: styles$1.cellPressLayer,
|
|
1740
1831
|
onPress: onPressCell ? handleBackgroundPress : void 0,
|
|
1741
1832
|
onLongPress: !createEnabled && onLongPressCell ? handleBackgroundLongPress : void 0,
|
|
1742
1833
|
tabIndex: -1,
|
|
@@ -1744,197 +1835,234 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1744
1835
|
accessibilityElementsHidden: true
|
|
1745
1836
|
}) : null;
|
|
1746
1837
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
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: [
|
|
1804
1901
|
styles$1.weekendColumn,
|
|
1805
1902
|
styles$1.nonInteractive,
|
|
1806
1903
|
{
|
|
1807
1904
|
left: dayLeft(dayIndex),
|
|
1808
1905
|
width: dayWidth
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
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) => ({
|
|
1829
1947
|
...b,
|
|
1830
1948
|
startHours: Math.max(b.startHours, minHour),
|
|
1831
1949
|
endHours: Math.min(b.endHours, maxHour)
|
|
1832
|
-
})).filter((b) => b.endHours > b.startHours).map((b, bandIndex) =>
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
minHour,
|
|
1837
|
-
left: dayLeft(dayIndex),
|
|
1838
|
-
width: dayWidth,
|
|
1839
|
-
color: theme.colors.backgroundEvent,
|
|
1840
|
-
slotName: "backgroundEvent",
|
|
1841
|
-
testID: "background-event-shade"
|
|
1842
|
-
}, `bg-${day.toISOString()}-${bandIndex}`))),
|
|
1843
|
-
days.map((day, dayIndex) => {
|
|
1844
|
-
const separatorSlot = slot("daySeparator", {
|
|
1845
|
-
base: [
|
|
1846
|
-
styles$1.daySeparator,
|
|
1847
|
-
styles$1.nonInteractive,
|
|
1848
|
-
{ left: dayLeft(dayIndex) }
|
|
1849
|
-
],
|
|
1850
|
-
themed: { backgroundColor: theme.colors.gridLine }
|
|
1851
|
-
});
|
|
1852
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1853
|
-
...separatorSlot,
|
|
1854
|
-
style: [separatorSlot.style, fullHeightStyle]
|
|
1855
|
-
}, `separator-${day.toISOString()}`);
|
|
1856
|
-
}),
|
|
1857
|
-
hoursRange.map((hour) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HourRow, {
|
|
1858
|
-
hour,
|
|
1859
|
-
minHour,
|
|
1860
|
-
cellHeight: heightSource,
|
|
1861
|
-
hourColumnWidth,
|
|
1862
|
-
label: (0, _super_calendar_core.formatHour)(hour, { ampm }),
|
|
1863
|
-
ampm,
|
|
1864
|
-
hourComponent
|
|
1865
|
-
}, hour)),
|
|
1866
|
-
timeslots > 1 ? hoursRange.flatMap((hour) => Array.from({ length: timeslots - 1 }, (_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeslotLine, {
|
|
1867
|
-
hour,
|
|
1868
|
-
minHour,
|
|
1869
|
-
fraction: (i + 1) / timeslots,
|
|
1870
|
-
cellHeight: heightSource,
|
|
1871
|
-
hourColumnWidth
|
|
1872
|
-
}, `slot-${hour}-${i}`))) : null,
|
|
1873
|
-
dayLayouts.flatMap((layout, dayIndex) => layout.filter((p) => p.startHours < maxHour && p.startHours + p.durationHours > minHour).map((positioned, eventIndex) => {
|
|
1874
|
-
const columnWidth = dayWidth / positioned.columns;
|
|
1875
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedEventBox, {
|
|
1876
|
-
positioned,
|
|
1877
|
-
eventIndex: events.indexOf(positioned.event),
|
|
1878
|
-
movingEvent,
|
|
1879
|
-
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,
|
|
1880
1954
|
cellHeight: heightSource,
|
|
1955
|
+
startHour: b.startHours,
|
|
1956
|
+
endHour: b.endHours,
|
|
1881
1957
|
minHour,
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
width: columnWidth,
|
|
1885
|
-
dayLeftPx: dayLeft(dayIndex),
|
|
1886
|
-
nextDayDirection: isRTL ? -1 : 1,
|
|
1887
|
-
dayWidth,
|
|
1888
|
-
dayIndex,
|
|
1889
|
-
dayCount: days.length,
|
|
1890
|
-
dayOrdinals,
|
|
1958
|
+
left: dayLeft(dayIndex),
|
|
1959
|
+
width: dayWidth,
|
|
1891
1960
|
mode,
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
showDragHandle,
|
|
1896
|
-
eventStartEditable,
|
|
1897
|
-
eventDurationEditable,
|
|
1961
|
+
continuesBefore: b.event.start < dayStart,
|
|
1962
|
+
continuesAfter: b.event.end > nextDayStart,
|
|
1963
|
+
render: renderBackgroundEvent,
|
|
1898
1964
|
onPress: onPressEvent,
|
|
1899
|
-
onLongPress: onLongPressEvent
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
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,
|
|
1908
2004
|
cellHeight: heightSource,
|
|
1909
|
-
dayWidth,
|
|
1910
|
-
hourColumnWidth,
|
|
1911
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,
|
|
1912
2015
|
mode,
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
|
|
2016
|
+
daysPerPage,
|
|
2017
|
+
renderEvent,
|
|
2018
|
+
snapMinutes,
|
|
2019
|
+
minEventHeight,
|
|
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
|
+
]
|
|
1929
2055
|
})
|
|
1930
|
-
|
|
2056
|
+
]
|
|
1931
2057
|
});
|
|
1932
2058
|
}
|
|
1933
2059
|
const TimetablePage = (0, react.memo)(TimetablePageInner);
|
|
1934
|
-
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
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 }) {
|
|
1935
2061
|
const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
|
|
1936
2062
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
1937
2063
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
2064
|
+
const pagedHeader = renderHeader == null;
|
|
2065
|
+
const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
|
|
1938
2066
|
const labeledRenderEvent = (0, react.useMemo)(() => require_MonthList.withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, ampm), [
|
|
1939
2067
|
renderEvent,
|
|
1940
2068
|
eventAccessibilityLabel,
|
|
@@ -1948,34 +2076,76 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1948
2076
|
eventOverlap,
|
|
1949
2077
|
events
|
|
1950
2078
|
]);
|
|
1951
|
-
const { width
|
|
2079
|
+
const { width } = (0, react_native.useWindowDimensions)();
|
|
1952
2080
|
const listRef = (0, react.useRef)(null);
|
|
1953
2081
|
const pagerRef = (0, react.useRef)(null);
|
|
1954
2082
|
const containerRef = (0, react.useRef)(null);
|
|
1955
|
-
const
|
|
1956
|
-
const
|
|
2083
|
+
const viewportRef = (0, react.useRef)(null);
|
|
2084
|
+
const pagerLayoutWidthRef = (0, react.useRef)(-1);
|
|
2085
|
+
const scrollRef = (0, react_native_reanimated.useAnimatedRef)();
|
|
1957
2086
|
const [containerWidth, setContainerWidth] = (0, react.useState)(width);
|
|
1958
|
-
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);
|
|
1959
2091
|
const weekAnchored = mode === "week" || mode === "custom" && weekEndsOn != null;
|
|
1960
2092
|
const step = weekAnchored ? 7 : (0, _super_calendar_core.viewDayCount)(mode, numberOfDays);
|
|
1961
2093
|
const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR$1 - clampedMinHour) * hourHeight;
|
|
1962
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);
|
|
1963
2135
|
const pagerLeft = (0, react_native_reanimated.useSharedValue)(0);
|
|
1964
|
-
const pagerTop = (0, react_native_reanimated.useSharedValue)(0);
|
|
1965
2136
|
const pagerWidth = (0, react_native_reanimated.useSharedValue)(width);
|
|
1966
|
-
const
|
|
2137
|
+
const pagerTop = (0, react_native_reanimated.useDerivedValue)(() => viewportTop.value - scrollY.value);
|
|
1967
2138
|
const ghostX = (0, react_native_reanimated.useSharedValue)(0);
|
|
1968
2139
|
const ghostY = (0, react_native_reanimated.useSharedValue)(0);
|
|
1969
2140
|
const ghostW = (0, react_native_reanimated.useSharedValue)(0);
|
|
1970
2141
|
const ghostH = (0, react_native_reanimated.useSharedValue)(0);
|
|
1971
2142
|
const ghostVisible = (0, react_native_reanimated.useSharedValue)(0);
|
|
1972
|
-
const gridTop = (0, react_native_reanimated.useSharedValue)(0);
|
|
1973
2143
|
const [liftedEvent, setLiftedEvent] = (0, react.useState)(null);
|
|
1974
2144
|
const liftedEventRef = (0, react.useRef)(null);
|
|
1975
2145
|
const dropRef = (0, react.useRef)({
|
|
1976
2146
|
headerDays: [],
|
|
1977
|
-
|
|
1978
|
-
|
|
2147
|
+
columnsWidth,
|
|
2148
|
+
headerOffset,
|
|
1979
2149
|
minHour: clampedMinHour,
|
|
1980
2150
|
maxHour: clampedMaxHour,
|
|
1981
2151
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
@@ -1990,17 +2160,16 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1990
2160
|
ghostVisible.value = 0;
|
|
1991
2161
|
liftedEventRef.current = null;
|
|
1992
2162
|
setLiftedEvent(null);
|
|
1993
|
-
setEdgePagingLock(false);
|
|
1994
2163
|
}, [ghostVisible]);
|
|
1995
2164
|
const commitLiftedDrop = (0, react.useCallback)((ghostLocalX, ghostLocalY) => {
|
|
1996
|
-
const { headerDays: days,
|
|
2165
|
+
const { headerDays: days, columnsWidth: cw, headerOffset: headerH, minHour: min, maxHour: max, snapMinutes: snap, onDragEvent: onDrag, onChangeDate: onDate } = dropRef.current;
|
|
1997
2166
|
const ev = liftedEventRef.current;
|
|
1998
2167
|
const duration = ev ? ev.end.getTime() - ev.start.getTime() : 0;
|
|
1999
2168
|
clearLift();
|
|
2000
2169
|
if (!ev || !onDrag || days.length === 0) return;
|
|
2001
|
-
const dayWidth =
|
|
2002
|
-
const col = Math.min(Math.max(Math.floor(
|
|
2003
|
-
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;
|
|
2004
2173
|
const minutes = (0, _super_calendar_core.clampMoveStartMinutes)(Math.round(rawMinutes / snap) * snap, min, max, snap);
|
|
2005
2174
|
const start = new Date(days[col]);
|
|
2006
2175
|
start.setHours(0, 0, 0, 0);
|
|
@@ -2008,18 +2177,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2008
2177
|
if (onDrag(ev, start, new Date(start.getTime() + duration)) === false) onDate(ev.start);
|
|
2009
2178
|
}, [
|
|
2010
2179
|
clearLift,
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
cellHeight
|
|
2180
|
+
cellHeight,
|
|
2181
|
+
laneHeight
|
|
2014
2182
|
]);
|
|
2015
|
-
const handleGridTop = (0, react.useCallback)((y) => {
|
|
2016
|
-
gridTop.value = y;
|
|
2017
|
-
}, [gridTop]);
|
|
2018
2183
|
const edgePaging = (0, react.useMemo)(() => ({
|
|
2019
2184
|
pagerLeft,
|
|
2020
2185
|
pagerTop,
|
|
2021
2186
|
pagerWidth,
|
|
2022
|
-
lockScroll: setEdgePagingLock,
|
|
2023
2187
|
ghostX,
|
|
2024
2188
|
ghostY,
|
|
2025
2189
|
ghostW,
|
|
@@ -2039,11 +2203,37 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2039
2203
|
beginLift,
|
|
2040
2204
|
commitLiftedDrop
|
|
2041
2205
|
]);
|
|
2042
|
-
const offsetSeedRef = (0, react.useRef)(null);
|
|
2043
|
-
const captureOffsetSeed = (0, react.useCallback)((y) => {
|
|
2044
|
-
offsetSeedRef.current = y;
|
|
2045
|
-
}, []);
|
|
2046
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
|
+
]);
|
|
2047
2237
|
useWebGridZoom(isWeb$1, containerRef, cellHeight, committedCellHeight, minHourHeight, maxHourHeight);
|
|
2048
2238
|
const [anchorDate] = (0, react.useState)(date);
|
|
2049
2239
|
const anchor = (0, react.useMemo)(() => weekAnchored ? (0, date_fns.startOfWeek)(anchorDate, { weekStartsOn }) : (0, date_fns.startOfDay)(anchorDate), [
|
|
@@ -2061,8 +2251,31 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2061
2251
|
step,
|
|
2062
2252
|
weekStartsOn
|
|
2063
2253
|
])(date);
|
|
2254
|
+
(0, react.useEffect)(() => {
|
|
2255
|
+
activeIndexShared.value = activeIndex;
|
|
2256
|
+
}, [activeIndex, activeIndexShared]);
|
|
2064
2257
|
const viewedIndexRef = (0, react.useRef)(activeIndex);
|
|
2065
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
|
+
]);
|
|
2066
2279
|
const headerDays = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
|
|
2067
2280
|
mode,
|
|
2068
2281
|
pageDates,
|
|
@@ -2076,8 +2289,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2076
2289
|
]);
|
|
2077
2290
|
dropRef.current = {
|
|
2078
2291
|
headerDays,
|
|
2079
|
-
|
|
2080
|
-
|
|
2292
|
+
columnsWidth,
|
|
2293
|
+
headerOffset,
|
|
2081
2294
|
minHour: clampedMinHour,
|
|
2082
2295
|
maxHour: clampedMaxHour,
|
|
2083
2296
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
@@ -2103,55 +2316,26 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2103
2316
|
if (activeIndex === viewedIndexRef.current) return;
|
|
2104
2317
|
viewedIndexRef.current = activeIndex;
|
|
2105
2318
|
pendingScrollIndexRef.current = activeIndex;
|
|
2319
|
+
pagerOffset.value = activeIndex * columnsWidth;
|
|
2106
2320
|
listRef.current?.scrollToIndex({
|
|
2107
2321
|
index: activeIndex,
|
|
2108
2322
|
animated: false
|
|
2109
2323
|
});
|
|
2110
2324
|
}, [activeIndex]);
|
|
2111
2325
|
(0, react.useEffect)(() => {
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
if (!root) return;
|
|
2115
|
-
const restoreVisiblePage = () => {
|
|
2116
|
-
const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
|
|
2117
|
-
for (const el of root.querySelectorAll("*")) {
|
|
2118
|
-
const style = getComputedStyle(el);
|
|
2119
|
-
if (!((style.overflowY === "scroll" || style.overflowY === "auto") && el.scrollHeight > el.clientHeight + 20 && el.clientHeight > 100)) continue;
|
|
2120
|
-
const rect = el.getBoundingClientRect();
|
|
2121
|
-
if (rect.left > -50 && rect.right <= vw + 50) {
|
|
2122
|
-
el.scrollTop = scrollY.value;
|
|
2123
|
-
break;
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
};
|
|
2127
|
-
suppressCaptureUntilRef.current = Date.now() + 400;
|
|
2128
|
-
let raf2 = 0;
|
|
2129
|
-
const raf1 = requestAnimationFrame(() => {
|
|
2130
|
-
restoreVisiblePage();
|
|
2131
|
-
raf2 = requestAnimationFrame(restoreVisiblePage);
|
|
2132
|
-
});
|
|
2133
|
-
return () => {
|
|
2134
|
-
cancelAnimationFrame(raf1);
|
|
2135
|
-
cancelAnimationFrame(raf2);
|
|
2136
|
-
};
|
|
2137
|
-
}, [activeIndex, pageHeight]);
|
|
2326
|
+
pagerOffset.value = activeIndex * columnsWidth;
|
|
2327
|
+
}, [columnsWidth, pagerOffset]);
|
|
2138
2328
|
(0, react.useEffect)(() => {
|
|
2139
2329
|
if (!isWeb$1) return;
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
if (!el || typeof el.scrollTop !== "number" || el.clientHeight <= 100) return;
|
|
2146
|
-
const rect = el.getBoundingClientRect();
|
|
2147
|
-
const vw = (root.ownerDocument?.defaultView ?? globalThis).innerWidth;
|
|
2148
|
-
if (rect.left <= -50 || rect.right > vw + 50) return;
|
|
2149
|
-
scrollY.value = el.scrollTop;
|
|
2150
|
-
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);
|
|
2151
2335
|
};
|
|
2152
|
-
|
|
2153
|
-
return () =>
|
|
2154
|
-
}, []);
|
|
2336
|
+
frame = requestAnimationFrame(attempt);
|
|
2337
|
+
return () => cancelAnimationFrame(frame);
|
|
2338
|
+
}, [seedWebScroll]);
|
|
2155
2339
|
(0, react.useEffect)(() => {
|
|
2156
2340
|
if (!isWeb$1) return;
|
|
2157
2341
|
const root = containerRef.current;
|
|
@@ -2168,17 +2352,51 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2168
2352
|
};
|
|
2169
2353
|
const raf = requestAnimationFrame(lockHorizontal);
|
|
2170
2354
|
return () => cancelAnimationFrame(raf);
|
|
2171
|
-
}, [
|
|
2355
|
+
}, [columnsWidth]);
|
|
2356
|
+
const reduceMotion = (0, react_native_reanimated.useReducedMotion)();
|
|
2172
2357
|
const goToPage = (0, react.useCallback)((delta) => {
|
|
2173
|
-
const
|
|
2174
|
-
|
|
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);
|
|
2175
2369
|
}, [
|
|
2176
2370
|
pageDates,
|
|
2177
|
-
|
|
2178
|
-
onChangeDate
|
|
2371
|
+
reduceMotion,
|
|
2372
|
+
onChangeDate,
|
|
2373
|
+
columnsWidth,
|
|
2374
|
+
pagerOffset
|
|
2179
2375
|
]);
|
|
2180
2376
|
require_MonthList.useWebPagerKeys(swipeEnabled, goToPage);
|
|
2181
|
-
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
|
+
]);
|
|
2182
2400
|
const handlePressCell = (0, react.useMemo)(() => {
|
|
2183
2401
|
if (!onPressCell) return void 0;
|
|
2184
2402
|
if (!resetPageOnPressCell) return onPressCell;
|
|
@@ -2197,98 +2415,93 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2197
2415
|
]);
|
|
2198
2416
|
const snapToIndices = (0, react.useMemo)(() => pageDates.map((_, index) => index), [pageDates]);
|
|
2199
2417
|
const keyExtractorList = (0, react.useCallback)((item) => item.toISOString(), []);
|
|
2200
|
-
const getFixedItemSize = (0, react.useCallback)(() =>
|
|
2201
|
-
const renderItem = (0, react.useCallback)(({ item, index }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2202
|
-
style: {
|
|
2203
|
-
width: containerWidth,
|
|
2204
|
-
height: pageHeight
|
|
2205
|
-
},
|
|
2206
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimetablePage, {
|
|
2207
|
-
mode,
|
|
2208
|
-
numberOfDays,
|
|
2209
|
-
hiddenDays,
|
|
2210
|
-
now,
|
|
2211
|
-
nowTimeZone: timeZone,
|
|
2212
|
-
date: item,
|
|
2213
|
-
width: containerWidth,
|
|
2214
|
-
events,
|
|
2215
|
-
cellHeight,
|
|
2216
|
-
hourHeight,
|
|
2217
|
-
committedCellHeight,
|
|
2218
|
-
scrollY,
|
|
2219
|
-
isActive: index === activeIndex,
|
|
2220
|
-
initialScrollY: offsetSeedRef.current ?? seedDefaultY,
|
|
2221
|
-
onSettleOffset: captureOffsetSeed,
|
|
2222
|
-
weekStartsOn,
|
|
2223
|
-
weekEndsOn,
|
|
2224
|
-
hourColumnWidth,
|
|
2225
|
-
minHour: clampedMinHour,
|
|
2226
|
-
maxHour: clampedMaxHour,
|
|
2227
|
-
ampm,
|
|
2228
|
-
timeslots,
|
|
2229
|
-
isRTL,
|
|
2230
|
-
showAllDayEventCell,
|
|
2231
|
-
highlightWeekends,
|
|
2232
|
-
showVerticalScrollIndicator,
|
|
2233
|
-
verticalScrollEnabled,
|
|
2234
|
-
hourComponent,
|
|
2235
|
-
calendarCellStyle,
|
|
2236
|
-
businessHours,
|
|
2237
|
-
renderBusinessHours,
|
|
2238
|
-
minHourHeight,
|
|
2239
|
-
maxHourHeight,
|
|
2240
|
-
showNowIndicator,
|
|
2241
|
-
renderEvent: labeledRenderEvent,
|
|
2242
|
-
keyExtractor,
|
|
2243
|
-
snapMinutes: Math.max(1, dragStepMinutes),
|
|
2244
|
-
showDragHandle,
|
|
2245
|
-
eventStartEditable,
|
|
2246
|
-
eventDurationEditable,
|
|
2247
|
-
onPressEvent,
|
|
2248
|
-
onLongPressEvent,
|
|
2249
|
-
onDragEvent,
|
|
2250
|
-
onDragStart,
|
|
2251
|
-
onPressCell: handlePressCell,
|
|
2252
|
-
onLongPressCell,
|
|
2253
|
-
onCreateEvent,
|
|
2254
|
-
onEdgeAdvance: goToPage,
|
|
2255
|
-
onGridTop: handleGridTop
|
|
2256
|
-
})
|
|
2257
|
-
}), [
|
|
2258
|
-
containerWidth,
|
|
2259
|
-
pageHeight,
|
|
2260
|
-
handleGridTop,
|
|
2418
|
+
const getFixedItemSize = (0, react.useCallback)(() => columnsWidth, [columnsWidth]);
|
|
2419
|
+
const renderItem = (0, react.useCallback)(({ item, index }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimetablePage, {
|
|
2261
2420
|
mode,
|
|
2262
2421
|
numberOfDays,
|
|
2422
|
+
hiddenDays,
|
|
2423
|
+
now,
|
|
2424
|
+
nowTimeZone: timeZone,
|
|
2425
|
+
date: item,
|
|
2426
|
+
width: columnsWidth,
|
|
2263
2427
|
events,
|
|
2264
2428
|
cellHeight,
|
|
2265
|
-
hourHeight,
|
|
2266
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,
|
|
2267
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,
|
|
2479
|
+
scrollY,
|
|
2480
|
+
showAllDayEventCell,
|
|
2481
|
+
reportLaneHeight,
|
|
2482
|
+
mode,
|
|
2483
|
+
numberOfDays,
|
|
2484
|
+
events,
|
|
2485
|
+
cellHeight,
|
|
2486
|
+
committedCellHeight,
|
|
2268
2487
|
activeIndex,
|
|
2269
|
-
seedDefaultY,
|
|
2270
|
-
captureOffsetSeed,
|
|
2271
2488
|
weekStartsOn,
|
|
2272
2489
|
weekEndsOn,
|
|
2273
|
-
hourColumnWidth,
|
|
2274
2490
|
clampedMinHour,
|
|
2275
2491
|
clampedMaxHour,
|
|
2276
|
-
ampm,
|
|
2277
2492
|
timeslots,
|
|
2278
2493
|
isRTL,
|
|
2279
|
-
showAllDayEventCell,
|
|
2280
2494
|
highlightWeekends,
|
|
2281
|
-
showVerticalScrollIndicator,
|
|
2282
|
-
verticalScrollEnabled,
|
|
2283
|
-
hourComponent,
|
|
2284
2495
|
calendarCellStyle,
|
|
2285
2496
|
businessHours,
|
|
2286
|
-
|
|
2287
|
-
|
|
2497
|
+
renderBusinessHours,
|
|
2498
|
+
renderBackgroundEvent,
|
|
2288
2499
|
showNowIndicator,
|
|
2289
2500
|
labeledRenderEvent,
|
|
2290
2501
|
keyExtractor,
|
|
2291
2502
|
dragStepMinutes,
|
|
2503
|
+
minEventHeight,
|
|
2504
|
+
eventGap,
|
|
2292
2505
|
showDragHandle,
|
|
2293
2506
|
eventStartEditable,
|
|
2294
2507
|
eventDurationEditable,
|
|
@@ -2306,8 +2519,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2306
2519
|
]);
|
|
2307
2520
|
const listExtraData = (0, react.useMemo)(() => ({
|
|
2308
2521
|
events,
|
|
2309
|
-
activeIndex
|
|
2310
|
-
|
|
2522
|
+
activeIndex,
|
|
2523
|
+
columnsWidth
|
|
2524
|
+
}), [
|
|
2525
|
+
events,
|
|
2526
|
+
activeIndex,
|
|
2527
|
+
columnsWidth
|
|
2528
|
+
]);
|
|
2311
2529
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.SlotStylesProvider, {
|
|
2312
2530
|
classNames,
|
|
2313
2531
|
styles: styleOverrides,
|
|
@@ -2316,62 +2534,105 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2316
2534
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
2317
2535
|
ref: containerRef,
|
|
2318
2536
|
style: styles$1.container,
|
|
2537
|
+
onLayout: (event) => setContainerWidth(event.nativeEvent.layout.width),
|
|
2319
2538
|
children: [
|
|
2320
|
-
renderHeader ? renderHeader(headerDays) :
|
|
2321
|
-
days: headerDays,
|
|
2322
|
-
mode,
|
|
2323
|
-
width: containerWidth,
|
|
2324
|
-
hourColumnWidth,
|
|
2325
|
-
showWeekNumber,
|
|
2326
|
-
weekNumberPrefix,
|
|
2327
|
-
weekdayFormat,
|
|
2328
|
-
locale,
|
|
2329
|
-
activeDate,
|
|
2330
|
-
onPressDateHeader
|
|
2331
|
-
}),
|
|
2539
|
+
renderHeader ? renderHeader(headerDays) : null,
|
|
2332
2540
|
headerComponent,
|
|
2333
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
2334
|
-
ref:
|
|
2335
|
-
style: styles$1.
|
|
2336
|
-
onLayout: (
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
pagerRef.current?.measureInWindow((x, y, w) => {
|
|
2341
|
-
pagerLeft.value = x;
|
|
2342
|
-
pagerTop.value = y;
|
|
2343
|
-
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;
|
|
2344
2548
|
});
|
|
2345
2549
|
},
|
|
2346
|
-
children:
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
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
|
+
})
|
|
2375
2636
|
})
|
|
2376
2637
|
]
|
|
2377
2638
|
})
|
|
@@ -2398,23 +2659,10 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2398
2659
|
* ```
|
|
2399
2660
|
*/
|
|
2400
2661
|
const TimeGrid = (0, react.memo)(TimeGridInner);
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
2406
|
-
...slot("header", {
|
|
2407
|
-
base: styles$1.headerRow,
|
|
2408
|
-
themed: { borderBottomColor: theme.colors.gridLine }
|
|
2409
|
-
}),
|
|
2410
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2411
|
-
style: [styles$1.weekNumberGutter, { width: hourColumnWidth }],
|
|
2412
|
-
children: showWeekNumber && hourColumnWidth > 0 && days[0] ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
2413
|
-
...slot("weekNumber", { themed: [theme.text.hourLabel, { color: theme.colors.textMuted }] }),
|
|
2414
|
-
allowFontScaling: false,
|
|
2415
|
-
children: `${weekNumberPrefix}${(0, date_fns.getISOWeek)(days.find((d) => d.getDay() === 4) ?? days[0])}`
|
|
2416
|
-
}) : null
|
|
2417
|
-
}), 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, {
|
|
2418
2666
|
day,
|
|
2419
2667
|
mode,
|
|
2420
2668
|
width: dayWidth,
|
|
@@ -2422,7 +2670,7 @@ const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, wee
|
|
|
2422
2670
|
locale,
|
|
2423
2671
|
activeDate,
|
|
2424
2672
|
onPressDateHeader
|
|
2425
|
-
}, day.toISOString()))
|
|
2673
|
+
}, day.toISOString()))
|
|
2426
2674
|
});
|
|
2427
2675
|
};
|
|
2428
2676
|
const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, onPressDateHeader }) => {
|
|
@@ -2466,17 +2714,58 @@ const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, on
|
|
|
2466
2714
|
});
|
|
2467
2715
|
};
|
|
2468
2716
|
const styles$1 = react_native.StyleSheet.create({
|
|
2469
|
-
pager: {
|
|
2717
|
+
pager: {
|
|
2718
|
+
position: "absolute",
|
|
2719
|
+
top: 0,
|
|
2720
|
+
right: 0
|
|
2721
|
+
},
|
|
2470
2722
|
pagerList: { flex: 1 },
|
|
2471
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 },
|
|
2472
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,
|
|
2473
2755
|
flexDirection: "row",
|
|
2474
2756
|
alignItems: "center",
|
|
2475
2757
|
borderBottomWidth: react_native.StyleSheet.hairlineWidth
|
|
2476
2758
|
},
|
|
2477
|
-
|
|
2759
|
+
gutterCorner: {
|
|
2760
|
+
position: "absolute",
|
|
2761
|
+
top: 0,
|
|
2762
|
+
left: 0,
|
|
2763
|
+
right: 0,
|
|
2764
|
+
zIndex: 2,
|
|
2478
2765
|
alignItems: "center",
|
|
2479
|
-
justifyContent: "flex-end"
|
|
2766
|
+
justifyContent: "flex-end",
|
|
2767
|
+
paddingBottom: 6,
|
|
2768
|
+
borderBottomWidth: react_native.StyleSheet.hairlineWidth
|
|
2480
2769
|
},
|
|
2481
2770
|
dayHeader: {
|
|
2482
2771
|
alignItems: "center",
|
|
@@ -2490,27 +2779,60 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2490
2779
|
justifyContent: "center",
|
|
2491
2780
|
alignItems: "center"
|
|
2492
2781
|
},
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
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
|
|
2496
2815
|
},
|
|
2497
2816
|
cellPressLayer: {
|
|
2498
2817
|
position: "absolute",
|
|
2499
2818
|
top: 0,
|
|
2500
2819
|
bottom: 0,
|
|
2820
|
+
left: 0,
|
|
2501
2821
|
right: 0
|
|
2502
2822
|
},
|
|
2503
2823
|
createGhost: {
|
|
2504
2824
|
position: "absolute",
|
|
2505
2825
|
borderRadius: 6,
|
|
2506
|
-
borderWidth: react_native.StyleSheet.hairlineWidth
|
|
2507
|
-
marginHorizontal: EVENT_GAP
|
|
2826
|
+
borderWidth: react_native.StyleSheet.hairlineWidth
|
|
2508
2827
|
},
|
|
2509
2828
|
weekendColumn: {
|
|
2510
2829
|
position: "absolute",
|
|
2511
2830
|
top: 0
|
|
2512
2831
|
},
|
|
2513
|
-
shadeBand: {
|
|
2832
|
+
shadeBand: {
|
|
2833
|
+
position: "absolute",
|
|
2834
|
+
overflow: "hidden"
|
|
2835
|
+
},
|
|
2514
2836
|
daySeparator: {
|
|
2515
2837
|
position: "absolute",
|
|
2516
2838
|
top: 0,
|
|
@@ -2518,6 +2840,7 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2518
2840
|
},
|
|
2519
2841
|
hourRow: {
|
|
2520
2842
|
position: "absolute",
|
|
2843
|
+
top: 0,
|
|
2521
2844
|
left: 0,
|
|
2522
2845
|
right: 0,
|
|
2523
2846
|
flexDirection: "row",
|
|
@@ -2529,11 +2852,16 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2529
2852
|
paddingRight: 6
|
|
2530
2853
|
},
|
|
2531
2854
|
hourLine: {
|
|
2532
|
-
|
|
2855
|
+
position: "absolute",
|
|
2856
|
+
top: 0,
|
|
2857
|
+
left: 0,
|
|
2858
|
+
right: 0,
|
|
2533
2859
|
height: react_native.StyleSheet.hairlineWidth
|
|
2534
2860
|
},
|
|
2535
2861
|
timeslotLine: {
|
|
2536
2862
|
position: "absolute",
|
|
2863
|
+
top: 0,
|
|
2864
|
+
left: 0,
|
|
2537
2865
|
right: 0,
|
|
2538
2866
|
height: react_native.StyleSheet.hairlineWidth,
|
|
2539
2867
|
opacity: .5
|
|
@@ -2564,8 +2892,7 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2564
2892
|
},
|
|
2565
2893
|
eventBox: {
|
|
2566
2894
|
position: "absolute",
|
|
2567
|
-
overflow: "hidden"
|
|
2568
|
-
padding: EVENT_GAP
|
|
2895
|
+
overflow: "hidden"
|
|
2569
2896
|
},
|
|
2570
2897
|
dragGhost: {
|
|
2571
2898
|
top: 0,
|
|
@@ -2577,6 +2904,7 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2577
2904
|
height: 2
|
|
2578
2905
|
},
|
|
2579
2906
|
nonInteractive: { pointerEvents: "none" },
|
|
2907
|
+
passThrough: { pointerEvents: "box-none" },
|
|
2580
2908
|
webNoScroll: { overflow: "hidden" }
|
|
2581
2909
|
});
|
|
2582
2910
|
//#endregion
|
|
@@ -2622,7 +2950,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
2622
2950
|
* }
|
|
2623
2951
|
* ```
|
|
2624
2952
|
*/
|
|
2625
|
-
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
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 }) {
|
|
2626
2954
|
const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
|
|
2627
2955
|
const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
2628
2956
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -2742,6 +3070,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2742
3070
|
}) : mode === "year" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(YearView, {
|
|
2743
3071
|
date,
|
|
2744
3072
|
events: displayEvents,
|
|
3073
|
+
refreshControl,
|
|
2745
3074
|
weekStartsOn,
|
|
2746
3075
|
hiddenDays,
|
|
2747
3076
|
locale,
|
|
@@ -2767,6 +3096,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2767
3096
|
onPressDay,
|
|
2768
3097
|
activeDate,
|
|
2769
3098
|
itemSeparatorComponent,
|
|
3099
|
+
refreshControl,
|
|
2770
3100
|
classNames,
|
|
2771
3101
|
styles: styleOverrides
|
|
2772
3102
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeGrid, {
|
|
@@ -2789,6 +3119,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2789
3119
|
hideHours,
|
|
2790
3120
|
timeslots,
|
|
2791
3121
|
showAllDayEventCell,
|
|
3122
|
+
showAllDayLabel,
|
|
3123
|
+
refreshControl,
|
|
2792
3124
|
highlightWeekends,
|
|
2793
3125
|
eventStartEditable,
|
|
2794
3126
|
eventDurationEditable,
|
|
@@ -2796,6 +3128,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2796
3128
|
calendarCellStyle,
|
|
2797
3129
|
businessHours,
|
|
2798
3130
|
renderBusinessHours,
|
|
3131
|
+
renderBackgroundEvent,
|
|
2799
3132
|
showWeekNumber,
|
|
2800
3133
|
weekNumberPrefix,
|
|
2801
3134
|
hourComponent,
|
|
@@ -2807,6 +3140,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2807
3140
|
ampm,
|
|
2808
3141
|
minHourHeight,
|
|
2809
3142
|
maxHourHeight,
|
|
3143
|
+
minEventHeight,
|
|
3144
|
+
eventGap,
|
|
2810
3145
|
showNowIndicator,
|
|
2811
3146
|
locale,
|
|
2812
3147
|
activeDate,
|