import { createVNode, createTextVNode } from 'vue';
import Header from '../Header.mjs';
import { useInjectPanel } from '../../PanelContext.mjs';
import useMergeProps from '../../hooks/useMergeProps.mjs';
import { DECADE_DISTANCE_COUNT } from './constant.mjs';

function DecadeHeader(_props) {
  const props = useMergeProps(_props);
  const {
    prefixCls,
    generateConfig,
    viewDate,
    onPrevDecades,
    onNextDecades
  } = props;
  const {
    hideHeader
  } = useInjectPanel();
  if (hideHeader)
    return null;
  const headerPrefixCls = `${prefixCls}-header`;
  const yearNumber = generateConfig.getYear(viewDate);
  const startYear = Math.floor(yearNumber / DECADE_DISTANCE_COUNT) * DECADE_DISTANCE_COUNT;
  const endYear = startYear + DECADE_DISTANCE_COUNT - 1;
  return createVNode(Header, {
    ...props,
    "prefixCls": headerPrefixCls,
    "onSuperPrev": onPrevDecades,
    "onSuperNext": onNextDecades
  }, {
    default: () => [startYear, createTextVNode("-"), endYear]
  });
}
DecadeHeader.displayName = "DecadeHeader";
DecadeHeader.inheritAttrs = false;

export { DecadeHeader as default };
//# sourceMappingURL=DecadeHeader.mjs.map
