add MonthCalendar

This commit is contained in:
yiminghe 2015-08-25 17:27:38 +08:00
parent 3456e1122e
commit 109e283e15
2 changed files with 84 additions and 78 deletions

View File

@ -1,7 +1,5 @@
import React from 'react';
import Calendar from 'rc-calendar';
const Datepicker = Calendar.Picker;
import Calendar, {MonthCalendar, Picker as Datepicker} from 'rc-calendar';
import GregorianCalendar from 'gregorian-calendar';
import zhCn from 'gregorian-calendar/lib/locale/zh-cn';
import CalendarLocale from 'rc-calendar/lib/locale/zh-cn';
@ -17,7 +15,9 @@ Locale.shortMonths = ['1月', '2月', '3月', '4月', '5月', '6月',
let defaultCalendarValue = new GregorianCalendar(zhCn);
defaultCalendarValue.setTime(Date.now());
const AntDatepicker = React.createClass({
function createPicker(Calendar){
return React.createClass({
getInitialState() {
var value;
if (this.props.value) {
@ -93,6 +93,11 @@ const AntDatepicker = React.createClass({
);
}
});
}
const AntDatePicker = createPicker(Calendar);
const AntMonthPicker = createPicker(MonthCalendar);
const AntCalendar = React.createClass({
getDefaultProps() {
@ -106,6 +111,7 @@ const AntCalendar = React.createClass({
}
});
AntDatepicker.Calendar = AntCalendar;
AntDatePicker.Calendar = AntCalendar;
AntDatePicker.MonthPicker = AntMonthPicker;
export default AntDatepicker;
export default AntDatePicker;

View File

@ -38,7 +38,7 @@
"gregorian-calendar-format": "~3.0.1",
"object-assign": "~4.0.1",
"rc-animate": "~1.2.0",
"rc-calendar": "~3.15.0",
"rc-calendar": "~3.16.1",
"rc-checkbox": "~1.1.1",
"rc-collapse": "~1.3.0",
"rc-dialog": "~5.0.2",