@atlaskit/editor-plugin-table 22.3.0 → 22.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/tablePlugin.js +5 -0
  3. package/dist/cjs/ui/FloatingDragMenu/index.js +9 -4
  4. package/dist/cjs/ui/TableMenu/row/RowMenu.compiled.css +6 -0
  5. package/dist/cjs/ui/TableMenu/row/RowMenu.js +35 -0
  6. package/dist/cjs/ui/TableMenu/row/RowMenuItems.js +130 -0
  7. package/dist/cjs/ui/TableMenu/row/getRowMenuComponents.js +189 -0
  8. package/dist/cjs/ui/TableMenu/row/keys.js +77 -0
  9. package/dist/cjs/ui/TableMenu/shared/consts.js +7 -0
  10. package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.compiled.css +11 -0
  11. package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +68 -0
  12. package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +31 -0
  13. package/dist/es2019/tablePlugin.js +5 -0
  14. package/dist/es2019/ui/FloatingDragMenu/index.js +10 -5
  15. package/dist/es2019/ui/TableMenu/row/RowMenu.compiled.css +6 -0
  16. package/dist/es2019/ui/TableMenu/row/RowMenu.js +27 -0
  17. package/dist/es2019/ui/TableMenu/row/RowMenuItems.js +126 -0
  18. package/dist/es2019/ui/TableMenu/row/getRowMenuComponents.js +155 -0
  19. package/dist/es2019/ui/TableMenu/row/keys.js +87 -0
  20. package/dist/es2019/ui/TableMenu/shared/consts.js +1 -0
  21. package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.compiled.css +11 -0
  22. package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +60 -0
  23. package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +26 -0
  24. package/dist/esm/tablePlugin.js +5 -0
  25. package/dist/esm/ui/FloatingDragMenu/index.js +10 -5
  26. package/dist/esm/ui/TableMenu/row/RowMenu.compiled.css +6 -0
  27. package/dist/esm/ui/TableMenu/row/RowMenu.js +28 -0
  28. package/dist/esm/ui/TableMenu/row/RowMenuItems.js +123 -0
  29. package/dist/esm/ui/TableMenu/row/getRowMenuComponents.js +183 -0
  30. package/dist/esm/ui/TableMenu/row/keys.js +70 -0
  31. package/dist/esm/ui/TableMenu/shared/consts.js +1 -0
  32. package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.compiled.css +11 -0
  33. package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +60 -0
  34. package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +24 -0
  35. package/dist/types/tablePluginType.d.ts +3 -1
  36. package/dist/types/ui/TableMenu/row/RowMenu.d.ts +7 -0
  37. package/dist/types/ui/TableMenu/row/RowMenuItems.d.ts +8 -0
  38. package/dist/types/ui/TableMenu/row/getRowMenuComponents.d.ts +9 -0
  39. package/dist/types/ui/TableMenu/row/keys.d.ts +20 -0
  40. package/dist/types/ui/TableMenu/shared/consts.d.ts +1 -0
  41. package/dist/types/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +10 -0
  42. package/dist/types/ui/TableMenu/shared/items/ClearCellsItem.d.ts +6 -0
  43. package/dist/types-ts4.5/tablePluginType.d.ts +3 -1
  44. package/dist/types-ts4.5/ui/TableMenu/row/RowMenu.d.ts +7 -0
  45. package/dist/types-ts4.5/ui/TableMenu/row/RowMenuItems.d.ts +8 -0
  46. package/dist/types-ts4.5/ui/TableMenu/row/getRowMenuComponents.d.ts +9 -0
  47. package/dist/types-ts4.5/ui/TableMenu/row/keys.d.ts +20 -0
  48. package/dist/types-ts4.5/ui/TableMenu/shared/consts.d.ts +1 -0
  49. package/dist/types-ts4.5/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +10 -0
  50. package/dist/types-ts4.5/ui/TableMenu/shared/items/ClearCellsItem.d.ts +6 -0
  51. package/package.json +8 -4
@@ -3,9 +3,13 @@ import { Popup } from '@atlaskit/editor-common/ui';
3
3
  import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
7
  import { TableCssClassName as ClassName } from '../../types';
7
- import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
8
+ import { dragMenuDropdownWidth, dragTableInsertColumnButtonSize, tablePopupMenuFitHeight } from '../consts';
9
+ import { RowMenu } from '../TableMenu/row/RowMenu';
10
+ import { newMenuWidth } from '../TableMenu/shared/consts';
8
11
  import DragMenu from './DragMenu';
