@super-calendar/native 2.11.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 +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
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as withEventAccessibilityLabel, c as createSlots, d as
|
|
1
|
+
import { a as withEventAccessibilityLabel, c as createSlots, d as useCalendarLabels, f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, l as useSlots, m as defaultTheme, n as DefaultMonthEvent, o as useWebPagerKeys, p as darkTheme, r as MonthPager, s as SlotStylesProvider, t as MonthList, u as CalendarLabelsContext } from "./MonthList-B-UE37ZG.mjs";
|
|
2
2
|
import { addDays, addMonths, addWeeks, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getHours, getISOWeek, getMinutes, isSameDay, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
3
3
|
import { createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import Animated, { runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useReducedMotion, useSharedValue } from "react-native-reanimated";
|
|
5
|
-
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, eventsInTimeZone as eventsInTimeZone$1, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, getWeekDays as getWeekDays$1, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, minutesIntoDay, monthCreateRange, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, useNow as useNow$1, viewDayCount, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core";
|
|
5
|
+
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthWeeks, buildMonthWeeks as buildMonthWeeks$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, eventsInTimeZone as eventsInTimeZone$1, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, getWeekDays as getWeekDays$1, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, minutesIntoDay, monthCreateRange, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, useNow as useNow$1, viewDayCount, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core";
|
|
6
6
|
import { Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
7
7
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -12,8 +12,9 @@ import { AnimatedLegendList } from "@legendapp/list/reanimated";
|
|
|
12
12
|
const isWeb$2 = Platform.OS === "web";
|
|
13
13
|
const DRAG_HOLD_MS = 400;
|
|
14
14
|
const FALLBACK_COLUMNS = 3;
|
|
15
|
-
function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, refreshControl, classNames, styles: styleOverrides }) {
|
|
15
|
+
function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth = 150, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, refreshControl, classNames, styles: styleOverrides }) {
|
|
16
16
|
const theme = useCalendarTheme();
|
|
17
|
+
const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
|
|
17
18
|
const slot = createSlots({
|
|
18
19
|
classNames,
|
|
19
20
|
styles: styleOverrides
|
|
@@ -167,7 +168,14 @@ function YearViewInner({ date, events, weekStartsOn, hiddenDays, locale, activeD
|
|
|
167
168
|
});
|
|
168
169
|
const dayTime = startOfDay(day).getTime();
|
|
169
170
|
const inSweep = sweep != null && dayTime >= Math.min(sweep.anchor, sweep.hover) && dayTime <= Math.max(sweep.anchor, sweep.hover);
|
|
170
|
-
const label =
|
|
171
|
+
const label = dayAccessibilityLabel({
|
|
172
|
+
dateLabel: format(day, "EEEE, d LLLL yyyy", { locale }),
|
|
173
|
+
isToday,
|
|
174
|
+
isSelected: state.isSelected,
|
|
175
|
+
isDisabled: state.isDisabled,
|
|
176
|
+
hasEvents,
|
|
177
|
+
labels
|
|
178
|
+
});
|
|
171
179
|
const badge = dayBadgeKind(state, isHighlighted);
|
|
172
180
|
const daySlot = slot("day", { base: styles$5.day });
|
|
173
181
|
const showBand = rangeBandKind(state, true) !== "none";
|
|
@@ -491,6 +499,7 @@ const numericStyle = (value, fallback) => typeof value === "number" ? value : fa
|
|
|
491
499
|
*/
|
|
492
500
|
function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, accessibilityLabel: accessibilityLabelProp, accessibilityActions, onAccessibilityAction, cellStyle, onPress, onLongPress }) {
|
|
493
501
|
const theme = useCalendarTheme();
|
|
502
|
+
const labels = useCalendarLabels();
|
|
494
503
|
const isAllDayEvent = isAllDay ?? false;
|
|
495
504
|
const timeLabel = eventTimeLabel({
|
|
496
505
|
mode,
|
|
@@ -509,7 +518,8 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
|
|
|
509
518
|
start: event.start,
|
|
510
519
|
end: event.end,
|
|
511
520
|
ampm,
|
|
512
|
-
allDayLabel
|
|
521
|
+
allDayLabel,
|
|
522
|
+
labels
|
|
513
523
|
});
|
|
514
524
|
const fixedTitleLines = titleNumberOfLines(mode, isAllDayEvent);
|
|
515
525
|
const isSchedule = mode === "schedule";
|
|
@@ -808,7 +818,7 @@ function PreviewDay({ move, cellHeight, dayWidth, minHour, mode, renderEvent: Re
|
|
|
808
818
|
const isWeb$1 = Platform.OS === "web";
|
|
809
819
|
const MINUTES_PER_HOUR$1 = 60;
|
|
810
820
|
const HOURS_PER_DAY = 24;
|
|
811
|
-
const MINUTES_PER_DAY =
|
|
821
|
+
const MINUTES_PER_DAY = 1440;
|
|
812
822
|
const PAGE_WINDOW = 180;
|
|
813
823
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
814
824
|
/** Default height in pixels of one hour row on the time grid. */
|
|
@@ -909,6 +919,7 @@ const DAY_HEADER_HEIGHT = 56;
|
|
|
909
919
|
function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, minEventHeight, eventGap, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
910
920
|
const RenderEventComponent = renderEvent;
|
|
911
921
|
const theme = useCalendarTheme();
|
|
922
|
+
const labels = useCalendarLabels();
|
|
912
923
|
const slot = useSlots();
|
|
913
924
|
const edgePaging = useContext(EdgePagingContext);
|
|
914
925
|
const pagerLeftSV = edgePaging?.pagerLeft;
|
|
@@ -1301,29 +1312,27 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1301
1312
|
handleLongPressFromHandle
|
|
1302
1313
|
]);
|
|
1303
1314
|
const handleLongPress = !canMove && onLongPress ? () => onLongPress(positioned.event) : void 0;
|
|
1304
|
-
const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
|
|
1305
|
-
const pageUnit = mode === "week" ? "week" : daysPerPage === 1 ? "day" : `${daysPerPage} day${daysPerPage === 1 ? "" : "s"}`;
|
|
1306
1315
|
const dragActions = [
|
|
1307
1316
|
...canMove ? [{
|
|
1308
1317
|
name: "move-later",
|
|
1309
|
-
label:
|
|
1318
|
+
label: labels.moveLater(snapMinutes)
|
|
1310
1319
|
}, {
|
|
1311
1320
|
name: "move-earlier",
|
|
1312
|
-
label:
|
|
1321
|
+
label: labels.moveEarlier(snapMinutes)
|
|
1313
1322
|
}] : [],
|
|
1314
1323
|
...resizable ? [{
|
|
1315
1324
|
name: "extend",
|
|
1316
|
-
label:
|
|
1325
|
+
label: labels.extend(snapMinutes)
|
|
1317
1326
|
}, {
|
|
1318
1327
|
name: "shrink",
|
|
1319
|
-
label:
|
|
1328
|
+
label: labels.shorten(snapMinutes)
|
|
1320
1329
|
}] : [],
|
|
1321
1330
|
...canMove ? [{
|
|
1322
1331
|
name: "move-next-page",
|
|
1323
|
-
label:
|
|
1332
|
+
label: labels.moveToNextPage(daysPerPage, mode)
|
|
1324
1333
|
}, {
|
|
1325
1334
|
name: "move-previous-page",
|
|
1326
|
-
label:
|
|
1335
|
+
label: labels.moveToPreviousPage(daysPerPage, mode)
|
|
1327
1336
|
}] : []
|
|
1328
1337
|
];
|
|
1329
1338
|
const accessibilityActions = dragActions.length ? dragActions : void 0;
|
|
@@ -1344,9 +1353,7 @@ function AnimatedEventBoxInner({ positioned, eventIndex, movingEvent, onMovePrev
|
|
|
1344
1353
|
case "move-next-page":
|
|
1345
1354
|
commitDrag(daysPerPage * MINUTES_PER_DAY, daysPerPage * MINUTES_PER_DAY);
|
|
1346
1355
|
break;
|
|
1347
|
-
case "move-previous-page":
|
|
1348
|
-
commitDrag(-daysPerPage * MINUTES_PER_DAY, -daysPerPage * MINUTES_PER_DAY);
|
|
1349
|
-
break;
|
|
1356
|
+
case "move-previous-page": commitDrag(-daysPerPage * MINUTES_PER_DAY, -daysPerPage * MINUTES_PER_DAY);
|
|
1350
1357
|
}
|
|
1351
1358
|
} : void 0;
|
|
1352
1359
|
const eventSlot = slot("event", {
|
|
@@ -1448,7 +1455,7 @@ const HourLines = memo(function HourLines({ hours, timeslots }) {
|
|
|
1448
1455
|
}, hour))
|
|
1449
1456
|
});
|
|
1450
1457
|
});
|
|
1451
|
-
const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scrollY, showLane, showAllDayLabel, headerHeight, weekNumber, ampm, hourComponent }) => {
|
|
1458
|
+
const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scrollY, showLane, showAllDayLabel, allDayLabel, headerHeight, weekNumber, ampm, hourComponent }) => {
|
|
1452
1459
|
const theme = useCalendarTheme();
|
|
1453
1460
|
const slot = useSlots();
|
|
1454
1461
|
const hours = useMemo(() => hourRange(minHour, maxHour), [minHour, maxHour]);
|
|
@@ -1499,7 +1506,7 @@ const HourGutterInner = ({ width, minHour, maxHour, cellHeight, laneHeight, scro
|
|
|
1499
1506
|
themed: { color: theme.colors.textMuted }
|
|
1500
1507
|
}),
|
|
1501
1508
|
allowFontScaling: false,
|
|
1502
|
-
children:
|
|
1509
|
+
children: allDayLabel
|
|
1503
1510
|
}) : null
|
|
1504
1511
|
}) : null,
|
|
1505
1512
|
/* @__PURE__ */ jsx(Animated.View, {
|
|
@@ -1601,7 +1608,7 @@ function BackgroundEventBand({ event, cellHeight, startHour, endHour, minHour, l
|
|
|
1601
1608
|
})
|
|
1602
1609
|
});
|
|
1603
1610
|
}
|
|
1604
|
-
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, committedCellHeight, isActive, weekStartsOn, weekEndsOn, width, minHour, maxHour, timeslots, isRTL, highlightWeekends, calendarCellStyle, showNowIndicator, businessHours, renderBusinessHours, renderBackgroundEvent, renderEvent, keyExtractor, snapMinutes, minEventHeight, eventGap, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, pageIndex, laneHeight, scrollY, showAllDayEventCell, onLaneLayout, height, pagedHeader, weekdayFormat, locale, activeDate, onPressDateHeader }) {
|
|
1611
|
+
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, committedCellHeight, isActive, weekStartsOn, weekEndsOn, width, minHour, maxHour, timeslots, isRTL, highlightWeekends, calendarCellStyle, showNowIndicator, businessHours, renderBusinessHours, renderBackgroundEvent, renderEvent, keyExtractor, snapMinutes, minEventHeight, eventGap, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, pageIndex, laneHeight, scrollY, showAllDayEventCell, onLaneLayout, height, pagedHeader, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) {
|
|
1605
1612
|
const theme = useCalendarTheme();
|
|
1606
1613
|
const slot = useSlots();
|
|
1607
1614
|
const heightSource = isActive ? cellHeight : committedCellHeight;
|
|
@@ -1834,6 +1841,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1834
1841
|
mode,
|
|
1835
1842
|
dayWidth,
|
|
1836
1843
|
weekdayFormat,
|
|
1844
|
+
todayLabel,
|
|
1837
1845
|
locale,
|
|
1838
1846
|
activeDate,
|
|
1839
1847
|
onPressDateHeader
|
|
@@ -2033,10 +2041,12 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
2033
2041
|
});
|
|
2034
2042
|
}
|
|
2035
2043
|
const TimetablePage = memo(TimetablePageInner);
|
|
2036
|
-
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, showAllDayLabel = false, refreshControl, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, 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 }) {
|
|
2037
|
-
const clampedMinHour = Math.max(0, Math.min(minHour,
|
|
2044
|
+
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", labels: labelsProp, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, showAllDayLabel = false, refreshControl, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, 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 }) {
|
|
2045
|
+
const clampedMinHour = Math.max(0, Math.min(minHour, 23));
|
|
2038
2046
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
2039
2047
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
2048
|
+
const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
|
|
2049
|
+
const todayLabel = labels.today;
|
|
2040
2050
|
const pagedHeader = renderHeader == null;
|
|
2041
2051
|
const headerOffset = pagedHeader ? DAY_HEADER_HEIGHT : 0;
|
|
2042
2052
|
const labeledRenderEvent = useMemo(() => withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, ampm), [
|
|
@@ -2440,6 +2450,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2440
2450
|
height: pagerHeight,
|
|
2441
2451
|
pagedHeader,
|
|
2442
2452
|
weekdayFormat,
|
|
2453
|
+
todayLabel,
|
|
2443
2454
|
locale,
|
|
2444
2455
|
activeDate,
|
|
2445
2456
|
onPressDateHeader
|
|
@@ -2448,6 +2459,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2448
2459
|
pagerHeight,
|
|
2449
2460
|
pagedHeader,
|
|
2450
2461
|
weekdayFormat,
|
|
2462
|
+
todayLabel,
|
|
2451
2463
|
locale,
|
|
2452
2464
|
activeDate,
|
|
2453
2465
|
onPressDateHeader,
|
|
@@ -2505,112 +2517,116 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2505
2517
|
return /* @__PURE__ */ jsx(SlotStylesProvider, {
|
|
2506
2518
|
classNames,
|
|
2507
2519
|
styles: styleOverrides,
|
|
2508
|
-
children: /* @__PURE__ */ jsx(
|
|
2509
|
-
value:
|
|
2510
|
-
children: /* @__PURE__ */
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
children: /* @__PURE__ */ jsx(
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
style: isWeb$1 ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
|
|
2575
|
-
data: pageDates,
|
|
2576
|
-
extraData: listExtraData,
|
|
2577
|
-
horizontal: true,
|
|
2578
|
-
recycleItems: false,
|
|
2579
|
-
keyExtractor: keyExtractorList,
|
|
2580
|
-
getFixedItemSize,
|
|
2581
|
-
drawDistance: columnsWidth * 2,
|
|
2582
|
-
sharedValues: pagerSharedValues,
|
|
2583
|
-
...isWeb$1 ? null : {
|
|
2584
|
-
scrollEnabled: swipeEnabled,
|
|
2585
|
-
pagingEnabled: !freeSwipe,
|
|
2586
|
-
snapToIndices: freeSwipe ? snapToIndices : void 0,
|
|
2587
|
-
decelerationRate: freeSwipe ? "normal" : "fast",
|
|
2588
|
-
disableIntervalMomentum: !freeSwipe,
|
|
2589
|
-
scrollEventThrottle: 16,
|
|
2590
|
-
onMomentumScrollEnd: handlePagerSettled
|
|
2520
|
+
children: /* @__PURE__ */ jsx(CalendarLabelsContext.Provider, {
|
|
2521
|
+
value: labels,
|
|
2522
|
+
children: /* @__PURE__ */ jsx(EdgePagingContext.Provider, {
|
|
2523
|
+
value: edgePaging,
|
|
2524
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
2525
|
+
ref: containerRef,
|
|
2526
|
+
style: styles$1.container,
|
|
2527
|
+
onLayout: (event) => setContainerWidth(event.nativeEvent.layout.width),
|
|
2528
|
+
children: [
|
|
2529
|
+
renderHeader ? renderHeader(headerDays) : null,
|
|
2530
|
+
headerComponent,
|
|
2531
|
+
/* @__PURE__ */ jsx(View, {
|
|
2532
|
+
ref: viewportRef,
|
|
2533
|
+
style: styles$1.viewport,
|
|
2534
|
+
onLayout: () => {
|
|
2535
|
+
seedWebScroll();
|
|
2536
|
+
viewportRef.current?.measureInWindow((_x, y) => {
|
|
2537
|
+
viewportTop.value = y;
|
|
2538
|
+
});
|
|
2539
|
+
},
|
|
2540
|
+
children: /* @__PURE__ */ jsx(GestureDetector, {
|
|
2541
|
+
gesture: zoomGesture,
|
|
2542
|
+
children: /* @__PURE__ */ jsx(Animated.ScrollView, {
|
|
2543
|
+
ref: scrollRef,
|
|
2544
|
+
showsVerticalScrollIndicator: showVerticalScrollIndicator,
|
|
2545
|
+
scrollEnabled: verticalScrollEnabled,
|
|
2546
|
+
onScroll: scrollHandler,
|
|
2547
|
+
scrollEventThrottle: 16,
|
|
2548
|
+
refreshControl: verticalScrollEnabled ? refreshControl : void 0,
|
|
2549
|
+
contentOffset: {
|
|
2550
|
+
x: 0,
|
|
2551
|
+
y: seedDefaultY
|
|
2552
|
+
},
|
|
2553
|
+
children: /* @__PURE__ */ jsxs(Animated.View, {
|
|
2554
|
+
testID: "time-grid-hours",
|
|
2555
|
+
style: [styles$1.gridRow, gridHeightStyle],
|
|
2556
|
+
children: [hourColumnWidth > 0 ? /* @__PURE__ */ jsx(HourGutter, {
|
|
2557
|
+
width: hourColumnWidth,
|
|
2558
|
+
minHour: clampedMinHour,
|
|
2559
|
+
maxHour: clampedMaxHour,
|
|
2560
|
+
cellHeight,
|
|
2561
|
+
laneHeight,
|
|
2562
|
+
scrollY,
|
|
2563
|
+
showLane: showAllDayEventCell,
|
|
2564
|
+
showAllDayLabel,
|
|
2565
|
+
allDayLabel: labels.allDay,
|
|
2566
|
+
headerHeight: headerOffset,
|
|
2567
|
+
weekNumber,
|
|
2568
|
+
ampm,
|
|
2569
|
+
hourComponent
|
|
2570
|
+
}) : null, /* @__PURE__ */ jsxs(View, {
|
|
2571
|
+
ref: pagerRef,
|
|
2572
|
+
testID: "time-grid-pager",
|
|
2573
|
+
style: [styles$1.pager, {
|
|
2574
|
+
left: hourColumnWidth,
|
|
2575
|
+
height: pagerHeight
|
|
2576
|
+
}],
|
|
2577
|
+
onLayout: (event) => {
|
|
2578
|
+
const laidOutWidth = event.nativeEvent.layout.width;
|
|
2579
|
+
if (laidOutWidth === pagerLayoutWidthRef.current) return;
|
|
2580
|
+
pagerLayoutWidthRef.current = laidOutWidth;
|
|
2581
|
+
setPagerLayoutWidth(laidOutWidth);
|
|
2582
|
+
pagerRef.current?.measureInWindow((x, _y, measuredWidth) => {
|
|
2583
|
+
pagerLeft.value = x;
|
|
2584
|
+
pagerWidth.value = measuredWidth;
|
|
2585
|
+
});
|
|
2591
2586
|
},
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2587
|
+
children: [pagerReady ? /* @__PURE__ */ jsx(AnimatedLegendList, {
|
|
2588
|
+
ref: listRef,
|
|
2589
|
+
style: isWeb$1 ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
|
|
2590
|
+
data: pageDates,
|
|
2591
|
+
extraData: listExtraData,
|
|
2592
|
+
horizontal: true,
|
|
2593
|
+
recycleItems: false,
|
|
2594
|
+
keyExtractor: keyExtractorList,
|
|
2595
|
+
getFixedItemSize,
|
|
2596
|
+
drawDistance: columnsWidth * 2,
|
|
2597
|
+
sharedValues: pagerSharedValues,
|
|
2598
|
+
...isWeb$1 ? null : {
|
|
2599
|
+
scrollEnabled: swipeEnabled,
|
|
2600
|
+
pagingEnabled: !freeSwipe,
|
|
2601
|
+
snapToIndices: freeSwipe ? snapToIndices : void 0,
|
|
2602
|
+
decelerationRate: freeSwipe ? "normal" : "fast",
|
|
2603
|
+
disableIntervalMomentum: !freeSwipe,
|
|
2604
|
+
scrollEventThrottle: 16,
|
|
2605
|
+
onMomentumScrollEnd: handlePagerSettled
|
|
2606
|
+
},
|
|
2607
|
+
initialScrollIndex: activeIndex,
|
|
2608
|
+
showsHorizontalScrollIndicator: false,
|
|
2609
|
+
viewabilityConfig: PAGE_VIEWABILITY,
|
|
2610
|
+
onViewableItemsChanged: handleViewableItemsChanged,
|
|
2611
|
+
renderItem
|
|
2612
|
+
}, `grid-${columnsWidth}`) : null, liftedEvent ? /* @__PURE__ */ jsx(DragGhost, {
|
|
2613
|
+
x: ghostX,
|
|
2614
|
+
y: ghostY,
|
|
2615
|
+
w: ghostW,
|
|
2616
|
+
h: ghostH,
|
|
2617
|
+
visible: ghostVisible,
|
|
2618
|
+
event: liftedEvent,
|
|
2619
|
+
mode,
|
|
2620
|
+
renderEvent: labeledRenderEvent,
|
|
2621
|
+
eventGap
|
|
2622
|
+
}) : null]
|
|
2623
|
+
})]
|
|
2624
|
+
})
|
|
2609
2625
|
})
|
|
2610
2626
|
})
|
|
2611
2627
|
})
|
|
2612
|
-
|
|
2613
|
-
|
|
2628
|
+
]
|
|
2629
|
+
})
|
|
2614
2630
|
})
|
|
2615
2631
|
})
|
|
2616
2632
|
});
|
|
@@ -2635,26 +2651,28 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2635
2651
|
* ```
|
|
2636
2652
|
*/
|
|
2637
2653
|
const TimeGrid = memo(TimeGridInner);
|
|
2638
|
-
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, locale, activeDate, onPressDateHeader }) => {
|
|
2654
|
+
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
2655
|
+
const slot = useSlots();
|
|
2639
2656
|
return /* @__PURE__ */ jsx(View, {
|
|
2640
|
-
...
|
|
2657
|
+
...slot("header", { base: styles$1.headerRow }),
|
|
2641
2658
|
children: days.map((day) => /* @__PURE__ */ jsx(DayHeader, {
|
|
2642
2659
|
day,
|
|
2643
2660
|
mode,
|
|
2644
2661
|
width: dayWidth,
|
|
2645
2662
|
weekdayFormat,
|
|
2663
|
+
todayLabel,
|
|
2646
2664
|
locale,
|
|
2647
2665
|
activeDate,
|
|
2648
2666
|
onPressDateHeader
|
|
2649
2667
|
}, day.toISOString()))
|
|
2650
2668
|
});
|
|
2651
2669
|
};
|
|
2652
|
-
const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, onPressDateHeader }) => {
|
|
2670
|
+
const DayHeader = ({ day, width, weekdayFormat = "short", todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
2653
2671
|
const theme = useCalendarTheme();
|
|
2654
2672
|
const slot = useSlots();
|
|
2655
2673
|
const isToday = getIsToday$1(day);
|
|
2656
2674
|
const isHighlighted = activeDate ? isSameCalendarDay$1(day, activeDate) : isToday;
|
|
2657
|
-
const accessibilityLabel = `${format(day, "EEEE d MMMM", { locale })}${isToday ?
|
|
2675
|
+
const accessibilityLabel = `${format(day, "EEEE d MMMM", { locale })}${isToday ? `, ${todayLabel}` : ""}`;
|
|
2658
2676
|
const headerSlot = slot("columnHeader", {
|
|
2659
2677
|
base: [styles$1.dayHeader, { width }],
|
|
2660
2678
|
themed: theme.containers.columnHeader
|
|
@@ -2926,7 +2944,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
2926
2944
|
* }
|
|
2927
2945
|
* ```
|
|
2928
2946
|
*/
|
|
2929
|
-
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2947
|
+
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, labels, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2930
2948
|
const mergedTheme = useMemo(() => mergeTheme(theme), [theme]);
|
|
2931
2949
|
const internalCellHeight = useSharedValue(hourHeight);
|
|
2932
2950
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -2996,149 +3014,156 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2996
3014
|
allDayLabel,
|
|
2997
3015
|
eventAccessibilityLabel
|
|
2998
3016
|
]);
|
|
3017
|
+
const resolvedLabels = useMemo(() => resolveCalendarLabels(labels), [labels]);
|
|
2999
3018
|
return /* @__PURE__ */ jsx(CalendarThemeProvider, {
|
|
3000
3019
|
value: mergedTheme,
|
|
3001
|
-
children:
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3020
|
+
children: /* @__PURE__ */ jsx(CalendarLabelsContext.Provider, {
|
|
3021
|
+
value: resolvedLabels,
|
|
3022
|
+
children: mode === "month" ? /* @__PURE__ */ jsx(MonthPager, {
|
|
3023
|
+
date,
|
|
3024
|
+
events: displayEvents,
|
|
3025
|
+
maxVisibleEventCount,
|
|
3026
|
+
weekStartsOn,
|
|
3027
|
+
hiddenDays,
|
|
3028
|
+
weekdayFormat,
|
|
3029
|
+
locale,
|
|
3030
|
+
labels,
|
|
3031
|
+
sortedMonthView,
|
|
3032
|
+
moreLabel,
|
|
3033
|
+
showAdjacentMonths,
|
|
3034
|
+
highlightWeekends,
|
|
3035
|
+
disableMonthEventCellPress,
|
|
3036
|
+
isRTL,
|
|
3037
|
+
showSixWeeks,
|
|
3038
|
+
showTitle,
|
|
3039
|
+
activeDate,
|
|
3040
|
+
renderHeaderForMonthView,
|
|
3041
|
+
renderCustomDateForMonth,
|
|
3042
|
+
calendarCellStyle,
|
|
3043
|
+
renderEvent: resolvedRenderEvent,
|
|
3044
|
+
keyExtractor,
|
|
3045
|
+
onPressDay,
|
|
3046
|
+
onLongPressDay,
|
|
3047
|
+
onPressCell,
|
|
3048
|
+
onPressEvent: handlePressEvent,
|
|
3049
|
+
onLongPressEvent: handleLongPressEvent,
|
|
3050
|
+
onPressMore,
|
|
3051
|
+
onCreateEvent,
|
|
3052
|
+
onSelectDrag,
|
|
3053
|
+
onDragEvent,
|
|
3054
|
+
onDragStart,
|
|
3055
|
+
eventStartEditable,
|
|
3056
|
+
eventOverlap,
|
|
3057
|
+
selectedDates,
|
|
3058
|
+
selectedRange,
|
|
3059
|
+
fillCellOnSelection,
|
|
3060
|
+
minDate,
|
|
3061
|
+
maxDate,
|
|
3062
|
+
isDateDisabled,
|
|
3063
|
+
onChangeDate: handleChangeDate,
|
|
3064
|
+
freeSwipe,
|
|
3065
|
+
swipeEnabled,
|
|
3066
|
+
classNames,
|
|
3067
|
+
styles: styleOverrides
|
|
3068
|
+
}) : mode === "year" ? /* @__PURE__ */ jsx(YearView, {
|
|
3069
|
+
date,
|
|
3070
|
+
events: displayEvents,
|
|
3071
|
+
refreshControl,
|
|
3072
|
+
weekStartsOn,
|
|
3073
|
+
hiddenDays,
|
|
3074
|
+
locale,
|
|
3075
|
+
labels,
|
|
3076
|
+
activeDate,
|
|
3077
|
+
selectedDates,
|
|
3078
|
+
selectedRange,
|
|
3079
|
+
minDate,
|
|
3080
|
+
maxDate,
|
|
3081
|
+
isDateDisabled,
|
|
3082
|
+
onPressDay,
|
|
3083
|
+
onPressMonth,
|
|
3084
|
+
onSelectDrag,
|
|
3085
|
+
onCreateEvent,
|
|
3086
|
+
classNames,
|
|
3087
|
+
styles: styleOverrides
|
|
3088
|
+
}) : mode === "schedule" ? /* @__PURE__ */ jsx(Agenda, {
|
|
3089
|
+
events: displayEvents,
|
|
3090
|
+
locale,
|
|
3091
|
+
renderEvent: resolvedRenderEvent,
|
|
3092
|
+
keyExtractor,
|
|
3093
|
+
onPressEvent: handlePressEvent,
|
|
3094
|
+
onLongPressEvent: handleLongPressEvent,
|
|
3095
|
+
onPressDay,
|
|
3096
|
+
activeDate,
|
|
3097
|
+
itemSeparatorComponent,
|
|
3098
|
+
refreshControl,
|
|
3099
|
+
classNames,
|
|
3100
|
+
styles: styleOverrides
|
|
3101
|
+
}) : /* @__PURE__ */ jsx(TimeGrid, {
|
|
3102
|
+
mode,
|
|
3103
|
+
numberOfDays,
|
|
3104
|
+
weekEndsOn,
|
|
3105
|
+
date,
|
|
3106
|
+
events: displayEvents,
|
|
3107
|
+
cellHeight,
|
|
3108
|
+
hourHeight,
|
|
3109
|
+
weekStartsOn,
|
|
3110
|
+
weekdayFormat,
|
|
3111
|
+
hiddenDays,
|
|
3112
|
+
now,
|
|
3113
|
+
timeZone,
|
|
3114
|
+
renderEvent: resolvedRenderEvent,
|
|
3115
|
+
keyExtractor,
|
|
3116
|
+
scrollOffsetMinutes,
|
|
3117
|
+
hourColumnWidth,
|
|
3118
|
+
hideHours,
|
|
3119
|
+
timeslots,
|
|
3120
|
+
showAllDayEventCell,
|
|
3121
|
+
showAllDayLabel,
|
|
3122
|
+
refreshControl,
|
|
3123
|
+
highlightWeekends,
|
|
3124
|
+
eventStartEditable,
|
|
3125
|
+
eventDurationEditable,
|
|
3126
|
+
eventOverlap,
|
|
3127
|
+
calendarCellStyle,
|
|
3128
|
+
businessHours,
|
|
3129
|
+
renderBusinessHours,
|
|
3130
|
+
renderBackgroundEvent,
|
|
3131
|
+
showWeekNumber,
|
|
3132
|
+
weekNumberPrefix,
|
|
3133
|
+
hourComponent,
|
|
3134
|
+
showVerticalScrollIndicator,
|
|
3135
|
+
verticalScrollEnabled,
|
|
3136
|
+
headerComponent,
|
|
3137
|
+
minHour,
|
|
3138
|
+
maxHour,
|
|
3139
|
+
ampm,
|
|
3140
|
+
minHourHeight,
|
|
3141
|
+
maxHourHeight,
|
|
3142
|
+
minEventHeight,
|
|
3143
|
+
eventGap,
|
|
3144
|
+
showNowIndicator,
|
|
3145
|
+
locale,
|
|
3146
|
+
labels,
|
|
3147
|
+
activeDate,
|
|
3148
|
+
isRTL,
|
|
3149
|
+
freeSwipe,
|
|
3150
|
+
swipeEnabled,
|
|
3151
|
+
onPressEvent: handlePressEvent,
|
|
3152
|
+
onLongPressEvent: handleLongPressEvent,
|
|
3153
|
+
onDragEvent,
|
|
3154
|
+
showDragHandle,
|
|
3155
|
+
onDragStart,
|
|
3156
|
+
dragStepMinutes,
|
|
3157
|
+
onPressCell,
|
|
3158
|
+
resetPageOnPressCell,
|
|
3159
|
+
onLongPressCell,
|
|
3160
|
+
onCreateEvent,
|
|
3161
|
+
onPressDateHeader,
|
|
3162
|
+
onChangeDate: handleChangeDate,
|
|
3163
|
+
renderHeader: renderTimeGridHeader,
|
|
3164
|
+
classNames,
|
|
3165
|
+
styles: styleOverrides
|
|
3166
|
+
})
|
|
3142
3167
|
})
|
|
3143
3168
|
});
|
|
3144
3169
|
}
|
|
@@ -3180,7 +3205,7 @@ function DefaultBar({ event, width, height }) {
|
|
|
3180
3205
|
}) : null]
|
|
3181
3206
|
});
|
|
3182
3207
|
}
|
|
3183
|
-
function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendererSize, snapMinutes, Renderer, onPress, onLongPress, onDragEvent, resources, laneIndex, laneSize, dragActive, onDragActiveChange, theme }) {
|
|
3208
|
+
function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendererSize, snapMinutes, Renderer, onPress, onLongPress, onDragEvent, resources, laneIndex, laneSize, dragActive, onDragActiveChange, theme, labels }) {
|
|
3184
3209
|
const moveX = useSharedValue(0);
|
|
3185
3210
|
const moveCross = useSharedValue(0);
|
|
3186
3211
|
const resizeW = useSharedValue(0);
|
|
@@ -3230,34 +3255,33 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
|
|
|
3230
3255
|
}
|
|
3231
3256
|
if (handler(event, next.start, next.end, target) === false) snapBack();
|
|
3232
3257
|
}, [snapMinutes, snapBack]);
|
|
3233
|
-
const unit = (n) => `${n} minute${n === 1 ? "" : "s"}`;
|
|
3234
3258
|
const laneTitle = (lane) => lane && (lane.title || lane.id);
|
|
3235
3259
|
const nextLane = laneTitle(resources[laneIndex + 1]);
|
|
3236
3260
|
const previousLane = laneTitle(resources[laneIndex - 1]);
|
|
3237
3261
|
const barActions = draggable ? [
|
|
3238
3262
|
{
|
|
3239
3263
|
name: "move-later",
|
|
3240
|
-
label:
|
|
3264
|
+
label: labels.moveLater(snapMinutes)
|
|
3241
3265
|
},
|
|
3242
3266
|
{
|
|
3243
3267
|
name: "move-earlier",
|
|
3244
|
-
label:
|
|
3268
|
+
label: labels.moveEarlier(snapMinutes)
|
|
3245
3269
|
},
|
|
3246
3270
|
{
|
|
3247
3271
|
name: "extend",
|
|
3248
|
-
label:
|
|
3272
|
+
label: labels.extend(snapMinutes)
|
|
3249
3273
|
},
|
|
3250
3274
|
{
|
|
3251
3275
|
name: "shrink",
|
|
3252
|
-
label:
|
|
3276
|
+
label: labels.shorten(snapMinutes)
|
|
3253
3277
|
},
|
|
3254
3278
|
...nextLane ? [{
|
|
3255
3279
|
name: "move-next-lane",
|
|
3256
|
-
label:
|
|
3280
|
+
label: labels.moveToResource(nextLane)
|
|
3257
3281
|
}] : [],
|
|
3258
3282
|
...previousLane ? [{
|
|
3259
3283
|
name: "move-previous-lane",
|
|
3260
|
-
label:
|
|
3284
|
+
label: labels.moveToResource(previousLane)
|
|
3261
3285
|
}] : []
|
|
3262
3286
|
] : void 0;
|
|
3263
3287
|
const onBarAction = draggable ? (e) => {
|
|
@@ -3277,9 +3301,7 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
|
|
|
3277
3301
|
case "move-next-lane":
|
|
3278
3302
|
commit(0, 0, 1);
|
|
3279
3303
|
break;
|
|
3280
|
-
case "move-previous-lane":
|
|
3281
|
-
commit(0, 0, -1);
|
|
3282
|
-
break;
|
|
3304
|
+
case "move-previous-lane": commit(0, 0, -1);
|
|
3283
3305
|
}
|
|
3284
3306
|
} : void 0;
|
|
3285
3307
|
const barStyle = useAnimatedStyle(() => vertical ? {
|
|
@@ -3303,7 +3325,8 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
|
|
|
3303
3325
|
moveCross.value = Math.min(Math.max(cross, -laneIndex * laneSize), (laneCount - 1 - laneIndex) * laneSize);
|
|
3304
3326
|
}
|
|
3305
3327
|
}).onEnd((e) => {
|
|
3306
|
-
const
|
|
3328
|
+
const translation = vertical ? e.translationY : e.translationX;
|
|
3329
|
+
const delta = snapDeltaMinutes(translation, hourSize, snapMinutes);
|
|
3307
3330
|
const cross = laneSize > 0 ? vertical ? e.translationX : e.translationY : 0;
|
|
3308
3331
|
const laneDelta = laneSize > 0 ? Math.min(Math.max(Math.round(cross / laneSize), -laneIndex), laneCount - 1 - laneIndex) : 0;
|
|
3309
3332
|
if (delta === 0 && laneDelta === 0) {
|
|
@@ -3333,7 +3356,8 @@ function ResourceBar({ pe, vertical, hourSize, left, top, width, height, rendere
|
|
|
3333
3356
|
const resizeGesture = useMemo(() => Gesture.Pan().enabled(draggable).onUpdate((e) => {
|
|
3334
3357
|
resizeW.value = vertical ? e.translationY : e.translationX;
|
|
3335
3358
|
}).onEnd((e) => {
|
|
3336
|
-
const
|
|
3359
|
+
const translation = vertical ? e.translationY : e.translationX;
|
|
3360
|
+
const delta = snapDeltaMinutes(translation, hourSize, snapMinutes);
|
|
3337
3361
|
if (delta === 0) {
|
|
3338
3362
|
resizeW.value = 0;
|
|
3339
3363
|
return;
|
|
@@ -3514,8 +3538,9 @@ function LaneInteractionLayer({ resource, vertical, hourSize, startHour, date, s
|
|
|
3514
3538
|
* />
|
|
3515
3539
|
* ```
|
|
3516
3540
|
*/
|
|
3517
|
-
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 }) {
|
|
3541
|
+
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, labels: labelsProp }) {
|
|
3518
3542
|
const theme = useCalendarTheme();
|
|
3543
|
+
const labels = useMemo(() => resolveCalendarLabels(labelsProp), [labelsProp]);
|
|
3519
3544
|
const resources = useMemo(() => {
|
|
3520
3545
|
if (!resourcesPerPage || resourcesPerPage <= 0) return allResources;
|
|
3521
3546
|
const pages = Math.max(1, Math.ceil(allResources.length / resourcesPerPage));
|
|
@@ -3699,7 +3724,8 @@ function ResourceTimeline({ date, orientation = "horizontal", resources: allReso
|
|
|
3699
3724
|
onPress,
|
|
3700
3725
|
onLongPress: onLongPressEvent ? () => onLongPressEvent(pe.event) : void 0,
|
|
3701
3726
|
onDragEvent,
|
|
3702
|
-
theme
|
|
3727
|
+
theme,
|
|
3728
|
+
labels
|
|
3703
3729
|
}, idx);
|
|
3704
3730
|
return /* @__PURE__ */ jsx(Pressable, {
|
|
3705
3731
|
onPress,
|
|
@@ -3855,7 +3881,8 @@ function ResourceTimeline({ date, orientation = "horizontal", resources: allReso
|
|
|
3855
3881
|
onPress,
|
|
3856
3882
|
onLongPress: onLongPressEvent ? () => onLongPressEvent(pe.event) : void 0,
|
|
3857
3883
|
onDragEvent,
|
|
3858
|
-
theme
|
|
3884
|
+
theme,
|
|
3885
|
+
labels
|
|
3859
3886
|
}, idx);
|
|
3860
3887
|
return /* @__PURE__ */ jsx(Pressable, {
|
|
3861
3888
|
onPress,
|
|
@@ -3999,4 +4026,4 @@ const styles = StyleSheet.create({
|
|
|
3999
4026
|
}
|
|
4000
4027
|
});
|
|
4001
4028
|
//#endregion
|
|
4002
|
-
export { Agenda, Calendar, CalendarThemeProvider, DEFAULT_HOUR_HEIGHT, DefaultEvent, DefaultMonthEvent, MonthList, MonthPager, MonthView, ResourceTimeline, TimeGrid, YearView, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
|
4029
|
+
export { Agenda, Calendar, CalendarThemeProvider, DEFAULT_HOUR_HEIGHT, DefaultEvent, DefaultMonthEvent, MonthList, MonthPager, MonthView, ResourceTimeline, TimeGrid, YearView, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultCalendarLabels, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, mergeTheme, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useCalendarTheme, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|