/**
 * tdesign v0.32.0
 * (c) 2021 tdesign
 * @license MIT
 */

import { h as helper } from '../../_chunks/dep-42d5c87e.js';
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import baseTableProps from '../base-table-props.js';
import primaryTableProps from '../primary-table-props.js';
import _BaseTable from '../base-table/index.js';
import mixins from '../../utils/mixins.js';
import expand from './mixins/expand.js';
import select from './mixins/select.js';
import sort from './mixins/sort.js';
import rowDraggable from './mixins/row-draggable.js';
import filter from './mixins/filter.js';
import showColumns from './mixins/show-columns.js';
import asyncLoadingMixin from './mixins/async-loading.js';
import { emitEvent } from '../../utils/event.js';
import 'lodash/throttle';
import '../../config-provider/config-receiver.js';
import 'vue';
import '../../config-provider/zh_CN_config.js';
import '../../config-provider/type.js';
import '../../config.js';
import '../util/props-util.js';
import '../base-table/table-body.js';
import 'lodash/get';
import '../base-table/table-row.js';
import '../base-table/table-cell.js';
import '../../popup/index.js';
import '../../popup/popup.js';
import '@babel/runtime/helpers/typeof';
import '@popperjs/core';
import '../../_chunks/dep-1db5c91c.js';
import '../../utils/classnames.js';
import '../../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../../utils/easing.js';
import '../../popup/props.js';
import '../../utils/render-tnode.js';
import '../../utils/set-style.js';
import '../../utils/map-props.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '../../utils/withInstall.js';
import 'lodash/capitalize';
import './style/css.js';
import '../../popup/type.js';
import '../util/common.js';
import 'lodash/isFunction';
import '../base-table/table-header.js';
import '../base-table/col-group.js';
import '../../pagination/index.js';
import '../../pagination/pagination.js';
import 'tdesign-icons-vue';
import '../../input-number/index.js';
import '../../input-number/input-number.js';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/regenerator';
import '../../button/index.js';
import '../../button/button.js';
import '../../loading/index.js';
import '../../loading/loading.js';
import '../../loading/icon/gradient.js';
import '../../utils/transfer-dom.js';
import '../../loading/props.js';
import '../../loading/type.js';
import '../../loading/plugin.js';
import '../../button/props.js';
import '../../utils/ripple.js';
import '../../button/type.js';
import '../../input-number/props.js';
import '../../input-number/type.js';
import '../../utils/helper.js';
import '@babel/runtime/helpers/slicedToArray';
import 'lodash/camelCase';
import '../../select/index.js';
import '../../select/select.js';
import 'lodash/debounce';
import 'lodash/set';
import '../../input/index.js';
import '../../input/addon.js';
import '../../input/input.js';
import '../../input/props.js';
import '../../input/input-group.js';
import '../../input/type.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/type.js';
import '../../common-components/fake-arrow.js';
import '../../select/option.js';
import '../../select/option-props.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/type.js';
import '../../select/props.js';
import '../../select/optionGroup.js';
import '../../select/option-group-props.js';
import '../../select/type.js';
import '../../pagination/props.js';
import '../../pagination/type.js';
import '../util/interface.js';
import './expand-box.js';
import './select-box.js';
import '../../radio/index.js';
import '../../radio/radio.js';
import '../../radio/props.js';
import '../../radio/group.js';
import 'lodash/isNumber';
import '../../radio/radio-group-props.js';
import '../../radio/radio-button.js';
import '../../radio/type.js';
import './sorter-button.js';
import '../../tooltip/index.js';
import '../../tooltip/tooltip.js';
import '../../tooltip/props.js';
import '../../tooltip/type.js';
import '../../dialog/index.js';
import '../../dialog/dialog.js';
import '../../dialog/actions.js';
import 'lodash/isObject';
import '../../dialog/props.js';
import '../../dialog/type.js';
import '../../dialog/plugin.js';

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 _PrimaryTable = mixins(expand, select, sort, rowDraggable, filter, showColumns, asyncLoadingMixin).extend({
  name: "TTable",
  props: _objectSpread(_objectSpread({}, baseTableProps), primaryTableProps),
  computed: {
    rehandleData: function rehandleData() {
      return this.asyncLoadingHandler(_toConsumableArray(this.data));
    },
    rehandleColumns: function rehandleColumns() {
      var columns = this.columns.map(function (col) {
        return _objectSpread({}, col);
      });
      columns = this.getShowColumns(_toConsumableArray(this.columns));
      columns = this.getSorterColumns(columns);
      columns = this.getFilterColumns(columns);
      columns = this.getSelectColumns(columns);
      columns = this.getExpandColumns(columns);
      return columns;
    }
  },
  created: function created() {
    if (typeof this.$attrs["expanded-row-render"] !== "undefined") {
      console.warn("The expandedRowRender prop is deprecated. Use expandedRow instead.");
    }
  },
  methods: {
    renderRows: function renderRows(params) {
      var row = params.row,
          rowIndex = params.rowIndex,
          rows = params.rows;

      if (row.colKey === "async-loading-row") {
        rows.splice(rowIndex, 1, this.renderAsyncLoadingRow());
        return;
      }

      this.renderExpandedRow(params);
    }
  },
  render: function render() {
    var _this = this;

    var h = arguments[0];
    var $props = this.$props,
        $scopedSlots = this.$scopedSlots,
        rehandleColumns = this.rehandleColumns;

    var scopedSlots = _objectSpread({}, $scopedSlots);

    var on = _objectSpread(_objectSpread({}, this.$listeners), {}, {
      "page-change": function pageChange(pageInfo, newDataSource) {
        emitEvent(_this, "page-change", pageInfo, newDataSource);
        emitEvent(_this, "change", {
          pagination: pageInfo
        }, {
          trigger: "pagination",
          currentData: newDataSource
        });
      },
      "row-dragstart": this.onDragStart,
      "row-dragover": this.onDragOver
    });

    if (this.expandOnRowClick) {
      on["row-click"] = function (params) {
        _this.handleExpandChange(params.row);
      };
    }

    var baseTableProps2 = {
      props: _objectSpread(_objectSpread({}, $props), {}, {
        data: this.rehandleData,
        columns: rehandleColumns,
        provider: {
          renderRows: this.renderRows,
          sortOnRowDraggable: this.sortOnRowDraggable,
          dragging: this.dragging
        },
        firstFullRow: this.hasFilterCondition ? this.renderFirstFilterRow : void 0,
        empty: this.empty
      }),
      scopedSlots: scopedSlots,
      on: on
    };

    if (this.hasFilterCondition) {
      baseTableProps2.props.empty = null;
    }

    return h(_BaseTable, helper([{}, baseTableProps2]));
  }
});

export { _PrimaryTable as default };
//# sourceMappingURL=index.js.map
