@orca-fe/pocket
Version:
UI components by orca-team
42 lines (41 loc) • 1.71 kB
TypeScript
import type { Moment, MomentInput } from 'moment';
import React from 'react';
import type { CustomDateRenderType } from './Context';
export type VirtualCalendarRefType = {
scrollTo(date: MomentInput): void;
};
export interface VirtualCalendarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
/** 日历能展示的最早的日期 */
startDate?: Moment;
/** 日历能展示的最晚的日期 */
endDate?: Moment;
/** 行高,当选择 'auto' 时,将会自动根据容器高度划分为 6 行 */
rowHeight?: number | 'auto';
/** 默认展示的月份,默认为本月 */
defaultCurrentMonth?: MomentInput;
/** 今天的日期 */
today?: MomentInput | boolean;
/** 选中的日期 */
checked?: MomentInput;
/** 日期是否可被選中 */
checkable?: boolean;
/** 日期点击事件 */
onDateClick?: (date: Moment) => void;
/** 月份变化事件 */
onCurrentMonthChange?: (month: string) => void;
/** 因为虚拟日历组件是无线滚动的,为了避免频繁触发月份变化事件,这里增加触发防抖 */
monthChangeDebounce?: number;
/** 顶部日期展示的格式 */
monthFormat?: string;
/** 周格式 */
weekHeaderFormat?: string;
/** 自定义日期渲染 */
children?: CustomDateRenderType;
/** 上翻页箭头 */
arrowUp?: React.ReactNode;
/** 下翻页箭头 */
arrowDown?: React.ReactNode;
}
declare const VirtualCalendar: React.ForwardRefExoticComponent<VirtualCalendarProps & React.RefAttributes<VirtualCalendarRefType>>;
export declare const useCalendarRef: () => React.RefObject<VirtualCalendarRefType>;
export default VirtualCalendar;