12
+ const rowMenuOffset = dragTableInsertColumnButtonSize + 4;
9
13
  const FloatingDragMenu = ({
10
14
  mountPoint,
11
15
  boundariesElement,
@@ -33,7 +37,6 @@ const FloatingDragMenu = ({
33
37
  }
34
38
  const inStickyMode = (stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky) || (tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.classList.contains(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW)) && fg('platform_editor_table_sticky_header_patch_7');
35
39
  const targetHandleRef = direction === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
36
- const offset = direction === 'row' ? [-9, 0] : [0, -7];
37
40
  if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
38
41
  return null;
39
42
  }
@@ -51,7 +54,7 @@ const FloatingDragMenu = ({
51
54
  mountTo: mountPoint,
52
55
  boundariesElement: boundariesElement,
53
56
  scrollableElement: scrollableElement,
54
- fitWidth: dragMenuDropdownWidth,
57
+ fitWidth: expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? newMenuWidth : dragMenuDropdownWidth,
55
58
  fitHeight: tablePopupMenuFitHeight
56
59
  // z-index value below is to ensure that this menu is above other floating menu
57
60
  // in table, but below floating dialogs like typeaheads, pickers, etc.
@@ -59,9 +62,11 @@ const FloatingDragMenu = ({
59
62
  ,
60
63
  zIndex: inStickyMode ? akEditorFloatingDialogZIndex : akEditorFloatingOverlapPanelZIndex,
61
64
  forcePlacement: true,
62
- offset: offset,
65
+ offset: expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? [rowMenuOffset, 0] : direction === 'row' ? [-9, 0] : [0, -7],
63
66
  stick: true
64
- }, /*#__PURE__*/React.createElement(DragMenu, {
67
+ }, expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? /*#__PURE__*/React.createElement(RowMenu, {
68
+ api: api
69
+ }) : /*#__PURE__*/React.createElement(DragMenu, {
65
70
  editorView: editorView,
66
71
  isOpen: isOpen,
67
72
  tableNode: tableNode,
@@ -0,0 +1,6 @@
1
+
2
+ ._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
3
+ ._18m915vq{overflow-y:hidden}
4
+ ._1bsb1178{width:280px}
5
+ ._1reo15vq{overflow-x:hidden}
6
+ ._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
@@ -0,0 +1,27 @@
1
+ /* RowMenu.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import "./RowMenu.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
6
+ import { Box } from '@atlaskit/primitives/compiled';
7
+ import { ROW_MENU } from './keys';
8
+ const rowMenuContainerStyles = {
9
+ container: "_2rko1qi0 _1reo15vq _18m915vq _1bsb1178 _16qs130s _bfhk1bhr"
10
+ };
11
+ export const RowMenu = ({
12
+ api
13
+ }) => {
14
+ var _api$uiControlRegistr, _api$uiControlRegistr2;
15
+ const rowMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 ? void 0 : (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(ROW_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
16
+ const surface = rowMenuComponents.find(c => c.type === ROW_MENU.type);
17
+ if (!surface) {
18
+ return null;
19
+ }
20
+ return /*#__PURE__*/React.createElement(Box, {
21
+ xcss: rowMenuContainerStyles.container,
22
+ testId: "row-handle-menu"
23
+ }, /*#__PURE__*/React.createElement(SurfaceRenderer, {
24
+ surface: surface,
25
+ components: rowMenuComponents
26
+ }));
27
+ };
@@ -0,0 +1,126 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { addRowAfter, addRowBefore, deleteRow, moveRowDown, moveRowDownOld, moveRowUp, moveRowUpOld, tooltip } from '@atlaskit/editor-common/keymaps';
4
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { DeleteIcon, TableRowAddAboveIcon, TableRowAddBelowIcon, TableRowMoveDownIcon, TableRowMoveUpIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
+ import Toggle from '@atlaskit/toggle';
8
+ export const HeaderRowToggleItem = () => {
9
+ const {
10
+ formatMessage
11
+ } = useIntl();
12
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
13
+ testId: "row-menu-header-row-toggle",
14
+ elemAfter: /*#__PURE__*/React.createElement(Toggle, {
15
+ id: "row-menu-toggle-header-row",
16
+ label: formatMessage(messages.headerRow),
17
+ isChecked: false
18
+ })
19
+ }, formatMessage(messages.headerRow));
20
+ };
21
+ export const NumberedRowsToggleItem = () => {
22
+ const {
23
+ formatMessage
24
+ } = useIntl();
25
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
26
+ testId: "row-menu-numbered-rows-toggle",
27
+ elemAfter: /*#__PURE__*/React.createElement(Toggle, {
28
+ id: "row-menu-toggle-numbered-rows",
29
+ label: formatMessage(messages.numberedRows),
30
+ isChecked: false
31
+ })
32
+ }, formatMessage(messages.numberedRows));
33
+ };
34
+ const getMoveRowUpShortcut = () => tooltip(expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true) ? moveRowUp : moveRowUpOld);
35
+ const getMoveRowDownShortcut = () => tooltip(expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true) ? moveRowDown : moveRowDownOld);
36
+ export const AddRowAboveItem = () => {
37
+ var _tooltip;
38
+ const {
39
+ formatMessage
40
+ } = useIntl();
41
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
42
+ testId: "row-menu-add-row-above",
43
+ elemBefore: /*#__PURE__*/React.createElement(TableRowAddAboveIcon, {
44
+ color: "currentColor",
45
+ label: "",
46
+ size: "small"
47
+ }),
48
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
49
+ shortcut: (_tooltip = tooltip(addRowBefore)) !== null && _tooltip !== void 0 ? _tooltip : ''
50
+ })
51
+ }, formatMessage(messages.addRowAbove));
52
+ };
53
+ export const AddRowBelowItem = () => {
54
+ var _tooltip2;
55
+ const {
56
+ formatMessage
57
+ } = useIntl();
58
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
59
+ testId: "row-menu-add-row-below",
60
+ elemBefore: /*#__PURE__*/React.createElement(TableRowAddBelowIcon, {
61
+ color: "currentColor",
62
+ label: "",
63
+ size: "small"
64
+ }),
65
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
66
+ shortcut: (_tooltip2 = tooltip(addRowAfter)) !== null && _tooltip2 !== void 0 ? _tooltip2 : ''
67
+ })
68
+ }, formatMessage(messages.addRowBelow));
69
+ };
70
+ export const MoveRowUpItem = () => {
71
+ var _getMoveRowUpShortcut;
72
+ const {
73
+ formatMessage
74
+ } = useIntl();
75
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
76
+ testId: "row-menu-move-row-up",
77
+ elemBefore: /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
78
+ color: "currentColor",
79
+ label: "",
80
+ size: "small"
81
+ }),
82
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
83
+ shortcut: (_getMoveRowUpShortcut = getMoveRowUpShortcut()) !== null && _getMoveRowUpShortcut !== void 0 ? _getMoveRowUpShortcut : ''
84
+ })
85
+ }, formatMessage(messages.moveRowUp, {
86
+ 0: 1
87
+ }));
88
+ };
89
+ export const MoveRowDownItem = () => {
90
+ var _getMoveRowDownShortc;
91
+ const {
92
+ formatMessage
93
+ } = useIntl();
94
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
95
+ testId: "row-menu-move-row-down",
96
+ elemBefore: /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
97
+ color: "currentColor",
98
+ label: "",
99
+ size: "small"
100
+ }),
101
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
102
+ shortcut: (_getMoveRowDownShortc = getMoveRowDownShortcut()) !== null && _getMoveRowDownShortc !== void 0 ? _getMoveRowDownShortc : ''
103
+ })
104
+ }, formatMessage(messages.moveRowDown, {
105
+ 0: 1
106
+ }));
107
+ };
108
+ export const DeleteRowItem = () => {
109
+ var _tooltip3;
110
+ const {
111
+ formatMessage
112
+ } = useIntl();
113
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
114
+ testId: "row-menu-delete-row",
115
+ elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
116
+ color: "currentColor",
117
+ label: "",
118
+ size: "small"
119
+ }),
120
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
121
+ shortcut: (_tooltip3 = tooltip(deleteRow)) !== null && _tooltip3 !== void 0 ? _tooltip3 : ''
122
+ })
123
+ }, formatMessage(messages.removeRows, {
124
+ 0: 1
125
+ }));
126
+ };
@@ -0,0 +1,155 @@
1
+ import React from 'react';
2
+ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
3
+ import { BackgroundColorItem } from '../shared/items/BackgroundColorItem';
4
+ import { ClearCellsItem } from '../shared/items/ClearCellsItem';
5
+ import { ROW_MENU, ROW_TOGGLE_SECTION, ROW_BACKGROUND_SECTION, ROW_ADD_SECTION, ROW_DANGER_SECTION, ROW_SECTION_RANK, HEADER_ROW_TOGGLE_ITEM, NUMBERED_ROWS_TOGGLE_ITEM, BACKGROUND_COLOR_ITEM, ADD_ROW_ABOVE_ITEM, ADD_ROW_BELOW_ITEM, MOVE_ROW_UP_ITEM, MOVE_ROW_DOWN_ITEM, CLEAR_CELLS_ITEM, DELETE_ROW_ITEM, TOGGLE_SECTION_ITEM_RANK, BACKGROUND_SECTION_ITEM_RANK, ADD_SECTION_ITEM_RANK, DANGER_SECTION_ITEM_RANK } from './keys';
6
+ import { HeaderRowToggleItem, NumberedRowsToggleItem, AddRowAboveItem, AddRowBelowItem, MoveRowUpItem, MoveRowDownItem, DeleteRowItem } from './RowMenuItems';
7
+
8
+ /**
9
+ * Returns the RegisterComponent[] array defining the row menu surface.
10
+ *
11
+ * This is a **UI-only stub** — all items are always visible with no conditional
12
+ * logic and no wired actions. Functional behaviour (actions, conditional visibility)
13
+ * will be connected in follow-up tickets.
14
+ */
15
+ export const getRowMenuComponents = () => [
16
+ // --- Menu surface ---
17
+ {
18
+ type: ROW_MENU.type,
19
+ key: ROW_MENU.key
20
+ },
21
+ // --- Toggle section (Header row, Numbered rows) ---
22
+ {
23
+ type: ROW_TOGGLE_SECTION.type,
24
+ key: ROW_TOGGLE_SECTION.key,
25
+ parents: [{
26
+ type: ROW_MENU.type,
27
+ key: ROW_MENU.key,
28
+ rank: ROW_SECTION_RANK[ROW_TOGGLE_SECTION.key]
29
+ }],
30
+ component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
31
+ }, {
32
+ type: HEADER_ROW_TOGGLE_ITEM.type,
33
+ key: HEADER_ROW_TOGGLE_ITEM.key,
34
+ parents: [{
35
+ type: ROW_TOGGLE_SECTION.type,
36
+ key: ROW_TOGGLE_SECTION.key,
37
+ rank: TOGGLE_SECTION_ITEM_RANK[HEADER_ROW_TOGGLE_ITEM.key]
38
+ }],
39
+ component: () => /*#__PURE__*/React.createElement(HeaderRowToggleItem, null)
40
+ }, {
41
+ type: NUMBERED_ROWS_TOGGLE_ITEM.type,
42
+ key: NUMBERED_ROWS_TOGGLE_ITEM.key,
43
+ parents: [{
44
+ type: ROW_TOGGLE_SECTION.type,
45
+ key: ROW_TOGGLE_SECTION.key,
46
+ rank: TOGGLE_SECTION_ITEM_RANK[NUMBERED_ROWS_TOGGLE_ITEM.key]
47
+ }],
48
+ component: () => /*#__PURE__*/React.createElement(NumberedRowsToggleItem, null)
49
+ },
50
+ // --- Background color section ---
51
+ {
52
+ type: ROW_BACKGROUND_SECTION.type,
53
+ key: ROW_BACKGROUND_SECTION.key,
54
+ parents: [{
55
+ type: ROW_MENU.type,
56
+ key: ROW_MENU.key,
57
+ rank: ROW_SECTION_RANK[ROW_BACKGROUND_SECTION.key]
58
+ }],
59
+ component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
60
+ hasSeparator: true
61
+ }, props.children)
62
+ }, {
63
+ type: BACKGROUND_COLOR_ITEM.type,
64
+ key: BACKGROUND_COLOR_ITEM.key,
65
+ parents: [{
66
+ type: ROW_BACKGROUND_SECTION.type,
67
+ key: ROW_BACKGROUND_SECTION.key,
68
+ rank: BACKGROUND_SECTION_ITEM_RANK[BACKGROUND_COLOR_ITEM.key]
69
+ }],
70
+ component: () => /*#__PURE__*/React.createElement(BackgroundColorItem, {
71
+ testId: "row-menu-background-color"
72
+ })
73
+ },
74
+ // --- Add / Move section ---
75
+ {
76
+ type: ROW_ADD_SECTION.type,
77
+ key: ROW_ADD_SECTION.key,
78
+ parents: [{
79
+ type: ROW_MENU.type,
80
+ key: ROW_MENU.key,
81
+ rank: ROW_SECTION_RANK[ROW_ADD_SECTION.key]
82
+ }],
83
+ component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
84
+ hasSeparator: true
85
+ }, props.children)
86
+ }, {
87
+ type: ADD_ROW_ABOVE_ITEM.type,
88
+ key: ADD_ROW_ABOVE_ITEM.key,
89
+ parents: [{
90
+ type: ROW_ADD_SECTION.type,
91
+ key: ROW_ADD_SECTION.key,
92
+ rank: ADD_SECTION_ITEM_RANK[ADD_ROW_ABOVE_ITEM.key]
93
+ }],
94
+ component: () => /*#__PURE__*/React.createElement(AddRowAboveItem, null)
95
+ }, {
96
+ type: ADD_ROW_BELOW_ITEM.type,
97
+ key: ADD_ROW_BELOW_ITEM.key,
98
+ parents: [{
99
+ type: ROW_ADD_SECTION.type,
100
+ key: ROW_ADD_SECTION.key,
101
+ rank: ADD_SECTION_ITEM_RANK[ADD_ROW_BELOW_ITEM.key]
102
+ }],
103
+ component: () => /*#__PURE__*/React.createElement(AddRowBelowItem, null)
104
+ }, {
105
+ type: MOVE_ROW_UP_ITEM.type,
106
+ key: MOVE_ROW_UP_ITEM.key,
107
+ parents: [{
108
+ type: ROW_ADD_SECTION.type,
109
+ key: ROW_ADD_SECTION.key,
110
+ rank: ADD_SECTION_ITEM_RANK[MOVE_ROW_UP_ITEM.key]
111
+ }],
112
+ component: () => /*#__PURE__*/React.createElement(MoveRowUpItem, null)
113
+ }, {
114
+ type: MOVE_ROW_DOWN_ITEM.type,
115
+ key: MOVE_ROW_DOWN_ITEM.key,
116
+ parents: [{
117
+ type: ROW_ADD_SECTION.type,
118
+ key: ROW_ADD_SECTION.key,
119
+ rank: ADD_SECTION_ITEM_RANK[MOVE_ROW_DOWN_ITEM.key]
120
+ }],
121
+ component: () => /*#__PURE__*/React.createElement(MoveRowDownItem, null)
122
+ },
123
+ // --- Danger section (Clear cells, Delete row) ---
124
+ {
125
+ type: ROW_DANGER_SECTION.type,
126
+ key: ROW_DANGER_SECTION.key,
127
+ parents: [{
128
+ type: ROW_MENU.type,
129
+ key: ROW_MENU.key,
130
+ rank: ROW_SECTION_RANK[ROW_DANGER_SECTION.key]
131
+ }],
132
+ component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
133
+ hasSeparator: true
134
+ }, props.children)
135
+ }, {
136
+ type: CLEAR_CELLS_ITEM.type,
137
+ key: CLEAR_CELLS_ITEM.key,
138
+ parents: [{
139
+ type: ROW_DANGER_SECTION.type,
140
+ key: ROW_DANGER_SECTION.key,
141
+ rank: DANGER_SECTION_ITEM_RANK[CLEAR_CELLS_ITEM.key]
142
+ }],
143
+ component: () => /*#__PURE__*/React.createElement(ClearCellsItem, {
144
+ testId: "row-menu-clear-cells"
145
+ })
146
+ }, {
147
+ type: DELETE_ROW_ITEM.type,
148
+ key: DELETE_ROW_ITEM.key,
149
+ parents: [{
150
+ type: ROW_DANGER_SECTION.type,
151
+ key: ROW_DANGER_SECTION.key,
152
+ rank: DANGER_SECTION_ITEM_RANK[DELETE_ROW_ITEM.key]
153
+ }],
154
+ component: () => /*#__PURE__*/React.createElement(DeleteRowItem, null)
155
+ }];
@@ -0,0 +1,87 @@
1
+ // --- Menu surface ---
2
+
3
+ export const ROW_MENU = {
4
+ type: 'menu',
5
+ key: 'row-handle-menu'
6
+ };
7
+
8
+ // --- Sections ---
9
+
10
+ export const ROW_TOGGLE_SECTION = {
11
+ type: 'menu-section',
12
+ key: 'row-toggle-section'
13
+ };
14
+ export const ROW_BACKGROUND_SECTION = {
15
+ type: 'menu-section',
16
+ key: 'row-background-section'
17
+ };
18
+ export const ROW_ADD_SECTION = {
19
+ type: 'menu-section',
20
+ key: 'row-add-section'
21
+ };
22
+ export const ROW_DANGER_SECTION = {
23
+ type: 'menu-section',
24
+ key: 'row-danger-section'
25
+ };
26
+ export const ROW_SECTION_RANK = {
27
+ [ROW_TOGGLE_SECTION.key]: 100,
28
+ [ROW_BACKGROUND_SECTION.key]: 200,
29
+ [ROW_ADD_SECTION.key]: 300,
30
+ [ROW_DANGER_SECTION.key]: 400
31
+ };
32
+ export const HEADER_ROW_TOGGLE_ITEM = {
33
+ type: 'menu-item',
34
+ key: 'header-row-toggle'
35
+ };
36
+ export const NUMBERED_ROWS_TOGGLE_ITEM = {
37
+ type: 'menu-item',
38
+ key: 'numbered-rows-toggle'
39
+ };
40
+ export const BACKGROUND_COLOR_ITEM = {
41
+ type: 'menu-item',
42
+ key: 'background-color'
43
+ };
44
+ export const ADD_ROW_ABOVE_ITEM = {
45
+ type: 'menu-item',
46
+ key: 'add-row-above'
47
+ };
48
+ export const ADD_ROW_BELOW_ITEM = {
49
+ type: 'menu-item',
50
+ key: 'add-row-below'
51
+ };
52
+ export const MOVE_ROW_UP_ITEM = {
53
+ type: 'menu-item',
54
+ key: 'move-row-up'
55
+ };
56
+ export const MOVE_ROW_DOWN_ITEM = {
57
+ type: 'menu-item',
58
+ key: 'move-row-down'
59
+ };
60
+ export const CLEAR_CELLS_ITEM = {
61
+ type: 'menu-item',
62
+ key: 'clear-cells'
63
+ };
64
+ export const DELETE_ROW_ITEM = {
65
+ type: 'menu-item',
66
+ key: 'delete-row'
67
+ };
68
+
69
+ // --- Item ranks within their sections ---
70
+
71
+ export const TOGGLE_SECTION_ITEM_RANK = {
72
+ [HEADER_ROW_TOGGLE_ITEM.key]: 100,
73
+ [NUMBERED_ROWS_TOGGLE_ITEM.key]: 200
74
+ };
75
+ export const BACKGROUND_SECTION_ITEM_RANK = {
76
+ [BACKGROUND_COLOR_ITEM.key]: 100
77
+ };
78
+ export const ADD_SECTION_ITEM_RANK = {
79
+ [ADD_ROW_ABOVE_ITEM.key]: 100,
80
+ [ADD_ROW_BELOW_ITEM.key]: 200,
81
+ [MOVE_ROW_UP_ITEM.key]: 300,
82
+ [MOVE_ROW_DOWN_ITEM.key]: 400
83
+ };
84
+ export const DANGER_SECTION_ITEM_RANK = {
85
+ [CLEAR_CELLS_ITEM.key]: 100,
86
+ [DELETE_ROW_ITEM.key]: 200
87
+ };
@@ -0,0 +1 @@
1
+ export const newMenuWidth = 280;
@@ -0,0 +1,11 @@
1
+
2
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
3
+ ._zulp1b66{gap:var(--ds-space-050,4px)}._189ee4h9{border-width:var(--ds-border-width,1px)}
4
+ ._1dqonqa1{border-style:solid}
5
+ ._1h6d1l7x{border-color:var(--ds-border,#0b120e24)}
6
+ ._1rjcu2gc{padding-block:var(--ds-space-100,8px)}
7
+ ._1bsbdlk8{width:14px}
8
+ ._1e0c1txw{display:flex}
9
+ ._1o9zidpf{flex-shrink:0}
10
+ ._4cvr1h6o{align-items:center}
11
+ ._4t3idlk8{height:14px}
@@ -0,0 +1,60 @@
1
+ /* BackgroundColorItem.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import "./BackgroundColorItem.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React, { useCallback, useMemo } from 'react';
5
+ import { useIntl } from 'react-intl';
6
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
7
+ import { backgroundPaletteTooltipMessages, cellBackgroundColorPalette, ColorPalette } from '@atlaskit/editor-common/ui-color';
8
+ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
9
+ import { NestedDropdownRightIcon, PaintBucketIcon, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
10
+ import { Box } from '@atlaskit/primitives/compiled';
11
+ const colorPaletteColumns = 7;
12
+ const colorPaletteStyles = {
13
+ container: "_1rjcu2gc",
14
+ elemAfter: "_zulp1b66 _1e0c1txw _4cvr1h6o",
15
+ colorPreview: "_2rko12b0 _1h6d1l7x _1dqonqa1 _189ee4h9 _1bsbdlk8 _4t3idlk8 _1o9zidpf"
16
+ };
17
+ export const BackgroundColorItem = ({
18
+ testId
19
+ }) => {
20
+ const {
21
+ formatMessage
22
+ } = useIntl();
23
+ const selectedColor = '#ffffff';
24
+ const onClick = useCallback(() => {}, []);
25
+ const colorPreviewStyle = useMemo(() => ({
26
+ backgroundColor: selectedColor
27
+ }), [selectedColor]);
28
+ const paletteOptions = useMemo(() => {
29
+ return {
30
+ palette: cellBackgroundColorPalette,
31
+ paletteColorTooltipMessages: backgroundPaletteTooltipMessages,
32
+ hexToPaletteColor: hexToEditorBackgroundPaletteColor
33
+ };
34
+ }, []);
35
+ return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
36
+ testId: testId,
37
+ elemBefore: /*#__PURE__*/React.createElement(PaintBucketIcon, {
38
+ color: "currentColor",
39
+ label: "",
40
+ size: "small"
41
+ }),
42
+ elemAfter: /*#__PURE__*/React.createElement(Box, {
43
+ xcss: colorPaletteStyles.elemAfter
44
+ }, /*#__PURE__*/React.createElement("div", {
45
+ style: colorPreviewStyle,
46
+ className: ax([colorPaletteStyles.colorPreview])
47
+ }), /*#__PURE__*/React.createElement(NestedDropdownRightIcon, {
48
+ label: "",
49
+ size: "small"
50
+ })),
51
+ text: formatMessage(messages.backgroundColor)
52
+ }, /*#__PURE__*/React.createElement(Box, {
53
+ xcss: colorPaletteStyles.container
54
+ }, /*#__PURE__*/React.createElement(ColorPalette, {
55
+ cols: colorPaletteColumns,
56
+ onClick: onClick,
57
+ selectedColor: selectedColor,
58
+ paletteOptions: paletteOptions
59
+ })));
60
+ };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { backspace, tooltip } from '@atlaskit/editor-common/keymaps';
4
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { CrossIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
6
+ export const ClearCellsItem = ({
7
+ testId
8
+ }) => {
9
+ var _tooltip;
10
+ const {
11
+ formatMessage
12
+ } = useIntl();
13
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
14
+ testId: testId,
15
+ elemBefore: /*#__PURE__*/React.createElement(CrossIcon, {
16
+ color: "currentColor",
17
+ label: "",
18
+ size: "small"
19
+ }),
20
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
21
+ shortcut: (_tooltip = tooltip(backspace)) !== null && _tooltip !== void 0 ? _tooltip : ''
22
+ })
23
+ }, formatMessage(messages.clearCells, {
24
+ 0: 1
25
+ }));
26
+ };
@@ -46,6 +46,7 @@ import { getHeightInfoPayload, getWidthInfoPayload } from './pm-plugins/utils/an
46
46
  import { createTableWithWidth } from './pm-plugins/utils/create';
