|
@ -144,17 +144,13 @@ class Calendar extends React.Component<CalendarProps, CalendarState> { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
setType = (mode: CalendarMode) => { |
|
|
|
|
|
this.setState({ mode }); |
|
|
|
|
|
this.onPanelChange(this.state.value, mode); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
onHeaderValueChange = (value: moment.Moment) => { |
|
|
onHeaderValueChange = (value: moment.Moment) => { |
|
|
this.setValue(value, 'changePanel'); |
|
|
this.setValue(value, 'changePanel'); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
onHeaderTypeChange = (type: CalendarMode) => { |
|
|
onHeaderTypeChange = (mode: CalendarMode) => { |
|
|
this.setType(type); |
|
|
this.setState({ mode }); |
|
|
|
|
|
this.onPanelChange(this.state.value, mode); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
onPanelChange(value: moment.Moment, mode: CalendarMode | undefined) { |
|
|
onPanelChange(value: moment.Moment, mode: CalendarMode | undefined) { |
|
@ -212,8 +208,6 @@ class Calendar extends React.Component<CalendarProps, CalendarState> { |
|
|
dateFullCellRender, |
|
|
dateFullCellRender, |
|
|
monthFullCellRender, |
|
|
monthFullCellRender, |
|
|
} = props; |
|
|
} = props; |
|
|
const type = mode === 'year' ? 'month' : 'date'; |
|
|
|
|
|
|
|
|
|
|
|
const monthCellRender = monthFullCellRender || this.monthCellRender; |
|
|
const monthCellRender = monthFullCellRender || this.monthCellRender; |
|
|
const dateCellRender = dateFullCellRender || this.dateCellRender; |
|
|
const dateCellRender = dateFullCellRender || this.dateCellRender; |
|
|
|
|
|
|
|
@ -255,7 +249,7 @@ class Calendar extends React.Component<CalendarProps, CalendarState> { |
|
|
disabledDate={disabledDate} |
|
|
disabledDate={disabledDate} |
|
|
Select={noop} |
|
|
Select={noop} |
|
|
locale={locale.lang} |
|
|
locale={locale.lang} |
|
|
type={type} |
|
|
type={mode === 'year' ? 'month' : 'date'} |
|
|
prefixCls={prefixCls} |
|
|
prefixCls={prefixCls} |
|
|
showHeader={false} |
|
|
showHeader={false} |
|
|
value={value} |
|
|
value={value} |
|
|