@atlaskit/editor-plugin-table 22.4.3 → 22.4.5

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 (161) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +1 -1
  3. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +1 -2
  4. package/dist/cjs/tablePlugin.js +2 -2
  5. package/dist/cjs/ui/FloatingDragMenu/index.js +9 -6
  6. package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +4 -6
  7. package/dist/cjs/ui/TableMenu/column/getColumnMenuComponents.js +194 -0
  8. package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +27 -0
  9. package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +27 -0
  10. package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +29 -0
  11. package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +22 -0
  12. package/dist/cjs/ui/TableMenu/column/items/HeaderColumnToggleItem.js +23 -0
  13. package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +33 -0
  14. package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +23 -0
  15. package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +23 -0
  16. package/dist/cjs/ui/TableMenu/column/keys.js +79 -0
  17. package/dist/cjs/ui/TableMenu/row/getRowMenuComponents.js +25 -47
  18. package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +27 -0
  19. package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +27 -0
  20. package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +29 -0
  21. package/dist/cjs/ui/TableMenu/row/items/HeaderRowToggleItem.js +23 -0
  22. package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +33 -0
  23. package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +33 -0
  24. package/dist/cjs/ui/TableMenu/row/items/NumberedRowsToggleItem.js +23 -0
  25. package/dist/cjs/ui/TableMenu/row/keys.js +7 -14
  26. package/dist/cjs/ui/TableMenu/shared/TableMenu.js +35 -0
  27. package/dist/cjs/ui/TableMenu/shared/consts.js +2 -2
  28. package/dist/cjs/ui/TableMenu/shared/getSharedItems.js +46 -0
  29. package/dist/cjs/ui/TableMenu/shared/getTableMenuComponents.js +14 -0
  30. package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +5 -7
  31. package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +1 -3
  32. package/dist/cjs/ui/TableMenu/shared/keys.js +14 -0
  33. package/dist/cjs/ui/common-styles.js +4 -4
  34. package/dist/es2019/nodeviews/TableComponent.js +1 -1
  35. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +1 -2
  36. package/dist/es2019/tablePlugin.js +2 -2
  37. package/dist/es2019/ui/FloatingDragMenu/index.js +10 -7
  38. package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +4 -4
  39. package/dist/es2019/ui/TableMenu/column/getColumnMenuComponents.js +160 -0
  40. package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +21 -0
  41. package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +21 -0
  42. package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +23 -0
  43. package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +16 -0
  44. package/dist/es2019/ui/TableMenu/column/items/HeaderColumnToggleItem.js +17 -0
  45. package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +25 -0
  46. package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +17 -0
  47. package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +17 -0
  48. package/dist/es2019/ui/TableMenu/column/keys.js +93 -0
  49. package/dist/es2019/ui/TableMenu/row/getRowMenuComponents.js +19 -37
  50. package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +21 -0
  51. package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +21 -0
  52. package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +23 -0
  53. package/dist/es2019/ui/TableMenu/row/items/HeaderRowToggleItem.js +17 -0
  54. package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +25 -0
  55. package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +25 -0
  56. package/dist/es2019/ui/TableMenu/row/items/NumberedRowsToggleItem.js +17 -0
  57. package/dist/es2019/ui/TableMenu/row/keys.js +7 -13
  58. package/dist/es2019/ui/TableMenu/shared/TableMenu.js +28 -0
  59. package/dist/es2019/ui/TableMenu/shared/consts.js +1 -1
  60. package/dist/es2019/ui/TableMenu/shared/getSharedItems.js +33 -0
  61. package/dist/es2019/ui/TableMenu/shared/getTableMenuComponents.js +4 -0
  62. package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +5 -8
  63. package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +1 -4
  64. package/dist/es2019/ui/TableMenu/shared/keys.js +8 -0
  65. package/dist/es2019/ui/common-styles.js +167 -66
  66. package/dist/esm/nodeviews/TableComponent.js +1 -1
  67. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +1 -2
  68. package/dist/esm/tablePlugin.js +2 -2
  69. package/dist/esm/ui/FloatingDragMenu/index.js +10 -7
  70. package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +4 -6
  71. package/dist/esm/ui/TableMenu/column/getColumnMenuComponents.js +188 -0
  72. package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +20 -0
  73. package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +20 -0
  74. package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +22 -0
  75. package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +15 -0
  76. package/dist/esm/ui/TableMenu/column/items/HeaderColumnToggleItem.js +16 -0
  77. package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +26 -0
  78. package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +16 -0
  79. package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +16 -0
  80. package/dist/esm/ui/TableMenu/column/keys.js +73 -0
  81. package/dist/esm/ui/TableMenu/row/getRowMenuComponents.js +19 -41
  82. package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +20 -0
  83. package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +20 -0
  84. package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +22 -0
  85. package/dist/esm/ui/TableMenu/row/items/HeaderRowToggleItem.js +16 -0
  86. package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +26 -0
  87. package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +26 -0
  88. package/dist/esm/ui/TableMenu/row/items/NumberedRowsToggleItem.js +16 -0
  89. package/dist/esm/ui/TableMenu/row/keys.js +7 -13
  90. package/dist/esm/ui/TableMenu/shared/TableMenu.js +27 -0
  91. package/dist/esm/ui/TableMenu/shared/consts.js +1 -1
  92. package/dist/esm/ui/TableMenu/shared/getSharedItems.js +39 -0
  93. package/dist/esm/ui/TableMenu/shared/getTableMenuComponents.js +7 -0
  94. package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +5 -7
  95. package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +1 -3
  96. package/dist/esm/ui/TableMenu/shared/keys.js +8 -0
  97. package/dist/esm/ui/common-styles.js +4 -4
  98. package/dist/types/ui/TableMenu/column/getColumnMenuComponents.d.ts +9 -0
  99. package/dist/types/ui/TableMenu/column/items/AddColumnLeftItem.d.ts +2 -0
  100. package/dist/types/ui/TableMenu/column/items/AddColumnRightItem.d.ts +2 -0
  101. package/dist/types/ui/TableMenu/column/items/DeleteColumnItem.d.ts +2 -0
  102. package/dist/types/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +2 -0
  103. package/dist/types/ui/TableMenu/column/items/HeaderColumnToggleItem.d.ts +2 -0
  104. package/dist/types/ui/TableMenu/column/items/MoveColumnRightItem.d.ts +2 -0
  105. package/dist/types/ui/TableMenu/column/items/SortDecreasingItem.d.ts +2 -0
  106. package/dist/types/ui/TableMenu/column/items/SortIncreasingItem.d.ts +2 -0
  107. package/dist/types/ui/TableMenu/column/keys.d.ts +21 -0
  108. package/dist/types/ui/TableMenu/row/items/AddRowAboveItem.d.ts +2 -0
  109. package/dist/types/ui/TableMenu/row/items/AddRowBelowItem.d.ts +2 -0
  110. package/dist/types/ui/TableMenu/row/items/DeleteRowItem.d.ts +2 -0
  111. package/dist/types/ui/TableMenu/row/items/HeaderRowToggleItem.d.ts +2 -0
  112. package/dist/types/ui/TableMenu/row/items/MoveRowDownItem.d.ts +2 -0
  113. package/dist/types/ui/TableMenu/row/items/MoveRowUpItem.d.ts +2 -0
  114. package/dist/types/ui/TableMenu/row/items/NumberedRowsToggleItem.d.ts +2 -0
  115. package/dist/types/ui/TableMenu/row/keys.d.ts +5 -7
  116. package/dist/types/ui/TableMenu/shared/TableMenu.d.ts +9 -0
  117. package/dist/types/ui/TableMenu/shared/consts.d.ts +1 -1
  118. package/dist/types/ui/TableMenu/shared/getSharedItems.d.ts +2 -0
  119. package/dist/types/ui/TableMenu/shared/getTableMenuComponents.d.ts +2 -0
  120. package/dist/types/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +1 -5
  121. package/dist/types/ui/TableMenu/shared/items/ClearCellsItem.d.ts +1 -5
  122. package/dist/types/ui/TableMenu/shared/keys.d.ts +3 -0
  123. package/dist/types-ts4.5/ui/TableMenu/column/getColumnMenuComponents.d.ts +9 -0
  124. package/dist/types-ts4.5/ui/TableMenu/column/items/AddColumnLeftItem.d.ts +2 -0
  125. package/dist/types-ts4.5/ui/TableMenu/column/items/AddColumnRightItem.d.ts +2 -0
  126. package/dist/types-ts4.5/ui/TableMenu/column/items/DeleteColumnItem.d.ts +2 -0
  127. package/dist/types-ts4.5/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +2 -0
  128. package/dist/types-ts4.5/ui/TableMenu/column/items/HeaderColumnToggleItem.d.ts +2 -0
  129. package/dist/types-ts4.5/ui/TableMenu/column/items/MoveColumnRightItem.d.ts +2 -0
  130. package/dist/types-ts4.5/ui/TableMenu/column/items/SortDecreasingItem.d.ts +2 -0
  131. package/dist/types-ts4.5/ui/TableMenu/column/items/SortIncreasingItem.d.ts +2 -0
  132. package/dist/types-ts4.5/ui/TableMenu/column/keys.d.ts +21 -0
  133. package/dist/types-ts4.5/ui/TableMenu/row/items/AddRowAboveItem.d.ts +2 -0
  134. package/dist/types-ts4.5/ui/TableMenu/row/items/AddRowBelowItem.d.ts +2 -0
  135. package/dist/types-ts4.5/ui/TableMenu/row/items/DeleteRowItem.d.ts +2 -0
  136. package/dist/types-ts4.5/ui/TableMenu/row/items/HeaderRowToggleItem.d.ts +2 -0
  137. package/dist/types-ts4.5/ui/TableMenu/row/items/MoveRowDownItem.d.ts +2 -0
  138. package/dist/types-ts4.5/ui/TableMenu/row/items/MoveRowUpItem.d.ts +2 -0
  139. package/dist/types-ts4.5/ui/TableMenu/row/items/NumberedRowsToggleItem.d.ts +2 -0
  140. package/dist/types-ts4.5/ui/TableMenu/row/keys.d.ts +5 -7
  141. package/dist/types-ts4.5/ui/TableMenu/shared/TableMenu.d.ts +9 -0
  142. package/dist/types-ts4.5/ui/TableMenu/shared/consts.d.ts +1 -1
  143. package/dist/types-ts4.5/ui/TableMenu/shared/getSharedItems.d.ts +2 -0
  144. package/dist/types-ts4.5/ui/TableMenu/shared/getTableMenuComponents.d.ts +2 -0
  145. package/dist/types-ts4.5/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +1 -5
  146. package/dist/types-ts4.5/ui/TableMenu/shared/items/ClearCellsItem.d.ts +1 -5
  147. package/dist/types-ts4.5/ui/TableMenu/shared/keys.d.ts +3 -0
  148. package/package.json +13 -16
  149. package/dist/cjs/ui/TableMenu/row/RowMenu.js +0 -35
  150. package/dist/cjs/ui/TableMenu/row/RowMenuItems.js +0 -130
  151. package/dist/es2019/ui/TableMenu/row/RowMenu.js +0 -27
  152. package/dist/es2019/ui/TableMenu/row/RowMenuItems.js +0 -126
  153. package/dist/esm/ui/TableMenu/row/RowMenu.js +0 -28
  154. package/dist/esm/ui/TableMenu/row/RowMenuItems.js +0 -123
  155. package/dist/types/ui/TableMenu/row/RowMenu.d.ts +0 -7
  156. package/dist/types/ui/TableMenu/row/RowMenuItems.d.ts +0 -8
  157. package/dist/types-ts4.5/ui/TableMenu/row/RowMenu.d.ts +0 -7
  158. package/dist/types-ts4.5/ui/TableMenu/row/RowMenuItems.d.ts +0 -8
  159. /package/dist/cjs/ui/TableMenu/{row/RowMenu.compiled.css → shared/TableMenu.compiled.css} +0 -0
  160. /package/dist/es2019/ui/TableMenu/{row/RowMenu.compiled.css → shared/TableMenu.compiled.css} +0 -0
  161. /package/dist/esm/ui/TableMenu/{row/RowMenu.compiled.css → shared/TableMenu.compiled.css} +0 -0
