import { defineComponent, createVNode } from 'vue';
import Cell from '../Cell/index.mjs';
import { useInjectSummary } from '../context/SummaryContext.mjs';
import { useInjectTable } from '../context/TableContext.mjs';
import { getCellFixedInfo } from '../utils/fixUtil.mjs';

var SummaryCell = /* @__PURE__ */ defineComponent({
  name: "ATableSummaryCell",
  props: ["index", "colSpan", "rowSpan", "align"],
  setup(props, {
    attrs,
    slots
  }) {
    const tableContext = useInjectTable();
    const summaryContext = useInjectSummary();
    return () => {
      const {
        index,
        colSpan = 1,
        rowSpan,
        align
      } = props;
      const {
        prefixCls,
        direction
      } = tableContext;
      const {
        scrollColumnIndex,
        stickyOffsets,
        flattenColumns
      } = summaryContext;
      const lastIndex = index + colSpan - 1;
      const mergedColSpan = lastIndex + 1 === scrollColumnIndex ? colSpan + 1 : colSpan;
      const fixedInfo = getCellFixedInfo(index, index + mergedColSpan - 1, flattenColumns, stickyOffsets, direction);
      return createVNode(Cell, {
        "class": attrs.class,
        "index": index,
        "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);
    };
  }
});

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