@atlaskit/editor-plugin-table 7.0.3 → 7.1.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 (102) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cjs/event-handlers.js +4 -1
  3. package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +9 -9
  4. package/dist/cjs/pm-plugins/drag-and-drop/commands.js +4 -11
  5. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +1 -4
  6. package/dist/cjs/pm-plugins/drag-and-drop/utils/monitor.js +0 -5
  7. package/dist/cjs/pm-plugins/keymap.js +1 -1
  8. package/dist/cjs/types.js +1 -0
  9. package/dist/cjs/ui/DragHandle/index.js +27 -9
  10. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
  11. package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -3
  12. package/dist/cjs/ui/FloatingContextualMenu/styles.js +3 -1
  13. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -2
  14. package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +1 -7
  15. package/dist/cjs/ui/TableFloatingColumnControls/index.js +0 -2
  16. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -2
  17. package/dist/cjs/ui/common-styles.js +2 -1
  18. package/dist/cjs/ui/consts.js +3 -3
  19. package/dist/cjs/ui/icons/AddRowAboveIcon.js +8 -12
  20. package/dist/cjs/ui/icons/AddRowBelowIcon.js +19 -15
  21. package/dist/cjs/ui/ui-styles.js +8 -8
  22. package/dist/cjs/utils/drag-menu.js +42 -29
  23. package/dist/es2019/event-handlers.js +3 -2
  24. package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +8 -8
  25. package/dist/es2019/pm-plugins/drag-and-drop/commands.js +5 -10
  26. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +1 -4
  27. package/dist/es2019/pm-plugins/drag-and-drop/utils/monitor.js +0 -5
  28. package/dist/es2019/pm-plugins/keymap.js +2 -2
  29. package/dist/es2019/types.js +1 -0
  30. package/dist/es2019/ui/DragHandle/index.js +26 -8
  31. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +2 -2
  32. package/dist/es2019/ui/FloatingContextualMenu/index.js +5 -4
  33. package/dist/es2019/ui/FloatingContextualMenu/styles.js +3 -3
  34. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -2
  35. package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +1 -7
  36. package/dist/es2019/ui/TableFloatingColumnControls/index.js +0 -2
  37. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -2
  38. package/dist/es2019/ui/common-styles.js +24 -5
  39. package/dist/es2019/ui/consts.js +2 -2
  40. package/dist/es2019/ui/icons/AddRowAboveIcon.js +8 -12
  41. package/dist/es2019/ui/icons/AddRowBelowIcon.js +19 -15
  42. package/dist/es2019/ui/ui-styles.js +8 -8
  43. package/dist/es2019/utils/drag-menu.js +29 -24
  44. package/dist/esm/event-handlers.js +5 -2
  45. package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +9 -9
  46. package/dist/esm/pm-plugins/drag-and-drop/commands.js +5 -12
  47. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +1 -4
  48. package/dist/esm/pm-plugins/drag-and-drop/utils/monitor.js +0 -5
  49. package/dist/esm/pm-plugins/keymap.js +2 -2
  50. package/dist/esm/types.js +1 -0
  51. package/dist/esm/ui/DragHandle/index.js +27 -9
  52. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +2 -2
  53. package/dist/esm/ui/FloatingContextualMenu/index.js +5 -4
  54. package/dist/esm/ui/FloatingContextualMenu/styles.js +4 -2
  55. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -2
  56. package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +1 -7
  57. package/dist/esm/ui/TableFloatingColumnControls/index.js +0 -2
  58. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +7 -2
  59. package/dist/esm/ui/common-styles.js +2 -1
  60. package/dist/esm/ui/consts.js +2 -2
  61. package/dist/esm/ui/icons/AddRowAboveIcon.js +8 -12
  62. package/dist/esm/ui/icons/AddRowBelowIcon.js +19 -15
  63. package/dist/esm/ui/ui-styles.js +8 -8
  64. package/dist/esm/utils/drag-menu.js +41 -28
  65. package/dist/types/index.d.ts +1 -1
  66. package/dist/types/types.d.ts +1 -0
  67. package/dist/types/ui/FloatingContextualMenu/styles.d.ts +1 -1
  68. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +0 -2
  69. package/dist/types/ui/consts.d.ts +2 -1
  70. package/dist/types/ui/ui-styles.d.ts +2 -2
  71. package/dist/types-ts4.5/index.d.ts +1 -1
  72. package/dist/types-ts4.5/types.d.ts +1 -0
  73. package/dist/types-ts4.5/ui/FloatingContextualMenu/styles.d.ts +1 -1
  74. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +0 -2
  75. package/dist/types-ts4.5/ui/consts.d.ts +2 -1
  76. package/dist/types-ts4.5/ui/ui-styles.d.ts +2 -2
  77. package/package.json +6 -8
  78. package/src/__tests__/unit/event-handlers.ts +3 -17
  79. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +46 -17
  80. package/src/event-handlers.ts +14 -2
  81. package/src/index.ts +1 -1
  82. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +11 -8
  83. package/src/pm-plugins/drag-and-drop/commands.ts +5 -33
  84. package/src/pm-plugins/drag-and-drop/plugin.ts +0 -3
  85. package/src/pm-plugins/drag-and-drop/utils/monitor.ts +0 -5
  86. package/src/pm-plugins/keymap.ts +2 -7
  87. package/src/types.ts +1 -0
  88. package/src/ui/DragHandle/index.tsx +33 -14
  89. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +9 -2
  90. package/src/ui/FloatingContextualMenu/index.tsx +10 -3
  91. package/src/ui/FloatingContextualMenu/styles.ts +10 -3
  92. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +13 -4
  93. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +1 -13
  94. package/src/ui/TableFloatingColumnControls/index.tsx +0 -2
  95. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +17 -7
  96. package/src/ui/common-styles.ts +20 -4
  97. package/src/ui/consts.ts +2 -6
  98. package/src/ui/icons/AddRowAboveIcon.tsx +2 -16
  99. package/src/ui/icons/AddRowBelowIcon.tsx +21 -12
  100. package/src/ui/ui-styles.ts +12 -8
  101. package/src/utils/drag-menu.ts +48 -32
  102. package/tsconfig.json +273 -0
