import { __assign, __extends, __rest } from "tslib";
import React, { Component } from 'react';
import Table from './table';
import AsyncTable from './asynctable';
var LPTable = /** @class */ (function (_super) {
    __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 = React.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 = __rest(_a, ["fetchData", "extraFilter"]);
        if (fetchData) {
            return React.createElement(AsyncTable, __assign({}, this.props, { ref: this.tableRef }));
        }
        return React.createElement(Table, __assign({}, rest));
    };
    return LPTable;
}(Component));
export default LPTable;
