'use strict';

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

var vue = require('vue');
var dateUtil = require('../../utils/dateUtil.cjs');
var RangeContext = require('../../RangeContext.cjs');
var useCellClassName = require('../../hooks/useCellClassName.cjs');
var PanelBody = require('../PanelBody.cjs');
var useMergeProps = require('../../hooks/useMergeProps.cjs');

const QUARTER_COL_COUNT = 4;
const QUARTER_ROW_COUNT = 1;
function QuarterBody(_props) {
  const props = useMergeProps.default(_props);
  const {
    prefixCls,
    locale,
    value,
    viewDate,
    generateConfig
  } = props;
  const {
    rangedValue,
    hoverRangedValue
  } = RangeContext.useInjectRange();
  const cellPrefixCls = `${prefixCls}-cell`;
  const getCellClassName = useCellClassName.default({
    cellPrefixCls,
    value,
    generateConfig,
    rangedValue: rangedValue.value,
    hoverRangedValue: hoverRangedValue.value,
    isSameCell: (current, target) => dateUtil.isSameQuarter(generateConfig, current, target),
    isInView: () => true,
    offsetCell: (date, offset) => generateConfig.addMonth(date, offset * 3)
  });
  const baseQuarter = generateConfig.setDate(generateConfig.setMonth(viewDate, 0), 1);
  return vue.createVNode(PanelBody.default, {
    ...props,
    "rowNum": QUARTER_ROW_COUNT,
    "colNum": QUARTER_COL_COUNT,
    "baseDate": baseQuarter,
    "getCellText": (date) => dateUtil.formatValue(date, {
      locale,
      format: locale.quarterFormat || "[Q]Q",
      generateConfig
    }),
    "getCellClassName": getCellClassName,
    "getCellDate": (date, offset) => generateConfig.addMonth(date, offset * 3),
    "titleCell": (date) => dateUtil.formatValue(date, {
      locale,
      format: "YYYY-[Q]Q",
      generateConfig
    })
  }, null);
}
QuarterBody.displayName = "QuarterBody";
QuarterBody.inheritAttrs = false;

exports.QUARTER_COL_COUNT = QUARTER_COL_COUNT;
exports.default = QuarterBody;
//# sourceMappingURL=QuarterBody.cjs.map
