You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.6 KiB

import * as React from 'react';
import assign from 'object-assign';
import RcCalendar from 'rc-calendar';
9 years ago
import MonthCalendar from 'rc-calendar/lib/MonthCalendar';
import createPicker from './createPicker';
import wrapPicker from './wrapPicker';
import RangePicker from './RangePicker';
import Calendar from './Calendar';
import { TimePickerProps } from '../time-picker';
interface PickerProps {
format?: string;
disabled?: boolean;
style?: React.CSSProperties;
popupStyle?: React.CSSProperties;
locale?: any;
size?: 'large' | 'small' | 'default';
getCalendarContainer?: (trigger) => React.ReactNode;
}
interface SinglePickerProps {
value?: string | Date;
defaultValue?: string | Date;
onChange?: (date: Date, dateString: string) => void;
}
export interface DatePickerProps extends PickerProps, SinglePickerProps {
showTime?: TimePickerProps;
}
const DatePicker = wrapPicker(createPicker(RcCalendar)) as React.ClassicComponentClass<DatePickerProps>;
export interface MonthPickerProps extends PickerProps, SinglePickerProps {
}
const MonthPicker = wrapPicker(createPicker(MonthCalendar), 'yyyy-MM') as React.ClassicComponentClass<MonthPickerProps>;
export interface RangePickerProps extends PickerProps {
value?: [string | Date, string | Date];
defaultValue?: [string | Date, string | Date];
onChange?: (dates: [Date, Date], dateStrings: [String, String]) => void;
showTime?: TimePickerProps;
}
9 years ago
assign(DatePicker, {
RangePicker: wrapPicker(RangePicker) as React.ClassicComponentClass<RangePickerProps>,
Calendar,
MonthPicker,
});
9 years ago
export default DatePicker;