/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

import { h as helper } from '../_chunks/dep-c89aafbb.js';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, ref, computed, watch, nextTick, onMounted } from '@vue/composition-api';
import pick from 'lodash/pick';
import useVirtualScroll from '../hooks/useVirtualScrollNew.js';
import { Loading } from '../loading/index.js';
import { useTNodeJSX } from '../hooks/tnode.js';
import { useConfig } from '../config-provider/useConfig.js';
import { Affix } from '../affix/index.js';
import '../_common/js/log/index.js';
import { getIEVersion } from '../_common/js/utils/helper.js';
import baseTableProps from './base-table-props.js';
import useTableHeader from './hooks/useTableHeader.js';
import useColumnResize from './hooks/useColumnResize.js';
import useFixed from './hooks/useFixed.js';
import usePagination from './hooks/usePagination.js';
import useAffix from './hooks/useAffix.js';
import TBody, { extendTableProps } from './tbody.js';
import useStyle, { formatCSSUnit } from './hooks/useStyle.js';
import useClassName from './hooks/useClassName.js';
import { ROW_LISTENERS } from './tr.js';
import THead from './thead.js';
import TFoot from './tfoot.js';
import { getAffixProps } from './utils.js';
import log from '../_common/js/log/log.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/slicedToArray';
import '../hooks/useResizeObserver.js';
import '../utils/withInstall.js';
import 'vue';
import 'lodash/capitalize';
import '../loading/directive.js';
import 'lodash/isObject';
import 'lodash/mapKeys';
import 'lodash/isEqual';
import '../loading/plugin.js';
import '../config.js';
import '../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../utils/easing.js';
import '../loading/loading.js';
import '../utils/render-tnode.js';
import '@babel/runtime/helpers/typeof';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../utils/transfer-dom.js';
import '../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import '../config-provider/context.js';
import 'lodash/merge';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '../_chunks/dep-be599ec8.js';
import 'dayjs';
import '../_chunks/dep-67ff4010.js';
import '../config-provider/type.js';
import '../utils/mixins.js';
import '../loading/props.js';
import '../loading/icon/gradient.js';
import '../_common/js/loading/circle-adapter.js';
import '../_common/js/utils/set-style.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'lodash/isNull';
import 'lodash/isUndefined';
import 'lodash/isNumber';
import 'lodash/isArray';
import '../loading/style/css.js';
import '../loading/type.js';
import 'lodash/isEmpty';
import 'lodash/isFunction';
import '../hooks/render-tnode.js';
import '../affix/affix.js';
import '../affix/props.js';
import '../affix/style/css.js';
import '../affix/type.js';
import './ellipsis.js';
import 'lodash/debounce';
import '../tooltip/index.js';
import '../utils/map-props.js';
import '../tooltip/tooltip.js';
import '../popup/props.js';
import '../popup/popup.js';
import '@popperjs/core';
import '../utils/helper.js';
import '../utils/event.js';
import '../popup/container.js';
import '../popup/utils.js';
import '../popup/trigger.js';
import '../tooltip/props.js';
import '../tooltip/style/css.js';
import '../tooltip/type.js';
import './hooks/useMultiHeader.js';
import 'lodash/get';
import '../_common/js/utils/getScrollbarWidth.js';
import '../pagination/index.js';
import '../pagination/pagination.js';
import '@ldesign/icons-vue';
import '../input-number/index.js';
import '../input-number/input-number.js';
import '../button/index.js';
import '../button/button.js';
import '../utils/ripple.js';
import '../button/props.js';
import '../button/style/css.js';
import '../button/type.js';
import '../input/index.js';
import '../input/input.js';
import '../input/props.js';
import '../input/input-group.js';
import '../input/style/css.js';
import '../input/type.js';
import '../hooks/useGlobalIcon.js';
import '../hooks/useConfig.js';
import '../input-number/props.js';
import '../input-number/useInputNumber.js';
import '../hooks/useCommonClassName.js';
import '../hooks/useVModel.js';
import '../_common/js/input-number/number.js';
import 'lodash/isNil';
import '../_common/js/input-number/large-number.js';
import '../hooks/useFormDisabled.js';
import '../input-number/style/css.js';
import '../input-number/type.js';
import '../select/index.js';
import '../select/select.js';
import 'lodash/cloneDeep';
import '../hooks/useDefaultValue.js';
import '../popup/index.js';
import '../popup/style/css.js';
import '../popup/type.js';
import '../popup/plugin.js';
import '../tag/index.js';
import '../tag/tag.js';
import '../tag/props.js';
import '../tag/check-tag.js';
import '../tag/check-tag-props.js';
import '../tag/style/css.js';
import '../tag/type.js';
import '../select-input/index.js';
import '../select-input/select-input.js';
import '../select-input/props.js';
import '../select-input/useSingle.js';
import '../select-input/useMultiple.js';
import '../tag-input/index.js';
import '../tag-input/tag-input.js';
import '../tag-input/props.js';
import '../tag-input/hooks/useTagScroll.js';
import '../tag-input/useTagList.js';
import '../tag-input/hooks/useHover.js';
import '../tag-input/hooks/useDragSorter.js';
import '../tag-input/style/css.js';
import '../tag-input/type.js';
import '../tag-input/interface.js';
import '../select-input/useOverlayInnerStyle.js';
import '../select-input/style/css.js';
import '../select-input/type.js';
import '../common-components/fake-arrow.js';
import '../select/option.js';
import '../checkbox/index.js';
import '../checkbox/group.js';
import 'lodash/intersection';
import '../checkbox/checkbox.js';
import '../checkbox/props.js';
import '../checkbox/checkbox-group-props.js';
import '../checkbox/style/css.js';
import '../checkbox/type.js';
import '../hooks/useLazyLoad.js';
import '../_common/js/utils/observe.js';
import '../select/util.js';
import '../select/option-props.js';
import '../select/select-panel.js';
import '../hooks/useVirtualScroll.js';
import '../select/hooks/useSelectOptions.js';
import '../select/props.js';
import '../select/optionGroup.js';
import '../select/option-group-props.js';
import '../select/style/css.js';
import '../select/type.js';
import '../input-adornment/index.js';
import '../input-adornment/input-adornment.js';
import '../input-adornment/props.js';
import '../input-adornment/style/css.js';
import '../input-adornment/type.js';
import '../pagination/props.js';
import '../pagination/pagination-mini.js';
import '../pagination/pagination-mini-props.js';
import '../pagination/style/css.js';
import '../pagination/type.js';
import './hooks/useRowspanAndColspan.js';
import 'lodash/upperFirst';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var BASE_TABLE_EVENTS = ["page-change", "cell-click", "scroll", "scrollX", "scrollY"];
var BASE_TABLE_ALL_EVENTS = ROW_LISTENERS.map(function (t) {
  return "row-".concat(t);
}).concat(BASE_TABLE_EVENTS);
var _BaseTable = defineComponent({
  name: "TBaseTable",
  props: _objectSpread(_objectSpread({}, baseTableProps), {}, {
    renderExpandedRow: Function,
    onLeafColumnsChange: Function,
    thDraggable: Boolean
  }),
  setup: function setup(props2, context) {
    var renderTNode = useTNodeJSX();
    var tableRef = ref();
    var tableElmRef = ref();
    var tableBodyRef = ref();
    var bottomContentRef = ref();
    var tableFootHeight = ref(0);
    var _useClassName = useClassName(),
      classPrefix = _useClassName.classPrefix,
      virtualScrollClasses = _useClassName.virtualScrollClasses,
      tableLayoutClasses = _useClassName.tableLayoutClasses,
      tableBaseClass = _useClassName.tableBaseClass,
      tableColFixedClasses = _useClassName.tableColFixedClasses;
    var _useStyle = useStyle(props2),
      tableClasses = _useStyle.tableClasses,
      sizeClassNames = _useStyle.sizeClassNames,
      tableContentStyles = _useStyle.tableContentStyles,
      tableElementStyles = _useStyle.tableElementStyles;
    var _useConfig = useConfig("table"),
      global = _useConfig.global;
    var _useTableHeader = useTableHeader(props2),
      isMultipleHeader = _useTableHeader.isMultipleHeader,
      spansAndLeafNodes = _useTableHeader.spansAndLeafNodes,
      thList = _useTableHeader.thList;
    var finalColumns = computed(function () {
      var _spansAndLeafNodes$va;
      return ((_spansAndLeafNodes$va = spansAndLeafNodes.value) === null || _spansAndLeafNodes$va === void 0 ? void 0 : _spansAndLeafNodes$va.leafColumns) || props2.columns;
    });
    var isIE = computed(function () {
      return getIEVersion() <= 11;
    });
    var paginationAffixRef = ref();
    var horizontalScrollAffixRef = ref();
    var headerTopAffixRef = ref();
    var footerBottomAffixRef = ref();
    var _useFixed = useFixed(props2, context, finalColumns, {
        paginationAffixRef: paginationAffixRef,
        horizontalScrollAffixRef: horizontalScrollAffixRef,
        headerTopAffixRef: headerTopAffixRef,
        footerBottomAffixRef: footerBottomAffixRef
      }),
      scrollbarWidth = _useFixed.scrollbarWidth,
      tableWidth = _useFixed.tableWidth,
      tableElmWidth = _useFixed.tableElmWidth,
      tableContentRef = _useFixed.tableContentRef,
      isFixedHeader = _useFixed.isFixedHeader,
      isWidthOverflow = _useFixed.isWidthOverflow,
      isFixedColumn = _useFixed.isFixedColumn,
      thWidthList = _useFixed.thWidthList,
      showColumnShadow = _useFixed.showColumnShadow,
      rowAndColFixedPosition = _useFixed.rowAndColFixedPosition,
      setData = _useFixed.setData,
      refreshTable = _useFixed.refreshTable,
      setTableElmWidth = _useFixed.setTableElmWidth,
      emitScrollEvent = _useFixed.emitScrollEvent,
      setUseFixedTableElmRef = _useFixed.setUseFixedTableElmRef,
      updateColumnFixedShadow = _useFixed.updateColumnFixedShadow,
      getThWidthList = _useFixed.getThWidthList,
      updateThWidthList = _useFixed.updateThWidthList,
      addTableResizeObserver = _useFixed.addTableResizeObserver,
      updateTableAfterColumnResize = _useFixed.updateTableAfterColumnResize;
    var _useAffix = useAffix(props2),
      affixHeaderRef = _useAffix.affixHeaderRef,
      affixFooterRef = _useAffix.affixFooterRef,
      horizontalScrollbarRef = _useAffix.horizontalScrollbarRef,
      paginationRef = _useAffix.paginationRef,
      showAffixHeader = _useAffix.showAffixHeader,
      showAffixFooter = _useAffix.showAffixFooter,
      showAffixPagination = _useAffix.showAffixPagination,
      onHorizontalScroll = _useAffix.onHorizontalScroll,
      updateAffixHeaderOrFooter = _useAffix.updateAffixHeaderOrFooter,
      setTableContentRef = _useAffix.setTableContentRef;
    var _usePagination = usePagination(props2, context),
      dataSource = _usePagination.dataSource,
      innerPagination = _usePagination.innerPagination,
      isPaginateData = _usePagination.isPaginateData,
      renderPagination = _usePagination.renderPagination;
    var columnResizeParams = useColumnResize({
      isWidthOverflow: isWidthOverflow,
      tableContentRef: tableContentRef,
      showColumnShadow: showColumnShadow,
      getThWidthList: getThWidthList,
      updateThWidthList: updateThWidthList,
      setTableElmWidth: setTableElmWidth,
      updateTableAfterColumnResize: updateTableAfterColumnResize
    });
    var resizeLineRef = columnResizeParams.resizeLineRef,
      resizeLineStyle = columnResizeParams.resizeLineStyle,
      setEffectColMap = columnResizeParams.setEffectColMap;
    var dynamicBaseTableClasses = computed(function () {
      var _ref;
      return [tableClasses.value, (_ref = {}, _defineProperty(_ref, tableBaseClass.headerFixed, isFixedHeader.value), _defineProperty(_ref, tableBaseClass.columnFixed, isFixedColumn.value), _defineProperty(_ref, tableBaseClass.widthOverflow, isWidthOverflow.value), _defineProperty(_ref, tableBaseClass.multipleHeader, isMultipleHeader.value), _defineProperty(_ref, tableColFixedClasses.leftShadow, showColumnShadow.left), _defineProperty(_ref, tableColFixedClasses.rightShadow, showColumnShadow.right), _defineProperty(_ref, tableBaseClass.columnResizableTable, props2.resizable), _ref)];
    });
    var tableElmClasses = computed(function () {
      return [[tableLayoutClasses[props2.tableLayout]]];
    });
    var showRightDivider = computed(function () {
      return props2.bordered && isFixedHeader.value && (isMultipleHeader.value && isWidthOverflow.value || !isMultipleHeader.value);
    });
    var dividerBottom = computed(function () {
      var _bottomContentRef$val, _paginationRef$value;
      if (!props2.bordered) return 0;
      var bottomRect = (_bottomContentRef$val = bottomContentRef.value) === null || _bottomContentRef$val === void 0 ? void 0 : _bottomContentRef$val.getBoundingClientRect();
      var paginationRect = (_paginationRef$value = paginationRef.value) === null || _paginationRef$value === void 0 ? void 0 : _paginationRef$value.getBoundingClientRect();
      return ((bottomRect === null || bottomRect === void 0 ? void 0 : bottomRect.height) || 0) + ((paginationRect === null || paginationRect === void 0 ? void 0 : paginationRect.height) || 0);
    });
    var columnResizable = computed(function () {
      var _props2$allowResizeCo;
      return (_props2$allowResizeCo = props2.allowResizeColumnWidth) !== null && _props2$allowResizeCo !== void 0 ? _props2$allowResizeCo : props2.resizable;
    });
    watch(tableElmRef, function () {
      setUseFixedTableElmRef(tableElmRef.value);
    });
    watch(function () {
      return [props2.data, dataSource, isPaginateData];
    }, function () {
      setData(isPaginateData.value ? dataSource.value : props2.data);
    });
    watch(spansAndLeafNodes, function () {
      var _props2$onLeafColumns;
      (_props2$onLeafColumns = props2.onLeafColumnsChange) === null || _props2$onLeafColumns === void 0 ? void 0 : _props2$onLeafColumns.call(props2, spansAndLeafNodes.value.leafColumns);
      context.emit("LeafColumnsChange", spansAndLeafNodes.value.leafColumns);
      setEffectColMap(spansAndLeafNodes.value.leafColumns, null);
    }, {
      immediate: true
    });
    var onFixedChange = function onFixedChange() {
      nextTick(function () {
        onHorizontalScroll();
        updateAffixHeaderOrFooter();
      });
    };
    var getListener = function getListener() {
      var listener = {};
      BASE_TABLE_ALL_EVENTS.forEach(function (key) {
        listener[key] = function () {
          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
          context.emit.apply(context, [key].concat(args));
        };
      });
      return listener;
    };
    var virtualScrollParams = computed(function () {
      return {
        data: props2.data,
        scroll: props2.scroll
      };
    });
    var virtualConfig = useVirtualScroll(tableContentRef, virtualScrollParams);
    var lastScrollY = 0;
    var onInnerVirtualScroll = function onInnerVirtualScroll(e) {
      var target = e.target || e.srcElement;
      var top = target.scrollTop;
      if (lastScrollY !== top) {
        virtualConfig.isVirtualScroll.value && virtualConfig.handleScroll();
      } else {
        lastScrollY = 0;
        updateColumnFixedShadow(target);
      }
      lastScrollY = top;
      emitScrollEvent(e);
    };
    var getTFootHeight = function getTFootHeight() {
      var _tableElmRef$value$qu;
      if (!tableElmRef.value) return;
      tableFootHeight.value = (_tableElmRef$value$qu = tableElmRef.value.querySelector("tfoot")) === null || _tableElmRef$value$qu === void 0 ? void 0 : _tableElmRef$value$qu.getBoundingClientRect().height;
    };
    var scrollColumnIntoView = function scrollColumnIntoView(colKey) {
      if (!tableContentRef.value) return;
      var thDom = tableContentRef.value.querySelector("th[data-colkey=\"".concat(colKey, "\"]"));
      var fixedThDom = tableContentRef.value.querySelectorAll("th.t-table__cell--fixed-left");
      var totalWidth = 0;
      for (var i = 0, len = fixedThDom.length; i < len; i++) totalWidth += fixedThDom[i].getBoundingClientRect().width;
      var domRect = thDom.getBoundingClientRect();
      var contentRect = tableContentRef.value.getBoundingClientRect();
      var distance = domRect.left - contentRect.left - totalWidth;
      tableContentRef.value.scrollTo({
        left: distance,
        behavior: "smooth"
      });
    };
    watch(tableContentRef, function () {
      setTableContentRef(tableContentRef.value);
    });
    watch(tableElmRef, getTFootHeight);
    watch(tableRef, function (tableRef2) {
      addTableResizeObserver(tableRef2);
    });
    onMounted(function () {
      getTFootHeight();
      setTableContentRef(tableContentRef.value);
      addTableResizeObserver(tableRef.value);
    });
    return {
      virtualConfig: virtualConfig,
      scrollToElement: virtualConfig.scrollToElement,
      columnResizable: columnResizable,
      thList: thList,
      classPrefix: classPrefix,
      innerPagination: innerPagination,
      global: global,
      tableFootHeight: tableFootHeight,
      tableWidth: tableWidth,
      tableElmWidth: tableElmWidth,
      tableRef: tableRef,
      tableElmRef: tableElmRef,
      sizeClassNames: sizeClassNames,
      tableBaseClass: tableBaseClass,
      spansAndLeafNodes: spansAndLeafNodes,
      dynamicBaseTableClasses: dynamicBaseTableClasses,
      tableContentStyles: tableContentStyles,
      tableElementStyles: tableElementStyles,
      virtualScrollClasses: virtualScrollClasses,
      tableLayoutClasses: tableLayoutClasses,
      tableElmClasses: tableElmClasses,
      dividerBottom: dividerBottom,
      tableContentRef: tableContentRef,
      isFixedHeader: isFixedHeader,
      isWidthOverflow: isWidthOverflow,
      isFixedColumn: isFixedColumn,
      rowAndColFixedPosition: rowAndColFixedPosition,
      showColumnShadow: showColumnShadow,
      thWidthList: thWidthList,
      isPaginateData: isPaginateData,
      dataSource: dataSource,
      affixHeaderRef: affixHeaderRef,
      affixFooterRef: affixFooterRef,
      paginationRef: paginationRef,
      bottomContentRef: bottomContentRef,
      showAffixHeader: showAffixHeader,
      showAffixFooter: showAffixFooter,
      scrollbarWidth: scrollbarWidth,
      isMultipleHeader: isMultipleHeader,
      showRightDivider: showRightDivider,
      resizeLineRef: resizeLineRef,
      resizeLineStyle: resizeLineStyle,
      columnResizeParams: columnResizeParams,
      horizontalScrollbarRef: horizontalScrollbarRef,
      tableBodyRef: tableBodyRef,
      showAffixPagination: showAffixPagination,
      getListener: getListener,
      renderPagination: renderPagination,
      renderTNode: renderTNode,
      onFixedChange: onFixedChange,
      onHorizontalScroll: onHorizontalScroll,
      updateAffixHeaderOrFooter: updateAffixHeaderOrFooter,
      refreshTable: refreshTable,
      onInnerVirtualScroll: onInnerVirtualScroll,
      scrollColumnIntoView: scrollColumnIntoView,
      paginationAffixRef: paginationAffixRef,
      horizontalScrollAffixRef: horizontalScrollAffixRef,
      headerTopAffixRef: headerTopAffixRef,
      footerBottomAffixRef: footerBottomAffixRef,
      isIE: isIE
    };
  },
  methods: {
    renderColGroup: function renderColGroup(columns) {
      var _this = this;
      var isAffixHeader = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
      var h = this.$createElement;
      return h("colgroup", [columns.map(function (col) {
        var style = {
          width: formatCSSUnit((isAffixHeader || _this.columnResizable ? _this.thWidthList[col.colKey] : void 0) || col.width)
        };
        if (col.minWidth) style.minWidth = formatCSSUnit(col.minWidth);
        if (!style.width && !col.minWidth && _this.tableLayout === "fixed") style.minWidth = "80px";
        return h("col", {
          "key": col.colKey,
          "style": style
        });
      })]);
    },
    getHeadProps: function getHeadProps() {
      var isAffixHeader = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      var headProps = {
        isFixedHeader: this.isFixedHeader,
        showColumnShadow: this.showColumnShadow,
        thDraggable: this.thDraggable,
        rowAndColFixedPosition: this.rowAndColFixedPosition,
        isMultipleHeader: this.isMultipleHeader,
        bordered: this.bordered,
        maxHeight: this.maxHeight,
        height: this.height,
        spansAndLeafNodes: this.spansAndLeafNodes,
        thList: this.thList,
        thWidthList: isAffixHeader || this.columnResizable ? this.thWidthList : {},
        resizable: this.resizable,
        columnResizeParams: this.columnResizeParams,
        classPrefix: this.classPrefix,
        ellipsisOverlayClassName: this.size !== "medium" ? this.sizeClassNames[this.size] : "",
        attach: this.attach
      };
      return headProps;
    },
    renderFixedHeader: function renderFixedHeader(columns) {
      var _this$affixHeaderRef;
      var h = this.$createElement;
      if (!this.showHeader) return null;
      var isVirtual = this.virtualConfig.isVirtualScroll.value;
      var barWidth = this.isWidthOverflow ? this.scrollbarWidth : 0;
      var IEHeaderWrap = this.isIE ? 4 : 0;
      var affixHeaderHeight = (((_this$affixHeaderRef = this.affixHeaderRef) === null || _this$affixHeaderRef === void 0 ? void 0 : _this$affixHeaderRef.getBoundingClientRect().height) || 0) - IEHeaderWrap;
      var affixHeaderWrapHeight = affixHeaderHeight - barWidth;
      var headerOpacity = this.headerAffixedTop ? Number(this.showAffixHeader) : 1;
      var affixHeaderWrapHeightStyle = {
        width: "".concat(this.tableWidth, "px"),
        height: "".concat(affixHeaderWrapHeight, "px"),
        opacity: headerOpacity
      };
      var colgroup = this.renderColGroup(columns, true);
      var affixedLeftBorder = this.bordered && !this.isIE ? 1 : 0;
      var affixedHeader = Boolean((this.headerAffixedTop || isVirtual) && this.tableWidth) && h("div", {
        "ref": "affixHeaderRef",
        "style": {
          width: "".concat(this.tableWidth - affixedLeftBorder, "px"),
          opacity: headerOpacity
        },
        "class": ["scrollbar", _defineProperty({}, this.tableBaseClass.affixedHeaderElm, this.headerAffixedTop || isVirtual)]
      }, [h("table", {
        "class": this.tableElmClasses,
        "style": _objectSpread(_objectSpread({}, this.tableElementStyles), {}, {
          width: "".concat(this.tableElmWidth, "px")
        })
      }, [colgroup, h(THead, helper([{
        "scopedSlots": this.$scopedSlots
      }, {
        "props": this.getHeadProps(true)
      }]))])]);
      var affixHeaderWithWrap = h("div", {
        "class": this.tableBaseClass.affixedHeaderWrap,
        "style": affixHeaderWrapHeightStyle
      }, [affixedHeader]);
      return affixHeaderWithWrap;
    },
    renderAffixedFooter: function renderAffixedFooter(columns) {
      var _this$footData;
      var h = this.$createElement;
      var barWidth = this.isWidthOverflow ? this.scrollbarWidth : 0;
      var affixedLeftBorder = this.bordered && !this.isIE ? 1 : 0;
      var marginScrollbarWidth = barWidth;
      if (this.bordered) marginScrollbarWidth += 1;
      var isVirtual = this.virtualConfig.isVirtualScroll.value;
      var affixedFooter = Boolean(this.footerAffixedBottom && ((_this$footData = this.footData) === null || _this$footData === void 0 ? void 0 : _this$footData.length) && this.tableWidth) && h(Affix, helper([{
        "class": this.tableBaseClass.affixedFooterWrap,
        "on": {
          "fixedChange": this.onFixedChange
        },
        "attrs": {
          "offsetBottom": marginScrollbarWidth || 0
        }
      }, {
        "props": getAffixProps(this.footerAffixedBottom, this.footerAffixProps)
      }, {
        "style": {
          marginTop: "".concat(-1 * (this.tableFootHeight + marginScrollbarWidth), "px")
        },
        "ref": "footerBottomAffixRef"
      }]), [h("div", {
        "ref": "affixFooterRef",
        "style": {
          width: "".concat(this.tableWidth - affixedLeftBorder, "px"),
          opacity: Number(this.showAffixFooter)
        },
        "class": ["scrollbar", _defineProperty({}, this.tableBaseClass.affixedFooterElm, this.footerAffixedBottom || isVirtual)]
      }, [h("table", {
        "class": this.tableElmClasses,
        "style": _objectSpread(_objectSpread({}, this.tableElementStyles), {}, {
          width: "".concat(this.tableElmWidth, "px")
        })
      }, [this.renderColGroup(columns, true), h(TFoot, {
        "attrs": {
          "rowKey": this.rowKey,
          "isFixedHeader": this.isFixedHeader,
          "rowAndColFixedPosition": this.rowAndColFixedPosition,
          "footData": this.footData,
          "columns": columns,
          "rowAttributes": this.rowAttributes,
          "rowClassName": this.rowClassName,
          "thWidthList": this.thWidthList,
          "footerSummary": this.footerSummary,
          "rowspanAndColspanInFooter": this.rowspanAndColspanInFooter
        },
        "scopedSlots": this.$scopedSlots
      })])])]);
      return affixedFooter;
    },
    renderAffixedHeader: function renderAffixedHeader(columns) {
      var h = this.$createElement;
      if (!baseTableProps.showHeader) return null;
      return !!(this.virtualConfig.isVirtualScroll.value || this.headerAffixedTop) && (this.headerAffixedTop ? h(Affix, helper([{
        "attrs": {
          "offsetTop": 0
        }
      }, {
        "props": getAffixProps(this.headerAffixedTop, this.headerAffixProps)
      }, {
        "on": {
          "fixedChange": this.onFixedChange
        },
        "ref": "headerTopAffixRef"
      }]), [this.renderFixedHeader(columns)]) : this.isFixedHeader && this.renderFixedHeader(columns));
    }
  },
  render: function render(h) {
    var _this$spansAndLeafNod,
      _this2 = this,
      _this$tableContentRef;
    var rowAndColFixedPosition = this.rowAndColFixedPosition;
    var data = this.isPaginateData ? this.dataSource : this.data;
    var columns = ((_this$spansAndLeafNod = this.spansAndLeafNodes) === null || _this$spansAndLeafNod === void 0 ? void 0 : _this$spansAndLeafNod.leafColumns) || this.columns;
    if (this.allowResizeColumnWidth) log.warn("Table", "allowResizeColumnWidth is going to be deprecated, please use resizable instead.");
    var translate = "translate(0, ".concat(this.virtualConfig.scrollHeight.value, "px)");
    var virtualStyle = {
      "transform": translate,
      "-ms-transform": translate,
      "-moz-transform": translate,
      "-webkit-transform": translate
    };
    var tableBodyProps = _objectSpread(_objectSpread({
      rowAndColFixedPosition: rowAndColFixedPosition,
      showColumnShadow: this.showColumnShadow,
      thDraggable: this.thDraggable,
      data: this.virtualConfig.isVirtualScroll.value ? this.virtualConfig.visibleData.value : data,
      virtualConfig: this.virtualConfig,
      columns: columns,
      tableElm: this.tableRef,
      tableContentElm: this.tableContentRef,
      tableWidth: this.tableWidth,
      isWidthOverflow: this.isWidthOverflow,
      scroll: this.scroll,
      cellEmptyContent: this.cellEmptyContent,
      classPrefix: this.classPrefix,
      handleRowMounted: this.virtualConfig.handleRowMounted,
      renderExpandedRow: this.renderExpandedRow
    }, pick(this.$props, extendTableProps)), {}, {
      pagination: this.innerPagination,
      attach: this.attach
    });
    var tBodyListener = this.getListener();
    var tableContent = h("div", helper([{
      "ref": "tableContentRef",
      "class": this.tableBaseClass.content,
      "style": this.tableContentStyles
    }, {
      "on": {
        scroll: this.onInnerVirtualScroll
      }
    }]), [this.virtualConfig.isVirtualScroll.value && h("div", {
      "class": this.virtualScrollClasses.cursor,
      "style": virtualStyle
    }), h("table", {
      "ref": "tableElmRef",
      "class": this.tableElmClasses,
      "style": _objectSpread(_objectSpread({}, this.tableElementStyles), {}, {
        width: this.resizable && this.isWidthOverflow && this.tableElmWidth ? "".concat(this.tableElmWidth, "px") : this.tableElementStyles.width
      })
    }, [this.renderColGroup(columns, false), this.showHeader && h(THead, helper([{
      "scopedSlots": this.$scopedSlots
    }, {
      "props": this.getHeadProps(false)
    }])), h(TBody, helper([{
      "ref": "tableBodyRef",
      "scopedSlots": this.$scopedSlots
    }, {
      "props": tableBodyProps
    }, {}, {
      "on": tBodyListener
    }])), h(TFoot, {
      "attrs": {
        "rowKey": this.rowKey,
        "isFixedHeader": this.isFixedHeader,
        "rowAndColFixedPosition": rowAndColFixedPosition,
        "footData": this.footData,
        "columns": columns,
        "rowAttributes": this.rowAttributes,
        "rowClassName": this.rowClassName,
        "footerSummary": this.footerSummary,
        "rowspanAndColspanInFooter": this.rowspanAndColspanInFooter
      },
      "scopedSlots": this.$scopedSlots
    })])]);
    var customLoadingText = this.renderTNode("loading");
    var loadingContent = this.loading !== void 0 && h(Loading, helper([{
      "attrs": {
        "loading": !!this.loading,
        "text": customLoadingText ? function () {
          return customLoadingText;
        } : void 0,
        "attach": this.tableRef ? function () {
          return _this2.tableRef;
        } : void 0,
        "showOverlay": true
      }
    }, {
      "props": _objectSpread({
        size: "small"
      }, this.loadingProps)
    }]));
    var topContent = this.renderTNode("topContent");
    var bottomContent = this.renderTNode("bottomContent");
    var pagination = h("div", {
      "ref": "paginationRef",
      "class": this.tableBaseClass.paginationWrap,
      "style": {
        opacity: Number(this.showAffixPagination)
      }
    }, [this.renderPagination(h)]);
    var bottom = !!bottomContent && h("div", {
      "ref": "bottomContentRef",
      "class": this.tableBaseClass.bottomContent
    }, [bottomContent]);
    return h("div", {
      "ref": "tableRef",
      "class": this.dynamicBaseTableClasses,
      "style": "position: relative"
    }, [!!topContent && h("div", {
      "class": this.tableBaseClass.topContent
    }, [topContent]), this.renderAffixedHeader(columns), tableContent, this.renderAffixedFooter(columns), loadingContent, bottom, this.showRightDivider && h("div", {
      "class": this.tableBaseClass.scrollbarDivider,
      "style": {
        right: "".concat(this.scrollbarWidth, "px"),
        bottom: this.dividerBottom ? "".concat(this.dividerBottom, "px") : void 0,
        height: "".concat((_this$tableContentRef = this.tableContentRef) === null || _this$tableContentRef === void 0 ? void 0 : _this$tableContentRef.getBoundingClientRect().height, "px")
      }
    }), this.horizontalScrollAffixedBottom && h(Affix, helper([{
      "attrs": {
        "offsetBottom": 0
      }
    }, {
      "props": getAffixProps(this.horizontalScrollAffixedBottom)
    }, {
      "style": this.showAffixFooter ? {
        marginTop: "-".concat(this.scrollbarWidth * 2, "px")
      } : {
        "float": "right",
        visibility: "hidden"
      },
      "ref": "horizontalScrollAffixRef"
    }]), [h("div", {
      "ref": "horizontalScrollbarRef",
      "class": ["scrollbar", this.tableBaseClass.obviousScrollbar],
      "style": {
        width: "".concat(this.tableWidth, "px"),
        overflow: "auto",
        opacity: Number(this.showAffixFooter)
      }
    }, [h("div", {
      "style": {
        width: "".concat(this.tableElmWidth, "px"),
        height: "5px"
      }
    })])]), this.paginationAffixedBottom ? h(Affix, helper([{
      "attrs": {
        "offsetBottom": 0
      }
    }, {
      "props": getAffixProps(this.paginationAffixedBottom)
    }, {
      "ref": "paginationAffixRef"
    }]), [pagination]) : pagination, h("div", {
      "ref": "resizeLineRef",
      "class": this.tableBaseClass.resizeLine,
      "style": this.resizeLineStyle
    })]);
  }
});

export { BASE_TABLE_ALL_EVENTS, BASE_TABLE_EVENTS, _BaseTable as default };
//# sourceMappingURL=base-table.js.map
