'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var Header = require('../Header.js');
var PanelContext = require('../../PanelContext.js');
var useMergeProps = require('../../hooks/useMergeProps.js');
var constants = require('./constants.js');

function YearHeader(_props) {
  const props = useMergeProps.default(_props);
  const {
    prefixCls,
    generateConfig,
    viewDate,
    onPrevDecade,
    onNextDecade,
    onDecadeClick
  } = props;
  const {
    hideHeader
  } = PanelContext.useInjectPanel();
  if (hideHeader.value)
    return null;
  const headerPrefixCls = `${prefixCls}-header`;
  const yearNumber = generateConfig.getYear(viewDate);
  const startYear = Math.floor(yearNumber / constants.YEAR_DECADE_COUNT) * constants.YEAR_DECADE_COUNT;
  const endYear = startYear + constants.YEAR_DECADE_COUNT - 1;
  return vue.createVNode(Header.default, vue.mergeProps(props, {
    "prefixCls": headerPrefixCls,
    "onSuperPrev": onPrevDecade,
    "onSuperNext": onNextDecade
  }), {
    default: () => [vue.createVNode("button", {
      "type": "button",
      "onClick": onDecadeClick,
      "class": `${prefixCls}-decade-btn`
    }, [startYear, vue.createTextVNode("-"), endYear])]
  });
}
YearHeader.displayName = "YearHeader";
YearHeader.inheritAttrs = false;

exports.default = YearHeader;
//# sourceMappingURL=YearHeader.js.map