@@ -4,18 +4,12 @@ import { ColumnDropTarget } from './ColumnDropTarget';
4
4
  export const ColumnDropTargets = ({
5
5
  tableRef,
6
6
  tableHeight,
7
- stickyTop,
8
7
  localId,
9
- rowHeights,
10
8
  colWidths
11
9
  }) => {
12
- var _rowHeights$;
13
10
  if (!tableRef) {
14
11
  return null;
15
12
  }
16
- const firstRow = tableRef.querySelector('tr');
17
- const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
18
- const marginTop = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
19
13
  return /*#__PURE__*/React.createElement("div", {
20
14
  className: ClassName.DRAG_COLUMN_DROP_TARGET_CONTROLS,
21
15
  contentEditable: false
@@ -29,7 +23,7 @@ export const ColumnDropTargets = ({
29
23
  localId: localId,
30
24
  width: width,
31
25
  height: tableHeight,
32
- marginTop: marginTop
26
+ marginTop: 0
33
27
  });
34
28
  })));
35
29
  };
@@ -112,10 +112,8 @@ export const TableFloatingColumnControls = ({
112
112
  isDragging: isDragging
113
113
  }), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
114
114
  tableRef: tableRef,
115
- stickyTop: tableActive ? stickyTop : undefined,
116
115
  tableHeight: tableRect.height,
117
116
  localId: currentNodeLocalId,
118
- rowHeights: rowHeights,
119
117
  colWidths: colWidths
120
118
  }));
121
119
  };
@@ -74,7 +74,10 @@ const DragControlsComponent = ({
74
74
  }
75
75
  });
76
76
  }, [editorView]);
77
- const onMouseUp = useCallback(() => {
77
+ const onMouseUp = useCallback(event => {
78
+ if (event.shiftKey) {
79
+ return;
80
+ }
78
81
  toggleDragMenu(undefined, 'row', hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex)(editorView.state, editorView.dispatch);
79
82
  }, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex]);
80
83
  const rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
@@ -118,7 +121,7 @@ const DragControlsComponent = ({
118
121
  }
119
122
  const isHover = type === 'hover';
120
123
  const isRowsSelected = selectedRowIndexes.length > 0;
121
- const showCondition = isHover ? isRowsSelected && !selectedRowIndexes.includes(rowIndex) && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex) : selectedRowIndexes.length < rowHeights.length && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex);
124
+ const showCondition = isHover ? isRowsSelected && !selectedRowIndexes.includes(rowIndex) && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex) : selectedRowIndexes.length < rowHeights.length && rowIndex < rowHeights.length && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex);
122
125
  if (!showCondition) {
123
126
  return null;
124
127
  }
