@super-calendar/native 2.11.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +20 -12
- package/dist/index.d.ts +20 -12
- package/dist/index.js +319 -286
- package/dist/index.mjs +314 -287
- 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/Calendar.tsx +162 -150
- 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/ResourceTimeline.tsx +18 -7
- package/src/components/TimeGrid.tsx +168 -150
- package/src/components/YearView.tsx +17 -5
- package/src/index.tsx +1 -0
- package/src/utils/labels.ts +13 -0
|
@@ -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
|
|
|
@@ -27,6 +27,8 @@ import {
|
|
|
27
27
|
type PositionedEvent,
|
|
28
28
|
resolveDraggedBounds,
|
|
29
29
|
snapDeltaMinutes,
|
|
30
|
+
type CalendarLabels,
|
|
31
|
+
resolveCalendarLabels,
|
|
30
32
|
} from "@super-calendar/core";
|
|
31
33
|
import { useCalendarTheme } from "../theme";
|
|
32
34
|
|
|
@@ -167,6 +169,8 @@ export interface ResourceTimelineProps<T = unknown> {
|
|
|
167
169
|
now?: Date;
|
|
168
170
|
/** Shift the now indicator into this IANA zone (pair with `eventsInTimeZone`). */
|
|
169
171
|
timeZone?: string;
|
|
172
|
+
/** Translations for the screen-reader drag actions; omitted keys use English. */
|
|
173
|
+
labels?: Partial<CalendarLabels>;
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
const clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));
|
|
@@ -250,6 +254,7 @@ type ResourceBarProps<T> = {
|
|
|
250
254
|
/** Raise this bar's lane above its siblings while a drag is live. */
|
|
251
255
|
onDragActiveChange: (laneId: string | null) => void;
|
|
252
256
|
theme: ReturnType<typeof useCalendarTheme>;
|
|
257
|
+
labels: CalendarLabels;
|
|
253
258
|
};
|
|
254
259
|
|
|
255
260
|
// A bar with drag-to-move (long-press) and edge resize along the time axis
|
|
@@ -276,6 +281,7 @@ function ResourceBar<T>({
|
|
|
276
281
|
dragActive,
|
|
277
282
|
onDragActiveChange,
|
|
278
283
|
theme,
|
|
284
|
+
labels,
|
|
279
285
|
}: ResourceBarProps<T>): ReactElement {
|
|
280
286
|
const moveX = useSharedValue(0);
|
|
281
287
|
const moveCross = useSharedValue(0);
|
|
@@ -330,18 +336,19 @@ function ResourceBar<T>({
|
|
|
330
336
|
// the same `commit` path. They all live on the bar's accessible Pressable (the
|
|
331
337
|
// resize grip is a non-focusable visual/gesture affordance, so an `adjustable`
|
|
332
338
|
// role there would never receive focus on a real device).
|
|
333
|
-
const unit = (n: number) => `${n} minute${n === 1 ? "" : "s"}`;
|
|
334
339
|
const laneTitle = (lane?: Resource) => lane && (lane.title || lane.id);
|
|
335
340
|
const nextLane = laneTitle(resources[laneIndex + 1]);
|
|
336
341
|
const previousLane = laneTitle(resources[laneIndex - 1]);
|
|
337
342
|
const barActions = draggable
|
|
338
343
|
? [
|
|
339
|
-
{ name: "move-later", label:
|
|
340
|
-
{ name: "move-earlier", label:
|
|
341
|
-
{ name: "extend", label:
|
|
342
|
-
{ name: "shrink", label:
|
|
343
|
-
...(nextLane ? [{ name: "move-next-lane", label:
|
|
344
|
-
...(previousLane
|
|
344
|
+
{ name: "move-later", label: labels.moveLater(snapMinutes) },
|
|
345
|
+
{ name: "move-earlier", label: labels.moveEarlier(snapMinutes) },
|
|
346
|
+
{ name: "extend", label: labels.extend(snapMinutes) },
|
|
347
|
+
{ name: "shrink", label: labels.shorten(snapMinutes) },
|
|
348
|
+
...(nextLane ? [{ name: "move-next-lane", label: labels.moveToResource(nextLane) }] : []),
|
|
349
|
+
...(previousLane
|
|
350
|
+
? [{ name: "move-previous-lane", label: labels.moveToResource(previousLane) }]
|
|
351
|
+
: []),
|
|
345
352
|
]
|
|
346
353
|
: undefined;
|
|
347
354
|
const onBarAction = draggable
|
|
@@ -720,8 +727,10 @@ export function ResourceTimeline<T = unknown>({
|
|
|
720
727
|
showNowIndicator = true,
|
|
721
728
|
now: nowProp,
|
|
722
729
|
timeZone,
|
|
730
|
+
labels: labelsProp,
|
|
723
731
|
}: ResourceTimelineProps<T>): ReactElement {
|
|
724
732
|
const theme = useCalendarTheme();
|
|
733
|
+
const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
|
|
725
734
|
// Window the lanes to the requested page when resourcesPerPage caps them.
|
|
726
735
|
const resources = useMemo(() => {
|
|
727
736
|
if (!resourcesPerPage || resourcesPerPage <= 0) return allResources;
|
|
@@ -960,6 +969,7 @@ export function ResourceTimeline<T = unknown>({
|
|
|
960
969
|
}
|
|
961
970
|
onDragEvent={onDragEvent}
|
|
962
971
|
theme={theme}
|
|
972
|
+
labels={labels}
|
|
963
973
|
/>
|
|
964
974
|
);
|
|
965
975
|
}
|
|
@@ -1139,6 +1149,7 @@ export function ResourceTimeline<T = unknown>({
|
|
|
1139
1149
|
}
|
|
1140
1150
|
onDragEvent={onDragEvent}
|
|
1141
1151
|
theme={theme}
|
|
1152
|
+
labels={labels}
|
|
1142
1153
|
/>
|
|
1143
1154
|
);
|
|
1144
1155
|
}
|