mobile-react-infinite-calendar
Version:
A mobile-optimized infinite scroll calendar component for React
70 lines (69 loc) • 2.46 kB
TypeScript
/**
* 캘린더 상태 관리 훅
* 모든 비즈니스 로직과 상태 관리를 담당
*/
import type { CalendarEvent, Holiday, LocaleCode, CalendarOptions } from '../types';
interface UseCalendarStateProps {
events?: CalendarEvent[];
holidays?: Holiday[];
dynamicEvents?: (startDate: string | Date, endDate: string | Date) => Promise<any[]>;
dynamicEventMapping?: {
id?: string;
title?: string;
date?: string;
startTime?: string;
endTime?: string;
color?: string;
description?: string;
};
dynamicEventTransform?: (apiData: any) => CalendarEvent;
onDynamicEventLoad?: (startDate: Date, endDate: Date, events: CalendarEvent[]) => void;
locale?: LocaleCode | string;
holidayServiceKey?: string;
options?: CalendarOptions;
}
export declare function useCalendarState({ events, holidays, dynamicEvents, dynamicEventMapping, dynamicEventTransform, onDynamicEventLoad, locale, holidayServiceKey, options }: UseCalendarStateProps): {
isDynamicLoading: boolean;
loadingMonths: string[];
cacheInfo: {
cacheSize: number;
cachedMonths: string[];
};
handleTodayClick: () => void;
isDebugEnabled: boolean;
displayMonth: Date;
activeMonth: Date;
infiniteMonths: Date[];
monthsData: {
month: Date;
weeks: (Date | null)[][];
eventsByDate: Record<string, CalendarEvent<any>[]>;
holidaysByDate: Record<string, Holiday[]>;
}[];
availableHeight: number | null;
isCurrentMonthVisible: boolean;
isInitialScrollSet: boolean;
showDateSelector: boolean;
selectedYear: number;
selectedMonth: number;
showYearDropdown: boolean;
showMonthDropdown: boolean;
setActiveMonth: (date: Date) => void;
setDisplayMonth: (date: Date) => void;
setInfiniteMonths: (months: Date[]) => void;
setAvailableHeight: (height: number | null) => void;
setIsCurrentMonthVisible: (visible: boolean) => void;
setIsInitialScrollSet: (value: boolean) => void;
openDateSelector: () => void;
closeDateSelector: () => void;
setShowYearDropdown: () => void;
setShowMonthDropdown: () => void;
setSelectedYear: (year: number) => void;
setSelectedMonth: (month: number) => void;
confirmDateSelection: () => void;
addPrevMonth: () => void;
addNextMonth: () => void;
holidayLoading: boolean;
autoHolidays: Holiday[];
};
export {};