import { defineComponent, createVNode } from 'vue';
import Cell from '../Cell/index.mjs';
import { useInjectTable } from '../context/TableContext.mjs';
import { useInjectExpandedRow } from '../context/ExpandedRowContext.mjs';

var ExpandedRow = /* @__PURE__ */ defineComponent({
  name: "ExpandedRow",
  inheritAttrs: false,
  props: ["prefixCls", "component", "cellComponent", "expanded", "colSpan", "isEmpty"],
  setup(props, {
    slots,
    attrs
  }) {
    const tableContext = useInjectTable();
    const expandedRowContext = useInjectExpandedRow();
    const {
      fixHeader,
      fixColumn,
      componentWidth,
      horizonScroll
    } = expandedRowContext;
    return () => {
      const {
        prefixCls,
        component: Component,
        cellComponent,
        expanded,
        colSpan,
        isEmpty
      } = props;
      return createVNode(Component, {
        "class": attrs.class,
        "style": {
          display: expanded ? null : "none"
        }
      }, {
        default: () => [createVNode(Cell, {
          "component": cellComponent,
          "prefixCls": prefixCls,
          "colSpan": colSpan
        }, {
          default: () => {
            var _a;
            let contentNode = (_a = slots.default) == null ? void 0 : _a.call(slots);
            if (isEmpty ? horizonScroll.value : fixColumn.value) {
              const _contentNode = function() {
                return contentNode;
              }();
              contentNode = createVNode("div", {
                "style": {
                  width: `${componentWidth.value - (fixHeader.value ? tableContext.scrollbarSize : 0)}px`,
                  position: "sticky",
                  left: 0,
                  overflow: "hidden"
                },
                "class": `${prefixCls}-expanded-row-fixed`
              }, [contentNode]);
            }
            return contentNode;
          }
        })]
      });
    };
  }
});

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