47
47
  import { createPlugin as createViewModeSortPlugin } from './pm-plugins/view-mode-sort';
48
48
  import { ContentComponent } from './ui/ContentComponent';
49
+ import { getRowMenuComponents } from './ui/TableMenu/row/getRowMenuComponents';
49
50
  import { getToolbarConfig } from './ui/toolbar';
50
51
  var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
51
52
  return {};
@@ -82,6 +83,10 @@ var tablePlugin = function tablePlugin(_ref) {
82
83
  var isTableSelectorEnabled =
83
84
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
84
85
  !(options !== null && options !== void 0 && options.isChromelessEditor) && !(options !== null && options !== void 0 && options.isCommentEditor) && (options === null || options === void 0 || (_options$getEditorFea2 = options.getEditorFeatureFlags) === null || _options$getEditorFea2 === void 0 ? void 0 : _options$getEditorFea2.call(options).tableSelector) && editorExperiment('platform_editor_controls', 'variant1');
86
+ if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
87
+ var _api$uiControlRegistr;
88
+ api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getRowMenuComponents());
89
+ }
85
90
  return {
86
91
  name: 'table',
87
92
  // Use getSharedState to store fullWidthEnabled and wasFullWidthModeEnabled to guarantee access
@@ -3,9 +3,13 @@ import { Popup } from '@atlaskit/editor-common/ui';
3
3
  import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
7
  import { TableCssClassName as ClassName } from '../../types';
7
- import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
8
+ import { dragMenuDropdownWidth, dragTableInsertColumnButtonSize, tablePopupMenuFitHeight } from '../consts';
9
+ import { RowMenu } from '../TableMenu/row/RowMenu';
10
+ import { newMenuWidth } from '../TableMenu/shared/consts';
8
11
  import DragMenu from './DragMenu';
12
+ var rowMenuOffset = dragTableInsertColumnButtonSize + 4;
9
13
  var FloatingDragMenu = function FloatingDragMenu(_ref) {
10
14
  var _getEditorFeatureFlag;
11
15
  var mountPoint = _ref.mountPoint,
@@ -32,7 +36,6 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
32
36
  }
33
37
  var inStickyMode = (stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky) || (tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.classList.contains(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW)) && fg('platform_editor_table_sticky_header_patch_7');
34
38
  var targetHandleRef = direction === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
35
- var offset = direction === 'row' ? [-9, 0] : [0, -7];
36
39
  if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
37
40
  return null;
38
41
  }
