import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
var _excluded = ["content", "render", "level"];

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

import React from 'react';
import PropTypes from 'prop-types';
import { isFunction } from '../util/isType';
/**
 * @ignore
 * */

var TD = /*#__PURE__*/function (_React$Component) {
  _inherits(TD, _React$Component);

  var _super = _createSuper(TD);

  function TD() {
    var _this;

    _classCallCheck(this, TD);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _super.call.apply(_super, [this].concat(args));

    _defineProperty(_assertThisInitialized(_this), "levelRender", function (level) {
      if (!level) return '';
      var result = [];

      for (var i = 0; i < level; i++) {
        result.push( /*#__PURE__*/React.createElement("div", {
          style: {
            "width": "50px",
            "height": "2px",
            "float": "left"
          }
        }));
      }

      return result;
    });

    return _this;
  }

  _createClass(TD, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          content = _this$props.content,
          render = _this$props.render,
          level = _this$props.level,
          other = _objectWithoutProperties(_this$props, _excluded);

      return /*#__PURE__*/React.createElement("td", other, this.levelRender(level), isFunction(render) ? render(content) : content);
    }
  }]);

  return TD;
}(React.Component);

_defineProperty(TD, "defaultProps", {});

_defineProperty(TD, "propTypes", {
  content: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array, PropTypes.bool, PropTypes.object]),
  render: PropTypes.func
});

export default TD;