'use strict';

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

var vue = require('vue');
var Header = require('../Header.cjs');
var PanelContext = require('../../PanelContext.cjs');
var useMergeProps = require('../../hooks/useMergeProps.cjs');
var constant = require('./constant.cjs');

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 / constant.YEAR_DECADE_COUNT) * constant.YEAR_DECADE_COUNT;
  const endYear = startYear + constant.YEAR_DECADE_COUNT - 1;
  return vue.createVNode(Header.default, {
    ...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.cjs.map
