@atlaskit/editor-plugin-table 7.2.1 → 7.2.3

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 (124) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +11 -7
  3. package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -19
  4. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +11 -25
  5. package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +13 -3
  6. package/dist/cjs/ui/TableFloatingColumnControls/index.js +7 -3
  7. package/dist/cjs/utils/drag-menu.js +37 -23
  8. package/dist/cjs/utils/merged-cells.js +66 -1
  9. package/dist/es2019/nodeviews/TableComponent.js +9 -5
  10. package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
  11. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -21
  12. package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +10 -2
  13. package/dist/es2019/ui/TableFloatingColumnControls/index.js +7 -3
  14. package/dist/es2019/utils/drag-menu.js +38 -14
  15. package/dist/es2019/utils/merged-cells.js +73 -0
  16. package/dist/esm/nodeviews/TableComponent.js +11 -7
  17. package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
  18. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -21
  19. package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +10 -2
  20. package/dist/esm/ui/TableFloatingColumnControls/index.js +7 -3
  21. package/dist/esm/utils/drag-menu.js +36 -22
  22. package/dist/esm/utils/merged-cells.js +65 -0
  23. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
  24. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -0
  25. package/dist/types/ui/TableFloatingColumnControls/index.d.ts +1 -0
  26. package/dist/types/utils/drag-menu.d.ts +4 -1
  27. package/dist/types/utils/merged-cells.d.ts +2 -0
  28. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
  29. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -0
  30. package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +1 -0
  31. package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -1
  32. package/dist/types-ts4.5/utils/merged-cells.d.ts +2 -0
  33. package/package.json +9 -16
  34. package/src/nodeviews/TableComponent.tsx +1 -0
  35. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +11 -32
  36. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +6 -27
  37. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +12 -1
  38. package/src/ui/TableFloatingColumnControls/index.tsx +5 -0
  39. package/src/utils/drag-menu.ts +94 -20
  40. package/src/utils/merged-cells.ts +78 -0
  41. package/tsconfig.dev.json +0 -69
  42. package/tsconfig.json +2 -871
  43. package/examples/99-testing.tsx +0 -140
  44. package/examples/config.jsonc +0 -14
  45. package/src/__tests__/unit/analytics.ts +0 -888
  46. package/src/__tests__/unit/collab.ts +0 -93
  47. package/src/__tests__/unit/commands/go-to-next-cell.ts +0 -173
  48. package/src/__tests__/unit/commands/insert.ts +0 -137
  49. package/src/__tests__/unit/commands/misc.ts +0 -185
  50. package/src/__tests__/unit/commands/sort.ts +0 -128
  51. package/src/__tests__/unit/commands.ts +0 -745
  52. package/src/__tests__/unit/copy-button.ts +0 -22
  53. package/src/__tests__/unit/copy-paste.ts +0 -677
  54. package/src/__tests__/unit/event-handlers/index.ts +0 -125
  55. package/src/__tests__/unit/event-handlers.ts +0 -296
  56. package/src/__tests__/unit/fix-tables.ts +0 -164
  57. package/src/__tests__/unit/get-toolbar-config.ts +0 -127
  58. package/src/__tests__/unit/handlers.ts +0 -98
  59. package/src/__tests__/unit/hover-selection.ts +0 -230
  60. package/src/__tests__/unit/index-with-fake-timers.ts +0 -111
  61. package/src/__tests__/unit/index.ts +0 -912
  62. package/src/__tests__/unit/layout.ts +0 -146
  63. package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +0 -162
  64. package/src/__tests__/unit/nodeviews/TableComponent.tsx +0 -280
  65. package/src/__tests__/unit/nodeviews/TableContainer.tsx +0 -525
  66. package/src/__tests__/unit/nodeviews/cell.ts +0 -132
  67. package/src/__tests__/unit/nodeviews/table.ts +0 -129
  68. package/src/__tests__/unit/pm-plugins/analytics.ts +0 -327
  69. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +0 -94
  70. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +0 -176
  71. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +0 -211
  72. package/src/__tests__/unit/pm-plugins/main.ts +0 -214
  73. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -101
  74. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +0 -562
  75. package/src/__tests__/unit/pm-plugins/table-local-id.ts +0 -507
  76. package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +0 -269
  77. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +0 -192
  78. package/src/__tests__/unit/pm-plugins/table-resizing/utils/resize-state.ts +0 -33
  79. package/src/__tests__/unit/pm-plugins/table-width.ts +0 -292
  80. package/src/__tests__/unit/sort-column.ts +0 -399
  81. package/src/__tests__/unit/toolbar.ts +0 -512
  82. package/src/__tests__/unit/transforms/delete-columns.ts +0 -597
  83. package/src/__tests__/unit/transforms/delete-rows.ts +0 -620
  84. package/src/__tests__/unit/transforms/merging.ts +0 -392
  85. package/src/__tests__/unit/ui/ContextualMenu.tsx +0 -71
  86. package/src/__tests__/unit/ui/CornerControls.tsx +0 -99
  87. package/src/__tests__/unit/ui/DeleteButton.tsx +0 -38
  88. package/src/__tests__/unit/ui/FixedButton.tsx +0 -217
  89. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +0 -123
  90. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +0 -68
  91. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +0 -178
  92. package/src/__tests__/unit/ui/FloatingDragMenu.tsx +0 -511
  93. package/src/__tests__/unit/ui/FloatingInsertButton.tsx +0 -322
  94. package/src/__tests__/unit/ui/NumberColumn.tsx +0 -146
  95. package/src/__tests__/unit/ui/RowControls.tsx +0 -294
  96. package/src/__tests__/unit/ui/RowDragControls.tsx +0 -129
  97. package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +0 -189
  98. package/src/__tests__/unit/ui/TableFloatingControls.tsx +0 -118
  99. package/src/__tests__/unit/undo-redo.ts +0 -220
  100. package/src/__tests__/unit/utils/analytics.ts +0 -98
  101. package/src/__tests__/unit/utils/collapse.ts +0 -57
  102. package/src/__tests__/unit/utils/column-controls.ts +0 -205
  103. package/src/__tests__/unit/utils/dom.ts +0 -180
  104. package/src/__tests__/unit/utils/merged-cells.ts +0 -156
  105. package/src/__tests__/unit/utils/nodes.ts +0 -79
  106. package/src/__tests__/unit/utils/row-controls.ts +0 -195
  107. package/src/__tests__/unit/utils/table.ts +0 -96
  108. package/src/__tests__/unit/utils.ts +0 -670
  109. package/src/__tests__/visual-regression/__fixtures__/sticky-header-with-horizontal-scroll.json +0 -5228
  110. package/src/__tests__/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -20272
  111. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +0 -3
  112. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +0 -3
  113. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +0 -3
  114. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +0 -3
  115. package/src/__tests__/visual-regression/__image_snapshots__/copy-button-ts-floating-toolbar-copy-button-table-target-node-displays-blue-border-when-copy-button-is-hovered-1-snap.png +0 -3
  116. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-1-snap.png +0 -3
  117. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-2-snap.png +0 -3
  118. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-3-snap.png +0 -3
  119. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-1-snap.png +0 -3
  120. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +0 -3
  121. package/src/__tests__/visual-regression/cell-options-menu.ts +0 -101
  122. package/src/__tests__/visual-regression/copy-button.ts +0 -181
  123. package/src/__tests__/visual-regression/index.ts +0 -62
  124. package/src/__tests__/visual-regression/sticky-header.ts +0 -61
