"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.RowOperationDropDownList = exports.RemoveTableMenu = exports.ColumnOperationDropDownList = exports.AlignmentDropDown = void 0;
var _react = _interopRequireWildcard(require("react"));
var _menuDropDown = _interopRequireDefault(require("../../../commons/menu/menu-drop-down"));
var _constants = require("../../../constants");
var _menuItem = _interopRequireDefault(require("../../../commons/menu/menu-item"));
var _tableOperations = require("../table-operations");
const AlignmentDropDown = _ref => {
  let {
    editor,
    readonly
  } = _ref;
  const alignmentOperationDropDownList = (0, _react.useMemo)(() => [{
    ..._constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_ALIGN_LEFT],
    handleClick: item => (0, _tableOperations.changeColumnAlign)(editor, _constants.TEXT_ALIGN.LEFT)
  }, {
    ..._constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_ALIGN_CENTER],
    handleClick: item => (0, _tableOperations.changeColumnAlign)(editor, _constants.TEXT_ALIGN.CENTER)
  }, {
    ..._constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_ALIGN_RIGHT],
    handleClick: item => (0, _tableOperations.changeColumnAlign)(editor, _constants.TEXT_ALIGN.RIGHT)
  }], [editor]);
  return /*#__PURE__*/_react.default.createElement(_menuDropDown.default, Object.assign({
    editor: editor,
    readonly: readonly,
    isDisabled: false,
    dropDownList: alignmentOperationDropDownList,
    isShowListItemIcon: true
  }, _constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_ALIGN_LEFT]));
};
exports.AlignmentDropDown = AlignmentDropDown;
const ColumnOperationDropDownList = _ref2 => {
  let {
    editor,
    readonly
  } = _ref2;
  const columnOperationDropDownList = (0, _react.useMemo)(() => [{
    ..._constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_INSERT_COLUMN],
    handleClick: item => (0, _tableOperations.insertColumn)(editor)
  }, {
    ..._constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_DELETE_COLUMN],
    handleClick: item => (0, _tableOperations.removeColumn)(editor)
  }], [editor]);
  return /*#__PURE__*/_react.default.createElement(_menuDropDown.default, Object.assign({
    editor: editor,
    readonly: readonly,
    isDisabled: false,
    dropDownList: columnOperationDropDownList
  }, _constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_INSERT_COLUMN]));
};
exports.ColumnOperationDropDownList = ColumnOperationDropDownList;
const RowOperationDropDownList = _ref3 => {
  let {
    editor,
    readonly
  } = _ref3;
  const rowOperationDropDownList = (0, _react.useMemo)(() => [{
    ..._constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_INSERT_ROW],
    handleClick: item => (0, _tableOperations.insertRow)(editor)
  }, {
    ..._constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_DELETE_ROW],
    handleClick: item => (0, _tableOperations.removeRow)(editor)
  }], [editor]);
  return /*#__PURE__*/_react.default.createElement(_menuDropDown.default, Object.assign({
    editor: editor,
    readonly: readonly,
    isDisabled: false,
    dropDownList: rowOperationDropDownList
  }, _constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_INSERT_ROW]));
};
exports.RowOperationDropDownList = RowOperationDropDownList;
const RemoveTableMenu = _ref4 => {
  let {
    editor,
    readonly,
    className,
    isRichEditor
  } = _ref4;
  return /*#__PURE__*/_react.default.createElement(_menuItem.default, Object.assign({
    isRichEditor: isRichEditor,
    className: className,
    disabled: false,
    isActive: false,
    onMouseDown: () => (0, _tableOperations.removeTable)(editor),
    editor: editor
  }, _constants.MENUS_CONFIG_MAP[_constants.TABLE_SUBMENU_MAP.TABLE_DELETE_TABLE]));
};
exports.RemoveTableMenu = RemoveTableMenu;