@super-calendar/native 2.12.0 → 2.13.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-B9KzVzFa.d.mts → DefaultMonthEvent-H1IQMTqK.d.ts} +3 -3
- package/dist/{DefaultMonthEvent-DlIIWDzr.d.ts → DefaultMonthEvent-eip3mlq_.d.mts} +3 -3
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +113 -11
- package/dist/index.mjs +115 -13
- package/dist/picker.d.mts +1 -1
- package/dist/picker.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/Calendar.tsx +126 -97
- package/src/components/TimeGrid.tsx +206 -81
- package/src/index.tsx +2 -0
- package/src/types.ts +2 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
-
import { SharedValue } from "react-native-reanimated";
|
|
4
|
-
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
5
3
|
import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
4
|
+
import { SharedValue } from "react-native-reanimated";
|
|
5
|
+
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
6
6
|
//#region src/theme.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* The full set of colours, text styles and metrics the calendar paints with.
|
|
@@ -557,4 +557,4 @@ declare const MonthList: typeof MonthListInner;
|
|
|
557
557
|
*/
|
|
558
558
|
declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
|
|
559
559
|
//#endregion
|
|
560
|
-
export {
|
|
560
|
+
export { WeekStartsOn as A, ICalendarEvent as C, RenderEventArgs as D, RenderEvent as E, darkTheme as F, defaultTheme as I, mergeTheme as L, CalendarTheme as M, CalendarThemeProvider as N, ScrollToTimeOptions as O, PartialCalendarTheme as P, useCalendarTheme as R, EventKeyExtractor as S, RecurrenceRule as T, CalendarMode$1 as _, MonthPager as a, EventDragHandler as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, WeekdayFormat$1 as j, TimeGridMode as k, MonthViewSlot as l, BusinessHoursBand$1 as m, MonthList as n, MonthPagerProps as o, BusinessHours as p, MonthListProps as r, MonthView as s, DefaultMonthEvent as t, ResolvedSlot as u, EventAccessibilityLabelContext as v, RecurrenceFrequency as w, EventDragStartHandler as x, EventAccessibilityLabeler$1 as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
-
import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
4
3
|
import { SharedValue } from "react-native-reanimated";
|
|
5
|
-
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
4
|
+
import { BusinessHours, BusinessHoursBand as BusinessHoursBand$1, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarMode, CalendarMode as CalendarMode$1, DateRange, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, EventKeyExtractor, ICalendarEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, WeekStartsOn, WeekdayFormat, WeekdayFormat as WeekdayFormat$1 } from "@super-calendar/core";
|
|
5
|
+
import { AccessibilityActionEvent, AccessibilityActionInfo, ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
6
6
|
//#region src/theme.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* The full set of colours, text styles and metrics the calendar paints with.
|
|
@@ -557,4 +557,4 @@ declare const MonthList: typeof MonthListInner;
|
|
|
557
557
|
*/
|
|
558
558
|
declare function DefaultMonthEvent<T>({ event, mode, isAllDay, ampm, showTime, ellipsizeTitle, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }: RenderEventArgs<T>): ReactElement;
|
|
559
559
|
//#endregion
|
|
560
|
-
export {
|
|
560
|
+
export { WeekStartsOn as A, ICalendarEvent as C, RenderEventArgs as D, RenderEvent as E, darkTheme as F, defaultTheme as I, mergeTheme as L, CalendarTheme as M, CalendarThemeProvider as N, ScrollToTimeOptions as O, PartialCalendarTheme as P, useCalendarTheme as R, EventKeyExtractor as S, RecurrenceRule as T, CalendarMode$1 as _, MonthPager as a, EventDragHandler as b, MonthViewProps as c, SlotDefault as d, SlotStyleProps as f, CalendarHandle$1 as g, CalendarEvent$1 as h, MonthListSlot as i, WeekdayFormat$1 as j, TimeGridMode as k, MonthViewSlot as l, BusinessHoursBand$1 as m, MonthList as n, MonthPagerProps as o, BusinessHours as p, MonthListProps as r, MonthView as s, DefaultMonthEvent as t, ResolvedSlot as u, EventAccessibilityLabelContext as v, RecurrenceFrequency as w, EventDragStartHandler as x, EventAccessibilityLabeler$1 as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, O as ScrollToTimeOptions, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, T as RecurrenceRule, _ as CalendarMode, a as MonthPager, b as EventDragHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarHandle, h as CalendarEvent, i as MonthListSlot, j as WeekdayFormat, k as TimeGridMode, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabelContext, w as RecurrenceFrequency, x as EventDragStartHandler, y as EventAccessibilityLabeler } from "./DefaultMonthEvent-eip3mlq_.mjs";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
|
-
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { ComponentType, ReactElement, ReactNode, RefAttributes } from "react";
|
|
4
4
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
5
|
-
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, CalendarLabels, CalendarLabels as CalendarLabels$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, defaultCalendarLabels, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
5
|
+
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, defaultCalendarLabels, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
6
6
|
import { ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
7
7
|
//#region src/components/YearView.d.ts
|
|
8
8
|
/**
|
|
@@ -268,7 +268,6 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
268
268
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
269
269
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
270
270
|
};
|
|
271
|
-
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, labels: labelsProp, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, minEventHeight, eventGap, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
272
271
|
/**
|
|
273
272
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
274
273
|
* hour-by-hour grid with positioned event boxes, an all-day lane, pinch-to-zoom
|
|
@@ -288,7 +287,7 @@ declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events
|
|
|
288
287
|
* />
|
|
289
288
|
* ```
|
|
290
289
|
*/
|
|
291
|
-
export declare const TimeGrid:
|
|
290
|
+
export declare const TimeGrid: <T>(props: TimeGridProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
292
291
|
//#endregion
|
|
293
292
|
//#region src/components/Calendar.d.ts
|
|
294
293
|
/**
|
|
@@ -550,7 +549,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
550
549
|
ellipsizeTitle?: boolean;
|
|
551
550
|
/** Label the built-in renderer shows for an all-day event in the schedule (and its screen-reader text). Default "All day". */
|
|
552
551
|
allDayLabel?: string;
|
|
553
|
-
/**
|
|
552
|
+
/** Vertical scroll, in minutes from midnight (week/day). Applied on mount and whenever it changes. */
|
|
554
553
|
scrollOffsetMinutes?: number;
|
|
555
554
|
/** Show the current-time line on the week/day grid. Default true. */
|
|
556
555
|
showNowIndicator?: boolean;
|
|
@@ -615,7 +614,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
615
614
|
* }
|
|
616
615
|
* ```
|
|
617
616
|
*/
|
|
618
|
-
export declare
|
|
617
|
+
export declare const Calendar: <T>(props: CalendarProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
619
618
|
//#endregion
|
|
620
619
|
//#region src/components/DefaultEvent.d.ts
|
|
621
620
|
/**
|
|
@@ -776,4 +775,4 @@ interface ResourceTimelineProps<T = unknown> {
|
|
|
776
775
|
*/
|
|
777
776
|
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, labels: labelsProp }: ResourceTimelineProps<T>): ReactElement;
|
|
778
777
|
//#endregion
|
|
779
|
-
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, 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 };
|
|
778
|
+
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as WeekStartsOn, C as ICalendarEvent, D as RenderEventArgs, E as RenderEvent, F as darkTheme, I as defaultTheme, L as mergeTheme, M as CalendarTheme, N as CalendarThemeProvider, O as ScrollToTimeOptions, P as PartialCalendarTheme, R as useCalendarTheme, S as EventKeyExtractor, T as RecurrenceRule, _ as CalendarMode, a as MonthPager, b as EventDragHandler, c as MonthViewProps, d as SlotDefault, f as SlotStyleProps, g as CalendarHandle, h as CalendarEvent, i as MonthListSlot, j as WeekdayFormat, k as TimeGridMode, l as MonthViewSlot, m as BusinessHoursBand, n as MonthList, o as MonthPagerProps, p as BusinessHours, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, u as ResolvedSlot, v as EventAccessibilityLabelContext, w as RecurrenceFrequency, x as EventDragStartHandler, y as EventAccessibilityLabeler } from "./DefaultMonthEvent-H1IQMTqK.js";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
|
-
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { ComponentType, ReactElement, ReactNode, RefAttributes } from "react";
|
|
4
4
|
import { ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
5
5
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
6
|
-
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, CalendarLabels, CalendarLabels as CalendarLabels$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, defaultCalendarLabels, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
6
|
+
import { BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarEvent as CalendarEvent$1, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DaySelectionState, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, buildMonthWeeks, daySelectionState, defaultCalendarLabels, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, minutesIntoDay, nextDateRange, parseICalendar, toICalendar, toZonedTime, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
7
7
|
//#region src/components/YearView.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* The styleable parts of {@link YearView}. `dayText` and `eventDot` are the
|
|
@@ -268,7 +268,6 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
268
268
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
269
269
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
270
270
|
};
|
|
271
|
-
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, labels: labelsProp, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, showAllDayLabel, refreshControl, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, renderBackgroundEvent, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, minEventHeight, eventGap, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
272
271
|
/**
|
|
273
272
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
274
273
|
* hour-by-hour grid with positioned event boxes, an all-day lane, pinch-to-zoom
|
|
@@ -288,7 +287,7 @@ declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events
|
|
|
288
287
|
* />
|
|
289
288
|
* ```
|
|
290
289
|
*/
|
|
291
|
-
export declare const TimeGrid:
|
|
290
|
+
export declare const TimeGrid: <T>(props: TimeGridProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
292
291
|
//#endregion
|
|
293
292
|
//#region src/components/Calendar.d.ts
|
|
294
293
|
/**
|
|
@@ -550,7 +549,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
550
549
|
ellipsizeTitle?: boolean;
|
|
551
550
|
/** Label the built-in renderer shows for an all-day event in the schedule (and its screen-reader text). Default "All day". */
|
|
552
551
|
allDayLabel?: string;
|
|
553
|
-
/**
|
|
552
|
+
/** Vertical scroll, in minutes from midnight (week/day). Applied on mount and whenever it changes. */
|
|
554
553
|
scrollOffsetMinutes?: number;
|
|
555
554
|
/** Show the current-time line on the week/day grid. Default true. */
|
|
556
555
|
showNowIndicator?: boolean;
|
|
@@ -615,7 +614,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
615
614
|
* }
|
|
616
615
|
* ```
|
|
617
616
|
*/
|
|
618
|
-
export declare
|
|
617
|
+
export declare const Calendar: <T>(props: CalendarProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
619
618
|
//#endregion
|
|
620
619
|
//#region src/components/DefaultEvent.d.ts
|
|
621
620
|
/**
|
|
@@ -776,4 +775,4 @@ interface ResourceTimelineProps<T = unknown> {
|
|
|
776
775
|
*/
|
|
777
776
|
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, renderEvent, onPressEvent, onLongPressEvent, onDragEvent, onPressCell, onLongPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, labels: labelsProp }: ResourceTimelineProps<T>): ReactElement;
|
|
778
777
|
//#endregion
|
|
779
|
-
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, 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 };
|
|
778
|
+
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type EventDragHandler, type EventDragStartHandler, type EventKeyExtractor, type HourRenderer, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, type MonthListSlot, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PartialCalendarTheme, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type RenderEvent, type RenderEventArgs, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, 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 };
|
package/dist/index.js
CHANGED
|
@@ -845,6 +845,8 @@ const HOURS_PER_DAY = 24;
|
|
|
845
845
|
const MINUTES_PER_DAY = 1440;
|
|
846
846
|
const PAGE_WINDOW = 180;
|
|
847
847
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
848
|
+
const PAGER_IDLE_MS = 150;
|
|
849
|
+
const PAGER_HELD_DRAG_MS = 1e3;
|
|
848
850
|
/** Default height in pixels of one hour row on the time grid. */
|
|
849
851
|
const DEFAULT_HOUR_HEIGHT = 48;
|
|
850
852
|
const DEFAULT_MIN_HOUR_HEIGHT = 32;
|
|
@@ -2065,7 +2067,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
2065
2067
|
});
|
|
2066
2068
|
}
|
|
2067
2069
|
const TimetablePage = (0, react.memo)(TimetablePageInner);
|
|
2068
|
-
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 }) {
|
|
2070
|
+
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 }, ref) {
|
|
2069
2071
|
const clampedMinHour = Math.max(0, Math.min(minHour, 23));
|
|
2070
2072
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
2071
2073
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
@@ -2105,6 +2107,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2105
2107
|
const scrollHandler = (0, react_native_reanimated.useAnimatedScrollHandler)({ onScroll: (event) => {
|
|
2106
2108
|
scrollY.value = event.contentOffset.y;
|
|
2107
2109
|
} });
|
|
2110
|
+
const [mountOffsetY] = (0, react.useState)(seedDefaultY);
|
|
2108
2111
|
const webSeededRef = (0, react.useRef)(!isWeb$1);
|
|
2109
2112
|
const seedWebScroll = (0, react.useCallback)(() => {
|
|
2110
2113
|
if (webSeededRef.current) return;
|
|
@@ -2346,6 +2349,35 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2346
2349
|
frame = requestAnimationFrame(attempt);
|
|
2347
2350
|
return () => cancelAnimationFrame(frame);
|
|
2348
2351
|
}, [seedWebScroll]);
|
|
2352
|
+
const scrollToMinutes = (0, react.useCallback)((minutes, animated) => {
|
|
2353
|
+
webSeededRef.current = true;
|
|
2354
|
+
const y = Math.max(0, minutes / MINUTES_PER_HOUR$1 - clampedMinHour) * cellHeight.value;
|
|
2355
|
+
scrollRef.current?.scrollTo({
|
|
2356
|
+
y,
|
|
2357
|
+
animated
|
|
2358
|
+
});
|
|
2359
|
+
}, [
|
|
2360
|
+
clampedMinHour,
|
|
2361
|
+
cellHeight,
|
|
2362
|
+
scrollRef
|
|
2363
|
+
]);
|
|
2364
|
+
const appliedOffsetRef = (0, react.useRef)({
|
|
2365
|
+
minutes: scrollOffsetMinutes,
|
|
2366
|
+
minHour: clampedMinHour
|
|
2367
|
+
});
|
|
2368
|
+
(0, react.useEffect)(() => {
|
|
2369
|
+
const applied = appliedOffsetRef.current;
|
|
2370
|
+
if (applied.minutes === scrollOffsetMinutes && applied.minHour === clampedMinHour) return;
|
|
2371
|
+
appliedOffsetRef.current = {
|
|
2372
|
+
minutes: scrollOffsetMinutes,
|
|
2373
|
+
minHour: clampedMinHour
|
|
2374
|
+
};
|
|
2375
|
+
scrollToMinutes(scrollOffsetMinutes, false);
|
|
2376
|
+
}, [
|
|
2377
|
+
scrollOffsetMinutes,
|
|
2378
|
+
clampedMinHour,
|
|
2379
|
+
scrollToMinutes
|
|
2380
|
+
]);
|
|
2349
2381
|
(0, react.useEffect)(() => {
|
|
2350
2382
|
if (!isWeb$1) return;
|
|
2351
2383
|
const root = containerRef.current;
|
|
@@ -2364,6 +2396,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2364
2396
|
return () => cancelAnimationFrame(raf);
|
|
2365
2397
|
}, [columnsWidth]);
|
|
2366
2398
|
const reduceMotion = (0, react_native_reanimated.useReducedMotion)();
|
|
2399
|
+
(0, react.useImperativeHandle)(ref, () => ({ scrollToTime: (minutes, { animated = true } = {}) => scrollToMinutes(minutes, animated && !reduceMotion) }), [scrollToMinutes, reduceMotion]);
|
|
2367
2400
|
const goToPage = (0, react.useCallback)((delta) => {
|
|
2368
2401
|
const index = viewedIndexRef.current + delta;
|
|
2369
2402
|
const target = pageDates[index];
|
|
@@ -2384,16 +2417,24 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2384
2417
|
pagerOffset
|
|
2385
2418
|
]);
|
|
2386
2419
|
require_MonthList.useWebPagerKeys(swipeEnabled, goToPage);
|
|
2387
|
-
const
|
|
2388
|
-
|
|
2389
|
-
if (pendingScrollIndexRef.current != null) return;
|
|
2390
|
-
const raw = Math.round(event.nativeEvent.contentOffset.x / columnsWidth);
|
|
2420
|
+
const commitNearestPage = (0, react.useCallback)((offsetX) => {
|
|
2421
|
+
const raw = Math.round(offsetX / columnsWidth);
|
|
2391
2422
|
const index = Math.min(Math.max(raw, 0), pageDates.length - 1);
|
|
2392
2423
|
if (index !== viewedIndexRef.current) {
|
|
2393
2424
|
viewedIndexRef.current = index;
|
|
2394
2425
|
const target = pageDates[index];
|
|
2395
2426
|
if (target) onChangeDate(target);
|
|
2396
2427
|
}
|
|
2428
|
+
return index;
|
|
2429
|
+
}, [
|
|
2430
|
+
columnsWidth,
|
|
2431
|
+
pageDates,
|
|
2432
|
+
onChangeDate
|
|
2433
|
+
]);
|
|
2434
|
+
const handlePagerSettled = (0, react.useCallback)((event) => {
|
|
2435
|
+
if (columnsWidth <= 0) return;
|
|
2436
|
+
if (pendingScrollIndexRef.current != null) return;
|
|
2437
|
+
const index = commitNearestPage(event.nativeEvent.contentOffset.x);
|
|
2397
2438
|
pagerOffset.value = index * columnsWidth;
|
|
2398
2439
|
requestAnimationFrame(() => {
|
|
2399
2440
|
listRef.current?.scrollToIndex({
|
|
@@ -2403,10 +2444,62 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2403
2444
|
});
|
|
2404
2445
|
}, [
|
|
2405
2446
|
columnsWidth,
|
|
2406
|
-
|
|
2407
|
-
onChangeDate,
|
|
2447
|
+
commitNearestPage,
|
|
2408
2448
|
pagerOffset
|
|
2409
2449
|
]);
|
|
2450
|
+
const pagerDraggingRef = (0, react.useRef)(false);
|
|
2451
|
+
const lastPagerScrollRef = (0, react.useRef)({
|
|
2452
|
+
offsetX: 0,
|
|
2453
|
+
at: 0
|
|
2454
|
+
});
|
|
2455
|
+
const pagerIdleTimerRef = (0, react.useRef)(null);
|
|
2456
|
+
(0, react.useEffect)(() => () => {
|
|
2457
|
+
if (pagerIdleTimerRef.current) clearTimeout(pagerIdleTimerRef.current);
|
|
2458
|
+
}, []);
|
|
2459
|
+
const realignRestingPager = (0, react.useCallback)((offsetX) => {
|
|
2460
|
+
pagerDraggingRef.current = false;
|
|
2461
|
+
if (columnsWidth <= 0) return;
|
|
2462
|
+
const pages = offsetX / columnsWidth;
|
|
2463
|
+
if (Math.abs(pages - Math.round(pages)) * columnsWidth * react_native.PixelRatio.get() < .5) return;
|
|
2464
|
+
const index = pendingScrollIndexRef.current ?? commitNearestPage(offsetX);
|
|
2465
|
+
pagerOffset.value = index * columnsWidth;
|
|
2466
|
+
listRef.current?.scrollToIndex({
|
|
2467
|
+
index,
|
|
2468
|
+
animated: !reduceMotion
|
|
2469
|
+
});
|
|
2470
|
+
}, [
|
|
2471
|
+
columnsWidth,
|
|
2472
|
+
commitNearestPage,
|
|
2473
|
+
pagerOffset,
|
|
2474
|
+
reduceMotion
|
|
2475
|
+
]);
|
|
2476
|
+
const realignRestingPagerRef = (0, react.useRef)(realignRestingPager);
|
|
2477
|
+
realignRestingPagerRef.current = realignRestingPager;
|
|
2478
|
+
const armPagerIdleTimer = (0, react.useCallback)((delay) => {
|
|
2479
|
+
pagerIdleTimerRef.current = setTimeout(() => {
|
|
2480
|
+
const wait = pagerDraggingRef.current ? PAGER_HELD_DRAG_MS : PAGER_IDLE_MS;
|
|
2481
|
+
const remaining = lastPagerScrollRef.current.at + wait - Date.now();
|
|
2482
|
+
if (remaining > 0) {
|
|
2483
|
+
armPagerIdleTimer(remaining);
|
|
2484
|
+
return;
|
|
2485
|
+
}
|
|
2486
|
+
pagerIdleTimerRef.current = null;
|
|
2487
|
+
realignRestingPagerRef.current(lastPagerScrollRef.current.offsetX);
|
|
2488
|
+
}, delay);
|
|
2489
|
+
}, []);
|
|
2490
|
+
const handlePagerScroll = (0, react.useCallback)((event) => {
|
|
2491
|
+
lastPagerScrollRef.current = {
|
|
2492
|
+
offsetX: event.nativeEvent.contentOffset.x,
|
|
2493
|
+
at: Date.now()
|
|
2494
|
+
};
|
|
2495
|
+
if (!pagerIdleTimerRef.current) armPagerIdleTimer(PAGER_IDLE_MS);
|
|
2496
|
+
}, [armPagerIdleTimer]);
|
|
2497
|
+
const handlePagerDragStart = (0, react.useCallback)(() => {
|
|
2498
|
+
pagerDraggingRef.current = true;
|
|
2499
|
+
}, []);
|
|
2500
|
+
const handlePagerDragEnd = (0, react.useCallback)(() => {
|
|
2501
|
+
pagerDraggingRef.current = false;
|
|
2502
|
+
}, []);
|
|
2410
2503
|
const handlePressCell = (0, react.useMemo)(() => {
|
|
2411
2504
|
if (!onPressCell) return void 0;
|
|
2412
2505
|
if (!resetPageOnPressCell) return onPressCell;
|
|
@@ -2572,7 +2665,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2572
2665
|
refreshControl: verticalScrollEnabled ? refreshControl : void 0,
|
|
2573
2666
|
contentOffset: {
|
|
2574
2667
|
x: 0,
|
|
2575
|
-
y:
|
|
2668
|
+
y: mountOffsetY
|
|
2576
2669
|
},
|
|
2577
2670
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
2578
2671
|
testID: "time-grid-hours",
|
|
@@ -2626,7 +2719,12 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2626
2719
|
decelerationRate: freeSwipe ? "normal" : "fast",
|
|
2627
2720
|
disableIntervalMomentum: !freeSwipe,
|
|
2628
2721
|
scrollEventThrottle: 16,
|
|
2629
|
-
onMomentumScrollEnd: handlePagerSettled
|
|
2722
|
+
onMomentumScrollEnd: handlePagerSettled,
|
|
2723
|
+
...react_native.Platform.OS === "android" ? {
|
|
2724
|
+
onScroll: handlePagerScroll,
|
|
2725
|
+
onScrollBeginDrag: handlePagerDragStart,
|
|
2726
|
+
onScrollEndDrag: handlePagerDragEnd
|
|
2727
|
+
} : null
|
|
2630
2728
|
},
|
|
2631
2729
|
initialScrollIndex: activeIndex,
|
|
2632
2730
|
showsHorizontalScrollIndicator: false,
|
|
@@ -2674,7 +2772,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2674
2772
|
* />
|
|
2675
2773
|
* ```
|
|
2676
2774
|
*/
|
|
2677
|
-
const TimeGrid = (0, react.memo)(TimeGridInner);
|
|
2775
|
+
const TimeGrid = (0, react.memo)((0, react.forwardRef)(TimeGridInner));
|
|
2678
2776
|
const DayHeaderRow = ({ days, mode, dayWidth, weekdayFormat, todayLabel, locale, activeDate, onPressDateHeader }) => {
|
|
2679
2777
|
const slot = require_MonthList.useSlots();
|
|
2680
2778
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
@@ -2968,10 +3066,13 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
2968
3066
|
* }
|
|
2969
3067
|
* ```
|
|
2970
3068
|
*/
|
|
2971
|
-
|
|
3069
|
+
const Calendar = (0, react.forwardRef)(CalendarInner);
|
|
3070
|
+
function CalendarInner({ 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 }, ref) {
|
|
2972
3071
|
const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
|
|
2973
3072
|
const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
2974
3073
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
3074
|
+
const timeGridRef = (0, react.useRef)(null);
|
|
3075
|
+
(0, react.useImperativeHandle)(ref, () => ({ scrollToTime: (minutes, options) => timeGridRef.current?.scrollToTime(minutes, options) }), []);
|
|
2975
3076
|
const displayEvents = (0, react.useMemo)(() => {
|
|
2976
3077
|
let out = events;
|
|
2977
3078
|
if (out.some((e) => e.recurrence)) {
|
|
@@ -3123,6 +3224,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
3123
3224
|
classNames,
|
|
3124
3225
|
styles: styleOverrides
|
|
3125
3226
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeGrid, {
|
|
3227
|
+
ref: timeGridRef,
|
|
3126
3228
|
mode,
|
|
3127
3229
|
numberOfDays,
|
|
3128
3230
|
weekEndsOn,
|