@@ -18,9 +18,35 @@ import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizi
18
18
  import { getClosestSelectionRect } from '../toolbar';
19
19
  import { deleteRows } from '../transforms';
20
20
  import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
21
+ import { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
21
22
  import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
22
- const canDecrease = (index, min = 0) => index !== undefined && index > min;
23
- const canIncrease = (index, max = 0) => index !== undefined && index < max;
23
+ export const getTargetIndex = (selectedIndexes, direction) => Math[direction < 0 ? 'min' : 'max'](...selectedIndexes) + direction;
24
+ export const canMove = (sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect) => {
25
+ if (!selectionRect) {
26
+ return false;
27
+ }
28
+ const isRow = sourceType === 'table-row';
29
+ const selectedIndexes = isRow ? getSelectedRowIndexes(selectionRect) : getSelectedColumnIndexes(selectionRect);
30
+ const targetIndex = getTargetIndex(selectedIndexes, direction);
31
+ const isValidTargetIndex = targetIndex >= 0 && targetIndex < totalItemsOfSourceTypeCount;
32
+ if (!isValidTargetIndex) {
33
+ return false;
34
+ }
35
+
36
+ // We can't move column when target has merges with other columns
37
+ // We can't move row when target has merges with other rows
38
+ const hasMergedCellsInTarget = isRow ? hasMergedCellsWithRowNextToRowIndex(targetIndex, selection) : hasMergedCellsWithColumnNextToColumnIndex(targetIndex, selection);
39
+ if (hasMergedCellsInTarget) {
40
+ return false;
41
+ }
42
+
43
+ // Currently we can't move in any direction if there are merged cells in the source
44
+ const hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
45
+ if (hasMergedCellsInSource) {
46
+ return false;
47
+ }
48
+ return true;
49
+ };
24
50
  const isDistributeColumnsEnabled = state => {
25
51
  const rect = getClosestSelectionRect(state);
26
52
  if (rect) {
@@ -30,6 +56,7 @@ const isDistributeColumnsEnabled = state => {
30
56
  return false;
31
57
  };
32
58
  export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI) => {
59
+ var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
33
60
  const addOptions = direction === 'row' ? [{
34
61
  label: 'above',
35
62
  offset: 0,
@@ -51,38 +78,35 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
51
78
  icon: AddColRightIcon,
52
79
  keymap: addColumnAfter
53
80
  }];
81
+ const {
82
+ selection
83
+ } = editorView.state;
54
84
  const moveOptions = direction === 'row' ? [{
55
85
  label: 'up',
56
86
  icon: ArrowUpIcon,
57
87
  keymap: moveRowUp,
58
- canMove: selectionRect => canDrag && canDecrease(selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.top),
88
+ canMove: canDrag && canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
59
89
  getOriginIndexes: getSelectedRowIndexes,
60
90
  getTargetIndex: selectionRect => selectionRect.top - 1
61
91
  }, {
62
92
  label: 'down',
63
93
  icon: ArrowDownIcon,
64
94
  keymap: moveRowDown,
65
- canMove: selectionRect => {
66
- var _selectionRect$bottom, _tableMap$height;
67
- return canDrag && canIncrease(((_selectionRect$bottom = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.bottom) !== null && _selectionRect$bottom !== void 0 ? _selectionRect$bottom : 0) - 1, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
68
- },
95
+ canMove: canDrag && canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
69
96
  getOriginIndexes: getSelectedRowIndexes,
70
97
  getTargetIndex: selectionRect => selectionRect.bottom
71
98
  }] : [{
72
99
  label: 'left',
73
100
  icon: ArrowLeftIcon,
74
101
  keymap: moveColumnLeft,
75
- canMove: selectionRect => canDrag && canDecrease(selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.left),
102
+ canMove: canDrag && canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
76
103
  getOriginIndexes: getSelectedColumnIndexes,
77
104
  getTargetIndex: selectionRect => selectionRect.left - 1
78
105
  }, {
79
106
  label: 'right',
80
107
  icon: ArrowRightIcon,
81
108
  keymap: moveColumnRight,
82
- canMove: selectionRect => {
83
- var _selectionRect$right, _tableMap$width;
84
- return canDrag && canIncrease(((_selectionRect$right = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right) !== null && _selectionRect$right !== void 0 ? _selectionRect$right : 0) - 1, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
85
- },
109
+ canMove: canDrag && canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
86
110
  getOriginIndexes: getSelectedColumnIndexes,
87
111
  getTargetIndex: selectionRect => selectionRect.right
88
112
  }];
@@ -166,10 +190,10 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
166
190
  }) => ({
167
191
  id: `move_${direction}_${label}`,
168
192
  title: `Move ${direction} ${label}`,
169
- disabled: !canMove(selectionRect),
193
+ disabled: !canMove,
170
194
  icon,
171
195
  onClick: (state, dispatch) => {
172
- if (canMove(selectionRect)) {
196
+ if (canMove) {
173
197
  requestAnimationFrame(() => {
174
198
  moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, `table-${direction}`, getOriginIndexes(selectionRect), getTargetIndex(selectionRect))(editorView.state, editorView.dispatch);
175
199
  });
@@ -107,4 +107,77 @@ export const hasMergedCellsInBetween = (indexes, type) => selection => {
107
107
 
108
108
  // Currently only support 2 indexes, but we can extend this to support more indexes in the future.
109
109
  return mergedCellsInRectArr[0].some(cell => mergedCellsInRectArr[1].includes(cell));
110
+ };
111
+
112
+ // Checks if any cell in the column with colIndex is merged with a cell in a column to the left or to the right of it.
113
+ // colIndex is a logical index of the column. It starts at 0 and goes up to tableMap.width - 1.
114
+ export const hasMergedCellsWithColumnNextToColumnIndex = (colIndex, selection) => {
115
+ const table = findTable(selection);
116
+ if (!table) {
117
+ return false;
118
+ }
119
+ const tableMap = TableMap.get(table.node);
120
+ const {
121
+ width
122
+ } = tableMap;
123
+ if (width <= 1) {
124
+ return false;
125
+ }
126
+ if (colIndex < 0 || colIndex > width - 1) {
127
+ return false;
128
+ }
129
+ const {
130
+ map
131
+ } = tableMap;
132
+ // j is an index in the tableMap.map array. tableMap.map is a flat array.
133
+ // Each item of this array contains a number.
134
+ // The number represents the position of the corresponding cell in the tableMap. It exists for each cell.
135
+ // If there are merged cells, their positions will be represented by the same number.
136
+ const isFirstColumn = colIndex === 0;
137
+ const isLastColumn = colIndex === width - 1;
138
+ for (let j = colIndex; j < map.length; j += width) {
139
+ if (!isFirstColumn && map[j] === map[j - 1] ||
140
+ // compare with a cell in the column on the left
141
+ !isLastColumn && map[j] === map[j + 1] // compare with a cell in the column on the right
142
+ ) {
143
+ return true;
144
+ }
145
+ }
146
+ return false;
147
+ };
148
+
149
+ // Checks if any cell in the row with rowIndex is merged with a cell in a row above or below it.
150
+ export const hasMergedCellsWithRowNextToRowIndex = (rowIndex, selection) => {
151
+ const table = findTable(selection);
152
+ if (!table) {
153
+ return false;
154
+ }
155
+ const tableMap = TableMap.get(table.node);
156
+ const {
157
+ height
158
+ } = tableMap;
159
+ if (height <= 1) {
160
+ return false;
161
+ }
162
+ if (rowIndex < 0 || rowIndex > height - 1) {
163
+ return false;
164
+ }
165
+ const {
166
+ map,
167
+ width
168
+ } = tableMap; // map is a flat array representing position of each cell in the table.
169
+ const indexOfFirstCellInTheRow = rowIndex * width;
170
+ const indexOfLastCellInTheRow = indexOfFirstCellInTheRow + width - 1;
171
+ const isFirstRow = rowIndex === 0;
172
+ const isLastRow = rowIndex === height - 1;
173
+ // j is an index of a cell in a row
174
+ for (let j = indexOfFirstCellInTheRow; j <= indexOfLastCellInTheRow; j++) {
175
+ if (!isFirstRow && map[j] === map[j - width] ||
176
+ // compare with a cell in the row above
177
+ !isLastRow && map[j] === map[j + width] // compare with a cell in the row below
178
+ ) {
179
+ return true;
180
+ }
181
+ }
182
+ return false;
110
183
  };
@@ -464,8 +464,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
464
464
  }, {
465
465
  key: "render",
466
466
  value: function render() {
467
- var _classnames,
468
- _this3 = this;
467
+ var _this3 = this,
468
+ _classnames;
469
469
  var _this$props10 = this.props,
470
470
  view = _this$props10.view,
471
471
  getNode = _this$props10.getNode,
@@ -537,7 +537,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
537
537
  stickyHeader: this.state.stickyHeader,
538
538
  getEditorFeatureFlags: getEditorFeatureFlags,
539
539
  tableContainerWidth: tableContainerWidth,
540
- isNumberColumnEnabled: node.attrs.isNumberColumnEnabled
540
+ isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
541
+ getScrollOffset: function getScrollOffset() {
542
+ var _this3$wrapper;
543
+ return ((_this3$wrapper = _this3.wrapper) === null || _this3$wrapper === void 0 ? void 0 : _this3$wrapper.scrollLeft) || 0;
544
+ }
541
545
  }) : null;
542
546
  var shadowPadding = allowControls && tableActive ? -tableToolbarSize : tableMarginSides;
543
547
  var shadowStyle = memoizeOne(function (visible) {
@@ -585,12 +589,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
585
589
  editorView: view,
586
590
  node: node,
587
591
  getScrollOffset: function getScrollOffset() {
588
- var _this3$wrapper;
589
- return ((_this3$wrapper = _this3.wrapper) === null || _this3$wrapper === void 0 ? void 0 : _this3$wrapper.scrollLeft) || 0;
592
+ var _this3$wrapper2;
593
+ return ((_this3$wrapper2 = _this3.wrapper) === null || _this3$wrapper2 === void 0 ? void 0 : _this3$wrapper2.scrollLeft) || 0;
590
594
  },
591
595
  getTableWrapperWidth: function getTableWrapperWidth() {
592
- var _this3$wrapper2;
593
- return ((_this3$wrapper2 = _this3.wrapper) === null || _this3$wrapper2 === void 0 ? void 0 : _this3$wrapper2.clientWidth) || 760;
596
+ var _this3$wrapper3;
597
+ return ((_this3$wrapper3 = _this3.wrapper) === null || _this3$wrapper3 === void 0 ? void 0 : _this3$wrapper3.clientWidth) || 760;
594
598
  }
595
599
  }), /*#__PURE__*/React.createElement("div", {
596
600
  style: shadowStyle(showBeforeShadow),
@@ -2,8 +2,9 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
3
3
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
4
4
  import { findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils';
5
- import { getSelectedColumnIndexes, getSelectedRowIndexes, getSelectedTableInfo, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
5
+ import { getSelectedColumnIndexes, getSelectedRowIndexes, getSelectedTableInfo } from '../../utils';
6
6
  import { withEditorAnalyticsAPI } from '../../utils/analytics';
7
+ import { canMove, getTargetIndex } from '../../utils/drag-menu';
7
8
  import { clearDropTarget, moveSource } from './commands';
8
9
  export var clearDropTargetWithAnalytics = function clearDropTargetWithAnalytics(editorAnalyticsAPI) {
9
10
  return function (inputMethod, sourceType, sourceIndexes, status, tr) {
@@ -84,30 +85,13 @@ export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalytics
84
85
  if (selectedIndexes.length === 0) {
85
86
  return false;
86
87
  }
87
-
88
- // const sourceIndex = selectedIndexes[0];
89
- // we can move only by one row/column
90
- // 'direction' can only be 1 (for right or down) or -1 (for left or up)
91
- var targetIndex = Math[direction < 0 ? 'min' : 'max'].apply(Math, _toConsumableArray(selectedIndexes)) + direction;
92
-
93
- // We can move only if targetIndex is a positive number and is not higher than the total number of rows/columns.
94
88
  var _getSelectedTableInfo3 = getSelectedTableInfo(selection),
95
89
  totalRowCount = _getSelectedTableInfo3.totalRowCount,
96
90
  totalColumnCount = _getSelectedTableInfo3.totalColumnCount;
97
- var isValidTargetIndex = targetIndex < 0 ? false : isRow ? targetIndex <= totalRowCount - 1 : targetIndex <= totalColumnCount - 1;
98
- if (!isValidTargetIndex) {
99
- return false;
100
- }
101
-
102
- // We can move only if there are no merged cells in the source or target row/column
103
- var hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
104
- if (hasMergedCellsInSource) {
105
- return false;
106
- }
107
- var hasMergedCellsInTarget = isRow ? hasMergedCellsInRow(targetIndex)(selection) : hasMergedCellsInColumn(targetIndex)(selection);
108
- if (hasMergedCellsInTarget) {
91
+ if (!canMove(sourceType, direction, isRow ? totalRowCount : totalColumnCount, selection, selectionRect)) {
109
92
  return false;
110
93
  }
94
+ var targetIndex = getTargetIndex(selectedIndexes, direction);
111
95
  return moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
112
96
  };
113
97
  };
@@ -1,8 +1,7 @@
1
1
  /* eslint-disable @atlaskit/design-system/prefer-primitives */
2
2
 
3
- import React, { useCallback, useEffect, useMemo, useRef } from 'react';
3
+ import React, { useCallback, useMemo, useRef } from 'react';
4
4
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
5
- import { closestElement } from '@atlaskit/editor-common/utils';
6
5
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
7
6
  import { CellSelection } from '@atlaskit/editor-tables';
8
7
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
@@ -37,7 +36,8 @@ export var ColumnControls = function ColumnControls(_ref) {
37
36
  isTableHovered = _ref.isTableHovered,
38
37
  tableContainerWidth = _ref.tableContainerWidth,
39
38
  isNumberColumnEnabled = _ref.isNumberColumnEnabled,
40
- isDragging = _ref.isDragging;
39
+ isDragging = _ref.isDragging,
40
+ getScrollOffset = _ref.getScrollOffset;
41
41
  var columnControlsRef = useRef(null);
42
42
  var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
43
43
  return (
@@ -107,24 +107,10 @@ export var ColumnControls = function ColumnControls(_ref) {
107
107
  var colIndexes = useMemo(function () {
108
108
  return [colIndex];
109
109
  }, [colIndex]);
110
- var tableWrapper = closestElement(tableRef, ".".concat(ClassName.TABLE_NODE_WRAPPER));
111
- var handleScroll = useCallback(function (event) {
112
- if (stickyTop) {
113
- if (columnControlsRef && columnControlsRef.current) {
114
- var _tableWrapper$scrollL;
115
- columnControlsRef.current.scrollLeft = (_tableWrapper$scrollL = tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.scrollLeft) !== null && _tableWrapper$scrollL !== void 0 ? _tableWrapper$scrollL : 0;
116
- }
117
- }
118
- }, [stickyTop, tableWrapper]);
119
- useEffect(function () {
120
- handleScroll();
121
- }, [handleScroll]);
122
- useEffect(function () {
123
- tableWrapper === null || tableWrapper === void 0 || tableWrapper.addEventListener('scroll', handleScroll);
124
- return function () {
125
- tableWrapper === null || tableWrapper === void 0 || tableWrapper.removeEventListener('scroll', handleScroll);
126
- };
127
- }, [tableWrapper, handleScroll]);
110
+ if (stickyTop && columnControlsRef.current) {
111
+ var _getScrollOffset;
112
+ columnControlsRef.current.scrollLeft = (_getScrollOffset = getScrollOffset === null || getScrollOffset === void 0 ? void 0 : getScrollOffset()) !== null && _getScrollOffset !== void 0 ? _getScrollOffset : 0;
113
+ }
128
114
  var generateHandleByType = function generateHandleByType(type) {
129
115
  var _rowHeights$reduce, _colWidths$reduce;
130
116
  if (!hoveredCell || !(colWidths !== null && colWidths !== void 0 && colWidths.length)) {
@@ -1,15 +1,23 @@
1
- import React from 'react';
1
+ import React, { useRef } from 'react';
2
2
  import { TableCssClassName as ClassName } from '../../../types';
3
3
  import { ColumnDropTarget } from './ColumnDropTarget';
4
4
  export var ColumnDropTargets = function ColumnDropTargets(_ref) {
5
5
  var tableRef = _ref.tableRef,
6
6
  tableHeight = _ref.tableHeight,
7
7
  localId = _ref.localId,
8
- colWidths = _ref.colWidths;
8
+ colWidths = _ref.colWidths,
9
+ isHeaderSticky = _ref.isHeaderSticky,
10
+ getScrollOffset = _ref.getScrollOffset;
11
+ var dropTargetRef = useRef(null);
9
12
  if (!tableRef) {
10
13
  return null;
11
14
  }
15
+ if (isHeaderSticky && dropTargetRef.current) {
16
+ var _getScrollOffset;
17
+ dropTargetRef.current.style.marginLeft = "-".concat((_getScrollOffset = getScrollOffset === null || getScrollOffset === void 0 ? void 0 : getScrollOffset()) !== null && _getScrollOffset !== void 0 ? _getScrollOffset : 0, "px");
18
+ }
12
19
  return /*#__PURE__*/React.createElement("div", {
20
+ ref: dropTargetRef,
13
21
  className: ClassName.DRAG_COLUMN_DROP_TARGET_CONTROLS,
14
22
  contentEditable: false
15
23
  }, /*#__PURE__*/React.createElement("div", {
@@ -21,7 +21,8 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
21
21
  isInDanger = _ref.isInDanger,
22
22
  isTableHovered = _ref.isTableHovered,
23
23
  tableContainerWidth = _ref.tableContainerWidth,
24
- isNumberColumnEnabled = _ref.isNumberColumnEnabled;
24
+ isNumberColumnEnabled = _ref.isNumberColumnEnabled,
25
+ getScrollOffset = _ref.getScrollOffset;
25
26
  var _useState = useState({
26
27
  width: 0,
27
28
  height: 0
@@ -126,12 +127,15 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
126
127
  hasHeaderColumn: hasHeaderColumn,
127
128
  tableContainerWidth: tableContainerWidth,
128
129
  isNumberColumnEnabled: isNumberColumnEnabled,
129
- isDragging: isDragging
130
+ isDragging: isDragging,
131
+ getScrollOffset: getScrollOffset
130
132
  }), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
131
133
  tableRef: tableRef,
134
+ isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
132
135
  tableHeight: tableRect.height,
133
136
  localId: currentNodeLocalId,
134
- colWidths: colWidths
137
+ colWidths: colWidths,
138
+ getScrollOffset: getScrollOffset
135
139
  }));
136
140
  };
137
141
  export default TableFloatingColumnControls;
@@ -19,14 +19,36 @@ import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizi
19
19
  import { getClosestSelectionRect } from '../toolbar';
20
20
  import { deleteRows } from '../transforms';
21
21
  import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
22
+ import { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
22
23
  import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
23
- var canDecrease = function canDecrease(index) {
24
- var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
25
- return index !== undefined && index > min;
24
+ export var getTargetIndex = function getTargetIndex(selectedIndexes, direction) {
25
+ return Math[direction < 0 ? 'min' : 'max'].apply(Math, _toConsumableArray(selectedIndexes)) + direction;
26
26
  };
27
- var canIncrease = function canIncrease(index) {
28
- var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
29
- return index !== undefined && index < max;
27
+ export var canMove = function canMove(sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect) {
28
+ if (!selectionRect) {
29
+ return false;
30
+ }
31
+ var isRow = sourceType === 'table-row';
32
+ var selectedIndexes = isRow ? getSelectedRowIndexes(selectionRect) : getSelectedColumnIndexes(selectionRect);
33
+ var targetIndex = getTargetIndex(selectedIndexes, direction);
34
+ var isValidTargetIndex = targetIndex >= 0 && targetIndex < totalItemsOfSourceTypeCount;
35
+ if (!isValidTargetIndex) {
36
+ return false;
37
+ }
38
+
39
+ // We can't move column when target has merges with other columns
40
+ // We can't move row when target has merges with other rows
41
+ var hasMergedCellsInTarget = isRow ? hasMergedCellsWithRowNextToRowIndex(targetIndex, selection) : hasMergedCellsWithColumnNextToColumnIndex(targetIndex, selection);
42
+ if (hasMergedCellsInTarget) {
43
+ return false;
44
+ }
45
+
46
+ // Currently we can't move in any direction if there are merged cells in the source
47
+ var hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
48
+ if (hasMergedCellsInSource) {
49
+ return false;
50
+ }
51
+ return true;
30
52
  };
31
53
  var isDistributeColumnsEnabled = function isDistributeColumnsEnabled(state) {
32
54
  var rect = getClosestSelectionRect(state);
@@ -37,6 +59,7 @@ var isDistributeColumnsEnabled = function isDistributeColumnsEnabled(state) {
37
59
  return false;
38
60
  };
39
61
  export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI) {
62
+ var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
40
63
  var addOptions = direction === 'row' ? [{
41
64
  label: 'above',
42
65
  offset: 0,
@@ -58,13 +81,12 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
58
81
  icon: AddColRightIcon,
59
82
  keymap: addColumnAfter
60
83
  }];
84
+ var selection = editorView.state.selection;
61
85
  var moveOptions = direction === 'row' ? [{
62
86
  label: 'up',
63
87
  icon: ArrowUpIcon,
64
88
  keymap: moveRowUp,
65
- canMove: function canMove(selectionRect) {
66
- return canDrag && canDecrease(selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.top);
67
- },
89
+ canMove: canDrag && canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
68
90
  getOriginIndexes: getSelectedRowIndexes,
69
91
  getTargetIndex: function getTargetIndex(selectionRect) {
70
92
  return selectionRect.top - 1;
@@ -73,10 +95,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
73
95
  label: 'down',
74
96
  icon: ArrowDownIcon,
75
97
  keymap: moveRowDown,
76
- canMove: function canMove(selectionRect) {
77
- var _selectionRect$bottom, _tableMap$height;
78
- return canDrag && canIncrease(((_selectionRect$bottom = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.bottom) !== null && _selectionRect$bottom !== void 0 ? _selectionRect$bottom : 0) - 1, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
79
- },
98
+ canMove: canDrag && canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
80
99
  getOriginIndexes: getSelectedRowIndexes,
81
100
  getTargetIndex: function getTargetIndex(selectionRect) {
82
101
  return selectionRect.bottom;
@@ -85,9 +104,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
85
104
  label: 'left',
86
105
  icon: ArrowLeftIcon,
87
106
  keymap: moveColumnLeft,
88
- canMove: function canMove(selectionRect) {
89
- return canDrag && canDecrease(selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.left);
90
- },
107
+ canMove: canDrag && canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
91
108
  getOriginIndexes: getSelectedColumnIndexes,
92
109
  getTargetIndex: function getTargetIndex(selectionRect) {
93
110
  return selectionRect.left - 1;
@@ -96,10 +113,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
96
113
  label: 'right',
97
114
  icon: ArrowRightIcon,
98
115
  keymap: moveColumnRight,
99
- canMove: function canMove(selectionRect) {
100
- var _selectionRect$right, _tableMap$width;
101
- return canDrag && canIncrease(((_selectionRect$right = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right) !== null && _selectionRect$right !== void 0 ? _selectionRect$right : 0) - 1, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
102
- },
116
+ canMove: canDrag && canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
103
117
  getOriginIndexes: getSelectedColumnIndexes,
104
118
  getTargetIndex: function getTargetIndex(selectionRect) {
105
119
  return selectionRect.right;
@@ -184,10 +198,10 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
184
198
  return {
185
199
  id: "move_".concat(direction, "_").concat(label),
186
200
  title: "Move ".concat(direction, " ").concat(label),
187
- disabled: !canMove(selectionRect),
201
+ disabled: !canMove,
188
202
  icon: icon,
189
203
  onClick: function onClick(state, dispatch) {
190
- if (canMove(selectionRect)) {
204
+ if (canMove) {
191
205
  requestAnimationFrame(function () {
192
206
  moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, "table-".concat(direction), getOriginIndexes(selectionRect), getTargetIndex(selectionRect))(editorView.state, editorView.dispatch);
193
207
  });
@@ -130,4 +130,69 @@ export var hasMergedCellsInBetween = function hasMergedCellsInBetween(indexes, t
130
130
  return mergedCellsInRectArr[1].includes(cell);
131
131
  });
132
132
  };
133
+ };
134
+
135
+ // Checks if any cell in the column with colIndex is merged with a cell in a column to the left or to the right of it.
136
+ // colIndex is a logical index of the column. It starts at 0 and goes up to tableMap.width - 1.
137
+ export var hasMergedCellsWithColumnNextToColumnIndex = function hasMergedCellsWithColumnNextToColumnIndex(colIndex, selection) {
138
+ var table = findTable(selection);
139
+ if (!table) {
140
+ return false;
141
+ }
142
+ var tableMap = TableMap.get(table.node);
143
+ var width = tableMap.width;
144
+ if (width <= 1) {
145
+ return false;
146
+ }
147
+ if (colIndex < 0 || colIndex > width - 1) {
148
+ return false;
149
+ }
150
+ var map = tableMap.map;
151
+ // j is an index in the tableMap.map array. tableMap.map is a flat array.
152
+ // Each item of this array contains a number.
153
+ // The number represents the position of the corresponding cell in the tableMap. It exists for each cell.
154
+ // If there are merged cells, their positions will be represented by the same number.
155
+ var isFirstColumn = colIndex === 0;
156
+ var isLastColumn = colIndex === width - 1;
157
+ for (var j = colIndex; j < map.length; j += width) {
158
+ if (!isFirstColumn && map[j] === map[j - 1] ||
159
+ // compare with a cell in the column on the left
160
+ !isLastColumn && map[j] === map[j + 1] // compare with a cell in the column on the right
161
+ ) {
162
+ return true;
163
+ }
164
+ }
165
+ return false;
166
+ };
167
+
168
+ // Checks if any cell in the row with rowIndex is merged with a cell in a row above or below it.
169
+ export var hasMergedCellsWithRowNextToRowIndex = function hasMergedCellsWithRowNextToRowIndex(rowIndex, selection) {
170
+ var table = findTable(selection);
171
+ if (!table) {
172
+ return false;
173
+ }
174
+ var tableMap = TableMap.get(table.node);
175
+ var height = tableMap.height;
176
+ if (height <= 1) {
177
+ return false;
178
+ }
179
+ if (rowIndex < 0 || rowIndex > height - 1) {
180
+ return false;
181
+ }
182
+ var map = tableMap.map,
183
+ width = tableMap.width; // map is a flat array representing position of each cell in the table.
184
+ var indexOfFirstCellInTheRow = rowIndex * width;
185
+ var indexOfLastCellInTheRow = indexOfFirstCellInTheRow + width - 1;
186
+ var isFirstRow = rowIndex === 0;
187
+ var isLastRow = rowIndex === height - 1;
188
+ // j is an index of a cell in a row
189
+ for (var j = indexOfFirstCellInTheRow; j <= indexOfLastCellInTheRow; j++) {
190
+ if (!isFirstRow && map[j] === map[j - width] ||
191
+ // compare with a cell in the row above
192
+ !isLastRow && map[j] === map[j + width] // compare with a cell in the row below
193
+ ) {
194
+ return true;
195
+ }
196
+ }
197
+ return false;
133
198
  };
@@ -17,6 +17,7 @@ export interface ColumnControlsProps {
17
17
  tableContainerWidth?: number;
18
18
  isNumberColumnEnabled?: boolean;
19
19
  isDragging?: boolean;
20
+ getScrollOffset?: () => number;
20
21
  }
21
- export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, tableContainerWidth, isNumberColumnEnabled, isDragging, }: ColumnControlsProps) => JSX.Element;
22
+ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, tableContainerWidth, isNumberColumnEnabled, isDragging, getScrollOffset, }: ColumnControlsProps) => JSX.Element;
22
23
  export default ColumnControls;
@@ -4,5 +4,7 @@ export interface Props {
4
4
  tableHeight?: number;
5
5
  localId?: string;
6
6
  colWidths?: (number | undefined)[];
7
+ isHeaderSticky?: boolean;
8
+ getScrollOffset?: () => number;
7
9
  }
8
10
  export declare const ColumnDropTargets: React.FC<Props>;
@@ -24,6 +24,7 @@ export interface Props {
24
24
  isTableHovered?: boolean;
25
25
  tableContainerWidth?: number;
26
26
  isNumberColumnEnabled?: boolean;
27
+ getScrollOffset?: () => number;
27
28
  }
28
29
  export declare const TableFloatingColumnControls: React.FC<Props>;
29
30
  export default TableFloatingColumnControls;
@@ -1,9 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import type { Command, DropdownOptionT, GetEditorContainerWidth, IconProps } from '@atlaskit/editor-common/types';
4
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
4
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
6
  import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
6
- import type { TableDirection } from '../types';
7
+ import type { DraggableData, DraggableType, TableDirection } from '../types';
8
+ export declare const getTargetIndex: (selectedIndexes: number[], direction: DraggableData['direction']) => number;
9
+ export declare const canMove: (sourceType: DraggableType, direction: DraggableData['direction'], totalItemsOfSourceTypeCount: number, selection: Selection, selectionRect?: Rect) => boolean;
7
10
  export type DragMenuOptionIdType = 'add_row_above' | 'add_row_below' | 'add_column_left' | 'add_column_right' | 'distribute_columns' | 'clear_cells' | 'delete_row' | 'delete_column' | 'move_column_left' | 'move_column_right' | 'move_row_up' | 'move_row_down' | 'sort_column_asc' | 'sort_column_desc';
8
11
  export interface DragMenuConfig extends DropdownOptionT<Command> {
9
12
  id: DragMenuOptionIdType;
@@ -3,4 +3,6 @@ type MergeType = 'row' | 'column';
3
3
  export declare const hasMergedCellsInColumn: (columnIndexes: number | number[]) => (selection: Selection) => boolean;
4
4
  export declare const hasMergedCellsInRow: (rowIndexes: number | number[]) => (selection: Selection) => boolean;
5
5
  export declare const hasMergedCellsInBetween: (indexes: number[], type: MergeType) => (selection: Selection) => boolean;
6
+ export declare const hasMergedCellsWithColumnNextToColumnIndex: (colIndex: number, selection: Selection) => boolean;
7
+ export declare const hasMergedCellsWithRowNextToRowIndex: (rowIndex: number, selection: Selection) => boolean;
6
8
  export {};
@@ -17,6 +17,7 @@ export interface ColumnControlsProps {
17
17
  tableContainerWidth?: number;
18
18
  isNumberColumnEnabled?: boolean;
19
19
  isDragging?: boolean;
20
+ getScrollOffset?: () => number;
20
21
  }
21
- export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, tableContainerWidth, isNumberColumnEnabled, isDragging, }: ColumnControlsProps) => JSX.Element;
22
+ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, tableContainerWidth, isNumberColumnEnabled, isDragging, getScrollOffset, }: ColumnControlsProps) => JSX.Element;
22
23
  export default ColumnControls;
@@ -4,5 +4,7 @@ export interface Props {
4
4
  tableHeight?: number;
5
5
  localId?: string;
6
6
  colWidths?: (number | undefined)[];
7
+ isHeaderSticky?: boolean;
8
+ getScrollOffset?: () => number;
7
9
  }
8
10
  export declare const ColumnDropTargets: React.FC<Props>;
@@ -24,6 +24,7 @@ export interface Props {
24
24
  isTableHovered?: boolean;
25
25
  tableContainerWidth?: number;
26
26
  isNumberColumnEnabled?: boolean;
27
+ getScrollOffset?: () => number;
27
28
  }
28
29
  export declare const TableFloatingColumnControls: React.FC<Props>;
29
30
  export default TableFloatingColumnControls;