'use strict';

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

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

function DateHeader(_props) {
  const props = useMergeProps.default(_props);
  const {
    prefixCls,
    generateConfig,
    locale,
    viewDate,
    onNextMonth,
    onPrevMonth,
    onNextYear,
    onPrevYear,
    onYearClick,
    onMonthClick
  } = props;
  const {
    hideHeader
  } = PanelContext.useInjectPanel();
  if (hideHeader.value)
    return null;
  const headerPrefixCls = `${prefixCls}-header`;
  const monthsLocale = locale.shortMonths || (generateConfig.locale.getShortMonths ? generateConfig.locale.getShortMonths(locale.locale) : []);
  const month = generateConfig.getMonth(viewDate);
  const yearNode = vue.createVNode("button", {
    "type": "button",
    "key": "year",
    "onClick": onYearClick,
    "tabindex": -1,
    "class": `${prefixCls}-year-btn`
  }, [dateUtil.formatValue(viewDate, {
    locale,
    format: locale.yearFormat,
    generateConfig
  })]);
  const monthNode = vue.createVNode("button", {
    "type": "button",
    "key": "month",
    "onClick": onMonthClick,
    "tabindex": -1,
    "class": `${prefixCls}-month-btn`
  }, [locale.monthFormat ? dateUtil.formatValue(viewDate, {
    locale,
    format: locale.monthFormat,
    generateConfig
  }) : monthsLocale[month]]);
  const monthYearNodes = locale.monthBeforeYear ? [monthNode, yearNode] : [yearNode, monthNode];
  return vue.createVNode(Header.default, {
    ...props,
    "prefixCls": headerPrefixCls,
    "onSuperPrev": onPrevYear,
    "onPrev": onPrevMonth,
    "onNext": onNextMonth,
    "onSuperNext": onNextYear
  }, {
    default: () => [monthYearNodes]
  });
}
DateHeader.displayName = "DateHeader";
DateHeader.inheritAttrs = false;

exports.default = DateHeader;
//# sourceMappingURL=DateHeader.cjs.map