@@ -136,7 +139,9 @@ const DragControlsComponent = ({
136
139
  gridRow: isSelecting ? selectedRowPosition : gridRowPosition,
137
140
  gridColumn: '2',
138
141
  // DragHandle uses `transform: rotate(90)`, which doesn't affect its parent (this div) causing the width of this element to be the true height of the drag handle
142
+ display: 'flex',
139
143
  width: '9px',
144
+ height: '100%',
140
145
  position: 'relative',
141
146
  right: '-0.5px'
142
147
  },
@@ -204,7 +204,9 @@ const tableWrapperStyles = () => {
204
204
  };
205
205
 
206
206
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4139
207
- export const tableStyles = props => css`
207
+ export const tableStyles = props => {
208
+ var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4;
209
+ return css`
208
210
  .${ClassName.LAYOUT_BUTTON} button {
209
211
  background: ${`var(--ds-background-neutral, ${N20A})`};
210
212
  color: ${`var(--ds-icon, ${N300})`};
@@ -223,8 +225,8 @@ export const tableStyles = props => css`
223
225
  ${hoveredDeleteButton()};
224
226
  ${hoveredCell()};
225
227
  ${hoveredWarningCell};
226
- ${getBooleanFF('platform.editor.table.drag-and-drop') && insertLine()};
227
- ${resizeHandle()};
228
+ ${((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableDragAndDrop) && insertLine()};
229
+ ${resizeHandle((_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.tableDragAndDrop)};
228
230
  ${rangeSelectionStyles};
229
231
 
230
232
  .${ClassName.LAST_ITEM_IN_CELL} {
@@ -434,7 +436,7 @@ export const tableStyles = props => css`
434
436
  }
435
437
 
436
438
  ${sentinelStyles}
437
- ${OverflowShadow()}
439
+ ${OverflowShadow((_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.tableDragAndDrop)}
438
440
  ${stickyScrollbarStyles(props.featureFlags)}
439
441
 
440
442
  .${ClassName.TABLE_STICKY} .${ClassName.TABLE_STICKY_SHADOW} {
@@ -653,6 +655,22 @@ export const tableStyles = props => css`
653
655
  }
654
656
  }
655
657
 
658
+ .${ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE} {
659
+ background: none;
660
+ border: none;
661
+ outline: none;
662
+ position: absolute;
663
+ margin: 0;
664
+ padding: 0;
665
+ display: flex;
666
+ align-items: center;
667
+ cursor: pointer;
668
+
669
+ :focus {
670
+ outline: none;
671
+ }
672
+ }
673
+
656
674
  .${ClassName.DRAG_HANDLE_BUTTON_CONTAINER} {
657
675
  cursor: grab;
658
676
  pointer-events: auto;
@@ -739,7 +757,7 @@ export const tableStyles = props => css`
739
757
  position: relative;
740
758
  float: right;
741
759
  margin-left: ${getBooleanFF('platform.editor.custom-table-width') ? akEditorTableToolbarSize : akEditorTableToolbarSize - 1}px;
742
- top: ${getBooleanFF('platform.editor.table.drag-and-drop') ? 0 : akEditorTableToolbarSize}px;
760
+ top: ${(_props$featureFlags4 = props.featureFlags) !== null && _props$featureFlags4 !== void 0 && _props$featureFlags4.tableDragAndDrop ? 0 : akEditorTableToolbarSize}px;
743
761
  width: ${akEditorTableNumberColumnWidth + 1}px;
744
762
  box-sizing: border-box;
745
763
  }
@@ -969,6 +987,7 @@ export const tableStyles = props => css`
969
987
 
970
988
  ${shadowSentinelStyles}
971
989
  `;
990
+ };
972
991
  export const tableFullPageEditorStyles = css`
973
992
  .ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
974
993
  margin-left: 0;
@@ -1,6 +1,5 @@
1
1
  import { tableCellBorderWidth, tableMarginTop } from '@atlaskit/editor-common/styles';
2
2
  import { akEditorTableBorder, akEditorTableBorderSelected, akEditorTableCellBlanketDeleted, akEditorTableCellBlanketSelected, akEditorTableHeaderCellBackground, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
3
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
3
  import { B200, N0, N20, N200, N20A, N300, R300, R400, R75 } from '@atlaskit/theme/colors';
5
4
  import { RESIZE_HANDLE_AREA_DECORATION_GAP } from '../types';
6
5
 
@@ -50,7 +49,8 @@ export const resizeHandlerAreaWidth = RESIZE_HANDLE_AREA_DECORATION_GAP / 3;
50
49
  export const resizeLineWidth = 2;
51
50
  export const resizeHandlerZIndex = columnControlsZIndex + akRichMediaResizeZIndex;
52
51
  export const contextualMenuTriggerSize = 16;
53
- export const contextualMenuDropdownWidth = getBooleanFF('platform.editor.table.drag-and-drop') ? 250 : 180;
52
+ export const contextualMenuDropdownWidth = 180;
53
+ export const contextualMenuDropdownWidthDnD = 250;
54
54
  export const stickyRowZIndex = resizeHandlerZIndex + 2;
55
55
  export const stickyRowOffsetTop = 8;
56
56
  export const stickyHeaderBorderBottomWidth = 1;
@@ -10,24 +10,20 @@ export const AddRowAboveIcon = () => /*#__PURE__*/React.createElement("svg", {
10
10
  height: "24",
11
11
  fill: "var(--ds-border-inverse, #FFFFFF)",
12
12
  fillOpacity: "0.01"
13
- }), /*#__PURE__*/React.createElement("mask", {
14
- id: "path-1-inside-1_896_17822",
15
- fill: "var(--ds-border-inverse, #FFFFFF)"
16
- }, /*#__PURE__*/React.createElement("rect", {
13
+ }), /*#__PURE__*/React.createElement("rect", {
17
14
  x: "6",
18
15
  y: "12",
19
16
  width: "12",
20
- height: "8",
21
- rx: "0.5"
22
- })), /*#__PURE__*/React.createElement("rect", {
17
+ height: "3",
18
+ rx: "0.5",
19
+ fill: "currentColor"
20
+ }), /*#__PURE__*/React.createElement("rect", {
23
21
  x: "6",
24
- y: "12",
22
+ y: "16",
25
23
  width: "12",
26
- height: "8",
24
+ height: "3",
27
25
  rx: "0.5",
28
- stroke: "currentColor",
29
- strokeWidth: "4",
30
- mask: "url(#path-1-inside-1_896_17822)"
26
+ fill: "currentColor"
31
27
  }), /*#__PURE__*/React.createElement("path", {
32
28
  fillRule: "evenodd",
33
29
  clipRule: "evenodd",
@@ -5,27 +5,31 @@ export const AddRowBelowIcon = () => /*#__PURE__*/React.createElement("svg", {
5
5
  viewBox: "0 0 24 24",
6
6
  fill: "none",
7
7
  xmlns: "http://www.w3.org/2000/svg"
8
- }, /*#__PURE__*/React.createElement("mask", {
9
- id: "path-1-inside-1_920_47112",
10
- fill: "var(--ds-border-inverse, #FFFFFF)"
11
8
  }, /*#__PURE__*/React.createElement("rect", {
12
- x: "6",
13
- y: "4",
9
+ width: "24",
10
+ height: "24",
11
+ transform: "matrix(-1 0 0 -1 24 24)",
12
+ fill: "var(--ds-border-inverse, #FFFFFF)",
13
+ fillOpacity: "0.01"
14
+ }), /*#__PURE__*/React.createElement("rect", {
15
+ x: "18",
16
+ y: "12",
14
17
  width: "12",
15
- height: "8",
16
- rx: "0.5"
17
- })), /*#__PURE__*/React.createElement("rect", {
18
- x: "6",
19
- y: "4",
18
+ height: "3",
19
+ rx: "0.5",
20
+ transform: "rotate(-180 18 12)",
21
+ fill: "currentColor"
22
+ }), /*#__PURE__*/React.createElement("rect", {
23
+ x: "18",
24
+ y: "8",
20
25
  width: "12",
21
- height: "8",
26
+ height: "3",
22
27
  rx: "0.5",
23
- stroke: "currentColor",
24
- strokeWidth: "4",
25
- mask: "url(#path-1-inside-1_920_47112)"
28
+ transform: "rotate(-180 18 8)",
29
+ fill: "currentColor"
26
30
  }), /*#__PURE__*/React.createElement("path", {
27
31
  fillRule: "evenodd",
28
32
  clipRule: "evenodd",
29
- d: "M13 15V13.99C12.9974 13.7265 12.8908 13.4747 12.7036 13.2893C12.5163 13.104 12.2635 13 12 13C11.444 13 11 13.444 11 13.99V15H10C9.73478 15 9.48043 15.1054 9.29289 15.2929C9.10536 15.4804 9 15.7348 9 16C9 16.2652 9.10536 16.5196 9.29289 16.7071C9.48043 16.8946 9.73478 17 10 17H11V18.01C11.0026 18.2735 11.1092 18.5253 11.2964 18.7107C11.4837 18.896 11.7365 19 12 19C12.556 19 13 18.556 13 18.01V17H14C14.2652 17 14.5196 16.8946 14.7071 16.7071C14.8946 16.5196 15 16.2652 15 16C15 15.7348 14.8946 15.4804 14.7071 15.2929C14.5196 15.1054 14.2652 15 14 15H13Z",
33
+ d: "M11 17V18.01C11.0026 18.2735 11.1092 18.5253 11.2964 18.7107C11.4837 18.896 11.7365 19 12 19C12.556 19 13 18.556 13 18.01V17H14C14.2652 17 14.5196 16.8946 14.7071 16.7071C14.8946 16.5196 15 16.2652 15 16C15 15.7348 14.8946 15.4804 14.7071 15.2929C14.5196 15.1054 14.2652 15 14 15H13V13.99C12.9974 13.7265 12.8908 13.4747 12.7036 13.2893C12.5163 13.104 12.2635 13 12 13C11.444 13 11 13.444 11 13.99V15H10C9.73478 15 9.48043 15.1054 9.29289 15.2929C9.10536 15.4804 9 15.7348 9 16C9 16.2652 9.10536 16.5196 9.29289 16.7071C9.48043 16.8946 9.73478 17 10 17H11Z",
30
34
  fill: "currentColor"
31
35
  }));
@@ -264,7 +264,7 @@ export const DeleteButton = () => css`
264
264
  cursor: pointer;
265
265
  }
