"use strict";

var _typeof = require("@babel/runtime-corejs3/helpers/typeof");

var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");

var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");

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

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

var _classnames = _interopRequireDefault(require("classnames"));

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

var _colgroup = require("./colgroup");

var _styles = require("./styles");

function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var DefaultEmptyContent = /*#__PURE__*/_react.default.memo(function () {
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("img", {
    alt: "empty-image",
    className: "empty-image",
    src: "//img.alicdn.com/tfs/TB1l1LcM3HqK1RjSZJnXXbNLpXa-50-50.svg"
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: "empty-tips"
  }, "\u6CA1\u6709\u7B26\u5408\u67E5\u8BE2\u6761\u4EF6\u7684\u6570\u636E", /*#__PURE__*/_react.default.createElement("br", null), "\u8BF7\u4FEE\u6539\u6761\u4EF6\u540E\u91CD\u65B0\u67E5\u8BE2"));
});

function EmptyHtmlTable(_ref) {
  var descriptors = _ref.descriptors,
      isLoading = _ref.isLoading,
      emptyCellHeight = _ref.emptyCellHeight,
      _ref$EmptyContent = _ref.EmptyContent,
      EmptyContent = _ref$EmptyContent === void 0 ? DefaultEmptyContent : _ref$EmptyContent;
  var show = !isLoading;
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("table", {
    key: "table"
  }, /*#__PURE__*/_react.default.createElement(_colgroup.Colgroup, {
    descriptors: descriptors
  }), /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", {
    className: (0, _classnames.default)(_styles.Classes.tableRow, _styles.Classes.first, _styles.Classes.last, 'no-hover'),
    "data-rowindex": 0
  }, /*#__PURE__*/_react.default.createElement("td", {
    className: (0, _classnames.default)(_styles.Classes.tableCell, _styles.Classes.first, _styles.Classes.last),
    colSpan: descriptors.length,
    style: {
      height: emptyCellHeight !== null && emptyCellHeight !== void 0 ? emptyCellHeight : 200
    }
  })))), show && /*#__PURE__*/_react.default.createElement("div", {
    className: _styles.Classes.emptyWrapper,
    key: "empty"
  }, /*#__PURE__*/_react.default.createElement(EmptyContent, null)));
}