import { ReactNode, MouseEvent, FocusEvent } from 'react'; import dayjs, { Dayjs } from 'dayjs'; import { Popper } from '@befe/brick-comp-popper'; import { InputProps } from '@befe/brick-comp-input'; import { ConfiguredComponent } from '@befe/brick-core'; import { TypeModuleMonthPanel } from '../modules/create-month-panel'; import { QuickActions } from './create-quick-actions'; import { TypeActionLink, TypeDatePickerMode, TypeDateValue, TypePickerSize, TypePickerStatus } from './prop-types'; type InnerRangePickerPropsFromInput = Pick; export interface RangePickerProps extends InnerRangePickerPropsFromInput { className?: string; startValue?: TypeDateValue; endValue?: TypeDateValue; defaultStartValue?: TypeDateValue; defaultEndValue?: TypeDateValue; disabled?: boolean; size?: TypePickerSize; status?: TypePickerStatus; mode?: TypeDatePickerMode; itemFormat?: string; renderItem?: (currentDate: Dayjs, today: Dayjs) => (ReactNode | string | number); /** * @todo: 未实现 range picker 的 disabled 问题 */ getDisabledItem?: (currentDate: Dayjs, today: Dayjs) => boolean; /** * 当日期面板打开时, 设置其 "显示的面板位置" * * 这个可能主要在当没有选择日期时, 用于确定面板月份的显示策略 ( 缺省方案是显示 "当月" + "1 个月" ) */ getDefaultDisplayDateRange?: (today: Dayjs) => { start: Dayjs; end: Dayjs; }; showTime?: boolean; getDisabledTime?: (currentDate: Dayjs) => { start: number | null; end: number | null; }; open?: boolean | undefined; clearable?: boolean; startPlaceholder?: string; endPlaceholder?: string; startStyle?: CSSStyleDeclaration; endStyle?: CSSStyleDeclaration; popupClassName?: string; popupStyle?: CSSStyleDeclaration; onChange?: (start: Dayjs | null, end: Dayjs | null) => void; /** * @todo: 待实现 * * 这个传递 start, end 的原因, 可参见 date picker 的 onOpenChange 的注释 */ onOpenChange?: (openStatus: boolean, start: Dayjs | null, end: Dayjs | null) => void; renderFooter?: () => ReactNode | TypeActionLink[]; renderQuickActions?: () => TypeActionLink[]; onFocus?: (e: FocusEvent) => void; onBlur?: (e: FocusEvent) => void; autoFocus?: boolean; onMouseEnter?: (e: MouseEvent) => void; onMouseLeave?: (e: MouseEvent) => void; yearStart?: number; yearEnd?: number; } export interface RangePickerState { open: boolean; isStartZooming: boolean; isEndZooming: boolean; startValue: Dayjs | null; endValue: Dayjs | null; startDisplayedDate: Dayjs | null; endDisplayedDate: Dayjs | null; startZoomedDisplayedDate: Dayjs | null; endZoomedDisplayedDate: Dayjs | null; isStartUserInput: boolean; startUserInputText: string; isEndUserInput: boolean; endUserInputText: string; startFocus: boolean; endFocus: boolean; isSelecting: boolean; firstSelectedDate: Dayjs | null; secondHoveringDate: Dayjs | null; } /** */ export declare class InnerRangePicker extends ConfiguredComponent { static dayjs: typeof dayjs; static displayName: string; static defaultProps: RangePickerProps; defaultItemFormat: string; componentLocale: import("@befe/brick-core").ComponentLocale<{ en_us: { get_year_month_title: (date: dayjs.Dayjs) => string; get_year_title: (date: dayjs.Dayjs) => string; get_month_text: (month: number) => string; get_week_day_text: (day: number) => string; }; zh_cn: { get_year_month_title: (date: dayjs.Dayjs) => string; get_year_title: (date: dayjs.Dayjs) => string; get_month_text: (month: number) => string; get_week_day_text: (day: number) => string; }; }>; state: RangePickerState; refPanelWrapper: { readonly elem: Popper | null; ref: (node: Popper | null) => void; }; userInput: { renderInput(opts: { status?: TypePickerStatus | undefined; disabled?: boolean | undefined; size?: TypePickerSize | undefined; }): import("react/jsx-runtime").JSX.Element; readonly inputWrapperElem: HTMLDivElement | null; readonly startInputElem: HTMLInputElement | null; readonly endInputElem: HTMLInputElement | null; formatStartInputValue: (value: dayjs.Dayjs | null) => string; formatEndInputValue: (value: dayjs.Dayjs | null) => string; }; get size(): RangePickerProps['size']; /** * @deprecated @0427: 为了避免歧义, 改为 inputWrapper (因此处并非 input element) */ get inputElem(): HTMLDivElement | null; get inputWrapperElem(): HTMLDivElement | null; get startInputElem(): HTMLInputElement | null; get endInputElem(): HTMLInputElement | null; focus(): void; getWeekDayText: (day: number) => string; getPanelTitle_yearMonth: (date: Dayjs) => string; getPanelTitle_year: (date: Dayjs) => string; startDatePanel: { init(panelOpts: import("../modules/create-date-panel").TypeInitOpts, switcherOpts?: import("../modules/create-date-switcher").TypeDisplayedDateSwitcherInitOpts | undefined): void; getRenderElem(): { titleElem: import("react/jsx-runtime").JSX.Element; contentElem: import("react/jsx-runtime").JSX.Element; contentType: import("../module-defs/ui-types").TypePickerContentType; asideElem: undefined; }; renderPanel(): import("react/jsx-runtime").JSX.Element; }; endDatePanel: { init(panelOpts: import("../modules/create-date-panel").TypeInitOpts, switcherOpts?: import("../modules/create-date-switcher").TypeDisplayedDateSwitcherInitOpts | undefined): void; getRenderElem(): { titleElem: import("react/jsx-runtime").JSX.Element; contentElem: import("react/jsx-runtime").JSX.Element; contentType: import("../module-defs/ui-types").TypePickerContentType; asideElem: undefined; }; renderPanel(): import("react/jsx-runtime").JSX.Element; }; getMonthText: (month: number) => string; zoomedStartDatePanel: TypeModuleMonthPanel; zoomedEndDatePanel: TypeModuleMonthPanel; /** * @todo: month range picker */ startMonthPanel: { init(opts: import("../modules/create-month-panel").TypeInitOpts): void; getRenderElem(): { titleElem: ReactNode; contentElem: ReactNode; asideElem: ReactNode; contentType: import("../module-defs/ui-types").TypePickerContentType; }; renderPanel(): import("react/jsx-runtime").JSX.Element; } & { setYearRangeAnchor: (yearAnchor: number) => void; syncAsideScroll: () => void; }; endMonthPanel: { init(opts: import("../modules/create-month-panel").TypeInitOpts): void; getRenderElem(): { titleElem: ReactNode; contentElem: ReactNode; asideElem: ReactNode; contentType: import("../module-defs/ui-types").TypePickerContentType; }; renderPanel(): import("react/jsx-runtime").JSX.Element; } & { setYearRangeAnchor: (yearAnchor: number) => void; syncAsideScroll: () => void; }; actionQueue: { pushAction(action: () => void, key?: string | undefined): void; execute(): void; }; listenerGroup: import("@befe/brick-utils").ListenerGroup; get className(): string; get popupClassName(): string; get computedItemFormat(): string; get computedItemValueExtractor(): (text: string) => dayjs.Dayjs; get shouldShowPanel(): boolean; triggerChange: ({ startValue, endValue, }: { startValue?: dayjs.Dayjs | null | undefined; endValue?: dayjs.Dayjs | null | undefined; }) => void; handleCalendarIconClick: () => void; setOpenStatus: ({ open, isStartUserInput, isEndUserInput, }: { open?: boolean | undefined; isStartUserInput?: boolean | undefined; isEndUserInput?: boolean | undefined; }) => void; constructor(props: any); static getDerivedStateFromProps(nextProps: RangePickerProps): Partial | null; componentDidMount(): void; componentDidUpdate(): void; componentWillUnmount(): void; quickActions: QuickActions; /** * @question. 这个是为了做 "测试用" 提供的内部 API? * * @param start * @param end */ setValue: (start?: TypeDateValue, end?: TypeDateValue) => void; getValue: () => (dayjs.Dayjs | null)[]; syncDisplayDate: () => void; renderPanel(): import("react/jsx-runtime").JSX.Element; render(): import("react/jsx-runtime").JSX.Element; } export {};