@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.
60 lines (59 loc) • 3.11 kB
TypeScript
import React, { ReactInstance } from 'react';
import PropTypes from 'prop-types';
import CalendarFoundation, { CalendarAdapter, EventObject, MonthData, MonthlyEvent, ParsedRangeEvent } from '@douyinfe/semi-foundation/lib/cjs/calendar/foundation';
import { DateObj } from '@douyinfe/semi-foundation/lib/cjs/calendar/eventUtil';
import BaseComponent from '../_base/baseComponent';
import { Locale } from '../locale/interface';
import { MonthCalendarProps } from './interface';
import '@douyinfe/semi-foundation/lib/cjs/calendar/calendar.css';
export interface MonthCalendarState {
itemLimit: number;
showCard: Record<string, [boolean] | [boolean, string]>;
parsedEvents: MonthlyEvent;
cachedKeys: Array<string>;
}
export default class monthCalendar extends BaseComponent<MonthCalendarProps, MonthCalendarState> {
static propTypes: {
displayValue: PropTypes.Requireable<Date>;
header: PropTypes.Requireable<PropTypes.ReactNodeLike>;
events: PropTypes.Requireable<any[]>;
mode: PropTypes.Requireable<string>;
markWeekend: PropTypes.Requireable<boolean>;
width: PropTypes.Requireable<NonNullable<string | number>>;
height: PropTypes.Requireable<NonNullable<string | number>>;
style: PropTypes.Requireable<object>;
className: PropTypes.Requireable<string>;
dateGridRender: PropTypes.Requireable<(...args: any[]) => any>;
onClick: PropTypes.Requireable<(...args: any[]) => any>;
onClose: PropTypes.Requireable<(...args: any[]) => any>;
};
static defaultProps: {
displayValue: Date;
events: EventObject[];
mode: string;
};
static contextType: React.Context<Locale>;
cellDom: React.RefObject<HTMLDivElement>;
foundation: CalendarFoundation;
cardRef: Map<string, ReactInstance>;
contentCellHeight: number;
monthlyData: MonthData;
clickOutsideHandler: (e: MouseEvent) => void;
constructor(props: MonthCalendarProps);
get adapter(): CalendarAdapter<MonthCalendarProps, MonthCalendarState>;
calcItemLimit: () => number;
componentDidMount(): void;
componentWillUnmount(): void;
componentDidUpdate(prevProps: MonthCalendarProps, prevState: MonthCalendarState): void;
handleClick: (e: React.MouseEvent, val: [Date]) => void;
closeCard(e: React.MouseEvent, key: string): void;
showCard: (e: React.MouseEvent, key: string) => void;
renderHeader: (dateFnsLocale: Locale['dateFnsLocale']) => React.JSX.Element;
renderEvents: (events: ParsedRangeEvent[]) => React.JSX.Element[];
renderCollapsed: (events: MonthlyEvent['day'][number], itemInfo: DateObj, listCls: string, month: string) => React.JSX.Element;
formatDayString: (dateObj: Date, month: string, date: string) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element;
renderCusDateGrid: (date: Date) => React.ReactNode;
renderWeekRow: (index: number | string, weekDay: MonthData[number], events?: MonthlyEvent) => React.JSX.Element;
renderMonthGrid: () => React.JSX.Element;
render(): React.JSX.Element;
}