@super-calendar/native 2.9.1 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +43 -24
- package/dist/index.mjs +43 -24
- package/package.json +2 -2
- package/src/components/Calendar.tsx +15 -0
- package/src/components/MultiDayMovePreview.tsx +11 -6
- package/src/components/TimeGrid.tsx +57 -16
package/dist/index.d.mts
CHANGED
|
@@ -192,6 +192,18 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
192
192
|
isRTL?: boolean;
|
|
193
193
|
minHourHeight?: number;
|
|
194
194
|
maxHourHeight?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Minimum pixel height of a timed event box, so short events stay legible and
|
|
197
|
+
* tappable. Also the floor of the `boxHeight` handed to `renderEvent`. Default
|
|
198
|
+
* 32; pass 0 to size every box strictly by its duration.
|
|
199
|
+
*/
|
|
200
|
+
minEventHeight?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Inset in pixels between a timed event box and its slot (each side), so
|
|
203
|
+
* adjacent boxes and column edges get some breathing room. Default 2; pass 0
|
|
204
|
+
* to let events fill their slot.
|
|
205
|
+
*/
|
|
206
|
+
eventGap?: number;
|
|
195
207
|
showNowIndicator?: boolean;
|
|
196
208
|
locale?: Locale;
|
|
197
209
|
freeSwipe?: boolean;
|
|
@@ -241,7 +253,7 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
241
253
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
242
254
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
243
255
|
};
|
|
244
|
-
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
256
|
+
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, minEventHeight, eventGap, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
245
257
|
/**
|
|
246
258
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
247
259
|
* hour-by-hour grid with positioned event boxes, an all-day lane, pinch-to-zoom
|
|
@@ -431,6 +443,17 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
431
443
|
hourHeight?: number;
|
|
432
444
|
minHourHeight?: number;
|
|
433
445
|
maxHourHeight?: number;
|
|
446
|
+
/**
|
|
447
|
+
* Minimum pixel height of a timed event box on the week/day grid, so short
|
|
448
|
+
* events stay legible and tappable. Also the floor of the `boxHeight` handed to
|
|
449
|
+
* `renderEvent`. Default 32; pass 0 to size every box strictly by its duration.
|
|
450
|
+
*/
|
|
451
|
+
minEventHeight?: number;
|
|
452
|
+
/**
|
|
453
|
+
* Inset in pixels between a timed event box and its slot on the week/day grid
|
|
454
|
+
* (each side). Default 2; pass 0 to let events fill their slot.
|
|
455
|
+
*/
|
|
456
|
+
eventGap?: number;
|
|
434
457
|
hourColumnWidth?: number;
|
|
435
458
|
/** Hide the left hour-axis column on the week/day grid. Default false. */
|
|
436
459
|
hideHours?: boolean;
|
|
@@ -548,7 +571,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
548
571
|
* }
|
|
549
572
|
* ```
|
|
550
573
|
*/
|
|
551
|
-
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
574
|
+
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
552
575
|
//#endregion
|
|
553
576
|
//#region src/components/DefaultEvent.d.ts
|
|
554
577
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -192,6 +192,18 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
192
192
|
isRTL?: boolean;
|
|
193
193
|
minHourHeight?: number;
|
|
194
194
|
maxHourHeight?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Minimum pixel height of a timed event box, so short events stay legible and
|
|
197
|
+
* tappable. Also the floor of the `boxHeight` handed to `renderEvent`. Default
|
|
198
|
+
* 32; pass 0 to size every box strictly by its duration.
|
|
199
|
+
*/
|
|
200
|
+
minEventHeight?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Inset in pixels between a timed event box and its slot (each side), so
|
|
203
|
+
* adjacent boxes and column edges get some breathing room. Default 2; pass 0
|
|
204
|
+
* to let events fill their slot.
|
|
205
|
+
*/
|
|
206
|
+
eventGap?: number;
|
|
195
207
|
showNowIndicator?: boolean;
|
|
196
208
|
locale?: Locale;
|
|
197
209
|
freeSwipe?: boolean;
|
|
@@ -241,7 +253,7 @@ type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
241
253
|
/** Optional header above the grid (e.g. weekday labels). Rendered full-width. */
|
|
242
254
|
renderHeader?: (days: Date[]) => React.ReactNode;
|
|
243
255
|
};
|
|
244
|
-
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
256
|
+
declare function TimeGridInner<T>({ mode, numberOfDays, weekEndsOn, date, events, cellHeight, hourHeight, weekStartsOn, weekdayFormat, renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes, hourColumnWidth: hourColumnWidthProp, hideHours, timeslots, showAllDayEventCell, highlightWeekends, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber, headerComponent, minHour, maxHour, ampm, isRTL, minHourHeight, maxHourHeight, minEventHeight, eventGap, showNowIndicator, locale, freeSwipe, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, weekNumberPrefix, hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell, dragStepMinutes, showDragHandle, eventStartEditable, eventDurationEditable, eventOverlap, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }: TimeGridProps<T>): ReactElement;
|
|
245
257
|
/**
|
|
246
258
|
* The timetable view used in day, 3days, week, and custom modes: an
|
|
247
259
|
* hour-by-hour grid with positioned event boxes, an all-day lane, pinch-to-zoom
|
|
@@ -431,6 +443,17 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
431
443
|
hourHeight?: number;
|
|
432
444
|
minHourHeight?: number;
|
|
433
445
|
maxHourHeight?: number;
|
|
446
|
+
/**
|
|
447
|
+
* Minimum pixel height of a timed event box on the week/day grid, so short
|
|
448
|
+
* events stay legible and tappable. Also the floor of the `boxHeight` handed to
|
|
449
|
+
* `renderEvent`. Default 32; pass 0 to size every box strictly by its duration.
|
|
450
|
+
*/
|
|
451
|
+
minEventHeight?: number;
|
|
452
|
+
/**
|
|
453
|
+
* Inset in pixels between a timed event box and its slot on the week/day grid
|
|
454
|
+
* (each side). Default 2; pass 0 to let events fill their slot.
|
|
455
|
+
*/
|
|
456
|
+
eventGap?: number;
|
|
434
457
|
hourColumnWidth?: number;
|
|
435
458
|
/** Hide the left hour-axis column on the week/day grid. Default false. */
|
|
436
459
|
hideHours?: boolean;
|
|
@@ -548,7 +571,7 @@ type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
548
571
|
* }
|
|
549
572
|
* ```
|
|
550
573
|
*/
|
|
551
|
-
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
574
|
+
declare function Calendar<T>({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor, theme, cellHeight: cellHeightProp, hourHeight, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }: CalendarProps<T>): ReactElement;
|
|
552
575
|
//#endregion
|
|
553
576
|
//#region src/components/DefaultEvent.d.ts
|
|
554
577
|
/**
|
package/dist/index.js
CHANGED
|
@@ -759,7 +759,6 @@ const styles$2 = react_native.StyleSheet.create({
|
|
|
759
759
|
//#endregion
|
|
760
760
|
//#region src/components/MultiDayMovePreview.tsx
|
|
761
761
|
const noop$1 = () => {};
|
|
762
|
-
const MIN_EVENT_HEIGHT$1 = 32;
|
|
763
762
|
function MultiDayMovePreview(props) {
|
|
764
763
|
const { move, days } = props;
|
|
765
764
|
const dayOffsets = (0, react.useMemo)(() => days.map((day) => (0, date_fns.differenceInCalendarDays)(day, days[move.dayIndex]) * 1440), [days, move]);
|
|
@@ -771,7 +770,7 @@ function MultiDayMovePreview(props) {
|
|
|
771
770
|
dayEnd: (0, date_fns.addDays)((0, date_fns.startOfDay)(day), 1).getTime()
|
|
772
771
|
}, day.toISOString()));
|
|
773
772
|
}
|
|
774
|
-
function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode, renderEvent: RenderEventComponent, dayOffsets, index, dayStart, dayEnd }) {
|
|
773
|
+
function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
|
|
775
774
|
const theme = require_MonthList.useCalendarTheme();
|
|
776
775
|
const slot = require_MonthList.useSlots();
|
|
777
776
|
const { offsetX, offsetY, lifted, dayIndex, event } = move;
|
|
@@ -799,7 +798,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
|
|
|
799
798
|
dayStart,
|
|
800
799
|
dayEnd
|
|
801
800
|
]);
|
|
802
|
-
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => segment.value.hours > 0 ? Math.max(segment.value.hours * cellHeight.value,
|
|
801
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => segment.value.hours > 0 ? Math.max(segment.value.hours * cellHeight.value, minEventHeight) : 0, [minEventHeight]);
|
|
803
802
|
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
804
803
|
top: (segment.value.top - minHour) * cellHeight.value,
|
|
805
804
|
height: boxHeight.value,
|
|
@@ -826,7 +825,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
|
|
|
826
825
|
{
|
|
827
826
|
position: "absolute",
|
|
828
827
|
overflow: "hidden",
|
|
829
|
-
padding:
|
|
828
|
+
padding: eventGap,
|
|
830
829
|
left: hourColumnWidth + index * dayWidth,
|
|
831
830
|
width: dayWidth,
|
|
832
831
|
zIndex: 100
|
|
@@ -856,8 +855,8 @@ const DEFAULT_HOUR_HEIGHT = 48;
|
|
|
856
855
|
const DEFAULT_MIN_HOUR_HEIGHT = 32;
|
|
857
856
|
const DEFAULT_MAX_HOUR_HEIGHT = 160;
|
|
858
857
|
const DEFAULT_HOUR_COLUMN_WIDTH = 56;
|
|
859
|
-
const
|
|
860
|
-
const
|
|
858
|
+
const DEFAULT_MIN_EVENT_HEIGHT = 32;
|
|
859
|
+
const DEFAULT_EVENT_GAP = 2;
|
|
861
860
|
const DRAG_ACTIVATE_MS = 300;
|
|
862
861
|
const MOVE_ACTIVATE_MS$1 = 500;
|
|
863
862
|
const DRAG_ACTIVATE_PX$1 = 8;
|
|
@@ -874,7 +873,7 @@ const noop = () => {};
|
|
|
874
873
|
* while a drag is actually spilling (see `spillHeight`), so an idle grid pays
|
|
875
874
|
* nothing for it; its geometry is driven on the UI thread from there.
|
|
876
875
|
*/
|
|
877
|
-
function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, dayWidth, nextDayDirection, minHour, event, mode, renderEvent, slotProps }) {
|
|
876
|
+
function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, dayWidth, nextDayDirection, minHour, event, mode, renderEvent, eventGap, slotProps }) {
|
|
878
877
|
const RenderEventComponent = renderEvent;
|
|
879
878
|
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
880
879
|
height: spillHeight.value,
|
|
@@ -896,7 +895,8 @@ function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, day
|
|
|
896
895
|
{
|
|
897
896
|
left: dayLeftPx,
|
|
898
897
|
width: dayWidth,
|
|
899
|
-
top: 0
|
|
898
|
+
top: 0,
|
|
899
|
+
padding: eventGap
|
|
900
900
|
},
|
|
901
901
|
slotProps.style,
|
|
902
902
|
style
|
|
@@ -917,7 +917,7 @@ function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, day
|
|
|
917
917
|
* visibility are driven on the UI thread by the shared values so it tracks the
|
|
918
918
|
* finger without a React re-render.
|
|
919
919
|
*/
|
|
920
|
-
function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
920
|
+
function DragGhost({ x, y, w, h, visible, event, mode, renderEvent, eventGap }) {
|
|
921
921
|
const RenderEventComponent = renderEvent;
|
|
922
922
|
const style = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
923
923
|
transform: [{ translateX: x.value }, { translateY: y.value }],
|
|
@@ -929,6 +929,7 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
929
929
|
style: [
|
|
930
930
|
styles$1.eventBox,
|
|
931
931
|
styles$1.dragGhost,
|
|
932
|
+
{ padding: eventGap },
|
|
932
933
|
style
|
|
933
934
|
],
|
|
934
935
|
pointerEvents: "none",
|
|
@@ -941,7 +942,7 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
941
942
|
});
|
|
942
943
|
}
|
|
943
944
|
const HOUR_LABEL_TOP_INSET = 12;
|
|
944
|
-
function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
945
|
+
function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, minEventHeight, eventGap, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
945
946
|
const RenderEventComponent = renderEvent;
|
|
946
947
|
const theme = require_MonthList.useCalendarTheme();
|
|
947
948
|
const slot = require_MonthList.useSlots();
|
|
@@ -978,12 +979,16 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
978
979
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
979
980
|
ownsStart
|
|
980
981
|
}), [startHours, ownsStart]);
|
|
981
|
-
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => Math.max(durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value,
|
|
982
|
+
const boxHeight = (0, react_native_reanimated.useDerivedValue)(() => Math.max(durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value, minEventHeight), [durationHours, minEventHeight]);
|
|
982
983
|
const visibleBoxHeight = (0, react_native_reanimated.useDerivedValue)(() => {
|
|
983
984
|
const top = (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
984
985
|
const dayEnd = (HOURS_PER_DAY - minHour) * cellHeight.value;
|
|
985
|
-
return Math.max(Math.min(boxHeight.value, dayEnd - top),
|
|
986
|
-
}, [
|
|
986
|
+
return Math.max(Math.min(boxHeight.value, dayEnd - top), minEventHeight);
|
|
987
|
+
}, [
|
|
988
|
+
startHours,
|
|
989
|
+
minHour,
|
|
990
|
+
minEventHeight
|
|
991
|
+
]);
|
|
987
992
|
const boxStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
988
993
|
return {
|
|
989
994
|
top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
@@ -1344,7 +1349,8 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1344
1349
|
const eventSlot = slot("event", {
|
|
1345
1350
|
base: [styles$1.eventBox, {
|
|
1346
1351
|
left,
|
|
1347
|
-
width
|
|
1352
|
+
width,
|
|
1353
|
+
padding: eventGap
|
|
1348
1354
|
}],
|
|
1349
1355
|
themed: theme.containers.timeGridEvent
|
|
1350
1356
|
});
|
|
@@ -1398,6 +1404,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1398
1404
|
event: positioned.event,
|
|
1399
1405
|
mode,
|
|
1400
1406
|
renderEvent,
|
|
1407
|
+
eventGap,
|
|
1401
1408
|
slotProps: slot("event", { themed: theme.containers.timeGridEvent })
|
|
1402
1409
|
}) : null] });
|
|
1403
1410
|
}
|
|
@@ -1498,7 +1505,7 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
1498
1505
|
children
|
|
1499
1506
|
});
|
|
1500
1507
|
};
|
|
1501
|
-
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, hourHeight, committedCellHeight, scrollY, isActive, initialScrollY, onSettleOffset, weekStartsOn, weekEndsOn, width, hourColumnWidth, minHour, maxHour, ampm, timeslots, isRTL, showAllDayEventCell, highlightWeekends, showVerticalScrollIndicator, verticalScrollEnabled, hourComponent, calendarCellStyle, minHourHeight, maxHourHeight, showNowIndicator, businessHours, renderBusinessHours, renderEvent, keyExtractor, snapMinutes, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, onGridTop }) {
|
|
1508
|
+
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, hourHeight, committedCellHeight, scrollY, isActive, initialScrollY, onSettleOffset, weekStartsOn, weekEndsOn, width, hourColumnWidth, minHour, maxHour, ampm, timeslots, isRTL, showAllDayEventCell, highlightWeekends, showVerticalScrollIndicator, verticalScrollEnabled, hourComponent, calendarCellStyle, minHourHeight, maxHourHeight, showNowIndicator, businessHours, renderBusinessHours, renderEvent, keyExtractor, snapMinutes, minEventHeight, eventGap, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, onGridTop }) {
|
|
1502
1509
|
const theme = require_MonthList.useCalendarTheme();
|
|
1503
1510
|
const slot = require_MonthList.useSlots();
|
|
1504
1511
|
const scrollRef = (0, react_native_reanimated.useAnimatedRef)();
|
|
@@ -1729,7 +1736,10 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1729
1736
|
opacity: createActive.value
|
|
1730
1737
|
}));
|
|
1731
1738
|
const ghostSlot = slot("createGhost", {
|
|
1732
|
-
base: [styles$1.createGhost, {
|
|
1739
|
+
base: [styles$1.createGhost, {
|
|
1740
|
+
marginHorizontal: eventGap,
|
|
1741
|
+
pointerEvents: "none"
|
|
1742
|
+
}],
|
|
1733
1743
|
themed: {
|
|
1734
1744
|
backgroundColor: theme.colors.eventBackground,
|
|
1735
1745
|
borderColor: theme.colors.todayBackground
|
|
@@ -1892,6 +1902,8 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1892
1902
|
daysPerPage,
|
|
1893
1903
|
renderEvent,
|
|
1894
1904
|
snapMinutes,
|
|
1905
|
+
minEventHeight,
|
|
1906
|
+
eventGap,
|
|
1895
1907
|
showDragHandle,
|
|
1896
1908
|
eventStartEditable,
|
|
1897
1909
|
eventDurationEditable,
|
|
@@ -1910,7 +1922,9 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1910
1922
|
hourColumnWidth,
|
|
1911
1923
|
minHour,
|
|
1912
1924
|
mode,
|
|
1913
|
-
renderEvent
|
|
1925
|
+
renderEvent,
|
|
1926
|
+
minEventHeight,
|
|
1927
|
+
eventGap
|
|
1914
1928
|
}) : null,
|
|
1915
1929
|
showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NowIndicator, {
|
|
1916
1930
|
cellHeight: heightSource,
|
|
@@ -1931,7 +1945,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1931
1945
|
});
|
|
1932
1946
|
}
|
|
1933
1947
|
const TimetablePage = (0, react.memo)(TimetablePageInner);
|
|
1934
|
-
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
1948
|
+
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
1935
1949
|
const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
|
|
1936
1950
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
1937
1951
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
@@ -2241,6 +2255,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2241
2255
|
renderEvent: labeledRenderEvent,
|
|
2242
2256
|
keyExtractor,
|
|
2243
2257
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
2258
|
+
minEventHeight,
|
|
2259
|
+
eventGap,
|
|
2244
2260
|
showDragHandle,
|
|
2245
2261
|
eventStartEditable,
|
|
2246
2262
|
eventDurationEditable,
|
|
@@ -2289,6 +2305,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2289
2305
|
labeledRenderEvent,
|
|
2290
2306
|
keyExtractor,
|
|
2291
2307
|
dragStepMinutes,
|
|
2308
|
+
minEventHeight,
|
|
2309
|
+
eventGap,
|
|
2292
2310
|
showDragHandle,
|
|
2293
2311
|
eventStartEditable,
|
|
2294
2312
|
eventDurationEditable,
|
|
@@ -2370,7 +2388,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2370
2388
|
visible: ghostVisible,
|
|
2371
2389
|
event: liftedEvent,
|
|
2372
2390
|
mode,
|
|
2373
|
-
renderEvent: labeledRenderEvent
|
|
2391
|
+
renderEvent: labeledRenderEvent,
|
|
2392
|
+
eventGap
|
|
2374
2393
|
}) : null]
|
|
2375
2394
|
})
|
|
2376
2395
|
]
|
|
@@ -2503,8 +2522,7 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2503
2522
|
createGhost: {
|
|
2504
2523
|
position: "absolute",
|
|
2505
2524
|
borderRadius: 6,
|
|
2506
|
-
borderWidth: react_native.StyleSheet.hairlineWidth
|
|
2507
|
-
marginHorizontal: EVENT_GAP
|
|
2525
|
+
borderWidth: react_native.StyleSheet.hairlineWidth
|
|
2508
2526
|
},
|
|
2509
2527
|
weekendColumn: {
|
|
2510
2528
|
position: "absolute",
|
|
@@ -2564,8 +2582,7 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
2564
2582
|
},
|
|
2565
2583
|
eventBox: {
|
|
2566
2584
|
position: "absolute",
|
|
2567
|
-
overflow: "hidden"
|
|
2568
|
-
padding: EVENT_GAP
|
|
2585
|
+
overflow: "hidden"
|
|
2569
2586
|
},
|
|
2570
2587
|
dragGhost: {
|
|
2571
2588
|
top: 0,
|
|
@@ -2622,7 +2639,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
2622
2639
|
* }
|
|
2623
2640
|
* ```
|
|
2624
2641
|
*/
|
|
2625
|
-
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2642
|
+
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2626
2643
|
const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
|
|
2627
2644
|
const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
2628
2645
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -2807,6 +2824,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2807
2824
|
ampm,
|
|
2808
2825
|
minHourHeight,
|
|
2809
2826
|
maxHourHeight,
|
|
2827
|
+
minEventHeight,
|
|
2828
|
+
eventGap,
|
|
2810
2829
|
showNowIndicator,
|
|
2811
2830
|
locale,
|
|
2812
2831
|
activeDate,
|
package/dist/index.mjs
CHANGED
|
@@ -735,7 +735,6 @@ const styles$2 = StyleSheet.create({
|
|
|
735
735
|
//#endregion
|
|
736
736
|
//#region src/components/MultiDayMovePreview.tsx
|
|
737
737
|
const noop$1 = () => {};
|
|
738
|
-
const MIN_EVENT_HEIGHT$1 = 32;
|
|
739
738
|
function MultiDayMovePreview(props) {
|
|
740
739
|
const { move, days } = props;
|
|
741
740
|
const dayOffsets = useMemo(() => days.map((day) => differenceInCalendarDays(day, days[move.dayIndex]) * 1440), [days, move]);
|
|
@@ -747,7 +746,7 @@ function MultiDayMovePreview(props) {
|
|
|
747
746
|
dayEnd: addDays(startOfDay(day), 1).getTime()
|
|
748
747
|
}, day.toISOString()));
|
|
749
748
|
}
|
|
750
|
-
function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode, renderEvent: RenderEventComponent, dayOffsets, index, dayStart, dayEnd }) {
|
|
749
|
+
function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode, renderEvent: RenderEventComponent, minEventHeight, eventGap, dayOffsets, index, dayStart, dayEnd }) {
|
|
751
750
|
const theme = useCalendarTheme();
|
|
752
751
|
const slot = useSlots();
|
|
753
752
|
const { offsetX, offsetY, lifted, dayIndex, event } = move;
|
|
@@ -775,7 +774,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
|
|
|
775
774
|
dayStart,
|
|
776
775
|
dayEnd
|
|
777
776
|
]);
|
|
778
|
-
const boxHeight = useDerivedValue(() => segment.value.hours > 0 ? Math.max(segment.value.hours * cellHeight.value,
|
|
777
|
+
const boxHeight = useDerivedValue(() => segment.value.hours > 0 ? Math.max(segment.value.hours * cellHeight.value, minEventHeight) : 0, [minEventHeight]);
|
|
779
778
|
const style = useAnimatedStyle(() => ({
|
|
780
779
|
top: (segment.value.top - minHour) * cellHeight.value,
|
|
781
780
|
height: boxHeight.value,
|
|
@@ -802,7 +801,7 @@ function PreviewDay({ move, cellHeight, dayWidth, hourColumnWidth, minHour, mode
|
|
|
802
801
|
{
|
|
803
802
|
position: "absolute",
|
|
804
803
|
overflow: "hidden",
|
|
805
|
-
padding:
|
|
804
|
+
padding: eventGap,
|
|
806
805
|
left: hourColumnWidth + index * dayWidth,
|
|
807
806
|
width: dayWidth,
|
|
808
807
|
zIndex: 100
|
|
@@ -832,8 +831,8 @@ const DEFAULT_HOUR_HEIGHT = 48;
|
|
|
832
831
|
const DEFAULT_MIN_HOUR_HEIGHT = 32;
|
|
833
832
|
const DEFAULT_MAX_HOUR_HEIGHT = 160;
|
|
834
833
|
const DEFAULT_HOUR_COLUMN_WIDTH = 56;
|
|
835
|
-
const
|
|
836
|
-
const
|
|
834
|
+
const DEFAULT_MIN_EVENT_HEIGHT = 32;
|
|
835
|
+
const DEFAULT_EVENT_GAP = 2;
|
|
837
836
|
const DRAG_ACTIVATE_MS = 300;
|
|
838
837
|
const MOVE_ACTIVATE_MS$1 = 500;
|
|
839
838
|
const DRAG_ACTIVATE_PX$1 = 8;
|
|
@@ -850,7 +849,7 @@ const noop = () => {};
|
|
|
850
849
|
* while a drag is actually spilling (see `spillHeight`), so an idle grid pays
|
|
851
850
|
* nothing for it; its geometry is driven on the UI thread from there.
|
|
852
851
|
*/
|
|
853
|
-
function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, dayWidth, nextDayDirection, minHour, event, mode, renderEvent, slotProps }) {
|
|
852
|
+
function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, dayWidth, nextDayDirection, minHour, event, mode, renderEvent, eventGap, slotProps }) {
|
|
854
853
|
const RenderEventComponent = renderEvent;
|
|
855
854
|
const style = useAnimatedStyle(() => ({
|
|
856
855
|
height: spillHeight.value,
|
|
@@ -872,7 +871,8 @@ function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, day
|
|
|
872
871
|
{
|
|
873
872
|
left: dayLeftPx,
|
|
874
873
|
width: dayWidth,
|
|
875
|
-
top: 0
|
|
874
|
+
top: 0,
|
|
875
|
+
padding: eventGap
|
|
876
876
|
},
|
|
877
877
|
slotProps.style,
|
|
878
878
|
style
|
|
@@ -893,7 +893,7 @@ function MoveSpillPreview({ spillHeight, moveOffsetX, cellHeight, dayLeftPx, day
|
|
|
893
893
|
* visibility are driven on the UI thread by the shared values so it tracks the
|
|
894
894
|
* finger without a React re-render.
|
|
895
895
|
*/
|
|
896
|
-
function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
896
|
+
function DragGhost({ x, y, w, h, visible, event, mode, renderEvent, eventGap }) {
|
|
897
897
|
const RenderEventComponent = renderEvent;
|
|
898
898
|
const style = useAnimatedStyle(() => ({
|
|
899
899
|
transform: [{ translateX: x.value }, { translateY: y.value }],
|
|
@@ -905,6 +905,7 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
905
905
|
style: [
|
|
906
906
|
styles$1.eventBox,
|
|
907
907
|
styles$1.dragGhost,
|
|
908
|
+
{ padding: eventGap },
|
|
908
909
|
style
|
|
909
910
|
],
|
|
910
911
|
pointerEvents: "none",
|
|
@@ -917,7 +918,7 @@ function DragGhost({ x, y, w, h, visible, event, mode, renderEvent }) {
|
|
|
917
918
|
});
|
|
918
919
|
}
|
|
919
920
|
const HOUR_LABEL_TOP_INSET = 12;
|
|
920
|
-
function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
921
|
+
function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview, cellHeight, minHour, maxHour, left, width, dayLeftPx, nextDayDirection, dayWidth, dayIndex, dayCount, dayOrdinals, mode, daysPerPage, renderEvent, snapMinutes, minEventHeight, eventGap, onPress, onLongPress, onDragEvent, onDragStart, onEdgeAdvance, showDragHandle, eventStartEditable, eventDurationEditable }) {
|
|
921
922
|
const RenderEventComponent = renderEvent;
|
|
922
923
|
const theme = useCalendarTheme();
|
|
923
924
|
const slot = useSlots();
|
|
@@ -954,12 +955,16 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
954
955
|
minutes: startHours * MINUTES_PER_HOUR$1,
|
|
955
956
|
ownsStart
|
|
956
957
|
}), [startHours, ownsStart]);
|
|
957
|
-
const boxHeight = useDerivedValue(() => Math.max(durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value,
|
|
958
|
+
const boxHeight = useDerivedValue(() => Math.max(durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value, minEventHeight), [durationHours, minEventHeight]);
|
|
958
959
|
const visibleBoxHeight = useDerivedValue(() => {
|
|
959
960
|
const top = (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
960
961
|
const dayEnd = (HOURS_PER_DAY - minHour) * cellHeight.value;
|
|
961
|
-
return Math.max(Math.min(boxHeight.value, dayEnd - top),
|
|
962
|
-
}, [
|
|
962
|
+
return Math.max(Math.min(boxHeight.value, dayEnd - top), minEventHeight);
|
|
963
|
+
}, [
|
|
964
|
+
startHours,
|
|
965
|
+
minHour,
|
|
966
|
+
minEventHeight
|
|
967
|
+
]);
|
|
963
968
|
const boxStyle = useAnimatedStyle(() => {
|
|
964
969
|
return {
|
|
965
970
|
top: (startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value,
|
|
@@ -1320,7 +1325,8 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1320
1325
|
const eventSlot = slot("event", {
|
|
1321
1326
|
base: [styles$1.eventBox, {
|
|
1322
1327
|
left,
|
|
1323
|
-
width
|
|
1328
|
+
width,
|
|
1329
|
+
padding: eventGap
|
|
1324
1330
|
}],
|
|
1325
1331
|
themed: theme.containers.timeGridEvent
|
|
1326
1332
|
});
|
|
@@ -1374,6 +1380,7 @@ function AnimatedEventBox({ positioned, eventIndex, movingEvent, onMovePreview,
|
|
|
1374
1380
|
event: positioned.event,
|
|
1375
1381
|
mode,
|
|
1376
1382
|
renderEvent,
|
|
1383
|
+
eventGap,
|
|
1377
1384
|
slotProps: slot("event", { themed: theme.containers.timeGridEvent })
|
|
1378
1385
|
}) : null] });
|
|
1379
1386
|
}
|
|
@@ -1474,7 +1481,7 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
1474
1481
|
children
|
|
1475
1482
|
});
|
|
1476
1483
|
};
|
|
1477
|
-
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, hourHeight, committedCellHeight, scrollY, isActive, initialScrollY, onSettleOffset, weekStartsOn, weekEndsOn, width, hourColumnWidth, minHour, maxHour, ampm, timeslots, isRTL, showAllDayEventCell, highlightWeekends, showVerticalScrollIndicator, verticalScrollEnabled, hourComponent, calendarCellStyle, minHourHeight, maxHourHeight, showNowIndicator, businessHours, renderBusinessHours, renderEvent, keyExtractor, snapMinutes, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, onGridTop }) {
|
|
1484
|
+
function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowTimeZone, date, events, cellHeight, hourHeight, committedCellHeight, scrollY, isActive, initialScrollY, onSettleOffset, weekStartsOn, weekEndsOn, width, hourColumnWidth, minHour, maxHour, ampm, timeslots, isRTL, showAllDayEventCell, highlightWeekends, showVerticalScrollIndicator, verticalScrollEnabled, hourComponent, calendarCellStyle, minHourHeight, maxHourHeight, showNowIndicator, businessHours, renderBusinessHours, renderEvent, keyExtractor, snapMinutes, minEventHeight, eventGap, showDragHandle, eventStartEditable, eventDurationEditable, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onEdgeAdvance, onGridTop }) {
|
|
1478
1485
|
const theme = useCalendarTheme();
|
|
1479
1486
|
const slot = useSlots();
|
|
1480
1487
|
const scrollRef = useAnimatedRef();
|
|
@@ -1705,7 +1712,10 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1705
1712
|
opacity: createActive.value
|
|
1706
1713
|
}));
|
|
1707
1714
|
const ghostSlot = slot("createGhost", {
|
|
1708
|
-
base: [styles$1.createGhost, {
|
|
1715
|
+
base: [styles$1.createGhost, {
|
|
1716
|
+
marginHorizontal: eventGap,
|
|
1717
|
+
pointerEvents: "none"
|
|
1718
|
+
}],
|
|
1709
1719
|
themed: {
|
|
1710
1720
|
backgroundColor: theme.colors.eventBackground,
|
|
1711
1721
|
borderColor: theme.colors.todayBackground
|
|
@@ -1868,6 +1878,8 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1868
1878
|
daysPerPage,
|
|
1869
1879
|
renderEvent,
|
|
1870
1880
|
snapMinutes,
|
|
1881
|
+
minEventHeight,
|
|
1882
|
+
eventGap,
|
|
1871
1883
|
showDragHandle,
|
|
1872
1884
|
eventStartEditable,
|
|
1873
1885
|
eventDurationEditable,
|
|
@@ -1886,7 +1898,9 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1886
1898
|
hourColumnWidth,
|
|
1887
1899
|
minHour,
|
|
1888
1900
|
mode,
|
|
1889
|
-
renderEvent
|
|
1901
|
+
renderEvent,
|
|
1902
|
+
minEventHeight,
|
|
1903
|
+
eventGap
|
|
1890
1904
|
}) : null,
|
|
1891
1905
|
showNowIndicator && nowDayIndex >= 0 && nowInWindow ? /* @__PURE__ */ jsx(NowIndicator, {
|
|
1892
1906
|
cellHeight: heightSource,
|
|
@@ -1907,7 +1921,7 @@ function TimetablePageInner({ mode, numberOfDays, hiddenDays, now: nowProp, nowT
|
|
|
1907
1921
|
});
|
|
1908
1922
|
}
|
|
1909
1923
|
const TimetablePage = memo(TimetablePageInner);
|
|
1910
|
-
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
1924
|
+
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, highlightWeekends = true, calendarCellStyle, businessHours, renderBusinessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, minEventHeight = DEFAULT_MIN_EVENT_HEIGHT, eventGap = DEFAULT_EVENT_GAP, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hiddenDays, now, timeZone, hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, eventStartEditable = true, eventDurationEditable = true, eventOverlap = true, onPressEvent, onLongPressEvent, onDragEvent: onDragEventProp, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader, classNames, styles: styleOverrides }) {
|
|
1911
1925
|
const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
|
|
1912
1926
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
1913
1927
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
@@ -2217,6 +2231,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2217
2231
|
renderEvent: labeledRenderEvent,
|
|
2218
2232
|
keyExtractor,
|
|
2219
2233
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
2234
|
+
minEventHeight,
|
|
2235
|
+
eventGap,
|
|
2220
2236
|
showDragHandle,
|
|
2221
2237
|
eventStartEditable,
|
|
2222
2238
|
eventDurationEditable,
|
|
@@ -2265,6 +2281,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2265
2281
|
labeledRenderEvent,
|
|
2266
2282
|
keyExtractor,
|
|
2267
2283
|
dragStepMinutes,
|
|
2284
|
+
minEventHeight,
|
|
2285
|
+
eventGap,
|
|
2268
2286
|
showDragHandle,
|
|
2269
2287
|
eventStartEditable,
|
|
2270
2288
|
eventDurationEditable,
|
|
@@ -2346,7 +2364,8 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
2346
2364
|
visible: ghostVisible,
|
|
2347
2365
|
event: liftedEvent,
|
|
2348
2366
|
mode,
|
|
2349
|
-
renderEvent: labeledRenderEvent
|
|
2367
|
+
renderEvent: labeledRenderEvent,
|
|
2368
|
+
eventGap
|
|
2350
2369
|
}) : null]
|
|
2351
2370
|
})
|
|
2352
2371
|
]
|
|
@@ -2479,8 +2498,7 @@ const styles$1 = StyleSheet.create({
|
|
|
2479
2498
|
createGhost: {
|
|
2480
2499
|
position: "absolute",
|
|
2481
2500
|
borderRadius: 6,
|
|
2482
|
-
borderWidth: StyleSheet.hairlineWidth
|
|
2483
|
-
marginHorizontal: EVENT_GAP
|
|
2501
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
2484
2502
|
},
|
|
2485
2503
|
weekendColumn: {
|
|
2486
2504
|
position: "absolute",
|
|
@@ -2540,8 +2558,7 @@ const styles$1 = StyleSheet.create({
|
|
|
2540
2558
|
},
|
|
2541
2559
|
eventBox: {
|
|
2542
2560
|
position: "absolute",
|
|
2543
|
-
overflow: "hidden"
|
|
2544
|
-
padding: EVENT_GAP
|
|
2561
|
+
overflow: "hidden"
|
|
2545
2562
|
},
|
|
2546
2563
|
dragGhost: {
|
|
2547
2564
|
top: 0,
|
|
@@ -2598,7 +2615,7 @@ function expansionRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
2598
2615
|
* }
|
|
2599
2616
|
* ```
|
|
2600
2617
|
*/
|
|
2601
|
-
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2618
|
+
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onPressMonth, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onSelectDrag, selectedDates, selectedRange, fillCellOnSelection, minDate, maxDate, isDateDisabled, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, hiddenDays, now, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, renderBusinessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, minEventHeight, eventGap, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, highlightWeekends, eventStartEditable, eventDurationEditable, eventOverlap, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, showTitle, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, timeZone, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent, classNames, styles: styleOverrides }) {
|
|
2602
2619
|
const mergedTheme = useMemo(() => mergeTheme(theme), [theme]);
|
|
2603
2620
|
const internalCellHeight = useSharedValue(hourHeight);
|
|
2604
2621
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -2783,6 +2800,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
2783
2800
|
ampm,
|
|
2784
2801
|
minHourHeight,
|
|
2785
2802
|
maxHourHeight,
|
|
2803
|
+
minEventHeight,
|
|
2804
|
+
eventGap,
|
|
2786
2805
|
showNowIndicator,
|
|
2787
2806
|
locale,
|
|
2788
2807
|
activeDate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.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.10.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@legendapp/list": ">=3",
|
|
@@ -217,6 +217,17 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
|
|
|
217
217
|
hourHeight?: number;
|
|
218
218
|
minHourHeight?: number;
|
|
219
219
|
maxHourHeight?: number;
|
|
220
|
+
/**
|
|
221
|
+
* Minimum pixel height of a timed event box on the week/day grid, so short
|
|
222
|
+
* events stay legible and tappable. Also the floor of the `boxHeight` handed to
|
|
223
|
+
* `renderEvent`. Default 32; pass 0 to size every box strictly by its duration.
|
|
224
|
+
*/
|
|
225
|
+
minEventHeight?: number;
|
|
226
|
+
/**
|
|
227
|
+
* Inset in pixels between a timed event box and its slot on the week/day grid
|
|
228
|
+
* (each side). Default 2; pass 0 to let events fill their slot.
|
|
229
|
+
*/
|
|
230
|
+
eventGap?: number;
|
|
220
231
|
hourColumnWidth?: number;
|
|
221
232
|
/** Hide the left hour-axis column on the week/day grid. Default false. */
|
|
222
233
|
hideHours?: boolean;
|
|
@@ -451,6 +462,8 @@ export function Calendar<T>({
|
|
|
451
462
|
hourHeight = DEFAULT_HOUR_HEIGHT,
|
|
452
463
|
minHourHeight,
|
|
453
464
|
maxHourHeight,
|
|
465
|
+
minEventHeight,
|
|
466
|
+
eventGap,
|
|
454
467
|
hourColumnWidth,
|
|
455
468
|
hideHours,
|
|
456
469
|
timeslots,
|
|
@@ -709,6 +722,8 @@ export function Calendar<T>({
|
|
|
709
722
|
ampm={ampm}
|
|
710
723
|
minHourHeight={minHourHeight}
|
|
711
724
|
maxHourHeight={maxHourHeight}
|
|
725
|
+
minEventHeight={minEventHeight}
|
|
726
|
+
eventGap={eventGap}
|
|
712
727
|
showNowIndicator={showNowIndicator}
|
|
713
728
|
locale={locale}
|
|
714
729
|
activeDate={activeDate}
|
|
@@ -32,10 +32,11 @@ type PreviewProps<T> = {
|
|
|
32
32
|
minHour: number;
|
|
33
33
|
mode: CalendarMode;
|
|
34
34
|
renderEvent: RenderEvent<T>;
|
|
35
|
+
minEventHeight: number;
|
|
36
|
+
eventGap: number;
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
const noop = () => {};
|
|
38
|
-
const MIN_EVENT_HEIGHT = 32;
|
|
39
40
|
|
|
40
41
|
// Mount once on grab. Only numbers and shared values cross to the UI thread;
|
|
41
42
|
// moving the pointer does not rerender the page or rebuild its gestures.
|
|
@@ -65,6 +66,8 @@ function PreviewDay<T>({
|
|
|
65
66
|
minHour,
|
|
66
67
|
mode,
|
|
67
68
|
renderEvent: RenderEventComponent,
|
|
69
|
+
minEventHeight,
|
|
70
|
+
eventGap,
|
|
68
71
|
dayOffsets,
|
|
69
72
|
index,
|
|
70
73
|
dayStart,
|
|
@@ -99,10 +102,12 @@ function PreviewDay<T>({
|
|
|
99
102
|
continuesAfter: end > dayEnd,
|
|
100
103
|
};
|
|
101
104
|
}, [dayWidth, dayIndex, dayOffsets, startTimestamp, duration, dayStart, dayEnd]);
|
|
102
|
-
const boxHeight = useDerivedValue(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
const boxHeight = useDerivedValue(
|
|
106
|
+
() =>
|
|
107
|
+
segment.value.hours > 0
|
|
108
|
+
? Math.max(segment.value.hours * cellHeight.value, minEventHeight)
|
|
109
|
+
: 0,
|
|
110
|
+
[minEventHeight],
|
|
106
111
|
);
|
|
107
112
|
const style = useAnimatedStyle(
|
|
108
113
|
() => ({
|
|
@@ -143,7 +148,7 @@ function PreviewDay<T>({
|
|
|
143
148
|
{
|
|
144
149
|
position: "absolute",
|
|
145
150
|
overflow: "hidden",
|
|
146
|
-
padding:
|
|
151
|
+
padding: eventGap,
|
|
147
152
|
left: hourColumnWidth + index * dayWidth,
|
|
148
153
|
width: dayWidth,
|
|
149
154
|
zIndex: 100,
|
|
@@ -129,11 +129,13 @@ const DEFAULT_MIN_HOUR_HEIGHT = 32;
|
|
|
129
129
|
const DEFAULT_MAX_HOUR_HEIGHT = 160;
|
|
130
130
|
const DEFAULT_HOUR_COLUMN_WIDTH = 56;
|
|
131
131
|
// Short events would otherwise render only a few pixels tall and clip their
|
|
132
|
-
// content; keep them tall enough to stay legible and tappable.
|
|
133
|
-
|
|
132
|
+
// content; keep them tall enough to stay legible and tappable. Overridable per
|
|
133
|
+
// grid via `minEventHeight`.
|
|
134
|
+
const DEFAULT_MIN_EVENT_HEIGHT = 32;
|
|
134
135
|
// Inset each event box within its slot so adjacent boxes (and column edges) get a
|
|
135
|
-
// little breathing room instead of butting edge-to-edge.
|
|
136
|
-
|
|
136
|
+
// little breathing room instead of butting edge-to-edge. Overridable per grid via
|
|
137
|
+
// `eventGap`.
|
|
138
|
+
const DEFAULT_EVENT_GAP = 2;
|
|
137
139
|
// Hold this long before drag-to-create (sweeping empty grid space) begins on
|
|
138
140
|
// native, so a normal scroll/tap isn't hijacked.
|
|
139
141
|
const DRAG_ACTIVATE_MS = 300;
|
|
@@ -208,6 +210,7 @@ function MoveSpillPreview<T>({
|
|
|
208
210
|
event,
|
|
209
211
|
mode,
|
|
210
212
|
renderEvent,
|
|
213
|
+
eventGap,
|
|
211
214
|
slotProps,
|
|
212
215
|
}: {
|
|
213
216
|
spillHeight: SharedValue<number>;
|
|
@@ -220,6 +223,7 @@ function MoveSpillPreview<T>({
|
|
|
220
223
|
event: CalendarEvent<T>;
|
|
221
224
|
mode: CalendarMode;
|
|
222
225
|
renderEvent: RenderEvent<T>;
|
|
226
|
+
eventGap: number;
|
|
223
227
|
slotProps: ResolvedSlot<ViewStyle>;
|
|
224
228
|
}): ReactElement {
|
|
225
229
|
const RenderEventComponent = renderEvent;
|
|
@@ -246,7 +250,7 @@ function MoveSpillPreview<T>({
|
|
|
246
250
|
style={[
|
|
247
251
|
styles.eventBox,
|
|
248
252
|
styles.nonInteractive,
|
|
249
|
-
{ left: dayLeftPx, width: dayWidth, top: 0 },
|
|
253
|
+
{ left: dayLeftPx, width: dayWidth, top: 0, padding: eventGap },
|
|
250
254
|
slotProps.style,
|
|
251
255
|
style,
|
|
252
256
|
]}
|
|
@@ -278,6 +282,7 @@ function DragGhost<T>({
|
|
|
278
282
|
event,
|
|
279
283
|
mode,
|
|
280
284
|
renderEvent,
|
|
285
|
+
eventGap,
|
|
281
286
|
}: {
|
|
282
287
|
x: SharedValue<number>;
|
|
283
288
|
y: SharedValue<number>;
|
|
@@ -287,6 +292,7 @@ function DragGhost<T>({
|
|
|
287
292
|
event: CalendarEvent<T>;
|
|
288
293
|
mode: CalendarMode;
|
|
289
294
|
renderEvent: RenderEvent<T>;
|
|
295
|
+
eventGap: number;
|
|
290
296
|
}): ReactElement {
|
|
291
297
|
const RenderEventComponent = renderEvent;
|
|
292
298
|
const style = useAnimatedStyle(() => ({
|
|
@@ -296,7 +302,10 @@ function DragGhost<T>({
|
|
|
296
302
|
opacity: visible.value,
|
|
297
303
|
}));
|
|
298
304
|
return (
|
|
299
|
-
<Animated.View
|
|
305
|
+
<Animated.View
|
|
306
|
+
style={[styles.eventBox, styles.dragGhost, { padding: eventGap }, style]}
|
|
307
|
+
pointerEvents="none"
|
|
308
|
+
>
|
|
300
309
|
<RenderEventComponent event={event} mode={mode} boxHeight={h} onPress={noop} />
|
|
301
310
|
</Animated.View>
|
|
302
311
|
);
|
|
@@ -341,6 +350,10 @@ type AnimatedEventBoxProps<T> = {
|
|
|
341
350
|
daysPerPage: number;
|
|
342
351
|
renderEvent: RenderEvent<T>;
|
|
343
352
|
snapMinutes: number;
|
|
353
|
+
// Floor for the box's pixel height (and the `boxHeight` handed to renderEvent).
|
|
354
|
+
minEventHeight: number;
|
|
355
|
+
// Inset between the box and its slot, applied as border-box padding.
|
|
356
|
+
eventGap: number;
|
|
344
357
|
onPress: (event: CalendarEvent<T>) => void;
|
|
345
358
|
onLongPress?: (event: CalendarEvent<T>) => void;
|
|
346
359
|
onDragEvent?: EventDragHandler<T>;
|
|
@@ -375,6 +388,8 @@ function AnimatedEventBox<T>({
|
|
|
375
388
|
daysPerPage,
|
|
376
389
|
renderEvent,
|
|
377
390
|
snapMinutes,
|
|
391
|
+
minEventHeight,
|
|
392
|
+
eventGap,
|
|
378
393
|
onPress,
|
|
379
394
|
onLongPress,
|
|
380
395
|
onDragEvent,
|
|
@@ -475,9 +490,9 @@ function AnimatedEventBox<T>({
|
|
|
475
490
|
() =>
|
|
476
491
|
Math.max(
|
|
477
492
|
durationHours * cellHeight.value + resizeDelta.value - resizeStartDelta.value,
|
|
478
|
-
|
|
493
|
+
minEventHeight,
|
|
479
494
|
),
|
|
480
|
-
[durationHours],
|
|
495
|
+
[durationHours, minEventHeight],
|
|
481
496
|
);
|
|
482
497
|
|
|
483
498
|
// The source segment may stop at midnight while the full event continues in
|
|
@@ -488,8 +503,8 @@ function AnimatedEventBox<T>({
|
|
|
488
503
|
const top =
|
|
489
504
|
(startHours - minHour) * cellHeight.value + moveOffset.value + resizeStartDelta.value;
|
|
490
505
|
const dayEnd = (HOURS_PER_DAY - minHour) * cellHeight.value;
|
|
491
|
-
return Math.max(Math.min(boxHeight.value, dayEnd - top),
|
|
492
|
-
}, [startHours, minHour]);
|
|
506
|
+
return Math.max(Math.min(boxHeight.value, dayEnd - top), minEventHeight);
|
|
507
|
+
}, [startHours, minHour, minEventHeight]);
|
|
493
508
|
|
|
494
509
|
const boxStyle = useAnimatedStyle(() => {
|
|
495
510
|
// A top-edge resize pushes the box down and shortens it (start moves later).
|
|
@@ -985,7 +1000,7 @@ function AnimatedEventBox<T>({
|
|
|
985
1000
|
: undefined;
|
|
986
1001
|
|
|
987
1002
|
const eventSlot = slot("event", {
|
|
988
|
-
base: [styles.eventBox, { left, width }],
|
|
1003
|
+
base: [styles.eventBox, { left, width, padding: eventGap }],
|
|
989
1004
|
themed: theme.containers.timeGridEvent,
|
|
990
1005
|
});
|
|
991
1006
|
const box = (
|
|
@@ -1047,6 +1062,7 @@ function AnimatedEventBox<T>({
|
|
|
1047
1062
|
event={positioned.event}
|
|
1048
1063
|
mode={mode}
|
|
1049
1064
|
renderEvent={renderEvent}
|
|
1065
|
+
eventGap={eventGap}
|
|
1050
1066
|
slotProps={slot("event", { themed: theme.containers.timeGridEvent })}
|
|
1051
1067
|
/>
|
|
1052
1068
|
) : null}
|
|
@@ -1264,6 +1280,8 @@ type TimetablePageProps<T> = {
|
|
|
1264
1280
|
renderEvent: RenderEvent<T>;
|
|
1265
1281
|
keyExtractor: EventKeyExtractor<T>;
|
|
1266
1282
|
snapMinutes: number;
|
|
1283
|
+
minEventHeight: number;
|
|
1284
|
+
eventGap: number;
|
|
1267
1285
|
showDragHandle: boolean;
|
|
1268
1286
|
eventStartEditable: boolean;
|
|
1269
1287
|
eventDurationEditable: boolean;
|
|
@@ -1321,6 +1339,8 @@ function TimetablePageInner<T>({
|
|
|
1321
1339
|
renderEvent,
|
|
1322
1340
|
keyExtractor,
|
|
1323
1341
|
snapMinutes,
|
|
1342
|
+
minEventHeight,
|
|
1343
|
+
eventGap,
|
|
1324
1344
|
showDragHandle,
|
|
1325
1345
|
eventStartEditable,
|
|
1326
1346
|
eventDurationEditable,
|
|
@@ -1679,7 +1699,7 @@ function TimetablePageInner<T>({
|
|
|
1679
1699
|
}));
|
|
1680
1700
|
|
|
1681
1701
|
const ghostSlot = slot("createGhost", {
|
|
1682
|
-
base: [styles.createGhost, { pointerEvents: "none" }],
|
|
1702
|
+
base: [styles.createGhost, { marginHorizontal: eventGap, pointerEvents: "none" }],
|
|
1683
1703
|
themed: {
|
|
1684
1704
|
backgroundColor: theme.colors.eventBackground,
|
|
1685
1705
|
borderColor: theme.colors.todayBackground,
|
|
@@ -1900,6 +1920,8 @@ function TimetablePageInner<T>({
|
|
|
1900
1920
|
daysPerPage={daysPerPage}
|
|
1901
1921
|
renderEvent={renderEvent}
|
|
1902
1922
|
snapMinutes={snapMinutes}
|
|
1923
|
+
minEventHeight={minEventHeight}
|
|
1924
|
+
eventGap={eventGap}
|
|
1903
1925
|
showDragHandle={showDragHandle}
|
|
1904
1926
|
eventStartEditable={eventStartEditable}
|
|
1905
1927
|
eventDurationEditable={eventDurationEditable}
|
|
@@ -1923,6 +1945,8 @@ function TimetablePageInner<T>({
|
|
|
1923
1945
|
minHour={minHour}
|
|
1924
1946
|
mode={mode}
|
|
1925
1947
|
renderEvent={renderEvent}
|
|
1948
|
+
minEventHeight={minEventHeight}
|
|
1949
|
+
eventGap={eventGap}
|
|
1926
1950
|
/>
|
|
1927
1951
|
) : null}
|
|
1928
1952
|
|
|
@@ -2048,6 +2072,18 @@ export type TimeGridProps<T> = SlotStyleProps<TimeGridSlot> & {
|
|
|
2048
2072
|
isRTL?: boolean;
|
|
2049
2073
|
minHourHeight?: number;
|
|
2050
2074
|
maxHourHeight?: number;
|
|
2075
|
+
/**
|
|
2076
|
+
* Minimum pixel height of a timed event box, so short events stay legible and
|
|
2077
|
+
* tappable. Also the floor of the `boxHeight` handed to `renderEvent`. Default
|
|
2078
|
+
* 32; pass 0 to size every box strictly by its duration.
|
|
2079
|
+
*/
|
|
2080
|
+
minEventHeight?: number;
|
|
2081
|
+
/**
|
|
2082
|
+
* Inset in pixels between a timed event box and its slot (each side), so
|
|
2083
|
+
* adjacent boxes and column edges get some breathing room. Default 2; pass 0
|
|
2084
|
+
* to let events fill their slot.
|
|
2085
|
+
*/
|
|
2086
|
+
eventGap?: number;
|
|
2051
2087
|
showNowIndicator?: boolean;
|
|
2052
2088
|
locale?: Locale;
|
|
2053
2089
|
freeSwipe?: boolean;
|
|
@@ -2128,6 +2164,8 @@ function TimeGridInner<T>({
|
|
|
2128
2164
|
isRTL = false,
|
|
2129
2165
|
minHourHeight = DEFAULT_MIN_HOUR_HEIGHT,
|
|
2130
2166
|
maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT,
|
|
2167
|
+
minEventHeight = DEFAULT_MIN_EVENT_HEIGHT,
|
|
2168
|
+
eventGap = DEFAULT_EVENT_GAP,
|
|
2131
2169
|
showNowIndicator = true,
|
|
2132
2170
|
locale,
|
|
2133
2171
|
freeSwipe = false,
|
|
@@ -2618,6 +2656,8 @@ function TimeGridInner<T>({
|
|
|
2618
2656
|
renderEvent={labeledRenderEvent}
|
|
2619
2657
|
keyExtractor={keyExtractor}
|
|
2620
2658
|
snapMinutes={Math.max(1, dragStepMinutes)}
|
|
2659
|
+
minEventHeight={minEventHeight}
|
|
2660
|
+
eventGap={eventGap}
|
|
2621
2661
|
showDragHandle={showDragHandle}
|
|
2622
2662
|
eventStartEditable={eventStartEditable}
|
|
2623
2663
|
eventDurationEditable={eventDurationEditable}
|
|
@@ -2668,6 +2708,8 @@ function TimeGridInner<T>({
|
|
|
2668
2708
|
labeledRenderEvent,
|
|
2669
2709
|
keyExtractor,
|
|
2670
2710
|
dragStepMinutes,
|
|
2711
|
+
minEventHeight,
|
|
2712
|
+
eventGap,
|
|
2671
2713
|
showDragHandle,
|
|
2672
2714
|
eventStartEditable,
|
|
2673
2715
|
eventDurationEditable,
|
|
@@ -2778,6 +2820,7 @@ function TimeGridInner<T>({
|
|
|
2778
2820
|
event={liftedEvent}
|
|
2779
2821
|
mode={mode}
|
|
2780
2822
|
renderEvent={labeledRenderEvent}
|
|
2823
|
+
eventGap={eventGap}
|
|
2781
2824
|
/>
|
|
2782
2825
|
) : null}
|
|
2783
2826
|
</View>
|
|
@@ -3019,7 +3062,6 @@ const styles = StyleSheet.create({
|
|
|
3019
3062
|
position: "absolute",
|
|
3020
3063
|
borderRadius: 6,
|
|
3021
3064
|
borderWidth: StyleSheet.hairlineWidth,
|
|
3022
|
-
marginHorizontal: EVENT_GAP,
|
|
3023
3065
|
},
|
|
3024
3066
|
weekendColumn: {
|
|
3025
3067
|
position: "absolute",
|
|
@@ -3079,12 +3121,11 @@ const styles = StyleSheet.create({
|
|
|
3079
3121
|
borderRadius: 2,
|
|
3080
3122
|
opacity: 0.4,
|
|
3081
3123
|
},
|
|
3124
|
+
// The `eventGap` inset is applied inline as border-box padding, so the visible
|
|
3125
|
+
// box (the flex child) sits inside the slot without touching its geometry.
|
|
3082
3126
|
eventBox: {
|
|
3083
3127
|
position: "absolute",
|
|
3084
3128
|
overflow: "hidden",
|
|
3085
|
-
// Border-box padding insets the visible box (the flex child) on all sides,
|
|
3086
|
-
// giving a small gap without touching the slot geometry above.
|
|
3087
|
-
padding: EVENT_GAP,
|
|
3088
3129
|
},
|
|
3089
3130
|
// The cross-week drag ghost: pinned to the pager's top-left, moved into place by
|
|
3090
3131
|
// its transform, and floated above every page so it stays visible across a page.
|