"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var React = _interopRequireWildcard(require("react"));
var _positionList = _interopRequireDefault(require("./position-list"));
var _positionLeft = _interopRequireDefault(require("./position-left"));
var _excluded = ["itemArray", "defaultLocation", "__designMode"];
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var Navigation = function BottomNavigation(_ref) {
  var itemArray = _ref.itemArray,
    defaultLocation = _ref.defaultLocation,
    __designMode = _ref.__designMode,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  var _React$useState = React.useState(defaultLocation),
    current = _React$useState[0],
    _setCurrent = _React$useState[1];
  var _React$useState2 = React.useState(false),
    isOpen = _React$useState2[0],
    setIsOpen = _React$useState2[1];
  var openList = function openList() {
    if (__designMode == 'design') {
      // 设计态不打开列表
      return;
    }
    setIsOpen(!isOpen);
  };
  // React.useEffect(() => {
  //   console.log('defaultLocation', defaultLocation)
  //   if (defaultLocation) {
  //     setCurrent(defaultLocation)
  //   }
  // })
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_positionLeft["default"], (0, _extends2["default"])({
    currentLocation: current
  }, otherProps, {
    clickHandle: function clickHandle() {
      return openList();
    }
  })), /*#__PURE__*/React.createElement(_positionList["default"], {
    open: isOpen,
    currentLocation: current,
    itemArray: itemArray,
    setIsOpen: openList,
    setCurrent: function setCurrent(value) {
      return _setCurrent(value);
    }
  }));
};
var _default = exports["default"] = Navigation;