266
266
  `;
267
- export const OverflowShadow = () => css`
267
+ export const OverflowShadow = isDragAndDropEnabled => css`
268
268
  .${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
269
269
  display: block;
270
270
  height: calc(100% - ${tableMarginTop}px);
@@ -306,14 +306,14 @@ export const OverflowShadow = () => css`
306
306
  left: ${getBooleanFF('platform.editor.custom-table-width') ? `calc(100% - ${getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? tableOverflowShadowWidthWide : tableOverflowShadowWidth}px)` : `calc(100% - ${getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? tableOverflowShadowWidthWide - 10 : -2}px)`};
307
307
  }
308
308
  .${ClassName.WITH_CONTROLS} {
309
- ${overflowShadowWidhoutDnD()}
309
+ ${overflowShadowWidhoutDnD(isDragAndDropEnabled)}
310
310
  .${ClassName.TABLE_LEFT_SHADOW} {
311
311
  border-left: 1px solid ${tableBorderColor};
312
312
  }
313
313
  }
314
314
  `;
315
- const overflowShadowWidhoutDnD = () => {
316
- if (!getBooleanFF('platform.editor.table.drag-and-drop')) {
315
+ const overflowShadowWidhoutDnD = isDragAndDropEnabled => {
316
+ if (!isDragAndDropEnabled) {
317
317
  return css`
