mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
Merge branch 'master' of github.com:ant-design/ant-design
This commit is contained in:
commit
50478936f0
@ -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),
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user