Merge branch 'master' of github.com:ant-design/ant-design

This commit is contained in:
afc163 2016-08-24 17:57:33 +08:00
commit 50478936f0
2 changed files with 12 additions and 4 deletions

View File

@ -6,6 +6,11 @@ import classNames from 'classnames';
import assign from 'object-assign';
import Icon from '../icon';
export interface PickerProps {
parseDateFromValue?: Function;
value?: string | Date;
}
export default function createPicker(TheCalendar) {
// use class typescript error
const CalenderWrapper = React.createClass({
@ -16,7 +21,7 @@ export default function createPicker(TheCalendar) {
};
},
componentWillReceiveProps(nextProps) {
componentWillReceiveProps(nextProps: PickerProps) {
if ('value' in nextProps) {
this.setState({
value: nextProps.parseDateFromValue(nextProps.value),

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import assign from 'object-assign';
import RcCalendar from 'rc-calendar';
import MonthCalendar from 'rc-calendar/lib/MonthCalendar';
import createPicker from './createPicker';
@ -38,9 +39,11 @@ export interface RangePickerProps extends PickerProps {
onChange?: (dates: [Date, Date], dateStrings: [String, String]) => void;
showTime?: TimePickerProps;
}
DatePicker.RangePicker = wrapPicker(RangePicker) as React.ClassicComponentClass<RangePickerProps>;
DatePicker.Calendar = Calendar;
DatePicker.MonthPicker = MonthPicker;
assign(DatePicker, {
RangePicker: wrapPicker(RangePicker) as React.ClassicComponentClass<RangePickerProps>,
Calendar,
MonthPicker,
});
export default DatePicker;