UNPKG

@atlaskit/editor-plugin-table

Version:

Table plugin for the @atlaskit/editor

151 lines (150 loc) 5.86 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.getCellMenuComponents = void 0; var _react = _interopRequireDefault(require("react")); var _messages = require("@atlaskit/editor-common/messages"); var _editorToolbar = require("@atlaskit/editor-toolbar"); var _alignPositionBottom = _interopRequireDefault(require("@atlaskit/icon-lab/core/align-position-bottom")); var _alignPositionCenterVertical = _interopRequireDefault(require("@atlaskit/icon-lab/core/align-position-center-vertical")); var _alignPositionTop = _interopRequireDefault(require("@atlaskit/icon-lab/core/align-position-top")); var _MergeCellsItem = require("./items/MergeCellsItem"); var _SplitCellItem = require("./items/SplitCellItem"); var _VerticalAlignDropdownItem = require("./items/VerticalAlignDropdownItem"); var _VerticalAlignNestedMenu = require("./items/VerticalAlignNestedMenu"); var _keys = require("./keys"); var getCellMenuComponents = exports.getCellMenuComponents = function getCellMenuComponents(_ref) { var api = _ref.api; return [ // --- Menu surface --- { type: _keys.CELL_MENU.type, key: _keys.CELL_MENU.key }, // --- Main action section (Background color, Merge cells, Split cell) --- { type: _keys.CELL_ACTION_SECTION.type, key: _keys.CELL_ACTION_SECTION.key, parents: [{ type: _keys.CELL_MENU.type, key: _keys.CELL_MENU.key, rank: _keys.CELL_MENU_RANK[_keys.CELL_ACTION_SECTION.key] }], component: function component(props) { return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, props.children); } }, { type: _keys.VERTICAL_ALIGN_MENU.type, key: _keys.VERTICAL_ALIGN_MENU.key, parents: [{ type: _keys.CELL_ACTION_SECTION.type, key: _keys.CELL_ACTION_SECTION.key, rank: _keys.CELL_ACTION_SECTION_RANK[_keys.VERTICAL_ALIGN_MENU.key] }], component: function component(props) { return /*#__PURE__*/_react.default.createElement(_VerticalAlignNestedMenu.VerticalAlignNestedMenu, null, props.children); } }, { type: _keys.VERTICAL_ALIGN_MENU_SECTION.type, key: _keys.VERTICAL_ALIGN_MENU_SECTION.key, parents: [{ type: _keys.VERTICAL_ALIGN_MENU.type, key: _keys.VERTICAL_ALIGN_MENU.key, rank: _keys.VERTICAL_ALIGN_MENU_RANK[_keys.VERTICAL_ALIGN_MENU_SECTION.key] }], component: function component(props) { return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, props.children); } }, { type: _keys.VERTICAL_ALIGN_TOP_ITEM.type, key: _keys.VERTICAL_ALIGN_TOP_ITEM.key, parents: [{ type: _keys.VERTICAL_ALIGN_MENU_SECTION.type, key: _keys.VERTICAL_ALIGN_MENU_SECTION.key, rank: _keys.VERTICAL_ALIGN_MENU_SECTION_RANK[_keys.VERTICAL_ALIGN_TOP_ITEM.key] }], component: function component() { return /*#__PURE__*/_react.default.createElement(_VerticalAlignDropdownItem.VerticalAlignDropdownItem, { api: api, icon: _alignPositionTop.default, label: _messages.tableMessages.cellAlignmentTop, value: "top" }); } }, { type: _keys.VERTICAL_ALIGN_MIDDLE_ITEM.type, key: _keys.VERTICAL_ALIGN_MIDDLE_ITEM.key, parents: [{ type: _keys.VERTICAL_ALIGN_MENU_SECTION.type, key: _keys.VERTICAL_ALIGN_MENU_SECTION.key, rank: _keys.VERTICAL_ALIGN_MENU_SECTION_RANK[_keys.VERTICAL_ALIGN_MIDDLE_ITEM.key] }], component: function component() { return /*#__PURE__*/_react.default.createElement(_VerticalAlignDropdownItem.VerticalAlignDropdownItem, { api: api, icon: _alignPositionCenterVertical.default, label: _messages.tableMessages.cellAlignmentMiddle, value: "middle" }); } }, { type: _keys.VERTICAL_ALIGN_BOTTOM_ITEM.type, key: _keys.VERTICAL_ALIGN_BOTTOM_ITEM.key, parents: [{ type: _keys.VERTICAL_ALIGN_MENU_SECTION.type, key: _keys.VERTICAL_ALIGN_MENU_SECTION.key, rank: _keys.VERTICAL_ALIGN_MENU_SECTION_RANK[_keys.VERTICAL_ALIGN_BOTTOM_ITEM.key] }], component: function component() { return /*#__PURE__*/_react.default.createElement(_VerticalAlignDropdownItem.VerticalAlignDropdownItem, { api: api, icon: _alignPositionBottom.default, label: _messages.tableMessages.cellAlignmentBottom, value: "bottom" }); } }, { type: _keys.MERGE_CELLS_ITEM.type, key: _keys.MERGE_CELLS_ITEM.key, parents: [{ type: _keys.CELL_ACTION_SECTION.type, key: _keys.CELL_ACTION_SECTION.key, rank: _keys.CELL_ACTION_SECTION_RANK[_keys.MERGE_CELLS_ITEM.key] }], component: function component() { return /*#__PURE__*/_react.default.createElement(_MergeCellsItem.MergeCellsItem, { api: api }); } }, { type: _keys.SPLIT_CELL_ITEM.type, key: _keys.SPLIT_CELL_ITEM.key, parents: [{ type: _keys.CELL_ACTION_SECTION.type, key: _keys.CELL_ACTION_SECTION.key, rank: _keys.CELL_ACTION_SECTION_RANK[_keys.SPLIT_CELL_ITEM.key] }], component: function component() { return /*#__PURE__*/_react.default.createElement(_SplitCellItem.SplitCellItem, { api: api }); } }, // --- Danger section (Clear cell) --- { type: _keys.CELL_DANGER_SECTION.type, key: _keys.CELL_DANGER_SECTION.key, parents: [{ type: _keys.CELL_MENU.type, key: _keys.CELL_MENU.key, rank: _keys.CELL_MENU_RANK[_keys.CELL_DANGER_SECTION.key] }], component: function component(props) { return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, { hasSeparator: true }, props.children); } }]; };