@@ -0,0 +1,93 @@
1
+ import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from '../shared/keys';
2
+
3
+ // --- Menu surface ---
4
+
5
+ export const COLUMN_MENU = {
6
+ type: 'menu',
7
+ key: 'column-handle-menu'
8
+ };
9
+
10
+ // --- Sections ---
11
+
12
+ export const COLUMN_TOGGLE_SECTION = {
13
+ type: 'menu-section',
14
+ key: 'column-toggle-section'
15
+ };
16
+ export const COLUMN_BACKGROUND_SECTION = {
17
+ type: 'menu-section',
18
+ key: 'column-background-section'
19
+ };
20
+ export const COLUMN_SORT_SECTION = {
21
+ type: 'menu-section',
22
+ key: 'column-sort-section'
23
+ };
24
+ export const COLUMN_ADD_SECTION = {
25
+ type: 'menu-section',
26
+ key: 'column-add-section'
27
+ };
28
+ export const COLUMN_DANGER_SECTION = {
29
+ type: 'menu-section',
30
+ key: 'column-danger-section'
31
+ };
32
+ export const COLUMN_SECTION_RANK = {
33
+ [COLUMN_TOGGLE_SECTION.key]: 100,
34
+ [COLUMN_BACKGROUND_SECTION.key]: 200,
35
+ [COLUMN_SORT_SECTION.key]: 300,
36
+ [COLUMN_ADD_SECTION.key]: 400,
37
+ [COLUMN_DANGER_SECTION.key]: 500
38
+ };
39
+ export const HEADER_COLUMN_TOGGLE_ITEM = {
40
+ type: 'menu-item',
41
+ key: 'header-column-toggle'
42
+ };
43
+ export const SORT_INCREASING_ITEM = {
44
+ type: 'menu-item',
45
+ key: 'sort-increasing'
46
+ };
47
+ export const SORT_DECREASING_ITEM = {
48
+ type: 'menu-item',
49
+ key: 'sort-decreasing'
50
+ };
51
+ export const ADD_COLUMN_LEFT_ITEM = {
52
+ type: 'menu-item',
53
+ key: 'add-column-left'
54
+ };
55
+ export const ADD_COLUMN_RIGHT_ITEM = {
56
+ type: 'menu-item',
57
+ key: 'add-column-right'
58
+ };
59
+ export const MOVE_COLUMN_RIGHT_ITEM = {
60
+ type: 'menu-item',
61
+ key: 'move-column-right'
62
+ };
63
+ export const DISTRIBUTE_COLUMNS_ITEM = {
64
+ type: 'menu-item',
65
+ key: 'distribute-columns'
66
+ };
67
+ export const DELETE_COLUMN_ITEM = {
68
+ type: 'menu-item',
69
+ key: 'delete-column'
70
+ };
71
+
72
+ // --- Item ranks within their sections ---
73
+
74
+ export const COLUMN_TOGGLE_SECTION_RANK = {
75
+ [HEADER_COLUMN_TOGGLE_ITEM.key]: 100
76
+ };
77
+ export const COLUMN_BACKGROUND_SECTION_RANK = {
78
+ [BACKGROUND_COLOR_ITEM.key]: 100
79
+ };
80
+ export const COLUMN_SORT_SECTION_RANK = {
81
+ [SORT_INCREASING_ITEM.key]: 100,
82
+ [SORT_DECREASING_ITEM.key]: 200
83
+ };
84
+ export const COLUMN_ADD_SECTION_RANK = {
85
+ [ADD_COLUMN_LEFT_ITEM.key]: 100,
86
+ [ADD_COLUMN_RIGHT_ITEM.key]: 200,
87
+ [MOVE_COLUMN_RIGHT_ITEM.key]: 300,
88
+ [DISTRIBUTE_COLUMNS_ITEM.key]: 400
89
+ };
90
+ export const COLUMN_DANGER_SECTION_RANK = {
91
+ [CLEAR_CELLS_ITEM.key]: 100,
92
+ [DELETE_COLUMN_ITEM.key]: 200
93
+ };
@@ -1,9 +1,13 @@
1
1
  import React from 'react';
