import BaseFoundation, { DefaultAdapter } from '../base/foundation'; import { BaseValueType, ValidateStatus, ValueType } from './foundation'; import { strings } from './constants'; export type Type = 'date' | 'dateRange' | 'year' | 'month' | 'dateTime' | 'dateTimeRange' | 'monthRange'; export type RangeType = 'rangeStart' | 'rangeEnd'; export type PanelType = 'left' | 'right'; export interface DateInputEventHandlerProps { onClick?: (e: any) => void; onChange?: (value: string, e: any) => void; onEnterPress?: (e: any) => void; onBlur?: (e: any) => void; onFocus?: (e: any, rangeType: RangeType) => void; onClear?: (e: any) => void; onRangeInputClear?: (e: any) => void; onRangeEndTabPress?: (e: any) => void; onInsetInputChange?: (options: InsetInputChangeProps) => void; } export interface DateInputElementProps { borderless?: boolean; insetLabel?: any; prefix?: any; } export interface InsetInputProps { placeholder?: { dateStart?: string; dateEnd?: string; timeStart?: string; timeEnd?: string; }; } export interface DateInputFoundationProps extends DateInputElementProps, DateInputEventHandlerProps { [x: string]: any; value?: Date[]; disabled?: boolean; type?: Type; showClear?: boolean; format?: string; inputStyle?: Record; inputReadOnly?: boolean; validateStatus?: ValidateStatus; prefixCls?: string; rangeSeparator?: string; panelType?: PanelType; insetInput?: boolean | InsetInputProps; insetInputValue?: InsetInputValue; density?: typeof strings.DENSITY_SET[number]; defaultPickerValue?: ValueType; } export interface InsetInputValue { monthLeft: { dateInput: string; timeInput: string; }; monthRight: { dateInput: string; timeInput: string; }; } export interface InsetInputChangeFoundationProps { value: string; insetInputValue: InsetInputValue; event: any; valuePath: string; } export interface InsetInputChangeProps { insetInputStr: string; format: string; insetInputValue: InsetInputValue; } export interface DateInputAdapter extends DefaultAdapter> { updateIsFocusing: (isFocusing: boolean) => void; notifyClick: DateInputFoundationProps['onClick']; notifyChange: DateInputFoundationProps['onChange']; notifyInsetInputChange: DateInputFoundationProps['onInsetInputChange']; notifyEnter: DateInputFoundationProps['onEnterPress']; notifyBlur: DateInputFoundationProps['onBlur']; notifyClear: DateInputFoundationProps['onClear']; notifyFocus: DateInputFoundationProps['onFocus']; notifyRangeInputClear: DateInputFoundationProps['onRangeInputClear']; notifyRangeInputFocus: DateInputFoundationProps['onFocus']; notifyTabPress: DateInputFoundationProps['onRangeEndTabPress']; } export default class InputFoundation extends BaseFoundation { constructor(adapter: DateInputAdapter); init(): void; destroy(): void; handleClick(e: any): void; handleChange(value: string, e: any): void; handleInputComplete(e: any): void; handleInputClear(e: any): void; handleRangeInputClear(e: any): void; handleRangeInputEnterPress(e: any, rangeInputValue: string): void; handleRangeInputEndKeyPress(e: any): void; handleRangeInputFocus(e: any, rangeType: RangeType): void; formatShowText(value: BaseValueType[], customFormat?: string): string; handleInsetInputChange(options: InsetInputChangeFoundationProps): void; _autoFillTimeToInsetInputValue(options: { insetInputValue: InsetInputValue; format: string; valuePath: string; }): InsetInputValue; /** * 只有传入的 format 符合 formatReg 时,才会使用用户传入的 format * 否则会使用默认的 format 作为 placeholder * * The format passed in by the user will be used only if the incoming format conforms to formatReg * Otherwise the default format will be used as placeholder */ getInsetInputPlaceholder(): { datePlaceholder: any; timePlaceholder: any; }; /** * 从当前日期值或 inputValue 中解析出 insetInputValue * * Parse out insetInputValue from current date value or inputValue */ getInsetInputValue({ value, insetInputValue }: { value: BaseValueType[]; insetInputValue: InsetInputValue; }): { monthLeft: { dateInput: string; timeInput: string; }; monthRight: { dateInput: string; timeInput: string; }; }; concatInsetDateAndTime({ date, time }: { date: any; time: any; }): string; concatInsetDateRange({ rangeStart, rangeEnd }: { rangeStart: any; rangeEnd: any; }): string; concatInsetInputValue({ insetInputValue }: { insetInputValue: InsetInputValue; }): string; }