import PropTypes from '../../../_util/vue-types';
import BaseMixin from '../../../_util/BaseMixin';
import { getMonthName } from '../util';
const CalendarHeader = {
name: 'CalendarHeader',
inheritAttrs: false,
mixins: [BaseMixin],
props: {
value: PropTypes.object,
locale: PropTypes.object,
yearSelectOffset: PropTypes.number.def(10),
yearSelectTotal: PropTypes.number.def(20),
// onValueChange: PropTypes.func,
// onTypeChange: PropTypes.func,
Select: PropTypes.object,
prefixCls: PropTypes.string,
type: PropTypes.string,
showTypeSwitch: PropTypes.looseBool,
headerComponents: PropTypes.array,
},
methods: {
onYearChange(year) {
const newValue = this.value.clone();
newValue.year(parseInt(year, 10));
this.__emit('valueChange', newValue);
},
onMonthChange(month) {
const newValue = this.value.clone();
newValue.month(parseInt(month, 10));
this.__emit('valueChange', newValue);
},
yearSelectElement(year) {
const { yearSelectOffset, yearSelectTotal, prefixCls, Select } = this;
const start = year - yearSelectOffset;
const end = start + yearSelectTotal;
const options = [];
for (let index = start; index < end; index++) {
options.push(