@super-calendar/native 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/{DefaultMonthEvent-C3C30hfV.d.mts → DefaultMonthEvent-B7xVeY7Q.d.ts} +24 -5
- package/dist/{DefaultMonthEvent-Dx3lD7ig.d.ts → DefaultMonthEvent-hGk7wSrr.d.mts} +24 -5
- package/dist/{MonthList-B2TSGYp7.js → MonthList-C_NTufaK.js} +70 -9
- package/dist/{MonthList-N1GVDIE4.mjs → MonthList-DdQxRhUy.mjs} +71 -10
- package/dist/index.d.mts +37 -13
- package/dist/index.d.ts +37 -13
- package/dist/index.js +179 -63
- package/dist/index.mjs +151 -65
- package/dist/picker.d.mts +1 -1
- package/dist/picker.d.ts +1 -1
- package/dist/picker.js +1 -1
- package/dist/picker.mjs +1 -1
- package/package.json +2 -2
- package/src/components/Agenda.tsx +19 -2
- package/src/components/AllDayLane.tsx +64 -37
- package/src/components/Calendar.tsx +100 -26
- package/src/components/MonthPager.tsx +37 -1
- package/src/components/MonthView.tsx +89 -4
- package/src/components/TimeGrid.tsx +60 -11
- package/src/components/YearView.tsx +12 -1
- package/src/index.tsx +10 -2
- package/src/types.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
const require_MonthList = require("./MonthList-
|
|
23
|
+
const require_MonthList = require("./MonthList-C_NTufaK.js");
|
|
24
24
|
let date_fns = require("date-fns");
|
|
25
25
|
let react = require("react");
|
|
26
26
|
let react_native_reanimated = require("react-native-reanimated");
|
|
@@ -35,7 +35,7 @@ let _legendapp_list_reanimated = require("@legendapp/list/reanimated");
|
|
|
35
35
|
const isWeb$2 = react_native.Platform.OS === "web";
|
|
36
36
|
const DRAG_HOLD_MS = 400;
|
|
37
37
|
const FALLBACK_COLUMNS = 3;
|
|
38
|
-
function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, refreshControl, classNames, styles: styleOverrides }) {
|
|
38
|
+
function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, now, timeZone, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, refreshControl, classNames, styles: styleOverrides }) {
|
|
39
39
|
const theme = require_MonthList.useCalendarTheme();
|
|
40
40
|
const labels = (0, react.useMemo)(() => (0, _super_calendar_core.resolveCalendarLabels)(labelsProp), [labelsProp]);
|
|
41
41
|
const slot = require_MonthList.createSlots({
|
|
@@ -48,6 +48,7 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, labels:
|
|
|
48
48
|
if (width <= 0) return;
|
|
49
49
|
setColumns(Math.max(2, Math.min(4, Math.floor(width / minMonthWidth))));
|
|
50
50
|
};
|
|
51
|
+
const today = (0, _super_calendar_core.nowInTimeZone)(now, timeZone);
|
|
51
52
|
const months = (0, react.useMemo)(() => (0, _super_calendar_core.getYearMonths)(date), [date]);
|
|
52
53
|
const monthWeeks = (0, react.useMemo)(() => months.map((month) => (0, _super_calendar_core.buildMonthWeeks)(month, weekStartsOn, { hiddenDays })), [
|
|
53
54
|
months,
|
|
@@ -178,7 +179,7 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, labels:
|
|
|
178
179
|
...slot("week", { base: styles$5.week }),
|
|
179
180
|
children: week.map((day) => {
|
|
180
181
|
if (day.getMonth() !== month.getMonth()) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: styles$5.day }, day.toISOString());
|
|
181
|
-
const isToday = (0, _super_calendar_core.getIsToday)(day);
|
|
182
|
+
const isToday = (0, _super_calendar_core.getIsToday)(day, today);
|
|
182
183
|
const isHighlighted = activeDate ? (0, _super_calendar_core.isSameCalendarDay)(day, activeDate) : isToday;
|
|
183
184
|
const hasEvents = eventDays.has((0, date_fns.startOfDay)(day).toISOString());
|
|
184
185
|
const state = (0, _super_calendar_core.daySelectionState)(day, {
|
|
@@ -401,7 +402,7 @@ const styles$5 = react_native.StyleSheet.create({
|
|
|
401
402
|
* start, grouped under a date header per day. The consumer controls which
|
|
402
403
|
* events (and therefore which date range) are shown.
|
|
403
404
|
*/
|
|
404
|
-
function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, refreshControl, classNames, styles: styleOverrides }) {
|
|
405
|
+
function Agenda({ events, locale, now, timeZone, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, refreshControl, classNames, styles: styleOverrides }) {
|
|
405
406
|
const theme = require_MonthList.useCalendarTheme();
|
|
406
407
|
const slot = (0, react.useMemo)(() => require_MonthList.createSlots({
|
|
407
408
|
classNames,
|
|
@@ -431,9 +432,10 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
431
432
|
return out;
|
|
432
433
|
}, [events, keyExtractor]);
|
|
433
434
|
const keyExtractorRow = (0, react.useCallback)((row) => row.key, []);
|
|
435
|
+
const todayKey = (0, date_fns.startOfDay)((0, _super_calendar_core.nowInTimeZone)(now, timeZone)).getTime();
|
|
434
436
|
const renderItem = (0, react.useCallback)(({ item }) => {
|
|
435
437
|
if (item.kind === "header") {
|
|
436
|
-
const isHighlighted = activeDate ? (0, date_fns.isSameDay)(item.date, activeDate) : (0, _super_calendar_core.getIsToday)(item.date);
|
|
438
|
+
const isHighlighted = activeDate ? (0, date_fns.isSameDay)(item.date, activeDate) : (0, _super_calendar_core.getIsToday)(item.date, new Date(todayKey));
|
|
437
439
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
438
440
|
...slot("dayHeader", {
|
|
439
441
|
base: styles$4.header,
|
|
@@ -461,6 +463,7 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
461
463
|
theme,
|
|
462
464
|
locale,
|
|
463
465
|
activeDate,
|
|
466
|
+
todayKey,
|
|
464
467
|
onPressDay,
|
|
465
468
|
onPressEvent,
|
|
466
469
|
onLongPressEvent,
|
|
@@ -479,6 +482,7 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
479
482
|
data: rows,
|
|
480
483
|
keyExtractor: keyExtractorRow,
|
|
481
484
|
renderItem,
|
|
485
|
+
extraData: todayKey,
|
|
482
486
|
ItemSeparatorComponent: itemSeparatorComponent ?? void 0,
|
|
483
487
|
recycleItems: false,
|
|
484
488
|
refreshControl
|
|
@@ -699,7 +703,7 @@ function useWebGridZoom(enabled, target, cellHeight, committedCellHeight, minHei
|
|
|
699
703
|
/**
|
|
700
704
|
* The all-day lane of one page, pinned above the scrolling hours. All-day
|
|
701
705
|
* events are excluded from the timed columns (see `layoutDayEvents`) and shown
|
|
702
|
-
* here, stacked
|
|
706
|
+
* here as continuous spans, stacked only when their dates overlap. Always rendered so every page reports a
|
|
703
707
|
* height, zero when the week has none, which the band above the grid follows
|
|
704
708
|
* live as you swipe; the "all-day" label lives in the hour column.
|
|
705
709
|
*/
|
|
@@ -707,43 +711,59 @@ function AllDayLane({ days, events, mode, dayWidth, renderEvent, keyExtractor, o
|
|
|
707
711
|
const theme = require_MonthList.useCalendarTheme();
|
|
708
712
|
const slot = require_MonthList.useSlots();
|
|
709
713
|
const RenderEventComponent = renderEvent;
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
const
|
|
713
|
-
const
|
|
714
|
-
|
|
715
|
-
|
|
714
|
+
const spans = (0, react.useMemo)(() => {
|
|
715
|
+
const allDay = events.filter((event) => (0, _super_calendar_core.isAllDayEvent)(event) && !(0, _super_calendar_core.isBackgroundEvent)(event) && days.some((day) => event.start < (0, date_fns.addDays)((0, date_fns.startOfDay)(day), 1) && event.end > (0, date_fns.startOfDay)(day)));
|
|
716
|
+
const { segments, laneCount } = (0, _super_calendar_core.layoutMonthWeek)(days, allDay);
|
|
717
|
+
const lanes = Array.from({ length: laneCount }, () => []);
|
|
718
|
+
for (const segment of segments) lanes[segment.lane].push(segment);
|
|
719
|
+
return lanes.flat();
|
|
720
|
+
}, [days, events]);
|
|
716
721
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
717
722
|
...slot("allDayLane", {
|
|
718
|
-
base: styles$2.lane,
|
|
723
|
+
base: [styles$2.lane, spans.length > 0 && { paddingVertical: 2 }],
|
|
719
724
|
themed: theme.containers.allDayLane
|
|
720
725
|
}),
|
|
721
726
|
onLayout,
|
|
722
|
-
children:
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
727
|
+
children: spans.map((segment, index) => {
|
|
728
|
+
const { event, startCol, endCol, lane, continuesBefore, continuesAfter } = segment;
|
|
729
|
+
const previous = spans[index - 1];
|
|
730
|
+
const previousEnd = previous?.lane === lane ? previous.endCol : -1;
|
|
731
|
+
const lastInLane = spans[index + 1]?.lane !== lane;
|
|
732
|
+
const remaining = lastInLane ? days.length - endCol - 1 : 0;
|
|
733
|
+
const wrapSlack = lastInLane ? Math.min(.5, dayWidth / 4) : 0;
|
|
734
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
735
|
+
...slot("allDayColumn", {
|
|
736
|
+
base: [styles$2.column, {
|
|
737
|
+
width: dayWidth * (endCol - startCol + 1),
|
|
738
|
+
marginLeft: dayWidth * (startCol - previousEnd - 1),
|
|
739
|
+
marginRight: dayWidth * remaining - wrapSlack
|
|
740
|
+
}],
|
|
741
|
+
themed: theme.containers.allDayColumn
|
|
742
|
+
}),
|
|
743
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
744
|
+
...slot("allDayEvent", { base: styles$2.chip }),
|
|
745
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
746
|
+
event,
|
|
747
|
+
mode,
|
|
748
|
+
isAllDay: true,
|
|
749
|
+
continuesBefore,
|
|
750
|
+
continuesAfter,
|
|
751
|
+
onPress: () => onPressEvent(event),
|
|
752
|
+
onLongPress: onLongPressEvent ? () => onLongPressEvent(event) : void 0
|
|
753
|
+
})
|
|
735
754
|
})
|
|
736
|
-
}, keyExtractor(event, index))
|
|
737
|
-
}
|
|
755
|
+
}, keyExtractor(event, index));
|
|
756
|
+
})
|
|
738
757
|
});
|
|
739
758
|
}
|
|
740
759
|
const styles$2 = react_native.StyleSheet.create({
|
|
741
|
-
lane: {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
760
|
+
lane: {
|
|
761
|
+
flexDirection: "row",
|
|
762
|
+
flexWrap: "wrap",
|
|
763
|
+
alignItems: "flex-start",
|
|
764
|
+
rowGap: 2
|
|
746
765
|
},
|
|
766
|
+
column: { paddingHorizontal: 1 },
|
|
747
767
|
chip: { minHeight: 18 }
|
|
748
768
|
});
|
|
749
769
|
// src/components/MultiDayMovePreview.tsx
|
|
@@ -964,6 +984,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
964
984
|
const resizeStartDelta = (0, react_native_reanimated.useSharedValue)(0);
|
|
965
985
|
const dragZ = (0, react_native_reanimated.useSharedValue)(0);
|
|
966
986
|
const moving = (0, react_native_reanimated.useSharedValue)(0);
|
|
987
|
+
const onHandle = (0, react_native_reanimated.useSharedValue)(0);
|
|
967
988
|
const edgeDir = (0, react_native_reanimated.useSharedValue)(0);
|
|
968
989
|
const lifted = (0, react_native_reanimated.useSharedValue)(0);
|
|
969
990
|
const grabX = (0, react_native_reanimated.useSharedValue)(0);
|
|
@@ -979,6 +1000,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
979
1000
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
980
1001
|
ownsStart
|
|
981
1002
|
}), [startHours, ownsStart]);
|
|
1003
|
+
const columnInsetSV = (0, react_native_reanimated.useDerivedValue)(() => left - dayLeftPx, [left, dayLeftPx]);
|
|
982
1004
|
const eventStartMs = positioned.event.start.getTime();
|
|
983
1005
|
const eventEndMs = positioned.event.end.getTime();
|
|
984
1006
|
const moveExtra = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
@@ -1015,8 +1037,12 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1015
1037
|
minEventHeight
|
|
1016
1038
|
]);
|
|
1017
1039
|
const boxStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
1040
|
+
const top = (startHours + moveExtra.value.top - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
1041
|
+
const floating = !onHandle.value && (moving.value || moveOffset.value !== 0 || moveOffsetX.value !== 0);
|
|
1018
1042
|
return {
|
|
1019
|
-
|
|
1043
|
+
left: floating ? dayLeftPx : left,
|
|
1044
|
+
width: floating ? dayWidth : width,
|
|
1045
|
+
top,
|
|
1020
1046
|
height: visibleBoxHeight.value,
|
|
1021
1047
|
transform: [{ translateX: moveOffsetX.value }],
|
|
1022
1048
|
zIndex: dragZ.value,
|
|
@@ -1025,7 +1051,11 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1025
1051
|
}, [
|
|
1026
1052
|
startHours,
|
|
1027
1053
|
minHour,
|
|
1028
|
-
hiddenForMove
|
|
1054
|
+
hiddenForMove,
|
|
1055
|
+
left,
|
|
1056
|
+
width,
|
|
1057
|
+
dayLeftPx,
|
|
1058
|
+
dayWidth
|
|
1029
1059
|
]);
|
|
1030
1060
|
const spillHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
1031
1061
|
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
@@ -1151,7 +1181,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1151
1181
|
if (!edgePaging) return;
|
|
1152
1182
|
if (!lifted.value) {
|
|
1153
1183
|
lifted.value = 1;
|
|
1154
|
-
edgePaging.ghostW.value =
|
|
1184
|
+
edgePaging.ghostW.value = dayWidth;
|
|
1155
1185
|
edgePaging.ghostH.value = boxHeight.value;
|
|
1156
1186
|
edgePaging.ghostX.value = liveAbsX.value - grabX.value - edgePaging.pagerLeft.value;
|
|
1157
1187
|
edgePaging.ghostY.value = liveAbsY.value - grabY.value - edgePaging.pagerTop.value;
|
|
@@ -1166,7 +1196,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1166
1196
|
disarmEdge,
|
|
1167
1197
|
edgePaging,
|
|
1168
1198
|
lifted,
|
|
1169
|
-
|
|
1199
|
+
dayWidth,
|
|
1170
1200
|
boxHeight,
|
|
1171
1201
|
liveAbsX,
|
|
1172
1202
|
liveAbsY,
|
|
@@ -1180,7 +1210,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1180
1210
|
moving.value = 1;
|
|
1181
1211
|
edgeDir.value = 0;
|
|
1182
1212
|
lifted.value = 0;
|
|
1183
|
-
grabX.value = event.x;
|
|
1213
|
+
grabX.value = event.x + columnInsetSV.value;
|
|
1184
1214
|
grabY.value = event.y;
|
|
1185
1215
|
liveAbsX.value = event.absoluteX;
|
|
1186
1216
|
liveAbsY.value = event.absoluteY;
|
|
@@ -1247,6 +1277,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1247
1277
|
}, [
|
|
1248
1278
|
canMove,
|
|
1249
1279
|
snapMinutes,
|
|
1280
|
+
columnInsetSV,
|
|
1250
1281
|
cellHeight,
|
|
1251
1282
|
moveOffset,
|
|
1252
1283
|
moveOffsetX,
|
|
@@ -1291,7 +1322,9 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1291
1322
|
press?.(event);
|
|
1292
1323
|
}, []);
|
|
1293
1324
|
const resizeGesture = (0, react.useMemo)(() => {
|
|
1294
|
-
const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizable).
|
|
1325
|
+
const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizable).onBegin(() => {
|
|
1326
|
+
onHandle.value = 1;
|
|
1327
|
+
}).onStart(() => {
|
|
1295
1328
|
dragZ.value = DRAG_EVENT_Z;
|
|
1296
1329
|
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
1297
1330
|
}).onUpdate((event) => {
|
|
@@ -1306,6 +1339,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1306
1339
|
(0, react_native_reanimated.runOnJS)(commitDrag)(0, delta);
|
|
1307
1340
|
}).onFinalize(() => {
|
|
1308
1341
|
dragZ.value = 0;
|
|
1342
|
+
onHandle.value = 0;
|
|
1309
1343
|
});
|
|
1310
1344
|
const tap = react_native_gesture_handler.Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1311
1345
|
if (success) handlePress();
|
|
@@ -1318,6 +1352,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1318
1352
|
resizable,
|
|
1319
1353
|
snapMinutes,
|
|
1320
1354
|
cellHeight,
|
|
1355
|
+
onHandle,
|
|
1321
1356
|
resizeDelta,
|
|
1322
1357
|
dragZ,
|
|
1323
1358
|
commitDrag,
|
|
@@ -1327,7 +1362,9 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1327
1362
|
handleLongPressFromHandle
|
|
1328
1363
|
]);
|
|
1329
1364
|
const resizeStartGesture = (0, react.useMemo)(() => {
|
|
1330
|
-
const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizableFromStart).
|
|
1365
|
+
const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizableFromStart).onBegin(() => {
|
|
1366
|
+
onHandle.value = 1;
|
|
1367
|
+
}).onStart(() => {
|
|
1331
1368
|
dragZ.value = DRAG_EVENT_Z;
|
|
1332
1369
|
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
1333
1370
|
}).onUpdate((event) => {
|
|
@@ -1342,6 +1379,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1342
1379
|
(0, react_native_reanimated.runOnJS)(commitDrag)(delta, 0);
|
|
1343
1380
|
}).onFinalize(() => {
|
|
1344
1381
|
dragZ.value = 0;
|
|
1382
|
+
onHandle.value = 0;
|
|
1345
1383
|
});
|
|
1346
1384
|
const tap = react_native_gesture_handler.Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1347
1385
|
if (success) handlePress();
|
|
@@ -1354,6 +1392,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1354
1392
|
resizableFromStart,
|
|
1355
1393
|
snapMinutes,
|
|
1356
1394
|
cellHeight,
|
|
1395
|
+
onHandle,
|
|
1357
1396
|
resizeStartDelta,
|
|
1358
1397
|
dragZ,
|
|
1359
1398
|
commitDrag,
|
|
@@ -1707,6 +1746,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1707
1746
|
now: nowProp,
|
|
1708
1747
|
timeZone: nowTimeZone
|
|
1709
1748
|
});
|
|
1749
|
+
const today = showNowIndicator && isActive ? now : (0, _super_calendar_core.nowInTimeZone)(nowProp, nowTimeZone);
|
|
1710
1750
|
const nowDayIndex = days.findIndex((day) => (0, _super_calendar_core.isSameCalendarDay)(day, now));
|
|
1711
1751
|
const nowHours = ((0, date_fns.getHours)(now) * MINUTES_PER_HOUR$1 + (0, date_fns.getMinutes)(now)) / MINUTES_PER_HOUR$1;
|
|
1712
1752
|
const nowInWindow = nowHours >= minHour && nowHours <= maxHour;
|
|
@@ -2033,6 +2073,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
2033
2073
|
dayWidth,
|
|
2034
2074
|
weekdayFormat,
|
|
2035
2075
|
todayLabel,
|
|
2076
|
+
today,
|
|
2036
2077
|
locale,
|
|
2037
2078
|
activeDate,
|
|
2038
2079
|
onPressDateHeader
|
|
@@ -2803,6 +2844,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2803
2844
|
now,
|
|
2804
2845
|
timeZone
|
|
2805
2846
|
]);
|
|
2847
|
+
const nowTime = now?.getTime();
|
|
2806
2848
|
const listExtraData = (0, react.useMemo)(() => ({
|
|
2807
2849
|
events,
|
|
2808
2850
|
activeIndex,
|
|
@@ -2812,7 +2854,9 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2812
2854
|
onCreateEvent,
|
|
2813
2855
|
dragStepMinutes,
|
|
2814
2856
|
minHour,
|
|
2815
|
-
maxHour
|
|
2857
|
+
maxHour,
|
|
2858
|
+
nowTime,
|
|
2859
|
+
timeZone
|
|
2816
2860
|
}), [
|
|
2817
2861
|
events,
|
|
2818
2862
|
activeIndex,
|
|
@@ -2822,7 +2866,9 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2822
2866
|
onCreateEvent,
|
|
2823
2867
|
dragStepMinutes,
|
|
2824
2868
|
minHour,
|
|
2825
|
-
maxHour
|
|
2869
|
+
maxHour,
|
|
2870
|
+
nowTime,
|
|
2871
|
+
timeZone
|
|
2826
2872
|
]);
|
|
2827
2873
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.SlotStylesProvider, {
|
|
2828
2874
|
classNames,
|
|
@@ -2966,7 +3012,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2966
3012
|
* ```
|
|
2967
3013
|
*/
|
|
2968
3014
|
const TimeGrid = (0, react.memo)((0, react.forwardRef)(TimeGridInner));
|
|
2969
|
-
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
3015
|
+
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, today, locale, activeDate, onPressDateHeader }) => {
|
|
2970
3016
|
const slot = require_MonthList.useSlots();
|
|
2971
3017
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2972
3018
|
...slot("header", { base: styles$1.headerRow }),
|
|
@@ -2976,16 +3022,17 @@ const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale,
|
|
|
2976
3022
|
width: dayWidth,
|
|
2977
3023
|
weekdayFormat,
|
|
2978
3024
|
todayLabel,
|
|
3025
|
+
today,
|
|
2979
3026
|
locale,
|
|
2980
3027
|
activeDate,
|
|
2981
3028
|
onPressDateHeader
|
|
2982
3029
|
}, day.toISOString()))
|
|
2983
3030
|
});
|
|
2984
3031
|
};
|
|
2985
|
-
const DayHeader = ({ day, width, weekdayFormat = "short", todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
3032
|
+
const DayHeader = ({ day, width, weekdayFormat = "short", todayLabel, today, locale, activeDate, onPressDateHeader }) => {
|
|
2986
3033
|
const theme = require_MonthList.useCalendarTheme();
|
|
2987
3034
|
const slot = require_MonthList.useSlots();
|
|
2988
|
-
const isToday = (0, _super_calendar_core.getIsToday)(day);
|
|
3035
|
+
const isToday = (0, _super_calendar_core.getIsToday)(day, today);
|
|
2989
3036
|
const isHighlighted = activeDate ? (0, _super_calendar_core.isSameCalendarDay)(day, activeDate) : isToday;
|
|
2990
3037
|
const accessibilityLabel = `${(0, date_fns.format)(day, "EEEE d MMMM", { locale })}${isToday ? `, ${todayLabel}` : ""}`;
|
|
2991
3038
|
const headerSlot = slot("columnHeader", {
|
|
@@ -3286,12 +3333,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3286
3333
|
const displayEvents = (0, react.useMemo)(() => {
|
|
3287
3334
|
let out = events;
|
|
3288
3335
|
if (out.some((e) => e.recurrence)) {
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
start = (0, date_fns.addDays)(start, -1);
|
|
3292
|
-
end = (0, date_fns.addDays)(end, 1);
|
|
3293
|
-
}
|
|
3294
|
-
out = (0, _super_calendar_core.expandRecurringEvents)(out, start, end);
|
|
3336
|
+
const [start, end] = expansionRange(mode, date, weekStartsOn, numberOfDays ?? 1, weekEndsOn, numberOfWeeks);
|
|
3337
|
+
out = timeZone ? (0, _super_calendar_core.expandRecurringEvents)(out, (0, _super_calendar_core.fromZonedTime)(start, timeZone), (0, _super_calendar_core.fromZonedTime)(end, timeZone), { timeZone }) : (0, _super_calendar_core.expandRecurringEvents)(out, start, end);
|
|
3295
3338
|
}
|
|
3296
3339
|
if (timeZone) out = (0, _super_calendar_core.eventsInTimeZone)(out, timeZone);
|
|
3297
3340
|
return out;
|
|
@@ -3306,11 +3349,47 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3306
3349
|
numberOfWeeks
|
|
3307
3350
|
]);
|
|
3308
3351
|
const handlePressEvent = (0, react.useCallback)((event) => {
|
|
3309
|
-
if (!event.disabled) onPressEvent(event);
|
|
3310
|
-
}, [onPressEvent]);
|
|
3352
|
+
if (!event.disabled) onPressEvent(timeZone ? (0, _super_calendar_core.zonedEventSource)(event) : event);
|
|
3353
|
+
}, [onPressEvent, timeZone]);
|
|
3311
3354
|
const handleLongPressEvent = (0, react.useMemo)(() => onLongPressEvent ? (event) => {
|
|
3312
|
-
if (!event.disabled) onLongPressEvent(event);
|
|
3313
|
-
} : void 0, [onLongPressEvent]);
|
|
3355
|
+
if (!event.disabled) onLongPressEvent(timeZone ? (0, _super_calendar_core.zonedEventSource)(event) : event);
|
|
3356
|
+
} : void 0, [onLongPressEvent, timeZone]);
|
|
3357
|
+
const timeGridMode = mode !== "month" && mode !== "multiweek";
|
|
3358
|
+
const zoned = (0, react.useMemo)(() => {
|
|
3359
|
+
if (!timeZone) return {
|
|
3360
|
+
onDragStart,
|
|
3361
|
+
onDragEvent,
|
|
3362
|
+
onPressMore,
|
|
3363
|
+
onPressTime: onPressCell,
|
|
3364
|
+
onLongPressTime: onLongPressCell,
|
|
3365
|
+
onCreateTimed: onCreateEvent
|
|
3366
|
+
};
|
|
3367
|
+
const instant = (wallClock) => (0, _super_calendar_core.fromZonedTime)(wallClock, timeZone);
|
|
3368
|
+
return {
|
|
3369
|
+
onDragStart: onDragStart && ((event) => onDragStart((0, _super_calendar_core.zonedEventSource)(event))),
|
|
3370
|
+
onDragEvent: onDragEvent && ((event, start, end) => {
|
|
3371
|
+
const bounds = (0, _super_calendar_core.zonedDragBounds)(event, start, end, { keepDuration: timeGridMode });
|
|
3372
|
+
if (!bounds) return false;
|
|
3373
|
+
return onDragEvent((0, _super_calendar_core.zonedEventSource)(event), bounds.start, bounds.end);
|
|
3374
|
+
}),
|
|
3375
|
+
onPressMore: onPressMore && ((dayEvents, day) => onPressMore(dayEvents.map(_super_calendar_core.zonedEventSource), day)),
|
|
3376
|
+
onPressTime: onPressCell && ((time) => onPressCell(instant(time))),
|
|
3377
|
+
onLongPressTime: onLongPressCell && ((time) => onLongPressCell(instant(time))),
|
|
3378
|
+
onCreateTimed: onCreateEvent && ((start, end) => {
|
|
3379
|
+
const range = (0, _super_calendar_core.fromZonedRange)(start, end, timeZone);
|
|
3380
|
+
if (range) onCreateEvent(range.start, range.end);
|
|
3381
|
+
})
|
|
3382
|
+
};
|
|
3383
|
+
}, [
|
|
3384
|
+
timeZone,
|
|
3385
|
+
timeGridMode,
|
|
3386
|
+
onDragStart,
|
|
3387
|
+
onDragEvent,
|
|
3388
|
+
onPressMore,
|
|
3389
|
+
onPressCell,
|
|
3390
|
+
onLongPressCell,
|
|
3391
|
+
onCreateEvent
|
|
3392
|
+
]);
|
|
3314
3393
|
const handleChangeDate = (0, react.useCallback)((next) => {
|
|
3315
3394
|
onChangeDate(next);
|
|
3316
3395
|
onChangeDateRange?.(visibleRange(mode, next, weekStartsOn, numberOfDays ?? 1, weekEndsOn, numberOfWeeks, hiddenDays));
|
|
@@ -3381,6 +3460,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3381
3460
|
hiddenDays,
|
|
3382
3461
|
weekdayFormat,
|
|
3383
3462
|
locale,
|
|
3463
|
+
now,
|
|
3464
|
+
timeZone,
|
|
3384
3465
|
labels,
|
|
3385
3466
|
sortedMonthView,
|
|
3386
3467
|
moreLabel,
|
|
@@ -3399,11 +3480,12 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3399
3480
|
onPressCell,
|
|
3400
3481
|
onPressEvent: handlePressEvent,
|
|
3401
3482
|
onLongPressEvent: handleLongPressEvent,
|
|
3402
|
-
onPressMore,
|
|
3483
|
+
onPressMore: zoned.onPressMore,
|
|
3403
3484
|
onCreateEvent,
|
|
3485
|
+
renderCreateGhost,
|
|
3404
3486
|
onSelectDrag,
|
|
3405
|
-
onDragEvent,
|
|
3406
|
-
onDragStart,
|
|
3487
|
+
onDragEvent: zoned.onDragEvent,
|
|
3488
|
+
onDragStart: zoned.onDragStart,
|
|
3407
3489
|
eventStartEditable,
|
|
3408
3490
|
eventOverlap,
|
|
3409
3491
|
selectedDates,
|
|
@@ -3424,6 +3506,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3424
3506
|
weekStartsOn,
|
|
3425
3507
|
hiddenDays,
|
|
3426
3508
|
locale,
|
|
3509
|
+
now,
|
|
3510
|
+
timeZone,
|
|
3427
3511
|
labels,
|
|
3428
3512
|
activeDate,
|
|
3429
3513
|
selectedDates,
|
|
@@ -3440,6 +3524,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3440
3524
|
}) : mode === "schedule" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Agenda, {
|
|
3441
3525
|
events: displayEvents,
|
|
3442
3526
|
locale,
|
|
3527
|
+
now,
|
|
3528
|
+
timeZone,
|
|
3443
3529
|
renderEvent: resolvedRenderEvent,
|
|
3444
3530
|
keyExtractor,
|
|
3445
3531
|
onPressEvent: handlePressEvent,
|
|
@@ -3503,14 +3589,14 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3503
3589
|
swipeEnabled,
|
|
3504
3590
|
onPressEvent: handlePressEvent,
|
|
3505
3591
|
onLongPressEvent: handleLongPressEvent,
|
|
3506
|
-
onDragEvent,
|
|
3592
|
+
onDragEvent: zoned.onDragEvent,
|
|
3507
3593
|
showDragHandle,
|
|
3508
|
-
onDragStart,
|
|
3594
|
+
onDragStart: zoned.onDragStart,
|
|
3509
3595
|
dragStepMinutes,
|
|
3510
|
-
onPressCell,
|
|
3596
|
+
onPressCell: zoned.onPressTime,
|
|
3511
3597
|
resetPageOnPressCell,
|
|
3512
|
-
onLongPressCell,
|
|
3513
|
-
onCreateEvent,
|
|
3598
|
+
onLongPressCell: zoned.onLongPressTime,
|
|
3599
|
+
onCreateEvent: zoned.onCreateTimed,
|
|
3514
3600
|
renderCreateGhost,
|
|
3515
3601
|
onPressDateHeader,
|
|
3516
3602
|
onChangeDate: handleChangeDate,
|
|
@@ -4604,6 +4690,18 @@ Object.defineProperty(exports, "expandRecurringEvents", {
|
|
|
4604
4690
|
return _super_calendar_core.expandRecurringEvents;
|
|
4605
4691
|
}
|
|
4606
4692
|
});
|
|
4693
|
+
Object.defineProperty(exports, "fromZonedRange", {
|
|
4694
|
+
enumerable: true,
|
|
4695
|
+
get: function() {
|
|
4696
|
+
return _super_calendar_core.fromZonedRange;
|
|
4697
|
+
}
|
|
4698
|
+
});
|
|
4699
|
+
Object.defineProperty(exports, "fromZonedTime", {
|
|
4700
|
+
enumerable: true,
|
|
4701
|
+
get: function() {
|
|
4702
|
+
return _super_calendar_core.fromZonedTime;
|
|
4703
|
+
}
|
|
4704
|
+
});
|
|
4607
4705
|
Object.defineProperty(exports, "getIsToday", {
|
|
4608
4706
|
enumerable: true,
|
|
4609
4707
|
get: function() {
|
|
@@ -4689,6 +4787,12 @@ Object.defineProperty(exports, "nextDateRange", {
|
|
|
4689
4787
|
return _super_calendar_core.nextDateRange;
|
|
4690
4788
|
}
|
|
4691
4789
|
});
|
|
4790
|
+
Object.defineProperty(exports, "nowInTimeZone", {
|
|
4791
|
+
enumerable: true,
|
|
4792
|
+
get: function() {
|
|
4793
|
+
return _super_calendar_core.nowInTimeZone;
|
|
4794
|
+
}
|
|
4795
|
+
});
|
|
4692
4796
|
Object.defineProperty(exports, "parseICalendar", {
|
|
4693
4797
|
enumerable: true,
|
|
4694
4798
|
get: function() {
|
|
@@ -4738,3 +4842,15 @@ Object.defineProperty(exports, "weekdayFormatToken", {
|
|
|
4738
4842
|
return _super_calendar_core.weekdayFormatToken;
|
|
4739
4843
|
}
|
|
4740
4844
|
});
|
|
4845
|
+
Object.defineProperty(exports, "zonedDragBounds", {
|
|
4846
|
+
enumerable: true,
|
|
4847
|
+
get: function() {
|
|
4848
|
+
return _super_calendar_core.zonedDragBounds;
|
|
4849
|
+
}
|
|
4850
|
+
});
|
|
4851
|
+
Object.defineProperty(exports, "zonedEventSource", {
|
|
4852
|
+
enumerable: true,
|
|
4853
|
+
get: function() {
|
|
4854
|
+
return _super_calendar_core.zonedEventSource;
|
|
4855
|
+
}
|
|
4856
|
+
});
|