2
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';
3
+ import { AddRowAboveItem } from './items/AddRowAboveItem';
4
+ import { AddRowBelowItem } from './items/AddRowBelowItem';
5
+ import { DeleteRowItem } from './items/DeleteRowItem';
6
+ import { HeaderRowToggleItem } from './items/HeaderRowToggleItem';
7
+ import { MoveRowDownItem } from './items/MoveRowDownItem';
8
+ import { MoveRowUpItem } from './items/MoveRowUpItem';
9
+ import { NumberedRowsToggleItem } from './items/NumberedRowsToggleItem';
10
+ import { ROW_MENU, ROW_TOGGLE_SECTION, ROW_BACKGROUND_SECTION, ROW_ADD_SECTION, ROW_DANGER_SECTION, ROW_MENU_SECTION_RANK, HEADER_ROW_TOGGLE_ITEM, NUMBERED_ROWS_TOGGLE_ITEM, ADD_ROW_ABOVE_ITEM, ADD_ROW_BELOW_ITEM, MOVE_ROW_UP_ITEM, MOVE_ROW_DOWN_ITEM, DELETE_ROW_ITEM, ROW_TOGGLE_SECTION_RANK, ROW_ADD_SECTION_RANK, ROW_DANGER_SECTION_RANK } from './keys';
7
11
 
