import _extends from "@babel/runtime-corejs3/helpers/extends";
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";

var __rest = this && this.__rest || function (s, e) {
  var t = {};

  for (var p in s) {
    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
  }

  if (s != null && typeof _Object$getOwnPropertySymbols === "function") for (var i = 0, p = _Object$getOwnPropertySymbols(s); i < p.length; i++) {
    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  }
  return t;
};

import React from 'react';
import { Table } from '../../base';
import buildCrossTable from './buildCrossTable';
import { ROW_KEY } from './constants';
export default (function CrossTable(_a) {
  var _a$BaseTableComponent = _a.BaseTableComponent,
      BaseTableComponent = _a$BaseTableComponent === void 0 ? Table : _a$BaseTableComponent,
      leftTree = _a.leftTree,
      leftTotalNode = _a.leftTotalNode,
      topTree = _a.topTree,
      topTotalNode = _a.topTotalNode,
      getValue = _a.getValue,
      getCellProps = _a.getCellProps,
      leftMetaColumns = _a.leftMetaColumns,
      render = _a.render,
      baseTableRef = _a.baseTableRef,
      others = __rest(_a, ["BaseTableComponent", "leftTree", "leftTotalNode", "topTree", "topTotalNode", "getValue", "getCellProps", "leftMetaColumns", "render", "baseTableRef"]);

  var _buildCrossTable = buildCrossTable({
    leftTree: leftTree,
    topTree: topTree,
    leftTotalNode: leftTotalNode,
    topTotalNode: topTotalNode,
    getValue: getValue,
    getCellProps: getCellProps,
    render: render,
    leftMetaColumns: leftMetaColumns
  }),
      dataSource = _buildCrossTable.dataSource,
      columns = _buildCrossTable.columns;

  return /*#__PURE__*/React.createElement(BaseTableComponent, _extends({
    ref: baseTableRef
  }, others, {
    primaryKey: ROW_KEY,
    dataSource: dataSource,
    columns: columns
  }));
});