/** * @file DatePicker * @description 时间选择器组件 */ import React from 'react'; import moment from 'dayjs'; import { type ClassValue } from '../../utils/cx'; export interface PlainObject { [propsName: string]: any; } export declare type ShortCutDate = { label: string; date: moment.Dayjs; }; export declare type ShortCutDateRange = { label: string; startDate?: moment.Dayjs; endDate?: moment.Dayjs; }; export declare type ShortCuts = { label: string; value: string; } | ShortCutDate | ShortCutDateRange; export interface DateProps { quickEdit?: boolean; viewMode: 'years' | 'months' | 'days' | 'time' | 'quarter'; className?: ClassValue; popoverClassName?: string; placeholder?: string; inputFormat?: string; timeFormat?: string; format?: string; closeOnSelect?: boolean; disabled?: boolean; minDate?: moment.Dayjs; maxDate?: moment.Dayjs; clearable?: boolean; defaultValue?: any; utc?: boolean; onChange: (value: any) => void; value?: any; shortcuts: string | Array; overlayPlacement: string; dateFormat?: string; timeConstraints?: { hours?: { min: number; max: number; step: number; }; minutes?: { min: number; max: number; step: number; }; seconds: { min: number; max: number; step: number; }; }; container?: any; borderMode?: 'full' | 'half' | 'none'; embed?: boolean; schedules?: Array<{ startTime: Date; endTime: Date; content: any; className?: ClassValue; }>; scheduleClassNames?: Array; largeMode?: boolean; onScheduleClick?: (scheduleData: any) => void; useMobileUI?: boolean; mobileCalendarMode?: 'picker' | 'calendar'; onFocus?: Function; onBlur?: Function; } export interface DatePickerState { isOpened: boolean; isFocused: boolean; value: moment.Dayjs | undefined; inputValue: string | undefined; } export declare class DatePicker extends React.Component { static contextType: any; static defaultProps: { viewMode: "time" | "days" | "months" | "years"; shortcuts: string; closeOnSelect: boolean; overlayPlacement: string; scheduleClassNames: string[]; container: HTMLElement; }; state: DatePickerState; constructor(props: DateProps); dom: HTMLDivElement; inputRef: React.RefObject; componentDidUpdate(prevProps: DateProps): void; focus(): void; handleFocus(e: React.SyntheticEvent): void; handleBlur(e: React.SyntheticEvent): void; handleKeyPress(e: React.KeyboardEvent): void; handleClick(): void; handlePopOverClick(e: React.MouseEvent): void; open(fn?: () => void): void; close(): void; clearValue(e: React.MouseEvent): void; handleChange(value: moment.Dayjs): void; inputChange(e?: React.ChangeEvent): void; selectRannge(item: any): void; checkIsValidDate(currentDate: moment.Dayjs): boolean; getTarget(): HTMLDivElement; getParent(): HTMLDivElement; domRef: (ref: HTMLDivElement) => void; getAvailableShortcuts(key: string): any; renderShortCuts(shortcuts: string | Array): JSX.Element; render(): JSX.Element; } export default DatePicker;