mirror of
https://github.com/urosran/cally.git
synced 2025-07-10 07:07:16 +00:00
149 lines
5.2 KiB
Diff
149 lines
5.2 KiB
Diff
diff --git a/node_modules/@howljs/calendar-kit/src/hooks/useSyncedList.tsx b/node_modules/@howljs/calendar-kit/src/hooks/useSyncedList.tsx
|
|
index 2c2d340..c27d395 100644
|
|
--- a/node_modules/@howljs/calendar-kit/src/hooks/useSyncedList.tsx
|
|
+++ b/node_modules/@howljs/calendar-kit/src/hooks/useSyncedList.tsx
|
|
@@ -40,12 +40,12 @@ const useSyncedList = ({ id }: { id: ScrollType }) => {
|
|
|
|
const _onMomentumEnd = () => {
|
|
if (
|
|
- isTriggerMomentum.current &&
|
|
- startDateUnix.current !== visibleDateUnix.current
|
|
+ isTriggerMomentum.current &&
|
|
+ startDateUnix.current !== visibleDateUnix.current
|
|
) {
|
|
triggerDateChanged.current = undefined;
|
|
onDateChanged?.(
|
|
- dateTimeToISOString(parseDateTime(visibleDateUnix.current))
|
|
+ dateTimeToISOString(parseDateTime(visibleDateUnix.current))
|
|
);
|
|
notifyDateChanged(visibleDateUnix.current);
|
|
isTriggerMomentum.current = false;
|
|
@@ -83,71 +83,70 @@ const useSyncedList = ({ id }: { id: ScrollType }) => {
|
|
});
|
|
|
|
const onVisibleColumnChanged = useCallback(
|
|
- (props: {
|
|
- index: number;
|
|
- column: number;
|
|
- columns: number;
|
|
- offset: number;
|
|
- extraScrollData: Record<string, any>;
|
|
- }) => {
|
|
- const { index: pageIndex, column, columns, extraScrollData } = props;
|
|
- const { visibleColumns, visibleDates } = extraScrollData;
|
|
+ (props: {
|
|
+ index: number;
|
|
+ column: number;
|
|
+ columns: number;
|
|
+ offset: number;
|
|
+ extraScrollData: Record<string, any>;
|
|
+ }) => {
|
|
+ const { index: pageIndex, column, columns, extraScrollData } = props;
|
|
+ const { visibleColumns, visibleDates } = extraScrollData;
|
|
|
|
- if (scrollType.current === id && visibleColumns && visibleDates) {
|
|
- const dayIndex = pageIndex * columns + column;
|
|
- const visibleStart = visibleDates[pageIndex * columns];
|
|
- const visibleEnd =
|
|
- visibleDates[pageIndex * columns + column + visibleColumns];
|
|
+ if (scrollType.current === id && visibleColumns && visibleDates) {
|
|
+ const dayIndex = pageIndex * columns + column;
|
|
+ const visibleStart = visibleDates[pageIndex * columns];
|
|
+ const visibleEnd =
|
|
+ visibleDates[pageIndex * columns + column + visibleColumns];
|
|
|
|
- if (visibleStart && visibleEnd) {
|
|
- const diffDays = Math.floor(
|
|
- (visibleEnd - visibleStart) / MILLISECONDS_IN_DAY
|
|
- );
|
|
- if (diffDays <= 7) {
|
|
- visibleWeeks.value = [visibleStart];
|
|
- } else {
|
|
- const nextWeekStart = visibleDates[pageIndex * columns + 7];
|
|
- if (nextWeekStart) {
|
|
- visibleWeeks.value = [visibleStart, nextWeekStart];
|
|
+ if (visibleStart && visibleEnd) {
|
|
+ const diffDays = Math.floor(
|
|
+ (visibleEnd - visibleStart) / MILLISECONDS_IN_DAY
|
|
+ );
|
|
+ if (diffDays <= 7) {
|
|
+ visibleWeeks.value = [visibleStart];
|
|
+ } else {
|
|
+ const nextWeekStart = visibleDates[pageIndex * columns + 7];
|
|
+ if (nextWeekStart) {
|
|
+ visibleWeeks.value = [visibleStart, nextWeekStart];
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
-
|
|
- const currentDate = visibleDates[dayIndex];
|
|
- if (!currentDate) {
|
|
- triggerDateChanged.current = undefined;
|
|
- return;
|
|
- }
|
|
|
|
- if (visibleDateUnix.current !== currentDate) {
|
|
- const dateIsoStr = dateTimeToISOString(parseDateTime(currentDate));
|
|
- onChange?.(dateIsoStr);
|
|
- if (
|
|
- triggerDateChanged.current &&
|
|
- triggerDateChanged.current === currentDate
|
|
- ) {
|
|
+ const currentDate = visibleDates[dayIndex];
|
|
+ if (!currentDate) {
|
|
triggerDateChanged.current = undefined;
|
|
- onDateChanged?.(dateIsoStr);
|
|
- notifyDateChanged(currentDate);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (visibleDateUnix.current !== currentDate) {
|
|
+ const dateIsoStr = dateTimeToISOString(parseDateTime(currentDate));
|
|
+ onChange?.(dateIsoStr);
|
|
+ if (
|
|
+ triggerDateChanged?.current === currentDate
|
|
+ ) {
|
|
+ triggerDateChanged.current = undefined;
|
|
+ onDateChanged?.(dateIsoStr);
|
|
+ notifyDateChanged(currentDate);
|
|
+ }
|
|
+ visibleDateUnix.current = currentDate;
|
|
+ runOnUI(() => {
|
|
+ visibleDateUnixAnim.value = currentDate;
|
|
+ })();
|
|
}
|
|
- visibleDateUnix.current = currentDate;
|
|
- runOnUI(() => {
|
|
- visibleDateUnixAnim.value = currentDate;
|
|
- })();
|
|
}
|
|
- }
|
|
- },
|
|
- [
|
|
- scrollType,
|
|
- id,
|
|
- visibleDateUnix,
|
|
- visibleWeeks,
|
|
- triggerDateChanged,
|
|
- onChange,
|
|
- onDateChanged,
|
|
- notifyDateChanged,
|
|
- visibleDateUnixAnim,
|
|
- ]
|
|
+ },
|
|
+ [
|
|
+ scrollType,
|
|
+ id,
|
|
+ visibleDateUnix,
|
|
+ visibleWeeks,
|
|
+ triggerDateChanged,
|
|
+ onChange,
|
|
+ onDateChanged,
|
|
+ notifyDateChanged,
|
|
+ visibleDateUnixAnim,
|
|
+ ]
|
|
);
|
|
|
|
return { onScroll, onVisibleColumnChanged };
|