8
12
  /**
9
13
  * Returns the RegisterComponent[] array defining the row menu surface.
@@ -25,7 +29,7 @@ export const getRowMenuComponents = () => [
25
29
  parents: [{
26
30
  type: ROW_MENU.type,
27
31
  key: ROW_MENU.key,
28
- rank: ROW_SECTION_RANK[ROW_TOGGLE_SECTION.key]
32
+ rank: ROW_MENU_SECTION_RANK[ROW_TOGGLE_SECTION.key]
29
33
  }],
30
34
  component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
31
35
  }, {
@@ -34,7 +38,7 @@ export const getRowMenuComponents = () => [
34
38
  parents: [{
35
39
  type: ROW_TOGGLE_SECTION.type,
36
40
  key: ROW_TOGGLE_SECTION.key,
37
- rank: TOGGLE_SECTION_ITEM_RANK[HEADER_ROW_TOGGLE_ITEM.key]
41
+ rank: ROW_TOGGLE_SECTION_RANK[HEADER_ROW_TOGGLE_ITEM.key]
38
42
  }],
39
43
  component: () => /*#__PURE__*/React.createElement(HeaderRowToggleItem, null)
40
44
  }, {
@@ -43,7 +47,7 @@ export const getRowMenuComponents = () => [
43
47
  parents: [{
44
48
  type: ROW_TOGGLE_SECTION.type,
45
49
  key: ROW_TOGGLE_SECTION.key,
46
- rank: TOGGLE_SECTION_ITEM_RANK[NUMBERED_ROWS_TOGGLE_ITEM.key]
50
+ rank: ROW_TOGGLE_SECTION_RANK[NUMBERED_ROWS_TOGGLE_ITEM.key]
47
51
  }],
48
52
  component: () => /*#__PURE__*/React.createElement(NumberedRowsToggleItem, null)
49
53
  },
@@ -54,22 +58,11 @@ export const getRowMenuComponents = () => [
54
58
  parents: [{
55
59
  type: ROW_MENU.type,
56
60
  key: ROW_MENU.key,
57
- rank: ROW_SECTION_RANK[ROW_BACKGROUND_SECTION.key]
61
+ rank: ROW_MENU_SECTION_RANK[ROW_BACKGROUND_SECTION.key]
58
62
  }],
59
63
  component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
60
64
  hasSeparator: true
61
65
  }, 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
66
  },
