"use strict";

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

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

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

var _tree = _interopRequireDefault(require("../../../tree"));

var _treeNode = _interopRequireDefault(require("./tree-node"));

var _index = require("./tree-node/index");

var _precls = _interopRequireDefault(require("./precls"));

require("./index.css");

var _excluded = ["data", "onSelect", "loadData", "selectedKeys", "onExpand"];

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

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function _default(props) {
  var data = props.data,
      onSelect = props.onSelect,
      loadData = props.loadData,
      selectedKeys = props.selectedKeys,
      onExpand = props.onExpand,
      restProps = _objectWithoutProperties(props, _excluded);

  var beforeSelectHandler = function beforeSelectHandler(node) {
    if (node.nodeType == _index.GROUP_NAME_NODE) return false;
    if (node.nodeType == _index.LOADING_NODE) return false;
    if (node.nodeType == _index.NO_FOLLOWER_NODE) return false; // if (node.nodeType == COMPANY_ALL_NODE) return false;

    return true;
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "-warpper"))
  }, /*#__PURE__*/_react["default"].createElement(_tree["default"], _extends({
    treeData: data,
    draggable: false,
    selectNodeHighlight: false,
    selectedKeys: selectedKeys,
    onExpand: onExpand,
    titleRender: _treeNode["default"],
    className: _precls["default"],
    loadData: loadData,
    onSelect: onSelect,
    switcherIcon: false,
    beforeSelect: beforeSelectHandler
  }, restProps)));
}