318
318
  .${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
319
319
  height: calc(100% - ${tableMarginTopWithControl}px);
@@ -680,8 +680,8 @@ const getLastColumnResizerOverrides = () => {
680
680
  }
681
681
  ` : '';
682
682
  };
683
- const resizeHandleOverrides = () => {
684
- if (getBooleanFF('platform.editor.table.drag-and-drop')) {
683
+ const resizeHandleOverrides = isDragAndDropEnabled => {
684
+ if (isDragAndDropEnabled) {
685
685
  return css`
686
686
  th.${ClassName.WITH_RESIZE_LINE}::before,
687
687
  td.${ClassName.WITH_RESIZE_LINE}::before {
@@ -754,7 +754,7 @@ const resizeHandleOverrides = () => {
754
754
  }
755
755
  `;
756
756
  };
757
- export const resizeHandle = () => css`
757
+ export const resizeHandle = isDragAndDropEnabled => css`
758
758
  .${ClassName.TABLE_CONTAINER} {
759
759
  .${ClassName.RESIZE_HANDLE_DECORATION} {
760
760
  background-color: transparent;
@@ -769,7 +769,7 @@ export const resizeHandle = () => css`
769
769
 
770
770
  ${getLastColumnResizerOverrides()}
771
771
 
772
- ${resizeHandleOverrides()}
772
+ ${resizeHandleOverrides(isDragAndDropEnabled)}
773
773
 
774
774
  table
775
775
  tr:first-of-type
@@ -18,7 +18,7 @@ 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 { getSelectedColumnIndexes } from './index';
21
+ import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
22
22
  const canDecrease = (index, min = 0) => index !== undefined && index > min;
23
23
  const canIncrease = (index, max = 0) => index !== undefined && index < max;
24
24
  const isDistributeColumnsEnabled = state => {
@@ -53,34 +53,38 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
53
53
  }];
54
54
  const moveOptions = direction === 'row' ? [{
55
55
  label: 'up',
56
- offset: -1,
57
- canMove: index => canDrag && canDecrease(index),
58
56
  icon: ArrowUpIcon,
59
- keymap: moveRowUp
57
+ keymap: moveRowUp,
58
+ canMove: selectionRect => canDrag && canDecrease(selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.top),
59
+ getOriginIndexes: getSelectedRowIndexes,
60
+ getTargetIndex: selectionRect => selectionRect.top - 1
60
61
  }, {
61
62
  label: 'down',
62
- offset: 1,
63
- canMove: index => {
64
- var _tableMap$height;
65
- return canDrag && canIncrease(index, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
66
- },
67
63
  icon: ArrowDownIcon,
68
- keymap: moveRowDown
64
+ 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
+ },
69
+ getOriginIndexes: getSelectedRowIndexes,
70
+ getTargetIndex: selectionRect => selectionRect.bottom
69
71
  }] : [{
70
72
  label: 'left',
71
- offset: -1,
72
- canMove: index => canDrag && canDecrease(index),
73
73
  icon: ArrowLeftIcon,
74
- keymap: moveColumnLeft
74
+ keymap: moveColumnLeft,
75
+ canMove: selectionRect => canDrag && canDecrease(selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.left),
76
+ getOriginIndexes: getSelectedColumnIndexes,
77
+ getTargetIndex: selectionRect => selectionRect.left - 1
75
78
  }, {
76
79
  label: 'right',
77
- offset: 1,
78
- canMove: index => {
79
- var _tableMap$width;
80
- return canDrag && canIncrease(index, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
81
- },
82
80
  icon: ArrowRightIcon,
83
- keymap: moveColumnRight
81
+ 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
+ },
86
+ getOriginIndexes: getSelectedColumnIndexes,
87
+ getTargetIndex: selectionRect => selectionRect.right
84
88
  }];
85
89
  const sortOptions = direction === 'column' ? [{
86
90
  label: 'increasing',
@@ -154,19 +158,20 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
154
158
  keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
155
159
  }, ...moveOptions.map(({
156
160
  label,
157
- offset,
158
161
  canMove,
159
162
  icon,
160
- keymap
163
+ keymap,
164
+ getOriginIndexes,
165
+ getTargetIndex
161
166
  }) => ({
162
167
  id: `move_${direction}_${label}`,
163
168
  title: `Move ${direction} ${label}`,
164
- disabled: !canMove(index),
169
+ disabled: !canMove(selectionRect),
165
170
  icon,
166
171
  onClick: (state, dispatch) => {
167
- if (canMove(index)) {
172
+ if (canMove(selectionRect)) {
168
173
  requestAnimationFrame(() => {
169
- moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, `table-${direction}`, [index], index + offset)(editorView.state, editorView.dispatch);
174
+ moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, `table-${direction}`, getOriginIndexes(selectionRect), getTargetIndex(selectionRect))(editorView.state, editorView.dispatch);
170
175
  });
171
176
  return true;
172
177
  }
@@ -10,7 +10,7 @@ import { getPluginState as getDragDropPluginState } from './pm-plugins/drag-and-
10
10
  import { getPluginState } from './pm-plugins/plugin-factory';
11
11
  import { getPluginState as getResizePluginState } from './pm-plugins/table-resizing/plugin-factory';
12
12
  import { deleteColumns, deleteRows } from './transforms';
13
- import { RESIZE_HANDLE_AREA_DECORATION_GAP } from './types';
13
+ import { TableCssClassName as ClassName, RESIZE_HANDLE_AREA_DECORATION_GAP } from './types';
14
14
  import { convertHTMLCellIndexToColumnIndex, getColumnIndexMappedToColumnIndexInFirstRow, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, getSelectedCellInfo, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isDragColumnFloatingInsertDot, isDragCornerButton, isDragRowFloatingInsertDot, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableContainerOrWrapper, isTableControlsButton } from './utils';
15
15
  import { getAllowAddColumnCustomStep } from './utils/get-allow-add-column-custom-step';
16
16
  var isFocusingCalendar = function isFocusingCalendar(event) {
@@ -25,12 +25,15 @@ var isFocusingFloatingToolbar = function isFocusingFloatingToolbar(event) {
25
25
  var isFocusingDragHandles = function isFocusingDragHandles(event) {
26
26
  return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('button') && event.relatedTarget.getAttribute('draggable') === 'true';
27
27
  };
28
+ var isFocusingDragHandlesClickableZone = function isFocusingDragHandlesClickableZone(event) {
29
+ return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('button') && event.relatedTarget.classList.contains(ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE);
30
+ };
28
31
  export var handleBlur = function handleBlur(view, event) {
29
32
  var state = view.state,
30
33
  dispatch = view.dispatch;
31
34
  // IE version check for ED-4665
32
35
  // Calendar focus check for ED-10466
33
- if (browser.ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event)) {
36
+ if (browser.ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event) && !isFocusingDragHandlesClickableZone(event)) {
34
37
  setEditorFocus(false)(state, dispatch);
35
38
  }
36
39
  event.preventDefault();
@@ -39,6 +39,7 @@ export var moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnal
39
39
  return function (inputMethod, sourceType, sourceIndexes, targetIndex, tr) {
40
40
  return withEditorAnalyticsAPI(function (_ref2) {
41
41
  var selection = _ref2.selection;
42
+ var direction = sourceIndexes[0] > targetIndex ? -1 : 1;
42
43
  var _getSelectedTableInfo2 = getSelectedTableInfo(selection),
43
44
  totalRowCount = _getSelectedTableInfo2.totalRowCount,
44
45
  totalColumnCount = _getSelectedTableInfo2.totalColumnCount;
@@ -52,8 +53,8 @@ export var moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnal
52
53
  // This identifies the total amount of row/cols the move operation covered. The distance covered should be a representaion
53
54
  // of the minimum distance. This will account for large selection being moved causing a large distance travelled value.
54
55
  distance: Math.min.apply(Math, _toConsumableArray(sourceIndexes.map(function (v) {
55
- return targetIndex - v;
56
- }))),
56
+ return Math.abs(targetIndex - v);
57
+ }))) * direction,
57
58
  // If a drop doesn't actually change anything then we're going to mark the event as cancelled.
58
59
  status: sourceIndexes.includes(targetIndex) ? TABLE_STATUS.CANCELLED : TABLE_STATUS.SUCCESS,
59
60
  totalRowCount: totalRowCount,
@@ -80,15 +81,14 @@ export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalytics
80
81
  }
81
82
  var isRow = sourceType === 'table-row';
82
83
  var selectedIndexes = isRow ? getSelectedRowIndexes(selectionRect) : getSelectedColumnIndexes(selectionRect);
83
-
84
- // FIXME: We can move if only one row/column selected
85
- if (selectedIndexes.length === 0 || selectedIndexes.length > 1) {
84
+ if (selectedIndexes.length === 0) {
86
85
  return false;
87
86
  }
88
- var sourceIndex = selectedIndexes[0];
87
+
88
+ // const sourceIndex = selectedIndexes[0];
89
89
  // we can move only by one row/column
90
90
  // 'direction' can only be 1 (for right or down) or -1 (for left or up)
91
- var targetIndex = sourceIndex + direction;
91
+ var targetIndex = Math[direction < 0 ? 'min' : 'max'].apply(Math, _toConsumableArray(selectedIndexes)) + direction;
92
92
 
93
93
  // We can move only if targetIndex is a positive number and is not higher than the total number of rows/columns.
94
94
  var _getSelectedTableInfo3 = getSelectedTableInfo(selection),
@@ -100,7 +100,7 @@ export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalytics
100
100
  }
101
101
 
102
102
  // We can move only if there are no merged cells in the source or target row/column
103
- var hasMergedCellsInSource = isRow ? hasMergedCellsInRow(sourceIndex)(selection) : hasMergedCellsInColumn(sourceIndex)(selection);
103
+ var hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
104
104
  if (hasMergedCellsInSource) {
105
105
  return false;
106
106
  }
@@ -108,7 +108,7 @@ export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalytics
108
108
  if (hasMergedCellsInTarget) {
109
109
  return false;
110
110
  }
111
- return moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, sourceType, [sourceIndex], targetIndex)(state, dispatch);
111
+ return moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
112
112
  };
113
113
  };
114
114
  };
@@ -1,9 +1,7 @@
1
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
1
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
- import { moveColumn, moveRow, selectColumn, selectRow } from '@atlaskit/editor-tables/utils';
2
+ import { moveColumn, moveRow } from '@atlaskit/editor-tables/utils';
4
3
  import { TableDecorations } from '../../types';
5
4
  import { createColumnInsertLine, createRowInsertLine, updateDecorations } from '../../utils';
6
- import { combineTransforms } from '../../utils/transforms';
7
5
  import { DragAndDropActionType } from './actions';
8
6
  import { DropTargetType } from './consts';
9
7
  import { createCommand, getPluginState } from './plugin-factory';
@@ -74,15 +72,10 @@ export var moveSource = function moveSource(sourceType, sourceIndexes, targetInd
74
72
  if (sourceIndexes.includes(targetIndex)) {
75
73
  return nextTr.setMeta('addToHistory', false);
76
74
  }
77
- var anchor = nextTr.selection.anchor;
78
- var selectStartOfTable = function selectStartOfTable(newTr) {
79
- return newTr.setSelection(TextSelection.create(newTr.doc, anchor));
80
- };
81
- var isTableRow = sourceType === 'table-row';
82
- if (isTableRow) {
83
- return combineTransforms([moveRow(state, sourceIndexes, targetIndex), selectStartOfTable, selectRow(targetIndex)], nextTr);
84
- }
85
- return combineTransforms([moveColumn(sourceIndexes, targetIndex), selectStartOfTable, selectColumn(targetIndex)], nextTr);
75
+ var move = sourceType === 'table-row' ? moveRow : moveColumn;
76
+ return move(state, sourceIndexes, targetIndex, {
77
+ selectAfterMove: true
78
+ })(nextTr);
86
79
  });
