"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

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

var _tslib = require("tslib");

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

var _table = _interopRequireDefault(require("./table"));

var _asynctable = _interopRequireDefault(require("./asynctable"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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 LPTable =
/** @class */
function (_super) {
  (0, _tslib.__extends)(LPTable, _super);

  function LPTable(props) {
    var _this = _super.call(this, props) || this;

    _this.getData = function (param) {
      _this.tableRef.current && _this.tableRef.current.getData(param);
    };

    _this.reset = function () {
      _this.tableRef.current && _this.tableRef.current.reset();
    };

    _this.tableRef = /*#__PURE__*/_react["default"].createRef();
    _this.getData = _this.getData.bind(_this);
    _this.reset = _this.reset.bind(_this);
    return _this;
  }

  LPTable.prototype.render = function () {
    var _a = this.props,
        fetchData = _a.fetchData,
        extraFilter = _a.extraFilter,
        rest = (0, _tslib.__rest)(_a, ["fetchData", "extraFilter"]);

    if (fetchData) {
      return /*#__PURE__*/_react["default"].createElement(_asynctable["default"], (0, _tslib.__assign)({}, this.props, {
        ref: this.tableRef
      }));
    }

    return /*#__PURE__*/_react["default"].createElement(_table["default"], (0, _tslib.__assign)({}, rest));
  };

  return LPTable;
}(_react.Component);

var _default = LPTable;
exports["default"] = _default;