"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _eventTypes = require("../../../../constants/event-types");
var _menusConfig = require("../../../constants/menus-config");
var _elementTypes = require("../../../constants/element-types");
var _eventBus = _interopRequireDefault(require("../../../../utils/event-bus"));
var _dropdownMenuItem = _interopRequireDefault(require("../../../commons/dropdown-menu-item"));
const menuConfig = _menusConfig.MENUS_CONFIG_MAP[_elementTypes.FORMULA];
const FormulaMenu = _ref => {
  let {
    readonly,
    toggle
  } = _ref;
  const OpenFormulaModal = () => {
    toggle && toggle();
    const eventBus = _eventBus.default.getInstance();
    eventBus.dispatch(_eventTypes.INTERNAL_EVENTS.INSERT_ELEMENT, {
      type: _elementTypes.FORMULA
    });
  };
  return /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
    disabled: readonly,
    menuConfig: menuConfig,
    className: "pr-2",
    onClick: OpenFormulaModal
  });
};
var _default = exports.default = FormulaMenu;