'use strict';

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

var vue = require('vue');
var index = require('../Cell/index.cjs');
var TableContext = require('../context/TableContext.cjs');
var ExpandedRowContext = require('../context/ExpandedRowContext.cjs');

var ExpandedRow = /* @__PURE__ */ vue.defineComponent({
  name: "ExpandedRow",
  inheritAttrs: false,
  props: ["prefixCls", "component", "cellComponent", "expanded", "colSpan", "isEmpty"],
  setup(props, {
    slots,
    attrs
  }) {
    const tableContext = TableContext.useInjectTable();
    const expandedRowContext = ExpandedRowContext.useInjectExpandedRow();
    const {
      fixHeader,
      fixColumn,
      componentWidth,
      horizonScroll
    } = expandedRowContext;
    return () => {
      const {
        prefixCls,
        component: Component,
        cellComponent,
        expanded,
        colSpan,
        isEmpty
      } = props;
      return vue.createVNode(Component, {
        "class": attrs.class,
        "style": {
          display: expanded ? null : "none"
        }
      }, {
        default: () => [vue.createVNode(index.default, {
          "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 = vue.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;
          }
        })]
      });
    };
  }
});

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