"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));

var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));

var _react = _interopRequireDefault(require("react"));

var _base = require("../../base");

var _buildCrossTable2 = _interopRequireDefault(require("./buildCrossTable"));

var _constants = require("./constants");

var __rest = void 0 && (void 0).__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 _getOwnPropertySymbols.default === "function") for (var i = 0, p = (0, _getOwnPropertySymbols.default)(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;
};

var CrossTable = function CrossTable(_a) {
  var _a$BaseTableComponent = _a.BaseTableComponent,
      BaseTableComponent = _a$BaseTableComponent === void 0 ? _base.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 = (0, _buildCrossTable2.default)({
    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.default.createElement(BaseTableComponent, (0, _extends2.default)({
    ref: baseTableRef
  }, others, {
    primaryKey: _constants.ROW_KEY,
    dataSource: dataSource,
    columns: columns
  }));
};

exports.default = CrossTable;