UNPKG

@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.

205 lines (204 loc) 7.48 kB
import React from 'react'; import PropTypes from 'prop-types'; import MonthFoundation, { MonthAdapter, MonthDayInfo, MonthFoundationProps, MonthFoundationState } from '@douyinfe/semi-foundation/lib/cjs/datePicker/monthFoundation'; import BaseComponent, { BaseProps } from '../_base/baseComponent'; import { Locale } from '../locale/interface'; export interface MonthProps extends MonthFoundationProps, BaseProps { forwardRef: React.Ref<any>; locale: Locale['DatePicker']; focusRecordsRef: React.RefObject<{ rangeStart: boolean; rangeEnd: boolean; }>; } export type MonthState = MonthFoundationState; export default class Month extends BaseComponent<MonthProps, MonthState> { static propTypes: { month: PropTypes.Requireable<object>; selected: PropTypes.Requireable<object>; rangeStart: PropTypes.Requireable<string>; rangeEnd: PropTypes.Requireable<string>; offsetRangeStart: PropTypes.Requireable<string>; offsetRangeEnd: PropTypes.Requireable<string>; onDayClick: PropTypes.Requireable<(...args: any[]) => any>; onDayHover: PropTypes.Requireable<(...args: any[]) => any>; weekStartsOn: PropTypes.Requireable<number>; disabledDate: PropTypes.Requireable<(...args: any[]) => any>; weeksRowNum: PropTypes.Requireable<number>; onWeeksRowNumChange: PropTypes.Requireable<(...args: any[]) => any>; renderDate: PropTypes.Requireable<(...args: any[]) => any>; renderFullDate: PropTypes.Requireable<(...args: any[]) => any>; hoverDay: PropTypes.Requireable<string>; startDateOffset: PropTypes.Requireable<(...args: any[]) => any>; endDateOffset: PropTypes.Requireable<(...args: any[]) => any>; rangeInputFocus: PropTypes.Requireable<NonNullable<string | boolean>>; focusRecordsRef: PropTypes.Requireable<object>; multiple: PropTypes.Requireable<boolean>; }; static defaultProps: { month: Date; selected: Set<unknown>; rangeStart: string; rangeEnd: string; onDayClick: (...args: any[]) => void; onDayHover: (...args: any[]) => void; onWeeksRowNumChange: (...args: any[]) => void; weekStartsOn: 0; disabledDate: { (): false; (): false; }; weeksRowNum: number; }; monthRef: React.RefObject<HTMLDivElement>; foundation: MonthFoundation; constructor(props: MonthProps); get adapter(): MonthAdapter; componentDidMount(): void; componentWillUnmount(): void; componentDidUpdate(prevProps: MonthProps, prevState: MonthState): void; getSingleDayStatus(options: Partial<MonthProps> & { fullDate: string; todayText: string; }): { isToday: boolean; isSelected: boolean; isDisabled: boolean; }; getDateRangeStatus(options: Partial<MonthProps> & { fullDate: string; }): { isHoverDay?: undefined; isSelectedStart?: undefined; isSelectedEnd?: undefined; isInRange?: undefined; isHover?: undefined; isSelectedStartAfterHover?: undefined; isSelectedEndBeforeHover?: undefined; isHoverDayInRange?: undefined; isHoverDayInStartSelection?: undefined; isHoverDayInEndSelection?: undefined; isHoverDayAroundOneSelected?: undefined; } | { isHoverDay: boolean; isSelectedStart: any; isSelectedEnd: any; isInRange: any; isHover: any; isSelectedStartAfterHover: any; isSelectedEndBeforeHover: any; isHoverDayInRange: any; isHoverDayInStartSelection: any; isHoverDayInEndSelection: any; isHoverDayAroundOneSelected: any; }; getOffsetDateStatus(options: Partial<MonthProps> & { fullDate: string; }): { isOffsetRangeStart?: undefined; isOffsetRangeEnd?: undefined; isHoverInOffsetRange?: undefined; isHoverDayOffset?: undefined; isInOffsetRange?: undefined; } | { isOffsetRangeStart: boolean; isOffsetRangeEnd: boolean; isHoverInOffsetRange: any; isHoverDayOffset: boolean; isInOffsetRange: any; }; /** * get day current status * @param {Object} fullDate * @param {Object} options * @returns {Object} */ getDayStatus(currentDay: MonthDayInfo, options: MonthProps & { todayText: string; }): { isOffsetRangeStart?: undefined; isOffsetRangeEnd?: undefined; isHoverInOffsetRange?: undefined; isHoverDayOffset?: undefined; isInOffsetRange?: undefined; isHoverDay?: undefined; isSelectedStart?: undefined; isSelectedEnd?: undefined; isInRange?: undefined; isHover?: undefined; isSelectedStartAfterHover?: undefined; isSelectedEndBeforeHover?: undefined; isHoverDayInRange?: undefined; isHoverDayInStartSelection?: undefined; isHoverDayInEndSelection?: undefined; isHoverDayAroundOneSelected?: undefined; isToday: boolean; isSelected: boolean; isDisabled: boolean; } | { isOffsetRangeStart: boolean; isOffsetRangeEnd: boolean; isHoverInOffsetRange: any; isHoverDayOffset: boolean; isInOffsetRange: any; isHoverDay?: undefined; isSelectedStart?: undefined; isSelectedEnd?: undefined; isInRange?: undefined; isHover?: undefined; isSelectedStartAfterHover?: undefined; isSelectedEndBeforeHover?: undefined; isHoverDayInRange?: undefined; isHoverDayInStartSelection?: undefined; isHoverDayInEndSelection?: undefined; isHoverDayAroundOneSelected?: undefined; isToday: boolean; isSelected: boolean; isDisabled: boolean; } | { isOffsetRangeStart?: undefined; isOffsetRangeEnd?: undefined; isHoverInOffsetRange?: undefined; isHoverDayOffset?: undefined; isInOffsetRange?: undefined; isHoverDay: boolean; isSelectedStart: any; isSelectedEnd: any; isInRange: any; isHover: any; isSelectedStartAfterHover: any; isSelectedEndBeforeHover: any; isHoverDayInRange: any; isHoverDayInStartSelection: any; isHoverDayInEndSelection: any; isHoverDayAroundOneSelected: any; isToday: boolean; isSelected: boolean; isDisabled: boolean; } | { isOffsetRangeStart: boolean; isOffsetRangeEnd: boolean; isHoverInOffsetRange: any; isHoverDayOffset: boolean; isInOffsetRange: any; isHoverDay: boolean; isSelectedStart: any; isSelectedEnd: any; isInRange: any; isHover: any; isSelectedStartAfterHover: any; isSelectedEndBeforeHover: any; isHoverDayInRange: any; isHoverDayInStartSelection: any; isHoverDayInEndSelection: any; isHoverDayAroundOneSelected: any; isToday: boolean; isSelected: boolean; isDisabled: boolean; }; renderDayOfWeek(): React.JSX.Element; renderWeeks(): React.JSX.Element; renderWeek(week: MonthDayInfo[], weekIndex: number): React.JSX.Element; renderDay(day: MonthDayInfo, dayIndex: number): React.JSX.Element; render(): React.JSX.Element; }