export default function () {
  let BodyTable = require('ant-design-vue/es/vc-table/src/BodyTable.js').default;

  BodyTable.render = (function (fn) {
    return function (h) {
      const vNode = fn.apply(this, arguments);
      if (this.$parent.data.length > 0) {
        const { minHeight } = this.table?.scroll ?? {};
        if (vNode && !this.fixed && minHeight) {
          vNode.data.style.minHeight = isNaN(minHeight) ? minHeight : minHeight + 'px';
        }
      }
      if (typeof customCell === 'function') {

        col.customCell=customCell
      }

      const { tableClassName } = this;
      const {  data, tableType, vScrollY, verticalState, scroll, columnManager } = this.table;
      if (tableType == 't-table') {

        if (vScrollY&& vScrollY.enabled && vScrollY.rows) {
          const { rowHeight } = verticalState;
          let minHeight = rowHeight * vScrollY.rows;
          if (data.length>0&&!isNaN(minHeight)) {
            vNode.data.style.minHeight = minHeight + 'px';
            scroll.y = minHeight;
          }
        }


          const { scrollWidth } = columnManager;
          const { bodyScrollHeight } = verticalState;
          let x_style = typeof scrollWidth !=='undefined'&&scrollWidth > 0 ? { width: scrollWidth + 'px' } : {};
          let y_style = tableClassName !== 'ant-table-fixed-footer' && bodyScrollHeight > -1 ? { height: bodyScrollHeight + 'px' } : {};
          vNode.children.unshift(<div class={['body-x-space']} style={x_style} />);
          vNode.children.unshift(<div class={['body-y-space']} style={y_style} />);
          //vNode.children.unshift(<div class={['t-table-drag-line' ]} style={{display:'block'}}/>);
          // console.log('x_style',scrollWidth)
        }


      return vNode;
    };
  })(BodyTable.render);
}
