@douyinfe/semi-ui
Version:
A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.
42 lines (41 loc) • 1.86 kB
TypeScript
/// <reference types="react" />
import { strings } from '@douyinfe/semi-foundation/lib/es/calendar/constants';
import type { ArrayElement } from '../_base/base';
import type { BaseProps } from '../_base/baseComponent';
import type { EventObject, weekStartsOnEnum } from '@douyinfe/semi-foundation/lib/es/calendar/foundation';
export interface CalendarProps extends BaseProps {
displayValue?: Date;
range?: Date[];
header?: React.ReactNode;
events?: EventObject[];
mode?: ArrayElement<typeof strings.MODE>;
showCurrTime?: boolean;
weekStartsOn?: weekStartsOnEnum;
scrollTop?: number;
onClick?: (e: React.MouseEvent, value: Date) => void;
onClose?: (e: React.MouseEvent) => void;
renderTimeDisplay?: (time: number) => React.ReactNode;
markWeekend?: boolean;
minEventHeight?: number;
width?: number | string;
height?: number | string;
renderDateDisplay?: (date: Date) => React.ReactNode;
dateGridRender?: (dateString?: string, date?: Date) => React.ReactNode;
allDayEventsRender?: (events: EventObject[]) => React.ReactNode;
}
export type DayCalendarProps = Omit<CalendarProps, 'mode'>;
type DayCalendarPropsKeys = 'events' | 'displayValue' | 'showCurrTime' | 'mode' | 'dateGridRender' | 'minEventHeight';
export interface DayColProps extends Pick<CalendarProps, DayCalendarPropsKeys>, BaseProps {
scrollHeight: number;
currPos: number;
isWeekend: boolean;
handleClick: (e: React.MouseEvent, val: [Date, number, number, number]) => void;
}
export type MonthCalendarProps = Omit<CalendarProps, 'range' | 'showCurrTime' | 'scrollTop' | 'renderTimeDisplay'>;
export type RangeCalendarProps = CalendarProps;
export interface TimeColProps {
className?: string;
renderTimeDisplay?: CalendarProps['renderTimeDisplay'];
}
export type WeekCalendarProps = CalendarProps;
export {};