"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

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

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

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

var _iconButtonList = _interopRequireDefault(require("../../../../../components/icon-button-list"));

var _switch = _interopRequireDefault(require("../../../../../components/switch"));

var _getLocale = require("../../../../../utils/getLocale");

var _popup = _interopRequireDefault(require("../../../../../components/popup"));

var _toast = _interopRequireDefault(require("../../../../../components/toast"));

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

require("./index.css");

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

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _default(props) {
  var setDarkTheme = props.setDarkTheme,
      darkTheme = props.darkTheme,
      showkr = props.showkr,
      showCardKr = props.showCardKr,
      setShowCardKr = props.setShowCardKr,
      setShowKr = props.setShowKr,
      setDirection = props.setDirection,
      onBtnClick = props.onBtnClick,
      direction = props.direction;
  var period = {};
  var iconButtons = [{
    icon: 'daochu',
    overlay: (0, _getLocale.getLocale)('Mod_Export'),
    type: 'export'
  }, {
    icon: direction == 'horizontal' ? 'yangshi-ditu' : 'yangshi-ditu',
    overlay: direction == 'horizontal' ? "".concat((0, _getLocale.getLocale)('OKR_Ali_Butt_Toggleportrait')) : "".concat((0, _getLocale.getLocale)('OKR_Ali_Butt_Togglelandscape')),
    placement: 'topRight',
    rotate: direction == 'horizontal' ? 0 : -90,
    type: direction == 'horizontal' ? 'vertical' : 'horizontal'
  }]; // 获取地图数据

  (0, _react.useEffect)(function () {// ...
  }, []);

  var onhandleShowCardKr = function onhandleShowCardKr(checked) {
    if (showkr && checked) {
      setShowKr(false);

      _toast["default"].Warning('仅允许开启一项');
    }

    setShowCardKr(checked);
  };

  var onConfirmHandler = function onConfirmHandler(checked) {
    if (showCardKr && checked) {
      setShowCardKr(false);

      _toast["default"].Warning('仅允许开启一项');
    }

    setShowKr(checked);
  };

  var popup = function popup() {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: (0, _classnames["default"])("".concat(_precls["default"], "__show-more-popup"))
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: (0, _classnames["default"])("".concat(_precls["default"], "__header-action-showkr"))
    }, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
      label: (0, _getLocale.getLocale)('OKR_Db_KRDetails'),
      checked: showCardKr,
      onChange: onhandleShowCardKr
    })), /*#__PURE__*/_react["default"].createElement("div", {
      className: (0, _classnames["default"])("".concat(_precls["default"], "__header-action-showkr"))
    }, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
      label: (0, _getLocale.getLocale)('OKR_Ali_Butt_ExhibitionKRs'),
      checked: showkr,
      onChange: onConfirmHandler
    })));
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "-share-okr__header"))
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "-share-okr__header-title"))
  }, (0, _getLocale.getLocale)('OKR_Menu_Title_Alignment')), /*#__PURE__*/_react["default"].createElement(_popup["default"], {
    popup: popup
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "-share-okr__header-showMore"))
  }, (0, _getLocale.getLocale)('OKR_Ali_Butt_Exhibitionmore'))), /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(_precls["default"], "-share-okr__header-direction"))
  }, /*#__PURE__*/_react["default"].createElement(_iconButtonList["default"], {
    items: iconButtons,
    onClick: function onClick(e, iconType) {
      return onBtnClick(iconType);
    }
  })));
}