@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.
54 lines (53 loc) • 2.72 kB
TypeScript
import React from 'react';
import PropTypes from 'prop-types';
import CalendarFoundation, { ParsedEvents, CalendarAdapter, RangeData, ParsedRangeEvent } from '@douyinfe/semi-foundation/lib/cjs/calendar/foundation';
import BaseComponent from '../_base/baseComponent';
import '@douyinfe/semi-foundation/lib/cjs/calendar/calendar.css';
import { RangeCalendarProps } from './interface';
import { Locale } from '../locale/interface';
export interface RangeCalendarState {
scrollHeight: number;
parsedEvents: ParsedEvents;
cachedKeys: Array<string>;
}
export default class RangeCalendar extends BaseComponent<RangeCalendarProps, RangeCalendarState> {
static propTypes: {
range: PropTypes.Requireable<any[]>;
header: PropTypes.Requireable<PropTypes.ReactNodeLike>;
events: PropTypes.Requireable<any[]>;
mode: PropTypes.Requireable<string>;
showCurrTime: PropTypes.Requireable<boolean>;
markWeekend: PropTypes.Requireable<boolean>;
scrollTop: PropTypes.Requireable<number>;
renderTimeDisplay: PropTypes.Requireable<(...args: any[]) => any>;
renderDateDisplay: PropTypes.Requireable<(...args: any[]) => any>;
dateGridRender: PropTypes.Requireable<(...args: any[]) => any>;
allDayEventsRender: PropTypes.Requireable<(...args: any[]) => any>;
width: PropTypes.Requireable<NonNullable<string | number>>;
height: PropTypes.Requireable<NonNullable<string | number>>;
style: PropTypes.Requireable<object>;
className: PropTypes.Requireable<string>;
};
static defaultProps: {
events: ParsedEvents[];
mode: string;
};
static contextType: React.Context<Locale>;
dom: React.RefObject<HTMLDivElement>;
scrollDom: React.RefObject<HTMLDivElement>;
isWeekend: boolean;
allDayRowHeight: number;
RangeData: RangeData;
foundation: CalendarFoundation;
constructor(props: RangeCalendarProps);
get adapter(): CalendarAdapter<RangeCalendarProps, RangeCalendarState>;
componentDidMount(): void;
componentDidUpdate(prevProps: RangeCalendarProps, prevState: RangeCalendarState): void;
componentWillUnmount(): void;
handleClick: (e: React.MouseEvent, val: [Date, number, number, number]) => void;
renderDayGrid: () => React.JSX.Element[];
renderHeader: (dateFnsLocale: Locale['dateFnsLocale']) => React.JSX.Element;
renderAllDayEvents: (events: Array<ParsedRangeEvent>) => string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.JSX.Element[];
renderAllDay: (locale: Locale['Calendar']) => React.JSX.Element;
render(): React.JSX.Element;
}