@atlaskit/editor-plugin-table 5.3.13 → 5.3.15

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 (139) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/plugins/table/event-handlers.js +6 -3
  3. package/dist/cjs/plugins/table/index.js +6 -4
  4. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +3 -7
  5. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
  6. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +11 -0
  7. package/dist/cjs/plugins/table/types.js +9 -2
  8. package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +49 -11
  9. package/dist/cjs/plugins/table/ui/FloatingDragMenu/index.js +10 -5
  10. package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +57 -9
  11. package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +9 -7
  12. package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +13 -4
  13. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +44 -5
  14. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +6 -4
  15. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +35 -13
  16. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +2 -0
  17. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  18. package/dist/cjs/plugins/table/ui/icons/AddColLeftIcon.js +44 -0
  19. package/dist/cjs/plugins/table/ui/icons/AddColRightIcon.js +44 -0
  20. package/dist/cjs/plugins/table/ui/icons/AddRowAboveIcon.js +45 -0
  21. package/dist/cjs/plugins/table/ui/icons/AddRowBelowIcon.js +40 -0
  22. package/dist/cjs/plugins/table/ui/icons/index.js +29 -1
  23. package/dist/cjs/plugins/table/ui/ui-styles.js +27 -24
  24. package/dist/cjs/plugins/table/utils/dom.js +12 -4
  25. package/dist/cjs/plugins/table/utils/drag-menu.js +122 -10
  26. package/dist/cjs/plugins/table/utils/index.js +12 -0
  27. package/dist/es2019/plugins/table/event-handlers.js +5 -4
  28. package/dist/es2019/plugins/table/index.js +6 -4
  29. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +3 -7
  30. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
  31. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +12 -0
  32. package/dist/es2019/plugins/table/types.js +9 -2
  33. package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +52 -8
  34. package/dist/es2019/plugins/table/ui/FloatingDragMenu/index.js +10 -5
  35. package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +58 -7
  36. package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +9 -7
  37. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +10 -4
  38. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +46 -6
  39. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +7 -5
  40. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +35 -14
  41. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +2 -0
  42. package/dist/es2019/plugins/table/ui/common-styles.js +51 -3
  43. package/dist/es2019/plugins/table/ui/icons/AddColLeftIcon.js +35 -0
  44. package/dist/es2019/plugins/table/ui/icons/AddColRightIcon.js +35 -0
  45. package/dist/es2019/plugins/table/ui/icons/AddRowAboveIcon.js +36 -0
  46. package/dist/es2019/plugins/table/ui/icons/AddRowBelowIcon.js +31 -0
  47. package/dist/es2019/plugins/table/ui/icons/index.js +5 -1
  48. package/dist/es2019/plugins/table/ui/ui-styles.js +23 -1
  49. package/dist/es2019/plugins/table/utils/dom.js +5 -1
  50. package/dist/es2019/plugins/table/utils/drag-menu.js +118 -8
  51. package/dist/es2019/plugins/table/utils/index.js +1 -1
  52. package/dist/esm/plugins/table/event-handlers.js +7 -4
  53. package/dist/esm/plugins/table/index.js +6 -4
  54. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +3 -7
  55. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
  56. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +11 -0
  57. package/dist/esm/plugins/table/types.js +9 -2
  58. package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +46 -8
  59. package/dist/esm/plugins/table/ui/FloatingDragMenu/index.js +10 -5
  60. package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +56 -8
  61. package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +9 -7
  62. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +10 -4
  63. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +45 -6
  64. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +7 -5
  65. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +36 -14
  66. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +2 -0
  67. package/dist/esm/plugins/table/ui/common-styles.js +2 -2
  68. package/dist/esm/plugins/table/ui/icons/AddColLeftIcon.js +37 -0
  69. package/dist/esm/plugins/table/ui/icons/AddColRightIcon.js +37 -0
  70. package/dist/esm/plugins/table/ui/icons/AddRowAboveIcon.js +38 -0
  71. package/dist/esm/plugins/table/ui/icons/AddRowBelowIcon.js +33 -0
  72. package/dist/esm/plugins/table/ui/icons/index.js +5 -1
  73. package/dist/esm/plugins/table/ui/ui-styles.js +26 -23
  74. package/dist/esm/plugins/table/utils/dom.js +11 -3
  75. package/dist/esm/plugins/table/utils/drag-menu.js +120 -8
  76. package/dist/esm/plugins/table/utils/index.js +1 -1
  77. package/dist/types/plugins/table/types.d.ts +9 -2
  78. package/dist/types/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +5 -2
  79. package/dist/types/plugins/table/ui/FloatingDragMenu/index.d.ts +3 -1
  80. package/dist/types/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +5 -1
  81. package/dist/types/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +1 -1
  82. package/dist/types/plugins/table/ui/FloatingInsertButton/index.d.ts +1 -0
  83. package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
  84. package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -0
  85. package/dist/types/plugins/table/ui/icons/AddColLeftIcon.d.ts +2 -0
  86. package/dist/types/plugins/table/ui/icons/AddColRightIcon.d.ts +2 -0
  87. package/dist/types/plugins/table/ui/icons/AddRowAboveIcon.d.ts +2 -0
  88. package/dist/types/plugins/table/ui/icons/AddRowBelowIcon.d.ts +2 -0
  89. package/dist/types/plugins/table/ui/icons/index.d.ts +4 -0
  90. package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
  91. package/dist/types/plugins/table/utils/dom.d.ts +4 -1
  92. package/dist/types/plugins/table/utils/drag-menu.d.ts +6 -3
  93. package/dist/types/plugins/table/utils/index.d.ts +1 -1
  94. package/dist/types-ts4.5/plugins/table/types.d.ts +9 -2
  95. package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +5 -2
  96. package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/index.d.ts +3 -1
  97. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +5 -1
  98. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +1 -1
  99. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +1 -0
  100. package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
  101. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -0
  102. package/dist/types-ts4.5/plugins/table/ui/icons/AddColLeftIcon.d.ts +2 -0
  103. package/dist/types-ts4.5/plugins/table/ui/icons/AddColRightIcon.d.ts +2 -0
  104. package/dist/types-ts4.5/plugins/table/ui/icons/AddRowAboveIcon.d.ts +2 -0
  105. package/dist/types-ts4.5/plugins/table/ui/icons/AddRowBelowIcon.d.ts +2 -0
  106. package/dist/types-ts4.5/plugins/table/ui/icons/index.d.ts +4 -0
  107. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
  108. package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +4 -1
  109. package/dist/types-ts4.5/plugins/table/utils/drag-menu.d.ts +6 -3
  110. package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
  111. package/package.json +2 -1
  112. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +40 -194
  113. package/src/__tests__/unit/ui/RowDragControls.tsx +9 -11
  114. package/src/plugins/table/event-handlers.ts +15 -3
  115. package/src/plugins/table/index.tsx +4 -2
  116. package/src/plugins/table/pm-plugins/decorations/plugin.ts +2 -9
  117. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +1 -3
  118. package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +9 -0
  119. package/src/plugins/table/types.ts +12 -2
  120. package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +73 -6
  121. package/src/plugins/table/ui/FloatingDragMenu/index.tsx +15 -3
  122. package/src/plugins/table/ui/FloatingInsertButton/InsertButton.tsx +82 -8
  123. package/src/plugins/table/ui/FloatingInsertButton/getPopupOptions.ts +28 -5
  124. package/src/plugins/table/ui/FloatingInsertButton/index.tsx +19 -7
  125. package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +47 -3
  126. package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +11 -4
  127. package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +49 -18
  128. package/src/plugins/table/ui/TableFloatingControls/index.tsx +2 -0
  129. package/src/plugins/table/ui/common-styles.ts +57 -2
  130. package/src/plugins/table/ui/icons/AddColLeftIcon.tsx +43 -0
  131. package/src/plugins/table/ui/icons/AddColRightIcon.tsx +43 -0
  132. package/src/plugins/table/ui/icons/AddRowAboveIcon.tsx +42 -0
  133. package/src/plugins/table/ui/icons/AddRowBelowIcon.tsx +36 -0
  134. package/src/plugins/table/ui/icons/index.ts +4 -0
  135. package/src/plugins/table/ui/ui-styles.ts +27 -1
  136. package/src/plugins/table/utils/dom.ts +11 -4
  137. package/src/plugins/table/utils/drag-menu.ts +158 -5
  138. package/src/plugins/table/utils/index.ts +2 -0
  139. package/tsconfig.app.json +3 -0
