import React, { useState } from "react"; import moment, { Moment } from "moment"; import CalendarPart from "./CalendarPart"; import { StyledProps } from "../_type"; import { ControlledProps, useDefaultValue } from "../form/controlled"; import { CalendarTable } from "./CalendarTable"; import { RangeDateType, CalendarTableType } from "./DateProps"; import { useTranslation } from "../i18n"; import { mergeEventProps } from "../_util/merge-event-props"; export interface CalendarProps extends ControlledProps, StyledProps { /** * 允许选择的日期范围,可同时使用 `disabledDate` 实现更精细控制 */ range?: RangeDateType; /** * 可选的日期范围 */ disabledDate?: (date: Moment) => boolean; } export const Calendar = React.forwardRef(function Calendar( props: CalendarProps, ref: React.Ref ) { useTranslation(moment); const { className, style, ...restProps } = useDefaultValue(props); const [type, setType] = useState("date"); const { value } = props; const [curViewMoment, setCurViewMoment] = useState( moment.isMoment(value) ? value : moment() ); return ( ); }); Calendar.displayName = "Calendar";