@super-calendar/native 2.16.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 +59 -0
- package/dist/{DefaultMonthEvent-ClIxUp__.d.ts → DefaultMonthEvent-B7xVeY7Q.d.ts} +29 -10
- package/dist/{DefaultMonthEvent-No5YhOcV.d.mts → DefaultMonthEvent-hGk7wSrr.d.mts} +29 -10
- package/dist/{MonthList-Dmp8JXvj.js → MonthList-C_NTufaK.js} +462 -92
- package/dist/{MonthList-D97JhM4F.mjs → MonthList-DdQxRhUy.mjs} +453 -95
- package/dist/index.d.mts +54 -13
- package/dist/index.d.ts +54 -13
- package/dist/index.js +245 -72
- package/dist/index.mjs +210 -74
- 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 +173 -34
- package/src/components/MonthPager.tsx +212 -21
- package/src/components/MonthView.tsx +419 -118
- package/src/components/MultiWeekView.tsx +34 -0
- package/src/components/TimeGrid.tsx +60 -11
- package/src/components/YearView.tsx +12 -1
- package/src/index.tsx +17 -2
- package/src/types.ts +2 -2
- package/src/utils/holdWebDateDrag.ts +63 -0
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { _ as mergeTheme, a as DateRows, c as useWebPagerKeys, d as useSlots, f as CalendarLabelsContext, g as defaultTheme, h as darkTheme, i as MonthPager, l as SlotStylesProvider, m as CalendarThemeProvider, n as DefaultMonthEvent, o as MonthView, p as useCalendarLabels, r as DateRowsPager, s as withEventAccessibilityLabel, t as MonthList, u as createSlots, v as useCalendarTheme } from "./MonthList-DdQxRhUy.mjs";
|
|
2
2
|
import { addDays, addMonths, addWeeks, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getHours, getISOWeek, getMinutes, isSameDay, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
3
3
|
import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import Animated, { runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
|
|
5
|
-
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, eventsInTimeZone as eventsInTimeZone$1, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, getWeekDays as getWeekDays$1, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, minutesIntoDay, monthCreateRange, movedClockSpan, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, useNow as useNow$1, viewDayCount, wallClockHours, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core";
|
|
5
|
+
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, buildMultiWeekGrid, buildMultiWeekGrid as buildMultiWeekGrid$1, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, eventsInTimeZone as eventsInTimeZone$1, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, fromZonedRange, fromZonedRange as fromZonedRange$1, fromZonedTime, fromZonedTime as fromZonedTime$1, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, getWeekDays as getWeekDays$1, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, layoutMonthWeek as layoutMonthWeek$1, minutesIntoDay, monthCreateRange, movedClockSpan, nextDateRange, nowInTimeZone, nowInTimeZone as nowInTimeZone$1, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, useNow as useNow$1, viewDayCount, wallClockHours, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1, zonedDragBounds, zonedDragBounds as zonedDragBounds$1, zonedEventSource, zonedEventSource as zonedEventSource$1 } from "@super-calendar/core";
|
|
6
6
|
import { PixelRatio, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
7
7
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -12,7 +12,7 @@ import { AnimatedLegendList } from "@legendapp/list/reanimated";
|
|
|
12
12
|
const isWeb$2 = Platform.OS === "web";
|
|
13
13
|
const DRAG_HOLD_MS = 400;
|
|
14
14
|
const FALLBACK_COLUMNS = 3;
|
|
15
|
-
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 }) {
|
|
15
|
+
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 }) {
|
|
16
16
|
const theme = useCalendarTheme();
|
|
17
17
|
const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
|
|
18
18
|
const slot = createSlots({
|
|
@@ -25,6 +25,7 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, labels:
|
|
|
25
25
|
if (width <= 0) return;
|
|
26
26
|
setColumns(Math.max(2, Math.min(4, Math.floor(width / minMonthWidth))));
|
|
27
27
|
};
|
|
28
|
+
const today = nowInTimeZone$1(now, timeZone);
|
|
28
29
|
const months = useMemo(() => getYearMonths(date), [date]);
|
|
29
30
|
const monthWeeks = useMemo(() => months.map((month) => buildMonthWeeks$1(month, weekStartsOn, { hiddenDays })), [
|
|
30
31
|
months,
|
|
@@ -155,7 +156,7 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, labels:
|
|
|
155
156
|
...slot("week", { base: styles$5.week }),
|
|
156
157
|
children: week.map((day) => {
|
|
157
158
|
if (day.getMonth() !== month.getMonth()) return /* @__PURE__ */ jsx(View, { style: styles$5.day }, day.toISOString());
|
|
158
|
-
const isToday = getIsToday$1(day);
|
|
159
|
+
const isToday = getIsToday$1(day, today);
|
|
159
160
|
const isHighlighted = activeDate ? isSameCalendarDay$1(day, activeDate) : isToday;
|
|
160
161
|
const hasEvents = eventDays.has(startOfDay(day).toISOString());
|
|
161
162
|
const state = daySelectionState$1(day, {
|
|
@@ -378,7 +379,7 @@ const styles$5 = StyleSheet.create({
|
|
|
378
379
|
* start, grouped under a date header per day. The consumer controls which
|
|
379
380
|
* events (and therefore which date range) are shown.
|
|
380
381
|
*/
|
|
381
|
-
function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, refreshControl, classNames, styles: styleOverrides }) {
|
|
382
|
+
function Agenda({ events, locale, now, timeZone, renderEvent, keyExtractor, onPressEvent, onLongPressEvent, onPressDay, activeDate, itemSeparatorComponent, refreshControl, classNames, styles: styleOverrides }) {
|
|
382
383
|
const theme = useCalendarTheme();
|
|
383
384
|
const slot = useMemo(() => createSlots({
|
|
384
385
|
classNames,
|
|
@@ -408,9 +409,10 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
408
409
|
return out;
|
|
409
410
|
}, [events, keyExtractor]);
|
|
410
411
|
const keyExtractorRow = useCallback((row) => row.key, []);
|
|
412
|
+
const todayKey = startOfDay(nowInTimeZone$1(now, timeZone)).getTime();
|
|
411
413
|
const renderItem = useCallback(({ item }) => {
|
|
412
414
|
if (item.kind === "header") {
|
|
413
|
-
const isHighlighted = activeDate ? isSameDay(item.date, activeDate) : getIsToday$1(item.date);
|
|
415
|
+
const isHighlighted = activeDate ? isSameDay(item.date, activeDate) : getIsToday$1(item.date, new Date(todayKey));
|
|
414
416
|
return /* @__PURE__ */ jsx(Text, {
|
|
415
417
|
...slot("dayHeader", {
|
|
416
418
|
base: styles$4.header,
|
|
@@ -438,6 +440,7 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
438
440
|
theme,
|
|
439
441
|
locale,
|
|
440
442
|
activeDate,
|
|
443
|
+
todayKey,
|
|
441
444
|
onPressDay,
|
|
442
445
|
onPressEvent,
|
|
443
446
|
onLongPressEvent,
|
|
@@ -456,6 +459,7 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
456
459
|
data: rows,
|
|
457
460
|
keyExtractor: keyExtractorRow,
|
|
458
461
|
renderItem,
|
|
462
|
+
extraData: todayKey,
|
|
459
463
|
ItemSeparatorComponent: itemSeparatorComponent ?? void 0,
|
|
460
464
|
recycleItems: false,
|
|
461
465
|
refreshControl
|
|
@@ -676,7 +680,7 @@ function useWebGridZoom(enabled, target, cellHeight, committedCellHeight, minHei
|
|
|
676
680
|
/**
|
|
677
681
|
* The all-day lane of one page, pinned above the scrolling hours. All-day
|
|
678
682
|
* events are excluded from the timed columns (see `layoutDayEvents`) and shown
|
|
679
|
-
* here, stacked
|
|
683
|
+
* here as continuous spans, stacked only when their dates overlap. Always rendered so every page reports a
|
|
680
684
|
* height, zero when the week has none, which the band above the grid follows
|
|
681
685
|
* live as you swipe; the "all-day" label lives in the hour column.
|
|
682
686
|
*/
|
|
@@ -684,43 +688,59 @@ function AllDayLane({ days, events, mode, dayWidth, renderEvent, keyExtractor, o
|
|
|
684
688
|
const theme = useCalendarTheme();
|
|
685
689
|
const slot = useSlots();
|
|
686
690
|
const RenderEventComponent = renderEvent;
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
const
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
|
|
691
|
+
const spans = useMemo(() => {
|
|
692
|
+
const allDay = events.filter((event) => isAllDayEvent$1(event) && !isBackgroundEvent$1(event) && days.some((day) => event.start < addDays(startOfDay(day), 1) && event.end > startOfDay(day)));
|
|
693
|
+
const { segments, laneCount } = layoutMonthWeek$1(days, allDay);
|
|
694
|
+
const lanes = Array.from({ length: laneCount }, () => []);
|
|
695
|
+
for (const segment of segments) lanes[segment.lane].push(segment);
|
|
696
|
+
return lanes.flat();
|
|
697
|
+
}, [days, events]);
|
|
693
698
|
return /* @__PURE__ */ jsx(View, {
|
|
694
699
|
...slot("allDayLane", {
|
|
695
|
-
base: styles$2.lane,
|
|
700
|
+
base: [styles$2.lane, spans.length > 0 && { paddingVertical: 2 }],
|
|
696
701
|
themed: theme.containers.allDayLane
|
|
697
702
|
}),
|
|
698
703
|
onLayout,
|
|
699
|
-
children:
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
704
|
+
children: spans.map((segment, index) => {
|
|
705
|
+
const { event, startCol, endCol, lane, continuesBefore, continuesAfter } = segment;
|
|
706
|
+
const previous = spans[index - 1];
|
|
707
|
+
const previousEnd = previous?.lane === lane ? previous.endCol : -1;
|
|
708
|
+
const lastInLane = spans[index + 1]?.lane !== lane;
|
|
709
|
+
const remaining = lastInLane ? days.length - endCol - 1 : 0;
|
|
710
|
+
const wrapSlack = lastInLane ? Math.min(.5, dayWidth / 4) : 0;
|
|
711
|
+
return /* @__PURE__ */ jsx(View, {
|
|
712
|
+
...slot("allDayColumn", {
|
|
713
|
+
base: [styles$2.column, {
|
|
714
|
+
width: dayWidth * (endCol - startCol + 1),
|
|
715
|
+
marginLeft: dayWidth * (startCol - previousEnd - 1),
|
|
716
|
+
marginRight: dayWidth * remaining - wrapSlack
|
|
717
|
+
}],
|
|
718
|
+
themed: theme.containers.allDayColumn
|
|
719
|
+
}),
|
|
720
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
721
|
+
...slot("allDayEvent", { base: styles$2.chip }),
|
|
722
|
+
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
723
|
+
event,
|
|
724
|
+
mode,
|
|
725
|
+
isAllDay: true,
|
|
726
|
+
continuesBefore,
|
|
727
|
+
continuesAfter,
|
|
728
|
+
onPress: () => onPressEvent(event),
|
|
729
|
+
onLongPress: onLongPressEvent ? () => onLongPressEvent(event) : void 0
|
|
730
|
+
})
|
|
712
731
|
})
|
|
713
|
-
}, keyExtractor(event, index))
|
|
714
|
-
}
|
|
732
|
+
}, keyExtractor(event, index));
|
|
733
|
+
})
|
|
715
734
|
});
|
|
716
735
|
}
|
|
717
736
|
const styles$2 = StyleSheet.create({
|
|
718
|
-
lane: {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
737
|
+
lane: {
|
|
738
|
+
flexDirection: "row",
|
|
739
|
+
flexWrap: "wrap",
|
|
740
|
+
alignItems: "flex-start",
|
|
741
|
+
rowGap: 2
|
|
723
742
|
},
|
|
743
|
+
column: { paddingHorizontal: 1 },
|
|
724
744
|
chip: { minHeight: 18 }
|
|
725
745
|
});
|
|
726
746
|
// src/components/MultiDayMovePreview.tsx
|
|
@@ -941,6 +961,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
941
961
|
const resizeStartDelta = useSharedValue(0);
|
|
942
962
|
const dragZ = useSharedValue(0);
|
|
943
963
|
const moving = useSharedValue(0);
|
|
964
|
+
const onHandle = useSharedValue(0);
|
|
944
965
|
const edgeDir = useSharedValue(0);
|
|
945
966
|
const lifted = useSharedValue(0);
|
|
946
967
|
const grabX = useSharedValue(0);
|
|
@@ -956,6 +977,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
956
977
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
957
978
|
ownsStart
|
|
958
979
|
}), [startHours, ownsStart]);
|
|
980
|
+
const columnInsetSV = useDerivedValue(() => left - dayLeftPx, [left, dayLeftPx]);
|
|
959
981
|
const eventStartMs = positioned.event.start.getTime();
|
|
960
982
|
const eventEndMs = positioned.event.end.getTime();
|
|
961
983
|
const moveExtra = useDerivedValue(() => {
|
|
@@ -992,8 +1014,12 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
992
1014
|
minEventHeight
|
|
993
1015
|
]);
|
|
994
1016
|
const boxStyle = useAnimatedStyle(() => {
|
|
1017
|
+
const top = (startHours + moveExtra.value.top - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
1018
|
+
const floating = !onHandle.value && (moving.value || moveOffset.value !== 0 || moveOffsetX.value !== 0);
|
|
995
1019
|
return {
|
|
996
|
-
|
|
1020
|
+
left: floating ? dayLeftPx : left,
|
|
1021
|
+
width: floating ? dayWidth : width,
|
|
1022
|
+
top,
|
|
997
1023
|
height: visibleBoxHeight.value,
|
|
998
1024
|
transform: [{ translateX: moveOffsetX.value }],
|
|
999
1025
|
zIndex: dragZ.value,
|
|
@@ -1002,7 +1028,11 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1002
1028
|
}, [
|
|
1003
1029
|
startHours,
|
|
1004
1030
|
minHour,
|
|
1005
|
-
hiddenForMove
|
|
1031
|
+
hiddenForMove,
|
|
1032
|
+
left,
|
|
1033
|
+
width,
|
|
1034
|
+
dayLeftPx,
|
|
1035
|
+
dayWidth
|
|
1006
1036
|
]);
|
|
1007
1037
|
const spillHeight = useDerivedValue(() => {
|
|
1008
1038
|
if (multiDay || !moving.value || lifted.value || cellHeight.value <= 0) return 0;
|
|
@@ -1128,7 +1158,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1128
1158
|
if (!edgePaging) return;
|
|
1129
1159
|
if (!lifted.value) {
|
|
1130
1160
|
lifted.value = 1;
|
|
1131
|
-
edgePaging.ghostW.value =
|
|
1161
|
+
edgePaging.ghostW.value = dayWidth;
|
|
1132
1162
|
edgePaging.ghostH.value = boxHeight.value;
|
|
1133
1163
|
edgePaging.ghostX.value = liveAbsX.value - grabX.value - edgePaging.pagerLeft.value;
|
|
1134
1164
|
edgePaging.ghostY.value = liveAbsY.value - grabY.value - edgePaging.pagerTop.value;
|
|
@@ -1143,7 +1173,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1143
1173
|
disarmEdge,
|
|
1144
1174
|
edgePaging,
|
|
1145
1175
|
lifted,
|
|
1146
|
-
|
|
1176
|
+
dayWidth,
|
|
1147
1177
|
boxHeight,
|
|
1148
1178
|
liveAbsX,
|
|
1149
1179
|
liveAbsY,
|
|
@@ -1157,7 +1187,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1157
1187
|
moving.value = 1;
|
|
1158
1188
|
edgeDir.value = 0;
|
|
1159
1189
|
lifted.value = 0;
|
|
1160
|
-
grabX.value = event.x;
|
|
1190
|
+
grabX.value = event.x + columnInsetSV.value;
|
|
1161
1191
|
grabY.value = event.y;
|
|
1162
1192
|
liveAbsX.value = event.absoluteX;
|
|
1163
1193
|
liveAbsY.value = event.absoluteY;
|
|
@@ -1224,6 +1254,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1224
1254
|
}, [
|
|
1225
1255
|
canMove,
|
|
1226
1256
|
snapMinutes,
|
|
1257
|
+
columnInsetSV,
|
|
1227
1258
|
cellHeight,
|
|
1228
1259
|
moveOffset,
|
|
1229
1260
|
moveOffsetX,
|
|
@@ -1268,7 +1299,9 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1268
1299
|
press?.(event);
|
|
1269
1300
|
}, []);
|
|
1270
1301
|
const resizeGesture = useMemo(() => {
|
|
1271
|
-
const pan = Gesture.Pan().enabled(resizable).
|
|
1302
|
+
const pan = Gesture.Pan().enabled(resizable).onBegin(() => {
|
|
1303
|
+
onHandle.value = 1;
|
|
1304
|
+
}).onStart(() => {
|
|
1272
1305
|
dragZ.value = DRAG_EVENT_Z;
|
|
1273
1306
|
runOnJS(notifyDragStart)();
|
|
1274
1307
|
}).onUpdate((event) => {
|
|
@@ -1283,6 +1316,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1283
1316
|
runOnJS(commitDrag)(0, delta);
|
|
1284
1317
|
}).onFinalize(() => {
|
|
1285
1318
|
dragZ.value = 0;
|
|
1319
|
+
onHandle.value = 0;
|
|
1286
1320
|
});
|
|
1287
1321
|
const tap = Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1288
1322
|
if (success) handlePress();
|
|
@@ -1295,6 +1329,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1295
1329
|
resizable,
|
|
1296
1330
|
snapMinutes,
|
|
1297
1331
|
cellHeight,
|
|
1332
|
+
onHandle,
|
|
1298
1333
|
resizeDelta,
|
|
1299
1334
|
dragZ,
|
|
1300
1335
|
commitDrag,
|
|
@@ -1304,7 +1339,9 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1304
1339
|
handleLongPressFromHandle
|
|
1305
1340
|
]);
|
|
1306
1341
|
const resizeStartGesture = useMemo(() => {
|
|
1307
|
-
const pan = Gesture.Pan().enabled(resizableFromStart).
|
|
1342
|
+
const pan = Gesture.Pan().enabled(resizableFromStart).onBegin(() => {
|
|
1343
|
+
onHandle.value = 1;
|
|
1344
|
+
}).onStart(() => {
|
|
1308
1345
|
dragZ.value = DRAG_EVENT_Z;
|
|
1309
1346
|
runOnJS(notifyDragStart)();
|
|
1310
1347
|
}).onUpdate((event) => {
|
|
@@ -1319,6 +1356,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1319
1356
|
runOnJS(commitDrag)(delta, 0);
|
|
1320
1357
|
}).onFinalize(() => {
|
|
1321
1358
|
dragZ.value = 0;
|
|
1359
|
+
onHandle.value = 0;
|
|
1322
1360
|
});
|
|
1323
1361
|
const tap = Gesture.Tap().runOnJS(true).onEnd((_event, success) => {
|
|
1324
1362
|
if (success) handlePress();
|
|
@@ -1331,6 +1369,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1331
1369
|
resizableFromStart,
|
|
1332
1370
|
snapMinutes,
|
|
1333
1371
|
cellHeight,
|
|
1372
|
+
onHandle,
|
|
1334
1373
|
resizeStartDelta,
|
|
1335
1374
|
dragZ,
|
|
1336
1375
|
commitDrag,
|
|
@@ -1684,6 +1723,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1684
1723
|
now: nowProp,
|
|
1685
1724
|
timeZone: nowTimeZone
|
|
1686
1725
|
});
|
|
1726
|
+
const today = showNowIndicator && isActive ? now : nowInTimeZone$1(nowProp, nowTimeZone);
|
|
1687
1727
|
const nowDayIndex = days.findIndex((day) => isSameCalendarDay$1(day, now));
|
|
1688
1728
|
const nowHours = (getHours(now) * MINUTES_PER_HOUR$1 + getMinutes(now)) / MINUTES_PER_HOUR$1;
|
|
1689
1729
|
const nowInWindow = nowHours >= minHour && nowHours <= maxHour;
|
|
@@ -2010,6 +2050,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
2010
2050
|
dayWidth,
|
|
2011
2051
|
weekdayFormat,
|
|
2012
2052
|
todayLabel,
|
|
2053
|
+
today,
|
|
2013
2054
|
locale,
|
|
2014
2055
|
activeDate,
|
|
2015
2056
|
onPressDateHeader
|
|
@@ -2780,6 +2821,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2780
2821
|
now,
|
|
2781
2822
|
timeZone
|
|
2782
2823
|
]);
|
|
2824
|
+
const nowTime = now?.getTime();
|
|
2783
2825
|
const listExtraData = useMemo(() => ({
|
|
2784
2826
|
events,
|
|
2785
2827
|
activeIndex,
|
|
@@ -2789,7 +2831,9 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2789
2831
|
onCreateEvent,
|
|
2790
2832
|
dragStepMinutes,
|
|
2791
2833
|
minHour,
|
|
2792
|
-
maxHour
|
|
2834
|
+
maxHour,
|
|
2835
|
+
nowTime,
|
|
2836
|
+
timeZone
|
|
2793
2837
|
}), [
|
|
2794
2838
|
events,
|
|
2795
2839
|
activeIndex,
|
|
@@ -2799,7 +2843,9 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2799
2843
|
onCreateEvent,
|
|
2800
2844
|
dragStepMinutes,
|
|
2801
2845
|
minHour,
|
|
2802
|
-
maxHour
|
|
2846
|
+
maxHour,
|
|
2847
|
+
nowTime,
|
|
2848
|
+
timeZone
|
|
2803
2849
|
]);
|
|
2804
2850
|
return /* @__PURE__ */ jsx(SlotStylesProvider, {
|
|
2805
2851
|
classNames,
|
|
@@ -2943,7 +2989,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2943
2989
|
* ```
|
|
2944
2990
|
*/
|
|
2945
2991
|
const TimeGrid = memo(forwardRef(TimeGridInner));
|
|
2946
|
-
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
2992
|
+
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, today, locale, activeDate, onPressDateHeader }) => {
|
|
2947
2993
|
const slot = useSlots();
|
|
2948
2994
|
return /* @__PURE__ */ jsx(View, {
|
|
2949
2995
|
...slot("header", { base: styles$1.headerRow }),
|
|
@@ -2953,16 +2999,17 @@ const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale,
|
|
|
2953
2999
|
width: dayWidth,
|
|
2954
3000
|
weekdayFormat,
|
|
2955
3001
|
todayLabel,
|
|
3002
|
+
today,
|
|
2956
3003
|
locale,
|
|
2957
3004
|
activeDate,
|
|
2958
3005
|
onPressDateHeader
|
|
2959
3006
|
}, day.toISOString()))
|
|
2960
3007
|
});
|
|
2961
3008
|
};
|
|
2962
|
-
const DayHeader = ({ day, width, weekdayFormat = "short", todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
3009
|
+
const DayHeader = ({ day, width, weekdayFormat = "short", todayLabel, today, locale, activeDate, onPressDateHeader }) => {
|
|
2963
3010
|
const theme = useCalendarTheme();
|
|
2964
3011
|
const slot = useSlots();
|
|
2965
|
-
const isToday = getIsToday$1(day);
|
|
3012
|
+
const isToday = getIsToday$1(day, today);
|
|
2966
3013
|
const isHighlighted = activeDate ? isSameCalendarDay$1(day, activeDate) : isToday;
|
|
2967
3014
|
const accessibilityLabel = `${format(day, "EEEE d MMMM", { locale })}${isToday ? `, ${todayLabel}` : ""}`;
|
|
2968
3015
|
const headerSlot = slot("columnHeader", {
|
|
@@ -3196,13 +3243,30 @@ const styles$1 = StyleSheet.create({
|
|
|
3196
3243
|
});
|
|
3197
3244
|
// src/components/Calendar.tsx
|
|
3198
3245
|
const defaultKeyExtractor = (event) => `${event.start.toISOString()}|${event.end.toISOString()}|${event.title ?? ""}`;
|
|
3199
|
-
function visibleRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
3246
|
+
function visibleRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn, numberOfWeeks = 2, hiddenDays) {
|
|
3247
|
+
if (mode === "multiweek") {
|
|
3248
|
+
const { visibleRange } = buildMultiWeekGrid$1(date, {
|
|
3249
|
+
numberOfWeeks,
|
|
3250
|
+
weekStartsOn,
|
|
3251
|
+
hiddenDays
|
|
3252
|
+
});
|
|
3253
|
+
return [visibleRange.start, endOfDay(addDays(visibleRange.endExclusive, -1))];
|
|
3254
|
+
}
|
|
3200
3255
|
if (mode === "month") return [startOfWeek(startOfMonth(date), { weekStartsOn }), endOfWeek(endOfMonth(date), { weekStartsOn })];
|
|
3201
3256
|
if (mode === "year") return [startOfWeek(startOfYear(date), { weekStartsOn }), endOfWeek(endOfYear(date), { weekStartsOn })];
|
|
3202
3257
|
const days = getViewDays$1(mode, date, weekStartsOn, numberOfDays, false, weekEndsOn);
|
|
3203
3258
|
return [startOfDay(days[0]), endOfDay(days[days.length - 1])];
|
|
3204
3259
|
}
|
|
3205
|
-
function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
3260
|
+
function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn, numberOfWeeks = 2) {
|
|
3261
|
+
if (mode === "multiweek") {
|
|
3262
|
+
const { period } = buildMultiWeekGrid$1(date, {
|
|
3263
|
+
numberOfWeeks,
|
|
3264
|
+
weekStartsOn
|
|
3265
|
+
});
|
|
3266
|
+
const previous = addWeeks(period.start, -numberOfWeeks);
|
|
3267
|
+
const following = addWeeks(period.endExclusive, numberOfWeeks);
|
|
3268
|
+
return [Number.isFinite(previous.getTime()) ? previous : period.start, endOfDay(addDays(Number.isFinite(following.getTime()) ? following : period.endExclusive, -1))];
|
|
3269
|
+
}
|
|
3206
3270
|
if (mode === "month") return [startOfWeek(startOfMonth(addMonths(date, -1)), { weekStartsOn }), addWeeks(endOfWeek(endOfMonth(addMonths(date, 1)), { weekStartsOn }), 1)];
|
|
3207
3271
|
if (mode === "year") return [startOfWeek(startOfYear(date), { weekStartsOn }), endOfWeek(endOfYear(date), { weekStartsOn })];
|
|
3208
3272
|
if (mode === "schedule") return [startOfDay(date), endOfDay(addMonths(date, 3))];
|
|
@@ -3237,7 +3301,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
3237
3301
|
* ```
|
|
3238
3302
|
*/
|
|
3239
3303
|
const Calendar = forwardRef(CalendarInner);
|
|
3240
|
-
function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, renderCreateGhost, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, chipHeight, chipGap, sortedMonthView, moreLabel, labels, 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 }, ref) {
|
|
3304
|
+
function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, renderCreateGhost, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, chipHeight, chipGap, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, numberOfWeeks = 2, 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 }, ref) {
|
|
3241
3305
|
const mergedTheme = useMemo(() => mergeTheme(theme), [theme]);
|
|
3242
3306
|
const internalCellHeight = useSharedValue(hourHeight);
|
|
3243
3307
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -3246,12 +3310,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3246
3310
|
const displayEvents = useMemo(() => {
|
|
3247
3311
|
let out = events;
|
|
3248
3312
|
if (out.some((e) => e.recurrence)) {
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
start = addDays(start, -1);
|
|
3252
|
-
end = addDays(end, 1);
|
|
3253
|
-
}
|
|
3254
|
-
out = expandRecurringEvents$1(out, start, end);
|
|
3313
|
+
const [start, end] = expansionRange(mode, date, weekStartsOn, numberOfDays ?? 1, weekEndsOn, numberOfWeeks);
|
|
3314
|
+
out = timeZone ? expandRecurringEvents$1(out, fromZonedTime$1(start, timeZone), fromZonedTime$1(end, timeZone), { timeZone }) : expandRecurringEvents$1(out, start, end);
|
|
3255
3315
|
}
|
|
3256
3316
|
if (timeZone) out = eventsInTimeZone$1(out, timeZone);
|
|
3257
3317
|
return out;
|
|
@@ -3262,24 +3322,63 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3262
3322
|
weekStartsOn,
|
|
3263
3323
|
numberOfDays,
|
|
3264
3324
|
weekEndsOn,
|
|
3265
|
-
timeZone
|
|
3325
|
+
timeZone,
|
|
3326
|
+
numberOfWeeks
|
|
3266
3327
|
]);
|
|
3267
3328
|
const handlePressEvent = useCallback((event) => {
|
|
3268
|
-
if (!event.disabled) onPressEvent(event);
|
|
3269
|
-
}, [onPressEvent]);
|
|
3329
|
+
if (!event.disabled) onPressEvent(timeZone ? zonedEventSource$1(event) : event);
|
|
3330
|
+
}, [onPressEvent, timeZone]);
|
|
3270
3331
|
const handleLongPressEvent = useMemo(() => onLongPressEvent ? (event) => {
|
|
3271
|
-
if (!event.disabled) onLongPressEvent(event);
|
|
3272
|
-
} : void 0, [onLongPressEvent]);
|
|
3332
|
+
if (!event.disabled) onLongPressEvent(timeZone ? zonedEventSource$1(event) : event);
|
|
3333
|
+
} : void 0, [onLongPressEvent, timeZone]);
|
|
3334
|
+
const timeGridMode = mode !== "month" && mode !== "multiweek";
|
|
3335
|
+
const zoned = useMemo(() => {
|
|
3336
|
+
if (!timeZone) return {
|
|
3337
|
+
onDragStart,
|
|
3338
|
+
onDragEvent,
|
|
3339
|
+
onPressMore,
|
|
3340
|
+
onPressTime: onPressCell,
|
|
3341
|
+
onLongPressTime: onLongPressCell,
|
|
3342
|
+
onCreateTimed: onCreateEvent
|
|
3343
|
+
};
|
|
3344
|
+
const instant = (wallClock) => fromZonedTime$1(wallClock, timeZone);
|
|
3345
|
+
return {
|
|
3346
|
+
onDragStart: onDragStart && ((event) => onDragStart(zonedEventSource$1(event))),
|
|
3347
|
+
onDragEvent: onDragEvent && ((event, start, end) => {
|
|
3348
|
+
const bounds = zonedDragBounds$1(event, start, end, { keepDuration: timeGridMode });
|
|
3349
|
+
if (!bounds) return false;
|
|
3350
|
+
return onDragEvent(zonedEventSource$1(event), bounds.start, bounds.end);
|
|
3351
|
+
}),
|
|
3352
|
+
onPressMore: onPressMore && ((dayEvents, day) => onPressMore(dayEvents.map(zonedEventSource$1), day)),
|
|
3353
|
+
onPressTime: onPressCell && ((time) => onPressCell(instant(time))),
|
|
3354
|
+
onLongPressTime: onLongPressCell && ((time) => onLongPressCell(instant(time))),
|
|
3355
|
+
onCreateTimed: onCreateEvent && ((start, end) => {
|
|
3356
|
+
const range = fromZonedRange$1(start, end, timeZone);
|
|
3357
|
+
if (range) onCreateEvent(range.start, range.end);
|
|
3358
|
+
})
|
|
3359
|
+
};
|
|
3360
|
+
}, [
|
|
3361
|
+
timeZone,
|
|
3362
|
+
timeGridMode,
|
|
3363
|
+
onDragStart,
|
|
3364
|
+
onDragEvent,
|
|
3365
|
+
onPressMore,
|
|
3366
|
+
onPressCell,
|
|
3367
|
+
onLongPressCell,
|
|
3368
|
+
onCreateEvent
|
|
3369
|
+
]);
|
|
3273
3370
|
const handleChangeDate = useCallback((next) => {
|
|
3274
3371
|
onChangeDate(next);
|
|
3275
|
-
onChangeDateRange?.(visibleRange(mode, next, weekStartsOn, numberOfDays ?? 1, weekEndsOn));
|
|
3372
|
+
onChangeDateRange?.(visibleRange(mode, next, weekStartsOn, numberOfDays ?? 1, weekEndsOn, numberOfWeeks, hiddenDays));
|
|
3276
3373
|
}, [
|
|
3277
3374
|
onChangeDate,
|
|
3278
3375
|
onChangeDateRange,
|
|
3279
3376
|
mode,
|
|
3280
3377
|
weekStartsOn,
|
|
3281
3378
|
numberOfDays,
|
|
3282
|
-
weekEndsOn
|
|
3379
|
+
weekEndsOn,
|
|
3380
|
+
numberOfWeeks,
|
|
3381
|
+
hiddenDays
|
|
3283
3382
|
]);
|
|
3284
3383
|
const resolvedRenderEvent = useMemo(() => {
|
|
3285
3384
|
if (eventCellStyle == null && ampm == null && showTime == null && ellipsizeTitle == null && allDayLabel == null && eventAccessibilityLabel == null) return renderEvent;
|
|
@@ -3309,12 +3408,26 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3309
3408
|
allDayLabel,
|
|
3310
3409
|
eventAccessibilityLabel
|
|
3311
3410
|
]);
|
|
3411
|
+
const rowSpec = useMemo(() => mode === "multiweek" ? {
|
|
3412
|
+
kind: "multiweek",
|
|
3413
|
+
numberOfWeeks
|
|
3414
|
+
} : {
|
|
3415
|
+
kind: "month",
|
|
3416
|
+
showAdjacentMonths: showAdjacentMonths ?? true,
|
|
3417
|
+
showSixWeeks: showSixWeeks ?? false
|
|
3418
|
+
}, [
|
|
3419
|
+
mode,
|
|
3420
|
+
numberOfWeeks,
|
|
3421
|
+
showAdjacentMonths,
|
|
3422
|
+
showSixWeeks
|
|
3423
|
+
]);
|
|
3312
3424
|
const resolvedLabels = useMemo(() => resolveCalendarLabels(labels), [labels]);
|
|
3313
3425
|
return /* @__PURE__ */ jsx(CalendarThemeProvider, {
|
|
3314
3426
|
value: mergedTheme,
|
|
3315
3427
|
children: /* @__PURE__ */ jsx(CalendarLabelsContext.Provider, {
|
|
3316
3428
|
value: resolvedLabels,
|
|
3317
|
-
children: mode === "month" ? /* @__PURE__ */ jsx(
|
|
3429
|
+
children: mode === "month" || mode === "multiweek" ? /* @__PURE__ */ jsx(DateRowsPager, {
|
|
3430
|
+
spec: rowSpec,
|
|
3318
3431
|
date,
|
|
3319
3432
|
events: displayEvents,
|
|
3320
3433
|
maxVisibleEventCount,
|
|
@@ -3324,14 +3437,14 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3324
3437
|
hiddenDays,
|
|
3325
3438
|
weekdayFormat,
|
|
3326
3439
|
locale,
|
|
3440
|
+
now,
|
|
3441
|
+
timeZone,
|
|
3327
3442
|
labels,
|
|
3328
3443
|
sortedMonthView,
|
|
3329
3444
|
moreLabel,
|
|
3330
|
-
showAdjacentMonths,
|
|
3331
3445
|
highlightWeekends,
|
|
3332
3446
|
disableMonthEventCellPress,
|
|
3333
3447
|
isRTL,
|
|
3334
|
-
showSixWeeks,
|
|
3335
3448
|
showTitle,
|
|
3336
3449
|
activeDate,
|
|
3337
3450
|
renderHeaderForMonthView,
|
|
@@ -3344,11 +3457,12 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3344
3457
|
onPressCell,
|
|
3345
3458
|
onPressEvent: handlePressEvent,
|
|
3346
3459
|
onLongPressEvent: handleLongPressEvent,
|
|
3347
|
-
onPressMore,
|
|
3460
|
+
onPressMore: zoned.onPressMore,
|
|
3348
3461
|
onCreateEvent,
|
|
3462
|
+
renderCreateGhost,
|
|
3349
3463
|
onSelectDrag,
|
|
3350
|
-
onDragEvent,
|
|
3351
|
-
onDragStart,
|
|
3464
|
+
onDragEvent: zoned.onDragEvent,
|
|
3465
|
+
onDragStart: zoned.onDragStart,
|
|
3352
3466
|
eventStartEditable,
|
|
3353
3467
|
eventOverlap,
|
|
3354
3468
|
selectedDates,
|
|
@@ -3369,6 +3483,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3369
3483
|
weekStartsOn,
|
|
3370
3484
|
hiddenDays,
|
|
3371
3485
|
locale,
|
|
3486
|
+
now,
|
|
3487
|
+
timeZone,
|
|
3372
3488
|
labels,
|
|
3373
3489
|
activeDate,
|
|
3374
3490
|
selectedDates,
|
|
@@ -3385,6 +3501,8 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3385
3501
|
}) : mode === "schedule" ? /* @__PURE__ */ jsx(Agenda, {
|
|
3386
3502
|
events: displayEvents,
|
|
3387
3503
|
locale,
|
|
3504
|
+
now,
|
|
3505
|
+
timeZone,
|
|
3388
3506
|
renderEvent: resolvedRenderEvent,
|
|
3389
3507
|
keyExtractor,
|
|
3390
3508
|
onPressEvent: handlePressEvent,
|
|
@@ -3448,14 +3566,14 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3448
3566
|
swipeEnabled,
|
|
3449
3567
|
onPressEvent: handlePressEvent,
|
|
3450
3568
|
onLongPressEvent: handleLongPressEvent,
|
|
3451
|
-
onDragEvent,
|
|
3569
|
+
onDragEvent: zoned.onDragEvent,
|
|
3452
3570
|
showDragHandle,
|
|
3453
|
-
onDragStart,
|
|
3571
|
+
onDragStart: zoned.onDragStart,
|
|
3454
3572
|
dragStepMinutes,
|
|
3455
|
-
onPressCell,
|
|
3573
|
+
onPressCell: zoned.onPressTime,
|
|
3456
3574
|
resetPageOnPressCell,
|
|
3457
|
-
onLongPressCell,
|
|
3458
|
-
onCreateEvent,
|
|
3575
|
+
onLongPressCell: zoned.onLongPressTime,
|
|
3576
|
+
onCreateEvent: zoned.onCreateTimed,
|
|
3459
3577
|
renderCreateGhost,
|
|
3460
3578
|
onPressDateHeader,
|
|
3461
3579
|
onChangeDate: handleChangeDate,
|
|
@@ -3466,6 +3584,24 @@ function CalendarInner({ events, mode, date, onChangeDate, onChangeDateRange, on
|
|
|
3466
3584
|
})
|
|
3467
3585
|
});
|
|
3468
3586
|
}
|
|
3587
|
+
// src/components/MultiWeekView.tsx
|
|
3588
|
+
/**
|
|
3589
|
+
* Consecutive full weeks with event bars and no hourly slots. Rows scroll
|
|
3590
|
+
* vertically when they cannot fit. Expand recurring events before passing them,
|
|
3591
|
+
* or use Calendar with mode="multiweek" for recurrence and swipe paging.
|
|
3592
|
+
*/
|
|
3593
|
+
function MultiWeekView({ date, numberOfWeeks = 2, weekStartsOn = 0, ...rest }) {
|
|
3594
|
+
const source = useMemo(() => ({
|
|
3595
|
+
kind: "multiweek",
|
|
3596
|
+
date,
|
|
3597
|
+
numberOfWeeks
|
|
3598
|
+
}), [date, numberOfWeeks]);
|
|
3599
|
+
return /* @__PURE__ */ jsx(DateRows, {
|
|
3600
|
+
...rest,
|
|
3601
|
+
source,
|
|
3602
|
+
weekStartsOn
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
3469
3605
|
// src/components/ResourceTimeline.tsx
|
|
3470
3606
|
const MOVE_ACTIVATE_MS = 250;
|
|
3471
3607
|
const DRAG_ACTIVATE_PX = 8;
|
|
@@ -4468,4 +4604,4 @@ const styles = StyleSheet.create({
|
|
|
4468
4604
|
right: 0
|
|
4469
4605
|
}
|
|
4470
4606
|
});
|
|
4471
|
-
export { Agenda, Calendar, CalendarThemeProvider, DEFAULT_HOUR_HEIGHT, DefaultEvent, DefaultMonthEvent, MonthList, MonthPager, MonthView, ResourceTimeline, TimeGrid, YearView, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
|
4607
|
+
export { Agenda, Calendar, CalendarThemeProvider, DEFAULT_HOUR_HEIGHT, DefaultEvent, DefaultMonthEvent, MonthList, MonthPager, MonthView, MultiWeekView, ResourceTimeline, TimeGrid, YearView, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, nowInTimeZone, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken, zonedDragBounds, zonedEventSource };
|
package/dist/picker.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as EventKeyExtractor, D as RenderEvent, F as PartialCalendarTheme, I as darkTheme, L as defaultTheme, N as CalendarTheme, O as RenderEventArgs, P as CalendarThemeProvider, R as mergeTheme, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, j as WeekStartsOn, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as ICalendarEvent, z as useCalendarTheme } from "./DefaultMonthEvent-
|
|
1
|
+
import { C as EventKeyExtractor, D as RenderEvent, F as PartialCalendarTheme, I as darkTheme, L as defaultTheme, N as CalendarTheme, O as RenderEventArgs, P as CalendarThemeProvider, R as mergeTheme, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, j as WeekStartsOn, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as ICalendarEvent, z as useCalendarTheme } from "./DefaultMonthEvent-hGk7wSrr.mjs";
|
|
2
2
|
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/dist/picker.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as EventKeyExtractor, D as RenderEvent, F as PartialCalendarTheme, I as darkTheme, L as defaultTheme, N as CalendarTheme, O as RenderEventArgs, P as CalendarThemeProvider, R as mergeTheme, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, j as WeekStartsOn, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as ICalendarEvent, z as useCalendarTheme } from "./DefaultMonthEvent-
|
|
1
|
+
import { C as EventKeyExtractor, D as RenderEvent, F as PartialCalendarTheme, I as darkTheme, L as defaultTheme, N as CalendarTheme, O as RenderEventArgs, P as CalendarThemeProvider, R as mergeTheme, _ as CalendarMode, a as MonthPager, c as MonthViewProps, h as CalendarEvent, j as WeekStartsOn, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as ICalendarEvent, z as useCalendarTheme } from "./DefaultMonthEvent-B7xVeY7Q.js";
|
|
2
2
|
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/dist/picker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_MonthList = require("./MonthList-
|
|
2
|
+
const require_MonthList = require("./MonthList-C_NTufaK.js");
|
|
3
3
|
let _super_calendar_core = require("@super-calendar/core");
|
|
4
4
|
exports.CalendarThemeProvider = require_MonthList.CalendarThemeProvider;
|
|
5
5
|
exports.DefaultMonthEvent = require_MonthList.DefaultMonthEvent;
|