"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"] = void 0;

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

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

var _Button = _interopRequireDefault(require("../../../common/Button"));

var _Iconfont = _interopRequireDefault(require("../../../common/Iconfont"));

var _constants = require("../../../constants");

require("./index.less");

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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var __extends = void 0 && (void 0).__extends || function () {
  var _extendStatics = function extendStatics(d, b) {
    _extendStatics = Object.setPrototypeOf || {
      __proto__: []
    } instanceof Array && function (d, b) {
      d.__proto__ = b;
    } || function (d, b) {
      for (var p in b) {
        if (b.hasOwnProperty(p)) d[p] = b[p];
      }
    };

    return _extendStatics(d, b);
  };

  return function (d, b) {
    _extendStatics(d, b);

    function __() {
      this.constructor = d;
    }

    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  };
}();

var langBook = {
  Indonesian: {
    text: 'Indonesian',
    color: '#FF8541',
    backColor: '#FFF8F0'
  },
  English: {
    text: 'English',
    color: '#00AC5A',
    backColor: '#DFF3EA'
  }
};

var QuickMenuBar =
/** @class */
function (_super) {
  __extends(QuickMenuBar, _super);

  function QuickMenuBar() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this.onBtnClick = function (event) {
      var code = event.currentTarget.dataset.code;

      if (_this.props.device === _constants.deviceTypeMap.PC) {}

      _this.props.onBtnClick(code);
    };

    return _this;
  }

  QuickMenuBar.prototype.render = function () {
    var _a = this.props,
        device = _a.device,
        undoDisable = _a.undoDisable,
        redoDisable = _a.redoDisable,
        language = _a.language;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "quick_menu_wrap"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "menu_left"
    }, /*#__PURE__*/_react["default"].createElement("span", {
      className: "language",
      style: {
        color: langBook[language].color,
        background: langBook[language].backColor
      }
    }, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
      size: "20px",
      style: {
        marginRight: '8px'
      },
      type: "icon-language"
    }), langBook[language].text)), /*#__PURE__*/_react["default"].createElement("div", {
      className: "menu_center"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "device_group"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: (0, _classnames["default"])('device_pc', {
        active: device === _constants.deviceTypeMap.PC
      }),
      "data-code": _constants.quickMenuCode.MODE_PC,
      onClick: this.onBtnClick
    }, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
      color: device === _constants.deviceTypeMap.PC ? '#2F54EB' : '',
      size: "20px",
      type: "icon-pc"
    })), /*#__PURE__*/_react["default"].createElement("div", {
      className: (0, _classnames["default"])('device_phone', {
        active: device === _constants.deviceTypeMap.PHONE
      }),
      "data-code": _constants.quickMenuCode.MODE_PHONE,
      onClick: this.onBtnClick
    }, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
      color: device === _constants.deviceTypeMap.PHONE ? '#2F54EB' : '',
      size: "20px",
      type: "icon-mobile"
    }))), /*#__PURE__*/_react["default"].createElement("div", {
      className: "redo_undo"
    }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
      "data-code": _constants.quickMenuCode.UNDO,
      disabled: undoDisable,
      icon: "icon-back",
      onClick: this.onBtnClick,
      type: "icon"
    }), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
      "data-code": _constants.quickMenuCode.REDO,
      disabled: redoDisable,
      icon: "icon-next",
      onClick: this.onBtnClick,
      type: "icon"
    }))), /*#__PURE__*/_react["default"].createElement("div", {
      className: "menu_right"
    }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
      "data-code": _constants.quickMenuCode.PREVIEW,
      onClick: this.onBtnClick
    }, "Preview"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
      "data-code": _constants.quickMenuCode.SAVE,
      disabled: window.magicDesign.readOnly,
      onClick: this.onBtnClick,
      tip: "The page is in use. Please copy or create a new page",
      type: "light"
    }, "Save"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
      "data-code": _constants.quickMenuCode.PUBLISH,
      disabled: window.magicDesign.readOnly,
      onClick: this.onBtnClick,
      tip: "The page is in use. Please copy or create a new page",
      type: "primary"
    }, "Publish")));
  };

  return QuickMenuBar;
}(_react.Component);

var _default = QuickMenuBar;
exports["default"] = _default;
QuickMenuBar.defaultProps = {
  deviceType: _constants.deviceTypeMap.PC,
  onBtnClick: function onBtnClick(code) {
    console.log(code);
  }
};