@super-calendar/native 2.6.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DefaultMonthEvent-BSvuJUFk.d.ts → DefaultMonthEvent-Cm9DsHBK.d.mts} +17 -10
- package/dist/{DefaultMonthEvent-zDj9dHEv.d.mts → DefaultMonthEvent-DAxZjk_D.d.ts} +17 -10
- package/dist/{MonthList-Gu6p64fE.js → MonthList-BWTCCmko.js} +168 -35
- package/dist/{MonthList-CMzYn9T0.mjs → MonthList-Chx0jP5n.mjs} +170 -37
- package/dist/index.d.mts +101 -17
- package/dist/index.d.ts +101 -17
- package/dist/index.js +734 -159
- package/dist/index.mjs +707 -162
- 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 +5 -2
- package/src/components/AllDayLane.tsx +3 -2
- package/src/components/Calendar.tsx +41 -0
- package/src/components/DefaultEvent.tsx +3 -1
- package/src/components/MonthPager.tsx +12 -3
- package/src/components/MonthView.tsx +239 -43
- package/src/components/ResourceTimeline.tsx +302 -44
- package/src/components/TimeGrid.tsx +807 -122
- package/src/components/YearView.tsx +14 -4
- package/src/index.tsx +13 -1
- package/src/types.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_MonthList = require("./MonthList-
|
|
24
|
+
const require_MonthList = require("./MonthList-BWTCCmko.js");
|
|
25
25
|
let date_fns = require("date-fns");
|
|
26
26
|
let react = require("react");
|
|
27
27
|
let react_native_reanimated = require("react-native-reanimated");
|
|
@@ -33,7 +33,7 @@ let _legendapp_list_react_native = require("@legendapp/list/react-native");
|
|
|
33
33
|
let react_native_gesture_handler = require("react-native-gesture-handler");
|
|
34
34
|
//#region src/components/YearView.tsx
|
|
35
35
|
const FALLBACK_COLUMNS = 3;
|
|
36
|
-
function YearViewInner({ date, events, weekStartsOn, locale, activeDate, minMonthWidth = 150, onPressDay, onPressMonth, classNames, styles: styleOverrides }) {
|
|
36
|
+
function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeDate, minMonthWidth = 150, onPressDay, onPressMonth, classNames, styles: styleOverrides }) {
|
|
37
37
|
const theme = require_MonthList.useCalendarTheme();
|
|
38
38
|
const slot = require_MonthList.createSlots({
|
|
39
39
|
classNames,
|
|
@@ -46,19 +46,20 @@ function YearViewInner({ date, events, weekStartsOn, locale, activeDate, minMont
|
|
|
46
46
|
setColumns(Math.max(2, Math.min(4, Math.floor(width / minMonthWidth))));
|
|
47
47
|
};
|
|
48
48
|
const months = (0, react.useMemo)(() => (0, _super_calendar_core.getYearMonths)(date), [date]);
|
|
49
|
-
const weekdayLabels = (0, react.useMemo)(() => (0, _super_calendar_core.getWeekDays)(date, weekStartsOn).map((d) => (0, date_fns.format)(d, (0, _super_calendar_core.weekdayFormatToken)("narrow"), { locale })), [
|
|
49
|
+
const weekdayLabels = (0, react.useMemo)(() => (0, _super_calendar_core.filterHiddenDays)((0, _super_calendar_core.getWeekDays)(date, weekStartsOn), hiddenDays).map((d) => (0, date_fns.format)(d, (0, _super_calendar_core.weekdayFormatToken)("narrow"), { locale })), [
|
|
50
50
|
date,
|
|
51
51
|
weekStartsOn,
|
|
52
|
-
locale
|
|
52
|
+
locale,
|
|
53
|
+
hiddenDays
|
|
53
54
|
]);
|
|
54
|
-
const eventDays = (0, react.useMemo)(() => new Set(events && events.length > 0 ? (0, _super_calendar_core.groupEventsByDay)(events).keys() : []), [events]);
|
|
55
|
+
const eventDays = (0, react.useMemo)(() => new Set(events && events.length > 0 ? (0, _super_calendar_core.groupEventsByDay)(events.filter((e) => !(0, _super_calendar_core.isBackgroundEvent)(e))).keys() : []), [events]);
|
|
55
56
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ScrollView, {
|
|
56
57
|
onLayout: handleLayout,
|
|
57
58
|
showsVerticalScrollIndicator: true,
|
|
58
59
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
59
60
|
...slot("grid", { base: styles$5.grid }),
|
|
60
61
|
children: months.map((month) => {
|
|
61
|
-
const weeks = (0, _super_calendar_core.buildMonthWeeks)(month, weekStartsOn);
|
|
62
|
+
const weeks = (0, _super_calendar_core.buildMonthWeeks)(month, weekStartsOn, { hiddenDays });
|
|
62
63
|
const title = (0, date_fns.format)(month, "MMMM", { locale });
|
|
63
64
|
const monthLabel = (0, date_fns.format)(month, "MMMM yyyy", { locale });
|
|
64
65
|
const titleText = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
@@ -208,7 +209,7 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
208
209
|
}), [classNames, styleOverrides]);
|
|
209
210
|
const RenderEventComponent = renderEvent;
|
|
210
211
|
const rows = (0, react.useMemo)(() => {
|
|
211
|
-
const sorted =
|
|
212
|
+
const sorted = events.filter((event) => !(0, _super_calendar_core.isBackgroundEvent)(event)).sort((a, b) => a.start.getTime() - b.start.getTime());
|
|
212
213
|
const out = [];
|
|
213
214
|
let currentDay = null;
|
|
214
215
|
sorted.forEach((event, index) => {
|
|
@@ -375,7 +376,7 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
|
|
|
375
376
|
],
|
|
376
377
|
onPress,
|
|
377
378
|
onLongPress,
|
|
378
|
-
activeOpacity:
|
|
379
|
+
activeOpacity: 1,
|
|
379
380
|
accessibilityRole: "button",
|
|
380
381
|
accessibilityLabel,
|
|
381
382
|
accessibilityState: { disabled: event.disabled ?? false },
|
|
@@ -505,7 +506,7 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
|
|
|
505
506
|
const theme = require_MonthList.useCalendarTheme();
|
|
506
507
|
const slot = require_MonthList.useSlots();
|
|
507
508
|
const RenderEventComponent = renderEvent;
|
|
508
|
-
const allDay = events.filter(_super_calendar_core.isAllDayEvent);
|
|
509
|
+
const allDay = events.filter((event) => (0, _super_calendar_core.isAllDayEvent)(event) && !(0, _super_calendar_core.isBackgroundEvent)(event));
|
|
509
510
|
const perDay = days.map((day) => {
|
|
510
511
|
const start = (0, date_fns.startOfDay)(day);
|
|
511
512
|
const next = (0, date_fns.addDays)(start, 1);
|
|
@@ -583,34 +584,76 @@ const MOVE_ACTIVATE_MS$1 = 500;
|
|
|
583
584
|
const DRAG_ACTIVATE_PX$1 = 8;
|
|
584
585
|
const RESIZE_HANDLE_HEIGHT = 14;
|
|
585
586
|
const DEFAULT_DRAG_STEP_MINUTES = 15;
|
|
586
|
-
const
|
|
587
|
-
const
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
587
|
+
const DRAG_EVENT_Z = 100;
|
|
588
|
+
const EDGE_DWELL_MS = 500;
|
|
589
|
+
const EDGE_ZONE_PX = 36;
|
|
590
|
+
const EdgePagingContext = (0, react.createContext)(null);
|
|
591
|
+
const noop = () => {};
|
|
592
|
+
/**
|
|
593
|
+
* The floating copy of a dragged event, rendered above the pager so a cross-week
|
|
594
|
+
* drag stays visible after its source page pages away. Position, size, and
|
|
595
|
+
* visibility are driven on the UI thread by the shared values so it tracks the
|
|
596
|
+
* finger without a React re-render.
|
|
597
|
+
*/
|
|
598
|
+
function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
599
|
+
const RenderEventComponent = renderEvent;
|
|
600
|
+
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
601
|
+
transform: [{ translateX: x.value }, { translateY: y.value }],
|
|
602
|
+
width: w.value,
|
|
603
|
+
height: h.value,
|
|
604
|
+
opacity: visible.value
|
|
605
|
+
}));
|
|
606
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
607
|
+
style: [
|
|
608
|
+
styles$1.eventBox,
|
|
609
|
+
styles$1.dragGhost,
|
|
610
|
+
style
|
|
611
|
+
],
|
|
612
|
+
pointerEvents: "none",
|
|
613
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
614
|
+
event,
|
|
615
|
+
mode,
|
|
616
|
+
boxHeight: h,
|
|
617
|
+
onPress: noop
|
|
618
|
+
})
|
|
619
|
+
});
|
|
597
620
|
}
|
|
598
|
-
|
|
621
|
+
const HOUR_LABEL_TOP_INSET = 12;
|
|
622
|
+
function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
599
623
|
const RenderEventComponent = renderEvent;
|
|
600
624
|
const theme = require_MonthList.useCalendarTheme();
|
|
601
625
|
const slot = require_MonthList.useSlots();
|
|
602
|
-
const
|
|
603
|
-
const
|
|
626
|
+
const edgePaging = (0, react.useContext)(EdgePagingContext);
|
|
627
|
+
const pagerLeftSV = edgePaging?.pagerLeft;
|
|
628
|
+
const pagerTopSV = edgePaging?.pagerTop;
|
|
629
|
+
const pagerWidthSV = edgePaging?.pagerWidth;
|
|
630
|
+
const ghostXSV = edgePaging?.ghostX;
|
|
631
|
+
const ghostYSV = edgePaging?.ghostY;
|
|
632
|
+
const commitLiftedDrop = edgePaging?.commitLiftedDrop;
|
|
633
|
+
const editable = onDragEvent != null && !positioned.event.disabled && positioned.event.draggable !== false;
|
|
634
|
+
const canMove = editable && (positioned.event.startEditable ?? eventStartEditable);
|
|
635
|
+
const canResize = editable && (positioned.event.durationEditable ?? eventDurationEditable);
|
|
636
|
+
const resizable = canResize && !positioned.continuesAfter;
|
|
637
|
+
const resizableFromStart = canResize && !positioned.continuesBefore && !isWeb$1;
|
|
604
638
|
const moveOffset = (0, react_native_reanimated.useSharedValue)(0);
|
|
605
639
|
const moveOffsetX = (0, react_native_reanimated.useSharedValue)(0);
|
|
606
640
|
const resizeDelta = (0, react_native_reanimated.useSharedValue)(0);
|
|
641
|
+
const resizeStartDelta = (0, react_native_reanimated.useSharedValue)(0);
|
|
642
|
+
const dragZ = (0, react_native_reanimated.useSharedValue)(0);
|
|
643
|
+
const edgeDir = (0, react_native_reanimated.useSharedValue)(0);
|
|
644
|
+
const lifted = (0, react_native_reanimated.useSharedValue)(0);
|
|
645
|
+
const grabX = (0, react_native_reanimated.useSharedValue)(0);
|
|
646
|
+
const grabY = (0, react_native_reanimated.useSharedValue)(0);
|
|
647
|
+
const liveAbsX = (0, react_native_reanimated.useSharedValue)(0);
|
|
648
|
+
const liveAbsY = (0, react_native_reanimated.useSharedValue)(0);
|
|
607
649
|
const startHours = positioned.startHours;
|
|
608
650
|
const durationHours = positioned.durationHours;
|
|
609
|
-
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => Math.max(durationHours * cellHeight.value + resizeDelta.value, MIN_EVENT_HEIGHT), [durationHours]);
|
|
651
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => Math.max(durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value, MIN_EVENT_HEIGHT), [durationHours]);
|
|
610
652
|
const boxStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
611
|
-
top: (startHours - minHour) * cellHeight.value + moveOffset.value,
|
|
653
|
+
top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
612
654
|
height: boxHeight.value,
|
|
613
|
-
transform: [{ translateX: moveOffsetX.value }]
|
|
655
|
+
transform: [{ translateX: moveOffsetX.value }],
|
|
656
|
+
zIndex: dragZ.value
|
|
614
657
|
}), [
|
|
615
658
|
startHours,
|
|
616
659
|
durationHours,
|
|
@@ -620,12 +663,14 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
620
663
|
moveOffset.value = 0;
|
|
621
664
|
moveOffsetX.value = 0;
|
|
622
665
|
resizeDelta.value = 0;
|
|
666
|
+
resizeStartDelta.value = 0;
|
|
623
667
|
}, [
|
|
624
668
|
positioned.startHours,
|
|
625
669
|
positioned.durationHours,
|
|
626
670
|
moveOffset,
|
|
627
671
|
moveOffsetX,
|
|
628
|
-
resizeDelta
|
|
672
|
+
resizeDelta,
|
|
673
|
+
resizeStartDelta
|
|
629
674
|
]);
|
|
630
675
|
const latest = (0, react.useRef)({
|
|
631
676
|
event: positioned.event,
|
|
@@ -641,10 +686,12 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
641
686
|
moveOffset.value = 0;
|
|
642
687
|
moveOffsetX.value = 0;
|
|
643
688
|
resizeDelta.value = 0;
|
|
689
|
+
resizeStartDelta.value = 0;
|
|
644
690
|
}, [
|
|
645
691
|
moveOffset,
|
|
646
692
|
moveOffsetX,
|
|
647
|
-
resizeDelta
|
|
693
|
+
resizeDelta,
|
|
694
|
+
resizeStartDelta
|
|
648
695
|
]);
|
|
649
696
|
const commitDrag = (0, react.useCallback)((deltaStartMin, deltaEndMin) => {
|
|
650
697
|
const { event, onDragEvent: handler } = latest.current;
|
|
@@ -659,16 +706,81 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
659
706
|
const notifyDragStart = (0, react.useCallback)(() => {
|
|
660
707
|
latest.current.onDragStart?.(latest.current.event);
|
|
661
708
|
}, []);
|
|
709
|
+
const dwellTimer = (0, react.useRef)(null);
|
|
710
|
+
const disarmEdge = (0, react.useCallback)(() => {
|
|
711
|
+
if (dwellTimer.current) {
|
|
712
|
+
clearTimeout(dwellTimer.current);
|
|
713
|
+
dwellTimer.current = null;
|
|
714
|
+
}
|
|
715
|
+
}, []);
|
|
716
|
+
const releaseEdge = (0, react.useCallback)(() => {
|
|
717
|
+
disarmEdge();
|
|
718
|
+
edgePaging?.lockScroll(false);
|
|
719
|
+
}, [disarmEdge, edgePaging]);
|
|
720
|
+
const armEdge = (0, react.useCallback)((dir) => {
|
|
721
|
+
disarmEdge();
|
|
722
|
+
dwellTimer.current = setTimeout(() => {
|
|
723
|
+
dwellTimer.current = null;
|
|
724
|
+
if (!edgePaging) return;
|
|
725
|
+
edgePaging.lockScroll(true);
|
|
726
|
+
if (!lifted.value) {
|
|
727
|
+
lifted.value = 1;
|
|
728
|
+
edgePaging.ghostW.value = width;
|
|
729
|
+
edgePaging.ghostH.value = boxHeight.value;
|
|
730
|
+
edgePaging.ghostX.value = liveAbsX.value - grabX.value - edgePaging.pagerLeft.value;
|
|
731
|
+
edgePaging.ghostY.value = liveAbsY.value - grabY.value - edgePaging.pagerTop.value;
|
|
732
|
+
edgePaging.ghostVisible.value = 1;
|
|
733
|
+
edgePaging.beginLift(latest.current.event);
|
|
734
|
+
}
|
|
735
|
+
onEdgeAdvance?.(dir);
|
|
736
|
+
}, EDGE_DWELL_MS);
|
|
737
|
+
}, [
|
|
738
|
+
disarmEdge,
|
|
739
|
+
edgePaging,
|
|
740
|
+
lifted,
|
|
741
|
+
width,
|
|
742
|
+
boxHeight,
|
|
743
|
+
liveAbsX,
|
|
744
|
+
liveAbsY,
|
|
745
|
+
grabX,
|
|
746
|
+
grabY,
|
|
747
|
+
onEdgeAdvance
|
|
748
|
+
]);
|
|
662
749
|
const moveGesture = (0, react.useMemo)(() => {
|
|
663
|
-
const pan = react_native_gesture_handler.Gesture.Pan().enabled(
|
|
750
|
+
const pan = react_native_gesture_handler.Gesture.Pan().enabled(canMove).onStart((event) => {
|
|
751
|
+
dragZ.value = DRAG_EVENT_Z;
|
|
752
|
+
edgeDir.value = 0;
|
|
753
|
+
lifted.value = 0;
|
|
754
|
+
grabX.value = event.x;
|
|
755
|
+
grabY.value = event.y;
|
|
756
|
+
liveAbsX.value = event.absoluteX;
|
|
757
|
+
liveAbsY.value = event.absoluteY;
|
|
664
758
|
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
665
759
|
}).onUpdate((event) => {
|
|
666
|
-
|
|
667
|
-
|
|
760
|
+
liveAbsX.value = event.absoluteX;
|
|
761
|
+
liveAbsY.value = event.absoluteY;
|
|
762
|
+
if (lifted.value && pagerLeftSV && pagerTopSV && ghostXSV && ghostYSV) {
|
|
763
|
+
ghostXSV.value = event.absoluteX - grabX.value - pagerLeftSV.value;
|
|
764
|
+
ghostYSV.value = event.absoluteY - grabY.value - pagerTopSV.value;
|
|
765
|
+
} else {
|
|
766
|
+
moveOffset.value = event.translationY;
|
|
767
|
+
moveOffsetX.value = event.translationX;
|
|
768
|
+
}
|
|
769
|
+
if (onEdgeAdvance && pagerLeftSV && pagerWidthSV) {
|
|
770
|
+
const fx = event.absoluteX - pagerLeftSV.value;
|
|
771
|
+
const dir = fx > pagerWidthSV.value - EDGE_ZONE_PX ? 1 : fx < EDGE_ZONE_PX ? -1 : 0;
|
|
772
|
+
if (dir !== edgeDir.value) {
|
|
773
|
+
edgeDir.value = dir;
|
|
774
|
+
if (dir === 0) (0, react_native_reanimated.runOnJS)(disarmEdge)();
|
|
775
|
+
else (0, react_native_reanimated.runOnJS)(armEdge)(dir);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
668
778
|
}).onEnd((event) => {
|
|
779
|
+
if (lifted.value) return;
|
|
669
780
|
const minuteDelta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
|
|
670
781
|
const rawDayDelta = dayWidth > 0 ? Math.round(event.translationX / dayWidth) : 0;
|
|
671
|
-
const
|
|
782
|
+
const targetDay = Math.min(Math.max(dayIndex + rawDayDelta, 0), dayCount - 1);
|
|
783
|
+
const dayDelta = targetDay - dayIndex;
|
|
672
784
|
if (minuteDelta === 0 && dayDelta === 0) {
|
|
673
785
|
moveOffset.value = 0;
|
|
674
786
|
moveOffsetX.value = 0;
|
|
@@ -676,23 +788,51 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
676
788
|
}
|
|
677
789
|
moveOffset.value = minuteDelta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
678
790
|
moveOffsetX.value = dayDelta * dayWidth;
|
|
679
|
-
const totalDelta = minuteDelta +
|
|
791
|
+
const totalDelta = minuteDelta + (dayOrdinals[targetDay] - dayOrdinals[dayIndex]) * MINUTES_PER_DAY;
|
|
680
792
|
(0, react_native_reanimated.runOnJS)(commitDrag)(totalDelta, totalDelta);
|
|
793
|
+
}).onFinalize(() => {
|
|
794
|
+
dragZ.value = 0;
|
|
795
|
+
if (lifted.value && ghostXSV && ghostYSV && commitLiftedDrop) {
|
|
796
|
+
(0, react_native_reanimated.runOnJS)(commitLiftedDrop)(ghostXSV.value, ghostYSV.value);
|
|
797
|
+
moveOffset.value = 0;
|
|
798
|
+
moveOffsetX.value = 0;
|
|
799
|
+
lifted.value = 0;
|
|
800
|
+
}
|
|
801
|
+
(0, react_native_reanimated.runOnJS)(releaseEdge)();
|
|
681
802
|
});
|
|
682
803
|
return isWeb$1 ? pan.activeOffsetX([-8, DRAG_ACTIVATE_PX$1]).activeOffsetY([-8, DRAG_ACTIVATE_PX$1]) : pan.activateAfterLongPress(MOVE_ACTIVATE_MS$1);
|
|
683
804
|
}, [
|
|
684
|
-
|
|
805
|
+
canMove,
|
|
685
806
|
snapMinutes,
|
|
686
807
|
cellHeight,
|
|
687
808
|
moveOffset,
|
|
688
809
|
moveOffsetX,
|
|
810
|
+
dragZ,
|
|
811
|
+
edgeDir,
|
|
812
|
+
lifted,
|
|
813
|
+
grabX,
|
|
814
|
+
grabY,
|
|
815
|
+
liveAbsX,
|
|
816
|
+
liveAbsY,
|
|
817
|
+
pagerLeftSV,
|
|
818
|
+
pagerTopSV,
|
|
819
|
+
pagerWidthSV,
|
|
820
|
+
ghostXSV,
|
|
821
|
+
ghostYSV,
|
|
822
|
+
commitLiftedDrop,
|
|
689
823
|
dayWidth,
|
|
690
824
|
dayIndex,
|
|
691
825
|
dayCount,
|
|
826
|
+
dayOrdinals,
|
|
692
827
|
commitDrag,
|
|
693
|
-
notifyDragStart
|
|
828
|
+
notifyDragStart,
|
|
829
|
+
onEdgeAdvance,
|
|
830
|
+
armEdge,
|
|
831
|
+
disarmEdge,
|
|
832
|
+
releaseEdge
|
|
694
833
|
]);
|
|
695
834
|
const resizeGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(resizable).onStart(() => {
|
|
835
|
+
dragZ.value = DRAG_EVENT_Z;
|
|
696
836
|
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
697
837
|
}).onUpdate((event) => {
|
|
698
838
|
resizeDelta.value = event.translationY;
|
|
@@ -704,35 +844,70 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
704
844
|
}
|
|
705
845
|
resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
706
846
|
(0, react_native_reanimated.runOnJS)(commitDrag)(0, delta);
|
|
847
|
+
}).onFinalize(() => {
|
|
848
|
+
dragZ.value = 0;
|
|
707
849
|
}), [
|
|
708
850
|
resizable,
|
|
709
851
|
snapMinutes,
|
|
710
852
|
cellHeight,
|
|
711
853
|
resizeDelta,
|
|
854
|
+
dragZ,
|
|
855
|
+
commitDrag,
|
|
856
|
+
notifyDragStart
|
|
857
|
+
]);
|
|
858
|
+
const resizeStartGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(resizableFromStart).onStart(() => {
|
|
859
|
+
dragZ.value = DRAG_EVENT_Z;
|
|
860
|
+
(0, react_native_reanimated.runOnJS)(notifyDragStart)();
|
|
861
|
+
}).onUpdate((event) => {
|
|
862
|
+
resizeStartDelta.value = event.translationY;
|
|
863
|
+
}).onEnd((event) => {
|
|
864
|
+
const delta = (0, _super_calendar_core.snapDeltaMinutes)(event.translationY, cellHeight.value, snapMinutes);
|
|
865
|
+
if (delta === 0) {
|
|
866
|
+
resizeStartDelta.value = 0;
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
resizeStartDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
870
|
+
(0, react_native_reanimated.runOnJS)(commitDrag)(delta, 0);
|
|
871
|
+
}).onFinalize(() => {
|
|
872
|
+
dragZ.value = 0;
|
|
873
|
+
}), [
|
|
874
|
+
resizableFromStart,
|
|
875
|
+
snapMinutes,
|
|
876
|
+
cellHeight,
|
|
877
|
+
resizeStartDelta,
|
|
878
|
+
dragZ,
|
|
712
879
|
commitDrag,
|
|
713
880
|
notifyDragStart
|
|
714
881
|
]);
|
|
715
882
|
const handlePress = () => onPress(positioned.event);
|
|
716
|
-
const handleLongPress = !
|
|
883
|
+
const handleLongPress = !canMove && onLongPress ? () => onLongPress(positioned.event) : void 0;
|
|
717
884
|
const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
|
|
718
|
-
const
|
|
719
|
-
|
|
885
|
+
const pageUnit = mode === "week" ? "week" : daysPerPage === 1 ? "day" : `${daysPerPage} day${daysPerPage === 1 ? "" : "s"}`;
|
|
886
|
+
const dragActions = [
|
|
887
|
+
...canMove ? [{
|
|
720
888
|
name: "move-later",
|
|
721
889
|
label: `Move ${unit(snapMinutes)} later`
|
|
722
|
-
},
|
|
723
|
-
{
|
|
890
|
+
}, {
|
|
724
891
|
name: "move-earlier",
|
|
725
892
|
label: `Move ${unit(snapMinutes)} earlier`
|
|
726
|
-
},
|
|
893
|
+
}] : [],
|
|
727
894
|
...resizable ? [{
|
|
728
895
|
name: "extend",
|
|
729
896
|
label: `Extend by ${unit(snapMinutes)}`
|
|
730
897
|
}, {
|
|
731
898
|
name: "shrink",
|
|
732
899
|
label: `Shorten by ${unit(snapMinutes)}`
|
|
900
|
+
}] : [],
|
|
901
|
+
...canMove ? [{
|
|
902
|
+
name: "move-next-page",
|
|
903
|
+
label: `Move to next ${pageUnit}`
|
|
904
|
+
}, {
|
|
905
|
+
name: "move-previous-page",
|
|
906
|
+
label: `Move to previous ${pageUnit}`
|
|
733
907
|
}] : []
|
|
734
|
-
]
|
|
735
|
-
const
|
|
908
|
+
];
|
|
909
|
+
const accessibilityActions = dragActions.length ? dragActions : void 0;
|
|
910
|
+
const handleAccessibilityAction = accessibilityActions ? (e) => {
|
|
736
911
|
switch (e.nativeEvent.actionName) {
|
|
737
912
|
case "move-later":
|
|
738
913
|
commitDrag(snapMinutes, snapMinutes);
|
|
@@ -746,6 +921,12 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
746
921
|
case "shrink":
|
|
747
922
|
commitDrag(0, -snapMinutes);
|
|
748
923
|
break;
|
|
924
|
+
case "move-next-page":
|
|
925
|
+
commitDrag(daysPerPage * MINUTES_PER_DAY, daysPerPage * MINUTES_PER_DAY);
|
|
926
|
+
break;
|
|
927
|
+
case "move-previous-page":
|
|
928
|
+
commitDrag(-daysPerPage * MINUTES_PER_DAY, -daysPerPage * MINUTES_PER_DAY);
|
|
929
|
+
break;
|
|
749
930
|
}
|
|
750
931
|
} : void 0;
|
|
751
932
|
const eventSlot = slot("event", {
|
|
@@ -758,25 +939,35 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
758
939
|
const box = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
759
940
|
...eventSlot,
|
|
760
941
|
style: [eventSlot.style, boxStyle],
|
|
761
|
-
children: [
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
children:
|
|
776
|
-
|
|
777
|
-
|
|
942
|
+
children: [
|
|
943
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
944
|
+
event: positioned.event,
|
|
945
|
+
mode,
|
|
946
|
+
boxHeight,
|
|
947
|
+
continuesBefore: positioned.continuesBefore,
|
|
948
|
+
continuesAfter: positioned.continuesAfter,
|
|
949
|
+
accessibilityActions,
|
|
950
|
+
onAccessibilityAction: handleAccessibilityAction,
|
|
951
|
+
onPress: handlePress,
|
|
952
|
+
onLongPress: handleLongPress
|
|
953
|
+
}),
|
|
954
|
+
resizableFromStart ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
955
|
+
gesture: resizeStartGesture,
|
|
956
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
957
|
+
style: styles$1.resizeHandleTop,
|
|
958
|
+
children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
959
|
+
})
|
|
960
|
+
}) : null,
|
|
961
|
+
resizable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
962
|
+
gesture: resizeGesture,
|
|
963
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
964
|
+
style: styles$1.resizeHandle,
|
|
965
|
+
children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
966
|
+
})
|
|
967
|
+
}) : null
|
|
968
|
+
]
|
|
778
969
|
});
|
|
779
|
-
if (!
|
|
970
|
+
if (!canMove) return box;
|
|
780
971
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
781
972
|
gesture: moveGesture,
|
|
782
973
|
children: box
|
|
@@ -849,7 +1040,7 @@ const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) =>
|
|
|
849
1040
|
style: [lineSlot.style, animatedStyle]
|
|
850
1041
|
});
|
|
851
1042
|
};
|
|
852
|
-
const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color }) => {
|
|
1043
|
+
const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color, slotName = "businessHours", testID = "business-hours-shade", children }) => {
|
|
853
1044
|
const slot = require_MonthList.useSlots();
|
|
854
1045
|
const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
855
1046
|
top: (startHour - minHour) * cellHeight.value,
|
|
@@ -859,7 +1050,7 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
859
1050
|
endHour,
|
|
860
1051
|
minHour
|
|
861
1052
|
]);
|
|
862
|
-
const bandSlot = slot(
|
|
1053
|
+
const bandSlot = slot(slotName, {
|
|
863
1054
|
base: [
|
|
864
1055
|
styles$1.shadeBand,
|
|
865
1056
|
styles$1.nonInteractive,
|
|
@@ -868,18 +1059,25 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
868
1059
|
width
|
|
869
1060
|
}
|
|
870
1061
|
],
|
|
871
|
-
themed: { backgroundColor: color }
|
|
1062
|
+
themed: color === void 0 ? void 0 : { backgroundColor: color }
|
|
872
1063
|
});
|
|
873
1064
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
874
|
-
testID
|
|
1065
|
+
testID,
|
|
1066
|
+
accessibilityElementsHidden: true,
|
|
1067
|
+
importantForAccessibility: "no-hide-descendants",
|
|
875
1068
|
...bandSlot,
|
|
876
|
-
style: [bandSlot.style, animatedStyle]
|
|
1069
|
+
style: [bandSlot.style, animatedStyle],
|
|
1070
|
+
children
|
|
877
1071
|
});
|
|
878
1072
|
};
|
|
879
|
-
function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hourHeight, committedCellHeight, scrollY, isActive, initialScrollY, onSettleOffset, weekStartsOn, weekEndsOn, width, hourColumnWidth, minHour, maxHour, ampm, timeslots, isRTL, showAllDayEventCell, showVerticalScrollIndicator, verticalScrollEnabled, hourComponent, calendarCellStyle, minHourHeight, maxHourHeight, showNowIndicator, businessHours, renderEvent, keyExtractor, snapMinutes, showDragHandle, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent }) {
|
|
1073
|
+
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, hourHeight, committedCellHeight, scrollY, isActive, initialScrollY, onSettleOffset, weekStartsOn, weekEndsOn, width, hourColumnWidth, minHour, maxHour, ampm, timeslots, isRTL, showAllDayEventCell, highlightWeekends, showVerticalScrollIndicator, verticalScrollEnabled, hourComponent, calendarCellStyle, minHourHeight, maxHourHeight, showNowIndicator, businessHours, renderBusinessHours, renderEvent, keyExtractor, snapMinutes, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, onGridTop }) {
|
|
880
1074
|
const theme = require_MonthList.useCalendarTheme();
|
|
881
1075
|
const slot = require_MonthList.useSlots();
|
|
882
1076
|
const scrollRef = (0, react_native_reanimated.useAnimatedRef)();
|
|
1077
|
+
const gridTopRef = (0, react.useRef)(0);
|
|
1078
|
+
(0, react.useEffect)(() => {
|
|
1079
|
+
if (isActive) onGridTop?.(gridTopRef.current);
|
|
1080
|
+
}, [isActive, onGridTop]);
|
|
883
1081
|
const heightSource = isActive ? cellHeight : committedCellHeight;
|
|
884
1082
|
const isDragging = (0, react_native_reanimated.useSharedValue)(false);
|
|
885
1083
|
const isActiveShared = (0, react_native_reanimated.useSharedValue)(isActive);
|
|
@@ -915,17 +1113,20 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
915
1113
|
if (isWeb$1 || !active || active === previous) return;
|
|
916
1114
|
(0, react_native_reanimated.scrollTo)(scrollRef, 0, scrollY.value, false);
|
|
917
1115
|
});
|
|
918
|
-
const days = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, date, weekStartsOn, numberOfDays, isRTL, weekEndsOn), [
|
|
1116
|
+
const days = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
|
|
919
1117
|
mode,
|
|
920
1118
|
date,
|
|
921
1119
|
weekStartsOn,
|
|
922
1120
|
numberOfDays,
|
|
923
1121
|
isRTL,
|
|
924
|
-
weekEndsOn
|
|
1122
|
+
weekEndsOn,
|
|
1123
|
+
hiddenDays
|
|
925
1124
|
]);
|
|
1125
|
+
const daysPerPage = (0, _super_calendar_core.pageStepDays)(mode, date, weekStartsOn, numberOfDays);
|
|
926
1126
|
const dayCount = days.length;
|
|
927
1127
|
const dayWidth = (width - hourColumnWidth) / dayCount;
|
|
928
1128
|
const dayLeft = (dayIndex) => hourColumnWidth + dayIndex * dayWidth;
|
|
1129
|
+
const dayOrdinals = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[0])), [days]);
|
|
929
1130
|
const dayLayouts = (0, react.useMemo)(() => days.map((day) => (0, _super_calendar_core.layoutDayEvents)(events, day)), [days, events]);
|
|
930
1131
|
const cellDateFromTouch = (event) => {
|
|
931
1132
|
const { locationX, locationY } = event.nativeEvent;
|
|
@@ -947,8 +1148,11 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
947
1148
|
if (date) onLongPressCell?.(date);
|
|
948
1149
|
};
|
|
949
1150
|
const hoursRange = (0, react.useMemo)(() => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index), [minHour, maxHour]);
|
|
950
|
-
const now = useNow(showNowIndicator && isActive
|
|
951
|
-
|
|
1151
|
+
const now = (0, _super_calendar_core.useNow)(showNowIndicator && isActive, {
|
|
1152
|
+
now: nowProp,
|
|
1153
|
+
timeZone: nowTimeZone
|
|
1154
|
+
});
|
|
1155
|
+
const nowDayIndex = days.findIndex((day) => (0, _super_calendar_core.isSameCalendarDay)(day, now));
|
|
952
1156
|
const nowHours = ((0, date_fns.getHours)(now) * MINUTES_PER_HOUR$1 + (0, date_fns.getMinutes)(now)) / MINUTES_PER_HOUR$1;
|
|
953
1157
|
const nowInWindow = nowHours >= minHour && nowHours <= maxHour;
|
|
954
1158
|
const fullHeightStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ height: (maxHour - minHour) * heightSource.value }), [
|
|
@@ -1126,6 +1330,10 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
1126
1330
|
scrollEnabled: verticalScrollEnabled,
|
|
1127
1331
|
onScroll: scrollHandler,
|
|
1128
1332
|
scrollEventThrottle: 16,
|
|
1333
|
+
onLayout: (event) => {
|
|
1334
|
+
gridTopRef.current = event.nativeEvent.layout.y;
|
|
1335
|
+
if (isActive) onGridTop?.(gridTopRef.current);
|
|
1336
|
+
},
|
|
1129
1337
|
contentContainerStyle: { paddingTop: HOUR_LABEL_TOP_INSET },
|
|
1130
1338
|
contentOffset: {
|
|
1131
1339
|
x: 0,
|
|
@@ -1139,7 +1347,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
1139
1347
|
children: cellLayer
|
|
1140
1348
|
}) : cellLayer,
|
|
1141
1349
|
days.map((day, dayIndex) => {
|
|
1142
|
-
if (!(0, _super_calendar_core.isWeekend)(day)) return null;
|
|
1350
|
+
if (!highlightWeekends || !(0, _super_calendar_core.isWeekend)(day)) return null;
|
|
1143
1351
|
const shadeSlot = slot("weekendShade", {
|
|
1144
1352
|
base: [
|
|
1145
1353
|
styles$1.weekendColumn,
|
|
@@ -1152,6 +1360,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
1152
1360
|
themed: { backgroundColor: theme.colors.weekendBackground }
|
|
1153
1361
|
});
|
|
1154
1362
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
1363
|
+
testID: "weekend-shade",
|
|
1155
1364
|
...shadeSlot,
|
|
1156
1365
|
style: [shadeSlot.style, fullHeightStyle]
|
|
1157
1366
|
}, `weekend-${day.toISOString()}`);
|
|
@@ -1176,8 +1385,28 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
1176
1385
|
minHour,
|
|
1177
1386
|
left: dayLeft(dayIndex),
|
|
1178
1387
|
width: dayWidth,
|
|
1179
|
-
color: theme.colors.outsideHoursBackground
|
|
1388
|
+
color: renderBusinessHours ? void 0 : theme.colors.outsideHoursBackground,
|
|
1389
|
+
children: renderBusinessHours?.({
|
|
1390
|
+
date: day,
|
|
1391
|
+
start: band.start,
|
|
1392
|
+
end: band.end
|
|
1393
|
+
})
|
|
1180
1394
|
}, `closed-${day.toISOString()}-${bandIndex}`))) : null,
|
|
1395
|
+
days.flatMap((day, dayIndex) => (0, _super_calendar_core.backgroundBandsForDay)(events, day).map((b) => ({
|
|
1396
|
+
...b,
|
|
1397
|
+
startHours: Math.max(b.startHours, minHour),
|
|
1398
|
+
endHours: Math.min(b.endHours, maxHour)
|
|
1399
|
+
})).filter((b) => b.endHours > b.startHours).map((b, bandIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShadeBand, {
|
|
1400
|
+
cellHeight: heightSource,
|
|
1401
|
+
startHour: b.startHours,
|
|
1402
|
+
endHour: b.endHours,
|
|
1403
|
+
minHour,
|
|
1404
|
+
left: dayLeft(dayIndex),
|
|
1405
|
+
width: dayWidth,
|
|
1406
|
+
color: theme.colors.backgroundEvent,
|
|
1407
|
+
slotName: "backgroundEvent",
|
|
1408
|
+
testID: "background-event-shade"
|
|
1409
|
+
}, `bg-${day.toISOString()}-${bandIndex}`))),
|
|
1181
1410
|
days.map((day, dayIndex) => {
|
|
1182
1411
|
const separatorSlot = slot("daySeparator", {
|
|
1183
1412
|
base: [
|
|
@@ -1219,14 +1448,19 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
1219
1448
|
dayWidth,
|
|
1220
1449
|
dayIndex,
|
|
1221
1450
|
dayCount: days.length,
|
|
1451
|
+
dayOrdinals,
|
|
1222
1452
|
mode,
|
|
1453
|
+
daysPerPage,
|
|
1223
1454
|
renderEvent,
|
|
1224
1455
|
snapMinutes,
|
|
1225
1456
|
showDragHandle,
|
|
1457
|
+
eventStartEditable,
|
|
1458
|
+
eventDurationEditable,
|
|
1226
1459
|
onPress: onPressEvent,
|
|
1227
1460
|
onLongPress: onLongPressEvent,
|
|
1228
1461
|
onDragEvent,
|
|
1229
|
-
onDragStart
|
|
1462
|
+
onDragStart,
|
|
1463
|
+
onEdgeAdvance
|
|
1230
1464
|
}, `${dayIndex}:${keyExtractor(positioned.event, eventIndex)}`);
|
|
1231
1465
|
})),
|
|
1232
1466
|
showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NowIndicator, {
|
|
@@ -1248,7 +1482,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
1248
1482
|
});
|
|
1249
1483
|
}
|
|
1250
1484
|
const TimetablePage = (0, react.memo)(TimetablePageInner);
|
|
1251
|
-
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, calendarCellStyle, businessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
1485
|
+
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
1252
1486
|
const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
|
|
1253
1487
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
1254
1488
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
@@ -1257,8 +1491,17 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1257
1491
|
eventAccessibilityLabel,
|
|
1258
1492
|
ampm
|
|
1259
1493
|
]);
|
|
1494
|
+
const onDragEvent = (0, react.useMemo)(() => {
|
|
1495
|
+
if (!onDragEventProp || eventOverlap !== false) return onDragEventProp;
|
|
1496
|
+
return (event, start, end) => (0, _super_calendar_core.overlapsOtherEvents)(events, event, start, end) ? false : onDragEventProp(event, start, end);
|
|
1497
|
+
}, [
|
|
1498
|
+
onDragEventProp,
|
|
1499
|
+
eventOverlap,
|
|
1500
|
+
events
|
|
1501
|
+
]);
|
|
1260
1502
|
const { width, height } = (0, react_native.useWindowDimensions)();
|
|
1261
1503
|
const listRef = (0, react.useRef)(null);
|
|
1504
|
+
const pagerRef = (0, react.useRef)(null);
|
|
1262
1505
|
const containerRef = (0, react.useRef)(null);
|
|
1263
1506
|
const suppressCaptureUntilRef = (0, react.useRef)(0);
|
|
1264
1507
|
const [pageHeight, setPageHeight] = (0, react.useState)(height);
|
|
@@ -1268,6 +1511,84 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1268
1511
|
const step = weekAnchored ? 7 : (0, _super_calendar_core.viewDayCount)(mode, numberOfDays);
|
|
1269
1512
|
const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR$1 - clampedMinHour) * hourHeight;
|
|
1270
1513
|
const scrollY = (0, react_native_reanimated.useSharedValue)(seedDefaultY);
|
|
1514
|
+
const pagerLeft = (0, react_native_reanimated.useSharedValue)(0);
|
|
1515
|
+
const pagerTop = (0, react_native_reanimated.useSharedValue)(0);
|
|
1516
|
+
const pagerWidth = (0, react_native_reanimated.useSharedValue)(width);
|
|
1517
|
+
const [edgePagingLock, setEdgePagingLock] = (0, react.useState)(false);
|
|
1518
|
+
const ghostX = (0, react_native_reanimated.useSharedValue)(0);
|
|
1519
|
+
const ghostY = (0, react_native_reanimated.useSharedValue)(0);
|
|
1520
|
+
const ghostW = (0, react_native_reanimated.useSharedValue)(0);
|
|
1521
|
+
const ghostH = (0, react_native_reanimated.useSharedValue)(0);
|
|
1522
|
+
const ghostVisible = (0, react_native_reanimated.useSharedValue)(0);
|
|
1523
|
+
const gridTop = (0, react_native_reanimated.useSharedValue)(0);
|
|
1524
|
+
const [liftedEvent, setLiftedEvent] = (0, react.useState)(null);
|
|
1525
|
+
const liftedEventRef = (0, react.useRef)(null);
|
|
1526
|
+
const dropRef = (0, react.useRef)({
|
|
1527
|
+
headerDays: [],
|
|
1528
|
+
containerWidth,
|
|
1529
|
+
hourColumnWidth,
|
|
1530
|
+
minHour: clampedMinHour,
|
|
1531
|
+
snapMinutes: Math.max(1, dragStepMinutes),
|
|
1532
|
+
onDragEvent,
|
|
1533
|
+
onChangeDate
|
|
1534
|
+
});
|
|
1535
|
+
const beginLift = (0, react.useCallback)((event) => {
|
|
1536
|
+
liftedEventRef.current = event;
|
|
1537
|
+
setLiftedEvent(event);
|
|
1538
|
+
}, []);
|
|
1539
|
+
const clearLift = (0, react.useCallback)(() => {
|
|
1540
|
+
ghostVisible.value = 0;
|
|
1541
|
+
liftedEventRef.current = null;
|
|
1542
|
+
setLiftedEvent(null);
|
|
1543
|
+
setEdgePagingLock(false);
|
|
1544
|
+
}, [ghostVisible]);
|
|
1545
|
+
const commitLiftedDrop = (0, react.useCallback)((ghostLocalX, ghostLocalY) => {
|
|
1546
|
+
const { headerDays: days, containerWidth: cw, hourColumnWidth: hcw, minHour: min, snapMinutes: snap, onDragEvent: onDrag, onChangeDate: onDate } = dropRef.current;
|
|
1547
|
+
const ev = liftedEventRef.current;
|
|
1548
|
+
const duration = ev ? ev.end.getTime() - ev.start.getTime() : 0;
|
|
1549
|
+
clearLift();
|
|
1550
|
+
if (!ev || !onDrag || days.length === 0) return;
|
|
1551
|
+
const dayWidth = (cw - hcw) / days.length;
|
|
1552
|
+
const col = Math.min(Math.max(Math.floor((ghostLocalX - hcw) / dayWidth), 0), days.length - 1);
|
|
1553
|
+
const rawMinutes = (min + (ghostLocalY - gridTop.value - HOUR_LABEL_TOP_INSET + scrollY.value) / cellHeight.value) * MINUTES_PER_HOUR$1;
|
|
1554
|
+
const minutes = Math.round(rawMinutes / snap) * snap;
|
|
1555
|
+
const start = new Date(days[col]);
|
|
1556
|
+
start.setHours(0, 0, 0, 0);
|
|
1557
|
+
start.setMinutes(minutes);
|
|
1558
|
+
if (onDrag(ev, start, new Date(start.getTime() + duration)) === false) onDate(ev.start);
|
|
1559
|
+
}, [
|
|
1560
|
+
clearLift,
|
|
1561
|
+
gridTop,
|
|
1562
|
+
scrollY,
|
|
1563
|
+
cellHeight
|
|
1564
|
+
]);
|
|
1565
|
+
const handleGridTop = (0, react.useCallback)((y) => {
|
|
1566
|
+
gridTop.value = y;
|
|
1567
|
+
}, [gridTop]);
|
|
1568
|
+
const edgePaging = (0, react.useMemo)(() => ({
|
|
1569
|
+
pagerLeft,
|
|
1570
|
+
pagerTop,
|
|
1571
|
+
pagerWidth,
|
|
1572
|
+
lockScroll: setEdgePagingLock,
|
|
1573
|
+
ghostX,
|
|
1574
|
+
ghostY,
|
|
1575
|
+
ghostW,
|
|
1576
|
+
ghostH,
|
|
1577
|
+
ghostVisible,
|
|
1578
|
+
beginLift,
|
|
1579
|
+
commitLiftedDrop
|
|
1580
|
+
}), [
|
|
1581
|
+
pagerLeft,
|
|
1582
|
+
pagerTop,
|
|
1583
|
+
pagerWidth,
|
|
1584
|
+
ghostX,
|
|
1585
|
+
ghostY,
|
|
1586
|
+
ghostW,
|
|
1587
|
+
ghostH,
|
|
1588
|
+
ghostVisible,
|
|
1589
|
+
beginLift,
|
|
1590
|
+
commitLiftedDrop
|
|
1591
|
+
]);
|
|
1271
1592
|
const offsetSeedRef = (0, react.useRef)(null);
|
|
1272
1593
|
const captureOffsetSeed = (0, react.useCallback)((y) => {
|
|
1273
1594
|
offsetSeedRef.current = y;
|
|
@@ -1292,7 +1613,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1292
1613
|
])(date);
|
|
1293
1614
|
const viewedIndexRef = (0, react.useRef)(activeIndex);
|
|
1294
1615
|
const pendingScrollIndexRef = (0, react.useRef)(null);
|
|
1295
|
-
const headerDays = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn), [
|
|
1616
|
+
const headerDays = (0, react.useMemo)(() => (0, _super_calendar_core.getViewDays)(mode, pageDates[activeIndex] ?? date, weekStartsOn, numberOfDays, isRTL, weekEndsOn, hiddenDays), [
|
|
1296
1617
|
mode,
|
|
1297
1618
|
pageDates,
|
|
1298
1619
|
activeIndex,
|
|
@@ -1300,8 +1621,18 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1300
1621
|
weekStartsOn,
|
|
1301
1622
|
numberOfDays,
|
|
1302
1623
|
isRTL,
|
|
1303
|
-
weekEndsOn
|
|
1624
|
+
weekEndsOn,
|
|
1625
|
+
hiddenDays
|
|
1304
1626
|
]);
|
|
1627
|
+
dropRef.current = {
|
|
1628
|
+
headerDays,
|
|
1629
|
+
containerWidth,
|
|
1630
|
+
hourColumnWidth,
|
|
1631
|
+
minHour: clampedMinHour,
|
|
1632
|
+
snapMinutes: Math.max(1, dragStepMinutes),
|
|
1633
|
+
onDragEvent,
|
|
1634
|
+
onChangeDate
|
|
1635
|
+
};
|
|
1305
1636
|
const handleViewableItemsChanged = (0, react.useCallback)((info) => {
|
|
1306
1637
|
if (isWeb$1) return;
|
|
1307
1638
|
const settled = info.viewableItems.find((token) => token.isViewable);
|
|
@@ -1387,14 +1718,15 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1387
1718
|
const raf = requestAnimationFrame(lockHorizontal);
|
|
1388
1719
|
return () => cancelAnimationFrame(raf);
|
|
1389
1720
|
}, [pageHeight]);
|
|
1390
|
-
|
|
1721
|
+
const goToPage = (0, react.useCallback)((delta) => {
|
|
1391
1722
|
const target = pageDates[activeIndex + delta];
|
|
1392
1723
|
if (target) onChangeDate(target);
|
|
1393
1724
|
}, [
|
|
1394
1725
|
pageDates,
|
|
1395
1726
|
activeIndex,
|
|
1396
1727
|
onChangeDate
|
|
1397
|
-
])
|
|
1728
|
+
]);
|
|
1729
|
+
require_MonthList.useWebPagerKeys(swipeEnabled, goToPage);
|
|
1398
1730
|
const reduceMotion = (0, react_native_reanimated.useReducedMotion)();
|
|
1399
1731
|
const handlePressCell = (0, react.useMemo)(() => {
|
|
1400
1732
|
if (!onPressCell) return void 0;
|
|
@@ -1423,6 +1755,9 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1423
1755
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimetablePage, {
|
|
1424
1756
|
mode,
|
|
1425
1757
|
numberOfDays,
|
|
1758
|
+
hiddenDays,
|
|
1759
|
+
now,
|
|
1760
|
+
nowTimeZone: timeZone,
|
|
1426
1761
|
date: item,
|
|
1427
1762
|
width: containerWidth,
|
|
1428
1763
|
events,
|
|
@@ -1442,11 +1777,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1442
1777
|
timeslots,
|
|
1443
1778
|
isRTL,
|
|
1444
1779
|
showAllDayEventCell,
|
|
1780
|
+
highlightWeekends,
|
|
1445
1781
|
showVerticalScrollIndicator,
|
|
1446
1782
|
verticalScrollEnabled,
|
|
1447
1783
|
hourComponent,
|
|
1448
1784
|
calendarCellStyle,
|
|
1449
1785
|
businessHours,
|
|
1786
|
+
renderBusinessHours,
|
|
1450
1787
|
minHourHeight,
|
|
1451
1788
|
maxHourHeight,
|
|
1452
1789
|
showNowIndicator,
|
|
@@ -1454,17 +1791,22 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1454
1791
|
keyExtractor,
|
|
1455
1792
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
1456
1793
|
showDragHandle,
|
|
1794
|
+
eventStartEditable,
|
|
1795
|
+
eventDurationEditable,
|
|
1457
1796
|
onPressEvent,
|
|
1458
1797
|
onLongPressEvent,
|
|
1459
1798
|
onDragEvent,
|
|
1460
1799
|
onDragStart,
|
|
1461
1800
|
onPressCell: handlePressCell,
|
|
1462
1801
|
onLongPressCell,
|
|
1463
|
-
onCreateEvent
|
|
1802
|
+
onCreateEvent,
|
|
1803
|
+
onEdgeAdvance: goToPage,
|
|
1804
|
+
onGridTop: handleGridTop
|
|
1464
1805
|
})
|
|
1465
1806
|
}), [
|
|
1466
1807
|
containerWidth,
|
|
1467
1808
|
pageHeight,
|
|
1809
|
+
handleGridTop,
|
|
1468
1810
|
mode,
|
|
1469
1811
|
numberOfDays,
|
|
1470
1812
|
events,
|
|
@@ -1484,6 +1826,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1484
1826
|
timeslots,
|
|
1485
1827
|
isRTL,
|
|
1486
1828
|
showAllDayEventCell,
|
|
1829
|
+
highlightWeekends,
|
|
1487
1830
|
showVerticalScrollIndicator,
|
|
1488
1831
|
verticalScrollEnabled,
|
|
1489
1832
|
hourComponent,
|
|
@@ -1496,13 +1839,19 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1496
1839
|
keyExtractor,
|
|
1497
1840
|
dragStepMinutes,
|
|
1498
1841
|
showDragHandle,
|
|
1842
|
+
eventStartEditable,
|
|
1843
|
+
eventDurationEditable,
|
|
1499
1844
|
onPressEvent,
|
|
1500
1845
|
onLongPressEvent,
|
|
1501
1846
|
onDragEvent,
|
|
1502
1847
|
onDragStart,
|
|
1503
1848
|
handlePressCell,
|
|
1504
1849
|
onLongPressCell,
|
|
1505
|
-
onCreateEvent
|
|
1850
|
+
onCreateEvent,
|
|
1851
|
+
goToPage,
|
|
1852
|
+
hiddenDays,
|
|
1853
|
+
now,
|
|
1854
|
+
timeZone
|
|
1506
1855
|
]);
|
|
1507
1856
|
const listExtraData = (0, react.useMemo)(() => ({
|
|
1508
1857
|
events,
|
|
@@ -1511,52 +1860,70 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1511
1860
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.SlotStylesProvider, {
|
|
1512
1861
|
classNames,
|
|
1513
1862
|
styles: styleOverrides,
|
|
1514
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
keyExtractor: keyExtractorList,
|
|
1546
|
-
getFixedItemSize,
|
|
1547
|
-
...isWeb$1 ? null : {
|
|
1548
|
-
scrollEnabled: swipeEnabled,
|
|
1549
|
-
pagingEnabled: !freeSwipe,
|
|
1550
|
-
snapToIndices: freeSwipe ? snapToIndices : void 0
|
|
1863
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EdgePagingContext.Provider, {
|
|
1864
|
+
value: edgePaging,
|
|
1865
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1866
|
+
ref: containerRef,
|
|
1867
|
+
style: styles$1.container,
|
|
1868
|
+
children: [
|
|
1869
|
+
renderHeader ? renderHeader(headerDays) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultHeader, {
|
|
1870
|
+
days: headerDays,
|
|
1871
|
+
mode,
|
|
1872
|
+
width: containerWidth,
|
|
1873
|
+
hourColumnWidth,
|
|
1874
|
+
showWeekNumber,
|
|
1875
|
+
weekNumberPrefix,
|
|
1876
|
+
weekdayFormat,
|
|
1877
|
+
locale,
|
|
1878
|
+
activeDate,
|
|
1879
|
+
onPressDateHeader
|
|
1880
|
+
}),
|
|
1881
|
+
headerComponent,
|
|
1882
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1883
|
+
ref: pagerRef,
|
|
1884
|
+
style: styles$1.pager,
|
|
1885
|
+
onLayout: (event) => {
|
|
1886
|
+
setPageHeight(event.nativeEvent.layout.height);
|
|
1887
|
+
setContainerWidth(event.nativeEvent.layout.width);
|
|
1888
|
+
setMeasured(true);
|
|
1889
|
+
pagerRef.current?.measureInWindow((x, y, w) => {
|
|
1890
|
+
pagerLeft.value = x;
|
|
1891
|
+
pagerTop.value = y;
|
|
1892
|
+
pagerWidth.value = w;
|
|
1893
|
+
});
|
|
1551
1894
|
},
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1895
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_legendapp_list_react_native.LegendList, {
|
|
1896
|
+
ref: listRef,
|
|
1897
|
+
style: isWeb$1 ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
|
|
1898
|
+
data: pageDates,
|
|
1899
|
+
extraData: listExtraData,
|
|
1900
|
+
horizontal: true,
|
|
1901
|
+
recycleItems: false,
|
|
1902
|
+
keyExtractor: keyExtractorList,
|
|
1903
|
+
getFixedItemSize,
|
|
1904
|
+
...isWeb$1 ? null : {
|
|
1905
|
+
scrollEnabled: swipeEnabled && !edgePagingLock,
|
|
1906
|
+
pagingEnabled: !freeSwipe,
|
|
1907
|
+
snapToIndices: freeSwipe ? snapToIndices : void 0
|
|
1908
|
+
},
|
|
1909
|
+
initialScrollIndex: activeIndex,
|
|
1910
|
+
showsHorizontalScrollIndicator: false,
|
|
1911
|
+
viewabilityConfig: PAGE_VIEWABILITY,
|
|
1912
|
+
onViewableItemsChanged: handleViewableItemsChanged,
|
|
1913
|
+
renderItem
|
|
1914
|
+
}, measured ? "grid" : "grid-seed"), liftedEvent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DragGhost, {
|
|
1915
|
+
x: ghostX,
|
|
1916
|
+
y: ghostY,
|
|
1917
|
+
w: ghostW,
|
|
1918
|
+
h: ghostH,
|
|
1919
|
+
visible: ghostVisible,
|
|
1920
|
+
event: liftedEvent,
|
|
1921
|
+
mode,
|
|
1922
|
+
renderEvent: labeledRenderEvent
|
|
1923
|
+
}) : null]
|
|
1924
|
+
})
|
|
1925
|
+
]
|
|
1926
|
+
})
|
|
1560
1927
|
})
|
|
1561
1928
|
});
|
|
1562
1929
|
}
|
|
@@ -1729,6 +2096,15 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
1729
2096
|
alignItems: "center",
|
|
1730
2097
|
justifyContent: "center"
|
|
1731
2098
|
},
|
|
2099
|
+
resizeHandleTop: {
|
|
2100
|
+
position: "absolute",
|
|
2101
|
+
left: 0,
|
|
2102
|
+
right: 0,
|
|
2103
|
+
top: 0,
|
|
2104
|
+
height: RESIZE_HANDLE_HEIGHT,
|
|
2105
|
+
alignItems: "center",
|
|
2106
|
+
justifyContent: "center"
|
|
2107
|
+
},
|
|
1732
2108
|
resizeGrip: {
|
|
1733
2109
|
width: 24,
|
|
1734
2110
|
height: 3,
|
|
@@ -1740,6 +2116,11 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
1740
2116
|
overflow: "hidden",
|
|
1741
2117
|
padding: EVENT_GAP
|
|
1742
2118
|
},
|
|
2119
|
+
dragGhost: {
|
|
2120
|
+
top: 0,
|
|
2121
|
+
left: 0,
|
|
2122
|
+
zIndex: 101
|
|
2123
|
+
},
|
|
1743
2124
|
nowIndicator: {
|
|
1744
2125
|
position: "absolute",
|
|
1745
2126
|
height: 2
|
|
@@ -1790,7 +2171,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
1790
2171
|
* }
|
|
1791
2172
|
* ```
|
|
1792
2173
|
*/
|
|
1793
|
-
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2174
|
+
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
1794
2175
|
const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
|
|
1795
2176
|
const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
1796
2177
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -1867,6 +2248,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1867
2248
|
events: displayEvents,
|
|
1868
2249
|
maxVisibleEventCount,
|
|
1869
2250
|
weekStartsOn,
|
|
2251
|
+
hiddenDays,
|
|
1870
2252
|
weekdayFormat,
|
|
1871
2253
|
locale,
|
|
1872
2254
|
sortedMonthView,
|
|
@@ -1895,6 +2277,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1895
2277
|
date,
|
|
1896
2278
|
events: displayEvents,
|
|
1897
2279
|
weekStartsOn,
|
|
2280
|
+
hiddenDays,
|
|
1898
2281
|
locale,
|
|
1899
2282
|
activeDate,
|
|
1900
2283
|
onPressDay,
|
|
@@ -1923,6 +2306,9 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1923
2306
|
hourHeight,
|
|
1924
2307
|
weekStartsOn,
|
|
1925
2308
|
weekdayFormat,
|
|
2309
|
+
hiddenDays,
|
|
2310
|
+
now,
|
|
2311
|
+
timeZone,
|
|
1926
2312
|
renderEvent: resolvedRenderEvent,
|
|
1927
2313
|
keyExtractor,
|
|
1928
2314
|
scrollOffsetMinutes,
|
|
@@ -1930,8 +2316,13 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1930
2316
|
hideHours,
|
|
1931
2317
|
timeslots,
|
|
1932
2318
|
showAllDayEventCell,
|
|
2319
|
+
highlightWeekends,
|
|
2320
|
+
eventStartEditable,
|
|
2321
|
+
eventDurationEditable,
|
|
2322
|
+
eventOverlap,
|
|
1933
2323
|
calendarCellStyle,
|
|
1934
2324
|
businessHours,
|
|
2325
|
+
renderBusinessHours,
|
|
1935
2326
|
showWeekNumber,
|
|
1936
2327
|
weekNumberPrefix,
|
|
1937
2328
|
hourComponent,
|
|
@@ -2005,41 +2396,60 @@ function DefaultBar({ event, width, height }) {
|
|
|
2005
2396
|
}) : null]
|
|
2006
2397
|
});
|
|
2007
2398
|
}
|
|
2008
|
-
function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendererSize, snapMinutes, Renderer, onPress, onLongPress, onDragEvent, theme }) {
|
|
2399
|
+
function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendererSize, snapMinutes, Renderer, onPress, onLongPress, onDragEvent, resources, laneIndex, laneSize, dragActive, onDragActiveChange, theme }) {
|
|
2009
2400
|
const moveX = (0, react_native_reanimated.useSharedValue)(0);
|
|
2401
|
+
const moveCross = (0, react_native_reanimated.useSharedValue)(0);
|
|
2010
2402
|
const resizeW = (0, react_native_reanimated.useSharedValue)(0);
|
|
2011
2403
|
const latest = (0, react.useRef)({
|
|
2012
2404
|
event: pe.event,
|
|
2013
|
-
onDragEvent
|
|
2405
|
+
onDragEvent,
|
|
2406
|
+
resources,
|
|
2407
|
+
laneIndex
|
|
2014
2408
|
});
|
|
2015
2409
|
latest.current = {
|
|
2016
2410
|
event: pe.event,
|
|
2017
|
-
onDragEvent
|
|
2411
|
+
onDragEvent,
|
|
2412
|
+
resources,
|
|
2413
|
+
laneIndex
|
|
2018
2414
|
};
|
|
2019
|
-
const
|
|
2415
|
+
const laneCount = resources.length;
|
|
2416
|
+
const draggable = !pe.event.disabled && pe.event.draggable !== false;
|
|
2020
2417
|
(0, react.useEffect)(() => {
|
|
2418
|
+
if (dragActive) return;
|
|
2021
2419
|
moveX.value = 0;
|
|
2420
|
+
moveCross.value = 0;
|
|
2022
2421
|
resizeW.value = 0;
|
|
2023
2422
|
}, [
|
|
2423
|
+
dragActive,
|
|
2024
2424
|
pe.startHours,
|
|
2025
2425
|
pe.durationHours,
|
|
2026
2426
|
moveX,
|
|
2427
|
+
moveCross,
|
|
2027
2428
|
resizeW
|
|
2028
2429
|
]);
|
|
2029
2430
|
const snapBack = (0, react.useCallback)(() => {
|
|
2030
2431
|
moveX.value = 0;
|
|
2432
|
+
moveCross.value = 0;
|
|
2031
2433
|
resizeW.value = 0;
|
|
2032
|
-
}, [
|
|
2033
|
-
|
|
2034
|
-
|
|
2434
|
+
}, [
|
|
2435
|
+
moveX,
|
|
2436
|
+
moveCross,
|
|
2437
|
+
resizeW
|
|
2438
|
+
]);
|
|
2439
|
+
const commit = (0, react.useCallback)((deltaStartMin, deltaEndMin, laneDelta = 0) => {
|
|
2440
|
+
const { event, onDragEvent: handler, resources: lanes, laneIndex: lane } = latest.current;
|
|
2035
2441
|
const next = (0, _super_calendar_core.resolveDraggedBounds)(event.start, event.end, deltaStartMin, deltaEndMin, snapMinutes);
|
|
2036
|
-
|
|
2442
|
+
const target = lanes[Math.min(Math.max(lane + laneDelta, 0), lanes.length - 1)];
|
|
2443
|
+
if (!next || !target) {
|
|
2037
2444
|
snapBack();
|
|
2038
2445
|
return;
|
|
2039
2446
|
}
|
|
2040
|
-
if (handler(event, next.start, next.end) === false) snapBack();
|
|
2447
|
+
if (handler(event, next.start, next.end, target) === false) snapBack();
|
|
2041
2448
|
}, [snapMinutes, snapBack]);
|
|
2042
2449
|
const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
|
|
2450
|
+
const laneTitle = (lane) => lane && (lane.title || lane.id);
|
|
2451
|
+
const nextLane = laneTitle(resources[laneIndex + 1]);
|
|
2452
|
+
const previousLane = laneTitle(resources[laneIndex - 1]);
|
|
2043
2453
|
const barActions = draggable ? [
|
|
2044
2454
|
{
|
|
2045
2455
|
name: "move-later",
|
|
@@ -2056,7 +2466,15 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
|
|
|
2056
2466
|
{
|
|
2057
2467
|
name: "shrink",
|
|
2058
2468
|
label: `Shorten by ${unit(snapMinutes)}`
|
|
2059
|
-
}
|
|
2469
|
+
},
|
|
2470
|
+
...nextLane ? [{
|
|
2471
|
+
name: "move-next-lane",
|
|
2472
|
+
label: `Move to ${nextLane}`
|
|
2473
|
+
}] : [],
|
|
2474
|
+
...previousLane ? [{
|
|
2475
|
+
name: "move-previous-lane",
|
|
2476
|
+
label: `Move to ${previousLane}`
|
|
2477
|
+
}] : []
|
|
2060
2478
|
] : void 0;
|
|
2061
2479
|
const onBarAction = draggable ? (e) => {
|
|
2062
2480
|
switch (e.nativeEvent.actionName) {
|
|
@@ -2072,36 +2490,61 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
|
|
|
2072
2490
|
case "shrink":
|
|
2073
2491
|
commit(0, -snapMinutes);
|
|
2074
2492
|
break;
|
|
2493
|
+
case "move-next-lane":
|
|
2494
|
+
commit(0, 0, 1);
|
|
2495
|
+
break;
|
|
2496
|
+
case "move-previous-lane":
|
|
2497
|
+
commit(0, 0, -1);
|
|
2498
|
+
break;
|
|
2075
2499
|
}
|
|
2076
2500
|
} : void 0;
|
|
2077
2501
|
const barStyle = (0, react_native_reanimated.useAnimatedStyle)(() => vertical ? {
|
|
2078
|
-
transform: [{ translateY: moveX.value }],
|
|
2502
|
+
transform: [{ translateY: moveX.value }, { translateX: moveCross.value }],
|
|
2079
2503
|
height: Math.max(height + resizeW.value, 2)
|
|
2080
2504
|
} : {
|
|
2081
|
-
transform: [{ translateX: moveX.value }],
|
|
2505
|
+
transform: [{ translateX: moveX.value }, { translateY: moveCross.value }],
|
|
2082
2506
|
width: Math.max(width + resizeW.value, 2)
|
|
2083
2507
|
}, [
|
|
2084
2508
|
vertical,
|
|
2085
2509
|
width,
|
|
2086
2510
|
height
|
|
2087
2511
|
]);
|
|
2088
|
-
const
|
|
2512
|
+
const laneId = resources[laneIndex]?.id ?? "";
|
|
2513
|
+
const moveGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(draggable).activateAfterLongPress(MOVE_ACTIVATE_MS).onStart(() => {
|
|
2514
|
+
(0, react_native_reanimated.runOnJS)(onDragActiveChange)(laneId);
|
|
2515
|
+
}).onUpdate((e) => {
|
|
2089
2516
|
moveX.value = vertical ? e.translationY : e.translationX;
|
|
2517
|
+
if (laneSize > 0 && laneCount > 1) {
|
|
2518
|
+
const cross = vertical ? e.translationX : e.translationY;
|
|
2519
|
+
moveCross.value = Math.min(Math.max(cross, -laneIndex * laneSize), (laneCount - 1 - laneIndex) * laneSize);
|
|
2520
|
+
}
|
|
2090
2521
|
}).onEnd((e) => {
|
|
2091
2522
|
const delta = (0, _super_calendar_core.snapDeltaMinutes)(vertical ? e.translationY : e.translationX, hourSize, snapMinutes);
|
|
2092
|
-
|
|
2523
|
+
const cross = laneSize > 0 ? vertical ? e.translationX : e.translationY : 0;
|
|
2524
|
+
const laneDelta = laneSize > 0 ? Math.min(Math.max(Math.round(cross / laneSize), -laneIndex), laneCount - 1 - laneIndex) : 0;
|
|
2525
|
+
if (delta === 0 && laneDelta === 0) {
|
|
2093
2526
|
moveX.value = 0;
|
|
2527
|
+
moveCross.value = 0;
|
|
2094
2528
|
return;
|
|
2095
2529
|
}
|
|
2096
2530
|
moveX.value = delta / MINUTES_PER_HOUR * hourSize;
|
|
2097
|
-
|
|
2531
|
+
moveCross.value = laneDelta * laneSize;
|
|
2532
|
+
(0, react_native_reanimated.runOnJS)(commit)(delta, delta, laneDelta);
|
|
2533
|
+
}).onFinalize(() => {
|
|
2534
|
+
(0, react_native_reanimated.runOnJS)(onDragActiveChange)(null);
|
|
2098
2535
|
}), [
|
|
2099
2536
|
draggable,
|
|
2100
2537
|
vertical,
|
|
2101
2538
|
hourSize,
|
|
2102
2539
|
snapMinutes,
|
|
2540
|
+
laneSize,
|
|
2541
|
+
laneCount,
|
|
2542
|
+
laneIndex,
|
|
2543
|
+
laneId,
|
|
2103
2544
|
moveX,
|
|
2104
|
-
|
|
2545
|
+
moveCross,
|
|
2546
|
+
commit,
|
|
2547
|
+
onDragActiveChange
|
|
2105
2548
|
]);
|
|
2106
2549
|
const resizeGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(draggable).onUpdate((e) => {
|
|
2107
2550
|
resizeW.value = vertical ? e.translationY : e.translationX;
|
|
@@ -2287,11 +2730,57 @@ function LaneInteractionLayer({ resource, vertical, hourSize, startHour, date, s
|
|
|
2287
2730
|
* />
|
|
2288
2731
|
* ```
|
|
2289
2732
|
*/
|
|
2290
|
-
function ResourceTimeline({ date, orientation = "horizontal", resources, events, resourceId = (event) => event.resourceId, startHour = 0, endHour = 24, hourWidth = 80, hourHeight = 48, rowHeight = 56, labelWidth = 140, ampm = false, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, dragStepMinutes = 15 }) {
|
|
2733
|
+
function ResourceTimeline({ date, orientation = "horizontal", resources: allResources, resourcesPerPage, resourcePage = 0, events, resourceId = (event) => event.resourceId, startHour = 0, endHour = 24, hourWidth = 80, hourHeight = 48, rowHeight = 56, labelWidth = 140, ampm = false, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes = 15, showNowIndicator = true, now: nowProp, timeZone }) {
|
|
2291
2734
|
const theme = require_MonthList.useCalendarTheme();
|
|
2735
|
+
const resources = (0, react.useMemo)(() => {
|
|
2736
|
+
if (!resourcesPerPage || resourcesPerPage <= 0) return allResources;
|
|
2737
|
+
const pages = Math.max(1, Math.ceil(allResources.length / resourcesPerPage));
|
|
2738
|
+
const page = Math.min(Math.max(resourcePage, 0), pages - 1);
|
|
2739
|
+
return allResources.slice(page * resourcesPerPage, (page + 1) * resourcesPerPage);
|
|
2740
|
+
}, [
|
|
2741
|
+
allResources,
|
|
2742
|
+
resourcesPerPage,
|
|
2743
|
+
resourcePage
|
|
2744
|
+
]);
|
|
2745
|
+
const [dragLaneId, setDragLaneId] = (0, react.useState)(null);
|
|
2746
|
+
const [vBodyWidth, setVBodyWidth] = (0, react.useState)(0);
|
|
2747
|
+
const vLaneSize = resources.length > 0 && vBodyWidth > GUTTER_WIDTH ? (vBodyWidth - GUTTER_WIDTH) / resources.length : 0;
|
|
2292
2748
|
const Renderer = renderEvent ?? DefaultBar;
|
|
2293
2749
|
const cellEnabled = !!onPressCell || !!onLongPressCell || !!onCreateEvent;
|
|
2750
|
+
const now = (0, _super_calendar_core.useNow)(showNowIndicator, {
|
|
2751
|
+
now: nowProp,
|
|
2752
|
+
timeZone
|
|
2753
|
+
});
|
|
2754
|
+
const nowHours = now.getHours() + now.getMinutes() / 60;
|
|
2755
|
+
const showNow = showNowIndicator && (0, _super_calendar_core.isSameCalendarDay)(now, date) && nowHours >= startHour && nowHours <= endHour;
|
|
2756
|
+
const nowLine = (vertical, hourSize) => showNow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2757
|
+
pointerEvents: "none",
|
|
2758
|
+
testID: "resource-now-indicator",
|
|
2759
|
+
style: [
|
|
2760
|
+
vertical ? {
|
|
2761
|
+
position: "absolute",
|
|
2762
|
+
left: 0,
|
|
2763
|
+
right: 0,
|
|
2764
|
+
height: 2
|
|
2765
|
+
} : {
|
|
2766
|
+
position: "absolute",
|
|
2767
|
+
top: 0,
|
|
2768
|
+
bottom: 0,
|
|
2769
|
+
width: 2
|
|
2770
|
+
},
|
|
2771
|
+
vertical ? { top: (nowHours - startHour) * hourSize } : { left: (nowHours - startHour) * hourSize },
|
|
2772
|
+
{
|
|
2773
|
+
backgroundColor: theme.colors.nowIndicator,
|
|
2774
|
+
zIndex: 2
|
|
2775
|
+
}
|
|
2776
|
+
]
|
|
2777
|
+
}) : null;
|
|
2294
2778
|
const bandsFor = (resource) => businessHours ? (0, _super_calendar_core.closedHourBands)(date, (d) => businessHours(d, resource), startHour, endHour) : [];
|
|
2779
|
+
const backgroundBandsFor = (resource) => (0, _super_calendar_core.backgroundBandsForDay)(events.filter((event) => resourceId(event) === resource.id), date).map((b) => ({
|
|
2780
|
+
...b,
|
|
2781
|
+
startHours: Math.max(b.startHours, startHour),
|
|
2782
|
+
endHours: Math.min(b.endHours, endHour)
|
|
2783
|
+
})).filter((b) => b.endHours > b.startHours);
|
|
2295
2784
|
const hours = (0, react.useMemo)(() => Array.from({ length: Math.max(0, endHour - startHour) }, (_, i) => startHour + i), [startHour, endHour]);
|
|
2296
2785
|
const trackWidth = (endHour - startHour) * hourWidth;
|
|
2297
2786
|
const byResource = (0, react.useMemo)(() => {
|
|
@@ -2313,9 +2802,9 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2313
2802
|
style: styles.vroot,
|
|
2314
2803
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
2315
2804
|
style: [styles.header, { borderBottomColor: theme.colors.gridLine }],
|
|
2316
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: { width: GUTTER_WIDTH } }), resources.map((resource) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2805
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: { width: GUTTER_WIDTH } }), resources.map((resource, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2317
2806
|
style: [styles.vheaderCell, theme.containers.resourceLabel],
|
|
2318
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
2807
|
+
children: renderResourceHeader ? renderResourceHeader(resource, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
2319
2808
|
numberOfLines: 1,
|
|
2320
2809
|
style: [styles.vheaderText, { color: theme.colors.text }],
|
|
2321
2810
|
allowFontScaling: false,
|
|
@@ -2326,6 +2815,7 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2326
2815
|
showsVerticalScrollIndicator: true,
|
|
2327
2816
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
2328
2817
|
style: [styles.vbody, { height: trackHeight }],
|
|
2818
|
+
onLayout: (event) => setVBodyWidth(event.nativeEvent.layout.width),
|
|
2329
2819
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2330
2820
|
style: { width: GUTTER_WIDTH },
|
|
2331
2821
|
children: hours.map((h) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
@@ -2336,24 +2826,45 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2336
2826
|
}],
|
|
2337
2827
|
children: (0, _super_calendar_core.formatHour)(h, { ampm })
|
|
2338
2828
|
}, h))
|
|
2339
|
-
}), resources.map((resource) => {
|
|
2829
|
+
}), resources.map((resource, laneIndex) => {
|
|
2340
2830
|
const positioned = byResource.get(resource.id) ?? [];
|
|
2341
2831
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
2342
2832
|
style: [
|
|
2343
2833
|
styles.vcolumn,
|
|
2344
2834
|
{ borderLeftColor: theme.colors.gridLine },
|
|
2345
|
-
theme.containers.resourceRow
|
|
2835
|
+
theme.containers.resourceRow,
|
|
2836
|
+
dragLaneId === resource.id && styles.laneLifted
|
|
2346
2837
|
],
|
|
2347
2838
|
children: [
|
|
2348
2839
|
bandsFor(resource).map((b) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2349
2840
|
pointerEvents: "none",
|
|
2841
|
+
accessibilityElementsHidden: true,
|
|
2842
|
+
importantForAccessibility: "no-hide-descendants",
|
|
2350
2843
|
testID: "resource-hours-shade",
|
|
2844
|
+
style: [
|
|
2845
|
+
styles.vshadeBand,
|
|
2846
|
+
{
|
|
2847
|
+
top: (b.start - startHour) * hourHeight,
|
|
2848
|
+
height: (b.end - b.start) * hourHeight
|
|
2849
|
+
},
|
|
2850
|
+
renderBusinessHours ? null : { backgroundColor: theme.colors.outsideHoursBackground }
|
|
2851
|
+
],
|
|
2852
|
+
children: renderBusinessHours?.({
|
|
2853
|
+
date,
|
|
2854
|
+
start: b.start,
|
|
2855
|
+
end: b.end,
|
|
2856
|
+
resource
|
|
2857
|
+
})
|
|
2858
|
+
}, `shade-${b.start}`)),
|
|
2859
|
+
backgroundBandsFor(resource).map((b, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2860
|
+
pointerEvents: "none",
|
|
2861
|
+
testID: "background-event-shade",
|
|
2351
2862
|
style: [styles.vshadeBand, {
|
|
2352
|
-
top: (b.
|
|
2353
|
-
height: (b.
|
|
2354
|
-
backgroundColor: theme.colors.
|
|
2863
|
+
top: (b.startHours - startHour) * hourHeight,
|
|
2864
|
+
height: (b.endHours - b.startHours) * hourHeight,
|
|
2865
|
+
backgroundColor: theme.colors.backgroundEvent
|
|
2355
2866
|
}]
|
|
2356
|
-
}, `
|
|
2867
|
+
}, `bg-${i}`)),
|
|
2357
2868
|
hours.slice(1).map((h) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2358
2869
|
pointerEvents: "none",
|
|
2359
2870
|
style: [styles.vgridLine, {
|
|
@@ -2361,6 +2872,7 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2361
2872
|
backgroundColor: theme.colors.gridLine
|
|
2362
2873
|
}]
|
|
2363
2874
|
}, h)),
|
|
2875
|
+
nowLine(true, hourHeight),
|
|
2364
2876
|
cellEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LaneInteractionLayer, {
|
|
2365
2877
|
resource,
|
|
2366
2878
|
vertical: true,
|
|
@@ -2384,6 +2896,11 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2384
2896
|
if (onDragEvent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResourceBar, {
|
|
2385
2897
|
pe,
|
|
2386
2898
|
vertical: true,
|
|
2899
|
+
resources,
|
|
2900
|
+
laneIndex,
|
|
2901
|
+
laneSize: vLaneSize,
|
|
2902
|
+
dragActive: dragLaneId === resource.id,
|
|
2903
|
+
onDragActiveChange: setDragLaneId,
|
|
2387
2904
|
hourSize: hourHeight,
|
|
2388
2905
|
left,
|
|
2389
2906
|
top,
|
|
@@ -2450,7 +2967,7 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2450
2967
|
children: (0, _super_calendar_core.formatHour)(h, { ampm })
|
|
2451
2968
|
}, h))
|
|
2452
2969
|
})]
|
|
2453
|
-
}), resources.map((resource) => {
|
|
2970
|
+
}), resources.map((resource, laneIndex) => {
|
|
2454
2971
|
const positioned = byResource.get(resource.id) ?? [];
|
|
2455
2972
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
2456
2973
|
style: [
|
|
@@ -2459,7 +2976,8 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2459
2976
|
height: rowHeight,
|
|
2460
2977
|
borderBottomColor: theme.colors.gridLine
|
|
2461
2978
|
},
|
|
2462
|
-
theme.containers.resourceRow
|
|
2979
|
+
theme.containers.resourceRow,
|
|
2980
|
+
dragLaneId === resource.id && styles.laneLifted
|
|
2463
2981
|
],
|
|
2464
2982
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2465
2983
|
style: [
|
|
@@ -2470,7 +2988,7 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2470
2988
|
},
|
|
2471
2989
|
theme.containers.resourceLabel
|
|
2472
2990
|
],
|
|
2473
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
2991
|
+
children: renderResourceHeader ? renderResourceHeader(resource, laneIndex) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
2474
2992
|
numberOfLines: 1,
|
|
2475
2993
|
style: { color: theme.colors.text },
|
|
2476
2994
|
allowFontScaling: false,
|
|
@@ -2481,13 +2999,33 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2481
2999
|
children: [
|
|
2482
3000
|
bandsFor(resource).map((b) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2483
3001
|
pointerEvents: "none",
|
|
3002
|
+
accessibilityElementsHidden: true,
|
|
3003
|
+
importantForAccessibility: "no-hide-descendants",
|
|
2484
3004
|
testID: "resource-hours-shade",
|
|
3005
|
+
style: [
|
|
3006
|
+
styles.hshadeBand,
|
|
3007
|
+
{
|
|
3008
|
+
left: (b.start - startHour) * hourWidth,
|
|
3009
|
+
width: (b.end - b.start) * hourWidth
|
|
3010
|
+
},
|
|
3011
|
+
renderBusinessHours ? null : { backgroundColor: theme.colors.outsideHoursBackground }
|
|
3012
|
+
],
|
|
3013
|
+
children: renderBusinessHours?.({
|
|
3014
|
+
date,
|
|
3015
|
+
start: b.start,
|
|
3016
|
+
end: b.end,
|
|
3017
|
+
resource
|
|
3018
|
+
})
|
|
3019
|
+
}, `shade-${b.start}`)),
|
|
3020
|
+
backgroundBandsFor(resource).map((b, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
3021
|
+
pointerEvents: "none",
|
|
3022
|
+
testID: "background-event-shade",
|
|
2485
3023
|
style: [styles.hshadeBand, {
|
|
2486
|
-
left: (b.
|
|
2487
|
-
width: (b.
|
|
2488
|
-
backgroundColor: theme.colors.
|
|
3024
|
+
left: (b.startHours - startHour) * hourWidth,
|
|
3025
|
+
width: (b.endHours - b.startHours) * hourWidth,
|
|
3026
|
+
backgroundColor: theme.colors.backgroundEvent
|
|
2489
3027
|
}]
|
|
2490
|
-
}, `
|
|
3028
|
+
}, `bg-${i}`)),
|
|
2491
3029
|
hours.slice(1).map((h) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
2492
3030
|
pointerEvents: "none",
|
|
2493
3031
|
style: [styles.gridLine, {
|
|
@@ -2495,6 +3033,7 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2495
3033
|
backgroundColor: theme.colors.gridLine
|
|
2496
3034
|
}]
|
|
2497
3035
|
}, h)),
|
|
3036
|
+
nowLine(false, hourWidth),
|
|
2498
3037
|
cellEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LaneInteractionLayer, {
|
|
2499
3038
|
resource,
|
|
2500
3039
|
vertical: false,
|
|
@@ -2516,6 +3055,11 @@ function ResourceTimeline({ date, orientation = "horizontal", resources, events,
|
|
|
2516
3055
|
if (onDragEvent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResourceBar, {
|
|
2517
3056
|
pe,
|
|
2518
3057
|
vertical: false,
|
|
3058
|
+
resources,
|
|
3059
|
+
laneIndex,
|
|
3060
|
+
laneSize: rowHeight,
|
|
3061
|
+
dragActive: dragLaneId === resource.id,
|
|
3062
|
+
onDragActiveChange: setDragLaneId,
|
|
2519
3063
|
hourSize: hourWidth,
|
|
2520
3064
|
left,
|
|
2521
3065
|
top: pe.column * laneHeight,
|
|
@@ -2625,6 +3169,7 @@ const styles = react_native.StyleSheet.create({
|
|
|
2625
3169
|
fontWeight: "600"
|
|
2626
3170
|
},
|
|
2627
3171
|
vbody: { flexDirection: "row" },
|
|
3172
|
+
laneLifted: { zIndex: 10 },
|
|
2628
3173
|
vcolumn: {
|
|
2629
3174
|
flex: 1,
|
|
2630
3175
|
borderLeftWidth: react_native.StyleSheet.hairlineWidth
|
|
@@ -2682,6 +3227,12 @@ exports.MonthView = require_MonthList.MonthView;
|
|
|
2682
3227
|
exports.ResourceTimeline = ResourceTimeline;
|
|
2683
3228
|
exports.TimeGrid = TimeGrid;
|
|
2684
3229
|
exports.YearView = YearView;
|
|
3230
|
+
Object.defineProperty(exports, "backgroundBandsForDay", {
|
|
3231
|
+
enumerable: true,
|
|
3232
|
+
get: function() {
|
|
3233
|
+
return _super_calendar_core.backgroundBandsForDay;
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
2685
3236
|
Object.defineProperty(exports, "buildMonthGrid", {
|
|
2686
3237
|
enumerable: true,
|
|
2687
3238
|
get: function() {
|
|
@@ -2738,6 +3289,12 @@ Object.defineProperty(exports, "isAllDayEvent", {
|
|
|
2738
3289
|
return _super_calendar_core.isAllDayEvent;
|
|
2739
3290
|
}
|
|
2740
3291
|
});
|
|
3292
|
+
Object.defineProperty(exports, "isBackgroundEvent", {
|
|
3293
|
+
enumerable: true,
|
|
3294
|
+
get: function() {
|
|
3295
|
+
return _super_calendar_core.isBackgroundEvent;
|
|
3296
|
+
}
|
|
3297
|
+
});
|
|
2741
3298
|
Object.defineProperty(exports, "isDateSelectable", {
|
|
2742
3299
|
enumerable: true,
|
|
2743
3300
|
get: function() {
|
|
@@ -2774,6 +3331,12 @@ Object.defineProperty(exports, "layoutDayEvents", {
|
|
|
2774
3331
|
return _super_calendar_core.layoutDayEvents;
|
|
2775
3332
|
}
|
|
2776
3333
|
});
|
|
3334
|
+
Object.defineProperty(exports, "layoutMonthWeek", {
|
|
3335
|
+
enumerable: true,
|
|
3336
|
+
get: function() {
|
|
3337
|
+
return _super_calendar_core.layoutMonthWeek;
|
|
3338
|
+
}
|
|
3339
|
+
});
|
|
2777
3340
|
exports.mergeTheme = require_MonthList.mergeTheme;
|
|
2778
3341
|
Object.defineProperty(exports, "minutesIntoDay", {
|
|
2779
3342
|
enumerable: true,
|
|
@@ -2812,12 +3375,24 @@ Object.defineProperty(exports, "useDateRange", {
|
|
|
2812
3375
|
return _super_calendar_core.useDateRange;
|
|
2813
3376
|
}
|
|
2814
3377
|
});
|
|
3378
|
+
Object.defineProperty(exports, "useEventSource", {
|
|
3379
|
+
enumerable: true,
|
|
3380
|
+
get: function() {
|
|
3381
|
+
return _super_calendar_core.useEventSource;
|
|
3382
|
+
}
|
|
3383
|
+
});
|
|
2815
3384
|
Object.defineProperty(exports, "useMonthGrid", {
|
|
2816
3385
|
enumerable: true,
|
|
2817
3386
|
get: function() {
|
|
2818
3387
|
return _super_calendar_core.useMonthGrid;
|
|
2819
3388
|
}
|
|
2820
3389
|
});
|
|
3390
|
+
Object.defineProperty(exports, "useNow", {
|
|
3391
|
+
enumerable: true,
|
|
3392
|
+
get: function() {
|
|
3393
|
+
return _super_calendar_core.useNow;
|
|
3394
|
+
}
|
|
3395
|
+
});
|
|
2821
3396
|
Object.defineProperty(exports, "weekdayFormatToken", {
|
|
2822
3397
|
enumerable: true,
|
|
2823
3398
|
get: function() {
|