@super-calendar/native 2.8.2 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{DefaultMonthEvent-C_T4thzu.d.ts → DefaultMonthEvent--9Jg6w-x.d.ts} +82 -3
- package/dist/{DefaultMonthEvent-Cewbec1K.d.mts → DefaultMonthEvent-BlnKHaq2.d.mts} +82 -3
- package/dist/{MonthList-DjAz4xoi.mjs → MonthList-CjKhzOJX.mjs} +356 -102
- package/dist/{MonthList-C-vBotP0.js → MonthList-DNT1LJkk.js} +355 -101
- package/dist/index.d.mts +85 -37
- package/dist/index.d.ts +85 -37
- package/dist/index.js +377 -60
- package/dist/index.mjs +378 -61
- 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 +2 -2
- package/src/components/Calendar.tsx +79 -16
- package/src/components/MonthPager.tsx +150 -62
- package/src/components/MonthView.tsx +415 -76
- package/src/components/TimeGrid.tsx +242 -31
- package/src/components/YearView.tsx +368 -81
- package/src/types.ts +19 -0
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-DNT1LJkk.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 { d as darkTheme, f as defaultTheme, i as MonthView, m as useCalendarTheme, n as DefaultMonthEvent, p as mergeTheme, r as MonthPager, t as MonthList, u as CalendarThemeProvider } from "./MonthList-
|
|
1
|
+
import { d as darkTheme, f as defaultTheme, i as MonthView, m as useCalendarTheme, n as DefaultMonthEvent, p as mergeTheme, r as MonthPager, t as MonthList, u as CalendarThemeProvider } from "./MonthList-CjKhzOJX.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.9.0",
|
|
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,7 +64,7 @@
|
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@super-calendar/core": "2.
|
|
67
|
+
"@super-calendar/core": "2.9.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@legendapp/list": ">=3",
|
|
@@ -27,6 +27,7 @@ import type {
|
|
|
27
27
|
WeekStartsOn,
|
|
28
28
|
} from "../types";
|
|
29
29
|
import {
|
|
30
|
+
type DateRange,
|
|
30
31
|
type EventAccessibilityLabeler,
|
|
31
32
|
eventsInTimeZone,
|
|
32
33
|
expandRecurringEvents,
|
|
@@ -67,19 +68,20 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
67
68
|
/** Long-press an event (month/week/day). */
|
|
68
69
|
onLongPressEvent?: (event: CalendarEvent<T>) => void;
|
|
69
70
|
/**
|
|
70
|
-
* Enable drag-to-move and drag-to-resize
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
71
|
+
* Enable drag-to-move and drag-to-resize. Called with the dragged event and its
|
|
72
|
+
* new start/end; update your own event state in response. On the week/day grid,
|
|
73
|
+
* long-press an event to move it (drag horizontally to change the day too) or
|
|
74
|
+
* drag its bottom grip to resize, snapped to `dragStepMinutes`. In `month` mode,
|
|
75
|
+
* long-press an event bar and drop it on another day: both ends shift by the
|
|
76
|
+
* days dragged, so the time of day and duration are kept. Return `false` to
|
|
77
|
+
* reject the drop (e.g. an overlap) and snap the event back.
|
|
75
78
|
*/
|
|
76
79
|
onDragEvent?: EventDragHandler<T>;
|
|
77
80
|
/**
|
|
78
|
-
* Fired when a
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* `onDragEvent` is also set.
|
|
81
|
+
* Fired when a drag gesture begins, before any change is committed: on grab for
|
|
82
|
+
* a move (after the long-press), and when a week/day resize drag starts. Use it
|
|
83
|
+
* to trigger haptic feedback, e.g. `Haptics.impactAsync()` from `expo-haptics`.
|
|
84
|
+
* Native-only and inert unless `onDragEvent` is also set.
|
|
83
85
|
*/
|
|
84
86
|
onDragStart?: EventDragStartHandler<T>;
|
|
85
87
|
/** Minutes a drag-to-move/resize snaps to. Default 15. */
|
|
@@ -97,20 +99,47 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
97
99
|
onLongPressDay?: (date: Date) => void;
|
|
98
100
|
/** Tap the "+N more" overflow label in a month cell. */
|
|
99
101
|
onPressMore?: (events: CalendarEvent<T>[], date: Date) => void;
|
|
100
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Tap empty space; receives the date+time pressed on the week/day grid, or the
|
|
104
|
+
* tapped day at midnight in `month` mode (where it fires alongside `onPressDay`).
|
|
105
|
+
*/
|
|
101
106
|
onPressCell?: (date: Date) => void;
|
|
102
107
|
/** After an empty-cell press, snap the pager back to the active page. Default false. */
|
|
103
108
|
resetPageOnPressCell?: boolean;
|
|
104
109
|
/** Long-press empty space on the week/day grid; receives the date+time. */
|
|
105
110
|
onLongPressCell?: (date: Date) => void;
|
|
106
111
|
/**
|
|
107
|
-
* Enable drag-to-create
|
|
108
|
-
*
|
|
109
|
-
* `
|
|
110
|
-
*
|
|
111
|
-
* `
|
|
112
|
+
* Enable drag-to-create: long-press empty space and drag to sweep out a new
|
|
113
|
+
* event, then release. On the week/day grid that is a time range snapped to
|
|
114
|
+
* `dragStepMinutes` (a stationary press yields a one-step range); in `month`
|
|
115
|
+
* mode it is an **all-day** span across the days swept — `start` at midnight of
|
|
116
|
+
* the first day, `end` at midnight after the last. Create your own event in
|
|
117
|
+
* response. Supersedes `onLongPressCell` (and, in month mode, `onLongPressDay`)
|
|
118
|
+
* on empty space when set.
|
|
112
119
|
*/
|
|
113
120
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
121
|
+
/**
|
|
122
|
+
* Month and year modes: reports a create sweep's day span as it happens, as the
|
|
123
|
+
* ordered inclusive `[start, end]` days, so a selection highlight can follow the
|
|
124
|
+
* drag. Pair it with `useDateRange`'s `selectRange` to drive `selectedRange`.
|
|
125
|
+
* Enables the sweep on its own, so it works without `onCreateEvent`.
|
|
126
|
+
*/
|
|
127
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
128
|
+
/** Days drawn as selected (a filled badge) in month and year modes. */
|
|
129
|
+
selectedDates?: Date[];
|
|
130
|
+
/** A selected span: endpoints get a filled badge, the span gets the range band. */
|
|
131
|
+
selectedRange?: DateRange;
|
|
132
|
+
/**
|
|
133
|
+
* Fill the whole month cell with the range band instead of the default centered
|
|
134
|
+
* rounded "pill" strip. Default false.
|
|
135
|
+
*/
|
|
136
|
+
fillCellOnSelection?: boolean;
|
|
137
|
+
/** Earliest selectable day (inclusive); earlier days render disabled. */
|
|
138
|
+
minDate?: Date;
|
|
139
|
+
/** Latest selectable day (inclusive); later days render disabled. */
|
|
140
|
+
maxDate?: Date;
|
|
141
|
+
/** Return true to render a specific day disabled (dimmed, taps ignored). */
|
|
142
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
114
143
|
/** Tap a day's column header on the week/day grid (default header only). */
|
|
115
144
|
onPressDateHeader?: (date: Date) => void;
|
|
116
145
|
/**
|
|
@@ -209,6 +238,11 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
209
238
|
hourComponent?: HourRenderer;
|
|
210
239
|
/** Always render six week rows in month view, for a fixed-height grid. Default false. */
|
|
211
240
|
showSixWeeks?: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Render the built-in "MMMM yyyy" title above the month grid. Default true. Set
|
|
243
|
+
* false when your own header already shows the month and year. Month mode only.
|
|
244
|
+
*/
|
|
245
|
+
showTitle?: boolean;
|
|
212
246
|
/** Allow swiping between pages (all modes). Default true. */
|
|
213
247
|
swipeEnabled?: boolean;
|
|
214
248
|
/** Show the vertical scroll indicator on the week/day grid. Default true. */
|
|
@@ -380,6 +414,13 @@ export function Calendar<T>({
|
|
|
380
414
|
resetPageOnPressCell,
|
|
381
415
|
onLongPressCell,
|
|
382
416
|
onCreateEvent,
|
|
417
|
+
onSelectDrag,
|
|
418
|
+
selectedDates,
|
|
419
|
+
selectedRange,
|
|
420
|
+
fillCellOnSelection,
|
|
421
|
+
minDate,
|
|
422
|
+
maxDate,
|
|
423
|
+
isDateDisabled,
|
|
383
424
|
onPressDateHeader,
|
|
384
425
|
maxVisibleEventCount,
|
|
385
426
|
sortedMonthView,
|
|
@@ -416,6 +457,7 @@ export function Calendar<T>({
|
|
|
416
457
|
weekNumberPrefix,
|
|
417
458
|
hourComponent,
|
|
418
459
|
showSixWeeks,
|
|
460
|
+
showTitle,
|
|
419
461
|
swipeEnabled,
|
|
420
462
|
showVerticalScrollIndicator,
|
|
421
463
|
verticalScrollEnabled,
|
|
@@ -557,6 +599,7 @@ export function Calendar<T>({
|
|
|
557
599
|
disableMonthEventCellPress={disableMonthEventCellPress}
|
|
558
600
|
isRTL={isRTL}
|
|
559
601
|
showSixWeeks={showSixWeeks}
|
|
602
|
+
showTitle={showTitle}
|
|
560
603
|
activeDate={activeDate}
|
|
561
604
|
renderHeaderForMonthView={renderHeaderForMonthView}
|
|
562
605
|
renderCustomDateForMonth={renderCustomDateForMonth}
|
|
@@ -565,9 +608,22 @@ export function Calendar<T>({
|
|
|
565
608
|
keyExtractor={keyExtractor}
|
|
566
609
|
onPressDay={onPressDay}
|
|
567
610
|
onLongPressDay={onLongPressDay}
|
|
611
|
+
onPressCell={onPressCell}
|
|
568
612
|
onPressEvent={handlePressEvent}
|
|
569
613
|
onLongPressEvent={handleLongPressEvent}
|
|
570
614
|
onPressMore={onPressMore}
|
|
615
|
+
onCreateEvent={onCreateEvent}
|
|
616
|
+
onSelectDrag={onSelectDrag}
|
|
617
|
+
onDragEvent={onDragEvent}
|
|
618
|
+
onDragStart={onDragStart}
|
|
619
|
+
eventStartEditable={eventStartEditable}
|
|
620
|
+
eventOverlap={eventOverlap}
|
|
621
|
+
selectedDates={selectedDates}
|
|
622
|
+
selectedRange={selectedRange}
|
|
623
|
+
fillCellOnSelection={fillCellOnSelection}
|
|
624
|
+
minDate={minDate}
|
|
625
|
+
maxDate={maxDate}
|
|
626
|
+
isDateDisabled={isDateDisabled}
|
|
571
627
|
onChangeDate={handleChangeDate}
|
|
572
628
|
freeSwipe={freeSwipe}
|
|
573
629
|
swipeEnabled={swipeEnabled}
|
|
@@ -582,8 +638,15 @@ export function Calendar<T>({
|
|
|
582
638
|
hiddenDays={hiddenDays}
|
|
583
639
|
locale={locale}
|
|
584
640
|
activeDate={activeDate}
|
|
641
|
+
selectedDates={selectedDates}
|
|
642
|
+
selectedRange={selectedRange}
|
|
643
|
+
minDate={minDate}
|
|
644
|
+
maxDate={maxDate}
|
|
645
|
+
isDateDisabled={isDateDisabled}
|
|
585
646
|
onPressDay={onPressDay}
|
|
586
647
|
onPressMonth={onPressMonth}
|
|
648
|
+
onSelectDrag={onSelectDrag}
|
|
649
|
+
onCreateEvent={onCreateEvent}
|
|
587
650
|
classNames={classNames}
|
|
588
651
|
styles={styleOverrides}
|
|
589
652
|
/>
|
|
@@ -17,8 +17,18 @@ import {
|
|
|
17
17
|
type ViewStyle,
|
|
18
18
|
} from "react-native";
|
|
19
19
|
import { useCalendarTheme } from "../theme";
|
|
20
|
-
import type {
|
|
20
|
+
import type {
|
|
21
|
+
CalendarEvent,
|
|
22
|
+
EventDragHandler,
|
|
23
|
+
EventDragStartHandler,
|
|
24
|
+
EventKeyExtractor,
|
|
25
|
+
RenderEvent,
|
|
26
|
+
WeekStartsOn,
|
|
27
|
+
} from "../types";
|
|
21
28
|
import {
|
|
29
|
+
type CalendarSelection,
|
|
30
|
+
CalendarSelectionProvider,
|
|
31
|
+
type DateRange,
|
|
22
32
|
type WeekdayFormat,
|
|
23
33
|
filterHiddenDays,
|
|
24
34
|
getWeekDays,
|
|
@@ -62,13 +72,41 @@ export type MonthPagerProps<T> = {
|
|
|
62
72
|
keyExtractor: EventKeyExtractor<T>;
|
|
63
73
|
onPressDay?: (date: Date) => void;
|
|
64
74
|
onLongPressDay?: (date: Date) => void;
|
|
75
|
+
/** Tap an empty day cell; receives the day at midnight. */
|
|
76
|
+
onPressCell?: (date: Date) => void;
|
|
65
77
|
onPressEvent: (event: CalendarEvent<T>) => void;
|
|
66
78
|
onLongPressEvent?: (event: CalendarEvent<T>) => void;
|
|
67
79
|
onPressMore?: (events: CalendarEvent<T>[], date: Date) => void;
|
|
80
|
+
/** Drag across empty day cells to sweep out an all-day span for a new event. */
|
|
81
|
+
onCreateEvent?: (start: Date, end: Date) => void;
|
|
82
|
+
/** Drag-to-select: reports the swept `[start, end]` days live. */
|
|
83
|
+
onSelectDrag?: (start: Date, end: Date) => void;
|
|
84
|
+
/** Days drawn as selected (a filled badge). */
|
|
85
|
+
selectedDates?: Date[];
|
|
86
|
+
/** A selected span: endpoints get a filled badge, the span gets the range band. */
|
|
87
|
+
selectedRange?: DateRange;
|
|
88
|
+
/** Fill the whole cell on selection instead of the default rounded pill band. */
|
|
89
|
+
fillCellOnSelection?: boolean;
|
|
90
|
+
/** Earliest selectable day (inclusive); earlier days render disabled. */
|
|
91
|
+
minDate?: Date;
|
|
92
|
+
/** Latest selectable day (inclusive); later days render disabled. */
|
|
93
|
+
maxDate?: Date;
|
|
94
|
+
/** Return true to render a specific day disabled (dimmed, taps ignored). */
|
|
95
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
96
|
+
/** Drag an event bar onto another day to reschedule it. */
|
|
97
|
+
onDragEvent?: EventDragHandler<T>;
|
|
98
|
+
/** Fired when a month drag picks an event up, before anything is committed. */
|
|
99
|
+
onDragStart?: EventDragStartHandler<T>;
|
|
100
|
+
/** Allow moving events by default (per-event `startEditable` overrides). Default true. */
|
|
101
|
+
eventStartEditable?: boolean;
|
|
102
|
+
/** Reject a drop that would overlap another event (default true = allowed). */
|
|
103
|
+
eventOverlap?: boolean;
|
|
68
104
|
onChangeDate: (date: Date) => void;
|
|
69
105
|
freeSwipe?: boolean;
|
|
70
106
|
swipeEnabled?: boolean;
|
|
71
107
|
showSixWeeks?: boolean;
|
|
108
|
+
/** Render the "MMMM yyyy" title above the weekday header. Default true. */
|
|
109
|
+
showTitle?: boolean;
|
|
72
110
|
activeDate?: Date;
|
|
73
111
|
/** Replace the weekday-label header above the month grid. Receives the week's days. */
|
|
74
112
|
renderHeaderForMonthView?: (weekDays: Date[]) => React.ReactNode;
|
|
@@ -95,13 +133,27 @@ function MonthPagerInner<T>({
|
|
|
95
133
|
keyExtractor,
|
|
96
134
|
onPressDay,
|
|
97
135
|
onLongPressDay,
|
|
136
|
+
onPressCell,
|
|
98
137
|
onPressEvent,
|
|
99
138
|
onLongPressEvent,
|
|
100
139
|
onPressMore,
|
|
140
|
+
onCreateEvent,
|
|
141
|
+
onSelectDrag,
|
|
142
|
+
selectedDates,
|
|
143
|
+
selectedRange,
|
|
144
|
+
fillCellOnSelection,
|
|
145
|
+
minDate,
|
|
146
|
+
maxDate,
|
|
147
|
+
isDateDisabled,
|
|
148
|
+
onDragEvent,
|
|
149
|
+
onDragStart,
|
|
150
|
+
eventStartEditable,
|
|
151
|
+
eventOverlap,
|
|
101
152
|
onChangeDate,
|
|
102
153
|
freeSwipe = false,
|
|
103
154
|
swipeEnabled = true,
|
|
104
155
|
showSixWeeks = false,
|
|
156
|
+
showTitle = true,
|
|
105
157
|
activeDate,
|
|
106
158
|
renderHeaderForMonthView,
|
|
107
159
|
renderCustomDateForMonth,
|
|
@@ -231,7 +283,21 @@ function MonthPagerInner<T>({
|
|
|
231
283
|
// `events` (events that arrive after mount, e.g. from an async fetch, must
|
|
232
284
|
// repaint the mounted page) and `activeDate` (the selected-day highlight must
|
|
233
285
|
// move). Mirrors listExtraData in TimeGrid.
|
|
234
|
-
|
|
286
|
+
// `fillCellOnSelection` and `onSelectDrag` ride along because they reach the
|
|
287
|
+
// grids as renderItem props, not through the selection context below: toggling
|
|
288
|
+
// a "pick dates" mode on must reach the pages already rendered.
|
|
289
|
+
const listExtraData = useMemo(
|
|
290
|
+
() => ({ events, activeDate, fillCellOnSelection, dragSelect: onSelectDrag != null }),
|
|
291
|
+
[events, activeDate, fillCellOnSelection, onSelectDrag],
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
// Selection reaches the grids through context, not `renderItem`, so a change
|
|
295
|
+
// repaints the pages LegendList has already cached (which `extraData` alone
|
|
296
|
+
// would not, since the pages are keyed by month and never recycled).
|
|
297
|
+
const selection = useMemo<CalendarSelection>(
|
|
298
|
+
() => ({ selectedDates, selectedRange, minDate, maxDate, isDateDisabled }),
|
|
299
|
+
[selectedDates, selectedRange, minDate, maxDate, isDateDisabled],
|
|
300
|
+
);
|
|
235
301
|
|
|
236
302
|
const snapToIndices = useMemo(() => monthDates.map((_, index) => index), [monthDates]);
|
|
237
303
|
const keyExtractorList = useCallback((item: Date) => item.toISOString(), []);
|
|
@@ -263,9 +329,17 @@ function MonthPagerInner<T>({
|
|
|
263
329
|
keyExtractor={keyExtractor}
|
|
264
330
|
onPressDay={onPressDay}
|
|
265
331
|
onLongPressDay={onLongPressDay}
|
|
332
|
+
onPressCell={onPressCell}
|
|
266
333
|
onPressEvent={onPressEvent}
|
|
267
334
|
onLongPressEvent={onLongPressEvent}
|
|
268
335
|
onPressMore={onPressMore}
|
|
336
|
+
onCreateEvent={onCreateEvent}
|
|
337
|
+
onSelectDrag={onSelectDrag}
|
|
338
|
+
fillCellOnSelection={fillCellOnSelection}
|
|
339
|
+
onDragEvent={onDragEvent}
|
|
340
|
+
onDragStart={onDragStart}
|
|
341
|
+
eventStartEditable={eventStartEditable}
|
|
342
|
+
eventOverlap={eventOverlap}
|
|
269
343
|
renderCustomDateForMonth={renderCustomDateForMonth}
|
|
270
344
|
classNames={classNames}
|
|
271
345
|
styles={styleOverrides}
|
|
@@ -278,10 +352,12 @@ function MonthPagerInner<T>({
|
|
|
278
352
|
events,
|
|
279
353
|
maxVisibleEventCount,
|
|
280
354
|
weekStartsOn,
|
|
355
|
+
hiddenDays,
|
|
281
356
|
locale,
|
|
282
357
|
sortedMonthView,
|
|
283
358
|
moreLabel,
|
|
284
359
|
showAdjacentMonths,
|
|
360
|
+
highlightWeekends,
|
|
285
361
|
disableMonthEventCellPress,
|
|
286
362
|
isRTL,
|
|
287
363
|
showSixWeeks,
|
|
@@ -291,9 +367,17 @@ function MonthPagerInner<T>({
|
|
|
291
367
|
keyExtractor,
|
|
292
368
|
onPressDay,
|
|
293
369
|
onLongPressDay,
|
|
370
|
+
onPressCell,
|
|
294
371
|
onPressEvent,
|
|
295
372
|
onLongPressEvent,
|
|
296
373
|
onPressMore,
|
|
374
|
+
onCreateEvent,
|
|
375
|
+
onSelectDrag,
|
|
376
|
+
fillCellOnSelection,
|
|
377
|
+
onDragEvent,
|
|
378
|
+
onDragStart,
|
|
379
|
+
eventStartEditable,
|
|
380
|
+
eventOverlap,
|
|
297
381
|
renderCustomDateForMonth,
|
|
298
382
|
classNames,
|
|
299
383
|
styleOverrides,
|
|
@@ -301,68 +385,72 @@ function MonthPagerInner<T>({
|
|
|
301
385
|
);
|
|
302
386
|
|
|
303
387
|
return (
|
|
304
|
-
<
|
|
305
|
-
{
|
|
388
|
+
<CalendarSelectionProvider value={selection}>
|
|
389
|
+
<View ref={containerRef} style={[styles.container, theme.containers.monthContainer]}>
|
|
390
|
+
{/* The active month's title, above the (shared) weekday header — mirrors the
|
|
306
391
|
dom MonthView's title. The grids below omit their own title/weekdays. */}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
392
|
+
{showTitle ? (
|
|
393
|
+
<Text
|
|
394
|
+
{...slot<TextStyle>("title", {
|
|
395
|
+
base: styles.monthTitle,
|
|
396
|
+
themed: [theme.text.monthTitle, { color: theme.colors.text }],
|
|
397
|
+
})}
|
|
398
|
+
allowFontScaling={false}
|
|
399
|
+
>
|
|
400
|
+
{format(date, "MMMM yyyy", locale ? { locale } : undefined)}
|
|
401
|
+
</Text>
|
|
402
|
+
) : null}
|
|
403
|
+
{renderHeaderForMonthView ? (
|
|
404
|
+
renderHeaderForMonthView(weekDays)
|
|
405
|
+
) : (
|
|
406
|
+
<MonthWeekdayHeader
|
|
407
|
+
weekDays={weekDays}
|
|
408
|
+
weekdayFormat={weekdayFormat}
|
|
409
|
+
locale={locale}
|
|
410
|
+
slot={slot}
|
|
411
|
+
/>
|
|
412
|
+
)}
|
|
413
|
+
<View
|
|
414
|
+
style={styles.pager}
|
|
415
|
+
onLayout={(event) => {
|
|
416
|
+
setPageHeight(event.nativeEvent.layout.height);
|
|
417
|
+
setContainerWidth(event.nativeEvent.layout.width);
|
|
418
|
+
}}
|
|
419
|
+
>
|
|
420
|
+
<LegendList
|
|
421
|
+
// Remount when the measured page height changes so the list adopts the
|
|
422
|
+
// corrected item height. Without this the list can keep the oversized
|
|
423
|
+
// initial (window-height) seed and clip the last week row.
|
|
424
|
+
key={pageHeight}
|
|
425
|
+
ref={listRef}
|
|
426
|
+
style={isWeb ? [styles.pagerList, styles.webNoScroll] : styles.pagerList}
|
|
427
|
+
data={monthDates}
|
|
428
|
+
extraData={listExtraData}
|
|
429
|
+
horizontal
|
|
430
|
+
recycleItems={false}
|
|
431
|
+
keyExtractor={keyExtractorList}
|
|
432
|
+
getFixedItemSize={getFixedItemSize}
|
|
433
|
+
// On web LegendList ignores these RN scroll props (it leaks them to the
|
|
434
|
+
// DOM as unknown attributes), so omit them there and disable horizontal
|
|
435
|
+
// scroll via `webNoScroll`; paging is driven by the arrow keys instead.
|
|
436
|
+
// Native: paging makes each swipe hard-stop at the adjacent month, while
|
|
437
|
+
// `freeSwipe` lets momentum carry across months and snap to a boundary.
|
|
438
|
+
{...(isWeb
|
|
439
|
+
? null
|
|
440
|
+
: {
|
|
441
|
+
scrollEnabled: swipeEnabled,
|
|
442
|
+
pagingEnabled: !freeSwipe,
|
|
443
|
+
snapToIndices: freeSwipe ? snapToIndices : undefined,
|
|
444
|
+
})}
|
|
445
|
+
initialScrollIndex={activeIndex}
|
|
446
|
+
showsHorizontalScrollIndicator={false}
|
|
447
|
+
viewabilityConfig={PAGE_VIEWABILITY}
|
|
448
|
+
onViewableItemsChanged={handleViewableItemsChanged}
|
|
449
|
+
renderItem={renderItem}
|
|
450
|
+
/>
|
|
451
|
+
</View>
|
|
364
452
|
</View>
|
|
365
|
-
</
|
|
453
|
+
</CalendarSelectionProvider>
|
|
366
454
|
);
|
|
367
455
|
}
|
|
368
456
|
|