74
67
  // --- Add / Move section ---
75
68
  {
@@ -78,7 +71,7 @@ export const getRowMenuComponents = () => [
78
71
  parents: [{
79
72
  type: ROW_MENU.type,
80
73
  key: ROW_MENU.key,
81
- rank: ROW_SECTION_RANK[ROW_ADD_SECTION.key]
74
+ rank: ROW_MENU_SECTION_RANK[ROW_ADD_SECTION.key]
82
75
  }],
83
76
  component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
84
77
  hasSeparator: true
@@ -89,7 +82,7 @@ export const getRowMenuComponents = () => [
89
82
  parents: [{
90
83
  type: ROW_ADD_SECTION.type,
91
84
  key: ROW_ADD_SECTION.key,
92
- rank: ADD_SECTION_ITEM_RANK[ADD_ROW_ABOVE_ITEM.key]
85
+ rank: ROW_ADD_SECTION_RANK[ADD_ROW_ABOVE_ITEM.key]
93
86
  }],
94
87
  component: () => /*#__PURE__*/React.createElement(AddRowAboveItem, null)
95
88
  }, {
@@ -98,7 +91,7 @@ export const getRowMenuComponents = () => [
98
91
  parents: [{
99
92
  type: ROW_ADD_SECTION.type,
100
93
  key: ROW_ADD_SECTION.key,
101
- rank: ADD_SECTION_ITEM_RANK[ADD_ROW_BELOW_ITEM.key]
94
+ rank: ROW_ADD_SECTION_RANK[ADD_ROW_BELOW_ITEM.key]
102
95
  }],
103
96
  component: () => /*#__PURE__*/React.createElement(AddRowBelowItem, null)
104
97
  }, {
@@ -107,7 +100,7 @@ export const getRowMenuComponents = () => [
107
100
  parents: [{
108
101
  type: ROW_ADD_SECTION.type,
109
102
  key: ROW_ADD_SECTION.key,
110
- rank: ADD_SECTION_ITEM_RANK[MOVE_ROW_UP_ITEM.key]
103
+ rank: ROW_ADD_SECTION_RANK[MOVE_ROW_UP_ITEM.key]
111
104
  }],
112
105
  component: () => /*#__PURE__*/React.createElement(MoveRowUpItem, null)
113
106
  }, {
@@ -116,7 +109,7 @@ export const getRowMenuComponents = () => [
116
109
  parents: [{
117
110
  type: ROW_ADD_SECTION.type,
118
111
  key: ROW_ADD_SECTION.key,
119
- rank: ADD_SECTION_ITEM_RANK[MOVE_ROW_DOWN_ITEM.key]
112
+ rank: ROW_ADD_SECTION_RANK[MOVE_ROW_DOWN_ITEM.key]
120
113
  }],
121
114
  component: () => /*#__PURE__*/React.createElement(MoveRowDownItem, null)
122
115
  },
@@ -127,29 +120,18 @@ export const getRowMenuComponents = () => [
127
120
  parents: [{
128
121
  type: ROW_MENU.type,
129
122
  key: ROW_MENU.key,
130
- rank: ROW_SECTION_RANK[ROW_DANGER_SECTION.key]
123
+ rank: ROW_MENU_SECTION_RANK[ROW_DANGER_SECTION.key]
131
124
  }],
132
125
  component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
133
126
  hasSeparator: true
134
127
  }, 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
128
  }, {
147
129
  type: DELETE_ROW_ITEM.type,
148
130
  key: DELETE_ROW_ITEM.key,
149
131
  parents: [{
150
132
  type: ROW_DANGER_SECTION.type,
151
133
  key: ROW_DANGER_SECTION.key,
152
- rank: DANGER_SECTION_ITEM_RANK[DELETE_ROW_ITEM.key]
134
+ rank: ROW_DANGER_SECTION_RANK[DELETE_ROW_ITEM.key]
153
135
  }],
154
136
  component: () => /*#__PURE__*/React.createElement(DeleteRowItem, null)
155
137
  }];
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { addRowBefore, tooltip } from '@atlaskit/editor-common/keymaps';
4
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { TableRowAddAboveIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
6
+ export const AddRowAboveItem = () => {
7
+ var _tooltip;
8
+ const {
9
+ formatMessage
10
+ } = useIntl();
11
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
12
+ elemBefore: /*#__PURE__*/React.createElement(TableRowAddAboveIcon, {
13
+ color: "currentColor",
14
+ label: "",
15
+ size: "small"
16
+ }),
17
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
18
+ shortcut: (_tooltip = tooltip(addRowBefore)) !== null && _tooltip !== void 0 ? _tooltip : ''
19
+ })
20
+ }, formatMessage(messages.addRowAbove));
21
+ };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { addRowAfter, tooltip } from '@atlaskit/editor-common/keymaps';
4
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { TableRowAddBelowIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
6
+ export const AddRowBelowItem = () => {
7
+ var _tooltip;
8
+ const {
9
+ formatMessage
10
+ } = useIntl();
11
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
12
+ elemBefore: /*#__PURE__*/React.createElement(TableRowAddBelowIcon, {
13
+ color: "currentColor",
14
+ label: "",
15
+ size: "small"
16
+ }),
17
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
18
+ shortcut: (_tooltip = tooltip(addRowAfter)) !== null && _tooltip !== void 0 ? _tooltip : ''
19
+ })
20
+ }, formatMessage(messages.addRowBelow));
21
+ };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { deleteRow, tooltip } from '@atlaskit/editor-common/keymaps';
4
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
6
+ export const DeleteRowItem = () => {
7
+ var _tooltip;
8
+ const {
9
+ formatMessage
10
+ } = useIntl();
11
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
12
+ elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
13
+ color: "currentColor",
14
+ label: "",
15
+ size: "small"
16
+ }),
17
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
18
+ shortcut: (_tooltip = tooltip(deleteRow)) !== null && _tooltip !== void 0 ? _tooltip : ''
19
+ })
20
+ }, formatMessage(messages.removeRows, {
21
+ 0: 1
22
+ }));
23
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
4
+ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
5
+ import Toggle from '@atlaskit/toggle';
6
+ export const HeaderRowToggleItem = () => {
7
+ const {
8
+ formatMessage
9
+ } = useIntl();
10
+ const label = formatMessage(messages.headerRow);
11
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
12
+ elemAfter: /*#__PURE__*/React.createElement(Toggle, {
13
+ label: label,
14
+ isChecked: false
15
+ })
16
+ }, label);
17
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { moveRowDown, moveRowDownOld, tooltip } from '@atlaskit/editor-common/keymaps';
4
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { TableRowMoveDownIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
+ const getMoveRowDownShortcut = () => tooltip(expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true) ? moveRowDown : moveRowDownOld);
8
+ export const MoveRowDownItem = () => {
9
+ var _getMoveRowDownShortc;
10
+ const {
11
+ formatMessage
12
+ } = useIntl();
13
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
14
+ elemBefore: /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
15
+ color: "currentColor",
16
+ label: "",
17
+ size: "small"
18
+ }),
19
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
20
+ shortcut: (_getMoveRowDownShortc = getMoveRowDownShortcut()) !== null && _getMoveRowDownShortc !== void 0 ? _getMoveRowDownShortc : ''
21
+ })
22
+ }, formatMessage(messages.moveRowDown, {
23
+ 0: 1
24
+ }));
25
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { moveRowUp, moveRowUpOld, tooltip } from '@atlaskit/editor-common/keymaps';
4
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { TableRowMoveUpIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
+ const getMoveRowUpShortcut = () => tooltip(expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true) ? moveRowUp : moveRowUpOld);
8
+ export const MoveRowUpItem = () => {
9
+ var _getMoveRowUpShortcut;
10
+ const {
11
+ formatMessage
12
+ } = useIntl();
13
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
14
+ elemBefore: /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
15
+ color: "currentColor",
16
+ label: "",
17
+ size: "small"
18
+ }),
19
+ elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
20
+ shortcut: (_getMoveRowUpShortcut = getMoveRowUpShortcut()) !== null && _getMoveRowUpShortcut !== void 0 ? _getMoveRowUpShortcut : ''
21
+ })
22
+ }, formatMessage(messages.moveRowUp, {
23
+ 0: 1
24
+ }));
25
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
4
+ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
5
+ import Toggle from '@atlaskit/toggle';
6
+ export const NumberedRowsToggleItem = () => {
7
+ const {
8
+ formatMessage
9
+ } = useIntl();
10
+ const label = formatMessage(messages.numberedRows);
11
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
12
+ elemAfter: /*#__PURE__*/React.createElement(Toggle, {
13
+ label: label,
14
+ isChecked: false
15
+ })
16
+ }, label);
17
+ };
@@ -1,3 +1,5 @@
1
+ import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from '../shared/keys';
2
+
1
3
  // --- Menu surface ---