@@ -1,6 +1,7 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
3
  import { getCellsInRow } from '@atlaskit/editor-tables/utils';
4
+ import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
4
5
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
5
6
  import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils/merged-cells';
6
7
  import { getPluginState as getTablePluginState } from '../plugin-factory';
@@ -83,7 +84,17 @@ export const createPlugin = (dispatch, eventDispatcher) => {
83
84
  // watch for changes
84
85
  return localId === (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId);
85
86
  },
87
+ onDragStart: ({
88
+ location
89
+ }) => {
90
+ autoScroller.start({
91
+ input: location.current.input
92
+ });
93
+ },
86
94
  onDrag(event) {
95
+ autoScroller.updateInput({
96
+ input: event.location.current.input
97
+ });
87
98
  const data = getDraggableDataFromEvent(event);
88
99
  // If no data can be found then it's most like we do not want to perform any drag actions
89
100
  if (!data) {
@@ -101,6 +112,7 @@ export const createPlugin = (dispatch, eventDispatcher) => {
101
112
  setDropTarget(dropTargetType, targetAdjustedIndex)(editorView.state, editorView.dispatch);
102
113
  },
103
114
  onDrop(event) {
115
+ autoScroller.stop();
104
116
  const data = getDraggableDataFromEvent(event);
105
117
 
106
118
  // If no data can be found then it's most like we do not want to perform any drop action
@@ -66,6 +66,9 @@ export const TableCssClassName = {
66
66
  CONTROLS_INSERT_LINE: `${tablePrefixSelector}-controls__insert-line`,
67
67
  CONTROLS_BUTTON_OVERLAY: `${tablePrefixSelector}-controls__button-overlay`,
68
68
  LAYOUT_BUTTON: `${tablePrefixSelector}-layout-button`,
69
+ DRAG_CONTROLS_INSERT_BUTTON: `${tablePrefixSelector}-controls__drag-insert-button`,
70
+ DRAG_CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__drag-insert-button-inner`,
71
+ DRAG_CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__drag-insert-button-wrap`,
69
72
  CONTROLS_INSERT_MARKER: `${tablePrefixSelector}-controls__insert-marker`,
70
73
  CONTROLS_INSERT_COLUMN: `${tablePrefixSelector}-controls__insert-column`,
71
74
  CONTROLS_INSERT_ROW: `${tablePrefixSelector}-controls__insert-row`,
@@ -78,8 +81,12 @@ export const TableCssClassName = {
78
81
  CORNER_CONTROLS_INSERT_COLUMN_MARKER: `${tablePrefixSelector}-corner-controls__insert-column-marker`,
79
82
  CONTROLS_CORNER_BUTTON: `${tablePrefixSelector}-corner-button`,
80
83
  /** Controls with drag handle */
81
- COLUMN_CONTROLS_WITH_DRAG: `${tablePrefixSelector}-column-controls-with-drag`,
82
- ROW_CONTROLS_WITH_DRAG: `${tablePrefixSelector}-row-controls-with-drag`,
84
+ DRAG_ROW_CONTROLS: `${tablePrefixSelector}-drag-row-controls`,
85
+ DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-row-floating-insert-dot-wrapper`,
86
+ DRAG_ROW_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-row-floating-insert-dot`,
87
+ DRAG_COLUMN_CONTROLS: `${tablePrefixSelector}-drag-column-controls`,
88
+ DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-columns-floating-insert-dot-wrapper`,
89
+ DRAG_COLUMN_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-columns-floating-insert-dot`,
83
90
  DRAG_HANDLE_BUTTON_CONTAINER: `${tablePrefixSelector}-drag-handle-button-container`,
84
91
  /** Other classes */
85
92
  NUMBERED_COLUMN: `${tablePrefixSelector}-numbered-column`,
@@ -1,7 +1,12 @@
1
- import React from 'react';
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
2
3
  import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
4
+ import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
3
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
+ import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
7
+ import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
4
8
  import { toggleDragMenu } from '../../pm-plugins/drag-and-drop/commands';
9
+ import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
5
10
  import { getDragMenuConfig } from '../../utils/drag-menu';
6
11
  import { dragMenuDropdownWidth } from '../consts';
7
12
  const convertToDropdownItems = dragMenuConfig => {
@@ -14,7 +19,18 @@ const convertToDropdownItems = dragMenuConfig => {
14
19
  value: {
15
20
  name: item.id
16
21
  },
17
- isDisabled: item.disabled
22
+ isDisabled: item.disabled,
23
+ elemBefore: item.icon ? jsx("div", {
24
+ style: {
25
+ marginRight: "var(--ds-space-negative-075, -6px)",
26
+ display: 'flex'
27
+ }
28
+ }, jsx(item.icon, {
29
+ label: item.title
30
+ })) : undefined,
31
+ elemAfter: item.keymap ? jsx("div", {
32
+ css: shortcutStyle
33
+ }, item.keymap) : undefined
18
34
  });
19
35
  item.onClick && (menuCallback[item.id] = item.onClick);
20
36
  });
@@ -31,10 +47,20 @@ export const DragMenu = ({
31
47
  tableNode,
32
48
  mountPoint,
33
49
  boundariesElement,
34
- scrollableElement
50
+ scrollableElement,
51
+ targetCellPosition,
52
+ getEditorContainerWidth
35
53
  }) => {
36
54
  const tableMap = tableNode ? TableMap.get(tableNode) : undefined;
37
- const dragMenuConfig = getDragMenuConfig(direction, tableMap, index);
55
+ const {
56
+ state,
57
+ dispatch
58
+ } = editorView;
59
+ const {
60
+ selection
61
+ } = state;
62
+ const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
63
+ const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, tableMap, index, targetCellPosition, selectionRect);
38
64
  const {
39
65
  menuItems,
40
66
  menuCallback
@@ -46,17 +72,33 @@ export const DragMenu = ({
46
72
  } = editorView;
47
73
  toggleDragMenu(false)(state, dispatch);
48
74
  };
49
- const onMenuItemActivated = ({
75
+ const handleMenuItemActivated = ({
50
76
  item
51
77
  }) => {
52
78
  var _menuCallback$item$va;
53
- (_menuCallback$item$va = menuCallback[item.value.name]) === null || _menuCallback$item$va === void 0 ? void 0 : _menuCallback$item$va.call(menuCallback, editorView.state, editorView.dispatch);
79
+ (_menuCallback$item$va = menuCallback[item.value.name]) === null || _menuCallback$item$va === void 0 ? void 0 : _menuCallback$item$va.call(menuCallback, state, dispatch);
54
80
  closeMenu();
55
81
  };
82
+ const handleItemMouseEnter = ({
83
+ item
84
+ }) => {
85
+ var _item$value$name;
86
+ if (!selectionRect || !((_item$value$name = item.value.name) !== null && _item$value$name !== void 0 && _item$value$name.startsWith('delete'))) {
87
+ return;
88
+ }
89
+ (item.value.name === 'delete_column' ? hoverColumns(getSelectedColumnIndexes(selectionRect), true) : hoverRows(getSelectedRowIndexes(selectionRect), true))(state, dispatch);
90
+ };
91
+ const handleItemMouseLeave = ({
92
+ item
93
+ }) => {
94
+ if (['sort_column_asc', 'sort_column_desc', 'delete_column', 'delete_row'].indexOf(item.value.name) > -1) {
95
+ clearHoverSelection()(state, dispatch);
96
+ }
97
+ };
56
98
  if (!menuItems) {
57
99
  return null;
58
100
  }
59
- return /*#__PURE__*/React.createElement(DropdownMenu, {
101
+ return jsx(DropdownMenu, {
60
102
  mountTo: mountPoint
61
103
  //This needs be removed when the a11y is completely handled
62
104
  //Disabling key navigation now as it works only partially
@@ -70,7 +112,9 @@ export const DragMenu = ({
70
112
  }],
71
113
  isOpen: isOpen,
72
114
  onOpenChange: closeMenu,
73
- onItemActivated: onMenuItemActivated,
115
+ onItemActivated: handleMenuItemActivated,
116
+ onMouseEnter: handleItemMouseEnter,
117
+ onMouseLeave: handleItemMouseLeave,
74
118
  fitWidth: dragMenuDropdownWidth,
75
119
  boundariesElement: boundariesElement
76
120
  });
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Popup } from '@atlaskit/editor-common/ui';
3
3
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
4
4
  import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
5
+ import { TableMap } from '@atlaskit/editor-tables/table-map';
5
6
  import { dragMenuDropdownWidth } from '../consts';
6
7
  import { DragMenu } from './DragMenu';
7
8
  const FloatingDragMenu = ({
@@ -14,7 +15,8 @@ const FloatingDragMenu = ({
14
15
  tableNode,
15
16
  direction,
16
17
  index,
17
- targetCellPosition
18
+ targetCellPosition,
19
+ getEditorContainerWidth
18
20
  }) => {
19
21
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
20
22
  return null;
@@ -24,10 +26,11 @@ const FloatingDragMenu = ({
24
26
  if (!targetCellRef) {
25
27
  return null;
26
28
  }
27
-
29
+ const tableMap = tableNode ? TableMap.get(tableNode) : undefined;
30
+ const offset = direction === 'row' ? [7, 0] : index === ((tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) || 1) - 1 ? [14, 0] : [-14, 0];
28
31
  // TODO: we will need to adjust the alignment and offset values depending on whether this is a row or column menu.
29
32
  return /*#__PURE__*/React.createElement(Popup, {
30
- alignX: "left",
33
+ alignX: direction === 'row' ? 'left' : 'center',
31
34
  alignY: "top",
32
35
  target: targetCellRef,
33
36
  mountTo: mountPoint,
@@ -39,7 +42,7 @@ const FloatingDragMenu = ({
39
42
  ,
40
43
  zIndex: akEditorFloatingOverlapPanelZIndex,
41
44
  forcePlacement: true,
42
- offset: [7, 0],
45
+ offset: offset,
43
46
  stick: true
44
47
  }, /*#__PURE__*/React.createElement(DragMenu, {
45
48
  editorView: editorView,
@@ -47,7 +50,9 @@ const FloatingDragMenu = ({
47
50
  boundariesElement: boundariesElement,
48
51
  tableNode: tableNode,
49
52
  direction: direction,
50
- index: index
53
+ index: index,
54
+ targetCellPosition: targetCellPosition,
55
+ getEditorContainerWidth: getEditorContainerWidth
51
56
  }));
52
57
  };
53
58
  FloatingDragMenu.displayName = 'FloatingDragMenu';
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
+
1
3
  import React from 'react';
2
4
  import { injectIntl } from 'react-intl-next';
3
5
  import { addColumnAfter, addRowAfter, ToolTipContent } from '@atlaskit/editor-common/keymaps';
@@ -23,7 +25,7 @@ const getToolbarSize = tableRef => {
23
25
  }
24
26
  return tableToolbarSize;
25
27
  };
26
- const getInsertLineWidth = tableRef => {
28
+ const getInsertLineWidth = (tableRef, isDragAndDropEnabled) => {
27
29
  // The line gets width 100% from the table,
28
30
  // but since we have an overflow on the left,
29
31
  // we should add an offset to make up for it.
@@ -37,16 +39,65 @@ const getInsertLineWidth = tableRef => {
37
39
  scrollLeft
38
40
  } = parentElement;
39
41
  const diff = offsetWidth - parentOffsetWidth;
40
- const toolbarSize = getToolbarSize(tableRef);
42
+ const toolbarSize = isDragAndDropEnabled ? 0 : getToolbarSize(tableRef);
41
43
  return Math.min(offsetWidth + toolbarSize, parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0)) + LINE_OFFSET;
42
44
  };
43
45
  const tooltipMessageByType = type => {
44
46
  return type === 'row' ? tableMessages.insertRow : tableMessages.insertColumn;
45
47
  };
48
+ export const InsertButtonForDragAndDrop = ({
49
+ onMouseDown,
50
+ tableRef,
51
+ type,
52
+ intl: {
53
+ formatMessage
54
+ },
55
+ hasStickyHeaders
56
+ }) => {
57
+ const content = /*#__PURE__*/React.createElement(Tooltip, {
58
+ content: /*#__PURE__*/React.createElement(ToolTipContent, {
59
+ description: formatMessage(tooltipMessageByType(type)),
60
+ keymap: type === 'row' ? addRowAfter : addColumnAfter
61
+ }),
62
+ position: "top"
63
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
64
+ className: ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER
65
+ }, /*#__PURE__*/React.createElement("button", {
66
+ type: "button",
67
+ className: ClassName.DRAG_CONTROLS_INSERT_BUTTON,
68
+ onMouseDown: onMouseDown
69
+ }, /*#__PURE__*/React.createElement("svg", {
70
+ width: "10",
71
+ height: "10",
72
+ viewBox: "0 0 10 10",
73
+ fill: "none",
74
+ xmlns: "http://www.w3.org/2000/svg"
75
+ }, /*#__PURE__*/React.createElement("path", {
76
+ fillRule: "evenodd",
77
+ clipRule: "evenodd",
78
+ d: "M5.41667 4.58333V2.91667C5.41667 2.80616 5.37277 2.70018 5.29463 2.62204C5.21649 2.5439 5.11051 2.5 5 2.5C4.88949 2.5 4.78351 2.5439 4.70537 2.62204C4.62723 2.70018 4.58333 2.80616 4.58333 2.91667V4.58333H2.91667C2.80616 4.58333 2.70018 4.62723 2.62204 4.70537C2.5439 4.78351 2.5 4.88949 2.5 5C2.5 5.11051 2.5439 5.21649 2.62204 5.29463C2.70018 5.37277 2.80616 5.41667 2.91667 5.41667H4.58333V7.08333C4.58333 7.19384 4.62723 7.29982 4.70537 7.37796C4.78351 7.4561 4.88949 7.5 5 7.5C5.11051 7.5 5.21649 7.4561 5.29463 7.37796C5.37277 7.29982 5.41667 7.19384 5.41667 7.08333V5.41667H7.08333C7.19384 5.41667 7.29982 5.37277 7.37796 5.29463C7.4561 5.21649 7.5 5.11051 7.5 5C7.5 4.88949 7.4561 4.78351 7.37796 4.70537C7.29982 4.62723 7.19384 4.58333 7.08333 4.58333H5.41667Z",
79
+ fill: "currentColor"
80
+ })))), /*#__PURE__*/React.createElement("div", {
81
+ className: ClassName.CONTROLS_INSERT_LINE,
82
+ style: type === 'row' ? {
83
+ width: getInsertLineWidth(tableRef, true),
84
+ left: '14px'
85
+ } : {
86
+ height: getInsertLineHeight(tableRef, hasStickyHeaders) - 11
87
+ }
88
+ })));
89
+ const floatingButtonClassName = type === 'column' ? ClassName.CONTROLS_FLOATING_BUTTON_COLUMN : ClassName.CONTROLS_FLOATING_BUTTON_ROW;
90
+ return /*#__PURE__*/React.createElement("div", {
91
+ className: floatingButtonClassName
92
+ }, /*#__PURE__*/React.createElement("div", {
93
+ className: `${ClassName.CONTROLS_INSERT_BUTTON_WRAP} ${ClassName.CONTROLS_INSERT_ROW}`
94
+ }, content));
95
+ };
96
+ export const DragAndDropInsertButton = injectIntl(InsertButtonForDragAndDrop);
46
97
  const InsertButton = ({
47
98
  onMouseDown,
48
99
  tableRef,
49
- direction,
100
+ type,
50
101
  intl: {
51
102
  formatMessage
52
103
  },
@@ -54,8 +105,8 @@ const InsertButton = ({
54
105
  }) => {
55
106
  const content = /*#__PURE__*/React.createElement(Tooltip, {
56
107
  content: /*#__PURE__*/React.createElement(ToolTipContent, {
57
- description: formatMessage(tooltipMessageByType(direction)),
58
- keymap: direction === 'row' ? addRowAfter : addColumnAfter
108
+ description: formatMessage(tooltipMessageByType(type)),
109
+ keymap: type === 'row' ? addRowAfter : addColumnAfter
59
110
  }),
60
111
  position: "top"
61
112
  }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -72,13 +123,13 @@ const InsertButton = ({
72
123
  fillRule: "evenodd"
73
124
  })))), /*#__PURE__*/React.createElement("div", {
74
125
  className: ClassName.CONTROLS_INSERT_LINE,
75
- style: direction === 'row' ? {
126
+ style: type === 'row' ? {
76
127
  width: getInsertLineWidth(tableRef)
77
128
  } : {
78
129
  height: getInsertLineHeight(tableRef, hasStickyHeaders)
79
130
  }
80
131
  })));
81
- const floatingButtonClassName = direction === 'column' ? ClassName.CONTROLS_FLOATING_BUTTON_COLUMN : ClassName.CONTROLS_FLOATING_BUTTON_ROW;
132
+ const floatingButtonClassName = type === 'column' ? ClassName.CONTROLS_FLOATING_BUTTON_COLUMN : ClassName.CONTROLS_FLOATING_BUTTON_ROW;
82
133
  return /*#__PURE__*/React.createElement("div", {
83
134
  className: floatingButtonClassName
84
135
  }, /*#__PURE__*/React.createElement("div", {
@@ -3,9 +3,11 @@ import { tableInsertColumnButtonOffset, tableInsertColumnButtonSize, tableToolba
3
3
  const HORIZONTAL_ALIGN_COLUMN_BUTTON = -(tableInsertColumnButtonSize / 2);
4
4
  const HORIZONTAL_ALIGN_NUMBERED_COLUMN_BUTTON = HORIZONTAL_ALIGN_COLUMN_BUTTON + akEditorTableNumberColumnWidth;
5
5
  const VERTICAL_ALIGN_COLUMN_BUTTON = tableToolbarSize + tableInsertColumnButtonOffset;
6
+ const VERTICAL_ALIGN_COLUMN_BUTTON_DRAG = tableInsertColumnButtonOffset;
6
7
  const HORIZONTAL_ALIGN_ROW_BUTTON = -(tableToolbarSize + tableInsertColumnButtonOffset + tableInsertColumnButtonSize);
8
+ const HORIZONTAL_ALIGN_ROW_BUTTON_DRAG = -18;
7
9
  const VERTICAL_ALIGN_ROW_BUTTON = tableInsertColumnButtonSize / 2;
8
- function getRowOptions(index) {
10
+ function getRowOptions(index, isDragAndDropEnabled) {
9
11
  let defaultOptions = {
10
12
  alignX: 'left',
11
13
  alignY: 'bottom',
@@ -25,16 +27,16 @@ function getRowOptions(index) {
25
27
  return {
26
28
  ...position,
27
29
  // Left position should be always the offset (To place in the correct position even if the table has overflow).
28
- left: HORIZONTAL_ALIGN_ROW_BUTTON
30
+ left: isDragAndDropEnabled ? HORIZONTAL_ALIGN_ROW_BUTTON_DRAG : HORIZONTAL_ALIGN_ROW_BUTTON
29
31
  };
30
32
  }
31
33
  };
32
34
  }
33
- function getColumnOptions(index, tableContainer, hasNumberedColumns) {
35
+ function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDropEnabled) {
34
36
  const options = {
35
37
  alignX: 'end',
36
38
  alignY: 'top',
37
- offset: [HORIZONTAL_ALIGN_COLUMN_BUTTON, VERTICAL_ALIGN_COLUMN_BUTTON],
39
+ offset: [HORIZONTAL_ALIGN_COLUMN_BUTTON, isDragAndDropEnabled ? VERTICAL_ALIGN_COLUMN_BUTTON_DRAG : VERTICAL_ALIGN_COLUMN_BUTTON],
38
40
  // :: (position: PopupPosition) -> PopupPosition
39
41
  // Limit the InsertButton position to the table container
40
42
  // if the left position starts before it
@@ -75,12 +77,12 @@ function getColumnOptions(index, tableContainer, hasNumberedColumns) {
75
77
  }
76
78
  return options;
77
79
  }
78
- function getPopupOptions(direction, index, hasNumberedColumns, tableContainer) {
80
+ function getPopupOptions(direction, index, hasNumberedColumns, isDragAndDropEnabled, tableContainer) {
79
81
  switch (direction) {
80
82
  case 'column':
81
- return getColumnOptions(index, tableContainer, hasNumberedColumns);
83
+ return getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDropEnabled);
82
84
  case 'row':
83
- return getRowOptions(index);
85
+ return getRowOptions(index, isDragAndDropEnabled);
84
86
  default:
85
87
  return {};
86
88
  }
@@ -14,7 +14,7 @@ import { insertColumnWithAnalytics, insertRowWithAnalytics } from '../../command
14
14
  import { TableCssClassName as ClassName } from '../../types';
15
15
  import { checkIfNumberColumnEnabled } from '../../utils';
16
16
  import getPopupOptions from './getPopupOptions';
17
- import InsertButton from './InsertButton';
17
+ import InsertButton, { DragAndDropInsertButton } from './InsertButton';
18
18
  export class FloatingInsertButton extends React.Component {
19
19
  constructor(props) {
20
20
  super(props);
@@ -32,6 +32,7 @@ export class FloatingInsertButton extends React.Component {
32
32
  boundariesElement,
33
33
  isHeaderColumnEnabled,
34
34
  isHeaderRowEnabled,
35
+ isDragAndDropEnabled,
35
36
  dispatchAnalyticsEvent
36
37
  } = this.props;
37
38
  const type = typeof insertColumnButtonIndex !== 'undefined' ? 'column' : typeof insertRowButtonIndex !== 'undefined' ? 'row' : null;
@@ -111,10 +112,15 @@ export class FloatingInsertButton extends React.Component {
111
112
  scrollableElement: tableWrapper,
112
113
  forcePlacement: true,
113
114
  allowOutOfBounds: true
114
- }, getPopupOptions(type, index, hasNumberedColumns, tableContainerWrapper), {
115
+ }, getPopupOptions(type, index, hasNumberedColumns, !!isDragAndDropEnabled, tableContainerWrapper), {
115
116
  zIndex: zIndex
116
- }), /*#__PURE__*/React.createElement(InsertButton, {
117
- direction: type,
117
+ }), isDragAndDropEnabled ? /*#__PURE__*/React.createElement(DragAndDropInsertButton, {
118
+ type: type,
119
+ tableRef: tableRef,
120
+ onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
121
+ hasStickyHeaders: this.props.hasStickyHeaders || false
122
+ }) : /*#__PURE__*/React.createElement(InsertButton, {
123
+ type: type,
118
124
  tableRef: tableRef,
119
125
  onMouseDown: type === 'column' ? this.insertColumn : this.insertRow,
120
126
  hasStickyHeaders: this.props.hasStickyHeaders || false
@@ -2,8 +2,9 @@ import React, { useCallback, useMemo } from 'react';
2
2
  import { CellSelection } from '@atlaskit/editor-tables';
3
3
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
4
4
  import { clearHoverSelection, hoverColumns, selectColumn } from '../../../commands';
5
+ import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
5
6
  import { TableCssClassName as ClassName } from '../../../types';
6
- import { getSelectedColumnIndexes } from '../../../utils';
7
+ import { getRowsParams, getSelectedColumnIndexes } from '../../../utils';
7
8
  import { DragHandle } from '../../DragHandle';
8
9
  const getSelectedColumns = selection => {
9
10
  if (selection instanceof CellSelection && selection.isColSelection()) {
@@ -25,10 +26,13 @@ export const ColumnControls = ({
25
26
  localId,
26
27
  isInDanger,
27
28
  rowHeights,
28
- colWidths
29
+ colWidths,
30
+ hasHeaderColumn
29
31
  }) => {
30
32
  var _colWidths$map$join, _rowHeights$;
31
33
  const widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(width => width ? `${width - 1}px` : '0px').join(' ')) !== null && _colWidths$map$join !== void 0 ? _colWidths$map$join : '0px';
34
+ // TODO: reusing getRowsParams here because it's generic enough to work for columns -> rename
35
+ const columnParams = getRowsParams(colWidths !== null && colWidths !== void 0 ? colWidths : []);
32
36
  const colIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex;
33
37
  const selectedColIndexes = getSelectedColumns(editorView.state.selection);
34
38
  const gridColumnPosition = useMemo(() => {
@@ -64,8 +68,15 @@ export const ColumnControls = ({
64
68
  clearHoverSelection()(state, dispatch);
65
69
  }
66
70
  }, [editorView, tableActive]);
71
+ const handleMouseUp = useCallback(() => {
72
+ const {
73
+ state,
74
+ dispatch
75
+ } = editorView;
76
+ toggleDragMenu(undefined, 'column', colIndex)(state, dispatch);
77
+ }, [editorView, colIndex]);
67
78
  return /*#__PURE__*/React.createElement("div", {
68
- className: ClassName.COLUMN_CONTROLS_WITH_DRAG
79
+ className: ClassName.DRAG_COLUMN_CONTROLS
69
80
  }, /*#__PURE__*/React.createElement("div", {
70
81
  className: ClassName.COLUMN_CONTROLS_INNER,
71
82
  "data-testid": "table-floating-column-controls",
@@ -73,10 +84,38 @@ export const ColumnControls = ({
73
84
  gridTemplateColumns: widths,
74
85
  marginTop
75
86
  }
76
- }, tableActive && !isResizing && !!hoveredCell && Number.isFinite(hoveredCell.colIndex) && /*#__PURE__*/React.createElement("div", {
87
+ }, !isResizing && columnParams.map(({
88
+ startIndex,
89
+ endIndex
90
+ }, index) => /*#__PURE__*/React.createElement("div", {
91
+ style: {
92
+ gridColumn: `${index + 1} / span 1`
93
+ },
94
+ "data-start-index": startIndex,
95
+ "data-end-index": endIndex,
96
+ className: ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER,
97
+ contentEditable: false,
98
+ key: index
99
+ }, !hasHeaderColumn && index === 0 && /*#__PURE__*/React.createElement("div", {
100
+ style: {
101
+ left: '0px',
102
+ right: 'unset'
103
+ },
104
+ className: ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT
105
+ }), /*#__PURE__*/React.createElement("div", {
106
+ className: ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT,
107
+ style: columnParams.length - 1 === index ? {
108
+ right: '0'
109
+ } : {}
110
+ }))), tableActive && !isResizing && !!hoveredCell && Number.isFinite(hoveredCell.colIndex) && /*#__PURE__*/React.createElement("div", {
77
111
  style: {
78
112
  gridColumn: gridColumnPosition,
79
- marginTop: `-15px`
113
+ zIndex: 99,
114
+ display: 'flex',
115
+ width: '100%',
116
+ justifyContent: 'center',
117
+ alignItems: 'center',
118
+ marginTop: "var(--ds-space-negative-025, -2px)"
80
119
  },
81
120
  "data-column-control-index": hoveredCell.colIndex,
82
121
  "data-testid": "table-floating-column-control"
@@ -89,7 +128,8 @@ export const ColumnControls = ({
89
128
  appearance: selectedColIndexes.includes(hoveredCell.colIndex) ? isInDanger ? 'danger' : 'selected' : 'default',
90
129
  onClick: handleClick,
91
130
  onMouseOver: handleMouseOver,
92
- onMouseOut: handleMouseOut
131
+ onMouseOut: handleMouseOut,
132
+ onMouseUp: handleMouseUp
93
133
  }))));
94
134
  };
95
135
  export default ColumnControls;
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
4
4
  import { TableCssClassName as ClassName } from '../../types';
5
- import { getColumnsWidths, getRowHeights } from '../../utils';
5
+ import { containsHeaderColumn, getColumnsWidths, getRowHeights } from '../../utils';
6
6
  import { ColumnControls } from './ColumnControls';
7
7
  import { ColumnDropTargets } from './ColumnDropTargets';
8
8
  export const TableFloatingColumnControls = ({
@@ -24,6 +24,7 @@ export const TableFloatingColumnControls = ({
24
24
  const [hasDropTargets, setHasDropTargets] = useState(false);
25
25
  const node = getNode();
26
26
  const currentNodeLocalId = node === null || node === void 0 ? void 0 : node.attrs.localId;
27
+ const hasHeaderColumn = containsHeaderColumn(node);
27
28
  useEffect(() => {
28
29
  var _window;
29
30
  if (tableRef && (_window = window) !== null && _window !== void 0 && _window.ResizeObserver) {
@@ -76,11 +77,11 @@ export const TableFloatingColumnControls = ({
76
77
  const colWidths = getColumnsWidths(editorView);
77
78
  const stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
78
79
  const mountTo = tableRef && (tableRef === null || tableRef === void 0 ? void 0 : tableRef.parentElement) || document.body;
80
+ if (!tableActive) {
81
+ return null;
82
+ }
79
83
  return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement("div", {
80
84
  className: ClassName.COLUMN_CONTROLS_WRAPPER,
81
- style: {
82
- pointerEvents: 'none'
83
- },
84
85
  "data-testid": "table-floating-column-controls-wrapper"
85
86
  }, /*#__PURE__*/React.createElement(ColumnControls, {
86
87
  editorView: editorView,
@@ -92,7 +93,8 @@ export const TableFloatingColumnControls = ({
92
93
  localId: currentNodeLocalId,
93
94
  isInDanger: isInDanger,
94
95
  rowHeights: rowHeights,
95
- colWidths: colWidths
96
+ colWidths: colWidths,
97
+ hasHeaderColumn: hasHeaderColumn
96
98
  }), hasDropTargets && /*#__PURE__*/React.createElement(ColumnDropTargets, {
97
99
  tableRef: tableRef,
98
100
  stickyTop: tableActive ? stickyTop : undefined,
@@ -5,7 +5,7 @@ import { getSelectionRect } from '@atlaskit/editor-tables/utils';
5
5
  import { clearHoverSelection } from '../../../commands';
6
6
  import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
7
7
  import { TableCssClassName as ClassName } from '../../../types';
8
- import { getRowHeights, getSelectedRowIndexes } from '../../../utils';
8
+ import { getRowHeights, getRowsParams, getSelectedRowIndexes } from '../../../utils';
9
9
  import { DragHandle } from '../../DragHandle';
10
10
  const getSelectedRows = selection => {
11
11
  if (selection instanceof CellSelection && selection.isRowSelection()) {
@@ -24,12 +24,15 @@ const DragControlsComponent = ({
24
24
  tableActive,
25
25
  editorView,
26
26
  isInDanger,
27
+ isResizing,
28
+ hasHeaderRow,
27
29
  hoverRows,
28
30
  selectRow,
29
31
  updateCellHoverLocation
30
32
  }) => {
31
33
  var _tableNode$attrs$loca, _tableNode$attrs;
32
34
  const rowHeights = getRowHeights(tableRef);
35
+ const rowsParams = getRowsParams(rowHeights);
33
36
  const heights = rowHeights.map(height => `${height - 1}px`).join(' ');
34
37
  const selectedRowIndexes = getSelectedRows(editorView.state.selection);
35
38
  const rowWidth = tableRef.offsetWidth;
@@ -54,18 +57,15 @@ const DragControlsComponent = ({
54
57
  }
55
58
  }, [editorView, tableActive]);
56
59
  const handleMouseMove = useCallback(e => {
57
- // avoid updating if event target is drag handle
58
- if (!e.nativeEvent.target.classList.contains(ClassName.ROW_CONTROLS_WITH_DRAG)) {
60
+ const isParentDragControls = e.nativeEvent.target.closest(`.${ClassName.DRAG_ROW_CONTROLS}`);
61
+ const rowIndex = e.nativeEvent.target.getAttribute('data-start-index');
62
+
63
+ // avoid updating if event target is not related
64
+ if (!isParentDragControls || !rowIndex) {
59
65
  return;
60
66
  }
61
- const hoverHeight = e.nativeEvent.offsetY;
62
- let totalHeight = 0;
63
- const rowIndex = rowHeights.findIndex(row => {
64
- totalHeight += row;
65
- return hoverHeight <= totalHeight;
66
- });
67
- updateCellHoverLocation(rowIndex);
68
- }, [updateCellHoverLocation, rowHeights]);
67
+ updateCellHoverLocation(Number(rowIndex));
68
+ }, [updateCellHoverLocation]);
69
69
  const handleMouseOver = useCallback(() => {
70
70
  hoverRows([rowIndex]);
71
71
  }, [hoverRows, rowIndex]);
@@ -73,19 +73,40 @@ const DragControlsComponent = ({
73
73
  selectRow(rowIndex, e === null || e === void 0 ? void 0 : e.shiftKey);
74
74
  }, [rowIndex, selectRow]);
75
75
  return /*#__PURE__*/React.createElement("div", {
76
- className: ClassName.ROW_CONTROLS_WITH_DRAG,
76
+ className: ClassName.DRAG_ROW_CONTROLS,
77
77
  style: {
78
78
  gridTemplateRows: heights
79
79
  },
80
80
  onMouseMove: handleMouseMove
81
- }, Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
81
+ }, !isResizing && rowsParams.map(({
82
+ startIndex,
83
+ endIndex
84
+ }, index) => /*#__PURE__*/React.createElement("div", {
85
+ style: {
86
+ gridRow: `${index + 1} / span 1`
87
+ },
88
+ "data-start-index": startIndex,
89
+ "data-end-index": endIndex,
90
+ className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER,
91
+ contentEditable: false,
92
+ key: index
93
+ }, !hasHeaderRow && index === 0 && /*#__PURE__*/React.createElement("div", {
94
+ style: {
95
+ top: '0px',
96
+ left: "var(--ds-space-075, 6px)"
97
+ },
98
+ className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT
99
+ }), /*#__PURE__*/React.createElement("div", {
100
+ className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT
101
+ }))), !isResizing && Number.isFinite(rowIndex) && /*#__PURE__*/React.createElement("div", {
82
102
  style: {
83
103
  gridRow: gridRowPosition,
84
104
  display: 'flex',
85
105
  height: '100%',
86
106
  alignItems: 'center',
87
107
  justifyContent: 'center'
88
- }
108
+ },
109
+ "data-testid": "table-floating-row-drag-handle"
89
110
  }, /*#__PURE__*/React.createElement(DragHandle, {
90
111
  tableLocalId: (_tableNode$attrs$loca = tableNode === null || tableNode === void 0 ? void 0 : (_tableNode$attrs = tableNode.attrs) === null || _tableNode$attrs === void 0 ? void 0 : _tableNode$attrs.localId) !== null && _tableNode$attrs$loca !== void 0 ? _tableNode$attrs$loca : '',
91
112
  indexes: [rowIndex],
@@ -144,6 +144,8 @@ export default class TableFloatingControls extends Component {
144
144
  editorView: editorView,
145
145
  tableActive: tableActive,
146
146
  isInDanger: isInDanger,
147
+ isResizing: isResizing,
148
+ hasHeaderRow: hasHeaderRow,
147
149
  hoverRows: this.hoverRows,
148
150
  selectRow: this.selectRow,
149
151
  updateCellHoverLocation: this.updateCellHoverLocation