@super-calendar/native 2.10.0 → 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{DefaultMonthEvent--9Jg6w-x.d.ts → DefaultMonthEvent-B9KzVzFa.d.mts} +11 -5
- package/dist/{DefaultMonthEvent-BlnKHaq2.d.mts → DefaultMonthEvent-DlIIWDzr.d.ts} +11 -5
- package/dist/{MonthList-CjKhzOJX.mjs → MonthList-B-UE37ZG.mjs} +166 -139
- package/dist/{MonthList-DNT1LJkk.js → MonthList-sGAZxQZ_.js} +176 -137
- package/dist/index.d.mts +67 -21
- package/dist/index.d.ts +67 -21
- package/dist/index.js +1121 -772
- package/dist/index.mjs +1117 -774
- package/dist/picker.d.mts +1 -1
- package/dist/picker.d.ts +1 -1
- package/dist/picker.js +1 -1
- package/dist/picker.mjs +1 -1
- package/package.json +3 -3
- package/src/components/Agenda.tsx +5 -1
- package/src/components/AllDayLane.tsx +36 -53
- package/src/components/Calendar.tsx +196 -149
- package/src/components/DefaultEvent.tsx +3 -0
- package/src/components/DefaultMonthEvent.tsx +3 -0
- package/src/components/MonthList.tsx +6 -0
- package/src/components/MonthPager.tsx +6 -0
- package/src/components/MonthView.tsx +195 -172
- package/src/components/MultiDayMovePreview.tsx +1 -3
- package/src/components/ResourceTimeline.tsx +18 -7
- package/src/components/TimeGrid.tsx +1409 -903
- package/src/components/YearView.tsx +22 -5
- package/src/index.tsx +1 -0
- package/src/utils/labels.ts +13 -0
package/dist/picker.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as CalendarTheme, E as RenderEventArgs, F as mergeTheme, I as useCalendarTheme, M as PartialCalendarTheme, N as darkTheme, O as WeekStartsOn, P as defaultTheme, S as ICalendarEvent, T as RenderEvent, a as MonthPager, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, x as EventKeyExtractor } from "./DefaultMonthEvent-
|
|
1
|
+
import { A as CalendarTheme, E as RenderEventArgs, F as mergeTheme, I as useCalendarTheme, M as PartialCalendarTheme, N as darkTheme, O as WeekStartsOn, P as defaultTheme, S as ICalendarEvent, T as RenderEvent, a as MonthPager, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, x as EventKeyExtractor } from "./DefaultMonthEvent-B9KzVzFa.mjs";
|
|
2
2
|
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/dist/picker.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as CalendarTheme, E as RenderEventArgs, F as mergeTheme, I as useCalendarTheme, M as PartialCalendarTheme, N as darkTheme, O as WeekStartsOn, P as defaultTheme, S as ICalendarEvent, T as RenderEvent, a as MonthPager, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, x as EventKeyExtractor } from "./DefaultMonthEvent
|
|
1
|
+
import { A as CalendarTheme, E as RenderEventArgs, F as mergeTheme, I as useCalendarTheme, M as PartialCalendarTheme, N as darkTheme, O as WeekStartsOn, P as defaultTheme, S as ICalendarEvent, T as RenderEvent, a as MonthPager, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, x as EventKeyExtractor } from "./DefaultMonthEvent-DlIIWDzr.js";
|
|
2
2
|
import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/dist/picker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_MonthList = require("./MonthList-
|
|
2
|
+
const require_MonthList = require("./MonthList-sGAZxQZ_.js");
|
|
3
3
|
let _super_calendar_core = require("@super-calendar/core");
|
|
4
4
|
exports.CalendarThemeProvider = require_MonthList.CalendarThemeProvider;
|
|
5
5
|
exports.DefaultMonthEvent = require_MonthList.DefaultMonthEvent;
|
package/dist/picker.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as CalendarThemeProvider, g as useCalendarTheme, h as mergeTheme, i as MonthView, m as defaultTheme, n as DefaultMonthEvent, p as darkTheme, r as MonthPager, t as MonthList } from "./MonthList-B-UE37ZG.mjs";
|
|
2
2
|
import { buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
|
|
3
3
|
export { CalendarThemeProvider, DefaultMonthEvent, MonthList, MonthPager, MonthView, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "Gesture-driven, virtualized month / week / day calendar and date picker for React Native (and web via react-native-web).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agenda",
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@super-calendar/core": "2.
|
|
67
|
+
"@super-calendar/core": "2.11.1"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@legendapp/list": ">=3",
|
|
71
71
|
"date-fns": ">=3",
|
|
72
72
|
"react": ">=18",
|
|
73
|
-
"react-native": ">=0.74",
|
|
73
|
+
"react-native": ">=0.74 <2",
|
|
74
74
|
"react-native-gesture-handler": ">=2.16",
|
|
75
75
|
"react-native-reanimated": ">=4.0.0 <5",
|
|
76
76
|
"react-native-worklets": ">=0.5"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LegendList, type LegendListRenderItemProps } from "@legendapp/list/react-native";
|
|
2
2
|
import { format, isSameDay, type Locale, startOfDay } from "date-fns";
|
|
3
3
|
import { type ComponentType, type ReactElement, useCallback, useMemo } from "react";
|
|
4
|
-
import { StyleSheet, Text, type TextStyle, View } from "react-native";
|
|
4
|
+
import { StyleSheet, Text, type TextStyle, View, type ScrollViewProps } from "react-native";
|
|
5
5
|
import { useCalendarTheme } from "../theme";
|
|
6
6
|
import type { CalendarEvent, EventKeyExtractor, RenderEvent } from "../types";
|
|
7
7
|
import { createSlots, type SlotStyleProps } from "../utils/slots";
|
|
@@ -27,6 +27,8 @@ export type AgendaProps<T> = SlotStyleProps<AgendaSlot> & {
|
|
|
27
27
|
activeDate?: Date;
|
|
28
28
|
/** Drawn between rows of the agenda list. */
|
|
29
29
|
itemSeparatorComponent?: ComponentType<unknown> | null;
|
|
30
|
+
/** Pull-to-refresh control, mounted on the list's scroll view. */
|
|
31
|
+
refreshControl?: ScrollViewProps["refreshControl"];
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
type Row<T> =
|
|
@@ -48,6 +50,7 @@ export function Agenda<T>({
|
|
|
48
50
|
onPressDay,
|
|
49
51
|
activeDate,
|
|
50
52
|
itemSeparatorComponent,
|
|
53
|
+
refreshControl,
|
|
51
54
|
classNames,
|
|
52
55
|
styles: styleOverrides,
|
|
53
56
|
}: AgendaProps<T>): ReactElement {
|
|
@@ -145,6 +148,7 @@ export function Agenda<T>({
|
|
|
145
148
|
(itemSeparatorComponent ?? undefined) as ComponentType<{ leadingItem: Row<T> }> | undefined
|
|
146
149
|
}
|
|
147
150
|
recycleItems={false}
|
|
151
|
+
refreshControl={refreshControl}
|
|
148
152
|
/>
|
|
149
153
|
);
|
|
150
154
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addDays, startOfDay } from "date-fns";
|
|
2
|
-
import {
|
|
2
|
+
import { type LayoutChangeEvent, StyleSheet, View } from "react-native";
|
|
3
3
|
import { useCalendarTheme } from "../theme";
|
|
4
4
|
import type { CalendarEvent, CalendarMode, EventKeyExtractor, RenderEvent } from "../types";
|
|
5
5
|
import { useSlots } from "../utils/slots";
|
|
@@ -7,36 +7,38 @@ import { isAllDayEvent, isBackgroundEvent } from "@super-calendar/core";
|
|
|
7
7
|
|
|
8
8
|
// The lane's slots are a subset of the TimeGrid slot union; typed locally so
|
|
9
9
|
// this file doesn't import the full TimeGrid type.
|
|
10
|
-
type AllDayLaneSlot = "allDayLane" | "
|
|
10
|
+
type AllDayLaneSlot = "allDayLane" | "allDayColumn" | "allDayEvent";
|
|
11
11
|
|
|
12
12
|
type AllDayLaneProps<T> = {
|
|
13
13
|
days: Date[];
|
|
14
14
|
events: CalendarEvent<T>[];
|
|
15
15
|
mode: CalendarMode;
|
|
16
|
-
hourColumnWidth: number;
|
|
17
16
|
dayWidth: number;
|
|
18
17
|
renderEvent: RenderEvent<T>;
|
|
19
18
|
keyExtractor: EventKeyExtractor<T>;
|
|
20
19
|
onPressEvent: (event: CalendarEvent<T>) => void;
|
|
21
20
|
onLongPressEvent?: (event: CalendarEvent<T>) => void;
|
|
21
|
+
/** Reports the lane's natural height, which the grid's all-day band follows. */
|
|
22
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
|
-
* The all-day lane
|
|
26
|
-
* excluded from the timed columns (see `layoutDayEvents`) and shown
|
|
27
|
-
* stacked under their day(s).
|
|
28
|
-
*
|
|
26
|
+
* The all-day lane of one page, pinned above the scrolling hours. All-day
|
|
27
|
+
* events are excluded from the timed columns (see `layoutDayEvents`) and shown
|
|
28
|
+
* here, stacked under their day(s). Always rendered so every page reports a
|
|
29
|
+
* height, zero when the week has none, which the band above the grid follows
|
|
30
|
+
* live as you swipe; the "all-day" label lives in the hour column.
|
|
29
31
|
*/
|
|
30
32
|
export function AllDayLane<T>({
|
|
31
33
|
days,
|
|
32
34
|
events,
|
|
33
35
|
mode,
|
|
34
|
-
hourColumnWidth,
|
|
35
36
|
dayWidth,
|
|
36
37
|
renderEvent,
|
|
37
38
|
keyExtractor,
|
|
38
39
|
onPressEvent,
|
|
39
40
|
onLongPressEvent,
|
|
41
|
+
onLayout,
|
|
40
42
|
}: AllDayLaneProps<T>) {
|
|
41
43
|
const theme = useCalendarTheme();
|
|
42
44
|
const slot = useSlots<AllDayLaneSlot>();
|
|
@@ -50,50 +52,40 @@ export function AllDayLane<T>({
|
|
|
50
52
|
return allDay.filter((event) => event.start < next && event.end > start);
|
|
51
53
|
});
|
|
52
54
|
|
|
53
|
-
if (perDay.every((list) => list.length === 0)) return null;
|
|
54
|
-
|
|
55
55
|
return (
|
|
56
56
|
<View
|
|
57
57
|
{...slot("allDayLane", {
|
|
58
58
|
base: styles.lane,
|
|
59
|
-
themed:
|
|
59
|
+
themed: theme.containers.allDayLane,
|
|
60
60
|
})}
|
|
61
|
+
onLayout={onLayout}
|
|
61
62
|
>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<RenderEventComponent
|
|
87
|
-
event={event}
|
|
88
|
-
mode={mode}
|
|
89
|
-
isAllDay
|
|
90
|
-
onPress={() => onPressEvent(event)}
|
|
91
|
-
onLongPress={onLongPressEvent ? () => onLongPressEvent(event) : undefined}
|
|
92
|
-
/>
|
|
63
|
+
{perDay.every((list) => list.length === 0)
|
|
64
|
+
? null
|
|
65
|
+
: days.map((day, dayIndex) => (
|
|
66
|
+
<View
|
|
67
|
+
key={day.toISOString()}
|
|
68
|
+
{...slot("allDayColumn", {
|
|
69
|
+
base: [styles.column, { width: dayWidth }],
|
|
70
|
+
themed: theme.containers.allDayColumn,
|
|
71
|
+
})}
|
|
72
|
+
>
|
|
73
|
+
{perDay[dayIndex].map((event, index) => (
|
|
74
|
+
<View
|
|
75
|
+
key={keyExtractor(event, index)}
|
|
76
|
+
{...slot("allDayEvent", { base: styles.chip })}
|
|
77
|
+
>
|
|
78
|
+
<RenderEventComponent
|
|
79
|
+
event={event}
|
|
80
|
+
mode={mode}
|
|
81
|
+
isAllDay
|
|
82
|
+
onPress={() => onPressEvent(event)}
|
|
83
|
+
onLongPress={onLongPressEvent ? () => onLongPressEvent(event) : undefined}
|
|
84
|
+
/>
|
|
85
|
+
</View>
|
|
86
|
+
))}
|
|
93
87
|
</View>
|
|
94
88
|
))}
|
|
95
|
-
</View>
|
|
96
|
-
))}
|
|
97
89
|
</View>
|
|
98
90
|
);
|
|
99
91
|
}
|
|
@@ -101,15 +93,6 @@ export function AllDayLane<T>({
|
|
|
101
93
|
const styles = StyleSheet.create({
|
|
102
94
|
lane: {
|
|
103
95
|
flexDirection: "row",
|
|
104
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
105
|
-
},
|
|
106
|
-
gutter: {
|
|
107
|
-
justifyContent: "center",
|
|
108
|
-
},
|
|
109
|
-
label: {
|
|
110
|
-
fontSize: 10,
|
|
111
|
-
textAlign: "right",
|
|
112
|
-
paddingRight: 6,
|
|
113
96
|
},
|
|
114
97
|
column: {
|
|
115
98
|
paddingVertical: 2,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
startOfYear,
|
|
14
14
|
} from "date-fns";
|
|
15
15
|
import { type ReactElement, useCallback, useMemo } from "react";
|
|
16
|
-
import type { StyleProp, ViewStyle } from "react-native";
|
|
16
|
+
import type { ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
17
17
|
import { useSharedValue } from "react-native-reanimated";
|
|
18
18
|
import { CalendarThemeProvider, mergeTheme, type PartialCalendarTheme } from "../theme";
|
|
19
19
|
import type {
|
|
@@ -34,6 +34,8 @@ import {
|
|
|
34
34
|
type WeekdayFormat,
|
|
35
35
|
getViewDays,
|
|
36
36
|
} from "@super-calendar/core";
|
|
37
|
+
import { type CalendarLabels, resolveCalendarLabels } from "@super-calendar/core";
|
|
38
|
+
import { CalendarLabelsContext } from "../utils/labels";
|
|
37
39
|
import { type SlotStyleProps } from "../utils/slots";
|
|
38
40
|
import { YearView, type YearViewSlot } from "./YearView";
|
|
39
41
|
import { Agenda, type AgendaSlot } from "./Agenda";
|
|
@@ -158,6 +160,8 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
158
160
|
sortedMonthView?: boolean;
|
|
159
161
|
/** Month overflow label template; `{moreCount}` is replaced. Default "{moreCount} More". */
|
|
160
162
|
moreLabel?: string;
|
|
163
|
+
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
164
|
+
labels?: Partial<CalendarLabels>;
|
|
161
165
|
/** Show dimmed adjacent-month days in the month grid. Default true. */
|
|
162
166
|
showAdjacentMonths?: boolean;
|
|
163
167
|
/** Ignore taps on month-cell events (day taps still fire). Default false. */
|
|
@@ -207,6 +211,18 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
207
211
|
* band stays non-interactive and hidden from assistive tech.
|
|
208
212
|
*/
|
|
209
213
|
renderBusinessHours?: (band: BusinessHoursBand) => React.ReactNode;
|
|
214
|
+
/**
|
|
215
|
+
* Week/day grid only: a component that draws a `display: "background"` event's
|
|
216
|
+
* band in place of the themed shade. Rendered as a real component, like
|
|
217
|
+
* `renderEvent`, so it may use hooks. It receives `event`, `mode`, a live
|
|
218
|
+
* `boxHeight`, `continuesBefore` / `continuesAfter` for a multi-day event, and
|
|
219
|
+
* `onPress` / `onLongPress`, which fire `onPressEvent` / `onLongPressEvent`.
|
|
220
|
+
* The band lets touches through to what you render and stops hiding itself
|
|
221
|
+
* from assistive tech, so a pressable there works; cell presses and
|
|
222
|
+
* drag-to-create are unreachable underneath it. Without this prop the band
|
|
223
|
+
* stays a shaded, non-interactive range. The resource timeline keeps the shade.
|
|
224
|
+
*/
|
|
225
|
+
renderBackgroundEvent?: RenderEvent<T>;
|
|
210
226
|
/** Stable key per event. Defaults to start-time + index. */
|
|
211
227
|
keyExtractor?: EventKeyExtractor<T>;
|
|
212
228
|
/** Partial theme merged over the defaults. */
|
|
@@ -234,11 +250,26 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
234
250
|
/** Sub-hour divider lines per hour on the week/day grid (e.g. 2 = half-hours). Default 1. */
|
|
235
251
|
timeslots?: number;
|
|
236
252
|
/**
|
|
237
|
-
* Show the all-day lane above the week/day grid. Default true
|
|
238
|
-
*
|
|
239
|
-
*
|
|
253
|
+
* Show the all-day lane above the week/day grid. Default true: the lane is
|
|
254
|
+
* sized to the week's all-day events, collapsing to nothing when there are
|
|
255
|
+
* none, and its height follows the week as you swipe. When false the lane is
|
|
256
|
+
* never rendered, so
|
|
257
|
+
* all-day events (see `ICalendarEvent.allDay` and whole-day spans) are not
|
|
258
|
+
* shown on the time grid.
|
|
240
259
|
*/
|
|
241
260
|
showAllDayEventCell?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Show the "all-day" text label in the week/day hour column. Default false: a
|
|
263
|
+
* week with no all-day events then shows no lane at all, rather than a label
|
|
264
|
+
* beside an empty row; with the label on, it slides away with the lane.
|
|
265
|
+
*/
|
|
266
|
+
showAllDayLabel?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Pull-to-refresh for the modes that scroll vertically: pass a `RefreshControl`
|
|
269
|
+
* element and it wraps the schedule list, the week/day grid's scroll view or
|
|
270
|
+
* the year view. Month pages scroll sideways, so it has no effect there.
|
|
271
|
+
*/
|
|
272
|
+
refreshControl?: ScrollViewProps["refreshControl"];
|
|
242
273
|
/** Tint weekend columns (default true). Set false to treat weekends normally. */
|
|
243
274
|
highlightWeekends?: boolean;
|
|
244
275
|
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
@@ -442,6 +473,7 @@ export function Calendar<T>({
|
|
|
442
473
|
maxVisibleEventCount,
|
|
443
474
|
sortedMonthView,
|
|
444
475
|
moreLabel,
|
|
476
|
+
labels,
|
|
445
477
|
showAdjacentMonths,
|
|
446
478
|
disableMonthEventCellPress,
|
|
447
479
|
weekStartsOn = 0,
|
|
@@ -456,6 +488,7 @@ export function Calendar<T>({
|
|
|
456
488
|
calendarCellStyle,
|
|
457
489
|
businessHours,
|
|
458
490
|
renderBusinessHours,
|
|
491
|
+
renderBackgroundEvent,
|
|
459
492
|
keyExtractor = defaultKeyExtractor as EventKeyExtractor<T>,
|
|
460
493
|
theme,
|
|
461
494
|
cellHeight: cellHeightProp,
|
|
@@ -468,6 +501,8 @@ export function Calendar<T>({
|
|
|
468
501
|
hideHours,
|
|
469
502
|
timeslots,
|
|
470
503
|
showAllDayEventCell,
|
|
504
|
+
showAllDayLabel,
|
|
505
|
+
refreshControl,
|
|
471
506
|
highlightWeekends,
|
|
472
507
|
eventStartEditable,
|
|
473
508
|
eventDurationEditable,
|
|
@@ -600,153 +635,165 @@ export function Calendar<T>({
|
|
|
600
635
|
eventAccessibilityLabel,
|
|
601
636
|
]);
|
|
602
637
|
|
|
638
|
+
const resolvedLabels = useMemo(() => resolveCalendarLabels(labels), [labels]);
|
|
639
|
+
|
|
603
640
|
return (
|
|
604
641
|
<CalendarThemeProvider value={mergedTheme}>
|
|
605
|
-
{
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
642
|
+
<CalendarLabelsContext.Provider value={resolvedLabels}>
|
|
643
|
+
{mode === "month" ? (
|
|
644
|
+
<MonthPager
|
|
645
|
+
date={date}
|
|
646
|
+
events={displayEvents}
|
|
647
|
+
maxVisibleEventCount={maxVisibleEventCount}
|
|
648
|
+
weekStartsOn={weekStartsOn}
|
|
649
|
+
hiddenDays={hiddenDays}
|
|
650
|
+
weekdayFormat={weekdayFormat}
|
|
651
|
+
locale={locale}
|
|
652
|
+
labels={labels}
|
|
653
|
+
sortedMonthView={sortedMonthView}
|
|
654
|
+
moreLabel={moreLabel}
|
|
655
|
+
showAdjacentMonths={showAdjacentMonths}
|
|
656
|
+
highlightWeekends={highlightWeekends}
|
|
657
|
+
disableMonthEventCellPress={disableMonthEventCellPress}
|
|
658
|
+
isRTL={isRTL}
|
|
659
|
+
showSixWeeks={showSixWeeks}
|
|
660
|
+
showTitle={showTitle}
|
|
661
|
+
activeDate={activeDate}
|
|
662
|
+
renderHeaderForMonthView={renderHeaderForMonthView}
|
|
663
|
+
renderCustomDateForMonth={renderCustomDateForMonth}
|
|
664
|
+
calendarCellStyle={calendarCellStyle}
|
|
665
|
+
renderEvent={resolvedRenderEvent}
|
|
666
|
+
keyExtractor={keyExtractor}
|
|
667
|
+
onPressDay={onPressDay}
|
|
668
|
+
onLongPressDay={onLongPressDay}
|
|
669
|
+
onPressCell={onPressCell}
|
|
670
|
+
onPressEvent={handlePressEvent}
|
|
671
|
+
onLongPressEvent={handleLongPressEvent}
|
|
672
|
+
onPressMore={onPressMore}
|
|
673
|
+
onCreateEvent={onCreateEvent}
|
|
674
|
+
onSelectDrag={onSelectDrag}
|
|
675
|
+
onDragEvent={onDragEvent}
|
|
676
|
+
onDragStart={onDragStart}
|
|
677
|
+
eventStartEditable={eventStartEditable}
|
|
678
|
+
eventOverlap={eventOverlap}
|
|
679
|
+
selectedDates={selectedDates}
|
|
680
|
+
selectedRange={selectedRange}
|
|
681
|
+
fillCellOnSelection={fillCellOnSelection}
|
|
682
|
+
minDate={minDate}
|
|
683
|
+
maxDate={maxDate}
|
|
684
|
+
isDateDisabled={isDateDisabled}
|
|
685
|
+
onChangeDate={handleChangeDate}
|
|
686
|
+
freeSwipe={freeSwipe}
|
|
687
|
+
swipeEnabled={swipeEnabled}
|
|
688
|
+
classNames={classNames}
|
|
689
|
+
styles={styleOverrides}
|
|
690
|
+
/>
|
|
691
|
+
) : mode === "year" ? (
|
|
692
|
+
<YearView
|
|
693
|
+
date={date}
|
|
694
|
+
events={displayEvents}
|
|
695
|
+
refreshControl={refreshControl}
|
|
696
|
+
weekStartsOn={weekStartsOn}
|
|
697
|
+
hiddenDays={hiddenDays}
|
|
698
|
+
locale={locale}
|
|
699
|
+
labels={labels}
|
|
700
|
+
activeDate={activeDate}
|
|
701
|
+
selectedDates={selectedDates}
|
|
702
|
+
selectedRange={selectedRange}
|
|
703
|
+
minDate={minDate}
|
|
704
|
+
maxDate={maxDate}
|
|
705
|
+
isDateDisabled={isDateDisabled}
|
|
706
|
+
onPressDay={onPressDay}
|
|
707
|
+
onPressMonth={onPressMonth}
|
|
708
|
+
onSelectDrag={onSelectDrag}
|
|
709
|
+
onCreateEvent={onCreateEvent}
|
|
710
|
+
classNames={classNames}
|
|
711
|
+
styles={styleOverrides}
|
|
712
|
+
/>
|
|
713
|
+
) : mode === "schedule" ? (
|
|
714
|
+
<Agenda
|
|
715
|
+
events={displayEvents}
|
|
716
|
+
locale={locale}
|
|
717
|
+
renderEvent={resolvedRenderEvent}
|
|
718
|
+
keyExtractor={keyExtractor}
|
|
719
|
+
onPressEvent={handlePressEvent}
|
|
720
|
+
onLongPressEvent={handleLongPressEvent}
|
|
721
|
+
onPressDay={onPressDay}
|
|
722
|
+
activeDate={activeDate}
|
|
723
|
+
itemSeparatorComponent={itemSeparatorComponent}
|
|
724
|
+
refreshControl={refreshControl}
|
|
725
|
+
classNames={classNames}
|
|
726
|
+
styles={styleOverrides}
|
|
727
|
+
/>
|
|
728
|
+
) : (
|
|
729
|
+
<TimeGrid
|
|
730
|
+
mode={mode}
|
|
731
|
+
numberOfDays={numberOfDays}
|
|
732
|
+
weekEndsOn={weekEndsOn}
|
|
733
|
+
date={date}
|
|
734
|
+
events={displayEvents}
|
|
735
|
+
cellHeight={cellHeight}
|
|
736
|
+
hourHeight={hourHeight}
|
|
737
|
+
weekStartsOn={weekStartsOn}
|
|
738
|
+
weekdayFormat={weekdayFormat}
|
|
739
|
+
hiddenDays={hiddenDays}
|
|
740
|
+
now={now}
|
|
741
|
+
timeZone={timeZone}
|
|
742
|
+
renderEvent={resolvedRenderEvent}
|
|
743
|
+
keyExtractor={keyExtractor}
|
|
744
|
+
scrollOffsetMinutes={scrollOffsetMinutes}
|
|
745
|
+
hourColumnWidth={hourColumnWidth}
|
|
746
|
+
hideHours={hideHours}
|
|
747
|
+
timeslots={timeslots}
|
|
748
|
+
showAllDayEventCell={showAllDayEventCell}
|
|
749
|
+
showAllDayLabel={showAllDayLabel}
|
|
750
|
+
refreshControl={refreshControl}
|
|
751
|
+
highlightWeekends={highlightWeekends}
|
|
752
|
+
eventStartEditable={eventStartEditable}
|
|
753
|
+
eventDurationEditable={eventDurationEditable}
|
|
754
|
+
eventOverlap={eventOverlap}
|
|
755
|
+
calendarCellStyle={calendarCellStyle}
|
|
756
|
+
businessHours={businessHours}
|
|
757
|
+
renderBusinessHours={renderBusinessHours}
|
|
758
|
+
renderBackgroundEvent={renderBackgroundEvent}
|
|
759
|
+
showWeekNumber={showWeekNumber}
|
|
760
|
+
weekNumberPrefix={weekNumberPrefix}
|
|
761
|
+
hourComponent={hourComponent}
|
|
762
|
+
showVerticalScrollIndicator={showVerticalScrollIndicator}
|
|
763
|
+
verticalScrollEnabled={verticalScrollEnabled}
|
|
764
|
+
headerComponent={headerComponent}
|
|
765
|
+
minHour={minHour}
|
|
766
|
+
maxHour={maxHour}
|
|
767
|
+
ampm={ampm}
|
|
768
|
+
minHourHeight={minHourHeight}
|
|
769
|
+
maxHourHeight={maxHourHeight}
|
|
770
|
+
minEventHeight={minEventHeight}
|
|
771
|
+
eventGap={eventGap}
|
|
772
|
+
showNowIndicator={showNowIndicator}
|
|
773
|
+
locale={locale}
|
|
774
|
+
labels={labels}
|
|
775
|
+
activeDate={activeDate}
|
|
776
|
+
isRTL={isRTL}
|
|
777
|
+
freeSwipe={freeSwipe}
|
|
778
|
+
swipeEnabled={swipeEnabled}
|
|
779
|
+
onPressEvent={handlePressEvent}
|
|
780
|
+
onLongPressEvent={handleLongPressEvent}
|
|
781
|
+
onDragEvent={onDragEvent}
|
|
782
|
+
showDragHandle={showDragHandle}
|
|
783
|
+
onDragStart={onDragStart}
|
|
784
|
+
dragStepMinutes={dragStepMinutes}
|
|
785
|
+
onPressCell={onPressCell}
|
|
786
|
+
resetPageOnPressCell={resetPageOnPressCell}
|
|
787
|
+
onLongPressCell={onLongPressCell}
|
|
788
|
+
onCreateEvent={onCreateEvent}
|
|
789
|
+
onPressDateHeader={onPressDateHeader}
|
|
790
|
+
onChangeDate={handleChangeDate}
|
|
791
|
+
renderHeader={renderTimeGridHeader}
|
|
792
|
+
classNames={classNames}
|
|
793
|
+
styles={styleOverrides}
|
|
794
|
+
/>
|
|
795
|
+
)}
|
|
796
|
+
</CalendarLabelsContext.Provider>
|
|
750
797
|
</CalendarThemeProvider>
|
|
751
798
|
);
|
|
752
799
|
}
|