UNPKG

@gdjiami/jm-mrc-components

Version:

移动端可复用组件库

58 lines (57 loc) 1.65 kB
/** * 日历组件 */ import React from 'react'; import SingleMonth from './SingleMonth'; import { CalendarEventList } from './type'; export * from './utils'; export * from './type'; export { SingleMonth }; export interface CalendarProps { date?: Date; onChange?: (date: Date) => void; onMonthChange?: (date: Date) => void; onGetEventsForMonth?: (date: Date) => Promise<void>; events?: { [yearmonth: string]: { [date: string]: any[] | undefined; }; }; legalHolidayEvents?: { [yearmonth: string]: CalendarEventList; }; animateHeight?: boolean; extraData?: any; weekTitleStyle?: React.CSSProperties; monthStyle?: React.CSSProperties; } interface State { base: Date; index: number; suppressError: boolean; } export default class Calendar extends React.Component<CalendarProps, State> { /** * 基准日期。日历swiper根据这个基准日期为index,向前向后计算日期 * 默认为惊天 */ state: State; private monthCached; constructor(props: CalendarProps); componentDidMount(): void; componentDidUpdate(preProps: CalendarProps): void; render(): JSX.Element; navigate2Today: () => void; /** * 如果日期变动超过两个月。即不是正常的滑动行为,这时候应该重设base * @param prev * @param current */ private rebaseIfNeed; private resetIndex; private renderMonth; private handleSuppressError; private handleIndexChange; private changeIndex; private getMonth; }