@super-calendar/native 2.17.0 → 2.19.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 +23 -1
- package/dist/{DefaultMonthEvent-C3C30hfV.d.mts → DefaultMonthEvent-DzgQFuVp.d.mts} +47 -10
- package/dist/{DefaultMonthEvent-Dx3lD7ig.d.ts → DefaultMonthEvent-joYl8Tu2.d.ts} +47 -10
- package/dist/{MonthList-N1GVDIE4.mjs → MonthList-BGl1gTDr.mjs} +603 -97
- package/dist/{MonthList-B2TSGYp7.js → MonthList-DeO-x5VW.js} +601 -95
- package/dist/index.d.mts +40 -15
- package/dist/index.d.ts +40 -15
- package/dist/index.js +189 -63
- package/dist/index.mjs +161 -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 -3
- package/src/components/AllDayLane.tsx +64 -37
- package/src/components/Calendar.tsx +104 -30
- package/src/components/MonthCellProbe.tsx +201 -0
- package/src/components/MonthList.tsx +4 -2
- package/src/components/MonthPager.tsx +41 -4
- package/src/components/MonthView.tsx +597 -118
- package/src/components/ResourceTimeline.tsx +11 -2
- package/src/components/TimeGrid.tsx +82 -24
- package/src/components/YearView.tsx +12 -3
- package/src/index.tsx +11 -2
- package/src/types.ts +20 -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-DeO-x5VW.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 resizeYielded = (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 = 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,
|
|
@@ -1292,11 +1323,17 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1292
1323
|
}, []);
|
|
1293
1324
|
const resizeGesture = (0, react.useMemo)(() => {
|
|
1294
1325
|
const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizable).onStart(() => {
|
|
1326
|
+
if (moving.value) {
|
|
1327
|
+
resizeYielded.value = 1;
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1295
1330
|
dragZ.value = DRAG_EVENT_Z;
|
|
1296
1331
|
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
1297
1332
|
}).onUpdate((event) => {
|
|
1333
|
+
if (resizeYielded.value) return;
|
|
1298
1334
|
resizeDelta.value = event.translationY;
|
|
1299
1335
|
}).onEnd((event) => {
|
|
1336
|
+
if (resizeYielded.value) return;
|
|
1300
1337
|
const delta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
|
|
1301
1338
|
if (delta === 0) {
|
|
1302
1339
|
resizeDelta.value = 0;
|
|
@@ -1305,7 +1342,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1305
1342
|
resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
1306
1343
|
(0, react_native_reanimated.runOnJS)(commitDrag)(0, delta);
|
|
1307
1344
|
}).onFinalize(() => {
|
|
1308
|
-
dragZ.value = 0;
|
|
1345
|
+
if (!resizeYielded.value) dragZ.value = 0;
|
|
1346
|
+
resizeYielded.value = 0;
|
|
1309
1347
|
});
|
|
1310
1348
|
const tap = react_native_gesture_handler.Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1311
1349
|
if (success) handlePress();
|
|
@@ -1318,6 +1356,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1318
1356
|
resizable,
|
|
1319
1357
|
snapMinutes,
|
|
1320
1358
|
cellHeight,
|
|
1359
|
+
moving,
|
|
1360
|
+
resizeYielded,
|
|
1321
1361
|
resizeDelta,
|
|
1322
1362
|
dragZ,
|
|
1323
1363
|
commitDrag,
|
|
@@ -1328,11 +1368,17 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1328
1368
|
]);
|
|
1329
1369
|
const resizeStartGesture = (0, react.useMemo)(() => {
|
|
1330
1370
|
const pan = react_native_gesture_handler.Gesture.Pan().enabled(resizableFromStart).onStart(() => {
|
|
1371
|
+
if (moving.value) {
|
|
1372
|
+
resizeYielded.value = 1;
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1331
1375
|
dragZ.value = DRAG_EVENT_Z;
|
|
1332
1376
|
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
1333
1377
|
}).onUpdate((event) => {
|
|
1378
|
+
if (resizeYielded.value) return;
|
|
1334
1379
|
resizeStartDelta.value = event.translationY;
|
|
1335
1380
|
}).onEnd((event) => {
|
|
1381
|
+
if (resizeYielded.value) return;
|
|
1336
1382
|
const delta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
|
|
1337
1383
|
if (delta === 0) {
|
|
1338
1384
|
resizeStartDelta.value = 0;
|
|
@@ -1341,7 +1387,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1341
1387
|
resizeStartDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
1342
1388
|
(0, react_native_reanimated.runOnJS)(commitDrag)(delta, 0);
|
|
1343
1389
|
}).onFinalize(() => {
|
|
1344
|
-
dragZ.value = 0;
|
|
1390
|
+
if (!resizeYielded.value) dragZ.value = 0;
|
|
1391
|
+
resizeYielded.value = 0;
|
|
1345
1392
|
});
|
|
1346
1393
|
const tap = react_native_gesture_handler.Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1347
1394
|
if (success) handlePress();
|
|
@@ -1354,6 +1401,8 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1354
1401
|
resizableFromStart,
|
|
1355
1402
|
snapMinutes,
|
|
1356
1403
|
cellHeight,
|
|
1404
|
+
moving,
|
|
1405
|
+
resizeYielded,
|
|
1357
1406
|
resizeStartDelta,
|
|
1358
1407
|
dragZ,
|
|
1359
1408
|
commitDrag,
|
|
@@ -1707,6 +1756,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1707
1756
|
now: nowProp,
|
|
1708
1757
|
timeZone: nowTimeZone
|
|
1709
1758
|
});
|
|
1759
|
+
const today = showNowIndicator && isActive ? now : (0, _super_calendar_core.nowInTimeZone)(nowProp, nowTimeZone);
|
|
1710
1760
|
const nowDayIndex = days.findIndex((day) => (0, _super_calendar_core.isSameCalendarDay)(day, now));
|
|
1711
1761
|
const nowHours = ((0, date_fns.getHours)(now) * MINUTES_PER_HOUR$1 + (0, date_fns.getMinutes)(now)) / MINUTES_PER_HOUR$1;
|
|
1712
1762
|
const nowInWindow = nowHours >= minHour && nowHours <= maxHour;
|
|
@@ -2033,6 +2083,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
2033
2083
|
dayWidth,
|
|
2034
2084
|
weekdayFormat,
|
|
2035
2085
|
todayLabel,
|
|
2086
|
+
today,
|
|
2036
2087
|
locale,
|
|
2037
2088
|
activeDate,
|
|
2038
2089
|
onPressDateHeader
|
|
@@ -2803,6 +2854,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2803
2854
|
now,
|
|
2804
2855
|
timeZone
|
|
2805
2856
|
]);
|
|
2857
|
+
const nowTime = now?.getTime();
|
|
2806
2858
|
const listExtraData = (0, react.useMemo)(() => ({
|
|
2807
2859
|
events,
|
|
2808
2860
|
activeIndex,
|
|
@@ -2812,7 +2864,9 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2812
2864
|
onCreateEvent,
|
|
2813
2865
|
dragStepMinutes,
|
|
2814
2866
|
minHour,
|
|
2815
|
-
maxHour
|
|
2867
|
+
maxHour,
|
|
2868
|
+
nowTime,
|
|
2869
|
+
timeZone
|
|
2816
2870
|
}), [
|
|
2817
2871
|
events,
|
|
2818
2872
|
activeIndex,
|
|
@@ -2822,7 +2876,9 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2822
2876
|
onCreateEvent,
|
|
2823
2877
|
dragStepMinutes,
|
|
2824
2878
|
minHour,
|
|
2825
|
-
maxHour
|
|
2879
|
+
maxHour,
|
|
2880
|
+
nowTime,
|
|
2881
|
+
timeZone
|
|
2826
2882
|
]);
|
|
2827
2883
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.SlotStylesProvider, {
|
|
2828
2884
|
classNames,
|
|
@@ -2966,7 +3022,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2966
3022
|
* ```
|
|
2967
3023
|
*/
|
|
2968
3024
|
const TimeGrid = (0, react.memo)((0, react.forwardRef)(TimeGridInner));
|
|
2969
|
-
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
3025
|
+
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, today, locale, activeDate, onPressDateHeader }) => {
|
|
2970
3026
|
const slot = require_MonthList.useSlots();
|
|
2971
3027
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2972
3028
|
...slot("header", { base: styles$1.headerRow }),
|
|
@@ -2976,16 +3032,17 @@ const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale,
|
|
|
2976
3032
|
width: dayWidth,
|
|
2977
3033
|
weekdayFormat,
|
|
2978
3034
|
todayLabel,
|
|
3035
|
+
today,
|
|
2979
3036
|
locale,
|
|
2980
3037
|
activeDate,
|
|
2981
3038
|
onPressDateHeader
|
|
2982
3039
|
}, day.toISOString()))
|
|
2983
3040
|
});
|
|
2984
3041
|
};
|
|
2985
|
-
const DayHeader = ({ day, width, weekdayFormat = "short", todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
3042
|
+
const DayHeader = ({ day, width, weekdayFormat = "short", todayLabel, today, locale, activeDate, onPressDateHeader }) => {
|
|
2986
3043
|
const theme = require_MonthList.useCalendarTheme();
|
|
2987
3044
|
const slot = require_MonthList.useSlots();
|
|
2988
|
-
const isToday = (0, _super_calendar_core.getIsToday)(day);
|
|
3045
|
+
const isToday = (0, _super_calendar_core.getIsToday)(day, today);
|
|
2989
3046
|
const isHighlighted = activeDate ? (0, _super_calendar_core.isSameCalendarDay)(day, activeDate) : isToday;
|
|
2990
3047
|
const accessibilityLabel = `${(0, date_fns.format)(day, "EEEE d MMMM", { locale })}${isToday ? `, ${todayLabel}` : ""}`;
|
|
2991
3048
|
const headerSlot = slot("columnHeader", {
|
|
@@ -3286,12 +3343,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3286
3343
|
const displayEvents = (0, react.useMemo)(() => {
|
|
3287
3344
|
let out = events;
|
|
3288
3345
|
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);
|
|
3346
|
+
const [start, end] = expansionRange(mode, date, weekStartsOn, numberOfDays ?? 1, weekEndsOn, numberOfWeeks);
|
|
3347
|
+
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
3348
|
}
|
|
3296
3349
|
if (timeZone) out = (0, _super_calendar_core.eventsInTimeZone)(out, timeZone);
|
|
3297
3350
|
return out;
|
|
@@ -3306,11 +3359,47 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3306
3359
|
numberOfWeeks
|
|
3307
3360
|
]);
|
|
3308
3361
|
const handlePressEvent = (0, react.useCallback)((event) => {
|
|
3309
|
-
if (!event.disabled) onPressEvent(event);
|
|
3310
|
-
}, [onPressEvent]);
|
|
3362
|
+
if (!event.disabled) onPressEvent(timeZone ? (0, _super_calendar_core.zonedEventSource)(event) : event);
|
|
3363
|
+
}, [onPressEvent, timeZone]);
|
|
3311
3364
|
const handleLongPressEvent = (0, react.useMemo)(() => onLongPressEvent ? (event) => {
|
|
3312
|
-
if (!event.disabled) onLongPressEvent(event);
|
|
3313
|
-
} : void 0, [onLongPressEvent]);
|
|
3365
|
+
if (!event.disabled) onLongPressEvent(timeZone ? (0, _super_calendar_core.zonedEventSource)(event) : event);
|
|
3366
|
+
} : void 0, [onLongPressEvent, timeZone]);
|
|
3367
|
+
const timeGridMode = mode !== "month" && mode !== "multiweek";
|
|
3368
|
+
const zoned = (0, react.useMemo)(() => {
|
|
3369
|
+
if (!timeZone) return {
|
|
3370
|
+
onDragStart,
|
|
3371
|
+
onDragEvent,
|
|
3372
|
+
onPressMore,
|
|
3373
|
+
onPressTime: onPressCell,
|
|
3374
|
+
onLongPressTime: onLongPressCell,
|
|
3375
|
+
onCreateTimed: onCreateEvent
|
|
3376
|
+
};
|
|
3377
|
+
const instant = (wallClock) => (0, _super_calendar_core.fromZonedTime)(wallClock, timeZone);
|
|
3378
|
+
return {
|
|
3379
|
+
onDragStart: onDragStart && ((event) => onDragStart((0, _super_calendar_core.zonedEventSource)(event))),
|
|
3380
|
+
onDragEvent: onDragEvent && ((event, start, end) => {
|
|
3381
|
+
const bounds = (0, _super_calendar_core.zonedDragBounds)(event, start, end, { keepDuration: timeGridMode });
|
|
3382
|
+
if (!bounds) return false;
|
|
3383
|
+
return onDragEvent((0, _super_calendar_core.zonedEventSource)(event), bounds.start, bounds.end);
|
|
3384
|
+
}),
|
|
3385
|
+
onPressMore: onPressMore && ((dayEvents, day) => onPressMore(dayEvents.map(_super_calendar_core.zonedEventSource), day)),
|
|
3386
|
+
onPressTime: onPressCell && ((time) => onPressCell(instant(time))),
|
|
3387
|
+
onLongPressTime: onLongPressCell && ((time) => onLongPressCell(instant(time))),
|
|
3388
|
+
onCreateTimed: onCreateEvent && ((start, end) => {
|
|
3389
|
+
const range = (0, _super_calendar_core.fromZonedRange)(start, end, timeZone);
|
|
3390
|
+
if (range) onCreateEvent(range.start, range.end);
|
|
3391
|
+
})
|
|
3392
|
+
};
|
|
3393
|
+
}, [
|
|
3394
|
+
timeZone,
|
|
3395
|
+
timeGridMode,
|
|
3396
|
+
onDragStart,
|
|
3397
|
+
onDragEvent,
|
|
3398
|
+
onPressMore,
|
|
3399
|
+
onPressCell,
|
|
3400
|
+
onLongPressCell,
|
|
3401
|
+
onCreateEvent
|
|
3402
|
+
]);
|
|
3314
3403
|
const handleChangeDate = (0, react.useCallback)((next) => {
|
|
3315
3404
|
onChangeDate(next);
|
|
3316
3405
|
onChangeDateRange?.(visibleRange(mode, next, weekStartsOn, numberOfDays ?? 1, weekEndsOn, numberOfWeeks, hiddenDays));
|
|
@@ -3381,6 +3470,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3381
3470
|
hiddenDays,
|
|
3382
3471
|
weekdayFormat,
|
|
3383
3472
|
locale,
|
|
3473
|
+
now,
|
|
3474
|
+
timeZone,
|
|
3384
3475
|
labels,
|
|
3385
3476
|
sortedMonthView,
|
|
3386
3477
|
moreLabel,
|
|
@@ -3399,11 +3490,12 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3399
3490
|
onPressCell,
|
|
3400
3491
|
onPressEvent: handlePressEvent,
|
|
3401
3492
|
onLongPressEvent: handleLongPressEvent,
|
|
3402
|
-
onPressMore,
|
|
3493
|
+
onPressMore: zoned.onPressMore,
|
|
3403
3494
|
onCreateEvent,
|
|
3495
|
+
renderCreateGhost,
|
|
3404
3496
|
onSelectDrag,
|
|
3405
|
-
onDragEvent,
|
|
3406
|
-
onDragStart,
|
|
3497
|
+
onDragEvent: zoned.onDragEvent,
|
|
3498
|
+
onDragStart: zoned.onDragStart,
|
|
3407
3499
|
eventStartEditable,
|
|
3408
3500
|
eventOverlap,
|
|
3409
3501
|
selectedDates,
|
|
@@ -3424,6 +3516,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3424
3516
|
weekStartsOn,
|
|
3425
3517
|
hiddenDays,
|
|
3426
3518
|
locale,
|
|
3519
|
+
now,
|
|
3520
|
+
timeZone,
|
|
3427
3521
|
labels,
|
|
3428
3522
|
activeDate,
|
|
3429
3523
|
selectedDates,
|
|
@@ -3440,6 +3534,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3440
3534
|
}) : mode === "schedule" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Agenda, {
|
|
3441
3535
|
events: displayEvents,
|
|
3442
3536
|
locale,
|
|
3537
|
+
now,
|
|
3538
|
+
timeZone,
|
|
3443
3539
|
renderEvent: resolvedRenderEvent,
|
|
3444
3540
|
keyExtractor,
|
|
3445
3541
|
onPressEvent: handlePressEvent,
|
|
@@ -3503,14 +3599,14 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3503
3599
|
swipeEnabled,
|
|
3504
3600
|
onPressEvent: handlePressEvent,
|
|
3505
3601
|
onLongPressEvent: handleLongPressEvent,
|
|
3506
|
-
onDragEvent,
|
|
3602
|
+
onDragEvent: zoned.onDragEvent,
|
|
3507
3603
|
showDragHandle,
|
|
3508
|
-
onDragStart,
|
|
3604
|
+
onDragStart: zoned.onDragStart,
|
|
3509
3605
|
dragStepMinutes,
|
|
3510
|
-
onPressCell,
|
|
3606
|
+
onPressCell: zoned.onPressTime,
|
|
3511
3607
|
resetPageOnPressCell,
|
|
3512
|
-
onLongPressCell,
|
|
3513
|
-
onCreateEvent,
|
|
3608
|
+
onLongPressCell: zoned.onLongPressTime,
|
|
3609
|
+
onCreateEvent: zoned.onCreateTimed,
|
|
3514
3610
|
renderCreateGhost,
|
|
3515
3611
|
onPressDateHeader,
|
|
3516
3612
|
onChangeDate: handleChangeDate,
|
|
@@ -4604,6 +4700,18 @@ Object.defineProperty(exports, "expandRecurringEvents", {
|
|
|
4604
4700
|
return _super_calendar_core.expandRecurringEvents;
|
|
4605
4701
|
}
|
|
4606
4702
|
});
|
|
4703
|
+
Object.defineProperty(exports, "fromZonedRange", {
|
|
4704
|
+
enumerable: true,
|
|
4705
|
+
get: function() {
|
|
4706
|
+
return _super_calendar_core.fromZonedRange;
|
|
4707
|
+
}
|
|
4708
|
+
});
|
|
4709
|
+
Object.defineProperty(exports, "fromZonedTime", {
|
|
4710
|
+
enumerable: true,
|
|
4711
|
+
get: function() {
|
|
4712
|
+
return _super_calendar_core.fromZonedTime;
|
|
4713
|
+
}
|
|
4714
|
+
});
|
|
4607
4715
|
Object.defineProperty(exports, "getIsToday", {
|
|
4608
4716
|
enumerable: true,
|
|
4609
4717
|
get: function() {
|
|
@@ -4689,6 +4797,12 @@ Object.defineProperty(exports, "nextDateRange", {
|
|
|
4689
4797
|
return _super_calendar_core.nextDateRange;
|
|
4690
4798
|
}
|
|
4691
4799
|
});
|
|
4800
|
+
Object.defineProperty(exports, "nowInTimeZone", {
|
|
4801
|
+
enumerable: true,
|
|
4802
|
+
get: function() {
|
|
4803
|
+
return _super_calendar_core.nowInTimeZone;
|
|
4804
|
+
}
|
|
4805
|
+
});
|
|
4692
4806
|
Object.defineProperty(exports, "parseICalendar", {
|
|
4693
4807
|
enumerable: true,
|
|
4694
4808
|
get: function() {
|
|
@@ -4738,3 +4852,15 @@ Object.defineProperty(exports, "weekdayFormatToken", {
|
|
|
4738
4852
|
return _super_calendar_core.weekdayFormatToken;
|
|
4739
4853
|
}
|
|
4740
4854
|
});
|
|
4855
|
+
Object.defineProperty(exports, "zonedDragBounds", {
|
|
4856
|
+
enumerable: true,
|
|
4857
|
+
get: function() {
|
|
4858
|
+
return _super_calendar_core.zonedDragBounds;
|
|
4859
|
+
}
|
|
4860
|
+
});
|
|
4861
|
+
Object.defineProperty(exports, "zonedEventSource", {
|
|
4862
|
+
enumerable: true,
|
|
4863
|
+
get: function() {
|
|
4864
|
+
return _super_calendar_core.zonedEventSource;
|
|
4865
|
+
}
|
|
4866
|
+
});
|