'use strict';

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

var vue = require('vue');
var index = require('../Cell/index.cjs');
var SummaryContext = require('../context/SummaryContext.cjs');
var TableContext = require('../context/TableContext.cjs');
var fixUtil = require('../utils/fixUtil.cjs');

var SummaryCell = /* @__PURE__ */ vue.defineComponent({
  name: "ATableSummaryCell",
  props: ["index", "colSpan", "rowSpan", "align"],
  setup(props, {
    attrs,
    slots
  }) {
    const tableContext = TableContext.useInjectTable();
    const summaryContext = SummaryContext.useInjectSummary();
    return () => {
      const {
        index: index$1,
        colSpan = 1,
        rowSpan,
        align
      } = props;
      const {
        prefixCls,
        direction
      } = tableContext;
      const {
        scrollColumnIndex,
        stickyOffsets,
        flattenColumns
      } = summaryContext;
      const lastIndex = index$1 + colSpan - 1;
      const mergedColSpan = lastIndex + 1 === scrollColumnIndex ? colSpan + 1 : colSpan;
      const fixedInfo = fixUtil.getCellFixedInfo(index$1, index$1 + mergedColSpan - 1, flattenColumns, stickyOffsets, direction);
      return vue.createVNode(index.default, {
        "class": attrs.class,
        "index": index$1,
        "component": "td",
        "prefixCls": prefixCls,
        "record": null,
        "dataIndex": null,
        "align": align,
        "colSpan": mergedColSpan,
        "rowSpan": rowSpan,
        "customRender": () => {
          var _a;
          return (_a = slots.default) == null ? void 0 : _a.call(slots);
        },
        ...fixedInfo
      }, null);
    };
  }
});

exports.default = SummaryCell;
//# sourceMappingURL=Cell.cjs.map