2
4
 
3
5
  export const ROW_MENU = {
@@ -23,7 +25,7 @@ export const ROW_DANGER_SECTION = {
23
25
  type: 'menu-section',
24
26
  key: 'row-danger-section'
25
27
  };
26
- export const ROW_SECTION_RANK = {
28
+ export const ROW_MENU_SECTION_RANK = {
27
29
  [ROW_TOGGLE_SECTION.key]: 100,
28
30
  [ROW_BACKGROUND_SECTION.key]: 200,
29
31
  [ROW_ADD_SECTION.key]: 300,
@@ -37,10 +39,6 @@ export const NUMBERED_ROWS_TOGGLE_ITEM = {
37
39
  type: 'menu-item',
38
40
  key: 'numbered-rows-toggle'
39
41
  };
40
- export const BACKGROUND_COLOR_ITEM = {
41
- type: 'menu-item',
42
- key: 'background-color'
43
- };
44
42
  export const ADD_ROW_ABOVE_ITEM = {
45
43
  type: 'menu-item',
46
44
  key: 'add-row-above'
@@ -57,10 +55,6 @@ export const MOVE_ROW_DOWN_ITEM = {
57
55
  type: 'menu-item',
58
56
  key: 'move-row-down'
59
57
  };
60
- export const CLEAR_CELLS_ITEM = {
61
- type: 'menu-item',
62
- key: 'clear-cells'
63
- };
64
58
  export const DELETE_ROW_ITEM = {
65
59
  type: 'menu-item',
66
60
  key: 'delete-row'
@@ -68,20 +62,20 @@ export const DELETE_ROW_ITEM = {
68
62
 
69
63
  // --- Item ranks within their sections ---
70
64
 
71
- export const TOGGLE_SECTION_ITEM_RANK = {
65
+ export const ROW_TOGGLE_SECTION_RANK = {
72
66
  [HEADER_ROW_TOGGLE_ITEM.key]: 100,
73
67
  [NUMBERED_ROWS_TOGGLE_ITEM.key]: 200
74
68
  };
75
- export const BACKGROUND_SECTION_ITEM_RANK = {
69
+ export const ROW_BACKGROUND_SECTION_RANK = {
76
70
  [BACKGROUND_COLOR_ITEM.key]: 100
77
71
  };
78
- export const ADD_SECTION_ITEM_RANK = {
72
+ export const ROW_ADD_SECTION_RANK = {
79
73
  [ADD_ROW_ABOVE_ITEM.key]: 100,
80
74
  [ADD_ROW_BELOW_ITEM.key]: 200,
81
75
  [MOVE_ROW_UP_ITEM.key]: 300,
82
76
  [MOVE_ROW_DOWN_ITEM.key]: 400
83
77
  };
84
- export const DANGER_SECTION_ITEM_RANK = {
78
+ export const ROW_DANGER_SECTION_RANK = {
85
79
  [CLEAR_CELLS_ITEM.key]: 100,
86
80
  [DELETE_ROW_ITEM.key]: 200
87
81
  };
@@ -0,0 +1,28 @@
1
+ /* TableMenu.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import "./TableMenu.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React, { memo, useMemo } from 'react';
5
+ import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
6
+ import { Box } from '@atlaskit/primitives/compiled';
7
+ const tableMenuContainerStyles = {
8
+ container: "_2rko1qi0 _1reo15vq _18m915vq _1bsb1178 _16qs130s _bfhk1bhr"
9
+ };
10
+ export const TableMenu = /*#__PURE__*/memo(({
11
+ api,
12
+ surface
13
+ }) => {
14
+ const components = useMemo(() => {
15
+ var _api$uiControlRegistr, _api$uiControlRegistr2;
16
+ return (_api$uiControlRegistr = api === null || api === void 0 ? void 0 : (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(surface.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
17
+ }, [api, surface.key]);
18
+ if (components.length === 0) {
19
+ return null;
20
+ }
21
+ return /*#__PURE__*/React.createElement(Box, {
22
+ xcss: tableMenuContainerStyles.container,
23
+ testId: surface.key
24
+ }, /*#__PURE__*/React.createElement(SurfaceRenderer, {
25
+ surface: surface,
26
+ components: components
27
+ }));
28
+ });
@@ -1 +1 @@
1
- export const newMenuWidth = 280;
1
+ export const TABLE_MENU_WIDTH = 280;
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { COLUMN_BACKGROUND_SECTION, COLUMN_DANGER_SECTION, COLUMN_BACKGROUND_SECTION_RANK, COLUMN_DANGER_SECTION_RANK } from '../column/keys';
3
+ import { ROW_BACKGROUND_SECTION, ROW_DANGER_SECTION, ROW_BACKGROUND_SECTION_RANK, ROW_DANGER_SECTION_RANK } from '../row/keys';
4
+ import { BackgroundColorItem } from './items/BackgroundColorItem';
5
+ import { ClearCellsItem } from './items/ClearCellsItem';
6
+ import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from './keys';
7
+ export const getSharedItems = () => [{
8
+ type: BACKGROUND_COLOR_ITEM.type,
9
+ key: BACKGROUND_COLOR_ITEM.key,
10
+ parents: [{
11
+ type: ROW_BACKGROUND_SECTION.type,
12
+ key: ROW_BACKGROUND_SECTION.key,
13
+ rank: ROW_BACKGROUND_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
14
+ }, {
15
+ type: COLUMN_BACKGROUND_SECTION.type,
16
+ key: COLUMN_BACKGROUND_SECTION.key,
17
+ rank: COLUMN_BACKGROUND_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
18
+ }],
19
+ component: () => /*#__PURE__*/React.createElement(BackgroundColorItem, null)
20
+ }, {
21
+ type: CLEAR_CELLS_ITEM.type,
22
+ key: CLEAR_CELLS_ITEM.key,
23
+ parents: [{
24
+ type: ROW_DANGER_SECTION.type,
25
+ key: ROW_DANGER_SECTION.key,
26
+ rank: ROW_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
27
+ }, {
28
+ type: COLUMN_DANGER_SECTION.type,
29
+ key: COLUMN_DANGER_SECTION.key,
30
+ rank: COLUMN_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
31
+ }],
32
+ component: () => /*#__PURE__*/React.createElement(ClearCellsItem, null)
33
+ }];
@@ -0,0 +1,4 @@
1
+ import { getColumnMenuComponents } from '../column/getColumnMenuComponents';
2
+ import { getRowMenuComponents } from '../row/getRowMenuComponents';
3
+ import { getSharedItems } from './getSharedItems';
4
+ export const getTableMenuComponents = () => [...getRowMenuComponents(), ...getColumnMenuComponents(), ...getSharedItems()];
@@ -14,17 +14,15 @@ const colorPaletteStyles = {
14
14
  elemAfter: "_zulp1b66 _1e0c1txw _4cvr1h6o",
15
15
  colorPreview: "_2rko12b0 _1h6d1l7x _1dqonqa1 _189ee4h9 _1bsbdlk8 _4t3idlk8 _1o9zidpf"
16
16
  };
17
- export const BackgroundColorItem = ({
18
- testId
19
- }) => {
17
+ export const BackgroundColorItem = () => {
20
18
  const {
21
19
  formatMessage
22
20
  } = useIntl();
23
- const selectedColor = '#ffffff';
24
21
  const onClick = useCallback(() => {}, []);
22
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
25
23
  const colorPreviewStyle = useMemo(() => ({
26
- backgroundColor: selectedColor
27
- }), [selectedColor]);
24
+ backgroundColor: '#ffffff'
25
+ }), []);
28
26
  const paletteOptions = useMemo(() => {
29
27
  return {
30
28
  palette: cellBackgroundColorPalette,
@@ -33,7 +31,6 @@ export const BackgroundColorItem = ({
33
31
  };
34
32
  }, []);
35
33
  return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
36
- testId: testId,
37
34
  elemBefore: /*#__PURE__*/React.createElement(PaintBucketIcon, {
38
35
  color: "currentColor",
39
36
  label: "",
@@ -54,7 +51,7 @@ export const BackgroundColorItem = ({
54
51
  }, /*#__PURE__*/React.createElement(ColorPalette, {
55
52
  cols: colorPaletteColumns,
56
53
  onClick: onClick,
57
- selectedColor: selectedColor,
54
+ selectedColor: colorPreviewStyle.backgroundColor,
58
55
  paletteOptions: paletteOptions
59
56
  })));
60
57
  };
@@ -3,15 +3,12 @@ import { useIntl } from 'react-intl';
3
3
  import { backspace, tooltip } from '@atlaskit/editor-common/keymaps';
4
4
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
5
  import { CrossIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
6
- export const ClearCellsItem = ({
7
- testId
8
- }) => {
6
+ export const ClearCellsItem = () => {
9
7
  var _tooltip;
10
8
  const {
11
9
  formatMessage
12
10
  } = useIntl();
13
11
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
14
- testId: testId,
15
12
  elemBefore: /*#__PURE__*/React.createElement(CrossIcon, {
16
13
  color: "currentColor",
17
14
  label: "",
@@ -0,0 +1,8 @@
1
+ export const BACKGROUND_COLOR_ITEM = {
2
+ type: 'menu-item',
3
+ key: 'background-color'
4
+ };
5
+ export const CLEAR_CELLS_ITEM = {
6
+ type: 'menu-item',
7
+ key: 'clear-cells'
8
+ };