@@ -50,7 +53,7 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
50
53
  mountTo: mountPoint,
51
54
  boundariesElement: boundariesElement,
52
55
  scrollableElement: scrollableElement,
53
- fitWidth: dragMenuDropdownWidth,
56
+ fitWidth: expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? newMenuWidth : dragMenuDropdownWidth,
54
57
  fitHeight: tablePopupMenuFitHeight
55
58
  // z-index value below is to ensure that this menu is above other floating menu
56
59
  // in table, but below floating dialogs like typeaheads, pickers, etc.
@@ -58,9 +61,11 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
58
61
  ,
59
62
  zIndex: inStickyMode ? akEditorFloatingDialogZIndex : akEditorFloatingOverlapPanelZIndex,
60
63
  forcePlacement: true,
61
- offset: offset,
64
+ offset: expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? [rowMenuOffset, 0] : direction === 'row' ? [-9, 0] : [0, -7],
62
65
  stick: true
63
- }, /*#__PURE__*/React.createElement(DragMenu, {
66
+ }, expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? /*#__PURE__*/React.createElement(RowMenu, {
67
+ api: api
68
+ }) : /*#__PURE__*/React.createElement(DragMenu, {
64
69
  editorView: editorView,
65
70
  isOpen: isOpen,
66
71
  tableNode: tableNode,
@@ -0,0 +1,6 @@
1
+
2
+ ._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
3
+ ._18m915vq{overflow-y:hidden}
4
+ ._1bsb1178{width:280px}
5
+ ._1reo15vq{overflow-x:hidden}
6
+ ._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
@@ -0,0 +1,28 @@
1
+ /* RowMenu.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import "./RowMenu.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
6
+ import { Box } from '@atlaskit/primitives/compiled';
7
+ import { ROW_MENU } from './keys';
8
+ var rowMenuContainerStyles = {
9
+ container: "_2rko1qi0 _1reo15vq _18m915vq _1bsb1178 _16qs130s _bfhk1bhr"
10
+ };
11
+ export var RowMenu = function RowMenu(_ref) {
12
+ var _api$uiControlRegistr, _api$uiControlRegistr2;
13
+ var api = _ref.api;
14
+ var rowMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(ROW_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
15
+ var surface = rowMenuComponents.find(function (c) {
16
+ return c.type === ROW_MENU.type;
17
+ });
18
+ if (!surface) {
19
+ return null;
20
+ }
21
+ return /*#__PURE__*/React.createElement(Box, {
22
+ xcss: rowMenuContainerStyles.container,
23
+ testId: "row-handle-menu"
24
+ }, /*#__PURE__*/React.createElement(SurfaceRenderer, {
25
+ surface: surface,
26
+ components: rowMenuComponents
27
+ }));
28
+ };