import { resolveDirective as _resolveDirective, createVNode as _createVNode } from "vue";
import Cell from '../Cell';
import { defineComponent } from 'vue';
import { useInjectTable } from '../context/TableContext';
export default defineComponent({
  name: 'ExpandedRow',
  inheritAttrs: false,
  props: ['prefixCls', 'component', 'cellComponent', 'fixHeader', 'fixColumn', 'horizonScroll', 'componentWidth', 'expanded', 'colSpan'],
  setup: function setup(props, _ref) {
    var slots = _ref.slots,
        attrs = _ref.attrs;
    var tableContext = useInjectTable();
    return function () {
      var prefixCls = props.prefixCls,
          Component = props.component,
          cellComponent = props.cellComponent,
          fixHeader = props.fixHeader,
          fixColumn = props.fixColumn,
          expanded = props.expanded,
          componentWidth = props.componentWidth,
          colSpan = props.colSpan;
      return _createVNode(Component, {
        "class": attrs.class,
        "style": {
          display: expanded ? null : 'none'
        }
      }, {
        default: function _default() {
          return [_createVNode(Cell, {
            "component": cellComponent,
            "prefixCls": prefixCls,
            "colSpan": colSpan
          }, {
            default: function _default() {
              var _slots$default;

              var contentNode = (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);

              if (fixColumn) {
                var _contentNode = function () {
                  return contentNode;
                }();

                contentNode = _createVNode("div", {
                  "style": {
                    width: "".concat(componentWidth - (fixHeader ? tableContext.scrollbarSize : 0), "px"),
                    position: 'sticky',
                    left: 0,
                    overflow: 'hidden'
                  },
                  "class": "".concat(prefixCls, "-expanded-row-fixed")
                }, [contentNode]);
              }

              return contentNode;
            }
          })];
        }
      });
    };
  }
});