87
80
  };
88
81
  export var toggleDragMenu = function toggleDragMenu(isDragMenuOpen, direction, index) {
@@ -55,10 +55,7 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI) {
55
55
  indexes = _ref6.indexes;
56
56
 
57
57
  // First; Perform any quick checks so we can abort early.
58
- if (!indexes || !localId ||
59
- // FIXME: We currently don't support DragNDrop of multiple elements. For now we will not bother to monitor drags
60
- // of more then 1 item.
61
- indexes.length !== 1 || !(type === 'table-row' || type === 'table-column')) {
58
+ if (!indexes || !localId || !(type === 'table-row' || type === 'table-column')) {
62
59
  return false;
63
60
  }
64
61
  var _getTablePluginState = getTablePluginState(editorView.state),
@@ -30,11 +30,6 @@ export var getDraggableDataFromEvent = function getDraggableDataFromEvent(_ref)
30
30
  sourceLocalId !== targetLocalId) {
31
31
  return undefined;
32
32
  }
33
-
34
- // FIXME: currently we only support a single row/col index being moved, remove this clause when this is no longer the case.
35
- if (sourceIndexes.length > 1) {
36
- return undefined;
37
- }
38
33
  var targetClosestEdge = (_extractClosestEdge = extractClosestEdge(destination.data)) !== null && _extractClosestEdge !== void 0 ? _extractClosestEdge : targetType === 'table-row' ? 'top' : 'left';
39
34
  // NOTE: By default we always insert row/cols at the target index to the top/left (retrospectively of row/cols).
40
35
  // This introduces an offset in the event the drop occured closer to the bottom/right of the target. We want
@@ -3,7 +3,7 @@ import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace,
3
3
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
4
4
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
5
5
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
- import { createTable, goToNextCell, moveCursorBackward, triggerUnlessTableHeader } from '../commands';
6
+ import { createTable, goToNextCell, moveCursorBackward } from '../commands';
7
7
  import { addRowAroundSelection, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
8
8
  import { activateNextResizeArea, changeColumnWidthByStep, initiateKeyboardColumnResizing } from '../commands/column-resize';
9
9
  import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
@@ -31,7 +31,7 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
31
31
  // Add row/column shortcuts
32
32
  bindKeymapWithCommand(addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
33
33
  bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
34
- bindKeymapWithCommand(addColumnBefore.common, triggerUnlessTableHeader(addColumnBeforeCommand(getEditorContainerWidth)), list);
34
+ bindKeymapWithCommand(addColumnBefore.common, addColumnBeforeCommand(getEditorContainerWidth), list);
35
35
  bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
36
36
  if (dragAndDropEnabled) {
37
37
  // Move row/column shortcuts
package/dist/esm/types.js CHANGED
@@ -93,6 +93,7 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
93
93
  DRAG_COLUMN_DROP_TARGET_CONTROLS: "".concat(tablePrefixSelector, "-col-drop-target-controls"),
94
94
  DRAG_COLUMN_CONTROLS_INNER: "".concat(tablePrefixSelector, "-col-controls__inner"),
95
95
  DRAG_HANDLE_BUTTON_CONTAINER: "".concat(tablePrefixSelector, "-drag-handle-button-container"),
96
+ DRAG_HANDLE_BUTTON_CLICKABLE_ZONE: "".concat(tablePrefixSelector, "-drag-handle-button-clickable-zone"),
96
97
  DRAG_CORNER_BUTTON: "".concat(tablePrefixSelector, "-drag-corner-button"),
97
98
  DRAG_CORNER_BUTTON_INNER: "".concat(tablePrefixSelector, "-drag-corner-button-inner"),
98
99
  /** disabled classes */
@@ -11,6 +11,7 @@ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/ut
11
11
  import { getPluginState } from '../../pm-plugins/plugin-factory';
12
12
  import { TableCssClassName as ClassName } from '../../types';
13
13
  import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
14
+ import { dragTableInsertColumnButtonSize } from '../consts';
14
15
  import { DragPreview } from '../DragPreview';
15
16
  import { HandleIconComponent } from './HandleIconComponent';
16
17
  var DragHandleComponent = function DragHandleComponent(_ref) {
@@ -42,11 +43,13 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
42
43
  hoveredColumns = _getPluginState.hoveredColumns,
43
44
  hoveredRows = _getPluginState.hoveredRows;
44
45
  var selection = editorView.state.selection;
45
- var isRowHandleHovered = direction === 'row' && hoveredRows.length > 0;
46
- var isColumnHandleHovered = direction === 'column' && hoveredColumns.length > 0;
46
+ var isRow = direction === 'row';
47
+ var isColumn = direction === 'column';
48
+ var isRowHandleHovered = isRow && hoveredRows.length > 0;
49
+ var isColumnHandleHovered = isColumn && hoveredColumns.length > 0;
47
50
  var hasMergedCells = useMemo(function () {
48
- return direction === 'row' ? hasMergedCellsInRow(indexes[0])(selection) : hasMergedCellsInColumn(indexes[0])(selection);
49
- }, [indexes, direction, selection]);
51
+ return isRow ? hasMergedCellsInRow(indexes[0])(selection) : hasMergedCellsInColumn(indexes[0])(selection);
52
+ }, [indexes, isRow, selection]);
50
53
  var handleIconProps = {
51
54
  forceDefaultHandle: forceDefaultHandle,
52
55
  isColumnHandleHovered: isColumnHandleHovered,
@@ -83,7 +86,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
83
86
  // be generated.
84
87
  container.style.left = "-".concat(rect.width - 0.0001, "px");
85
88
  }
86
- if (direction === 'row') {
89
+ if (isRow) {
87
90
  return {
88
91
  x: 12,
89
92
  y: rect.height / 2
@@ -107,17 +110,32 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
107
110
  }
108
111
  });
109
112
  }
110
- }, [tableLocalId, direction, indexes, editorView.state.selection, hasMergedCells, _canDrag]);
111
- var showDragMenuAnchorId = direction === 'row' ? 'drag-handle-button-row' : 'drag-handle-button-column';
113
+ }, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells, _canDrag]);
114
+ var showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
112
115
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
116
+ className: ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE,
117
+ "data-testid": "table-drag-handle-clickable-zone-button",
118
+ style: {
119
+ height: isRow ? "calc(100% - ".concat(dragTableInsertColumnButtonSize, "px)") : "var(--ds-space-200, 16px)",
120
+ // 16px here because it's the size of drag handle button's large side
121
+ width: isRow ? "var(--ds-space-200, 16px)" // 16px here because it's the size of drag handle button's large side
122
+ : "calc(100% - ".concat(dragTableInsertColumnButtonSize, "px)"),
123
+ left: isRow ? '3px' : undefined,
124
+ bottom: isColumn ? '0' : undefined,
125
+ alignSelf: isColumn ? 'none' : 'center',
126
+ zIndex: isColumn ? '-1' : 'auto'
127
+ },
128
+ onClick: onClick
129
+ }), /*#__PURE__*/React.createElement("button", {
113
130
  id: isDragMenuTarget ? showDragMenuAnchorId : undefined,
114
131
  className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, _defineProperty({}, ClassName.DRAG_HANDLE_DISABLED, !_canDrag || hasMergedCells)),
115
132
  ref: dragHandleDivRef,
116
133
  style: {
117
- transform: direction === 'column' ? 'none' : 'rotate(90deg)'
134
+ transform: isColumn ? 'none' : 'rotate(90deg)',
135
+ alignSelf: isColumn ? 'none' : 'center'
118
136
  },
119
137
  "data-testid": "table-drag-handle-button",
120
- "aria-label": formatMessage(direction === 'row' ? messages.rowDragHandle : messages.columnDragHandle),
138
+ "aria-label": formatMessage(isRow ? messages.rowDragHandle : messages.columnDragHandle),
121
139
  onMouseOver: onMouseOver,
122
140
  onMouseOut: onMouseOut,
123
141
  onMouseUp: function onMouseUp(e) {