@super-calendar/native 2.7.0 → 2.8.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/dist/{DefaultMonthEvent-DCPDsnvq.d.ts → DefaultMonthEvent-CjwX3Nt1.d.ts} +14 -6
- package/dist/{DefaultMonthEvent-DMOC5aNL.d.mts → DefaultMonthEvent-VgJarTO_.d.mts} +14 -6
- package/dist/{MonthList-CJs1vq5T.js → MonthList-C-vBotP0.js} +94 -28
- package/dist/{MonthList-Dn37Ezj0.mjs → MonthList-DjAz4xoi.mjs} +95 -29
- package/dist/index.d.mts +27 -6
- package/dist/index.d.ts +27 -6
- package/dist/index.js +121 -47
- package/dist/index.mjs +117 -49
- 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 +13 -0
- package/src/components/MonthList.tsx +4 -0
- package/src/components/MonthPager.tsx +3 -0
- package/src/components/MonthView.tsx +148 -36
- package/src/components/ResourceTimeline.tsx +32 -15
- package/src/components/TimeGrid.tsx +155 -29
- package/src/index.tsx +3 -0
|
@@ -214,9 +214,12 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
214
214
|
date: Date;
|
|
215
215
|
events: CalendarEvent$1<T>[];
|
|
216
216
|
/**
|
|
217
|
-
* Max event
|
|
218
|
-
*
|
|
219
|
-
*
|
|
217
|
+
* Max event lanes (stacked rows) shown per week before the rest of a day's
|
|
218
|
+
* events collapse into a "+N more" label. Because multi-day events draw as one
|
|
219
|
+
* bar spanning a lane across the week, this caps lanes per row, not chips per
|
|
220
|
+
* day, so a long bar can push a lightly-booked day's own events into "+N more".
|
|
221
|
+
* Omit to auto-fit as many lanes as the cell height allows (the default); set a
|
|
222
|
+
* number for a fixed cap. Auto-fit assumes the built-in chip size — pass an
|
|
220
223
|
* explicit value when using a custom `renderEvent`.
|
|
221
224
|
*/
|
|
222
225
|
maxVisibleEventCount?: number;
|
|
@@ -232,6 +235,8 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
232
235
|
moreLabel?: string;
|
|
233
236
|
/** Show dimmed days from adjacent months in the grid. Default true. */
|
|
234
237
|
showAdjacentMonths?: boolean;
|
|
238
|
+
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
239
|
+
highlightWeekends?: boolean;
|
|
235
240
|
/** Ignore taps on month-cell events (day-cell taps still fire). Default false. */
|
|
236
241
|
disableMonthEventCellPress?: boolean;
|
|
237
242
|
/** Reverse the day order within each week (right-to-left). Default false. */
|
|
@@ -284,7 +289,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
284
289
|
*/
|
|
285
290
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
286
291
|
};
|
|
287
|
-
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
292
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
288
293
|
/**
|
|
289
294
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
290
295
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -317,6 +322,7 @@ type MonthPagerProps<T> = {
|
|
|
317
322
|
sortedMonthView?: boolean;
|
|
318
323
|
moreLabel?: string;
|
|
319
324
|
showAdjacentMonths?: boolean;
|
|
325
|
+
highlightWeekends?: boolean;
|
|
320
326
|
disableMonthEventCellPress?: boolean;
|
|
321
327
|
isRTL?: boolean;
|
|
322
328
|
calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
|
|
@@ -337,7 +343,7 @@ type MonthPagerProps<T> = {
|
|
|
337
343
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
338
344
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
339
345
|
} & SlotStyleProps<MonthViewSlot>;
|
|
340
|
-
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
346
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
341
347
|
/**
|
|
342
348
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
343
349
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -387,6 +393,8 @@ type MonthListProps<T> = {
|
|
|
387
393
|
moreLabel?: string;
|
|
388
394
|
/** Show dimmed adjacent-month days. Default false (each month shows only its own days). */
|
|
389
395
|
showAdjacentMonths?: boolean;
|
|
396
|
+
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
397
|
+
highlightWeekends?: boolean;
|
|
390
398
|
disableMonthEventCellPress?: boolean;
|
|
391
399
|
isRTL?: boolean;
|
|
392
400
|
activeDate?: Date;
|
|
@@ -424,7 +432,7 @@ type MonthListProps<T> = {
|
|
|
424
432
|
/** Replace the per-month title (default "LLLL yyyy"). */
|
|
425
433
|
renderMonthHeader?: (month: Date) => React.ReactNode;
|
|
426
434
|
} & SlotStyleProps<MonthListSlot>;
|
|
427
|
-
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
|
|
435
|
+
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
|
|
428
436
|
/**
|
|
429
437
|
* A vertically scrolling, virtualized list of month grids. It doubles as the
|
|
430
438
|
* date picker: pass `selectedRange`/`selectedDates` and selection handlers to
|
|
@@ -214,9 +214,12 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
214
214
|
date: Date;
|
|
215
215
|
events: CalendarEvent$1<T>[];
|
|
216
216
|
/**
|
|
217
|
-
* Max event
|
|
218
|
-
*
|
|
219
|
-
*
|
|
217
|
+
* Max event lanes (stacked rows) shown per week before the rest of a day's
|
|
218
|
+
* events collapse into a "+N more" label. Because multi-day events draw as one
|
|
219
|
+
* bar spanning a lane across the week, this caps lanes per row, not chips per
|
|
220
|
+
* day, so a long bar can push a lightly-booked day's own events into "+N more".
|
|
221
|
+
* Omit to auto-fit as many lanes as the cell height allows (the default); set a
|
|
222
|
+
* number for a fixed cap. Auto-fit assumes the built-in chip size — pass an
|
|
220
223
|
* explicit value when using a custom `renderEvent`.
|
|
221
224
|
*/
|
|
222
225
|
maxVisibleEventCount?: number;
|
|
@@ -232,6 +235,8 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
232
235
|
moreLabel?: string;
|
|
233
236
|
/** Show dimmed days from adjacent months in the grid. Default true. */
|
|
234
237
|
showAdjacentMonths?: boolean;
|
|
238
|
+
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
239
|
+
highlightWeekends?: boolean;
|
|
235
240
|
/** Ignore taps on month-cell events (day-cell taps still fire). Default false. */
|
|
236
241
|
disableMonthEventCellPress?: boolean;
|
|
237
242
|
/** Reverse the day order within each week (right-to-left). Default false. */
|
|
@@ -284,7 +289,7 @@ type MonthViewProps<T> = SlotStyleProps<MonthViewSlot> & {
|
|
|
284
289
|
*/
|
|
285
290
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
286
291
|
};
|
|
287
|
-
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
292
|
+
declare function MonthViewInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, showSixWeeks, showTitle, showWeekdays, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }: MonthViewProps<T>): ReactElement;
|
|
288
293
|
/**
|
|
289
294
|
* A single month rendered as a 7-column grid of day cells, each showing its
|
|
290
295
|
* event chips with a "+N more" overflow. Render it on its own for a static
|
|
@@ -317,6 +322,7 @@ type MonthPagerProps<T> = {
|
|
|
317
322
|
sortedMonthView?: boolean;
|
|
318
323
|
moreLabel?: string;
|
|
319
324
|
showAdjacentMonths?: boolean;
|
|
325
|
+
highlightWeekends?: boolean;
|
|
320
326
|
disableMonthEventCellPress?: boolean;
|
|
321
327
|
isRTL?: boolean;
|
|
322
328
|
calendarCellStyle?: (date: Date) => StyleProp<ViewStyle>;
|
|
@@ -337,7 +343,7 @@ type MonthPagerProps<T> = {
|
|
|
337
343
|
/** Replace the default date badge in each day cell. Receives the day. */
|
|
338
344
|
renderCustomDateForMonth?: (date: Date) => React.ReactNode;
|
|
339
345
|
} & SlotStyleProps<MonthViewSlot>;
|
|
340
|
-
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
346
|
+
declare function MonthPagerInner<T>({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe, swipeEnabled, showSixWeeks, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }: MonthPagerProps<T>): ReactElement;
|
|
341
347
|
/**
|
|
342
348
|
* A horizontally swipeable month carousel. Swipe left/right to page between
|
|
343
349
|
* months; the committed month is reported through `onChangeDate`. It is the
|
|
@@ -387,6 +393,8 @@ type MonthListProps<T> = {
|
|
|
387
393
|
moreLabel?: string;
|
|
388
394
|
/** Show dimmed adjacent-month days. Default false (each month shows only its own days). */
|
|
389
395
|
showAdjacentMonths?: boolean;
|
|
396
|
+
/** Tint weekend day cells with the theme's weekend background. Default true. */
|
|
397
|
+
highlightWeekends?: boolean;
|
|
390
398
|
disableMonthEventCellPress?: boolean;
|
|
391
399
|
isRTL?: boolean;
|
|
392
400
|
activeDate?: Date;
|
|
@@ -424,7 +432,7 @@ type MonthListProps<T> = {
|
|
|
424
432
|
/** Replace the per-month title (default "LLLL yyyy"). */
|
|
425
433
|
renderMonthHeader?: (month: Date) => React.ReactNode;
|
|
426
434
|
} & SlotStyleProps<MonthListSlot>;
|
|
427
|
-
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
|
|
435
|
+
declare function MonthListInner<T>({ date, events, weekStartsOn, weekdayFormat, weekRowHeight: weekRowHeightProp, monthHeaderHeight, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }: MonthListProps<T>): ReactElement;
|
|
428
436
|
/**
|
|
429
437
|
* A vertically scrolling, virtualized list of month grids. It doubles as the
|
|
430
438
|
* date picker: pass `selectedRange`/`selectedDates` and selection handlers to
|
|
@@ -200,9 +200,29 @@ const DATE_BADGE_HEIGHT = 24;
|
|
|
200
200
|
const BAND_CENTER_Y = 16;
|
|
201
201
|
const CELL_ROW_GAP = 2;
|
|
202
202
|
const CHIP_PADDING_V = 2;
|
|
203
|
+
const BADGE_AREA = 30;
|
|
204
|
+
const EMPTY_LAYOUT = {
|
|
205
|
+
segments: [],
|
|
206
|
+
laneCount: 0
|
|
207
|
+
};
|
|
208
|
+
const CHIP_INSET_H = 4;
|
|
203
209
|
const FALLBACK_VISIBLE_COUNT = 3;
|
|
204
210
|
const numericStyle = (value, fallback) => typeof value === "number" ? value : fallback;
|
|
205
|
-
function
|
|
211
|
+
function collectRowEvents(week, eventsByDay) {
|
|
212
|
+
const seen = /* @__PURE__ */ new Set();
|
|
213
|
+
const out = [];
|
|
214
|
+
for (const day of week) {
|
|
215
|
+
const list = eventsByDay.get((0, date_fns.startOfDay)(day).toISOString());
|
|
216
|
+
if (!list) continue;
|
|
217
|
+
for (const event of list) if (!seen.has(event)) {
|
|
218
|
+
seen.add(event);
|
|
219
|
+
out.push(event);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return out;
|
|
223
|
+
}
|
|
224
|
+
const pct = (n) => `${n}%`;
|
|
225
|
+
function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = true, highlightWeekends = true, disableMonthEventCellPress = false, isRTL = false, showSixWeeks = false, showTitle = true, showWeekdays = true, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection = false, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
|
|
206
226
|
const theme = useCalendarTheme();
|
|
207
227
|
const slot = createSlots({
|
|
208
228
|
classNames,
|
|
@@ -239,6 +259,14 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
239
259
|
isRTL,
|
|
240
260
|
hiddenDays
|
|
241
261
|
]);
|
|
262
|
+
const chipMetrics = (0, react.useMemo)(() => {
|
|
263
|
+
const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
|
|
264
|
+
const chipHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3)) + CHIP_PADDING_V * 2;
|
|
265
|
+
return {
|
|
266
|
+
chipHeight,
|
|
267
|
+
chipRowHeight: chipHeight + CELL_ROW_GAP
|
|
268
|
+
};
|
|
269
|
+
}, [theme]);
|
|
242
270
|
const capacity = (0, react.useMemo)(() => {
|
|
243
271
|
if (maxVisibleEventCount != null) return {
|
|
244
272
|
full: maxVisibleEventCount,
|
|
@@ -249,16 +277,15 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
249
277
|
withMore: FALLBACK_VISIBLE_COUNT
|
|
250
278
|
};
|
|
251
279
|
const rowHeight = gridHeight / weeks.length;
|
|
252
|
-
const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
|
|
253
|
-
const chipRowHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3)) + CHIP_PADDING_V * 2 + CELL_ROW_GAP;
|
|
254
280
|
const moreFontSize = numericStyle(theme.text.more.fontSize, 11);
|
|
255
281
|
const moreRowHeight = Math.ceil(moreFontSize * 1.3) + CELL_ROW_GAP;
|
|
256
|
-
return (0, _super_calendar_core.monthEventCapacity)(rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT, chipRowHeight, moreRowHeight);
|
|
282
|
+
return (0, _super_calendar_core.monthEventCapacity)(rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT, chipMetrics.chipRowHeight, moreRowHeight);
|
|
257
283
|
}, [
|
|
258
284
|
maxVisibleEventCount,
|
|
259
285
|
gridHeight,
|
|
260
286
|
weeks.length,
|
|
261
|
-
theme
|
|
287
|
+
theme,
|
|
288
|
+
chipMetrics
|
|
262
289
|
]);
|
|
263
290
|
const eventsByDay = (0, react.useMemo)(() => {
|
|
264
291
|
const map = (0, _super_calendar_core.groupEventsByDay)(events.filter((event) => !(0, _super_calendar_core.isBackgroundEvent)(event)));
|
|
@@ -266,7 +293,12 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
266
293
|
return map;
|
|
267
294
|
}, [events, sortedMonthView]);
|
|
268
295
|
const showGrid = events.length > 0;
|
|
269
|
-
const
|
|
296
|
+
const weekLayouts = (0, react.useMemo)(() => showGrid ? weeks.map((week) => (0, _super_calendar_core.layoutMonthWeek)(week, collectRowEvents(week, eventsByDay))) : [], [
|
|
297
|
+
showGrid,
|
|
298
|
+
weeks,
|
|
299
|
+
eventsByDay
|
|
300
|
+
]);
|
|
301
|
+
const renderDay = (day, dayCol, rowLayout, visibleLanes) => {
|
|
270
302
|
const isCurrentMonth = (0, date_fns.isSameMonth)(day, date);
|
|
271
303
|
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { ...slot("day", {
|
|
272
304
|
base: styles$3.dayCell,
|
|
@@ -287,8 +319,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
287
319
|
maxDate,
|
|
288
320
|
isDateDisabled
|
|
289
321
|
});
|
|
290
|
-
const
|
|
291
|
-
const hiddenCount = dayEvents.length - visibleCount;
|
|
322
|
+
const hiddenCount = rowLayout.segments.filter((s) => s.startCol <= dayCol && s.endCol >= dayCol && s.lane >= visibleLanes).map((s) => s.event).length;
|
|
292
323
|
const isFilledBadge = (0, _super_calendar_core.dayBadgeKind)({ isSelected }, isHighlighted) !== "none";
|
|
293
324
|
const hasBand = (0, _super_calendar_core.rangeBandKind)({
|
|
294
325
|
isInRange,
|
|
@@ -310,7 +341,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
310
341
|
borderRightWidth: react_native.StyleSheet.hairlineWidth,
|
|
311
342
|
borderColor: theme.colors.gridLine
|
|
312
343
|
},
|
|
313
|
-
(0, _super_calendar_core.isWeekend)(day) && { backgroundColor: theme.colors.weekendBackground },
|
|
344
|
+
highlightWeekends && (0, _super_calendar_core.isWeekend)(day) && { backgroundColor: theme.colors.weekendBackground },
|
|
314
345
|
theme.containers.dayCell
|
|
315
346
|
]
|
|
316
347
|
});
|
|
@@ -393,16 +424,10 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
393
424
|
children: (0, date_fns.format)(day, "d")
|
|
394
425
|
})
|
|
395
426
|
}),
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
mode: "month",
|
|
401
|
-
isAllDay: (0, _super_calendar_core.isAllDayEvent)(event),
|
|
402
|
-
onPress: disableMonthEventCellPress ? () => {} : () => onPressEvent(event),
|
|
403
|
-
onLongPress: disableMonthEventCellPress || !onLongPressEvent ? void 0 : () => onLongPressEvent(event)
|
|
404
|
-
})
|
|
405
|
-
}, keyExtractor(event, index))),
|
|
427
|
+
Array.from({ length: visibleLanes }, (_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: {
|
|
428
|
+
height: chipMetrics.chipHeight,
|
|
429
|
+
pointerEvents: "none"
|
|
430
|
+
} }, `lane-${i}`)),
|
|
406
431
|
hiddenCount > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
407
432
|
...slot("more", {
|
|
408
433
|
base: styles$3.moreLabel,
|
|
@@ -490,13 +515,52 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
490
515
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
491
516
|
...slot("grid", { base: styles$3.container }),
|
|
492
517
|
onLayout: handleLayout,
|
|
493
|
-
children: weeks.map((week) =>
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
518
|
+
children: weeks.map((week, weekIndex) => {
|
|
519
|
+
const rowLayout = weekLayouts[weekIndex] ?? EMPTY_LAYOUT;
|
|
520
|
+
const visibleLanes = (0, _super_calendar_core.monthVisibleCount)(rowLayout.laneCount, capacity);
|
|
521
|
+
const cols = week.length;
|
|
522
|
+
let firstVisCol = 0;
|
|
523
|
+
let lastVisCol = cols - 1;
|
|
524
|
+
if (showGrid && !showAdjacentMonths) {
|
|
525
|
+
const first = week.findIndex((d) => (0, date_fns.isSameMonth)(d, date));
|
|
526
|
+
if (first !== -1) {
|
|
527
|
+
firstVisCol = first;
|
|
528
|
+
lastVisCol = cols - 1 - [...week].reverse().findIndex((d) => (0, date_fns.isSameMonth)(d, date));
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return /* @__PURE__ */ (0, react.createElement)(react_native.View, {
|
|
532
|
+
...slot("week", {
|
|
533
|
+
base: styles$3.weekRow,
|
|
534
|
+
themed: theme.containers.weekRow
|
|
535
|
+
}),
|
|
536
|
+
key: week[0].toISOString()
|
|
537
|
+
}, week.map((day, dayCol) => renderDay(day, dayCol, rowLayout, visibleLanes)), showGrid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
538
|
+
style: [react_native.StyleSheet.absoluteFill, { pointerEvents: "box-none" }],
|
|
539
|
+
children: rowLayout.segments.filter((seg) => seg.lane < visibleLanes).map((seg) => {
|
|
540
|
+
const startCol = Math.max(seg.startCol, firstVisCol);
|
|
541
|
+
const endCol = Math.min(seg.endCol, lastVisCol);
|
|
542
|
+
if (startCol > endCol) return null;
|
|
543
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
544
|
+
style: {
|
|
545
|
+
position: "absolute",
|
|
546
|
+
left: pct(startCol / cols * 100),
|
|
547
|
+
width: pct((endCol - startCol + 1) / cols * 100),
|
|
548
|
+
top: BADGE_AREA + seg.lane * chipMetrics.chipRowHeight,
|
|
549
|
+
height: chipMetrics.chipHeight,
|
|
550
|
+
paddingHorizontal: CHIP_INSET_H,
|
|
551
|
+
pointerEvents: "box-none"
|
|
552
|
+
},
|
|
553
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
554
|
+
event: seg.event,
|
|
555
|
+
mode: "month",
|
|
556
|
+
isAllDay: (0, _super_calendar_core.isAllDayEvent)(seg.event),
|
|
557
|
+
onPress: disableMonthEventCellPress ? () => {} : () => onPressEvent(seg.event),
|
|
558
|
+
onLongPress: disableMonthEventCellPress || !onLongPressEvent ? void 0 : () => onLongPressEvent(seg.event)
|
|
559
|
+
})
|
|
560
|
+
}, `bar-${seg.event.start.toISOString()}:${seg.event.title}:${seg.lane}`);
|
|
561
|
+
})
|
|
562
|
+
}) : null);
|
|
563
|
+
})
|
|
500
564
|
})
|
|
501
565
|
]
|
|
502
566
|
});
|
|
@@ -594,7 +658,7 @@ const styles$3 = react_native.StyleSheet.create({
|
|
|
594
658
|
const isWeb$1 = react_native.Platform.OS === "web";
|
|
595
659
|
const PAGE_WINDOW$1 = 60;
|
|
596
660
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
597
|
-
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
661
|
+
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
598
662
|
const theme = useCalendarTheme();
|
|
599
663
|
const slot = (0, react.useMemo)(() => createSlots({
|
|
600
664
|
classNames,
|
|
@@ -692,6 +756,7 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
692
756
|
sortedMonthView,
|
|
693
757
|
moreLabel,
|
|
694
758
|
showAdjacentMonths,
|
|
759
|
+
highlightWeekends,
|
|
695
760
|
disableMonthEventCellPress,
|
|
696
761
|
isRTL,
|
|
697
762
|
showSixWeeks,
|
|
@@ -928,7 +993,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
|
|
|
928
993
|
const NO_EVENTS = [];
|
|
929
994
|
const noop = () => {};
|
|
930
995
|
const defaultKeyExtractor = (event) => `${event.start.toISOString()}|${event.end.toISOString()}|${event.title ?? ""}`;
|
|
931
|
-
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, eventAccessibilityLabel, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }) {
|
|
996
|
+
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, highlightWeekends = true, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, eventAccessibilityLabel, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }) {
|
|
932
997
|
const theme = useCalendarTheme();
|
|
933
998
|
const slot = (0, react.useMemo)(() => createSlots({
|
|
934
999
|
classNames,
|
|
@@ -1159,6 +1224,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1159
1224
|
sortedMonthView,
|
|
1160
1225
|
moreLabel,
|
|
1161
1226
|
showAdjacentMonths,
|
|
1227
|
+
highlightWeekends,
|
|
1162
1228
|
disableMonthEventCellPress,
|
|
1163
1229
|
isRTL,
|
|
1164
1230
|
activeDate,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addMonths, differenceInCalendarMonths, format, isSameMonth, startOfDay, startOfMonth } from "date-fns";
|
|
2
2
|
import { createContext, createElement, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { CalendarSelectionProvider, buildMonthWeeks, compareDayEvents, darkColors, dayBadgeKind, daySelectionState, eventAccessibilityLabel, eventTimeLabel, filterHiddenDays, getIsToday, getWeekDays, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isSameCalendarDay, isWeekend, lightColors, monthEventCapacity, monthVisibleCount, rangeBandKind, titleEllipsizeMode, titleNumberOfLines, useCalendarSelection, weekdayFormatToken } from "@super-calendar/core";
|
|
3
|
+
import { CalendarSelectionProvider, buildMonthWeeks, compareDayEvents, darkColors, dayBadgeKind, daySelectionState, eventAccessibilityLabel, eventTimeLabel, filterHiddenDays, getIsToday, getWeekDays, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isSameCalendarDay, isWeekend, layoutMonthWeek, lightColors, monthEventCapacity, monthVisibleCount, rangeBandKind, titleEllipsizeMode, titleNumberOfLines, useCalendarSelection, weekdayFormatToken } from "@super-calendar/core";
|
|
4
4
|
import { Modal, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { LegendList } from "@legendapp/list/react-native";
|
|
@@ -200,9 +200,29 @@ const DATE_BADGE_HEIGHT = 24;
|
|
|
200
200
|
const BAND_CENTER_Y = 16;
|
|
201
201
|
const CELL_ROW_GAP = 2;
|
|
202
202
|
const CHIP_PADDING_V = 2;
|
|
203
|
+
const BADGE_AREA = 30;
|
|
204
|
+
const EMPTY_LAYOUT = {
|
|
205
|
+
segments: [],
|
|
206
|
+
laneCount: 0
|
|
207
|
+
};
|
|
208
|
+
const CHIP_INSET_H = 4;
|
|
203
209
|
const FALLBACK_VISIBLE_COUNT = 3;
|
|
204
210
|
const numericStyle = (value, fallback) => typeof value === "number" ? value : fallback;
|
|
205
|
-
function
|
|
211
|
+
function collectRowEvents(week, eventsByDay) {
|
|
212
|
+
const seen = /* @__PURE__ */ new Set();
|
|
213
|
+
const out = [];
|
|
214
|
+
for (const day of week) {
|
|
215
|
+
const list = eventsByDay.get(startOfDay(day).toISOString());
|
|
216
|
+
if (!list) continue;
|
|
217
|
+
for (const event of list) if (!seen.has(event)) {
|
|
218
|
+
seen.add(event);
|
|
219
|
+
out.push(event);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return out;
|
|
223
|
+
}
|
|
224
|
+
const pct = (n) => `${n}%`;
|
|
225
|
+
function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView = true, moreLabel = "{moreCount} More", showAdjacentMonths = true, highlightWeekends = true, disableMonthEventCellPress = false, isRTL = false, showSixWeeks = false, showTitle = true, showWeekdays = true, activeDate, selectedDates: selectedDatesProp, selectedRange: selectedRangeProp, fillCellOnSelection = false, minDate: minDateProp, maxDate: maxDateProp, isDateDisabled: isDateDisabledProp, calendarCellStyle, renderEvent, eventAccessibilityLabel, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, renderCustomDateForMonth, onDayPointerDown, onDayPointerEnter, classNames, styles: styleOverrides }) {
|
|
206
226
|
const theme = useCalendarTheme();
|
|
207
227
|
const slot = createSlots({
|
|
208
228
|
classNames,
|
|
@@ -239,6 +259,14 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
239
259
|
isRTL,
|
|
240
260
|
hiddenDays
|
|
241
261
|
]);
|
|
262
|
+
const chipMetrics = useMemo(() => {
|
|
263
|
+
const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
|
|
264
|
+
const chipHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3)) + CHIP_PADDING_V * 2;
|
|
265
|
+
return {
|
|
266
|
+
chipHeight,
|
|
267
|
+
chipRowHeight: chipHeight + CELL_ROW_GAP
|
|
268
|
+
};
|
|
269
|
+
}, [theme]);
|
|
242
270
|
const capacity = useMemo(() => {
|
|
243
271
|
if (maxVisibleEventCount != null) return {
|
|
244
272
|
full: maxVisibleEventCount,
|
|
@@ -249,16 +277,15 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
249
277
|
withMore: FALLBACK_VISIBLE_COUNT
|
|
250
278
|
};
|
|
251
279
|
const rowHeight = gridHeight / weeks.length;
|
|
252
|
-
const fontSize = numericStyle(theme.text.eventTitle.fontSize, 12);
|
|
253
|
-
const chipRowHeight = numericStyle(theme.text.eventTitle.lineHeight, Math.ceil(fontSize * 1.3)) + CHIP_PADDING_V * 2 + CELL_ROW_GAP;
|
|
254
280
|
const moreFontSize = numericStyle(theme.text.more.fontSize, 11);
|
|
255
281
|
const moreRowHeight = Math.ceil(moreFontSize * 1.3) + CELL_ROW_GAP;
|
|
256
|
-
return monthEventCapacity(rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT, chipRowHeight, moreRowHeight);
|
|
282
|
+
return monthEventCapacity(rowHeight - DAY_CELL_PADDING_TOP - DATE_BADGE_HEIGHT, chipMetrics.chipRowHeight, moreRowHeight);
|
|
257
283
|
}, [
|
|
258
284
|
maxVisibleEventCount,
|
|
259
285
|
gridHeight,
|
|
260
286
|
weeks.length,
|
|
261
|
-
theme
|
|
287
|
+
theme,
|
|
288
|
+
chipMetrics
|
|
262
289
|
]);
|
|
263
290
|
const eventsByDay = useMemo(() => {
|
|
264
291
|
const map = groupEventsByDay(events.filter((event) => !isBackgroundEvent(event)));
|
|
@@ -266,7 +293,12 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
266
293
|
return map;
|
|
267
294
|
}, [events, sortedMonthView]);
|
|
268
295
|
const showGrid = events.length > 0;
|
|
269
|
-
const
|
|
296
|
+
const weekLayouts = useMemo(() => showGrid ? weeks.map((week) => layoutMonthWeek(week, collectRowEvents(week, eventsByDay))) : [], [
|
|
297
|
+
showGrid,
|
|
298
|
+
weeks,
|
|
299
|
+
eventsByDay
|
|
300
|
+
]);
|
|
301
|
+
const renderDay = (day, dayCol, rowLayout, visibleLanes) => {
|
|
270
302
|
const isCurrentMonth = isSameMonth(day, date);
|
|
271
303
|
if (!isCurrentMonth && !showAdjacentMonths) return /* @__PURE__ */ jsx(View, { ...slot("day", {
|
|
272
304
|
base: styles$3.dayCell,
|
|
@@ -287,8 +319,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
287
319
|
maxDate,
|
|
288
320
|
isDateDisabled
|
|
289
321
|
});
|
|
290
|
-
const
|
|
291
|
-
const hiddenCount = dayEvents.length - visibleCount;
|
|
322
|
+
const hiddenCount = rowLayout.segments.filter((s) => s.startCol <= dayCol && s.endCol >= dayCol && s.lane >= visibleLanes).map((s) => s.event).length;
|
|
292
323
|
const isFilledBadge = dayBadgeKind({ isSelected }, isHighlighted) !== "none";
|
|
293
324
|
const hasBand = rangeBandKind({
|
|
294
325
|
isInRange,
|
|
@@ -310,7 +341,7 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
310
341
|
borderRightWidth: StyleSheet.hairlineWidth,
|
|
311
342
|
borderColor: theme.colors.gridLine
|
|
312
343
|
},
|
|
313
|
-
isWeekend(day) && { backgroundColor: theme.colors.weekendBackground },
|
|
344
|
+
highlightWeekends && isWeekend(day) && { backgroundColor: theme.colors.weekendBackground },
|
|
314
345
|
theme.containers.dayCell
|
|
315
346
|
]
|
|
316
347
|
});
|
|
@@ -393,16 +424,10 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
393
424
|
children: format(day, "d")
|
|
394
425
|
})
|
|
395
426
|
}),
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
mode: "month",
|
|
401
|
-
isAllDay: isAllDayEvent(event),
|
|
402
|
-
onPress: disableMonthEventCellPress ? () => {} : () => onPressEvent(event),
|
|
403
|
-
onLongPress: disableMonthEventCellPress || !onLongPressEvent ? void 0 : () => onLongPressEvent(event)
|
|
404
|
-
})
|
|
405
|
-
}, keyExtractor(event, index))),
|
|
427
|
+
Array.from({ length: visibleLanes }, (_, i) => /* @__PURE__ */ jsx(View, { style: {
|
|
428
|
+
height: chipMetrics.chipHeight,
|
|
429
|
+
pointerEvents: "none"
|
|
430
|
+
} }, `lane-${i}`)),
|
|
406
431
|
hiddenCount > 0 ? /* @__PURE__ */ jsx(Text, {
|
|
407
432
|
...slot("more", {
|
|
408
433
|
base: styles$3.moreLabel,
|
|
@@ -490,13 +515,52 @@ function MonthViewInner({ date, events, maxVisibleEventCount, weekStartsOn, hidd
|
|
|
490
515
|
/* @__PURE__ */ jsx(View, {
|
|
491
516
|
...slot("grid", { base: styles$3.container }),
|
|
492
517
|
onLayout: handleLayout,
|
|
493
|
-
children: weeks.map((week) =>
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
518
|
+
children: weeks.map((week, weekIndex) => {
|
|
519
|
+
const rowLayout = weekLayouts[weekIndex] ?? EMPTY_LAYOUT;
|
|
520
|
+
const visibleLanes = monthVisibleCount(rowLayout.laneCount, capacity);
|
|
521
|
+
const cols = week.length;
|
|
522
|
+
let firstVisCol = 0;
|
|
523
|
+
let lastVisCol = cols - 1;
|
|
524
|
+
if (showGrid && !showAdjacentMonths) {
|
|
525
|
+
const first = week.findIndex((d) => isSameMonth(d, date));
|
|
526
|
+
if (first !== -1) {
|
|
527
|
+
firstVisCol = first;
|
|
528
|
+
lastVisCol = cols - 1 - [...week].reverse().findIndex((d) => isSameMonth(d, date));
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return /* @__PURE__ */ createElement(View, {
|
|
532
|
+
...slot("week", {
|
|
533
|
+
base: styles$3.weekRow,
|
|
534
|
+
themed: theme.containers.weekRow
|
|
535
|
+
}),
|
|
536
|
+
key: week[0].toISOString()
|
|
537
|
+
}, week.map((day, dayCol) => renderDay(day, dayCol, rowLayout, visibleLanes)), showGrid ? /* @__PURE__ */ jsx(View, {
|
|
538
|
+
style: [StyleSheet.absoluteFill, { pointerEvents: "box-none" }],
|
|
539
|
+
children: rowLayout.segments.filter((seg) => seg.lane < visibleLanes).map((seg) => {
|
|
540
|
+
const startCol = Math.max(seg.startCol, firstVisCol);
|
|
541
|
+
const endCol = Math.min(seg.endCol, lastVisCol);
|
|
542
|
+
if (startCol > endCol) return null;
|
|
543
|
+
return /* @__PURE__ */ jsx(View, {
|
|
544
|
+
style: {
|
|
545
|
+
position: "absolute",
|
|
546
|
+
left: pct(startCol / cols * 100),
|
|
547
|
+
width: pct((endCol - startCol + 1) / cols * 100),
|
|
548
|
+
top: BADGE_AREA + seg.lane * chipMetrics.chipRowHeight,
|
|
549
|
+
height: chipMetrics.chipHeight,
|
|
550
|
+
paddingHorizontal: CHIP_INSET_H,
|
|
551
|
+
pointerEvents: "box-none"
|
|
552
|
+
},
|
|
553
|
+
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
554
|
+
event: seg.event,
|
|
555
|
+
mode: "month",
|
|
556
|
+
isAllDay: isAllDayEvent(seg.event),
|
|
557
|
+
onPress: disableMonthEventCellPress ? () => {} : () => onPressEvent(seg.event),
|
|
558
|
+
onLongPress: disableMonthEventCellPress || !onLongPressEvent ? void 0 : () => onLongPressEvent(seg.event)
|
|
559
|
+
})
|
|
560
|
+
}, `bar-${seg.event.start.toISOString()}:${seg.event.title}:${seg.lane}`);
|
|
561
|
+
})
|
|
562
|
+
}) : null);
|
|
563
|
+
})
|
|
500
564
|
})
|
|
501
565
|
]
|
|
502
566
|
});
|
|
@@ -594,7 +658,7 @@ const styles$3 = StyleSheet.create({
|
|
|
594
658
|
const isWeb$1 = Platform.OS === "web";
|
|
595
659
|
const PAGE_WINDOW$1 = 60;
|
|
596
660
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
597
|
-
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
661
|
+
function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hiddenDays, weekdayFormat = "short", locale, sortedMonthView, moreLabel, showAdjacentMonths, highlightWeekends, disableMonthEventCellPress, isRTL, calendarCellStyle, renderEvent, keyExtractor, onPressDay, onLongPressDay, onPressEvent, onLongPressEvent, onPressMore, onChangeDate, freeSwipe = false, swipeEnabled = true, showSixWeeks = false, activeDate, renderHeaderForMonthView, renderCustomDateForMonth, classNames, styles: styleOverrides }) {
|
|
598
662
|
const theme = useCalendarTheme();
|
|
599
663
|
const slot = useMemo(() => createSlots({
|
|
600
664
|
classNames,
|
|
@@ -692,6 +756,7 @@ function MonthPagerInner({ date, events, maxVisibleEventCount, weekStartsOn, hid
|
|
|
692
756
|
sortedMonthView,
|
|
693
757
|
moreLabel,
|
|
694
758
|
showAdjacentMonths,
|
|
759
|
+
highlightWeekends,
|
|
695
760
|
disableMonthEventCellPress,
|
|
696
761
|
isRTL,
|
|
697
762
|
showSixWeeks,
|
|
@@ -928,7 +993,7 @@ const AUTOSCROLL_INTERVAL_MS = 16;
|
|
|
928
993
|
const NO_EVENTS = [];
|
|
929
994
|
const noop = () => {};
|
|
930
995
|
const defaultKeyExtractor = (event) => `${event.start.toISOString()}|${event.end.toISOString()}|${event.title ?? ""}`;
|
|
931
|
-
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, eventAccessibilityLabel, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }) {
|
|
996
|
+
function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat = "short", weekRowHeight: weekRowHeightProp, monthHeaderHeight = DEFAULT_MONTH_HEADER_HEIGHT, maxVisibleEventCount, locale, sortedMonthView, moreLabel, showAdjacentMonths = false, highlightWeekends = true, disableMonthEventCellPress, isRTL, activeDate, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, calendarCellStyle, renderEvent = DefaultMonthEvent, eventAccessibilityLabel, keyExtractor = defaultKeyExtractor, onPressDay, onLongPressDay, onPressEvent = noop, onLongPressEvent, onPressMore, onSelectDrag, onChangeVisibleMonth, renderMonthHeader, classNames, styles: styleOverrides }) {
|
|
932
997
|
const theme = useCalendarTheme();
|
|
933
998
|
const slot = useMemo(() => createSlots({
|
|
934
999
|
classNames,
|
|
@@ -1159,6 +1224,7 @@ function MonthListInner({ date, events = NO_EVENTS, weekStartsOn, weekdayFormat
|
|
|
1159
1224
|
sortedMonthView,
|
|
1160
1225
|
moreLabel,
|
|
1161
1226
|
showAdjacentMonths,
|
|
1227
|
+
highlightWeekends,
|
|
1162
1228
|
disableMonthEventCellPress,
|
|
1163
1229
|
isRTL,
|
|
1164
1230
|
activeDate,
|