@super-calendar/native 2.10.0 → 2.11.1
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 +1 -1
- package/dist/{DefaultMonthEvent--9Jg6w-x.d.ts → DefaultMonthEvent-B9KzVzFa.d.mts} +11 -5
- package/dist/{DefaultMonthEvent-BlnKHaq2.d.mts → DefaultMonthEvent-DlIIWDzr.d.ts} +11 -5
- package/dist/{MonthList-CjKhzOJX.mjs → MonthList-B-UE37ZG.mjs} +166 -139
- package/dist/{MonthList-DNT1LJkk.js → MonthList-sGAZxQZ_.js} +176 -137
- package/dist/index.d.mts +67 -21
- package/dist/index.d.ts +67 -21
- package/dist/index.js +1121 -772
- package/dist/index.mjs +1117 -774
- 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 +3 -3
- package/src/components/Agenda.tsx +5 -1
- package/src/components/AllDayLane.tsx +36 -53
- package/src/components/Calendar.tsx +196 -149
- package/src/components/DefaultEvent.tsx +3 -0
- package/src/components/DefaultMonthEvent.tsx +3 -0
- package/src/components/MonthList.tsx +6 -0
- package/src/components/MonthPager.tsx +6 -0
- package/src/components/MonthView.tsx +195 -172
- package/src/components/MultiDayMovePreview.tsx +1 -3
- package/src/components/ResourceTimeline.tsx +18 -7
- package/src/components/TimeGrid.tsx +1409 -903
- package/src/components/YearView.tsx +22 -5
- package/src/index.tsx +1 -0
- package/src/utils/labels.ts +13 -0
|
@@ -2,6 +2,7 @@ import type { ReactElement } from "react";
|
|
|
2
2
|
import { StyleSheet, Text, TouchableOpacity } from "react-native";
|
|
3
3
|
import Animated, { useAnimatedStyle, useDerivedValue } from "react-native-reanimated";
|
|
4
4
|
import { useCalendarTheme } from "../theme";
|
|
5
|
+
import { useCalendarLabels } from "../utils/labels";
|
|
5
6
|
import type { RenderEventArgs } from "../types";
|
|
6
7
|
import {
|
|
7
8
|
eventAccessibilityLabel,
|
|
@@ -46,6 +47,7 @@ export function DefaultEvent<T>({
|
|
|
46
47
|
onLongPress,
|
|
47
48
|
}: RenderEventArgs<T>): ReactElement {
|
|
48
49
|
const theme = useCalendarTheme();
|
|
50
|
+
const labels = useCalendarLabels();
|
|
49
51
|
const isAllDayEvent = isAllDay ?? false;
|
|
50
52
|
const timeLabel = eventTimeLabel({
|
|
51
53
|
mode,
|
|
@@ -75,6 +77,7 @@ export function DefaultEvent<T>({
|
|
|
75
77
|
end: event.end,
|
|
76
78
|
ampm,
|
|
77
79
|
allDayLabel,
|
|
80
|
+
labels,
|
|
78
81
|
});
|
|
79
82
|
|
|
80
83
|
// Month cells and the all-day lane get a single clipped line; the timed grid
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
3
3
|
import { useCalendarTheme } from "../theme";
|
|
4
|
+
import { useCalendarLabels } from "../utils/labels";
|
|
4
5
|
import type { RenderEventArgs } from "../types";
|
|
5
6
|
import {
|
|
6
7
|
eventAccessibilityLabel,
|
|
@@ -30,6 +31,7 @@ export function DefaultMonthEvent<T>({
|
|
|
30
31
|
onLongPress,
|
|
31
32
|
}: RenderEventArgs<T>): ReactElement {
|
|
32
33
|
const theme = useCalendarTheme();
|
|
34
|
+
const labels = useCalendarLabels();
|
|
33
35
|
const isAllDayEvent = isAllDay ?? false;
|
|
34
36
|
const timeLabel = eventTimeLabel({
|
|
35
37
|
mode,
|
|
@@ -50,6 +52,7 @@ export function DefaultMonthEvent<T>({
|
|
|
50
52
|
end: event.end,
|
|
51
53
|
ampm,
|
|
52
54
|
allDayLabel,
|
|
55
|
+
labels,
|
|
53
56
|
});
|
|
54
57
|
|
|
55
58
|
return (
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
type WeekdayFormat,
|
|
37
37
|
isDateSelectable,
|
|
38
38
|
} from "@super-calendar/core";
|
|
39
|
+
import type { CalendarLabels } from "@super-calendar/core";
|
|
39
40
|
import { buildMonthWeeks, getWeekDays, weekdayFormatToken } from "@super-calendar/core";
|
|
40
41
|
import { createSlots, type SlotStyleProps } from "../utils/slots";
|
|
41
42
|
import { DefaultMonthEvent } from "./DefaultMonthEvent";
|
|
@@ -100,6 +101,8 @@ export type MonthListProps<T> = {
|
|
|
100
101
|
locale?: Locale;
|
|
101
102
|
sortedMonthView?: boolean;
|
|
102
103
|
moreLabel?: string;
|
|
104
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
105
|
+
labels?: Partial<CalendarLabels>;
|
|
103
106
|
/** Show dimmed adjacent-month days. Default false (each month shows only its own days). */
|
|
104
107
|
showAdjacentMonths?: boolean;
|
|
105
108
|
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
@@ -153,6 +156,7 @@ function MonthListInner<T>({
|
|
|
153
156
|
locale,
|
|
154
157
|
sortedMonthView,
|
|
155
158
|
moreLabel,
|
|
159
|
+
labels,
|
|
156
160
|
showAdjacentMonths = false,
|
|
157
161
|
highlightWeekends = true,
|
|
158
162
|
disableMonthEventCellPress,
|
|
@@ -466,6 +470,7 @@ function MonthListInner<T>({
|
|
|
466
470
|
locale={locale}
|
|
467
471
|
sortedMonthView={sortedMonthView}
|
|
468
472
|
moreLabel={moreLabel}
|
|
473
|
+
labels={labels}
|
|
469
474
|
showAdjacentMonths={showAdjacentMonths}
|
|
470
475
|
highlightWeekends={highlightWeekends}
|
|
471
476
|
disableMonthEventCellPress={disableMonthEventCellPress}
|
|
@@ -501,6 +506,7 @@ function MonthListInner<T>({
|
|
|
501
506
|
weekStartsOn,
|
|
502
507
|
sortedMonthView,
|
|
503
508
|
moreLabel,
|
|
509
|
+
labels,
|
|
504
510
|
showAdjacentMonths,
|
|
505
511
|
disableMonthEventCellPress,
|
|
506
512
|
isRTL,
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
getWeekDays,
|
|
35
35
|
weekdayFormatToken,
|
|
36
36
|
} from "@super-calendar/core";
|
|
37
|
+
import type { CalendarLabels } from "@super-calendar/core";
|
|
37
38
|
import { createSlots, type SlotStyleProps } from "../utils/slots";
|
|
38
39
|
import { useWebPagerKeys } from "../utils/useWebPagerKeys";
|
|
39
40
|
import { MonthView, type MonthViewSlot } from "./MonthView";
|
|
@@ -63,6 +64,8 @@ export type MonthPagerProps<T> = {
|
|
|
63
64
|
locale?: Locale;
|
|
64
65
|
sortedMonthView?: boolean;
|
|
65
66
|
moreLabel?: string;
|
|
67
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
68
|
+
labels?: Partial<CalendarLabels>;
|
|
66
69
|
showAdjacentMonths?: boolean;
|
|
67
70
|
highlightWeekends?: boolean;
|
|
68
71
|
disableMonthEventCellPress?: boolean;
|
|
@@ -124,6 +127,7 @@ function MonthPagerInner<T>({
|
|
|
124
127
|
locale,
|
|
125
128
|
sortedMonthView,
|
|
126
129
|
moreLabel,
|
|
130
|
+
labels,
|
|
127
131
|
showAdjacentMonths,
|
|
128
132
|
highlightWeekends,
|
|
129
133
|
disableMonthEventCellPress,
|
|
@@ -318,6 +322,7 @@ function MonthPagerInner<T>({
|
|
|
318
322
|
locale={locale}
|
|
319
323
|
sortedMonthView={sortedMonthView}
|
|
320
324
|
moreLabel={moreLabel}
|
|
325
|
+
labels={labels}
|
|
321
326
|
showAdjacentMonths={showAdjacentMonths}
|
|
322
327
|
highlightWeekends={highlightWeekends}
|
|
323
328
|
disableMonthEventCellPress={disableMonthEventCellPress}
|
|
@@ -356,6 +361,7 @@ function MonthPagerInner<T>({
|
|
|
356
361
|
locale,
|
|
357
362
|
sortedMonthView,
|
|
358
363
|
moreLabel,
|
|
364
|
+
labels,
|
|
359
365
|
showAdjacentMonths,
|
|
360
366
|
highlightWeekends,
|
|
361
367
|
disableMonthEventCellPress,
|
|
@@ -32,9 +32,13 @@ import type {
|
|
|
32
32
|
} from "../types";
|
|
33
33
|
import { createSlots, type SlotStyleProps } from "../utils/slots";
|
|
34
34
|
import { withEventAccessibilityLabel } from "../utils/withEventAccessibilityLabel";
|
|
35
|
+
import { CalendarLabelsContext } from "../utils/labels";
|
|
35
36
|
import {
|
|
37
|
+
type CalendarLabels,
|
|
36
38
|
type DateRange,
|
|
37
39
|
type EventAccessibilityLabeler,
|
|
40
|
+
dayAccessibilityLabel,
|
|
41
|
+
resolveCalendarLabels,
|
|
38
42
|
type WeekdayFormat,
|
|
39
43
|
daySelectionState,
|
|
40
44
|
isDateSelectable,
|
|
@@ -167,6 +171,8 @@ export type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
167
171
|
sortedMonthView?: boolean;
|
|
168
172
|
/** Template for the overflow label; `{moreCount}` is replaced. Default "{moreCount} More". */
|
|
169
173
|
moreLabel?: string;
|
|
174
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
175
|
+
labels?: Partial<CalendarLabels>;
|
|
170
176
|
/** Show dimmed days from adjacent months in the grid. Default true. */
|
|
171
177
|
showAdjacentMonths?: boolean;
|
|
172
178
|
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
@@ -272,6 +278,7 @@ function MonthViewInner<T>({
|
|
|
272
278
|
locale,
|
|
273
279
|
sortedMonthView = true,
|
|
274
280
|
moreLabel = "{moreCount} More",
|
|
281
|
+
labels: labelsProp,
|
|
275
282
|
showAdjacentMonths = true,
|
|
276
283
|
highlightWeekends = true,
|
|
277
284
|
disableMonthEventCellPress = false,
|
|
@@ -310,6 +317,7 @@ function MonthViewInner<T>({
|
|
|
310
317
|
}: MonthViewProps<T>): ReactElement {
|
|
311
318
|
const theme = useCalendarTheme();
|
|
312
319
|
const slot = createSlots<MonthViewSlot>({ classNames, styles: styleOverrides });
|
|
320
|
+
const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
|
|
313
321
|
// Selection comes from context (so cached pages still repaint), but explicit
|
|
314
322
|
// props win for direct/standalone use of MonthView.
|
|
315
323
|
const selection = useCalendarSelection();
|
|
@@ -694,7 +702,14 @@ function MonthViewInner<T>({
|
|
|
694
702
|
// Summarise the cell for screen readers: full date, today marker, and how
|
|
695
703
|
// many events it holds (the chips inside are grouped under this cell).
|
|
696
704
|
const eventCount = dayEvents.length;
|
|
697
|
-
const accessibilityLabel =
|
|
705
|
+
const accessibilityLabel = dayAccessibilityLabel({
|
|
706
|
+
dateLabel: format(day, "EEEE, d LLLL yyyy", { locale }),
|
|
707
|
+
isToday,
|
|
708
|
+
isSelected,
|
|
709
|
+
isDisabled,
|
|
710
|
+
eventCount,
|
|
711
|
+
labels,
|
|
712
|
+
});
|
|
698
713
|
|
|
699
714
|
const daySlot = slot("day", {
|
|
700
715
|
// Events mode mirrors the dom renderer: left-aligned cell content with
|
|
@@ -856,7 +871,7 @@ function MonthViewInner<T>({
|
|
|
856
871
|
: () => setMoreOpenFor({ day, events: dayEvents })
|
|
857
872
|
}
|
|
858
873
|
accessibilityRole="button"
|
|
859
|
-
accessibilityLabel={
|
|
874
|
+
accessibilityLabel={`${labels.moreEvents(hiddenCount)}, ${format(day, "d MMMM", { locale })}`}
|
|
860
875
|
allowFontScaling={false}
|
|
861
876
|
>
|
|
862
877
|
{moreLabel.replace("{moreCount}", String(hiddenCount))}
|
|
@@ -874,183 +889,191 @@ function MonthViewInner<T>({
|
|
|
874
889
|
};
|
|
875
890
|
|
|
876
891
|
return (
|
|
877
|
-
<
|
|
878
|
-
{
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
{format(date, "MMMM yyyy", locale ? { locale } : undefined)}
|
|
887
|
-
</Text>
|
|
888
|
-
) : null}
|
|
889
|
-
{showWeekdays ? (
|
|
890
|
-
<View
|
|
891
|
-
{...slot("weekdays", {
|
|
892
|
-
base: styles.weekdayHeader,
|
|
893
|
-
themed: theme.containers.weekdayHeader,
|
|
894
|
-
})}
|
|
895
|
-
>
|
|
896
|
-
{weekdayLabels.map((day) => (
|
|
897
|
-
<Text
|
|
898
|
-
key={day.toISOString()}
|
|
899
|
-
{...slot<TextStyle>("weekday", {
|
|
900
|
-
base: styles.weekdayLabel,
|
|
901
|
-
themed: [theme.text.weekday, { color: theme.colors.textMuted }],
|
|
902
|
-
})}
|
|
903
|
-
allowFontScaling={false}
|
|
904
|
-
>
|
|
905
|
-
{format(day, weekdayFormatToken(weekdayFormat), { locale })}
|
|
906
|
-
</Text>
|
|
907
|
-
))}
|
|
908
|
-
</View>
|
|
909
|
-
) : null}
|
|
910
|
-
{moreOpenFor ? (
|
|
911
|
-
<Modal transparent animationType="fade" visible onRequestClose={() => setMoreOpenFor(null)}>
|
|
912
|
-
<Pressable
|
|
913
|
-
style={styles.moreBackdrop}
|
|
914
|
-
accessibilityLabel="Close"
|
|
915
|
-
onPress={() => setMoreOpenFor(null)}
|
|
892
|
+
<CalendarLabelsContext.Provider value={labels}>
|
|
893
|
+
<View style={styles.root}>
|
|
894
|
+
{showTitle ? (
|
|
895
|
+
<Text
|
|
896
|
+
{...slot<TextStyle>("title", {
|
|
897
|
+
base: styles.title,
|
|
898
|
+
themed: [theme.text.monthTitle, { color: theme.colors.text }],
|
|
899
|
+
})}
|
|
900
|
+
allowFontScaling={false}
|
|
916
901
|
>
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
902
|
+
{format(date, "MMMM yyyy", locale ? { locale } : undefined)}
|
|
903
|
+
</Text>
|
|
904
|
+
) : null}
|
|
905
|
+
{showWeekdays ? (
|
|
906
|
+
<View
|
|
907
|
+
{...slot("weekdays", {
|
|
908
|
+
base: styles.weekdayHeader,
|
|
909
|
+
themed: theme.containers.weekdayHeader,
|
|
910
|
+
})}
|
|
911
|
+
>
|
|
912
|
+
{weekdayLabels.map((day) => (
|
|
928
913
|
<Text
|
|
929
|
-
|
|
930
|
-
|
|
914
|
+
key={day.toISOString()}
|
|
915
|
+
{...slot<TextStyle>("weekday", {
|
|
916
|
+
base: styles.weekdayLabel,
|
|
917
|
+
themed: [theme.text.weekday, { color: theme.colors.textMuted }],
|
|
918
|
+
})}
|
|
931
919
|
allowFontScaling={false}
|
|
932
920
|
>
|
|
933
|
-
{format(
|
|
921
|
+
{format(day, weekdayFormatToken(weekdayFormat), { locale })}
|
|
934
922
|
</Text>
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
923
|
+
))}
|
|
924
|
+
</View>
|
|
925
|
+
) : null}
|
|
926
|
+
{moreOpenFor ? (
|
|
927
|
+
<Modal
|
|
928
|
+
transparent
|
|
929
|
+
animationType="fade"
|
|
930
|
+
visible
|
|
931
|
+
onRequestClose={() => setMoreOpenFor(null)}
|
|
932
|
+
>
|
|
933
|
+
<Pressable
|
|
934
|
+
style={styles.moreBackdrop}
|
|
935
|
+
accessibilityLabel={labels.close}
|
|
936
|
+
onPress={() => setMoreOpenFor(null)}
|
|
937
|
+
>
|
|
938
|
+
<Pressable
|
|
939
|
+
// Swallow taps on the card so only the backdrop dismisses.
|
|
940
|
+
onPress={() => {}}
|
|
941
|
+
{...slot("morePopover", {
|
|
942
|
+
base: styles.moreCard,
|
|
943
|
+
themed: {
|
|
944
|
+
backgroundColor: theme.colors.surface,
|
|
945
|
+
borderColor: theme.colors.gridLine,
|
|
946
|
+
},
|
|
947
|
+
})}
|
|
948
|
+
>
|
|
949
|
+
<Text
|
|
950
|
+
accessibilityRole="header"
|
|
951
|
+
style={[styles.moreCardTitle, { color: theme.colors.text }]}
|
|
952
|
+
allowFontScaling={false}
|
|
953
|
+
>
|
|
954
|
+
{format(moreOpenFor.day, "EEEE, d LLLL yyyy", { locale })}
|
|
955
|
+
</Text>
|
|
956
|
+
<ScrollView>
|
|
957
|
+
{moreOpenFor.events.map((event, index) => (
|
|
958
|
+
<View key={keyExtractor(event, index)} style={styles.moreCardRow}>
|
|
959
|
+
<RenderEventComponent
|
|
960
|
+
event={event}
|
|
961
|
+
mode="month"
|
|
962
|
+
isAllDay={isAllDayEvent(event)}
|
|
963
|
+
onPress={() => {
|
|
964
|
+
setMoreOpenFor(null);
|
|
965
|
+
onPressEvent(event);
|
|
966
|
+
}}
|
|
967
|
+
/>
|
|
968
|
+
</View>
|
|
969
|
+
))}
|
|
970
|
+
</ScrollView>
|
|
971
|
+
</Pressable>
|
|
950
972
|
</Pressable>
|
|
951
|
-
</
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
973
|
+
</Modal>
|
|
974
|
+
) : null}
|
|
975
|
+
<MonthGridSurface gesture={dragGesture}>
|
|
976
|
+
<View
|
|
977
|
+
ref={gridRef}
|
|
978
|
+
testID="month-grid"
|
|
979
|
+
{...slot("grid", { base: styles.container })}
|
|
980
|
+
onLayout={handleLayout}
|
|
981
|
+
{...(isWeb && dragEnabled
|
|
982
|
+
? {
|
|
983
|
+
onPointerDown: (event: RNPointerEvent) => {
|
|
984
|
+
const point = gridPoint(event.nativeEvent.clientX, event.nativeEvent.clientY);
|
|
985
|
+
if (point) beginDrag(point.x, point.y);
|
|
986
|
+
},
|
|
987
|
+
onPointerMove: (event: RNPointerEvent) => {
|
|
988
|
+
if (!dragRef.current) return;
|
|
989
|
+
const point = gridPoint(event.nativeEvent.clientX, event.nativeEvent.clientY);
|
|
990
|
+
if (point) extendDrag(point.x, point.y);
|
|
991
|
+
},
|
|
992
|
+
}
|
|
993
|
+
: null)}
|
|
994
|
+
>
|
|
995
|
+
{weeks.map((week, weekIndex) => {
|
|
996
|
+
// Spanning bars for this row (laid out once in `weekLayouts`). A multi-day
|
|
997
|
+
// event is one bar across its columns, stacked into lanes; the bars render
|
|
998
|
+
// in an overlay so they can span cells, and the cells reserve the lane rows
|
|
999
|
+
// so "+more" sits below them. `visibleLanes` mirrors the per-day cap.
|
|
1000
|
+
const rowLayout = weekLayouts[weekIndex] ?? EMPTY_LAYOUT;
|
|
1001
|
+
const visibleLanes = monthVisibleCount(rowLayout.laneCount, capacity);
|
|
1002
|
+
const cols = week.length;
|
|
1003
|
+
// With adjacent months hidden, clamp bars to the current-month columns so
|
|
1004
|
+
// none draw over the blank leading/trailing cells.
|
|
1005
|
+
let firstVisCol = 0;
|
|
1006
|
+
let lastVisCol = cols - 1;
|
|
1007
|
+
if (showGrid && !showAdjacentMonths) {
|
|
1008
|
+
const first = week.findIndex((d) => isSameMonth(d, date));
|
|
1009
|
+
if (first !== -1) {
|
|
1010
|
+
firstVisCol = first;
|
|
1011
|
+
lastVisCol =
|
|
1012
|
+
cols - 1 - [...week].reverse().findIndex((d) => isSameMonth(d, date));
|
|
1013
|
+
}
|
|
991
1014
|
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
)
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
)
|
|
1050
|
-
|
|
1051
|
-
</
|
|
1052
|
-
</
|
|
1053
|
-
</
|
|
1015
|
+
return (
|
|
1016
|
+
<View
|
|
1017
|
+
{...slot("week", { base: styles.weekRow, themed: theme.containers.weekRow })}
|
|
1018
|
+
key={week[0].toISOString()}
|
|
1019
|
+
>
|
|
1020
|
+
{week.map((day, dayCol) => renderDay(day, dayCol, rowLayout, visibleLanes))}
|
|
1021
|
+
{showGrid ? (
|
|
1022
|
+
<View style={[StyleSheet.absoluteFill, { pointerEvents: "box-none" }]}>
|
|
1023
|
+
{rowLayout.segments
|
|
1024
|
+
.filter((seg) => seg.lane < visibleLanes)
|
|
1025
|
+
.map((seg) => {
|
|
1026
|
+
const startCol = Math.max(seg.startCol, firstVisCol);
|
|
1027
|
+
const endCol = Math.min(seg.endCol, lastVisCol);
|
|
1028
|
+
if (startCol > endCol) return null;
|
|
1029
|
+
// Fade the bar being carried, so the tinted drop target reads
|
|
1030
|
+
// as where it is going and this as where it came from.
|
|
1031
|
+
const isDragged = drag?.kind === "move" && drag.event === seg.event;
|
|
1032
|
+
return (
|
|
1033
|
+
<View
|
|
1034
|
+
key={`bar-${seg.event.start.toISOString()}:${seg.event.title}:${seg.lane}`}
|
|
1035
|
+
style={{
|
|
1036
|
+
position: "absolute",
|
|
1037
|
+
left: pct((startCol / cols) * 100),
|
|
1038
|
+
width: pct(((endCol - startCol + 1) / cols) * 100),
|
|
1039
|
+
top: BADGE_AREA + seg.lane * chipMetrics.chipRowHeight,
|
|
1040
|
+
height: chipMetrics.chipHeight,
|
|
1041
|
+
paddingHorizontal: CHIP_INSET_H,
|
|
1042
|
+
// Let a sweep in progress reach the cells underneath.
|
|
1043
|
+
pointerEvents: drag ? "none" : "box-none",
|
|
1044
|
+
opacity: isDragged ? DRAGGED_BAR_OPACITY : 1,
|
|
1045
|
+
}}
|
|
1046
|
+
>
|
|
1047
|
+
<RenderEventComponent
|
|
1048
|
+
event={seg.event}
|
|
1049
|
+
mode="month"
|
|
1050
|
+
isAllDay={isAllDayEvent(seg.event)}
|
|
1051
|
+
onPress={
|
|
1052
|
+
disableMonthEventCellPress
|
|
1053
|
+
? () => {}
|
|
1054
|
+
: () => {
|
|
1055
|
+
if (consumeSuppressedPress()) return;
|
|
1056
|
+
onPressEvent(seg.event);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
onLongPress={
|
|
1060
|
+
disableMonthEventCellPress || !onLongPressEvent
|
|
1061
|
+
? undefined
|
|
1062
|
+
: () => onLongPressEvent(seg.event)
|
|
1063
|
+
}
|
|
1064
|
+
/>
|
|
1065
|
+
</View>
|
|
1066
|
+
);
|
|
1067
|
+
})}
|
|
1068
|
+
</View>
|
|
1069
|
+
) : null}
|
|
1070
|
+
</View>
|
|
1071
|
+
);
|
|
1072
|
+
})}
|
|
1073
|
+
</View>
|
|
1074
|
+
</MonthGridSurface>
|
|
1075
|
+
</View>
|
|
1076
|
+
</CalendarLabelsContext.Provider>
|
|
1054
1077
|
);
|
|
1055
1078
|
}
|
|
1056
1079
|
|
|
@@ -28,7 +28,6 @@ type PreviewProps<T> = {
|
|
|
28
28
|
days: Date[];
|
|
29
29
|
cellHeight: SharedValue<number>;
|
|
30
30
|
dayWidth: number;
|
|
31
|
-
hourColumnWidth: number;
|
|
32
31
|
minHour: number;
|
|
33
32
|
mode: CalendarMode;
|
|
34
33
|
renderEvent: RenderEvent<T>;
|
|
@@ -62,7 +61,6 @@ function PreviewDay<T>({
|
|
|
62
61
|
move,
|
|
63
62
|
cellHeight,
|
|
64
63
|
dayWidth,
|
|
65
|
-
hourColumnWidth,
|
|
66
64
|
minHour,
|
|
67
65
|
mode,
|
|
68
66
|
renderEvent: RenderEventComponent,
|
|
@@ -149,7 +147,7 @@ function PreviewDay<T>({
|
|
|
149
147
|
position: "absolute",
|
|
150
148
|
overflow: "hidden",
|
|
151
149
|
padding: eventGap,
|
|
152
|
-
left:
|
|
150
|
+
left: index * dayWidth,
|
|
153
151
|
width: dayWidth,
|
|
154
152
|
zIndex: 100,
|
|
155
153
|
},
|