import _extends from "@babel/runtime/helpers/extends";
import React, { useContext } from 'react';
import { observer } from 'mobx-react-lite';
import { Droppable } from 'react-beautiful-dnd';
import TableContext from '../../TableContext';

var Tree = function Tree(props) {
  var children = props.children,
      value = props.value;

  var _useContext = useContext(TableContext),
      prefixCls = _useContext.prefixCls,
      _useContext$columnsDr = _useContext.columnsDragRender,
      columnsDragRender = _useContext$columnsDr === void 0 ? {} : _useContext$columnsDr,
      columnDraggable = _useContext.tableStore.columnDraggable;

  var droppableProps = columnsDragRender.droppableProps,
      renderClone = columnsDragRender.renderClone;
  return columnDraggable ? /*#__PURE__*/React.createElement(Droppable, _extends({
    droppableId: "tree__--__".concat(value),
    key: "tree",
    renderClone: renderClone ? function (provided, snapshot, rubric) {
      return renderClone({
        provided: provided,
        snapshot: snapshot,
        rubric: rubric
      });
    } : undefined
  }, droppableProps), function (droppableProvided) {
    return /*#__PURE__*/React.createElement("div", _extends({
      ref: droppableProvided.innerRef,
      className: "".concat(prefixCls, "-customization-tree")
    }, droppableProvided && droppableProvided.droppableProps), children, droppableProvided && droppableProvided.placeholder);
  }) : /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefixCls, "-customization-tree")
  }, children);
};

Tree.displayName = 'Tree';
export default observer(Tree);
//# sourceMappingURL=Tree.js.map
